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

Sky

SUsds

buildsstablecoin

Sky savings USDS (ERC4626) implementation.

Ethereum
0x4e7991e5C547ce825BdEb665EE14a3274f9F61e0

Implementation behind proxy 0xa393…7fbD

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

proved equivalent, no assumption

mapped59

equivalent under a recorded assumption

divergent8

behaves differently on Starknet

blocked0

cannot be preserved; the source must change

divergent 8 findings

HD0151block.timestamp / block.number follow Starknet block cadencesrc/SUsds.sol:125
rho = uint64(block.timestamp);

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/SUsds.sol:206
require(rho == block.timestamp, "SUsds/chi-not-up-to-date");

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/SUsds.sol:217
if (block.timestamp > rho_) {

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/SUsds.sol:335
uint256 chi_ = (block.timestamp > rho) ? _rpow(ssr, block.timestamp - rho) * chi / RAY : chi;

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/SUsds.sol:340
uint256 chi_ = (block.timestamp > rho) ? _rpow(ssr, block.timestamp - rho) * chi / RAY : chi;

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/SUsds.sol:367
uint256 chi_ = (block.timestamp > rho) ? _rpow(ssr, block.timestamp - rho) * chi / RAY : chi;

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/SUsds.sol:386
uint256 chi_ = (block.timestamp > rho) ? _rpow(ssr, block.timestamp - rho) * chi / RAY : chi;

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/SUsds.sol:446
require(block.timestamp <= deadline, "SUsds/permit-expired");

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 event18

indexers read topics from event keys and data from event data

lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol:130emit Initialized(1);
lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol:201emit Initialized(type(uint64).max);
lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Utils.sol:85emit Upgraded(newImplementation);
src/SUsds.sol:129emit Rely(msg.sender);
src/SUsds.sol:195emit Rely(usr);
src/SUsds.sol:200emit Deny(usr);
src/SUsds.sol:209emit File(what, data);
src/SUsds.sol:228emit Drip(nChi, diff);
src/SUsds.sol:243emit Transfer(msg.sender, to, value);
src/SUsds.sol:269emit Transfer(from, to, value);
src/SUsds.sol:277emit Approval(msg.sender, spender, value);
src/SUsds.sol:294emit Deposit(msg.sender, receiver, assets, shares);
src/SUsds.sol:295emit Transfer(address(0), receiver, shares);
src/SUsds.sol:320emit Transfer(owner, address(0), shares);
src/SUsds.sol:321emit Withdraw(msg.sender, receiver, owner, assets, shares);
src/SUsds.sol:359emit Referral(referral, receiver, assets, shares);
src/SUsds.sol:378emit Referral(referral, receiver, assets, shares);
src/SUsds.sol:469emit Approval(owner, spender, value);
HD0102address(this) is this contract's 160-bit alias10

no action needed

lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol:118bool construction = initialized == 1 && address(this).code.length == 0;
lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol:22address private immutable __self = address(this);
lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol:104address(this) == __self || // Must be called through delegatecall
lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol:116if (address(this) != __self) {
src/SUsds.sol:149address(this)
src/SUsds.sol:221vat.suck(address(vow), address(this), diff * RAY);
src/SUsds.sol:234require(to != address(0) && to != address(this), "SUsds/invalid-address");
src/SUsds.sol:249require(to != address(0) && to != address(this), "SUsds/invalid-address");
src/SUsds.sol:285require(receiver != address(0) && receiver != address(this), "SUsds/invalid-address");
src/SUsds.sol:287usds.transferFrom(msg.sender, address(this), assets);
HD0140code size check means 'is deployed' on Starknet9

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

lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol:118bool construction = initialized == 1 && address(this).code.length == 0;
lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Utils.sol:70if (newImplementation.code.length == 0) {
lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/utils/Address.sol:124if (returndata.length == 0 && target.code.length == 0) {
src/SUsds.sol:127vat.hope(address(usdsJoin));
src/SUsds.sol:221vat.suck(address(vow), address(this), diff * RAY);
src/SUsds.sol:222usdsJoin.exit(address(this), diff);
src/SUsds.sol:287usds.transferFrom(msg.sender, address(this), assets);
src/SUsds.sol:318usds.transfer(receiver, assets);
src/SUsds.sol:429if (signer.code.length > 0) {
HD0160external call routed through the alias registry9

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

lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol:143try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {
src/SUsds.sol:114vat = VatLike(UsdsJoinLike(usdsJoin_).vat());
src/SUsds.sol:115usds = UsdsLike(UsdsJoinLike(usdsJoin_).usds());
src/SUsds.sol:127vat.hope(address(usdsJoin));
src/SUsds.sol:221vat.suck(address(vow), address(this), diff * RAY);
src/SUsds.sol:222usdsJoin.exit(address(this), diff);
src/SUsds.sol:287usds.transferFrom(msg.sender, address(this), assets);
src/SUsds.sol:318usds.transfer(receiver, assets);
src/SUsds.sol:430(bool success, bytes memory result) = signer.staticcall(
HD0101msg.sender is the caller's 160-bit alias7

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

src/SUsds.sol:104require(wards[msg.sender] == 1, "SUsds/not-authorized");
src/SUsds.sol:128wards[msg.sender] = 1;
src/SUsds.sol:235uint256 balance = balanceOf[msg.sender];
src/SUsds.sol:253if (from != msg.sender) {
src/SUsds.sol:275allowance[msg.sender][spender] = value;
src/SUsds.sol:287usds.transferFrom(msg.sender, address(this), assets);
src/SUsds.sol:302if (owner != msg.sender) {
HD0152block.chainid is the Starknet chain id2

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

src/SUsds.sol:155return _calculateDomainSeparator(block.chainid);
src/SUsds.sol:455_calculateDomainSeparator(block.chainid),
HD0161a failing external call returns false with its revert data (Starknet v0.13.4 or later)2

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

lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol:143try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {
src/SUsds.sol:430(bool success, bytes memory result) = signer.staticcall(
HD0110msg.value is an amount of the network's value token1

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

lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Utils.sol:189if (msg.value > 0) {
HD0162delegatecall runs the target's class on this contract's storage (library call)1

no action needed

lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/utils/Address.sol:105(bool success, bytes memory returndata) = target.delegatecall(data);

The other 1,655 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
SUsdsnot declared
73,566
SUsds_Ctornot declared
15,775
SUsds_P1not declared
62,890

Build time: 2.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 0x4e7991e5C547ce825BdEb665EE14a3274f9F61e0
solc (deployed)
0.8.21
Optimizer runs
200
Via IR (deployed)
no
Compilation target
src/SUsds.sol:SUsds
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.