Skip to content

Instantly share code, notes, and snippets.

@gzeoneth
Last active December 23, 2022 09:42
Show Gist options
  • Save gzeoneth/0a8bac381752e4b4f30650a0d3c76096 to your computer and use it in GitHub Desktop.
Save gzeoneth/0a8bac381752e4b4f30650a0d3c76096 to your computer and use it in GitHub Desktop.
import { BigNumber, ethers } from 'ethers'
import dotenv from 'dotenv'
dotenv.config()
const rollupAbi = [
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "previousAdmin",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "newAdmin",
"type": "address"
}
],
"name": "AdminChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "beacon",
"type": "address"
}
],
"name": "BeaconUpgraded",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint64",
"name": "nodeNum",
"type": "uint64"
},
{
"indexed": false,
"internalType": "bytes32",
"name": "blockHash",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "bytes32",
"name": "sendRoot",
"type": "bytes32"
}
],
"name": "NodeConfirmed",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint64",
"name": "nodeNum",
"type": "uint64"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "parentNodeHash",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "nodeHash",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "bytes32",
"name": "executionHash",
"type": "bytes32"
},
{
"components": [
{
"components": [
{
"components": [
{
"internalType": "bytes32[2]",
"name": "bytes32Vals",
"type": "bytes32[2]"
},
{
"internalType": "uint64[2]",
"name": "u64Vals",
"type": "uint64[2]"
}
],
"internalType": "struct GlobalState",
"name": "globalState",
"type": "tuple"
},
{
"internalType": "enum MachineStatus",
"name": "machineStatus",
"type": "uint8"
}
],
"internalType": "struct RollupLib.ExecutionState",
"name": "beforeState",
"type": "tuple"
},
{
"components": [
{
"components": [
{
"internalType": "bytes32[2]",
"name": "bytes32Vals",
"type": "bytes32[2]"
},
{
"internalType": "uint64[2]",
"name": "u64Vals",
"type": "uint64[2]"
}
],
"internalType": "struct GlobalState",
"name": "globalState",
"type": "tuple"
},
{
"internalType": "enum MachineStatus",
"name": "machineStatus",
"type": "uint8"
}
],
"internalType": "struct RollupLib.ExecutionState",
"name": "afterState",
"type": "tuple"
},
{
"internalType": "uint64",
"name": "numBlocks",
"type": "uint64"
}
],
"indexed": false,
"internalType": "struct RollupLib.Assertion",
"name": "assertion",
"type": "tuple"
},
{
"indexed": false,
"internalType": "bytes32",
"name": "afterInboxBatchAcc",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "bytes32",
"name": "wasmModuleRoot",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "uint256",
"name": "inboxMaxCount",
"type": "uint256"
}
],
"name": "NodeCreated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint64",
"name": "nodeNum",
"type": "uint64"
}
],
"name": "NodeRejected",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "Paused",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint64",
"name": "challengeIndex",
"type": "uint64"
},
{
"indexed": false,
"internalType": "address",
"name": "asserter",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "challenger",
"type": "address"
},
{
"indexed": false,
"internalType": "uint64",
"name": "challengedNode",
"type": "uint64"
}
],
"name": "RollupChallengeStarted",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "bytes32",
"name": "machineHash",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "uint256",
"name": "chainId",
"type": "uint256"
}
],
"name": "RollupInitialized",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "Unpaused",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "implementation",
"type": "address"
}
],
"name": "Upgraded",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "implementation",
"type": "address"
}
],
"name": "UpgradedSecondary",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "user",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "initialBalance",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "finalBalance",
"type": "uint256"
}
],
"name": "UserStakeUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "user",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "initialBalance",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "finalBalance",
"type": "uint256"
}
],
"name": "UserWithdrawableFundsUpdated",
"type": "event"
},
{
"inputs": [],
"name": "VALIDATOR_AFK_BLOCKS",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "_stakerMap",
"outputs": [
{
"internalType": "uint256",
"name": "amountStaked",
"type": "uint256"
},
{
"internalType": "uint64",
"name": "index",
"type": "uint64"
},
{
"internalType": "uint64",
"name": "latestStakedNode",
"type": "uint64"
},
{
"internalType": "uint64",
"name": "currentChallenge",
"type": "uint64"
},
{
"internalType": "bool",
"name": "isStaked",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "stakerAddress",
"type": "address"
}
],
"name": "addToDeposit",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "staker",
"type": "address"
}
],
"name": "amountStaked",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "baseStake",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "bridge",
"outputs": [
{
"internalType": "contract IBridge",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "chainId",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "challengeManager",
"outputs": [
{
"internalType": "contract IChallengeManager",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "challengeIndex",
"type": "uint256"
},
{
"internalType": "address",
"name": "winningStaker",
"type": "address"
},
{
"internalType": "address",
"name": "losingStaker",
"type": "address"
}
],
"name": "completeChallenge",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "blockHash",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "sendRoot",
"type": "bytes32"
}
],
"name": "confirmNextNode",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "confirmPeriodBlocks",
"outputs": [
{
"internalType": "uint64",
"name": "",
"type": "uint64"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint64",
"name": "nodeNum",
"type": "uint64"
}
],
"name": "countStakedZombies",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint64",
"name": "nodeNum",
"type": "uint64"
}
],
"name": "countZombiesStakedOnChildren",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address[2]",
"name": "stakers",
"type": "address[2]"
},
{
"internalType": "uint64[2]",
"name": "nodeNums",
"type": "uint64[2]"
},
{
"internalType": "enum MachineStatus[2]",
"name": "machineStatuses",
"type": "uint8[2]"
},
{
"components": [
{
"internalType": "bytes32[2]",
"name": "bytes32Vals",
"type": "bytes32[2]"
},
{
"internalType": "uint64[2]",
"name": "u64Vals",
"type": "uint64[2]"
}
],
"internalType": "struct GlobalState[2]",
"name": "globalStates",
"type": "tuple[2]"
},
{
"internalType": "uint64",
"name": "numBlocks",
"type": "uint64"
},
{
"internalType": "bytes32",
"name": "secondExecutionHash",
"type": "bytes32"
},
{
"internalType": "uint256[2]",
"name": "proposedTimes",
"type": "uint256[2]"
},
{
"internalType": "bytes32[2]",
"name": "wasmModuleRoots",
"type": "bytes32[2]"
}
],
"name": "createChallenge",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "staker",
"type": "address"
}
],
"name": "currentChallenge",
"outputs": [
{
"internalType": "uint64",
"name": "",
"type": "uint64"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "currentRequiredStake",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "extraChallengeTimeBlocks",
"outputs": [
{
"internalType": "uint64",
"name": "",
"type": "uint64"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "firstUnresolvedNode",
"outputs": [
{
"internalType": "uint64",
"name": "",
"type": "uint64"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"components": [
{
"components": [
{
"internalType": "bytes32[2]",
"name": "bytes32Vals",
"type": "bytes32[2]"
},
{
"internalType": "uint64[2]",
"name": "u64Vals",
"type": "uint64[2]"
}
],
"internalType": "struct GlobalState",
"name": "globalState",
"type": "tuple"
},
{
"internalType": "enum MachineStatus",
"name": "machineStatus",
"type": "uint8"
}
],
"internalType": "struct RollupLib.ExecutionState",
"name": "beforeState",
"type": "tuple"
},
{
"components": [
{
"components": [
{
"internalType": "bytes32[2]",
"name": "bytes32Vals",
"type": "bytes32[2]"
},
{
"internalType": "uint64[2]",
"name": "u64Vals",
"type": "uint64[2]"
}
],
"internalType": "struct GlobalState",
"name": "globalState",
"type": "tuple"
},
{
"internalType": "enum MachineStatus",
"name": "machineStatus",
"type": "uint8"
}
],
"internalType": "struct RollupLib.ExecutionState",
"name": "afterState",
"type": "tuple"
},
{
"internalType": "uint64",
"name": "numBlocks",
"type": "uint64"
}
],
"internalType": "struct RollupLib.Assertion",
"name": "assertion",
"type": "tuple"
}
],
"name": "getL2BlockHash",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint64",
"name": "nodeNum",
"type": "uint64"
}
],
"name": "getNode",
"outputs": [
{
"components": [
{
"internalType": "bytes32",
"name": "stateHash",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "challengeHash",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "confirmData",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "prevNum",
"type": "uint64"
},
{
"internalType": "uint64",
"name": "deadlineBlock",
"type": "uint64"
},
{
"internalType": "uint64",
"name": "noChildConfirmedBeforeBlock",
"type": "uint64"
},
{
"internalType": "uint64",
"name": "stakerCount",
"type": "uint64"
},
{
"internalType": "uint64",
"name": "childStakerCount",
"type": "uint64"
},
{
"internalType": "uint64",
"name": "firstChildBlock",
"type": "uint64"
},
{
"internalType": "uint64",
"name": "latestChildNumber",
"type": "uint64"
},
{
"internalType": "uint64",
"name": "createdAtBlock",
"type": "uint64"
},
{
"internalType": "bytes32",
"name": "nodeHash",
"type": "bytes32"
}
],
"internalType": "struct Node",
"name": "",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "staker",
"type": "address"
}
],
"name": "getStaker",
"outputs": [
{
"components": [
{
"internalType": "uint256",
"name": "amountStaked",
"type": "uint256"
},
{
"internalType": "uint64",
"name": "index",
"type": "uint64"
},
{
"internalType": "uint64",
"name": "latestStakedNode",
"type": "uint64"
},
{
"internalType": "uint64",
"name": "currentChallenge",
"type": "uint64"
},
{
"internalType": "bool",
"name": "isStaked",
"type": "bool"
}
],
"internalType": "struct IRollupCore.Staker",
"name": "",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint64",
"name": "stakerNum",
"type": "uint64"
}
],
"name": "getStakerAddress",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "inbox",
"outputs": [
{
"internalType": "contract IInbox",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_stakeToken",
"type": "address"
}
],
"name": "initialize",
"outputs": [],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "isERC20Enabled",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "staker",
"type": "address"
}
],
"name": "isStaked",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "staker",
"type": "address"
}
],
"name": "isStakedOnLatestConfirmed",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "isValidator",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "staker",
"type": "address"
}
],
"name": "isZombie",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "lastStakeBlock",
"outputs": [
{
"internalType": "uint64",
"name": "",
"type": "uint64"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "latestConfirmed",
"outputs": [
{
"internalType": "uint64",
"name": "",
"type": "uint64"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "latestNodeCreated",
"outputs": [
{
"internalType": "uint64",
"name": "",
"type": "uint64"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "staker",
"type": "address"
}
],
"name": "latestStakedNode",
"outputs": [
{
"internalType": "uint64",
"name": "",
"type": "uint64"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "loserStakeEscrow",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "minimumAssertionPeriod",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint64",
"name": "nodeNum",
"type": "uint64"
},
{
"internalType": "bytes32",
"name": "nodeHash",
"type": "bytes32"
}
],
"name": "newStakeOnExistingNode",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"components": [
{
"components": [
{
"internalType": "bytes32[2]",
"name": "bytes32Vals",
"type": "bytes32[2]"
},
{
"internalType": "uint64[2]",
"name": "u64Vals",
"type": "uint64[2]"
}
],
"internalType": "struct GlobalState",
"name": "globalState",
"type": "tuple"
},
{
"internalType": "enum MachineStatus",
"name": "machineStatus",
"type": "uint8"
}
],
"internalType": "struct RollupLib.ExecutionState",
"name": "beforeState",
"type": "tuple"
},
{
"components": [
{
"components": [
{
"internalType": "bytes32[2]",
"name": "bytes32Vals",
"type": "bytes32[2]"
},
{
"internalType": "uint64[2]",
"name": "u64Vals",
"type": "uint64[2]"
}
],
"internalType": "struct GlobalState",
"name": "globalState",
"type": "tuple"
},
{
"internalType": "enum MachineStatus",
"name": "machineStatus",
"type": "uint8"
}
],
"internalType": "struct RollupLib.ExecutionState",
"name": "afterState",
"type": "tuple"
},
{
"internalType": "uint64",
"name": "numBlocks",
"type": "uint64"
}
],
"internalType": "struct RollupLib.Assertion",
"name": "assertion",
"type": "tuple"
},
{
"internalType": "bytes32",
"name": "expectedNodeHash",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "prevNodeInboxMaxCount",
"type": "uint256"
}
],
"name": "newStakeOnNewNode",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint64",
"name": "nodeNum",
"type": "uint64"
},
{
"internalType": "address",
"name": "staker",
"type": "address"
}
],
"name": "nodeHasStaker",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "outbox",
"outputs": [
{
"internalType": "contract IOutbox",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "paused",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "proxiableUUID",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "target",
"type": "uint256"
}
],
"name": "reduceDeposit",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "stakerAddress",
"type": "address"
}
],
"name": "rejectNextNode",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "startIndex",
"type": "uint256"
}
],
"name": "removeOldZombies",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "removeWhitelistAfterFork",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "removeWhitelistAfterValidatorAfk",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "zombieNum",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "maxNodes",
"type": "uint256"
}
],
"name": "removeZombie",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "nodeNum",
"type": "uint256"
}
],
"name": "requireUnresolved",
"outputs": [],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "requireUnresolvedExists",
"outputs": [],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "blockNumber",
"type": "uint256"
},
{
"internalType": "uint64",
"name": "firstUnresolvedNodeNum",
"type": "uint64"
},
{
"internalType": "uint64",
"name": "latestCreatedNode",
"type": "uint64"
}
],
"name": "requiredStake",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "stakerAddress",
"type": "address"
}
],
"name": "returnOldDeposit",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "rollupDeploymentBlock",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "rollupEventInbox",
"outputs": [
{
"internalType": "contract IRollupEventInbox",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "sequencerInbox",
"outputs": [
{
"internalType": "contract ISequencerInbox",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint64",
"name": "nodeNum",
"type": "uint64"
},
{
"internalType": "bytes32",
"name": "nodeHash",
"type": "bytes32"
}
],
"name": "stakeOnExistingNode",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"components": [
{
"components": [
{
"internalType": "bytes32[2]",
"name": "bytes32Vals",
"type": "bytes32[2]"
},
{
"internalType": "uint64[2]",
"name": "u64Vals",
"type": "uint64[2]"
}
],
"internalType": "struct GlobalState",
"name": "globalState",
"type": "tuple"
},
{
"internalType": "enum MachineStatus",
"name": "machineStatus",
"type": "uint8"
}
],
"internalType": "struct RollupLib.ExecutionState",
"name": "beforeState",
"type": "tuple"
},
{
"components": [
{
"components": [
{
"internalType": "bytes32[2]",
"name": "bytes32Vals",
"type": "bytes32[2]"
},
{
"internalType": "uint64[2]",
"name": "u64Vals",
"type": "uint64[2]"
}
],
"internalType": "struct GlobalState",
"name": "globalState",
"type": "tuple"
},
{
"internalType": "enum MachineStatus",
"name": "machineStatus",
"type": "uint8"
}
],
"internalType": "struct RollupLib.ExecutionState",
"name": "afterState",
"type": "tuple"
},
{
"internalType": "uint64",
"name": "numBlocks",
"type": "uint64"
}
],
"internalType": "struct RollupLib.Assertion",
"name": "assertion",
"type": "tuple"
},
{
"internalType": "bytes32",
"name": "expectedNodeHash",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "prevNodeInboxMaxCount",
"type": "uint256"
}
],
"name": "stakeOnNewNode",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "stakeToken",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "stakerCount",
"outputs": [
{
"internalType": "uint64",
"name": "",
"type": "uint64"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalWithdrawableFunds",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "validatorUtils",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "validatorWalletCreator",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "validatorWhitelistDisabled",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "wasmModuleRoot",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "withdrawStakerFunds",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "user",
"type": "address"
}
],
"name": "withdrawableFunds",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "zombieNum",
"type": "uint256"
}
],
"name": "zombieAddress",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "zombieCount",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "zombieNum",
"type": "uint256"
}
],
"name": "zombieLatestStakedNode",
"outputs": [
{
"internalType": "uint64",
"name": "",
"type": "uint64"
}
],
"stateMutability": "view",
"type": "function"
}
]
const helperAbi = [{"inputs":[{"components":[{"components":[{"components":[{"internalType":"bytes32[2]","name":"bytes32Vals","type":"bytes32[2]"},{"internalType":"uint64[2]","name":"u64Vals","type":"uint64[2]"}],"internalType":"struct GlobalState","name":"globalState","type":"tuple"},{"internalType":"enum MachineStatus","name":"machineStatus","type":"uint8"}],"internalType":"struct ExecutionState","name":"beforeState","type":"tuple"},{"components":[{"components":[{"internalType":"bytes32[2]","name":"bytes32Vals","type":"bytes32[2]"},{"internalType":"uint64[2]","name":"u64Vals","type":"uint64[2]"}],"internalType":"struct GlobalState","name":"globalState","type":"tuple"},{"internalType":"enum MachineStatus","name":"machineStatus","type":"uint8"}],"internalType":"struct ExecutionState","name":"afterState","type":"tuple"},{"internalType":"uint64","name":"numBlocks","type":"uint64"}],"internalType":"struct Assertion","name":"assertion","type":"tuple"}],"name":"getBlockHash","outputs":[{"internalType":"bytes32","name":"hash","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"components":[{"components":[{"components":[{"internalType":"bytes32[2]","name":"bytes32Vals","type":"bytes32[2]"},{"internalType":"uint64[2]","name":"u64Vals","type":"uint64[2]"}],"internalType":"struct GlobalState","name":"globalState","type":"tuple"},{"internalType":"enum MachineStatus","name":"machineStatus","type":"uint8"}],"internalType":"struct ExecutionState","name":"beforeState","type":"tuple"},{"components":[{"components":[{"internalType":"bytes32[2]","name":"bytes32Vals","type":"bytes32[2]"},{"internalType":"uint64[2]","name":"u64Vals","type":"uint64[2]"}],"internalType":"struct GlobalState","name":"globalState","type":"tuple"},{"internalType":"enum MachineStatus","name":"machineStatus","type":"uint8"}],"internalType":"struct ExecutionState","name":"afterState","type":"tuple"},{"internalType":"uint64","name":"numBlocks","type":"uint64"}],"internalType":"struct Assertion","name":"assertion","type":"tuple"}],"name":"getSendRoot","outputs":[{"internalType":"bytes32","name":"root","type":"bytes32"}],"stateMutability":"pure","type":"function"}]
const fooAbi = [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"getInt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_val","type":"uint256"}],"name":"setInt","outputs":[],"stateMutability":"nonpayable","type":"function"}]
const verifierAbi = [{"inputs":[{"internalType":"bytes","name":"_key","type":"bytes"},{"internalType":"bytes","name":"_proof","type":"bytes"},{"internalType":"bytes32","name":"_root","type":"bytes32"}],"name":"get","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"_key","type":"bytes"},{"internalType":"bytes","name":"_value","type":"bytes"},{"internalType":"bytes","name":"_proof","type":"bytes"},{"internalType":"bytes32","name":"_root","type":"bytes32"}],"name":"verifyInclusionProof","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"}]
const outboxAbi = [{"inputs":[],"name":"AlreadyInit","type":"error"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"AlreadySpent","type":"error"},{"inputs":[],"name":"BridgeCallFailed","type":"error"},{"inputs":[{"internalType":"uint256","name":"actualLength","type":"uint256"},{"internalType":"uint256","name":"maxProofLength","type":"uint256"}],"name":"MerkleProofTooLong","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"rollup","type":"address"}],"name":"NotRollup","type":"error"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"maxIndex","type":"uint256"}],"name":"PathNotMinimal","type":"error"},{"inputs":[{"internalType":"uint256","name":"proofLength","type":"uint256"}],"name":"ProofTooLong","type":"error"},{"inputs":[],"name":"SimulationOnlyEntrypoint","type":"error"},{"inputs":[{"internalType":"bytes32","name":"root","type":"bytes32"}],"name":"UnknownRoot","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"address","name":"l2Sender","type":"address"},{"indexed":true,"internalType":"uint256","name":"zero","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"transactionIndex","type":"uint256"}],"name":"OutBoxTransactionExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"blockHash","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"outputRoot","type":"bytes32"}],"name":"SendRootUpdated","type":"event"},{"inputs":[],"name":"OUTBOX_VERSION","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bridge","outputs":[{"internalType":"contract IBridge","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"l2Sender","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"l2Block","type":"uint256"},{"internalType":"uint256","name":"l1Block","type":"uint256"},{"internalType":"uint256","name":"l2Timestamp","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"calculateItemHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"uint256","name":"path","type":"uint256"},{"internalType":"bytes32","name":"item","type":"bytes32"}],"name":"calculateMerkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"address","name":"l2Sender","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"l2Block","type":"uint256"},{"internalType":"uint256","name":"l1Block","type":"uint256"},{"internalType":"uint256","name":"l2Timestamp","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"executeTransaction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"address","name":"l2Sender","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"l2Block","type":"uint256"},{"internalType":"uint256","name":"l1Block","type":"uint256"},{"internalType":"uint256","name":"l2Timestamp","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"executeTransactionSimulation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IBridge","name":"_bridge","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"isSpent","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l2ToL1BatchNum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"l2ToL1Block","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l2ToL1EthBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l2ToL1OutputId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l2ToL1Sender","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l2ToL1Timestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rollup","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"roots","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"spent","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"root","type":"bytes32"},{"internalType":"bytes32","name":"l2BlockHash","type":"bytes32"}],"name":"updateSendRoot","outputs":[],"stateMutability":"nonpayable","type":"function"}]
const L1_ALCHEMY_KEY = process.env.L1_ALCHEMY_KEY
const L2_ALCHEMY_KEY = process.env.L2_ALCHEMY_KEY
if(!(L1_ALCHEMY_KEY && L2_ALCHEMY_KEY)) throw("set L1_ALCHEMY_KEY and L2_ALCHEMY_KEY")
const l1url = `https://eth-goerli.g.alchemy.com/v2/${L1_ALCHEMY_KEY}`
const l1provider = new ethers.providers.JsonRpcProvider(l1url);
const l2url = `https://arb-goerli.g.alchemy.com/v2/${L2_ALCHEMY_KEY}`
const l2provider = new ethers.providers.JsonRpcProvider(l2url);
console.log({l1url, l2url})
// l2 addresses
const fooAddress = '0xe0fb944d3f724a79a4a3f7f3aabfcd2c85057c14'
const foo = new ethers.Contract(fooAddress, fooAbi, l2provider);
// l1 addresses
const rollupAddress = '0x45e5cAea8768F42B385A366D3551Ad1e0cbFAb17'
const helperAddress = '0x252656ea5274e178d91d6a8e102574ab0548e036'
const outboxAddress = '0x45Af9Ed1D03703e480CE7d328fB684bb67DA5049'
// Uses @eth-optimism/contracts/libraries/trie/Lib_SecureMerkleTrie.sol
// https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts/contracts/libraries/trie/Lib_SecureMerkleTrie.sol
const verifierAddress = '0xde1f73BACbd1C13ceDBDB56aDE1c2c98284de5aa'
const rollup = new ethers.Contract(rollupAddress, rollupAbi, l1provider);
const helper = new ethers.Contract(helperAddress, helperAbi, l1provider);
const outbox = new ethers.Contract(outboxAddress, outboxAbi, l1provider);
const verifier = new ethers.Contract(verifierAddress, verifierAbi, l1provider);
async function main(){
// console.log(await foo.getInt())
const slot = '0x0000000000000000000000000000000000000000000000000000000000000000'
const nodeIndex = await rollup.latestNodeCreated()
console.log(3, nodeIndex)
const nodeEventFilter = await rollup.filters.NodeCreated(nodeIndex);
const nodeEvents = await rollup.queryFilter(nodeEventFilter);
const assertion = nodeEvents[0].args!.assertion
console.log(4, {assertion})
const blockHash = await helper.getBlockHash(assertion)
const sendRoot = await helper.getSendRoot(assertion)
// const l2blockHash = await outbox.roots(sendRoot)
const confirmdata = ethers.utils.keccak256(ethers.utils.solidityPack(['bytes32','bytes32'], [blockHash, sendRoot]))
console.log(5, {blockHash, sendRoot})
const l2block = (await l2provider.getBlock(blockHash))
const l2blockNumber = l2block.number
console.log(6, l2blockNumber)
const rblock = await rollup.getNode(nodeIndex)
// compare these two
console.log(7, rblock.confirmData) // node or rollup block or rblock
console.log(8, confirmdata, rblock.confirmData === confirmdata)
// ^ This complete Proof a certain l2 block hash correspond to a node/rblock
// ^ Your L1 contract now know the L2 block hash
// Next step, you need to show the L1 contract the L1 state root
// You get all the field in the blockheader with the L2 RPC
const l2blockRaw = await l2provider.send('eth_getBlockByHash', [
blockHash,
false
]);
console.log(l2blockRaw)
const stateroot = l2blockRaw.stateRoot
const blockarray = [
l2blockRaw.parentHash,
l2blockRaw.sha3Uncles,
l2blockRaw.miner,
stateroot,
l2blockRaw.transactionsRoot,
l2blockRaw.receiptsRoot,
l2blockRaw.logsBloom,
BigNumber.from(l2blockRaw.difficulty).toHexString(),
BigNumber.from(l2blockRaw.number).toHexString(),
BigNumber.from(l2blockRaw.gasLimit).toHexString(),
BigNumber.from(l2blockRaw.gasUsed).toHexString(),
BigNumber.from(l2blockRaw.timestamp).toHexString(),
l2blockRaw.extraData,
l2blockRaw.mixHash,
l2blockRaw.nonce,
BigNumber.from(l2blockRaw.baseFeePerGas).toHexString(),
]
console.log(blockarray)
const calculated_blockhash = ethers.utils.keccak256(ethers.utils.RLP.encode(blockarray))
console.log(calculated_blockhash)
console.log(calculated_blockhash === blockHash)
// ParentHash common.Hash `json:"parentHash" gencodec:"required"`
// UncleHash common.Hash `json:"sha3Uncles" gencodec:"required"`
// Coinbase common.Address `json:"miner"`
// Root common.Hash `json:"stateRoot" gencodec:"required"`
// TxHash common.Hash `json:"transactionsRoot" gencodec:"required"`
// ReceiptHash common.Hash `json:"receiptsRoot" gencodec:"required"`
// Bloom Bloom `json:"logsBloom" gencodec:"required"`
// Difficulty *big.Int `json:"difficulty" gencodec:"required"`
// Number *big.Int `json:"number" gencodec:"required"`
// GasLimit uint64 `json:"gasLimit" gencodec:"required"`
// GasUsed uint64 `json:"gasUsed" gencodec:"required"`
// Time uint64 `json:"timestamp" gencodec:"required"`
// Extra []byte `json:"extraData" gencodec:"required"`
// MixDigest common.Hash `json:"mixHash"`
// Nonce BlockNonce `json:"nonce"`
// // BaseFee was added by EIP-1559 and is ignored in legacy headers.
// BaseFee *big.Int `json:"baseFeePerGas" rlp:"optional"`
// ^ with these, the L1 contract now know the state root (from the blockhash)
// For the last steps, you need to
// 1. prove the account is in the state root
// 2. prove the storage is in the account root
const proof = await l2provider.send('eth_getProof', [
fooAddress,
[slot],
{blockHash}
]);
console.log(proof)
const proofKey = ethers.utils.keccak256(proof.address)
const accountProof = ethers.utils.RLP.encode(proof.accountProof)
console.log(7, {
address:proof.address,
proofKey, accountProof, stateroot
})
const [acctExists, acctEncoded] = await verifier.get(
proofKey, accountProof, stateroot
)
// decodeEVMAccount
const storageRoot = ethers.utils.RLP.decode(acctEncoded)[2]
console.log({storageRoot: storageRoot})
const slotKey = ethers.utils.keccak256(slot)
const storageProof = ethers.utils.RLP.encode((proof.storageProof as any[]).filter((x)=>x.key===slot)[0].proof)
const [storageExists, storageEncoded] = await verifier.get(
slotKey, storageProof, storageRoot
)
console.log({storageEncoded: storageEncoded})
const storageValue = ethers.utils.RLP.decode(storageEncoded)
const actualValue = await l2provider.getStorageAt(fooAddress, slot, l2block.number) // should use blockhash here but some bug with the alchemy rpc
const actualValueRemoveLeading0 = BigNumber.from(actualValue).toHexString()
console.log({storageValue: storageValue, actualValue: actualValueRemoveLeading0, equal: storageValue===actualValueRemoveLeading0})
// 1. Proof a certain l2 block hash correspond to a node/rblock state with the assertion
// 2. Proof the state root belong to the l2 block hash by supplying the blockheader
// 3. Proof the account storage inside the state root
// 4. Proof the storage slot is in the account root
}
main()
@gzeoneth
Copy link
Author

yarn run v1.22.19
{
  l1url: 'https://eth-goerli.g.alchemy.com/v2/quflDqJ0XzhlpD3FoCycc2zO6bDo6m1f',
  l2url: 'https://arb-goerli.g.alchemy.com/v2/quflDqJ0XzhlpD3FoCycc2zO6bDo6m1f'
}
3 BigNumber { _hex: '0x11ac', _isBigNumber: true }
4 {
  assertion: [
    [ [Array], 1, globalState: [Array], machineStatus: 1 ],
    [ [Array], 1, globalState: [Array], machineStatus: 1 ],
    BigNumber { _hex: '0x0911', _isBigNumber: true },
    beforeState: [ [Array], 1, globalState: [Array], machineStatus: 1 ],
    afterState: [ [Array], 1, globalState: [Array], machineStatus: 1 ],
    numBlocks: BigNumber { _hex: '0x0911', _isBigNumber: true }
  ]
}
5 {
  blockHash: '0xbfa0df1d3751ead2ba775a108a367159dfa0649ee7068415030bc1d109cea9b1',
  sendRoot: '0x254f2c070126843c12a2e1e74ab6606bbe8957c824ffcce2ecfa97c8e1f75e18'
}
6 3413773
7 0xe6c36e2238c9dbd4a828c20c582be4f6c3435919cbad211b593836dd56628cb9
8 0xe6c36e2238c9dbd4a828c20c582be4f6c3435919cbad211b593836dd56628cb9 true
{
  number: '0x34170d',
  hash: '0xbfa0df1d3751ead2ba775a108a367159dfa0649ee7068415030bc1d109cea9b1',
  transactions: [
    '0x31ff17b48283a39fa46862ca811fdcd963dffee4c80efa81f3cdd4f793b24d07',
    '0x93b0f65d6e22c3d1812f099535056a2be7c1cef755f41dd8f23b0d9f38fed200'
  ],
  difficulty: '0x1',
  extraData: '0x254f2c070126843c12a2e1e74ab6606bbe8957c824ffcce2ecfa97c8e1f75e18',
  gasLimit: '0x4000000000000',
  gasUsed: '0x4a4e4',
  logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000020000200000000000000000000000000000000000000000000000000008000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000040000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000100400000000000000000000',
  miner: '0xa4b000000000000000000073657175656e636572',
  mixHash: '0x0000000000002dac00000000007ce6b1000000000000000a0000000000000000',
  nonce: '0x0000000000019f73',
  parentHash: '0xa080255f5ed75fc7cbbdfc428f5b422c9eee8cf33430cf6ffccd0df6f06bebe1',
  receiptsRoot: '0xa1e8a294d51103abca36ab824add9d7ffa95502b51e778090896fa6fe16dccbd',
  sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
  size: '0x3b6',
  stateRoot: '0x4e47550a3c4234b4f3a0f0f1de3fc269221b2f8dedf10435dfec40ee2332ff33',
  timestamp: '0x63a567a0',
  totalDifficulty: '0x34170e',
  transactionsRoot: '0xa830b781ef6273c0c50cf76f485c9d310849e02e7ec8c18d70163cec199ed7ea',
  uncles: [],
  baseFeePerGas: '0x5f5e100',
  l1BlockNumber: '0x7ce6b1',
  sendCount: '0x2dac',
  sendRoot: '0x254f2c070126843c12a2e1e74ab6606bbe8957c824ffcce2ecfa97c8e1f75e18'
}
[
  '0xa080255f5ed75fc7cbbdfc428f5b422c9eee8cf33430cf6ffccd0df6f06bebe1',
  '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
  '0xa4b000000000000000000073657175656e636572',
  '0x4e47550a3c4234b4f3a0f0f1de3fc269221b2f8dedf10435dfec40ee2332ff33',
  '0xa830b781ef6273c0c50cf76f485c9d310849e02e7ec8c18d70163cec199ed7ea',
  '0xa1e8a294d51103abca36ab824add9d7ffa95502b51e778090896fa6fe16dccbd',
  '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000020000200000000000000000000000000000000000000000000000000008000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000040000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000100400000000000000000000',
  '0x01',
  '0x34170d',
  '0x04000000000000',
  '0x04a4e4',
  '0x63a567a0',
  '0x254f2c070126843c12a2e1e74ab6606bbe8957c824ffcce2ecfa97c8e1f75e18',
  '0x0000000000002dac00000000007ce6b1000000000000000a0000000000000000',
  '0x0000000000019f73',
  '0x05f5e100'
]
0xbfa0df1d3751ead2ba775a108a367159dfa0649ee7068415030bc1d109cea9b1
true
{
  address: '0xe0fb944d3f724a79a4a3f7f3aabfcd2c85057c14',
  accountProof: [
    '0xf90211a097f436f1e0c8a65fe79f7388863451751af586c880a3e986010791908525a8a6a0262d8da64eb24458d2d0b360c702b6ced9dabaeacee1b07f80f20fc5b5cc0612a029f1c7ccb1b6378935eed7949eeb26346ba9679360e125d7d538d97d54f39c76a0806ebe72ffe8285c93dfd772dd1f1a04ba3af6aca80fc5e3894ecdf32744237da0204b362880816cea26cff4e057ff2625b1ac5b5239d2a2a0d700c9c574e504b3a0388624f287d978b19c012adef4f40aee55d7b52aff00154ea47261eac31e5c26a027d4e742b7d18acd33c64653ea0bab86fef8f8d58128f974fd22d200faa3a198a0be66bc67c8c17c4327173504d2810632b8af2b99744f6d4c8877455794d94760a0f086864d419c17a7f42351e45f69add679b6ce5a653307348fa68e85f08eb06fa0626930d8c11ab92b8d951c0f7e5f2cf90246f227e1a9d4a812876c4af64813e7a0794cd97029385f90e9f081a7bde82b9e51b45667263ed32241046e2868602e12a03ee68b49871bec72e1ae9c803fa69c6268ecc7a4ad7ee665abd8251bf27ffca5a0d55f2daa02308313dde504d9a04881dfe167842eb5a6b0aad866acba47e5530aa0748a45878170df3ddf534f661f95d5c6b94ef9b9dccc416999b498c35215e6e3a0743eb4afe80808c15c4508629e7852ec06dc3e035dafaaa20fa182b62347a188a071912246a6d2857d5a8114fcb4da7e0c56f77a2290c88738506158bb9f5d41cb80',
    '0xf90211a04895d2601bce2b3ce53a9d4550182d918eb00552aff8de1eb5eaf82867784fe3a0408934a4c63f913994f0b60dcbc8807969eb4f533796b2bacc63917b395aa46aa0733e602e779f01dee2ea18966a9b014676cfffb75a17927f89615b034cca47f8a0525230fd9bb15a6ad62df9b248f85345a7bd6941d75646d5be94418647896f5ca0b2f24f93bcacaeef0a7e1f88fd16cd3bc220608bc80dc2bf21acd1384e2b2d75a00c8ca6c8ba7bd38519360c441dfe1936d37498eceae1e5ef9b82ebb4e3e9de02a0c9b5a8affb8d7413c0955c2a3ae2e8e7f465d6ba381b010f95ad4bdb690b5927a06a079bd1d1b64b415b947f7dbb553a4e5c8f45a38ceedfebddb9bd3b9d5141aca04a7609e65c5e1b2306afd46f219c20c62520172a14aa405cc3537f9e0deb8248a04c12cf140c58dd08e2254f215abf56528837bf763cf1c0e0c312f5f04efed1c4a01a54b9ce7401634dd8800ad1a664474841b106e7a864574f9a640a2bd71ed0f1a0bcf5d8c371961bbdb9ebcc455fe3292a949baf32c9cb8c0f95b5c3c8651f3efca0d20e78f13c9ec8509ade7015cc321adde65ae85d3fcdf31add253867247d383ea05e29f909bbee29874e8a8b9c65eceef71cb2f0a4b5f7dee1798dcb654d71b0efa0581469dd427b97895d2f0fa8f8f450ebe3f9c6b2a6aacfba9779580b341963e6a018128875aaa7d270953d0856f40ce6cd620b24bbaa3dd2f8ad8a6059a193732580',
    '0xf90211a0fbd6198e87e7663b6edfe1b9266e6e1ba441a96c09b15eab3c3ca6468eb3d142a0b4b1796c4a078149b6227c17270005f9819d8e758bd5c194a41b89f4bfcf72c9a0c67dda128eac4aba550da67b572ca8d981e8f4f334f02ac24b72e851b80d9c6ca0097bbfdd5e761def161dcfaed3389325c51282b6054459e3f77ac7923eb8fe05a06940dda14fceb18a7748bb1f6c76453eabb53c1d7d06ccf1059be30570cd7c00a04288334ebb6bae8c47cfeac535a79664a9d95e94dff565d6d10e3cd56840f22aa0fd002cad413d07c4f70ca1e5cf58ac43bcf85408215f24bade85f232a7c1daffa06b0a76c316d3dbef4cf34a406698431a5ca7b8f009053be83112d9024331caf4a0ec3c42a81901ccfe33810fed0e55a36fdd452b4073572083c755dac841c5fdf6a0dec788759d9074fb3e270f8df9bd99d756a4d7e0c738edc17d2bb6fbc64e1a73a09ede2292325659115544b97bc39796c7003eb0c7b4fe040163ec6f9dd641927ea08eb8271089c8e37a9a70a4cdaf3ef2ab15676578647a49c3839b111205e7da3ea03ee95a5184f45f9998793527c935379783c1e096bba2a9da2de83346f9eab128a0e38548b0ab034dffd84e855cc8a9d2e208da9e1d23b9e025c2e8a0b8e0c48477a03697d923c751643eeca73da7f168992c23f316cec98166e4f8edae57eac784dda0df9db399ee26f4533aa36fc59ae557393d4abd9b2a6fef855ce75e2783df08d080',
    '0xf901f180a031a8de8dc726f64e65000a0290fc7ff326cf23ebfd9ce1a00875dc27baa46f84a0be6518a4dbec644565346f0b3b599e831632892009f0eca3338e63692a658703a005c4ef6fed9e222d5c2ca9e63c40977f36d1b909e4bdb4607a5963124a705b45a0aabf62adffd016d909444f2bbb9dbc4736ed913af863c0747a9958d1fa17961aa0c5bd67948865a3ad5b211533a112f1ace67c248baad3e266708af507d593708ba08500a7c6f205f57e3f0709837db935de1b027a5830cbf65b495c6adc07af5b14a0872e3b49e3b3b0f23268bf6811c65eb1776a299b06ec2a4dc4ef93e826c938bba0e63d820e6c40d20ac4481c89c54b5601da104e5ada68db9f4e77065b67f26496a0c67c46f5b8c33fca4409970ecc827b4ee5eacb298d8acf515330e72646d9b6a5a0c6cd83af21bb3017c7f7849d16f29f06a56879d3145b783ca03011e99750d3e7a010ceed06da9a1ad36adb46f2f58dc1cbd463dffe2827b745e188e655330bd3b0a0eb0cef803682d3e15e194f3322a822402977b604720c01c384abef4555d2e67ca0be16ecf387b4866e5bbf0131fb9f34c17d9080829715bd03eb7a72bfd100bf9aa0ad58afb434a097529647c9d0545a2d1628bdab28d27c4800a5e396e79defc8cfa070a9112f60bda81523569687db9685a2238286ff6bae3e1a51d4e3136bd6f94680',
    '0xf8b180a002f1ca7e53f4d1245890cb536d3ac6f11c9cc7d39bef6e95085bd57fdb22d330a00553aee9fe376b1172c9c68f253369a4172d056a033cc08073f383791907b34d808080a0e88e07b309a29927686609041c23e45faf24f7ad85569173aa3c9eeb58d78844808080808080a098a17a84935c37bea2b6088563ea9f7b8909f2032077d747dcb66283054d7063a0ecec1adee4d5db25e0d61716b5239760c0090f70ededb4becfc47e4d2df9e7418080',
    '0xf8679e369434087b9a13633978386e9ee341588032f98227d1a81a5291733dbdc3b846f8440180a0f45883042def0dddaed8f4cb24920a5c81ac3d4ada87dcbd72e886f5bdc64fbba099a40f4c23f0e74bcb9a6f96f2a5d82deaa83f7f3e78655e59cf5e3cc9e7d334'
  ],
  balance: '0x0',
  codeHash: '0x99a40f4c23f0e74bcb9a6f96f2a5d82deaa83f7f3e78655e59cf5e3cc9e7d334',
  nonce: '0x1',
  storageHash: '0xf45883042def0dddaed8f4cb24920a5c81ac3d4ada87dcbd72e886f5bdc64fbb',
  storageProof: [
    {
      key: '0x0000000000000000000000000000000000000000000000000000000000000000',
      value: '0xa52c4cd73157bcfdd4a7c570106016db2749b05',
      proof: [Array]
    }
  ]
}
7 {
  address: '0xe0fb944d3f724a79a4a3f7f3aabfcd2c85057c14',
  proofKey: '0x1fc6d69434087b9a13633978386e9ee341588032f98227d1a81a5291733dbdc3',
  accountProof: '0xf9095cb90214f90211a097f436f1e0c8a65fe79f7388863451751af586c880a3e986010791908525a8a6a0262d8da64eb24458d2d0b360c702b6ced9dabaeacee1b07f80f20fc5b5cc0612a029f1c7ccb1b6378935eed7949eeb26346ba9679360e125d7d538d97d54f39c76a0806ebe72ffe8285c93dfd772dd1f1a04ba3af6aca80fc5e3894ecdf32744237da0204b362880816cea26cff4e057ff2625b1ac5b5239d2a2a0d700c9c574e504b3a0388624f287d978b19c012adef4f40aee55d7b52aff00154ea47261eac31e5c26a027d4e742b7d18acd33c64653ea0bab86fef8f8d58128f974fd22d200faa3a198a0be66bc67c8c17c4327173504d2810632b8af2b99744f6d4c8877455794d94760a0f086864d419c17a7f42351e45f69add679b6ce5a653307348fa68e85f08eb06fa0626930d8c11ab92b8d951c0f7e5f2cf90246f227e1a9d4a812876c4af64813e7a0794cd97029385f90e9f081a7bde82b9e51b45667263ed32241046e2868602e12a03ee68b49871bec72e1ae9c803fa69c6268ecc7a4ad7ee665abd8251bf27ffca5a0d55f2daa02308313dde504d9a04881dfe167842eb5a6b0aad866acba47e5530aa0748a45878170df3ddf534f661f95d5c6b94ef9b9dccc416999b498c35215e6e3a0743eb4afe80808c15c4508629e7852ec06dc3e035dafaaa20fa182b62347a188a071912246a6d2857d5a8114fcb4da7e0c56f77a2290c88738506158bb9f5d41cb80b90214f90211a04895d2601bce2b3ce53a9d4550182d918eb00552aff8de1eb5eaf82867784fe3a0408934a4c63f913994f0b60dcbc8807969eb4f533796b2bacc63917b395aa46aa0733e602e779f01dee2ea18966a9b014676cfffb75a17927f89615b034cca47f8a0525230fd9bb15a6ad62df9b248f85345a7bd6941d75646d5be94418647896f5ca0b2f24f93bcacaeef0a7e1f88fd16cd3bc220608bc80dc2bf21acd1384e2b2d75a00c8ca6c8ba7bd38519360c441dfe1936d37498eceae1e5ef9b82ebb4e3e9de02a0c9b5a8affb8d7413c0955c2a3ae2e8e7f465d6ba381b010f95ad4bdb690b5927a06a079bd1d1b64b415b947f7dbb553a4e5c8f45a38ceedfebddb9bd3b9d5141aca04a7609e65c5e1b2306afd46f219c20c62520172a14aa405cc3537f9e0deb8248a04c12cf140c58dd08e2254f215abf56528837bf763cf1c0e0c312f5f04efed1c4a01a54b9ce7401634dd8800ad1a664474841b106e7a864574f9a640a2bd71ed0f1a0bcf5d8c371961bbdb9ebcc455fe3292a949baf32c9cb8c0f95b5c3c8651f3efca0d20e78f13c9ec8509ade7015cc321adde65ae85d3fcdf31add253867247d383ea05e29f909bbee29874e8a8b9c65eceef71cb2f0a4b5f7dee1798dcb654d71b0efa0581469dd427b97895d2f0fa8f8f450ebe3f9c6b2a6aacfba9779580b341963e6a018128875aaa7d270953d0856f40ce6cd620b24bbaa3dd2f8ad8a6059a193732580b90214f90211a0fbd6198e87e7663b6edfe1b9266e6e1ba441a96c09b15eab3c3ca6468eb3d142a0b4b1796c4a078149b6227c17270005f9819d8e758bd5c194a41b89f4bfcf72c9a0c67dda128eac4aba550da67b572ca8d981e8f4f334f02ac24b72e851b80d9c6ca0097bbfdd5e761def161dcfaed3389325c51282b6054459e3f77ac7923eb8fe05a06940dda14fceb18a7748bb1f6c76453eabb53c1d7d06ccf1059be30570cd7c00a04288334ebb6bae8c47cfeac535a79664a9d95e94dff565d6d10e3cd56840f22aa0fd002cad413d07c4f70ca1e5cf58ac43bcf85408215f24bade85f232a7c1daffa06b0a76c316d3dbef4cf34a406698431a5ca7b8f009053be83112d9024331caf4a0ec3c42a81901ccfe33810fed0e55a36fdd452b4073572083c755dac841c5fdf6a0dec788759d9074fb3e270f8df9bd99d756a4d7e0c738edc17d2bb6fbc64e1a73a09ede2292325659115544b97bc39796c7003eb0c7b4fe040163ec6f9dd641927ea08eb8271089c8e37a9a70a4cdaf3ef2ab15676578647a49c3839b111205e7da3ea03ee95a5184f45f9998793527c935379783c1e096bba2a9da2de83346f9eab128a0e38548b0ab034dffd84e855cc8a9d2e208da9e1d23b9e025c2e8a0b8e0c48477a03697d923c751643eeca73da7f168992c23f316cec98166e4f8edae57eac784dda0df9db399ee26f4533aa36fc59ae557393d4abd9b2a6fef855ce75e2783df08d080b901f4f901f180a031a8de8dc726f64e65000a0290fc7ff326cf23ebfd9ce1a00875dc27baa46f84a0be6518a4dbec644565346f0b3b599e831632892009f0eca3338e63692a658703a005c4ef6fed9e222d5c2ca9e63c40977f36d1b909e4bdb4607a5963124a705b45a0aabf62adffd016d909444f2bbb9dbc4736ed913af863c0747a9958d1fa17961aa0c5bd67948865a3ad5b211533a112f1ace67c248baad3e266708af507d593708ba08500a7c6f205f57e3f0709837db935de1b027a5830cbf65b495c6adc07af5b14a0872e3b49e3b3b0f23268bf6811c65eb1776a299b06ec2a4dc4ef93e826c938bba0e63d820e6c40d20ac4481c89c54b5601da104e5ada68db9f4e77065b67f26496a0c67c46f5b8c33fca4409970ecc827b4ee5eacb298d8acf515330e72646d9b6a5a0c6cd83af21bb3017c7f7849d16f29f06a56879d3145b783ca03011e99750d3e7a010ceed06da9a1ad36adb46f2f58dc1cbd463dffe2827b745e188e655330bd3b0a0eb0cef803682d3e15e194f3322a822402977b604720c01c384abef4555d2e67ca0be16ecf387b4866e5bbf0131fb9f34c17d9080829715bd03eb7a72bfd100bf9aa0ad58afb434a097529647c9d0545a2d1628bdab28d27c4800a5e396e79defc8cfa070a9112f60bda81523569687db9685a2238286ff6bae3e1a51d4e3136bd6f94680b8b3f8b180a002f1ca7e53f4d1245890cb536d3ac6f11c9cc7d39bef6e95085bd57fdb22d330a00553aee9fe376b1172c9c68f253369a4172d056a033cc08073f383791907b34d808080a0e88e07b309a29927686609041c23e45faf24f7ad85569173aa3c9eeb58d78844808080808080a098a17a84935c37bea2b6088563ea9f7b8909f2032077d747dcb66283054d7063a0ecec1adee4d5db25e0d61716b5239760c0090f70ededb4becfc47e4d2df9e7418080b869f8679e369434087b9a13633978386e9ee341588032f98227d1a81a5291733dbdc3b846f8440180a0f45883042def0dddaed8f4cb24920a5c81ac3d4ada87dcbd72e886f5bdc64fbba099a40f4c23f0e74bcb9a6f96f2a5d82deaa83f7f3e78655e59cf5e3cc9e7d334',
  stateroot: '0x4e47550a3c4234b4f3a0f0f1de3fc269221b2f8dedf10435dfec40ee2332ff33'
}
{
  storageRoot: '0xf45883042def0dddaed8f4cb24920a5c81ac3d4ada87dcbd72e886f5bdc64fbb'
}
{ storageEncoded: '0x940a52c4cd73157bcfdd4a7c570106016db2749b05' }
{
  storageValue: '0x0a52c4cd73157bcfdd4a7c570106016db2749b05',
  actualValue: '0x0a52c4cd73157bcfdd4a7c570106016db2749b05',
  equal: true
}
✨  Done in 16.14s.

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