Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
5098578
feat: add Axelar GMP and LayerZero V2 proof oracles
reednaa Sep 30, 2026
bb1cd07
fix(layerzero): reject NIL confirmations in pinned ULN config
reednaa Sep 30, 2026
2531f6e
feat(axelar): permissionless Solana sender cache for execute
reednaa Oct 2, 2026
bbeec00
feat(axelar): memoize Solana senders on first approved execute
reednaa Oct 2, 2026
33561e3
refactor(oracles): use OpenZeppelin Base58 for Solana addresses; drop…
reednaa Oct 2, 2026
dc07c68
feat(axelar): owner-mapped chains following ChainMap conventions
reednaa Oct 2, 2026
43209ca
Merge remote-tracking branch 'origin/feat/axelar-owner-routes' into f…
reednaa Oct 2, 2026
2a9fac4
test(oracles): split transport tests per oracle
reednaa Oct 2, 2026
42b3632
refactor: move LayerZero oracle to its own PR
reednaa Oct 2, 2026
e226659
refactor(oracles): share owner set-once route map; drop LayerZero-onl…
reednaa Oct 5, 2026
81de032
feat(axelar): add AxelarOracle deployment script
reednaa Oct 12, 2026
8052144
Separate Axelar deployment from chain-map configuration
reednaa Oct 13, 2026
b8a4178
refactor(axelar): build AxelarOracle on shared ChainMap
reednaa Oct 14, 2026
c82cf20
refactor(axelar): merge string codecs into AxelarStrings, word-at-a-t…
reednaa Oct 14, 2026
28389f7
docs(axelar): avoid typos false positive in chain-map script
reednaa Oct 14, 2026
3655ef6
test(axelar): add symbolic AxelarStrings properties
reednaa Oct 14, 2026
3b9143d
docs(axelar): drop symbolic test README section
reednaa Oct 14, 2026
e57f0b2
chore(snapshots): restore gas snapshots truncated in b8a4178
reednaa Oct 15, 2026
8e3efc7
fix(axelar): only map chain names Axelar can route
reednaa Oct 29, 2026
a2d4b94
Merge remote-tracking branch 'origin/main' into feat/axelar-oracle
reednaa Oct 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,85 @@ forge coverage --no-match-coverage "(script|test|wormhole/external/wormhole|worm
forge script deploy --sig "run(string[])" "[<chains>]" --account <account> --slow --multi --isolate --always-use-create-2-factory --verify --broadcast [-vvvv]
```

### Axelar deployment

`script/AxelarOracle.s.sol:DeployAxelarOracle` deploys with CREATE2 (`salt = 0`), matching the
other oracle deployment scripts. Pass the mapping owner, local gateway, and local gas service
explicitly. The deployer can differ from the owner. Deployment does **not** configure any chain maps
and is not restricted to Base or Arbitrum.

Use verified provider addresses for the target network from
[Axelar's mainnet contract reference](https://docs.axelar.dev/dev/reference/mainnet-contract-addresses/).
On Base (8453) and Arbitrum (42161), both providers currently use the addresses in this example:

```shell
OWNER=0x712E90032d8f44bE276A903E1769d64dD1C7F45a
GATEWAY=0xe432150cce91c13a887f7D836923d5597adD8E31
GAS_SERVICE=0x2d5d7d31F671F86C782533cc367F14109a082712
RPC=https://arb1.arbitrum.io/rpc

# Verify the target network and provider code before signing.
cast chain-id --rpc-url "$RPC"
cast code "$GATEWAY" --rpc-url "$RPC"
cast code "$GAS_SERVICE" --rpc-url "$RPC"

# Dry run; no transactions are sent.
forge script script/AxelarOracle.s.sol:DeployAxelarOracle \
--sig 'deploy(address,address,address)' "$OWNER" "$GATEWAY" "$GAS_SERVICE" \
--rpc-url "$RPC" --account deployer

# Deployment only; the deployer signs, not necessarily OWNER.
forge script script/AxelarOracle.s.sol:DeployAxelarOracle \
--sig 'deploy(address,address,address)' "$OWNER" "$GATEWAY" "$GAS_SERVICE" \
--rpc-url "$RPC" --account deployer --broadcast
```

Set `ORACLE` to the returned deployed address. Verify `owner()(address)`, `gateway()(address)`,
and `gasService()(address)` with `cast call`. CREATE2 prediction depends on the factory, salt,
bytecode, and all constructor arguments, not the sender's nonce. Fund the deployer above Forge's
estimated transaction cost, with headroom for fee changes; a dry run does not prove sufficient funds.

#### Separate chain-map configuration

`script/AxelarChainMap.s.sol:ConfigureAxelarChainMap` configures one route per invocation.
The signing account must control the oracle's owner. Axelar names must be lowercase with no NUL, and
must satisfy Axelar's `ChainNameRaw` rule: 1–20 ASCII bytes, no `_`. The script packs the name with
`AxelarStrings.chainKey` and refuses, before broadcasting, any name whose packed key differs from its raw bytes,
such as `Base`; the oracle's setter rejects names that are too long, non-ASCII or contain `_`, which Forge's
simulation also catches before broadcasting. Names and canonical OIF chain IDs are set-once. Repeated
configuration reverts rather than overwriting a route.

```shell
# Example: configure the Base route on an Arbitrum oracle. Dry-run first.
forge script script/AxelarChainMap.s.sol:ConfigureAxelarChainMap \
--sig 'setChainMap(address,string,uint256)' "$ORACLE" base 8453 \
--rpc-url "$RPC" --account owner

# Only after checking the route and signing account:
forge script script/AxelarChainMap.s.sol:ConfigureAxelarChainMap \
--sig 'setChainMap(address,string,uint256)' "$ORACLE" base 8453 \
--rpc-url "$RPC" --account owner --broadcast

cast call "$ORACLE" 'reverseChainIdMap(uint256)(bytes32)' 8453 --rpc-url "$RPC"
# Expected: $(cast --format-bytes32-string base), the lowercase name packed left-aligned.
```

The sibling [`intents-oracle-owner`](../../intents-oracle-owner/README.md) repository keeps its
ceremony owner keys in GitHub Actions, separately from deployment. Use the target chain's
`expectedOwner` from its reviewed configuration when that owner is intended; the example above uses
its current Base/Arbitrum owner. Axelar uses the numeric `setChainMap(uint256,uint256)` that its
reconciler already supports. The key is `uint256(bytes32(bytes(lowercaseName)))`; the oracle
rejects keys that are not packed lowercase names. The local configuration script is for owners
with an available signer; it does not access GitHub-held keys.

Route checks confirm configuration, not live GMP delivery. `submit` takes the destination's OIF
chain ID and the destination oracle's Axelar address string (EVM `0x…`, Stellar `C…` StrKey, Solana
base58), passed through unchecked. Use a nonzero `destinationConfig` only for Solana destinations;
it selects the Borsh envelope. Clients split batches to meet the destination's limits: Stellar
allows 1–4 payloads of ≤684 bytes, and Solana allows one payload of ≤320 bytes. Relayed delivery
requires a positive, off-chain-estimated native gas payment. Self-relay uses zero value and still
requires gateway approval before `execute`.

### Chainlink CCIP deployment

`script/ChainlinkCCIPOracle.s.sol:DeployChainlinkCCIPOracle` deploys with CREATE2 (`salt = 0`).
Expand Down
7 changes: 7 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ fs_permissions = [
{ access = "read", path = "./test/oracle/broadcaster/payloads/ethereum-sepolia" },
]

[profile.default.symbolic]
solver = "z3"
timeout = 120
max_depth = 200000
max_paths = 4096
max_solver_queries = 10000

# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options


Expand Down
33 changes: 33 additions & 0 deletions script/AxelarChainMap.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;

import { Script } from "forge-std/Script.sol";

import { AxelarOracle } from "../src/integrations/oracles/axelar/AxelarOracle.sol";
import { AxelarStrings } from "../src/integrations/oracles/axelar/AxelarStrings.sol";

/// @notice Configures one permanent Axelar route; broadcast with the oracle's owner.
/// Names must be canonical Axelar chain names: 1–20 ASCII bytes, no NUL or `_`, already lowercase. The script rejects
/// a wrongly cased or malformed name before broadcasting; the oracle's setter enforces the length and character rules,
/// and Forge simulates that call before broadcasting, so an invalid name never reaches the permanent map.
///
/// Usage (omit --broadcast for a dry run):
/// forge script script/AxelarChainMap.s.sol:ConfigureAxelarChainMap \
/// --sig 'setChainMap(address,string,uint256)' <ORACLE> <NAME> <CHAIN_ID> \
/// --rpc-url <RPC> --account owner --broadcast
contract ConfigureAxelarChainMap is Script {
function setChainMap(
address oracle,
string calldata name,
uint256 chainId
) external {
// chainKey() checks the packing bounds (1–32 bytes) and NUL bytes; comparing with the raw packing
// additionally requires the input to already be canonical lowercase, so the stored key reads back as exactly
// the name given. The setter adds Axelar's 20-byte, ASCII-only, no-`_` rule.
uint256 packed = AxelarStrings.chainKey(name);
if (packed != uint256(bytes32(bytes(name)))) revert AxelarStrings.InvalidChainName();

vm.broadcast();
AxelarOracle(oracle).setChainMap(packed, chainId);
}
}
25 changes: 25 additions & 0 deletions script/AxelarOracle.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;

import { Script } from "forge-std/Script.sol";

import { AxelarOracle } from "../src/integrations/oracles/axelar/AxelarOracle.sol";

/// @notice Deploys an AxelarOracle without configuring chain maps.
/// Uses CREATE2 with salt zero, matching the other oracle deployment scripts.
/// The owner need not be the broadcasting account.
///
/// Usage (omit --broadcast for a dry run):
/// forge script script/AxelarOracle.s.sol:DeployAxelarOracle \
/// --sig 'deploy(address,address,address)' <OWNER> <GATEWAY> <GAS_SERVICE> \
/// --rpc-url <RPC> --account deployer --broadcast
contract DeployAxelarOracle is Script {
function deploy(
address owner,
address gateway,
address gasService
) external returns (AxelarOracle oracle) {
vm.broadcast();
oracle = new AxelarOracle{ salt: bytes32(0) }(owner, gateway, gasService);
}
}
32 changes: 16 additions & 16 deletions snapshots/inputSettler.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{
"BasePurchaseOrder": "138441",
"CompactFinaliseFor": "167221",
"CompactFinaliseSelf": "158347",
"CompactFinaliseTo": "158347",
"EscrowFinalise": "81268",
"CompactFinaliseFor": "167224",
"CompactFinaliseSelf": "158344",
"CompactFinaliseTo": "158344",
"EscrowFinalise": "76280",
"IntegrationCoinFill": "89862",
"IntegrationCompactFinaliseSelf": "150381",
"IntegrationWormholeReceiveMessage": "73557",
"IntegrationWormholeReceiveMessage": "73570",
"IntegrationWormholeSubmit": "42492",
"broadcast": "43912",
"compactFinaliseSelfWithFee": "189114",
"compactFinaliseSelfWithFee": "189111",
"depositAndRegisterFor": "163659",
"escrowFinaliseSelfWithFee": "106622",
"escrowFinaliseWithSignature": "89900",
"escrowOpen": "83106",
"escrowOpenFor3009Single": "115693",
"escrowOpenFor3009SingleArray": "122525",
"escrowOpenFor3009Two": "178133",
"escrowOpenForMsgSender": "83913",
"escrowOpenForPermit2": "125605",
"escrowRefundOnNonFill": "54410",
"escrowFinaliseSelfWithFee": "106637",
"escrowFinaliseWithSignature": "85025",
"escrowOpen": "82963",
"escrowOpenFor3009Single": "115670",
"escrowOpenFor3009SingleArray": "122502",
"escrowOpenFor3009Two": "178086",
"escrowOpenForMsgSender": "83878",
"escrowOpenForPermit2": "125509",
"escrowRefundOnNonFill": "51784",
"maxTimestamp1": "461",
"minTimestamp1": "483",
"tronEscrowFinaliseSelfWithFee": "111065",
"tronEscrowFinaliseSelfWithFee": "111107",
"validate2Fills": "9617",
"validate2FillsMultipleSolvers": "9617"
}
4 changes: 2 additions & 2 deletions snapshots/oracle.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"bitcoinOutputDispute": "71733",
"bitcoinVerify": "135429",
"bitcoinVerifyWithEmbed": "138039",
"chainlinkCCIPOracleReceive": "54301",
"chainlinkCCIPOracleReceive": "54316",
"chainlinkCCIPOracleSubmit": "64949",
"chainlinkCCIPOracleSubmitFeeToken": "117226",
"citreaFinaliseDispute": "63284",
Expand All @@ -14,7 +14,7 @@
"citreaOutputDispute": "71733",
"citreaVerify": "130685",
"citreaVerifyWithEmbed": "133295",
"hyperlaneOracleHandle": "50281",
"hyperlaneOracleHandle": "50296",
"hyperlaneOracleSubmit": "67472",
"hyperlaneOracleSubmitCustomHook": "67848",
"wormholeOracleSubmit": "42648"
Expand Down
146 changes: 146 additions & 0 deletions src/integrations/oracles/axelar/AxelarOracle.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;

import { IAttester } from "../../../interfaces/IAttester.sol";
import { LibAddress } from "../../../libs/LibAddress.sol";
import { MessageEncodingLib } from "../../../libs/MessageEncodingLib.sol";
import { BaseInputOracle } from "../../../oracles/BaseInputOracle.sol";
import { ChainMap } from "../../../oracles/ChainMap.sol";
import { AxelarStrings } from "./AxelarStrings.sol";
import { SolanaEnvelope } from "./SolanaEnvelope.sol";

interface IAxelarMessageGateway {
function callContract(
string calldata chain,
string calldata destination,
bytes calldata payload
) external;
function validateContractCall(
bytes32 commandId,
string calldata chain,
string calldata sender,
bytes32 hash
) external returns (bool);
}

interface IAxelarNativeGasService {
function payNativeGasForContractCall(
address sender,
string calldata chain,
string calldata destination,
bytes calldata payload,
address refund
) external payable;
}

/// @title AxelarOracle
/// @notice Transparent Axelar GMP oracle with owner-set, immutable chain maps.
/// @dev The owner maps an Axelar chain to an OIF chain through `ChainMap.setChainMap(key, chainId)`, where `key` is
/// the ASCII-lowercased Axelar name packed left-aligned and zero-padded: `uint256(bytes32(bytes(name)))`. The setter
/// accepts only names Axelar can route (1–20 ASCII bytes without NUL or `_`), so `reverseChainIdMap(chainId)` returns
/// the packed name, which `submit` unpacks into the outbound chain name.
/// Inbound sender formats (EVM hex, Stellar StrKey, Solana base58) are inferred from the
/// sender string. No Stellar message limits are enforced here; Stellar and Solana destinations enforce their own,
/// so clients split batches to fit.
contract AxelarOracle is BaseInputOracle, ChainMap {
using LibAddress for address;

enum DeliveryMode {
Relayed,
SelfRelay
}

IAxelarMessageGateway public immutable gateway;
IAxelarNativeGasService public immutable gasService;

error InvalidConfiguration();
error NotAllPayloadsValid();
error NotApproved();
error InvalidFee();

/// @dev Axelar `ChainNameRaw::MAX_LEN`: the longest chain name Axelar routes.
uint256 private constant MAX_CHAIN_NAME = 20;

constructor(
address owner_,
address gateway_,
address gasService_
) ChainMap(owner_) {
if (gateway_.code.length == 0 || gasService_.code.length == 0) revert InvalidConfiguration();
gateway = IAxelarMessageGateway(gateway_);
gasService = IAxelarNativeGasService(gasService_);
}

/// @notice Sets an immutable map from a packed lowercase Axelar name to an OIF chain ID.
/// @dev `protocolChainIdentifier` must be `uint256(bytes32(bytes(name)))` for a name Axelar's `ChainNameRaw`
/// accepts (1–20 bytes, ASCII only, no `_`), with no NUL and no ASCII uppercase. Anything else (zero,
/// right-aligned, bytes after a NUL, uppercase, too long, non-ASCII, `_`) reverts `AxelarStrings.InvalidChainName`:
/// the map is set-once, so a name Axelar cannot route would permanently consume `chainId`.
function setChainMap(
uint256 protocolChainIdentifier,
uint256 chainId
) public override onlyOwner {
bytes memory name = bytes(AxelarStrings.chainName(protocolChainIdentifier));
if (AxelarStrings.chainKey(string(name)) != protocolChainIdentifier) revert AxelarStrings.InvalidChainName();
if (name.length > MAX_CHAIN_NAME) revert AxelarStrings.InvalidChainName();
for (uint256 i; i < name.length; ++i) {
if (name[i] >= 0x80 || name[i] == "_") revert AxelarStrings.InvalidChainName();
}
super.setChainMap(protocolChainIdentifier, chainId);
}

/// @notice Sends attested payloads to the Axelar chain mapped to `destinationChainId`.
/// @dev `recipientOracle` is passed to Axelar unchecked. A wrong recipient or config loses only that delivery:
/// export does not consume anything, so anyone can submit again.
/// @param destinationChainId OIF chain ID of the destination; must be mapped.
/// @param recipientOracle Destination oracle as an Axelar address string (`0x…`, `C…` StrKey, or base58).
/// @param source Attester whose payloads are sent.
/// @param payloads Payloads `source` has attested.
/// @param destinationConfig Nonzero selects the Solana Borsh envelope with this config; zero sends the raw message.
/// @param deliveryMode `Relayed` pays `msg.value` to the gas service; `SelfRelay` requires no value.
function submit(
uint256 destinationChainId,
string calldata recipientOracle,
address source,
bytes[] calldata payloads,
bytes32 destinationConfig,
DeliveryMode deliveryMode
) external payable {
uint256 key = reverseChainIdMap[destinationChainId];
if (key == 0) revert ZeroValue();
string memory chain = AxelarStrings.chainName(key);
if (!IAttester(source).hasAttested(payloads)) revert NotAllPayloadsValid();
bytes memory message = MessageEncodingLib.encodeMessage(source.toIdentifier(), payloads);
if (destinationConfig != 0) message = SolanaEnvelope.encode(message, destinationConfig);
if (deliveryMode == DeliveryMode.Relayed) {
if (msg.value == 0) revert InvalidFee();
gasService.payNativeGasForContractCall{ value: msg.value }(
address(this), chain, recipientOracle, message, msg.sender
);
} else if (msg.value != 0) {
revert InvalidFee();
}
gateway.callContract(chain, recipientOracle, message);
}

/// @notice Records the payload hashes of a gateway-approved message.
/// @dev Anyone may execute, but only the gateway can approve the exact destination-bound message. The original
/// `sourceChain` and `sourceAddress` strings are validated, since Axelar binds the approved spelling.
function execute(
bytes32 commandId,
string calldata sourceChain,
string calldata sourceAddress,
bytes calldata payload
) external {
uint256 chainId = _getMappedChainId(AxelarStrings.chainKey(sourceChain));
bytes32 sender = AxelarStrings.decodeAddress(sourceAddress);
if (!gateway.validateContractCall(commandId, sourceChain, sourceAddress, keccak256(payload))) {
revert NotApproved();
}
(bytes32 application, bytes32[] memory hashes) = MessageEncodingLib.getHashesOfEncodedPayloads(payload);
for (uint256 i; i < hashes.length; ++i) {
_attestations[chainId][sender][application][hashes[i]] = true;
emit OutputProven(chainId, sender, application, hashes[i]);
}
}
}
Loading
Loading