Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 39 minutes and 30 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds xHOPR token address support across bindings and contracts: updates crate version, adds xhopr_token entries in contracts-addresses.json, extends address structs/serialization to include xhopr token, and small related doc/test tweaks. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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.
Pull request overview
Adds support for tracking the xHOPR token address in the repository’s generated/checked-in contract address artifacts.
Changes:
- Extend
NetworkConfigto include and (intended to) serialize anxhopr_tokenaddress. - Add
xhopr_tokenentries toethereum/bindings/contracts-addresses.json. - Bump
hopr-bindingscrate version to4.8.0and updateCargo.lock.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| ethereum/contracts/script/utils/NetworkConfig.s.sol | Adds an xHOPR address field and attempts to write it into the generated JSON output. |
| ethereum/contracts/script/DeployAll.s.sol | Notes that xHOPR is not deployed by the deploy-all script. |
| ethereum/bindings/contracts-addresses.json | Adds xhopr_token address entries per network. |
| ethereum/bindings/Cargo.toml | Bumps hopr-bindings version to reflect the updated address schema. |
| Cargo.lock | Updates lockfile to the new hopr-bindings version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
ethereum/contracts/script/utils/NetworkConfig.s.sol (1)
108-121:⚠️ Potential issue | 🔴 CriticalMove the assignment to capture the final
xhopr_tokenserialization.The
xhopr_tokenfield is not included in the JSON due to improper return value handling.stdJson.serializereturns the accumulated JSON string; only the last captured return value is what gets embedded. Currently:
- Lines 116–118 capture after
winning_probability_oracle- Line 119 calls
serialize("xhopr_token", ...)but discards the return value- Line 121 passes the stale
addressesstring (missingxhopr_token) toobj.serializeProposed fix
- addresses.serialize("token", networkDetail.addresses.tokenContractAddress); - addresses = addresses.serialize( - "winning_probability_oracle", networkDetail.addresses.winningProbabilityContractAddress - ); - addresses.serialize("xhopr_token", networkDetail.addresses.xhoprTokenContractAddress); + addresses.serialize("token", networkDetail.addresses.tokenContractAddress); + addresses.serialize( + "winning_probability_oracle", networkDetail.addresses.winningProbabilityContractAddress + ); + addresses = addresses.serialize("xhopr_token", networkDetail.addresses.xhoprTokenContractAddress);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ethereum/contracts/script/utils/NetworkConfig.s.sol` around lines 108 - 121, The JSON for addresses is missing the xhopr_token because the return value of stdJson.serialize is ignored; update the chain so the final serialize call is captured: assign the result of addresses.serialize("xhopr_token", networkDetail.addresses.xhoprTokenContractAddress) back to addresses (just like addresses = addresses.serialize("winning_probability_oracle", ...)), then pass that updated addresses to obj.serialize("addresses", addresses) so the xhopr_token field is included.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@ethereum/bindings/contracts-addresses.json`:
- Around line 13-14: The JSON uses the zero-address for "xhopr_token", which
NetworkConfig.s.sol's isValidAddress treats as invalid and can break logic that
dereferences addresses (e.g., Rust IntoIterator balance queries); either replace
the placeholder with a locally deployed mock xHOPR address and update
contracts-addresses.json to that deployed address, or explicitly
document/implement guards so consumers (and any iteration code) skip address(0)
when reading "xhopr_token" — reference xhopr_token, isValidAddress, and
NetworkConfig.s.sol when adding the change.
In `@ethereum/contracts/script/utils/NetworkConfig.s.sol`:
- Around line 223-232: The vm.writeLine call that emits the
"xhopr_token_contract_address" field in displayNetworkDetail currently appends a
trailing comma which makes the output inconsistent/non-JSON; update the string
passed to vm.writeLine (the abi.encodePacked that builds
'"xhopr_token_contract_address": "' +
vm.toString(networkDetail.addresses.xhoprTokenContractAddress) + '"') to remove
the trailing comma so the field ends with '"' only (and ensure surrounding
fields like announcements_contract_address keep consistent punctuation), i.e.,
delete the '",' suffix or adjust concatenation in the
xhopr_token_contract_address write to not include the comma.
---
Outside diff comments:
In `@ethereum/contracts/script/utils/NetworkConfig.s.sol`:
- Around line 108-121: The JSON for addresses is missing the xhopr_token because
the return value of stdJson.serialize is ignored; update the chain so the final
serialize call is captured: assign the result of
addresses.serialize("xhopr_token",
networkDetail.addresses.xhoprTokenContractAddress) back to addresses (just like
addresses = addresses.serialize("winning_probability_oracle", ...)), then pass
that updated addresses to obj.serialize("addresses", addresses) so the
xhopr_token field is included.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d4aa4626-fffa-48c4-be10-a43ccf2b4ba9
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (5)
ethereum/bindings/Cargo.tomlethereum/bindings/contracts-addresses.jsonethereum/bindings/src/config.rsethereum/contracts/script/DeployAll.s.solethereum/contracts/script/utils/NetworkConfig.s.sol
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| addresses = addresses.serialize( | ||
| "winning_probability_oracle", networkDetail.addresses.winningProbabilityContractAddress | ||
| ); | ||
| addresses.serialize("xhopr_token", networkDetail.addresses.xhoprTokenContractAddress); | ||
|
|
||
| obj.serialize("addresses", addresses); |
There was a problem hiding this comment.
In writeNetwork, addresses is used as the objectKey for stdJson.serialize(...) calls. After addresses = addresses.serialize("winning_probability_oracle", ...), the addresses variable now holds the stringified JSON, not the original object key (e.g. "addresses-<network>"). The subsequent addresses.serialize("xhopr_token", ...) therefore writes into a different in-memory object and the returned addresses JSON passed into obj.serialize("addresses", addresses) will not include xhopr_token.
Keep the original object key separate (or delay assigning addresses = ... until the final serialize call) so that xhopr_token is serialized into the same addresses-<network> object and included in the written JSON.
| addresses = addresses.serialize( | |
| "winning_probability_oracle", networkDetail.addresses.winningProbabilityContractAddress | |
| ); | |
| addresses.serialize("xhopr_token", networkDetail.addresses.xhoprTokenContractAddress); | |
| obj.serialize("addresses", addresses); | |
| addresses.serialize("winning_probability_oracle", networkDetail.addresses.winningProbabilityContractAddress); | |
| string memory serializedAddresses = | |
| addresses.serialize("xhopr_token", networkDetail.addresses.xhoprTokenContractAddress); | |
| obj.serialize("addresses", serializedAddresses); |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -659,6 +659,6 @@ contract Crypto is Test, AccountsFixtureTest, HoprCrypto, CryptoUtils { | |||
| params.hVx = rx; | |||
| params.hVy = ry; | |||
|
|
|||
| assertFalse(crypto.vrfVerifyProxy(params, payload)); | |||
| crypto.vrfVerifyProxy(params, payload); | |||
| } | |||
There was a problem hiding this comment.
vrfVerifyProxy returns bool and only reverts for invalid field elements/curve points/witnesses. In this test you tweak h and update the corresponding witness (hVx/hVy), so the call will likely return false (not revert). With a testFail_ name and no assertion/expectRevert, Foundry will treat this as an unexpected success and the test will fail. Consider restoring an assertFalse(...)-style check (and a non-testFail_ name), or explicitly vm.expectRevert(...) if the intended behavior is to revert.
Description
Closes #78
Include xHOPR token in the contracts-addresses.json, under
xhopr_tokenSummary by CodeRabbit
New Features
Chores
Documentation
Tests