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

Compound III

CometWithExtendedAssetList

buildslending

Compound III cUSDCv3 implementation.

Ethereum
0x0B07565A8ef48170e15918b251EbD95109B23255

Implementation behind proxy 0xc3d6…cdc3

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,198

proved equivalent, no assumption

mapped49

equivalent under a recorded assumption

divergent4

behaves differently on Starknet

blocked0

cannot be preserved; the source must change

divergent 4 findings

HD0150gasleft() uses Starknet gas unitscontracts/CometWithExtendedAssetList.sol:1034
uint startGas = gasleft();

acknowledge, or remove logic that depends on exact gas amounts

Acknowledged: survey: auto-acknowledged to measure the build

HD0150gasleft() uses Starknet gas unitscontracts/CometWithExtendedAssetList.sol:1040
uint gasUsed = startGas - gasleft();

acknowledge, or remove logic that depends on exact gas amounts

Acknowledged: survey: auto-acknowledged to measure the build

HD0151block.timestamp / block.number follow Starknet block cadencecontracts/CometWithExtendedAssetList.sol:247
if (block.timestamp >= 2**40) revert TimestampTooLarge();

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

Acknowledged: survey: auto-acknowledged to measure the build

HD0154fee and coinbase values have no Starknet equivalentcontracts/CometWithExtendedAssetList.sol:1049
points.approxSpend += safe128(gasUsed * block.basefee);

acknowledge; these return fixed values

Acknowledged: survey: auto-acknowledged to measure the build

mapped Mapped: equivalent under the assumptions below

HD0130EVM log emitted as a Starknet event15

indexers read topics from event keys and data from event data

contracts/CometWithExtendedAssetList.sol:513emit PauseAction(supplyPaused, transferPaused, withdrawPaused, absorbPaused, buyPaused);
contracts/CometWithExtendedAssetList.sol:771emit Supply(from, dst, amount);
contracts/CometWithExtendedAssetList.sol:774emit Transfer(address(0), dst, presentValueSupply(baseSupplyIndex, supplyAmount));
contracts/CometWithExtendedAssetList.sol:797emit SupplyCollateral(from, dst, asset, amount);
contracts/CometWithExtendedAssetList.sol:895emit Transfer(src, address(0), presentValueSupply(baseSupplyIndex, withdrawAmount));
contracts/CometWithExtendedAssetList.sol:899emit Transfer(address(0), dst, presentValueSupply(baseSupplyIndex, supplyAmount));
contracts/CometWithExtendedAssetList.sol:922emit TransferCollateral(src, dst, asset, amount);
contracts/CometWithExtendedAssetList.sol:998emit Withdraw(src, to, amount);
contracts/CometWithExtendedAssetList.sol:1001emit Transfer(src, address(0), presentValueSupply(baseSupplyIndex, withdrawAmount));
contracts/CometWithExtendedAssetList.sol:1023emit WithdrawCollateral(src, to, asset, amount);
contracts/CometWithExtendedAssetList.sol:1079emit AbsorbCollateral(absorber, account, asset, seizeAmount, value);
contracts/CometWithExtendedAssetList.sol:1107emit AbsorbDebt(absorber, account, basePaidOut, valueOfBasePaidOut);
contracts/CometWithExtendedAssetList.sol:1110emit Transfer(address(0), account, presentValueSupply(baseSupplyIndex, unsigned104(newPrincipal)));
contracts/CometWithExtendedAssetList.sol:1140emit BuyCollateral(msg.sender, asset, baseAmount, collateralAmount);
contracts/CometWithExtendedAssetList.sol:1176emit WithdrawReserves(to, amount);
HD0101msg.sender is the caller's 160-bit alias14

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

contracts/CometWithExtendedAssetList.sol:503if (msg.sender != governor && msg.sender != pauseGuardian) revert Unauthorized();
contracts/CometWithExtendedAssetList.sol:709return supplyInternal(msg.sender, msg.sender, msg.sender, asset, amount);
contracts/CometWithExtendedAssetList.sol:719return supplyInternal(msg.sender, msg.sender, dst, asset, amount);
contracts/CometWithExtendedAssetList.sol:730return supplyInternal(msg.sender, from, dst, asset, amount);
contracts/CometWithExtendedAssetList.sol:807transferInternal(msg.sender, msg.sender, dst, baseToken, amount);
contracts/CometWithExtendedAssetList.sol:819transferInternal(msg.sender, src, dst, baseToken, amount);
contracts/CometWithExtendedAssetList.sol:830return transferInternal(msg.sender, msg.sender, dst, asset, amount);
contracts/CometWithExtendedAssetList.sol:841return transferInternal(msg.sender, src, dst, asset, amount);
contracts/CometWithExtendedAssetList.sol:931return withdrawInternal(msg.sender, msg.sender, msg.sender, asset, amount);
contracts/CometWithExtendedAssetList.sol:941return withdrawInternal(msg.sender, msg.sender, to, asset, amount);
contracts/CometWithExtendedAssetList.sol:952return withdrawInternal(msg.sender, src, to, asset, amount);
contracts/CometWithExtendedAssetList.sol:1129baseAmount = doTransferIn(baseToken, msg.sender, baseAmount);
contracts/CometWithExtendedAssetList.sol:1169if (msg.sender != governor) revert Unauthorized();
contracts/CometWithExtendedAssetList.sol:1190if (msg.sender != governor) revert Unauthorized();
HD0160external call routed through the alias registry13

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

contracts/CometWithExtendedAssetList.sol:117uint8 decimals_ = IERC20NonStandard(config.baseToken).decimals();
contracts/CometWithExtendedAssetList.sol:122if (IPriceFeed(config.baseTokenPriceFeed).decimals() != PRICE_FEED_DECIMALS) revert BadDecimals();
contracts/CometWithExtendedAssetList.sol:162assetList = IAssetListFactory(IAssetListFactoryHolder(extensionDelegate).assetListFactory()).createAssetList(config.assetConfigs);
contracts/CometWithExtendedAssetList.sol:162assetList = IAssetListFactory(IAssetListFactoryHolder(extensionDelegate).assetListFactory()).createAssetList(config.assetConfigs);
contracts/CometWithExtendedAssetList.sol:226return IAssetList(assetList).getAssetInfo(i);
contracts/CometWithExtendedAssetList.sol:345(, int price, , , ) = IPriceFeed(priceFeed).latestRoundData();
contracts/CometWithExtendedAssetList.sol:356return IERC20NonStandard(asset).balanceOf(address(this)) - totalsCollateral[asset].totalSupplyAsset;
contracts/CometWithExtendedAssetList.sol:364uint balance = IERC20NonStandard(baseToken).balanceOf(address(this));
contracts/CometWithExtendedAssetList.sol:660uint256 preTransferBalance = IERC20NonStandard(asset).balanceOf(address(this));
contracts/CometWithExtendedAssetList.sol:661IERC20NonStandard(asset).transferFrom(from, address(this), amount);
contracts/CometWithExtendedAssetList.sol:677return IERC20NonStandard(asset).balanceOf(address(this)) - preTransferBalance;
contracts/CometWithExtendedAssetList.sol:685IERC20NonStandard(asset).transfer(to, amount);
contracts/CometWithExtendedAssetList.sol:1192IERC20NonStandard(asset).approve(manager, amount);
HD0102address(this) is this contract's 160-bit alias3

no action needed

contracts/CometWithExtendedAssetList.sol:356return IERC20NonStandard(asset).balanceOf(address(this)) - totalsCollateral[asset].totalSupplyAsset;
contracts/CometWithExtendedAssetList.sol:364uint balance = IERC20NonStandard(baseToken).balanceOf(address(this));
contracts/CometWithExtendedAssetList.sol:660uint256 preTransferBalance = IERC20NonStandard(asset).balanceOf(address(this));
HD0140code size check means 'is deployed' on Starknet3

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

contracts/CometWithExtendedAssetList.sol:661IERC20NonStandard(asset).transferFrom(from, address(this), amount);
contracts/CometWithExtendedAssetList.sol:685IERC20NonStandard(asset).transfer(to, amount);
contracts/CometWithExtendedAssetList.sol:1192IERC20NonStandard(asset).approve(manager, amount);
HD0162delegatecall runs the target's class on this contract's storage (library call)1

no action needed

contracts/CometWithExtendedAssetList.sol:1244assembly {

The other 3,198 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).
  • A-SPLITThe contract is split into several classes (split.json). A library call runs the part class with this contract's storage, caller and address, and its revert data reaches the caller unchanged; the part classes declared on the network are the ones whose class hashes are embedded here.

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
CometWithExtendedAssetListnot declared
73,306
CometWithExtendedAssetList_Ctornot declared
37,086
CometWithExtendedAssetList_P1not declared
59,635
CometWithExtendedAssetList_P2not declared
48,358
CometWithExtendedAssetList_P3not declared
64,974
CometWithExtendedAssetList_P4not declared
66,219
CometWithExtendedAssetList_P5not declared
60,468

Build time: 9.5 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 0x0B07565A8ef48170e15918b251EbD95109B23255
solc (deployed)
0.8.15
Optimizer runs
1
Via IR (deployed)
yes
Compilation target
contracts/CometWithExtendedAssetList.sol:CometWithExtendedAssetList
Sourcify match
full

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.