fix: abi encode custom params#1108
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
WalkthroughReplace JSON-serialized custom parameters with ABI-encoded tuple (token_address, balance_threshold); parse balance_threshold as Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
examples/CRISP/server/src/cli/commands.rs(2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2024-11-05T06:48:58.177Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 173
File: packages/ciphernode/config/src/app_config.rs:13-21
Timestamp: 2024-11-05T06:48:58.177Z
Learning: In the `packages/ciphernode/config/src/app_config.rs` file, for the `Contract` enum, the team prefers to use `String` type for `address` fields, relying on parsing to handle validation, instead of using the `Address` type.
Applied to files:
examples/CRISP/server/src/cli/commands.rs
📚 Learning: 2024-09-26T03:11:29.311Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 107
File: packages/ciphernode/sortition/src/distance.rs:1-1
Timestamp: 2024-09-26T03:11:29.311Z
Learning: In `packages/ciphernode/core/src/events.rs`, the import statements use the correct and updated `alloy::primitives` module.
Applied to files:
examples/CRISP/server/src/cli/commands.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
- GitHub Check: build_sdk
- GitHub Check: build_e3_support_dev
- GitHub Check: test_net
- GitHub Check: integration_prebuild
- GitHub Check: rust_integration
- GitHub Check: test_contracts
- GitHub Check: build_enclave_cli
- GitHub Check: rust_unit
- GitHub Check: build_ciphernode_image
- GitHub Check: crisp_unit
- GitHub Check: Build & Push Image
🔇 Additional comments (2)
examples/CRISP/server/src/cli/commands.rs (2)
17-17: LGTM! Import addition is correct.The
SolValuetrait import is necessary for the ABI encoding functionality used on line 104.
101-101: LGTM! Correct type conversion to U256.The change from
BigUinttoU256withfrom_str_radixis appropriate for Solidity contract compatibility. The method correctly parses decimal strings and propagates errors for invalid input.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
examples/CRISP/server/src/cli/commands.rs (1)
101-101: Redundant borrow on&strparameter.Since
balance_thresholdis already&str, the extra&is unnecessary—from_str_radixwill accept it directly.- let balance_threshold = U256::from_str_radix(&balance_threshold, 10)?; + let balance_threshold = U256::from_str_radix(balance_threshold, 10)?;
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
examples/CRISP/server/src/cli/commands.rs(2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-11-05T06:48:58.177Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 173
File: packages/ciphernode/config/src/app_config.rs:13-21
Timestamp: 2024-11-05T06:48:58.177Z
Learning: In the `packages/ciphernode/config/src/app_config.rs` file, for the `Contract` enum, the team prefers to use `String` type for `address` fields, relying on parsing to handle validation, instead of using the `Address` type.
Applied to files:
examples/CRISP/server/src/cli/commands.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: build_enclave_cli
- GitHub Check: build_sdk
- GitHub Check: crisp_unit
- GitHub Check: rust_integration
- GitHub Check: integration_prebuild
- GitHub Check: test_net
- GitHub Check: rust_unit
- GitHub Check: test_contracts
- GitHub Check: Build & Push Image
🔇 Additional comments (1)
examples/CRISP/server/src/cli/commands.rs (1)
17-17: LGTM!Import correctly added to support the
abi_encode()method used for tuple encoding on line 104.
cbfcc3b to
39d4b0c
Compare
39d4b0c to
312885b
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
examples/CRISP/server/src/server/routes/rounds.rs (1)
186-186: Minor nit: Unnecessary reference operator.
balance_thresholdis already&str, so&balance_thresholdcreates&&str. While this works due to auto-deref, you can simplify:- let balance_threshold = U256::from_str_radix(&balance_threshold, 10)?; + let balance_threshold = U256::from_str_radix(balance_threshold, 10)?;
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
examples/CRISP/server/src/cli/commands.rs(2 hunks)examples/CRISP/server/src/server/routes/rounds.rs(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- examples/CRISP/server/src/cli/commands.rs
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2024-09-26T03:11:29.311Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 107
File: packages/ciphernode/sortition/src/distance.rs:1-1
Timestamp: 2024-09-26T03:11:29.311Z
Learning: In `packages/ciphernode/core/src/events.rs`, the import statements use the correct and updated `alloy::primitives` module.
Applied to files:
examples/CRISP/server/src/server/routes/rounds.rs
📚 Learning: 2024-10-29T00:05:52.278Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 156
File: packages/ciphernode/config/src/app_config.rs:133-144
Timestamp: 2024-10-29T00:05:52.278Z
Learning: In the `load_config` function in `packages/ciphernode/config/src/app_config.rs`, Figment ensures correct types for the final configuration from defaults, reducing the need for additional validation after loading.
Applied to files:
examples/CRISP/server/src/server/routes/rounds.rs
🧬 Code graph analysis (1)
examples/CRISP/server/src/server/routes/rounds.rs (1)
packages/enclave-sdk/src/utils.ts (1)
ComputeProviderParams(81-85)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: crisp_unit
- GitHub Check: test_net
- GitHub Check: build_enclave_cli
- GitHub Check: rust_integration
- GitHub Check: build_sdk
- GitHub Check: integration_prebuild
- GitHub Check: rust_unit
- GitHub Check: build_e3_support_dev
🔇 Additional comments (3)
examples/CRISP/server/src/server/routes/rounds.rs (3)
14-15: LGTM!The
SolValueimport is correctly added to support ABI encoding of the tuple via the.abi_encode()method.
185-189: Clean type conversion and encoding flow.The variable shadowing pattern for parsing
token_addresstoAddressandbalance_thresholdtoU256, followed by ABI encoding, is idiomatic and addresses the linked issue #1107.
188-189:and
fix #1107
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.