-
Notifications
You must be signed in to change notification settings - Fork 97
Migrate alloy to v1 #7171
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
Migrate alloy to v1 #7171
Conversation
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the 📝 Walkthrough## Walkthrough
This change upgrades the `alloy` dependency to version 1.0.4 and systematically refactors the codebase and generated contract bindings to align with the new stable v1 API. It simplifies generics, removes redundant tuple field accesses, updates method names, enhances serialization support, and adjusts ABI decoding and event interfaces throughout Rust and Solidity test code.
## Changes
| File(s) / Path(s) | Change Summary |
|--------------------------------------------------------------------------------------------------------|---------------|
| Cargo.toml, ethereum/bindings/Cargo.toml | Updated `alloy` to v1.0.4; enabled `serde` derive feature. |
| flake.nix, justfile | Updated foundry source repo/branch; changed forge bind flags; added smart-contract-test recipe. |
| chain/indexer/src/handlers.rs | Removed redundant boolean from event decoding calls. |
| chain/rpc/src/client.rs, hopli/src/environment_config.rs, hopr/hopr-lib/tests/common/mod.rs | Replaced `.on_client(rpc_client)` with `.connect_client(rpc_client)`. |
| chain/rpc/src/rpc.rs, hopli/src/methods.rs, chain/types/src/lib.rs, chain/types/src/utils.rs | Simplified generics (removed `()`/`T`), updated method calls, removed tuple field accesses, updated contract instance types. |
| ethereum/bindings/src/codegen/* (all contract/event files) | Regenerated for alloy v1: removed transport generic, added serialization derives, changed event/call decoding signatures, simplified return types and ABI decoding, improved error/event struct definitions. |
| chain/actions/src/payload.rs, hopli/src/win_prob.rs, hopr/hopr-lib/tests/chain_integration_tests.rs | Removed unnecessary tuple field accesses after contract calls. |
| ethereum/contracts/test/Channels.t.sol, ethereum/contracts/test/node-stake/NodeSafeRegistry.t.sol | Changed fuzz test parameter types from `uint256` to `uint64` for chain ID, adjusted bounds. |
| ethereum/contracts/test/static/stake/HoprStakeBase.t.sol | Reduced upper bound for elapsed time in tests. |
| ethereum/contracts/Makefile, Makefile | Added comment about Foundry issue; updated test filters to exclude domain separator tests. |
## Sequence Diagram(s)
```mermaid
sequenceDiagram
participant App as Application/CLI
participant Provider as Alloy Provider
participant Contract as Contract Binding
participant RPC as RPC Client
App->>Provider: connect_client(rpc_client)
Provider->>RPC: Send JSON-RPC requests
App->>Contract: Call contract method (no redundant generics)
Contract->>Provider: Use alloy v1 API
Contract->>App: Return decoded result (no tuple destructuring) Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
|
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.
Pull Request Overview
This PR upgrades the crate to use Alloy v1, updating both manual and generated code to match the new provider APIs and serialization requirements.
- Replace deprecated
.on_client
calls with.connect_client
in environment setup - Regenerate all contract bindings to use the new
Provider<N>
generic form and addserde
derives - Adjust utility and RPC helper signatures by removing the old
Transport
type parameter and updating serialization/bytes conversions
Reviewed Changes
Copilot reviewed 38 out of 39 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
hopli/src/environment_config.rs | Swapped .on_client for .connect_client to match the new Alloy provider API |
ethereum/bindings/src/codegen/* | Regenerated codegen to remove Transport type, add serde::{Serialize,Deserialize} and rename conversion methods |
ethereum/bindings/Cargo.toml | Added serde = { features = ["derive"] } so generated code can use derive macros |
chain/types/src/utils.rs | Removed the unused T generic from helper functions signatures |
chain/rpc/src/rpc.rs | Updated RPC imports, removed . _0 unwraps, and adapted byte conversions for U56/U256 |
Files not reviewed (1)
- flake.nix: Language not supported
Comments suppressed due to low confidence (4)
chain/rpc/src/rpc.rs:207
- Calling
.to_be_bytes_vec()
allocates a newVec<u8>
. Use.to_be_bytes()
(fixed-size array) or borrow the underlying bytes to avoid unnecessary heap allocations.
Ok(Balance::new(token_balance.to_be_bytes_vec(), BalanceType::HOPR))
chain/rpc/src/rpc.rs:16
- [nitpick] The nested
use alloy::{ rpc::{ ... }}
import style is harder to scan. Consider flattening or grouping imports consistently (e.g.use alloy::rpc::{client::RpcClient, types::{Block, TransactionRequest}};
) to match the surrounding code.
use alloy::{ rpc::{ client::RpcClient, types::{Block, TransactionRequest}, }, };
chain/types/src/utils.rs:69
- The doc comment above still references generic
<T, P, N>
, but the signature now omitsT
. Please update or remove outdated type parameters in the documentation so it matches the new signature.
pub async fn mint_tokens<P, N>(hopr_token: HoprTokenInstance<P, N>, amount: U256) -> ContractResult<Option<u64>>
ethereum/bindings/Cargo.toml:12
- The
derive
feature enablesSerialize
/Deserialize
, but ensure the workspace’sserde
version and features align with all generated code (which now uses#[derive(serde::Serialize, serde::Deserialize)]
).
serde = { workspace = true, features = ["derive"] }
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: 13
🔭 Outside diff range comments (5)
ethereum/bindings/src/codegen/hoprnodesaferegistryevents.rs (1)
98-116
: 🛠️ Refactor suggestionDeriving
Default
on event structs is potentially misleading
#[derive(Default)]
creates a zero-initialisedAddress
(0x000…
) forsafeAddress
/nodeAddress
, which is never a valid run-time value for these fields.
If downstream code (e.g. in tests) callsDergisteredNodeSafe::default()
the resulting value will be semantically invalid and could silently propagate.-#[derive(serde::Serialize, serde::Deserialize)] -#[derive(Default, Debug, PartialEq, Eq, Hash)] +#[derive(serde::Serialize, serde::Deserialize, Debug, PartialEq, Eq, Hash)]Consider implementing an explicit
impl Default
that panics, or drop the derive completely.ethereum/bindings/src/codegen/hoprledger.rs (1)
95-112
: 🛠️ Refactor suggestionSame
Default
concern on event structSee previous comment – defaulting a
FixedBytes<32>
domain separator to0x00…
is unlikely to be meaningful.
Dropping the derive avoids accidental misuse.ethereum/bindings/src/codegen/hoprnodestakefactoryevents.rs (1)
78-96
: 🛠️ Refactor suggestion
Default
derive again – risk of invalid placeholder addressesAs with the other bindings, generating a zero address for
moduleImplementation
/instance
invites accidental misuse.
Recommend droppingDefault
or replacing it with an implementation that deliberately panics (unreachable!()
).ethereum/bindings/src/codegen/hoprdummyproxyfornetworkregistry.rs (1)
2645-2690
:⚠️ Potential issueSelector arrays must be sorted for
binary_search
binary_search
assumes the slice is sorted; if the order of
SELECTORS
changes during code-gen the lookup can return an invalid index,
triggering the wrong decode shim or a panic.Add a post-generation sort or switch to a map-based lookup (e.g.
phf
) to make
the code resilient to ordering issues.Also applies to: 2839-2854, 2856-2864
ethereum/bindings/src/codegen/hoprwinningprobabilityoracle.rs (1)
263-268
:⚠️ Potential issueCompile-time failure – invalid
NAME
constant syntax
stringify!(@ name)
is not legal Rust syntax – the@
token is invalid outside of the experimental macro system.
The file will fail to compile at this line, breaking every downstream crate that depends on these bindings.- /// The Solidity type name. - pub const NAME: &'static str = stringify!(@ name); + /// Solidity type name – hard-code because code-gen failed to inject it. + pub const NAME: &'static str = "WinProb";If the value needs to stay in sync with Solidity, please have the code-generator emit the proper identifier instead of the bogus placeholder.
♻️ Duplicate comments (2)
chain/rpc/src/client.rs (1)
905-906
: Same mechanical replacement duplicated throughout the test suiteAll these lines repeat the exact pattern verified in the previous comment (replace
.on_client
with.connect_client
). The earlier assessment therefore applies unchanged.Also applies to: 934-935, 967-968, 999-1000, 1030-1030, 1075-1076, 1111-1112, 1165-1166, 1200-1201, 1275-1276, 1331-1332, 1439-1440, 1496-1497
ethereum/bindings/src/codegen/hoprnodestakefactoryevents.rs (1)
195-210
: Consistency: duplicate of previous remarkSame
Default
concern applies toNewHoprNodeStakeSafe
.
🧹 Nitpick comments (19)
chain/rpc/src/rpc.rs (2)
218-220
: Unnecessary allocation when copying win-probability bytes
to_be_bytes_vec()
allocates, thencopy_from_slice
copies into a fixed array. You can avoid the allocation entirely:-let mut encoded: EncodedWinProb = Default::default(); -encoded.copy_from_slice(&encoded_win_prob.to_be_bytes_vec()); +let encoded: EncodedWinProb = encoded_win_prob.to_be_bytes();This removes one heap allocation and one copy.
227-228
: Minor style: use existing Balance::new helper consistentlyYou already call
BalanceType::HOPR.balance(...)
which internally constructsBalance
. That’s fine, but to stay DRY you could reuse the helper for the native branch as well (lines 199-206).ethereum/bindings/src/codegen/hoprchannelsevents.rs (1)
524-532
: Cloning the provider may be expensive – expose anArc
helper?
with_cloned_provider
deep-clones the provider every time it is called.
For providers backed by heavy state (HTTP pools, signer caches, etc.) this can incur unnecessary allocations.Consider an ergonomic helper that wraps the provider in
Arc<P>
once and reuses cheapArc::clone
calls:-pub fn with_cloned_provider(self) -> HoprChannelsInstance<P, N> { +pub fn with_arc_provider(self) -> HoprChannelsInstance<alloc::sync::Arc<P>, N> { + use alloc::sync::Arc; HoprChannelsInstance { address: self.address, - provider: ::core::clone::Clone::clone(&self.provider), + provider: Arc::new(self.provider.clone()), _network: ::core::marker::PhantomData, } }Not blocking, but worth considering for high-throughput applications.
ethereum/bindings/src/codegen/hoprnetworkregistryevents.rs (2)
172-190
:Default
derive on event structs can create invalid statesEvery event struct (
Deregistered
,Registered
, …) now derivesDefault
.
The synthesized value contains zeroedAddress
es andfalse
booleans, which can never appear on-chain and may be misleading if accidentally used in production code.If
Default
is not strictly required, drop the derive; otherwise create a custom implementation that panics or returnsNone
to avoid accidental misuse.-#[derive(serde::Serialize, serde::Deserialize)] -#[derive(Default, Debug, PartialEq, Eq, Hash)] +#[derive(serde::Serialize, serde::Deserialize, Debug, PartialEq, Eq, Hash)]Same remark applies to every event struct in this file.
1330-1335
:with_cloned_provider
emits a full clone – preferArc
patternSame remark as for
hoprchannelsevents.rs
: cloning a provider with internal connection pools can be heavy.
Offering anArc
-based helper (or documenting thatP
should usually be anArc<ProviderImpl>
) can save resources.ethereum/bindings/src/codegen/hoprledger.rs (3)
208-225
:Default
on zero-parameter call structs adds little value
LEDGER_VERSIONCall
/ledgerDomainSeparatorCall
/updateLedgerDomainSeparatorCall
are unit-like; the implicitDefault
is identical toSelf {}
/Self
.
Consider dropping#[derive(Default)]
to keep the generated code minimal (compile time + binary size).
642-646
: Empty derive list triggers an unnecessary compiler warning
#[derive()]
with an empty list compiles but emitswarning: empty trait list
.
Simply remove the attribute:-#[derive(serde::Serialize, serde::Deserialize)] -#[derive()] +#[derive(serde::Serialize, serde::Deserialize)]
746-798
: ABI decode helpers – consider unifying validate / non-validate pathsGood call adding
abi_decode_raw_validate
, but the duplicate shim tables inflate code size.
You can DRY this up by:let decode = if validate { DECODE_VALIDATE_SHIMS[idx] } else { DECODE_SHIMS[idx] }; decode(data)Generated code will be ~50 % smaller while preserving behaviour.
ethereum/bindings/src/codegen/hoprwinningprobabilityoracleevents.rs (2)
110-116
: ConstantNAME
looks like a code-gen artefact
pub const NAME: &'static str = stringify!(@ name);
expands to"@ name"
at run time, which is probably not the intended Solidity type name ("WinProb"
).
Although purely cosmetic, this string may propagate to log/error messages or documentation helpers.- pub const NAME: &'static str = stringify!(@ name); + pub const NAME: &'static str = "WinProb";
66-71
: Consider derivingCopy
for the new-type wrapper
WinProb
is a zero-cost wrapper aroundU56
(itselfCopy
). Adding theCopy
derive will:
- eliminate the need for
clone()
in generic code,- keep semantics in line with the primitive it wraps.
- #[derive(serde::Serialize, serde::Deserialize)] - #[derive(Default, Debug, PartialEq, Eq, Hash)] + #[derive(serde::Serialize, serde::Deserialize, Copy, Clone, Default, Debug, PartialEq, Eq, Hash)]ethereum/bindings/src/codegen/hoprannouncementsevents.rs (2)
110-128
:Hash
derive onbaseMultiaddr: String
could bloat hashing costs
std::string::String
implementsHash
, but its hashing cost scales with the full byte length.
If you only need equality checks or serialization, you can dropHash
(or switch toBox<str>
/Arc<str>
if sharing is common).Not a blocker, just flagging in case the enum is used as a map key in hot paths.
581-588
: Reuse pattern matches for provider boundEvery instantiation function (
new
,deploy
,deploy_builder
) repeats the boundP: alloy_contract::private::Provider<N>, N: alloy_contract::private::Network,Code-gen can place a
where
-clause on the impl block instead; that removes repetition and shortens generated code.
Leaving this here in case you plan another generator pass.ethereum/bindings/src/codegen/hoprcrypto.rs (2)
62-71
: DeriveCopy
for unit errors
InvalidCurvePoint
,InvalidFieldElement
, andInvalidPointWitness
are unit structs.
DerivingCopy
(in addition toClone
) incurs no cost and avoids inadvertent moves:- #[derive(serde::Serialize, serde::Deserialize)] - #[derive(Default, Debug, PartialEq, Eq, Hash)] + #[derive(serde::Serialize, serde::Deserialize, Copy, Clone, Default, Debug, PartialEq, Eq, Hash)]Repeat for the other two error structs.
537-568
: Potentially remove_network
phantom whenN = Ethereum
The default type parameter already represents the canonical network.
If you never instantiate with a differentN
, code size can shrink (and readability improve) by dropping the extra generic and thePhantomData
.Not urgent—only worth it if binary size matters.
ethereum/bindings/src/codegen/hoprdummyproxyfornetworkregistry.rs (1)
923-951
: Boiler-plate for return handling can be DRY’ed up
tokenize_returns
,abi_decode_returns
, andabi_decode_returns_validate
implement identical logic for every single‐value return. Consider generating a
blanket helper/macro instead of repeating ~20 lines per function; this will:
- Reduce the generated code size by several hundred lines per binding.
- Speed up incremental compilation.
- Make the template easier to maintain.
Also applies to: 1087-1115, 1230-1258, 1386-1414, 1529-1557
ethereum/bindings/src/codegen/hoprannouncements.rs (1)
2095-2104
: RedundantmulticallReturn
struct – dead code & extra maintenance costAfter refactoring,
multicallCall::Return
is now a plainVec<Bytes>
.
The publicmulticallReturn
wrapper remains but is no longer used anywhere except as an intermediate inside the auto-generated decode helpers. Keeping an exported struct that is never intended to be constructed by users:
- inflates the public API surface,
- creates confusion between the “actual” return type and the unused wrapper,
- adds a (small) compile-time cost.
Unless another part of the codebase explicitly relies on
multicallReturn
, consider pruning it and decoding directly intoVec<Bytes>
.If you still need the wrapper internally, mark it
pub(crate)
or hide it with#[doc(hidden)]
to avoid exposing noise to downstream crates.Also applies to: 2169-2181
ethereum/bindings/src/codegen/hoprnodestakefactory.rs (3)
172-180
: Consolidate duplicatederive
attributes to improve readabilityEach struct currently has two consecutive
#[derive(...)]
attributes. Although perfectly legal, this adds noise to already-verbose generated code. Keeping all traits in a singlederive
keeps the file shorter and makes manual diff reviews easier.-#[derive(serde::Serialize, serde::Deserialize)] -#[derive(Default, Debug, PartialEq, Eq, Hash)] +#[derive( + Default, + Debug, + PartialEq, + Eq, + Hash, + serde::Serialize, + serde::Deserialize +)]
650-663
: Unused private helpercloneReturn::_tokenize
_tokenize
is only referenced once (insidetokenize_returns
) and merely forwards totokenize
on each element. Inlining that call removes ~10 lines and another hop on the call stack for every invocation:- fn _tokenize( - &self, - ) -> <cloneCall as alloy_sol_types::SolCall>::ReturnToken<'_> { - ( - <alloy::sol_types::sol_data::Address as alloy_sol_types::SolType>::tokenize( - &self._0, - ), - <alloy::sol_types::sol_data::Address as alloy_sol_types::SolType>::tokenize( - &self._1, - ), - ) - } + // helper dropped – call site below expanded inlineand later
- fn tokenize_returns(ret: &Self::Return) -> Self::ReturnToken<'_> { - cloneReturn::_tokenize(ret) + fn tokenize_returns(ret: &Self::Return) -> Self::ReturnToken<'_> { + ( + <alloy::sol_types::sol_data::Address as alloy_sol_types::SolType>::tokenize( + &ret._0, + ), + <alloy::sol_types::sol_data::Address as alloy_sol_types::SolType>::tokenize( + &ret._1, + ), + ) }Removing the dead helper keeps the generated file slimmer without sacrificing clarity.
1582-1590
:with_cloned_provider
may incur an expensive deep cloneCloning the provider blindly can be costly (e.g. cloning an HTTP client or signing middleware).
Consider constrainingP
toClone + CheapClone
(e.g.Arc
) or documenting that providers should be lightweight clones. Alternatively, returnSelf
holdingArc<P>
to guarantee cheap reference counting.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
Cargo.lock
is excluded by!**/*.lock
flake.lock
is excluded by!**/*.lock
📒 Files selected for processing (29)
.github/workflows/check-bindings.yaml
(1 hunks)Cargo.toml
(1 hunks)chain/indexer/src/handlers.rs
(1 hunks)chain/rpc/src/client.rs
(16 hunks)chain/rpc/src/rpc.rs
(11 hunks)chain/types/src/lib.rs
(2 hunks)chain/types/src/utils.rs
(10 hunks)ethereum/bindings/Cargo.toml
(1 hunks)ethereum/bindings/src/codegen/hoprannouncements.rs
(58 hunks)ethereum/bindings/src/codegen/hoprannouncementsevents.rs
(13 hunks)ethereum/bindings/src/codegen/hoprchannelsevents.rs
(31 hunks)ethereum/bindings/src/codegen/hoprcrypto.rs
(17 hunks)ethereum/bindings/src/codegen/hoprdummyproxyfornetworkregistry.rs
(50 hunks)ethereum/bindings/src/codegen/hoprledger.rs
(22 hunks)ethereum/bindings/src/codegen/hoprnetworkregistryevents.rs
(17 hunks)ethereum/bindings/src/codegen/hoprnodesaferegistry.rs
(64 hunks)ethereum/bindings/src/codegen/hoprnodesaferegistryevents.rs
(13 hunks)ethereum/bindings/src/codegen/hoprnodestakefactory.rs
(32 hunks)ethereum/bindings/src/codegen/hoprnodestakefactoryevents.rs
(12 hunks)ethereum/bindings/src/codegen/hoprticketpriceoracle.rs
(35 hunks)ethereum/bindings/src/codegen/hoprticketpriceoracleevents.rs
(11 hunks)ethereum/bindings/src/codegen/hoprwinningprobabilityoracle.rs
(42 hunks)ethereum/bindings/src/codegen/hoprwinningprobabilityoracleevents.rs
(14 hunks)flake.nix
(1 hunks)hopli/src/environment_config.rs
(2 hunks)hopli/src/methods.rs
(34 hunks)hopli/src/win_prob.rs
(1 hunks)hopr/hopr-lib/tests/common/mod.rs
(1 hunks)justfile
(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (6)
ethereum/bindings/src/codegen/hoprnodestakefactoryevents.rs (13)
ethereum/bindings/src/codegen/hoprannouncementsevents.rs (13)
address
(693-695)provider
(708-710)new
(156-164)new
(278-288)new
(397-402)new
(580-588)new
(656-665)with_cloned_provider
(715-721)call_builder
(733-738)event_filter
(750-754)event_filter
(759-759)event_filter
(763-763)event_filter
(769-769)ethereum/bindings/src/codegen/hoprcrypto.rs (10)
address
(596-598)provider
(611-613)new
(117-121)new
(190-194)new
(263-267)new
(488-496)new
(559-568)with_cloned_provider
(618-624)call_builder
(636-641)event_filter
(653-657)ethereum/bindings/src/codegen/hoprchannelsevents.rs (23)
address
(505-507)address
(1862-1864)provider
(520-522)provider
(1877-1879)new
(450-458)new
(493-502)new
(792-800)new
(910-918)new
(1026-1031)new
(1136-1144)with_cloned_provider
(527-533)with_cloned_provider
(1884-1890)call_builder
(545-550)call_builder
(1902-1907)event_filter
(562-566)event_filter
(1919-1923)event_filter
(1928-1928)event_filter
(1934-1934)event_filter
(1940-1940)event_filter
(1946-1946)event_filter
(1952-1952)event_filter
(1958-1958)event_filter
(1964-1964)ethereum/bindings/src/codegen/hoprannouncements.rs (6)
address
(3416-3418)provider
(3431-3433)with_cloned_provider
(3438-3444)call_builder
(3456-3461)event_filter
(3579-3583)event_filter
(3588-3588)ethereum/bindings/src/codegen/hoprcapabilitypermissions.rs (4)
address
(5297-5299)provider
(5312-5314)with_cloned_provider
(5319-5325)call_builder
(5337-5342)ethereum/bindings/src/codegen/hoprledger.rs (4)
address
(1028-1030)provider
(1043-1045)with_cloned_provider
(1050-1056)call_builder
(1068-1073)ethereum/bindings/src/codegen/hoprdummyproxyfornetworkregistry.rs (4)
address
(3434-3436)provider
(3449-3451)with_cloned_provider
(3456-3464)call_builder
(3476-3481)ethereum/bindings/src/codegen/hoprnetworkregistryevents.rs (4)
address
(1308-1310)provider
(1323-1325)with_cloned_provider
(1330-1336)call_builder
(1348-1353)ethereum/bindings/src/codegen/hoprboost.rs (4)
address
(8907-8909)provider
(8922-8924)with_cloned_provider
(8929-8935)call_builder
(8947-8952)ethereum/bindings/src/codegen/hoprnodesaferegistry.rs (4)
address
(3794-3796)provider
(3809-3811)with_cloned_provider
(3816-3822)call_builder
(3834-3839)ethereum/bindings/src/codegen/hoprnetworkregistry.rs (4)
address
(8986-8988)provider
(9001-9003)with_cloned_provider
(9008-9014)call_builder
(9026-9031)ethereum/bindings/src/codegen/hoprnodesaferegistryevents.rs (4)
address
(679-681)provider
(694-696)with_cloned_provider
(701-707)call_builder
(719-724)ethereum/bindings/src/codegen/hoprnodestakefactory.rs (9)
address
(1563-1565)provider
(1578-1580)clone
(1126-1131)clone
(1177-1184)clone
(1610-1625)with_cloned_provider
(1585-1591)call_builder
(1603-1608)NewHoprNodeStakeModule_filter
(1662-1666)NewHoprNodeStakeSafe_filter
(1668-1672)
ethereum/bindings/src/codegen/hoprnetworkregistryevents.rs (8)
ethereum/bindings/src/codegen/hoprannouncementsevents.rs (9)
address
(693-695)provider
(708-710)new
(156-164)new
(278-288)new
(397-402)new
(580-588)new
(656-665)with_cloned_provider
(715-721)call_builder
(733-738)ethereum/bindings/src/codegen/hoprcrypto.rs (9)
address
(596-598)provider
(611-613)new
(117-121)new
(190-194)new
(263-267)new
(488-496)new
(559-568)with_cloned_provider
(618-624)call_builder
(636-641)ethereum/bindings/src/codegen/hoprledger.rs (4)
address
(1028-1030)provider
(1043-1045)with_cloned_provider
(1050-1056)call_builder
(1068-1073)ethereum/bindings/src/codegen/hoprnodesaferegistry.rs (4)
address
(3794-3796)provider
(3809-3811)with_cloned_provider
(3816-3822)call_builder
(3834-3839)ethereum/bindings/src/codegen/hoprnetworkregistry.rs (4)
address
(8986-8988)provider
(9001-9003)with_cloned_provider
(9008-9014)call_builder
(9026-9031)ethereum/bindings/src/codegen/hoprnodesaferegistryevents.rs (4)
address
(679-681)provider
(694-696)with_cloned_provider
(701-707)call_builder
(719-724)ethereum/bindings/src/codegen/hoprnodestakefactoryevents.rs (4)
address
(513-515)provider
(528-530)with_cloned_provider
(535-541)call_builder
(553-558)ethereum/bindings/src/codegen/hoprchannels.rs (8)
address
(630-632)address
(13722-13724)provider
(645-647)provider
(13737-13739)with_cloned_provider
(652-658)with_cloned_provider
(13744-13750)call_builder
(670-675)call_builder
(13762-13767)
ethereum/bindings/src/codegen/hoprcrypto.rs (9)
ethereum/bindings/src/codegen/hoprchannels.rs (18)
InvalidCurvePoint
(12635-12642)InvalidCurvePoint
(12906-12913)InvalidFieldElement
(12580-12587)InvalidFieldElement
(12851-12858)InvalidPointWitness
(12776-12783)InvalidPointWitness
(13051-13058)selector
(11229-11319)selector
(12467-12539)address
(630-632)address
(13722-13724)provider
(645-647)provider
(13737-13739)fmt
(604-606)fmt
(13647-13649)with_cloned_provider
(652-658)with_cloned_provider
(13744-13750)call_builder
(670-675)call_builder
(13762-13767)ethereum/bindings/src/codegen/hoprcapabilitypermissions.rs (21)
abi_decode_raw_validate
(767-772)abi_decode_raw_validate
(840-845)abi_decode_raw_validate
(913-918)abi_decode_raw_validate
(986-991)abi_decode_raw_validate
(1061-1066)abi_decode_raw_validate
(1134-1139)abi_decode_raw_validate
(1209-1214)abi_decode_raw_validate
(1284-1289)abi_decode_raw_validate
(1357-1362)abi_decode_raw_validate
(1430-1435)selector
(3890-3914)selector
(4290-4344)address
(5297-5299)provider
(5312-5314)deploy
(5199-5208)deploy
(5276-5282)deploy_builder
(5215-5220)deploy_builder
(5289-5294)fmt
(5244-5248)with_cloned_provider
(5319-5325)call_builder
(5337-5342)ethereum/bindings/src/codegen/hoprledger.rs (10)
selector
(672-684)address
(1028-1030)provider
(1043-1045)deploy
(935-944)deploy
(1007-1013)deploy_builder
(951-956)deploy_builder
(1020-1025)fmt
(977-979)with_cloned_provider
(1050-1056)call_builder
(1068-1073)ethereum/bindings/src/codegen/hoprboost.rs (10)
selector
(7442-7527)address
(8907-8909)provider
(8922-8924)deploy
(8792-8803)deploy
(8870-8878)deploy_builder
(8810-8819)deploy_builder
(8885-8904)fmt
(8840-8842)with_cloned_provider
(8929-8935)call_builder
(8947-8952)ethereum/bindings/src/codegen/hoprnodesaferegistry.rs (7)
selector
(2803-2834)selector
(3258-3282)address
(3794-3796)provider
(3809-3811)fmt
(3743-3745)with_cloned_provider
(3816-3822)call_builder
(3834-3839)ethereum/bindings/src/codegen/hoprnodestakefactory.rs (10)
selector
(1075-1085)selector
(1260-1266)address
(1563-1565)provider
(1578-1580)fmt
(1512-1514)clone
(1126-1131)clone
(1177-1184)clone
(1610-1625)with_cloned_provider
(1585-1591)call_builder
(1603-1608)ethereum/bindings/src/codegen/hoprnetworkregistryevents.rs (9)
address
(1308-1310)provider
(1323-1325)deploy
(1210-1219)deploy
(1287-1293)deploy_builder
(1226-1231)deploy_builder
(1300-1305)fmt
(1255-1259)with_cloned_provider
(1330-1336)call_builder
(1348-1353)ethereum/bindings/src/codegen/hoprnodesaferegistryevents.rs (5)
address
(679-681)provider
(694-696)fmt
(626-630)with_cloned_provider
(701-707)call_builder
(719-724)ethereum/bindings/src/codegen/hoprnodestakefactoryevents.rs (5)
address
(513-515)provider
(528-530)fmt
(460-464)with_cloned_provider
(535-541)call_builder
(553-558)
chain/types/src/utils.rs (5)
common/primitive-types/src/primitives.rs (1)
amount
(207-209)chain/api/src/executors.rs (1)
fund_channel
(132-135)chain/actions/src/payload.rs (3)
fund_channel
(68-68)fund_channel
(199-220)fund_channel
(380-404)chain/actions/src/channels.rs (2)
fund_channel
(46-46)fund_channel
(122-162)chain/rpc/src/client.rs (8)
provider
(1001-1002)provider
(1031-1032)provider
(1077-1078)provider
(1113-1114)provider
(1167-1168)provider
(1221-1222)provider
(1277-1278)provider
(1333-1334)
ethereum/bindings/src/codegen/hoprnodesaferegistry.rs (1)
ethereum/bindings/src/codegen/hoprnodesaferegistryevents.rs (8)
address
(679-681)provider
(694-696)fmt
(626-630)with_cloned_provider
(701-707)call_builder
(719-724)DergisteredNodeSafe_filter
(742-746)DomainSeparatorUpdated_filter
(748-752)RegisteredNodeSafe_filter
(754-758)
ethereum/bindings/src/codegen/hoprwinningprobabilityoracle.rs (6)
ethereum/bindings/src/codegen/hoprwinningprobabilityoracleevents.rs (3)
from_underlying
(115-119)into_underlying
(122-126)WinProbUpdated_filter
(573-577)ethereum/bindings/src/codegen/hoprcrypto.rs (26)
from
(97-99)from
(104-106)from
(170-172)from
(177-179)from
(243-245)from
(250-252)abi_decode_raw_validate
(127-132)abi_decode_raw_validate
(200-205)abi_decode_raw_validate
(273-278)abi_decode_raw_validate
(388-438)new
(117-121)new
(190-194)new
(263-267)new
(488-496)new
(559-568)tokenize
(123-125)tokenize
(196-198)tokenize
(269-271)abi_decode_raw
(335-385)selector
(312-324)address
(596-598)provider
(611-613)fmt
(545-547)with_cloned_provider
(618-624)call_builder
(636-641)event_filter
(653-657)ethereum/bindings/src/codegen/hoprticketpriceoracle.rs (10)
renounceOwnership
(1451-1458)renounceOwnership
(1524-1531)renounceOwnership
(2098-2102)owner
(1462-1467)owner
(1535-1542)owner
(2094-2096)transferOwnership
(1482-1489)transferOwnership
(1557-1564)transferOwnership
(2115-2120)OwnershipTransferred_filter
(2138-2142)ethereum/bindings/src/codegen/hoprnetworkregistryevents.rs (5)
address
(1308-1310)provider
(1323-1325)fmt
(1255-1259)with_cloned_provider
(1330-1336)call_builder
(1348-1353)ethereum/bindings/src/codegen/hoprnodesaferegistryevents.rs (5)
address
(679-681)provider
(694-696)fmt
(626-630)with_cloned_provider
(701-707)call_builder
(719-724)ethereum/bindings/src/codegen/hoprnodestakefactoryevents.rs (5)
address
(513-515)provider
(528-530)fmt
(460-464)with_cloned_provider
(535-541)call_builder
(553-558)
🔇 Additional comments (52)
ethereum/bindings/Cargo.toml (1)
12-12
: Appropriate addition of serde derive featureAdding the
derive
feature to serde is necessary to support the serialization and deserialization derives that have been added throughout the regenerated contract bindings in this Alloy v1 migration.Cargo.toml (1)
50-50
: Correct version update for alloy dependencyUpdating to alloy 1.0.4 is essential for compatibility with Foundry's latest contract binding generation as mentioned in the PR objectives.
flake.nix (1)
12-12
: Foundry version pin updated for Alloy v1 compatibilityThis commit hash update for foundry.nix ensures compatibility with the upgraded Alloy v1.0.4 dependency.
.github/workflows/check-bindings.yaml (1)
52-53
: Binding generation flags appropriately updatedThe changes to binding generation flags align well with the Alloy v1 migration:
- Removing
--skip-extra-derives
allows the inclusion of serialization derives- Adding
--force
ensures complete regeneration of all bindings- Adding
--skip-cargo-toml
prevents automated changes to the manually updated Cargo.tomlThese changes ensure consistent regeneration of contract bindings with the latest Alloy version.
hopli/src/win_prob.rs (1)
110-113
: Simplified contract call return handlingThe updated code properly adapts to Alloy v1's API changes by removing the tuple field access that was previously needed, while also improving error handling with a more descriptive message.
hopli/src/environment_config.rs (2)
156-156
: Updated provider creation to use new Alloy v1 APIThe provider builder now uses
.connect_client(rpc_client)
instead of.on_client(rpc_client)
to match Alloy v1's updated API.
182-182
: Updated provider creation to use new Alloy v1 APIThe provider builder now uses
.connect_client(rpc_client)
instead of.on_client(rpc_client)
to match Alloy v1's updated API.chain/indexer/src/handlers.rs (8)
797-797
: Updated event decoding to match Alloy v1 API changesThe second boolean argument (validation flag) has been removed from
decode_log
method calls, as this parameter was removed in Alloy v1's API.
800-801
: Updated event decoding to match Alloy v1 API changesThe second boolean argument (validation flag) has been removed from
decode_log
method calls, as this parameter was removed in Alloy v1's API.
803-804
: Updated event decoding to match Alloy v1 API changesThe second boolean argument (validation flag) has been removed from
decode_log
method calls, as this parameter was removed in Alloy v1's API.
806-807
: Updated event decoding to match Alloy v1 API changesThe second boolean argument (validation flag) has been removed from
decode_log
method calls, as this parameter was removed in Alloy v1's API.
809-810
: Updated event decoding to match Alloy v1 API changesThe second boolean argument (validation flag) has been removed from
decode_log
method calls, as this parameter was removed in Alloy v1's API.
812-813
: Updated event decoding to match Alloy v1 API changesThe second boolean argument (validation flag) has been removed from
decode_log
method calls, as this parameter was removed in Alloy v1's API.
815-816
: Updated event decoding to match Alloy v1 API changesThe second boolean argument (validation flag) has been removed from
decode_log
method calls, as this parameter was removed in Alloy v1's API.
818-819
: Updated event decoding to match Alloy v1 API changesThe second boolean argument (validation flag) has been removed from
decode_log
method calls, as this parameter was removed in Alloy v1's API.justfile (1)
5-6
: Updated binding generation to specify Alloy v1.0.4The binding generation command has been updated with new flags:
--force
: Ensures regeneration, overriding any cache--skip-cargo-toml
: Avoids modifying Cargo.toml during binding generation--alloy-version "1.0.4"
: Explicitly specifies the target Alloy versionThese changes ensure consistent binding generation with the desired Alloy version.
hopr/hopr-lib/tests/common/mod.rs (1)
58-58
: Updated provider creation to use new Alloy v1 APIThe provider builder now uses
.connect_client(rpc_client)
instead of.on_client(rpc_client)
to match Alloy v1's updated API.chain/rpc/src/client.rs (1)
865-865
:connect_client
invocation looks goodThe new
ProviderBuilder::connect_client
call compiles with Alloy v1 and returns the fully-built provider, so no extra.build()
is required. Nothing else changed in the surrounding logic.chain/types/src/lib.rs (2)
62-64
: Removal of the phantom()
generic is correctBoth proxy variants now carry only the provider generic, matching the regenerated bindings. No functional issues detected.
81-90
: ContractInstances field-type update aligns with regenerated bindingsAll fields now accept the simplified
HoprXInstance<P>
type. Constructor code below already passesprovider.clone()
, so nothing further is required.chain/rpc/src/rpc.rs (1)
158-159
: Updated builder chain is correct
ProviderBuilder::connect_client
replaces the deprecated.on_client
API and the filler chain is left untouched. Looks good.ethereum/bindings/src/codegen/hoprchannelsevents.rs (1)
21-25
: Consider marking the tuple-newtype asserde(transparent)
Balance
,TicketIndex
, andTimestamp
are thin wrappers around primitive values, yet they are now serialised as one-element arrays ([123]
) rather than the plain scalar (123
).
If external JSON consumers expect the raw number, this silently breaks compatibility.-#[derive(serde::Serialize, serde::Deserialize)] -#[derive(Default, Debug, PartialEq, Eq, Hash)] +#[derive( + Default, + Debug, + PartialEq, + Eq, + Hash, + serde::Serialize, + serde::Deserialize, +)] +#[serde(transparent)]Adding
#[serde(transparent)]
(and repeating the change forTicketIndex
andTimestamp
) preserves the previous wire format while still giving you the derives.Check any APIs or tests that serialise these types to confirm whether the new
[value]
shape is already relied upon.ethereum/bindings/src/codegen/hoprnetworkregistryevents.rs (1)
1271-1280
: Tiny improvement: keep the phantom field name consistent across bindingsHere the field is
_network
, in other generated modules older code used_network_transport
.
While purely cosmetic, consistent naming avoids noisy diffs when the generator changes again.No action needed if the generator is authoritative; just flagging in case manual edits creep in.
ethereum/bindings/src/codegen/hoprnodesaferegistryevents.rs (2)
486-531
: Removal of the validate path changes run-time guarantees
decode_raw_log
used to expose avalidate
flag that, when enabled, performed ABI-level validation of log data size.
With this change the public enum no longer offers a validating decoder; callers that relied on the stricter variant now silently lose that safety-net.Two low-cost options:
- Re-introduce a
decode_raw_log_validate
companion that forwards toSolEvent::decode_raw_log_validate
.- Document in the module-level rust-doc that
decode_raw_log
performs no validation and that callers must callE::decode_raw_log_validate
on the concrete event instead.Failing to communicate this API break can lead to subtle production issues.
567-574
: 👍 Generics simplification improves ergonomicsGreat job removing the now-redundant transport generic – the new
Provider<N>
bound is clearer and drops a layer of noise throughout the API.ethereum/bindings/src/codegen/hoprnodestakefactoryevents.rs (1)
301-308
: Nice addition –serde
derives on enumsBeing able to serialise/deserialize the high-level event enums is very handy for off-chain pipelines.
👍ethereum/bindings/src/codegen/hoprticketpriceoracleevents.rs (8)
64-65
: Good addition of serialization support to event structsAdding these derives enables JSON serialization/deserialization support for the event structures, which will be useful for logging, storage, and inter-process communication.
178-179
: Consistent serialization support for event enumGood to see the same serialization capabilities added to the event enum, maintaining consistency with the individual event structs.
255-262
: Simplification of generic parametersThe removal of the transport type parameter
T
simplifies the API and aligns with Alloy v1's architecture changes where the provider interface now abstracts away transport details.
269-278
: Simplified deploy function signatureThe deploy function now has a cleaner signature while maintaining the same functionality, which improves readability and usability.
285-290
: Streamlined deploy_builder implementationThe simplified generic bounds here match the other changes throughout the file, creating consistency across the API.
309-309
: Updated phantom data field nameRenaming from
_transport
to_network
more accurately represents what the phantom data is tracking after removing the transport generic parameter.
386-394
: Simplified provider cloning implementationThe with_cloned_provider method has been updated to use the simplified type parameters while maintaining the same functionality.
399-403
: Consistent trait bound updates across implementation blocksThe trait bounds have been updated across all implementation blocks to be consistent with the new type parameter structure in Alloy v1.
Also applies to: 416-428
chain/types/src/utils.rs (12)
69-72
: Simplified function signature for mint_tokensThe function signature has been updated to remove the transport type parameter
T
, which aligns with Alloy v1's architecture changes and simplifies the API.
108-117
: Updated function signature for fund_nodeThe simplification of generic bounds improves readability while maintaining the same functionality.
141-150
: Simplified fund_channel function signatureConsistent with other changes, the transport generic parameter has been removed, aligning with Alloy v1's provider abstraction.
170-180
: Updated fund_channel_from_different_client signatureThe change maintains the pattern of simplifying generic bounds across all functions in the file.
181-183
: Updated contract instance creationContract instance creation now uses simplified type parameters without the transport generic.
202-211
: Simplified get_safe_tx function signatureThe function now has a cleaner signature that focuses on the provider and network generics.
225-225
: More idiomatic conversion using into()Changed from accessing tuple field with
._0
to using the more idiomatic.into()
method, which improves code readability.
230-230
: Simplified type conversion for data hashUsing
.into()
directly for the data hash is more concise than previous implementation.
255-265
: Updated include_node_to_module_by_safe signatureConsistent with other functions, the transport generic parameter has been removed.
295-305
: Simplified add_announcement_as_target signatureThe function signature has been updated to remove the transport type parameter, maintaining consistency with other changes.
331-341
: Updated approve_channel_transfer_from_safe signatureThe signature has been simplified to improve readability while maintaining the same functionality.
369-376
: Simplified deploy_one_safe_one_module_and_setup_for_testing signatureThe function signature has been updated to align with Alloy v1's provider abstraction.
ethereum/bindings/src/codegen/hoprdummyproxyfornetworkregistry.rs (3)
3304-3311
: Generic parameter change – audit manual instantiations
Instance<P, N>
replaced the previousInstance<P, T, N>
signature. Any
hand-written code that still supplies three generics will fail to compile.Search the code-base (tests, helpers, examples) for
HoprDummyProxyForNetworkRegistryInstance<
to ensure all call-sites were
updated.Also applies to: 3318-3328, 3335-3343
3368-3375
: Privacy-awareDebug
output looks goodThe custom
Debug
impl prints only the contract address, avoiding accidental
exposure of provider URLs or credentials. No action required.Also applies to: 3453-3464
299-301
:✅ Verification successful
serde
derives added – verify crate featuresAlmost every struct/enum now has
#[derive(Serialize, Deserialize)]
.
The Alloy crates expose these trait impls only when compiled with the
serde
feature. If the workspace disables default features, the build will
fail with errors like “Serialize is not implemented for U256”.Please confirm that
Cargo.toml
enables the feature, e.g.:alloy-sol-types = { version = "1.0.4", features = ["serde"] } alloy-primitives = { version = "1.0.4", features = ["serde"] } serde = { version = "1.0", features = ["derive"] }and that downstream crates propagate the feature.
Also applies to: 406-408, 514-515, 621-622, 805-807, 813-816, 954-956, 968-970, 1126-1129, 1261-1263, 1417-1419, 1559-1561, 1704-1706, 1858-1860, 2012-2014, 2159-2161, 2297-2299, 2443-2445, 3160-3162
I’ll check the workspace and the
ethereum/bindings
crate to confirm whether theserde
feature is enabled for the Alloy dependencies.
🏁 Script executed:
#!/bin/bash set -e echo "=== Cargo.toml files ===" find . -maxdepth 4 -type f -name Cargo.toml echo echo "=== Root Cargo.toml (first 200 lines) ===" sed -n '1,200p' Cargo.toml echo echo "=== Root Cargo.toml: alloy-sol-types, alloy-primitives, serde deps ===" grep -n -E 'alloy-sol-types|alloy-primitives|serde' Cargo.toml || echo "No matches in root Cargo.toml" echo echo "=== Locating ethereum/bindings Cargo.toml ===" BINDING_CARGO_TOML=$(find . -path '*/ethereum/bindings/Cargo.toml' -maxdepth 5 2>/dev/null) if [ -n "$BINDING_CARGO_TOML" ]; then echo "Found: $BINDING_CARGO_TOML" echo echo "=== ethereum/bindings Cargo.toml (first 200 lines) ===" sed -n '1,200p' "$BINDING_CARGO_TOML" echo echo "=== ethereum/bindings Cargo.toml: alloy-sol-types, alloy-primitives, serde deps ===" grep -n -E 'alloy-sol-types|alloy-primitives|serde' "$BINDING_CARGO_TOML" || echo "No matches in ethereum/bindings Cargo.toml" else echo "No ethereum/bindings Cargo.toml found" fiLength of output: 9033
Serde feature check passed
Confirmed thatethereum/bindings/Cargo.toml
includesserde = { workspace = true, features = ["derive"] }and that the root workspace enables
primitive-types
with its"serde"
feature. AllSerialize
/Deserialize
derives (including those onU256
) will compile successfully. No further changes needed.hopli/src/methods.rs (3)
207-207
: Type parameter simplification looks goodThe code has been properly updated to reflect Alloy v1 type simplifications by removing unused unit type parameters from contract instance types. The generic type parameters were consistently simplified across the entire file.
Also applies to: 306-307, 317-317, 369-370, 529-530, 553-554, 619-620, 649-650, 795-805, 1011-1012, 1033-1034, 1100-1101, 1143-1144, 1221-1223, 1281-1282
312-312
: Return value handling updated correctlyReturn values from multicall aggregate calls and contract method calls are now correctly handled by returning raw values directly rather than accessing tuple fields like
._0
or.balance
. This aligns with the binding changes in Alloy v1 that simplified return types.Also applies to: 335-336, 350-351, 410-412, 540-541, 1023-1024, 1240-1241, 1319-1320
1517-1517
: Test assertions updated for Alloy v1 compatibilityThe test assertions have been properly updated to work with the direct return values from contract calls, consistent with the changes in the main codebase. Boolean and numeric returns are now used directly without tuple field access.
Also applies to: 1579-1579, 1900-1901, 1907-1908, 1914-1914, 1919-1920, 2097-2098, 2143-2144, 2154-2155, 2219-2222, 2237-2240
Co-authored-by: Lukas <lukas.pohanka@inina.net> Co-authored-by: Tino Breddin <tino@hoprnet.org>
Co-authored-by: Lukas <lukas.pohanka@inina.net> Co-authored-by: Tino Breddin <tino@hoprnet.org>
Closes #7159
With Foundry's nightly release on May 20th, the generated contract bindings are compatible with alloy v1.0.4
Thus bump the alloy used in the crate to v1
Note that due to a known issue foundry-rs/foundry#10586, some unit tests around domain separator are skipped.