-
Notifications
You must be signed in to change notification settings - Fork 97
Migrate ethers-rs
to alloy-rs
#7079
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 WalkthroughWalkthroughThis change migrates the codebase from the deprecated Changes
Sequence Diagram(s)sequenceDiagram
participant App
participant ChainTypes
participant AlloyProvider
participant AlloyContract
participant EthereumNode
App->>ChainTypes: Construct TransactionRequest / Call contract
ChainTypes->>AlloyProvider: Send TransactionRequest
AlloyProvider->>EthereumNode: JSON-RPC call (sendTransaction, call, etc.)
EthereumNode-->>AlloyProvider: JSON-RPC response (tx hash, receipt, data)
AlloyProvider-->>ChainTypes: Result (tx hash, contract call result)
ChainTypes-->>App: Result (tx hash, contract call result)
sequenceDiagram
participant Indexer
participant AlloyProvider
participant AlloyContract
participant EthereumNode
Indexer->>AlloyProvider: stream_logs(Filter)
AlloyProvider->>EthereumNode: JSON-RPC call (eth_getLogs)
EthereumNode-->>AlloyProvider: Logs
AlloyProvider-->>Indexer: Logs
Indexer->>AlloyContract: Decode logs using SolEventInterface
AlloyContract-->>Indexer: Typed Events
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. Note ⚡️ Faster reviews with cachingCodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
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)
.github/workflows/check-bindings.yaml (1)
49-52
: Optimize the bindings generation step.
Currentlynix develop -c
loads the full development shell, which rebuilds most of the workspace and prolongs CI. You can:
- Add
-L
to lock the flake and avoid unnecessary rebuilds:- nix develop -c forge bind ... + nix develop -L -c forge bind ...- Or install Foundry via a dedicated action (e.g.,
foundry-rs/foundry-action
) and invokeforge bind
directly, bypassing the heavy Nix environment.Either approach will significantly reduce CI time.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/check-bindings.yaml
(1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/check-bindings.yaml
14-14: label "self-hosted-hoprnet-big" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2025", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-24.04-arm", "ubuntu-22.04", "ubuntu-22.04-arm", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file
(runner-label)
🔇 Additional comments (2)
.github/workflows/check-bindings.yaml (2)
4-11
: Validate workflow triggers coverage.
The workflow fires on bothmerge_group
(withchecks_requested
) andpull_request
(synchronize
,ready_for_review
). Please confirm that your organization’s merge queue feature emitsmerge_group
events as expected and that these triggers cover all desired scenarios (e.g., PR updates, merge groups, main‐branch merges).
58-61
: Bindings diff check correctly implemented.
The use ofgit diff --exit-code
(instead of--cached
) now properly detects unstaged changes in generated bindings. This fulfills the prior recommendation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (1)
.github/workflows/check-bindings.yaml (1)
13-14
: Actionlint runner label configuration
Using the single custom labelself-hosted-hoprnet-big
may trigger actionlint validation errors because it’s not in the default label set. You can either whitelist it in youractionlint
config or split it into standard labels, for example:runs-on: [self-hosted, hoprnet-big]🧰 Tools
🪛 actionlint (1.7.7)
14-14: label "self-hosted-hoprnet-big" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2025", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-24.04-arm", "ubuntu-22.04", "ubuntu-22.04-arm", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file
(runner-label)
🧹 Nitpick comments (2)
.github/workflows/check-bindings.yaml (2)
23-24
: Address egress policy TODO
You’ve setegress-policy: audit
for now, with a TODO to switch toblock
later. To ensure this doesn’t slip off the radar, consider opening an issue or adding a reminder in your backlog to revisit and update this policy once sufficient audit data has been collected.Would you like me to create an issue to track changing the egress policy to
block
?
45-53
: Optimize Nix environment for faster CI
Thenix develop -c
invocation will load your full development environment, which can be heavier than needed for just runningforge bind
. This may be why the "check smart contract" job takes a long time. Consider defining a minimal devshell or flake that only includes the Forge binary (and its dependencies), or usenix run
if available, to significantly cut down CI startup and runtime.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/check-bindings.yaml
(1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/check-bindings.yaml
14-14: label "self-hosted-hoprnet-big" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2025", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-24.04-arm", "ubuntu-22.04", "ubuntu-22.04-arm", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file
(runner-label)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: hoprd / docker
- GitHub Check: hopli / docker
- GitHub Check: Docs / Rust docs
- GitHub Check: tests-smoke-hopli
- GitHub Check: tests-unit-nightly
- GitHub Check: Linter
- GitHub Check: zizmor
- GitHub Check: tests-unit
🔇 Additional comments (2)
.github/workflows/check-bindings.yaml (2)
4-11
: Verifymerge_group
trigger support
The workflow is configured to run on themerge_group
event withchecks_requested
, which is typically emitted by Mergify’s merge queues rather than GitHub Actions natively. Please confirm that your repository is set up to receive this event (e.g., via the Mergify GitHub App) and that the workflow is actually invoked when a merge group is updated.
54-63
: Diff check correctly identifies outdated bindings
You’ve correctly replacedgit diff --cached --exit-code
withgit diff --exit-code
, ensuring unstaged changes after binding generation are caught and the job fails if bindings are stale.
There was a problem hiding this comment.
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 (6)
.github/workflows/check-bindings.yaml (6)
4-11
: Includepull_request
opened
trigger
The workflow currently runs onsynchronize
andready_for_review
events, but not on initial PR creation or reopens. Withoutopened
/reopened
, binding checks won’t run when a PR is first submitted or reopened from draft. Update to:on: pull_request: types: [opened, reopened, synchronize, ready_for_review]
49-51
: Optimize Nix shell invocation for performance
Usingnix develop -c
can load or rebuild the full flake environment each run. Adding the-L
flag reuses existing development shells and speeds up CI:- nix develop -c \ + nix develop -L -c \
24-24
: Remove or resolve the TODO
TheTODO
notes switchingegress-policy
toblock
after a trial. If it's time to enforce stricter egress controls, update it now; otherwise, consider tracking this work as an issue to avoid stale comments.
45-54
: Externalize the--select
regex for maintainability
The long inline regex forforge bind --select
is hard to read and update. You could move the contract list into an environment variable or file:env: SELECT_MODULES: | HoprAnnouncements|HoprAnnouncementsEvents|HoprCapabilityPermissions|... ... forge bind --select "^(${SELECT_MODULES})$"This makes it easier to add/remove modules.
2-3
: Use a more descriptive workflow name
Renamingname: Check
to something likeCheck Smart Contract Bindings
improves clarity when viewing workflows in GitHub Actions.
55-63
: Fail early on binding generation errors
Currently, a failingforge bind
won’t stop the job until the diff check. Consider addingset -o pipefail
or explicit error handling to report binding generation failures immediately:+ set -o pipefail rm -rf ./ethereum/bindings/src/codegen && cd ./ethereum/contracts && \ - nix develop -c forge bind ... + nix develop -c forge bind ... || { + echo "::error::Binding generation failed." + exit 1 + }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/check-bindings.yaml
(1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/check-bindings.yaml
14-14: label "self-hosted-hoprnet-big" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2025", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-24.04-arm", "ubuntu-22.04", "ubuntu-22.04-arm", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file
(runner-label)
⏰ Context from checks skipped due to timeout of 90000ms (6)
- GitHub Check: hoprd / docker
- GitHub Check: tests-smoke-hopli
- GitHub Check: tests-unit-nightly
- GitHub Check: tests-unit
- GitHub Check: Linter
- GitHub Check: zizmor
🔇 Additional comments (1)
.github/workflows/check-bindings.yaml (1)
20-24
: Verify Nix installation works with sudo disabled
You disable sudo in the "Harden Runner" step (disable-sudo: true
). The subsequentcachix/install-nix-action
might require privilege escalation. Please confirm that Nix installs successfully under these restrictions or adjust the hardening order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (1)
.github/workflows/check-bindings.yaml (1)
14-14
: Split custom runner label into standard labels
The runner labelself-hosted-hoprnet-big
is not recognized byactionlint
and may trigger validation errors. Please split it into an array of standard labels, for example:runs-on: [self-hosted, hoprnet-big]Alternatively, whitelist
self-hosted-hoprnet-big
in youractionlint
configuration.🧰 Tools
🪛 actionlint (1.7.7)
14-14: label "self-hosted-hoprnet-big" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2025", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-24.04-arm", "ubuntu-22.04", "ubuntu-22.04-arm", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file
(runner-label)
🧹 Nitpick comments (2)
.github/workflows/check-bindings.yaml (2)
23-24
: Track the pending egress-policy change
The comment notes switchingegress-policy
toblock
after a trial period. Consider opening an issue or scheduling a reminder to revisit this TODO so the runner is fully locked down when ready.
49-54
: Reduce maintenance overhead of the--select
pattern
The hard-coded regex list of modules in--select
is lengthy and error-prone. To avoid manual updates whenever contracts change, consider:
- Dynamically generating the list from the contracts directory.
- Using a broader pattern (e.g.,
^Hopr.*
) if safe.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/check-bindings.yaml
(1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/check-bindings.yaml
14-14: label "self-hosted-hoprnet-big" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2025", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-24.04-arm", "ubuntu-22.04", "ubuntu-22.04-arm", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file
(runner-label)
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: tests-unit-nightly
- GitHub Check: tests-unit
- GitHub Check: tests-smoke-hopli
- GitHub Check: zizmor
- GitHub Check: Linter
- GitHub Check: smart-contract-bindings
- GitHub Check: Cargo Audit
🔇 Additional comments (3)
.github/workflows/check-bindings.yaml (3)
4-11
: Confirm support for themerge_group
event
This workflow is configured to trigger on themerge_group
event, which is still in beta/alpha on GitHub. Verify that your organization has enabled this event type, and consider adding a fallback trigger (e.g.,push
to the default branch) to avoid missed binding checks.
50-51
: Verify Nix develop invocation flags
Thenix develop -c
invocation builds the developer environment. If you need lockfile reproducibility or to avoid unexpected rebuilds, confirm whether flags like-L
(for legacy lockfile behavior) or--impure
are required, or if the current setup suffices.
59-62
: Approve updated diff check for generated bindings
Switching fromgit diff --cached --exit-code
togit diff --exit-code
correctly detects any unstaged changes in the working tree and ensures outdated bindings fail the check.
Remove deprecated ethers-rs and migrate to alloy-rs
Closes #6722