Skip to content

chore: retry activate on crisp server#1171

Merged
ctrlc03 merged 6 commits into
mainfrom
chore/retry-activate-crisp
Jan 17, 2026
Merged

chore: retry activate on crisp server#1171
ctrlc03 merged 6 commits into
mainfrom
chore/retry-activate-crisp

Conversation

@ctrlc03

@ctrlc03 ctrlc03 commented Jan 16, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Exposed a retry-enabled transaction send API at the crate root to improve on-chain reliability.
    • Activation and related flows now use the retry-enabled send behavior.
  • Refactor

    • Standardized retry behavior and renamed retry constants for clearer operation.
    • Unified error mapping across server paths for more consistent error handling.
    • Minor formatting and import reorganizations across example server code.
  • Chores

    • Updated workspace dependency declarations.

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

@ctrlc03 ctrlc03 requested a review from hmzakhalid January 16, 2026 16:01
@vercel

vercel Bot commented Jan 16, 2026

Copy link
Copy Markdown

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

Project Deployment Review Updated (UTC)
crisp Ready Ready Preview, Comment Jan 17, 2026 5:58pm
enclave-docs Ready Ready Preview, Comment Jan 17, 2026 5:58pm

Request Review

@coderabbitai

coderabbitai Bot commented Jan 16, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Added a crate-root re-export of send_tx_with_retry; refactored retry helper to use e3_utils::retry_with_backoff and anyhow::Result; added workspace dependencies; integrated retry-wrapped calls into CRISP server indexer flows; remaining edits are formatting only.

Changes

Cohort / File(s) Summary
Retry helper refactor
crates/evm-helpers/src/retry.rs
Replaced manual retry loop with e3_utils::retry_with_backoff; renamed constants (READ_RETRY_*RETRY_*); changed call_with_retry signature to return anyhow::Result<T> and renamed read_fnoperation_fn; added use e3_utils::{retry_with_backoff, RetryError} and mapped errors to RetryError.
Send-tx export
crates/evm/src/lib.rs
Re-exported helpers::send_tx_with_retry at crate root (pub use helpers::send_tx_with_retry;).
Crate deps
crates/evm-helpers/Cargo.toml
Added workspace dependencies: anyhow.workspace = true and e3-utils.workspace = true.
CRISP server integration
examples/CRISP/server/src/server/indexer.rs
Replaced direct await/error paths for enclave activation and E3 retrieval with calls that wrap inner async operations in the retry/helper flow and map errors via anyhow/eyre.
Formatting & nonfunctional edits
examples/CRISP/server/src/server/repo.rs, .../routes/rounds.rs, .../routes/state.rs, .../token_holders/etherscan.rs
Import reflows, multi-line parameter formatting, trailing commas, and minor call-site reorganizations only; no behavioral changes.

Sequence Diagram(s)

sequenceDiagram
  participant Server as Server (CRISP indexer)
  participant Helper as evm_helpers::send_tx_with_retry
  participant Node as Blockchain Provider

  Server->>Helper: send_tx_with_retry("activate", args, async closure)
  Note right of Helper: closure sends transaction (calls provider)
  Helper->>Node: send_transaction(payload)
  alt transient error
    Node-->>Helper: transient error
    Helper->>Helper: backoff & retry (retry_with_backoff)
    Helper->>Node: send_transaction(payload) (retry)
  end
  Node-->>Helper: TransactionReceipt
  Helper-->>Server: TransactionReceipt or final error
  Server->>Server: log result / map errors to eyre
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • hmzakhalid

Poem

🐰 I hopped through lines both short and spry,
I nudged the tx to give retries a try,
Backoff bops and logs that softly chime,
I hop, I wait, I try one more time,
A tiny rabbit cheering: success—oh my!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore: retry activate on crisp server' accurately reflects the main changes, which involve adding retry logic to the activation path in the CRISP server via call_with_retry wrapper and refactoring error handling.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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

🤖 Fix all issues with AI agents
In `@examples/CRISP/server/src/server/token_holders/etherscan.rs`:
- Around line 449-453: Guard against underflow when computing
U256::from(block_number - 1) before calling token.getPastVotes: check
block_number and use a saturating decrement (e.g., compute let query_block = if
block_number == 0 { 0 } else { block_number - 1 }; or use
block_number.saturating_sub(1)) and then convert query_block to U256, and pass
that U256 to token.getPastVotes(voter_address, U256::from(query_block)). Ensure
this logic is applied where token.getPastVotes, voter_address, and block_number
are used so you never call getPastVotes with a wrapped/negative value.
📜 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 5e8df62 and 97ba82d.

⛔ Files ignored due to path filters (1)
  • examples/CRISP/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (8)
  • crates/evm/src/lib.rs
  • examples/CRISP/Cargo.toml
  • examples/CRISP/server/Cargo.toml
  • examples/CRISP/server/src/server/indexer.rs
  • examples/CRISP/server/src/server/repo.rs
  • examples/CRISP/server/src/server/routes/rounds.rs
  • examples/CRISP/server/src/server/routes/state.rs
  • examples/CRISP/server/src/server/token_holders/etherscan.rs
🧰 Additional context used
🧠 Learnings (9)
📓 Common learnings
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 145
File: packages/ciphernode/evm/src/enclave_sol_reader.rs:87-89
Timestamp: 2024-10-22T03:39:29.448Z
Learning: In the `ciphernode` project, specifically in `packages/ciphernode/evm/src/enclave_sol_reader.rs`, the method `EnclaveSolReader::attach` should be retained even if it directly calls `EvmEventReader::attach` without additional processing. Avoid suggesting its removal in future reviews.
Learnt from: ctrlc03
Repo: gnosisguild/enclave PR: 657
File: Cargo.toml:32-34
Timestamp: 2025-08-25T10:28:56.174Z
Learning: The examples/CRISP directory has its own Cargo.toml workspace configuration with members like "server", "wasm-crypto", "program/core", "program/client", etc. The root workspace intentionally excludes "examples/CRISP/server", "examples/CRISP/program", and "examples/CRISP/wasm-crypto" to prevent double workspace membership, which is the correct approach for self-contained example workspaces.
📚 Learning: 2024-10-22T03:39:29.448Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 145
File: packages/ciphernode/evm/src/enclave_sol_reader.rs:87-89
Timestamp: 2024-10-22T03:39:29.448Z
Learning: In the `ciphernode` project, specifically in `packages/ciphernode/evm/src/enclave_sol_reader.rs`, the method `EnclaveSolReader::attach` should be retained even if it directly calls `EvmEventReader::attach` without additional processing. Avoid suggesting its removal in future reviews.

Applied to files:

  • crates/evm/src/lib.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:

  • crates/evm/src/lib.rs
  • examples/CRISP/server/src/server/routes/rounds.rs
  • examples/CRISP/server/src/server/routes/state.rs
  • examples/CRISP/server/src/server/token_holders/etherscan.rs
📚 Learning: 2024-11-05T06:56:49.157Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 173
File: packages/ciphernode/enclave_node/src/aggregator.rs:0-0
Timestamp: 2024-11-05T06:56:49.157Z
Learning: `RegistryFilterSol` does not have a reader and does not require a repository reader or deploy block when calling `RegistryFilterSol::attach` in `packages/ciphernode/enclave_node/src/aggregator.rs`.

Applied to files:

  • crates/evm/src/lib.rs
📚 Learning: 2024-10-16T09:51:10.038Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 145
File: packages/ciphernode/router/src/committee_meta.rs:43-43
Timestamp: 2024-10-16T09:51:10.038Z
Learning: In `packages/ciphernode/router/src/committee_meta.rs`, avoid suggesting making the `on_event` method in `CommitteMetaFeature` asynchronous or adding error handling for the `write` operation to the data store.

Applied to files:

  • examples/CRISP/server/src/server/indexer.rs
📚 Learning: 2024-10-08T07:15:06.690Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 139
File: packages/ciphernode/evm/src/ciphernode_registry_sol.rs:133-143
Timestamp: 2024-10-08T07:15:06.690Z
Learning: In `packages/ciphernode/evm/src/ciphernode_registry_sol.rs`, the function `helpers::stream_from_evm` in Rust returns `()`, not a `Result`, so error handling with `if let Err(e) = ...` is not applicable.

Applied to files:

  • examples/CRISP/server/src/server/indexer.rs
📚 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/server/routes/state.rs
📚 Learning: 2025-08-25T10:28:56.174Z
Learnt from: ctrlc03
Repo: gnosisguild/enclave PR: 657
File: Cargo.toml:32-34
Timestamp: 2025-08-25T10:28:56.174Z
Learning: The examples/CRISP directory has its own Cargo.toml workspace configuration with members like "server", "wasm-crypto", "program/core", "program/client", etc. The root workspace intentionally excludes "examples/CRISP/server", "examples/CRISP/program", and "examples/CRISP/wasm-crypto" to prevent double workspace membership, which is the correct approach for self-contained example workspaces.

Applied to files:

  • examples/CRISP/server/Cargo.toml
  • examples/CRISP/Cargo.toml
📚 Learning: 2024-10-22T02:36:01.448Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 145
File: packages/ciphernode/data/Cargo.toml:0-0
Timestamp: 2024-10-22T02:36:01.448Z
Learning: In `packages/ciphernode/data/Cargo.toml`, `actix-rt` is only used in tests and should remain in `[dev-dependencies]`.

Applied to files:

  • examples/CRISP/server/Cargo.toml
  • examples/CRISP/Cargo.toml
🧬 Code graph analysis (3)
crates/evm/src/lib.rs (1)
crates/evm/src/helpers.rs (1)
  • send_tx_with_retry (240-278)
examples/CRISP/server/src/server/indexer.rs (1)
crates/evm/src/helpers.rs (1)
  • send_tx_with_retry (240-278)
examples/CRISP/server/src/server/routes/state.rs (1)
examples/CRISP/server/src/server/repo.rs (2)
  • store (38-40)
  • store (116-118)
⏰ 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). (10)
  • GitHub Check: rust_integration
  • GitHub Check: build_crisp_sdk
  • GitHub Check: test_net
  • GitHub Check: build_ciphernode_image
  • GitHub Check: build_sdk
  • GitHub Check: rust_unit
  • GitHub Check: build_enclave_cli
  • GitHub Check: build_e3_support_dev
  • GitHub Check: integration_prebuild
  • GitHub Check: Build & Push Image
🔇 Additional comments (9)
crates/evm/src/lib.rs (1)

25-25: Clean crate-root re-export.
This makes the helper easier to consume without exposing internal module paths.

examples/CRISP/server/Cargo.toml (1)

48-48: Workspace dependency addition looks good.

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

10-12: Formatting-only change; behavior unchanged.

Also applies to: 88-91

examples/CRISP/server/src/server/token_holders/etherscan.rs (1)

7-13: Import reorg is clear and consistent.

examples/CRISP/server/src/server/indexer.rs (1)

19-19: Retry wrapper integration is clean and readable.

Also applies to: 379-392

examples/CRISP/server/src/server/repo.rs (1)

47-57: Formatting-only adjustments look good.
No functional changes detected in these edits.

Also applies to: 60-64, 186-186

examples/CRISP/server/src/server/routes/state.rs (2)

9-18: Import reflow is clean and consistent.
No behavior change here.


225-228: Signature formatting is fine.
No functional impact from the generic syntax cleanup.

examples/CRISP/Cargo.toml (1)

42-42: Local workspace dependency resolves correctly.
The crate at ../../crates/evm exists and is properly named e3-evm, matching the dependency specification.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment thread examples/CRISP/server/src/server/token_holders/etherscan.rs
Comment thread crates/evm-helpers/src/retry.rs Outdated
@ctrlc03 ctrlc03 force-pushed the chore/retry-activate-crisp branch from 5a632c1 to b882822 Compare January 17, 2026 17:57
@ctrlc03 ctrlc03 disabled auto-merge January 17, 2026 21:43
@ctrlc03 ctrlc03 merged commit b19922b into main Jan 17, 2026
27 checks passed
@ctrlc03 ctrlc03 deleted the chore/retry-activate-crisp branch January 17, 2026 21:43
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.

2 participants