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

Uniswap

Permit2

failingdex

Signature-based approvals shared by Uniswap, 1inch, CoW and many wallets.

Not on Starknet yet. Permit2 is 83880 CASM felts, over the 81920 limit, and has no selector dispatcher to split by.
Ethereum
0x000000000022D473030F116dDEE9F6B43aC78BA3
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.

exact1,483

proved equivalent, no assumption

mapped21

equivalent under a recorded assumption

divergent7

behaves differently on Starknet

blocked0

cannot be preserved; the source must change

divergent 7 findings

HD0151block.timestamp / block.number follow Starknet block cadencesrc/AllowanceTransfer.sol:34
if (block.timestamp > permitSingle.sigDeadline) revert SignatureExpired(permitSingle.sigDeadline);

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 cadencesrc/AllowanceTransfer.sol:44
if (block.timestamp > permitBatch.sigDeadline) revert SignatureExpired(permitBatch.sigDeadline);

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 cadencesrc/AllowanceTransfer.sol:79
if (block.timestamp > allowed.expiration) revert AllowanceExpired(allowed.expiration);

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 cadencesrc/SignatureTransfer.sol:60
if (block.timestamp > permit.deadline) revert SignatureExpired(permit.deadline);

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 cadencesrc/SignatureTransfer.sol:108
if (block.timestamp > permit.deadline) revert SignatureExpired(permit.deadline);

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 cadencesrc/libraries/Allowance.sol:24
uint48 storedExpiration = expiration == BLOCK_TIMESTAMP_EXPIRATION ? uint48(block.timestamp) : expiration;

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 cadencesrc/libraries/Allowance.sol:40
allowed.expiration = expiration == 0 ? uint48(block.timestamp) : expiration;

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

HD0101msg.sender is the caller's 160-bit alias9

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

src/AllowanceTransfer.sol:27PackedAllowance storage allowed = allowance[msg.sender][token][spender];
src/AllowanceTransfer.sol:77PackedAllowance storage allowed = allowance[from][token][msg.sender];
src/AllowanceTransfer.sol:98address owner = msg.sender;
src/AllowanceTransfer.sol:114uint48 oldNonce = allowance[msg.sender][token][spender].nonce;
src/SignatureTransfer.sol:131nonceBitmap[msg.sender][wordPos] |= mask;
src/libraries/PermitHash.sol:62abi.encode(_PERMIT_TRANSFER_FROM_TYPEHASH, tokenPermissionsHash, msg.sender, permit.nonce, permit.deadline)
src/libraries/PermitHash.sol:78msg.sender,
src/libraries/PermitHash.sol:93return keccak256(abi.encode(typeHash, tokenPermissionsHash, msg.sender, permit.nonce, permit.deadline, witness));
src/libraries/PermitHash.sol:115msg.sender,
HD0130EVM log emitted as a Starknet event5

indexers read topics from event keys and data from event data

src/AllowanceTransfer.sol:29emit Approval(msg.sender, token, spender, amount, expiration);
src/AllowanceTransfer.sol:107emit Lockdown(owner, token, spender);
src/AllowanceTransfer.sol:125emit NonceInvalidation(msg.sender, token, spender, newNonce, oldNonce);
src/AllowanceTransfer.sol:141emit Permit(owner, token, spender, amount, expiration, nonce);
src/SignatureTransfer.sol:133emit UnorderedNonceInvalidation(msg.sender, wordPos, mask);
HD0152block.chainid is the Starknet chain id2

no action needed; EIP-712 domains will use the Starknet chain id

src/EIP712.sol:20_CACHED_CHAIN_ID = block.chainid;
src/EIP712.sol:27return block.chainid == _CACHED_CHAIN_ID
HD0160external call routed through the alias registry2

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

lib/solmate/src/utils/SafeTransferLib.sol:40assembly {
src/libraries/SignatureVerification.sol:43bytes4 magicValue = IERC1271(claimedSigner).isValidSignature(hash, signature);
HD0102address(this) is this contract's 160-bit alias1

no action needed

src/EIP712.sol:34return keccak256(abi.encode(typeHash, nameHash, block.chainid, address(this)));
HD0140code size check means 'is deployed' on Starknet1

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

src/libraries/SignatureVerification.sol:26if (claimedSigner.code.length == 0) {
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

lib/solmate/src/utils/SafeTransferLib.sol:40assembly {

The other 1,483 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
Permit2not declared
83,880

Build time: 5.1 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 0x000000000022D473030F116dDEE9F6B43aC78BA3
solc (deployed)
0.8.17
Optimizer runs
1,000,000
Via IR (deployed)
yes
Compilation target
src/Permit2.sol:Permit2
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.