Sample data. Built from the compile survey; nothing on this site is deployed or attested yet.
hyperdriveregistry

LayerZero

EndpointV2

failinginfra

LayerZero v2 messaging endpoint (OFT tokens bridge through it).

Not on Starknet yet. EndpointV2 is 160492 CASM felts, over the 81920 limit, and has no selector dispatcher to split by.
Ethereum
0x1a44076050125825900e736c501f859c50fE728c
Starknet Sepolia
Not deployed yet
Same code, not same state. The Starknet contract runs the same code as the Ethereum one, but it starts empty: balances, positions, owners and settings on Ethereum do not carry over.

What is different on Starknet#

hyperdrive check reports every place this contract depends on the EVM, at its Solidity line. Exact counts operations; the other tiers count findings. About tiers.

exact3,561

proved equivalent, no assumption

mapped59

equivalent under a recorded assumption

divergent5

behaves differently on Starknet

blocked0

cannot be preserved; the source must change

divergent 5 findings

HD0151block.timestamp / block.number follow Starknet block cadencecontracts/MessageLibManager.sol:128
if (timeout.lib == _actualReceiveLib && timeout.expiry > block.number) {

acknowledge if your logic uses wall-clock windows, not block counts

Acknowledged: survey: auto-acknowledged to measure the build

HD0151block.timestamp / block.number follow Starknet block cadencecontracts/MessageLibManager.sol:187
timeout.expiry = block.number + _gracePeriod;

acknowledge if your logic uses wall-clock windows, not block counts

Acknowledged: survey: auto-acknowledged to measure the build

HD0151block.timestamp / block.number follow Starknet block cadencecontracts/MessageLibManager.sol:210
if (_expiry <= block.number) revert Errors.LZ_InvalidExpiry();

acknowledge if your logic uses wall-clock windows, not block counts

Acknowledged: survey: auto-acknowledged to measure the build

HD0151block.timestamp / block.number follow Starknet block cadencecontracts/MessageLibManager.sol:266
Timeout memory timeout = Timeout({ lib: oldLib, expiry: block.number + _gracePeriod });

acknowledge if your logic uses wall-clock windows, not block counts

Acknowledged: survey: auto-acknowledged to measure the build

HD0151block.timestamp / block.number follow Starknet block cadencecontracts/MessageLibManager.sol:296
if (_expiry <= block.number) revert Errors.LZ_InvalidExpiry();

acknowledge if your logic uses wall-clock windows, not block counts

Acknowledged: survey: auto-acknowledged to measure the build

mapped Mapped: equivalent under the assumptions below

HD0130EVM log emitted as a Starknet event25

indexers read topics from event keys and data from event data

@openzeppelin/contracts/access/Ownable.sol:81emit OwnershipTransferred(oldOwner, newOwner);
contracts/EndpointV2.sol:141emit PacketSent(encodedPacket, _params.options, _sendLibrary);
contracts/EndpointV2.sol:160emit PacketVerified(_origin, _receiver, _payloadHash);
contracts/EndpointV2.sol:182emit PacketDelivered(_origin, _receiver);
contracts/EndpointV2.sol:201emit LzReceiveAlert(_receiver, msg.sender, _origin, _guid, _gas, _value, _message, _extraData, _reason);
contracts/EndpointV2.sol:216emit PacketDelivered(_origin, _oapp);
contracts/EndpointV2.sol:226emit LzTokenSet(_lzToken);
contracts/EndpointV2.sol:329emit DelegateSet(msg.sender, _delegate);
contracts/MessageLibManager.sol:150emit LibraryRegistered(_lib);
contracts/MessageLibManager.sol:164emit DefaultSendLibrarySet(_eid, _newLib);
contracts/MessageLibManager.sol:181emit DefaultReceiveLibrarySet(_eid, _newLib);
contracts/MessageLibManager.sol:188emit DefaultReceiveLibraryTimeoutSet(_eid, oldLib, timeout.expiry);
contracts/MessageLibManager.sol:192emit DefaultReceiveLibraryTimeoutSet(_eid, oldLib, 0);
contracts/MessageLibManager.sol:215emit DefaultReceiveLibraryTimeoutSet(_eid, _lib, _expiry);
contracts/MessageLibManager.sol:237emit SendLibrarySet(_oapp, _eid, _newLib);
contracts/MessageLibManager.sol:257emit ReceiveLibrarySet(_oapp, _eid, _newLib);
contracts/MessageLibManager.sol:268emit ReceiveLibraryTimeoutSet(_oapp, _eid, oldLib, timeout.expiry);
contracts/MessageLibManager.sol:271emit ReceiveLibraryTimeoutSet(_oapp, _eid, oldLib, 0);
contracts/MessageLibManager.sol:301emit ReceiveLibraryTimeoutSet(_oapp, _eid, _lib, _expiry);
contracts/MessagingChannel.sol:87emit InboundNonceSkipped(_srcEid, _sender, _oapp, _nonce);
contracts/MessagingChannel.sol:104emit PacketNilified(_srcEid, _sender, _oapp, _nonce, _payloadHash);
contracts/MessagingChannel.sol:120emit PacketBurnt(_srcEid, _sender, _oapp, _nonce, _payloadHash);
contracts/MessagingComposer.sol:27emit ComposeSent(msg.sender, _to, _guid, _index, _message);
contracts/MessagingComposer.sol:58emit ComposeDelivered(_from, _to, _guid, _index);
contracts/MessagingComposer.sol:78emit LzComposeAlert(_from, _to, msg.sender, _guid, _index, _gas, _value, _message, _extraData, _reason);
HD0160external call routed through the alias registry14

target addresses resolve through aliases or link symbols in hyperdrive.toml

@openzeppelin/contracts/utils/Address.sol:135(bool success, bytes memory returndata) = target.call{value: value}(data);
contracts/EndpointV2.sol:77return ISendLib(_sendLibrary).quote(packet, _params.options, _params.payInLzToken);
contracts/EndpointV2.sol:133(MessagingFee memory fee, bytes memory encodedPacket) = ISendLib(_sendLibrary).send(
contracts/EndpointV2.sol:181ILayerZeroReceiver(_receiver).lzReceive{ value: msg.value }(_origin, _guid, _message, msg.sender, _extraData);
contracts/EndpointV2.sol:289supplied = IERC20(lzToken).balanceOf(address(this));
contracts/EndpointV2.sol:340ILayerZeroReceiver(_receiver).allowInitializePath(_origin);
contracts/MessageLibManager.sol:46if (IMessageLib(_lib).messageLibType() == MessageLibType.Receive) revert Errors.LZ_OnlySendLib();
contracts/MessageLibManager.sol:53if (IMessageLib(_lib).messageLibType() == MessageLibType.Send) revert Errors.LZ_OnlyReceiveLib();
contracts/MessageLibManager.sol:67if (!IMessageLib(_lib).isSupportedEid(_eid)) revert Errors.LZ_UnsupportedEid();
contracts/MessageLibManager.sol:142if (!IERC165(_lib).supportsInterface(type(IMessageLib).interfaceId)) revert Errors.LZ_UnsupportedInterface();
contracts/MessageLibManager.sol:310IMessageLib(_lib).setConfig(_oapp, _params);
contracts/MessageLibManager.sol:320return IMessageLib(_lib).getConfig(_eid, _oapp, _configType);
contracts/MessagingComposer.sol:57ILayerZeroComposer(_to).lzCompose{ value: msg.value }(_from, _guid, _message, msg.sender, _extraData);
contracts/libs/Transfer.sol:18(bool success, ) = _to.call{ value: _value }("");
HD0101msg.sender is the caller's 160-bit alias10

no action needed; Ethereum-key accounts keep their Ethereum address

@openzeppelin/contracts/utils/Context.sol:18return msg.sender;
contracts/EndpointV2.sol:86) external payable sendContext(_params.dstEid, msg.sender) returns (MessagingReceipt memory) {
contracts/EndpointV2.sol:152if (!isValidReceiveLibrary(_receiver, _origin.srcEid, msg.sender)) revert Errors.LZ_InvalidReceiveLibrary();
contracts/EndpointV2.sol:181ILayerZeroReceiver(_receiver).lzReceive{ value: msg.value }(_origin, _guid, _message, msg.sender, _extraData);
contracts/EndpointV2.sol:201emit LzReceiveAlert(_receiver, msg.sender, _origin, _guid, _gas, _value, _message, _extraData, _reason);
contracts/EndpointV2.sol:328delegates[msg.sender] = _delegate;
contracts/EndpointV2.sol:356if (msg.sender != _oapp && msg.sender != delegates[_oapp]) revert Errors.LZ_Unauthorized();
contracts/MessagingComposer.sol:25if (composeQueue[msg.sender][_to][_guid][_index] != NO_MESSAGE_HASH) revert Errors.LZ_ComposeExists();
contracts/MessagingComposer.sol:57ILayerZeroComposer(_to).lzCompose{ value: msg.value }(_from, _guid, _message, msg.sender, _extraData);
contracts/MessagingComposer.sol:78emit LzComposeAlert(_from, _to, msg.sender, _guid, _index, _gas, _value, _message, _extraData, _reason);
HD0140code size check means 'is deployed' on Starknet4

every Starknet account is a contract: code-length checks on users are always true

@openzeppelin/contracts/utils/Address.sol:45return account.code.length > 0;
contracts/EndpointV2.sol:181ILayerZeroReceiver(_receiver).lzReceive{ value: msg.value }(_origin, _guid, _message, msg.sender, _extraData);
contracts/MessageLibManager.sol:310IMessageLib(_lib).setConfig(_oapp, _params);
contracts/MessagingComposer.sol:57ILayerZeroComposer(_to).lzCompose{ value: msg.value }(_from, _guid, _message, msg.sender, _extraData);
HD0110msg.value is an amount of the network's value token3

no action needed; the registry admin sets the value token (ETH or STRK) once per network

contracts/EndpointV2.sol:181ILayerZeroReceiver(_receiver).lzReceive{ value: msg.value }(_origin, _guid, _message, msg.sender, _extraData);
contracts/EndpointV2.sol:301return msg.value;
contracts/MessagingComposer.sol:57ILayerZeroComposer(_to).lzCompose{ value: msg.value }(_from, _guid, _message, msg.sender, _extraData);
HD0102address(this) is this contract's 160-bit alias1

no action needed

contracts/EndpointV2.sol:289supplied = IERC20(lzToken).balanceOf(address(this));
HD0161a failing external call returns false with its revert data (Starknet v0.13.4 or later)1

no action needed; deploy to a network running Starknet v0.13.4 or later

@openzeppelin/contracts/utils/Address.sol:135(bool success, bytes memory returndata) = target.call{value: value}(data);
HD0163new Contract deploys the child's class declared in the alias registry1

declare each child class once per network: registry.declare(selector(name), class_hash)

contracts/MessageLibManager.sol:35blockedLibrary = address(new BlockedMessageLib());

The other 3,561 operations translate exactly: proved equivalent, with no assumption.

Assumptions#

From the build's certificate: what this contract's equivalence rests on, beyond the Lean proof. What these mean.

  • A-STORAGE-HASHhyperdrive's Poseidon hashes have no collisions on reachable inputs: storage slots (HD0120), keccak256 cache keys and Poseidon slot hashes (HD0123).
  • A-ALIASContracts are registered with the HdRegistry passed to their constructor, and an unregistered account's low 160 bits are not a registered alias. Registered addresses never share an alias (proved: RegistryProof.alias_injective).
  • A-SLOT-MODECode compiled with Poseidon slots and code with keccak256 slots never share storage. The constructor records slot mode keccak in this contract's storage and every delegatecall frame running this code checks the storage owner's mode (reverting with "hyperdrive: storage slot mode mismatch"). Not checked: an upgrade with replace_class must keep the slot mode of the class it replaces (both builds' ASSUMPTIONS.md name it).

Tested against the EVM#

The same calls run on the compiled Cairo and on revm, compared on return data, reverts, events, storage and balances.

Differential runs: not yet measured.

Cost#

EVM gas on Ethereum next to Starknet L2 gas for the same call. They are different units with different prices, so compare contracts, not the two columns. Raw is the EVM calldata entry point; typed is the Starknet ABI entry point. About costs.

Per-call cost: not yet measured.

Classes#

Starknet limits a class to 81,920 CASM felts. A larger contract is split by function selector into classes that call each other by library call.

ClassClass hashCASM felts of 81,920
EndpointV2not declared
160,492

Build time: 11.4 s (wall time, depends on the compile cache).

Reproduce#

Rebuild from the Sourcify source and compare class hashes with the deployed ones. Nothing here needs trusting the registry.

hyperdrive verify 0x1a44076050125825900e736c501f859c50fE728c
solc (deployed)
0.8.22
Optimizer runs
20,000
Via IR (deployed)
no
Compilation target
contracts/EndpointV2.sol:EndpointV2
Sourcify match
partial

Attestations#

Each attestation is an on-chain record that someone rebuilt this contract and got the deployed class hashes. Anyone who runs hyperdrive verify can add one.

No attestations yet.