Skip to content

fix: abi encode custom params#1108

Merged
ctrlc03 merged 2 commits into
mainfrom
fix/cli-init
Dec 16, 2025
Merged

fix: abi encode custom params#1108
ctrlc03 merged 2 commits into
mainfrom
fix/cli-init

Conversation

@ctrlc03

@ctrlc03 ctrlc03 commented Dec 14, 2025

Copy link
Copy Markdown
Collaborator

fix #1107

Summary by CodeRabbit

  • Refactor
    • Contract call parameters are now encoded consistently, improving reliability of interactions.
    • Numeric threshold parsing tightened to reduce failures when submitting thresholds.
    • Public parameter surface simplified by removing legacy exports to align with the new encoding approach.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel

vercel Bot commented Dec 14, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Review Updated (UTC)
crisp Skipped Skipped Dec 16, 2025 11:38am
enclave-docs Skipped Skipped Dec 16, 2025 11:38am

@coderabbitai

coderabbitai Bot commented Dec 14, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Replace JSON-serialized custom parameters with ABI-encoded tuple (token_address, balance_threshold); parse balance_threshold as U256 instead of BigUint; update imports and encoding in the CRISP CLI and rounds route to emit ABI-encoded custom_params_bytes.

Changes

Cohort / File(s) Change Summary
CRISP CLI parameter encoding
examples/CRISP/server/src/cli/commands.rs
Removed CustomParams and its serde JSON usage; parse balance_threshold as U256; produce custom_params_bytes via abi_encode((token_address, balance_threshold)); added SolValue import; removed BigUint and BfvParamSets imports; adjusted error handling.
Rounds route encoding update
examples/CRISP/server/src/server/routes/rounds.rs
Stop re-exporting CustomParams; replace JSON serialization with abi_encode((token_address, balance_threshold)); parse threshold into U256 using from_str_radix; removed BigUint import and updated related parsing/error flow.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify ABI tuple types/order match the on-chain contract ABI and decoding expectations.
  • Inspect U256::from_str_radix usage for overflow/invalid input handling and error messages.
  • Confirm no remaining references to removed types/imports (e.g., CustomParams, BigUint, BfvParamSets) in nearby modules or tests.
  • Check callers/consumers (E3 request handler, contract decoder) accept the new custom_params_bytes format.

Poem

🐇 I nibble bytes beneath the moon,
Token hops and thresholds tune.
JSON crumbs I leave no more,
ABI gardens at my door. 🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically identifies the main change: implementing ABI encoding for custom parameters, which directly addresses the PR's core objective.
Linked Issues check ✅ Passed The PR successfully implements ABI encoding for custom parameters (token_address and balance_threshold) across both CLI and routes modules, directly addressing issue #1107's requirement.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing ABI encoding for custom parameters; removal of CustomParams and BigUint imports supports the encoding refactor and are in-scope.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/cli-init

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ca8f01d and f9114f1.

📒 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 SolValue trait import is necessary for the ABI encoding functionality used on line 104.


101-101: LGTM! Correct type conversion to U256.

The change from BigUint to U256 with from_str_radix is appropriate for Solidity contract compatibility. The method correctly parses decimal strings and propagates errors for invalid input.

Comment thread examples/CRISP/server/src/cli/commands.rs
@ctrlc03 ctrlc03 requested review from 0xjei and cedoor December 15, 2025 08:45
@vercel vercel Bot temporarily deployed to Preview – enclave-docs December 16, 2025 09:19 Inactive
@vercel vercel Bot temporarily deployed to Preview – crisp December 16, 2025 09:19 Inactive
cedoor
cedoor previously approved these changes Dec 16, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
examples/CRISP/server/src/cli/commands.rs (1)

101-101: Redundant borrow on &str parameter.

Since balance_threshold is already &str, the extra & is unnecessary—from_str_radix will 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

📥 Commits

Reviewing files that changed from the base of the PR and between f9114f1 and b55402f.

📒 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.

Comment thread examples/CRISP/server/src/cli/commands.rs
@vercel vercel Bot temporarily deployed to Preview – crisp December 16, 2025 09:37 Inactive
@vercel vercel Bot temporarily deployed to Preview – enclave-docs December 16, 2025 09:37 Inactive
@vercel vercel Bot temporarily deployed to Preview – enclave-docs December 16, 2025 10:02 Inactive
@vercel vercel Bot temporarily deployed to Preview – crisp December 16, 2025 10:02 Inactive
@vercel vercel Bot temporarily deployed to Preview – enclave-docs December 16, 2025 11:25 Inactive
@vercel vercel Bot temporarily deployed to Preview – crisp December 16, 2025 11:25 Inactive
@ctrlc03 ctrlc03 requested a review from cedoor December 16, 2025 11:27
@ctrlc03 ctrlc03 enabled auto-merge (squash) December 16, 2025 11:36
@vercel vercel Bot temporarily deployed to Preview – crisp December 16, 2025 11:38 Inactive
@vercel vercel Bot temporarily deployed to Preview – enclave-docs December 16, 2025 11:38 Inactive

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
examples/CRISP/server/src/server/routes/rounds.rs (1)

186-186: Minor nit: Unnecessary reference operator.

balance_threshold is already &str, so &balance_threshold creates &&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

📥 Commits

Reviewing files that changed from the base of the PR and between 39d4b0c and 312885b.

📒 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 SolValue import 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_address to Address and balance_threshold to U256, followed by ABI encoding, is idiomatic and addresses the linked issue #1107.


188-189: and

@ctrlc03 ctrlc03 merged commit 3b81758 into main Dec 16, 2025
25 of 26 checks passed
@github-actions github-actions Bot deleted the fix/cli-init branch December 24, 2025 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CRISP cli correctly encode custom params

3 participants