Skip to content
This repository was archived by the owner on Dec 3, 2025. It is now read-only.

Conversation

@batconjurer
Copy link
Contributor

This PR replaces the explicit Warp contract in the TeleporterMessenger contracts with an interface. An implimentation of this interface is provided that works identically for internal interop. It is built on top of #888

Comment on lines +585 to +568
require(
teleporterMessage.destinationBlockchainID == blockchainID_,
"TeleporterMessenger: invalid destination chain ID"
);

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.
Comment on lines +585 to +568
require(
teleporterMessage.destinationBlockchainID == blockchainID_,
"TeleporterMessenger: invalid destination chain ID"
);

Check notice

Code scanning / Semgrep PRO

Semgrep Finding: solidity.performance.use-short-revert-string.use-short-revert-string Note

Shortening revert strings to fit in 32 bytes will decrease gas costs for deployment and gas costs when the revert condition has been met.
);

// Require that the message has not been received previously.
require(!_messageReceived(messageID), "TeleporterMessenger: message already received");

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.
);

// Require that the message has not been received previously.
require(!_messageReceived(messageID), "TeleporterMessenger: message already received");

Check notice

Code scanning / Semgrep PRO

Semgrep Finding: solidity.performance.use-short-revert-string.use-short-revert-string Note

Shortening revert strings to fit in 32 bytes will decrease gas costs for deployment and gas costs when the revert condition has been met.
Comment on lines +599 to +582
require(
_checkIsAllowedRelayer(msg.sender, teleporterMessage.allowedRelayerAddresses),
"TeleporterMessenger: unauthorized relayer"
);

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.
Comment on lines +599 to +582
require(
_checkIsAllowedRelayer(msg.sender, teleporterMessage.allowedRelayerAddresses),
"TeleporterMessenger: unauthorized relayer"
);

Check notice

Code scanning / Semgrep PRO

Semgrep Finding: solidity.performance.use-short-revert-string.use-short-revert-string Note

Shortening revert strings to fit in 32 bytes will decrease gas costs for deployment and gas costs when the revert condition has been met.
// Process the receipts that were included in the teleporter message by paying the
// fee for the messages are reward to the given relayers.
uint256 length = teleporterMessage.receipts.length;
for (uint256 i; i < length; ++i) {

Check notice

Code scanning / Semgrep PRO

Semgrep Finding: solidity.performance.unnecessary-checked-arithmetic-in-loop.unnecessary-checked-arithmetic-in-loop Note

A lot of times there is no risk that the loop counter can overflow. Using Solidity's unchecked block saves the overflow checks.
@batconjurer batconjurer force-pushed the bat/add-warp-interface-to-teleporter branch from f81a637 to 5e9ffa6 Compare November 26, 2025 14:37
@batconjurer batconjurer force-pushed the bat/avalanche-contract-folder-refactor branch from cf90012 to d66d980 Compare November 27, 2025 09:30
@batconjurer batconjurer force-pushed the bat/add-warp-interface-to-teleporter branch 3 times, most recently from 882f519 to e5d7280 Compare November 28, 2025 09:42
uint256 amount;
}


Copy link

@mdelle1 mdelle1 Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add brief documentation to these structs to keep it consistent with the repo's style and potentially explain the motivation for the ICMMessage type given the lack of access lists on Ethereum

@@ -0,0 +1,27 @@
// (c) 2025, Ava Labs, Inc. All rights reserved.
Copy link

@mdelle1 mdelle1 Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this code live in the avalanche/... directory? As fas as I understand, contracts implementing IWarpExt should live on external chains that don't have access lists?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants