feat: axelar oracle#137
Conversation
reednaa
left a comment
There was a problem hiding this comment.
Looks fine to me.
Before we merge, we should consider a way to display which contracts (including oracles) have been audited and which have not.
| if (source == address(0)) revert InvalidAddress(); | ||
| if (payloads.length == 0) revert EmptyPayloadsNotAllowed(); | ||
|
|
||
| if (!IAttester(source).hasAttested(payloads)) revert NotAllPayloadsValid(); |
There was a problem hiding this comment.
(Opinion) Should be implemented in the outer submit function. The inner function is (mainly) concerned with messaging layer logic.
| function gateway() public view returns (IAxelarGateway) { | ||
| return IAxelarGateway(gatewayAddress); | ||
| } |
There was a problem hiding this comment.
Some strange code inherited from Axalar 😅
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Note
|
| Cohort / File(s) | Summary |
|---|---|
Axelar Oracle Integration src/integrations/oracles/axelar/AxelarOracle.sol, src/integrations/oracles/axelar/external/axelar/executable/AxelarExecutable.sol, src/integrations/oracles/axelar/external/axelar/interfaces/IAxelarExecutable.sol, src/integrations/oracles/axelar/external/axelar/interfaces/IAxelarGasService.sol, src/integrations/oracles/axelar/external/axelar/interfaces/IAxelarGateway.sol, src/integrations/oracles/axelar/external/axelar/interfaces/IContractIdentifier.sol, src/integrations/oracles/axelar/external/axelar/interfaces/IImplementation.sol, src/integrations/oracles/axelar/external/axelar/interfaces/IInterchainGasEstimation.sol, src/integrations/oracles/axelar/external/axelar/interfaces/IOwnable.sol, src/integrations/oracles/axelar/external/axelar/interfaces/IUpgradable.sol, src/integrations/oracles/axelar/external/axelar/libs/AddressString.sol, src/integrations/oracles/axelar/external/axelar/mocks/MockAxelarGasService.sol, src/integrations/oracles/axelar/external/axelar/mocks/MockAxelarGateway.sol, src/integrations/oracles/axelar/external/axelar/types/GasEstimationTypes.sol |
New Axelar oracle implementation with submit/execute flows, comprehensive interface definitions (gateway, gas service, executable), address-string conversion utilities, type definitions for gas estimation, and mock contracts for testing. |
Snapshot Updates snapshots/oracle.json, snapshots/outputSettler.json |
Oracle metrics replace Bitcoin/Citrea/Hyperlane/Wormhole entries with new Axelar keys; outputSettler values updated across all CoinFill-related keys. |
Comment Formatting Standardization src/input/compact/InputSettlerCompact.sol, src/input/escrow/InputSettlerEscrow.sol, src/input/types/MandateOutputType.sol, src/integrations/CatsMulticallHandler.sol, src/integrations/oracles/bitcoin/BitcoinOracle.sol, src/integrations/oracles/bitcoin/external/interfaces/BtcStructs.sol, src/integrations/oracles/bitcoin/external/library/BtcScript.sol, src/integrations/oracles/hyperlane/external/hyperlane/interfaces/hooks/IPostDispatchHook.sol, src/integrations/oracles/hyperlane/external/hyperlane/libs/StandardHookMetadata.sol, src/integrations/oracles/polymer/external/core/prove_api/CrossL2ProverV2.sol, src/integrations/oracles/polymer/external/core/prove_api/SequencerSignatureVerifier.sol, src/integrations/oracles/polymer/external/libs/ReceiptParser.sol, src/integrations/oracles/polymer/external/mocks/MockCrossL2ProverV2.sol, src/integrations/oracles/polymer/external/optimism/rlp/RLPReader.sol, src/integrations/oracles/wormhole/external/callworm/WormholeVerifier.sol, src/integrations/oracles/wormhole/external/wormhole/Messages.sol, src/integrations/oracles/wormhole/external/wormhole/libraries/external/BytesLib.sol, src/libs/MandateOutputEncodingLib.sol, src/libs/MessageEncodingLib.sol, src/oracles/BaseInputOracle.sol, src/output/simple/FillerDataLib.sol, src/output/simple/FulfilmentLib.sol, test/input/BaseSettler.t.sol, test/input/BaseSettler.timestamps.t.sol, test/integration/SettlerCompact.crosschain.t.sol, test/libs/MessageEncodingLib.t.sol, test/oracle/bitcoin/BitcoinOracle.t.sol, test/oracle/bitcoin/CitreaOracle.t.sol |
Cosmetic normalization of section header comments, spacing adjustments, and minor ASCII art alignment. No functional impact. |
Axelar Oracle Test Suite test/oracle/axelar/AxelarOracle.t.sol |
Comprehensive Forge tests covering submit/execute flows, validation error paths, payload encoding/decoding, and mock gateway/gas service interactions. |
Test Data Updates test/oracle/bitcoin/blocksinfo.t.sol |
Addition of next-block transaction constants (NEXT_TX_ID, NEXT_TX_INDEX, NEXT_TX_MERKLE_PROOF, NEXT_RAW_TX, NEXT_SATS_AMOUNT, NEXT_BLOCK_TIME). |
Sequence Diagram(s)
sequenceDiagram
participant Client
participant AxelarOracle
participant IAttester as IAttester<br/>(Validator)
participant GasService
participant Gateway
participant Destination
rect rgb(200, 220, 255)
Note over Client,Destination: Submit Flow
Client->>AxelarOracle: submit(chain, addr, source, payloads[])
AxelarOracle->>IAttester: Validate all payloads attested
alt Not all payloads valid
AxelarOracle-->>Client: NotAllPayloadsValid()
end
AxelarOracle->>AxelarOracle: _submit() - encode message
AxelarOracle->>GasService: payNativeGasForContractCall()
activate GasService
GasService-->>AxelarOracle: ✓ gas paid
deactivate GasService
AxelarOracle->>Gateway: callContract(chain, addr, encoded)
activate Gateway
Gateway-->>AxelarOracle: ✓ message broadcast
deactivate Gateway
end
rect rgb(220, 255, 220)
Note over Client,Destination: Execute Flow
Gateway->>AxelarOracle: execute(commandId, sourceChain, sourceAddr, payload)
AxelarOracle->>Gateway: validateContractCall()
alt Not approved
Gateway-->>AxelarOracle: NotApprovedByGateway()
end
AxelarOracle->>AxelarOracle: Extract app hash & payload hashes<br/>Record attestations
AxelarOracle->>Client: OutputProven event
activate Client
Client-->>AxelarOracle: ✓ processed
deactivate Client
end
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~25 minutes
The changes introduce substantial new Axelar integration logic (contract, interfaces, libraries, mocks, tests) requiring careful review of cross-chain message flow, gateway validation, and gas service integration. However, the majority of the diff consists of repetitive comment formatting across many files (low-effort per file), and the new test suite follows clear patterns. The Axelar contract implementation itself is straightforward without complex state mutations or intricate error paths.
Suggested reviewers
- frangio
Poem
🐰 A cross-chain bridge now hops through Axelar's path,
With formatted comments—no formatting wrath!
Gas services paid, and messages sealed,
Oracle attestations perfectly healed.
From Bitcoin to Axelar, the network expands,
One more oracle oracle in code's helping hands! 🌉
Pre-merge checks and finishing touches
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The title 'feat: axelar oracle' clearly and concisely summarizes the main change: introducing Axelar oracle functionality. |
| Description check | ✅ Passed | The PR description provides clear implementation details, public interface explanation, design decisions, and completes the third-party integration checklist with all items verified. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
✨ Finishing touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Post copyable unit tests in a comment
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 @coderabbitai help to get the list of available commands and usage tips.
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
test/input/BaseSettler.timestamps.t.sol (1)
6-8: Duplicate import ofInputSettlerBase.
InputSettlerBaseis imported on both line 6 and line 8.🔎 Proposed fix
import { InputSettlerBase } from "../../src/input/InputSettlerBase.sol"; - -import { InputSettlerBase } from "../../src/input/InputSettlerBase.sol";
🧹 Nitpick comments (4)
src/integrations/oracles/hyperlane/external/hyperlane/libs/StandardHookMetadata.sol (1)
4-14: Minor documentation consistency: "verbatim copy" status compromised by spacing change.The file header declares this a verbatim copy of Hyperlane's StandardHookMetadata (lines 27–30, commit d0d8049c13140b9230c60415a445da9048bb1caa), but the ASCII art spacing has been adjusted. While this is purely cosmetic and doesn't affect functionality, it technically breaks the verbatim claim. Consider either reverting the spacing to match the original exactly, or updating the comment to indicate the copy includes minor formatting adjustments.
src/integrations/oracles/wormhole/external/callworm/WormholeVerifier.sol (1)
191-202: Remove commented-out code.This large block of commented-out code should be removed entirely rather than left in the source. Git history preserves the old implementation if reference is needed later.
🔎 Proposed fix
- // signatures = new Structs.Signature[](signersLen); - // for (uint i = 0; i < signersLen; ++i) { - // signatures[i].guardianIndex = uint8(bytes1(encodedVM[index:index+1])); - // index += 1; - - // signatures[i].r = bytes32(encodedVM[index:index+32]); - // index += 32; - // signatures[i].s = bytes32(encodedVM[index:index+32]); - // index += 32; - // signatures[i].v = uint8(bytes1(encodedVM[index:index+1])) + 27; - // index += 1; - //}src/integrations/oracles/axelar/external/axelar/mocks/MockAxelarGasService.sol (1)
10-22: Consider trackingmsg.valuefor more comprehensive test assertions.The mock currently only counts calls. For tests that need to verify the correct gas payment amount was sent, tracking
msg.valuecould be useful.🔎 Optional enhancement
contract MockAxelarGasService { uint256 public paidGasCounter; + uint256 public totalGasPaid; function payNativeGasForContractCall( address, string calldata, string calldata, bytes calldata, address ) external payable { paidGasCounter += 1; + totalGasPaid += msg.value; } }test/oracle/axelar/AxelarOracle.t.sol (1)
286-287: Unnecessaryvm.prankbefore mock helper call.The
vm.prank(address(_axelarGateway))at line 286 is unnecessary sinceapproveContractCallis a test helper onMockAxelarGatewaythat doesn't checkmsg.sender. The prank has no effect here and may confuse future readers.🔎 Suggested simplification
- vm.prank(address(_axelarGateway)); _axelarGateway.approveContractCall(_commandId, _origin, messageSender.toString(), messageHash);
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (46)
snapshots/oracle.jsonsnapshots/outputSettler.jsonsrc/input/compact/InputSettlerCompact.solsrc/input/escrow/InputSettlerEscrow.solsrc/input/types/MandateOutputType.solsrc/integrations/CatsMulticallHandler.solsrc/integrations/oracles/axelar/AxelarOracle.solsrc/integrations/oracles/axelar/external/axelar/executable/AxelarExecutable.solsrc/integrations/oracles/axelar/external/axelar/interfaces/IAxelarExecutable.solsrc/integrations/oracles/axelar/external/axelar/interfaces/IAxelarGasService.solsrc/integrations/oracles/axelar/external/axelar/interfaces/IAxelarGateway.solsrc/integrations/oracles/axelar/external/axelar/interfaces/IContractIdentifier.solsrc/integrations/oracles/axelar/external/axelar/interfaces/IImplementation.solsrc/integrations/oracles/axelar/external/axelar/interfaces/IInterchainGasEstimation.solsrc/integrations/oracles/axelar/external/axelar/interfaces/IOwnable.solsrc/integrations/oracles/axelar/external/axelar/interfaces/IUpgradable.solsrc/integrations/oracles/axelar/external/axelar/libs/AddressString.solsrc/integrations/oracles/axelar/external/axelar/mocks/MockAxelarGasService.solsrc/integrations/oracles/axelar/external/axelar/mocks/MockAxelarGateway.solsrc/integrations/oracles/axelar/external/axelar/types/GasEstimationTypes.solsrc/integrations/oracles/bitcoin/BitcoinOracle.solsrc/integrations/oracles/bitcoin/external/interfaces/BtcStructs.solsrc/integrations/oracles/bitcoin/external/library/BtcScript.solsrc/integrations/oracles/hyperlane/external/hyperlane/interfaces/hooks/IPostDispatchHook.solsrc/integrations/oracles/hyperlane/external/hyperlane/libs/StandardHookMetadata.solsrc/integrations/oracles/polymer/external/core/prove_api/CrossL2ProverV2.solsrc/integrations/oracles/polymer/external/core/prove_api/SequencerSignatureVerifier.solsrc/integrations/oracles/polymer/external/libs/ReceiptParser.solsrc/integrations/oracles/polymer/external/mocks/MockCrossL2ProverV2.solsrc/integrations/oracles/polymer/external/optimism/rlp/RLPReader.solsrc/integrations/oracles/wormhole/external/callworm/WormholeVerifier.solsrc/integrations/oracles/wormhole/external/wormhole/Messages.solsrc/integrations/oracles/wormhole/external/wormhole/libraries/external/BytesLib.solsrc/libs/MandateOutputEncodingLib.solsrc/libs/MessageEncodingLib.solsrc/oracles/BaseInputOracle.solsrc/output/simple/FillerDataLib.solsrc/output/simple/FulfilmentLib.soltest/input/BaseSettler.t.soltest/input/BaseSettler.timestamps.t.soltest/integration/SettlerCompact.crosschain.t.soltest/libs/MessageEncodingLib.t.soltest/oracle/axelar/AxelarOracle.t.soltest/oracle/bitcoin/BitcoinOracle.t.soltest/oracle/bitcoin/CitreaOracle.t.soltest/oracle/bitcoin/blocksinfo.t.sol
🔇 Additional comments (66)
src/integrations/oracles/hyperlane/external/hyperlane/interfaces/hooks/IPostDispatchHook.sol (1)
4-14: Verify intentionality of formatting changes to external code.The ASCII art header (lines 4–14) has been reformatted for spacing. Since this file contains copied external Hyperlane interfaces, clarify whether this formatting change is intentional or an artifact. Keeping external code unmodified (except where necessary) helps with maintenance and tracking upstream changes.
If the change is intentional, it's acceptable but non-functional. If unintentional, consider reverting to preserve alignment with the upstream Hyperlane codebase.
src/integrations/oracles/polymer/external/mocks/MockCrossL2ProverV2.sol (1)
158-161: Comment formatting updates for clarity.The comments on lines 158 and 160 have been adjusted to better document the proof structure assignments. These are purely documentation changes with no impact on the contract logic.
src/output/simple/FillerDataLib.sol (2)
12-12: Documentation formatting improvement.Removing excess whitespace in the byte layout comment improves readability without changing substance. The byte offset and size description remain accurate.
20-26: Clean assembly implementation.The use of "memory-safe" assembly with
calldataloadis appropriate and correct. The function properly extracts the 32-byte proposed solver from the calldata offset as documented.test/integration/SettlerCompact.crosschain.t.sol (1)
428-428: No concerns—formatting normalization only.These changes normalize comment spacing (adding a space after
//) on previously commented-out code. No functional impact to the test logic.Also applies to: 432-432
src/integrations/oracles/wormhole/external/wormhole/Messages.sol (1)
73-79: Editorial change—code logic unaffected.The warning comment formatting has been updated without any change to underlying logic or behavior. The verifyVMInternal function correctly validates guardian sets, enforces quorum, and verifies signatures.
src/integrations/oracles/polymer/external/libs/ReceiptParser.sol (1)
64-71: LGTM – comment formatting only.These changes are purely cosmetic adjustments to the indentation/alignment of the inline documentation for the
Logstruct. No executable code or logic is affected.src/integrations/oracles/polymer/external/optimism/rlp/RLPReader.sol (1)
33-33: Documentation formatting improvements approved.The normalization of spacing in natspec documentation for the
ptrfield (line 33) and_srcparameter (line 240) improves consistency without affecting functionality or API contract. External code attribution and provenance remain properly documented.Also applies to: 240-240
src/integrations/oracles/wormhole/external/wormhole/libraries/external/BytesLib.sol (1)
263-271: Comment-only formatting changes—low-impact but verify scope.All changes in this file are inline comment reformatting (whitespace and text alignment). The library's logic, behavior, and public API are unchanged. However, since this is external third-party code (BytesLib by ConsenSys), please clarify whether these formatting updates are in scope for the Axelar oracle PR, or if they are part of a broader codebase-wide comment normalization effort.
Also applies to: 420-420, 484-484
src/integrations/oracles/wormhole/external/callworm/WormholeVerifier.sol (1)
60-60: Verify the relationship between these Wormhole changes and the Axelar oracle PR.This PR is described as implementing an Axelar-based oracle, but these changes are in the Wormhole verifier. The modifications (comment edit on line 60 and signature parsing refactor on lines 191-202) appear unrelated to Axelar integration.
Please confirm whether:
- These changes are intentionally bundled in this PR
- The signature parsing refactor has been tested with existing Wormhole oracle functionality
- There's a dependency between the Wormhole changes and the Axelar implementation
Also applies to: 191-202
src/integrations/oracles/polymer/external/core/prove_api/SequencerSignatureVerifier.sol (1)
70-70: LGTM: Comment formatting improvement.This whitespace adjustment improves comment readability with no functional impact.
test/oracle/bitcoin/BitcoinOracle.t.sol (1)
84-86: LGTM: Test comment formatting standardization.These changes standardize comment headers and fix TODO spacing throughout the test file with no impact on test logic or coverage.
Also applies to: 249-249, 519-519, 728-728, 986-986, 1057-1057
src/oracles/BaseInputOracle.sol (1)
27-27: LGTM: Comment header formatting improvement.Standardizes comment header spacing with no functional impact on the attestation storage implementation.
test/libs/MessageEncodingLib.t.sol (1)
27-33: LGTM: Formatting of commented-out code.These indentation adjustments improve readability of the commented-out test block with no impact on active test logic.
src/input/escrow/InputSettlerEscrow.sol (1)
184-186: LGTM: Documentation and comment formatting improvements.These changes improve comment readability and parameter documentation formatting with no impact on escrow, deposit, or signature handling logic.
Also applies to: 307-314, 445-445
src/integrations/oracles/bitcoin/BitcoinOracle.sol (1)
149-149: LGTM: Comment header formatting standardization.These changes standardize section header spacing with no impact on the Bitcoin oracle verification, claim, or dispute logic.
Also applies to: 212-212
src/integrations/oracles/bitcoin/external/interfaces/BtcStructs.sol (1)
16-16: LGTM: Comment formatting improvement.This change adds proper spacing after the comment marker with no impact on the struct definitions.
src/input/compact/InputSettlerCompact.sol (1)
197-197: LGTM: Comment header formatting standardization.Standardizes section header spacing with no impact on the Compact integration or resource lock logic.
src/integrations/CatsMulticallHandler.sol (1)
36-36: LGTM!Comment spacing normalization aligns with the broader formatting cleanup in this PR.
test/input/BaseSettler.t.sol (3)
88-88: LGTM!Section header comment formatting is consistent with PR's style normalization.
271-271: LGTM!Section header formatting aligns with codebase conventions.
500-500: LGTM!Consistent section header formatting.
test/input/BaseSettler.timestamps.t.sol (1)
34-34: LGTM!Section header formatting is consistent with the PR's style normalization.
src/libs/MandateOutputEncodingLib.sol (1)
17-35: LGTM!Documentation formatting is cleaner and more readable. The encoding schema layout accurately reflects the data structure.
src/integrations/oracles/bitcoin/external/library/BtcScript.sol (2)
35-35: LGTM!Section header formatting is consistent.
134-134: LGTM!Section header formatting matches the decode helpers section above.
src/output/simple/FulfilmentLib.sol (1)
14-32: LGTM!Documentation reformatting improves readability while maintaining accurate byte layout descriptions.
test/oracle/bitcoin/CitreaOracle.t.sol (9)
94-96: LGTM!Comment formatting is consistent with PR's style normalization.
259-259: LGTM!Section header formatting is consistent.
529-529: LGTM!Section header formatting is consistent.
738-738: LGTM!Section header formatting is consistent.
996-997: LGTM!Commented-out code formatting is consistent.
1067-1067: LGTM!Commented-out code formatting is consistent.
1626-1626: LGTM!Commented-out code formatting is consistent.
1678-1678: LGTM!Commented-out code formatting is consistent.
1725-1725: LGTM!Commented-out code formatting is consistent.
src/integrations/oracles/polymer/external/core/prove_api/CrossL2ProverV2.sol (3)
55-81: LGTM!Proof bytes layout documentation formatting is cleaner and maintains accurate byte offset information.
128-150: LGTM!Solana proof bytes layout documentation is well-formatted and accurate.
246-258: LGTM!IAVL proof encoding documentation formatting is consistent with the rest of the file.
src/integrations/oracles/axelar/external/axelar/interfaces/IOwnable.sol (1)
1-63: LGTM!The interface is properly documented with source provenance (commit hash, URL, copy date), follows the third-party integration checklist requirements, and defines a clean ownership abstraction used by
IUpgradable.src/integrations/oracles/axelar/external/axelar/libs/AddressString.sol (1)
1-58: LGTM!The address-string conversion utilities are correctly implemented with proper validation. The
toAddressfunction validates the0xprefix and 42-character length, and the hex character parsing logic correctly handles lowercase (a-f), uppercase (A-F), and numeric (0-9) ranges. Provenance documentation is complete.test/oracle/bitcoin/blocksinfo.t.sol (1)
4-5: LGTM!The comment formatting changes improve consistency across the file.
Also applies to: 28-28, 45-45, 62-62
src/input/types/MandateOutputType.sol (1)
27-27: LGTM!Minor comment formatting adjustment for consistency.
snapshots/outputSettler.json (1)
1-9: LGTM!Gas snapshot values updated. These should be verified by the CI pipeline's gas snapshot tests to ensure they match the actual measured gas consumption after the code changes in this PR.
src/libs/MessageEncodingLib.sol (1)
13-14: LGTM!Documentation formatting cleanup. Removing the
+prefix from the data structure description improves readability.Also applies to: 17-18
src/integrations/oracles/axelar/external/axelar/interfaces/IContractIdentifier.sol (1)
1-22: LGTM!Minimal interface for contract identification during upgrades, properly documented with source provenance.
src/integrations/oracles/axelar/external/axelar/interfaces/IImplementation.sol (1)
1-21: LGTM!The interface is correctly copied from the Axelar GMP SDK with proper attribution including source URL, commit hash, and copy date. The interface definition is minimal and appropriate for the upgradeability pattern.
snapshots/oracle.json (1)
2-3: LGTM!New gas snapshot entries for
axelarOracleExecuteandaxelarOracleSubmitare added. The gas values are reasonable and consistent with other oracle implementations in the snapshot.src/integrations/oracles/axelar/external/axelar/types/GasEstimationTypes.sol (1)
1-46: LGTM!The gas estimation types are correctly copied from the Axelar GMP SDK with proper attribution. The struct packing is efficient, and the documentation clearly explains the purpose of each field.
src/integrations/oracles/axelar/external/axelar/interfaces/IUpgradable.sol (1)
1-32: LGTM!The upgradable interface is correctly copied from the Axelar GMP SDK with proper attribution. The interface follows standard upgradeability patterns with appropriate error definitions and events.
src/integrations/oracles/axelar/external/axelar/interfaces/IInterchainGasEstimation.sol (1)
1-57: LGTM!The interchain gas estimation interface is correctly copied from the Axelar GMP SDK with proper attribution. The interface provides the necessary abstractions for cross-chain gas fee estimation.
src/integrations/oracles/axelar/external/axelar/interfaces/IAxelarExecutable.sol (1)
1-54: LGTM!The executable interface is correctly copied from the Axelar GMP SDK with proper attribution. The interface defines the standard cross-chain execution pattern with appropriate error definitions.
src/integrations/oracles/axelar/external/axelar/executable/AxelarExecutable.sol (1)
1-86: LGTM!The AxelarExecutable abstract contract is correctly copied from the Axelar GMP SDK. The implementation follows the standard Axelar pattern:
- Constructor validates non-zero gateway address
execute()validates with gateway before delegating to_execute()- Derived contracts implement
_execute()for custom logicThe gateway validation via
validateContractCallensures cross-chain messages are properly authenticated before execution.src/integrations/oracles/axelar/AxelarOracle.sol (4)
29-37: LGTM!The constructor correctly validates both the gateway (via
AxelarExecutable) and the gas service addresses, preventing zero-address initialization.
48-60: LGTM!The
submitfunction has proper validation:
- Validates source is not zero address
- Validates payloads array is not empty
- Verifies all payloads are attested before submission
The attestation check via
IAttester(source).hasAttested(payloads)ensures only valid payloads are broadcast.
73-86: LGTM!The internal
_submitfunction correctly:
- Encodes the message with source identifier and payloads
- Pays for gas via the gas service (with excess refunded to
msg.sender)- Calls the gateway to broadcast the message
The gas payment flow aligns with Axelar's recommended pattern of paying before the gateway call.
97-117: The identified concerns are already properly handled in the codebase.The
_getMappedChainIdfunction in ChainMap.sol explicitly reverts withZeroValue()if a chain is not mapped (if (chainId == 0) revert ZeroValue()), preventing attestations from being stored under unexpected keys. Additionally,StringToAddress.toAddress()in AddressString.sol validates the input format strictly—it requires exactly 42 characters starting with "0x" and reverts withInvalidAddressString()for any invalid address strings, including those that may come from the Axelar network.Likely an incorrect or invalid review comment.
src/integrations/oracles/axelar/external/axelar/interfaces/IAxelarGateway.sol (1)
1-92: Well-documented external interface with proper provenance tracking.The interface is appropriately minimal, containing only the functions needed for Axelar GMP integration. Good practice to document the source commit hash and copy date for external code.
src/integrations/oracles/axelar/external/axelar/mocks/MockAxelarGateway.sol (2)
29-35: Verifyaddress(this)is intentional in the ContractCall event.The mock emits
address(this)as the sender in theContractCallevent rather thanmsg.sender. The real Axelar gateway would emitmsg.sender. This is acceptable for a mock if tests don't rely on the sender value, but worth confirming this is the intended behavior.
47-78: Approval and validation logic is correctly paired.The
approveContractCallandvalidateContractCallfunctions use consistent key derivation withaddress(this)as the contractAddress, ensuring that test approvals can be properly validated. ThevalidateContractCallcorrectly clears the approval flag after successful validation (line 55), preventing replay.test/oracle/axelar/AxelarOracle.t.sol (4)
44-53: Setup correctly initializes test dependencies.The test setup properly creates mock contracts, initializes the oracle, and configures chain mappings. The chain map uses
keccak256(abi.encodePacked(chainName))as the endpoint ID, which aligns with how Axelar chain names are mapped to canonical chain IDs.
109-178: Error path tests provide good coverage.The tests correctly verify revert conditions:
NotAllPayloadsValidwhen payloads aren't proven on the settlerInvalidAddresswhen source address is zeroEmptyPayloadsNotAllowedwhen payload array is emptyThe fuzz tests properly use
vm.assumeto filter invalid inputs.
289-296: Execute test correctly validates the full execution flow.The test properly:
- Approves the contract call on the mock gateway
- Expects the
OutputProvenevent emission- Calls execute and snapshots gas usage
- Asserts the proven state via
isProven
180-188: Wrapper tests provide concrete regression examples.The
_wsuffix wrapper tests (test_submit_works_w,test_execute_works_w) call the parameterized fuzz tests with concrete values. This is a good pattern for ensuring basic functionality works even when fuzz testing is disabled or constrained.src/integrations/oracles/axelar/external/axelar/interfaces/IAxelarGasService.sol (2)
1-31: External interface properly documented with provenance.The interface correctly documents its source, commit hash, and copy date. The error definitions are clear and the interface structure is appropriate for the Axelar gas service integration.
431-435: No action needed. ThegasCollector()function signature matches the official Axelar SDK interface exactly as shown in authoritative sources (Arbiscan, Blastscan). While the lack of aviewmodifier is unconventional for a getter function, this is the original design from Axelar and should be preserved for compatibility.
| bytes20 constant PHASH = bytes20(0x93AB15e523955F293Df3A68029eC41E6b1ca1790); | ||
|
|
||
| //Next block to test verification after subimssion | ||
| // Next block to test verification after subimssion |
There was a problem hiding this comment.
Typo in comment: "subimssion" should be "submission".
🔎 Proposed fix
-// Next block to test verification after subimssion
+// Next block to test verification after submission📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // Next block to test verification after subimssion | |
| // Next block to test verification after submission |
🤖 Prompt for AI Agents
In test/oracle/bitcoin/blocksinfo.t.sol around line 31, there's a typo in the
inline comment ("subimssion"); update the comment text to read "submission" so
it correctly documents "Next block to test verification after submission".
Description
This PR implements an Axelar-based oracle for cross-chain message attestation.
Oracle Implementation:
Public Interface:
Design Decisions:
Related Issues
There is no related issue.
Third-Party Integration Checklist
foundry.tomlsrc/oracles/[oracle-type]/external/[protocol-name]/Additional Notes
Summary by CodeRabbit
Release Notes
New Features
Style
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.