Skip to content

Commit

Permalink
add SC receive function
Browse files Browse the repository at this point in the history
  • Loading branch information
krlosMata committed Apr 17, 2024
1 parent bd072f4 commit bcf69aa
Show file tree
Hide file tree
Showing 4 changed files with 483 additions and 0 deletions.
254 changes: 254 additions & 0 deletions inputs-executor/calldata/receive_0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,254 @@
{
"oldStateRoot": "0x04e8154a59dd75bfa0db6053cb09adbd1f8d42a8ee556eae224d510d8d588a36",
"newStateRoot": "0x973be5252a255c37be78957fdc004e36df7b9be63e50f0ffad838740ccabcf0b",
"oldAccInputHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"newAccInputHash": "0x237aff389bd11699516c94a4dfeda34034b5697073cd0155d4847acbc7543059",
"newLocalExitRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
"oldNumBatch": 0,
"newNumBatch": 1,
"chainID": 1000,
"forkID": 9,
"forcedBlockHashL1": "0x0000000000000000000000000000000000000000000000000000000000000000",
"batchL2Data": "0x0b73e6af6f00000000ed80843b9aca00825208941275fbb540c8efc58b812ba83b0d0b8b9917ae98881bc16d674ec80000808203e88080a629cbf2ea0a4ac74f6ca8fe7ac59b0ab9fa3369a6e70d0f6ee165ce342063795dcb6deab089d989d87611823ded102412bf82528f95bcd871acbc9afcbcb8e81bff",
"l1InfoRoot": "0x090bcaf734c4f06c93954a827b45a6e8c67b8e0fd1e0a35a1c5982d6961828f9",
"timestampLimit": "1944498031",
"sequencerAddr": "0x617b3a3528F9cDd6630fd3301B9c8911F7Bf063D",
"batchHashData": "0xbcc927e33367de40acffb0be0d6b58e4a1f7e37cf2522297df17870ad946e17b",
"contractsBytecode": {
"0xfbeccd2898933b39a54bb44ef8051671776f730baa94f8344949ee6e26372c0c": "0x608060405260043610601f5760003560e01c80636ca7c21614603257602d565b36602d576001600081905550005b600080fd5b348015603d57600080fd5b5060446058565b604051604f9190606b565b60405180910390f35b60005481565b6065816084565b82525050565b6000602082019050607e6000830184605e565b92915050565b600081905091905056fea2646970667358221220ad2cb434a8b8fc1e70285d29eb476be3685524fb0ec2df89e8d4946d56907b3b64736f6c63430008070033",
"0x1275fbb540c8efc58b812ba83b0d0b8b9917ae98": "0xfbeccd2898933b39a54bb44ef8051671776f730baa94f8344949ee6e26372c0c"
},
"l1InfoTree": {
"skipVerifyL1InfoRoot": true
},
"db": {
"0x04e8154a59dd75bfa0db6053cb09adbd1f8d42a8ee556eae224d510d8d588a36": [
"8d92e85212e456d9",
"614b0c0879efd807",
"956e7a968846a478",
"3859eed4cb232990",
"74ce03143dd6a348",
"a48d6890edfe962e",
"c3dc35a78fc9ae90",
"9647dc6f13169a29",
"0000000000000000",
"0000000000000000",
"0000000000000000",
"0000000000000000"
],
"0x3859eed4cb232990956e7a968846a478614b0c0879efd8078d92e85212e456d9": [
"0000000000000000",
"0000000000000000",
"0000000000000000",
"0000000000000000",
"4f13592ef414953e",
"b06eb87c30e9e0b7",
"10ddd0cbb03f414a",
"fd5924db59db79fa",
"0000000000000000",
"0000000000000000",
"0000000000000000",
"0000000000000000"
],
"0xfd5924db59db79fa10ddd0cbb03f414ab06eb87c30e9e0b74f13592ef414953e": [
"1baeee07cadec004",
"99f5931a96dacdaa",
"fc3570bcf0bf7c9e",
"ca0f755a7f970e76",
"06e2b3ee4df174b7",
"4c8ab4fc33e8321c",
"707072a2fd2fee9e",
"eedb37d147fb5a8b",
"0000000000000000",
"0000000000000000",
"0000000000000000",
"0000000000000000"
],
"0xca0f755a7f970e76fc3570bcf0bf7c9e99f5931a96dacdaa1baeee07cadec004": [
"25928440032faa48",
"7603eeedd4b5445e",
"553f6707e9e92083",
"c86ee7583a0df9c1",
"d074b8cee5dcf415",
"2346a1b4c0f390e8",
"47969c1f5a6a25b1",
"da62fdf84a21108e",
"0000000000000001",
"0000000000000000",
"0000000000000000",
"0000000000000000"
],
"0xda62fdf84a21108e47969c1f5a6a25b12346a1b4c0f390e8d074b8cee5dcf415": [
"0000000000000001",
"0000000000000000",
"0000000000000000",
"0000000000000000",
"0000000000000000",
"0000000000000000",
"0000000000000000",
"0000000000000000"
],
"0xeedb37d147fb5a8b707072a2fd2fee9e4c8ab4fc33e8321c06e2b3ee4df174b7": [
"14945417c9b957d1",
"1af1a1e389f5d2bf",
"33fbf3cd8d9bb1e0",
"13060509db26d4ff",
"a9b685376634c15a",
"b81d940d54465873",
"eb0502937ede7b7a",
"d0a8eb8ebd6b65a1",
"0000000000000001",
"0000000000000000",
"0000000000000000",
"0000000000000000"
],
"0xd0a8eb8ebd6b65a1eb0502937ede7b7ab81d940d54465873a9b685376634c15a": [
"00000000000000c4",
"0000000000000000",
"0000000000000000",
"0000000000000000",
"0000000000000000",
"0000000000000000",
"0000000000000000",
"0000000000000000"
],
"0x9647dc6f13169a29c3dc35a78fc9ae90a48d6890edfe962e74ce03143dd6a348": [
"3becbafe0be31961",
"5b704b3a3fb04719",
"6c1fc2781633c3bb",
"d2a73e5d2efc9409",
"ebb05ed2082602b9",
"c538204eb07f3d6c",
"a5ed480ede7b8f0e",
"52621f81fded9c35",
"0000000000000000",
"0000000000000000",
"0000000000000000",
"0000000000000000"
],
"0xd2a73e5d2efc94096c1fc2781633c3bb5b704b3a3fb047193becbafe0be31961": [
"0000000000000000",
"0000000000000000",
"0000000000000000",
"0000000000000000",
"341cec27558aec39",
"a67829464a22c26a",
"68e3e50b992dfb62",
"9fbf3a717fea4e92",
"0000000000000000",
"0000000000000000",
"0000000000000000",
"0000000000000000"
],
"0x9fbf3a717fea4e9268e3e50b992dfb62a67829464a22c26a341cec27558aec39": [
"f035558025b8ec59",
"babb3d90caac7c8b",
"d6886b24a49a1362",
"5e31fa67a4b061c0",
"0000000000000000",
"0000000000000000",
"0000000000000000",
"0000000000000000",
"0000000000000000",
"0000000000000000",
"0000000000000000",
"0000000000000000"
],
"0x5e31fa67a4b061c0d6886b24a49a1362babb3d90caac7c8bf035558025b8ec59": [
"81e3bdb388774b0d",
"a50b1933c787fc21",
"ebcc8b86635df159",
"96a3c63c42db0900",
"a9862d2be2f36e52",
"81988452eab15bf1",
"8ebd249ac24fab51",
"00c1b75210a981ef",
"0000000000000000",
"0000000000000000",
"0000000000000000",
"0000000000000000"
],
"0x96a3c63c42db0900ebcc8b86635df159a50b1933c787fc2181e3bdb388774b0d": [
"0b6ef212cb5c83f8",
"49015d7e991a1528",
"4a6eced6e8304885",
"305a6af4d7a8a00c",
"fd2932c5abe83153",
"1709a8437918cba8",
"6850fdbe6bafc112",
"83a343e7421665a0",
"0000000000000001",
"0000000000000000",
"0000000000000000",
"0000000000000000"
],
"0x83a343e7421665a06850fdbe6bafc1121709a8437918cba8fd2932c5abe83153": [
"00000000314c0000",
"0000000098a7d9b8",
"0000000000000000",
"0000000000000000",
"0000000000000000",
"0000000000000000",
"0000000000000000",
"0000000000000000"
],
"0x00c1b75210a981ef8ebd249ac24fab5181988452eab15bf1a9862d2be2f36e52": [
"3220d02477c5569c",
"0dfe002ac222af8c",
"6f01200bb557e8ae",
"2890f215f2c6b9f7",
"a4d873c913d294c4",
"a3ba3ad0d12fed37",
"a605025780847abb",
"5e1e09526750434c",
"0000000000000001",
"0000000000000000",
"0000000000000000",
"0000000000000000"
],
"0x5e1e09526750434ca605025780847abba3ba3ad0d12fed37a4d873c913d294c4": [
"0000000026372c0c",
"000000004949ee6e",
"00000000aa94f834",
"00000000776f730b",
"00000000f8051671",
"00000000a54bb44e",
"0000000098933b39",
"00000000fbeccd28"
],
"0x52621f81fded9c35a5ed480ede7b8f0ec538204eb07f3d6cebb05ed2082602b9": [
"66ee2be0687eea76",
"6926f8ca8796c78a",
"4c2f3e938869b82d",
"649e63bfe1247ba4",
"35f28afeae0ff489",
"b6d75a1b213c2f7c",
"521f1ce7fca92f45",
"2afffacb569cf689",
"0000000000000001",
"0000000000000000",
"0000000000000000",
"0000000000000000"
],
"0x2afffacb569cf689521f1ce7fca92f45b6d75a1b213c2f7c35f28afeae0ff489": [
"0000000063100000",
"000000006bc75e2d",
"0000000000000005",
"0000000000000000",
"0000000000000000",
"0000000000000000",
"0000000000000000",
"0000000000000000"
]
},
"virtualCounters": {
"steps": 11055,
"arith": 580,
"binary": 725,
"memAlign": 0,
"keccaks": 41,
"padding": 16,
"poseidon": 1266,
"sha256": 0
}
}
123 changes: 123 additions & 0 deletions tools-inputs/data/calldata/receive.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
[
{
"id": 0,
"description": "Deploy OpBitLogic contract (test)",
"sequencerAddress": "0x617b3a3528F9cDd6630fd3301B9c8911F7Bf063D",
"sequencerPvtKey": "0x28b2b0318721be8c8339199172cd7cc8f5e273800a35616ec893083a4b32c02e",
"genesis": [
{
"address": "0x617b3a3528F9cDd6630fd3301B9c8911F7Bf063D",
"nonce": "0",
"balance": "100000000000000000000",
"pvtKey": "0x28b2b0318721be8c8339199172cd7cc8f5e273800a35616ec893083a4b32c02e"
},
{
"address": "0x4d5Cf5032B2a844602278b01199ED191A86c93ff",
"nonce": "0",
"balance": "11000000000000000000",
"pvtKey": "0x4d27a600dce8c29b7bd080e29a26972377dbb04d7a27d919adbb602bf13cfd23"
},
{
"address": "0x1275fbb540c8efc58b812ba83b0d0b8b9917ae98",
"nonce": 1,
"balance": 0,
"bytecode": "0x608060405260043610601f5760003560e01c80636ca7c21614603257602d565b36602d576001600081905550005b600080fd5b348015603d57600080fd5b5060446058565b604051604f9190606b565b60405180910390f35b60005481565b6065816084565b82525050565b6000602082019050607e6000830184605e565b92915050565b600081905091905056fea2646970667358221220ad2cb434a8b8fc1e70285d29eb476be3685524fb0ec2df89e8d4946d56907b3b64736f6c63430008070033",
"abi": [
{
"inputs": [],
"name": "gas",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"stateMutability": "payable",
"type": "receive"
}
],
"storage": {}
}
],
"expectedOldRoot": "0x04e8154a59dd75bfa0db6053cb09adbd1f8d42a8ee556eae224d510d8d588a36",
"txs": [
{
"type": 11,
"deltaTimestamp": "1944498031",
"l1Info": {
"globalExitRoot": "0x090bcaf734c4f06c93954a827b45a6e8c67b8e0fd1e0a35a1c5982d6961828f9",
"blockHash": "0x24a5871d68723340d9eadc674aa8ad75f3e33b61d5a9db7db92af856a19270bb",
"timestamp": "42"
},
"indexL1InfoTree": 0
},
{
"from": "0x4d5Cf5032B2a844602278b01199ED191A86c93ff",
"to": "0x1275fbb540c8efc58b812ba83b0d0b8b9917ae98",
"nonce": "0",
"value": "2000000000000000000",
"gasLimit": 21000,
"gasPrice": "1000000000",
"chainId": 1000
}
],
"expectedNewRoot": "0x973be5252a255c37be78957fdc004e36df7b9be63e50f0ffad838740ccabcf0b",
"expectedNewLeafs": {
"0x617b3a3528F9cDd6630fd3301B9c8911F7Bf063D": {
"balance": "100000021000000000000",
"nonce": "0",
"storage": null
},
"0x4d5Cf5032B2a844602278b01199ED191A86c93ff": {
"balance": "10999979000000000000",
"nonce": "1",
"storage": null
},
"0x1000000000000000000000000000000000000000": {
"balance": "0",
"nonce": "0",
"storage": null
},
"0x000000000000000000000000000000005ca1ab1e": {
"balance": "0",
"nonce": "0",
"storage": {
"0x0000000000000000000000000000000000000000000000000000000000000000": "0x01",
"0x0000000000000000000000000000000000000000000000000000000000000002": "0x73e6af6f",
"0xa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb49": "0x04e8154a59dd75bfa0db6053cb09adbd1f8d42a8ee556eae224d510d8d588a36",
"0x0000000000000000000000000000000000000000000000000000000000000003": "0xf98a881d57ecb0f4e30cb3c039be6a52e0ab19311250cd20f67b1fd8a0111e95"
}
},
"0x1275fbb540c8efc58b812ba83b0d0b8b9917ae98": {
"balance": "0",
"nonce": "1",
"storage": {},
"hashBytecode": "0xfbeccd2898933b39a54bb44ef8051671776f730baa94f8344949ee6e26372c0c",
"bytecodeLength": 196
}
},
"newLocalExitRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
"batchHashData": "0xbcc927e33367de40acffb0be0d6b58e4a1f7e37cf2522297df17870ad946e17b",
"batchL2Data": "0x0b73e6af6f00000000ed80843b9aca00825208941275fbb540c8efc58b812ba83b0d0b8b9917ae98881bc16d674ec80000808203e88080a629cbf2ea0a4ac74f6ca8fe7ac59b0ab9fa3369a6e70d0f6ee165ce342063795dcb6deab089d989d87611823ded102412bf82528f95bcd871acbc9afcbcb8e81bff",
"chainID": 1000,
"oldAccInputHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"forkID": 9,
"l1InfoRoot": "0x090bcaf734c4f06c93954a827b45a6e8c67b8e0fd1e0a35a1c5982d6961828f9",
"timestampLimit": "1944498031",
"virtualCounters": {
"steps": 11055,
"arith": 580,
"binary": 725,
"memAlign": 0,
"keccaks": 41,
"padding": 16,
"poseidon": 1266,
"sha256": 0
}
}
]
11 changes: 11 additions & 0 deletions tools-inputs/tools-calldata/contracts/ReceiveContract.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;

contract ReceiveContract {

uint256 public gas = 0;

receive() external payable {
gas = 1;
}
}
Loading

0 comments on commit bcf69aa

Please sign in to comment.