Skip to content
Draft
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a34b0b9
Restructure
michaelkaplan13 Jul 17, 2025
d705a68
save
michaelkaplan13 Jul 22, 2025
ca2d534
E2E test set up and log fix
michaelkaplan13 Jul 23, 2025
33d00bf
working e2e test
michaelkaplan13 Jul 25, 2025
3ec202d
Clean up
michaelkaplan13 Jul 25, 2025
fb32a42
Update TODOs
michaelkaplan13 Jul 25, 2025
2d07682
Add Warp adapters for validating messages on Ethereum. Needs testing
batconjurer Oct 31, 2025
1a7fa48
Added a test that validator set registry enforces the network id. Als…
batconjurer Oct 31, 2025
401e993
Adding unit tests for verifying warp messages on Ethereum
batconjurer Nov 4, 2025
30f820b
Small cleanup
batconjurer Nov 5, 2025
e005e00
Fixed unit tests and added to the Ethereum ICM e2e test
batconjurer Nov 14, 2025
7d8c63b
small cleanups
batconjurer Nov 14, 2025
06a43f4
small cleanups
batconjurer Nov 14, 2025
dcbddd4
Cleanup: remove unneeded field from EthWarp contract
batconjurer Nov 17, 2025
13fce4f
Fleshed out e2e test
batconjurer Nov 17, 2025
5277257
Fleshed out e2e test
batconjurer Nov 17, 2025
bfe38dd
Strengthen checks for checking an ICM message was correctly sent to E…
batconjurer Nov 17, 2025
25a32e1
Fixed the packing of ReceiveInterChainMessage calls
batconjurer Nov 18, 2025
b740bfd
switch from spaces to tabs
batconjurer Nov 18, 2025
74958a6
Update tests/utils/eth_warp.go
batconjurer Nov 19, 2025
cf96fb4
Addressing PR comments regarding e2e logging and error handling
batconjurer Nov 19, 2025
aa36665
Refactor TeleporterMessenger contract to use initializer modifier
batconjurer Nov 19, 2025
0749ba3
Update ethereum/contracts/utils/ICM.sol
batconjurer Nov 20, 2025
4dce051
Addressing PR comments
batconjurer Nov 20, 2025
8caaea7
Update ethereum/contracts/utils/ICM.sol
batconjurer Nov 24, 2025
6ead19f
Enforce the blockchain ID validation in AvalancheValidatorSetRegisty …
batconjurer Nov 25, 2025
9c2115e
Add originSenderAddress to warp messages received on ethereum
batconjurer Nov 26, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/abi_bindings_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Install solc
run: |
source ./scripts/versions.sh
wget https://github.com/ethereum/solidity/releases/download/v$SOLIDITY_VERSION/solc-static-linux
wget https://github.com/ethereum/solidity/releases/download/v$AVALANCHE_SOLIDITY_VERSION/solc-static-linux
chmod +x solc-static-linux
sudo mv solc-static-linux /usr/local/bin/solc

Expand Down
15 changes: 9 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
[submodule "lib/forge-std"]
[submodule "avalanche/lib/forge-std"]
branch = v1
path = lib/forge-std
path = avalanche/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/openzeppelin-contracts-upgradeable"]
path = lib/openzeppelin-contracts-upgradeable
[submodule "avalanche/lib/openzeppelin-contracts-upgradeable"]
path = avalanche/lib/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
[submodule "lib/subnet-evm"]
path = lib/subnet-evm
[submodule "avalanche/lib/subnet-evm"]
path = avalanche/lib/subnet-evm
url = https://github.com/ava-labs/subnet-evm
[submodule "ethereum/lib/forge-std"]
path = ethereum/lib/forge-std
url = https://github.com/foundry-rs/forge-std

Large diffs are not rendered by default.

620 changes: 620 additions & 0 deletions abi-bindings/go/EthWarp/EthWarp.go

Large diffs are not rendered by default.

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions abi-bindings/go/teleporter/TeleporterMessenger/packing.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"math/big"

"github.com/ava-labs/avalanchego/ids"
avalancheWarp "github.com/ava-labs/avalanchego/vms/platformvm/warp"
"github.com/ava-labs/libevm/common"
"github.com/ava-labs/subnet-evm/accounts/abi"
"github.com/pkg/errors"
Expand Down Expand Up @@ -91,6 +92,17 @@ func PackReceiveCrossChainMessage(messageIndex uint32, relayerRewardAddress comm
return abi.Pack("receiveCrossChainMessage", messageIndex, relayerRewardAddress)
}

// PackReceiveInterChainMessage packs a ReceiveInterChainMessageInput to form
// a call to the receiveInterChainMessage function
func PackReceiveInterChainMessage(messagePayload *avalancheWarp.Message, relayerRewardAddress common.Address) ([]byte, error) {
abi, err := TeleporterMessengerMetaData.GetAbi()
if err != nil {
return nil, errors.Wrap(err, "failed to get abi")
}

return abi.Pack("receiveInterChainMessage", messagePayload, relayerRewardAddress)
}

// PackCalculateMessageID packs input to form a call to the calculateMessageID function
func PackCalculateMessageID(
sourceBlockchainID [32]byte,
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// SPDX-License-Identifier: LicenseRef-Ecosystem

pragma solidity 0.8.25;
pragma solidity ^0.8.25;

// A message receipt identifies the message that was delivered by its nonce,
// and the address that can redeem the reward for that message.
Expand All @@ -26,7 +26,7 @@ struct TeleporterMessageInput {
bytes message;
}

// Represents a message sent or received by an implementation of {ITeleporterMessenger}.
// Represents a cross-chain message sent or received by an implementation of {ITeleporterMessenger}.
struct TeleporterMessage {
uint256 messageNonce;
address originSenderAddress;
Expand All @@ -46,6 +46,27 @@ struct TeleporterFeeInfo {
uint256 amount;
}


struct ICMSignature {
bytes signers;
bytes signature;
}


struct ICMUnsignedMessage {
uint32 avalancheNetworkID;
bytes32 avalancheSourceBlockchainID;
bytes payload;
}

/// A signed ICM message which carries a Teleporter message
struct ICMMessage {
ICMUnsignedMessage unsignedMessage;
bytes unsignedMessageBytes;
ICMSignature signature;
}


/**
* @dev Interface that describes functionalities for a cross-chain messenger implementing the Teleporter protcol.
*
Expand Down Expand Up @@ -125,6 +146,7 @@ interface ITeleporterMessenger {
TeleporterMessageInput calldata messageInput
) external returns (bytes32);


/**
* @notice Called by transactions to retry the sending of a cross-chain message.
*
Expand Down Expand Up @@ -160,6 +182,12 @@ interface ITeleporterMessenger {
*/
function receiveCrossChainMessage(uint32 messageIndex, address relayerRewardAddress) external;

/**
* @notice Receives an inter-chain message, and marks the `relayerRewardAddress` for fee reward for a successful delivery.
*
*/
function receiveInterChainMessage(ICMMessage calldata icmMessage, address relayerRewardAddress) external;

/**
* @notice Retries the execution of a previously delivered message by verifying the payload matches
* the hash of the payload originally delivered, and calling the destination address again.
Expand Down Expand Up @@ -187,7 +215,7 @@ interface ITeleporterMessenger {
bytes32[] calldata messageIDs,
TeleporterFeeInfo calldata feeInfo,
address[] calldata allowedRelayerAddresses
) external returns (bytes32);
) external returns (bytes32); /**

/**
* @notice Sends any fee amount rewards for the given fee asset out to the caller.
Expand Down
27 changes: 27 additions & 0 deletions avalanche/contracts/teleporter/IWarpExt.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// (c) 2025, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

// SPDX-License-Identifier: LicenseRef-Ecosystem

pragma solidity ^0.8.25;

import {
WarpMessage,
IWarpMessenger
} from "@avalabs/[email protected]/contracts/interfaces/IWarpMessenger.sol";
import {ICMMessage} from "./ITeleporterMessenger.sol";

/**
* @dev Interface that allows adapting the Warp interface. This is necessary for external interoperability
* since external chains do not receive Warp messages in their access lists.
*/
interface IWarpExt is IWarpMessenger {
/**
* @notice Depending on the chain this contract is deployed on, dispatch logic for
* getting the actual verified Warp message.
* @return message A verified Warp message.
*/
function getVerifiedICMMessage(
ICMMessage calldata icmMessag3
) external view returns (WarpMessage memory message);
}
47 changes: 47 additions & 0 deletions avalanche/contracts/teleporter/NativeWarp.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// (c) 2025, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

// SPDX-License-Identifier: LicenseRef-Ecosystem

pragma solidity 0.8.25;

import {
WarpMessage,
WarpBlockHash,
IWarpMessenger
} from "@avalabs/[email protected]/contracts/interfaces/IWarpMessenger.sol";
import {ICMMessage} from "./ITeleporterMessenger.sol";
import {IWarpExt} from "./IWarpExt.sol";

contract WarpNative is IWarpExt {
/**
* @notice Warp precompile used for sending and receiving Warp messages.
*/
IWarpMessenger public constant WARP_MESSENGER =
IWarpMessenger(0x0200000000000000000000000000000000000005);

function getVerifiedICMMessage(
ICMMessage calldata icmMessage
) external view returns (WarpMessage memory message) {
revert("Todo");

Check notice

Code scanning / Semgrep PRO

Semgrep Finding: solidity.performance.use-custom-error-not-require.use-custom-error-not-require Note

Consider using custom errors as they are more gas efficient while allowing developers to describe the error in detail using NatSpec.
}

function getVerifiedWarpMessage(uint32 index) external view returns (WarpMessage memory message, bool valid) {
return WARP_MESSENGER.getVerifiedWarpMessage(index);
}

function sendWarpMessage(bytes calldata payload) external returns (bytes32 messageID) {
return WARP_MESSENGER.sendWarpMessage(payload);
}

function getVerifiedWarpBlockHash(
uint32 index
) external view returns (WarpBlockHash memory warpBlockHash, bool valid) {
return WARP_MESSENGER.getVerifiedWarpBlockHash(index);
}

function getBlockchainID() external view returns (bytes32 blockchainID) {
return WARP_MESSENGER.getBlockchainID();
}

}
Loading
Loading