From 404088f92bbf21c443984414d0d50a5de0db2837 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Negovanovi=C4=87?= <93934272+Stefan-Ethernal@users.noreply.github.com> Date: Wed, 22 May 2024 14:23:43 +0200 Subject: [PATCH] Merge upstream v0.6.6 changes (#134) * check GER and index of synced L1InfoRoot matches with sc values (#3551) * apply txIndex fix to StoreTransactions; add migration to fix wrong txIndexes (#3556) * Feature/#3549 reorgs improvement (#3553) * New reorg function * mocks * linter * Synchronizer tests * new elderberry smc docker image * new image * logs * fix json rpc * fix * Test sync from empty block * Regular reorg case tested * linter * remove empty block + fix LatestSyncedBlockEmpty * Improve check reorgs when no block is received during the call * fix RPC error code for eth_estimateGas and eth_call for reverted tx and no return value; fix e2e test; * fix test * Extra unit test * fix reorg until genesis * disable parallel synchronization --------- Co-authored-by: tclemos * Fix adding tx that matches with tx that is being processed (#3559) * fix adding tx that matches (same addr and nonce) tx that is being processing * fix generate mocks * fix updateCurrentNonceBalance * synchronizer: check l1blocks (#3546) * wip * run on background L1block checker * fix lint and documentation * fix conflict * add unittest * more unittest * fix lint * increase timeout for async unittest * fix unittest * rename GetResponse for GetResult and fix uniitest * add a second gorutines for check the newest blocks * more unittest * add unittest and run also preCheck on launch * by default Precheck from FINALIZED and SAFE * fix unittest, apply PR comments * changes suggested by ARR552 in integration method * fix documentation * import new network-l1-mock from PR#3553 * import new network-l1-mock from PR#3553 * import new network-l1-mock from PR#3553 * import new network-l1-mock from PR#3553 * fix unittest * fix PR comments * fix error * checkReorgAndExecuteReset can't be call with lastEthBlockSynced=nil * add parentHash to error * fix error * merge 3553 fix unittest * fix unittest * fix wrong merge * adapt parallel reorg detection to flow * fix unit tests * fix log * allow use sync parallel mode --------- Co-authored-by: Alonso * Fix + remove empty blocks (#3564) * Fix + remove empty blocks * unit test * linter * Fix/#3565 reorg (#3566) * fix + logs * fix loop * Revert "fix + logs" This reverts commit 39ced69339f46f145aabdf03a93279b737d02bf0. * fix L1InfoRoot when an error happens during the process of the L1 information (#3576) * fix * Comments + mock * avoid error from some L1providers when fromBlock is higher than toBlock * Revert some changes * comments * add L2BlockModulus to L1check * doc * fix dbTx = nil * fix unit tests * added logs to analyze blocking issue when storing L2 block * add debug logs for datastreamer * fix #3581 synchronizer panic synchronizing from trusted node (#3582) * synchronized: #3583 stop sync from l2 after no closed batch (#3584) * stop processing trusted Node after first open batch * Update datastream lib to the latest version with additional debug info * update dslib client interface * Update the diff * Fix non-e2e tests * Update the docker image for the mock L1 network * Update the diff * Fix typo in the comment * Use the Geth v1.13.11 Docker image and update the genesis spec * Update the diff --------- Co-authored-by: agnusmor <100322135+agnusmor@users.noreply.github.com> Co-authored-by: Thiago Coimbra Lemos Co-authored-by: Alonso Rodriguez Co-authored-by: tclemos Co-authored-by: Joan Esteban <129153821+joanestebanr@users.noreply.github.com> Co-authored-by: Alonso Co-authored-by: agnusmor Co-authored-by: dPunisher --- config/default.go | 10 +- .../local/local.genesis.config.json | 182 +- db/migrations/state/0019.sql | 25 + db/migrations/state/0019_test.go | 145 + db/migrations/state/0020.sql | 28 + db/migrations/state/0020_test.go | 99 + docs/config-file/node-config-doc.html | 2 +- docs/config-file/node-config-doc.md | 171 +- docs/config-file/node-config-schema.json | 53 +- docs/diff/diff.html | 319613 ++++++++++++--- docs/running_local.md | 2 +- etherman/etherman.go | 15 +- go.mod | 3 +- go.sum | 6 +- jsonrpc/endpoints_eth.go | 8 +- jsonrpc/endpoints_eth_test.go | 2 +- sequencer/addrqueue.go | 4 + sequencer/datastreamer.go | 2 + sequencer/finalizer.go | 122 +- sequencer/interfaces.go | 7 +- sequencer/l2block.go | 9 + sequencer/mock_etherman.go | 73 +- sequencer/sequencer.go | 21 +- sequencer/worker.go | 20 + state/interfaces.go | 2 + state/l1infotree.go | 12 + state/mocks/mock_storage.go | 121 + state/pgstatestorage/block.go | 49 + state/pgstatestorage/l1infotree.go | 2 +- state/pgstatestorage/pgstatestorage_test.go | 21 + state/reset.go | 7 +- state/state.go | 26 +- state/transaction.go | 5 +- synchronizer/actions/check_l2block.go | 12 +- synchronizer/actions/check_l2block_test.go | 20 +- synchronizer/common/reorg_error.go | 44 + .../syncinterfaces/async_l1_block_checker.go | 40 + .../common/syncinterfaces/etherman.go | 4 +- .../mocks/async_l1_block_checker.go | 196 + .../mocks/etherman_full_interface.go | 56 + .../mocks/l1_block_checker_integrator.go | 176 + .../mocks/state_full_interface.go | 181 + ...ent_ethereum_compatible_l2_block_getter.go | 98 + synchronizer/common/syncinterfaces/state.go | 3 + synchronizer/config.go | 32 + synchronizer/l1_check_block/async.go | 183 + synchronizer/l1_check_block/async_test.go | 138 + synchronizer/l1_check_block/check_l1block.go | 146 + .../l1_check_block/check_l1block_test.go | 128 + synchronizer/l1_check_block/common.go | 5 + synchronizer/l1_check_block/integration.go | 205 + .../l1_check_block/integration_test.go | 298 + .../l1_check_block/mocks/l1_block_checker.go | 82 + .../l1_check_block/mocks/l1_requester.go | 98 + .../mocks/safe_l1_block_number_fetcher.go | 139 + .../state_for_l1_block_checker_integration.go | 100 + .../l1_check_block/mocks/state_interfacer.go | 149 + .../mocks/state_pre_check_interfacer.go | 101 + .../mocks/sync_check_reorger.go | 111 + .../l1_check_block/pre_check_l1block.go | 139 + .../l1_check_block/pre_check_l1block_test.go | 144 + synchronizer/l1_check_block/safe_l1_block.go | 120 + .../l1_check_block/safe_l1_block_test.go | 113 + .../l1_rollup_info_consumer.go | 14 +- .../l2_shared/processor_trusted_batch_sync.go | 8 +- .../tests/trusted_batches_retrieve_test.go | 117 + .../l2_shared/trusted_batches_retrieve.go | 19 + synchronizer/synchronizer.go | 384 +- synchronizer/synchronizer_test.go | 1506 +- test/Makefile | 9 +- test/config/test.genesis.config.json | 180 +- test/docker-compose.yml | 2 +- test/e2e/datacommittee_test.go | 2 +- test/e2e/jsonrpc2_test.go | 122 +- tools/datastreamer/main.go | 20 +- 75 files changed, 262898 insertions(+), 63613 deletions(-) create mode 100644 db/migrations/state/0019.sql create mode 100644 db/migrations/state/0019_test.go create mode 100644 db/migrations/state/0020.sql create mode 100644 db/migrations/state/0020_test.go create mode 100644 synchronizer/common/reorg_error.go create mode 100644 synchronizer/common/syncinterfaces/async_l1_block_checker.go create mode 100644 synchronizer/common/syncinterfaces/mocks/async_l1_block_checker.go create mode 100644 synchronizer/common/syncinterfaces/mocks/l1_block_checker_integrator.go create mode 100644 synchronizer/common/syncinterfaces/mocks/zkevm_client_ethereum_compatible_l2_block_getter.go create mode 100644 synchronizer/l1_check_block/async.go create mode 100644 synchronizer/l1_check_block/async_test.go create mode 100644 synchronizer/l1_check_block/check_l1block.go create mode 100644 synchronizer/l1_check_block/check_l1block_test.go create mode 100644 synchronizer/l1_check_block/common.go create mode 100644 synchronizer/l1_check_block/integration.go create mode 100644 synchronizer/l1_check_block/integration_test.go create mode 100644 synchronizer/l1_check_block/mocks/l1_block_checker.go create mode 100644 synchronizer/l1_check_block/mocks/l1_requester.go create mode 100644 synchronizer/l1_check_block/mocks/safe_l1_block_number_fetcher.go create mode 100644 synchronizer/l1_check_block/mocks/state_for_l1_block_checker_integration.go create mode 100644 synchronizer/l1_check_block/mocks/state_interfacer.go create mode 100644 synchronizer/l1_check_block/mocks/state_pre_check_interfacer.go create mode 100644 synchronizer/l1_check_block/mocks/sync_check_reorger.go create mode 100644 synchronizer/l1_check_block/pre_check_l1block.go create mode 100644 synchronizer/l1_check_block/pre_check_l1block_test.go create mode 100644 synchronizer/l1_check_block/safe_l1_block.go create mode 100644 synchronizer/l1_check_block/safe_l1_block_test.go create mode 100644 synchronizer/l2_sync/l2_shared/tests/trusted_batches_retrieve_test.go diff --git a/config/default.go b/config/default.go index 9b7ec56291..1d41806e4e 100644 --- a/config/default.go +++ b/config/default.go @@ -105,7 +105,15 @@ TrustedSequencerURL = "" # If it is empty or not specified, then the value is re SyncBlockProtection = "safe" # latest, finalized, safe L1SynchronizationMode = "sequential" L1SyncCheckL2BlockHash = true -L1SyncCheckL2BlockNumberhModulus = 30 +L1SyncCheckL2BlockNumberhModulus = 600 + [Synchronizer.L1BlockCheck] + Enable = true + L1SafeBlockPoint = "finalized" + L1SafeBlockOffset = 0 + ForceCheckBeforeStart = true + PreCheckEnable = true + L1PreSafeBlockPoint = "safe" + L1PreSafeBlockOffset = 0 [Synchronizer.L1ParallelSynchronization] MaxClients = 10 MaxPendingNoProcessedBlocks = 25 diff --git a/config/environments/local/local.genesis.config.json b/config/environments/local/local.genesis.config.json index 93620d4f9a..2646957eb6 100644 --- a/config/environments/local/local.genesis.config.json +++ b/config/environments/local/local.genesis.config.json @@ -6,96 +6,96 @@ "polTokenAddress": "0x5FbDB2315678afecb367f032d93F642f64180aa3", "polygonZkEVMGlobalExitRootAddress": "0x8A791620dd6260079BF849Dc5567aDC3F2FdC318" }, - "rollupCreationBlockNumber": 82, - "rollupManagerCreationBlockNumber": 82, + "rollupCreationBlockNumber": 46, + "rollupManagerCreationBlockNumber": 41, "root": "0xcc9ec17819f4ac7f282949ca8c379c4d3ee1b8b7908c51b9b405b6319af67b32", "genesis": [ - { - "contractName": "PolygonZkEVMDeployer", - "balance": "0", - "nonce": "4", - "address": "0x51dbd54FCCb6b3A07738fd3E156D588e71f79973", - "bytecode": "0x6080604052600436106100705760003560e01c8063715018a61161004e578063715018a6146100e65780638da5cb5b146100fb578063e11ae6cb14610126578063f2fde38b1461013957600080fd5b80632b79805a146100755780634a94d4871461008a5780636d07dbf81461009d575b600080fd5b610088610083366004610927565b610159565b005b6100886100983660046109c7565b6101cb565b3480156100a957600080fd5b506100bd6100b8366004610a1e565b61020d565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b50610088610220565b34801561010757600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100bd565b610088610134366004610a40565b610234565b34801561014557600080fd5b50610088610154366004610a90565b61029b565b610161610357565b600061016e8585856103d8565b905061017a8183610537565b5060405173ffffffffffffffffffffffffffffffffffffffff821681527fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a15050505050565b6101d3610357565b6101de83838361057b565b506040517f25adb19089b6a549831a273acdf7908cff8b7ee5f551f8d1d37996cf01c5df5b90600090a1505050565b600061021983836105a9565b9392505050565b610228610357565b61023260006105b6565b565b61023c610357565b60006102498484846103d8565b60405173ffffffffffffffffffffffffffffffffffffffff821681529091507fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a150505050565b6102a3610357565b73ffffffffffffffffffffffffffffffffffffffff811661034b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610354816105b6565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610232576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610342565b600083471015610444576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e63650000006044820152606401610342565b81516000036104af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f6044820152606401610342565b8282516020840186f5905073ffffffffffffffffffffffffffffffffffffffff8116610219576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f79000000000000006044820152606401610342565b6060610219838360006040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c6564000081525061062b565b60606105a1848484604051806060016040528060298152602001610b3d6029913961062b565b949350505050565b6000610219838330610744565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060824710156106bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610342565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516106e69190610acf565b60006040518083038185875af1925050503d8060008114610723576040519150601f19603f3d011682016040523d82523d6000602084013e610728565b606091505b50915091506107398783838761076e565b979650505050505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b606083156108045782516000036107fd5773ffffffffffffffffffffffffffffffffffffffff85163b6107fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610342565b50816105a1565b6105a183838151156108195781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103429190610aeb565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f83011261088d57600080fd5b813567ffffffffffffffff808211156108a8576108a861084d565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156108ee576108ee61084d565b8160405283815286602085880101111561090757600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000806080858703121561093d57600080fd5b8435935060208501359250604085013567ffffffffffffffff8082111561096357600080fd5b61096f8883890161087c565b9350606087013591508082111561098557600080fd5b506109928782880161087c565b91505092959194509250565b803573ffffffffffffffffffffffffffffffffffffffff811681146109c257600080fd5b919050565b6000806000606084860312156109dc57600080fd5b6109e58461099e565b9250602084013567ffffffffffffffff811115610a0157600080fd5b610a0d8682870161087c565b925050604084013590509250925092565b60008060408385031215610a3157600080fd5b50508035926020909101359150565b600080600060608486031215610a5557600080fd5b8335925060208401359150604084013567ffffffffffffffff811115610a7a57600080fd5b610a868682870161087c565b9150509250925092565b600060208284031215610aa257600080fd5b6102198261099e565b60005b83811015610ac6578181015183820152602001610aae565b50506000910152565b60008251610ae1818460208701610aab565b9190910192915050565b6020815260008251806020840152610b0a816040850160208701610aab565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a2646970667358221220964619cee0e0baf94c6f8763f013be157da5d54c89e5cff4a8caf4266e13f13a64736f6c63430008140033", - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266" - } - }, - { - "contractName": "ProxyAdmin", - "balance": "0", - "nonce": "1", - "address": "0xe34Fe58DDa5b8c6D547E4857E987633aa86a5e90", - "bytecode": "0x60806040526004361061007b5760003560e01c80639623609d1161004e5780639623609d1461012b57806399a88ec41461013e578063f2fde38b1461015e578063f3b7dead1461017e57600080fd5b8063204e1c7a14610080578063715018a6146100c95780637eff275e146100e05780638da5cb5b14610100575b600080fd5b34801561008c57600080fd5b506100a061009b366004610608565b61019e565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100d557600080fd5b506100de610255565b005b3480156100ec57600080fd5b506100de6100fb36600461062c565b610269565b34801561010c57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100a0565b6100de610139366004610694565b6102f7565b34801561014a57600080fd5b506100de61015936600461062c565b61038c565b34801561016a57600080fd5b506100de610179366004610608565b6103e8565b34801561018a57600080fd5b506100a0610199366004610608565b6104a4565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907f5c60da1b00000000000000000000000000000000000000000000000000000000815260040190565b600060405180830381855afa9150503d8060008114610225576040519150601f19603f3d011682016040523d82523d6000602084013e61022a565b606091505b50915091508161023957600080fd5b8080602001905181019061024d9190610788565b949350505050565b61025d6104f0565b6102676000610571565b565b6102716104f0565b6040517f8f28397000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690638f283970906024015b600060405180830381600087803b1580156102db57600080fd5b505af11580156102ef573d6000803e3d6000fd5b505050505050565b6102ff6104f0565b6040517f4f1ef28600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690634f1ef28690349061035590869086906004016107a5565b6000604051808303818588803b15801561036e57600080fd5b505af1158015610382573d6000803e3d6000fd5b5050505050505050565b6103946104f0565b6040517f3659cfe600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690633659cfe6906024016102c1565b6103f06104f0565b73ffffffffffffffffffffffffffffffffffffffff8116610498576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6104a181610571565b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907ff851a44000000000000000000000000000000000000000000000000000000000815260040190565b60005473ffffffffffffffffffffffffffffffffffffffff163314610267576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161048f565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b73ffffffffffffffffffffffffffffffffffffffff811681146104a157600080fd5b60006020828403121561061a57600080fd5b8135610625816105e6565b9392505050565b6000806040838503121561063f57600080fd5b823561064a816105e6565b9150602083013561065a816105e6565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000606084860312156106a957600080fd5b83356106b4816105e6565b925060208401356106c4816105e6565b9150604084013567ffffffffffffffff808211156106e157600080fd5b818601915086601f8301126106f557600080fd5b81358181111561070757610707610665565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561074d5761074d610665565b8160405282815289602084870101111561076657600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b60006020828403121561079a57600080fd5b8151610625816105e6565b73ffffffffffffffffffffffffffffffffffffffff8316815260006020604081840152835180604085015260005b818110156107ef578581018301518582016060015282016107d3565b5060006060828601015260607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010192505050939250505056fea2646970667358221220c9867ffac53151bdb1305d8f5e3e883cd83e5270c7ec09cdc24e837b2e65239064736f6c63430008140033", - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000000165878a594ca255338adfa4d48449f69242eb8f" - } - }, - { - "contractName": "PolygonZkEVMBridge implementation", - "balance": "0", - "nonce": "1", - "address": "0x493732fB136a380920C390a85fc27d79C7b70756", - "bytecode": "0x6080604052600436106101a35760003560e01c806383f24403116100e2578063ccaa2d1111610085578063ccaa2d1114610511578063cd58657914610531578063d02103ca14610544578063dbc169761461056b578063ee25560b14610580578063f5efcd79146105ad578063f811bff7146105cd578063fb570834146105ed57600080fd5b806383f244031461040b5780638ed7e3f21461042b578063aaa13cc21461044b578063b8b284d01461046b578063bab161bf1461048b578063be5831c7146104ad578063c00f14ab146104d1578063cc461632146104f157600080fd5b80633cbc795b1161014a5780633cbc795b146102fd5780633e197043146103365780634b2f336d146103565780635ca1e165146103765780637843298b1461038b57806379e2cf97146103ab57806381b1c174146103c057806383c43a55146103f657600080fd5b806315064c96146101a85780632072f6c5146101d757806322e95f2c146101ee578063240ff3781461021b57806327aef4e81461022e5780632dfdf0b514610250578063318aee3d146102745780633c351e10146102dd575b600080fd5b3480156101b457600080fd5b506068546101c29060ff1681565b60405190151581526020015b60405180910390f35b3480156101e357600080fd5b506101ec61060d565b005b3480156101fa57600080fd5b5061020e610209366004612b65565b610642565b6040516101ce9190612b9c565b6101ec610229366004612c06565b610693565b34801561023a57600080fd5b50610243610703565b6040516101ce9190612ccf565b34801561025c57600080fd5b5061026660535481565b6040519081526020016101ce565b34801561028057600080fd5b506102b961028f366004612ce9565b606b6020526000908152604090205463ffffffff811690600160201b90046001600160a01b031682565b6040805163ffffffff90931683526001600160a01b039091166020830152016101ce565b3480156102e957600080fd5b50606d5461020e906001600160a01b031681565b34801561030957600080fd5b50606d5461032190600160a01b900463ffffffff1681565b60405163ffffffff90911681526020016101ce565b34801561034257600080fd5b50610266610351366004612d15565b610791565b34801561036257600080fd5b50606f5461020e906001600160a01b031681565b34801561038257600080fd5b5061026661081e565b34801561039757600080fd5b5061020e6103a6366004612d94565b6108fb565b3480156103b757600080fd5b506101ec610925565b3480156103cc57600080fd5b5061020e6103db366004612ddd565b606a602052600090815260409020546001600160a01b031681565b34801561040257600080fd5b50610243610946565b34801561041757600080fd5b50610266610426366004612e08565b610965565b34801561043757600080fd5b50606c5461020e906001600160a01b031681565b34801561045757600080fd5b5061020e610466366004612f12565b610a3b565b34801561047757600080fd5b506101ec610486366004612fad565b610b3d565b34801561049757600080fd5b5060685461032190610100900463ffffffff1681565b3480156104b957600080fd5b5060685461032190600160c81b900463ffffffff1681565b3480156104dd57600080fd5b506102436104ec366004612ce9565b610c04565b3480156104fd57600080fd5b506101c261050c36600461302f565b610c49565b34801561051d57600080fd5b506101ec61052c366004613062565b610cd2565b6101ec61053f36600461314d565b6111c7565b34801561055057600080fd5b5060685461020e90600160281b90046001600160a01b031681565b34801561057757600080fd5b506101ec611621565b34801561058c57600080fd5b5061026661059b366004612ddd565b60696020526000908152604090205481565b3480156105b957600080fd5b506101ec6105c8366004613062565b611654565b3480156105d957600080fd5b506101ec6105e83660046131e2565b6118ef565b3480156105f957600080fd5b506101c261060836600461328a565b611b62565b606c546001600160a01b0316331461063857604051631736745960e31b815260040160405180910390fd5b610640611b7a565b565b6000606a6000848460405160200161065b9291906132d2565b60408051601f19818403018152918152815160209283012083529082019290925201600020546001600160a01b031690505b92915050565b60685460ff16156106b757604051630bc011ff60e21b815260040160405180910390fd5b34158015906106d05750606f546001600160a01b031615155b156106ee576040516301bd897160e61b815260040160405180910390fd5b6106fc858534868686611bd6565b5050505050565b606e8054610710906132fc565b80601f016020809104026020016040519081016040528092919081815260200182805461073c906132fc565b80156107895780601f1061075e57610100808354040283529160200191610789565b820191906000526020600020905b81548152906001019060200180831161076c57829003601f168201915b505050505081565b6040516001600160f81b031960f889901b1660208201526001600160e01b031960e088811b821660218401526001600160601b0319606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b605354600090819081805b60208110156108f2578083901c600116600103610886576033816020811061085357610853613336565b015460408051602081019290925281018590526060016040516020818303038152906040528051906020012093506108b3565b60408051602081018690529081018390526060016040516020818303038152906040528051906020012093505b604080516020810184905290810183905260600160405160208183030381529060405280519060200120915080806108ea90613362565b915050610829565b50919392505050565b600061091d848461090b85611ca0565b61091486611d5f565b61046687611e17565b949350505050565b605354606854600160c81b900463ffffffff16101561064057610640611ecf565b60405180611ba00160405280611b668152602001613a7a611b66913981565b600083815b6020811015610a3257600163ffffffff8516821c811690036109d55784816020811061099857610998613336565b6020020135826040516020016109b8929190918252602082015260400190565b604051602081830303815290604052805190602001209150610a20565b818582602081106109e8576109e8613336565b6020020135604051602001610a07929190918252602082015260400190565b6040516020818303038152906040528051906020012091505b80610a2a81613362565b91505061096a565b50949350505050565b6000808686604051602001610a519291906132d2565b604051602081830303815290604052805190602001209050600060ff60f81b308360405180611ba00160405280611b668152602001613a7a611b669139898989604051602001610aa39392919061337b565b60408051601f1981840301815290829052610ac192916020016133b4565b60405160208183030381529060405280519060200120604051602001610b1994939291906001600160f81b031994909416845260609290921b6001600160601b03191660018401526015830152603582015260550190565b60408051808303601f19018152919052805160209091012098975050505050505050565b60685460ff1615610b6157604051630bc011ff60e21b815260040160405180910390fd5b606f546001600160a01b0316610b8a5760405163dde3cda760e01b815260040160405180910390fd5b606f54604051632770a7eb60e21b81526001600160a01b0390911690639dc29fac90610bbc90339088906004016133e3565b600060405180830381600087803b158015610bd657600080fd5b505af1158015610bea573d6000803e3d6000fd5b50505050610bfc868686868686611bd6565b505050505050565b6060610c0f82611ca0565b610c1883611d5f565b610c2184611e17565b604051602001610c339392919061337b565b6040516020818303038152906040529050919050565b6068546000908190610100900463ffffffff16158015610c6f575063ffffffff83166001145b15610c81575063ffffffff8316610ca8565b610c95600160201b63ffffffff85166133fc565b610ca59063ffffffff8616613413565b90505b600881901c600090815260696020526040902054600160ff9092169190911b908116149392505050565b60685460ff1615610cf657604051630bc011ff60e21b815260040160405180910390fd5b60685463ffffffff8681166101009092041614610d26576040516302caf51760e11b815260040160405180910390fd5b610d5a8c8c8c8c8c610d5560008e8e8e8e8e8e8e604051610d48929190613426565b6040518091039020610791565b611f68565b6001600160a01b038616610e9257606f546001600160a01b0316610e295760006001600160a01b03851684825b6040519080825280601f01601f191660200182016040528015610db1576020820181803683370190505b50604051610dbf9190613436565b60006040518083038185875af1925050503d8060008114610dfc576040519150601f19603f3d011682016040523d82523d6000602084013e610e01565b606091505b5050905080610e2357604051630ce8f45160e31b815260040160405180910390fd5b5061117a565b606f546040516340c10f1960e01b81526001600160a01b03909116906340c10f1990610e5b90879087906004016133e3565b600060405180830381600087803b158015610e7557600080fd5b505af1158015610e89573d6000803e3d6000fd5b5050505061117a565b606d546001600160a01b038781169116148015610ec05750606d5463ffffffff888116600160a01b90920416145b15610ed85760006001600160a01b0385168482610d87565b60685463ffffffff610100909104811690881603610f0957610f046001600160a01b03871685856120c7565b61117a565b60008787604051602001610f1e9291906132d2565b60408051601f1981840301815291815281516020928301206000818152606a9093529120549091506001600160a01b031680611116576000610f968386868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061212292505050565b6040516340c10f1960e01b81529091506001600160a01b038216906340c10f1990610fc7908a908a906004016133e3565b600060405180830381600087803b158015610fe157600080fd5b505af1158015610ff5573d6000803e3d6000fd5b5050505080606a600085815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060405180604001604052808b63ffffffff1681526020018a6001600160a01b0316815250606b6000836001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a8154816001600160a01b0302191690836001600160a01b031602179055509050507f490e59a1701b938786ac72570a1efeac994a3dbe96e2e883e19e902ace6e6a398a8a83888860405161110895949392919061347b565b60405180910390a150611177565b6040516340c10f1960e01b81526001600160a01b038216906340c10f199061114490899089906004016133e3565b600060405180830381600087803b15801561115e57600080fd5b505af1158015611172573d6000803e3d6000fd5b505050505b50505b7f1df3f2a973a00d6635911755c260704e95e8a5876997546798770f76396fda4d8a888887876040516111b19594939291906134b4565b60405180910390a1505050505050505050505050565b60685460ff16156111eb57604051630bc011ff60e21b815260040160405180910390fd5b6111f361219e565b60685463ffffffff610100909104811690881603611224576040516302caf51760e11b815260040160405180910390fd5b6000806060876001600160a01b03881661130a578834146112585760405163b89240f560e01b815260040160405180910390fd5b606d54606e80546001600160a01b0383169650600160a01b90920463ffffffff16945090611285906132fc565b80601f01602080910402602001604051908101604052809291908181526020018280546112b1906132fc565b80156112fe5780601f106112d3576101008083540402835291602001916112fe565b820191906000526020600020905b8154815290600101906020018083116112e157829003601f168201915b50505050509150611596565b34156113295760405163798ee6f160e01b815260040160405180910390fd5b606f546001600160a01b03908116908916036113a457604051632770a7eb60e21b81526001600160a01b03891690639dc29fac9061136d9033908d906004016133e3565b600060405180830381600087803b15801561138757600080fd5b505af115801561139b573d6000803e3d6000fd5b50505050611596565b6001600160a01b038089166000908152606b602090815260409182902082518084019093525463ffffffff81168352600160201b9004909216918101829052901561145c57604051632770a7eb60e21b81526001600160a01b038a1690639dc29fac906114179033908e906004016133e3565b600060405180830381600087803b15801561143157600080fd5b505af1158015611445573d6000803e3d6000fd5b505050508060200151945080600001519350611589565b851561146e5761146e898b89896121f7565b6040516370a0823160e01b81526000906001600160a01b038b16906370a082319061149d903090600401612b9c565b602060405180830381865afa1580156114ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114de91906134e6565b90506114f56001600160a01b038b1633308e61253d565b6040516370a0823160e01b81526000906001600160a01b038c16906370a0823190611524903090600401612b9c565b602060405180830381865afa158015611541573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061156591906134e6565b905061157182826134ff565b6068548c9850610100900463ffffffff169650935050505b61159289610c04565b9250505b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b600084868e8e86886053546040516115d6989796959493929190613512565b60405180910390a16115fd6115f8600085878f8f878980519060200120610791565b612575565b861561160b5761160b611ecf565b5050505061161860018055565b50505050505050565b606c546001600160a01b0316331461164c57604051631736745960e31b815260040160405180910390fd5b610640612660565b60685460ff161561167857604051630bc011ff60e21b815260040160405180910390fd5b60685463ffffffff86811661010090920416146116a8576040516302caf51760e11b815260040160405180910390fd5b6116ca8c8c8c8c8c610d5560018e8e8e8e8e8e8e604051610d48929190613426565b606f546000906001600160a01b031661178157846001600160a01b031684888a86866040516024016116ff949392919061357d565b60408051601f198184030181529181526020820180516001600160e01b0316630c035af960e11b179052516117349190613436565b60006040518083038185875af1925050503d8060008114611771576040519150601f19603f3d011682016040523d82523d6000602084013e611776565b606091505b505080915050611883565b606f546040516340c10f1960e01b81526001600160a01b03909116906340c10f19906117b390889088906004016133e3565b600060405180830381600087803b1580156117cd57600080fd5b505af11580156117e1573d6000803e3d6000fd5b50505050846001600160a01b031687898585604051602401611806949392919061357d565b60408051601f198184030181529181526020820180516001600160e01b0316630c035af960e11b1790525161183b9190613436565b6000604051808303816000865af19150503d8060008114611878576040519150601f19603f3d011682016040523d82523d6000602084013e61187d565b606091505b50909150505b806118a1576040516337e391c360e01b815260040160405180910390fd5b7f1df3f2a973a00d6635911755c260704e95e8a5876997546798770f76396fda4d8b898988886040516118d89594939291906134b4565b60405180910390a150505050505050505050505050565b600054610100900460ff161580801561190f5750600054600160ff909116105b806119295750303b158015611929575060005460ff166001145b6119915760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff1916600117905580156119b4576000805461ff0019166101001790555b60688054610100600160c81b03191661010063ffffffff8a160265010000000000600160c81b03191617600160281b6001600160a01b038781169190910291909117909155606c80546001600160a01b0319168583161790558616611a3d5763ffffffff851615611a3857604051630d43a60960e11b815260040160405180910390fd5b611b0c565b606d805463ffffffff8716600160a01b026001600160c01b03199091166001600160a01b03891617179055606e611a7483826135fe565b50611aeb6000801b6012604051602001611ad791906060808252600d908201526c2bb930b83832b21022ba3432b960991b608082015260a060208201819052600490820152630ae8aa8960e31b60c082015260ff91909116604082015260e00190565b604051602081830303815290604052612122565b606f80546001600160a01b0319166001600160a01b03929092169190911790555b611b146126b8565b8015611618576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150505050505050565b600081611b70868686610965565b1495945050505050565b60685460ff1615611b9e57604051630bc011ff60e21b815260040160405180910390fd5b6068805460ff191660011790556040517f2261efe5aef6fedc1fd1550b25facc9181745623049c7901287030b9ad1a549790600090a1565b60685463ffffffff610100909104811690871603611c07576040516302caf51760e11b815260040160405180910390fd5b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b6001606860019054906101000a900463ffffffff16338989898888605354604051611c5b999897969594939291906136bd565b60405180910390a1611c926115f86001606860019054906101000a900463ffffffff16338a8a8a8989604051610d48929190613426565b8215610bfc57610bfc611ecf565b60408051600481526024810182526020810180516001600160e01b03166306fdde0360e01b179052905160609160009182916001600160a01b03861691611ce79190613436565b600060405180830381855afa9150503d8060008114611d22576040519150601f19603f3d011682016040523d82523d6000602084013e611d27565b606091505b509150915081611d5657604051806040016040528060078152602001664e4f5f4e414d4560c81b81525061091d565b61091d816126e7565b60408051600481526024810182526020810180516001600160e01b03166395d89b4160e01b179052905160609160009182916001600160a01b03861691611da69190613436565b600060405180830381855afa9150503d8060008114611de1576040519150601f19603f3d011682016040523d82523d6000602084013e611de6565b606091505b509150915081611d5657604051806040016040528060098152602001681393d7d4d6535093d360ba1b81525061091d565b60408051600481526024810182526020810180516001600160e01b031663313ce56760e01b1790529051600091829182916001600160a01b03861691611e5d9190613436565b600060405180830381855afa9150503d8060008114611e98576040519150601f19603f3d011682016040523d82523d6000602084013e611e9d565b606091505b5091509150818015611eb0575080516020145b611ebb57601261091d565b8080602001905181019061091d919061372a565b6053546068805463ffffffff909216600160c81b0263ffffffff60c81b1990921691909117908190556001600160a01b03600160281b909104166333d6247d611f1661081e565b6040518263ffffffff1660e01b8152600401611f3491815260200190565b600060405180830381600087803b158015611f4e57600080fd5b505af1158015611f62573d6000803e3d6000fd5b50505050565b606854604080516020808201879052818301869052825180830384018152606083019384905280519101206312bd9b1960e11b9092526064810191909152600091600160281b90046001600160a01b03169063257b3632906084016020604051808303816000875af1158015611fe2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061200691906134e6565b90508060000361202857604051622f6fad60e01b815260040160405180910390fd5b600080600160401b87161561206857869150612046848a8489611b62565b612063576040516338105f3b60e21b815260040160405180910390fd5b6120b2565b602087901c612078816001613747565b915087925061209361208b868c86610965565b8a8389611b62565b6120b0576040516338105f3b60e21b815260040160405180910390fd5b505b6120bc8282612875565b505050505050505050565b61211d8363a9059cbb60e01b84846040516024016120e69291906133e3565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261291d565b505050565b60008060405180611ba00160405280611b668152602001613a7a611b669139836040516020016121539291906133b4565b6040516020818303038152906040529050838151602083016000f591506001600160a01b038216612197576040516305f7d84960e51b815260040160405180910390fd5b5092915050565b6002600154036121f05760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611988565b6002600155565b60006122066004828486613764565b61220f9161378e565b9050632afa533160e01b6001600160e01b03198216016123a357600080808080808061223e896004818d613764565b81019061224b91906137be565b9650965096509650965096509650336001600160a01b0316876001600160a01b03161461228b5760405163912ecce760e01b815260040160405180910390fd5b6001600160a01b03861630146122b45760405163750643af60e01b815260040160405180910390fd5b8a85146122d4576040516303fffc4b60e01b815260040160405180910390fd5b604080516001600160a01b0389811660248301528881166044830152606482018890526084820187905260ff861660a483015260c4820185905260e48083018590528351808403909101815261010490920183526020820180516001600160e01b031663d505accf60e01b1790529151918e16916123529190613436565b6000604051808303816000865af19150503d806000811461238f576040519150601f19603f3d011682016040523d82523d6000602084013e612394565b606091505b505050505050505050506106fc565b6001600160e01b031981166323f2ebc360e21b146123d457604051637141605d60e11b815260040160405180910390fd5b6000808080808080806123ea8a6004818e613764565b8101906123f79190613812565b97509750975097509750975097509750336001600160a01b0316886001600160a01b0316146124395760405163912ecce760e01b815260040160405180910390fd5b6001600160a01b03871630146124625760405163750643af60e01b815260040160405180910390fd5b604080516001600160a01b038a811660248301528981166044830152606482018990526084820188905286151560a483015260ff861660c483015260e482018590526101048083018590528351808403909101815261012490920183526020820180516001600160e01b03166323f2ebc360e21b1790529151918f16916124e99190613436565b6000604051808303816000865af19150503d8060008114612526576040519150601f19603f3d011682016040523d82523d6000602084013e61252b565b606091505b50505050505050505050505050505050565b6040516001600160a01b0380851660248301528316604482015260648101829052611f629085906323b872dd60e01b906084016120e6565b80600161258460206002613979565b61258e91906134ff565b605354106125af576040516377ae67b360e11b815260040160405180910390fd5b60006053600081546125c090613362565b9182905550905060005b6020811015612651578082901c6001166001036125fd5782603382602081106125f5576125f5613336565b015550505050565b6033816020811061261057612610613336565b01546040805160208101929092528101849052606001604051602081830303815290604052805190602001209250808061264990613362565b9150506125ca565b5061211d613985565b60018055565b60685460ff1661268357604051635386698160e01b815260040160405180910390fd5b6068805460ff191690556040517f1e5e34eea33501aecf2ebec9fe0e884a40804275ea7fe10b2ba084c8374308b390600090a1565b600054610100900460ff166126df5760405162461bcd60e51b81526004016119889061399b565b6106406129ef565b60606040825110612706578180602001905181019061068d91906139e6565b81516020036128425760005b602081108015612741575082818151811061272f5761272f613336565b01602001516001600160f81b03191615155b15612758578061275081613362565b915050612712565b806000036127905750506040805180820190915260128152714e4f545f56414c49445f454e434f44494e4760701b6020820152919050565b6000816001600160401b038111156127aa576127aa612e47565b6040519080825280601f01601f1916602001820160405280156127d4576020820181803683370190505b50905060005b8281101561283a578481815181106127f4576127f4613336565b602001015160f81c60f81b82828151811061281157612811613336565b60200101906001600160f81b031916908160001a9053508061283281613362565b9150506127da565b509392505050565b50506040805180820190915260128152714e4f545f56414c49445f454e434f44494e4760701b602082015290565b919050565b606854600090610100900463ffffffff16158015612899575063ffffffff82166001145b156128ab575063ffffffff82166128d2565b6128bf600160201b63ffffffff84166133fc565b6128cf9063ffffffff8516613413565b90505b600881901c60008181526069602052604081208054600160ff861690811b9182189283905592909190818316900361161857604051630c8d9eab60e31b815260040160405180910390fd5b6000612972826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612a169092919063ffffffff16565b80519091501561211d57808060200190518101906129909190613a5c565b61211d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401611988565b600054610100900460ff1661265a5760405162461bcd60e51b81526004016119889061399b565b606061091d848460008585600080866001600160a01b03168587604051612a3d9190613436565b60006040518083038185875af1925050503d8060008114612a7a576040519150601f19603f3d011682016040523d82523d6000602084013e612a7f565b606091505b5091509150612a9087838387612a9b565b979650505050505050565b60608315612b0a578251600003612b03576001600160a01b0385163b612b035760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611988565b508161091d565b61091d8383815115612b1f5781518083602001fd5b8060405162461bcd60e51b81526004016119889190612ccf565b803563ffffffff8116811461287057600080fd5b6001600160a01b0381168114612b6257600080fd5b50565b60008060408385031215612b7857600080fd5b612b8183612b39565b91506020830135612b9181612b4d565b809150509250929050565b6001600160a01b0391909116815260200190565b8015158114612b6257600080fd5b60008083601f840112612bd057600080fd5b5081356001600160401b03811115612be757600080fd5b602083019150836020828501011115612bff57600080fd5b9250929050565b600080600080600060808688031215612c1e57600080fd5b612c2786612b39565b94506020860135612c3781612b4d565b93506040860135612c4781612bb0565b925060608601356001600160401b03811115612c6257600080fd5b612c6e88828901612bbe565b969995985093965092949392505050565b60005b83811015612c9a578181015183820152602001612c82565b50506000910152565b60008151808452612cbb816020860160208601612c7f565b601f01601f19169290920160200192915050565b602081526000612ce26020830184612ca3565b9392505050565b600060208284031215612cfb57600080fd5b8135612ce281612b4d565b60ff81168114612b6257600080fd5b600080600080600080600060e0888a031215612d3057600080fd5b8735612d3b81612d06565b9650612d4960208901612b39565b95506040880135612d5981612b4d565b9450612d6760608901612b39565b93506080880135612d7781612b4d565b9699959850939692959460a0840135945060c09093013592915050565b600080600060608486031215612da957600080fd5b612db284612b39565b92506020840135612dc281612b4d565b91506040840135612dd281612b4d565b809150509250925092565b600060208284031215612def57600080fd5b5035919050565b80610400810183101561068d57600080fd5b60008060006104408486031215612e1e57600080fd5b83359250612e2f8560208601612df6565b9150612e3e6104208501612b39565b90509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715612e8557612e85612e47565b604052919050565b60006001600160401b03821115612ea657612ea6612e47565b50601f01601f191660200190565b6000612ec7612ec284612e8d565b612e5d565b9050828152838383011115612edb57600080fd5b828260208301376000602084830101529392505050565b600082601f830112612f0357600080fd5b612ce283833560208501612eb4565b600080600080600060a08688031215612f2a57600080fd5b612f3386612b39565b94506020860135612f4381612b4d565b935060408601356001600160401b0380821115612f5f57600080fd5b612f6b89838a01612ef2565b94506060880135915080821115612f8157600080fd5b50612f8e88828901612ef2565b9250506080860135612f9f81612d06565b809150509295509295909350565b60008060008060008060a08789031215612fc657600080fd5b612fcf87612b39565b95506020870135612fdf81612b4d565b9450604087013593506060870135612ff681612bb0565b925060808701356001600160401b0381111561301157600080fd5b61301d89828a01612bbe565b979a9699509497509295939492505050565b6000806040838503121561304257600080fd5b61304b83612b39565b915061305960208401612b39565b90509250929050565b6000806000806000806000806000806000806109208d8f03121561308557600080fd5b61308f8e8e612df6565b9b5061309f8e6104008f01612df6565b9a506108008d013599506108208d013598506108408d013597506130c66108608e01612b39565b96506130d66108808e0135612b4d565b6108808d013595506130eb6108a08e01612b39565b94506130fb6108c08e0135612b4d565b6108c08d013593506108e08d013592506001600160401b036109008e0135111561312457600080fd5b6131358e6109008f01358f01612bbe565b81935080925050509295989b509295989b509295989b565b600080600080600080600060c0888a03121561316857600080fd5b61317188612b39565b9650602088013561318181612b4d565b955060408801359450606088013561319881612b4d565b935060808801356131a881612bb0565b925060a08801356001600160401b038111156131c357600080fd5b6131cf8a828b01612bbe565b989b979a50959850939692959293505050565b60008060008060008060c087890312156131fb57600080fd5b61320487612b39565b9550602087013561321481612b4d565b945061322260408801612b39565b9350606087013561323281612b4d565b9250608087013561324281612b4d565b915060a08701356001600160401b0381111561325d57600080fd5b8701601f8101891361326e57600080fd5b61327d89823560208401612eb4565b9150509295509295509295565b60008060008061046085870312156132a157600080fd5b843593506132b28660208701612df6565b92506132c16104208601612b39565b939692955092936104400135925050565b60e09290921b6001600160e01b031916825260601b6001600160601b031916600482015260180190565b600181811c9082168061331057607f821691505b60208210810361333057634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016133745761337461334c565b5060010190565b60608152600061338e6060830186612ca3565b82810360208401526133a08186612ca3565b91505060ff83166040830152949350505050565b600083516133c6818460208801612c7f565b8351908301906133da818360208801612c7f565b01949350505050565b6001600160a01b03929092168252602082015260400190565b808202811582820484141761068d5761068d61334c565b8082018082111561068d5761068d61334c565b8183823760009101908152919050565b60008251613448818460208701612c7f565b9190910192915050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b63ffffffff861681526001600160a01b03858116602083015284166040820152608060608201819052600090612a909083018486613452565b94855263ffffffff9390931660208501526001600160a01b039182166040850152166060830152608082015260a00190565b6000602082840312156134f857600080fd5b5051919050565b8181038181111561068d5761068d61334c565b60ff8916815263ffffffff88811660208301526001600160a01b03888116604084015287821660608401528616608083015260a0820185905261010060c0830181905260009161356484830187612ca3565b925080851660e085015250509998505050505050505050565b6001600160a01b038516815263ffffffff841660208201526060604082018190526000906135ae9083018486613452565b9695505050505050565b601f82111561211d57600081815260208120601f850160051c810160208610156135df5750805b601f850160051c820191505b81811015610bfc578281556001016135eb565b81516001600160401b0381111561361757613617612e47565b61362b8161362584546132fc565b846135b8565b602080601f83116001811461366057600084156136485750858301515b600019600386901b1c1916600185901b178555610bfc565b600085815260208120601f198616915b8281101561368f57888601518255948401946001909101908401613670565b50858210156136ad5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60ff8a16815263ffffffff89811660208301526001600160a01b03898116604084015288821660608401528716608083015260a0820186905261010060c083018190526000916137108483018789613452565b925080851660e085015250509a9950505050505050505050565b60006020828403121561373c57600080fd5b8151612ce281612d06565b63ffffffff8181168382160190808211156121975761219761334c565b6000808585111561377457600080fd5b8386111561378157600080fd5b5050820193919092039150565b6001600160e01b031981358181169160048510156137b65780818660040360031b1b83161692505b505092915050565b600080600080600080600060e0888a0312156137d957600080fd5b87356137e481612b4d565b965060208801356137f481612b4d565b955060408801359450606088013593506080880135612d7781612d06565b600080600080600080600080610100898b03121561382f57600080fd5b883561383a81612b4d565b9750602089013561384a81612b4d565b96506040890135955060608901359450608089013561386881612bb0565b935060a089013561387881612d06565b979a969950949793969295929450505060c08201359160e0013590565b600181815b808511156138d05781600019048211156138b6576138b661334c565b808516156138c357918102915b93841c939080029061389a565b509250929050565b6000826138e75750600161068d565b816138f45750600061068d565b816001811461390a576002811461391457613930565b600191505061068d565b60ff8411156139255761392561334c565b50506001821b61068d565b5060208310610133831016604e8410600b8410161715613953575081810a61068d565b61395d8383613895565b80600019048211156139715761397161334c565b029392505050565b6000612ce283836138d8565b634e487b7160e01b600052600160045260246000fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156139f857600080fd5b81516001600160401b03811115613a0e57600080fd5b8201601f81018413613a1f57600080fd5b8051613a2d612ec282612e8d565b818152856020838501011115613a4257600080fd5b613a53826020830160208601612c7f565b95945050505050565b600060208284031215613a6e57600080fd5b8151612ce281612bb056fe6101006040523480156200001257600080fd5b5060405162001b6638038062001b6683398101604081905262000035916200028d565b82826003620000458382620003a1565b506004620000548282620003a1565b50503360c0525060ff811660e052466080819052620000739062000080565b60a052506200046d915050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f620000ad6200012e565b805160209182012060408051808201825260018152603160f81b90840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b6060600380546200013f9062000312565b80601f01602080910402602001604051908101604052809291908181526020018280546200016d9062000312565b8015620001be5780601f106200019257610100808354040283529160200191620001be565b820191906000526020600020905b815481529060010190602001808311620001a057829003601f168201915b5050505050905090565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620001f057600080fd5b81516001600160401b03808211156200020d576200020d620001c8565b604051601f8301601f19908116603f01168101908282118183101715620002385762000238620001c8565b816040528381526020925086838588010111156200025557600080fd5b600091505b838210156200027957858201830151818301840152908201906200025a565b600093810190920192909252949350505050565b600080600060608486031215620002a357600080fd5b83516001600160401b0380821115620002bb57600080fd5b620002c987838801620001de565b94506020860151915080821115620002e057600080fd5b50620002ef86828701620001de565b925050604084015160ff811681146200030757600080fd5b809150509250925092565b600181811c908216806200032757607f821691505b6020821081036200034857634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200039c57600081815260208120601f850160051c81016020861015620003775750805b601f850160051c820191505b81811015620003985782815560010162000383565b5050505b505050565b81516001600160401b03811115620003bd57620003bd620001c8565b620003d581620003ce845462000312565b846200034e565b602080601f8311600181146200040d5760008415620003f45750858301515b600019600386901b1c1916600185901b17855562000398565b600085815260208120601f198616915b828110156200043e578886015182559484019460019091019084016200041d565b50858210156200045d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e0516116aa620004bc6000396000610237015260008181610307015281816105c001526106a70152600061053a015260008181610379015261050401526116aa6000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806370a08231116100d8578063a457c2d71161008c578063d505accf11610066578063d505accf1461039b578063dd62ed3e146103ae578063ffa1ad74146103f457600080fd5b8063a457c2d71461034e578063a9059cbb14610361578063cd0d00961461037457600080fd5b806395d89b41116100bd57806395d89b41146102e75780639dc29fac146102ef578063a3c573eb1461030257600080fd5b806370a08231146102915780637ecebe00146102c757600080fd5b806330adf81f1161012f5780633644e515116101145780633644e51514610261578063395093511461026957806340c10f191461027c57600080fd5b806330adf81f14610209578063313ce5671461023057600080fd5b806318160ddd1161016057806318160ddd146101bd57806320606b70146101cf57806323b872dd146101f657600080fd5b806306fdde031461017c578063095ea7b31461019a575b600080fd5b610184610430565b60405161019191906113e4565b60405180910390f35b6101ad6101a8366004611479565b6104c2565b6040519015158152602001610191565b6002545b604051908152602001610191565b6101c17f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81565b6101ad6102043660046114a3565b6104dc565b6101c17f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152602001610191565b6101c1610500565b6101ad610277366004611479565b61055c565b61028f61028a366004611479565b6105a8565b005b6101c161029f3660046114df565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6101c16102d53660046114df565b60056020526000908152604090205481565b610184610680565b61028f6102fd366004611479565b61068f565b6103297f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610191565b6101ad61035c366004611479565b61075e565b6101ad61036f366004611479565b61082f565b6101c17f000000000000000000000000000000000000000000000000000000000000000081565b61028f6103a9366004611501565b61083d565b6101c16103bc366004611574565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6101846040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525081565b60606003805461043f906115a7565b80601f016020809104026020016040519081016040528092919081815260200182805461046b906115a7565b80156104b85780601f1061048d576101008083540402835291602001916104b8565b820191906000526020600020905b81548152906001019060200180831161049b57829003601f168201915b5050505050905090565b6000336104d0818585610b73565b60019150505b92915050565b6000336104ea858285610d27565b6104f5858585610dfe565b506001949350505050565b60007f00000000000000000000000000000000000000000000000000000000000000004614610537576105324661106d565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091906104d090829086906105a3908790611629565b610b73565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610672576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d4272696467650000000000000000000000000000000060648201526084015b60405180910390fd5b61067c8282611135565b5050565b60606004805461043f906115a7565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610754576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d427269646765000000000000000000000000000000006064820152608401610669565b61067c8282611228565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015610822576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610669565b6104f58286868403610b73565b6000336104d0818585610dfe565b834211156108cc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f546f6b656e577261707065643a3a7065726d69743a204578706972656420706560448201527f726d6974000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8716600090815260056020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918a918a918a9190866109268361163c565b9091555060408051602081019690965273ffffffffffffffffffffffffffffffffffffffff94851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000610991610500565b6040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281019190915260428101839052606201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa158015610a55573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590610ad057508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b610b5c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f546f6b656e577261707065643a3a7065726d69743a20496e76616c696420736960448201527f676e6174757265000000000000000000000000000000000000000000000000006064820152608401610669565b610b678a8a8a610b73565b50505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff8316610c15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610cb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610df85781811015610deb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610669565b610df88484848403610b73565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610ea1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610f44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610ffa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610df8565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f611098610430565b8051602091820120604080518082018252600181527f310000000000000000000000000000000000000000000000000000000000000090840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b73ffffffffffffffffffffffffffffffffffffffff82166111b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610669565b80600260008282546111c49190611629565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff82166112cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205481811015611381576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610d1a565b600060208083528351808285015260005b81811015611411578581018301518582016040015282016113f5565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461147457600080fd5b919050565b6000806040838503121561148c57600080fd5b61149583611450565b946020939093013593505050565b6000806000606084860312156114b857600080fd5b6114c184611450565b92506114cf60208501611450565b9150604084013590509250925092565b6000602082840312156114f157600080fd5b6114fa82611450565b9392505050565b600080600080600080600060e0888a03121561151c57600080fd5b61152588611450565b965061153360208901611450565b95506040880135945060608801359350608088013560ff8116811461155757600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561158757600080fd5b61159083611450565b915061159e60208401611450565b90509250929050565b600181811c908216806115bb57607f821691505b6020821081036115f4577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156104d6576104d66115fa565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361166d5761166d6115fa565b506001019056fea26469706673582212208d88fee561cff7120d381c345cfc534cef8229a272dc5809d4bbb685ad67141164736f6c63430008110033a2646970667358221220914f18d5b241f0d10b2ebc814aadeee338ad60bad704683e414dad415cb2e14d64736f6c63430008140033" - }, - { - "contractName": "PolygonZkEVMBridge proxy", - "balance": "340282366920938463463374607431768211455", - "nonce": "1", - "address": "0xB7098a13a48EcE087d3DA15b2D28eCE0f89819B8", - "bytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461086f565b610135565b61006b6100a336600461088a565b61017f565b3480156100b457600080fd5b506100bd6101f3565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461086f565b610231565b34801561011257600080fd5b506100bd61025e565b61012361028c565b61013361012e610363565b61036d565b565b61013d610391565b73ffffffffffffffffffffffffffffffffffffffff16330361017757610174816040518060200160405280600081525060006103d1565b50565b61017461011b565b610187610391565b73ffffffffffffffffffffffffffffffffffffffff1633036101eb576101e68383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506103d1915050565b505050565b6101e661011b565b60006101fd610391565b73ffffffffffffffffffffffffffffffffffffffff16330361022657610221610363565b905090565b61022e61011b565b90565b610239610391565b73ffffffffffffffffffffffffffffffffffffffff16330361017757610174816103fc565b6000610268610391565b73ffffffffffffffffffffffffffffffffffffffff16330361022657610221610391565b610294610391565b73ffffffffffffffffffffffffffffffffffffffff163303610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b600061022161045d565b3660008037600080366000845af43d6000803e80801561038c573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6103da83610485565b6000825111806103e75750805b156101e6576103f683836104d2565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f610425610391565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a1610174816104fe565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6103b5565b61048e8161060a565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606104f7838360405180606001604052806027815260200161099f602791396106d5565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff81166105a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161035a565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b73ffffffffffffffffffffffffffffffffffffffff81163b6106ae576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161035a565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6105c4565b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516106ff9190610931565b600060405180830381855af49150503d806000811461073a576040519150601f19603f3d011682016040523d82523d6000602084013e61073f565b606091505b50915091506107508683838761075a565b9695505050505050565b606083156107f05782516000036107e95773ffffffffffffffffffffffffffffffffffffffff85163b6107e9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161035a565b50816107fa565b6107fa8383610802565b949350505050565b8151156108125781518083602001fd5b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161035a919061094d565b803573ffffffffffffffffffffffffffffffffffffffff8116811461086a57600080fd5b919050565b60006020828403121561088157600080fd5b6104f782610846565b60008060006040848603121561089f57600080fd5b6108a884610846565b9250602084013567ffffffffffffffff808211156108c557600080fd5b818601915086601f8301126108d957600080fd5b8135818111156108e857600080fd5b8760208285010111156108fa57600080fd5b6020830194508093505050509250925092565b60005b83811015610928578181015183820152602001610910565b50506000910152565b6000825161094381846020870161090d565b9190910192915050565b602081526000825180602084015261096c81604085016020870161090d565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220701a0c26bdd76686e63fc3c65e4f28a20ba3ecc8a60246733c0627e679c9804e64736f6c63430008140033", - "storage": { - "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x000000000000000000000000e34fe58dda5b8c6d547e4857e987633aa86a5e90", - "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x000000000000000000000000493732fb136a380920c390a85fc27d79c7b70756" - } - }, - { - "contractName": "PolygonZkEVMGlobalExitRootL2 implementation", - "balance": "0", - "nonce": "1", - "address": "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9", - "bytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806301fd904414610051578063257b36321461006d57806333d6247d1461008d578063a3c573eb146100a2575b600080fd5b61005a60015481565b6040519081526020015b60405180910390f35b61005a61007b366004610162565b60006020819052908152604090205481565b6100a061009b366004610162565b6100ee565b005b6100c97f000000000000000000000000b7098a13a48ece087d3da15b2d28ece0f89819b881565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610064565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000b7098a13a48ece087d3da15b2d28ece0f89819b8161461015d576040517fb49365dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600155565b60006020828403121561017457600080fd5b503591905056fea2646970667358221220ea2171e2c85c8bff947affc409ef6fc6a8fe82fb8c174ddeda988651e595d66564736f6c63430008140033" - }, - { - "contractName": "PolygonZkEVMGlobalExitRootL2 proxy", - "balance": "0", - "nonce": "1", - "address": "0xa40d5f56745a118d0906a34e69aec8c0db1cb8fa", - "bytecode": "0x60806040523661001357610011610017565b005b6100115b61001f6101b7565b6001600160a01b0316336001600160a01b0316141561016f5760606001600160e01b031960003516631b2ce7f360e11b8114156100655761005e6101ea565b9150610167565b6001600160e01b0319811663278f794360e11b14156100865761005e610241565b6001600160e01b031981166308f2839760e41b14156100a75761005e610287565b6001600160e01b031981166303e1469160e61b14156100c85761005e6102b8565b6001600160e01b03198116635c60da1b60e01b14156100e95761005e6102f8565b60405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b815160208301f35b61017761030c565b565b606061019e83836040518060600160405280602781526020016108576027913961031c565b9392505050565b90565b6001600160a01b03163b151590565b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b60606101f4610394565b600061020336600481846106a2565b81019061021091906106e8565b905061022d8160405180602001604052806000815250600061039f565b505060408051602081019091526000815290565b606060008061025336600481846106a2565b8101906102609190610719565b915091506102708282600161039f565b604051806020016040528060008152509250505090565b6060610291610394565b60006102a036600481846106a2565b8101906102ad91906106e8565b905061022d816103cb565b60606102c2610394565b60006102cc6101b7565b604080516001600160a01b03831660208201529192500160405160208183030381529060405291505090565b6060610302610394565b60006102cc610422565b610177610317610422565b610431565b6060600080856001600160a01b0316856040516103399190610807565b600060405180830381855af49150503d8060008114610374576040519150601f19603f3d011682016040523d82523d6000602084013e610379565b606091505b509150915061038a86838387610455565b9695505050505050565b341561017757600080fd5b6103a8836104d3565b6000825111806103b55750805b156103c6576103c48383610179565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6103f46101b7565b604080516001600160a01b03928316815291841660208301520160405180910390a161041f81610513565b50565b600061042c6105bc565b905090565b3660008037600080366000845af43d6000803e808015610450573d6000f35b3d6000fd5b606083156104c15782516104ba576001600160a01b0385163b6104ba5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161015e565b50816104cb565b6104cb83836105e4565b949350505050565b6104dc8161060e565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6001600160a01b0381166105785760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b606482015260840161015e565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80546001600160a01b0319166001600160a01b039290921691909117905550565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6101db565b8151156105f45781518083602001fd5b8060405162461bcd60e51b815260040161015e9190610823565b6001600160a01b0381163b61067b5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161015e565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc61059b565b600080858511156106b257600080fd5b838611156106bf57600080fd5b5050820193919092039150565b80356001600160a01b03811681146106e357600080fd5b919050565b6000602082840312156106fa57600080fd5b61019e826106cc565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561072c57600080fd5b610735836106cc565b9150602083013567ffffffffffffffff8082111561075257600080fd5b818501915085601f83011261076657600080fd5b81358181111561077857610778610703565b604051601f8201601f19908116603f011681019083821181831017156107a0576107a0610703565b816040528281528860208487010111156107b957600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b838110156107f65781810151838201526020016107de565b838111156103c45750506000910152565b600082516108198184602087016107db565b9190910192915050565b60208152600082518060208401526108428160408501602087016107db565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122012bb4f564f73959a03513dc74fc3c6e40e8386e6f02c16b78d6db00ce0aa16af64736f6c63430008090033", - "storage": { - "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x000000000000000000000000e34fe58dda5b8c6d547e4857e987633aa86a5e90", - "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x000000000000000000000000dc64a140aa3e981100a9beca4e685f962f0cf6c9" - } - }, - { - "contractName": "PolygonZkEVMTimelock", - "balance": "0", - "nonce": "1", - "address": "0x0165878A594ca255338adfa4d48449f69242Eb8F", - "bytecode": "0x6080604052600436106101c65760003560e01c806364d62353116100f7578063b1c5f42711610095578063d547741f11610064578063d547741f14610661578063e38335e514610681578063f23a6e6114610694578063f27a0c92146106d957600080fd5b8063b1c5f427146105af578063bc197c81146105cf578063c4d252f514610614578063d45c44351461063457600080fd5b80638f61f4f5116100d15780638f61f4f5146104e157806391d1485414610515578063a217fddf14610566578063b08e51c01461057b57600080fd5b806364d62353146104815780638065657f146104a15780638f2a0bb0146104c157600080fd5b8063248a9ca31161016457806331d507501161013e57806331d50750146103c857806336568abe146103e85780633a6aae7214610408578063584b153e1461046157600080fd5b8063248a9ca3146103475780632ab0f529146103775780632f2ff15d146103a857600080fd5b80630d3cf6fc116101a05780630d3cf6fc1461026b578063134008d31461029f57806313bc9f20146102b2578063150b7a02146102d257600080fd5b806301d5062a146101d257806301ffc9a7146101f457806307bd02651461022957600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506101f26101ed366004611c52565b6106ee565b005b34801561020057600080fd5b5061021461020f366004611cc7565b610783565b60405190151581526020015b60405180910390f35b34801561023557600080fd5b5061025d7fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e6381565b604051908152602001610220565b34801561027757600080fd5b5061025d7f5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca581565b6101f26102ad366004611d09565b6107df565b3480156102be57600080fd5b506102146102cd366004611d75565b6108d7565b3480156102de57600080fd5b506103166102ed366004611e9a565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610220565b34801561035357600080fd5b5061025d610362366004611d75565b60009081526020819052604090206001015490565b34801561038357600080fd5b50610214610392366004611d75565b6000908152600160208190526040909120541490565b3480156103b457600080fd5b506101f26103c3366004611f02565b6108fd565b3480156103d457600080fd5b506102146103e3366004611d75565b610927565b3480156103f457600080fd5b506101f2610403366004611f02565b610940565b34801561041457600080fd5b5061043c7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610220565b34801561046d57600080fd5b5061021461047c366004611d75565b6109f8565b34801561048d57600080fd5b506101f261049c366004611d75565b610a0e565b3480156104ad57600080fd5b5061025d6104bc366004611d09565b610ade565b3480156104cd57600080fd5b506101f26104dc366004611f73565b610b1d565b3480156104ed57600080fd5b5061025d7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc181565b34801561052157600080fd5b50610214610530366004611f02565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b34801561057257600080fd5b5061025d600081565b34801561058757600080fd5b5061025d7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f78381565b3480156105bb57600080fd5b5061025d6105ca366004612025565b610d4f565b3480156105db57600080fd5b506103166105ea36600461214e565b7fbc197c810000000000000000000000000000000000000000000000000000000095945050505050565b34801561062057600080fd5b506101f261062f366004611d75565b610d94565b34801561064057600080fd5b5061025d61064f366004611d75565b60009081526001602052604090205490565b34801561066d57600080fd5b506101f261067c366004611f02565b610e8f565b6101f261068f366004612025565b610eb4565b3480156106a057600080fd5b506103166106af3660046121f8565b7ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b3480156106e557600080fd5b5061025d611161565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc161071881611244565b6000610728898989898989610ade565b90506107348184611251565b6000817f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8b8b8b8b8b8a604051610770969594939291906122a6565b60405180910390a3505050505050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f4e2312e00000000000000000000000000000000000000000000000000000000014806107d957506107d98261139e565b92915050565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff1661085c5761085c8133611435565b600061086c888888888888610ade565b905061087881856114ed565b6108848888888861162a565b6000817fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588a8a8a8a6040516108bc94939291906122f1565b60405180910390a36108cd8161172e565b5050505050505050565b6000818152600160205260408120546001811180156108f65750428111155b9392505050565b60008281526020819052604090206001015461091881611244565b61092283836117d7565b505050565b60008181526001602052604081205481905b1192915050565b73ffffffffffffffffffffffffffffffffffffffff811633146109ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6109f482826118c7565b5050565b6000818152600160208190526040822054610939565b333014610a9d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f54696d656c6f636b436f6e74726f6c6c65723a2063616c6c6572206d7573742060448201527f62652074696d656c6f636b00000000000000000000000000000000000000000060648201526084016109e1565b60025460408051918252602082018390527f11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d5910160405180910390a1600255565b6000868686868686604051602001610afb969594939291906122a6565b6040516020818303038152906040528051906020012090509695505050505050565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1610b4781611244565b888714610bd6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b888514610c65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b6000610c778b8b8b8b8b8b8b8b610d4f565b9050610c838184611251565b60005b8a811015610d415780827f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8e8e85818110610cc357610cc3612331565b9050602002016020810190610cd89190612360565b8d8d86818110610cea57610cea612331565b905060200201358c8c87818110610d0357610d03612331565b9050602002810190610d15919061237b565b8c8b604051610d29969594939291906122a6565b60405180910390a3610d3a8161240f565b9050610c86565b505050505050505050505050565b60008888888888888888604051602001610d709897969594939291906124f7565b60405160208183030381529060405280519060200120905098975050505050505050565b7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f783610dbe81611244565b610dc7826109f8565b610e53576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20636160448201527f6e6e6f742062652063616e63656c6c656400000000000000000000000000000060648201526084016109e1565b6000828152600160205260408082208290555183917fbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb7091a25050565b600082815260208190526040902060010154610eaa81611244565b61092283836118c7565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff16610f3157610f318133611435565b878614610fc0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b87841461104f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b60006110618a8a8a8a8a8a8a8a610d4f565b905061106d81856114ed565b60005b8981101561114b5760008b8b8381811061108c5761108c612331565b90506020020160208101906110a19190612360565b905060008a8a848181106110b7576110b7612331565b9050602002013590503660008a8a868181106110d5576110d5612331565b90506020028101906110e7919061237b565b915091506110f78484848461162a565b84867fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588686868660405161112e94939291906122f1565b60405180910390a350505050806111449061240f565b9050611070565b506111558161172e565b50505050505050505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff161580159061123257507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166315064c966040518163ffffffff1660e01b8152600401602060405180830381865afa15801561120e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123291906125be565b1561123d5750600090565b5060025490565b61124e8133611435565b50565b61125a82610927565b156112e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20616c60448201527f7265616479207363686564756c6564000000000000000000000000000000000060648201526084016109e1565b6112ef611161565b81101561137e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a20696e73756666696369656e7460448201527f2064656c6179000000000000000000000000000000000000000000000000000060648201526084016109e1565b61138881426125e0565b6000928352600160205260409092209190915550565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806107d957507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146107d9565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f4576114738161197e565b61147e83602061199d565b60405160200161148f929190612617565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526109e191600401612698565b6114f6826108d7565b611582576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b80158061159e5750600081815260016020819052604090912054145b6109f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a206d697373696e67206465706560448201527f6e64656e6379000000000000000000000000000000000000000000000000000060648201526084016109e1565b60008473ffffffffffffffffffffffffffffffffffffffff168484846040516116549291906126e9565b60006040518083038185875af1925050503d8060008114611691576040519150601f19603f3d011682016040523d82523d6000602084013e611696565b606091505b5050905080611727576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f54696d656c6f636b436f6e74726f6c6c65723a20756e6465726c79696e67207460448201527f72616e73616374696f6e2072657665727465640000000000000000000000000060648201526084016109e1565b5050505050565b611737816108d7565b6117c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b600090815260016020819052604090912055565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556118693390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60606107d973ffffffffffffffffffffffffffffffffffffffff831660145b606060006119ac8360026126f9565b6119b79060026125e0565b67ffffffffffffffff8111156119cf576119cf611d8e565b6040519080825280601f01601f1916602001820160405280156119f9576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611a3057611a30612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611a9357611a93612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000611acf8460026126f9565b611ada9060016125e0565b90505b6001811115611b77577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611b1b57611b1b612331565b1a60f81b828281518110611b3157611b31612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611b7081612710565b9050611add565b5083156108f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109e1565b803573ffffffffffffffffffffffffffffffffffffffff81168114611c0457600080fd5b919050565b60008083601f840112611c1b57600080fd5b50813567ffffffffffffffff811115611c3357600080fd5b602083019150836020828501011115611c4b57600080fd5b9250929050565b600080600080600080600060c0888a031215611c6d57600080fd5b611c7688611be0565b965060208801359550604088013567ffffffffffffffff811115611c9957600080fd5b611ca58a828b01611c09565b989b979a50986060810135976080820135975060a09091013595509350505050565b600060208284031215611cd957600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146108f657600080fd5b60008060008060008060a08789031215611d2257600080fd5b611d2b87611be0565b955060208701359450604087013567ffffffffffffffff811115611d4e57600080fd5b611d5a89828a01611c09565b979a9699509760608101359660809091013595509350505050565b600060208284031215611d8757600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611e0457611e04611d8e565b604052919050565b600082601f830112611e1d57600080fd5b813567ffffffffffffffff811115611e3757611e37611d8e565b611e6860207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601611dbd565b818152846020838601011115611e7d57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215611eb057600080fd5b611eb985611be0565b9350611ec760208601611be0565b925060408501359150606085013567ffffffffffffffff811115611eea57600080fd5b611ef687828801611e0c565b91505092959194509250565b60008060408385031215611f1557600080fd5b82359150611f2560208401611be0565b90509250929050565b60008083601f840112611f4057600080fd5b50813567ffffffffffffffff811115611f5857600080fd5b6020830191508360208260051b8501011115611c4b57600080fd5b600080600080600080600080600060c08a8c031215611f9157600080fd5b893567ffffffffffffffff80821115611fa957600080fd5b611fb58d838e01611f2e565b909b50995060208c0135915080821115611fce57600080fd5b611fda8d838e01611f2e565b909950975060408c0135915080821115611ff357600080fd5b506120008c828d01611f2e565b9a9d999c50979a969997986060880135976080810135975060a0013595509350505050565b60008060008060008060008060a0898b03121561204157600080fd5b883567ffffffffffffffff8082111561205957600080fd5b6120658c838d01611f2e565b909a50985060208b013591508082111561207e57600080fd5b61208a8c838d01611f2e565b909850965060408b01359150808211156120a357600080fd5b506120b08b828c01611f2e565b999c989b509699959896976060870135966080013595509350505050565b600082601f8301126120df57600080fd5b8135602067ffffffffffffffff8211156120fb576120fb611d8e565b8160051b61210a828201611dbd565b928352848101820192828101908785111561212457600080fd5b83870192505b848310156121435782358252918301919083019061212a565b979650505050505050565b600080600080600060a0868803121561216657600080fd5b61216f86611be0565b945061217d60208701611be0565b9350604086013567ffffffffffffffff8082111561219a57600080fd5b6121a689838a016120ce565b945060608801359150808211156121bc57600080fd5b6121c889838a016120ce565b935060808801359150808211156121de57600080fd5b506121eb88828901611e0c565b9150509295509295909350565b600080600080600060a0868803121561221057600080fd5b61221986611be0565b945061222760208701611be0565b93506040860135925060608601359150608086013567ffffffffffffffff81111561225157600080fd5b6121eb88828901611e0c565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b73ffffffffffffffffffffffffffffffffffffffff8716815285602082015260a0604082015260006122dc60a08301868861225d565b60608301949094525060800152949350505050565b73ffffffffffffffffffffffffffffffffffffffff8516815283602082015260606040820152600061232760608301848661225d565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561237257600080fd5b6108f682611be0565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126123b057600080fd5b83018035915067ffffffffffffffff8211156123cb57600080fd5b602001915036819003821315611c4b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612440576124406123e0565b5060010190565b81835260006020808501808196508560051b810191508460005b878110156124ea57828403895281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18836030181126124a057600080fd5b8701858101903567ffffffffffffffff8111156124bc57600080fd5b8036038213156124cb57600080fd5b6124d686828461225d565b9a87019a9550505090840190600101612461565b5091979650505050505050565b60a0808252810188905260008960c08301825b8b8110156125455773ffffffffffffffffffffffffffffffffffffffff61253084611be0565b1682526020928301929091019060010161250a565b5083810360208501528881527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff89111561257e57600080fd5b8860051b9150818a602083013701828103602090810160408501526125a69082018789612447565b60608401959095525050608001529695505050505050565b6000602082840312156125d057600080fd5b815180151581146108f657600080fd5b808201808211156107d9576107d96123e0565b60005b8381101561260e5781810151838201526020016125f6565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161264f8160178501602088016125f3565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161268c8160288401602088016125f3565b01602801949350505050565b60208152600082518060208401526126b78160408501602087016125f3565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b8183823760009101908152919050565b80820281158282048414176107d9576107d96123e0565b60008161271f5761271f6123e0565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea2646970667358221220c474c39da3523b28ebfa5fd66c05b42d6ddcc4a57055483bdda32888b366016164736f6c63430008140033", - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000000000000000000e10", - "0xaedcc9e7897c0d335bdc5d92fe3a8b4f23727fe558cd1c19f332b28716a30559": "0x0000000000000000000000000000000000000000000000000000000000000001", - "0xf5e61edb9c9cc6bfbae4463e9a2b1dd6ac3b44ddef38f18016e56ba0363910d9": "0x0000000000000000000000000000000000000000000000000000000000000001", - "0x64494413541ff93b31aa309254e3fed72a7456e9845988b915b4c7a7ceba8814": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", - "0x60b9d94c75b7b3f721925089391e4644cd890cb5e6466f9596dfbd2c54e0b280": "0x0000000000000000000000000000000000000000000000000000000000000001", - "0x3412d5605ac6cd444957cedb533e5dacad6378b4bc819ebe3652188a665066d6": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", - "0x4b63b79f1e338a49559dcd3193ac9eecc50d0f275d24e97cc8c319e5a31a8bd0": "0x0000000000000000000000000000000000000000000000000000000000000001", - "0xdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d706a": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", - "0x800d5dfe4bba53eedee06cd4546a27da8de00f12db83f56062976d4493fda899": "0x0000000000000000000000000000000000000000000000000000000000000001", - "0xc3ad33e20b0c56a223ad5104fff154aa010f8715b9c981fd38fdc60a4d1a52fc": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5" - } - }, - { - "accountName": "keyless Deployer", - "balance": "0", - "nonce": "1", - "address": "0x28BB4e66addE1f042B77E04cf7D3784C1dcDBbA3" - }, - { - "accountName": "deployer", - "balance": "100000000000000000000000", - "nonce": "8", - "address": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" - } - ] -} \ No newline at end of file + { + "contractName": "PolygonZkEVMDeployer", + "balance": "0", + "nonce": "4", + "address": "0x51dbd54FCCb6b3A07738fd3E156D588e71f79973", + "bytecode": "0x6080604052600436106100705760003560e01c8063715018a61161004e578063715018a6146100e65780638da5cb5b146100fb578063e11ae6cb14610126578063f2fde38b1461013957600080fd5b80632b79805a146100755780634a94d4871461008a5780636d07dbf81461009d575b600080fd5b610088610083366004610927565b610159565b005b6100886100983660046109c7565b6101cb565b3480156100a957600080fd5b506100bd6100b8366004610a1e565b61020d565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b50610088610220565b34801561010757600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100bd565b610088610134366004610a40565b610234565b34801561014557600080fd5b50610088610154366004610a90565b61029b565b610161610357565b600061016e8585856103d8565b905061017a8183610537565b5060405173ffffffffffffffffffffffffffffffffffffffff821681527fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a15050505050565b6101d3610357565b6101de83838361057b565b506040517f25adb19089b6a549831a273acdf7908cff8b7ee5f551f8d1d37996cf01c5df5b90600090a1505050565b600061021983836105a9565b9392505050565b610228610357565b61023260006105b6565b565b61023c610357565b60006102498484846103d8565b60405173ffffffffffffffffffffffffffffffffffffffff821681529091507fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a150505050565b6102a3610357565b73ffffffffffffffffffffffffffffffffffffffff811661034b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610354816105b6565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610232576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610342565b600083471015610444576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e63650000006044820152606401610342565b81516000036104af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f6044820152606401610342565b8282516020840186f5905073ffffffffffffffffffffffffffffffffffffffff8116610219576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f79000000000000006044820152606401610342565b6060610219838360006040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c6564000081525061062b565b60606105a1848484604051806060016040528060298152602001610b3d6029913961062b565b949350505050565b6000610219838330610744565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060824710156106bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610342565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516106e69190610acf565b60006040518083038185875af1925050503d8060008114610723576040519150601f19603f3d011682016040523d82523d6000602084013e610728565b606091505b50915091506107398783838761076e565b979650505050505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b606083156108045782516000036107fd5773ffffffffffffffffffffffffffffffffffffffff85163b6107fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610342565b50816105a1565b6105a183838151156108195781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103429190610aeb565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f83011261088d57600080fd5b813567ffffffffffffffff808211156108a8576108a861084d565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156108ee576108ee61084d565b8160405283815286602085880101111561090757600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000806080858703121561093d57600080fd5b8435935060208501359250604085013567ffffffffffffffff8082111561096357600080fd5b61096f8883890161087c565b9350606087013591508082111561098557600080fd5b506109928782880161087c565b91505092959194509250565b803573ffffffffffffffffffffffffffffffffffffffff811681146109c257600080fd5b919050565b6000806000606084860312156109dc57600080fd5b6109e58461099e565b9250602084013567ffffffffffffffff811115610a0157600080fd5b610a0d8682870161087c565b925050604084013590509250925092565b60008060408385031215610a3157600080fd5b50508035926020909101359150565b600080600060608486031215610a5557600080fd5b8335925060208401359150604084013567ffffffffffffffff811115610a7a57600080fd5b610a868682870161087c565b9150509250925092565b600060208284031215610aa257600080fd5b6102198261099e565b60005b83811015610ac6578181015183820152602001610aae565b50506000910152565b60008251610ae1818460208701610aab565b9190910192915050565b6020815260008251806020840152610b0a816040850160208701610aab565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a2646970667358221220964619cee0e0baf94c6f8763f013be157da5d54c89e5cff4a8caf4266e13f13a64736f6c63430008140033", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266" + } + }, + { + "contractName": "ProxyAdmin", + "balance": "0", + "nonce": "1", + "address": "0xe34Fe58DDa5b8c6D547E4857E987633aa86a5e90", + "bytecode": "0x60806040526004361061007b5760003560e01c80639623609d1161004e5780639623609d1461012b57806399a88ec41461013e578063f2fde38b1461015e578063f3b7dead1461017e57600080fd5b8063204e1c7a14610080578063715018a6146100c95780637eff275e146100e05780638da5cb5b14610100575b600080fd5b34801561008c57600080fd5b506100a061009b366004610608565b61019e565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100d557600080fd5b506100de610255565b005b3480156100ec57600080fd5b506100de6100fb36600461062c565b610269565b34801561010c57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100a0565b6100de610139366004610694565b6102f7565b34801561014a57600080fd5b506100de61015936600461062c565b61038c565b34801561016a57600080fd5b506100de610179366004610608565b6103e8565b34801561018a57600080fd5b506100a0610199366004610608565b6104a4565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907f5c60da1b00000000000000000000000000000000000000000000000000000000815260040190565b600060405180830381855afa9150503d8060008114610225576040519150601f19603f3d011682016040523d82523d6000602084013e61022a565b606091505b50915091508161023957600080fd5b8080602001905181019061024d9190610788565b949350505050565b61025d6104f0565b6102676000610571565b565b6102716104f0565b6040517f8f28397000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690638f283970906024015b600060405180830381600087803b1580156102db57600080fd5b505af11580156102ef573d6000803e3d6000fd5b505050505050565b6102ff6104f0565b6040517f4f1ef28600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690634f1ef28690349061035590869086906004016107a5565b6000604051808303818588803b15801561036e57600080fd5b505af1158015610382573d6000803e3d6000fd5b5050505050505050565b6103946104f0565b6040517f3659cfe600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690633659cfe6906024016102c1565b6103f06104f0565b73ffffffffffffffffffffffffffffffffffffffff8116610498576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6104a181610571565b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907ff851a44000000000000000000000000000000000000000000000000000000000815260040190565b60005473ffffffffffffffffffffffffffffffffffffffff163314610267576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161048f565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b73ffffffffffffffffffffffffffffffffffffffff811681146104a157600080fd5b60006020828403121561061a57600080fd5b8135610625816105e6565b9392505050565b6000806040838503121561063f57600080fd5b823561064a816105e6565b9150602083013561065a816105e6565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000606084860312156106a957600080fd5b83356106b4816105e6565b925060208401356106c4816105e6565b9150604084013567ffffffffffffffff808211156106e157600080fd5b818601915086601f8301126106f557600080fd5b81358181111561070757610707610665565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561074d5761074d610665565b8160405282815289602084870101111561076657600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b60006020828403121561079a57600080fd5b8151610625816105e6565b73ffffffffffffffffffffffffffffffffffffffff8316815260006020604081840152835180604085015260005b818110156107ef578581018301518582016060015282016107d3565b5060006060828601015260607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010192505050939250505056fea2646970667358221220c9867ffac53151bdb1305d8f5e3e883cd83e5270c7ec09cdc24e837b2e65239064736f6c63430008140033", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000000165878a594ca255338adfa4d48449f69242eb8f" + } + }, + { + "contractName": "PolygonZkEVMBridge implementation", + "balance": "0", + "nonce": "1", + "address": "0x493732fB136a380920C390a85fc27d79C7b70756", + "bytecode": "0x6080604052600436106101a35760003560e01c806383f24403116100e2578063ccaa2d1111610085578063ccaa2d1114610511578063cd58657914610531578063d02103ca14610544578063dbc169761461056b578063ee25560b14610580578063f5efcd79146105ad578063f811bff7146105cd578063fb570834146105ed57600080fd5b806383f244031461040b5780638ed7e3f21461042b578063aaa13cc21461044b578063b8b284d01461046b578063bab161bf1461048b578063be5831c7146104ad578063c00f14ab146104d1578063cc461632146104f157600080fd5b80633cbc795b1161014a5780633cbc795b146102fd5780633e197043146103365780634b2f336d146103565780635ca1e165146103765780637843298b1461038b57806379e2cf97146103ab57806381b1c174146103c057806383c43a55146103f657600080fd5b806315064c96146101a85780632072f6c5146101d757806322e95f2c146101ee578063240ff3781461021b57806327aef4e81461022e5780632dfdf0b514610250578063318aee3d146102745780633c351e10146102dd575b600080fd5b3480156101b457600080fd5b506068546101c29060ff1681565b60405190151581526020015b60405180910390f35b3480156101e357600080fd5b506101ec61060d565b005b3480156101fa57600080fd5b5061020e610209366004612b65565b610642565b6040516101ce9190612b9c565b6101ec610229366004612c06565b610693565b34801561023a57600080fd5b50610243610703565b6040516101ce9190612ccf565b34801561025c57600080fd5b5061026660535481565b6040519081526020016101ce565b34801561028057600080fd5b506102b961028f366004612ce9565b606b6020526000908152604090205463ffffffff811690600160201b90046001600160a01b031682565b6040805163ffffffff90931683526001600160a01b039091166020830152016101ce565b3480156102e957600080fd5b50606d5461020e906001600160a01b031681565b34801561030957600080fd5b50606d5461032190600160a01b900463ffffffff1681565b60405163ffffffff90911681526020016101ce565b34801561034257600080fd5b50610266610351366004612d15565b610791565b34801561036257600080fd5b50606f5461020e906001600160a01b031681565b34801561038257600080fd5b5061026661081e565b34801561039757600080fd5b5061020e6103a6366004612d94565b6108fb565b3480156103b757600080fd5b506101ec610925565b3480156103cc57600080fd5b5061020e6103db366004612ddd565b606a602052600090815260409020546001600160a01b031681565b34801561040257600080fd5b50610243610946565b34801561041757600080fd5b50610266610426366004612e08565b610965565b34801561043757600080fd5b50606c5461020e906001600160a01b031681565b34801561045757600080fd5b5061020e610466366004612f12565b610a3b565b34801561047757600080fd5b506101ec610486366004612fad565b610b3d565b34801561049757600080fd5b5060685461032190610100900463ffffffff1681565b3480156104b957600080fd5b5060685461032190600160c81b900463ffffffff1681565b3480156104dd57600080fd5b506102436104ec366004612ce9565b610c04565b3480156104fd57600080fd5b506101c261050c36600461302f565b610c49565b34801561051d57600080fd5b506101ec61052c366004613062565b610cd2565b6101ec61053f36600461314d565b6111c7565b34801561055057600080fd5b5060685461020e90600160281b90046001600160a01b031681565b34801561057757600080fd5b506101ec611621565b34801561058c57600080fd5b5061026661059b366004612ddd565b60696020526000908152604090205481565b3480156105b957600080fd5b506101ec6105c8366004613062565b611654565b3480156105d957600080fd5b506101ec6105e83660046131e2565b6118ef565b3480156105f957600080fd5b506101c261060836600461328a565b611b62565b606c546001600160a01b0316331461063857604051631736745960e31b815260040160405180910390fd5b610640611b7a565b565b6000606a6000848460405160200161065b9291906132d2565b60408051601f19818403018152918152815160209283012083529082019290925201600020546001600160a01b031690505b92915050565b60685460ff16156106b757604051630bc011ff60e21b815260040160405180910390fd5b34158015906106d05750606f546001600160a01b031615155b156106ee576040516301bd897160e61b815260040160405180910390fd5b6106fc858534868686611bd6565b5050505050565b606e8054610710906132fc565b80601f016020809104026020016040519081016040528092919081815260200182805461073c906132fc565b80156107895780601f1061075e57610100808354040283529160200191610789565b820191906000526020600020905b81548152906001019060200180831161076c57829003601f168201915b505050505081565b6040516001600160f81b031960f889901b1660208201526001600160e01b031960e088811b821660218401526001600160601b0319606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b605354600090819081805b60208110156108f2578083901c600116600103610886576033816020811061085357610853613336565b015460408051602081019290925281018590526060016040516020818303038152906040528051906020012093506108b3565b60408051602081018690529081018390526060016040516020818303038152906040528051906020012093505b604080516020810184905290810183905260600160405160208183030381529060405280519060200120915080806108ea90613362565b915050610829565b50919392505050565b600061091d848461090b85611ca0565b61091486611d5f565b61046687611e17565b949350505050565b605354606854600160c81b900463ffffffff16101561064057610640611ecf565b60405180611ba00160405280611b668152602001613a7a611b66913981565b600083815b6020811015610a3257600163ffffffff8516821c811690036109d55784816020811061099857610998613336565b6020020135826040516020016109b8929190918252602082015260400190565b604051602081830303815290604052805190602001209150610a20565b818582602081106109e8576109e8613336565b6020020135604051602001610a07929190918252602082015260400190565b6040516020818303038152906040528051906020012091505b80610a2a81613362565b91505061096a565b50949350505050565b6000808686604051602001610a519291906132d2565b604051602081830303815290604052805190602001209050600060ff60f81b308360405180611ba00160405280611b668152602001613a7a611b669139898989604051602001610aa39392919061337b565b60408051601f1981840301815290829052610ac192916020016133b4565b60405160208183030381529060405280519060200120604051602001610b1994939291906001600160f81b031994909416845260609290921b6001600160601b03191660018401526015830152603582015260550190565b60408051808303601f19018152919052805160209091012098975050505050505050565b60685460ff1615610b6157604051630bc011ff60e21b815260040160405180910390fd5b606f546001600160a01b0316610b8a5760405163dde3cda760e01b815260040160405180910390fd5b606f54604051632770a7eb60e21b81526001600160a01b0390911690639dc29fac90610bbc90339088906004016133e3565b600060405180830381600087803b158015610bd657600080fd5b505af1158015610bea573d6000803e3d6000fd5b50505050610bfc868686868686611bd6565b505050505050565b6060610c0f82611ca0565b610c1883611d5f565b610c2184611e17565b604051602001610c339392919061337b565b6040516020818303038152906040529050919050565b6068546000908190610100900463ffffffff16158015610c6f575063ffffffff83166001145b15610c81575063ffffffff8316610ca8565b610c95600160201b63ffffffff85166133fc565b610ca59063ffffffff8616613413565b90505b600881901c600090815260696020526040902054600160ff9092169190911b908116149392505050565b60685460ff1615610cf657604051630bc011ff60e21b815260040160405180910390fd5b60685463ffffffff8681166101009092041614610d26576040516302caf51760e11b815260040160405180910390fd5b610d5a8c8c8c8c8c610d5560008e8e8e8e8e8e8e604051610d48929190613426565b6040518091039020610791565b611f68565b6001600160a01b038616610e9257606f546001600160a01b0316610e295760006001600160a01b03851684825b6040519080825280601f01601f191660200182016040528015610db1576020820181803683370190505b50604051610dbf9190613436565b60006040518083038185875af1925050503d8060008114610dfc576040519150601f19603f3d011682016040523d82523d6000602084013e610e01565b606091505b5050905080610e2357604051630ce8f45160e31b815260040160405180910390fd5b5061117a565b606f546040516340c10f1960e01b81526001600160a01b03909116906340c10f1990610e5b90879087906004016133e3565b600060405180830381600087803b158015610e7557600080fd5b505af1158015610e89573d6000803e3d6000fd5b5050505061117a565b606d546001600160a01b038781169116148015610ec05750606d5463ffffffff888116600160a01b90920416145b15610ed85760006001600160a01b0385168482610d87565b60685463ffffffff610100909104811690881603610f0957610f046001600160a01b03871685856120c7565b61117a565b60008787604051602001610f1e9291906132d2565b60408051601f1981840301815291815281516020928301206000818152606a9093529120549091506001600160a01b031680611116576000610f968386868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061212292505050565b6040516340c10f1960e01b81529091506001600160a01b038216906340c10f1990610fc7908a908a906004016133e3565b600060405180830381600087803b158015610fe157600080fd5b505af1158015610ff5573d6000803e3d6000fd5b5050505080606a600085815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060405180604001604052808b63ffffffff1681526020018a6001600160a01b0316815250606b6000836001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a8154816001600160a01b0302191690836001600160a01b031602179055509050507f490e59a1701b938786ac72570a1efeac994a3dbe96e2e883e19e902ace6e6a398a8a83888860405161110895949392919061347b565b60405180910390a150611177565b6040516340c10f1960e01b81526001600160a01b038216906340c10f199061114490899089906004016133e3565b600060405180830381600087803b15801561115e57600080fd5b505af1158015611172573d6000803e3d6000fd5b505050505b50505b7f1df3f2a973a00d6635911755c260704e95e8a5876997546798770f76396fda4d8a888887876040516111b19594939291906134b4565b60405180910390a1505050505050505050505050565b60685460ff16156111eb57604051630bc011ff60e21b815260040160405180910390fd5b6111f361219e565b60685463ffffffff610100909104811690881603611224576040516302caf51760e11b815260040160405180910390fd5b6000806060876001600160a01b03881661130a578834146112585760405163b89240f560e01b815260040160405180910390fd5b606d54606e80546001600160a01b0383169650600160a01b90920463ffffffff16945090611285906132fc565b80601f01602080910402602001604051908101604052809291908181526020018280546112b1906132fc565b80156112fe5780601f106112d3576101008083540402835291602001916112fe565b820191906000526020600020905b8154815290600101906020018083116112e157829003601f168201915b50505050509150611596565b34156113295760405163798ee6f160e01b815260040160405180910390fd5b606f546001600160a01b03908116908916036113a457604051632770a7eb60e21b81526001600160a01b03891690639dc29fac9061136d9033908d906004016133e3565b600060405180830381600087803b15801561138757600080fd5b505af115801561139b573d6000803e3d6000fd5b50505050611596565b6001600160a01b038089166000908152606b602090815260409182902082518084019093525463ffffffff81168352600160201b9004909216918101829052901561145c57604051632770a7eb60e21b81526001600160a01b038a1690639dc29fac906114179033908e906004016133e3565b600060405180830381600087803b15801561143157600080fd5b505af1158015611445573d6000803e3d6000fd5b505050508060200151945080600001519350611589565b851561146e5761146e898b89896121f7565b6040516370a0823160e01b81526000906001600160a01b038b16906370a082319061149d903090600401612b9c565b602060405180830381865afa1580156114ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114de91906134e6565b90506114f56001600160a01b038b1633308e61253d565b6040516370a0823160e01b81526000906001600160a01b038c16906370a0823190611524903090600401612b9c565b602060405180830381865afa158015611541573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061156591906134e6565b905061157182826134ff565b6068548c9850610100900463ffffffff169650935050505b61159289610c04565b9250505b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b600084868e8e86886053546040516115d6989796959493929190613512565b60405180910390a16115fd6115f8600085878f8f878980519060200120610791565b612575565b861561160b5761160b611ecf565b5050505061161860018055565b50505050505050565b606c546001600160a01b0316331461164c57604051631736745960e31b815260040160405180910390fd5b610640612660565b60685460ff161561167857604051630bc011ff60e21b815260040160405180910390fd5b60685463ffffffff86811661010090920416146116a8576040516302caf51760e11b815260040160405180910390fd5b6116ca8c8c8c8c8c610d5560018e8e8e8e8e8e8e604051610d48929190613426565b606f546000906001600160a01b031661178157846001600160a01b031684888a86866040516024016116ff949392919061357d565b60408051601f198184030181529181526020820180516001600160e01b0316630c035af960e11b179052516117349190613436565b60006040518083038185875af1925050503d8060008114611771576040519150601f19603f3d011682016040523d82523d6000602084013e611776565b606091505b505080915050611883565b606f546040516340c10f1960e01b81526001600160a01b03909116906340c10f19906117b390889088906004016133e3565b600060405180830381600087803b1580156117cd57600080fd5b505af11580156117e1573d6000803e3d6000fd5b50505050846001600160a01b031687898585604051602401611806949392919061357d565b60408051601f198184030181529181526020820180516001600160e01b0316630c035af960e11b1790525161183b9190613436565b6000604051808303816000865af19150503d8060008114611878576040519150601f19603f3d011682016040523d82523d6000602084013e61187d565b606091505b50909150505b806118a1576040516337e391c360e01b815260040160405180910390fd5b7f1df3f2a973a00d6635911755c260704e95e8a5876997546798770f76396fda4d8b898988886040516118d89594939291906134b4565b60405180910390a150505050505050505050505050565b600054610100900460ff161580801561190f5750600054600160ff909116105b806119295750303b158015611929575060005460ff166001145b6119915760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff1916600117905580156119b4576000805461ff0019166101001790555b60688054610100600160c81b03191661010063ffffffff8a160265010000000000600160c81b03191617600160281b6001600160a01b038781169190910291909117909155606c80546001600160a01b0319168583161790558616611a3d5763ffffffff851615611a3857604051630d43a60960e11b815260040160405180910390fd5b611b0c565b606d805463ffffffff8716600160a01b026001600160c01b03199091166001600160a01b03891617179055606e611a7483826135fe565b50611aeb6000801b6012604051602001611ad791906060808252600d908201526c2bb930b83832b21022ba3432b960991b608082015260a060208201819052600490820152630ae8aa8960e31b60c082015260ff91909116604082015260e00190565b604051602081830303815290604052612122565b606f80546001600160a01b0319166001600160a01b03929092169190911790555b611b146126b8565b8015611618576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150505050505050565b600081611b70868686610965565b1495945050505050565b60685460ff1615611b9e57604051630bc011ff60e21b815260040160405180910390fd5b6068805460ff191660011790556040517f2261efe5aef6fedc1fd1550b25facc9181745623049c7901287030b9ad1a549790600090a1565b60685463ffffffff610100909104811690871603611c07576040516302caf51760e11b815260040160405180910390fd5b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b6001606860019054906101000a900463ffffffff16338989898888605354604051611c5b999897969594939291906136bd565b60405180910390a1611c926115f86001606860019054906101000a900463ffffffff16338a8a8a8989604051610d48929190613426565b8215610bfc57610bfc611ecf565b60408051600481526024810182526020810180516001600160e01b03166306fdde0360e01b179052905160609160009182916001600160a01b03861691611ce79190613436565b600060405180830381855afa9150503d8060008114611d22576040519150601f19603f3d011682016040523d82523d6000602084013e611d27565b606091505b509150915081611d5657604051806040016040528060078152602001664e4f5f4e414d4560c81b81525061091d565b61091d816126e7565b60408051600481526024810182526020810180516001600160e01b03166395d89b4160e01b179052905160609160009182916001600160a01b03861691611da69190613436565b600060405180830381855afa9150503d8060008114611de1576040519150601f19603f3d011682016040523d82523d6000602084013e611de6565b606091505b509150915081611d5657604051806040016040528060098152602001681393d7d4d6535093d360ba1b81525061091d565b60408051600481526024810182526020810180516001600160e01b031663313ce56760e01b1790529051600091829182916001600160a01b03861691611e5d9190613436565b600060405180830381855afa9150503d8060008114611e98576040519150601f19603f3d011682016040523d82523d6000602084013e611e9d565b606091505b5091509150818015611eb0575080516020145b611ebb57601261091d565b8080602001905181019061091d919061372a565b6053546068805463ffffffff909216600160c81b0263ffffffff60c81b1990921691909117908190556001600160a01b03600160281b909104166333d6247d611f1661081e565b6040518263ffffffff1660e01b8152600401611f3491815260200190565b600060405180830381600087803b158015611f4e57600080fd5b505af1158015611f62573d6000803e3d6000fd5b50505050565b606854604080516020808201879052818301869052825180830384018152606083019384905280519101206312bd9b1960e11b9092526064810191909152600091600160281b90046001600160a01b03169063257b3632906084016020604051808303816000875af1158015611fe2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061200691906134e6565b90508060000361202857604051622f6fad60e01b815260040160405180910390fd5b600080600160401b87161561206857869150612046848a8489611b62565b612063576040516338105f3b60e21b815260040160405180910390fd5b6120b2565b602087901c612078816001613747565b915087925061209361208b868c86610965565b8a8389611b62565b6120b0576040516338105f3b60e21b815260040160405180910390fd5b505b6120bc8282612875565b505050505050505050565b61211d8363a9059cbb60e01b84846040516024016120e69291906133e3565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261291d565b505050565b60008060405180611ba00160405280611b668152602001613a7a611b669139836040516020016121539291906133b4565b6040516020818303038152906040529050838151602083016000f591506001600160a01b038216612197576040516305f7d84960e51b815260040160405180910390fd5b5092915050565b6002600154036121f05760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611988565b6002600155565b60006122066004828486613764565b61220f9161378e565b9050632afa533160e01b6001600160e01b03198216016123a357600080808080808061223e896004818d613764565b81019061224b91906137be565b9650965096509650965096509650336001600160a01b0316876001600160a01b03161461228b5760405163912ecce760e01b815260040160405180910390fd5b6001600160a01b03861630146122b45760405163750643af60e01b815260040160405180910390fd5b8a85146122d4576040516303fffc4b60e01b815260040160405180910390fd5b604080516001600160a01b0389811660248301528881166044830152606482018890526084820187905260ff861660a483015260c4820185905260e48083018590528351808403909101815261010490920183526020820180516001600160e01b031663d505accf60e01b1790529151918e16916123529190613436565b6000604051808303816000865af19150503d806000811461238f576040519150601f19603f3d011682016040523d82523d6000602084013e612394565b606091505b505050505050505050506106fc565b6001600160e01b031981166323f2ebc360e21b146123d457604051637141605d60e11b815260040160405180910390fd5b6000808080808080806123ea8a6004818e613764565b8101906123f79190613812565b97509750975097509750975097509750336001600160a01b0316886001600160a01b0316146124395760405163912ecce760e01b815260040160405180910390fd5b6001600160a01b03871630146124625760405163750643af60e01b815260040160405180910390fd5b604080516001600160a01b038a811660248301528981166044830152606482018990526084820188905286151560a483015260ff861660c483015260e482018590526101048083018590528351808403909101815261012490920183526020820180516001600160e01b03166323f2ebc360e21b1790529151918f16916124e99190613436565b6000604051808303816000865af19150503d8060008114612526576040519150601f19603f3d011682016040523d82523d6000602084013e61252b565b606091505b50505050505050505050505050505050565b6040516001600160a01b0380851660248301528316604482015260648101829052611f629085906323b872dd60e01b906084016120e6565b80600161258460206002613979565b61258e91906134ff565b605354106125af576040516377ae67b360e11b815260040160405180910390fd5b60006053600081546125c090613362565b9182905550905060005b6020811015612651578082901c6001166001036125fd5782603382602081106125f5576125f5613336565b015550505050565b6033816020811061261057612610613336565b01546040805160208101929092528101849052606001604051602081830303815290604052805190602001209250808061264990613362565b9150506125ca565b5061211d613985565b60018055565b60685460ff1661268357604051635386698160e01b815260040160405180910390fd5b6068805460ff191690556040517f1e5e34eea33501aecf2ebec9fe0e884a40804275ea7fe10b2ba084c8374308b390600090a1565b600054610100900460ff166126df5760405162461bcd60e51b81526004016119889061399b565b6106406129ef565b60606040825110612706578180602001905181019061068d91906139e6565b81516020036128425760005b602081108015612741575082818151811061272f5761272f613336565b01602001516001600160f81b03191615155b15612758578061275081613362565b915050612712565b806000036127905750506040805180820190915260128152714e4f545f56414c49445f454e434f44494e4760701b6020820152919050565b6000816001600160401b038111156127aa576127aa612e47565b6040519080825280601f01601f1916602001820160405280156127d4576020820181803683370190505b50905060005b8281101561283a578481815181106127f4576127f4613336565b602001015160f81c60f81b82828151811061281157612811613336565b60200101906001600160f81b031916908160001a9053508061283281613362565b9150506127da565b509392505050565b50506040805180820190915260128152714e4f545f56414c49445f454e434f44494e4760701b602082015290565b919050565b606854600090610100900463ffffffff16158015612899575063ffffffff82166001145b156128ab575063ffffffff82166128d2565b6128bf600160201b63ffffffff84166133fc565b6128cf9063ffffffff8516613413565b90505b600881901c60008181526069602052604081208054600160ff861690811b9182189283905592909190818316900361161857604051630c8d9eab60e31b815260040160405180910390fd5b6000612972826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612a169092919063ffffffff16565b80519091501561211d57808060200190518101906129909190613a5c565b61211d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401611988565b600054610100900460ff1661265a5760405162461bcd60e51b81526004016119889061399b565b606061091d848460008585600080866001600160a01b03168587604051612a3d9190613436565b60006040518083038185875af1925050503d8060008114612a7a576040519150601f19603f3d011682016040523d82523d6000602084013e612a7f565b606091505b5091509150612a9087838387612a9b565b979650505050505050565b60608315612b0a578251600003612b03576001600160a01b0385163b612b035760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611988565b508161091d565b61091d8383815115612b1f5781518083602001fd5b8060405162461bcd60e51b81526004016119889190612ccf565b803563ffffffff8116811461287057600080fd5b6001600160a01b0381168114612b6257600080fd5b50565b60008060408385031215612b7857600080fd5b612b8183612b39565b91506020830135612b9181612b4d565b809150509250929050565b6001600160a01b0391909116815260200190565b8015158114612b6257600080fd5b60008083601f840112612bd057600080fd5b5081356001600160401b03811115612be757600080fd5b602083019150836020828501011115612bff57600080fd5b9250929050565b600080600080600060808688031215612c1e57600080fd5b612c2786612b39565b94506020860135612c3781612b4d565b93506040860135612c4781612bb0565b925060608601356001600160401b03811115612c6257600080fd5b612c6e88828901612bbe565b969995985093965092949392505050565b60005b83811015612c9a578181015183820152602001612c82565b50506000910152565b60008151808452612cbb816020860160208601612c7f565b601f01601f19169290920160200192915050565b602081526000612ce26020830184612ca3565b9392505050565b600060208284031215612cfb57600080fd5b8135612ce281612b4d565b60ff81168114612b6257600080fd5b600080600080600080600060e0888a031215612d3057600080fd5b8735612d3b81612d06565b9650612d4960208901612b39565b95506040880135612d5981612b4d565b9450612d6760608901612b39565b93506080880135612d7781612b4d565b9699959850939692959460a0840135945060c09093013592915050565b600080600060608486031215612da957600080fd5b612db284612b39565b92506020840135612dc281612b4d565b91506040840135612dd281612b4d565b809150509250925092565b600060208284031215612def57600080fd5b5035919050565b80610400810183101561068d57600080fd5b60008060006104408486031215612e1e57600080fd5b83359250612e2f8560208601612df6565b9150612e3e6104208501612b39565b90509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715612e8557612e85612e47565b604052919050565b60006001600160401b03821115612ea657612ea6612e47565b50601f01601f191660200190565b6000612ec7612ec284612e8d565b612e5d565b9050828152838383011115612edb57600080fd5b828260208301376000602084830101529392505050565b600082601f830112612f0357600080fd5b612ce283833560208501612eb4565b600080600080600060a08688031215612f2a57600080fd5b612f3386612b39565b94506020860135612f4381612b4d565b935060408601356001600160401b0380821115612f5f57600080fd5b612f6b89838a01612ef2565b94506060880135915080821115612f8157600080fd5b50612f8e88828901612ef2565b9250506080860135612f9f81612d06565b809150509295509295909350565b60008060008060008060a08789031215612fc657600080fd5b612fcf87612b39565b95506020870135612fdf81612b4d565b9450604087013593506060870135612ff681612bb0565b925060808701356001600160401b0381111561301157600080fd5b61301d89828a01612bbe565b979a9699509497509295939492505050565b6000806040838503121561304257600080fd5b61304b83612b39565b915061305960208401612b39565b90509250929050565b6000806000806000806000806000806000806109208d8f03121561308557600080fd5b61308f8e8e612df6565b9b5061309f8e6104008f01612df6565b9a506108008d013599506108208d013598506108408d013597506130c66108608e01612b39565b96506130d66108808e0135612b4d565b6108808d013595506130eb6108a08e01612b39565b94506130fb6108c08e0135612b4d565b6108c08d013593506108e08d013592506001600160401b036109008e0135111561312457600080fd5b6131358e6109008f01358f01612bbe565b81935080925050509295989b509295989b509295989b565b600080600080600080600060c0888a03121561316857600080fd5b61317188612b39565b9650602088013561318181612b4d565b955060408801359450606088013561319881612b4d565b935060808801356131a881612bb0565b925060a08801356001600160401b038111156131c357600080fd5b6131cf8a828b01612bbe565b989b979a50959850939692959293505050565b60008060008060008060c087890312156131fb57600080fd5b61320487612b39565b9550602087013561321481612b4d565b945061322260408801612b39565b9350606087013561323281612b4d565b9250608087013561324281612b4d565b915060a08701356001600160401b0381111561325d57600080fd5b8701601f8101891361326e57600080fd5b61327d89823560208401612eb4565b9150509295509295509295565b60008060008061046085870312156132a157600080fd5b843593506132b28660208701612df6565b92506132c16104208601612b39565b939692955092936104400135925050565b60e09290921b6001600160e01b031916825260601b6001600160601b031916600482015260180190565b600181811c9082168061331057607f821691505b60208210810361333057634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016133745761337461334c565b5060010190565b60608152600061338e6060830186612ca3565b82810360208401526133a08186612ca3565b91505060ff83166040830152949350505050565b600083516133c6818460208801612c7f565b8351908301906133da818360208801612c7f565b01949350505050565b6001600160a01b03929092168252602082015260400190565b808202811582820484141761068d5761068d61334c565b8082018082111561068d5761068d61334c565b8183823760009101908152919050565b60008251613448818460208701612c7f565b9190910192915050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b63ffffffff861681526001600160a01b03858116602083015284166040820152608060608201819052600090612a909083018486613452565b94855263ffffffff9390931660208501526001600160a01b039182166040850152166060830152608082015260a00190565b6000602082840312156134f857600080fd5b5051919050565b8181038181111561068d5761068d61334c565b60ff8916815263ffffffff88811660208301526001600160a01b03888116604084015287821660608401528616608083015260a0820185905261010060c0830181905260009161356484830187612ca3565b925080851660e085015250509998505050505050505050565b6001600160a01b038516815263ffffffff841660208201526060604082018190526000906135ae9083018486613452565b9695505050505050565b601f82111561211d57600081815260208120601f850160051c810160208610156135df5750805b601f850160051c820191505b81811015610bfc578281556001016135eb565b81516001600160401b0381111561361757613617612e47565b61362b8161362584546132fc565b846135b8565b602080601f83116001811461366057600084156136485750858301515b600019600386901b1c1916600185901b178555610bfc565b600085815260208120601f198616915b8281101561368f57888601518255948401946001909101908401613670565b50858210156136ad5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60ff8a16815263ffffffff89811660208301526001600160a01b03898116604084015288821660608401528716608083015260a0820186905261010060c083018190526000916137108483018789613452565b925080851660e085015250509a9950505050505050505050565b60006020828403121561373c57600080fd5b8151612ce281612d06565b63ffffffff8181168382160190808211156121975761219761334c565b6000808585111561377457600080fd5b8386111561378157600080fd5b5050820193919092039150565b6001600160e01b031981358181169160048510156137b65780818660040360031b1b83161692505b505092915050565b600080600080600080600060e0888a0312156137d957600080fd5b87356137e481612b4d565b965060208801356137f481612b4d565b955060408801359450606088013593506080880135612d7781612d06565b600080600080600080600080610100898b03121561382f57600080fd5b883561383a81612b4d565b9750602089013561384a81612b4d565b96506040890135955060608901359450608089013561386881612bb0565b935060a089013561387881612d06565b979a969950949793969295929450505060c08201359160e0013590565b600181815b808511156138d05781600019048211156138b6576138b661334c565b808516156138c357918102915b93841c939080029061389a565b509250929050565b6000826138e75750600161068d565b816138f45750600061068d565b816001811461390a576002811461391457613930565b600191505061068d565b60ff8411156139255761392561334c565b50506001821b61068d565b5060208310610133831016604e8410600b8410161715613953575081810a61068d565b61395d8383613895565b80600019048211156139715761397161334c565b029392505050565b6000612ce283836138d8565b634e487b7160e01b600052600160045260246000fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156139f857600080fd5b81516001600160401b03811115613a0e57600080fd5b8201601f81018413613a1f57600080fd5b8051613a2d612ec282612e8d565b818152856020838501011115613a4257600080fd5b613a53826020830160208601612c7f565b95945050505050565b600060208284031215613a6e57600080fd5b8151612ce281612bb056fe6101006040523480156200001257600080fd5b5060405162001b6638038062001b6683398101604081905262000035916200028d565b82826003620000458382620003a1565b506004620000548282620003a1565b50503360c0525060ff811660e052466080819052620000739062000080565b60a052506200046d915050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f620000ad6200012e565b805160209182012060408051808201825260018152603160f81b90840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b6060600380546200013f9062000312565b80601f01602080910402602001604051908101604052809291908181526020018280546200016d9062000312565b8015620001be5780601f106200019257610100808354040283529160200191620001be565b820191906000526020600020905b815481529060010190602001808311620001a057829003601f168201915b5050505050905090565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620001f057600080fd5b81516001600160401b03808211156200020d576200020d620001c8565b604051601f8301601f19908116603f01168101908282118183101715620002385762000238620001c8565b816040528381526020925086838588010111156200025557600080fd5b600091505b838210156200027957858201830151818301840152908201906200025a565b600093810190920192909252949350505050565b600080600060608486031215620002a357600080fd5b83516001600160401b0380821115620002bb57600080fd5b620002c987838801620001de565b94506020860151915080821115620002e057600080fd5b50620002ef86828701620001de565b925050604084015160ff811681146200030757600080fd5b809150509250925092565b600181811c908216806200032757607f821691505b6020821081036200034857634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200039c57600081815260208120601f850160051c81016020861015620003775750805b601f850160051c820191505b81811015620003985782815560010162000383565b5050505b505050565b81516001600160401b03811115620003bd57620003bd620001c8565b620003d581620003ce845462000312565b846200034e565b602080601f8311600181146200040d5760008415620003f45750858301515b600019600386901b1c1916600185901b17855562000398565b600085815260208120601f198616915b828110156200043e578886015182559484019460019091019084016200041d565b50858210156200045d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e0516116aa620004bc6000396000610237015260008181610307015281816105c001526106a70152600061053a015260008181610379015261050401526116aa6000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806370a08231116100d8578063a457c2d71161008c578063d505accf11610066578063d505accf1461039b578063dd62ed3e146103ae578063ffa1ad74146103f457600080fd5b8063a457c2d71461034e578063a9059cbb14610361578063cd0d00961461037457600080fd5b806395d89b41116100bd57806395d89b41146102e75780639dc29fac146102ef578063a3c573eb1461030257600080fd5b806370a08231146102915780637ecebe00146102c757600080fd5b806330adf81f1161012f5780633644e515116101145780633644e51514610261578063395093511461026957806340c10f191461027c57600080fd5b806330adf81f14610209578063313ce5671461023057600080fd5b806318160ddd1161016057806318160ddd146101bd57806320606b70146101cf57806323b872dd146101f657600080fd5b806306fdde031461017c578063095ea7b31461019a575b600080fd5b610184610430565b60405161019191906113e4565b60405180910390f35b6101ad6101a8366004611479565b6104c2565b6040519015158152602001610191565b6002545b604051908152602001610191565b6101c17f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81565b6101ad6102043660046114a3565b6104dc565b6101c17f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152602001610191565b6101c1610500565b6101ad610277366004611479565b61055c565b61028f61028a366004611479565b6105a8565b005b6101c161029f3660046114df565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6101c16102d53660046114df565b60056020526000908152604090205481565b610184610680565b61028f6102fd366004611479565b61068f565b6103297f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610191565b6101ad61035c366004611479565b61075e565b6101ad61036f366004611479565b61082f565b6101c17f000000000000000000000000000000000000000000000000000000000000000081565b61028f6103a9366004611501565b61083d565b6101c16103bc366004611574565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6101846040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525081565b60606003805461043f906115a7565b80601f016020809104026020016040519081016040528092919081815260200182805461046b906115a7565b80156104b85780601f1061048d576101008083540402835291602001916104b8565b820191906000526020600020905b81548152906001019060200180831161049b57829003601f168201915b5050505050905090565b6000336104d0818585610b73565b60019150505b92915050565b6000336104ea858285610d27565b6104f5858585610dfe565b506001949350505050565b60007f00000000000000000000000000000000000000000000000000000000000000004614610537576105324661106d565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091906104d090829086906105a3908790611629565b610b73565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610672576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d4272696467650000000000000000000000000000000060648201526084015b60405180910390fd5b61067c8282611135565b5050565b60606004805461043f906115a7565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610754576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d427269646765000000000000000000000000000000006064820152608401610669565b61067c8282611228565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015610822576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610669565b6104f58286868403610b73565b6000336104d0818585610dfe565b834211156108cc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f546f6b656e577261707065643a3a7065726d69743a204578706972656420706560448201527f726d6974000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8716600090815260056020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918a918a918a9190866109268361163c565b9091555060408051602081019690965273ffffffffffffffffffffffffffffffffffffffff94851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000610991610500565b6040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281019190915260428101839052606201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa158015610a55573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590610ad057508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b610b5c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f546f6b656e577261707065643a3a7065726d69743a20496e76616c696420736960448201527f676e6174757265000000000000000000000000000000000000000000000000006064820152608401610669565b610b678a8a8a610b73565b50505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff8316610c15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610cb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610df85781811015610deb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610669565b610df88484848403610b73565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610ea1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610f44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610ffa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610df8565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f611098610430565b8051602091820120604080518082018252600181527f310000000000000000000000000000000000000000000000000000000000000090840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b73ffffffffffffffffffffffffffffffffffffffff82166111b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610669565b80600260008282546111c49190611629565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff82166112cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205481811015611381576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610d1a565b600060208083528351808285015260005b81811015611411578581018301518582016040015282016113f5565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461147457600080fd5b919050565b6000806040838503121561148c57600080fd5b61149583611450565b946020939093013593505050565b6000806000606084860312156114b857600080fd5b6114c184611450565b92506114cf60208501611450565b9150604084013590509250925092565b6000602082840312156114f157600080fd5b6114fa82611450565b9392505050565b600080600080600080600060e0888a03121561151c57600080fd5b61152588611450565b965061153360208901611450565b95506040880135945060608801359350608088013560ff8116811461155757600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561158757600080fd5b61159083611450565b915061159e60208401611450565b90509250929050565b600181811c908216806115bb57607f821691505b6020821081036115f4577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156104d6576104d66115fa565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361166d5761166d6115fa565b506001019056fea26469706673582212208d88fee561cff7120d381c345cfc534cef8229a272dc5809d4bbb685ad67141164736f6c63430008110033a2646970667358221220914f18d5b241f0d10b2ebc814aadeee338ad60bad704683e414dad415cb2e14d64736f6c63430008140033" + }, + { + "contractName": "PolygonZkEVMBridge proxy", + "balance": "340282366920938463463374607431768211455", + "nonce": "1", + "address": "0xB7098a13a48EcE087d3DA15b2D28eCE0f89819B8", + "bytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461086f565b610135565b61006b6100a336600461088a565b61017f565b3480156100b457600080fd5b506100bd6101f3565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461086f565b610231565b34801561011257600080fd5b506100bd61025e565b61012361028c565b61013361012e610363565b61036d565b565b61013d610391565b73ffffffffffffffffffffffffffffffffffffffff16330361017757610174816040518060200160405280600081525060006103d1565b50565b61017461011b565b610187610391565b73ffffffffffffffffffffffffffffffffffffffff1633036101eb576101e68383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506103d1915050565b505050565b6101e661011b565b60006101fd610391565b73ffffffffffffffffffffffffffffffffffffffff16330361022657610221610363565b905090565b61022e61011b565b90565b610239610391565b73ffffffffffffffffffffffffffffffffffffffff16330361017757610174816103fc565b6000610268610391565b73ffffffffffffffffffffffffffffffffffffffff16330361022657610221610391565b610294610391565b73ffffffffffffffffffffffffffffffffffffffff163303610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b600061022161045d565b3660008037600080366000845af43d6000803e80801561038c573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6103da83610485565b6000825111806103e75750805b156101e6576103f683836104d2565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f610425610391565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a1610174816104fe565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6103b5565b61048e8161060a565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606104f7838360405180606001604052806027815260200161099f602791396106d5565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff81166105a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161035a565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b73ffffffffffffffffffffffffffffffffffffffff81163b6106ae576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161035a565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6105c4565b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516106ff9190610931565b600060405180830381855af49150503d806000811461073a576040519150601f19603f3d011682016040523d82523d6000602084013e61073f565b606091505b50915091506107508683838761075a565b9695505050505050565b606083156107f05782516000036107e95773ffffffffffffffffffffffffffffffffffffffff85163b6107e9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161035a565b50816107fa565b6107fa8383610802565b949350505050565b8151156108125781518083602001fd5b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161035a919061094d565b803573ffffffffffffffffffffffffffffffffffffffff8116811461086a57600080fd5b919050565b60006020828403121561088157600080fd5b6104f782610846565b60008060006040848603121561089f57600080fd5b6108a884610846565b9250602084013567ffffffffffffffff808211156108c557600080fd5b818601915086601f8301126108d957600080fd5b8135818111156108e857600080fd5b8760208285010111156108fa57600080fd5b6020830194508093505050509250925092565b60005b83811015610928578181015183820152602001610910565b50506000910152565b6000825161094381846020870161090d565b9190910192915050565b602081526000825180602084015261096c81604085016020870161090d565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220701a0c26bdd76686e63fc3c65e4f28a20ba3ecc8a60246733c0627e679c9804e64736f6c63430008140033", + "storage": { + "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x000000000000000000000000e34fe58dda5b8c6d547e4857e987633aa86a5e90", + "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x000000000000000000000000493732fb136a380920c390a85fc27d79c7b70756" + } + }, + { + "contractName": "PolygonZkEVMGlobalExitRootL2 implementation", + "balance": "0", + "nonce": "1", + "address": "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9", + "bytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806301fd904414610051578063257b36321461006d57806333d6247d1461008d578063a3c573eb146100a2575b600080fd5b61005a60015481565b6040519081526020015b60405180910390f35b61005a61007b366004610162565b60006020819052908152604090205481565b6100a061009b366004610162565b6100ee565b005b6100c97f000000000000000000000000b7098a13a48ece087d3da15b2d28ece0f89819b881565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610064565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000b7098a13a48ece087d3da15b2d28ece0f89819b8161461015d576040517fb49365dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600155565b60006020828403121561017457600080fd5b503591905056fea2646970667358221220ea2171e2c85c8bff947affc409ef6fc6a8fe82fb8c174ddeda988651e595d66564736f6c63430008140033" + }, + { + "contractName": "PolygonZkEVMGlobalExitRootL2 proxy", + "balance": "0", + "nonce": "1", + "address": "0xa40d5f56745a118d0906a34e69aec8c0db1cb8fa", + "bytecode": "0x60806040523661001357610011610017565b005b6100115b61001f6101b7565b6001600160a01b0316336001600160a01b0316141561016f5760606001600160e01b031960003516631b2ce7f360e11b8114156100655761005e6101ea565b9150610167565b6001600160e01b0319811663278f794360e11b14156100865761005e610241565b6001600160e01b031981166308f2839760e41b14156100a75761005e610287565b6001600160e01b031981166303e1469160e61b14156100c85761005e6102b8565b6001600160e01b03198116635c60da1b60e01b14156100e95761005e6102f8565b60405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b815160208301f35b61017761030c565b565b606061019e83836040518060600160405280602781526020016108576027913961031c565b9392505050565b90565b6001600160a01b03163b151590565b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b60606101f4610394565b600061020336600481846106a2565b81019061021091906106e8565b905061022d8160405180602001604052806000815250600061039f565b505060408051602081019091526000815290565b606060008061025336600481846106a2565b8101906102609190610719565b915091506102708282600161039f565b604051806020016040528060008152509250505090565b6060610291610394565b60006102a036600481846106a2565b8101906102ad91906106e8565b905061022d816103cb565b60606102c2610394565b60006102cc6101b7565b604080516001600160a01b03831660208201529192500160405160208183030381529060405291505090565b6060610302610394565b60006102cc610422565b610177610317610422565b610431565b6060600080856001600160a01b0316856040516103399190610807565b600060405180830381855af49150503d8060008114610374576040519150601f19603f3d011682016040523d82523d6000602084013e610379565b606091505b509150915061038a86838387610455565b9695505050505050565b341561017757600080fd5b6103a8836104d3565b6000825111806103b55750805b156103c6576103c48383610179565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6103f46101b7565b604080516001600160a01b03928316815291841660208301520160405180910390a161041f81610513565b50565b600061042c6105bc565b905090565b3660008037600080366000845af43d6000803e808015610450573d6000f35b3d6000fd5b606083156104c15782516104ba576001600160a01b0385163b6104ba5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161015e565b50816104cb565b6104cb83836105e4565b949350505050565b6104dc8161060e565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6001600160a01b0381166105785760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b606482015260840161015e565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80546001600160a01b0319166001600160a01b039290921691909117905550565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6101db565b8151156105f45781518083602001fd5b8060405162461bcd60e51b815260040161015e9190610823565b6001600160a01b0381163b61067b5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161015e565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc61059b565b600080858511156106b257600080fd5b838611156106bf57600080fd5b5050820193919092039150565b80356001600160a01b03811681146106e357600080fd5b919050565b6000602082840312156106fa57600080fd5b61019e826106cc565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561072c57600080fd5b610735836106cc565b9150602083013567ffffffffffffffff8082111561075257600080fd5b818501915085601f83011261076657600080fd5b81358181111561077857610778610703565b604051601f8201601f19908116603f011681019083821181831017156107a0576107a0610703565b816040528281528860208487010111156107b957600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b838110156107f65781810151838201526020016107de565b838111156103c45750506000910152565b600082516108198184602087016107db565b9190910192915050565b60208152600082518060208401526108428160408501602087016107db565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122012bb4f564f73959a03513dc74fc3c6e40e8386e6f02c16b78d6db00ce0aa16af64736f6c63430008090033", + "storage": { + "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x000000000000000000000000e34fe58dda5b8c6d547e4857e987633aa86a5e90", + "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x000000000000000000000000dc64a140aa3e981100a9beca4e685f962f0cf6c9" + } + }, + { + "contractName": "PolygonZkEVMTimelock", + "balance": "0", + "nonce": "1", + "address": "0x0165878A594ca255338adfa4d48449f69242Eb8F", + "bytecode": "0x6080604052600436106101c65760003560e01c806364d62353116100f7578063b1c5f42711610095578063d547741f11610064578063d547741f14610661578063e38335e514610681578063f23a6e6114610694578063f27a0c92146106d957600080fd5b8063b1c5f427146105af578063bc197c81146105cf578063c4d252f514610614578063d45c44351461063457600080fd5b80638f61f4f5116100d15780638f61f4f5146104e157806391d1485414610515578063a217fddf14610566578063b08e51c01461057b57600080fd5b806364d62353146104815780638065657f146104a15780638f2a0bb0146104c157600080fd5b8063248a9ca31161016457806331d507501161013e57806331d50750146103c857806336568abe146103e85780633a6aae7214610408578063584b153e1461046157600080fd5b8063248a9ca3146103475780632ab0f529146103775780632f2ff15d146103a857600080fd5b80630d3cf6fc116101a05780630d3cf6fc1461026b578063134008d31461029f57806313bc9f20146102b2578063150b7a02146102d257600080fd5b806301d5062a146101d257806301ffc9a7146101f457806307bd02651461022957600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506101f26101ed366004611c52565b6106ee565b005b34801561020057600080fd5b5061021461020f366004611cc7565b610783565b60405190151581526020015b60405180910390f35b34801561023557600080fd5b5061025d7fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e6381565b604051908152602001610220565b34801561027757600080fd5b5061025d7f5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca581565b6101f26102ad366004611d09565b6107df565b3480156102be57600080fd5b506102146102cd366004611d75565b6108d7565b3480156102de57600080fd5b506103166102ed366004611e9a565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610220565b34801561035357600080fd5b5061025d610362366004611d75565b60009081526020819052604090206001015490565b34801561038357600080fd5b50610214610392366004611d75565b6000908152600160208190526040909120541490565b3480156103b457600080fd5b506101f26103c3366004611f02565b6108fd565b3480156103d457600080fd5b506102146103e3366004611d75565b610927565b3480156103f457600080fd5b506101f2610403366004611f02565b610940565b34801561041457600080fd5b5061043c7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610220565b34801561046d57600080fd5b5061021461047c366004611d75565b6109f8565b34801561048d57600080fd5b506101f261049c366004611d75565b610a0e565b3480156104ad57600080fd5b5061025d6104bc366004611d09565b610ade565b3480156104cd57600080fd5b506101f26104dc366004611f73565b610b1d565b3480156104ed57600080fd5b5061025d7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc181565b34801561052157600080fd5b50610214610530366004611f02565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b34801561057257600080fd5b5061025d600081565b34801561058757600080fd5b5061025d7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f78381565b3480156105bb57600080fd5b5061025d6105ca366004612025565b610d4f565b3480156105db57600080fd5b506103166105ea36600461214e565b7fbc197c810000000000000000000000000000000000000000000000000000000095945050505050565b34801561062057600080fd5b506101f261062f366004611d75565b610d94565b34801561064057600080fd5b5061025d61064f366004611d75565b60009081526001602052604090205490565b34801561066d57600080fd5b506101f261067c366004611f02565b610e8f565b6101f261068f366004612025565b610eb4565b3480156106a057600080fd5b506103166106af3660046121f8565b7ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b3480156106e557600080fd5b5061025d611161565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc161071881611244565b6000610728898989898989610ade565b90506107348184611251565b6000817f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8b8b8b8b8b8a604051610770969594939291906122a6565b60405180910390a3505050505050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f4e2312e00000000000000000000000000000000000000000000000000000000014806107d957506107d98261139e565b92915050565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff1661085c5761085c8133611435565b600061086c888888888888610ade565b905061087881856114ed565b6108848888888861162a565b6000817fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588a8a8a8a6040516108bc94939291906122f1565b60405180910390a36108cd8161172e565b5050505050505050565b6000818152600160205260408120546001811180156108f65750428111155b9392505050565b60008281526020819052604090206001015461091881611244565b61092283836117d7565b505050565b60008181526001602052604081205481905b1192915050565b73ffffffffffffffffffffffffffffffffffffffff811633146109ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6109f482826118c7565b5050565b6000818152600160208190526040822054610939565b333014610a9d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f54696d656c6f636b436f6e74726f6c6c65723a2063616c6c6572206d7573742060448201527f62652074696d656c6f636b00000000000000000000000000000000000000000060648201526084016109e1565b60025460408051918252602082018390527f11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d5910160405180910390a1600255565b6000868686868686604051602001610afb969594939291906122a6565b6040516020818303038152906040528051906020012090509695505050505050565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1610b4781611244565b888714610bd6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b888514610c65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b6000610c778b8b8b8b8b8b8b8b610d4f565b9050610c838184611251565b60005b8a811015610d415780827f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8e8e85818110610cc357610cc3612331565b9050602002016020810190610cd89190612360565b8d8d86818110610cea57610cea612331565b905060200201358c8c87818110610d0357610d03612331565b9050602002810190610d15919061237b565b8c8b604051610d29969594939291906122a6565b60405180910390a3610d3a8161240f565b9050610c86565b505050505050505050505050565b60008888888888888888604051602001610d709897969594939291906124f7565b60405160208183030381529060405280519060200120905098975050505050505050565b7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f783610dbe81611244565b610dc7826109f8565b610e53576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20636160448201527f6e6e6f742062652063616e63656c6c656400000000000000000000000000000060648201526084016109e1565b6000828152600160205260408082208290555183917fbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb7091a25050565b600082815260208190526040902060010154610eaa81611244565b61092283836118c7565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff16610f3157610f318133611435565b878614610fc0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b87841461104f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b60006110618a8a8a8a8a8a8a8a610d4f565b905061106d81856114ed565b60005b8981101561114b5760008b8b8381811061108c5761108c612331565b90506020020160208101906110a19190612360565b905060008a8a848181106110b7576110b7612331565b9050602002013590503660008a8a868181106110d5576110d5612331565b90506020028101906110e7919061237b565b915091506110f78484848461162a565b84867fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588686868660405161112e94939291906122f1565b60405180910390a350505050806111449061240f565b9050611070565b506111558161172e565b50505050505050505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff161580159061123257507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166315064c966040518163ffffffff1660e01b8152600401602060405180830381865afa15801561120e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123291906125be565b1561123d5750600090565b5060025490565b61124e8133611435565b50565b61125a82610927565b156112e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20616c60448201527f7265616479207363686564756c6564000000000000000000000000000000000060648201526084016109e1565b6112ef611161565b81101561137e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a20696e73756666696369656e7460448201527f2064656c6179000000000000000000000000000000000000000000000000000060648201526084016109e1565b61138881426125e0565b6000928352600160205260409092209190915550565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806107d957507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146107d9565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f4576114738161197e565b61147e83602061199d565b60405160200161148f929190612617565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526109e191600401612698565b6114f6826108d7565b611582576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b80158061159e5750600081815260016020819052604090912054145b6109f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a206d697373696e67206465706560448201527f6e64656e6379000000000000000000000000000000000000000000000000000060648201526084016109e1565b60008473ffffffffffffffffffffffffffffffffffffffff168484846040516116549291906126e9565b60006040518083038185875af1925050503d8060008114611691576040519150601f19603f3d011682016040523d82523d6000602084013e611696565b606091505b5050905080611727576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f54696d656c6f636b436f6e74726f6c6c65723a20756e6465726c79696e67207460448201527f72616e73616374696f6e2072657665727465640000000000000000000000000060648201526084016109e1565b5050505050565b611737816108d7565b6117c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b600090815260016020819052604090912055565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556118693390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60606107d973ffffffffffffffffffffffffffffffffffffffff831660145b606060006119ac8360026126f9565b6119b79060026125e0565b67ffffffffffffffff8111156119cf576119cf611d8e565b6040519080825280601f01601f1916602001820160405280156119f9576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611a3057611a30612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611a9357611a93612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000611acf8460026126f9565b611ada9060016125e0565b90505b6001811115611b77577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611b1b57611b1b612331565b1a60f81b828281518110611b3157611b31612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611b7081612710565b9050611add565b5083156108f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109e1565b803573ffffffffffffffffffffffffffffffffffffffff81168114611c0457600080fd5b919050565b60008083601f840112611c1b57600080fd5b50813567ffffffffffffffff811115611c3357600080fd5b602083019150836020828501011115611c4b57600080fd5b9250929050565b600080600080600080600060c0888a031215611c6d57600080fd5b611c7688611be0565b965060208801359550604088013567ffffffffffffffff811115611c9957600080fd5b611ca58a828b01611c09565b989b979a50986060810135976080820135975060a09091013595509350505050565b600060208284031215611cd957600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146108f657600080fd5b60008060008060008060a08789031215611d2257600080fd5b611d2b87611be0565b955060208701359450604087013567ffffffffffffffff811115611d4e57600080fd5b611d5a89828a01611c09565b979a9699509760608101359660809091013595509350505050565b600060208284031215611d8757600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611e0457611e04611d8e565b604052919050565b600082601f830112611e1d57600080fd5b813567ffffffffffffffff811115611e3757611e37611d8e565b611e6860207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601611dbd565b818152846020838601011115611e7d57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215611eb057600080fd5b611eb985611be0565b9350611ec760208601611be0565b925060408501359150606085013567ffffffffffffffff811115611eea57600080fd5b611ef687828801611e0c565b91505092959194509250565b60008060408385031215611f1557600080fd5b82359150611f2560208401611be0565b90509250929050565b60008083601f840112611f4057600080fd5b50813567ffffffffffffffff811115611f5857600080fd5b6020830191508360208260051b8501011115611c4b57600080fd5b600080600080600080600080600060c08a8c031215611f9157600080fd5b893567ffffffffffffffff80821115611fa957600080fd5b611fb58d838e01611f2e565b909b50995060208c0135915080821115611fce57600080fd5b611fda8d838e01611f2e565b909950975060408c0135915080821115611ff357600080fd5b506120008c828d01611f2e565b9a9d999c50979a969997986060880135976080810135975060a0013595509350505050565b60008060008060008060008060a0898b03121561204157600080fd5b883567ffffffffffffffff8082111561205957600080fd5b6120658c838d01611f2e565b909a50985060208b013591508082111561207e57600080fd5b61208a8c838d01611f2e565b909850965060408b01359150808211156120a357600080fd5b506120b08b828c01611f2e565b999c989b509699959896976060870135966080013595509350505050565b600082601f8301126120df57600080fd5b8135602067ffffffffffffffff8211156120fb576120fb611d8e565b8160051b61210a828201611dbd565b928352848101820192828101908785111561212457600080fd5b83870192505b848310156121435782358252918301919083019061212a565b979650505050505050565b600080600080600060a0868803121561216657600080fd5b61216f86611be0565b945061217d60208701611be0565b9350604086013567ffffffffffffffff8082111561219a57600080fd5b6121a689838a016120ce565b945060608801359150808211156121bc57600080fd5b6121c889838a016120ce565b935060808801359150808211156121de57600080fd5b506121eb88828901611e0c565b9150509295509295909350565b600080600080600060a0868803121561221057600080fd5b61221986611be0565b945061222760208701611be0565b93506040860135925060608601359150608086013567ffffffffffffffff81111561225157600080fd5b6121eb88828901611e0c565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b73ffffffffffffffffffffffffffffffffffffffff8716815285602082015260a0604082015260006122dc60a08301868861225d565b60608301949094525060800152949350505050565b73ffffffffffffffffffffffffffffffffffffffff8516815283602082015260606040820152600061232760608301848661225d565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561237257600080fd5b6108f682611be0565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126123b057600080fd5b83018035915067ffffffffffffffff8211156123cb57600080fd5b602001915036819003821315611c4b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612440576124406123e0565b5060010190565b81835260006020808501808196508560051b810191508460005b878110156124ea57828403895281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18836030181126124a057600080fd5b8701858101903567ffffffffffffffff8111156124bc57600080fd5b8036038213156124cb57600080fd5b6124d686828461225d565b9a87019a9550505090840190600101612461565b5091979650505050505050565b60a0808252810188905260008960c08301825b8b8110156125455773ffffffffffffffffffffffffffffffffffffffff61253084611be0565b1682526020928301929091019060010161250a565b5083810360208501528881527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff89111561257e57600080fd5b8860051b9150818a602083013701828103602090810160408501526125a69082018789612447565b60608401959095525050608001529695505050505050565b6000602082840312156125d057600080fd5b815180151581146108f657600080fd5b808201808211156107d9576107d96123e0565b60005b8381101561260e5781810151838201526020016125f6565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161264f8160178501602088016125f3565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161268c8160288401602088016125f3565b01602801949350505050565b60208152600082518060208401526126b78160408501602087016125f3565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b8183823760009101908152919050565b80820281158282048414176107d9576107d96123e0565b60008161271f5761271f6123e0565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea2646970667358221220c474c39da3523b28ebfa5fd66c05b42d6ddcc4a57055483bdda32888b366016164736f6c63430008140033", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000000000000000000e10", + "0xaedcc9e7897c0d335bdc5d92fe3a8b4f23727fe558cd1c19f332b28716a30559": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0xf5e61edb9c9cc6bfbae4463e9a2b1dd6ac3b44ddef38f18016e56ba0363910d9": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x64494413541ff93b31aa309254e3fed72a7456e9845988b915b4c7a7ceba8814": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", + "0x60b9d94c75b7b3f721925089391e4644cd890cb5e6466f9596dfbd2c54e0b280": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x3412d5605ac6cd444957cedb533e5dacad6378b4bc819ebe3652188a665066d6": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", + "0x4b63b79f1e338a49559dcd3193ac9eecc50d0f275d24e97cc8c319e5a31a8bd0": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0xdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d706a": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", + "0x800d5dfe4bba53eedee06cd4546a27da8de00f12db83f56062976d4493fda899": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0xc3ad33e20b0c56a223ad5104fff154aa010f8715b9c981fd38fdc60a4d1a52fc": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5" + } + }, + { + "accountName": "keyless Deployer", + "balance": "0", + "nonce": "1", + "address": "0x28BB4e66addE1f042B77E04cf7D3784C1dcDBbA3" + }, + { + "accountName": "deployer", + "balance": "100000000000000000000000", + "nonce": "8", + "address": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" + } + ] +} diff --git a/db/migrations/state/0019.sql b/db/migrations/state/0019.sql new file mode 100644 index 0000000000..bd982feab1 --- /dev/null +++ b/db/migrations/state/0019.sql @@ -0,0 +1,25 @@ +-- +migrate Up + +-- the update below fix the wrong receipt TX indexes +WITH map_fix_tx_index AS ( + SELECT t.l2_block_num AS block_num + , t.hash AS tx_hash + , r.tx_index AS current_index + , (ROW_NUMBER() OVER (PARTITION BY t.l2_block_num ORDER BY r.tx_index))-1 AS correct_index + FROM state.receipt r + INNER JOIN state."transaction" t + ON t.hash = r.tx_hash +) +UPDATE state.receipt AS r + SET tx_index = m.correct_index + FROM map_fix_tx_index m + WHERE m.block_num = r.block_num + AND m.tx_hash = r.tx_hash + AND m.current_index = r.tx_index + AND m.current_index != m.correct_index; + + +-- +migrate Down + +-- no action is needed, the data fixed by the +-- migrate up must remain fixed \ No newline at end of file diff --git a/db/migrations/state/0019_test.go b/db/migrations/state/0019_test.go new file mode 100644 index 0000000000..7205998d60 --- /dev/null +++ b/db/migrations/state/0019_test.go @@ -0,0 +1,145 @@ +package migrations_test + +import ( + "database/sql" + "testing" + + "github.com/0xPolygonHermez/zkevm-node/hex" + "github.com/ethereum/go-ethereum/common" + "github.com/stretchr/testify/require" +) + +type migrationTest0019TestCase struct { + Name string + Block migrationTest0019TestCaseBlock +} + +type migrationTest0019TestCaseBlock struct { + Transactions []migrationTest0019TestCaseTransaction +} + +type migrationTest0019TestCaseTransaction struct { + CurrentIndex uint +} + +type migrationTest0019 struct { + TestCases []migrationTest0019TestCase +} + +func (m migrationTest0019) InsertData(db *sql.DB) error { + const addBlock0 = "INSERT INTO state.block (block_num, received_at, block_hash) VALUES (0, now(), '0x0')" + if _, err := db.Exec(addBlock0); err != nil { + return err + } + + const addBatch0 = ` + INSERT INTO state.batch (batch_num, global_exit_root, local_exit_root, acc_input_hash, state_root, timestamp, coinbase, raw_txs_data, forced_batch_num, wip) + VALUES (0,'0x0000', '0x0000', '0x0000', '0x0000', now(), '0x0000', null, null, true)` + if _, err := db.Exec(addBatch0); err != nil { + return err + } + + const addL2Block = "INSERT INTO state.l2block (block_num, block_hash, header, uncles, parent_hash, state_root, received_at, batch_num, created_at) VALUES ($1, $2, '{}', '{}', '0x0', '0x0', now(), 0, now())" + const addTransaction = "INSERT INTO state.transaction (hash, encoded, decoded, l2_block_num, effective_percentage, l2_hash) VALUES ($1, 'ABCDEF', '{}', $2, 255, $1)" + const addReceipt = "INSERT INTO state.receipt (tx_hash, type, post_state, status, cumulative_gas_used, gas_used, effective_gas_price, block_num, tx_index, contract_address) VALUES ($1, 1, null, 1, 1234, 1234, 1, $2, $3, '')" + + txUnique := 0 + for tci, testCase := range m.TestCases { + blockNum := uint64(tci + 1) + blockHash := common.HexToHash(hex.EncodeUint64(blockNum)).String() + if _, err := db.Exec(addL2Block, blockNum, blockHash); err != nil { + return err + } + for _, tx := range testCase.Block.Transactions { + txUnique++ + txHash := common.HexToHash(hex.EncodeUint64(uint64(txUnique))).String() + if _, err := db.Exec(addTransaction, txHash, blockNum); err != nil { + return err + } + if _, err := db.Exec(addReceipt, txHash, blockNum, tx.CurrentIndex); err != nil { + return err + } + } + } + + return nil +} + +func (m migrationTest0019) RunAssertsAfterMigrationUp(t *testing.T, db *sql.DB) { + const getReceiptsByBlock = "SELECT r.tx_index FROM state.receipt r WHERE r.block_num = $1 ORDER BY r.tx_index" + + for tci := range m.TestCases { + blockNum := uint64(tci + 1) + + rows, err := db.Query(getReceiptsByBlock, blockNum) + require.NoError(t, err) + + var expectedIndex = uint(0) + var txIndex uint + for rows.Next() { + err := rows.Scan(&txIndex) + require.NoError(t, err) + require.Equal(t, expectedIndex, txIndex) + expectedIndex++ + } + } +} + +func (m migrationTest0019) RunAssertsAfterMigrationDown(t *testing.T, db *sql.DB) { + m.RunAssertsAfterMigrationUp(t, db) +} + +func TestMigration0019(t *testing.T) { + runMigrationTest(t, 19, migrationTest0019{ + TestCases: []migrationTest0019TestCase{ + { + Name: "single tx with correct index", + Block: migrationTest0019TestCaseBlock{ + Transactions: []migrationTest0019TestCaseTransaction{ + {CurrentIndex: 0}, + }, + }, + }, + { + Name: "multiple txs indexes are correct", + Block: migrationTest0019TestCaseBlock{ + Transactions: []migrationTest0019TestCaseTransaction{ + {CurrentIndex: 0}, + {CurrentIndex: 1}, + {CurrentIndex: 2}, + }, + }, + }, + { + Name: "single tx with wrong tx index", + Block: migrationTest0019TestCaseBlock{ + Transactions: []migrationTest0019TestCaseTransaction{ + {CurrentIndex: 3}, + }, + }, + }, + { + Name: "multiple txs missing 0 index", + Block: migrationTest0019TestCaseBlock{ + Transactions: []migrationTest0019TestCaseTransaction{ + {CurrentIndex: 1}, + {CurrentIndex: 2}, + {CurrentIndex: 3}, + {CurrentIndex: 4}, + }, + }, + }, + { + Name: "multiple has index 0 but also txs index gap", + Block: migrationTest0019TestCaseBlock{ + Transactions: []migrationTest0019TestCaseTransaction{ + {CurrentIndex: 0}, + {CurrentIndex: 2}, + {CurrentIndex: 4}, + {CurrentIndex: 6}, + }, + }, + }, + }, + }) +} diff --git a/db/migrations/state/0020.sql b/db/migrations/state/0020.sql new file mode 100644 index 0000000000..1068b6f8da --- /dev/null +++ b/db/migrations/state/0020.sql @@ -0,0 +1,28 @@ +-- +migrate Up + +-- This migration will delete all empty blocks +DELETE FROM state.block +WHERE NOT EXISTS (SELECT * + FROM state.virtual_batch + WHERE state.virtual_batch.block_num = state.block.block_num) + AND NOT EXISTS (SELECT * + FROM state.verified_batch + WHERE state.verified_batch.block_num = state.block.block_num) + AND NOT EXISTS (SELECT * + FROM state.forced_batch + WHERE state.forced_batch.block_num = state.block.block_num) + AND NOT EXISTS (SELECT * + FROM state.exit_root + WHERE state.exit_root.block_num = state.block.block_num) + AND NOT EXISTS (SELECT * + FROM state.monitored_txs + WHERE state.monitored_txs.block_num = state.block.block_num) + AND NOT EXISTS (SELECT * + FROM state.fork_id + WHERE state.fork_id.block_num = state.block.block_num); + + + +-- +migrate Down + +-- no action is needed, the data must remain deleted as it is useless \ No newline at end of file diff --git a/db/migrations/state/0020_test.go b/db/migrations/state/0020_test.go new file mode 100644 index 0000000000..e58ea23381 --- /dev/null +++ b/db/migrations/state/0020_test.go @@ -0,0 +1,99 @@ +package migrations_test + +import ( + "database/sql" + "fmt" + "testing" + + "github.com/stretchr/testify/assert" +) + +// this migration changes length of the token name +type migrationTest0020 struct{} + +func (m migrationTest0020) InsertData(db *sql.DB) error { + addBlocks := ` + INSERT INTO state.block + (block_num, block_hash, parent_hash, received_at, checked) + VALUES(1, '0x013be63487a53c874614dd1ae0434cf211e393b2e386c8fde74da203b5469b20', '0x0328698ebeda498df8c63040e2a4771d24722ab2c1e8291226b9215c7eec50fe', '2024-03-11 02:52:23.000', true); + INSERT INTO state.block + (block_num, block_hash, parent_hash, received_at, checked) + VALUES(2, '0x013be63487a53c874614dd1ae0434cf211e393b2e386c8fde74da203b5469b21', '0x0328698ebeda498df8c63040e2a4771d24722ab2c1e8291226b9215c7eec50f1', '2024-03-11 02:52:24.000', true); + INSERT INTO state.block + (block_num, block_hash, parent_hash, received_at, checked) + VALUES(3, '0x013be63487a53c874614dd1ae0434cf211e393b2e386c8fde74da203b5469b22', '0x0328698ebeda498df8c63040e2a4771d24722ab2c1e8291226b9215c7eec50f2', '2024-03-11 02:52:25.000', false); + INSERT INTO state.block + (block_num, block_hash, parent_hash, received_at, checked) + VALUES(4, '0x013be63487a53c874614dd1ae0434cf211e393b2e386c8fde74da203b5469b23', '0x0328698ebeda498df8c63040e2a4771d24722ab2c1e8291226b9215c7eec50f3', '2024-03-11 02:52:26.000', false); + INSERT INTO state.block + (block_num, block_hash, parent_hash, received_at, checked) + VALUES(5, '0x013be63487a53c874614dd1ae0434cf211e393b2e386c8fde74da203b5469b24', '0x0328698ebeda498df8c63040e2a4771d24722ab2c1e8291226b9215c7eec50f4', '2024-03-11 02:52:27.000', true); + INSERT INTO state.block + (block_num, block_hash, parent_hash, received_at, checked) + VALUES(6, '0x013be63487a53c874614dd1ae0434cf211e393b2e386c8fde74da203b5469b25', '0x0328698ebeda498df8c63040e2a4771d24722ab2c1e8291226b9215c7eec50f5', '2024-03-11 02:52:28.000', true); + INSERT INTO state.block + (block_num, block_hash, parent_hash, received_at, checked) + VALUES(7, '0x013be63487a53c874614dd1ae0434cf211e393b2e386c8fde74da203b5469b26', '0x0328698ebeda498df8c63040e2a4771d24722ab2c1e8291226b9215c7eec50f6', '2024-03-11 02:52:29.000', true); + INSERT INTO state.block + (block_num, block_hash, parent_hash, received_at, checked) + VALUES(8, '0x013be63487a53c874614dd1ae0434cf211e393b2e386c8fde74da203b5469b27', '0x0328698ebeda498df8c63040e2a4771d24722ab2c1e8291226b9215c7eec50f7', '2024-03-11 02:52:30.000', true); + INSERT INTO state.block + (block_num, block_hash, parent_hash, received_at, checked) + VALUES(9, '0x013be63487a53c874614dd1ae0434cf211e393b2e386c8fde74da203b5469b28', '0x0328698ebeda498df8c63040e2a4771d24722ab2c1e8291226b9215c7eec50f8', '2024-03-11 02:52:31.000', true); + INSERT INTO state.block + (block_num, block_hash, parent_hash, received_at, checked) + VALUES(10, '0x013be63487a53c874614dd1ae0434cf211e393b2e386c8fde74da203b5469b29', '0x0328698ebeda498df8c63040e2a4771d24722ab2c1e8291226b9215c7eec50f9', '2024-03-11 02:52:32.000', true); + INSERT INTO state.block + (block_num, block_hash, parent_hash, received_at, checked) + VALUES(11, '0x013be63487a53c874614dd1ae0434cf211e393b2e386c8fde74da203b5469b2a', '0x0328698ebeda498df8c63040e2a4771d24722ab2c1e8291226b9215c7eec50fa', '2024-03-11 02:52:33.000', true); + INSERT INTO state.batch + (batch_num, global_exit_root, local_exit_root, state_root, acc_input_hash, "timestamp", coinbase, raw_txs_data, forced_batch_num, batch_resources, closing_reason, wip, checked) + VALUES(1, '0x0000000000000000000000000000000000000000000000000000000000000000', '0x0000000000000000000000000000000000000000000000000000000000000000', '0x3f86b09b43e3e49a41fc20a07579b79eba044253367817d5c241d23c0e2bc5c9', '0xa5bd7311fe00707809dd3aa718be2ea0cb363626b9db44172098515f07acf940', '2023-03-24 16:35:27.000', '0x148Ee7dAF16574cD020aFa34CC658f8F3fbd2800', decode('','hex'), NULL, '{"Bytes": 0, "ZKCounters": {"GasUsed": 0, "UsedSteps": 0, "UsedBinaries": 0, "UsedMemAligns": 0, "UsedArithmetics": 0, "UsedKeccakHashes": 0, "UsedPoseidonHashes": 0, "UsedSha256Hashes_V2": 0, "UsedPoseidonPaddings": 0}}'::jsonb, '', false, true); + INSERT INTO state.virtual_batch + (batch_num, tx_hash, coinbase, block_num, sequencer_addr, timestamp_batch_etrog, l1_info_root) + VALUES(1, '0x4314ed5d8ad4812e88895942b2b4642af176d80a97c5489a16a7a5aeb08b51a6', '0x148Ee7dAF16574cD020aFa34CC658f8F3fbd2800', 2, '0x148Ee7dAF16574cD020aFa34CC658f8F3fbd2800', '2024-04-09 16:26:45.000', '0xcdb4258d7ccd8fd41c4a26fd8d9d1fadbc9c506e64d489170525a65e2ad3580b'); + INSERT INTO state.verified_batch + (batch_num, tx_hash, aggregator, state_root, block_num, is_trusted) + VALUES(1, '0x28e82f15ab7bac043598623c65a838c315d00ecb5d6e013c406d6bb889680592', '0x6329Fe417621925C81c16F9F9a18c203C21Af7ab', '0x80bd488b1e150b9b42611d038c7fdfa43a3e95b3a02e5c2d57074e73b583f8fd', 3, true); + INSERT INTO state.fork_id + (fork_id, from_batch_num, to_batch_num, "version", block_num) + VALUES(5, 813267, 1228916, 'v2.0.0-RC1-fork.5', 5); + INSERT INTO state.monitored_txs + ("owner", id, from_addr, to_addr, nonce, value, "data", gas, gas_price, status, history, block_num, created_at, updated_at, gas_offset) + VALUES('sequencer', 'sequence-from-2006249-to-2006252', '0x148Ee7dAF16574cD020aFa34CC658f8F3fbd2800', '0x519E42c24163192Dca44CD3fBDCEBF6be9130987', 58056, NULL, 'def57e540000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000006614ec3100000000000000000000000000000000000000000000000000000000001e9ce8000000000000000000000000148ee7da0000000300000000ee8306089a84ae0baa0082520894417a7ba2d8d0060ae6c54fd098590db854b9c1d58609184e72a0008082044d80802787e068e6fe23cda64eb868cefb7231a17449d508a77919f6c5408814aaab5f259d43a62eb50df0b2d5740552d3f95176a1f0e31cade590facf70b01c1129151bab0b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000000000000000000000000000000', 1474265, 25212431373, 'done', '{0x44423d538d6fc2f2e882fcd0d1952a735d81c824827b83936e6a5e52268a7d8e}', 7, '2024-04-09 09:26:36.235', '2024-04-09 09:38:24.377', 150000); + INSERT INTO state.exit_root + (id, block_num, "timestamp", mainnet_exit_root, rollup_exit_root, global_exit_root, prev_block_hash, l1_info_root, l1_info_tree_index) + VALUES(379599, 8, '2024-04-09 09:43:59.000', decode('C90DCBC69719971625800AD619E5EEEFD0378317E26F0DDE9B30B3C7C84DBD78','hex'), decode('514D72BBF7C2AD8E4D15EC1186EBF077E98208479651B1C30C5AC7DA11BAB209','hex'), decode('B20FACBED4A2774CE33A0F68D9B6F9B4D9AD553DACD73705503910B141D2102E','hex'), decode('845E01F723E5C77DBE5A4889F299860FBECD8353BFD423D366851F3A90496334','hex'), decode('EDB0EF9C80E947C411FD9B8B23318708132F8A3BD15CD366499866EF91748FC8','hex'), 8032); + INSERT INTO state.forced_batch + (block_num, forced_batch_num, global_exit_root, timestamp, raw_txs_data, coinbase) + VALUES(10, 1, '0x3f86b09b43e3e49a41fc20a07579b79eba044253367817d5c241d23c0e2bc5ca', '2024-04-09 09:26:36.235', '0x3f86b09b', '0x3f86b09b43e3e49a41fc20a07579b79eba044253367817d5c241d23c0e2bc5c9'); + ` + if _, err := db.Exec(addBlocks); err != nil { + return err + } + blockCount := `SELECT count(*) FROM state.block` + var count int + err := db.QueryRow(blockCount).Scan(&count) + if err != nil { + return err + } + if count != 11 { + return fmt.Errorf("error: initial wrong number of blocks") + } + return nil +} + +func (m migrationTest0020) RunAssertsAfterMigrationUp(t *testing.T, db *sql.DB) { + blockCount := `SELECT count(*) FROM state.block` + var count int + err := db.QueryRow(blockCount).Scan(&count) + assert.NoError(t, err) + assert.Equal(t, 6, count) +} + +func (m migrationTest0020) RunAssertsAfterMigrationDown(t *testing.T, db *sql.DB) { +} + +func TestMigration0020(t *testing.T) { + runMigrationTest(t, 20, migrationTest0020{}) +} diff --git a/docs/config-file/node-config-doc.html b/docs/config-file/node-config-doc.html index 34bd2d4ed1..e21ad83563 100644 --- a/docs/config-file/node-config-doc.html +++ b/docs/config-file/node-config-doc.html @@ -16,7 +16,7 @@
"300ms"
 

Default: 500Type: number

MaxRequestsPerIPAndSecond defines how much requests a single IP can
send within a single second


Default: ""Type: string

SequencerNodeURI is used allow Non-Sequencer nodes
to relay transactions to the Sequencer node


Default: 0Type: integer

MaxCumulativeGasUsed is the max gas allowed per batch


WebSockets configuration
Default: trueType: boolean

Enabled defines if the WebSocket requests are enabled or disabled


Default: "0.0.0.0"Type: string

Host defines the network adapter that will be used to serve the WS requests


Default: 8546Type: integer

Port defines the port to serve the endpoints via WS


Default: 104857600Type: integer

ReadLimit defines the maximum size of a message read from the client (in bytes)


Default: trueType: boolean

EnableL2SuggestedGasPricePolling enables polling of the L2 gas price to block tx in the RPC with lower gas price.


Default: falseType: boolean

BatchRequestsEnabled defines if the Batch requests are enabled or disabled


Default: 20Type: integer

BatchRequestsLimit defines the limit of requests that can be incorporated into each batch request


Type: array of integer

L2Coinbase defines which address is going to receive the fees

Must contain a minimum of 20 items

Must contain a maximum of 20 items

Each item of this array must be:


Default: 10000Type: integer

MaxLogsCount is a configuration to set the max number of logs that can be returned
in a single call to the state, if zero it means no limit


Default: 10000Type: integer

MaxLogsBlockRange is a configuration to set the max range for block number when querying TXs
logs in a single call to the state, if zero it means no limit


Default: 60000Type: integer

MaxNativeBlockHashBlockRange is a configuration to set the max range for block number when querying
native block hashes in a single call to the state, if zero it means no limit


Default: trueType: boolean

EnableHttpLog allows the user to enable or disable the logs related to the HTTP
requests to be captured by the server.


ZKCountersLimits defines the ZK Counter limits
Default: 0Type: integer

Default: 0Type: integer

Default: 0Type: integer

Default: 0Type: integer

Default: 0Type: integer

Default: 0Type: integer

Default: 0Type: integer

Default: 0Type: integer

Configuration of service `Syncrhonizer`. For this service is also really important the value of `IsTrustedSequencer` because depending of this values is going to ask to a trusted node for trusted transactions or not
Default: "1s"Type: string

SyncInterval is the delay interval between reading new rollup information


Examples:

"1m"
 
"300ms"
-

Default: 100Type: integer

SyncChunkSize is the number of blocks to sync on each chunk


Default: ""Type: string

TrustedSequencerURL is the rpc url to connect and sync the trusted state


Default: "safe"Type: string

SyncBlockProtection specify the state to sync (lastest, finalized or safe)


Default: trueType: boolean

L1SyncCheckL2BlockHash if is true when a batch is closed is force to check L2Block hash against trustedNode (only apply for permissionless)


Default: 30Type: integer

L1SyncCheckL2BlockNumberhModulus is the modulus used to choose the l2block to check
a modules 5, for instance, means check all l2block multiples of 5 (10,15,20,...)


Default: "sequential"Type: enum (of string)

L1SynchronizationMode define how to synchronize with L1:
- parallel: Request data to L1 in parallel, and process sequentially. The advantage is that executor is not blocked waiting for L1 data
- sequential: Request data to L1 and execute

Must be one of:

  • "sequential"
  • "parallel"

L1ParallelSynchronization Configuration for parallel mode (if L1SynchronizationMode equal to 'parallel')
Default: 10Type: integer

MaxClients Number of clients used to synchronize with L1


Default: 25Type: integer

MaxPendingNoProcessedBlocks Size of the buffer used to store rollup information from L1, must be >= to NumberOfEthereumClientsToSync
sugested twice of NumberOfParallelOfEthereumClients


Default: "5s"Type: string

RequestLastBlockPeriod is the time to wait to request the
last block to L1 to known if we need to retrieve more data.
This value only apply when the system is synchronized


Examples:

"1m"
+

Default: 100Type: integer

SyncChunkSize is the number of blocks to sync on each chunk


Default: ""Type: string

TrustedSequencerURL is the rpc url to connect and sync the trusted state


Default: "safe"Type: string

SyncBlockProtection specify the state to sync (lastest, finalized or safe)


Default: trueType: boolean

L1SyncCheckL2BlockHash if is true when a batch is closed is force to check L2Block hash against trustedNode (only apply for permissionless)


Default: 600Type: integer

L1SyncCheckL2BlockNumberhModulus is the modulus used to choose the l2block to check
a modules 5, for instance, means check all l2block multiples of 5 (10,15,20,...)


Default: trueType: boolean

Enable if is true then the check l1 Block Hash is active


Default: "finalized"Type: enum (of string)

L1SafeBlockPoint is the point that a block is considered safe enough to be checked
it can be: finalized, safe,pending or latest

Must be one of:

  • "finalized"
  • "safe"
  • "latest"

Default: 0Type: integer

L1SafeBlockOffset is the offset to add to L1SafeBlockPoint as a safe point
it can be positive or negative
Example: L1SafeBlockPoint= finalized, L1SafeBlockOffset= -10, then the safe block ten blocks before the finalized block


Default: trueType: boolean

ForceCheckBeforeStart if is true then the first time the system is started it will force to check all pending blocks


Default: trueType: boolean

PreCheckEnable if is true then the pre-check is active, will check blocks between L1SafeBlock and L1PreSafeBlock


Default: "safe"Type: enum (of string)

L1PreSafeBlockPoint is the point that a block is considered safe enough to be checked
it can be: finalized, safe,pending or latest

Must be one of:

  • "finalized"
  • "safe"
  • "latest"

Default: 0Type: integer

L1PreSafeBlockOffset is the offset to add to L1PreSafeBlockPoint as a safe point
it can be positive or negative
Example: L1PreSafeBlockPoint= finalized, L1PreSafeBlockOffset= -10, then the safe block ten blocks before the finalized block


Default: "sequential"Type: enum (of string)

L1SynchronizationMode define how to synchronize with L1:
- parallel: Request data to L1 in parallel, and process sequentially. The advantage is that executor is not blocked waiting for L1 data
- sequential: Request data to L1 and execute

Must be one of:

  • "sequential"
  • "parallel"

L1ParallelSynchronization Configuration for parallel mode (if L1SynchronizationMode equal to 'parallel')
Default: 10Type: integer

MaxClients Number of clients used to synchronize with L1


Default: 25Type: integer

MaxPendingNoProcessedBlocks Size of the buffer used to store rollup information from L1, must be >= to NumberOfEthereumClientsToSync
sugested twice of NumberOfParallelOfEthereumClients


Default: "5s"Type: string

RequestLastBlockPeriod is the time to wait to request the
last block to L1 to known if we need to retrieve more data.
This value only apply when the system is synchronized


Examples:

"1m"
 
"300ms"
 

Consumer Configuration for the consumer of rollup information from L1
Default: "5s"Type: string

AceptableInacctivityTime is the expected maximum time that the consumer
could wait until new data is produced. If the time is greater it emmit a log to warn about
that. The idea is keep working the consumer as much as possible, so if the producer is not
fast enought then you could increse the number of parallel clients to sync with L1


Examples:

"1m"
 
"300ms"
diff --git a/docs/config-file/node-config-doc.md b/docs/config-file/node-config-doc.md
index 046008f0af..925ac0f95c 100644
--- a/docs/config-file/node-config-doc.md
+++ b/docs/config-file/node-config-doc.md
@@ -1342,6 +1342,7 @@ because depending of this values is going to ask to a trusted node for trusted t
 | - [SyncBlockProtection](#Synchronizer_SyncBlockProtection )                           | No      | string           | No         | -          | SyncBlockProtection specify the state to sync (lastest, finalized or safe)                                                                                                                                                                              |
 | - [L1SyncCheckL2BlockHash](#Synchronizer_L1SyncCheckL2BlockHash )                     | No      | boolean          | No         | -          | L1SyncCheckL2BlockHash if is true when a batch is closed is force to check  L2Block hash against trustedNode (only apply for permissionless)                                                                                                            |
 | - [L1SyncCheckL2BlockNumberhModulus](#Synchronizer_L1SyncCheckL2BlockNumberhModulus ) | No      | integer          | No         | -          | L1SyncCheckL2BlockNumberhModulus is the modulus used to choose the l2block to check
a modules 5, for instance, means check all l2block multiples of 5 (10,15,20,...) | +| - [L1BlockCheck](#Synchronizer_L1BlockCheck ) | No | object | No | - | - | | - [L1SynchronizationMode](#Synchronizer_L1SynchronizationMode ) | No | enum (of string) | No | - | L1SynchronizationMode define how to synchronize with L1:
- parallel: Request data to L1 in parallel, and process sequentially. The advantage is that executor is not blocked waiting for L1 data
- sequential: Request data to L1 and execute | | - [L1ParallelSynchronization](#Synchronizer_L1ParallelSynchronization ) | No | object | No | - | L1ParallelSynchronization Configuration for parallel mode (if L1SynchronizationMode equal to 'parallel') | | - [L2Synchronization](#Synchronizer_L2Synchronization ) | No | object | No | - | L2Synchronization Configuration for L2 synchronization | @@ -1432,18 +1433,146 @@ L1SyncCheckL2BlockHash=true **Type:** : `integer` -**Default:** `30` +**Default:** `600` **Description:** L1SyncCheckL2BlockNumberhModulus is the modulus used to choose the l2block to check a modules 5, for instance, means check all l2block multiples of 5 (10,15,20,...) -**Example setting the default value** (30): +**Example setting the default value** (600): ``` [Synchronizer] -L1SyncCheckL2BlockNumberhModulus=30 +L1SyncCheckL2BlockNumberhModulus=600 ``` -### 9.7. `Synchronizer.L1SynchronizationMode` +### 9.7. `[Synchronizer.L1BlockCheck]` + +**Type:** : `object` + +| Property | Pattern | Type | Deprecated | Definition | Title/Description | +| ---------------------------------------------------------------------------- | ------- | ---------------- | ---------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| - [Enable](#Synchronizer_L1BlockCheck_Enable ) | No | boolean | No | - | Enable if is true then the check l1 Block Hash is active | +| - [L1SafeBlockPoint](#Synchronizer_L1BlockCheck_L1SafeBlockPoint ) | No | enum (of string) | No | - | L1SafeBlockPoint is the point that a block is considered safe enough to be checked
it can be: finalized, safe,pending or latest | +| - [L1SafeBlockOffset](#Synchronizer_L1BlockCheck_L1SafeBlockOffset ) | No | integer | No | - | L1SafeBlockOffset is the offset to add to L1SafeBlockPoint as a safe point
it can be positive or negative
Example: L1SafeBlockPoint= finalized, L1SafeBlockOffset= -10, then the safe block ten blocks before the finalized block | +| - [ForceCheckBeforeStart](#Synchronizer_L1BlockCheck_ForceCheckBeforeStart ) | No | boolean | No | - | ForceCheckBeforeStart if is true then the first time the system is started it will force to check all pending blocks | +| - [PreCheckEnable](#Synchronizer_L1BlockCheck_PreCheckEnable ) | No | boolean | No | - | PreCheckEnable if is true then the pre-check is active, will check blocks between L1SafeBlock and L1PreSafeBlock | +| - [L1PreSafeBlockPoint](#Synchronizer_L1BlockCheck_L1PreSafeBlockPoint ) | No | enum (of string) | No | - | L1PreSafeBlockPoint is the point that a block is considered safe enough to be checked
it can be: finalized, safe,pending or latest | +| - [L1PreSafeBlockOffset](#Synchronizer_L1BlockCheck_L1PreSafeBlockOffset ) | No | integer | No | - | L1PreSafeBlockOffset is the offset to add to L1PreSafeBlockPoint as a safe point
it can be positive or negative
Example: L1PreSafeBlockPoint= finalized, L1PreSafeBlockOffset= -10, then the safe block ten blocks before the finalized block | + +#### 9.7.1. `Synchronizer.L1BlockCheck.Enable` + +**Type:** : `boolean` + +**Default:** `true` + +**Description:** Enable if is true then the check l1 Block Hash is active + +**Example setting the default value** (true): +``` +[Synchronizer.L1BlockCheck] +Enable=true +``` + +#### 9.7.2. `Synchronizer.L1BlockCheck.L1SafeBlockPoint` + +**Type:** : `enum (of string)` + +**Default:** `"finalized"` + +**Description:** L1SafeBlockPoint is the point that a block is considered safe enough to be checked +it can be: finalized, safe,pending or latest + +**Example setting the default value** ("finalized"): +``` +[Synchronizer.L1BlockCheck] +L1SafeBlockPoint="finalized" +``` + +Must be one of: +* "finalized" +* "safe" +* "latest" + +#### 9.7.3. `Synchronizer.L1BlockCheck.L1SafeBlockOffset` + +**Type:** : `integer` + +**Default:** `0` + +**Description:** L1SafeBlockOffset is the offset to add to L1SafeBlockPoint as a safe point +it can be positive or negative +Example: L1SafeBlockPoint= finalized, L1SafeBlockOffset= -10, then the safe block ten blocks before the finalized block + +**Example setting the default value** (0): +``` +[Synchronizer.L1BlockCheck] +L1SafeBlockOffset=0 +``` + +#### 9.7.4. `Synchronizer.L1BlockCheck.ForceCheckBeforeStart` + +**Type:** : `boolean` + +**Default:** `true` + +**Description:** ForceCheckBeforeStart if is true then the first time the system is started it will force to check all pending blocks + +**Example setting the default value** (true): +``` +[Synchronizer.L1BlockCheck] +ForceCheckBeforeStart=true +``` + +#### 9.7.5. `Synchronizer.L1BlockCheck.PreCheckEnable` + +**Type:** : `boolean` + +**Default:** `true` + +**Description:** PreCheckEnable if is true then the pre-check is active, will check blocks between L1SafeBlock and L1PreSafeBlock + +**Example setting the default value** (true): +``` +[Synchronizer.L1BlockCheck] +PreCheckEnable=true +``` + +#### 9.7.6. `Synchronizer.L1BlockCheck.L1PreSafeBlockPoint` + +**Type:** : `enum (of string)` + +**Default:** `"safe"` + +**Description:** L1PreSafeBlockPoint is the point that a block is considered safe enough to be checked +it can be: finalized, safe,pending or latest + +**Example setting the default value** ("safe"): +``` +[Synchronizer.L1BlockCheck] +L1PreSafeBlockPoint="safe" +``` + +Must be one of: +* "finalized" +* "safe" +* "latest" + +#### 9.7.7. `Synchronizer.L1BlockCheck.L1PreSafeBlockOffset` + +**Type:** : `integer` + +**Default:** `0` + +**Description:** L1PreSafeBlockOffset is the offset to add to L1PreSafeBlockPoint as a safe point +it can be positive or negative +Example: L1PreSafeBlockPoint= finalized, L1PreSafeBlockOffset= -10, then the safe block ten blocks before the finalized block + +**Example setting the default value** (0): +``` +[Synchronizer.L1BlockCheck] +L1PreSafeBlockOffset=0 +``` + +### 9.8. `Synchronizer.L1SynchronizationMode` **Type:** : `enum (of string)` @@ -1463,7 +1592,7 @@ Must be one of: * "sequential" * "parallel" -### 9.8. `[Synchronizer.L1ParallelSynchronization]` +### 9.9. `[Synchronizer.L1ParallelSynchronization]` **Type:** : `object` **Description:** L1ParallelSynchronization Configuration for parallel mode (if L1SynchronizationMode equal to 'parallel') @@ -1481,7 +1610,7 @@ Must be one of: | - [RollupInfoRetriesSpacing](#Synchronizer_L1ParallelSynchronization_RollupInfoRetriesSpacing ) | No | string | No | - | Duration | | - [FallbackToSequentialModeOnSynchronized](#Synchronizer_L1ParallelSynchronization_FallbackToSequentialModeOnSynchronized ) | No | boolean | No | - | FallbackToSequentialModeOnSynchronized if true switch to sequential mode if the system is synchronized | -#### 9.8.1. `Synchronizer.L1ParallelSynchronization.MaxClients` +#### 9.9.1. `Synchronizer.L1ParallelSynchronization.MaxClients` **Type:** : `integer` @@ -1495,7 +1624,7 @@ Must be one of: MaxClients=10 ``` -#### 9.8.2. `Synchronizer.L1ParallelSynchronization.MaxPendingNoProcessedBlocks` +#### 9.9.2. `Synchronizer.L1ParallelSynchronization.MaxPendingNoProcessedBlocks` **Type:** : `integer` @@ -1510,7 +1639,7 @@ sugested twice of NumberOfParallelOfEthereumClients MaxPendingNoProcessedBlocks=25 ``` -#### 9.8.3. `Synchronizer.L1ParallelSynchronization.RequestLastBlockPeriod` +#### 9.9.3. `Synchronizer.L1ParallelSynchronization.RequestLastBlockPeriod` **Title:** Duration @@ -1538,7 +1667,7 @@ This value only apply when the system is synchronized RequestLastBlockPeriod="5s" ``` -#### 9.8.4. `[Synchronizer.L1ParallelSynchronization.PerformanceWarning]` +#### 9.9.4. `[Synchronizer.L1ParallelSynchronization.PerformanceWarning]` **Type:** : `object` **Description:** Consumer Configuration for the consumer of rollup information from L1 @@ -1548,7 +1677,7 @@ RequestLastBlockPeriod="5s" | - [AceptableInacctivityTime](#Synchronizer_L1ParallelSynchronization_PerformanceWarning_AceptableInacctivityTime ) | No | string | No | - | Duration | | - [ApplyAfterNumRollupReceived](#Synchronizer_L1ParallelSynchronization_PerformanceWarning_ApplyAfterNumRollupReceived ) | No | integer | No | - | ApplyAfterNumRollupReceived is the number of iterations to
start checking the time waiting for new rollup info data | -##### 9.8.4.1. `Synchronizer.L1ParallelSynchronization.PerformanceWarning.AceptableInacctivityTime` +##### 9.9.4.1. `Synchronizer.L1ParallelSynchronization.PerformanceWarning.AceptableInacctivityTime` **Title:** Duration @@ -1577,7 +1706,7 @@ fast enought then you could increse the number of parallel clients to sync with AceptableInacctivityTime="5s" ``` -##### 9.8.4.2. `Synchronizer.L1ParallelSynchronization.PerformanceWarning.ApplyAfterNumRollupReceived` +##### 9.9.4.2. `Synchronizer.L1ParallelSynchronization.PerformanceWarning.ApplyAfterNumRollupReceived` **Type:** : `integer` @@ -1592,7 +1721,7 @@ start checking the time waiting for new rollup info data ApplyAfterNumRollupReceived=10 ``` -#### 9.8.5. `Synchronizer.L1ParallelSynchronization.RequestLastBlockTimeout` +#### 9.9.5. `Synchronizer.L1ParallelSynchronization.RequestLastBlockTimeout` **Title:** Duration @@ -1618,7 +1747,7 @@ ApplyAfterNumRollupReceived=10 RequestLastBlockTimeout="5s" ``` -#### 9.8.6. `Synchronizer.L1ParallelSynchronization.RequestLastBlockMaxRetries` +#### 9.9.6. `Synchronizer.L1ParallelSynchronization.RequestLastBlockMaxRetries` **Type:** : `integer` @@ -1632,7 +1761,7 @@ RequestLastBlockTimeout="5s" RequestLastBlockMaxRetries=3 ``` -#### 9.8.7. `Synchronizer.L1ParallelSynchronization.StatisticsPeriod` +#### 9.9.7. `Synchronizer.L1ParallelSynchronization.StatisticsPeriod` **Title:** Duration @@ -1658,7 +1787,7 @@ RequestLastBlockMaxRetries=3 StatisticsPeriod="5m0s" ``` -#### 9.8.8. `Synchronizer.L1ParallelSynchronization.TimeOutMainLoop` +#### 9.9.8. `Synchronizer.L1ParallelSynchronization.TimeOutMainLoop` **Title:** Duration @@ -1684,7 +1813,7 @@ StatisticsPeriod="5m0s" TimeOutMainLoop="5m0s" ``` -#### 9.8.9. `Synchronizer.L1ParallelSynchronization.RollupInfoRetriesSpacing` +#### 9.9.9. `Synchronizer.L1ParallelSynchronization.RollupInfoRetriesSpacing` **Title:** Duration @@ -1710,7 +1839,7 @@ TimeOutMainLoop="5m0s" RollupInfoRetriesSpacing="5s" ``` -#### 9.8.10. `Synchronizer.L1ParallelSynchronization.FallbackToSequentialModeOnSynchronized` +#### 9.9.10. `Synchronizer.L1ParallelSynchronization.FallbackToSequentialModeOnSynchronized` **Type:** : `boolean` @@ -1724,7 +1853,7 @@ RollupInfoRetriesSpacing="5s" FallbackToSequentialModeOnSynchronized=false ``` -### 9.9. `[Synchronizer.L2Synchronization]` +### 9.10. `[Synchronizer.L2Synchronization]` **Type:** : `object` **Description:** L2Synchronization Configuration for L2 synchronization @@ -1735,7 +1864,7 @@ FallbackToSequentialModeOnSynchronized=false | - [ReprocessFullBatchOnClose](#Synchronizer_L2Synchronization_ReprocessFullBatchOnClose ) | No | boolean | No | - | ReprocessFullBatchOnClose if is true when a batch is closed is force to reprocess again | | - [CheckLastL2BlockHashOnCloseBatch](#Synchronizer_L2Synchronization_CheckLastL2BlockHashOnCloseBatch ) | No | boolean | No | - | CheckLastL2BlockHashOnCloseBatch if is true when a batch is closed is force to check the last L2Block hash | -#### 9.9.1. `Synchronizer.L2Synchronization.AcceptEmptyClosedBatches` +#### 9.10.1. `Synchronizer.L2Synchronization.AcceptEmptyClosedBatches` **Type:** : `boolean` @@ -1750,7 +1879,7 @@ if true, the synchronizer will accept empty batches and process them. AcceptEmptyClosedBatches=false ``` -#### 9.9.2. `Synchronizer.L2Synchronization.ReprocessFullBatchOnClose` +#### 9.10.2. `Synchronizer.L2Synchronization.ReprocessFullBatchOnClose` **Type:** : `boolean` @@ -1764,7 +1893,7 @@ AcceptEmptyClosedBatches=false ReprocessFullBatchOnClose=false ``` -#### 9.9.3. `Synchronizer.L2Synchronization.CheckLastL2BlockHashOnCloseBatch` +#### 9.10.3. `Synchronizer.L2Synchronization.CheckLastL2BlockHashOnCloseBatch` **Type:** : `boolean` diff --git a/docs/config-file/node-config-schema.json b/docs/config-file/node-config-schema.json index 916aaf18b1..517a846e4f 100644 --- a/docs/config-file/node-config-schema.json +++ b/docs/config-file/node-config-schema.json @@ -530,7 +530,58 @@ "L1SyncCheckL2BlockNumberhModulus": { "type": "integer", "description": "L1SyncCheckL2BlockNumberhModulus is the modulus used to choose the l2block to check\na modules 5, for instance, means check all l2block multiples of 5 (10,15,20,...)", - "default": 30 + "default": 600 + }, + "L1BlockCheck": { + "properties": { + "Enable": { + "type": "boolean", + "description": "Enable if is true then the check l1 Block Hash is active", + "default": true + }, + "L1SafeBlockPoint": { + "type": "string", + "enum": [ + "finalized", + "safe", + "latest" + ], + "description": "L1SafeBlockPoint is the point that a block is considered safe enough to be checked\nit can be: finalized, safe,pending or latest", + "default": "finalized" + }, + "L1SafeBlockOffset": { + "type": "integer", + "description": "L1SafeBlockOffset is the offset to add to L1SafeBlockPoint as a safe point\nit can be positive or negative\nExample: L1SafeBlockPoint= finalized, L1SafeBlockOffset= -10, then the safe block ten blocks before the finalized block", + "default": 0 + }, + "ForceCheckBeforeStart": { + "type": "boolean", + "description": "ForceCheckBeforeStart if is true then the first time the system is started it will force to check all pending blocks", + "default": true + }, + "PreCheckEnable": { + "type": "boolean", + "description": "PreCheckEnable if is true then the pre-check is active, will check blocks between L1SafeBlock and L1PreSafeBlock", + "default": true + }, + "L1PreSafeBlockPoint": { + "type": "string", + "enum": [ + "finalized", + "safe", + "latest" + ], + "description": "L1PreSafeBlockPoint is the point that a block is considered safe enough to be checked\nit can be: finalized, safe,pending or latest", + "default": "safe" + }, + "L1PreSafeBlockOffset": { + "type": "integer", + "description": "L1PreSafeBlockOffset is the offset to add to L1PreSafeBlockPoint as a safe point\nit can be positive or negative\nExample: L1PreSafeBlockPoint= finalized, L1PreSafeBlockOffset= -10, then the safe block ten blocks before the finalized block", + "default": 0 + } + }, + "additionalProperties": false, + "type": "object" }, "L1SynchronizationMode": { "type": "string", diff --git a/docs/diff/diff.html b/docs/diff/diff.html index 178e9ca43f..f1e3ffa3b7 100644 --- a/docs/diff/diff.html +++ b/docs/diff/diff.html @@ -54,7 +54,7 @@

zkEVM node vs CDK validium node

zkevm-node version: v0.6.0

- Files changed (107) + Files changed (208) hide show
@@ -66,8 +66,8 @@

zkEVM node vs CDK validium node

zkevm-node version: v0.6.0

{/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/aggregator.go - +135 - -21 + +840 + -38 @@ -78,8 +78,44 @@

zkEVM node vs CDK validium node

zkevm-node version: v0.6.0

{/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/aggregator_test.go - +10 - -10 + +154 + -84 + + + +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/batch.go + + +0 + -427 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/blobinner.go + + +0 + -7 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/blobouter.go + + +0 + -11
  • @@ -95,6 +131,18 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/final.go + + +0 + -288 + + +
  • zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/interfaces.go - +2 - -1 + +9 + -8 + +
    +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/beacon_client/beacon_client.go + + +0 + -68 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/beacon_client/req_beacon_blob_sidecars.go + + +0 + -92 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/beacon_client/req_beacon_genesis.go + + +0 + -60 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/beacon_client/req_config_spec.go + + +0 + -64
  • @@ -150,8 +246,8 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/run.go - +158 - -18 + +140 + -29 @@ -198,8 +294,8 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/config/config_test.go - +12 - -6 + +13 + -7 @@ -210,8 +306,8 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/config/default.go - +6 - -0 + +7 + -2 @@ -294,7 +390,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/dataavailability.go - +139 + +152 -0 @@ -330,7 +426,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/interfaces.go - +58 + +60 -0 @@ -352,10 +448,10 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/state/0018.sql + {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/state/0013_test.go - +11 - -0 + +19 + -25 @@ -364,10 +460,94 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/state/0018_test.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/state/0019.sql - +69 - -0 + +19 + -75 + + + +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/state/0019_test.go + + +107 + -81 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/state/0021.sql + + +0 + -25 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/state/0021_test.go + + +0 + -145 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/state/0022.sql + + +0 + -12 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/state/0022_test.go + + +0 + -106 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/state/0023.sql + + +0 + -57 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/state/utils_test.go + + +0 + -159
  • @@ -395,6 +575,18 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/docker-compose.yml + + +1 + -1 + + +
  • zkevm-node version: v0.6.0

  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/config.go + + +0 + -2 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/eip4844/eip4844.go + + +0 + -86 + + +
  • zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/etherman.go - +198 - -145 + +407 + -332
  • @@ -438,8 +654,80 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/etherman_test.go - +40 - -31 + +51 + -40 + + + +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/events_helper.go + + +0 + -191 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/events_helper_test.go + + +0 + -180 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/feijoa_contracts.go + + +0 + -38 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/feijoa_event_sequence_blobs.go + + +0 + -173 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/feijoa_events.go + + +0 + -76 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/feijoa_events_test.go + + +0 + -17
  • @@ -450,7 +738,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/interfaces.go - +7 + +16 -0 @@ -462,11 +750,83 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/simulated.go - +26 + +51 + -25 + + + +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/types.go + + +4 + -5 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/ethtxmanager/ethtxmanager.go + + +4 + -33 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/ethtxmanager/ethtxmanager_test.go + + +8 + -8 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/ethtxmanager/interfaces.go + + +0 -2
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/ethtxmanager/pgstorage.go + + +0 + -44 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/ethtxmanager/pgstorage_test.go + + +0 + -66 + + +
  • zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/event/event.go - +5 + +3 -0
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/event/eventlog.go + + +25 + -1 + + +
  • zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/go.mod - +9 - -7 + +44 + -38
  • @@ -522,7 +894,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/client/zkevm.go - +29 + +40 -0 @@ -558,7 +930,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/endpoints_zkevm.go - +37 + +48 -1 @@ -606,7 +978,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/types/interfaces.go - +2 + +3 -1 @@ -630,8 +1002,68 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/l1infotree/tree.go - +20 - -1 + +0 + -5 + + + +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/l1infotree/tree_recursive.go + + +0 + -94 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/l1infotree/tree_recursive_test.go + + +0 + -113 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/merkletree/client.go + + +5 + -25 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/merkletree/tree.go + + +0 + -3 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/merkletree/tree_test.go + + +0 + -86
  • @@ -715,7 +1147,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/pool.go +13 - -1 + -2 @@ -726,8 +1158,8 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/pool_test.go - +66 - -0 + +67 + -1 @@ -737,6 +1169,30 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    viewBox="0 0 14 16" width="14"> {/home/stefan/go/src/Polygon/zkevm-node → .}/proto/src/proto/executor/v1/executor.proto + + +2 + -246 + + + +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencer/batch.go + + +8 + -4 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencer/datastreamer.go +1 -0 @@ -750,8 +1206,8 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencer/finalizer.go - +18 - -4 + +8 + -6
  • @@ -762,7 +1218,19 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencer/l2block.go - +2 + +12 + -1 + + + +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencer/sequencer.go + + +17 -0 @@ -798,8 +1266,8 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencesender/sequencesender.go - +15 - -104 + +18 + -107
  • @@ -815,6 +1283,30 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/sonar-project.properties + + +2 + -7 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/batch_pending.go + + +0 + -11 + + +
  • zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/state/batchV2.go - +3 - -0 + +12 + -19
  • @@ -832,9 +1324,117 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/state/block.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/batchV2_test.go - +1 + +2 + -2 + + + +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/batchV3.go + + +0 + -137 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/blob_inner_in.go + + +0 + -101 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/blob_inner_process.go + + +0 + -18 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/blob_inner_request.go + + +0 + -81 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/blob_inner_response.go + + +0 + -114 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/blob_sequences.go + + +0 + -69 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/convertersV2.go + + +0 + -1 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/convertersV3.go + + +0 + -79 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/datastream.go + + +2 -0 @@ -851,6 +1451,42 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/encoding_batch_v2.go + + +50 + -116 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/encoding_batch_v2_test.go + + +6 + -44 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/forkid.go + + +2 + -4 + + +
  • zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/state/helper.go - +0 - -2 + +3 + -5
  • @@ -882,7 +1518,43 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/state/interfaces.go - +5 + +12 + -24 + + + +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/l1infotree_recursive.go + + +0 + -83 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/l1infotree_test.go + + +4 + -11 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/batch.go + + +21 -1 @@ -892,10 +1564,10 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/state/l1infotree.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/batch_pending.go - +7 - -8 + +0 + -1
  • @@ -904,10 +1576,10 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/block.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/blob_inner_in.go - +39 - -8 + +0 + -41 @@ -916,13 +1588,61 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/l1infotree.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/blob_sequences.go + + +0 + -48 + + + +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/forkid_external_test.go + + +4 + -4 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/forkid_test.go +1 -1
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/l1infotree.go + + +27 + -66 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/l1infotree_recursive.go + + +0 + -46 + + +
  • zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/pgstatestorage.go - +81 - -3 + +84 + -0
  • @@ -942,8 +1662,32 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/pgstatestorage_test.go - +418 - -34 + +116 + -66 + + + +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/proof.go + + +54 + -35 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/transaction.go + + +4 + -10
  • @@ -954,8 +1698,8 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/state/reset.go - +9 - -7 + +0 + -2 @@ -966,8 +1710,8 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/state/runtime/executor/client.go - +7 - -0 + +11 + -26 @@ -976,10 +1720,10 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/state/trace.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/runtime/executor/errors.go - +9 - -1 + +0 + -143 @@ -988,9 +1732,57 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/state/transaction.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/runtime/instrumentation/tracers/native/gen_callframe_json.go - +8 + +2 + -2 + + + +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/runtime/runtime.go + + +0 + -66 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/state.go + + +5 + -7 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/syncinginfo_test.go + + +2 + -2 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/test/forkid_common/common.go + + +2 -6 @@ -1000,9 +1792,9 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/check_l2block.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/test/forkid_etrog/etrog_test.go - +8 + +3 -5 @@ -1012,10 +1804,10 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/check_l2block_test.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/trace.go - +21 - -15 + +10 + -2
  • @@ -1024,10 +1816,10 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/elderberry/processor_l1_sequence_batches.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/transaction.go - +5 - -52 + +7 + -3 @@ -1036,10 +1828,10 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/etrog/processor_l1_sequence_batches.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/types.go - +1 - -1 + +32 + -47 @@ -1048,10 +1840,10 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/common/syncinterfaces/state.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/elderberry/processor_l1_initial_sequence_batches.go - +2 - -0 + +3 + -3 @@ -1060,10 +1852,10 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/common/syncinterfaces/zkevm_ethereum_compatible_client.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/elderberry/processor_l1_sequence_batches.go - +21 - -0 + +8 + -55 @@ -1072,10 +1864,10 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/config.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/etrog/processor_l1_info_tree_update.go - +2 - -0 + +3 + -3 @@ -1084,7 +1876,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l1_parallel_sync/l1_worker_etherman_test.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/etrog/processor_l1_info_tree_update_test.go +1 -1 @@ -1096,10 +1888,10 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l2_sync/l2_sync_etrog/executor_trusted_batch_sync.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/etrog/processor_l1_sequence_batches.go +5 - -4 + -5
    @@ -1108,10 +1900,10 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l2_sync/l2_sync_incaberry/sync_trusted_state.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/etrog/processor_l1_sequence_batches_test.go - +1 - -0 + +2 + -2 @@ -1120,10 +1912,10 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/synchronizer.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/etrog/processor_l1_update_etrog_sequence.go - +131 - -47 + +3 + -3 @@ -1132,10 +1924,10 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/synchronizer_test.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/feijoa/processor_l1_info_tree_update.go - +43 - -23 + +0 + -54 @@ -1144,10 +1936,10 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/test/contracts/auto/CounterAndBlock.sol + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/feijoa/processor_l1_sequence_blobs.go - +15 - -0 + +0 + -189 @@ -1156,10 +1948,10 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/test/contracts/auto/customModExp.sol + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/feijoa/processor_l1_sequence_blobs_test.go - +24 - -0 + +0 + -102 @@ -1168,10 +1960,10 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/test/contracts/bin/CounterAndBlock/CounterAndBlock.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/forksids.go - +287 - -0 + +3 + -23 @@ -1180,10 +1972,10 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/test/contracts/bin/customModExp/customModExp.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/incaberry/processor_l1_forced_batches.go - +224 - -0 + +3 + -3 @@ -1192,10 +1984,10 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/test/contracts/bin/triggerErrors/triggerErrors.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/incaberry/processor_l1_forkid.go - +1 - -1 + +4 + -3 @@ -1204,9 +1996,9 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/test/docker-compose.yml + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/incaberry/processor_l1_global_exit_root.go - +53 + +3 -3 @@ -1216,10 +2008,10 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/datacommittee_test.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/incaberry/processor_l1_sequence_batches.go - +270 - -0 + +3 + -3 @@ -1228,9 +2020,9 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/forced_batches_test.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/incaberry/processor_l1_sequence_batches_test.go - +1 + +0 -1 @@ -1240,7 +2032,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/forced_batches_vector_shared.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/incaberry/processor_l1_sequence_force_batches.go +3 -3 @@ -1252,10 +2044,10 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/sc_test.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/incaberry/processor_l1_verify_batch.go - +103 - -0 + +3 + -3
    @@ -1264,10 +2056,10 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/state_test.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/processor_base.go - +2 - -2 + +6 + -16 @@ -1276,10 +2068,10 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/test/Makefile + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/common/syncinterfaces/block_range_processor.go - +47 - -5 + +0 + -21 @@ -1288,10 +2080,10 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/test/operations/manager.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/common/syncinterfaces/etherman.go - +21 - -1 + +0 + -6 @@ -1300,7 +2092,43 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/test/scripts/batchsender/main.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/common/syncinterfaces/l1_event_processor_manager.go + + +0 + -14 + + + +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/common/syncinterfaces/state.go + + +0 + -13 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/common/syncinterfaces/sync_pre_rollup_syncer.go + + +0 + -10 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/config.go +2 -2 @@ -1312,10 +2140,10 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/tools/genesis/genesisparser/genesisparser.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/default_l1processors.go - +6 - -6 + +0 + -2
  • @@ -1324,7 +2152,31 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/tools/state/main.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l1_parallel_sync/l1_rollup_info_consumer.go + + +11 + -5 + + + +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l1_parallel_sync/l1_rollup_info_consumer_test.go + + +7 + -7 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l1_parallel_sync/l1_worker_etherman_test.go +1 -1 @@ -1336,116 +2188,516 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    {/home/stefan/go/src/Polygon/zkevm-node → .}/tools/state/reprocess_cmd.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l2_sync/l2_sync_etrog/executor_trusted_batch_sync.go +1 - -1 + -0
  • - -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/aggregator.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l2_sync/l2_sync_incaberry/sync_trusted_state.go + + +1 + -0 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/synchronizer_block_range_process.go + + +0 + -166 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/synchronizer.go + + +90 + -104 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/synchronizer_pre_rollup.go + + +0 + -122 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/synchronizer_pre_rollup_test.go + + +0 + -89 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/synchronizer_test.go + + +21 + -17 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/contracts/auto/customModExp.sol + + +24 + -0 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/docker-compose.yml + + +55 + -11 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/datacommittee_test.go + + +270 + -0 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/forced_batches_test.go + + +6 + -6 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/forced_batches_vector_shared.go + + +2 + -2 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/jsonrpc1_test.go + + +13 + -14 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/shared.go + + +2 + -2 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/state_test.go + + +1 + -1 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/Makefile + + +66 + -44 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/operations/manager.go + + +22 + -6 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/scripts/batchsender/main.go + + +4 + -4 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/scripts/deploy_sc/main.go + + +6 + -0 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/scripts/hash_compare/main.go + + +0 + -124 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/scripts/hash_gen/main.go + + +0 + -188 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/scripts/http_ws_sync/main.go + + +0 + -161 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/scripts/sendForcedBatch/main.go + + +2 + -2 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/scripts/sequenceForcedBatch/main.go + + +5 + -5 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/tools/datastreamer/main.go + + +1 + -156 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/tools/datastreamer/Makefile + + +0 + -8 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/tools/egp/main.go + + +85 + -183 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/tools/executor/main.go + + +3 + -3 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/tools/rlp/main.go + + +1 + -1 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/tools/state/main.go + + +1 + -1 + + +
  • +
  • + + {/home/stefan/go/src/Polygon/zkevm-node → .}/tools/state/reprocess_cmd.go + + +2 + -2 + + +
  • + +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/aggregator.go + RENAMED + +
    +
    +
    +
    +
    -
    @@ -2,6 +2,7 @@
    -
    - 2 - -
    -   -
    -
    -
    - 3 - -
    -   - import ( -
    -
    - 4 - -
    -   - "context" -
    -
    - - -
    -   -
    -
    -
    - 5 - -
    -   - "encoding/json" -
    -
    - 6 - -
    -   - "errors" -
    -
    - 7 - -
    -   - "fmt" -
    -
    -
    @@ -67,6 +71,9 @@
    -
    - 67 -
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - + + + + + + @@ -2297,6 +3584,66 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0


    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - -
    +
    @@ -2,8 +2,11 @@
    +
    + 2 + +
    +   +
    +
    +
    + 3 + +
    +   + import ( +
    +
    + 4 + +
    +   + "context" +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 5 + +
    +   + "errors" +
    +
    + 6 + +
    +   + "fmt" +
    +
    + + +
    +   +
    +
    +
    + 7 + +
    +   + "net" +
    +
    + 8 + +
    +   + "strconv" +
    +
    + 9 + +
    +   + "strings" +
    +
    +
    @@ -64,6 +71,9 @@
    +
    + 64 +
      @@ -1454,7 +2706,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 68 + 65
    @@ -1464,7 +2716,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 69 + 66
    @@ -1504,7 +2756,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 70 + 67
    @@ -1514,7 +2766,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 71 + 68
    @@ -1524,7 +2776,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 72 + 69
    @@ -1535,11 +2787,11 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    @@ -75,6 +82,8 @@
    +
    @@ -72,6 +82,8 @@
    - 75 + 72
    @@ -1549,7 +2801,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 76 + 73
    @@ -1559,7 +2811,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 77 + 74
    @@ -1589,7 +2841,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 78 + 75
    @@ -1599,7 +2851,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 79 + 76
    @@ -1609,7 +2861,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 80 + 77
    @@ -1620,11 +2872,11 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    @@ -96,6 +105,9 @@
    +
    @@ -93,6 +105,9 @@
    - 96 + 93
    @@ -1634,7 +2886,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 97 + 94
    @@ -1644,7 +2896,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 98 + 95
    @@ -1684,7 +2936,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 99 + 96
    @@ -1694,7 +2946,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 100 + 97
    @@ -1704,7 +2956,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 101 + 98
    @@ -1715,316 +2967,351 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    @@ -269,34 +281,139 @@
    +
    @@ -116,7 +131,7 @@
    - 269 + 116
      -
    + }, nil)
    - 270 + 117
      - log.Infof("Final proof inputs: NewLocalExitRoot [%#x], NewStateRoot [%#x]", inputs.NewLocalExitRoot, inputs.NewStateRoot) +
    - 271 + 118
      -
    + // Delete ungenerated recursive proofs
    - 272 + 119
    - - // add batch verification to be monitored + err := a.State.DeleteUngeneratedBatchProofs(ctx, nil)
    - 273 + + 120 +
    - - - sender := common.HexToAddress(a.cfg.SenderAddress) +   + if err != nil {
    - 274 + + 121 +
    - - - to, data, err := a.Ethman.BuildTrustedVerifyBatchesTxData(proof.BatchNumber-1, proof.BatchNumberFinal, &inputs, sender) +   + return fmt.Errorf("failed to initialize proofs cache %w", err)
    - 275 + + 122 +
    - - - if err != nil { +   + }
    - 276 + +
    @@ -212,46 +227,819 @@
    +
    + 212 +
    - - - log.Errorf("Error estimating batch verification to add to eth tx manager: %v", err) +   + _, err = a.tryBuildFinalProof(ctx, prover, nil)
    - 277 + + 213 +
    - - - a.handleFailureToAddVerifyBatchToBeMonitored(ctx, proof) +   + if err != nil {
    - 278 + + 214 +
    - - - continue +   + log.Errorf("Error checking proofs to verify: %v", err)
    - 279 + + -
    - - - } +
    +
    +   +
    - 280 + + -
    - - - monitoredTxID := buildMonitoredTxID(proof.BatchNumber, proof.BatchNumberFinal) +
    +
    +   +
    - 281 + + -
    - - - err = a.EthTxManager.Add(ctx, ethTxManagerOwner, monitoredTxID, sender, to, nil, data, a.cfg.GasOffset, nil) +
    +
    +   +
    - 282 + + -
    - - - if err != nil { +
    +
    +   +
    - 283 + + -
    - - - mTxLogger := ethtxmanager.CreateLogger(ethTxManagerOwner, monitoredTxID, sender, to) +
    +
    +   +
    - 284 + + 215 +
    - - - mTxLogger.Errorf("Error to add batch verification tx to eth tx manager: %v", err) +   + }
    - 285 + + 216 +
    - - - a.handleFailureToAddVerifyBatchToBeMonitored(ctx, proof) +   +
    - 286 + + 217 +
    - - continue + proofGenerated, err := a.tryAggregateBlobOuterProofs(ctx, prover)
    - 287 + 218
      - } + if err != nil { +
    +
    + 219 + +
    + - + log.Errorf("Error trying to aggregate blobOuter proofs: %v", err)
    - 288 + 220
      -
    + }
    - 289 + 221
    - - // process monitored batch verifications before starting a next cycle +
    - 290 + + 222 +
    - - - a.EthTxManager.ProcessPendingMonitoredTxs(ctx, ethTxManagerOwner, func(result ethtxmanager.MonitoredTxResult, dbTx pgx.Tx) { +   + if !proofGenerated {
    - 291 + + 223 +
    - - a.handleMonitoredTxResult(result) + proofGenerated, err = a.tryGenerateBlobOuterProof(ctx, prover)
    - 292 + + 224 +
    - - - }, nil) +   + if err != nil {
    - 293 + + 225 +
    - -
    + log.Errorf("Error trying to generate blobOuter proofs: %v", err)
    - 294 + 226
      - a.resetVerifyProofTime() + }
    - 295 + 227
      - a.endProofVerification() + }
    - 296 + + 228 +
    -   - } + - +
    - 297 + 229
      - } + if !proofGenerated {
    - 298 + + 230 +
    -   - } + - + proofGenerated, err = a.tryGenerateBlobInnerProof(ctx, prover)
    - 299 + + 231 +
    -   -
    + - + if err != nil { +
    +
    + 232 + +
    + - + log.Errorf("Error trying to aggregate blobInner proofs: %v", err) +
    +
    + 233 + +
    + - + }
    + 234 + +
    +   + } +
    +
    + 235 + +
    +   +
    +
    +
    + 236 + +
    + - + if !proofGenerated { +
    +
    + 237 + +
    + - + proofGenerated, err = a.tryAggregateBatchProofs(ctx, prover) +
    +
    + 238 + +
    + - + if err != nil { +
    +
    + 239 + +
    + - + log.Errorf("Error trying to aggregate batch proofs: %v", err) +
    +
    @@ -2417,6 +3764,76 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0


    + 240 + +
    +   + } +
    +
    + 241 + +
    +   + } +
    +
    + 242 + +
    +   +
    +
    +
    + 243 + +
    + - + if !proofGenerated { +
    +
    + 244 + +
    + - + proofGenerated, err = a.tryGenerateBatchProof(ctx, prover) +
    +
    + 245 + +
    + - + if err != nil { +
    +
    + 246 + +
    + - + log.Errorf("Error trying to generate batch proof: %v", err) +
    +
    @@ -3188,592 +4605,553 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 300 + + -
    +
    +
      - func (a *Aggregator) handleFailureToAddVerifyBatchToBeMonitored(ctx context.Context, proof *state.Proof) { +
    - 301 + + -
    +
    +
      - log := log.WithFields("proofId", proof.ProofID, "batches", fmt.Sprintf("%d-%d", proof.BatchNumber, proof.BatchNumberFinal)) +
    - 302 + + -
    +
    +
      - proof.GeneratingSince = nil +
    -
    @@ -1021,7 +1138,7 @@
    -
    - 1021 + + -
    +
    +
      - if err != nil { +
    - 1022 + + -
    +
    +
      - return nil, err +
    - 1023 + + -
    +
    +
      - } +
    - 1024 + + -
    - - - leaves, err := a.State.GetLeafsByL1InfoRoot(ctx, *l1InfoRoot, nil) +
    +
    +   +
    - 1025 + + -
    +
    +
      - if err != nil { +
    - 1026 + + -
    +
    +
      - return nil, err +
    - 1027 + + -
    +
    +
      - } -
    -
    -
    +
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -3837,21 +5215,21 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    - 2 + + -
    +
    +
     
    - 3 + + -
    +
    +
      - import ( +
    - 4 + + -
    +
    +
      - "context" +
    - 5 + + -
    - + - "crypto/ecdsa" +
    +
    +   +
    - 6 + + -
    +
    +
      - "encoding/json" +
    - 7 + + -
    +
    +
      - "errors" +
    - 8 + + -
    +
    +
      - "fmt" +
    -
     
    -
    - 71 + + -
    +
    +
      - srv *grpc.Server +
    - 72 + + -
    +
    +
      - ctx context.Context +
    - 73 + + -
    +
    +
      - exit context.CancelFunc +
    - 74 + + -
    - + +
    +
    +  
    - 75 + + -
    - + - AggLayerClient client.ClientInterface +
    +
    +   +
    - 76 + + -
    - + - sequencerPrivateKey *ecdsa.PrivateKey +
    +
    +   +
    - 77 + + -
    +
    +
      - } +
    - 78 + + -
    +
    +
     
    - 79 + + -
    +
    +
      - // New creates a new aggregator. +
    -
     
    -
    - 82 + + -
    +
    +
      - stateInterface stateInterface, +
    - 83 + + -
    +
    +
      - ethTxManager ethTxManager, +
    - 84 + + -
    +
    +
      - etherman etherman, +
    - 85 + + -
    - + - agglayerClient client.ClientInterface, +
    +
    +   +
    - 86 + + -
    - + - sequencerPrivateKey *ecdsa.PrivateKey, +
    +
    +   +
    - 87 + + -
    +
    +
      - ) (Aggregator, error) { +
    - 88 + + -
    +
    +
      - var profitabilityChecker aggregatorTxProfitabilityChecker +
    - 89 + + -
    +
    +
      - switch cfg.TxProfitabilityCheckerType { +
    -
     
    -
    - 105 + + -
    +
    +
      - TimeCleanupLockedProofs: cfg.CleanupLockedProofsInterval, +
    - 106 + + -
    +
    +
     
    - 107 + + -
    +
    +
      - finalProof: make(chan finalProofMsg), +
    - 108 + + -
    - + +
    +
    +  
    - 109 + + -
    - + - AggLayerClient: agglayerClient, +
    +
    +   +
    - 110 + + -
    - + - sequencerPrivateKey: sequencerPrivateKey, +
    +
    +   +
    - 111 + + -
    +
    +
      - } +
    - 112 + + -
    +
    +
     
    - 113 + + -
    +
    +
      - return a, nil +
    -
     
    -
    - 281 + + -
    +
    +
     
    - 282 + + -
    +
    +
      - log.Infof("Final proof inputs: NewLocalExitRoot [%#x], NewStateRoot [%#x]", inputs.NewLocalExitRoot, inputs.NewStateRoot) +
    - 283 + + -
    +
    +
     
    - 284 + + -
    - + - switch a.cfg.SettlementBackend { +
    +
    +   +
    - 285 + + -
    - + - case AggLayer: +
    +
    +   +
    - 286 + + -
    - + - if success := a.settleWithAggLayer(ctx, proof, inputs); !success { +
    +
    +   +
    - 287 + + -
    - + - continue +
    +
    +   +
    - 288 + + -
    - + - } +
    +
    +   +
    - 289 + + -
    - + - default: +
    +
    +   +
    - 290 + + -
    - + - if success := a.settleDirect(ctx, proof, inputs); !success { +
    +
    +   +
    - 291 + + -
    - + - continue +
    +
    +   +
    - 292 + + -
    - + - } +
    +
    +   +
    - 293 + + -
    +
    +
      - } +
    - 294 + + -
    +
    +
     
    @@ -3907,2918 +5285,2761 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 295 + + -
    +
    +
      - a.resetVerifyProofTime() +
    - 296 + + -
    +
    +
      - a.endProofVerification() +
    - 297 + + -
    +
    +
      - } +
    - 298 + + -
    +
    +
      - } +
    - 299 + + -
    +
    +
      - } +
    - 300 + + -
    +
    +
     
    - 301 + + -
    - + - func (a *Aggregator) settleDirect( +
    +
    +   +
    - 302 + + -
    - + - ctx context.Context, +
    +
    +   +
    - 303 + + -
    - + - proof *state.Proof, +
    +
    +   +
    - 304 + + -
    - + - inputs ethmanTypes.FinalProofInputs, +
    +
    +   +
    - 305 + + -
    - + - ) (success bool) { +
    +
    +   +
    - 306 + + -
    - + - // add batch verification to be monitored +
    +
    +   +
    - 307 + + -
    - + - sender := common.HexToAddress(a.cfg.SenderAddress) +
    +
    +   +
    - 308 + + -
    - + +
    +
    +  
    - 309 + + -
    - + - to, data, err := a.Ethman.BuildTrustedVerifyBatchesTxData( +
    +
    +   +
    - 310 + + -
    - + - proof.BatchNumber-1, +
    +
    +   +
    - 311 + + -
    - + - proof.BatchNumberFinal, +
    +
    +   +
    - 312 + + -
    - + - &inputs, +
    +
    +   +
    - 313 + + -
    - + - sender, +
    +
    +   +
    - 314 + + -
    - + - ) +
    +
    +   +
    - 315 + + -
    - + - if err != nil { +
    +
    +   +
    - 316 + + -
    - + - log.Errorf("Error estimating batch verification to add to eth tx manager: %v", err) +
    +
    +   +
    - 317 + + -
    - + - a.handleFailureToAddVerifyBatchToBeMonitored(ctx, proof) +
    +
    +   +
    - 318 + + -
    - + +
    +
    +  
    - 319 + + -
    - + - return false +
    +
    +   +
    - 320 + + -
    - + - } +
    +
    +   +
    - 321 + + -
    - + +
    +
    +  
    - 322 + + -
    - + - monitoredTxID := buildMonitoredTxID(proof.BatchNumber, proof.BatchNumberFinal) +
    +
    +   +
    - 323 + + -
    - + - err = a.EthTxManager.Add( +
    +
    +   +
    - 324 + + -
    - + - ctx, +
    +
    +   +
    - 325 + + -
    - + - ethTxManagerOwner, +
    +
    +   +
    - 326 + + -
    - + - monitoredTxID, +
    +
    +   +
    - 327 + + -
    - + - sender, +
    +
    +   +
    - 328 + + -
    - + - to, +
    +
    +   +
    - 329 + + -
    - + - nil, +
    +
    +   +
    - 330 + + -
    - + - data, +
    +
    +   +
    - 331 + + -
    - + - a.cfg.GasOffset, +
    +
    +   +
    - 332 + + -
    - + - nil, +
    +
    +   +
    - 333 + + -
    - + - ) +
    +
    +   +
    - 334 + + -
    - + - if err != nil { +
    +
    +   +
    - 335 + + -
    - + - mTxLogger := ethtxmanager.CreateLogger(ethTxManagerOwner, monitoredTxID, sender, to) +
    +
    +   +
    - 336 + + -
    - + - mTxLogger.Errorf("Error to add batch verification tx to eth tx manager: %v", err) +
    +
    +   +
    - 337 + + -
    - + - a.handleFailureToAddVerifyBatchToBeMonitored(ctx, proof) +
    +
    +   +
    - 338 + + -
    - + +
    +
    +  
    - 339 + + -
    - + - return false +
    +
    +   +
    - 340 + + -
    - + - } +
    +
    +   +
    - 341 + + -
    - + +
    +
    +  
    - 342 - -
    - + - // process monitored batch verifications before starting a next cycle +
    + + +
    +   +
    - 343 + + -
    - + - a.EthTxManager.ProcessPendingMonitoredTxs( +
    +
    +   +
    - 344 + + -
    - + - ctx, +
    +
    +   +
    - 345 + + -
    - + - ethTxManagerOwner, +
    +
    +   +
    - 346 + + -
    - + - func(result ethtxmanager.MonitoredTxResult, dbTx pgx.Tx) { +
    +
    +   +
    - 347 + + -
    - + - a.handleMonitoredTxResult(result) +
    +
    +   +
    - 348 + + -
    - + - }, +
    +
    +   +
    - 349 + + -
    - + - nil, +
    +
    +   +
    - 350 + + -
    - + - ) +
    +
    +   +
    - 351 + + -
    - + +
    +
    +  
    - 352 + + -
    - + - return true +
    +
    +   +
    - 353 + + -
    - + - } +
    +
    +   +
    - 354 + + -
    - + +
    +
    +  
    - 355 + + -
    - + - func (a *Aggregator) settleWithAggLayer( +
    +
    +   +
    - 356 + + -
    - + - ctx context.Context, +
    +
    +   +
    - 357 + + -
    - + - proof *state.Proof, +
    +
    +   +
    - 358 + + -
    - + - inputs ethmanTypes.FinalProofInputs, +
    +
    +   +
    - 359 + + -
    - + - ) (success bool) { +
    +
    +   +
    - 360 + + -
    - + - proofStrNo0x := strings.TrimPrefix(inputs.FinalProof.Proof, "0x") +
    +
    +   +
    - 361 + + -
    - + - proofBytes := common.Hex2Bytes(proofStrNo0x) +
    +
    +   +
    - 362 + + -
    - + - tx := tx.Tx{ +
    +
    +   +
    - 363 + + -
    - + - LastVerifiedBatch: agglayerTypes.ArgUint64(proof.BatchNumber - 1), +
    +
    +   +
    - 364 + + -
    - + - NewVerifiedBatch: agglayerTypes.ArgUint64(proof.BatchNumberFinal), +
    +
    +   +
    - 365 + + -
    - + - ZKP: tx.ZKP{ +
    +
    +   +
    - 366 + + -
    - + - NewStateRoot: common.BytesToHash(inputs.NewStateRoot), +
    +
    +   +
    - 367 + + -
    - + - NewLocalExitRoot: common.BytesToHash(inputs.NewLocalExitRoot), +
    +
    +   +
    - 368 + + -
    - + - Proof: agglayerTypes.ArgBytes(proofBytes), +
    +
    +   +
    - 369 + + -
    - + - }, +
    +
    +   +
    - 370 + + -
    - + - RollupID: a.Ethman.GetRollupId(), +
    +
    +   +
    - 371 + + -
    - + - } +
    +
    +   +
    - 372 + + -
    - + - signedTx, err := tx.Sign(a.sequencerPrivateKey) +
    +
    +   +
    - 373 + + -
    - + +
    +
    +  
    - 374 + + -
    - + - if err != nil { +
    +
    +   +
    - 375 + + -
    - + - log.Errorf("failed to sign tx: %v", err) +
    +
    +   +
    - 376 + + -
    - + - a.handleFailureToSendToAggLayer(ctx, proof) +
    +
    +   +
    - 377 + + -
    - + +
    +
    +  
    - 378 + + -
    - + - return false +
    +
    +   +
    - 379 + + 247 +
    - + - } +   + }
    - 380 + + 248 +
    - + -
    +   + }
    - 381 + + 249 +
    - + - log.Debug("final proof signedTx: ", signedTx.Tx.ZKP.Proof.Hex()) + - + if !proofGenerated {
    - 382 + + 250 +
    - + - txHash, err := a.AggLayerClient.SendTx(*signedTx) + - + // if no proof was generated (aggregated or batch) wait some time before retry
    - 383 + + 251 +
    - + - if err != nil { + - + time.Sleep(a.cfg.RetryTime.Duration)
    - 384 + + 252 +
    - + - log.Errorf("failed to send tx to the interop: %v", err) + - + } // if proof was generated we retry immediately as probably we have more proofs to process
    - 385 + + -
    - + - a.handleFailureToSendToAggLayer(ctx, proof) +
    +
    +   +
    - 386 + + -
    - + +
    +
    +  
    - 387 + + -
    - + - return false +
    +
    +   +
    - 388 + + -
    - + - } +
    +
    +   +
    - 389 + + -
    - + +
    +
    +  
    - 390 + + -
    - + - log.Infof("tx %s sent to agglayer, waiting to be mined", txHash.Hex()) +
    +
    +   +
    - 391 + + -
    - + - log.Debugf("Timeout set to %f seconds", a.cfg.AggLayerTxTimeout.Duration.Seconds()) +
    +
    +   +
    - 392 + + -
    - + - waitCtx, cancelFunc := context.WithDeadline(ctx, time.Now().Add(a.cfg.AggLayerTxTimeout.Duration)) +
    +
    +   +
    - 393 + + -
    - + - defer cancelFunc() +
    +
    +   +
    - 394 + + -
    - + - if err := a.AggLayerClient.WaitTxToBeMined(txHash, waitCtx); err != nil { +
    +
    +   +
    - 395 + + -
    - + - log.Errorf("interop didn't mine the tx: %v", err) +
    +
    +   +
    - 396 + + -
    - + - a.handleFailureToSendToAggLayer(ctx, proof) +
    +
    +   +
    - 397 + + -
    - + +
    +
    +  
    - 398 + + -
    - + - return false +
    +
    +   +
    - 399 + + -
    - + - } +
    +
    +   +
    - 400 + + -
    - + +
    +
    +  
    - 401 + + -
    - + - // TODO: wait for synchronizer to catch up +
    +
    +   +
    - 402 + + -
    - + - return true +
    +
    +   +
    - 403 + + -
    - + - } +
    +
    +   +
    - 404 + + -
    - + +
    +
    +  
    - 405 + + -
    - + - func (a *Aggregator) handleFailureToSendToAggLayer(ctx context.Context, proof *state.Proof) { +
    +
    +   +
    - 406 + + -
    - + - log := log.WithFields("proofId", proof.ProofID, "batches", fmt.Sprintf("%d-%d", proof.BatchNumber, proof.BatchNumberFinal)) +
    +
    +   +
    - 407 + + -
    - + - proof.GeneratingSince = nil +
    +
    +   +
    - 408 + + -
    - + +
    +
    +  
    - 409 + + -
    - + - err := a.State.UpdateGeneratedProof(ctx, proof, nil) +
    +
    +   +
    - 410 + + -
    - + - if err != nil { +
    +
    +   +
    - 411 + + -
    - + - log.Errorf("Failed updating proof state (false): %v", err) +
    +
    +   +
    - 412 + + -
    - + - } +
    +
    +   +
    - 413 + + -
    - + +
    +
    +  
    - 414 + + -
    - + - a.endProofVerification() +
    +
    +   +
    - 415 + + -
    - + - } +
    +
    +   +
    - 416 + + -
    - + +
    +
    +  
    - 417 + + -
    +
    +
      - func (a *Aggregator) handleFailureToAddVerifyBatchToBeMonitored(ctx context.Context, proof *state.Proof) { +
    - 418 + + -
    +
    +
      - log := log.WithFields("proofId", proof.ProofID, "batches", fmt.Sprintf("%d-%d", proof.BatchNumber, proof.BatchNumberFinal)) +
    - 419 + + -
    +
    +
      - proof.GeneratingSince = nil +
    -
     
    -
    - 1138 + + -
    +
    +
      - if err != nil { +
    - 1139 + + -
    +
    +
      - return nil, err +
    - 1140 + + -
    +
    +
      - } +
    - 1141 + + -
    - + - leaves, err := a.State.GetLeavesByL1InfoRoot(ctx, *l1InfoRoot, nil) +
    +
    +   +
    - 1142 + + -
    +
    +
      - if err != nil { +
    - 1143 + + -
    +
    +
      - return nil, err +
    - 1144 + + -
    +
    +
      - } -
    -
    -
    +
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/aggregator_test.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    @@ -191,7 +191,7 @@
    - 191 + + -
    +
    +
      - stateMock := mocks.NewStateMock(t) +
    - 192 + + -
    +
    +
      - ethTxManager := mocks.NewEthTxManager(t) +
    - 193 + + -
    +
    +
      - etherman := mocks.NewEtherman(t) +
    - 194 + + -
    - - - a, err := New(cfg, stateMock, ethTxManager, etherman) +
    +
    +   +
    - 195 + + -
    +
    +
      - require.NoError(err) +
    - 196 + + -
    +
    +
      - a.ctx, a.exit = context.WithCancel(context.Background()) +
    - 197 + + -
    +
    +
      - m := mox{ +
    -
    @@ -686,7 +686,7 @@
    -
    - 686 + + -
    +
    +
      - ethTxManager := mocks.NewEthTxManager(t) +
    - 687 + + -
    +
    +
      - etherman := mocks.NewEtherman(t) +
    - 688 + + -
    +
    +
      - proverMock := mocks.NewProverMock(t) +
    - 689 + + -
    - - - a, err := New(cfg, stateMock, ethTxManager, etherman) +
    +
    +   +
    - 690 + + -
    +
    +
      - require.NoError(err) +
    - 691 + + -
    +
    +
      - aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck +
    - 692 + + -
    +
    +
      - a.ctx, a.exit = context.WithCancel(aggregatorCtx) +
    -
    @@ -801,7 +801,7 @@
    -
    - 801 + + -
    +
    +
      - } +
    - 802 + 253
      - m.etherman.On("GetLatestBlockHeader", mock.Anything).Return(&types.Header{Number: new(big.Int).SetUint64(1)}, nil).Once() + }
    - 803 + 254
      - m.stateMock.On("GetVirtualBatch", mock.Anything, lastVerifiedBatchNum+1, nil).Return(&vb, nil).Twice() + }
    - 804 + + -
    - - - m.stateMock.On("GetLeafsByL1InfoRoot", mock.Anything, *vb.L1InfoRoot, nil).Return([]state.L1InfoTreeExitRootStorageEntry{}, nil).Twice() +
    +
    +   +
    - 805 + + -
    +
    +
      - expectedInputProver, err := a.buildInputProver(context.Background(), &batchToProve) +
    - 806 + + -
    +
    +
      - require.NoError(err) +
    - 807 + + -
    +
    +
      - m.proverMock.On("BatchProof", expectedInputProver).Return(nil, errBanana).Once() +
    -
    @@ -844,7 +844,7 @@
    -
    - 844 + + -
    +
    +
      - } +
    - 845 + + -
    +
    +
      - m.etherman.On("GetLatestBlockHeader", mock.Anything).Return(&types.Header{Number: new(big.Int).SetUint64(1)}, nil).Once() +
    - 846 + + -
    +
    +
      - m.stateMock.On("GetVirtualBatch", mock.Anything, lastVerifiedBatchNum+1, nil).Return(&vb, nil).Twice() +
    - 847 + + -
    - - - m.stateMock.On("GetLeafsByL1InfoRoot", mock.Anything, *vb.L1InfoRoot, nil).Return([]state.L1InfoTreeExitRootStorageEntry{}, nil).Twice() +
    +
    +   +
    - 848 + + -
    +
    +
      - expectedInputProver, err := a.buildInputProver(context.Background(), &batchToProve) +
    - 849 + + -
    +
    +
      - require.NoError(err) +
    - 850 + + -
    +
    +
      - m.proverMock.On("BatchProof", expectedInputProver).Return(&proofID, nil).Once() +
    -
    @@ -888,7 +888,7 @@
    -
    - 888 + + -
    +
    +
      - } +
    - 889 + + -
    +
    +
      - m.etherman.On("GetLatestBlockHeader", mock.Anything).Return(&types.Header{Number: new(big.Int).SetUint64(1)}, nil).Once() +
    - 890 + + -
    +
    +
      - m.stateMock.On("GetVirtualBatch", mock.Anything, lastVerifiedBatchNum+1, nil).Return(&vb, nil).Twice() +
    - 891 + + -
    - - - m.stateMock.On("GetLeafsByL1InfoRoot", mock.Anything, *vb.L1InfoRoot, nil).Return([]state.L1InfoTreeExitRootStorageEntry{}, nil).Twice() +
    +
    +   +
    - 892 + + -
    +
    +
      - expectedInputProver, err := a.buildInputProver(context.Background(), &batchToProve) +
    - 893 + + -
    +
    +
      - require.NoError(err) +
    - 894 + + -
    +
    +
      - m.proverMock.On("BatchProof", expectedInputProver).Return(&proofID, nil).Once() +
    -
    @@ -932,7 +932,7 @@
    -
    - 932 + + -
    +
    +
      - } +
    - 933 + + -
    +
    +
      - m.etherman.On("GetLatestBlockHeader", mock.Anything).Return(&types.Header{Number: new(big.Int).SetUint64(1)}, nil).Once() +
    - 934 + + -
    +
    +
      - m.stateMock.On("GetVirtualBatch", mock.Anything, lastVerifiedBatchNum+1, nil).Return(&vb, nil).Twice() +
    - 935 + + -
    - - - m.stateMock.On("GetLeafsByL1InfoRoot", mock.Anything, *vb.L1InfoRoot, nil).Return([]state.L1InfoTreeExitRootStorageEntry{}, nil).Twice() +
    +
    +   +
    - 936 + + -
    +
    +
      - expectedInputProver, err := a.buildInputProver(context.Background(), &batchToProve) +
    - 937 + + -
    +
    +
      - require.NoError(err) +
    - 938 + + -
    +
    +
      - m.proverMock.On("BatchProof", expectedInputProver).Return(&proofID, nil).Once() +
    -
    @@ -989,7 +989,7 @@
    -
    - 989 + + -
    +
    +
      - TimestampBatchEtrog: &t, +
    - 990 + + -
    +
    +
      - } +
    - 991 + + -
    +
    +
      - m.stateMock.On("GetVirtualBatch", mock.Anything, lastVerifiedBatchNum+1, nil).Return(&vb, nil).Twice() +
    - 992 + + -
    - - - m.stateMock.On("GetLeafsByL1InfoRoot", mock.Anything, *vb.L1InfoRoot, nil).Return([]state.L1InfoTreeExitRootStorageEntry{}, nil).Twice() +
    +
    +   +
    - 993 + + -
    +
    +
      - expectedInputProver, err := a.buildInputProver(context.Background(), &batchToProve) +
    - 994 + + -
    +
    +
      - require.NoError(err) +
    - 995 + + -
    +
    +
      - m.proverMock.On("BatchProof", expectedInputProver).Return(&proofID, nil).Once() +
    -
    @@ -1029,7 +1029,7 @@
    -
    - 1029 + + -
    +
    +
      - ethTxManager := mocks.NewEthTxManager(t) +
    - 1030 + + -
    +
    +
      - etherman := mocks.NewEtherman(t) +
    - 1031 + + -
    +
    +
      - proverMock := mocks.NewProverMock(t) +
    - 1032 + + -
    - - - a, err := New(cfg, stateMock, ethTxManager, etherman) +
    +
    +   +
    - 1033 + + -
    +
    +
      - require.NoError(err) +
    - 1034 + + -
    +
    +
      - aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck +
    - 1035 + + -
    +
    +
      - a.ctx, a.exit = context.WithCancel(aggregatorCtx) +
    -
    @@ -1306,7 +1306,7 @@
    -
    - 1306 + + -
    +
    +
      - ethTxManager := mocks.NewEthTxManager(t) +
    - 1307 + + -
    +
    +
      - etherman := mocks.NewEtherman(t) +
    - 1308 + + -
    +
    +
      - proverMock := mocks.NewProverMock(t) +
    - 1309 + + -
    - - - a, err := New(cfg, stateMock, ethTxManager, etherman) +
    +
    +   +
    - 1310 + + -
    +
    +
      - require.NoError(err) +
    - 1311 + + -
    +
    +
      - aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck +
    - 1312 + + -
    +
    +
      - a.ctx, a.exit = context.WithCancel(aggregatorCtx) +
    -
    @@ -1436,7 +1436,7 @@
    -
    - 1436 + + -
    +
    +
      - ethTxManager := mocks.NewEthTxManager(t) +
    - 1437 + + -
    +
    +
      - etherman := mocks.NewEtherman(t) +
    - 1438 + + -
    +
    +
      - proverMock := mocks.NewProverMock(t) +
    - 1439 + + -
    - - - a, err := New(cfg, stateMock, ethTxManager, etherman) +
    +
    +   +
    - 1440 + + -
    +
    +
      - require.NoError(err) +
    - 1441 + + -
    +
    +
      - aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck +
    - 1442 + + -
    +
    +
      - a.ctx, a.exit = context.WithCancel(aggregatorCtx) -
    -
    -
    +
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    - 191 + + -
    +
    +
      - stateMock := mocks.NewStateMock(t) +
    - 192 + + -
    +
    +
      - ethTxManager := mocks.NewEthTxManager(t) +
    - 193 + + -
    +
    +
      - etherman := mocks.NewEtherman(t) +
    - 194 + + -
    - + - a, err := New(cfg, stateMock, ethTxManager, etherman, nil, nil) +
    +
    +   +
    - 195 + + -
    +
    +
      - require.NoError(err) +
    - 196 + + -
    +
    +
      - a.ctx, a.exit = context.WithCancel(context.Background()) +
    - 197 + + -
    +
    +
      - m := mox{ +
    -
     
    -
    - 686 + + -
    +
    +
      - ethTxManager := mocks.NewEthTxManager(t) +
    - 687 + + -
    +
    +
      - etherman := mocks.NewEtherman(t) +
    - 688 + + -
    +
    +
      - proverMock := mocks.NewProverMock(t) +
    - 689 + + -
    - + - a, err := New(cfg, stateMock, ethTxManager, etherman, nil, nil) +
    +
    +   +
    - 690 + + -
    +
    +
      - require.NoError(err) +
    - 691 + + -
    +
    +
      - aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck +
    - 692 + + -
    +
    +
      - a.ctx, a.exit = context.WithCancel(aggregatorCtx) +
    -
     
    -
    - 801 + + -
    +
    +
      - } +
    - 802 + + -
    +
    +
      - m.etherman.On("GetLatestBlockHeader", mock.Anything).Return(&types.Header{Number: new(big.Int).SetUint64(1)}, nil).Once() +
    - 803 + + -
    +
    +
      - m.stateMock.On("GetVirtualBatch", mock.Anything, lastVerifiedBatchNum+1, nil).Return(&vb, nil).Twice() +
    - 804 + + -
    - + - m.stateMock.On("GetLeavesByL1InfoRoot", mock.Anything, *vb.L1InfoRoot, nil).Return([]state.L1InfoTreeExitRootStorageEntry{}, nil).Twice() +
    +
    +   +
    - 805 + + -
    +
    +
      - expectedInputProver, err := a.buildInputProver(context.Background(), &batchToProve) +
    - 806 + + -
    +
    +
      - require.NoError(err) +
    - 807 + + -
    +
    +
      - m.proverMock.On("BatchProof", expectedInputProver).Return(nil, errBanana).Once() +
    -
     
    -
    - 844 + + -
    +
    +
      - } +
    - 845 + + -
    +
    +
      - m.etherman.On("GetLatestBlockHeader", mock.Anything).Return(&types.Header{Number: new(big.Int).SetUint64(1)}, nil).Once() +
    - 846 + + -
    +
    +
      - m.stateMock.On("GetVirtualBatch", mock.Anything, lastVerifiedBatchNum+1, nil).Return(&vb, nil).Twice() +
    - 847 + + -
    - + - m.stateMock.On("GetLeavesByL1InfoRoot", mock.Anything, *vb.L1InfoRoot, nil).Return([]state.L1InfoTreeExitRootStorageEntry{}, nil).Twice() +
    +
    +   +
    - 848 + + -
    +
    +
      - expectedInputProver, err := a.buildInputProver(context.Background(), &batchToProve) +
    - 849 + + -
    +
    +
      - require.NoError(err) +
    - 850 + + -
    +
    +
      - m.proverMock.On("BatchProof", expectedInputProver).Return(&proofID, nil).Once() +
    -
     
    -
    - 888 + + -
    +
    +
      - } +
    - 889 + + -
    +
    +
      - m.etherman.On("GetLatestBlockHeader", mock.Anything).Return(&types.Header{Number: new(big.Int).SetUint64(1)}, nil).Once() +
    - 890 + + -
    +
    +
      - m.stateMock.On("GetVirtualBatch", mock.Anything, lastVerifiedBatchNum+1, nil).Return(&vb, nil).Twice() +
    - 891 + + -
    - + - m.stateMock.On("GetLeavesByL1InfoRoot", mock.Anything, *vb.L1InfoRoot, nil).Return([]state.L1InfoTreeExitRootStorageEntry{}, nil).Twice() +
    +
    +   +
    - 892 + + -
    +
    +
      - expectedInputProver, err := a.buildInputProver(context.Background(), &batchToProve) +
    - 893 + + -
    +
    +
      - require.NoError(err) +
    - 894 + + -
    +
    +
      - m.proverMock.On("BatchProof", expectedInputProver).Return(&proofID, nil).Once() +
    -
     
    -
    - 932 + + -
    +
    +
      - } +
    - 933 + + -
    +
    +
      - m.etherman.On("GetLatestBlockHeader", mock.Anything).Return(&types.Header{Number: new(big.Int).SetUint64(1)}, nil).Once() +
    - 934 + + -
    +
    +
      - m.stateMock.On("GetVirtualBatch", mock.Anything, lastVerifiedBatchNum+1, nil).Return(&vb, nil).Twice() +
    - 935 + + -
    - + - m.stateMock.On("GetLeavesByL1InfoRoot", mock.Anything, *vb.L1InfoRoot, nil).Return([]state.L1InfoTreeExitRootStorageEntry{}, nil).Twice() +
    +
    +   +
    - 936 + + -
    +
    +
      - expectedInputProver, err := a.buildInputProver(context.Background(), &batchToProve) +
    - 937 + + -
    +
    +
      - require.NoError(err) +
    - 938 + + -
    +
    +
      - m.proverMock.On("BatchProof", expectedInputProver).Return(&proofID, nil).Once() +
    -
     
    -
    - 989 + + -
    +
    +
      - TimestampBatchEtrog: &t, +
    - 990 + + -
    +
    +
      - } +
    - 991 + + -
    +
    +
      - m.stateMock.On("GetVirtualBatch", mock.Anything, lastVerifiedBatchNum+1, nil).Return(&vb, nil).Twice() +
    - 992 + + -
    - + - m.stateMock.On("GetLeavesByL1InfoRoot", mock.Anything, *vb.L1InfoRoot, nil).Return([]state.L1InfoTreeExitRootStorageEntry{}, nil).Twice() +
    +
    +   +
    - 993 + + -
    +
    +
      - expectedInputProver, err := a.buildInputProver(context.Background(), &batchToProve) +
    - 994 + + -
    +
    +
      - require.NoError(err) +
    - 995 + + -
    +
    +
      - m.proverMock.On("BatchProof", expectedInputProver).Return(&proofID, nil).Once() +
    -
     
    -
    - 1029 + + -
    +
    +
      - ethTxManager := mocks.NewEthTxManager(t) +
    - 1030 + + -
    +
    +
      - etherman := mocks.NewEtherman(t) +
    - 1031 + + -
    +
    +
      - proverMock := mocks.NewProverMock(t) +
    - 1032 + + -
    - + - a, err := New(cfg, stateMock, ethTxManager, etherman, nil, nil) +
    +
    +   +
    - 1033 + + -
    +
    +
      - require.NoError(err) +
    - 1034 + + -
    +
    +
      - aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck +
    - 1035 + + -
    +
    +
      - a.ctx, a.exit = context.WithCancel(aggregatorCtx) +
    -
     
    -
    - 1306 + + -
    +
    +
      - ethTxManager := mocks.NewEthTxManager(t) +
    - 1307 + + -
    +
    +
      - etherman := mocks.NewEtherman(t) +
    - 1308 + + -
    +
    +
      - proverMock := mocks.NewProverMock(t) +
    - 1309 + + -
    - + - a, err := New(cfg, stateMock, ethTxManager, etherman, nil, nil) +
    +
    +   +
    - 1310 + + -
    +
    +
      - require.NoError(err) +
    - 1311 + + -
    +
    +
      - aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck +
    - 1312 + + -
    +
    +
      - a.ctx, a.exit = context.WithCancel(aggregatorCtx) +
    -
     
    -
    - 1436 + + -
    +
    +
      - ethTxManager := mocks.NewEthTxManager(t) +
    - 1437 + + -
    +
    +
      - etherman := mocks.NewEtherman(t) +
    - 1438 + + -
    +
    +
      - proverMock := mocks.NewProverMock(t) +
    - 1439 + + -
    - + - a, err := New(cfg, stateMock, ethTxManager, etherman, nil, nil) +
    +
    +   +
    - 1440 + + -
    +
    +
      - require.NoError(err) +
    - 1441 + + -
    +
    +
      - aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck +
    - 1442 + + -
    +
    +
      - a.ctx, a.exit = context.WithCancel(aggregatorCtx) +
    -
    + + + + + +
    +   +
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/config.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - -
    -
    @@ -8,6 +8,17 @@
    - 8 + + -
    +
    +
      - "github.com/0xPolygonHermez/zkevm-node/encoding" +
    - 9 + + -
    +
    +
      - ) +
    - 10 + + -
    +
    +
     
    @@ -6934,66 +8155,71 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 11 + + -
    +
    +
      - // TokenAmountWithDecimals is a wrapper type that parses token amount with decimals to big int +
    - 12 + + -
    +
    +
      - type TokenAmountWithDecimals struct { +
    - 13 + + -
    +
    +
      - *big.Int `validate:"required"` +
    -
    @@ -89,6 +100,18 @@
    +
    + + +
    +   +
    +
    - 89 + + -
    +
    +
      - // UpgradeEtrogBatchNumber is the number of the first batch after upgrading to etrog +
    - 90 + + -
    +
    +
      - UpgradeEtrogBatchNumber uint64 `mapstructure:"UpgradeEtrogBatchNumber"` +
    - 91 + + -
    +
    +
     
    @@ -7119,461 +8345,433 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 92 + + -
    +
    +
      - // BatchProofL1BlockConfirmations is number of L1 blocks to consider we can generate the proof for a virtual batch +
    - 93 + + -
    +
    +
      - BatchProofL1BlockConfirmations uint64 `mapstructure:"BatchProofL1BlockConfirmations"` +
    - 94 + + -
    +
    +
      - } +
    -
    + + + + + +
    +   +
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    - 8 + + -
    +
    +
      - "github.com/0xPolygonHermez/zkevm-node/encoding" +
    - 9 + + -
    +
    +
      - ) +
    - 10 + + -
    +
    +
     
    - 11 + + -
    - + - // SettlementBackend is the type of the settlement backend +
    +
    +   +
    - 12 + + -
    - + - type SettlementBackend string +
    +
    +   +
    - 13 + + -
    - + +
    +
    +  
    - 14 + + -
    - + - const ( +
    +
    +   +
    - 15 + + -
    - + - // AggLayer settlement backend +
    +
    +   +
    - 16 + + -
    - + - AggLayer SettlementBackend = "agglayer" +
    +
    +   +
    - 17 + + -
    - + +
    +
    +  
    - 18 + + -
    - + - // L1 settlement backend +
    +
    +   +
    - 19 + + -
    - + - L1 SettlementBackend = "l1" +
    +
    +   +
    - 20 + + -
    - + - ) +
    +
    +   +
    - 21 + + -
    - + +
    +
    +  
    - 22 + + -
    +
    +
      - // TokenAmountWithDecimals is a wrapper type that parses token amount with decimals to big int +
    - 23 + + -
    +
    +
      - type TokenAmountWithDecimals struct { +
    - 24 + + -
    +
    +
      - *big.Int `validate:"required"` +
    -
     
    +
    + + +
    +   +
    +
    - 100 + + -
    +
    +
      - // UpgradeEtrogBatchNumber is the number of the first batch after upgrading to etrog +
    - 101 + + -
    +
    +
      - UpgradeEtrogBatchNumber uint64 `mapstructure:"UpgradeEtrogBatchNumber"` +
    - 102 + + -
    +
    +
     
    - 103 + + -
    - + - // SettlementBackend configuration defines how a final ZKP should be settled. Directly to L1 or over the Beethoven service. +
    +
    +   +
    - 104 + + -
    - + - SettlementBackend SettlementBackend `mapstructure:"SettlementBackend"` +
    +
    +   +
    - 105 + + -
    - + +
    +
    +  
    - 106 + + -
    - + - // AggLayerTxTimeout is the interval time to wait for a tx to be mined from the agglayer +
    +
    +   +
    - 107 + + -
    - + - AggLayerTxTimeout types.Duration `mapstructure:"AggLayerTxTimeout"` +
    +
    +   +
    - 108 + + -
    - + +
    +
    +  
    - 109 + + -
    - + - // AggLayerURL url of the agglayer service +
    +
    +   +
    - 110 + + -
    - + - AggLayerURL string `mapstructure:"AggLayerURL"` +
    +
    +   +
    - 111 + + -
    - + +
    +
    +  
    - 112 + + -
    - + - // SequencerPrivateKey Private key of the trusted sequencer +
    +
    +   +
    - 113 + + -
    - + - SequencerPrivateKey types.KeystoreFileConfig `mapstructure:"SequencerPrivateKey"` +
    +
    +   +
    - 114 + + -
    - + +
    +
    +  
    - 115 + + -
    +
    +
      - // BatchProofL1BlockConfirmations is number of L1 blocks to consider we can generate the proof for a virtual batch +
    - 116 + + -
    +
    +
      - BatchProofL1BlockConfirmations uint64 `mapstructure:"BatchProofL1BlockConfirmations"` +
    - 117 + + -
    +
    +
      - } +
    -
    -
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/interfaces.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - @@ -7587,724 +8785,613 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    @@ -38,6 +38,7 @@
    -
    - 38 + + -
    +
    +
     
    - 39 + + -
    +
    +
      - // etherman contains the methods required to interact with ethereum +
    - 40 + + -
    +
    +
      - type etherman interface { +
    - 41 + + -
    +
    +
      - GetLatestVerifiedBatchNum() (uint64, error) +
    - 42 + + -
    +
    +
      - BuildTrustedVerifyBatchesTxData(lastVerifiedBatch, newVerifiedBatch uint64, inputs *ethmanTypes.FinalProofInputs, beneficiary common.Address) (to *common.Address, data []byte, err error) +
    - 43 + + -
    +
    +
      - GetLatestBlockHeader(ctx context.Context) (*types.Header, error) +
    -
    @@ -65,7 +66,7 @@
    -
    - 65 + + -
    +
    +
      - CleanupGeneratedProofs(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error +
    - 66 + + -
    +
    +
      - CleanupLockedProofs(ctx context.Context, duration string, dbTx pgx.Tx) (int64, error) +
    - 67 + + -
    +
    +
      - GetL1InfoRootLeafByIndex(ctx context.Context, l1InfoTreeIndex uint32, dbTx pgx.Tx) (state.L1InfoTreeExitRootStorageEntry, error) -
    -
    - 68 - -
    - - - GetLeafsByL1InfoRoot(ctx context.Context, l1InfoRoot common.Hash, dbTx pgx.Tx) ([]state.L1InfoTreeExitRootStorageEntry, error) +
    - 69 + + -
    +
    +
      - GetVirtualBatchParentHash(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (common.Hash, error) +
    - 70 + + -
    +
    +
      - GetForcedBatchParentHash(ctx context.Context, forcedBatchNumber uint64, dbTx pgx.Tx) (common.Hash, error) +
    - 71 + + -
    +
    +
      - GetVirtualBatch(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.VirtualBatch, error) -
    -
    -
    +
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    - 38 + + -
    +
    +
     
    - 39 + + -
    +
    +
      - // etherman contains the methods required to interact with ethereum +
    - 40 + + -
    +
    +
      - type etherman interface { +
    - 41 + + -
    - + - GetRollupId() uint32 +
    +
    +   +
    - 42 + + -
    +
    +
      - GetLatestVerifiedBatchNum() (uint64, error) +
    - 43 + + -
    +
    +
      - BuildTrustedVerifyBatchesTxData(lastVerifiedBatch, newVerifiedBatch uint64, inputs *ethmanTypes.FinalProofInputs, beneficiary common.Address) (to *common.Address, data []byte, err error) +
    - 44 + + -
    +
    +
      - GetLatestBlockHeader(ctx context.Context) (*types.Header, error) +
    -
     
    -
    - 66 + + -
    +
    +
      - CleanupGeneratedProofs(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error +
    - 67 + + -
    +
    +
      - CleanupLockedProofs(ctx context.Context, duration string, dbTx pgx.Tx) (int64, error) +
    - 68 + + -
    +
    +
      - GetL1InfoRootLeafByIndex(ctx context.Context, l1InfoTreeIndex uint32, dbTx pgx.Tx) (state.L1InfoTreeExitRootStorageEntry, error) +
    - 69 + + -
    - + - GetLeavesByL1InfoRoot(ctx context.Context, l1InfoRoot common.Hash, dbTx pgx.Tx) ([]state.L1InfoTreeExitRootStorageEntry, error) +
    +
    +   +
    - 70 + + -
    +
    +
      - GetVirtualBatchParentHash(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (common.Hash, error) +
    - 71 + + -
    +
    +
      - GetForcedBatchParentHash(ctx context.Context, forcedBatchNumber uint64, dbTx pgx.Tx) (common.Hash, error) +
    - 72 + + -
    +
    +
      - GetVirtualBatch(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.VirtualBatch, error) -
    -
    -
    +
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/approve.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    @@ -51,14 +51,14 @@
    - 51 + + -
    +
    +
      - setupLog(c.Log) +
    - 52 + + -
    +
    +
     
    - 53 + + -
    +
    +
      - // Check if it is already registered +
    - 54 + + -
    - - - etherman, err := newEtherman(*c) +
    +
    +   +
    - 55 + + -
    +
    +
      - if err != nil { +
    - 56 + + -
    +
    +
      - log.Fatal(err) +
    - 57 + + -
    +
    +
      - return err +
    - 58 + + -
    +
    +
      - } +
    - 59 + + -
    +
    +
     
    - 60 + + -
    +
    +
      - // load auth from keystore file +
    - 61 + + -
    - - - auth, err := etherman.LoadAuthFromKeyStore(addrKeyStorePath, addrPassword) +
    +
    +   +
    - 62 + + -
    +
    +
      - if err != nil { +
    - 63 + + -
    +
    +
      - log.Fatal(err) +
    - 64 + + -
    +
    +
      - return err -
    -
    -
    +
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    - 51 + + -
    +
    +
      - setupLog(c.Log) +
    - 52 + + -
    +
    +
     
    - 53 + + -
    +
    +
      - // Check if it is already registered +
    - 54 + + -
    - + - etherman, err := newEtherman(*c, nil) +
    +
    +   +
    - 55 + + -
    +
    +
      - if err != nil { +
    - 56 + + -
    +
    +
      - log.Fatal(err) +
    - 57 + + -
    +
    +
      - return err +
    - 58 + + -
    +
    +
      - } +
    - 59 + + -
    +
    +
     
    - 60 + + -
    +
    +
      - // load auth from keystore file +
    - 61 + + -
    - + - auth, _, err := etherman.LoadAuthFromKeyStore(addrKeyStorePath, addrPassword) +
    +
    +   +
    - 62 + + -
    +
    +
      - if err != nil { +
    - 63 + + -
    +
    +
      - log.Fatal(err) +
    - 64 + + -
    +
    +
      - return err -
    -
    -
    +
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/main.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -8378,283 +9465,225 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - -
    -
    @@ -47,7 +47,7 @@
    - 47 + + -
    +
    +
      - networkFlag = cli.StringFlag{ +
    - 48 + + -
    +
    +
      - Name: config.FlagNetwork, +
    - 49 + + -
    +
    +
      - Aliases: []string{"net"}, +
    - 50 + + -
    - - - Usage: "Load default network configuration. Supported values: [`mainnet`, `testnet`, `cardona`, `custom`]", +
    +
    +   +
    - 51 + + -
    +
    +
      - Required: true, +
    - 52 + + -
    +
    +
      - } +
    - 53 + + -
    +
    +
      - customNetworkFlag = cli.StringFlag{ +
    -
    @@ -186,6 +186,13 @@
    -
    - 186 + + -
    +
    +
      - Action: restore, +
    - 187 + + -
    +
    +
      - Flags: restoreFlags, +
    - 188 + + -
    +
    +
      - }, +
    - 189 + + -
    +
    +
      - } +
    - 190 + + -
    +
    +
     
    - 191 + + -
    +
    +
      - err := app.Run(os.Args) -
    -
    -
    +
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    - 47 + + -
    +
    +
      - networkFlag = cli.StringFlag{ +
    - 48 + + -
    +
    +
      - Name: config.FlagNetwork, +
    - 49 + + -
    +
    +
      - Aliases: []string{"net"}, +
    - 50 + + -
    - + - Usage: "Load default network configuration. Supported values: [`custom`]", +
    +
    +   +
    - 51 + + -
    +
    +
      - Required: true, +
    - 52 + + -
    +
    +
      - } +
    - 53 + + -
    +
    +
      - customNetworkFlag = cli.StringFlag{ +
    -
     
    -
    - 186 + + -
    +
    +
      - Action: restore, +
    - 187 + + -
    +
    +
      - Flags: restoreFlags, +
    - 188 + + -
    +
    +
      - }, +
    - 189 + + -
    - + - { +
    +
    +   +
    - 190 + + -
    - + - Name: "set-data-availability-protocol", +
    +
    +   +
    - 191 + + -
    - + - Aliases: []string{"set-dap"}, +
    +
    +   +
    - 192 + + -
    - + - Usage: "Sets the new data availability protocol", +
    +
    +   +
    - 193 + + -
    - + - Action: setDataAvailabilityProtocol, +
    +
    +   +
    - 194 + + -
    - + - Flags: setDataAvailabilityProtocolFlags, +
    +
    +   +
    - 195 + + -
    - + - }, +
    +
    +   +
    - 196 + + -
    +
    +
      - } +
    - 197 + + -
    +
    +
     
    - 198 - -
    -   - err := app.Run(os.Args) -
    -
    -
    -
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/policy.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - + - + + - - - - - - + + + - - - - - - + + + - - - - - - + + + - - - - - - + + + - - - - - - - - + + + - - - - - - - - - - - - + + + - - - - - - - - - - - - + + + - - - - + + + - - - - - + - + + - - - - - - + + + - - - - + + + - - - - - + - + + - - - - - - + + + + + + + + + - - - - - - - - + + + - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - + + +
    -
    @@ -0,0 +1,308 @@
    -
    @@ -10196,561 +11225,716 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - + + 255 -
    +
    +
      -
    + }
    - + + 256 -
    +
    +
     
    - + + 257 -
    +
    +
      -
    + // canVerifyProof returns true if we have reached the timeout to verify a proof
    - + +
    @@ -285,41 +1073,41 @@
    -
    +
    + 285 + +
     
    - + + 286 -
    +
    +
      -
    + // isSynced checks if the state is synchronized with L1. If a batch number is
    - + + 287 -
    +
    +
      -
    + // provided, it makes sure that the state is synced with that batch.
    - + + 288 -
    +
    +
    + - + func (a *Aggregator) isSynced(ctx context.Context, batchNum *uint64) bool { +
    +
    + 289 + +
      -
    + // get latest verified batch as seen by the synchronizer
    - + + 290 -
    +
    +
      -
    + lastVerifiedBatch, err := a.State.GetLastVerifiedBatch(ctx, nil)
    - + + 291 -
    +
    +
      -
    + if err == state.ErrNotFound {
    - + + 292 -
    +
    +
    + - + return false +
    +
    + 293 + +
      -
    + }
    - + + 294 -
    +
    +
      -
    + if err != nil {
    - + + 295 -
    +
    +
      -
    + log.Warnf("Failed to get last consolidated batch: %v", err)
    - + + 296 -
    +
    +
    + - + return false +
    +
    + 297 + +
      -
    + }
    - + + 298 -
    +
    +
     
    - + + 299 -
    +
    +
      -
    + if lastVerifiedBatch == nil {
    - + + 300 -
    +
    +
    + - + return false +
    +
    + 301 + +
      -
    + }
    - + + 302 -
    +
    +
     
    - + + 303 -
    +
    +
      -
    + if batchNum != nil && lastVerifiedBatch.BatchNumber < *batchNum {
    - + + 304 -
    +
    +
      -
    + log.Infof("Waiting for the state to be synced, lastVerifiedBatchNum: %d, waiting for batch: %d", lastVerifiedBatch.BatchNumber, batchNum)
    - + + 305 -
    +
    +
    + - + return false +
    +
    + 306 + +
      -
    + }
    - + + 307 -
    +
    +
     
    - + + 308 -
    +
    +
      -
    + // latest verified batch in L1
    - + + 309 -
    +
    +
      -
    + lastVerifiedEthBatchNum, err := a.Ethman.GetLatestVerifiedBatchNum()
    - + + 310 -
    +
    +
      -
    + if err != nil {
    - + + 311 -
    +
    +
      -
    + log.Warnf("Failed to get last eth batch, err: %v", err)
    - + + 312 -
    +
    +
    + - + return false +
    +
    + 313 + +
      -
    + }
    - + + 314 -
    +
    +
     
    - + + 315 -
    +
    +
      -
    + // check if L2 is synced with L1
    - + + 316 -
    +
    +
      -
    + if lastVerifiedBatch.BatchNumber < lastVerifiedEthBatchNum {
    - + + 317 -
    +
    +
      -
    + log.Infof("Waiting for the state to be synced, lastVerifiedBatchNum: %d, lastVerifiedEthBatchNum: %d, waiting for batch",
    - + + 318 -
    +
    +
      -
    + lastVerifiedBatch.BatchNumber, lastVerifiedEthBatchNum)
    - + + 319 -
    +
    +
    + - + return false +
    +
    + 320 + +
      -
    + }
    - + + 321 -
    +
    +
     
    - + + 322 -
    +
    +
    + - + return true +
    +
    + 323 + +
      -
    + }
    - + + 324 -
    +
    +
     
    - + + 325 -
    +
    +
      -
    + func (a *Aggregator) buildInputProver(ctx context.Context, batchToVerify *state.Batch) (*prover.InputProver, error) {
    - + +
    @@ -383,10 +1171,10 @@
    -
    +
    + 383 + +
      -
    + }
    - + + 384 -
    +
    +
      -
    + if l1InfoRoot != nil && *l1InfoRoot != calculatedL1InfoRoot {
    - + + 385 -
    +
    +
      -
    + for i, l := range aLeaves {
    - + + 386 -
    +
    +
    + - + log.Infof("AllLeaves[%d]: %s", i, common.Bytes2Hex(l[:])) +
    +
    + 387 + +
      -
    + }
    - + + 388 -
    +
    +
      -
    + for i, s := range smtProof {
    - + + 389 -
    +
    +
    + - + log.Infof("smtProof[%d]: %s", i, common.Bytes2Hex(s[:])) +
    +
    + 390 + +
      -
    + }
    - + + 391 -
    +
    +
      -
    + return nil, fmt.Errorf("error: l1InfoRoot mismatch. L1InfoRoot: %s, calculatedL1InfoRoot: %s. l1InfoTreeIndex: %d", l1InfoRoot.String(), calculatedL1InfoRoot.String(), l2blockRaw.IndexL1InfoTree)
    - + + 392 -
    +
    +
      -
    + }
    - + +
    @@ -513,19 +1301,37 @@
    -
    +
    + 513 + +
     
    - + + 514 -
    +
    +
      -
    + // wait for the synchronizer to catch up the verified batches
    - + + 515 -
    +
    +
      -
    + log.Debug("A final proof has been sent, waiting for the network to be synced")
    - + + 516 -
    +
    +
    + - + for !a.isSynced(a.ctx, &proofBatchNumberFinal) { +
    +
    + 517 + +
    + - + log.Info("Waiting for synchronizer to sync...") +
    +
    + 518 + +
    + - + time.Sleep(a.cfg.RetryTime.Duration) +
    +
    + 519 + +
      -
    + }
    - + + 520 -
    +
    +
     
    - + + 521 -
    +
    +
      -
    + // network is synced with the final proof, we can safely delete all recursive
    - + + 522 -
    +
    +
      -
    + // proofs up to the last synced batch
    - + + 523 -
    +
    +
    + - + err = a.State.CleanupBatchProofs(a.ctx, proofBatchNumberFinal, nil) +
    +
    + 524 + +
      -
    + if err != nil {
    - + + 525 -
    +
    +
      -
    + log.Errorf("Failed to store proof aggregation result: %v", err)
    - + + 526 -
    +
    +
      -
    + }
    - + + 527 -
    +
    +
      -
    + }
    - + + 528 -
    +
    +
     
    @@ -10936,683 +12120,727 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - + + 529 -
    +
    +
      -
    + func buildMonitoredTxID(batchNumber, batchNumberFinal uint64) string {
    - + + 530 -
    +
    +
      -
    + return fmt.Sprintf(monitoredIDFormat, batchNumber, batchNumberFinal)
    - + + 531 -
    +
    +
      -
    + }
    - + +
    @@ -536,7 +1342,7 @@
    -
    +
    + 536 + +
      -
    + case <-a.ctx.Done():
    - + + 537 -
    +
    +
      -
    + return
    - + + 538 -
    +
    +
      -
    + case <-time.After(a.TimeCleanupLockedProofs.Duration):
    - + + 539 -
    -   -
    +
    +
    + - + n, err := a.State.CleanupLockedBatchProofs(a.ctx, a.cfg.GeneratingProofCleanupThreshold, nil)
    - + + 540 -
    +
    +
      -
    + if err != nil {
    - + + 541 -
    +
    +
      -
    + log.Errorf("Failed to cleanup locked proofs: %v", err)
    - + + 542 -
    +
    +
      -
    + } +
    +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -11626,63 +12854,63 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - @@ -11696,222 +12924,218 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - -
    +
     
    - + + 2 -
    +
    +
     
    - + + 3 -
    +
    +
      -
    + import (
    - + + 4 -
    +
    +
      -
    + "context"
    - + + 5 -
    -   -
    +
    +
    + + + "crypto/ecdsa"
    - + + 6 -
    -   -
    +
    +
    + + + "encoding/json"
    - + + 7 -
    +
    +
      -
    + "errors"
    - + + 8 -
    +
    +
      -
    + "fmt"
    - + + 9 -
    -   -
    +
    +
    + + + "math/big"
    - + + 10 -
    +
    +
      -
    + "net"
    - + + 11 -
    +
    +
      -
    + "strconv"
    - + + 12 -
    +
    +
      -
    + "strings"
    - + +
     
    -
    +
    + 71 + +
      -
    + srv *grpc.Server
    - + + 72 -
    +
    +
      -
    + ctx context.Context
    - + + 73 -
    +
    +
      -
    + exit context.CancelFunc
    - + + 74 -
    -   +
    +
    + +
    - + + 75 -
    -   -
    +
    +
    + + + AggLayerClient client.ClientInterface
    - + + 76 -
    -   -
    +
    +
    + + + sequencerPrivateKey *ecdsa.PrivateKey
    - + + 77 -
    +
    +
      -
    + }
    - + + 78 -
    +
    +
     
    - + + 79 -
    +
    +
      -
    + // New creates a new aggregator.
    - + +
     
    -
    +
    + 82 + +
      -
    + stateInterface stateInterface,
    - + + 83 -
    +
    +
      -
    + ethTxManager ethTxManager,
    - + + 84 -
    +
    +
      -
    + etherman etherman,
    - + + 85 -
    -   -
    +
    +
    + + + agglayerClient client.ClientInterface,
    - + + 86 -
    -   -
    +
    +
    + + + sequencerPrivateKey *ecdsa.PrivateKey,
    - + + 87 -
    +
    +
      -
    + ) (Aggregator, error) {
    - + + 88 -
    +
    +
      -
    + var profitabilityChecker aggregatorTxProfitabilityChecker
    - + + 89 -
    +
    +
      -
    + switch cfg.TxProfitabilityCheckerType {
    - + +
     
    -
    +
    + 105 + +
      -
    + TimeCleanupLockedProofs: cfg.CleanupLockedProofsInterval,
    - + + 106 -
    +
    +
     
    - + + 107 -
    +
    +
      -
    + finalProof: make(chan finalProofMsg),
    - + + 108 -
    -   +
    +
    + +
    - + + 109 -
    -   -
    +
    +
    + + + AggLayerClient: agglayerClient,
    - + + 110 -
    -   -
    +
    +
    + + + sequencerPrivateKey: sequencerPrivateKey,
    - + + 111 -
    +
    +
      -
    + }
    - + + 112 -
    +
    +
     
    - + + 113 -
    +
    +
      -
    + return a, nil
    - + +
     
    -
    +
    + 131 + +
      -
    + }, nil)
    - + + 132 -
    +
    +
     
    - + + 133 -
    +
    +
      -
    + // Delete ungenerated recursive proofs
    - + + 134 -
    -   -
    +
    +
    + + + err := a.State.DeleteUngeneratedProofs(ctx, nil)
    - + + 135 -
    +
    +
      -
    + if err != nil {
    - + + 136 -
    +
    +
      -
    + return fmt.Errorf("failed to initialize proofs cache %w", err)
    - + + 137 -
    +
    +
      -
    + }
    - + +
     
    -
    +
    + 227 + +
      -
    + _, err = a.tryBuildFinalProof(ctx, prover, nil)
    - + + 228 -
    +
    +
      -
    + if err != nil {
    - + + 229 -
    +
    +
      -
    + log.Errorf("Error checking proofs to verify: %v", err)
    - + + 230 -
    -   +
    +
    + +
    - + + 231 -
    -   -
    +
    +
    + + + if errors.Is(err, context.Canceled) {
    - + + 232 -
    -   -
    +
    +
    + + + // the context was canceled, just continue, the loop will stop in the <-ctx.Done() case
    - + + 233 -
    -   -
    +
    +
    + + + continue
    - + + 234 -
    -   -
    +
    +
    + + + }
    - + + 235 -
    +
    +
      -
    + }
    - + + 236 -
    +
    +
     
    - + + 237 -
    -   -
    +
    +
    + + + proofGenerated, err := a.tryAggregateProofs(ctx, prover)
    - + + 238 -
    +
    +
      -
    + if err != nil {
    - + + 239 -
    -   -
    +
    +
    + + + log.Errorf("Error trying to aggregate proofs: %v", err)
    - + + 240 -
    +
    +
      -
    + }
    - + + 241 -
    +
    +
      -
    + if !proofGenerated {
    - + + 242 -
    -   -
    +
    +
    + + + proofGenerated, err = a.tryGenerateBatchProof(ctx, prover)
    - + + 243 -
    +
    +
      -
    + if err != nil {
    - + + 244 -
    -   -
    +
    +
    + + + log.Errorf("Error trying to generate proof: %v", err)
    - + + 245 -
    +
    +
      -
    + }
    - + + 246 -
    +
    +
      -
    + }
    - + + 247 -
    +
    +
      -
    + if !proofGenerated {
    - + + 248 -
    -   -
    +
    +
    + + + // if no proof was generated (aggregated or batch) wait some time before retry
    - + + 249 -
    -   -
    +
    +
    + + + time.Sleep(a.cfg.RetryTime.Duration)
    - + + 250 -
    -   -
    +
    +
    + + + } // if proof was generated we retry immediately as probably we have more proofs to process
    -
    + + + 251 + + +
    + + + }
    -
    -
    - - - - - - - - - - - - - - - - - + + + + + + + + + - - + + + + + + + + + - - + + + + + + - - - - - - + + + - - -
    -
     
    - 1 + 252
    + - package main + }
    - 2 + 253
    + -
    + }
    - 3 + 254
    + - import ( +
    - 4 + 255
    + - "context" + // This function waits to receive a final proof from a prover. Once it receives
    - 5 + 256
    + - "encoding/csv" + // the proof, it performs these steps in order:
    - 6 + 257
    + - "errors" + // - send the final proof to L1
    - 7 + 258
    + - "fmt" + // - wait for the synchronizer to catch up
    - 8 + 259
    + - "os" + // - clean up the cache of recursive proofs
    - 9 + 260
    + - "strings" + func (a *Aggregator) sendFinalProof() {
    - 10 + 261
    + -
    + for {
    - 11 + 262
    + - "github.com/0xPolygonHermez/zkevm-node/config" + select {
    - 12 + 263
    + - "github.com/0xPolygonHermez/zkevm-node/pool" + case <-a.ctx.Done():
    - 13 + 264
    + - "github.com/0xPolygonHermez/zkevm-node/pool/pgpoolstorage" + return
    - 14 + 265
    + - "github.com/ethereum/go-ethereum/common" + case msg := <-a.finalProof:
    - 15 + 266
    + - "github.com/urfave/cli/v2" + ctx := a.ctx
    - 16 + 267
    + - ) + proof := msg.recursiveProof
    - 17 + 268
    @@ -11921,307 +13145,367 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 18 + 269
    + - var ( + log.WithFields("proofId", proof.ProofID, "batches", fmt.Sprintf("%d-%d", proof.BatchNumber, proof.BatchNumberFinal))
    - 19 + 270
    + - policyFlag = cli.StringFlag{ + log.Info("Verifying final proof with ethereum smart contract")
    - 20 + 271
    + - Name: "policy", +
    - 21 + 272
    + - Aliases: []string{"p"}, + a.startProofVerification()
    - 22 + 273
    + - Usage: "Name of policy to operate on", +
    - 23 + 274
    + - Required: false, + finalBatch, err := a.State.GetBatchByNumber(ctx, proof.BatchNumberFinal, nil)
    - 24 + 275
    + - } + if err != nil {
    - 25 + 276
    + - csvFlag = cli.StringFlag{ + log.Errorf("Failed to retrieve batch with number [%d]: %v", proof.BatchNumberFinal, err)
    - 26 + 277
    + - Name: "csv", + a.endProofVerification()
    - 27 + 278
    + - Usage: "CSV file with addresses", + continue
    - 28 + + 279 +
    - + - Required: false, +   + }
    - 29 + + 280 +
    - + - } +   +
    - 30 + + 281 +
    + - allowFlag = cli.BoolFlag{ + inputs := ethmanTypes.FinalProofInputs{
    - 31 + + 282 +
    + - Name: "allow", + FinalProof: msg.finalProof,
    - 32 + + 283 +
    + - Usage: "Update policy to 'allow' addresses on list", + NewLocalExitRoot: finalBatch.LocalExitRoot.Bytes(),
    - 33 + + 284 +
    + - Required: false, + NewStateRoot: finalBatch.StateRoot.Bytes(),
    - 34 + 285
    + - } + }
    - 35 + 286
    + - denyFlag = cli.BoolFlag{ +
    - 36 + 287
    + - Name: "deny", + log.Infof("Final proof inputs: NewLocalExitRoot [%#x], NewStateRoot [%#x]", inputs.NewLocalExitRoot, inputs.NewStateRoot)
    - 37 + 288
    + - Usage: "Update policy to 'deny' addresses on list", +
    - 38 + 289
    + - Required: false, + switch a.cfg.SettlementBackend {
    - 39 + 290
    + - } + case AggLayer:
    - 40 + 291
    + - noHeaderFlag = cli.BoolFlag{ + if success := a.settleWithAggLayer(ctx, proof, inputs); !success {
    - 41 + 292
    + - Name: "no-header", + continue
    - 42 + 293
    + - Value: false, + }
    - 43 + 294
    + - Required: false, + default:
    - 44 + 295
    + - } + if success := a.settleDirect(ctx, proof, inputs); !success {
    - 45 + 296
    + + continue +
    +
    + 297 + +
    +   + } +
    +
    + 298 + +
    +   + } +
    +
    + 299 + +
    +  
    - 46 + + 300 +
    + - policyActionFlags = []cli.Flag{&policyFlag} + a.resetVerifyProofTime() +
    +
    + 301 + +
    + + + a.endProofVerification() +
    +
    + 302 + +
    + + + } +
    +
    + 303 + +
    + + + }
    - 47 + 304
    + - ) + }
    - 48 + 305
    @@ -12231,397 +13515,397 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 49 + 306
    + - var policyCommands = cli.Command{ + func (a *Aggregator) settleDirect(
    - 50 + 307
    + - Name: "policy", + ctx context.Context,
    - 51 + 308
    + - Usage: "View, update, and apply policies", + proof *state.Proof,
    - 52 + 309
    + - Action: describe, + inputs ethmanTypes.FinalProofInputs,
    - 53 + 310
    + - Flags: []cli.Flag{&configFileFlag}, + ) (success bool) {
    - 54 + 311
    + - Subcommands: []*cli.Command{ + // add batch verification to be monitored
    - 55 + 312
    + - { + sender := common.HexToAddress(a.cfg.SenderAddress)
    - 56 + 313
    + - Name: "add", +
    - 57 + 314
    + - Usage: "Add address(es) to a policy exclusion list", + to, data, err := a.Ethman.BuildTrustedVerifyBatchesTxData(
    - 58 + 315
    + - Action: addAcl, + proof.BatchNumber-1,
    - 59 + 316
    + - Flags: append(policyActionFlags, &csvFlag), + proof.BatchNumberFinal,
    - 60 + 317
    + - }, { + &inputs,
    - 61 + 318
    + - Name: "clear", + sender,
    - 62 + 319
    + - Usage: "Clear the addresses listed as exceptions to a policy", + )
    - 63 + 320
    + - Action: clearAcl, + if err != nil {
    - 64 + 321
    + - Flags: policyActionFlags, + log.Errorf("Error estimating batch verification to add to eth tx manager: %v", err)
    - 65 + 322
    + - }, { + a.handleFailureToAddVerifyBatchToBeMonitored(ctx, proof)
    - 66 + 323
    + - Name: "describe", +
    - 67 + 324
    + - Usage: "Describe the default actions for the policies", + return false
    - 68 + 325
    + - Action: describe, + }
    - 69 + 326
    + - Flags: append(policyActionFlags, &noHeaderFlag), +
    - 70 + 327
    + - }, { + monitoredTxID := buildMonitoredTxID(proof.BatchNumber, proof.BatchNumberFinal)
    - 71 + 328
    + - Name: "remove", + err = a.EthTxManager.Add(
    - 72 + 329
    + - Usage: "Remove address(es) from a policy exclusion list", + ctx,
    - 73 + 330
    + - Action: removeAcl, + ethTxManagerOwner,
    - 74 + 331
    + - Flags: append(policyActionFlags, &csvFlag), + monitoredTxID,
    - 75 + 332
    + - }, { + sender,
    - 76 + 333
    + - Name: "update", + to,
    - 77 + 334
    + - Usage: "Update the default action for a policy", + nil,
    - 78 + 335
    + - Action: updatePolicy, + data,
    - 79 + 336
    + - Flags: append(policyActionFlags, &allowFlag, &denyFlag), + a.cfg.GasOffset,
    - 80 + 337
    + - }, + nil,
    - 81 + 338
    + - }, + )
    - 82 + 339
    + - } + if err != nil {
    - 83 + 340
    + -
    + mTxLogger := ethtxmanager.CreateLogger(ethTxManagerOwner, monitoredTxID, sender, to)
    - 84 + 341
    + - func updatePolicy(cli *cli.Context) error { + mTxLogger.Errorf("Error to add batch verification tx to eth tx manager: %v", err)
    - 85 + 342
    + - _, db, err := configAndStorage(cli) + a.handleFailureToAddVerifyBatchToBeMonitored(ctx, proof)
    - 86 + 343
    + - if err != nil { +
    - 87 + 344
    + - return err + return false
    - 88 + 345
    @@ -12631,337 +13915,337 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 89 + 346
    + - policy, err := resolvePolicy(cli) +
    - 90 + 347
    + - if err != nil { + // process monitored batch verifications before starting a next cycle
    - 91 + 348
    + - return err + a.EthTxManager.ProcessPendingMonitoredTxs(
    - 92 + 349
    + - } + ctx,
    - 93 + 350
    + -
    + ethTxManagerOwner,
    - 94 + 351
    + - allow := cli.Bool(allowFlag.Name) + func(result ethtxmanager.MonitoredTxResult, dbTx pgx.Tx) {
    - 95 + 352
    + - deny := cli.Bool(denyFlag.Name) + a.handleMonitoredTxResult(result)
    - 96 + 353
    + -
    + },
    - 97 + 354
    + - // exactly one must be set + nil,
    - 98 + 355
    + - if (allow && deny) || (!allow && !deny) { + )
    - 99 + 356
    + - return errors.New("supply one policy action [--allow or --deny]") +
    - 100 + 357
    + - } + return true
    - 101 + 358
    + -
    + }
    - 102 + 359
    + - var setting bool +
    - 103 + 360
    + - if allow { + func (a *Aggregator) settleWithAggLayer(
    - 104 + 361
    + - setting = true + ctx context.Context,
    - 105 + 362
    + - } else if deny { + proof *state.Proof,
    - 106 + 363
    + - setting = false + inputs ethmanTypes.FinalProofInputs,
    - 107 + 364
    + - } + ) (success bool) {
    - 108 + 365
    + -
    + proofStrNo0x := strings.TrimPrefix(inputs.FinalProof.Proof, "0x")
    - 109 + 366
    + - err = db.UpdatePolicy(context.Background(), policy, setting) + proofBytes := common.Hex2Bytes(proofStrNo0x)
    - 110 + 367
    + - if err != nil { + tx := tx.Tx{
    - 111 + 368
    + - return err + LastVerifiedBatch: agglayerTypes.ArgUint64(proof.BatchNumber - 1),
    - 112 + 369
    + - } + NewVerifiedBatch: agglayerTypes.ArgUint64(proof.BatchNumberFinal),
    - 113 + 370
    + - return nil + ZKP: tx.ZKP{
    - 114 + 371
    + - } + NewStateRoot: common.BytesToHash(inputs.NewStateRoot),
    - 115 + 372
    + -
    + NewLocalExitRoot: common.BytesToHash(inputs.NewLocalExitRoot),
    - 116 + 373
    + - func addAcl(cli *cli.Context) error { + Proof: agglayerTypes.ArgBytes(proofBytes),
    - 117 + 374
    + - _, db, err := configAndStorage(cli) + },
    - 118 + 375
    + - if err != nil { + RollupID: a.Ethman.GetRollupId(),
    - 119 + 376
    + - return err + }
    - 120 + 377
    + - } + signedTx, err := tx.Sign(a.sequencerPrivateKey)
    - 121 + 378
    + - policy, addresses, err := requirePolicyAndAddresses(cli) +
    - 122 + 379
    @@ -12971,137 +14255,137 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 123 + 380
    + - return err + log.Errorf("failed to sign tx: %v", err)
    - 124 + 381
    + - } + a.handleFailureToSendToAggLayer(ctx, proof)
    - 125 + 382
    + - err = db.AddAddressesToPolicy(context.Background(), policy, addresses) +
    - 126 + 383
    + - if err != nil { + return false
    - 127 + 384
    + - return err + }
    - 128 + 385
    + - } +
    - 129 + 386
    + - return nil + log.Debug("final proof signedTx: ", signedTx.Tx.ZKP.Proof.Hex())
    - 130 + 387
    + - } + txHash, err := a.AggLayerClient.SendTx(*signedTx)
    - 131 + 388
    + -
    + if err != nil {
    - 132 + 389
    + - func removeAcl(cli *cli.Context) error { + log.Errorf("failed to send tx to the interop: %v", err)
    - 133 + 390
    + - _, db, err := configAndStorage(cli) + a.handleFailureToSendToAggLayer(ctx, proof)
    - 134 + 391
    + - if err != nil { +
    - 135 + 392
    + - return err + return false
    - 136 + 393
    @@ -13111,217 +14395,217 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 137 + 394
    + - policy, addresses, err := requirePolicyAndAddresses(cli) +
    - 138 + 395
    + - if err != nil { + log.Infof("tx %s sent to agglayer, waiting to be mined", txHash.Hex())
    - 139 + 396
    + - return err + log.Debugf("Timeout set to %f seconds", a.cfg.AggLayerTxTimeout.Duration.Seconds())
    - 140 + 397
    + - } + waitCtx, cancelFunc := context.WithDeadline(ctx, time.Now().Add(a.cfg.AggLayerTxTimeout.Duration))
    - 141 + 398
    + - err = db.RemoveAddressesFromPolicy(context.Background(), policy, addresses) + defer cancelFunc()
    - 142 + 399
    + - if err != nil { + if err := a.AggLayerClient.WaitTxToBeMined(txHash, waitCtx); err != nil {
    - 143 + 400
    + - return err + log.Errorf("interop didn't mine the tx: %v", err)
    - 144 + 401
    + - } + a.handleFailureToSendToAggLayer(ctx, proof)
    - 145 + 402
    + - return nil +
    - 146 + 403
    + - } + return false
    - 147 + 404
    + -
    + }
    - 148 + 405
    + - func clearAcl(cli *cli.Context) error { +
    - 149 + 406
    + - _, db, err := configAndStorage(cli) + // TODO: wait for synchronizer to catch up
    - 150 + 407
    + - if err != nil { + return true
    - 151 + 408
    + - return err + }
    - 152 + 409
    + - } +
    - 153 + 410
    + - policy, err := resolvePolicy(cli) + func (a *Aggregator) handleFailureToSendToAggLayer(ctx context.Context, proof *state.Proof) {
    - 154 + 411
    + - if err != nil { + log := log.WithFields("proofId", proof.ProofID, "batches", fmt.Sprintf("%d-%d", proof.BatchNumber, proof.BatchNumberFinal))
    - 155 + 412
    + - return err + proof.GeneratingSince = nil
    - 156 + 413
    + - } +
    - 157 + 414
    + - err = db.ClearPolicy(context.Background(), policy) + err := a.State.UpdateGeneratedProof(ctx, proof, nil)
    - 158 + 415
    @@ -13331,17 +14615,17 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 159 + 416
    + - return err + log.Errorf("Failed updating proof state (false): %v", err)
    - 160 + 417
    @@ -13351,357 +14635,357 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 161 + 418
    + - return nil +
    - 162 + 419
    + - } + a.endProofVerification()
    - 163 + 420
    + -
    + }
    - 164 + 421
    + - func describe(cli *cli.Context) error { +
    - 165 + 422
    + - showHeader := !cli.Bool(noHeaderFlag.Name) + func (a *Aggregator) handleFailureToAddVerifyBatchToBeMonitored(ctx context.Context, proof *state.Proof) {
    - 166 + 423
    + - if cli.IsSet(policyFlag.Name) { + log := log.WithFields("proofId", proof.ProofID, "batches", fmt.Sprintf("%d-%d", proof.BatchNumber, proof.BatchNumberFinal))
    - 167 + 424
    + - return describePolicy(cli, showHeader) + proof.GeneratingSince = nil
    - 168 + 425
    + - } + err := a.State.UpdateGeneratedProof(ctx, proof, nil)
    - 169 + 426
    + - return describePolicies(cli, showHeader) + if err != nil {
    - 170 + 427
    + - } + log.Errorf("Failed updating proof state (false): %v", err)
    - 171 + 428
    + -
    + }
    - 172 + 429
    + - func describePolicy(cli *cli.Context, showHeader bool) error { + a.endProofVerification()
    - 173 + 430
    + - _, db, err := configAndStorage(cli) + }
    - 174 + 431
    + - if err != nil { +
    - 175 + 432
    + - return err + // buildFinalProof builds and return the final proof for an aggregated/batch proof.
    - 176 + 433
    + - } + func (a *Aggregator) buildFinalProof(ctx context.Context, prover proverInterface, proof *state.Proof) (*prover.FinalProof, error) {
    - 177 + 434
    + -
    + log := log.WithFields(
    - 178 + 435
    + - policyName, err := resolvePolicy(cli) + "prover", prover.Name(),
    - 179 + 436
    + - if err != nil { + "proverId", prover.ID(),
    - 180 + 437
    + - return err + "proverAddr", prover.Addr(),
    - 181 + 438
    + - } + "recursiveProofId", *proof.ProofID,
    - 182 + 439
    + -
    + "batches", fmt.Sprintf("%d-%d", proof.BatchNumber, proof.BatchNumberFinal),
    - 183 + 440
    + - if showHeader { + )
    - 184 + 441
    + - policy, err := db.DescribePolicy(context.Background(), policyName) + log.Info("Generating final proof")
    - 185 + 442
    + - if err != nil { +
    - 186 + 443
    + - return err + finalProofID, err := prover.FinalProof(proof.Proof, a.cfg.SenderAddress)
    - 187 + 444
    + - } + if err != nil {
    - 188 + 445
    + - fmt.Printf("%s: %s\n", "Policy", policy.Name) + return nil, fmt.Errorf("failed to get final proof id: %w", err)
    - 189 + 446
    + - fmt.Printf("%s: %s\n", "Action", policy.Desc()) + }
    - 190 + 447
    + - } + proof.ProofID = finalProofID
    - 191 + 448
    + - query, err := resolveAddresses(cli, false) +
    - 192 + 449
    + - if err != nil { + log.Infof("Final proof ID for batches [%d-%d]: %s", proof.BatchNumber, proof.BatchNumberFinal, *proof.ProofID)
    - 193 + 450
    + - return nil + log = log.WithFields("finalProofId", finalProofID)
    - 194 + 451
    + - } +
    - 195 + 452
    + - list, err := db.ListAcl(context.Background(), policyName, query) + finalProof, err := prover.WaitFinalProof(ctx, *proof.ProofID)
    - 196 + 453
    @@ -13711,17 +14995,17 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 197 + 454
    + - return err + return nil, fmt.Errorf("failed to get final proof from prover: %w", err)
    - 198 + 455
    @@ -13731,7 +15015,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 199 + 456
    @@ -13741,187 +15025,187 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 200 + 457
    + - if showHeader { + log.Info("Final proof generated")
    - 201 + 458
    + - fmt.Println("Addresses:") +
    - 202 + 459
    + - } + // mock prover sanity check
    - 203 + 460
    + - for _, address := range list { + if string(finalProof.Public.NewStateRoot) == mockedStateRoot && string(finalProof.Public.NewLocalExitRoot) == mockedLocalExitRoot {
    - 204 + 461
    + - fmt.Println(address.Hex()) + // This local exit root and state root come from the mock
    - 205 + 462
    + - } + // prover, use the one captured by the executor instead
    - 206 + 463
    + - return nil + finalBatch, err := a.State.GetBatchByNumber(ctx, proof.BatchNumberFinal, nil)
    - 207 + 464
    + - } + if err != nil {
    - 208 + 465
    + -
    + return nil, fmt.Errorf("failed to retrieve batch with number [%d]", proof.BatchNumberFinal)
    - 209 + 466
    + - func describePolicies(cli *cli.Context, showHeader bool) error { + }
    - 210 + 467
    + - _, db, err := configAndStorage(cli) + log.Warnf("NewLocalExitRoot and NewStateRoot look like a mock values, using values from executor instead: LER: %v, SR: %v",
    - 211 + 468
    + - if err != nil { + finalBatch.LocalExitRoot.TerminalString(), finalBatch.StateRoot.TerminalString())
    - 212 + 469
    + - return err + finalProof.Public.NewStateRoot = finalBatch.StateRoot.Bytes()
    - 213 + 470
    + - } + finalProof.Public.NewLocalExitRoot = finalBatch.LocalExitRoot.Bytes()
    - 214 + 471
    + - list, err := db.DescribePolicies(context.Background()) + }
    - 215 + 472
    + - if err != nil { +
    - 216 + 473
    + - return err + return finalProof, nil
    - 217 + 474
    + - } + }
    - 218 + 475
    @@ -13931,357 +15215,357 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 219 + 476
    + - if showHeader { + // tryBuildFinalProof checks if the provided proof is eligible to be used to
    - 220 + 477
    + - fmt.Printf("%7s: %s\n", "Policy", "Action") + // build the final proof. If no proof is provided it looks for a previously
    - 221 + 478
    + - } + // generated proof. If the proof is eligible, then the final proof generation
    - 222 + 479
    + - for _, p := range list { + // is triggered.
    - 223 + 480
    + - fmt.Printf("%7s: %s\n", p.Name, p.Desc()) + func (a *Aggregator) tryBuildFinalProof(ctx context.Context, prover proverInterface, proof *state.Proof) (bool, error) {
    - 224 + 481
    + - } + proverName := prover.Name()
    - 225 + 482
    + -
    + proverID := prover.ID()
    - 226 + 483
    + - return nil +
    - 227 + 484
    + - } + log := log.WithFields(
    - 228 + 485
    + -
    + "prover", proverName,
    - 229 + 486
    + - func configAndStorage(cli *cli.Context) (*config.Config, *pgpoolstorage.PostgresPoolStorage, error) { + "proverId", proverID,
    - 230 + 487
    + - c, err := config.Load(cli, false) + "proverAddr", prover.Addr(),
    - 231 + 488
    + - if err != nil { + )
    - 232 + 489
    + - return nil, nil, err + log.Debug("tryBuildFinalProof start")
    - 233 + 490
    + - } +
    - 234 + 491
    + - setupLog(c.Log) + var err error
    - 235 + 492
    + -
    + if !a.canVerifyProof() {
    - 236 + 493
    + - db, err := pgpoolstorage.NewPostgresPoolStorage(c.Pool.DB) + log.Debug("Time to verify proof not reached or proof verification in progress")
    - 237 + 494
    + - if err != nil { + return false, nil
    - 238 + 495
    + - return nil, nil, err + }
    - 239 + 496
    + - } + log.Debug("Send final proof time reached")
    - 240 + 497
    + - return c, db, nil +
    - 241 + 498
    + - } + if err = a.waitForSynchronizerToSyncUp(ctx, nil); err != nil {
    - 242 + 499
    + -
    + log.Warn("waiting for the synchronizer to sync up was canceled", err)
    - 243 + 500
    + - func requirePolicyAndAddresses(cli *cli.Context) (pool.PolicyName, []common.Address, error) { + return false, err
    - 244 + 501
    + - policy, err := resolvePolicy(cli) + }
    - 245 + 502
    + - if err != nil { +
    - 246 + 503
    + - return "", nil, err + var lastVerifiedBatchNum uint64
    - 247 + 504
    + - } + lastVerifiedBatch, err := a.State.GetLastVerifiedBatch(ctx, nil)
    - 248 + 505
    + - addresses, err := resolveAddresses(cli, true) + if err != nil && !errors.Is(err, state.ErrNotFound) {
    - 249 + 506
    + - if err != nil { + return false, fmt.Errorf("failed to get last verified batch, %w", err)
    - 250 + 507
    + - return "", nil, err + }
    - 251 + 508
    + - } + if lastVerifiedBatch != nil {
    - 252 + 509
    + - return policy, addresses, nil + lastVerifiedBatchNum = lastVerifiedBatch.BatchNumber
    - 253 + 510
    + - } + }
    - 254 + 511
    @@ -14291,267 +15575,287 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 255 + 512
    + - func resolvePolicy(cli *cli.Context) (pool.PolicyName, error) { + if proof == nil {
    - 256 + 513
    + - policy := cli.String(policyFlag.Name) + // we don't have a proof generating at the moment, check if we
    - 257 + 514
    + - if policy == "" { + // have a proof ready to verify
    - 258 + 515
    + - return "", nil +
    - 259 + 516
    + - } + proof, err = a.getAndLockProofReadyToVerify(ctx, prover, lastVerifiedBatchNum)
    - 260 + 517
    + - if !pool.IsPolicy(policy) { + if errors.Is(err, state.ErrNotFound) {
    - 261 + 518
    + - return "", fmt.Errorf("invalid policy name: %s", policy) + // nothing to verify, swallow the error
    - 262 + 519
    + - } + log.Debug("No proof ready to verify")
    - 263 + 520
    + - return pool.PolicyName(policy), nil + return false, nil
    - 264 + 521
    + - } + }
    - 265 + 522
    + -
    + if err != nil {
    - 266 + 523
    + - func resolveAddresses(cli *cli.Context, failIfEmpty bool) ([]common.Address, error) { + return false, err
    - 267 + 524
    + - var set = make(map[common.Address]struct{}) + }
    - 268 + 525
    + - if cli.IsSet("csv") { +
    - 269 + 526
    + - file := cli.String(csvFlag.Name) + defer func() {
    - 270 + 527
    + - fd, err := os.Open(file) + if err != nil {
    - 271 + 528
    + - if err != nil { + // Set the generating state to false for the proof ("unlock" it)
    - 272 + 529
    + - return nil, err + proof.GeneratingSince = nil
    - 273 + 530
    + - } + err2 := a.State.UpdateGeneratedProof(a.ctx, proof, nil)
    - 274 + 531
    + - defer func(fd *os.File) { + if err2 != nil {
    - 275 + 532
    + - _ = fd.Close() + log.Errorf("Failed to unlock proof: %v", err2)
    - 276 + + 533 + +
    +   + } +
    +
    + 534 + +
    +   + } +
    +
    + 535 +
    + - }(fd) + }()
    - 277 + + 536 +
    + -
    + } else {
    - 278 + + 537 +
    + - fileReader := csv.NewReader(fd) + // we do have a proof generating at the moment, check if it is
    - 279 + + 538 +
    + - records, err := fileReader.ReadAll() + // eligible to be verified
    - 280 + 539
    + -
    + eligible, err := a.validateEligibleFinalProof(ctx, proof, lastVerifiedBatchNum)
    - 281 + 540
    @@ -14561,17 +15865,17 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 282 + 541
    + - return nil, err + return false, fmt.Errorf("failed to validate eligible final proof, %w", err)
    - 283 + 542
    @@ -14581,157 +15885,167 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 284 + 543
    + - for _, row := range records { + if !eligible {
    - 285 + 544
    + - for _, cell := range row { + return false, nil
    - 286 + 545
    + - hex := strings.TrimSpace(cell) + }
    - 287 + 546
    + - set[common.HexToAddress(hex)] = struct{}{} + }
    - 288 + 547
    + - } +
    - 289 + 548
    + - } + log = log.WithFields(
    - 290 + 549
    + - } + "proofId", *proof.ProofID,
    - 291 + 550
    + -
    + "batches", fmt.Sprintf("%d-%d", proof.BatchNumber, proof.BatchNumberFinal),
    - 292 + 551
    + - for _, a := range cli.Args().Slice() { + )
    - 293 + 552
    + - a = strings.TrimSpace(a) +
    - 294 + 553
    + - a = strings.Trim(a, ",|") + // at this point we have an eligible proof, build the final one using it
    - 295 + 554
    + - if !strings.HasPrefix(a, "0x") { + finalProof, err := a.buildFinalProof(ctx, prover, proof)
    - 296 + 555
    + - a = "0x" + a + if err != nil {
    - 297 + 556
    + - } + err = fmt.Errorf("failed to build final proof, %w", err)
    - 298 + 557
    + - set[common.HexToAddress(a)] = struct{}{} + log.Error(FirstToUpper(err.Error()))
    - 299 + 558 + +
    + + + return false, err +
    +
    + 559
    @@ -14741,67 +16055,67 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 300 + 560
    + - var ret []common.Address +
    - 301 + 561
    + - for a := range set { + msg := finalProofMsg{
    - 302 + 562
    + - ret = append(ret, a) + proverName: proverName,
    - 303 + 563
    + - } + proverID: proverID,
    - 304 + 564
    + - if failIfEmpty && len(ret) == 0 { + recursiveProof: proof,
    - 305 + 565
    + - return nil, errors.New("no addresses given") + finalProof: finalProof,
    - 306 + 566
    @@ -14811,336 +16125,307 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 307 + 567
    + - return ret, nil +
    - 308 + 568
    + - } + select {
    -
    + + + 569 + + +
    + + + case <-a.ctx.Done():
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/run.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    @@ -2,6 +2,7 @@
    - 2 + + 570 +
    -   -
    + + + return false, a.ctx.Err()
    - 3 + + 571 +
    -   - import ( + + + case a.finalProof <- msg:
    - 4 + + 572 +
    -   - "context" + + + }
    - + + 573 -
    -   +
    +
    + +
    - 5 + + 574 +
    -   - "errors" + + + log.Debug("tryBuildFinalProof end")
    - 6 + + 575 +
    -   - "fmt" + + + return true, nil
    - 7 + + 576 +
    -   - "net" + + + }
    -
    @@ -37,6 +42,7 @@
    -
    - 37 + + 577 +
    -   - "github.com/0xPolygonHermez/zkevm-node/state/runtime/executor" + + +
    - 38 + + 578 +
    -   - "github.com/0xPolygonHermez/zkevm-node/synchronizer" + + + func (a *Aggregator) validateEligibleFinalProof(ctx context.Context, proof *state.Proof, lastVerifiedBatchNum uint64) (bool, error) {
    - 39 + + 579 +
    -   - "github.com/0xPolygonHermez/zkevm-node/synchronizer/common/syncinterfaces" + + + batchNumberToVerify := lastVerifiedBatchNum + 1
    - + + 580 -
    -   +
    +
    + +
    - 40 + + 581 +
    -   - "github.com/jackc/pgx/v4/pgxpool" + + + if proof.BatchNumber != batchNumberToVerify {
    - 41 + + 582 +
    -   - "github.com/prometheus/client_golang/prometheus/promhttp" + + + if proof.BatchNumber < batchNumberToVerify && proof.BatchNumberFinal >= batchNumberToVerify {
    - 42 + + 583 +
    -   - "github.com/urfave/cli/v2" + + + // We have a proof that contains some batches below the last batch verified, anyway can be eligible as final proof
    -
    @@ -107,19 +113,27 @@
    -
    - 107 + + 584 +
    -   - log.Fatal(err) + + + log.Warnf("Proof %d-%d contains some batches lower than last batch verified %d. Check anyway if it is eligible", proof.BatchNumber, proof.BatchNumberFinal, lastVerifiedBatchNum)
    - 108 + + 585 +
    -   - } + + + } else if proof.BatchNumberFinal < batchNumberToVerify {
    - 109 + + 586 +
    -   -
    + + + // We have a proof that contains batches below that the last batch verified, we need to delete this proof
    - 110 + + 587 +
    - - - etherman, err := newEtherman(*c) + + + log.Warnf("Proof %d-%d lower than next batch to verify %d. Deleting it", proof.BatchNumber, proof.BatchNumberFinal, batchNumberToVerify)
    - + + 588 -
    -   -
    +
    +
    + + + err := a.State.DeleteGeneratedProofs(ctx, proof.BatchNumber, proof.BatchNumberFinal, nil)
    - 111 + + 589 +
    -   - if err != nil { + + + if err != nil {
    - 112 + + 590 +
    -   - log.Fatal(err) + + + return false, fmt.Errorf("failed to delete discarded proof, err: %w", err)
    - 113 + + 591 +
    -   - } + + + }
    - 114 + + 592 +
    - - -
    + + + return false, nil
    - 115 + + 593 +
    - - - // READ CHAIN ID FROM POE SC + + + } else {
    - 116 + + 594 +
    - - - l2ChainID, err := etherman.GetL2ChainID() + + + log.Debugf("Proof batch number %d is not the following to last verfied batch number %d", proof.BatchNumber, lastVerifiedBatchNum)
    - 117 + + 595 +
    -   - if err != nil { + + + return false, nil
    - 118 + 596
      - log.Fatal(err) + }
    - 119 + 597
    @@ -15149,3042 +16434,2988 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 120 + + 598 +
    -   + +
    - + + 599 -
    -   -
    +
    +
    + + + bComplete, err := a.State.CheckProofContainsCompleteSequences(ctx, proof, nil)
    - + + 600 -
    -   -
    +
    +
    + + + if err != nil {
    - + + 601 -
    -   -
    +
    +
    + + + return false, fmt.Errorf("failed to check if proof contains complete sequences, %w", err)
    - + + 602 -
    -   -
    +
    +
    + + + }
    - 121 + + 603 +
    -   - st, currentForkID := newState(cliCtx.Context, c, etherman, l2ChainID, stateSqlDB, eventLog, needsExecutor, needsStateTree, false) + + + if !bComplete {
    - 122 + + 604 +
    -   -
    + + + log.Infof("Recursive proof %d-%d not eligible to be verified: not containing complete sequences", proof.BatchNumber, proof.BatchNumberFinal)
    - + + 605 -
    -   -
    +
    +
    + + + return false, nil
    - + + 606 -
    -   -
    +
    +
    + + + }
    - + + 607 -
    -   -
    +
    +
    + + + return true, nil
    - + + 608 -
    -   -
    +
    +
    + + + }
    - + + 609 -
    -   +
    +
    + +
    - 123 + + 610 +
    -   - c.Aggregator.ChainID = l2ChainID + + + func (a *Aggregator) getAndLockProofReadyToVerify(ctx context.Context, prover proverInterface, lastVerifiedBatchNum uint64) (*state.Proof, error) {
    - 124 + + 611 +
    -   - c.Sequencer.StreamServer.ChainID = l2ChainID + + + a.StateDBMutex.Lock()
    - 125 + + 612 +
    -   - log.Infof("Chain ID read from POE SC = %v", l2ChainID) + + + defer a.StateDBMutex.Unlock()
    -
    @@ -276,8 +290,88 @@
    -
    - 276 + + 613 +
    -   - } + + +
    - 277 + + 614 +
    -   - } + + + // Get proof ready to be verified
    - 278 + + 615 +
    -   -
    + + + proofToVerify, err := a.State.GetProofReadyToVerify(ctx, lastVerifiedBatchNum, nil)
    - 279 + + 616 +
    - - - func newEtherman(c config.Config) (*etherman.Client, error) { + + + if err != nil {
    - 280 + + 617 +
    - - - return etherman.NewClient(c.Etherman, c.NetworkConfig.L1Config) + + + return nil, err
    - + + 618 -
    -   -
    +
    +
    + + + }
    - + + 619 -
    -   +
    +
    + +
    - + + 620 -
    -   -
    +
    +
    + + + now := time.Now().Round(time.Microsecond)
    - + + 621 -
    -   -
    +
    +
    + + + proofToVerify.GeneratingSince = &now
    - + + 622 -
    -   +
    +
    + +
    - + + 623 -
    -   -
    +
    +
    + + + err = a.State.UpdateGeneratedProof(ctx, proofToVerify, nil)
    - + + 624 -
    -   -
    +
    +
    + + + if err != nil {
    - + + 625 -
    -   -
    +
    +
    + + + return nil, err
    - + + 626 -
    -   -
    +
    +
    + + + }
    - + + 627 -
    -   +
    +
    + +
    - + + 628 -
    -   -
    +
    +
    + + + return proofToVerify, nil
    - + + 629 -
    -   -
    +
    +
    + + + }
    - + + 630 -
    -   +
    +
    + +
    - + + 631 -
    -   -
    +
    +
    + + + func (a *Aggregator) unlockProofsToAggregate(ctx context.Context, proof1 *state.Proof, proof2 *state.Proof) error {
    - + + 632 -
    -   -
    +
    +
    + + + // Release proofs from generating state in a single transaction
    - + + 633 -
    -   -
    +
    +
    + + + dbTx, err := a.State.BeginStateTransaction(ctx)
    - + + 634 -
    -   -
    +
    +
    + + + if err != nil {
    - + + 635 -
    -   -
    +
    +
    + + + log.Warnf("Failed to begin transaction to release proof aggregation state, err: %v", err)
    - + + 636 -
    -   -
    +
    +
    + + + return err
    - + + 637 -
    -   -
    +
    +
    + + + }
    - + + 638 -
    -   +
    +
    + +
    - + + 639 -
    -   -
    +
    +
    + + + proof1.GeneratingSince = nil
    - + + 640 -
    -   -
    +
    +
    + + + err = a.State.UpdateGeneratedProof(ctx, proof1, dbTx)
    - + + 641 -
    -   -
    +
    +
    + + + if err == nil {
    - + + 642 -
    -   -
    +
    +
    + + + proof2.GeneratingSince = nil
    - + + 643 -
    -   -
    +
    +
    + + + err = a.State.UpdateGeneratedProof(ctx, proof2, dbTx)
    - + + 644 -
    -   -
    +
    +
    + + + }
    - + + 645 -
    -   +
    +
    + +
    - + + 646 -
    -   -
    +
    +
    + + + if err != nil {
    - + + 647 -
    -   -
    +
    +
    + + + if err := dbTx.Rollback(ctx); err != nil {
    - + + 648 -
    -   -
    +
    +
    + + + err := fmt.Errorf("failed to rollback proof aggregation state: %w", err)
    - + + 649 -
    -   -
    +
    +
    + + + log.Error(FirstToUpper(err.Error()))
    - + + 650 -
    -   -
    +
    +
    + + + return err
    - + + 651 -
    -   -
    +
    +
    + + + }
    - + + 652 -
    -   -
    +
    +
    + + + return fmt.Errorf("failed to release proof aggregation state: %w", err)
    - + + 653 -
    -   -
    +
    +
    + + + }
    - + + 654 -
    -   +
    +
    + +
    - + + 655 -
    -   -
    +
    +
    + + + err = dbTx.Commit(ctx)
    - + + 656 -
    -   -
    +
    +
    + + + if err != nil {
    - + + 657 -
    -   -
    +
    +
    + + + return fmt.Errorf("failed to release proof aggregation state %w", err)
    - + + 658 -
    -   -
    +
    +
    + + + }
    - + + 659 -
    -   +
    +
    + +
    - + + 660 -
    -   -
    +
    +
    + + + return nil
    - + + 661 -
    -   -
    +
    +
    + + + }
    - + + 662 -
    -   +
    +
    + +
    - + + 663 -
    -   -
    +
    +
    + + + func (a *Aggregator) getAndLockProofsToAggregate(ctx context.Context, prover proverInterface) (*state.Proof, *state.Proof, error) {
    - + + 664 -
    -   -
    +
    +
    + + + log := log.WithFields(
    - - -
    -   -
    +
    + 665 + +
    + + + "prover", prover.Name(),
    - + + 666 -
    -   -
    +
    +
    + + + "proverId", prover.ID(),
    - + + 667 -
    -   -
    +
    +
    + + + "proverAddr", prover.Addr(),
    - + + 668 -
    -   -
    +
    +
    + + + )
    - + + 669 -
    -   +
    +
    + +
    - + + 670 -
    -   -
    +
    +
    + + + a.StateDBMutex.Lock()
    - + + 671 -
    -   -
    +
    +
    + + + defer a.StateDBMutex.Unlock()
    - + + 672 -
    -   +
    +
    + +
    - + + 673 -
    -   -
    +
    +
    + + + proof1, proof2, err := a.State.GetProofsToAggregate(ctx, nil)
    - + + 674 -
    -   -
    +
    +
    + + + if err != nil {
    - + + 675 -
    -   -
    +
    +
    + + + return nil, nil, err
    - + + 676 -
    -   -
    +
    +
    + + + }
    - + + 677 -
    -   +
    +
    + +
    - + + 678 -
    -   -
    +
    +
    + + + // Set proofs in generating state in a single transaction
    - + + 679 -
    -   -
    +
    +
    + + + dbTx, err := a.State.BeginStateTransaction(ctx)
    - + + 680 -
    -   -
    +
    +
    + + + if err != nil {
    - + + 681 -
    -   -
    +
    +
    + + + log.Errorf("Failed to begin transaction to set proof aggregation state, err: %v", err)
    - + + 682 -
    -   -
    +
    +
    + + + return nil, nil, err
    - + + 683 -
    -   -
    +
    +
    + + + }
    - + + 684 -
    -   +
    +
    + +
    - + + 685 -
    -   -
    +
    +
    + + + now := time.Now().Round(time.Microsecond)
    - + + 686 -
    -   -
    +
    +
    + + + proof1.GeneratingSince = &now
    - + + 687 -
    -   -
    +
    +
    + + + err = a.State.UpdateGeneratedProof(ctx, proof1, dbTx)
    - + + 688 -
    -   -
    +
    +
    + + + if err == nil {
    - + + 689 -
    -   -
    +
    +
    + + + proof2.GeneratingSince = &now
    - + + 690 -
    -   -
    +
    +
    + + + err = a.State.UpdateGeneratedProof(ctx, proof2, dbTx)
    - + + 691 -
    -   -
    +
    +
    + + + }
    - + + 692 -
    -   +
    +
    + +
    - + + 693 -
    -   -
    +
    +
    + + + if err != nil {
    - + + 694 -
    -   -
    +
    +
    + + + if err := dbTx.Rollback(ctx); err != nil {
    - + + 695 -
    -   -
    +
    +
    + + + err := fmt.Errorf("failed to rollback proof aggregation state %w", err)
    - + + 696 -
    -   -
    +
    +
    + + + log.Error(FirstToUpper(err.Error()))
    - + + 697 -
    -   -
    +
    +
    + + + return nil, nil, err
    - 281 + + 698 +
    -   - } + + + }
    - 282 + + 699 +
    -   -
    + + + return nil, nil, fmt.Errorf("failed to set proof aggregation state %w", err)
    - 283 + + 700 +
    -   - func runSynchronizer(cfg config.Config, etherman *etherman.Client, ethTxManagerStorage *ethtxmanager.PostgresStorage, st *state.State, pool *pool.Pool, eventLog *event.EventLog) { + + + }
    -
    @@ -295,12 +389,23 @@
    -
    - 295 + + 701 +
    -   - } + + +
    - 296 + + 702 +
    -   - log.Info("trustedSequencerURL ", trustedSequencerURL) + + + err = dbTx.Commit(ctx)
    - 297 + + 703 +
    -   - } + + + if err != nil {
    - + + 704 -
    -   -
    +
    +
    + + + return nil, nil, fmt.Errorf("failed to set proof aggregation state %w", err)
    - + + 705 -
    -   -
    +
    +
    + + + }
    - + + 706 -
    -   +
    +
    + +
    - + + 707 -
    -   -
    +
    +
    + + + return proof1, proof2, nil
    - + + 708 -
    -   -
    +
    +
    + + + }
    - + + 709 -
    -   +
    +
    + +
    - + + 710 -
    -   -
    +
    +
    + + + func (a *Aggregator) tryAggregateProofs(ctx context.Context, prover proverInterface) (bool, error) {
    - + + 711 -
    -   -
    +
    +
    + + + proverName := prover.Name()
    - + + 712 -
    -   -
    +
    +
    + + + proverID := prover.ID()
    - + + 713 -
    -   +
    +
    + +
    - + + 714 -
    -   -
    +
    +
    + + + log := log.WithFields(
    - 298 + + 715 +
    -   - zkEVMClient := client.NewClient(trustedSequencerURL) + + + "prover", proverName,
    - 299 + + 716 +
    -   - etherManForL1 := []syncinterfaces.EthermanFullInterface{} + + + "proverId", proverID,
    - 300 + + 717 +
    -   - // If synchronizer are using sequential mode, we only need one etherman client + + + "proverAddr", prover.Addr(),
    - 301 + + 718 +
    -   - if cfg.Synchronizer.L1SynchronizationMode == synchronizer.ParallelMode { + + + )
    - 302 + + 719 +
    -   - for i := 0; i < int(cfg.Synchronizer.L1ParallelSynchronization.MaxClients+1); i++ { + + + log.Debug("tryAggregateProofs start")
    - 303 + + 720 +
    - - - eth, err := newEtherman(cfg) + + +
    - 304 + + 721 +
    -   - if err != nil { + + + proof1, proof2, err0 := a.getAndLockProofsToAggregate(ctx, prover)
    - 305 + + 722 +
    -   - log.Fatal(err) + + + if errors.Is(err0, state.ErrNotFound) {
    - 306 + + 723 +
    -   - } + + + // nothing to aggregate, swallow the error
    -
    @@ -310,7 +415,7 @@
    -
    - 310 + + 724 +
    -   - etm := ethtxmanager.New(cfg.EthTxManager, etherman, ethTxManagerStorage, st) + + + log.Debug("Nothing to aggregate")
    - 311 + + 725 +
    -   - sy, err := synchronizer.NewSynchronizer( + + + return false, nil
    - 312 + + 726 +
    -   - cfg.IsTrustedSequencer, etherman, etherManForL1, st, pool, etm, + + + }
    - 313 + + 727 +
    - - - zkEVMClient, eventLog, cfg.NetworkConfig.Genesis, cfg.Synchronizer, cfg.Log.Environment == "development", + + + if err0 != nil {
    - 314 + + 728 +
    -   - ) + + + return false, err0
    - 315 + + 729 +
    -   - if err != nil { + + + }
    - 316 + + 730 +
    -   - log.Fatal(err) + + +
    -
    @@ -403,12 +508,12 @@
    -
    - 403 + + 731 +
    -   - } + + + var (
    - 404 + + 732 +
    -   -
    + + + aggrProofID *string
    - 405 + + 733 +
    -   - func createSequenceSender(cfg config.Config, pool *pool.Pool, etmStorage *ethtxmanager.PostgresStorage, st *state.State, eventLog *event.EventLog) *sequencesender.SequenceSender { + + + err error
    - 406 + + 734 +
    - - - etherman, err := newEtherman(cfg) + + + )
    - 407 + + 735 +
    -   - if err != nil { + + +
    - 408 + + 736 +
    -   - log.Fatal(err) + + + defer func() {
    - 409 + + 737 +
    -   - } + + + if err != nil {
    - 410 + + 738 +
    -   -
    + + + err2 := a.unlockProofsToAggregate(a.ctx, proof1, proof2)
    - 411 + + 739 +
    - - - auth, err := etherman.LoadAuthFromKeyStore(cfg.SequenceSender.PrivateKey.Path, cfg.SequenceSender.PrivateKey.Password) + + + if err2 != nil {
    - 412 + + 740 +
    -   - if err != nil { + + + log.Errorf("Failed to release aggregated proofs, err: %v", err2)
    - 413 + + 741 +
    -   - log.Fatal(err) + + + }
    - 414 + + 742 +
    -   - } + + + }
    -
    @@ -418,7 +523,12 @@
    -
    - 418 + + 743 +
    -   -
    + + + log.Debug("tryAggregateProofs end")
    - 419 + + 744 +
    -   - ethTxManager := ethtxmanager.New(cfg.EthTxManager, etherman, etmStorage, st) + + + }()
    - 420 + + 745 +
    -   + +
    - 421 + + 746 +
    - - - seqSender, err := sequencesender.New(cfg.SequenceSender, st, etherman, ethTxManager, eventLog) + + + log.Infof("Aggregating proofs: %d-%d and %d-%d", proof1.BatchNumber, proof1.BatchNumberFinal, proof2.BatchNumber, proof2.BatchNumberFinal)
    - + + 747 -
    -   +
    +
    + +
    - + + 748 -
    -   -
    +
    +
    + + + batches := fmt.Sprintf("%d-%d", proof1.BatchNumber, proof2.BatchNumberFinal)
    - + + 749 -
    -   -
    +
    +
    + + + log = log.WithFields("batches", batches)
    - + + 750 -
    -   +
    +
    + +
    - + + 751 -
    -   -
    +
    +
    + + + inputProver := map[string]interface{}{
    - 422 + + 752 +
    -   - if err != nil { + + + "recursive_proof_1": proof1.Proof,
    - 423 + + 753 +
    -   - log.Fatal(err) + + + "recursive_proof_2": proof2.Proof,
    - 424 + + 754 +
    -   + + }
    -
    @@ -427,7 +537,23 @@
    +
    + 755 + +
    + + + b, err := json.Marshal(inputProver) +
    - 427 + + 756 +
    -   - } + + + if err != nil {
    - 428 + + 757 +
    -   -
    + + + err = fmt.Errorf("failed to serialize input prover, %w", err)
    - 429 + + 758 +
    -   - func runAggregator(ctx context.Context, c aggregator.Config, etherman *etherman.Client, ethTxManager *ethtxmanager.Client, st *state.State) { + + + log.Error(FirstToUpper(err.Error()))
    - 430 + + 759 +
    - - - agg, err := aggregator.New(c, st, ethTxManager, etherman) + + + return false, err
    - + + 760 -
    -   -
    +
    +
    + + + }
    - + + 761 -
    -   +
    +
    + +
    - + + 762 -
    -   -
    +
    +
    + + + proof := &state.Proof{
    - + + 763 -
    -   -
    +
    +
    + + + BatchNumber: proof1.BatchNumber,
    - + + 764 -
    -   -
    +
    +
    + + + BatchNumberFinal: proof2.BatchNumberFinal,
    - + + 765 -
    -   -
    +
    +
    + + + Prover: &proverName,
    - + + 766 -
    -   -
    +
    +
    + + + ProverID: &proverID,
    - + + 767 -
    -   -
    +
    +
    + + + InputProver: string(b),
    - + + 768 -
    -   -
    +
    +
    + + + }
    - + + 769 -
    -   +
    +
    + +
    - + + 770 -
    -   -
    +
    +
    + + + aggrProofID, err = prover.AggregatedProof(proof1.Proof, proof2.Proof)
    - + + 771 -
    -   -
    +
    +
    + + + if err != nil {
    - + + 772 -
    -   -
    +
    +
    + + + err = fmt.Errorf("failed to get aggregated proof id, %w", err)
    - + + 773 -
    -   -
    +
    +
    + + + log.Error(FirstToUpper(err.Error()))
    - + + 774 -
    -   -
    +
    +
    + + + return false, err
    - + + 775 -
    -   -
    +
    +
    + + + }
    - 431 + + 776 +
    -   - if err != nil { + + +
    - 432 + + 777 +
    -   - log.Fatal(err) + + + proof.ProofID = aggrProofID
    - 433 + + 778 +
    -   - } + + +
    -
    @@ -497,14 +623,14 @@
    -
    - 497 + + 779 +
    -   - } + + + log.Infof("Proof ID for aggregated proof: %v", *proof.ProofID)
    - 498 + + 780 +
    -   - log.Infof("Starting L1InfoRoot: %v", l1inforoot.String()) + + + log = log.WithFields("proofId", *proof.ProofID)
    - 499 + + 781 +
    -   + +
    - 500 + + 782 +
    - - - forkIDIntervals, err := forkIDIntervals(ctx, st, etherman, c.NetworkConfig.Genesis.BlockNumber) + + + recursiveProof, err := prover.WaitRecursiveProof(ctx, *proof.ProofID)
    - 501 + + 783 +
    -   + + if err != nil {
    - 502 + + 784 +
    -   - log.Fatal("error getting forkIDs. Error: ", err) + + + err = fmt.Errorf("failed to get aggregated proof from prover, %w", err)
    - 503 + + 785 +
    -   - } + + + log.Error(FirstToUpper(err.Error()))
    - 504 + + 786 +
    -   - st.UpdateForkIDIntervalsInMemory(forkIDIntervals) + + + return false, err
    - 505 + + 787 +
    -   -
    + + + }
    - 506 + + 788 +
    -   - currentForkID := forkIDIntervals[len(forkIDIntervals)-1].ForkId + + +
    - 507 + + 789 +
    - - - log.Infof("Fork ID read from POE SC = %v", forkIDIntervals[len(forkIDIntervals)-1].ForkId) + + + log.Info("Aggregated proof generated")
    - 508 + + 790 +
    -   + +
    - 509 + + 791 +
    -   - return st, currentForkID + + + proof.Proof = recursiveProof
    - 510 + + 792 +
    -   - } + + +
    -
    @@ -520,13 +646,13 @@
    +
    + 793 + +
    + + + // update the state by removing the 2 aggregated proofs and storing the +
    - 520 + + 794 +
    -   - } + + + // newly generated recursive proof
    - 521 + + 795 +
    -   -
    + + + dbTx, err := a.State.BeginStateTransaction(ctx)
    - 522 + + 796 +
    -   - func createEthTxManager(cfg config.Config, etmStorage *ethtxmanager.PostgresStorage, st *state.State) *ethtxmanager.Client { + + + if err != nil {
    - 523 + + 797 +
    - - - etherman, err := newEtherman(cfg) + + + err = fmt.Errorf("failed to begin transaction to update proof aggregation state, %w", err)
    - 524 + + 798 +
    -   - if err != nil { + + + log.Error(FirstToUpper(err.Error()))
    - 525 + + 799 +
    -   - log.Fatal(err) + + + return false, err
    - 526 + + 800 +
    -   + + }
    - 527 + + 801 +
    -   + +
    - 528 + + 802 +
    -   - for _, privateKey := range cfg.EthTxManager.PrivateKeys { + + + err = a.State.DeleteGeneratedProofs(ctx, proof1.BatchNumber, proof2.BatchNumberFinal, dbTx)
    - 529 + + 803 +
    - - - _, err := etherman.LoadAuthFromKeyStore(privateKey.Path, privateKey.Password) + + + if err != nil {
    - 530 + + 804 +
    -   - if err != nil { + + + if err := dbTx.Rollback(ctx); err != nil {
    - 531 + + 805 +
    -   - log.Fatal(err) + + + err := fmt.Errorf("failed to rollback proof aggregation state, %w", err)
    - 532 + + 806 +
    -   - } + + + log.Error(FirstToUpper(err.Error()))
    -
    @@ -658,14 +784,32 @@
    -
    - 658 + + 807 +
    -   - } + + + return false, err
    - 659 + + 808 +
    -   - forkIDIntervals = forkIntervals + + + }
    - 660 + + 809 +
    -   - } else { + + + err = fmt.Errorf("failed to delete previously aggregated proofs, %w", err)
    - 661 + + 810 +
    - - - log.Debug("Getting initial forkID") + + + log.Error(FirstToUpper(err.Error()))
    - 662 + + 811 +
    - - - forkIntervals, err := etherman.GetForks(ctx, genesisBlockNumber, genesisBlockNumber) + + + return false, err
    - + + 812 -
    -   -
    +
    +
    + + + }
    - + + 813 -
    -   +
    +
    + +
    - + + 814 -
    -   -
    +
    +
    + + + now := time.Now().Round(time.Microsecond)
    - + + 815 -
    -   -
    +
    +
    + + + proof.GeneratingSince = &now
    - + + 816 -
    -   +
    +
    + +
    - + + 817 -
    -   -
    +
    +
    + + + err = a.State.AddGeneratedProof(ctx, proof, dbTx)
    - + + 818 -
    -   -
    +
    +
    + + + if err != nil {
    - + + 819 -
    -   -
    +
    +
    + + + if err := dbTx.Rollback(ctx); err != nil {
    - 663 + + 820 +
    -   - if err != nil { + + + err := fmt.Errorf("failed to rollback proof aggregation state, %w", err)
    - 664 + + 821 +
    -   - return []state.ForkIDInterval{}, fmt.Errorf("error getting forks. Please check the configuration. Error: %v", err) + + + log.Error(FirstToUpper(err.Error()))
    - 665 + + 822 +
    -   - } else if len(forkIntervals) == 0 { + + + return false, err
    - 666 + + 823 +
    -   - return []state.ForkIDInterval{}, fmt.Errorf("error: no forkID received. It should receive at least one, please check the configuration...") + + + }
    - 667 + + 824 +
    -   - } + + + err = fmt.Errorf("failed to store the recursive proof, %w", err)
    - 668 + + 825 +
    -   - forkIDIntervals = forkIntervals + + + log.Error(FirstToUpper(err.Error()))
    - + + 826 -
    -   -
    +
    +
    + + + return false, err
    - + + 827 -
    -   -
    +
    +
    + + + }
    - + + 828 -
    -   +
    +
    + +
    - + + 829 -
    -   -
    +
    +
    + + + err = dbTx.Commit(ctx)
    - + + 830 -
    -   -
    +
    +
    + + + if err != nil {
    - + + 831 -
    -   -
    +
    +
    + + + err = fmt.Errorf("failed to store the recursive proof, %w", err)
    - + + 832 -
    -   -
    +
    +
    + + + log.Error(FirstToUpper(err.Error()))
    - + + 833 -
    -   -
    +
    +
    + + + return false, err
    - + + 834 -
    -   -
    +
    +
    + + + }
    - + + 835 -
    -   +
    +
    + +
    - 669 + + 836 +
    -   - } + + + // NOTE(pg): the defer func is useless from now on, use a different variable
    - 670 + + 837 +
    -   - } + + + // name for errors (or shadow err in inner scopes) to not trigger it.
    - 671 + + 838 +
    -   - return forkIDIntervals, nil -
    -
    -
    + + +
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -19724,162 +20920,177 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    + + + - - + + + + + + + - - - - - + + + - - - - - - - - - + - + + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    - 2 + + 839 +
    -   -
    + + + // state is up to date, check if we can send the final proof using the
    - 3 + + 840 +
    -   - import ( + + + // one just crafted.
    - 4 + + 841 +
    -   - "context" + + + finalProofBuilt, finalProofErr := a.tryBuildFinalProof(ctx, prover, proof)
    - 5 + 842
    + - "crypto/ecdsa" + if finalProofErr != nil {
    - 6 + + 843 +
    -   - "errors" + + + // just log the error and continue to handle the aggregated proof
    - 7 + + 844 +
    -   - "fmt" + + + log.Errorf("Failed trying to check if recursive proof can be verified: %v", finalProofErr)
    - 8 + + 845 +
    -   - "net" + + + }
    -
     
    -
    - 42 + + 846 +
    -   - "github.com/0xPolygonHermez/zkevm-node/state/runtime/executor" + + +
    - 43 + + 847 +
    -   - "github.com/0xPolygonHermez/zkevm-node/synchronizer" + + + // NOTE(pg): prover is done, use a.ctx from now on
    - 44 + + 848 +
    -   - "github.com/0xPolygonHermez/zkevm-node/synchronizer/common/syncinterfaces" + + +
    - 45 + 849
    + - "github.com/ethereum/go-ethereum/ethclient" + if !finalProofBuilt {
    - 46 + + 850 +
    -   - "github.com/jackc/pgx/v4/pgxpool" + + + proof.GeneratingSince = nil
    - 47 + + 851 +
    -   - "github.com/prometheus/client_golang/prometheus/promhttp" + + +
    - 48 + + 852 +
    -   - "github.com/urfave/cli/v2" + + + // final proof has not been generated, update the recursive proof
    -
     
    -
    - 113 + + 853 +
    -   - log.Fatal(err) + + + err := a.State.UpdateGeneratedProof(a.ctx, proof, nil)
    - 114 + + 854 +
    -   - } + + + if err != nil {
    - 115 + + 855 +
    -   -
    + + + err = fmt.Errorf("failed to store batch proof result, %w", err)
    - 116 + + 856 +
    + - // READ CHAIN ID FROM POE SC + log.Error(FirstToUpper(err.Error()))
    - 117 + 857
    + - tmpEthMan, err := etherman.NewClient(c.Etherman, c.NetworkConfig.L1Config, nil) + return false, err
    - 118 + + 858 +
    -   - if err != nil { + + + }
    - 119 + + 859 +
    -   - log.Fatal(err) + + + }
    - 120 + + 860 +
    -   - } + + +
    - 121 + + 861 +
    + - l2ChainID, err := tmpEthMan.GetL2ChainID() + return true, nil
    - + + 862 -
    -   -
    +
    +
    + + + }
    - + + 863 -
    -   +
    +
    + +
    - 122 + + 864 +
    -   - if err != nil { + + + func (a *Aggregator) getAndLockBatchToProve(ctx context.Context, prover proverInterface) (*state.Batch, *state.Proof, error) {
    - 123 + + 865 +
    -   - log.Fatal(err) + + + proverID := prover.ID()
    - 124 + + 866 +
    -   - } + + + proverName := prover.Name()
    - 125 + + 867 +
    -   + +
    - 126 + 868
    + - etherman, err := etherman.NewClient(c.Etherman, c.NetworkConfig.L1Config, nil) + log := log.WithFields(
    - 127 + 869
    + - if err != nil { + "prover", proverName,
    - 128 + 870
    + - log.Fatal(err) + "proverId", proverID,
    - 129 + 871
    + - } + "proverAddr", prover.Addr(),
    - 130 + + 872 +
    -   - st, currentForkID := newState(cliCtx.Context, c, etherman, l2ChainID, stateSqlDB, eventLog, needsExecutor, needsStateTree, false) + + + )
    - 131 + + 873 +
    -   + +
    - 132 + 874
    + - etherman, err = newEtherman(*c, st) + a.StateDBMutex.Lock()
    - 133 + 875
    + - if err != nil { + defer a.StateDBMutex.Unlock()
    - 134 + 876
    + - log.Fatal(err) +
    - 135 + 877
    + - } + lastVerifiedBatch, err := a.State.GetLastVerifiedBatch(ctx, nil)
    - 136 + 878
    + -
    + if err != nil {
    - 137 + + 879 +
    -   - c.Aggregator.ChainID = l2ChainID + + + return nil, nil, err
    - 138 + + 880 +
    -   - c.Sequencer.StreamServer.ChainID = l2ChainID + + + }
    - 139 + + 881 +
    -   - log.Infof("Chain ID read from POE SC = %v", l2ChainID) + + +
    -
     
    -
    - 290 + + 882 +
    -   - } + + + // Get header of the last L1 block
    - 291 + + 883 +
    -   - } + + + lastL1BlockHeader, err := a.Ethman.GetLatestBlockHeader(ctx)
    - 292 + + 884 +
    -   -
    + + + if err != nil {
    - 293 + + 885 +
    + - func newEtherman(c config.Config, st *state.State) (*etherman.Client, error) { + log.Errorf("Failed to get last L1 block header, err: %v", err)
    - 294 + + 886 +
    + - ethman, err := etherman.NewClient(c.Etherman, c.NetworkConfig.L1Config, nil) + return nil, nil, err
    - 295 + 887
    + - if err != nil { + }
    - 296 + 888
    + - return nil, err + lastL1BlockNumber := lastL1BlockHeader.Number.Uint64()
    - 297 + 889
    + - } +
    - 298 + 890
    + - da, err := newDataAvailability(c, st, ethman, false) + // Calculate max L1 block number for getting next virtual batch to prove
    - 299 + 891
    + - if err != nil { + maxL1BlockNumber := uint64(0)
    - 300 + 892
    + - return nil, err + if a.cfg.BatchProofL1BlockConfirmations <= lastL1BlockNumber {
    - 301 + 893
    + - } + maxL1BlockNumber = lastL1BlockNumber - a.cfg.BatchProofL1BlockConfirmations
    - 302 + 894
    + - return etherman.NewClient(c.Etherman, c.NetworkConfig.L1Config, da) + }
    - 303 + 895
    + - } + log.Debugf("Max L1 block number for getting next virtual batch to prove: %d", maxL1BlockNumber)
    - 304 + 896
    @@ -18194,167 +19425,167 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 305 + 897
    + - func newDataAvailability(c config.Config, st *state.State, etherman *etherman.Client, isSequenceSender bool) (*dataavailability.DataAvailability, error) { + // Get virtual batch pending to generate proof
    - 306 + 898
    + - var ( + batchToVerify, err := a.State.GetVirtualBatchToProve(ctx, lastVerifiedBatch.BatchNumber, maxL1BlockNumber, nil)
    - 307 + 899
    + - trustedSequencerURL string + if err != nil {
    - 308 + 900
    + - err error + return nil, nil, err
    - 309 + 901
    + - ) + }
    - 310 + 902
    + - if !c.IsTrustedSequencer { +
    - 311 + 903
    + - if c.Synchronizer.TrustedSequencerURL != "" { + log.Infof("Found virtual batch %d pending to generate proof", batchToVerify.BatchNumber)
    - 312 + 904
    + - trustedSequencerURL = c.Synchronizer.TrustedSequencerURL + log = log.WithFields("batch", batchToVerify.BatchNumber)
    - 313 + 905
    + - } else { +
    - 314 + 906
    + - log.Debug("getting trusted sequencer URL from smc") + log.Info("Checking profitability to aggregate batch")
    - 315 + 907
    + - trustedSequencerURL, err = etherman.GetTrustedSequencerURL() +
    - 316 + 908
    + - if err != nil { + // pass pol collateral as zero here, bcs in smart contract fee for aggregator is not defined yet
    - 317 + 909
    + - return nil, fmt.Errorf("error getting trusted sequencer URI. Error: %v", err) + isProfitable, err := a.ProfitabilityChecker.IsProfitable(ctx, big.NewInt(0))
    - 318 + 910
    + - } + if err != nil {
    - 319 + 911
    + - } + log.Errorf("Failed to check aggregator profitability, err: %v", err)
    - 320 + 912
    + - log.Debug("trustedSequencerURL ", trustedSequencerURL) + return nil, nil, err
    - 321 + 913
    @@ -18364,247 +19595,247 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 322 + 914
    + - zkEVMClient := client.NewClient(trustedSequencerURL) +
    - 323 + 915
    + -
    + if !isProfitable {
    - 324 + 916
    + - // Backend specific config + log.Infof("Batch is not profitable, pol collateral %d", big.NewInt(0))
    - 325 + 917
    + - daProtocolName, err := etherman.GetDAProtocolName() + return nil, nil, err
    - 326 + 918
    + - if err != nil { + }
    - 327 + 919
    + - return nil, fmt.Errorf("error getting data availability protocol name: %v", err) +
    - 328 + 920
    + - } + now := time.Now().Round(time.Microsecond)
    - 329 + 921
    + - var daBackend dataavailability.DABackender + proof := &state.Proof{
    - 330 + 922
    + - switch daProtocolName { + BatchNumber: batchToVerify.BatchNumber,
    - 331 + 923
    + - case string(dataavailability.DataAvailabilityCommittee): + BatchNumberFinal: batchToVerify.BatchNumber,
    - 332 + 924
    + - var ( + Prover: &proverName,
    - 333 + 925
    + - pk *ecdsa.PrivateKey + ProverID: &proverID,
    - 334 + 926
    + - err error + GeneratingSince: &now,
    - 335 + 927
    + - ) + }
    - 336 + 928
    + - if isSequenceSender { +
    - 337 + 929
    + - _, pk, err = etherman.LoadAuthFromKeyStore(c.SequenceSender.PrivateKey.Path, c.SequenceSender.PrivateKey.Password) + // Avoid other prover to process the same batch
    - 338 + 930
    + - if err != nil { + err = a.State.AddGeneratedProof(ctx, proof, nil)
    - 339 + 931
    + - return nil, err + if err != nil {
    - 340 + 932
    + - } + log.Errorf("Failed to add batch proof, err: %v", err)
    - 341 + 933
    + - } + return nil, nil, err
    - 342 + 934
    + - dacAddr, err := etherman.GetDAProtocolAddr() + }
    - 343 + 935
    + - if err != nil { +
    - 344 + 936
    + - return nil, fmt.Errorf("error getting trusted sequencer URI. Error: %v", err) + return batchToVerify, proof, nil
    - 345 + 937
    + - } + }
    - 346 + 938
    @@ -18614,452 +19845,437 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 347 + 939
    + - daBackend, err = datacommittee.New( + func (a *Aggregator) tryGenerateBatchProof(ctx context.Context, prover proverInterface) (bool, error) {
    - 348 + 940
    + - c.Etherman.URL, + log := log.WithFields(
    - 349 + 941
    + - dacAddr, + "prover", prover.Name(),
    - 350 + 942
    + - pk, + "proverId", prover.ID(),
    - 351 + 943
    + - dataCommitteeClient.NewFactory(), + "proverAddr", prover.Addr(),
    - 352 + 944
    + - ) + )
    - 353 + 945
    + - if err != nil { + log.Debug("tryGenerateBatchProof start")
    - 354 + 946
    + - return nil, err +
    - 355 + 947
    + - } + batchToProve, proof, err0 := a.getAndLockBatchToProve(ctx, prover)
    - 356 + 948
    + - default: + if errors.Is(err0, state.ErrNotFound) {
    - 357 + 949
    + - return nil, fmt.Errorf("unexpected / unsupported DA protocol: %s", daProtocolName) + // nothing to proof, swallow the error
    - 358 + 950
    + - } + log.Debug("Nothing to generate proof")
    - 359 + 951
    + -
    + return false, nil
    - 360 + 952
    + - return dataavailability.New( + }
    - 361 + 953
    + - c.IsTrustedSequencer, + if err0 != nil {
    - 362 + 954
    + - daBackend, + return false, err0
    - 363 + 955
    + - st, + }
    - 364 + 956
    + - zkEVMClient, +
    - 365 + 957
    + - ) + log = log.WithFields("batch", batchToProve.BatchNumber)
    - 366 + 958
    + - } +
    - 367 + 959
    + -
    + var (
    - 368 + 960
    + - func newL2EthClient(url string) (*ethclient.Client, error) { + genProofID *string
    - 369 + 961
    + - ethClient, err := ethclient.Dial(url) + err error
    - 370 + 962
    + - if err != nil { + )
    - 371 + 963
    + - log.Errorf("error connecting L1 to %s: %+v", url, err) +
    - 372 + 964
    + - return nil, err + defer func() {
    - 373 + 965
    + - } + if err != nil {
    - 374 + 966
    + - return ethClient, nil + err2 := a.State.DeleteGeneratedProofs(a.ctx, proof.BatchNumber, proof.BatchNumberFinal, nil)
    - 375 + + 967 +
    -   - } + + + if err2 != nil {
    - 376 + + 968 +
    -   -
    + + + log.Errorf("Failed to delete proof in progress, err: %v", err2)
    - 377 + + 969 +
    -   - func runSynchronizer(cfg config.Config, etherman *etherman.Client, ethTxManagerStorage *ethtxmanager.PostgresStorage, st *state.State, pool *pool.Pool, eventLog *event.EventLog) { + + + }
    -
     
    -
    - 389 + + 970 +
    -   + + }
    - 390 - -
    -   - log.Info("trustedSequencerURL ", trustedSequencerURL) -
    -
    - 391 + + 971 +
    -   - } + + + log.Debug("tryGenerateBatchProof end")
    - 392 + 972
    + - var ethClientForL2 *ethclient.Client + }()
    - 393 + 973
    + - if trustedSequencerURL != "" { +
    - 394 + 974
    + - log.Infof("Creating L2 ethereum client %s", trustedSequencerURL) + log.Info("Generating proof from batch")
    - 395 + 975
    + - ethClientForL2, err = newL2EthClient(trustedSequencerURL) +
    - 396 + 976
    + - if err != nil { + log.Infof("Sending zki + batch to the prover, batchNumber [%d]", batchToProve.BatchNumber)
    - 397 + 977
    + - log.Fatalf("Can't create L2 ethereum client. Err:%w", err) + inputProver, err := a.buildInputProver(ctx, batchToProve)
    - 398 + 978
    + - } + if err != nil {
    - 399 + 979
    + - } else { + err = fmt.Errorf("failed to build input prover, %w", err)
    - 400 + 980
    + - ethClientForL2 = nil + log.Error(FirstToUpper(err.Error()))
    - 401 + 981
    + - log.Infof("skipping creating L2 ethereum client because URL is empty") + return false, err
    - 402 + 982
    @@ -19068,373 +20284,358 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 403 + + 983 +
    -   - zkEVMClient := client.NewClient(trustedSequencerURL) + + +
    - 404 + + 984 +
    -   - etherManForL1 := []syncinterfaces.EthermanFullInterface{} + + + b, err := json.Marshal(inputProver)
    - 405 + + 985 +
    -   - // If synchronizer are using sequential mode, we only need one etherman client + + + if err != nil {
    - 406 + + 986 +
    -   - if cfg.Synchronizer.L1SynchronizationMode == synchronizer.ParallelMode { + + + err = fmt.Errorf("failed to serialize input prover, %w", err)
    - 407 + + 987 +
    -   - for i := 0; i < int(cfg.Synchronizer.L1ParallelSynchronization.MaxClients+1); i++ { + + + log.Error(FirstToUpper(err.Error()))
    - 408 + + 988 +
    + - eth, err := newEtherman(cfg, st) + return false, err
    - 409 + + 989 +
    -   - if err != nil { + + + }
    - 410 + + 990 +
    -   - log.Fatal(err) + + +
    - 411 + + 991 +
    -   - } + + + proof.InputProver = string(b)
    -
     
    -
    - 415 + + 992 +
    -   - etm := ethtxmanager.New(cfg.EthTxManager, etherman, ethTxManagerStorage, st) + + +
    - 416 + + 993 +
    -   - sy, err := synchronizer.NewSynchronizer( + + + log.Infof("Sending a batch to the prover. OldStateRoot [%#x], OldBatchNum [%d]",
    - 417 + + 994 +
    -   - cfg.IsTrustedSequencer, etherman, etherManForL1, st, pool, etm, + + + inputProver.PublicInputs.OldStateRoot, inputProver.PublicInputs.OldBatchNum)
    - 418 + + 995 +
    + - zkEVMClient, ethClientForL2, eventLog, cfg.NetworkConfig.Genesis, cfg.Synchronizer, cfg.Log.Environment == "development", +
    - 419 + + 996 +
    -   - ) + + + genProofID, err = prover.BatchProof(inputProver)
    - 420 + + 997 +
    -   + + if err != nil {
    - 421 + + 998 +
    -   - log.Fatal(err) + + + err = fmt.Errorf("failed to get batch proof id, %w", err)
    -
     
    -
    - 508 + + 999 +
    -   - } + + + log.Error(FirstToUpper(err.Error()))
    - 509 + + 1000 +
    -   -
    + + + return false, err
    - 510 + + 1001 +
    -   - func createSequenceSender(cfg config.Config, pool *pool.Pool, etmStorage *ethtxmanager.PostgresStorage, st *state.State, eventLog *event.EventLog) *sequencesender.SequenceSender { + + + }
    - 511 + + 1002 +
    + - etherman, err := newEtherman(cfg, st) +
    - 512 + + 1003 +
    -   - if err != nil { + + + proof.ProofID = genProofID
    - 513 + + 1004 +
    -   - log.Fatal(err) + + +
    - 514 + + 1005 +
    -   - } + + + log.Infof("Proof ID %v", *proof.ProofID)
    - 515 + + 1006 +
    -   -
    + + + log = log.WithFields("proofId", *proof.ProofID)
    - 516 + + 1007 +
    + - auth, _, err := etherman.LoadAuthFromKeyStore(cfg.SequenceSender.PrivateKey.Path, cfg.SequenceSender.PrivateKey.Password) +
    - 517 + + 1008 +
    -   - if err != nil { + + + resGetProof, err := prover.WaitRecursiveProof(ctx, *proof.ProofID)
    - 518 + + 1009 +
    -   - log.Fatal(err) + + + if err != nil {
    - 519 + + 1010 +
    -   - } + + + err = fmt.Errorf("failed to get proof from prover, %w", err)
    -
     
    -
    - 523 + + 1011 +
    -   -
    + + + log.Error(FirstToUpper(err.Error()))
    - 524 + + 1012 +
    -   - ethTxManager := ethtxmanager.New(cfg.EthTxManager, etherman, etmStorage, st) + + + return false, err
    - 525 + + 1013 +
    -   -
    + + + }
    - 526 + + 1014 +
    + - da, err := newDataAvailability(cfg, st, etherman, true) +
    - 527 + 1015
    + - if err != nil { + log.Info("Batch proof generated")
    - 528 + 1016
    + - log.Fatal(err) +
    - 529 + 1017
    + - } + proof.Proof = resGetProof
    - 530 + 1018
    @@ -19444,212 +20645,207 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 531 + 1019
    + - seqSender, err := sequencesender.New(cfg.SequenceSender, st, etherman, ethTxManager, eventLog, da) + // NOTE(pg): the defer func is useless from now on, use a different variable
    - 532 + + 1020 +
    -   - if err != nil { + + + // name for errors (or shadow err in inner scopes) to not trigger it.
    - 533 + + 1021 +
    -   - log.Fatal(err) + + +
    - 534 + + 1022 +
    -   - } + + + finalProofBuilt, finalProofErr := a.tryBuildFinalProof(ctx, prover, proof)
    -
     
    -
    - 537 + + 1023 +
    -   - } + + + if finalProofErr != nil {
    - 538 + + 1024 +
    -   -
    + + + // just log the error and continue to handle the generated proof
    - 539 + + 1025 +
    -   - func runAggregator(ctx context.Context, c aggregator.Config, etherman *etherman.Client, ethTxManager *ethtxmanager.Client, st *state.State) { + + + log.Errorf("Error trying to build final proof: %v", finalProofErr)
    - 540 + + 1026 +
    + - var ( + }
    - 541 + 1027
    + - aggCli *agglayerClient.Client +
    - 542 + 1028
    + - pk *ecdsa.PrivateKey + // NOTE(pg): prover is done, use a.ctx from now on
    - 543 + 1029
    + - err error +
    - 544 + 1030
    + - ) + if !finalProofBuilt {
    - 545 + 1031
    + -
    + proof.GeneratingSince = nil
    - 546 + 1032
    + - if c.SettlementBackend == aggregator.AggLayer { +
    - 547 + 1033
    + - aggCli = agglayerClient.New(c.AggLayerURL) + // final proof has not been generated, update the batch proof
    - 548 + 1034
    + -
    + err := a.State.UpdateGeneratedProof(a.ctx, proof, nil)
    - 549 + 1035
    + - // Load private key + if err != nil {
    - 550 + 1036
    + - pk, err = config.NewKeyFromKeystore(c.SequencerPrivateKey) + err = fmt.Errorf("failed to store batch proof result, %w", err)
    - 551 + 1037
    + - if err != nil { + log.Error(FirstToUpper(err.Error()))
    - 552 + 1038
    + - log.Fatal(err) + return false, err
    - 553 + 1039
    @@ -19659,7 +20855,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 554 + 1040
    @@ -19669,7 +20865,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 555 + 1041
    @@ -19679,42 +20875,42 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 556 + 1042
    + - agg, err := aggregator.New(c, st, ethTxManager, etherman, aggCli, pk) + return true, nil
    - 557 + 1043
      - if err != nil { + }
    - 558 + 1044
      - log.Fatal(err) +
    - 559 + 1045
      - } + // canVerifyProof returns true if we have reached the timeout to verify a proof
    - 623 + 1073
      - } +
    - 624 + 1074
      - log.Infof("Starting L1InfoRoot: %v", l1inforoot.String()) + // isSynced checks if the state is synchronized with L1. If a batch number is
    - 625 + 1075
      -
    + // provided, it makes sure that the state is synced with that batch.
    - 626 + 1076
    + - forkIDIntervals, err := forkIDIntervals(ctx, st, etherman, c.NetworkConfig.Genesis.RollupBlockNumber) + func (a *Aggregator) isSynced(ctx context.Context, batchNum *uint64) (bool, error) {
    - 627 + 1077
      - if err != nil { + // get latest verified batch as seen by the synchronizer
    - 628 + 1078
      - log.Fatal("error getting forkIDs. Error: ", err) + lastVerifiedBatch, err := a.State.GetLastVerifiedBatch(ctx, nil)
    - 629 + 1079
      - } + if err == state.ErrNotFound { +
    +
    + 1080 + +
    + + + return false, nil
    - 630 + 1081
      - st.UpdateForkIDIntervalsInMemory(forkIDIntervals) + }
    - 631 + 1082
      -
    + if err != nil {
    - 632 + 1083
      - currentForkID := forkIDIntervals[len(forkIDIntervals)-1].ForkId + log.Warnf("Failed to get last consolidated batch: %v", err)
    - 633 + 1084
    + - log.Infof("Fork ID read from POE SC = %v", currentForkID) + return false, err
    - 634 + 1085
      -
    + }
    - 635 + 1086
      - return st, currentForkID +
    - 636 + 1087
      - } + if lastVerifiedBatch == nil {
    -
     
    +
    + 1088 + +
    + + + return false, nil +
    - 646 + 1089
      - } + }
    - 647 + 1090
    @@ -19889,9373 +21100,9070 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 648 + 1091
      - func createEthTxManager(cfg config.Config, etmStorage *ethtxmanager.PostgresStorage, st *state.State) *ethtxmanager.Client { + if batchNum != nil && lastVerifiedBatch.BatchNumber < *batchNum { +
    +
    + 1092 + +
    +   + log.Infof("Waiting for the state to be synced, lastVerifiedBatchNum: %d, waiting for batch: %d", lastVerifiedBatch.BatchNumber, batchNum)
    - 649 + 1093
    + - etherman, err := newEtherman(cfg, st) + return false, nil
    - 650 + 1094
      - if err != nil { + }
    - 651 + 1095
      - log.Fatal(err) +
    - 652 + 1096
      - } + // latest verified batch in L1
    - 653 + 1097
      -
    + lastVerifiedEthBatchNum, err := a.Ethman.GetLatestVerifiedBatchNum()
    - 654 + 1098
      - for _, privateKey := range cfg.EthTxManager.PrivateKeys { + if err != nil { +
    +
    + 1099 + +
    +   + log.Warnf("Failed to get last eth batch, err: %v", err)
    - 655 + 1100
    + - _, _, err := etherman.LoadAuthFromKeyStore(privateKey.Path, privateKey.Password) + return false, err
    - 656 + 1101
      - if err != nil { + }
    - 657 + 1102
      - log.Fatal(err) +
    - 658 + 1103
      - } + // check if L2 is synced with L1
    -
     
    -
    - 784 + 1104
      - } + if lastVerifiedBatch.BatchNumber < lastVerifiedEthBatchNum {
    - 785 + 1105
      - forkIDIntervals = forkIntervals + log.Infof("Waiting for the state to be synced, lastVerifiedBatchNum: %d, lastVerifiedEthBatchNum: %d, waiting for batch",
    - 786 + 1106
      - } else { + lastVerifiedBatch.BatchNumber, lastVerifiedEthBatchNum)
    - 787 + 1107
    + - log.Debug("Getting all forkIDs") + return false, nil
    - 788 + + 1108 +
    - + +   + } +
    +
    + 1109 + +
    +  
    - 789 + + 1110 +
    + - // Get last L1 block number + return true, nil
    - 790 + + 1111 +
    - + - bn, err := etherman.GetLatestBlockNumber(ctx) +   + }
    - 791 + + 1112 +
    - + - if err != nil { +   +
    - 792 + + 1113 +
    - + - return []state.ForkIDInterval{}, fmt.Errorf("error getting latest block number. Error: %v", err) +   + func (a *Aggregator) buildInputProver(ctx context.Context, batchToVerify *state.Batch) (*prover.InputProver, error) {
    - 793 + +
     
    +
    + 1171 +
    - + - } +   + }
    - 794 + + 1172 +
    - + -
    +   + if l1InfoRoot != nil && *l1InfoRoot != calculatedL1InfoRoot {
    - 795 + + 1173 +
    - + - // Get all forkIDs since genesis +   + for i, l := range aLeaves {
    - 796 + + 1174 +
    + - forkIntervals, err := etherman.GetForks(ctx, genesisBlockNumber, bn) + log.Info("AllLeaves[%d]: %s", i, common.Bytes2Hex(l[:]))
    - 797 + 1175
      - if err != nil { + }
    - 798 + 1176
      - return []state.ForkIDInterval{}, fmt.Errorf("error getting forks. Please check the configuration. Error: %v", err) + for i, s := range smtProof { +
    +
    + 1177 + +
    + + + log.Info("smtProof[%d]: %s", i, common.Bytes2Hex(s[:]))
    - 799 + 1178
      - } else if len(forkIntervals) == 0 { + }
    - 800 + 1179
      - return []state.ForkIDInterval{}, fmt.Errorf("error: no forkID received. It should receive at least one, please check the configuration...") + return nil, fmt.Errorf("error: l1InfoRoot mismatch. L1InfoRoot: %s, calculatedL1InfoRoot: %s. l1InfoTreeIndex: %d", l1InfoRoot.String(), calculatedL1InfoRoot.String(), l2blockRaw.IndexL1InfoTree)
    - 801 + 1180
      - } + }
    +
     
    +
    - 802 + 1301
      - forkIDIntervals = forkIntervals +
    - 803 + + 1302 +
    - + -
    +   + // wait for the synchronizer to catch up the verified batches
    - 804 + + 1303 +
    - + - log.Debugf("Retrieved %d forkIDs", len(forkIDIntervals)) +   + log.Debug("A final proof has been sent, waiting for the network to be synced")
    - 805 + + 1304 +
    + -
    + if err := a.waitForSynchronizerToSyncUp(a.ctx, &proofBatchNumberFinal); err != nil {
    - 806 + + 1305 +
    + - log.Debug("Adding forkIDs to db and memory") + log.Warn("waiting for the synchronizer to sync up was canceled", err)
    - 807 + + 1306 +
    + - for _, forkID := range forkIDIntervals { + return
    - 808 + + 1307 +
    - + - err = st.AddForkIDInterval(ctx, forkID, nil) +   + }
    - 809 + + 1308 +
    - + - if err != nil { +   +
    - 810 + + 1309 +
    - + - log.Fatal("error adding forkID to db. Error: ", err) +   + // network is synced with the final proof, we can safely delete all recursive
    - 811 + + 1310 +
    - + - } +   + // proofs up to the last synced batch
    - 812 + + 1311 +
    + - } + err = a.State.CleanupGeneratedProofs(a.ctx, proofBatchNumberFinal, nil)
    - 813 + 1312
      - } + if err != nil {
    - 814 + 1313
      - } + log.Errorf("Failed to store proof aggregation result: %v", err)
    - 815 + 1314
      - return forkIDIntervals, nil -
    -
    -
    + }
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/set_data_availability_protocol.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - + +
    -
    @@ -0,0 +1,68 @@
    - + + 1315 -
    +
    +
      -
    + }
    - + + 1316 -
    +
    +
     
    - + + 1317 -
    -   -
    +
    +
    + + + func (a *Aggregator) waitForSynchronizerToSyncUp(ctx context.Context, batchNum *uint64) error {
    - + + 1318 -
    -   -
    +
    +
    + + + for {
    - + + 1319 -
    -   -
    +
    +
    + + + log.Info("waiting for the synchronizer to sync...")
    - + + 1320 -
    -   -
    +
    +
    + + + synced, err := a.isSynced(ctx, batchNum)
    - + + 1321 -
    -   -
    +
    +
    + + + if err != nil && errors.Is(err, context.Canceled) {
    - + + 1322 -
    -   -
    +
    +
    + + + // if context is canceled, stop the loop, since it will never
    - + + 1323 -
    -   -
    +
    +
    + + + // be able to execute properly and break in this case, and we will be stuck in it forever
    - + + 1324 -
    -   -
    +
    +
    + + + return err
    - + + 1325 -
    -   -
    +
    +
    + + + }
    - + + 1326 -
    -   +
    +
    + +
    - + + 1327 -
    -   -
    +
    +
    + + + if synced {
    - + + 1328 -
    -   -
    +
    +
    + + + return nil
    - + + 1329 -
    -   -
    +
    +
    + + + }
    - + + 1330 -
    -   +
    +
    + +
    - + + 1331 -
    -   -
    +
    +
    + + + time.Sleep(a.cfg.RetryTime.Duration)
    - + + 1332 -
    -   -
    +
    +
    + + + }
    - + + 1333 -
    -   -
    +
    +
    + + + }
    - + + 1334 -
    -   +
    +
    + +
    - + + 1335 -
    +
    +
      -
    + func buildMonitoredTxID(batchNumber, batchNumberFinal uint64) string {
    - + + 1336 -
    +
    +
      -
    + return fmt.Sprintf(monitoredIDFormat, batchNumber, batchNumberFinal)
    - + + 1337 -
    +
    +
      -
    + }
    - - -
    -   -
    -
    +
    +
     
    - + + 1342 -
    +
    +
      -
    + case <-a.ctx.Done():
    - + + 1343 -
    +
    +
      -
    + return
    - + + 1344 -
    +
    +
      -
    + case <-time.After(a.TimeCleanupLockedProofs.Duration):
    - + + 1345 -
    -   -
    +
    +
    + + + n, err := a.State.CleanupLockedProofs(a.ctx, a.cfg.GeneratingProofCleanupThreshold, nil)
    - + + 1346 -
    +
    +
      -
    + if err != nil {
    - + + 1347 -
    +
    +
      -
    + log.Errorf("Failed to cleanup locked proofs: %v", err)
    - + + 1348 -
    +
    +
      -
    + }
    - - -
    -   -
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/aggregator_test.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - -
    +
    @@ -89,7 +89,7 @@
    - + + 89 -
    +
    +
      -
    + m.etherman.On("BuildTrustedVerifyBatchesTxData", batchNum-1, batchNumFinal, &expectedInputs, common.HexToAddress(cfg.SenderAddress)).Run(func(args mock.Arguments) {
    - + + 90 -
    +
    +
      -
    + assert.True(a.verifyingProof)
    - + + 91 -
    +
    +
      -
    + }).Return(nil, nil, errBanana).Once()
    - + + 92 -
    -   -
    +
    +
    + - + m.stateMock.On("UpdateBatchProof", mock.Anything, recursiveProof, nil).Run(func(args mock.Arguments) {
    - + + 93 -
    +
    +
      -
    + // test is done, stop the sendFinalProof method
    - + + 94 -
    +
    +
      -
    + a.exit()
    - + + 95 -
    +
    +
      -
    + }).Return(nil).Once()
    - - -
    -   -
    -
    +
    +
    @@ -99,7 +99,7 @@
    - + + 99 -
    +
    +
      -
    + },
    - + + 100 -
    +
    +
      -
    + },
    - + + 101 -
    +
    +
      -
    + {
    - + + 102 -
    -   -
    +
    +
    + - + name: "UpdateBatchProof error after BuildTrustedVerifyBatchesTxData error",
    - + + 103 -
    +
    +
      -
    + setup: func(m mox, a *Aggregator) {
    - + + 104 -
    +
    +
      -
    + m.stateMock.On("GetBatchByNumber", mock.Anything, batchNumFinal, nil).Run(func(args mock.Arguments) {
    - + + 105 -
    +
    +
      -
    + assert.True(a.verifyingProof)
    - + +
    @@ -112,7 +112,7 @@
    -
    +
    + 112 + +
      -
    + m.etherman.On("BuildTrustedVerifyBatchesTxData", batchNum-1, batchNumFinal, &expectedInputs, common.HexToAddress(cfg.SenderAddress)).Run(func(args mock.Arguments) {
    - + + 113 -
    +
    +
      -
    + assert.True(a.verifyingProof)
    - + + 114 -
    +
    +
      -
    + }).Return(nil, nil, errBanana).Once()
    - + + 115 -
    -   -
    +
    +
    + - + m.stateMock.On("UpdateBatchProof", mock.Anything, recursiveProof, nil).Run(func(args mock.Arguments) {
    - + + 116 -
    +
    +
      -
    + // test is done, stop the sendFinalProof method
    - + + 117 -
    +
    +
      -
    + a.exit()
    - + + 118 -
    +
    +
      -
    + }).Return(errBanana).Once()
    - + +
    @@ -137,7 +137,7 @@
    -
    +
    + 137 + +
      -
    + }).Return(&to, data, nil).Once()
    - + + 138 -
    +
    +
      -
    + monitoredTxID := buildMonitoredTxID(batchNum, batchNumFinal)
    - + + 139 -
    +
    +
      -
    + m.ethTxManager.On("Add", mock.Anything, ethTxManagerOwner, monitoredTxID, from, &to, value, data, cfg.GasOffset, nil).Return(errBanana).Once()
    - + + 140 -
    -   -
    +
    +
    + - + m.stateMock.On("UpdateBatchProof", mock.Anything, recursiveProof, nil).Run(func(args mock.Arguments) {
    - + + 141 -
    +
    +
      -
    + // test is done, stop the sendFinalProof method
    - + + 142 -
    +
    +
      -
    + a.exit()
    - + + 143 -
    +
    +
      -
    + }).Return(nil).Once()
    - + +
    @@ -175,7 +175,7 @@
    -
    +
    + 175 + +
      -
    + }
    - + + 176 -
    +
    +
      -
    + m.stateMock.On("GetLastVerifiedBatch", mock.Anything, nil).Return(&verifiedBatch, nil).Once()
    - + + 177 -
    +
    +
      -
    + m.etherman.On("GetLatestVerifiedBatchNum").Return(batchNumFinal, nil).Once()
    - + + 178 -
    -   -
    +
    +
    + - + m.stateMock.On("CleanupBatchProofs", mock.Anything, batchNumFinal, nil).Run(func(args mock.Arguments) {
    - + + 179 -
    +
    +
      -
    + // test is done, stop the sendFinalProof method
    - + + 180 -
    +
    +
      -
    + a.exit()
    - + + 181 -
    +
    +
      -
    + }).Return(nil).Once()
    -
    -
    -
    -
    - - - + - - - - - - - - - - + - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    +
    @@ -191,7 +191,7 @@
    - 1 + + 191 +
    - + - package main +   + stateMock := mocks.NewStateMock(t)
    - 2 + + 192 +
    - + -
    +   + ethTxManager := mocks.NewEthTxManager(t)
    - 3 + + 193 +
    - + - import ( +   + etherman := mocks.NewEtherman(t)
    - 4 + + 194 +
    - + - "github.com/0xPolygonHermez/zkevm-node/config" + - + a, err := New(cfg, stateMock, ethTxManager, etherman)
    - 5 - + + 195 +
    - + - "github.com/0xPolygonHermez/zkevm-node/log" +   + require.NoError(err)
    - 6 + + 196 +
    - + - "github.com/ethereum/go-ethereum/common" +   + a.ctx, a.exit = context.WithCancel(context.Background())
    - 7 + + 197 +
    - + - "github.com/urfave/cli/v2" +   + m := mox{
    - 8 + +
    @@ -251,12 +251,12 @@
    +
    + 251 +
    - + - ) +   + asserts func(bool, *Aggregator, error)
    - 9 + + 252 +
    - + -
    +   + }{
    - 10 + + 253 +
    - + - const flagDAAddress = "data-availability-address" +   + {
    - 11 + + 254 +
    - + -
    + - + name: "getAndLockBatchProofsToAggregate returns generic error",
    - 12 + + 255 +
    - + - var setDataAvailabilityProtocolFlags = []cli.Flag{ +   + setup: func(m mox, a *Aggregator) {
    - 13 + + 256 +
    - + - &cli.StringFlag{ +   + m.proverMock.On("Name").Return(proverName).Twice()
    - 14 + + 257 +
    - + - Name: flagDAAddress, +   + m.proverMock.On("ID").Return(proverID).Twice()
    - 15 + + 258 +
    - + - Aliases: []string{"da-addr"}, +   + m.proverMock.On("Addr").Return("addr")
    - 16 + + 259 +
    - + - Usage: "address of the new data availibility protocol", + - + m.stateMock.On("GetBatchProofsToAggregate", mock.MatchedBy(matchProverCtxFn), nil).Return(nil, nil, errBanana).Once()
    - 17 + + 260 +
    - + - Required: true, +   + },
    - 18 + + 261 +
    - + - }, +   + asserts: func(result bool, a *Aggregator, err error) {
    - 19 + + 262 +
    - + - &cli.StringFlag{ +   + assert.False(result)
    - 20 + +
    @@ -264,12 +264,12 @@
    +
    + 264 +
    - + - Name: config.FlagKeyStorePath, +   + },
    - 21 + + 265 +
    - + - Aliases: []string{"ksp"}, +   + },
    - 22 + + 266 +
    - + - Usage: "the path of the key store file containing the private key of the account going to set new data availability protocol", +   + {
    - 23 + + 267 +
    - + - Required: true, + - + name: "getAndLockBatchProofsToAggregate returns ErrNotFound",
    - 24 + + 268 +
    - + - }, +   + setup: func(m mox, a *Aggregator) {
    - 25 + + 269 +
    - + - &cli.StringFlag{ +   + m.proverMock.On("Name").Return(proverName).Twice()
    - 26 + + 270 +
    - + - Name: config.FlagPassword, +   + m.proverMock.On("ID").Return(proverID).Twice()
    - 27 + + 271 +
    - + - Aliases: []string{"pw"}, +   + m.proverMock.On("Addr").Return("addr")
    - 28 + + 272 +
    - + - Usage: "the password do decrypt the key store file", + - + m.stateMock.On("GetBatchProofsToAggregate", mock.MatchedBy(matchProverCtxFn), nil).Return(nil, nil, state.ErrNotFound).Once()
    - 29 + + 273 +
    - + - Required: true, +   + },
    - 30 + + 274 +
    - + - }, +   + asserts: func(result bool, a *Aggregator, err error) {
    - 31 + + 275 +
    - + - &configFileFlag, +   + assert.False(result)
    - 32 + +
    @@ -277,7 +277,7 @@
    +
    + 277 +
    - + - &networkFlag, +   + },
    - 33 + + 278 +
    - + - &customNetworkFlag, +   + },
    - 34 + + 279 +
    - + - } +   + {
    - 35 + + 280 +
    - + -
    + - + name: "getAndLockBatchProofsToAggregate error updating proofs",
    - 36 + + 281 +
    - + - func setDataAvailabilityProtocol(ctx *cli.Context) error { +   + setup: func(m mox, a *Aggregator) {
    - 37 + + 282 +
    - + - c, err := config.Load(ctx, true) +   + m.proverMock.On("Name").Return(proverName).Twice()
    - 38 + + 283 +
    - + - if err != nil { +   + m.proverMock.On("ID").Return(proverID).Twice()
    - 39 + +
    @@ -285,9 +285,9 @@
    +
    + 285 +
    - + - return err +   + dbTx := &mocks.DbTxMock{}
    - 40 + + 286 +
    - + - } +   + dbTx.On("Rollback", mock.MatchedBy(matchProverCtxFn)).Return(nil).Once()
    - 41 + + 287 +
    - + -
    +   + m.stateMock.On("BeginStateTransaction", mock.MatchedBy(matchProverCtxFn)).Return(dbTx, nil).Once()
    - 42 + + 288 +
    - + - setupLog(c.Log) + - + m.stateMock.On("GetBatchProofsToAggregate", mock.MatchedBy(matchProverCtxFn), nil).Return(&proof1, &proof2, nil).Once()
    - 43 + + 289 +
    - + -
    +   + m.stateMock.
    - 44 + + 290 +
    - + - daAddress := common.HexToAddress(ctx.String(flagDAAddress)) + - + On("UpdateBatchProof", mock.MatchedBy(matchProverCtxFn), &proof1, dbTx).
    - 45 + + 291 +
    - + - addrKeyStorePath := ctx.String(config.FlagKeyStorePath) +   + Run(func(args mock.Arguments) {
    - 46 + + 292 +
    - + - addrPassword := ctx.String(config.FlagPassword) +   + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - 47 + + 293 +
    - + -
    +   + }).
    - 48 + +
    @@ -300,7 +300,7 @@
    +
    + 300 +
    - + - etherman, err := newEtherman(*c, nil) +   + },
    - 49 + + 301 +
    - + - if err != nil { +   + },
    - 50 + + 302 +
    - + - log.Fatal(err) +   + {
    - 51 + + 303 +
    - + - return err + - + name: "AggregatedBatchProof prover error",
    - 52 + + 304 +
    - + - } +   + setup: func(m mox, a *Aggregator) {
    - 53 + + 305 +
    - + -
    +   + m.proverMock.On("Name").Return(proverName).Twice()
    - 54 + + 306 +
    - + - auth, _, err := etherman.LoadAuthFromKeyStore(addrKeyStorePath, addrPassword) +   + m.proverMock.On("ID").Return(proverID).Twice()
    - 55 + +
    @@ -308,16 +308,16 @@
    +
    + 308 +
    - + - if err != nil { +   + dbTx := &mocks.DbTxMock{}
    - 56 + + 309 +
    - + - log.Fatal(err) +   + lockProofsTxBegin := m.stateMock.On("BeginStateTransaction", mock.MatchedBy(matchProverCtxFn)).Return(dbTx, nil).Once()
    - 57 + + 310 +
    - + - return err +   + lockProofsTxCommit := dbTx.On("Commit", mock.MatchedBy(matchProverCtxFn)).Return(nil).Once()
    - 58 + + 311 +
    - + - } + - + m.stateMock.On("GetBatchProofsToAggregate", mock.MatchedBy(matchProverCtxFn), nil).Return(&proof1, &proof2, nil).Once()
    - 59 + + 312 +
    - + -
    +   + proof1GeneratingTrueCall := m.stateMock.
    - 60 + + 313 +
    - + - tx, err := etherman.SetDataAvailabilityProtocol(auth.From, daAddress) + - + On("UpdateBatchProof", mock.MatchedBy(matchProverCtxFn), &proof1, dbTx).
    - 61 + + 314 +
    - + - if err != nil { +   + Run(func(args mock.Arguments) {
    - 62 + + 315 +
    - + - return err +   + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - 63 + + 316 +
    - + - } +   + }).
    - 64 + + 317 +
    - + -
    +   + Return(nil).
    - 65 + + 318 +
    - + - log.Infof("Transaction to set new data availability protocol sent. Hash: %s", tx.Hash()) +   + Once()
    - 66 + + 319 +
    - + -
    +   + proof2GeneratingTrueCall := m.stateMock.
    - 67 + + 320 +
    - + - return nil + - + On("UpdateBatchProof", mock.MatchedBy(matchProverCtxFn), &proof2, dbTx).
    - 68 + + 321 +
    - + - } -
    -
    -
    +   + Run(func(args mock.Arguments) {
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/config/cardonagenesis.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - -
    -
    @@ -1,109 +0,0 @@
    - 1 + + 322 +
    - - - package config +   + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - 2 + + 323 +
    - - -
    +   + }).
    - 3 + +
    @@ -326,7 +326,7 @@
    +
    + 326 +
    - - - // CardonaNetworkConfigJSON is the hardcoded network configuration to be used for the official mainnet setup +   + m.proverMock.On("AggregatedProof", proof1.Proof, proof2.Proof).Return(nil, errBanana).Once()
    - 4 + + 327 +
    - - - const CardonaNetworkConfigJSON = ` +   + m.stateMock.On("BeginStateTransaction", mock.MatchedBy(matchAggregatorCtxFn)).Return(dbTx, nil).Once().NotBefore(lockProofsTxBegin)
    - 5 + + 328 +
    - - - { +   + m.stateMock.
    - 6 + + 329 +
    - - "l1Config": { + On("UpdateBatchProof", mock.MatchedBy(matchAggregatorCtxFn), &proof1, dbTx).
    - 7 + + 330 +
    - - - "polygonZkEVMAddress": "0xA13Ddb14437A8F34897131367ad3ca78416d6bCa", +   + Run(func(args mock.Arguments) {
    - 8 + + 331 +
    - - - "polygonZkEVMBridgeAddress": "0x528e26b25a34a4A5d0dbDa1d57D318153d2ED582", +   + assert.Nil(args[1].(*state.Proof).GeneratingSince)
    - 9 + + 332 +
    - - - "polygonZkEVMGlobalExitRootAddress": "0xAd1490c248c5d3CbAE399Fd529b79B42984277DF", +   + }).
    - 10 + +
    @@ -334,7 +334,7 @@
    +
    + 334 +
    - - - "polTokenAddress": "0x6a7c3F4B0651d6DA389AD1d11D962ea458cDCA70", +   + Once().
    - 11 + + 335 +
    - - - "polygonRollupManagerAddress": "0x32d33D5137a7cFFb54c5Bf8371172bcEc5f310ff", +   + NotBefore(proof1GeneratingTrueCall)
    - 12 + + 336 +
    - - - "chainId": 11155111 +   + m.stateMock.
    - 13 + + 337 +
    - - }, + On("UpdateBatchProof", mock.MatchedBy(matchAggregatorCtxFn), &proof2, dbTx).
    - 14 + + 338 +
    - - - "genesisBlockNumber": 4789190, +   + Run(func(args mock.Arguments) {
    - 15 + + 339 +
    - - - "root": "0x91dfcdeb628dfdc51f3a2ee38cb17c78581e4e7ff91bcc2e327d24a9dfa46982", +   + assert.Nil(args[1].(*state.Proof).GeneratingSince)
    - 16 + + 340 +
    - - - "genesis": [ +   + }).
    - 17 + +
    @@ -357,16 +357,16 @@
    +
    + 357 +
    - - - { +   + dbTx := &mocks.DbTxMock{}
    - 18 + + 358 +
    - - - "contractName": "PolygonZkEVMDeployer", +   + lockProofsTxBegin := m.stateMock.On("BeginStateTransaction", mock.MatchedBy(matchProverCtxFn)).Return(dbTx, nil).Once()
    - 19 + + 359 +
    - - - "balance": "0", +   + lockProofsTxCommit := dbTx.On("Commit", mock.MatchedBy(matchProverCtxFn)).Return(nil).Once()
    - 20 + + 360 +
    - - "nonce": "4", + m.stateMock.On("GetBatchProofsToAggregate", mock.MatchedBy(matchProverCtxFn), nil).Return(&proof1, &proof2, nil).Once()
    - 21 + + 361 +
    - - - "address": "0x36810012486fc134D0679c07f85fe5ba5A087D8C", +   + proof1GeneratingTrueCall := m.stateMock.
    - 22 + + 362 +
    - - "bytecode": "0x6080604052600436106100705760003560e01c8063715018a61161004e578063715018a6146100e65780638da5cb5b146100fb578063e11ae6cb14610126578063f2fde38b1461013957600080fd5b80632b79805a146100755780634a94d4871461008a5780636d07dbf81461009d575b600080fd5b610088610083366004610927565b610159565b005b6100886100983660046109c7565b6101cb565b3480156100a957600080fd5b506100bd6100b8366004610a1e565b61020d565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b50610088610220565b34801561010757600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100bd565b610088610134366004610a40565b610234565b34801561014557600080fd5b50610088610154366004610a90565b61029b565b610161610357565b600061016e8585856103d8565b905061017a8183610537565b5060405173ffffffffffffffffffffffffffffffffffffffff821681527fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a15050505050565b6101d3610357565b6101de83838361057b565b506040517f25adb19089b6a549831a273acdf7908cff8b7ee5f551f8d1d37996cf01c5df5b90600090a1505050565b600061021983836105a9565b9392505050565b610228610357565b61023260006105b6565b565b61023c610357565b60006102498484846103d8565b60405173ffffffffffffffffffffffffffffffffffffffff821681529091507fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a150505050565b6102a3610357565b73ffffffffffffffffffffffffffffffffffffffff811661034b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610354816105b6565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610232576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610342565b600083471015610444576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e63650000006044820152606401610342565b81516000036104af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f6044820152606401610342565b8282516020840186f5905073ffffffffffffffffffffffffffffffffffffffff8116610219576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f79000000000000006044820152606401610342565b6060610219838360006040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c6564000081525061062b565b60606105a1848484604051806060016040528060298152602001610b3d6029913961062b565b949350505050565b6000610219838330610744565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060824710156106bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610342565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516106e69190610acf565b60006040518083038185875af1925050503d8060008114610723576040519150601f19603f3d011682016040523d82523d6000602084013e610728565b606091505b50915091506107398783838761076e565b979650505050505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b606083156108045782516000036107fd5773ffffffffffffffffffffffffffffffffffffffff85163b6107fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610342565b50816105a1565b6105a183838151156108195781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103429190610aeb565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f83011261088d57600080fd5b813567ffffffffffffffff808211156108a8576108a861084d565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156108ee576108ee61084d565b8160405283815286602085880101111561090757600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000806080858703121561093d57600080fd5b8435935060208501359250604085013567ffffffffffffffff8082111561096357600080fd5b61096f8883890161087c565b9350606087013591508082111561098557600080fd5b506109928782880161087c565b91505092959194509250565b803573ffffffffffffffffffffffffffffffffffffffff811681146109c257600080fd5b919050565b6000806000606084860312156109dc57600080fd5b6109e58461099e565b9250602084013567ffffffffffffffff811115610a0157600080fd5b610a0d8682870161087c565b925050604084013590509250925092565b60008060408385031215610a3157600080fd5b50508035926020909101359150565b600080600060608486031215610a5557600080fd5b8335925060208401359150604084013567ffffffffffffffff811115610a7a57600080fd5b610a868682870161087c565b9150509250925092565b600060208284031215610aa257600080fd5b6102198261099e565b60005b83811015610ac6578181015183820152602001610aae565b50506000910152565b60008251610ae1818460208701610aab565b9190910192915050565b6020815260008251806020840152610b0a816040850160208701610aab565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a26469706673582212203e70ce334e8ec9d8d03e87415afd36dce4e82633bd277b08937095a6bd66367764736f6c63430008110033", + On("UpdateBatchProof", mock.MatchedBy(matchProverCtxFn), &proof1, dbTx).
    - 23 + + 363 +
    - - - "storage": { +   + Run(func(args mock.Arguments) {
    - 24 + + 364 +
    - - - "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000ff6250d0e86a2465b0c1bf8e36409503d6a26963" +   + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - 25 + + 365 +
    - - - } +   + }).
    - 26 + + 366 +
    - - - }, +   + Return(nil).
    - 27 + + 367 +
    - - - { +   + Once()
    - 28 + + 368 +
    - - - "contractName": "ProxyAdmin", +   + proof2GeneratingTrueCall := m.stateMock.
    - 29 + + 369 +
    - - "balance": "0", + On("UpdateBatchProof", mock.MatchedBy(matchProverCtxFn), &proof2, dbTx).
    - 30 + + 370 +
    - - - "nonce": "1", +   + Run(func(args mock.Arguments) {
    - 31 + + 371 +
    - - - "address": "0x85cEB41028B1a5ED2b88E395145344837308b251", +   + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - 32 + + 372 +
    - - - "bytecode": "0x60806040526004361061007b5760003560e01c80639623609d1161004e5780639623609d1461012b57806399a88ec41461013e578063f2fde38b1461015e578063f3b7dead1461017e57600080fd5b8063204e1c7a14610080578063715018a6146100c95780637eff275e146100e05780638da5cb5b14610100575b600080fd5b34801561008c57600080fd5b506100a061009b366004610608565b61019e565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100d557600080fd5b506100de610255565b005b3480156100ec57600080fd5b506100de6100fb36600461062c565b610269565b34801561010c57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100a0565b6100de610139366004610694565b6102f7565b34801561014a57600080fd5b506100de61015936600461062c565b61038c565b34801561016a57600080fd5b506100de610179366004610608565b6103e8565b34801561018a57600080fd5b506100a0610199366004610608565b6104a4565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907f5c60da1b00000000000000000000000000000000000000000000000000000000815260040190565b600060405180830381855afa9150503d8060008114610225576040519150601f19603f3d011682016040523d82523d6000602084013e61022a565b606091505b50915091508161023957600080fd5b8080602001905181019061024d9190610788565b949350505050565b61025d6104f0565b6102676000610571565b565b6102716104f0565b6040517f8f28397000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690638f283970906024015b600060405180830381600087803b1580156102db57600080fd5b505af11580156102ef573d6000803e3d6000fd5b505050505050565b6102ff6104f0565b6040517f4f1ef28600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690634f1ef28690349061035590869086906004016107a5565b6000604051808303818588803b15801561036e57600080fd5b505af1158015610382573d6000803e3d6000fd5b5050505050505050565b6103946104f0565b6040517f3659cfe600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690633659cfe6906024016102c1565b6103f06104f0565b73ffffffffffffffffffffffffffffffffffffffff8116610498576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6104a181610571565b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907ff851a44000000000000000000000000000000000000000000000000000000000815260040190565b60005473ffffffffffffffffffffffffffffffffffffffff163314610267576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161048f565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b73ffffffffffffffffffffffffffffffffffffffff811681146104a157600080fd5b60006020828403121561061a57600080fd5b8135610625816105e6565b9392505050565b6000806040838503121561063f57600080fd5b823561064a816105e6565b9150602083013561065a816105e6565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000606084860312156106a957600080fd5b83356106b4816105e6565b925060208401356106c4816105e6565b9150604084013567ffffffffffffffff808211156106e157600080fd5b818601915086601f8301126106f557600080fd5b81358181111561070757610707610665565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561074d5761074d610665565b8160405282815289602084870101111561076657600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b60006020828403121561079a57600080fd5b8151610625816105e6565b73ffffffffffffffffffffffffffffffffffffffff8316815260006020604081840152835180604085015260005b818110156107ef578581018301518582016060015282016107d3565b5060006060828601015260607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010192505050939250505056fea2646970667358221220372a0e10eebea1b7fa43ae4c976994e6ed01d85eedc3637b83f01d3f06be442064736f6c63430008110033", +   + }).
    - 33 + +
    @@ -376,7 +376,7 @@
    +
    + 376 +
    - - - "storage": { +   + m.proverMock.On("WaitRecursiveProof", mock.MatchedBy(matchProverCtxFn), proofID).Return("", errBanana).Once()
    - 34 + + 377 +
    - - - "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000dbc6981a11fc2b000c635bfa7c47676b25c87d39" +   + m.stateMock.On("BeginStateTransaction", mock.MatchedBy(matchAggregatorCtxFn)).Return(dbTx, nil).Once().NotBefore(lockProofsTxBegin)
    - 35 + + 378 +
    - - - } +   + m.stateMock.
    - 36 + + 379 +
    - - }, + On("UpdateBatchProof", mock.MatchedBy(matchAggregatorCtxFn), &proof1, dbTx).
    - 37 + + 380 +
    - - - { +   + Run(func(args mock.Arguments) {
    - 38 + + 381 +
    - - - "contractName": "PolygonZkEVMBridge implementation", +   + assert.Nil(args[1].(*state.Proof).GeneratingSince)
    - 39 + + 382 +
    - - - "balance": "0", +   + }).
    - 40 + +
    @@ -384,7 +384,7 @@
    +
    + 384 +
    - - - "nonce": "1", +   + Once().
    - 41 + + 385 +
    - - - "address": "0x8BD36ca1A55e389335004872aA3C3Be0969D3aA7", +   + NotBefore(proof1GeneratingTrueCall)
    - 42 + + 386 +
    - - - "bytecode": "0x6080604052600436106200019f5760003560e01c8063647c576c11620000e7578063be5831c71162000089578063dbc169761162000060578063dbc169761462000639578063ee25560b1462000651578063fb570834146200068257600080fd5b8063be5831c714620005ae578063cd58657914620005ea578063d02103ca146200060157600080fd5b80639e34070f11620000be5780639e34070f146200050a578063aaa13cc2146200054f578063bab161bf146200057457600080fd5b8063647c576c146200048657806379e2cf9714620004ab57806381b1c17414620004c357600080fd5b80632d2c9d94116200015157806334ac9cf2116200012857806334ac9cf2146200034b5780633ae05047146200037a5780633e197043146200039257600080fd5b80632d2c9d9414620002765780632dfdf0b5146200029b578063318aee3d14620002c257600080fd5b806322e95f2c116200018657806322e95f2c14620001ef578063240ff378146200023a5780632cffd02e146200025157600080fd5b806315064c9614620001a45780632072f6c514620001d5575b600080fd5b348015620001b157600080fd5b50606854620001c09060ff1681565b60405190151581526020015b60405180910390f35b348015620001e257600080fd5b50620001ed620006a7565b005b348015620001fc57600080fd5b50620002146200020e366004620032db565b62000705565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001620001cc565b620001ed6200024b36600462003372565b620007a8565b3480156200025e57600080fd5b50620001ed6200027036600462003409565b620009d0565b3480156200028357600080fd5b50620001ed6200029536600462003409565b62000f74565b348015620002a857600080fd5b50620002b360535481565b604051908152602001620001cc565b348015620002cf57600080fd5b5062000319620002e1366004620034ef565b606b6020526000908152604090205463ffffffff811690640100000000900473ffffffffffffffffffffffffffffffffffffffff1682565b6040805163ffffffff909316835273ffffffffffffffffffffffffffffffffffffffff909116602083015201620001cc565b3480156200035857600080fd5b50606c54620002149073ffffffffffffffffffffffffffffffffffffffff1681565b3480156200038757600080fd5b50620002b362001178565b3480156200039f57600080fd5b50620002b3620003b136600462003526565b6040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b3480156200049357600080fd5b50620001ed620004a5366004620035b0565b6200125e565b348015620004b857600080fd5b50620001ed620014ad565b348015620004d057600080fd5b5062000214620004e236600462003600565b606a6020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b3480156200051757600080fd5b50620001c06200052936600462003600565b600881901c600090815260696020526040902054600160ff9092169190911b9081161490565b3480156200055c57600080fd5b50620002146200056e3660046200361a565b620014e7565b3480156200058157600080fd5b506068546200059890610100900463ffffffff1681565b60405163ffffffff9091168152602001620001cc565b348015620005bb57600080fd5b506068546200059890790100000000000000000000000000000000000000000000000000900463ffffffff1681565b620001ed620005fb366004620036ce565b620016d3565b3480156200060e57600080fd5b50606854620002149065010000000000900473ffffffffffffffffffffffffffffffffffffffff1681565b3480156200064657600080fd5b50620001ed62001c37565b3480156200065e57600080fd5b50620002b36200067036600462003600565b60696020526000908152604090205481565b3480156200068f57600080fd5b50620001c0620006a136600462003770565b62001c93565b606c5473ffffffffffffffffffffffffffffffffffffffff163314620006f9576040517fe2e8106b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200070362001d7c565b565b6040805160e084901b7fffffffff0000000000000000000000000000000000000000000000000000000016602080830191909152606084901b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602483015282516018818403018152603890920183528151918101919091206000908152606a909152205473ffffffffffffffffffffffffffffffffffffffff165b92915050565b60685460ff1615620007e6576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60685463ffffffff8681166101009092041614806200080c5750600263ffffffff861610155b1562000844576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b6001606860019054906101000a900463ffffffff163388883488886053546040516200089a9998979695949392919062003806565b60405180910390a1620009b8620009b26001606860019054906101000a900463ffffffff16338989348989604051620008d592919062003881565b60405180910390206040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b62001e10565b8215620009c957620009c962001f27565b5050505050565b60685460ff161562000a0e576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000a258b8b8b8b8b8b8b8b8b8b8b600062001ffc565b73ffffffffffffffffffffffffffffffffffffffff861662000b01576040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff861690859060405162000a7a9190620038e6565b60006040518083038185875af1925050503d806000811462000ab9576040519150601f19603f3d011682016040523d82523d6000602084013e62000abe565b606091505b505090508062000afa576040517f6747a28800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5062000efc565b60685463ffffffff61010090910481169088160362000b435762000b3d73ffffffffffffffffffffffffffffffffffffffff87168585620021ed565b62000efc565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b1660208201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b166024820152600090603801604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291815281516020928301206000818152606a90935291205490915073ffffffffffffffffffffffffffffffffffffffff168062000e6e576000808062000c1886880188620039fb565b92509250925060008584848460405162000c329062003292565b62000c409392919062003abd565b8190604051809103906000f590508015801562000c61573d6000803e3d6000fd5b506040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8c81166004830152602482018c9052919250908216906340c10f1990604401600060405180830381600087803b15801562000cd757600080fd5b505af115801562000cec573d6000803e3d6000fd5b5050505080606a600088815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060405180604001604052808e63ffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff16815250606b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509050507f490e59a1701b938786ac72570a1efeac994a3dbe96e2e883e19e902ace6e6a398d8d838b8b60405162000e5c95949392919062003afa565b60405180910390a15050505062000ef9565b6040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152602482018790528216906340c10f1990604401600060405180830381600087803b15801562000edf57600080fd5b505af115801562000ef4573d6000803e3d6000fd5b505050505b50505b6040805163ffffffff8c811682528916602082015273ffffffffffffffffffffffffffffffffffffffff88811682840152861660608201526080810185905290517f25308c93ceeed162da955b3f7ce3e3f93606579e40fb92029faa9efe275459839181900360a00190a15050505050505050505050565b60685460ff161562000fb2576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000fc98b8b8b8b8b8b8b8b8b8b8b600162001ffc565b60008473ffffffffffffffffffffffffffffffffffffffff1684888a868660405160240162000ffc949392919062003b42565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f1806b5f200000000000000000000000000000000000000000000000000000000179052516200107f9190620038e6565b60006040518083038185875af1925050503d8060008114620010be576040519150601f19603f3d011682016040523d82523d6000602084013e620010c3565b606091505b5050905080620010ff576040517f37e391c300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805163ffffffff8d811682528a16602082015273ffffffffffffffffffffffffffffffffffffffff89811682840152871660608201526080810186905290517f25308c93ceeed162da955b3f7ce3e3f93606579e40fb92029faa9efe275459839181900360a00190a1505050505050505050505050565b605354600090819081805b602081101562001255578083901c600116600103620011e65760338160208110620011b257620011b262003b8a565b0154604080516020810192909252810185905260600160405160208183030381529060405280519060200120935062001213565b60408051602081018690529081018390526060016040516020818303038152906040528051906020012093505b604080516020810184905290810183905260600160405160208183030381529060405280519060200120915080806200124c9062003be8565b91505062001183565b50919392505050565b600054610100900460ff16158080156200127f5750600054600160ff909116105b806200129b5750303b1580156200129b575060005460ff166001145b6200132d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156200138c57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b606880547fffffffffffffff000000000000000000000000000000000000000000000000ff1661010063ffffffff8716027fffffffffffffff0000000000000000000000000000000000000000ffffffffff16176501000000000073ffffffffffffffffffffffffffffffffffffffff8681169190910291909117909155606c80547fffffffffffffffffffffffff00000000000000000000000000000000000000001691841691909117905562001443620022c3565b8015620014a757600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b605354606854790100000000000000000000000000000000000000000000000000900463ffffffff16101562000703576200070362001f27565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b1660208201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b1660248201526000908190603801604051602081830303815290604052805190602001209050600060ff60f81b3083604051806020016200157d9062003292565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082820381018352601f909101166040819052620015c8908d908d908d908d908d9060200162003c23565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905262001606929160200162003c64565b604051602081830303815290604052805190602001206040516020016200168f94939291907fff0000000000000000000000000000000000000000000000000000000000000094909416845260609290921b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660018401526015830152603582015260550190565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001815291905280516020909101209a9950505050505050505050565b60685460ff161562001711576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200171b62002366565b60685463ffffffff888116610100909204161480620017415750600263ffffffff881610155b1562001779576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008060608773ffffffffffffffffffffffffffffffffffffffff8816620017df57883414620017d5576040517fb89240f500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000925062001ad9565b341562001818576040517f798ee6f100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8089166000908152606b602090815260409182902082518084019093525463ffffffff811683526401000000009004909216918101829052901562001908576040517f9dc29fac000000000000000000000000000000000000000000000000000000008152336004820152602481018b905273ffffffffffffffffffffffffffffffffffffffff8a1690639dc29fac90604401600060405180830381600087803b158015620018db57600080fd5b505af1158015620018f0573d6000803e3d6000fd5b50505050806020015194508060000151935062001ad7565b85156200191d576200191d898b8989620023db565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8b16906370a0823190602401602060405180830381865afa1580156200198b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620019b1919062003c97565b9050620019d773ffffffffffffffffffffffffffffffffffffffff8b1633308e620028f9565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa15801562001a45573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001a6b919062003c97565b905062001a79828262003cb1565b6068548c9850610100900463ffffffff169650935062001a998762002959565b62001aa48c62002a71565b62001aaf8d62002b7e565b60405160200162001ac39392919062003abd565b604051602081830303815290604052945050505b505b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b600084868e8e868860535460405162001b1b98979695949392919062003cc7565b60405180910390a162001c0f620009b2600085878f8f8789805190602001206040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b861562001c205762001c2062001f27565b5050505062001c2e60018055565b50505050505050565b606c5473ffffffffffffffffffffffffffffffffffffffff16331462001c89576040517fe2e8106b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200070362002c80565b600084815b602081101562001d6e57600163ffffffff8616821c8116900362001d0a5785816020811062001ccb5762001ccb62003b8a565b60200201358260405160200162001cec929190918252602082015260400190565b60405160208183030381529060405280519060200120915062001d59565b8186826020811062001d205762001d2062003b8a565b602002013560405160200162001d40929190918252602082015260400190565b6040516020818303038152906040528051906020012091505b8062001d658162003be8565b91505062001c98565b50821490505b949350505050565b60685460ff161562001dba576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556040517f2261efe5aef6fedc1fd1550b25facc9181745623049c7901287030b9ad1a549790600090a1565b80600162001e216020600262003e79565b62001e2d919062003cb1565b6053541062001e68576040517fef5ccf6600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060536000815462001e7b9062003be8565b9182905550905060005b602081101562001f17578082901c60011660010362001ebd57826033826020811062001eb55762001eb562003b8a565b015550505050565b6033816020811062001ed35762001ed362003b8a565b01546040805160208101929092528101849052606001604051602081830303815290604052805190602001209250808062001f0e9062003be8565b91505062001e85565b5062001f2262003e87565b505050565b6053546068805463ffffffff909216790100000000000000000000000000000000000000000000000000027fffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffffff909216919091179081905573ffffffffffffffffffffffffffffffffffffffff65010000000000909104166333d6247d62001fad62001178565b6040518263ffffffff1660e01b815260040162001fcc91815260200190565b600060405180830381600087803b15801562001fe757600080fd5b505af1158015620014a7573d6000803e3d6000fd5b6200200d8b63ffffffff1662002d10565b6068546040805160208082018e90528183018d9052825180830384018152606083019384905280519101207f257b363200000000000000000000000000000000000000000000000000000000909252606481019190915260009165010000000000900473ffffffffffffffffffffffffffffffffffffffff169063257b3632906084016020604051808303816000875af1158015620020b0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620020d6919062003c97565b90508060000362002112576040517e2f6fad00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60685463ffffffff88811661010090920416146200215c576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606854600090610100900463ffffffff166200217a5750896200217d565b508a5b620021a66200219d848c8c8c8c8c8c8c604051620008d592919062003881565b8f8f8462001c93565b620021dd576040517fe0417cec00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505050505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905262001f229084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915262002d75565b600054610100900460ff166200235c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162001324565b6200070362002e88565b600260015403620023d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640162001324565b6002600155565b6000620023ec600482848662003eb6565b620023f79162003ee2565b90507f2afa5331000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000821601620026765760008080808080806200245a896004818d62003eb6565b81019062002469919062003f2b565b96509650965096509650965096503373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614620024dd576040517f912ecce700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff861630146200252d576040517f750643af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8a851462002567576040517f03fffc4b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff89811660248301528881166044830152606482018890526084820187905260ff861660a483015260c4820185905260e48083018590528351808403909101815261010490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fd505accf000000000000000000000000000000000000000000000000000000001790529151918e1691620026229190620038e6565b6000604051808303816000865af19150503d806000811462002661576040519150601f19603f3d011682016040523d82523d6000602084013e62002666565b606091505b50505050505050505050620009c9565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f8fcbaf0c0000000000000000000000000000000000000000000000000000000014620026f2576040517fe282c0ba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808080808080806200270a8a6004818e62003eb6565b81019062002719919062003f86565b975097509750975097509750975097503373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff16146200278f576040517f912ecce700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff87163014620027df576040517f750643af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff8a811660248301528981166044830152606482018990526084820188905286151560a483015260ff861660c483015260e482018590526101048083018590528351808403909101815261012490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f8fcbaf0c000000000000000000000000000000000000000000000000000000001790529151918f1691620028a39190620038e6565b6000604051808303816000865af19150503d8060008114620028e2576040519150601f19603f3d011682016040523d82523d6000602084013e620028e7565b606091505b50505050505050505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052620014a79085907f23b872dd000000000000000000000000000000000000000000000000000000009060840162002240565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f06fdde03000000000000000000000000000000000000000000000000000000001790529051606091600091829173ffffffffffffffffffffffffffffffffffffffff861691620029dd9190620038e6565b600060405180830381855afa9150503d806000811462002a1a576040519150601f19603f3d011682016040523d82523d6000602084013e62002a1f565b606091505b50915091508162002a66576040518060400160405280600781526020017f4e4f5f4e414d450000000000000000000000000000000000000000000000000081525062001d74565b62001d748162002f21565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f95d89b41000000000000000000000000000000000000000000000000000000001790529051606091600091829173ffffffffffffffffffffffffffffffffffffffff86169162002af59190620038e6565b600060405180830381855afa9150503d806000811462002b32576040519150601f19603f3d011682016040523d82523d6000602084013e62002b37565b606091505b50915091508162002a66576040518060400160405280600981526020017f4e4f5f53594d424f4c000000000000000000000000000000000000000000000081525062001d74565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f313ce5670000000000000000000000000000000000000000000000000000000017905290516000918291829173ffffffffffffffffffffffffffffffffffffffff86169162002c019190620038e6565b600060405180830381855afa9150503d806000811462002c3e576040519150601f19603f3d011682016040523d82523d6000602084013e62002c43565b606091505b509150915081801562002c57575080516020145b62002c6457601262001d74565b8080602001905181019062001d74919062004012565b60018055565b60685460ff1662002cbd576040517f5386698100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040517f1e5e34eea33501aecf2ebec9fe0e884a40804275ea7fe10b2ba084c8374308b390600090a1565b600881901c60008181526069602052604081208054600160ff861690811b91821892839055929091908183169003620009c9576040517f646cf55800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600062002dd9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16620031119092919063ffffffff16565b80519091501562001f22578080602001905181019062002dfa919062004032565b62001f22576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840162001324565b600054610100900460ff1662002c7a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162001324565b6060604082511062002f435781806020019051810190620007a2919062004052565b8151602003620030d35760005b60208110801562002f9b575082818151811062002f715762002f7162003b8a565b01602001517fff000000000000000000000000000000000000000000000000000000000000001615155b1562002fb6578062002fad8162003be8565b91505062002f50565b8060000362002ffa57505060408051808201909152601281527f4e4f545f56414c49445f454e434f44494e4700000000000000000000000000006020820152919050565b60008167ffffffffffffffff81111562003018576200301862003891565b6040519080825280601f01601f19166020018201604052801562003043576020820181803683370190505b50905060005b82811015620030cb5784818151811062003067576200306762003b8a565b602001015160f81c60f81b82828151811062003087576200308762003b8a565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080620030c28162003be8565b91505062003049565b509392505050565b505060408051808201909152601281527f4e4f545f56414c49445f454e434f44494e470000000000000000000000000000602082015290565b919050565b606062001d748484600085856000808673ffffffffffffffffffffffffffffffffffffffff168587604051620031489190620038e6565b60006040518083038185875af1925050503d806000811462003187576040519150601f19603f3d011682016040523d82523d6000602084013e6200318c565b606091505b50915091506200319f87838387620031aa565b979650505050505050565b60608315620032455782516000036200323d5773ffffffffffffffffffffffffffffffffffffffff85163b6200323d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162001324565b508162001d74565b62001d7483838151156200325c5781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620013249190620040d2565b611b6680620040e883390190565b803563ffffffff811681146200310c57600080fd5b73ffffffffffffffffffffffffffffffffffffffff81168114620032d857600080fd5b50565b60008060408385031215620032ef57600080fd5b620032fa83620032a0565b915060208301356200330c81620032b5565b809150509250929050565b8015158114620032d857600080fd5b60008083601f8401126200333957600080fd5b50813567ffffffffffffffff8111156200335257600080fd5b6020830191508360208285010111156200336b57600080fd5b9250929050565b6000806000806000608086880312156200338b57600080fd5b6200339686620032a0565b94506020860135620033a881620032b5565b93506040860135620033ba8162003317565b9250606086013567ffffffffffffffff811115620033d757600080fd5b620033e58882890162003326565b969995985093965092949392505050565b806104008101831015620007a257600080fd5b60008060008060008060008060008060006105208c8e0312156200342c57600080fd5b620034388d8d620033f6565b9a50620034496104008d01620032a0565b99506104208c013598506104408c013597506200346a6104608d01620032a0565b96506104808c01356200347d81620032b5565b95506200348e6104a08d01620032a0565b94506104c08c0135620034a181620032b5565b93506104e08c013592506105008c013567ffffffffffffffff811115620034c757600080fd5b620034d58e828f0162003326565b915080935050809150509295989b509295989b9093969950565b6000602082840312156200350257600080fd5b81356200350f81620032b5565b9392505050565b60ff81168114620032d857600080fd5b600080600080600080600060e0888a0312156200354257600080fd5b87356200354f8162003516565b96506200355f60208901620032a0565b955060408801356200357181620032b5565b94506200358160608901620032a0565b935060808801356200359381620032b5565b9699959850939692959460a0840135945060c09093013592915050565b600080600060608486031215620035c657600080fd5b620035d184620032a0565b92506020840135620035e381620032b5565b91506040840135620035f581620032b5565b809150509250925092565b6000602082840312156200361357600080fd5b5035919050565b600080600080600080600060a0888a0312156200363657600080fd5b6200364188620032a0565b965060208801356200365381620032b5565b9550604088013567ffffffffffffffff808211156200367157600080fd5b6200367f8b838c0162003326565b909750955060608a01359150808211156200369957600080fd5b50620036a88a828b0162003326565b9094509250506080880135620036be8162003516565b8091505092959891949750929550565b600080600080600080600060c0888a031215620036ea57600080fd5b620036f588620032a0565b965060208801356200370781620032b5565b95506040880135945060608801356200372081620032b5565b93506080880135620037328162003317565b925060a088013567ffffffffffffffff8111156200374f57600080fd5b6200375d8a828b0162003326565b989b979a50959850939692959293505050565b60008060008061046085870312156200378857600080fd5b843593506200379b8660208701620033f6565b9250620037ac6104208601620032a0565b939692955092936104400135925050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b600061010060ff8c16835263ffffffff808c16602085015273ffffffffffffffffffffffffffffffffffffffff808c166040860152818b166060860152808a166080860152508760a08501528160c0850152620038678285018789620037bd565b925080851660e085015250509a9950505050505050505050565b8183823760009101908152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60005b83811015620038dd578181015183820152602001620038c3565b50506000910152565b60008251620038fa818460208701620038c0565b9190910192915050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156200394e576200394e62003891565b604052919050565b600067ffffffffffffffff82111562003973576200397362003891565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112620039b157600080fd5b8135620039c8620039c28262003956565b62003904565b818152846020838601011115620039de57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121562003a1157600080fd5b833567ffffffffffffffff8082111562003a2a57600080fd5b62003a38878388016200399f565b9450602086013591508082111562003a4f57600080fd5b5062003a5e868287016200399f565b9250506040840135620035f58162003516565b6000815180845262003a8b816020860160208601620038c0565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60608152600062003ad2606083018662003a71565b828103602084015262003ae6818662003a71565b91505060ff83166040830152949350505050565b63ffffffff86168152600073ffffffffffffffffffffffffffffffffffffffff8087166020840152808616604084015250608060608301526200319f608083018486620037bd565b73ffffffffffffffffffffffffffffffffffffffff8516815263ffffffff8416602082015260606040820152600062003b80606083018486620037bd565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820362003c1c5762003c1c62003bb9565b5060010190565b60608152600062003c39606083018789620037bd565b828103602084015262003c4e818688620037bd565b91505060ff831660408301529695505050505050565b6000835162003c78818460208801620038c0565b83519083019062003c8e818360208801620038c0565b01949350505050565b60006020828403121562003caa57600080fd5b5051919050565b81810381811115620007a257620007a262003bb9565b600061010060ff8b16835263ffffffff808b16602085015273ffffffffffffffffffffffffffffffffffffffff808b166040860152818a1660608601528089166080860152508660a08501528160c085015262003d278285018762003a71565b925080851660e085015250509998505050505050505050565b600181815b8085111562003d9f57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111562003d835762003d8362003bb9565b8085161562003d9157918102915b93841c939080029062003d45565b509250929050565b60008262003db857506001620007a2565b8162003dc757506000620007a2565b816001811462003de0576002811462003deb5762003e0b565b6001915050620007a2565b60ff84111562003dff5762003dff62003bb9565b50506001821b620007a2565b5060208310610133831016604e8410600b841016171562003e30575081810a620007a2565b62003e3c838362003d40565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111562003e715762003e7162003bb9565b029392505050565b60006200350f838362003da7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b6000808585111562003ec757600080fd5b8386111562003ed557600080fd5b5050820193919092039150565b7fffffffff00000000000000000000000000000000000000000000000000000000813581811691600485101562003f235780818660040360031b1b83161692505b505092915050565b600080600080600080600060e0888a03121562003f4757600080fd5b873562003f5481620032b5565b9650602088013562003f6681620032b5565b955060408801359450606088013593506080880135620035938162003516565b600080600080600080600080610100898b03121562003fa457600080fd5b883562003fb181620032b5565b9750602089013562003fc381620032b5565b96506040890135955060608901359450608089013562003fe38162003317565b935060a089013562003ff58162003516565b979a969950949793969295929450505060c08201359160e0013590565b6000602082840312156200402557600080fd5b81516200350f8162003516565b6000602082840312156200404557600080fd5b81516200350f8162003317565b6000602082840312156200406557600080fd5b815167ffffffffffffffff8111156200407d57600080fd5b8201601f810184136200408f57600080fd5b8051620040a0620039c28262003956565b818152856020838501011115620040b657600080fd5b620040c9826020830160208601620038c0565b95945050505050565b6020815260006200350f602083018462003a7156fe6101006040523480156200001257600080fd5b5060405162001b6638038062001b6683398101604081905262000035916200028d565b82826003620000458382620003a1565b506004620000548282620003a1565b50503360c0525060ff811660e052466080819052620000739062000080565b60a052506200046d915050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f620000ad6200012e565b805160209182012060408051808201825260018152603160f81b90840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b6060600380546200013f9062000312565b80601f01602080910402602001604051908101604052809291908181526020018280546200016d9062000312565b8015620001be5780601f106200019257610100808354040283529160200191620001be565b820191906000526020600020905b815481529060010190602001808311620001a057829003601f168201915b5050505050905090565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620001f057600080fd5b81516001600160401b03808211156200020d576200020d620001c8565b604051601f8301601f19908116603f01168101908282118183101715620002385762000238620001c8565b816040528381526020925086838588010111156200025557600080fd5b600091505b838210156200027957858201830151818301840152908201906200025a565b600093810190920192909252949350505050565b600080600060608486031215620002a357600080fd5b83516001600160401b0380821115620002bb57600080fd5b620002c987838801620001de565b94506020860151915080821115620002e057600080fd5b50620002ef86828701620001de565b925050604084015160ff811681146200030757600080fd5b809150509250925092565b600181811c908216806200032757607f821691505b6020821081036200034857634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200039c57600081815260208120601f850160051c81016020861015620003775750805b601f850160051c820191505b81811015620003985782815560010162000383565b5050505b505050565b81516001600160401b03811115620003bd57620003bd620001c8565b620003d581620003ce845462000312565b846200034e565b602080601f8311600181146200040d5760008415620003f45750858301515b600019600386901b1c1916600185901b17855562000398565b600085815260208120601f198616915b828110156200043e578886015182559484019460019091019084016200041d565b50858210156200045d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e0516116aa620004bc6000396000610237015260008181610307015281816105c001526106a70152600061053a015260008181610379015261050401526116aa6000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806370a08231116100d8578063a457c2d71161008c578063d505accf11610066578063d505accf1461039b578063dd62ed3e146103ae578063ffa1ad74146103f457600080fd5b8063a457c2d71461034e578063a9059cbb14610361578063cd0d00961461037457600080fd5b806395d89b41116100bd57806395d89b41146102e75780639dc29fac146102ef578063a3c573eb1461030257600080fd5b806370a08231146102915780637ecebe00146102c757600080fd5b806330adf81f1161012f5780633644e515116101145780633644e51514610261578063395093511461026957806340c10f191461027c57600080fd5b806330adf81f14610209578063313ce5671461023057600080fd5b806318160ddd1161016057806318160ddd146101bd57806320606b70146101cf57806323b872dd146101f657600080fd5b806306fdde031461017c578063095ea7b31461019a575b600080fd5b610184610430565b60405161019191906113e4565b60405180910390f35b6101ad6101a8366004611479565b6104c2565b6040519015158152602001610191565b6002545b604051908152602001610191565b6101c17f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81565b6101ad6102043660046114a3565b6104dc565b6101c17f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152602001610191565b6101c1610500565b6101ad610277366004611479565b61055c565b61028f61028a366004611479565b6105a8565b005b6101c161029f3660046114df565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6101c16102d53660046114df565b60056020526000908152604090205481565b610184610680565b61028f6102fd366004611479565b61068f565b6103297f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610191565b6101ad61035c366004611479565b61075e565b6101ad61036f366004611479565b61082f565b6101c17f000000000000000000000000000000000000000000000000000000000000000081565b61028f6103a9366004611501565b61083d565b6101c16103bc366004611574565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6101846040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525081565b60606003805461043f906115a7565b80601f016020809104026020016040519081016040528092919081815260200182805461046b906115a7565b80156104b85780601f1061048d576101008083540402835291602001916104b8565b820191906000526020600020905b81548152906001019060200180831161049b57829003601f168201915b5050505050905090565b6000336104d0818585610b73565b60019150505b92915050565b6000336104ea858285610d27565b6104f5858585610dfe565b506001949350505050565b60007f00000000000000000000000000000000000000000000000000000000000000004614610537576105324661106d565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091906104d090829086906105a3908790611629565b610b73565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610672576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d4272696467650000000000000000000000000000000060648201526084015b60405180910390fd5b61067c8282611135565b5050565b60606004805461043f906115a7565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610754576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d427269646765000000000000000000000000000000006064820152608401610669565b61067c8282611228565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015610822576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610669565b6104f58286868403610b73565b6000336104d0818585610dfe565b834211156108cc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f546f6b656e577261707065643a3a7065726d69743a204578706972656420706560448201527f726d6974000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8716600090815260056020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918a918a918a9190866109268361163c565b9091555060408051602081019690965273ffffffffffffffffffffffffffffffffffffffff94851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000610991610500565b6040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281019190915260428101839052606201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa158015610a55573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590610ad057508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b610b5c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f546f6b656e577261707065643a3a7065726d69743a20496e76616c696420736960448201527f676e6174757265000000000000000000000000000000000000000000000000006064820152608401610669565b610b678a8a8a610b73565b50505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff8316610c15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610cb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610df85781811015610deb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610669565b610df88484848403610b73565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610ea1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610f44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610ffa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610df8565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f611098610430565b8051602091820120604080518082018252600181527f310000000000000000000000000000000000000000000000000000000000000090840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b73ffffffffffffffffffffffffffffffffffffffff82166111b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610669565b80600260008282546111c49190611629565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff82166112cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205481811015611381576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610d1a565b600060208083528351808285015260005b81811015611411578581018301518582016040015282016113f5565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461147457600080fd5b919050565b6000806040838503121561148c57600080fd5b61149583611450565b946020939093013593505050565b6000806000606084860312156114b857600080fd5b6114c184611450565b92506114cf60208501611450565b9150604084013590509250925092565b6000602082840312156114f157600080fd5b6114fa82611450565b9392505050565b600080600080600080600060e0888a03121561151c57600080fd5b61152588611450565b965061153360208901611450565b95506040880135945060608801359350608088013560ff8116811461155757600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561158757600080fd5b61159083611450565b915061159e60208401611450565b90509250929050565b600181811c908216806115bb57607f821691505b6020821081036115f4577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156104d6576104d66115fa565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361166d5761166d6115fa565b506001019056fea26469706673582212208d88fee561cff7120d381c345cfc534cef8229a272dc5809d4bbb685ad67141164736f6c63430008110033a2646970667358221220d9b3ca7b13ec80ac58634ddf0ecebe71e209a71f532614949b9e720413f50c8364736f6c63430008110033" +   + m.stateMock.
    - 43 + + 387 +
    - - }, + On("UpdateBatchProof", mock.MatchedBy(matchAggregatorCtxFn), &proof2, dbTx).
    - 44 + + 388 +
    - - - { +   + Run(func(args mock.Arguments) {
    - 45 + + 389 +
    - - - "contractName": "PolygonZkEVMBridge proxy", +   + assert.Nil(args[1].(*state.Proof).GeneratingSince)
    - 46 + + 390 +
    - - - "balance": "200000000000000000000000000", +   + }).
    - 47 + +
    @@ -399,7 +399,7 @@
    +
    + 399 +
    - - - "nonce": "1", +   + },
    - 48 + + 400 +
    - - - "address": "0x528e26b25a34a4A5d0dbDa1d57D318153d2ED582", +   + },
    - 49 + + 401 +
    - - - "bytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461088b565b610135565b61006b6100a33660046108a6565b61017f565b3480156100b457600080fd5b506100bd6101f3565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461088b565b610231565b34801561011257600080fd5b506100bd61025e565b6101236102d4565b61013361012e6103ab565b6103b5565b565b61013d6103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481604051806020016040528060008152506000610419565b50565b61017461011b565b6101876103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101eb576101e68383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610419915050565b505050565b6101e661011b565b60006101fd6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103ab565b905090565b61022e61011b565b90565b6102396103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481610444565b60006102686103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103d9565b60606102b183836040518060600160405280602781526020016109bb602791396104a5565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b6102dc6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b600061022161052a565b3660008037600080366000845af43d6000803e8080156103d4573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b61042283610552565b60008251118061042f5750805b156101e65761043e838361028c565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61046d6103d9565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a16101748161059f565b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516104cf919061094d565b600060405180830381855af49150503d806000811461050a576040519150601f19603f3d011682016040523d82523d6000602084013e61050f565b606091505b5091509150610520868383876106ab565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6103fd565b61055b81610753565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff8116610642576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103a2565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b6060831561074157825160000361073a5773ffffffffffffffffffffffffffffffffffffffff85163b61073a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103a2565b508161074b565b61074b838361081e565b949350505050565b73ffffffffffffffffffffffffffffffffffffffff81163b6107f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e74726163740000000000000000000000000000000000000060648201526084016103a2565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610665565b81511561082e5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a29190610969565b803573ffffffffffffffffffffffffffffffffffffffff8116811461088657600080fd5b919050565b60006020828403121561089d57600080fd5b6102b182610862565b6000806000604084860312156108bb57600080fd5b6108c484610862565b9250602084013567ffffffffffffffff808211156108e157600080fd5b818601915086601f8301126108f557600080fd5b81358181111561090457600080fd5b87602082850101111561091657600080fd5b6020830194508093505050509250925092565b60005b8381101561094457818101518382015260200161092c565b50506000910152565b6000825161095f818460208701610929565b9190910192915050565b6020815260008251806020840152610988816040850160208701610929565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220a1af0d6cb4f1e31496a4c5c1448913bce4bd6ad3a39e47c6f7190c114d6f9bf464736f6c63430008110033", +   + {
    - 50 + + 402 +
    - - "storage": { + name: "unlockBatchProofsToAggregate error after WaitRecursiveProof prover error",
    - 51 + + 403 +
    - - - "0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000000000000000000000000000000000000000000001", +   + setup: func(m mox, a *Aggregator) {
    - 52 + + 404 +
    - - - "0x0000000000000000000000000000000000000000000000000000000000000001": "0x0000000000000000000000000000000000000000000000000000000000000001", +   + m.proverMock.On("Name").Return(proverName).Twice()
    - 53 + + 405 +
    - - - "0x0000000000000000000000000000000000000000000000000000000000000068": "0x00000000000000a40d5f56745a118d0906a34e69aec8c0db1cb8fa0000000100", +   + m.proverMock.On("ID").Return(proverID).Twice()
    - 54 + +
    @@ -407,16 +407,16 @@
    +
    + 407 +
    - - - "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x00000000000000000000000085ceb41028b1a5ed2b88e395145344837308b251", +   + dbTx := &mocks.DbTxMock{}
    - 55 + + 408 +
    - - - "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x0000000000000000000000008bd36ca1a55e389335004872aa3c3be0969d3aa7" +   + lockProofsTxBegin := m.stateMock.On("BeginStateTransaction", mock.MatchedBy(matchProverCtxFn)).Return(dbTx, nil).Once()
    - 56 + + 409 +
    - - - } +   + dbTx.On("Commit", mock.MatchedBy(matchProverCtxFn)).Return(nil).Once()
    - 57 + + 410 +
    - - }, + m.stateMock.On("GetBatchProofsToAggregate", mock.MatchedBy(matchProverCtxFn), nil).Return(&proof1, &proof2, nil).Once()
    - 58 + + 411 +
    - - - { +   + proof1GeneratingTrueCall := m.stateMock.
    - 59 + + 412 +
    - - "contractName": "PolygonZkEVMGlobalExitRootL2 implementation", + On("UpdateBatchProof", mock.MatchedBy(matchProverCtxFn), &proof1, dbTx).
    - 60 + + 413 +
    - - - "balance": "0", +   + Run(func(args mock.Arguments) {
    - 61 + + 414 +
    - - - "nonce": "1", +   + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - 62 + + 415 +
    - - - "address": "0x282a631D9F3Ef04Bf1A44B4C9e8bDC8EB278917f", +   + }).
    - 63 + + 416 +
    - - - "bytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806301fd904414610051578063257b36321461006d57806333d6247d1461008d578063a3c573eb146100a2575b600080fd5b61005a60015481565b6040519081526020015b60405180910390f35b61005a61007b366004610162565b60006020819052908152604090205481565b6100a061009b366004610162565b6100ee565b005b6100c97f000000000000000000000000528e26b25a34a4a5d0dbda1d57d318153d2ed58281565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610064565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000528e26b25a34a4a5d0dbda1d57d318153d2ed582161461015d576040517fb49365dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600155565b60006020828403121561017457600080fd5b503591905056fea2646970667358221220a187fc278346c1b61c449ea3641002b6eac2bda3351a122a12c35099f933696864736f6c63430008110033" +   + Return(nil).
    - 64 + + 417 +
    - - - }, +   + Once()
    - 65 + + 418 +
    - - - { +   + m.stateMock.
    - 66 + + 419 +
    - - "contractName": "PolygonZkEVMGlobalExitRootL2 proxy", + On("UpdateBatchProof", mock.MatchedBy(matchProverCtxFn), &proof2, dbTx).
    - 67 + + 420 +
    - - - "balance": "0", +   + Run(func(args mock.Arguments) {
    - 68 + + 421 +
    - - - "nonce": "1", +   + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - 69 + + 422 +
    - - - "address": "0xa40d5f56745a118d0906a34e69aec8c0db1cb8fa", +   + }).
    - 70 + +
    @@ -426,7 +426,7 @@
    +
    + 426 +
    - - - "bytecode": "0x60806040523661001357610011610017565b005b6100115b61001f6101b7565b6001600160a01b0316336001600160a01b0316141561016f5760606001600160e01b031960003516631b2ce7f360e11b8114156100655761005e6101ea565b9150610167565b6001600160e01b0319811663278f794360e11b14156100865761005e610241565b6001600160e01b031981166308f2839760e41b14156100a75761005e610287565b6001600160e01b031981166303e1469160e61b14156100c85761005e6102b8565b6001600160e01b03198116635c60da1b60e01b14156100e95761005e6102f8565b60405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b815160208301f35b61017761030c565b565b606061019e83836040518060600160405280602781526020016108576027913961031c565b9392505050565b90565b6001600160a01b03163b151590565b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b60606101f4610394565b600061020336600481846106a2565b81019061021091906106e8565b905061022d8160405180602001604052806000815250600061039f565b505060408051602081019091526000815290565b606060008061025336600481846106a2565b8101906102609190610719565b915091506102708282600161039f565b604051806020016040528060008152509250505090565b6060610291610394565b60006102a036600481846106a2565b8101906102ad91906106e8565b905061022d816103cb565b60606102c2610394565b60006102cc6101b7565b604080516001600160a01b03831660208201529192500160405160208183030381529060405291505090565b6060610302610394565b60006102cc610422565b610177610317610422565b610431565b6060600080856001600160a01b0316856040516103399190610807565b600060405180830381855af49150503d8060008114610374576040519150601f19603f3d011682016040523d82523d6000602084013e610379565b606091505b509150915061038a86838387610455565b9695505050505050565b341561017757600080fd5b6103a8836104d3565b6000825111806103b55750805b156103c6576103c48383610179565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6103f46101b7565b604080516001600160a01b03928316815291841660208301520160405180910390a161041f81610513565b50565b600061042c6105bc565b905090565b3660008037600080366000845af43d6000803e808015610450573d6000f35b3d6000fd5b606083156104c15782516104ba576001600160a01b0385163b6104ba5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161015e565b50816104cb565b6104cb83836105e4565b949350505050565b6104dc8161060e565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6001600160a01b0381166105785760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b606482015260840161015e565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80546001600160a01b0319166001600160a01b039290921691909117905550565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6101db565b8151156105f45781518083602001fd5b8060405162461bcd60e51b815260040161015e9190610823565b6001600160a01b0381163b61067b5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161015e565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc61059b565b600080858511156106b257600080fd5b838611156106bf57600080fd5b5050820193919092039150565b80356001600160a01b03811681146106e357600080fd5b919050565b6000602082840312156106fa57600080fd5b61019e826106cc565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561072c57600080fd5b610735836106cc565b9150602083013567ffffffffffffffff8082111561075257600080fd5b818501915085601f83011261076657600080fd5b81358181111561077857610778610703565b604051601f8201601f19908116603f011681019083821181831017156107a0576107a0610703565b816040528281528860208487010111156107b957600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b838110156107f65781810151838201526020016107de565b838111156103c45750506000910152565b600082516108198184602087016107db565b9190910192915050565b60208152600082518060208401526108428160408501602087016107db565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122012bb4f564f73959a03513dc74fc3c6e40e8386e6f02c16b78d6db00ce0aa16af64736f6c63430008090033", +   + m.proverMock.On("WaitRecursiveProof", mock.MatchedBy(matchProverCtxFn), proofID).Return("", errBanana).Once()
    - 71 + + 427 +
    - - - "storage": { +   + m.stateMock.On("BeginStateTransaction", mock.MatchedBy(matchAggregatorCtxFn)).Return(dbTx, nil).Once().NotBefore(lockProofsTxBegin)
    - 72 + + 428 +
    - - - "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x00000000000000000000000085ceb41028b1a5ed2b88e395145344837308b251", +   + m.stateMock.
    - 73 + + 429 +
    - - "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x000000000000000000000000282a631d9f3ef04bf1a44b4c9e8bdc8eb278917f" + On("UpdateBatchProof", mock.MatchedBy(matchAggregatorCtxFn), &proof1, dbTx).
    - 74 + + 430 +
    - - - } +   + Run(func(args mock.Arguments) {
    - 75 + + 431 +
    - - - }, +   + assert.Nil(args[1].(*state.Proof).GeneratingSince)
    - 76 + + 432 +
    - - - { +   + }).
    - 77 + +
    @@ -441,7 +441,7 @@
    +
    + 441 +
    - - - "contractName": "PolygonZkEVMTimelock", +   + },
    - 78 + + 442 +
    - - - "balance": "0", +   + },
    - 79 + + 443 +
    - - - "nonce": "1", +   + {
    - 80 + + 444 +
    - - "address": "0xdbC6981a11fc2B000c635bFA7C47676b25C87D39", + name: "rollback after DeleteBatchProofs error in db transaction",
    - 81 + + 445 +
    - - - "bytecode": "0x6080604052600436106101c65760003560e01c806364d62353116100f7578063b1c5f42711610095578063d547741f11610064578063d547741f14610661578063e38335e514610681578063f23a6e6114610694578063f27a0c92146106d957600080fd5b8063b1c5f427146105af578063bc197c81146105cf578063c4d252f514610614578063d45c44351461063457600080fd5b80638f61f4f5116100d15780638f61f4f5146104e157806391d1485414610515578063a217fddf14610566578063b08e51c01461057b57600080fd5b806364d62353146104815780638065657f146104a15780638f2a0bb0146104c157600080fd5b8063248a9ca31161016457806331d507501161013e57806331d50750146103c857806336568abe146103e85780633a6aae7214610408578063584b153e1461046157600080fd5b8063248a9ca3146103475780632ab0f529146103775780632f2ff15d146103a857600080fd5b80630d3cf6fc116101a05780630d3cf6fc1461026b578063134008d31461029f57806313bc9f20146102b2578063150b7a02146102d257600080fd5b806301d5062a146101d257806301ffc9a7146101f457806307bd02651461022957600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506101f26101ed366004611c52565b6106ee565b005b34801561020057600080fd5b5061021461020f366004611cc7565b610783565b60405190151581526020015b60405180910390f35b34801561023557600080fd5b5061025d7fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e6381565b604051908152602001610220565b34801561027757600080fd5b5061025d7f5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca581565b6101f26102ad366004611d09565b6107df565b3480156102be57600080fd5b506102146102cd366004611d75565b6108d7565b3480156102de57600080fd5b506103166102ed366004611e9a565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610220565b34801561035357600080fd5b5061025d610362366004611d75565b60009081526020819052604090206001015490565b34801561038357600080fd5b50610214610392366004611d75565b6000908152600160208190526040909120541490565b3480156103b457600080fd5b506101f26103c3366004611f02565b6108fd565b3480156103d457600080fd5b506102146103e3366004611d75565b610927565b3480156103f457600080fd5b506101f2610403366004611f02565b610940565b34801561041457600080fd5b5061043c7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610220565b34801561046d57600080fd5b5061021461047c366004611d75565b6109f8565b34801561048d57600080fd5b506101f261049c366004611d75565b610a0e565b3480156104ad57600080fd5b5061025d6104bc366004611d09565b610ade565b3480156104cd57600080fd5b506101f26104dc366004611f73565b610b1d565b3480156104ed57600080fd5b5061025d7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc181565b34801561052157600080fd5b50610214610530366004611f02565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b34801561057257600080fd5b5061025d600081565b34801561058757600080fd5b5061025d7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f78381565b3480156105bb57600080fd5b5061025d6105ca366004612025565b610d4f565b3480156105db57600080fd5b506103166105ea36600461214e565b7fbc197c810000000000000000000000000000000000000000000000000000000095945050505050565b34801561062057600080fd5b506101f261062f366004611d75565b610d94565b34801561064057600080fd5b5061025d61064f366004611d75565b60009081526001602052604090205490565b34801561066d57600080fd5b506101f261067c366004611f02565b610e8f565b6101f261068f366004612025565b610eb4565b3480156106a057600080fd5b506103166106af3660046121f8565b7ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b3480156106e557600080fd5b5061025d611161565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc161071881611244565b6000610728898989898989610ade565b90506107348184611251565b6000817f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8b8b8b8b8b8a604051610770969594939291906122a6565b60405180910390a3505050505050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f4e2312e00000000000000000000000000000000000000000000000000000000014806107d957506107d98261139e565b92915050565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff1661085c5761085c8133611435565b600061086c888888888888610ade565b905061087881856114ed565b6108848888888861162a565b6000817fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588a8a8a8a6040516108bc94939291906122f1565b60405180910390a36108cd8161172e565b5050505050505050565b6000818152600160205260408120546001811180156108f65750428111155b9392505050565b60008281526020819052604090206001015461091881611244565b61092283836117d7565b505050565b60008181526001602052604081205481905b1192915050565b73ffffffffffffffffffffffffffffffffffffffff811633146109ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6109f482826118c7565b5050565b6000818152600160208190526040822054610939565b333014610a9d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f54696d656c6f636b436f6e74726f6c6c65723a2063616c6c6572206d7573742060448201527f62652074696d656c6f636b00000000000000000000000000000000000000000060648201526084016109e1565b60025460408051918252602082018390527f11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d5910160405180910390a1600255565b6000868686868686604051602001610afb969594939291906122a6565b6040516020818303038152906040528051906020012090509695505050505050565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1610b4781611244565b888714610bd6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b888514610c65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b6000610c778b8b8b8b8b8b8b8b610d4f565b9050610c838184611251565b60005b8a811015610d415780827f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8e8e85818110610cc357610cc3612331565b9050602002016020810190610cd89190612360565b8d8d86818110610cea57610cea612331565b905060200201358c8c87818110610d0357610d03612331565b9050602002810190610d15919061237b565b8c8b604051610d29969594939291906122a6565b60405180910390a3610d3a8161240f565b9050610c86565b505050505050505050505050565b60008888888888888888604051602001610d709897969594939291906124f7565b60405160208183030381529060405280519060200120905098975050505050505050565b7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f783610dbe81611244565b610dc7826109f8565b610e53576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20636160448201527f6e6e6f742062652063616e63656c6c656400000000000000000000000000000060648201526084016109e1565b6000828152600160205260408082208290555183917fbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb7091a25050565b600082815260208190526040902060010154610eaa81611244565b61092283836118c7565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff16610f3157610f318133611435565b878614610fc0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b87841461104f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b60006110618a8a8a8a8a8a8a8a610d4f565b905061106d81856114ed565b60005b8981101561114b5760008b8b8381811061108c5761108c612331565b90506020020160208101906110a19190612360565b905060008a8a848181106110b7576110b7612331565b9050602002013590503660008a8a868181106110d5576110d5612331565b90506020028101906110e7919061237b565b915091506110f78484848461162a565b84867fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588686868660405161112e94939291906122f1565b60405180910390a350505050806111449061240f565b9050611070565b506111558161172e565b50505050505050505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff161580159061123257507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166315064c966040518163ffffffff1660e01b8152600401602060405180830381865afa15801561120e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123291906125be565b1561123d5750600090565b5060025490565b61124e8133611435565b50565b61125a82610927565b156112e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20616c60448201527f7265616479207363686564756c6564000000000000000000000000000000000060648201526084016109e1565b6112ef611161565b81101561137e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a20696e73756666696369656e7460448201527f2064656c6179000000000000000000000000000000000000000000000000000060648201526084016109e1565b61138881426125e0565b6000928352600160205260409092209190915550565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806107d957507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146107d9565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f4576114738161197e565b61147e83602061199d565b60405160200161148f929190612617565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526109e191600401612698565b6114f6826108d7565b611582576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b80158061159e5750600081815260016020819052604090912054145b6109f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a206d697373696e67206465706560448201527f6e64656e6379000000000000000000000000000000000000000000000000000060648201526084016109e1565b60008473ffffffffffffffffffffffffffffffffffffffff168484846040516116549291906126e9565b60006040518083038185875af1925050503d8060008114611691576040519150601f19603f3d011682016040523d82523d6000602084013e611696565b606091505b5050905080611727576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f54696d656c6f636b436f6e74726f6c6c65723a20756e6465726c79696e67207460448201527f72616e73616374696f6e2072657665727465640000000000000000000000000060648201526084016109e1565b5050505050565b611737816108d7565b6117c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b600090815260016020819052604090912055565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556118693390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60606107d973ffffffffffffffffffffffffffffffffffffffff831660145b606060006119ac8360026126f9565b6119b79060026125e0565b67ffffffffffffffff8111156119cf576119cf611d8e565b6040519080825280601f01601f1916602001820160405280156119f9576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611a3057611a30612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611a9357611a93612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000611acf8460026126f9565b611ada9060016125e0565b90505b6001811115611b77577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611b1b57611b1b612331565b1a60f81b828281518110611b3157611b31612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611b7081612710565b9050611add565b5083156108f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109e1565b803573ffffffffffffffffffffffffffffffffffffffff81168114611c0457600080fd5b919050565b60008083601f840112611c1b57600080fd5b50813567ffffffffffffffff811115611c3357600080fd5b602083019150836020828501011115611c4b57600080fd5b9250929050565b600080600080600080600060c0888a031215611c6d57600080fd5b611c7688611be0565b965060208801359550604088013567ffffffffffffffff811115611c9957600080fd5b611ca58a828b01611c09565b989b979a50986060810135976080820135975060a09091013595509350505050565b600060208284031215611cd957600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146108f657600080fd5b60008060008060008060a08789031215611d2257600080fd5b611d2b87611be0565b955060208701359450604087013567ffffffffffffffff811115611d4e57600080fd5b611d5a89828a01611c09565b979a9699509760608101359660809091013595509350505050565b600060208284031215611d8757600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611e0457611e04611d8e565b604052919050565b600082601f830112611e1d57600080fd5b813567ffffffffffffffff811115611e3757611e37611d8e565b611e6860207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601611dbd565b818152846020838601011115611e7d57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215611eb057600080fd5b611eb985611be0565b9350611ec760208601611be0565b925060408501359150606085013567ffffffffffffffff811115611eea57600080fd5b611ef687828801611e0c565b91505092959194509250565b60008060408385031215611f1557600080fd5b82359150611f2560208401611be0565b90509250929050565b60008083601f840112611f4057600080fd5b50813567ffffffffffffffff811115611f5857600080fd5b6020830191508360208260051b8501011115611c4b57600080fd5b600080600080600080600080600060c08a8c031215611f9157600080fd5b893567ffffffffffffffff80821115611fa957600080fd5b611fb58d838e01611f2e565b909b50995060208c0135915080821115611fce57600080fd5b611fda8d838e01611f2e565b909950975060408c0135915080821115611ff357600080fd5b506120008c828d01611f2e565b9a9d999c50979a969997986060880135976080810135975060a0013595509350505050565b60008060008060008060008060a0898b03121561204157600080fd5b883567ffffffffffffffff8082111561205957600080fd5b6120658c838d01611f2e565b909a50985060208b013591508082111561207e57600080fd5b61208a8c838d01611f2e565b909850965060408b01359150808211156120a357600080fd5b506120b08b828c01611f2e565b999c989b509699959896976060870135966080013595509350505050565b600082601f8301126120df57600080fd5b8135602067ffffffffffffffff8211156120fb576120fb611d8e565b8160051b61210a828201611dbd565b928352848101820192828101908785111561212457600080fd5b83870192505b848310156121435782358252918301919083019061212a565b979650505050505050565b600080600080600060a0868803121561216657600080fd5b61216f86611be0565b945061217d60208701611be0565b9350604086013567ffffffffffffffff8082111561219a57600080fd5b6121a689838a016120ce565b945060608801359150808211156121bc57600080fd5b6121c889838a016120ce565b935060808801359150808211156121de57600080fd5b506121eb88828901611e0c565b9150509295509295909350565b600080600080600060a0868803121561221057600080fd5b61221986611be0565b945061222760208701611be0565b93506040860135925060608601359150608086013567ffffffffffffffff81111561225157600080fd5b6121eb88828901611e0c565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b73ffffffffffffffffffffffffffffffffffffffff8716815285602082015260a0604082015260006122dc60a08301868861225d565b60608301949094525060800152949350505050565b73ffffffffffffffffffffffffffffffffffffffff8516815283602082015260606040820152600061232760608301848661225d565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561237257600080fd5b6108f682611be0565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126123b057600080fd5b83018035915067ffffffffffffffff8211156123cb57600080fd5b602001915036819003821315611c4b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612440576124406123e0565b5060010190565b81835260006020808501808196508560051b810191508460005b878110156124ea57828403895281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18836030181126124a057600080fd5b8701858101903567ffffffffffffffff8111156124bc57600080fd5b8036038213156124cb57600080fd5b6124d686828461225d565b9a87019a9550505090840190600101612461565b5091979650505050505050565b60a0808252810188905260008960c08301825b8b8110156125455773ffffffffffffffffffffffffffffffffffffffff61253084611be0565b1682526020928301929091019060010161250a565b5083810360208501528881527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff89111561257e57600080fd5b8860051b9150818a602083013701828103602090810160408501526125a69082018789612447565b60608401959095525050608001529695505050505050565b6000602082840312156125d057600080fd5b815180151581146108f657600080fd5b808201808211156107d9576107d96123e0565b60005b8381101561260e5781810151838201526020016125f6565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161264f8160178501602088016125f3565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161268c8160288401602088016125f3565b01602801949350505050565b60208152600082518060208401526126b78160408501602087016125f3565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b8183823760009101908152919050565b80820281158282048414176107d9576107d96123e0565b60008161271f5761271f6123e0565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea26469706673582212206416c4e08f97752b4bb06159524dac058d3dccd8775e57ef1b01505751ebf7af64736f6c63430008110033", +   + setup: func(m mox, a *Aggregator) {
    - 82 + + 446 +
    - - - "storage": { +   + m.proverMock.On("Name").Return(proverName).Twice()
    - 83 + + 447 +
    - - - "0x0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000000000000000000e10", +   + m.proverMock.On("ID").Return(proverID).Twice()
    - 84 + +
    @@ -449,16 +449,16 @@
    +
    + 449 +
    - - - "0xf587dde6f8846415188f807710a3304f72092565918b30307d60efdc8014f20b": "0x0000000000000000000000000000000000000000000000000000000000000001", +   + dbTx := &mocks.DbTxMock{}
    - 85 + + 450 +
    - - - "0x07020fe9de9b8274d1e6cc0668a6f6344a870f35e5a847590c8069dfa85ac78f": "0x0000000000000000000000000000000000000000000000000000000000000001", +   + lockProofsTxBegin := m.stateMock.On("BeginStateTransaction", mock.MatchedBy(matchProverCtxFn)).Return(dbTx, nil).Twice()
    - 86 + + 451 +
    - - - "0x64494413541ff93b31aa309254e3fed72a7456e9845988b915b4c7a7ceba8814": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", +   + lockProofsTxCommit := dbTx.On("Commit", mock.MatchedBy(matchProverCtxFn)).Return(nil).Once()
    - 87 + + 452 +
    - - "0xc8e266e0814671642b74f3807affd27009fcc23f713ea92d1743e0ee0c1e7603": "0x0000000000000000000000000000000000000000000000000000000000000001", + m.stateMock.On("GetBatchProofsToAggregate", mock.MatchedBy(matchProverCtxFn), nil).Return(&proof1, &proof2, nil).Once()
    - 88 + + 453 +
    - - - "0x3412d5605ac6cd444957cedb533e5dacad6378b4bc819ebe3652188a665066d6": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", +   + proof1GeneratingTrueCall := m.stateMock.
    - 89 + + 454 +
    - - "0x9b3efc411c5f69533db363941e091f6f3af8b7e306525413577a56d27e5dbe73": "0x0000000000000000000000000000000000000000000000000000000000000001", + On("UpdateBatchProof", mock.MatchedBy(matchProverCtxFn), &proof1, dbTx).
    - 90 + + 455 +
    - - - "0xdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d706a": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", +   + Run(func(args mock.Arguments) {
    - 91 + + 456 +
    - - - "0xa2001bdd6a5944149e83176d089ee9a8246bd56aecf38fe4d6c66f5fbac18675": "0x0000000000000000000000000000000000000000000000000000000000000001", +   + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - 92 + + 457 +
    - - - "0xc3ad33e20b0c56a223ad5104fff154aa010f8715b9c981fd38fdc60a4d1a52fc": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5" +   + }).
    - 93 + + 458 +
    - - - } +   + Return(nil).
    - 94 + + 459 +
    - - - }, +   + Once()
    - 95 + + 460 +
    - - - { +   + proof2GeneratingTrueCall := m.stateMock.
    - 96 + + 461 +
    - - "accountName": "keyless Deployer", + On("UpdateBatchProof", mock.MatchedBy(matchProverCtxFn), &proof2, dbTx).
    - 97 + + 462 +
    - - - "balance": "0", +   + Run(func(args mock.Arguments) {
    - 98 + + 463 +
    - - - "nonce": "1", +   + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - 99 + + 464 +
    - - - "address": "0x1754175c450BEbB9B6E14dEe542649c0402A25d2" +   + }).
    - 100 + +
    @@ -466,11 +466,11 @@
    +
    + 466 +
    - - - }, +   + Once()
    - 101 + + 467 +
    - - - { +   + m.proverMock.On("AggregatedProof", proof1.Proof, proof2.Proof).Return(&proofID, nil).Once()
    - 102 + + 468 +
    - - - "accountName": "deployer", +   + m.proverMock.On("WaitRecursiveProof", mock.MatchedBy(matchProverCtxFn), proofID).Return(recursiveProof, nil).Once()
    - 103 + + 469 +
    - - "balance": "100000000000000000000000", + m.stateMock.On("DeleteBatchProofs", mock.MatchedBy(matchProverCtxFn), proof1.BatchNumber, proof2.BatchNumberFinal, dbTx).Return(errBanana).Once()
    - 104 + + 470 +
    - - - "nonce": "8", +   + dbTx.On("Rollback", mock.MatchedBy(matchProverCtxFn)).Return(nil).Once()
    - 105 + + 471 +
    - - - "address": "0xff6250d0E86A2465B0C1bF8e36409503d6a26963" +   + m.stateMock.On("BeginStateTransaction", mock.MatchedBy(matchAggregatorCtxFn)).Return(dbTx, nil).Once().NotBefore(lockProofsTxBegin)
    - 106 + + 472 +
    - - - } +   + m.stateMock.
    - 107 + + 473 +
    - - ] + On("UpdateBatchProof", mock.MatchedBy(matchAggregatorCtxFn), &proof1, dbTx).
    - 108 + + 474 +
    - - - } +   + Run(func(args mock.Arguments) {
    - 109 + + 475 +
    - - - ` +   + assert.Nil(args[1].(*state.Proof).GeneratingSince)
    -
    + + + 476 + + +
    +   + }).
    -
    -
    - - - + + - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    +
    @@ -478,7 +478,7 @@
    - + + 478 -
    +
    +
      -
    + Once().
    - + + 479 -
    +
    +
      -
    + NotBefore(proof1GeneratingTrueCall)
    - + + 480 -
    +
    +
      -
    + m.stateMock.
    - + + 481 -
    -   -
    +
    +
    + - + On("UpdateBatchProof", mock.MatchedBy(matchAggregatorCtxFn), &proof2, dbTx).
    - + + 482 -
    +
    +
      -
    + Run(func(args mock.Arguments) {
    - + + 483 -
    +
    +
      -
    + assert.Nil(args[1].(*state.Proof).GeneratingSince)
    - + + 484 -
    +
    +
      -
    + }).
    - - -
    -   -
    -
    +
    +
    @@ -493,7 +493,7 @@
    - + + 493 -
    +
    +
      -
    + },
    - + + 494 -
    +
    +
      -
    + },
    - + + 495 -
    +
    +
      -
    + {
    - + + 496 -
    -   -
    +
    +
    + - + name: "rollback after AddBatchProof error in db transaction",
    - + + 497 -
    +
    +
      -
    + setup: func(m mox, a *Aggregator) {
    - + + 498 -
    +
    +
      -
    + m.proverMock.On("Name").Return(proverName).Twice()
    - + + 499 -
    +
    +
      -
    + m.proverMock.On("ID").Return(proverID).Twice()
    - + +
    @@ -501,16 +501,16 @@
    -
    +
    + 501 + +
      -
    + dbTx := &mocks.DbTxMock{}
    - + + 502 -
    +
    +
      -
    + lockProofsTxBegin := m.stateMock.On("BeginStateTransaction", mock.MatchedBy(matchProverCtxFn)).Return(dbTx, nil).Twice()
    - + + 503 -
    +
    +
      -
    + lockProofsTxCommit := dbTx.On("Commit", mock.MatchedBy(matchProverCtxFn)).Return(nil).Once()
    - + + 504 -
    -   -
    +
    +
    + - + m.stateMock.On("GetBatchProofsToAggregate", mock.MatchedBy(matchProverCtxFn), nil).Return(&proof1, &proof2, nil).Once()
    - + + 505 -
    +
    +
      -
    + proof1GeneratingTrueCall := m.stateMock.
    - + + 506 -
    -   -
    +
    +
    + - + On("UpdateBatchProof", mock.MatchedBy(matchProverCtxFn), &proof1, dbTx).
    - + + 507 -
    +
    +
      -
    + Run(func(args mock.Arguments) {
    - + + 508 -
    +
    +
      -
    + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - + + 509 -
    +
    +
      -
    + }).
    - + + 510 -
    +
    +
      -
    + Return(nil).
    - + + 511 -
    +
    +
      -
    + Once()
    - + + 512 -
    +
    +
      -
    + proof2GeneratingTrueCall := m.stateMock.
    - + + 513 -
    -   -
    +
    +
    + - + On("UpdateBatchProof", mock.MatchedBy(matchProverCtxFn), &proof2, dbTx).
    - + + 514 -
    +
    +
      -
    + Run(func(args mock.Arguments) {
    - + + 515 -
    +
    +
      -
    + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - + + 516 -
    +
    +
      -
    + }).
    - + +
    @@ -518,12 +518,12 @@
    -
    +
    + 518 + +
      -
    + Once()
    - + + 519 -
    +
    +
      -
    + m.proverMock.On("AggregatedProof", proof1.Proof, proof2.Proof).Return(&proofID, nil).Once()
    - + + 520 -
    +
    +
      -
    + m.proverMock.On("WaitRecursiveProof", mock.MatchedBy(matchProverCtxFn), proofID).Return(recursiveProof, nil).Once()
    - + + 521 -
    -   -
    +
    +
    + - + m.stateMock.On("DeleteBatchProofs", mock.MatchedBy(matchProverCtxFn), proof1.BatchNumber, proof2.BatchNumberFinal, dbTx).Return(nil).Once()
    - + + 522 -
    -   -
    +
    +
    + - + m.stateMock.On("AddBatchProof", mock.MatchedBy(matchProverCtxFn), mock.Anything, dbTx).Return(errBanana).Once()
    - + + 523 -
    +
    +
      -
    + dbTx.On("Rollback", mock.MatchedBy(matchProverCtxFn)).Return(nil).Once()
    - + + 524 -
    +
    +
      -
    + m.stateMock.On("BeginStateTransaction", mock.MatchedBy(matchAggregatorCtxFn)).Return(dbTx, nil).Once().NotBefore(lockProofsTxBegin)
    - + + 525 -
    +
    +
      -
    + m.stateMock.
    - + + 526 -
    -   -
    +
    +
    + - + On("UpdateBatchProof", mock.MatchedBy(matchAggregatorCtxFn), &proof1, dbTx).
    - + + 527 -
    +
    +
      -
    + Run(func(args mock.Arguments) {
    - + + 528 -
    +
    +
      -
    + assert.Nil(args[1].(*state.Proof).GeneratingSince)
    - + + 529 -
    +
    +
      -
    + }).
    - - -
    -   -
    -
    +
    +
    @@ -531,7 +531,7 @@
    - + + 531 -
    +
    +
      -
    + Once().
    - + + 532 -
    +
    +
      -
    + NotBefore(proof1GeneratingTrueCall)
    - + + 533 -
    +
    +
      -
    + m.stateMock.
    - + + 534 -
    -   -
    +
    +
    + - + On("UpdateBatchProof", mock.MatchedBy(matchAggregatorCtxFn), &proof2, dbTx).
    - + + 535 -
    +
    +
      -
    + Run(func(args mock.Arguments) {
    - + + 536 -
    +
    +
      -
    + assert.Nil(args[1].(*state.Proof).GeneratingSince)
    - + + 537 -
    +
    +
      -
    + }).
    - - -
    -   -
    -
    +
    +
    @@ -554,16 +554,16 @@
    - + + 554 -
    +
    +
      -
    + dbTx := &mocks.DbTxMock{}
    - + + 555 -
    +
    +
      -
    + m.stateMock.On("BeginStateTransaction", mock.MatchedBy(matchProverCtxFn)).Return(dbTx, nil).Twice()
    - + + 556 -
    +
    +
      -
    + dbTx.On("Commit", mock.MatchedBy(matchProverCtxFn)).Return(nil).Twice()
    - + + 557 -
    -   -
    +
    +
    + - + m.stateMock.On("GetBatchProofsToAggregate", mock.MatchedBy(matchProverCtxFn), nil).Return(&proof1, &proof2, nil).Once()
    - + + 558 -
    +
    +
      -
    + m.stateMock.
    - + + 559 -
    -   -
    +
    +
    + - + On("UpdateBatchProof", mock.MatchedBy(matchProverCtxFn), &proof1, dbTx).
    - + + 560 -
    +
    +
      -
    + Run(func(args mock.Arguments) {
    - + + 561 -
    +
    +
      -
    + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - + + 562 -
    +
    +
      -
    + }).
    - + + 563 -
    +
    +
      -
    + Return(nil).
    - + + 564 -
    +
    +
      -
    + Once()
    - + + 565 -
    +
    +
      -
    + m.stateMock.
    - + + 566 -
    -   -
    +
    +
    + - + On("UpdateBatchProof", mock.MatchedBy(matchProverCtxFn), &proof2, dbTx).
    - + + 567 -
    +
    +
      -
    + Run(func(args mock.Arguments) {
    - + + 568 -
    +
    +
      -
    + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - + + 569 -
    +
    +
      -
    + }).
    - - -
    -   -
    -
    +
    +
    @@ -571,14 +571,14 @@
    - + + 571 -
    +
    +
      -
    + Once()
    - + + 572 -
    +
    +
      -
    + m.proverMock.On("AggregatedProof", proof1.Proof, proof2.Proof).Return(&proofID, nil).Once()
    - + + 573 -
    +
    +
      -
    + m.proverMock.On("WaitRecursiveProof", mock.MatchedBy(matchProverCtxFn), proofID).Return(recursiveProof, nil).Once()
    - + + 574 -
    -   -
    +
    +
    + - + m.stateMock.On("DeleteBatchProofs", mock.MatchedBy(matchProverCtxFn), proof1.BatchNumber, proof2.BatchNumberFinal, dbTx).Return(nil).Once()
    - + + 575 -
    +
    +
      -
    + expectedInputProver := map[string]interface{}{
    - + + 576 -
    +
    +
      -
    + "recursive_proof_1": proof1.Proof,
    - + + 577 -
    +
    +
      -
    + "recursive_proof_2": proof2.Proof,
    - + + 578 -
    +
    +
      -
    + }
    - + + 579 -
    +
    +
      -
    + b, err := json.Marshal(expectedInputProver)
    - + + 580 -
    +
    +
      -
    + require.NoError(err)
    - + + 581 -
    -   -
    +
    +
    + - + m.stateMock.On("AddBatchProof", mock.MatchedBy(matchProverCtxFn), mock.Anything, dbTx).Run(
    - + + 582 -
    +
    +
      -
    + func(args mock.Arguments) {
    - + + 583 -
    +
    +
      -
    + proof := args[1].(*state.Proof)
    - + + 584 -
    +
    +
      -
    + assert.Equal(proof1.BatchNumber, proof.BatchNumber)
    - - -
    -   -
    -
    +
    +
    @@ -590,7 +590,7 @@
    - + + 590 -
    +
    +
      -
    + assert.InDelta(time.Now().Unix(), proof.GeneratingSince.Unix(), float64(time.Second))
    - + + 591 -
    +
    +
      -
    + },
    - + + 592 -
    +
    +
      -
    + ).Return(nil).Once()
    - + + 593 -
    -   -
    +
    +
    + - + m.stateMock.On("UpdateBatchProof", mock.MatchedBy(matchAggregatorCtxFn), mock.Anything, nil).Run(
    - + + 594 -
    +
    +
      -
    + func(args mock.Arguments) {
    - + + 595 -
    +
    +
      -
    + proof := args[1].(*state.Proof)
    - + + 596 -
    +
    +
      -
    + assert.Equal(proof1.BatchNumber, proof.BatchNumber)
    - - -
    -   -
    -
    +
    +
    @@ -618,16 +618,16 @@
    - + + 618 -
    +
    +
      -
    + dbTx := &mocks.DbTxMock{}
    - + + 619 -
    +
    +
      -
    + m.stateMock.On("BeginStateTransaction", mock.MatchedBy(matchProverCtxFn)).Return(dbTx, nil).Twice()
    - + + 620 -
    +
    +
      -
    + dbTx.On("Commit", mock.MatchedBy(matchProverCtxFn)).Return(nil).Twice()
    - + + 621 -
    -   -
    +
    +
    + - + m.stateMock.On("GetBatchProofsToAggregate", mock.MatchedBy(matchProverCtxFn), nil).Return(&proof1, &proof2, nil).Once()
    - + + 622 -
    +
    +
      -
    + m.stateMock.
    - + + 623 -
    -   -
    +
    +
    + - + On("UpdateBatchProof", mock.MatchedBy(matchProverCtxFn), &proof1, dbTx).
    - + + 624 -
    +
    +
      -
    + Run(func(args mock.Arguments) {
    - + + 625 -
    +
    +
      -
    + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - + + 626 -
    +
    +
      -
    + }).
    - + + 627 -
    +
    +
      -
    + Return(nil).
    - + + 628 -
    +
    +
      -
    + Once()
    - + + 629 -
    +
    +
      -
    + m.stateMock.
    - + + 630 -
    -   -
    +
    +
    + - + On("UpdateBatchProof", mock.MatchedBy(matchProverCtxFn), &proof2, dbTx).
    - + + 631 -
    +
    +
      -
    + Run(func(args mock.Arguments) {
    - + + 632 -
    +
    +
      -
    + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - + + 633 -
    +
    +
      -
    + }).
    - - -
    -   -
    -
    -
    -
    -
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/config/config.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - -
    -
    @@ -2,6 +2,8 @@
    +
    @@ -635,14 +635,14 @@
    - 2 + 635
      -
    + Once()
    - 3 + 636
      - import ( + m.proverMock.On("AggregatedProof", proof1.Proof, proof2.Proof).Return(&proofID, nil).Once()
    - 4 + 637
      - "bytes" -
    -
    - - -
    -   -
    + m.proverMock.On("WaitRecursiveProof", mock.MatchedBy(matchProverCtxFn), proofID).Return(recursiveProof, nil).Once()
    - + + 638 -
    -   -
    +
    +
    + - + m.stateMock.On("DeleteBatchProofs", mock.MatchedBy(matchProverCtxFn), proof1.BatchNumber, proof2.BatchNumberFinal, dbTx).Return(nil).Once()
    - 5 + 639
      - "path/filepath" + expectedInputProver := map[string]interface{}{
    - 6 + 640
      - "strings" + "recursive_proof_1": proof1.Proof,
    - 7 + 641
      -
    + "recursive_proof_2": proof2.Proof,
    -
    @@ -21,6 +24,7 @@
    -
    - 21 + 642
      - "github.com/0xPolygonHermez/zkevm-node/state" + }
    - 22 + 643
      - "github.com/0xPolygonHermez/zkevm-node/state/runtime/executor" + b, err := json.Marshal(expectedInputProver)
    - 23 + 644
      - "github.com/0xPolygonHermez/zkevm-node/synchronizer" + require.NoError(err)
    - + + 645 -
    -   -
    +
    +
    + - + m.stateMock.On("AddBatchProof", mock.MatchedBy(matchProverCtxFn), mock.Anything, dbTx).Run(
    - 24 + 646
      - "github.com/mitchellh/mapstructure" + func(args mock.Arguments) {
    - 25 + 647
      - "github.com/spf13/viper" + proof := args[1].(*state.Proof)
    - 26 + 648
      - "github.com/urfave/cli/v2" + assert.Equal(proof1.BatchNumber, proof.BatchNumber)
    -
    @@ -31,7 +35,7 @@
    +
    @@ -660,7 +660,7 @@
    - 31 + 660
      - FlagYes = "yes" + m.etherman.On("GetLatestVerifiedBatchNum").Return(uint64(42), nil).Once()
    - 32 + 661
      - // FlagCfg is the flag for cfg. + // make tryBuildFinalProof fail ASAP
    - 33 + 662
      - FlagCfg = "cfg" + m.stateMock.On("GetLastVerifiedBatch", mock.MatchedBy(matchProverCtxFn), nil).Return(nil, errBanana).Once().NotBefore(isSyncedCall)
    - 34 + 663
    - - // FlagNetwork is the flag for the network name. Valid values: ["testnet", "mainnet", "cardona", "custom"]. + m.stateMock.On("UpdateBatchProof", mock.MatchedBy(matchAggregatorCtxFn), mock.Anything, nil).Run(
    - 35 + 664
      - FlagNetwork = "network" + func(args mock.Arguments) {
    - 36 + 665
      - // FlagCustomNetwork is the flag for the custom network file. This is required if --network=custom + proof := args[1].(*state.Proof)
    - 37 + 666
      - FlagCustomNetwork = "custom-network-file" + assert.Equal(proof1.BatchNumber, proof.BatchNumber)
    -
    @@ -183,3 +187,19 @@
    +
    @@ -686,7 +686,7 @@
    - 183 + 686
      - } + ethTxManager := mocks.NewEthTxManager(t)
    - 184 + 687
      - return cfg, nil + etherman := mocks.NewEtherman(t)
    - 185 + 688
      - } -
    -
    - - -
    -   -
    -
    -
    - - -
    -   -
    -
    -
    - - -
    -   -
    + proverMock := mocks.NewProverMock(t)
    - + + 689 -
    -   -
    +
    +
    + - + a, err := New(cfg, stateMock, ethTxManager, etherman)
    - + + 690 -
    +
    +
      -
    + require.NoError(err)
    - + + 691 -
    +
    +
      -
    + aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck
    - + + 692 -
    +
    +
      -
    + a.ctx, a.exit = context.WithCancel(aggregatorCtx)
    - - -
    -   -
    -
    +
    +
    @@ -701,7 +701,7 @@
    - + + 701 -
    +
    +
      -
    + }
    - + + 702 -
    +
    +
      -
    + a.resetVerifyProofTime()
    - + + 703 -
    +
    +
     
    - + + 704 -
    -   -
    +
    +
    + - + result, err := a.tryAggregateBatchProofs(proverCtx, proverMock)
    - + + 705 -
    +
    +
     
    - + + 706 -
    +
    +
      -
    + if tc.asserts != nil {
    - + + 707 -
    +
    +
      -
    + tc.asserts(result, &a, err)
    - - -
    -   -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    +
    @@ -777,7 +777,7 @@
    - 2 + 777
      -
    + m.proverMock.On("Addr").Return("addr")
    - 3 + 778
      - import ( + m.stateMock.On("GetLastVerifiedBatch", mock.MatchedBy(matchProverCtxFn), nil).Return(&lastVerifiedBatch, nil).Once()
    - 4 + 779
      - "bytes" -
    -
    - 5 - -
    - + - "crypto/ecdsa" + m.stateMock.On("GetVirtualBatchToProve", mock.MatchedBy(matchProverCtxFn), lastVerifiedBatchNum, mock.Anything, nil).Return(&batchToProve, nil).Once()
    - 6 + + 780 +
    - + - "os" + - + m.stateMock.On("AddBatchProof", mock.MatchedBy(matchProverCtxFn), mock.Anything, nil).Run(
    - 7 + 781
      - "path/filepath" + func(args mock.Arguments) {
    - 8 + 782
      - "strings" + proof := args[1].(*state.Proof)
    - 9 + 783
      -
    + assert.Equal(batchToProve.BatchNumber, proof.BatchNumber)
    -
     
    +
    @@ -805,7 +805,7 @@
    - 24 + 805
      - "github.com/0xPolygonHermez/zkevm-node/state" + expectedInputProver, err := a.buildInputProver(context.Background(), &batchToProve)
    - 25 + 806
      - "github.com/0xPolygonHermez/zkevm-node/state/runtime/executor" + require.NoError(err)
    - 26 + 807
      - "github.com/0xPolygonHermez/zkevm-node/synchronizer" + m.proverMock.On("BatchProof", expectedInputProver).Return(nil, errBanana).Once()
    - 27 + + 808 +
    - + - "github.com/ethereum/go-ethereum/accounts/keystore" + - + m.stateMock.On("DeleteBatchProofs", mock.MatchedBy(matchAggregatorCtxFn), batchToProve.BatchNumber, batchToProve.BatchNumber, nil).Return(nil).Once()
    - 28 + 809
      - "github.com/mitchellh/mapstructure" + },
    - 29 + 810
      - "github.com/spf13/viper" + asserts: func(result bool, a *Aggregator, err error) {
    - 30 + 811
      - "github.com/urfave/cli/v2" + assert.False(result)
    -
     
    +
    @@ -820,7 +820,7 @@
    - 35 + 820
      - FlagYes = "yes" + m.proverMock.On("Addr").Return("addr")
    - 36 + 821
      - // FlagCfg is the flag for cfg. + m.stateMock.On("GetLastVerifiedBatch", mock.MatchedBy(matchProverCtxFn), nil).Return(&lastVerifiedBatch, nil).Once()
    - 37 + 822
      - FlagCfg = "cfg" + m.stateMock.On("GetVirtualBatchToProve", mock.MatchedBy(matchProverCtxFn), lastVerifiedBatchNum, mock.Anything, nil).Return(&batchToProve, nil).Once()
    - 38 + + 823 +
    - + - // FlagNetwork is the flag for the network name. Valid values: ["custom"]. + - + m.stateMock.On("AddBatchProof", mock.MatchedBy(matchProverCtxFn), mock.Anything, nil).Run(
    - 39 + 824
      - FlagNetwork = "network" + func(args mock.Arguments) {
    - 40 + 825
      - // FlagCustomNetwork is the flag for the custom network file. This is required if --network=custom + proof := args[1].(*state.Proof)
    - 41 + 826
      - FlagCustomNetwork = "custom-network-file" + assert.Equal(batchToProve.BatchNumber, proof.BatchNumber)
    -
     
    +
    @@ -849,7 +849,7 @@
    - 187 + 849
      - } + require.NoError(err)
    - 188 + 850
      - return cfg, nil + m.proverMock.On("BatchProof", expectedInputProver).Return(&proofID, nil).Once()
    - 189 + 851
      - } + m.proverMock.On("WaitRecursiveProof", mock.MatchedBy(matchProverCtxFn), proofID).Return("", errBanana).Once()
    - 190 + + 852 +
    - + -
    + - + m.stateMock.On("DeleteBatchProofs", mock.MatchedBy(matchAggregatorCtxFn), batchToProve.BatchNumber, batchToProve.BatchNumber, nil).Return(nil).Once()
    - 191 + + 853 +
    - + - // NewKeyFromKeystore creates a private key from a keystore file +   + },
    - 192 + + 854 +
    - + - func NewKeyFromKeystore(cfg types.KeystoreFileConfig) (*ecdsa.PrivateKey, error) { +   + asserts: func(result bool, a *Aggregator, err error) {
    - 193 + + 855 +
    - + - if cfg.Path == "" && cfg.Password == "" { +   + assert.False(result)
    - 194 - -
    - + - return nil, nil -
    +
    +
    @@ -857,14 +857,14 @@
    - 195 + + 857 +
    - + - } +   + },
    - 196 + + 858 +
    - + - keystoreEncrypted, err := os.ReadFile(filepath.Clean(cfg.Path)) +   + },
    - 197 + + 859 +
    - + - if err != nil { +   + {
    - 198 + + 860 +
    - + - return nil, err + - + name: "DeleteBatchProofs error after WaitRecursiveProof prover error",
    - 199 + + 861 +
    - + - } +   + setup: func(m mox, a *Aggregator) {
    - 200 + + 862 +
    - + - key, err := keystore.DecryptKey(keystoreEncrypted, cfg.Password) +   + m.proverMock.On("Name").Return(proverName).Twice()
    - 201 + + 863 +
    - + - if err != nil { +   + m.proverMock.On("ID").Return(proverID).Twice()
    - 202 + + 864 +
    - + - return nil, err +   + m.proverMock.On("Addr").Return(proverID)
    - 203 + + 865 +
    - + - } +   + m.stateMock.On("GetLastVerifiedBatch", mock.MatchedBy(matchProverCtxFn), nil).Return(&lastVerifiedBatch, nil).Once()
    - 204 + + 866 +
    - + - return key.PrivateKey, nil +   + m.stateMock.On("GetVirtualBatchToProve", mock.MatchedBy(matchProverCtxFn), lastVerifiedBatchNum, mock.Anything, nil).Return(&batchToProve, nil).Once()
    - 205 + + 867 +
    - + - } -
    -
    -
    + - + m.stateMock.On("AddBatchProof", mock.MatchedBy(matchProverCtxFn), mock.Anything, nil).Run(
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/config/config_test.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - + - - - - - - - - + - - + - - - - - - - - -
    -
    @@ -174,24 +174,28 @@
    - 174 + 868
      - expectedValue: uint64(80000), + func(args mock.Arguments) {
    - 175 + 869
      - }, + proof := args[1].(*state.Proof)
    - 176 + 870
      - { -
    -
    - - -
    -   -
    + assert.Equal(batchToProve.BatchNumber, proof.BatchNumber)
    - - -
    -   -
    -
    +
    +
    @@ -893,7 +893,7 @@
    - + + 893 -
    +
    +
      -
    + require.NoError(err)
    - + + 894 -
    +
    +
      -
    + m.proverMock.On("BatchProof", expectedInputProver).Return(&proofID, nil).Once()
    - 177 + 895
      - path: "Etherman.URL", + m.proverMock.On("WaitRecursiveProof", mock.MatchedBy(matchProverCtxFn), proofID).Return("", errBanana).Once()
    - 178 + + 896 +
    -   - expectedValue: "http://localhost:8545", + - + m.stateMock.On("DeleteBatchProofs", mock.MatchedBy(matchAggregatorCtxFn), batchToProve.BatchNumber, batchToProve.BatchNumber, nil).Return(errBanana).Once()
    - 179 + 897
      - }, + },
    - 180 + 898
      - { + asserts: func(result bool, a *Aggregator, err error) {
    - 181 + 899
      - path: "NetworkConfig.L1Config.L1ChainID", + assert.False(result)
    - 182 - -
    - - - expectedValue: uint64(5), -
    +
    +
    @@ -908,7 +908,7 @@
    - 183 + 908
      - }, + m.proverMock.On("Addr").Return("addr")
    - 184 + 909
      - { + m.stateMock.On("GetLastVerifiedBatch", mock.MatchedBy(matchProverCtxFn), nil).Return(&lastVerifiedBatch, nil).Once()
    - 185 + 910
      - path: "NetworkConfig.L1Config.ZkEVMAddr", + m.stateMock.On("GetVirtualBatchToProve", mock.MatchedBy(matchProverCtxFn), lastVerifiedBatchNum, mock.Anything, nil).Return(&batchToProve, nil).Once()
    - 186 + 911
    - - expectedValue: common.HexToAddress("0xa997cfD539E703921fD1e3Cf25b4c241a27a4c7A"), + m.stateMock.On("AddBatchProof", mock.MatchedBy(matchProverCtxFn), mock.Anything, nil).Run(
    - 187 + 912
      - }, + func(args mock.Arguments) {
    - 188 + 913
      - { + proof := args[1].(*state.Proof)
    - 189 + 914
      - path: "NetworkConfig.L1Config.PolAddr", + assert.Equal(batchToProve.BatchNumber, proof.BatchNumber)
    - 190 - -
    - - - expectedValue: common.HexToAddress("0x1319D23c2F7034F52Eb07399702B040bA278Ca49"), -
    +
    +
    @@ -939,7 +939,7 @@
    - 191 + 939
      - }, + m.proverMock.On("WaitRecursiveProof", mock.MatchedBy(matchProverCtxFn), proofID).Return(recursiveProof, nil).Once()
    - 192 + 940
      - { + b, err := json.Marshal(expectedInputProver)
    - 193 + 941
      - path: "NetworkConfig.L1Config.GlobalExitRootManagerAddr", + require.NoError(err)
    - 194 + 942
    - - expectedValue: common.HexToAddress("0x4d9427DCA0406358445bC0a8F88C26b704004f74"), + m.stateMock.On("UpdateBatchProof", mock.MatchedBy(matchAggregatorCtxFn), mock.Anything, nil).Run(
    - 195 + 943
      - }, + func(args mock.Arguments) {
    - 196 + 944
      - { + proof := args[1].(*state.Proof)
    - 197 + 945
      - path: "Etherman.MultiGasProvider", + assert.Equal(batchToProve.BatchNumber, proof.BatchNumber)
    -
    @@ -547,7 +551,8 @@
    +
    @@ -966,7 +966,7 @@
    - 547 + 966
      - require.NoError(t, os.WriteFile(file.Name(), []byte("{}"), 0600)) + m.proverMock.On("Addr").Return("addr")
    - 548 + 967
      -
    + m.stateMock.On("GetLastVerifiedBatch", mock.MatchedBy(matchProverCtxFn), nil).Return(&lastVerifiedBatch, nil).Once()
    - 549 + 968
      - flagSet := flag.NewFlagSet("", flag.PanicOnError) + m.stateMock.On("GetVirtualBatchToProve", mock.MatchedBy(matchProverCtxFn), lastVerifiedBatchNum, mock.Anything, nil).Return(&batchToProve, nil).Once()
    - 550 + 969
    - - flagSet.String(config.FlagNetwork, "testnet", "") -
    -
    - - -
    -   -
    + m.stateMock.On("AddBatchProof", mock.MatchedBy(matchProverCtxFn), mock.Anything, nil).Run(
    - 551 + 970
      - ctx := cli.NewContext(cli.NewApp(), flagSet, nil) + func(args mock.Arguments) {
    - 552 + 971
      - cfg, err := config.Load(ctx, true) + proof := args[1].(*state.Proof)
    - 553 + 972
      - if err != nil { + assert.Equal(batchToProve.BatchNumber, proof.BatchNumber)
    -
    @@ -585,7 +590,8 @@
    +
    @@ -1003,7 +1003,7 @@
    - 585 + 1003
      - }() + m.etherman.On("GetLatestBlockHeader", mock.Anything).Return(&types.Header{Number: new(big.Int).SetUint64(1)}, nil).Once()
    - 586 + 1004
      - require.NoError(t, os.WriteFile(file.Name(), []byte("{}"), 0600)) + // make tryBuildFinalProof fail ASAP
    - 587 + 1005
      - flagSet := flag.NewFlagSet("", flag.PanicOnError) + m.stateMock.On("GetLastVerifiedBatch", mock.MatchedBy(matchProverCtxFn), nil).Return(nil, errBanana).Once().NotBefore(isSyncedCall)
    - 588 + 1006
    - - flagSet.String(config.FlagNetwork, "testnet", "") -
    -
    - - -
    -   -
    + m.stateMock.On("UpdateBatchProof", mock.MatchedBy(matchAggregatorCtxFn), mock.Anything, nil).Run(
    - 589 + 1007
      - ctx := cli.NewContext(cli.NewApp(), flagSet, nil) + func(args mock.Arguments) {
    - 590 + 1008
      -
    + proof := args[1].(*state.Proof)
    - 591 + 1009
      - os.Setenv("ZKEVM_NODE_LOG_OUTPUTS", "a,b,c") + assert.Equal(batchToProve.BatchNumber, proof.BatchNumber)
    -
    -
    -
    -
    - - - + - - - - - - - - + + + + + + + + + - - - - + - - + + + - - - - - - - - - - - - - - -
    -
     
    +
    @@ -1029,7 +1029,7 @@
    - 174 + 1029
      - expectedValue: uint64(80000), + ethTxManager := mocks.NewEthTxManager(t)
    - 175 + 1030
      - }, + etherman := mocks.NewEtherman(t)
    - 176 + 1031
      - { + proverMock := mocks.NewProverMock(t)
    - 177 + + 1032 +
    - + - path: "SequenceSender.MaxBatchesForL1", + - + a, err := New(cfg, stateMock, ethTxManager, etherman)
    - 178 + + 1033 +
    - + - expectedValue: uint64(300), +   + require.NoError(err)
    - 179 + + 1034 +
    - + - }, +   + aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck
    - 180 + + 1035 +
    - + - { +   + a.ctx, a.exit = context.WithCancel(aggregatorCtx)
    +
    @@ -1138,11 +1138,11 @@
    +
    - 181 + 1138
      - path: "Etherman.URL", + m.proverMock.On("Addr").Return("addr").Twice()
    - 182 + 1139
      - expectedValue: "http://localhost:8545", + m.stateMock.On("GetLastVerifiedBatch", mock.MatchedBy(matchProverCtxFn), nil).Return(&verifiedBatch, nil).Twice()
    - 183 + 1140
      - }, + m.etherman.On("GetLatestVerifiedBatchNum").Return(latestVerifiedBatchNum, nil).Once() +
    +
    + 1141 + +
    + - + m.stateMock.On("GetProofReadyForFinal", mock.MatchedBy(matchProverCtxFn), latestVerifiedBatchNum, nil).Return(&proofToVerify, nil).Once() +
    +
    + 1142 + +
    + - + proofGeneratingTrueCall := m.stateMock.On("UpdateBatchProof", mock.MatchedBy(matchProverCtxFn), &proofToVerify, nil).Return(nil).Once()
    - 184 + 1143
      - { + m.proverMock.On("FinalProof", proofToVerify.Proof, from.String()).Return(nil, errBanana).Once()
    - 185 + 1144
      - path: "NetworkConfig.L1Config.L1ChainID", + m.stateMock.
    - 186 + + 1145 +
    - + - expectedValue: uint64(1337), + - + On("UpdateBatchProof", mock.MatchedBy(matchAggregatorCtxFn), &proofToVerify, nil).
    - 187 + 1146
      - }, + Return(nil).
    - 188 + 1147
      - { + Once().
    - 189 + 1148
      - path: "NetworkConfig.L1Config.ZkEVMAddr", + NotBefore(proofGeneratingTrueCall)
    - 190 - -
    - + - expectedValue: common.HexToAddress("0x8dAF17A20c9DBA35f005b6324F493785D239719d"), -
    +
    +
    @@ -1160,12 +1160,12 @@
    - 191 + 1160
      - }, + m.proverMock.On("Addr").Return("addr").Twice()
    - 192 + 1161
      - { + m.stateMock.On("GetLastVerifiedBatch", mock.MatchedBy(matchProverCtxFn), nil).Return(&verifiedBatch, nil).Twice()
    - 193 + 1162
      - path: "NetworkConfig.L1Config.PolAddr", + m.etherman.On("GetLatestVerifiedBatchNum").Return(latestVerifiedBatchNum, nil).Once()
    - 194 + + 1163 +
    - + - expectedValue: common.HexToAddress("0x5FbDB2315678afecb367f032d93F642f64180aa3"), + - + m.stateMock.On("GetProofReadyForFinal", mock.MatchedBy(matchProverCtxFn), latestVerifiedBatchNum, nil).Return(&proofToVerify, nil).Once() +
    +
    + 1164 + +
    + - + proofGeneratingTrueCall := m.stateMock.On("UpdateBatchProof", mock.MatchedBy(matchProverCtxFn), &proofToVerify, nil).Return(nil).Once()
    - 195 + 1165
      - }, + m.proverMock.On("FinalProof", proofToVerify.Proof, from.String()).Return(&finalProofID, nil).Once()
    - 196 + 1166
      - { + m.proverMock.On("WaitFinalProof", mock.MatchedBy(matchProverCtxFn), finalProofID).Return(nil, errBanana).Once()
    - 197 + 1167
      - path: "NetworkConfig.L1Config.GlobalExitRootManagerAddr", + m.stateMock.
    - 198 + + 1168 +
    - + - expectedValue: common.HexToAddress("0x8A791620dd6260079BF849Dc5567aDC3F2FdC318"), + - + On("UpdateBatchProof", mock.MatchedBy(matchAggregatorCtxFn), &proofToVerify, nil).
    - 199 + 1169
      - }, + Return(nil).
    - 200 + 1170
      - { + Once().
    - 201 + 1171
      - path: "Etherman.MultiGasProvider", + NotBefore(proofGeneratingTrueCall)
    -
     
    +
    @@ -1183,7 +1183,7 @@
    - 551 + 1183
      - require.NoError(t, os.WriteFile(file.Name(), []byte("{}"), 0600)) + m.proverMock.On("Addr").Return(proverID).Once()
    - 552 + 1184
      -
    + m.stateMock.On("GetLastVerifiedBatch", mock.MatchedBy(matchProverCtxFn), nil).Return(&verifiedBatch, nil).Twice()
    - 553 + 1185
      - flagSet := flag.NewFlagSet("", flag.PanicOnError) + m.etherman.On("GetLatestVerifiedBatchNum").Return(latestVerifiedBatchNum, nil).Once()
    - 554 - -
    - + - flagSet.String(config.FlagNetwork, "custom", "") -
    -
    - 555 + + 1186 +
    - + - flagSet.String(config.FlagCustomNetwork, "../test/config/test.genesis.config.json", "") + - + m.stateMock.On("GetProofReadyForFinal", mock.MatchedBy(matchProverCtxFn), latestVerifiedBatchNum, nil).Return(nil, errBanana).Once()
    - 556 + 1187
      - ctx := cli.NewContext(cli.NewApp(), flagSet, nil) + },
    - 557 + 1188
      - cfg, err := config.Load(ctx, true) + asserts: func(result bool, a *Aggregator, err error) {
    - 558 + 1189
      - if err != nil { + assert.False(result)
    -
     
    +
    @@ -1198,7 +1198,7 @@
    - 590 + 1198
      - }() + m.proverMock.On("Addr").Return(proverID).Once()
    - 591 + 1199
      - require.NoError(t, os.WriteFile(file.Name(), []byte("{}"), 0600)) + m.stateMock.On("GetLastVerifiedBatch", mock.MatchedBy(matchProverCtxFn), nil).Return(&verifiedBatch, nil).Twice()
    - 592 + 1200
      - flagSet := flag.NewFlagSet("", flag.PanicOnError) -
    -
    - 593 - -
    - + - flagSet.String(config.FlagNetwork, "custom", "") + m.etherman.On("GetLatestVerifiedBatchNum").Return(latestVerifiedBatchNum, nil).Once()
    - 594 + + 1201 +
    - + - flagSet.String(config.FlagCustomNetwork, "../test/config/test.genesis.config.json", "") + - + m.stateMock.On("GetProofReadyForFinal", mock.MatchedBy(matchProverCtxFn), latestVerifiedBatchNum, nil).Return(nil, state.ErrNotFound).Once()
    - 595 + 1202
      - ctx := cli.NewContext(cli.NewApp(), flagSet, nil) + },
    - 596 + 1203
      -
    + asserts: func(result bool, a *Aggregator, err error) {
    - 597 + 1204
      - os.Setenv("ZKEVM_NODE_LOG_OUTPUTS", "a,b,c") + assert.False(result)
    -
    -
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/config/default.go - RENAMED - -
    -
    -
    -
    - - - + - - + + + - - - - - - - - - - - - - - - -
    -
    @@ -102,6 +102,7 @@
    +
    @@ -1213,8 +1213,8 @@
    - 102 + 1213
      - SyncInterval = "1s" + m.proverMock.On("Addr").Return(proverID).Twice()
    - 103 + 1214
      - SyncChunkSize = 100 + m.stateMock.On("GetLastVerifiedBatch", mock.MatchedBy(matchProverCtxFn), nil).Return(&verifiedBatch, nil).Twice()
    - 104 + 1215
      - TrustedSequencerURL = "" # If it is empty or not specified, then the value is read from the smc + m.etherman.On("GetLatestVerifiedBatchNum").Return(latestVerifiedBatchNum, nil).Once()
    - + + 1216 -
    -   -
    +
    +
    + - + m.stateMock.On("GetProofReadyForFinal", mock.MatchedBy(matchProverCtxFn), latestVerifiedBatchNum, nil).Return(&proofToVerify, nil).Once() +
    +
    + 1217 + +
    + - + m.stateMock.On("UpdateBatchProof", mock.MatchedBy(matchProverCtxFn), &proofToVerify, nil).Return(nil).Once()
    - 105 + 1218
      - L1SynchronizationMode = "sequential" + m.proverMock.On("FinalProof", proofToVerify.Proof, from.String()).Return(&finalProofID, nil).Once()
    - 106 + 1219
      - L1SyncCheckL2BlockHash = true + m.proverMock.On("WaitFinalProof", mock.MatchedBy(matchProverCtxFn), finalProofID).Return(&finalProof, nil).Once()
    - 107 + 1220
      - L1SyncCheckL2BlockNumberhModulus = 30 + },
    -
    @@ -160,6 +161,7 @@
    +
    @@ -1306,7 +1306,7 @@
    - 160 + 1306
      - L2Coinbase = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266" + ethTxManager := mocks.NewEthTxManager(t)
    - 161 + 1307
      - PrivateKey = {Path = "/pk/sequencer.keystore", Password = "testonly"} + etherman := mocks.NewEtherman(t)
    - 162 + 1308
      - GasOffset = 80000 + proverMock := mocks.NewProverMock(t)
    - + + 1309 -
    -   -
    +
    +
    + - + a, err := New(cfg, stateMock, ethTxManager, etherman)
    - 163 + 1310
      -
    + require.NoError(err)
    - 164 + 1311
      - [Aggregator] + aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck
    - 165 + 1312
      - Host = "0.0.0.0" + a.ctx, a.exit = context.WithCancel(aggregatorCtx)
    -
    @@ -174,6 +176,10 @@
    +
    @@ -1436,7 +1436,7 @@
    - 174 + 1436
      - GasOffset = 0 + ethTxManager := mocks.NewEthTxManager(t)
    - 175 + 1437
      - UpgradeEtrogBatchNumber = 0 + etherman := mocks.NewEtherman(t)
    - 176 + 1438
      - BatchProofL1BlockConfirmations = 2 -
    -
    - - -
    -   -
    -
    -
    - - -
    -   -
    -
    -
    - - -
    -   -
    + proverMock := mocks.NewProverMock(t)
    - + + 1439 -
    -   -
    +
    +
    + - + a, err := New(cfg, stateMock, ethTxManager, etherman)
    - 177 + 1440
      -
    + require.NoError(err)
    - 178 + 1441
      - [L2GasPriceSuggester] + aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck
    - 179 + 1442
      - Type = "follower" + a.ctx, a.exit = context.WithCancel(aggregatorCtx)
    -
    -
    -
    -
    - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    +
    @@ -1450,9 +1450,79 @@
    - 102 + 1450
      - SyncInterval = "1s" + tc.setup(m, &a)
    - 103 + 1451
      - SyncChunkSize = 100 + }
    - 104 + 1452
      - TrustedSequencerURL = "" # If it is empty or not specified, then the value is read from the smc +
    - 105 + + 1453 +
    - + - SyncBlockProtection = "safe" # latest, finalized, safe + - + synced := a.isSynced(a.ctx, tc.batchNum)
    - 106 + + 1454 +
    -   - L1SynchronizationMode = "sequential" + - +
    - 107 + 1455
      - L1SyncCheckL2BlockHash = true + assert.Equal(tc.synced, synced)
    - 108 + 1456
      - L1SyncCheckL2BlockNumberhModulus = 30 + })
    -
     
    -
    - 161 + 1457
      - L2Coinbase = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266" + }
    - 162 + 1458
      - PrivateKey = {Path = "/pk/sequencer.keystore", Password = "testonly"} + }
    - 163 + + -
    +
    +
      - GasOffset = 80000 +
    - 164 + + -
    - + - MaxBatchesForL1 = 300 +
    +
    +   +
    - 165 + + -
    +
    +
     
    - 166 + + -
    +
    +
      - [Aggregator] +
    - 167 + + -
    +
    +
      - Host = "0.0.0.0" +
    -
     
    -
    - 176 + + -
    +
    +
      - GasOffset = 0 +
    - 177 + + -
    +
    +
      - UpgradeEtrogBatchNumber = 0 +
    - 178 + + -
    +
    +
      - BatchProofL1BlockConfirmations = 2 +
    - 179 + + -
    - + - SettlementBackend = "agglayer" +
    +
    +   +
    - 180 + + -
    - + - AggLayerTxTimeout = "5m" +
    +
    +   +
    - 181 + + -
    - + - AggLayerURL = "http://zkevm-agglayer" +
    +
    +   +
    - 182 + + -
    - + - SequencerPrivateKey = {Path = "/pk/sequencer.keystore", Password = "testonly"} +
    +
    +   +
    - 183 + + -
    +
    +
     
    - 184 + + -
    +
    +
      - [L2GasPriceSuggester] +
    - 185 + + -
    +
    +
      - Type = "follower" +
    -
    + + + + + +
    +   +
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/config/mainnetgenesis.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +
    -
    @@ -1,108 +0,0 @@
    - 1 + + -
    - - - package config +
    +
    +   +
    - 2 + + -
    - - +
    +
    +  
    - 3 + + -
    - - - // MainnetNetworkConfigJSON is the hardcoded network configuration to be used for the official mainnet setup +
    +
    +   +
    - 4 + + -
    - - - const MainnetNetworkConfigJSON = ` +
    +
    +   +
    - 5 + + -
    - - - { +
    +
    +   +
    - 6 + + -
    - - - "l1Config" : { +
    +
    +   +
    - 7 + + -
    - - - "chainId": 1, +
    +
    +   +
    - 8 + + -
    - - - "polygonZkEVMAddress": "0x519E42c24163192Dca44CD3fBDCEBF6be9130987", +
    +
    +   +
    - 9 + + -
    - - - "polygonRollupManagerAddress": "0x5132A183E9F3CB7C848b0AAC5Ae0c4f0491B7aB2", +
    +
    +   +
    - 10 + + -
    - - - "polTokenAddress": "0x455e53CBB86018Ac2B8092FdCd39d8444aFFC3F6", +
    +
    +   +
    - 11 + + -
    - - - "polygonZkEVMGlobalExitRootAddress": "0x580bda1e7A0CFAe92Fa7F6c20A3794F169CE3CFb" +
    +
    +   +
    - 12 + + -
    - - - }, +
    +
    +   +
    - 13 + + -
    - - - "root": "0x3f86b09b43e3e49a41fc20a07579b79eba044253367817d5c241d23c0e2bc5c9", +
    +
    +   +
    - 14 + + -
    - - - "genesisBlockNumber": 16896721, +
    +
    +   +
    - 15 + + -
    - - - "genesis": [ +
    +
    +   +
    - 16 + + -
    - - - { +
    +
    +   +
    - 17 + + -
    - - - "contractName": "PolygonZkEVMDeployer", +
    +
    +   +
    - 18 + + -
    - - - "balance": "0", +
    +
    +   +
    - 19 + + -
    - - - "nonce": "4", +
    +
    +   +
    - 20 + + -
    - - - "address": "0xCB19eDdE626906eB1EE52357a27F62dd519608C2", +
    +
    +   +
    - 21 + + -
    - - - "bytecode": "0x6080604052600436106100705760003560e01c8063715018a61161004e578063715018a6146100e65780638da5cb5b146100fb578063e11ae6cb14610126578063f2fde38b1461013957600080fd5b80632b79805a146100755780634a94d4871461008a5780636d07dbf81461009d575b600080fd5b610088610083366004610927565b610159565b005b6100886100983660046109c7565b6101cb565b3480156100a957600080fd5b506100bd6100b8366004610a1e565b61020d565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b50610088610220565b34801561010757600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100bd565b610088610134366004610a40565b610234565b34801561014557600080fd5b50610088610154366004610a90565b61029b565b610161610357565b600061016e8585856103d8565b905061017a8183610537565b5060405173ffffffffffffffffffffffffffffffffffffffff821681527fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a15050505050565b6101d3610357565b6101de83838361057b565b506040517f25adb19089b6a549831a273acdf7908cff8b7ee5f551f8d1d37996cf01c5df5b90600090a1505050565b600061021983836105a9565b9392505050565b610228610357565b61023260006105b6565b565b61023c610357565b60006102498484846103d8565b60405173ffffffffffffffffffffffffffffffffffffffff821681529091507fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a150505050565b6102a3610357565b73ffffffffffffffffffffffffffffffffffffffff811661034b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610354816105b6565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610232576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610342565b600083471015610444576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e63650000006044820152606401610342565b81516000036104af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f6044820152606401610342565b8282516020840186f5905073ffffffffffffffffffffffffffffffffffffffff8116610219576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f79000000000000006044820152606401610342565b6060610219838360006040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c6564000081525061062b565b60606105a1848484604051806060016040528060298152602001610b3d6029913961062b565b949350505050565b6000610219838330610744565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060824710156106bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610342565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516106e69190610acf565b60006040518083038185875af1925050503d8060008114610723576040519150601f19603f3d011682016040523d82523d6000602084013e610728565b606091505b50915091506107398783838761076e565b979650505050505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b606083156108045782516000036107fd5773ffffffffffffffffffffffffffffffffffffffff85163b6107fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610342565b50816105a1565b6105a183838151156108195781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103429190610aeb565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f83011261088d57600080fd5b813567ffffffffffffffff808211156108a8576108a861084d565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156108ee576108ee61084d565b8160405283815286602085880101111561090757600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000806080858703121561093d57600080fd5b8435935060208501359250604085013567ffffffffffffffff8082111561096357600080fd5b61096f8883890161087c565b9350606087013591508082111561098557600080fd5b506109928782880161087c565b91505092959194509250565b803573ffffffffffffffffffffffffffffffffffffffff811681146109c257600080fd5b919050565b6000806000606084860312156109dc57600080fd5b6109e58461099e565b9250602084013567ffffffffffffffff811115610a0157600080fd5b610a0d8682870161087c565b925050604084013590509250925092565b60008060408385031215610a3157600080fd5b50508035926020909101359150565b600080600060608486031215610a5557600080fd5b8335925060208401359150604084013567ffffffffffffffff811115610a7a57600080fd5b610a868682870161087c565b9150509250925092565b600060208284031215610aa257600080fd5b6102198261099e565b60005b83811015610ac6578181015183820152602001610aae565b50506000910152565b60008251610ae1818460208701610aab565b9190910192915050565b6020815260008251806020840152610b0a816040850160208701610aab565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a26469706673582212203e70ce334e8ec9d8d03e87415afd36dce4e82633bd277b08937095a6bd66367764736f6c63430008110033", +
    +
    +   +
    - 22 + + -
    - - - "storage": { +
    +
    +   +
    - 23 + + -
    - - - "0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000004c1665d6651ecefa59b9b3041951608468b18891" +
    +
    +   +
    - 24 + + -
    - - - } +
    +
    +   +
    - 25 + + -
    - - - }, +
    +
    +   +
    - 26 + + -
    - - - { +
    +
    +   +
    - 27 + + -
    - - - "contractName": "ProxyAdmin", +
    +
    +   +
    - 28 + + -
    - - - "balance": "0", +
    +
    +   +
    - 29 + + -
    - - - "nonce": "1", +
    +
    +   +
    - 30 + + -
    - - - "address": "0x0F99738B2Fc14D77308337f3e2596b63aE7BCC4A", +
    +
    +   +
    - 31 + + -
    - - - "bytecode": "0x60806040526004361061007b5760003560e01c80639623609d1161004e5780639623609d1461012b57806399a88ec41461013e578063f2fde38b1461015e578063f3b7dead1461017e57600080fd5b8063204e1c7a14610080578063715018a6146100c95780637eff275e146100e05780638da5cb5b14610100575b600080fd5b34801561008c57600080fd5b506100a061009b366004610608565b61019e565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100d557600080fd5b506100de610255565b005b3480156100ec57600080fd5b506100de6100fb36600461062c565b610269565b34801561010c57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100a0565b6100de610139366004610694565b6102f7565b34801561014a57600080fd5b506100de61015936600461062c565b61038c565b34801561016a57600080fd5b506100de610179366004610608565b6103e8565b34801561018a57600080fd5b506100a0610199366004610608565b6104a4565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907f5c60da1b00000000000000000000000000000000000000000000000000000000815260040190565b600060405180830381855afa9150503d8060008114610225576040519150601f19603f3d011682016040523d82523d6000602084013e61022a565b606091505b50915091508161023957600080fd5b8080602001905181019061024d9190610788565b949350505050565b61025d6104f0565b6102676000610571565b565b6102716104f0565b6040517f8f28397000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690638f283970906024015b600060405180830381600087803b1580156102db57600080fd5b505af11580156102ef573d6000803e3d6000fd5b505050505050565b6102ff6104f0565b6040517f4f1ef28600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690634f1ef28690349061035590869086906004016107a5565b6000604051808303818588803b15801561036e57600080fd5b505af1158015610382573d6000803e3d6000fd5b5050505050505050565b6103946104f0565b6040517f3659cfe600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690633659cfe6906024016102c1565b6103f06104f0565b73ffffffffffffffffffffffffffffffffffffffff8116610498576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6104a181610571565b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907ff851a44000000000000000000000000000000000000000000000000000000000815260040190565b60005473ffffffffffffffffffffffffffffffffffffffff163314610267576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161048f565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b73ffffffffffffffffffffffffffffffffffffffff811681146104a157600080fd5b60006020828403121561061a57600080fd5b8135610625816105e6565b9392505050565b6000806040838503121561063f57600080fd5b823561064a816105e6565b9150602083013561065a816105e6565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000606084860312156106a957600080fd5b83356106b4816105e6565b925060208401356106c4816105e6565b9150604084013567ffffffffffffffff808211156106e157600080fd5b818601915086601f8301126106f557600080fd5b81358181111561070757610707610665565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561074d5761074d610665565b8160405282815289602084870101111561076657600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b60006020828403121561079a57600080fd5b8151610625816105e6565b73ffffffffffffffffffffffffffffffffffffffff8316815260006020604081840152835180604085015260005b818110156107ef578581018301518582016060015282016107d3565b5060006060828601015260607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010192505050939250505056fea2646970667358221220372a0e10eebea1b7fa43ae4c976994e6ed01d85eedc3637b83f01d3f06be442064736f6c63430008110033", +
    +
    +   +
    - 32 + + -
    - - - "storage": { +
    +
    +   +
    - 33 + + -
    - - - "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000bba0935fa93eb23de7990b47f0d96a8f75766d13" +
    +
    +   +
    - 34 + + -
    - - - } +
    +
    +   +
    - 35 + + -
    - - - }, +
    +
    +   +
    - 36 + + -
    - - - { +
    +
    +   +
    - 37 + + -
    - - - "contractName": "PolygonZkEVMBridge implementation", +
    +
    +   +
    - 38 + + -
    - - - "balance": "0", +
    +
    +   +
    - 39 + + -
    - - - "nonce": "1", +
    +
    +   +
    - 40 + + -
    - - - "address": "0x5ac4182A1dd41AeEf465E40B82fd326BF66AB82C", +
    +
    +   +
    - 41 + + -
    - - - "bytecode": "0x6080604052600436106200019f5760003560e01c8063647c576c11620000e7578063be5831c71162000089578063dbc169761162000060578063dbc169761462000639578063ee25560b1462000651578063fb570834146200068257600080fd5b8063be5831c714620005ae578063cd58657914620005ea578063d02103ca146200060157600080fd5b80639e34070f11620000be5780639e34070f146200050a578063aaa13cc2146200054f578063bab161bf146200057457600080fd5b8063647c576c146200048657806379e2cf9714620004ab57806381b1c17414620004c357600080fd5b80632d2c9d94116200015157806334ac9cf2116200012857806334ac9cf2146200034b5780633ae05047146200037a5780633e197043146200039257600080fd5b80632d2c9d9414620002765780632dfdf0b5146200029b578063318aee3d14620002c257600080fd5b806322e95f2c116200018657806322e95f2c14620001ef578063240ff378146200023a5780632cffd02e146200025157600080fd5b806315064c9614620001a45780632072f6c514620001d5575b600080fd5b348015620001b157600080fd5b50606854620001c09060ff1681565b60405190151581526020015b60405180910390f35b348015620001e257600080fd5b50620001ed620006a7565b005b348015620001fc57600080fd5b50620002146200020e366004620032db565b62000705565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001620001cc565b620001ed6200024b36600462003372565b620007a8565b3480156200025e57600080fd5b50620001ed6200027036600462003409565b620009d0565b3480156200028357600080fd5b50620001ed6200029536600462003409565b62000f74565b348015620002a857600080fd5b50620002b360535481565b604051908152602001620001cc565b348015620002cf57600080fd5b5062000319620002e1366004620034ef565b606b6020526000908152604090205463ffffffff811690640100000000900473ffffffffffffffffffffffffffffffffffffffff1682565b6040805163ffffffff909316835273ffffffffffffffffffffffffffffffffffffffff909116602083015201620001cc565b3480156200035857600080fd5b50606c54620002149073ffffffffffffffffffffffffffffffffffffffff1681565b3480156200038757600080fd5b50620002b362001178565b3480156200039f57600080fd5b50620002b3620003b136600462003526565b6040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b3480156200049357600080fd5b50620001ed620004a5366004620035b0565b6200125e565b348015620004b857600080fd5b50620001ed620014ad565b348015620004d057600080fd5b5062000214620004e236600462003600565b606a6020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b3480156200051757600080fd5b50620001c06200052936600462003600565b600881901c600090815260696020526040902054600160ff9092169190911b9081161490565b3480156200055c57600080fd5b50620002146200056e3660046200361a565b620014e7565b3480156200058157600080fd5b506068546200059890610100900463ffffffff1681565b60405163ffffffff9091168152602001620001cc565b348015620005bb57600080fd5b506068546200059890790100000000000000000000000000000000000000000000000000900463ffffffff1681565b620001ed620005fb366004620036ce565b620016d3565b3480156200060e57600080fd5b50606854620002149065010000000000900473ffffffffffffffffffffffffffffffffffffffff1681565b3480156200064657600080fd5b50620001ed62001c37565b3480156200065e57600080fd5b50620002b36200067036600462003600565b60696020526000908152604090205481565b3480156200068f57600080fd5b50620001c0620006a136600462003770565b62001c93565b606c5473ffffffffffffffffffffffffffffffffffffffff163314620006f9576040517fe2e8106b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200070362001d7c565b565b6040805160e084901b7fffffffff0000000000000000000000000000000000000000000000000000000016602080830191909152606084901b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602483015282516018818403018152603890920183528151918101919091206000908152606a909152205473ffffffffffffffffffffffffffffffffffffffff165b92915050565b60685460ff1615620007e6576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60685463ffffffff8681166101009092041614806200080c5750600263ffffffff861610155b1562000844576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b6001606860019054906101000a900463ffffffff163388883488886053546040516200089a9998979695949392919062003806565b60405180910390a1620009b8620009b26001606860019054906101000a900463ffffffff16338989348989604051620008d592919062003881565b60405180910390206040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b62001e10565b8215620009c957620009c962001f27565b5050505050565b60685460ff161562000a0e576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000a258b8b8b8b8b8b8b8b8b8b8b600062001ffc565b73ffffffffffffffffffffffffffffffffffffffff861662000b01576040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff861690859060405162000a7a9190620038e6565b60006040518083038185875af1925050503d806000811462000ab9576040519150601f19603f3d011682016040523d82523d6000602084013e62000abe565b606091505b505090508062000afa576040517f6747a28800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5062000efc565b60685463ffffffff61010090910481169088160362000b435762000b3d73ffffffffffffffffffffffffffffffffffffffff87168585620021ed565b62000efc565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b1660208201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b166024820152600090603801604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291815281516020928301206000818152606a90935291205490915073ffffffffffffffffffffffffffffffffffffffff168062000e6e576000808062000c1886880188620039fb565b92509250925060008584848460405162000c329062003292565b62000c409392919062003abd565b8190604051809103906000f590508015801562000c61573d6000803e3d6000fd5b506040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8c81166004830152602482018c9052919250908216906340c10f1990604401600060405180830381600087803b15801562000cd757600080fd5b505af115801562000cec573d6000803e3d6000fd5b5050505080606a600088815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060405180604001604052808e63ffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff16815250606b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509050507f490e59a1701b938786ac72570a1efeac994a3dbe96e2e883e19e902ace6e6a398d8d838b8b60405162000e5c95949392919062003afa565b60405180910390a15050505062000ef9565b6040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152602482018790528216906340c10f1990604401600060405180830381600087803b15801562000edf57600080fd5b505af115801562000ef4573d6000803e3d6000fd5b505050505b50505b6040805163ffffffff8c811682528916602082015273ffffffffffffffffffffffffffffffffffffffff88811682840152861660608201526080810185905290517f25308c93ceeed162da955b3f7ce3e3f93606579e40fb92029faa9efe275459839181900360a00190a15050505050505050505050565b60685460ff161562000fb2576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000fc98b8b8b8b8b8b8b8b8b8b8b600162001ffc565b60008473ffffffffffffffffffffffffffffffffffffffff1684888a868660405160240162000ffc949392919062003b42565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f1806b5f200000000000000000000000000000000000000000000000000000000179052516200107f9190620038e6565b60006040518083038185875af1925050503d8060008114620010be576040519150601f19603f3d011682016040523d82523d6000602084013e620010c3565b606091505b5050905080620010ff576040517f37e391c300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805163ffffffff8d811682528a16602082015273ffffffffffffffffffffffffffffffffffffffff89811682840152871660608201526080810186905290517f25308c93ceeed162da955b3f7ce3e3f93606579e40fb92029faa9efe275459839181900360a00190a1505050505050505050505050565b605354600090819081805b602081101562001255578083901c600116600103620011e65760338160208110620011b257620011b262003b8a565b0154604080516020810192909252810185905260600160405160208183030381529060405280519060200120935062001213565b60408051602081018690529081018390526060016040516020818303038152906040528051906020012093505b604080516020810184905290810183905260600160405160208183030381529060405280519060200120915080806200124c9062003be8565b91505062001183565b50919392505050565b600054610100900460ff16158080156200127f5750600054600160ff909116105b806200129b5750303b1580156200129b575060005460ff166001145b6200132d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156200138c57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b606880547fffffffffffffff000000000000000000000000000000000000000000000000ff1661010063ffffffff8716027fffffffffffffff0000000000000000000000000000000000000000ffffffffff16176501000000000073ffffffffffffffffffffffffffffffffffffffff8681169190910291909117909155606c80547fffffffffffffffffffffffff00000000000000000000000000000000000000001691841691909117905562001443620022c3565b8015620014a757600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b605354606854790100000000000000000000000000000000000000000000000000900463ffffffff16101562000703576200070362001f27565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b1660208201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b1660248201526000908190603801604051602081830303815290604052805190602001209050600060ff60f81b3083604051806020016200157d9062003292565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082820381018352601f909101166040819052620015c8908d908d908d908d908d9060200162003c23565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905262001606929160200162003c64565b604051602081830303815290604052805190602001206040516020016200168f94939291907fff0000000000000000000000000000000000000000000000000000000000000094909416845260609290921b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660018401526015830152603582015260550190565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001815291905280516020909101209a9950505050505050505050565b60685460ff161562001711576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200171b62002366565b60685463ffffffff888116610100909204161480620017415750600263ffffffff881610155b1562001779576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008060608773ffffffffffffffffffffffffffffffffffffffff8816620017df57883414620017d5576040517fb89240f500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000925062001ad9565b341562001818576040517f798ee6f100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8089166000908152606b602090815260409182902082518084019093525463ffffffff811683526401000000009004909216918101829052901562001908576040517f9dc29fac000000000000000000000000000000000000000000000000000000008152336004820152602481018b905273ffffffffffffffffffffffffffffffffffffffff8a1690639dc29fac90604401600060405180830381600087803b158015620018db57600080fd5b505af1158015620018f0573d6000803e3d6000fd5b50505050806020015194508060000151935062001ad7565b85156200191d576200191d898b8989620023db565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8b16906370a0823190602401602060405180830381865afa1580156200198b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620019b1919062003c97565b9050620019d773ffffffffffffffffffffffffffffffffffffffff8b1633308e620028f9565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa15801562001a45573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001a6b919062003c97565b905062001a79828262003cb1565b6068548c9850610100900463ffffffff169650935062001a998762002959565b62001aa48c62002a71565b62001aaf8d62002b7e565b60405160200162001ac39392919062003abd565b604051602081830303815290604052945050505b505b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b600084868e8e868860535460405162001b1b98979695949392919062003cc7565b60405180910390a162001c0f620009b2600085878f8f8789805190602001206040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b861562001c205762001c2062001f27565b5050505062001c2e60018055565b50505050505050565b606c5473ffffffffffffffffffffffffffffffffffffffff16331462001c89576040517fe2e8106b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200070362002c80565b600084815b602081101562001d6e57600163ffffffff8616821c8116900362001d0a5785816020811062001ccb5762001ccb62003b8a565b60200201358260405160200162001cec929190918252602082015260400190565b60405160208183030381529060405280519060200120915062001d59565b8186826020811062001d205762001d2062003b8a565b602002013560405160200162001d40929190918252602082015260400190565b6040516020818303038152906040528051906020012091505b8062001d658162003be8565b91505062001c98565b50821490505b949350505050565b60685460ff161562001dba576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556040517f2261efe5aef6fedc1fd1550b25facc9181745623049c7901287030b9ad1a549790600090a1565b80600162001e216020600262003e79565b62001e2d919062003cb1565b6053541062001e68576040517fef5ccf6600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060536000815462001e7b9062003be8565b9182905550905060005b602081101562001f17578082901c60011660010362001ebd57826033826020811062001eb55762001eb562003b8a565b015550505050565b6033816020811062001ed35762001ed362003b8a565b01546040805160208101929092528101849052606001604051602081830303815290604052805190602001209250808062001f0e9062003be8565b91505062001e85565b5062001f2262003e87565b505050565b6053546068805463ffffffff909216790100000000000000000000000000000000000000000000000000027fffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffffff909216919091179081905573ffffffffffffffffffffffffffffffffffffffff65010000000000909104166333d6247d62001fad62001178565b6040518263ffffffff1660e01b815260040162001fcc91815260200190565b600060405180830381600087803b15801562001fe757600080fd5b505af1158015620014a7573d6000803e3d6000fd5b6200200d8b63ffffffff1662002d10565b6068546040805160208082018e90528183018d9052825180830384018152606083019384905280519101207f257b363200000000000000000000000000000000000000000000000000000000909252606481019190915260009165010000000000900473ffffffffffffffffffffffffffffffffffffffff169063257b3632906084016020604051808303816000875af1158015620020b0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620020d6919062003c97565b90508060000362002112576040517e2f6fad00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60685463ffffffff88811661010090920416146200215c576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606854600090610100900463ffffffff166200217a5750896200217d565b508a5b620021a66200219d848c8c8c8c8c8c8c604051620008d592919062003881565b8f8f8462001c93565b620021dd576040517fe0417cec00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505050505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905262001f229084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915262002d75565b600054610100900460ff166200235c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162001324565b6200070362002e88565b600260015403620023d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640162001324565b6002600155565b6000620023ec600482848662003eb6565b620023f79162003ee2565b90507f2afa5331000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000821601620026765760008080808080806200245a896004818d62003eb6565b81019062002469919062003f2b565b96509650965096509650965096503373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614620024dd576040517f912ecce700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff861630146200252d576040517f750643af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8a851462002567576040517f03fffc4b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff89811660248301528881166044830152606482018890526084820187905260ff861660a483015260c4820185905260e48083018590528351808403909101815261010490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fd505accf000000000000000000000000000000000000000000000000000000001790529151918e1691620026229190620038e6565b6000604051808303816000865af19150503d806000811462002661576040519150601f19603f3d011682016040523d82523d6000602084013e62002666565b606091505b50505050505050505050620009c9565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f8fcbaf0c0000000000000000000000000000000000000000000000000000000014620026f2576040517fe282c0ba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808080808080806200270a8a6004818e62003eb6565b81019062002719919062003f86565b975097509750975097509750975097503373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff16146200278f576040517f912ecce700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff87163014620027df576040517f750643af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff8a811660248301528981166044830152606482018990526084820188905286151560a483015260ff861660c483015260e482018590526101048083018590528351808403909101815261012490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f8fcbaf0c000000000000000000000000000000000000000000000000000000001790529151918f1691620028a39190620038e6565b6000604051808303816000865af19150503d8060008114620028e2576040519150601f19603f3d011682016040523d82523d6000602084013e620028e7565b606091505b50505050505050505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052620014a79085907f23b872dd000000000000000000000000000000000000000000000000000000009060840162002240565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f06fdde03000000000000000000000000000000000000000000000000000000001790529051606091600091829173ffffffffffffffffffffffffffffffffffffffff861691620029dd9190620038e6565b600060405180830381855afa9150503d806000811462002a1a576040519150601f19603f3d011682016040523d82523d6000602084013e62002a1f565b606091505b50915091508162002a66576040518060400160405280600781526020017f4e4f5f4e414d450000000000000000000000000000000000000000000000000081525062001d74565b62001d748162002f21565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f95d89b41000000000000000000000000000000000000000000000000000000001790529051606091600091829173ffffffffffffffffffffffffffffffffffffffff86169162002af59190620038e6565b600060405180830381855afa9150503d806000811462002b32576040519150601f19603f3d011682016040523d82523d6000602084013e62002b37565b606091505b50915091508162002a66576040518060400160405280600981526020017f4e4f5f53594d424f4c000000000000000000000000000000000000000000000081525062001d74565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f313ce5670000000000000000000000000000000000000000000000000000000017905290516000918291829173ffffffffffffffffffffffffffffffffffffffff86169162002c019190620038e6565b600060405180830381855afa9150503d806000811462002c3e576040519150601f19603f3d011682016040523d82523d6000602084013e62002c43565b606091505b509150915081801562002c57575080516020145b62002c6457601262001d74565b8080602001905181019062001d74919062004012565b60018055565b60685460ff1662002cbd576040517f5386698100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040517f1e5e34eea33501aecf2ebec9fe0e884a40804275ea7fe10b2ba084c8374308b390600090a1565b600881901c60008181526069602052604081208054600160ff861690811b91821892839055929091908183169003620009c9576040517f646cf55800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600062002dd9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16620031119092919063ffffffff16565b80519091501562001f22578080602001905181019062002dfa919062004032565b62001f22576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840162001324565b600054610100900460ff1662002c7a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162001324565b6060604082511062002f435781806020019051810190620007a2919062004052565b8151602003620030d35760005b60208110801562002f9b575082818151811062002f715762002f7162003b8a565b01602001517fff000000000000000000000000000000000000000000000000000000000000001615155b1562002fb6578062002fad8162003be8565b91505062002f50565b8060000362002ffa57505060408051808201909152601281527f4e4f545f56414c49445f454e434f44494e4700000000000000000000000000006020820152919050565b60008167ffffffffffffffff81111562003018576200301862003891565b6040519080825280601f01601f19166020018201604052801562003043576020820181803683370190505b50905060005b82811015620030cb5784818151811062003067576200306762003b8a565b602001015160f81c60f81b82828151811062003087576200308762003b8a565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080620030c28162003be8565b91505062003049565b509392505050565b505060408051808201909152601281527f4e4f545f56414c49445f454e434f44494e470000000000000000000000000000602082015290565b919050565b606062001d748484600085856000808673ffffffffffffffffffffffffffffffffffffffff168587604051620031489190620038e6565b60006040518083038185875af1925050503d806000811462003187576040519150601f19603f3d011682016040523d82523d6000602084013e6200318c565b606091505b50915091506200319f87838387620031aa565b979650505050505050565b60608315620032455782516000036200323d5773ffffffffffffffffffffffffffffffffffffffff85163b6200323d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162001324565b508162001d74565b62001d7483838151156200325c5781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620013249190620040d2565b611b6680620040e883390190565b803563ffffffff811681146200310c57600080fd5b73ffffffffffffffffffffffffffffffffffffffff81168114620032d857600080fd5b50565b60008060408385031215620032ef57600080fd5b620032fa83620032a0565b915060208301356200330c81620032b5565b809150509250929050565b8015158114620032d857600080fd5b60008083601f8401126200333957600080fd5b50813567ffffffffffffffff8111156200335257600080fd5b6020830191508360208285010111156200336b57600080fd5b9250929050565b6000806000806000608086880312156200338b57600080fd5b6200339686620032a0565b94506020860135620033a881620032b5565b93506040860135620033ba8162003317565b9250606086013567ffffffffffffffff811115620033d757600080fd5b620033e58882890162003326565b969995985093965092949392505050565b806104008101831015620007a257600080fd5b60008060008060008060008060008060006105208c8e0312156200342c57600080fd5b620034388d8d620033f6565b9a50620034496104008d01620032a0565b99506104208c013598506104408c013597506200346a6104608d01620032a0565b96506104808c01356200347d81620032b5565b95506200348e6104a08d01620032a0565b94506104c08c0135620034a181620032b5565b93506104e08c013592506105008c013567ffffffffffffffff811115620034c757600080fd5b620034d58e828f0162003326565b915080935050809150509295989b509295989b9093969950565b6000602082840312156200350257600080fd5b81356200350f81620032b5565b9392505050565b60ff81168114620032d857600080fd5b600080600080600080600060e0888a0312156200354257600080fd5b87356200354f8162003516565b96506200355f60208901620032a0565b955060408801356200357181620032b5565b94506200358160608901620032a0565b935060808801356200359381620032b5565b9699959850939692959460a0840135945060c09093013592915050565b600080600060608486031215620035c657600080fd5b620035d184620032a0565b92506020840135620035e381620032b5565b91506040840135620035f581620032b5565b809150509250925092565b6000602082840312156200361357600080fd5b5035919050565b600080600080600080600060a0888a0312156200363657600080fd5b6200364188620032a0565b965060208801356200365381620032b5565b9550604088013567ffffffffffffffff808211156200367157600080fd5b6200367f8b838c0162003326565b909750955060608a01359150808211156200369957600080fd5b50620036a88a828b0162003326565b9094509250506080880135620036be8162003516565b8091505092959891949750929550565b600080600080600080600060c0888a031215620036ea57600080fd5b620036f588620032a0565b965060208801356200370781620032b5565b95506040880135945060608801356200372081620032b5565b93506080880135620037328162003317565b925060a088013567ffffffffffffffff8111156200374f57600080fd5b6200375d8a828b0162003326565b989b979a50959850939692959293505050565b60008060008061046085870312156200378857600080fd5b843593506200379b8660208701620033f6565b9250620037ac6104208601620032a0565b939692955092936104400135925050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b600061010060ff8c16835263ffffffff808c16602085015273ffffffffffffffffffffffffffffffffffffffff808c166040860152818b166060860152808a166080860152508760a08501528160c0850152620038678285018789620037bd565b925080851660e085015250509a9950505050505050505050565b8183823760009101908152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60005b83811015620038dd578181015183820152602001620038c3565b50506000910152565b60008251620038fa818460208701620038c0565b9190910192915050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156200394e576200394e62003891565b604052919050565b600067ffffffffffffffff82111562003973576200397362003891565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112620039b157600080fd5b8135620039c8620039c28262003956565b62003904565b818152846020838601011115620039de57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121562003a1157600080fd5b833567ffffffffffffffff8082111562003a2a57600080fd5b62003a38878388016200399f565b9450602086013591508082111562003a4f57600080fd5b5062003a5e868287016200399f565b9250506040840135620035f58162003516565b6000815180845262003a8b816020860160208601620038c0565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60608152600062003ad2606083018662003a71565b828103602084015262003ae6818662003a71565b91505060ff83166040830152949350505050565b63ffffffff86168152600073ffffffffffffffffffffffffffffffffffffffff8087166020840152808616604084015250608060608301526200319f608083018486620037bd565b73ffffffffffffffffffffffffffffffffffffffff8516815263ffffffff8416602082015260606040820152600062003b80606083018486620037bd565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820362003c1c5762003c1c62003bb9565b5060010190565b60608152600062003c39606083018789620037bd565b828103602084015262003c4e818688620037bd565b91505060ff831660408301529695505050505050565b6000835162003c78818460208801620038c0565b83519083019062003c8e818360208801620038c0565b01949350505050565b60006020828403121562003caa57600080fd5b5051919050565b81810381811115620007a257620007a262003bb9565b600061010060ff8b16835263ffffffff808b16602085015273ffffffffffffffffffffffffffffffffffffffff808b166040860152818a1660608601528089166080860152508660a08501528160c085015262003d278285018762003a71565b925080851660e085015250509998505050505050505050565b600181815b8085111562003d9f57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111562003d835762003d8362003bb9565b8085161562003d9157918102915b93841c939080029062003d45565b509250929050565b60008262003db857506001620007a2565b8162003dc757506000620007a2565b816001811462003de0576002811462003deb5762003e0b565b6001915050620007a2565b60ff84111562003dff5762003dff62003bb9565b50506001821b620007a2565b5060208310610133831016604e8410600b841016171562003e30575081810a620007a2565b62003e3c838362003d40565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111562003e715762003e7162003bb9565b029392505050565b60006200350f838362003da7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b6000808585111562003ec757600080fd5b8386111562003ed557600080fd5b5050820193919092039150565b7fffffffff00000000000000000000000000000000000000000000000000000000813581811691600485101562003f235780818660040360031b1b83161692505b505092915050565b600080600080600080600060e0888a03121562003f4757600080fd5b873562003f5481620032b5565b9650602088013562003f6681620032b5565b955060408801359450606088013593506080880135620035938162003516565b600080600080600080600080610100898b03121562003fa457600080fd5b883562003fb181620032b5565b9750602089013562003fc381620032b5565b96506040890135955060608901359450608089013562003fe38162003317565b935060a089013562003ff58162003516565b979a969950949793969295929450505060c08201359160e0013590565b6000602082840312156200402557600080fd5b81516200350f8162003516565b6000602082840312156200404557600080fd5b81516200350f8162003317565b6000602082840312156200406557600080fd5b815167ffffffffffffffff8111156200407d57600080fd5b8201601f810184136200408f57600080fd5b8051620040a0620039c28262003956565b818152856020838501011115620040b657600080fd5b620040c9826020830160208601620038c0565b95945050505050565b6020815260006200350f602083018462003a7156fe6101006040523480156200001257600080fd5b5060405162001b6638038062001b6683398101604081905262000035916200028d565b82826003620000458382620003a1565b506004620000548282620003a1565b50503360c0525060ff811660e052466080819052620000739062000080565b60a052506200046d915050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f620000ad6200012e565b805160209182012060408051808201825260018152603160f81b90840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b6060600380546200013f9062000312565b80601f01602080910402602001604051908101604052809291908181526020018280546200016d9062000312565b8015620001be5780601f106200019257610100808354040283529160200191620001be565b820191906000526020600020905b815481529060010190602001808311620001a057829003601f168201915b5050505050905090565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620001f057600080fd5b81516001600160401b03808211156200020d576200020d620001c8565b604051601f8301601f19908116603f01168101908282118183101715620002385762000238620001c8565b816040528381526020925086838588010111156200025557600080fd5b600091505b838210156200027957858201830151818301840152908201906200025a565b600093810190920192909252949350505050565b600080600060608486031215620002a357600080fd5b83516001600160401b0380821115620002bb57600080fd5b620002c987838801620001de565b94506020860151915080821115620002e057600080fd5b50620002ef86828701620001de565b925050604084015160ff811681146200030757600080fd5b809150509250925092565b600181811c908216806200032757607f821691505b6020821081036200034857634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200039c57600081815260208120601f850160051c81016020861015620003775750805b601f850160051c820191505b81811015620003985782815560010162000383565b5050505b505050565b81516001600160401b03811115620003bd57620003bd620001c8565b620003d581620003ce845462000312565b846200034e565b602080601f8311600181146200040d5760008415620003f45750858301515b600019600386901b1c1916600185901b17855562000398565b600085815260208120601f198616915b828110156200043e578886015182559484019460019091019084016200041d565b50858210156200045d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e0516116aa620004bc6000396000610237015260008181610307015281816105c001526106a70152600061053a015260008181610379015261050401526116aa6000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806370a08231116100d8578063a457c2d71161008c578063d505accf11610066578063d505accf1461039b578063dd62ed3e146103ae578063ffa1ad74146103f457600080fd5b8063a457c2d71461034e578063a9059cbb14610361578063cd0d00961461037457600080fd5b806395d89b41116100bd57806395d89b41146102e75780639dc29fac146102ef578063a3c573eb1461030257600080fd5b806370a08231146102915780637ecebe00146102c757600080fd5b806330adf81f1161012f5780633644e515116101145780633644e51514610261578063395093511461026957806340c10f191461027c57600080fd5b806330adf81f14610209578063313ce5671461023057600080fd5b806318160ddd1161016057806318160ddd146101bd57806320606b70146101cf57806323b872dd146101f657600080fd5b806306fdde031461017c578063095ea7b31461019a575b600080fd5b610184610430565b60405161019191906113e4565b60405180910390f35b6101ad6101a8366004611479565b6104c2565b6040519015158152602001610191565b6002545b604051908152602001610191565b6101c17f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81565b6101ad6102043660046114a3565b6104dc565b6101c17f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152602001610191565b6101c1610500565b6101ad610277366004611479565b61055c565b61028f61028a366004611479565b6105a8565b005b6101c161029f3660046114df565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6101c16102d53660046114df565b60056020526000908152604090205481565b610184610680565b61028f6102fd366004611479565b61068f565b6103297f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610191565b6101ad61035c366004611479565b61075e565b6101ad61036f366004611479565b61082f565b6101c17f000000000000000000000000000000000000000000000000000000000000000081565b61028f6103a9366004611501565b61083d565b6101c16103bc366004611574565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6101846040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525081565b60606003805461043f906115a7565b80601f016020809104026020016040519081016040528092919081815260200182805461046b906115a7565b80156104b85780601f1061048d576101008083540402835291602001916104b8565b820191906000526020600020905b81548152906001019060200180831161049b57829003601f168201915b5050505050905090565b6000336104d0818585610b73565b60019150505b92915050565b6000336104ea858285610d27565b6104f5858585610dfe565b506001949350505050565b60007f00000000000000000000000000000000000000000000000000000000000000004614610537576105324661106d565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091906104d090829086906105a3908790611629565b610b73565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610672576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d4272696467650000000000000000000000000000000060648201526084015b60405180910390fd5b61067c8282611135565b5050565b60606004805461043f906115a7565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610754576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d427269646765000000000000000000000000000000006064820152608401610669565b61067c8282611228565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015610822576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610669565b6104f58286868403610b73565b6000336104d0818585610dfe565b834211156108cc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f546f6b656e577261707065643a3a7065726d69743a204578706972656420706560448201527f726d6974000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8716600090815260056020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918a918a918a9190866109268361163c565b9091555060408051602081019690965273ffffffffffffffffffffffffffffffffffffffff94851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000610991610500565b6040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281019190915260428101839052606201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa158015610a55573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590610ad057508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b610b5c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f546f6b656e577261707065643a3a7065726d69743a20496e76616c696420736960448201527f676e6174757265000000000000000000000000000000000000000000000000006064820152608401610669565b610b678a8a8a610b73565b50505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff8316610c15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610cb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610df85781811015610deb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610669565b610df88484848403610b73565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610ea1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610f44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610ffa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610df8565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f611098610430565b8051602091820120604080518082018252600181527f310000000000000000000000000000000000000000000000000000000000000090840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b73ffffffffffffffffffffffffffffffffffffffff82166111b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610669565b80600260008282546111c49190611629565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff82166112cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205481811015611381576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610d1a565b600060208083528351808285015260005b81811015611411578581018301518582016040015282016113f5565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461147457600080fd5b919050565b6000806040838503121561148c57600080fd5b61149583611450565b946020939093013593505050565b6000806000606084860312156114b857600080fd5b6114c184611450565b92506114cf60208501611450565b9150604084013590509250925092565b6000602082840312156114f157600080fd5b6114fa82611450565b9392505050565b600080600080600080600060e0888a03121561151c57600080fd5b61152588611450565b965061153360208901611450565b95506040880135945060608801359350608088013560ff8116811461155757600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561158757600080fd5b61159083611450565b915061159e60208401611450565b90509250929050565b600181811c908216806115bb57607f821691505b6020821081036115f4577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156104d6576104d66115fa565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361166d5761166d6115fa565b506001019056fea26469706673582212208d88fee561cff7120d381c345cfc534cef8229a272dc5809d4bbb685ad67141164736f6c63430008110033a2646970667358221220d9b3ca7b13ec80ac58634ddf0ecebe71e209a71f532614949b9e720413f50c8364736f6c63430008110033" +
    +
    +   +
    - 42 + + -
    - - - }, +
    +
    +   +
    - 43 + + -
    - - - { +
    +
    +   +
    - 44 + + -
    - - - "contractName": "PolygonZkEVMBridge proxy", +
    +
    +   +
    - 45 + + -
    - - - "balance": "200000000000000000000000000", +
    +
    +   +
    - 46 + + -
    - - - "nonce": "1", +
    +
    +   +
    - 47 + + -
    - - - "address": "0x2a3DD3EB832aF982ec71669E178424b10Dca2EDe", +
    +
    +   +
    - 48 + + -
    - - - "bytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461088b565b610135565b61006b6100a33660046108a6565b61017f565b3480156100b457600080fd5b506100bd6101f3565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461088b565b610231565b34801561011257600080fd5b506100bd61025e565b6101236102d4565b61013361012e6103ab565b6103b5565b565b61013d6103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481604051806020016040528060008152506000610419565b50565b61017461011b565b6101876103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101eb576101e68383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610419915050565b505050565b6101e661011b565b60006101fd6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103ab565b905090565b61022e61011b565b90565b6102396103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481610444565b60006102686103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103d9565b60606102b183836040518060600160405280602781526020016109bb602791396104a5565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b6102dc6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b600061022161052a565b3660008037600080366000845af43d6000803e8080156103d4573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b61042283610552565b60008251118061042f5750805b156101e65761043e838361028c565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61046d6103d9565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a16101748161059f565b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516104cf919061094d565b600060405180830381855af49150503d806000811461050a576040519150601f19603f3d011682016040523d82523d6000602084013e61050f565b606091505b5091509150610520868383876106ab565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6103fd565b61055b81610753565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff8116610642576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103a2565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b6060831561074157825160000361073a5773ffffffffffffffffffffffffffffffffffffffff85163b61073a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103a2565b508161074b565b61074b838361081e565b949350505050565b73ffffffffffffffffffffffffffffffffffffffff81163b6107f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e74726163740000000000000000000000000000000000000060648201526084016103a2565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610665565b81511561082e5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a29190610969565b803573ffffffffffffffffffffffffffffffffffffffff8116811461088657600080fd5b919050565b60006020828403121561089d57600080fd5b6102b182610862565b6000806000604084860312156108bb57600080fd5b6108c484610862565b9250602084013567ffffffffffffffff808211156108e157600080fd5b818601915086601f8301126108f557600080fd5b81358181111561090457600080fd5b87602082850101111561091657600080fd5b6020830194508093505050509250925092565b60005b8381101561094457818101518382015260200161092c565b50506000910152565b6000825161095f818460208701610929565b9190910192915050565b6020815260008251806020840152610988816040850160208701610929565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220a1af0d6cb4f1e31496a4c5c1448913bce4bd6ad3a39e47c6f7190c114d6f9bf464736f6c63430008110033", +
    +
    +   +
    - 49 + + -
    - - - "storage": { +
    +
    +   +
    - 50 + + -
    - - - "0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000000000000000000000000000000000000000000001", +
    +
    +   +
    - 51 + + -
    - - - "0x0000000000000000000000000000000000000000000000000000000000000001": "0x0000000000000000000000000000000000000000000000000000000000000001", +
    +
    +   +
    - 52 + + -
    - - - "0x0000000000000000000000000000000000000000000000000000000000000068": "0x00000000000000a40d5f56745a118d0906a34e69aec8c0db1cb8fa0000000100", +
    +
    +   +
    - 53 + + -
    - - - "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x0000000000000000000000000f99738b2fc14d77308337f3e2596b63ae7bcc4a", +
    +
    +   +
    - 54 + + -
    - - - "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x0000000000000000000000005ac4182a1dd41aeef465e40b82fd326bf66ab82c" +
    +
    +   +
    - 55 + + -
    - - - } +
    +
    +   +
    +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - -
    +
     
    +
    - 56 + + 89 +
    - - - }, +   + m.etherman.On("BuildTrustedVerifyBatchesTxData", batchNum-1, batchNumFinal, &expectedInputs, common.HexToAddress(cfg.SenderAddress)).Run(func(args mock.Arguments) {
    - 57 + + 90 +
    - - - { +   + assert.True(a.verifyingProof)
    - 58 + + 91 +
    - - - "contractName": "PolygonZkEVMGlobalExitRootL2 implementation", +   + }).Return(nil, nil, errBanana).Once()
    - 59 + + 92 +
    - - - "balance": "0", + + + m.stateMock.On("UpdateGeneratedProof", mock.Anything, recursiveProof, nil).Run(func(args mock.Arguments) {
    - 60 + + 93 +
    - - - "nonce": "1", +   + // test is done, stop the sendFinalProof method
    - 61 + + 94 +
    - - - "address": "0x0200143Fa295EE4dffEF22eE2616c2E008D81688", +   + a.exit()
    - 62 + + 95 +
    - - - "bytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806301fd904414610051578063257b36321461006d57806333d6247d1461008d578063a3c573eb146100a2575b600080fd5b61005a60015481565b6040519081526020015b60405180910390f35b61005a61007b366004610162565b60006020819052908152604090205481565b6100a061009b366004610162565b6100ee565b005b6100c97f0000000000000000000000002a3dd3eb832af982ec71669e178424b10dca2ede81565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610064565b3373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000002a3dd3eb832af982ec71669e178424b10dca2ede161461015d576040517fb49365dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600155565b60006020828403121561017457600080fd5b503591905056fea2646970667358221220a187fc278346c1b61c449ea3641002b6eac2bda3351a122a12c35099f933696864736f6c63430008110033" +   + }).Return(nil).Once()
    - 63 + +
     
    +
    + 99 +
    - - - }, +   + },
    - 64 + + 100 +
    - - - { +   + },
    - 65 + + 101 +
    - - - "contractName": "PolygonZkEVMGlobalExitRootL2 proxy", +   + {
    - 66 + + 102 +
    - - - "balance": "0", + + + name: "UpdateGeneratedProof error after BuildTrustedVerifyBatchesTxData error",
    - 67 + + 103 +
    - - - "nonce": "1", +   + setup: func(m mox, a *Aggregator) {
    - 68 + + 104 +
    - - - "address": "0xa40d5f56745a118d0906a34e69aec8c0db1cb8fa", +   + m.stateMock.On("GetBatchByNumber", mock.Anything, batchNumFinal, nil).Run(func(args mock.Arguments) {
    - 69 + + 105 +
    - - - "bytecode": "0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100855780635c60da1b146100985780638f283970146100c9578063f851a440146100e95761005d565b3661005d5761005b6100fe565b005b61005b6100fe565b34801561007157600080fd5b5061005b6100803660046106ca565b610118565b61005b6100933660046106e5565b61015f565b3480156100a457600080fd5b506100ad6101d0565b6040516001600160a01b03909116815260200160405180910390f35b3480156100d557600080fd5b5061005b6100e43660046106ca565b61020b565b3480156100f557600080fd5b506100ad610235565b610106610292565b610116610111610331565b61033b565b565b61012061035f565b6001600160a01b0316336001600160a01b031614156101575761015481604051806020016040528060008152506000610392565b50565b6101546100fe565b61016761035f565b6001600160a01b0316336001600160a01b031614156101c8576101c38383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610392915050565b505050565b6101c36100fe565b60006101da61035f565b6001600160a01b0316336001600160a01b03161415610200576101fb610331565b905090565b6102086100fe565b90565b61021361035f565b6001600160a01b0316336001600160a01b0316141561015757610154816103f1565b600061023f61035f565b6001600160a01b0316336001600160a01b03161415610200576101fb61035f565b606061028583836040518060600160405280602781526020016107e460279139610445565b9392505050565b3b151590565b61029a61035f565b6001600160a01b0316336001600160a01b031614156101165760405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b60006101fb610519565b3660008037600080366000845af43d6000803e80801561035a573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b61039b83610541565b6040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a26000825111806103dc5750805b156101c3576103eb8383610260565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61041a61035f565b604080516001600160a01b03928316815291841660208301520160405180910390a1610154816105e9565b6060833b6104a45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610328565b600080856001600160a01b0316856040516104bf9190610794565b600060405180830381855af49150503d80600081146104fa576040519150601f19603f3d011682016040523d82523d6000602084013e6104ff565b606091505b509150915061050f828286610675565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610383565b803b6105a55760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610328565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5b80546001600160a01b0319166001600160a01b039290921691909117905550565b6001600160a01b03811661064e5760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401610328565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61036105c8565b60608315610684575081610285565b8251156106945782518084602001fd5b8160405162461bcd60e51b815260040161032891906107b0565b80356001600160a01b03811681146106c557600080fd5b919050565b6000602082840312156106dc57600080fd5b610285826106ae565b6000806000604084860312156106fa57600080fd5b610703846106ae565b9250602084013567ffffffffffffffff8082111561072057600080fd5b818601915086601f83011261073457600080fd5b81358181111561074357600080fd5b87602082850101111561075557600080fd5b6020830194508093505050509250925092565b60005b8381101561078357818101518382015260200161076b565b838111156103eb5750506000910152565b600082516107a6818460208701610768565b9190910192915050565b60208152600082518060208401526107cf816040850160208701610768565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212204675187caf3a43285d9a2c1844a981e977bd52a85ff073e7fc649f73847d70a464736f6c63430008090033", +   + assert.True(a.verifyingProof)
    - 70 + +
     
    +
    + 112 +
    - - - "storage": { +   + m.etherman.On("BuildTrustedVerifyBatchesTxData", batchNum-1, batchNumFinal, &expectedInputs, common.HexToAddress(cfg.SenderAddress)).Run(func(args mock.Arguments) {
    - 71 + + 113 +
    - - - "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x0000000000000000000000000f99738b2fc14d77308337f3e2596b63ae7bcc4a", +   + assert.True(a.verifyingProof)
    - 72 + + 114 +
    - - - "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x0000000000000000000000000200143fa295ee4dffef22ee2616c2e008d81688" +   + }).Return(nil, nil, errBanana).Once()
    - 73 + + 115 +
    - - - } + + + m.stateMock.On("UpdateGeneratedProof", mock.Anything, recursiveProof, nil).Run(func(args mock.Arguments) {
    - 74 + + 116 +
    - - - }, +   + // test is done, stop the sendFinalProof method
    - 75 + + 117 +
    - - - { +   + a.exit()
    - 76 + + 118 +
    - - - "contractName": "PolygonZkEVMTimelock", +   + }).Return(errBanana).Once()
    - 77 + +
     
    +
    + 137 +
    - - - "balance": "0", +   + }).Return(&to, data, nil).Once()
    - 78 + + 138 +
    - - - "nonce": "1", +   + monitoredTxID := buildMonitoredTxID(batchNum, batchNumFinal)
    - 79 + + 139 +
    - - - "address": "0xBBa0935Fa93Eb23de7990b47F0D96a8f75766d13", +   + m.ethTxManager.On("Add", mock.Anything, ethTxManagerOwner, monitoredTxID, from, &to, value, data, cfg.GasOffset, nil).Return(errBanana).Once()
    - 80 + + 140 +
    - - - "bytecode": "0x6080604052600436106101c65760003560e01c806364d62353116100f7578063b1c5f42711610095578063d547741f11610064578063d547741f14610661578063e38335e514610681578063f23a6e6114610694578063f27a0c92146106d957600080fd5b8063b1c5f427146105af578063bc197c81146105cf578063c4d252f514610614578063d45c44351461063457600080fd5b80638f61f4f5116100d15780638f61f4f5146104e157806391d1485414610515578063a217fddf14610566578063b08e51c01461057b57600080fd5b806364d62353146104815780638065657f146104a15780638f2a0bb0146104c157600080fd5b8063248a9ca31161016457806331d507501161013e57806331d50750146103c857806336568abe146103e85780633a6aae7214610408578063584b153e1461046157600080fd5b8063248a9ca3146103475780632ab0f529146103775780632f2ff15d146103a857600080fd5b80630d3cf6fc116101a05780630d3cf6fc1461026b578063134008d31461029f57806313bc9f20146102b2578063150b7a02146102d257600080fd5b806301d5062a146101d257806301ffc9a7146101f457806307bd02651461022957600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506101f26101ed366004611c52565b6106ee565b005b34801561020057600080fd5b5061021461020f366004611cc7565b610783565b60405190151581526020015b60405180910390f35b34801561023557600080fd5b5061025d7fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e6381565b604051908152602001610220565b34801561027757600080fd5b5061025d7f5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca581565b6101f26102ad366004611d09565b6107df565b3480156102be57600080fd5b506102146102cd366004611d75565b6108d7565b3480156102de57600080fd5b506103166102ed366004611e9a565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610220565b34801561035357600080fd5b5061025d610362366004611d75565b60009081526020819052604090206001015490565b34801561038357600080fd5b50610214610392366004611d75565b6000908152600160208190526040909120541490565b3480156103b457600080fd5b506101f26103c3366004611f02565b6108fd565b3480156103d457600080fd5b506102146103e3366004611d75565b610927565b3480156103f457600080fd5b506101f2610403366004611f02565b610940565b34801561041457600080fd5b5061043c7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610220565b34801561046d57600080fd5b5061021461047c366004611d75565b6109f8565b34801561048d57600080fd5b506101f261049c366004611d75565b610a0e565b3480156104ad57600080fd5b5061025d6104bc366004611d09565b610ade565b3480156104cd57600080fd5b506101f26104dc366004611f73565b610b1d565b3480156104ed57600080fd5b5061025d7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc181565b34801561052157600080fd5b50610214610530366004611f02565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b34801561057257600080fd5b5061025d600081565b34801561058757600080fd5b5061025d7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f78381565b3480156105bb57600080fd5b5061025d6105ca366004612025565b610d4f565b3480156105db57600080fd5b506103166105ea36600461214e565b7fbc197c810000000000000000000000000000000000000000000000000000000095945050505050565b34801561062057600080fd5b506101f261062f366004611d75565b610d94565b34801561064057600080fd5b5061025d61064f366004611d75565b60009081526001602052604090205490565b34801561066d57600080fd5b506101f261067c366004611f02565b610e8f565b6101f261068f366004612025565b610eb4565b3480156106a057600080fd5b506103166106af3660046121f8565b7ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b3480156106e557600080fd5b5061025d611161565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc161071881611244565b6000610728898989898989610ade565b90506107348184611251565b6000817f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8b8b8b8b8b8a604051610770969594939291906122a6565b60405180910390a3505050505050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f4e2312e00000000000000000000000000000000000000000000000000000000014806107d957506107d98261139e565b92915050565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff1661085c5761085c8133611435565b600061086c888888888888610ade565b905061087881856114ed565b6108848888888861162a565b6000817fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588a8a8a8a6040516108bc94939291906122f1565b60405180910390a36108cd8161172e565b5050505050505050565b6000818152600160205260408120546001811180156108f65750428111155b9392505050565b60008281526020819052604090206001015461091881611244565b61092283836117d7565b505050565b60008181526001602052604081205481905b1192915050565b73ffffffffffffffffffffffffffffffffffffffff811633146109ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6109f482826118c7565b5050565b6000818152600160208190526040822054610939565b333014610a9d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f54696d656c6f636b436f6e74726f6c6c65723a2063616c6c6572206d7573742060448201527f62652074696d656c6f636b00000000000000000000000000000000000000000060648201526084016109e1565b60025460408051918252602082018390527f11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d5910160405180910390a1600255565b6000868686868686604051602001610afb969594939291906122a6565b6040516020818303038152906040528051906020012090509695505050505050565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1610b4781611244565b888714610bd6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b888514610c65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b6000610c778b8b8b8b8b8b8b8b610d4f565b9050610c838184611251565b60005b8a811015610d415780827f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8e8e85818110610cc357610cc3612331565b9050602002016020810190610cd89190612360565b8d8d86818110610cea57610cea612331565b905060200201358c8c87818110610d0357610d03612331565b9050602002810190610d15919061237b565b8c8b604051610d29969594939291906122a6565b60405180910390a3610d3a8161240f565b9050610c86565b505050505050505050505050565b60008888888888888888604051602001610d709897969594939291906124f7565b60405160208183030381529060405280519060200120905098975050505050505050565b7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f783610dbe81611244565b610dc7826109f8565b610e53576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20636160448201527f6e6e6f742062652063616e63656c6c656400000000000000000000000000000060648201526084016109e1565b6000828152600160205260408082208290555183917fbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb7091a25050565b600082815260208190526040902060010154610eaa81611244565b61092283836118c7565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff16610f3157610f318133611435565b878614610fc0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b87841461104f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b60006110618a8a8a8a8a8a8a8a610d4f565b905061106d81856114ed565b60005b8981101561114b5760008b8b8381811061108c5761108c612331565b90506020020160208101906110a19190612360565b905060008a8a848181106110b7576110b7612331565b9050602002013590503660008a8a868181106110d5576110d5612331565b90506020028101906110e7919061237b565b915091506110f78484848461162a565b84867fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588686868660405161112e94939291906122f1565b60405180910390a350505050806111449061240f565b9050611070565b506111558161172e565b50505050505050505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff161580159061123257507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166315064c966040518163ffffffff1660e01b8152600401602060405180830381865afa15801561120e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123291906125be565b1561123d5750600090565b5060025490565b61124e8133611435565b50565b61125a82610927565b156112e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20616c60448201527f7265616479207363686564756c6564000000000000000000000000000000000060648201526084016109e1565b6112ef611161565b81101561137e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a20696e73756666696369656e7460448201527f2064656c6179000000000000000000000000000000000000000000000000000060648201526084016109e1565b61138881426125e0565b6000928352600160205260409092209190915550565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806107d957507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146107d9565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f4576114738161197e565b61147e83602061199d565b60405160200161148f929190612617565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526109e191600401612698565b6114f6826108d7565b611582576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b80158061159e5750600081815260016020819052604090912054145b6109f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a206d697373696e67206465706560448201527f6e64656e6379000000000000000000000000000000000000000000000000000060648201526084016109e1565b60008473ffffffffffffffffffffffffffffffffffffffff168484846040516116549291906126e9565b60006040518083038185875af1925050503d8060008114611691576040519150601f19603f3d011682016040523d82523d6000602084013e611696565b606091505b5050905080611727576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f54696d656c6f636b436f6e74726f6c6c65723a20756e6465726c79696e67207460448201527f72616e73616374696f6e2072657665727465640000000000000000000000000060648201526084016109e1565b5050505050565b611737816108d7565b6117c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b600090815260016020819052604090912055565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556118693390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60606107d973ffffffffffffffffffffffffffffffffffffffff831660145b606060006119ac8360026126f9565b6119b79060026125e0565b67ffffffffffffffff8111156119cf576119cf611d8e565b6040519080825280601f01601f1916602001820160405280156119f9576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611a3057611a30612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611a9357611a93612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000611acf8460026126f9565b611ada9060016125e0565b90505b6001811115611b77577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611b1b57611b1b612331565b1a60f81b828281518110611b3157611b31612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611b7081612710565b9050611add565b5083156108f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109e1565b803573ffffffffffffffffffffffffffffffffffffffff81168114611c0457600080fd5b919050565b60008083601f840112611c1b57600080fd5b50813567ffffffffffffffff811115611c3357600080fd5b602083019150836020828501011115611c4b57600080fd5b9250929050565b600080600080600080600060c0888a031215611c6d57600080fd5b611c7688611be0565b965060208801359550604088013567ffffffffffffffff811115611c9957600080fd5b611ca58a828b01611c09565b989b979a50986060810135976080820135975060a09091013595509350505050565b600060208284031215611cd957600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146108f657600080fd5b60008060008060008060a08789031215611d2257600080fd5b611d2b87611be0565b955060208701359450604087013567ffffffffffffffff811115611d4e57600080fd5b611d5a89828a01611c09565b979a9699509760608101359660809091013595509350505050565b600060208284031215611d8757600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611e0457611e04611d8e565b604052919050565b600082601f830112611e1d57600080fd5b813567ffffffffffffffff811115611e3757611e37611d8e565b611e6860207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601611dbd565b818152846020838601011115611e7d57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215611eb057600080fd5b611eb985611be0565b9350611ec760208601611be0565b925060408501359150606085013567ffffffffffffffff811115611eea57600080fd5b611ef687828801611e0c565b91505092959194509250565b60008060408385031215611f1557600080fd5b82359150611f2560208401611be0565b90509250929050565b60008083601f840112611f4057600080fd5b50813567ffffffffffffffff811115611f5857600080fd5b6020830191508360208260051b8501011115611c4b57600080fd5b600080600080600080600080600060c08a8c031215611f9157600080fd5b893567ffffffffffffffff80821115611fa957600080fd5b611fb58d838e01611f2e565b909b50995060208c0135915080821115611fce57600080fd5b611fda8d838e01611f2e565b909950975060408c0135915080821115611ff357600080fd5b506120008c828d01611f2e565b9a9d999c50979a969997986060880135976080810135975060a0013595509350505050565b60008060008060008060008060a0898b03121561204157600080fd5b883567ffffffffffffffff8082111561205957600080fd5b6120658c838d01611f2e565b909a50985060208b013591508082111561207e57600080fd5b61208a8c838d01611f2e565b909850965060408b01359150808211156120a357600080fd5b506120b08b828c01611f2e565b999c989b509699959896976060870135966080013595509350505050565b600082601f8301126120df57600080fd5b8135602067ffffffffffffffff8211156120fb576120fb611d8e565b8160051b61210a828201611dbd565b928352848101820192828101908785111561212457600080fd5b83870192505b848310156121435782358252918301919083019061212a565b979650505050505050565b600080600080600060a0868803121561216657600080fd5b61216f86611be0565b945061217d60208701611be0565b9350604086013567ffffffffffffffff8082111561219a57600080fd5b6121a689838a016120ce565b945060608801359150808211156121bc57600080fd5b6121c889838a016120ce565b935060808801359150808211156121de57600080fd5b506121eb88828901611e0c565b9150509295509295909350565b600080600080600060a0868803121561221057600080fd5b61221986611be0565b945061222760208701611be0565b93506040860135925060608601359150608086013567ffffffffffffffff81111561225157600080fd5b6121eb88828901611e0c565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b73ffffffffffffffffffffffffffffffffffffffff8716815285602082015260a0604082015260006122dc60a08301868861225d565b60608301949094525060800152949350505050565b73ffffffffffffffffffffffffffffffffffffffff8516815283602082015260606040820152600061232760608301848661225d565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561237257600080fd5b6108f682611be0565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126123b057600080fd5b83018035915067ffffffffffffffff8211156123cb57600080fd5b602001915036819003821315611c4b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612440576124406123e0565b5060010190565b81835260006020808501808196508560051b810191508460005b878110156124ea57828403895281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18836030181126124a057600080fd5b8701858101903567ffffffffffffffff8111156124bc57600080fd5b8036038213156124cb57600080fd5b6124d686828461225d565b9a87019a9550505090840190600101612461565b5091979650505050505050565b60a0808252810188905260008960c08301825b8b8110156125455773ffffffffffffffffffffffffffffffffffffffff61253084611be0565b1682526020928301929091019060010161250a565b5083810360208501528881527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff89111561257e57600080fd5b8860051b9150818a602083013701828103602090810160408501526125a69082018789612447565b60608401959095525050608001529695505050505050565b6000602082840312156125d057600080fd5b815180151581146108f657600080fd5b808201808211156107d9576107d96123e0565b60005b8381101561260e5781810151838201526020016125f6565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161264f8160178501602088016125f3565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161268c8160288401602088016125f3565b01602801949350505050565b60208152600082518060208401526126b78160408501602087016125f3565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b8183823760009101908152919050565b80820281158282048414176107d9576107d96123e0565b60008161271f5761271f6123e0565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea26469706673582212206416c4e08f97752b4bb06159524dac058d3dccd8775e57ef1b01505751ebf7af64736f6c63430008110033", + + + m.stateMock.On("UpdateGeneratedProof", mock.Anything, recursiveProof, nil).Run(func(args mock.Arguments) {
    - 81 + + 141 +
    - - - "storage": { +   + // test is done, stop the sendFinalProof method
    - 82 + + 142 +
    - - - "0x0000000000000000000000000000000000000000000000000000000000000002": "0x00000000000000000000000000000000000000000000000000000000000d2f00", +   + a.exit()
    - 83 + + 143 +
    - - - "0x33d4aa03df3f12c4f615b40676f67fdafecd3edb5a9c0ca2a47a923dae33a023": "0x0000000000000000000000000000000000000000000000000000000000000001", +   + }).Return(nil).Once()
    - 84 + +
     
    +
    + 175 +
    - - - "0x9fa2d8034dbcb437bee38d61fbd100910e1342ffc07f128aa1b8e6790b7f3f68": "0x0000000000000000000000000000000000000000000000000000000000000001", +   + }
    - 85 + + 176 +
    - - - "0x64494413541ff93b31aa309254e3fed72a7456e9845988b915b4c7a7ceba8814": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", +   + m.stateMock.On("GetLastVerifiedBatch", mock.Anything, nil).Return(&verifiedBatch, nil).Once()
    - 86 + + 177 +
    - - - "0x531a7c25761aa4b0f2310edca9bb25e1e3ceb49ad4b0422aec866b3ce7567c87": "0x0000000000000000000000000000000000000000000000000000000000000001", +   + m.etherman.On("GetLatestVerifiedBatchNum").Return(batchNumFinal, nil).Once()
    - 87 + + 178 +
    - - - "0x3412d5605ac6cd444957cedb533e5dacad6378b4bc819ebe3652188a665066d6": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", + + + m.stateMock.On("CleanupGeneratedProofs", mock.Anything, batchNumFinal, nil).Run(func(args mock.Arguments) {
    - 88 + + 179 +
    - - - "0xedbedc78c4240c7613622a35de050b48bd6c6d9a31b3d485b68fbbed54a4802d": "0x0000000000000000000000000000000000000000000000000000000000000001", +   + // test is done, stop the sendFinalProof method
    - 89 + + 180 +
    - - - "0xdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d706a": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", +   + a.exit()
    - 90 + + 181 +
    - - - "0x76616448da8d124a07383c26a6b2433b3259de946aa40f51524ec96ee05e871a": "0x0000000000000000000000000000000000000000000000000000000000000001", +   + }).Return(nil).Once()
    - 91 + +
     
    +
    + 191 +
    - - - "0xc3ad33e20b0c56a223ad5104fff154aa010f8715b9c981fd38fdc60a4d1a52fc": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5" +   + stateMock := mocks.NewStateMock(t)
    - 92 + + 192 +
    - - - } +   + ethTxManager := mocks.NewEthTxManager(t)
    - 93 + + 193 +
    - - - }, +   + etherman := mocks.NewEtherman(t)
    - 94 + + 194 +
    - - - { + + + a, err := New(cfg, stateMock, ethTxManager, etherman, nil, nil)
    - 95 + + 195 +
    - - - "accountName": "keyless Deployer", +   + require.NoError(err)
    - 96 + + 196 +
    - - - "balance": "0", +   + a.ctx, a.exit = context.WithCancel(context.Background())
    - 97 + + 197 +
    - - - "nonce": "1", +   + m := mox{
    - 98 + +
     
    +
    + 251 +
    - - - "address": "0x9d90066e7478496e2284E54c3548106bb4F90E50" +   + asserts func(bool, *Aggregator, error)
    - 99 + + 252 +
    - - - }, +   + }{
    - 100 + + 253 +
    - - - { +   + {
    - 101 + + 254 +
    - - - "accountName": "deployer", + + + name: "getAndLockProofsToAggregate returns generic error",
    - 102 + + 255 +
    - - - "balance": "0", +   + setup: func(m mox, a *Aggregator) {
    - 103 + + 256 +
    - - - "nonce": "8", +   + m.proverMock.On("Name").Return(proverName).Twice()
    - 104 + + 257 +
    - - - "address": "0x4c1665d6651ecEfa59B9B3041951608468b18891" +   + m.proverMock.On("ID").Return(proverID).Twice()
    - 105 + + 258 +
    - - - } +   + m.proverMock.On("Addr").Return("addr")
    - 106 + + 259 +
    - - - ] + + + m.stateMock.On("GetProofsToAggregate", mock.MatchedBy(matchProverCtxFn), nil).Return(nil, nil, errBanana).Once()
    - 107 + + 260 +
    - - - } +   + },
    - 108 + + 261 +
    - - - ` +   + asserts: func(result bool, a *Aggregator, err error) {
    -
    + + + 262 + + +
    +   + assert.False(result)
    -
    -
    - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - -
     
    - + + 264 -
    +
    +
      -
    + },
    - + + 265 -
    +
    +
      -
    + },
    - + + 266 -
    +
    +
      -
    + {
    - + + 267 -
    -   -
    +
    +
    + + + name: "getAndLockProofsToAggregate returns ErrNotFound",
    - + + 268 -
    +
    +
      -
    + setup: func(m mox, a *Aggregator) {
    - + + 269 -
    +
    +
      -
    + m.proverMock.On("Name").Return(proverName).Twice()
    - + + 270 -
    +
    +
      -
    + m.proverMock.On("ID").Return(proverID).Twice()
    - + + 271 -
    +
    +
      -
    + m.proverMock.On("Addr").Return("addr")
    - + + 272 -
    -   -
    +
    +
    + + + m.stateMock.On("GetProofsToAggregate", mock.MatchedBy(matchProverCtxFn), nil).Return(nil, nil, state.ErrNotFound).Once()
    - + + 273 -
    +
    +
      -
    + },
    - + + 274 -
    +
    +
      -
    + asserts: func(result bool, a *Aggregator, err error) {
    - + + 275 -
    +
    +
      -
    + assert.False(result)
    - - -
    -   -
    -
    +
    +
     
    - + + 277 -
    +
    +
      -
    + },
    - + + 278 -
    +
    +
      -
    + },
    - + + 279 -
    +
    +
      -
    + {
    - + + 280 -
    -   -
    +
    +
    + + + name: "getAndLockProofsToAggregate error updating proofs",
    - + + 281 -
    +
    +
      -
    + setup: func(m mox, a *Aggregator) {
    - + + 282 -
    +
    +
      -
    + m.proverMock.On("Name").Return(proverName).Twice()
    - + + 283 -
    +
    +
      -
    + m.proverMock.On("ID").Return(proverID).Twice()
    - - -
    -   -
    -
    +
    +
     
    - + + 285 -
    +
    +
      -
    + dbTx := &mocks.DbTxMock{}
    - + + 286 -
    +
    +
      -
    + dbTx.On("Rollback", mock.MatchedBy(matchProverCtxFn)).Return(nil).Once()
    - + + 287 -
    +
    +
      -
    + m.stateMock.On("BeginStateTransaction", mock.MatchedBy(matchProverCtxFn)).Return(dbTx, nil).Once()
    - + + 288 -
    -   -
    +
    +
    + + + m.stateMock.On("GetProofsToAggregate", mock.MatchedBy(matchProverCtxFn), nil).Return(&proof1, &proof2, nil).Once()
    - + + 289 -
    +
    +
      -
    + m.stateMock.
    - + + 290 -
    -   -
    +
    +
    + + + On("UpdateGeneratedProof", mock.MatchedBy(matchProverCtxFn), &proof1, dbTx).
    - + + 291 -
    +
    +
      -
    + Run(func(args mock.Arguments) {
    - + + 292 -
    +
    +
      -
    + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - + + 293 -
    +
    +
      -
    + }).
    - + +
     
    -
    +
    + 300 + +
      -
    + },
    - + + 301 -
    +
    +
      -
    + },
    - + + 302 -
    +
    +
      -
    + {
    - + + 303 -
    -   -
    +
    +
    + + + name: "AggregatedProof prover error",
    - + + 304 -
    +
    +
      -
    + setup: func(m mox, a *Aggregator) {
    - + + 305 -
    +
    +
      -
    + m.proverMock.On("Name").Return(proverName).Twice()
    - + + 306 -
    +
    +
      -
    + m.proverMock.On("ID").Return(proverID).Twice()
    - + +
     
    -
    +
    + 308 + +
      -
    + dbTx := &mocks.DbTxMock{}
    - + + 309 -
    +
    +
      -
    + lockProofsTxBegin := m.stateMock.On("BeginStateTransaction", mock.MatchedBy(matchProverCtxFn)).Return(dbTx, nil).Once()
    - + + 310 -
    +
    +
      -
    + lockProofsTxCommit := dbTx.On("Commit", mock.MatchedBy(matchProverCtxFn)).Return(nil).Once()
    - + + 311 -
    -   -
    +
    +
    + + + m.stateMock.On("GetProofsToAggregate", mock.MatchedBy(matchProverCtxFn), nil).Return(&proof1, &proof2, nil).Once()
    - + + 312 -
    +
    +
      -
    + proof1GeneratingTrueCall := m.stateMock.
    - + + 313 -
    -   -
    +
    +
    + + + On("UpdateGeneratedProof", mock.MatchedBy(matchProverCtxFn), &proof1, dbTx).
    - + + 314 -
    +
    +
      -
    + Run(func(args mock.Arguments) {
    - + + 315 -
    +
    +
      -
    + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - + + 316 -
    +
    +
      -
    + }).
    - + + 317 -
    +
    +
      -
    + Return(nil).
    - + + 318 -
    +
    +
      -
    + Once()
    - + + 319 -
    +
    +
      -
    + proof2GeneratingTrueCall := m.stateMock.
    - + + 320 -
    -   -
    +
    +
    + + + On("UpdateGeneratedProof", mock.MatchedBy(matchProverCtxFn), &proof2, dbTx).
    - + + 321 -
    +
    +
      -
    + Run(func(args mock.Arguments) {
    - + + 322 -
    +
    +
      -
    + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - + + 323 -
    +
    +
      -
    + }).
    - + +
     
    -
    +
    + 326 + +
      -
    + m.proverMock.On("AggregatedProof", proof1.Proof, proof2.Proof).Return(nil, errBanana).Once()
    - + + 327 -
    +
    +
      -
    + m.stateMock.On("BeginStateTransaction", mock.MatchedBy(matchAggregatorCtxFn)).Return(dbTx, nil).Once().NotBefore(lockProofsTxBegin)
    - + + 328 -
    +
    +
      -
    + m.stateMock.
    - + + 329 -
    -   -
    +
    +
    + + + On("UpdateGeneratedProof", mock.MatchedBy(matchAggregatorCtxFn), &proof1, dbTx).
    - + + 330 -
    +
    +
      -
    + Run(func(args mock.Arguments) {
    - + + 331 -
    +
    +
      -
    + assert.Nil(args[1].(*state.Proof).GeneratingSince)
    - + + 332 -
    +
    +
      -
    + }).
    - + +
     
    -
    +
    + 334 + +
      -
    + Once().
    - + + 335 -
    +
    +
      -
    + NotBefore(proof1GeneratingTrueCall)
    - + + 336 -
    +
    +
      -
    + m.stateMock.
    - + + 337 -
    -   -
    +
    +
    + + + On("UpdateGeneratedProof", mock.MatchedBy(matchAggregatorCtxFn), &proof2, dbTx).
    - + + 338 -
    +
    +
      -
    + Run(func(args mock.Arguments) {
    - + + 339 -
    +
    +
      -
    + assert.Nil(args[1].(*state.Proof).GeneratingSince)
    - + + 340 -
    +
    +
      -
    + }).
    - + +
     
    -
    +
    + 357 + +
      -
    + dbTx := &mocks.DbTxMock{}
    - + + 358 -
    +
    +
      -
    + lockProofsTxBegin := m.stateMock.On("BeginStateTransaction", mock.MatchedBy(matchProverCtxFn)).Return(dbTx, nil).Once()
    - + + 359 -
    +
    +
      -
    + lockProofsTxCommit := dbTx.On("Commit", mock.MatchedBy(matchProverCtxFn)).Return(nil).Once()
    - + + 360 -
    -   -
    +
    +
    + + + m.stateMock.On("GetProofsToAggregate", mock.MatchedBy(matchProverCtxFn), nil).Return(&proof1, &proof2, nil).Once()
    - + + 361 -
    +
    +
      -
    + proof1GeneratingTrueCall := m.stateMock.
    - + + 362 -
    -   -
    +
    +
    + + + On("UpdateGeneratedProof", mock.MatchedBy(matchProverCtxFn), &proof1, dbTx).
    - + + 363 -
    +
    +
      -
    + Run(func(args mock.Arguments) {
    - + + 364 -
    +
    +
      -
    + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - + + 365 -
    +
    +
      -
    + }).
    - + + 366 -
    +
    +
      -
    + Return(nil).
    - + + 367 -
    +
    +
      -
    + Once()
    - + + 368 -
    +
    +
      -
    + proof2GeneratingTrueCall := m.stateMock.
    - + + 369 -
    -   -
    +
    +
    + + + On("UpdateGeneratedProof", mock.MatchedBy(matchProverCtxFn), &proof2, dbTx).
    - + + 370 -
    +
    +
      -
    + Run(func(args mock.Arguments) {
    - + + 371 -
    +
    +
      -
    + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - + + 372 -
    +
    +
      -
    + }).
    - - -
    -   -
    -
    +
    +
     
    - + + 376 -
    +
    +
      -
    + m.proverMock.On("WaitRecursiveProof", mock.MatchedBy(matchProverCtxFn), proofID).Return("", errBanana).Once()
    - + + 377 -
    +
    +
      -
    + m.stateMock.On("BeginStateTransaction", mock.MatchedBy(matchAggregatorCtxFn)).Return(dbTx, nil).Once().NotBefore(lockProofsTxBegin)
    - + + 378 -
    +
    +
      -
    + m.stateMock.
    - + + 379 -
    -   -
    +
    +
    + + + On("UpdateGeneratedProof", mock.MatchedBy(matchAggregatorCtxFn), &proof1, dbTx).
    - + + 380 -
    +
    +
      -
    + Run(func(args mock.Arguments) {
    - + + 381 -
    +
    +
      -
    + assert.Nil(args[1].(*state.Proof).GeneratingSince)
    - + + 382 -
    +
    +
      -
    + }).
    - - -
    -   -
    -
    +
    +
     
    - + + 384 -
    +
    +
      -
    + Once().
    - + + 385 -
    +
    +
      -
    + NotBefore(proof1GeneratingTrueCall)
    - + + 386 -
    +
    +
      -
    + m.stateMock.
    - + + 387 -
    -   -
    +
    +
    + + + On("UpdateGeneratedProof", mock.MatchedBy(matchAggregatorCtxFn), &proof2, dbTx).
    - + + 388 -
    +
    +
      -
    + Run(func(args mock.Arguments) {
    - + + 389 -
    +
    +
      -
    + assert.Nil(args[1].(*state.Proof).GeneratingSince)
    - + + 390 -
    +
    +
      -
    + }).
    - - -
    -   -
    -
    +
    +
     
    - + + 399 -
    +
    +
      -
    + },
    - + + 400 -
    +
    +
      -
    + },
    - + + 401 -
    +
    +
      -
    + {
    - + + 402 -
    -   -
    +
    +
    + + + name: "unlockProofsToAggregate error after WaitRecursiveProof prover error",
    - + + 403 -
    +
    +
      -
    + setup: func(m mox, a *Aggregator) {
    - + + 404 -
    +
    +
      -
    + m.proverMock.On("Name").Return(proverName).Twice()
    - + + 405 -
    +
    +
      -
    + m.proverMock.On("ID").Return(proverID).Twice()
    - - -
    -   -
    -
    -
    -
    -
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/config/network.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    @@ -25,17 +25,16 @@
    +
     
    - 25 + 407
      -
    + dbTx := &mocks.DbTxMock{}
    - 26 + 408
      - type network string + lockProofsTxBegin := m.stateMock.On("BeginStateTransaction", mock.MatchedBy(matchProverCtxFn)).Return(dbTx, nil).Once()
    - 27 + 409
      -
    + dbTx.On("Commit", mock.MatchedBy(matchProverCtxFn)).Return(nil).Once()
    - 28 + + 410 +
    - - - const mainnet network = "mainnet" + + + m.stateMock.On("GetProofsToAggregate", mock.MatchedBy(matchProverCtxFn), nil).Return(&proof1, &proof2, nil).Once()
    - 29 + + 411 +
    - - - const testnet network = "testnet" +   + proof1GeneratingTrueCall := m.stateMock.
    - 30 + + 412 +
    - - - const cardona network = "cardona" + + + On("UpdateGeneratedProof", mock.MatchedBy(matchProverCtxFn), &proof1, dbTx).
    - 31 + 413
      - const custom network = "custom" + Run(func(args mock.Arguments) {
    - 32 + 414
      -
    + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - 33 + 415
      - // GenesisFromJSON is the config file for network_custom + }).
    - 34 + 416
      - type GenesisFromJSON struct { + Return(nil).
    - 35 + 417
      - // L1: root hash of the genesis block + Once()
    - 36 + 418
      - Root string `json:"root"` -
    -
    - 37 - -
    - - - // L1: block number of the genesis block + m.stateMock.
    - 38 + + 419 +
    - - - GenesisBlockNum uint64 `json:"genesisBlockNumber"` -
    -
    - - -
    -   -
    -
    -
    - - -
    -   -
    + + + On("UpdateGeneratedProof", mock.MatchedBy(matchProverCtxFn), &proof2, dbTx).
    - 39 + 420
      - // L2: List of states contracts used to populate merkle tree at initial state + Run(func(args mock.Arguments) {
    - 40 + 421
      - Genesis []genesisAccountFromJSON `json:"genesis"` + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - 41 + 422
      - // L1: configuration of the network + }).
    -
    @@ -60,12 +59,6 @@
    +
     
    - 60 + 426
      - func (cfg *Config) loadNetworkConfig(ctx *cli.Context) { + m.proverMock.On("WaitRecursiveProof", mock.MatchedBy(matchProverCtxFn), proofID).Return("", errBanana).Once()
    - 61 + 427
      - var networkJSON string + m.stateMock.On("BeginStateTransaction", mock.MatchedBy(matchAggregatorCtxFn)).Return(dbTx, nil).Once().NotBefore(lockProofsTxBegin)
    - 62 + 428
      - switch ctx.String(FlagNetwork) { -
    -
    - 63 - -
    - - - case string(mainnet): -
    -
    - 64 - -
    - - - networkJSON = MainnetNetworkConfigJSON -
    -
    - 65 - -
    - - - case string(testnet): -
    -
    - 66 - -
    - - - networkJSON = TestnetNetworkConfigJSON -
    -
    - 67 - -
    - - - case string(cardona): + m.stateMock.
    - 68 + + 429 +
    - - - networkJSON = CardonaNetworkConfigJSON + + + On("UpdateGeneratedProof", mock.MatchedBy(matchAggregatorCtxFn), &proof1, dbTx).
    - 69 + 430
      - case string(custom): + Run(func(args mock.Arguments) {
    - 70 + 431
      - var err error + assert.Nil(args[1].(*state.Proof).GeneratingSince)
    - 71 + 432
      - cfgPath := ctx.String(FlagCustomNetwork) + }).
    -
    @@ -74,7 +67,7 @@
    +
     
    - 74 + 441
      - panic(err.Error()) + },
    - 75 + 442
      - } + },
    - 76 + 443
      - default: + {
    - 77 + + 444 +
    - - - log.Fatalf("unsupported --network value. Must be one of: [%s, %s, %s]", mainnet, testnet, cardona, custom) + + + name: "rollback after DeleteGeneratedProofs error in db transaction",
    - 78 + 445
      - } + setup: func(m mox, a *Aggregator) {
    - 79 + 446
      - config, err := LoadGenesisFromJSONString(networkJSON) + m.proverMock.On("Name").Return(proverName).Twice()
    - 80 + 447
      - if err != nil { + m.proverMock.On("ID").Return(proverID).Twice()
    -
    @@ -122,9 +115,10 @@
    +
     
    - 122 + 449
      -
    + dbTx := &mocks.DbTxMock{}
    - 123 + 450
      - cfg.L1Config = cfgJSON.L1Config + lockProofsTxBegin := m.stateMock.On("BeginStateTransaction", mock.MatchedBy(matchProverCtxFn)).Return(dbTx, nil).Twice()
    - 124 + 451
      - cfg.Genesis = state.Genesis{ + lockProofsTxCommit := dbTx.On("Commit", mock.MatchedBy(matchProverCtxFn)).Return(nil).Once()
    - 125 + + 452 +
    - - - BlockNumber: cfgJSON.GenesisBlockNum, + + + m.stateMock.On("GetProofsToAggregate", mock.MatchedBy(matchProverCtxFn), nil).Return(&proof1, &proof2, nil).Once()
    - 126 + + 453 +
    - - - Root: common.HexToHash(cfgJSON.Root), +   + proof1GeneratingTrueCall := m.stateMock.
    - 127 + + 454 +
    - - - Actions: []*state.GenesisAction{}, -
    -
    - - -
    -   -
    + + + On("UpdateGeneratedProof", mock.MatchedBy(matchProverCtxFn), &proof1, dbTx).
    - 128 + 455
      - } + Run(func(args mock.Arguments) {
    - 129 + 456
      -
    + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - 130 + 457
      - for _, account := range cfgJSON.Genesis { -
    -
    -
    + }).
    -
    -
    - - - - - - - - - - - - - + + + - - - - - - + + + @@ -29265,122 +30173,72 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - @@ -29390,72 +30248,72 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -29465,685 +30323,672 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - -
    -
     
    - 25 + 458
      -
    + Return(nil).
    - 26 + 459
      - type network string + Once()
    - 27 + 460
      -
    -
    -
    - - -
    -   -
    -
    -
    - - -
    -   -
    + proof2GeneratingTrueCall := m.stateMock.
    - + + 461 -
    -   -
    +
    +
    + + + On("UpdateGeneratedProof", mock.MatchedBy(matchProverCtxFn), &proof2, dbTx).
    - 28 + 462
      - const custom network = "custom" + Run(func(args mock.Arguments) {
    - 29 + 463
      -
    + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - 30 + 464
      - // GenesisFromJSON is the config file for network_custom + }).
    +
     
    +
    - 31 + 466
      - type GenesisFromJSON struct { + Once()
    - 32 + 467
      - // L1: root hash of the genesis block + m.proverMock.On("AggregatedProof", proof1.Proof, proof2.Proof).Return(&proofID, nil).Once()
    - 33 + 468
      - Root string `json:"root"` + m.proverMock.On("WaitRecursiveProof", mock.MatchedBy(matchProverCtxFn), proofID).Return(recursiveProof, nil).Once()
    - 34 + 469
    + - // L1: block number in which the rollup was created + m.stateMock.On("DeleteGeneratedProofs", mock.MatchedBy(matchProverCtxFn), proof1.BatchNumber, proof2.BatchNumberFinal, dbTx).Return(errBanana).Once()
    - 35 + + 470 +
    - + - RollupCreationBlockNum uint64 `json:"rollupCreationBlockNumber"` +   + dbTx.On("Rollback", mock.MatchedBy(matchProverCtxFn)).Return(nil).Once()
    - 36 + + 471 +
    - + - // L1: block number in which the rollup manager was created +   + m.stateMock.On("BeginStateTransaction", mock.MatchedBy(matchAggregatorCtxFn)).Return(dbTx, nil).Once().NotBefore(lockProofsTxBegin)
    - 37 + + 472 + +
    +   + m.stateMock. +
    +
    + 473 +
    + - RollupManagerCreationBlockNum uint64 `json:"rollupManagerCreationBlockNumber"` + On("UpdateGeneratedProof", mock.MatchedBy(matchAggregatorCtxFn), &proof1, dbTx).
    - 38 + 474
      - // L2: List of states contracts used to populate merkle tree at initial state + Run(func(args mock.Arguments) {
    - 39 + 475
      - Genesis []genesisAccountFromJSON `json:"genesis"` + assert.Nil(args[1].(*state.Proof).GeneratingSince)
    - 40 + 476
      - // L1: configuration of the network + }).
    - 59 + 478
      - func (cfg *Config) loadNetworkConfig(ctx *cli.Context) { + Once().
    - 60 + 479
      - var networkJSON string + NotBefore(proof1GeneratingTrueCall)
    - 61 + 480
      - switch ctx.String(FlagNetwork) { -
    -
    - - -
    -   -
    -
    -
    - - -
    -   -
    -
    -
    - - -
    -   -
    -
    -
    - - -
    -   -
    -
    -
    - - -
    -   -
    + m.stateMock.
    - + + 481 -
    -   -
    +
    +
    + + + On("UpdateGeneratedProof", mock.MatchedBy(matchAggregatorCtxFn), &proof2, dbTx).
    - 62 + 482
      - case string(custom): + Run(func(args mock.Arguments) {
    - 63 + 483
      - var err error + assert.Nil(args[1].(*state.Proof).GeneratingSince)
    - 64 + 484
      - cfgPath := ctx.String(FlagCustomNetwork) + }).
    - 67 + 493
      - panic(err.Error()) + },
    - 68 + 494
      - } + },
    - 69 + 495
      - default: + {
    - 70 + 496
    + - log.Fatalf("unsupported --network value. Must be %s", custom) + name: "rollback after AddGeneratedProof error in db transaction",
    - 71 + 497
      - } + setup: func(m mox, a *Aggregator) {
    - 72 + 498
      - config, err := LoadGenesisFromJSONString(networkJSON) + m.proverMock.On("Name").Return(proverName).Twice()
    - 73 + 499
      - if err != nil { + m.proverMock.On("ID").Return(proverID).Twice()
    - 115 + 501
      -
    + dbTx := &mocks.DbTxMock{}
    - 116 + 502
      - cfg.L1Config = cfgJSON.L1Config + lockProofsTxBegin := m.stateMock.On("BeginStateTransaction", mock.MatchedBy(matchProverCtxFn)).Return(dbTx, nil).Twice()
    - 117 + 503
      - cfg.Genesis = state.Genesis{ + lockProofsTxCommit := dbTx.On("Commit", mock.MatchedBy(matchProverCtxFn)).Return(nil).Once()
    - 118 + 504
    + - RollupBlockNumber: cfgJSON.RollupCreationBlockNum, + m.stateMock.On("GetProofsToAggregate", mock.MatchedBy(matchProverCtxFn), nil).Return(&proof1, &proof2, nil).Once()
    - 119 + + 505 +
    - + - RollupManagerBlockNumber: cfgJSON.RollupManagerCreationBlockNum, +   + proof1GeneratingTrueCall := m.stateMock.
    - 120 + 506
    + - Root: common.HexToHash(cfgJSON.Root), + On("UpdateGeneratedProof", mock.MatchedBy(matchProverCtxFn), &proof1, dbTx).
    - 121 + + 507 +
    - + - Actions: []*state.GenesisAction{}, +   + Run(func(args mock.Arguments) {
    - 122 + 508
      - } + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - 123 + 509
      -
    + }).
    - 124 + 510
      - for _, account := range cfgJSON.Genesis { -
    -
    -
    + Return(nil).
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/config/network_test.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - + + + - - - + + + - - - - - - - - -
    -
    @@ -14,18 +13,6 @@
    - 14 + 511
      - "github.com/urfave/cli/v2" + Once()
    - 15 + 512
      - ) + proof2GeneratingTrueCall := m.stateMock.
    - 16 + + 513 +
    -   -
    + + + On("UpdateGeneratedProof", mock.MatchedBy(matchProverCtxFn), &proof2, dbTx).
    - 17 + + 514 +
    - - - func TestCardona(t *testing.T) { +   + Run(func(args mock.Arguments) {
    - 18 + + 515 +
    - - - cfg := Config{} +   + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - 19 + + 516 +
    - - - fs := flag.NewFlagSet("", flag.ExitOnError) +   + }).
    - 20 + +
     
    +
    + 518 +
    - - - fs.String(FlagNetwork, string(cardona), string(cardona)) +   + Once()
    - 21 + + 519 +
    - - - err := fs.Set(FlagNetwork, string(cardona)) +   + m.proverMock.On("AggregatedProof", proof1.Proof, proof2.Proof).Return(&proofID, nil).Once()
    - 22 + + 520 +
    - - - require.NoError(t, err) +   + m.proverMock.On("WaitRecursiveProof", mock.MatchedBy(matchProverCtxFn), proofID).Return(recursiveProof, nil).Once()
    - 23 + + 521 +
    - - - app := cli.NewApp() + + + m.stateMock.On("DeleteGeneratedProofs", mock.MatchedBy(matchProverCtxFn), proof1.BatchNumber, proof2.BatchNumberFinal, dbTx).Return(nil).Once()
    - 24 + + 522 +
    - - - ctx := cli.NewContext(app, fs, nil) + + + m.stateMock.On("AddGeneratedProof", mock.MatchedBy(matchProverCtxFn), mock.Anything, dbTx).Return(errBanana).Once()
    - 25 + + 523 +
    - - -
    +   + dbTx.On("Rollback", mock.MatchedBy(matchProverCtxFn)).Return(nil).Once()
    - 26 + + 524 +
    - - - log.Info("flag=", ctx.String(FlagNetwork)) +   + m.stateMock.On("BeginStateTransaction", mock.MatchedBy(matchAggregatorCtxFn)).Return(dbTx, nil).Once().NotBefore(lockProofsTxBegin)
    - 27 + + 525 +
    - - - cfg.loadNetworkConfig(ctx) +   + m.stateMock.
    - 28 + + 526 +
    - - - } + + + On("UpdateGeneratedProof", mock.MatchedBy(matchAggregatorCtxFn), &proof1, dbTx).
    - 29 + 527
      - func TestLoadCustomNetworkConfig(t *testing.T) { + Run(func(args mock.Arguments) {
    - 30 + 528
      - tcs := []struct { + assert.Nil(args[1].(*state.Proof).GeneratingSince)
    - 31 + 529
      - description string + }).
    -
    @@ -37,7 +24,8 @@
    +
     
    - 37 + 531
      - description: "happy path", + Once().
    - 38 + 532
      - inputConfigStr: `{ + NotBefore(proof1GeneratingTrueCall)
    - 39 + 533
      - "root": "0xBEEF", + m.stateMock.
    - 40 + + 534 +
    - - - "genesisBlockNumber": 69, + + + On("UpdateGeneratedProof", mock.MatchedBy(matchAggregatorCtxFn), &proof2, dbTx).
    - + + 535 -
    +
    +
      -
    + Run(func(args mock.Arguments) {
    - 41 + 536
      - "l1Config" : { + assert.Nil(args[1].(*state.Proof).GeneratingSince)
    - 42 + 537
      - "chainId": 420, + }).
    +
     
    +
    - 43 + 554
      - "polygonZkEVMAddress": "0xc949254d682d8c9ad5682521675b8f43b102aec4", + dbTx := &mocks.DbTxMock{}
    -
    @@ -89,8 +77,9 @@
    -
    - 89 + 555
      - GlobalExitRootManagerAddr: common.HexToAddress("0xc949254d682d8c9ad5682521675b8f43b102aec4"), + m.stateMock.On("BeginStateTransaction", mock.MatchedBy(matchProverCtxFn)).Return(dbTx, nil).Twice()
    - 90 + 556
      - }, + dbTx.On("Commit", mock.MatchedBy(matchProverCtxFn)).Return(nil).Twice() +
    +
    + 557 + +
    + + + m.stateMock.On("GetProofsToAggregate", mock.MatchedBy(matchProverCtxFn), nil).Return(&proof1, &proof2, nil).Once()
    - 91 + 558
      - Genesis: state.Genesis{ + m.stateMock.
    - 92 + + 559 +
    - - - Root: common.HexToHash("0xBEEF"), + + + On("UpdateGeneratedProof", mock.MatchedBy(matchProverCtxFn), &proof1, dbTx).
    - 93 + + 560 +
    - - - BlockNumber: 69, +   + Run(func(args mock.Arguments) {
    - + + 561 -
    +
    +
      -
    + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - 94 + 562
      - Actions: []*state.GenesisAction{ + }).
    - 95 + 563
      - { + Return(nil).
    - 96 + 564
      - Address: "0xc949254d682d8c9ad5682521675b8f43b102aec4", -
    -
    -
    + Once()
    -
    -
    - - - - - + + + - - - + - + + - - - - - - - - - - - - - - - - - - - - @@ -30153,82 +30998,72 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - @@ -30238,2065 +31073,2097 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - -
    -
     
    - 13 + 565
      - "github.com/urfave/cli/v2" + m.stateMock. +
    +
    + 566 + +
    + + + On("UpdateGeneratedProof", mock.MatchedBy(matchProverCtxFn), &proof2, dbTx).
    - 14 + 567
      - ) + Run(func(args mock.Arguments) {
    - 15 + 568
      -
    + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - + + 569 -
    +
    +
      -
    + }).
    - + +
     
    -
    +
    + 571 + +
      -
    + Once()
    - + + 572 -
    +
    +
      -
    + m.proverMock.On("AggregatedProof", proof1.Proof, proof2.Proof).Return(&proofID, nil).Once()
    - + + 573 -
    +
    +
      -
    + m.proverMock.On("WaitRecursiveProof", mock.MatchedBy(matchProverCtxFn), proofID).Return(recursiveProof, nil).Once()
    - + + 574 -
    -   -
    +
    +
    + + + m.stateMock.On("DeleteGeneratedProofs", mock.MatchedBy(matchProverCtxFn), proof1.BatchNumber, proof2.BatchNumberFinal, dbTx).Return(nil).Once()
    - + + 575 -
    +
    +
      -
    + expectedInputProver := map[string]interface{}{
    - + + 576 -
    +
    +
      -
    + "recursive_proof_1": proof1.Proof,
    - + + 577 -
    +
    +
      -
    + "recursive_proof_2": proof2.Proof,
    - + + 578 -
    +
    +
      -
    + }
    - + + 579 -
    +
    +
      -
    + b, err := json.Marshal(expectedInputProver)
    - + + 580 -
    +
    +
      -
    + require.NoError(err)
    - + + 581 -
    -   -
    +
    +
    + + + m.stateMock.On("AddGeneratedProof", mock.MatchedBy(matchProverCtxFn), mock.Anything, dbTx).Run(
    - 16 + 582
      - func TestLoadCustomNetworkConfig(t *testing.T) { + func(args mock.Arguments) {
    - 17 + 583
      - tcs := []struct { + proof := args[1].(*state.Proof)
    - 18 + 584
      - description string + assert.Equal(proof1.BatchNumber, proof.BatchNumber)
    - 24 + 590
      - description: "happy path", + assert.InDelta(time.Now().Unix(), proof.GeneratingSince.Unix(), float64(time.Second))
    - 25 + 591
      - inputConfigStr: `{ + },
    - 26 + 592
      - "root": "0xBEEF", + ).Return(nil).Once()
    - 27 + 593
    + - "rollupCreationBlockNumber": 69, -
    -
    - 28 - -
    - + - "rollupManagerCreationBlockNumber": 60, + m.stateMock.On("UpdateGeneratedProof", mock.MatchedBy(matchAggregatorCtxFn), mock.Anything, nil).Run(
    - 29 + 594
      - "l1Config" : { + func(args mock.Arguments) {
    - 30 + 595
      - "chainId": 420, + proof := args[1].(*state.Proof)
    - 31 + 596
      - "polygonZkEVMAddress": "0xc949254d682d8c9ad5682521675b8f43b102aec4", + assert.Equal(proof1.BatchNumber, proof.BatchNumber)
    - 77 + 618
      - GlobalExitRootManagerAddr: common.HexToAddress("0xc949254d682d8c9ad5682521675b8f43b102aec4"), + dbTx := &mocks.DbTxMock{}
    - 78 + 619
      - }, + m.stateMock.On("BeginStateTransaction", mock.MatchedBy(matchProverCtxFn)).Return(dbTx, nil).Twice()
    - 79 + 620
      - Genesis: state.Genesis{ + dbTx.On("Commit", mock.MatchedBy(matchProverCtxFn)).Return(nil).Twice()
    - 80 + 621
    + - Root: common.HexToHash("0xBEEF"), + m.stateMock.On("GetProofsToAggregate", mock.MatchedBy(matchProverCtxFn), nil).Return(&proof1, &proof2, nil).Once()
    - 81 + + 622 +
    - + - RollupBlockNumber: 69, +   + m.stateMock.
    - 82 + + 623 +
    + - RollupManagerBlockNumber: 60, + On("UpdateGeneratedProof", mock.MatchedBy(matchProverCtxFn), &proof1, dbTx).
    - 83 + 624
      - Actions: []*state.GenesisAction{ + Run(func(args mock.Arguments) {
    - 84 + 625
      - { + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - 85 + 626
      - Address: "0xc949254d682d8c9ad5682521675b8f43b102aec4", -
    -
    -
    + }).
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/config/testnetgenesis.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - -
    -
    @@ -1,108 +0,0 @@
    - 1 + + 627 +
    - - - package config +   + Return(nil).
    - 2 + + 628 +
    - - -
    +   + Once()
    - 3 + + 629 +
    - - - // TestnetNetworkConfigJSON is the hardcoded network configuration to be used for the official mainnet setup +   + m.stateMock.
    - 4 + + 630 +
    - - - const TestnetNetworkConfigJSON = ` + + + On("UpdateGeneratedProof", mock.MatchedBy(matchProverCtxFn), &proof2, dbTx).
    - 5 + + 631 +
    - - - { +   + Run(func(args mock.Arguments) {
    - 6 + + 632 +
    - - - "l1Config" : { +   + assert.NotNil(args[1].(*state.Proof).GeneratingSince)
    - 7 + + 633 +
    - - - "chainId": 5, +   + }).
    - 8 - -
    - - - "polygonZkEVMAddress": "0xa997cfD539E703921fD1e3Cf25b4c241a27a4c7A", -
    +
    +
     
    - 9 + + 635 +
    - - - "polTokenAddress": "0x1319D23c2F7034F52Eb07399702B040bA278Ca49", +   + Once()
    - 10 + + 636 +
    - - - "polygonZkEVMGlobalExitRootAddress": "0x4d9427DCA0406358445bC0a8F88C26b704004f74" +   + m.proverMock.On("AggregatedProof", proof1.Proof, proof2.Proof).Return(&proofID, nil).Once()
    - 11 + + 637 +
    - - - }, +   + m.proverMock.On("WaitRecursiveProof", mock.MatchedBy(matchProverCtxFn), proofID).Return(recursiveProof, nil).Once()
    - 12 + + 638 +
    - - - "root": "0x13a14c4a8288e782863d7ce916d224546c69dc428fbfa7115a0cc33a27a05b26", + + + m.stateMock.On("DeleteGeneratedProofs", mock.MatchedBy(matchProverCtxFn), proof1.BatchNumber, proof2.BatchNumberFinal, dbTx).Return(nil).Once()
    - 13 + + 639 +
    - - - "genesisBlockNumber": 8572998, +   + expectedInputProver := map[string]interface{}{
    - 14 + + 640 +
    - - - "genesis": [ +   + "recursive_proof_1": proof1.Proof,
    - 15 + + 641 +
    - - - { +   + "recursive_proof_2": proof2.Proof,
    - 16 + + 642 +
    - - - "contractName": "PolygonZkEVMDeployer", +   + }
    - 17 + + 643 +
    - - - "balance": "0", +   + b, err := json.Marshal(expectedInputProver)
    - 18 + + 644 +
    - - - "nonce": "4", +   + require.NoError(err)
    - 19 + + 645 +
    - - - "address": "0x39877a0c3cd148476DaA2475c77c478C62eC7509", + + + m.stateMock.On("AddGeneratedProof", mock.MatchedBy(matchProverCtxFn), mock.Anything, dbTx).Run(
    - 20 + + 646 +
    - - - "bytecode": "0x6080604052600436106100705760003560e01c8063715018a61161004e578063715018a6146100e65780638da5cb5b146100fb578063e11ae6cb14610126578063f2fde38b1461013957600080fd5b80632b79805a146100755780634a94d4871461008a5780636d07dbf81461009d575b600080fd5b610088610083366004610927565b610159565b005b6100886100983660046109c7565b6101cb565b3480156100a957600080fd5b506100bd6100b8366004610a1e565b61020d565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b50610088610220565b34801561010757600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100bd565b610088610134366004610a40565b610234565b34801561014557600080fd5b50610088610154366004610a90565b61029b565b610161610357565b600061016e8585856103d8565b905061017a8183610537565b5060405173ffffffffffffffffffffffffffffffffffffffff821681527fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a15050505050565b6101d3610357565b6101de83838361057b565b506040517f25adb19089b6a549831a273acdf7908cff8b7ee5f551f8d1d37996cf01c5df5b90600090a1505050565b600061021983836105a9565b9392505050565b610228610357565b61023260006105b6565b565b61023c610357565b60006102498484846103d8565b60405173ffffffffffffffffffffffffffffffffffffffff821681529091507fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a150505050565b6102a3610357565b73ffffffffffffffffffffffffffffffffffffffff811661034b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610354816105b6565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610232576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610342565b600083471015610444576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e63650000006044820152606401610342565b81516000036104af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f6044820152606401610342565b8282516020840186f5905073ffffffffffffffffffffffffffffffffffffffff8116610219576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f79000000000000006044820152606401610342565b6060610219838360006040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c6564000081525061062b565b60606105a1848484604051806060016040528060298152602001610b3d6029913961062b565b949350505050565b6000610219838330610744565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060824710156106bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610342565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516106e69190610acf565b60006040518083038185875af1925050503d8060008114610723576040519150601f19603f3d011682016040523d82523d6000602084013e610728565b606091505b50915091506107398783838761076e565b979650505050505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b606083156108045782516000036107fd5773ffffffffffffffffffffffffffffffffffffffff85163b6107fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610342565b50816105a1565b6105a183838151156108195781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103429190610aeb565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f83011261088d57600080fd5b813567ffffffffffffffff808211156108a8576108a861084d565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156108ee576108ee61084d565b8160405283815286602085880101111561090757600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000806080858703121561093d57600080fd5b8435935060208501359250604085013567ffffffffffffffff8082111561096357600080fd5b61096f8883890161087c565b9350606087013591508082111561098557600080fd5b506109928782880161087c565b91505092959194509250565b803573ffffffffffffffffffffffffffffffffffffffff811681146109c257600080fd5b919050565b6000806000606084860312156109dc57600080fd5b6109e58461099e565b9250602084013567ffffffffffffffff811115610a0157600080fd5b610a0d8682870161087c565b925050604084013590509250925092565b60008060408385031215610a3157600080fd5b50508035926020909101359150565b600080600060608486031215610a5557600080fd5b8335925060208401359150604084013567ffffffffffffffff811115610a7a57600080fd5b610a868682870161087c565b9150509250925092565b600060208284031215610aa257600080fd5b6102198261099e565b60005b83811015610ac6578181015183820152602001610aae565b50506000910152565b60008251610ae1818460208701610aab565b9190910192915050565b6020815260008251806020840152610b0a816040850160208701610aab565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a26469706673582212200b8e3cd6bd762444a7eeff86e1cfcd7e1ce9524b715dcb70b2a4c2b70fd5188464736f6c63430008110033", +   + func(args mock.Arguments) {
    - 21 + + 647 +
    - - - "storage": { +   + proof := args[1].(*state.Proof)
    - 22 + + 648 +
    - - - "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000a0b02b28920812324f1cc3255bd8840867d3f227" +   + assert.Equal(proof1.BatchNumber, proof.BatchNumber)
    - 23 + +
     
    +
    + 660 +
    - - - } +   + m.etherman.On("GetLatestVerifiedBatchNum").Return(uint64(42), nil).Once()
    - 24 + + 661 +
    - - - }, +   + // make tryBuildFinalProof fail ASAP
    - 25 + + 662 +
    - - - { +   + m.stateMock.On("GetLastVerifiedBatch", mock.MatchedBy(matchProverCtxFn), nil).Return(nil, errBanana).Once().NotBefore(isSyncedCall)
    - 26 + + 663 +
    - - - "contractName": "ProxyAdmin", + + + m.stateMock.On("UpdateGeneratedProof", mock.MatchedBy(matchAggregatorCtxFn), mock.Anything, nil).Run(
    - 27 + + 664 +
    - - - "balance": "0", +   + func(args mock.Arguments) {
    - 28 + + 665 +
    - - - "nonce": "1", +   + proof := args[1].(*state.Proof)
    - 29 + + 666 +
    - - - "address": "0x40797c2f93298a44a893F43EdF1B33B63d7BA333", +   + assert.Equal(proof1.BatchNumber, proof.BatchNumber)
    - 30 + +
     
    +
    + 686 +
    - - - "bytecode": "0x60806040526004361061007b5760003560e01c80639623609d1161004e5780639623609d1461012b57806399a88ec41461013e578063f2fde38b1461015e578063f3b7dead1461017e57600080fd5b8063204e1c7a14610080578063715018a6146100c95780637eff275e146100e05780638da5cb5b14610100575b600080fd5b34801561008c57600080fd5b506100a061009b366004610608565b61019e565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100d557600080fd5b506100de610255565b005b3480156100ec57600080fd5b506100de6100fb36600461062c565b610269565b34801561010c57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100a0565b6100de610139366004610694565b6102f7565b34801561014a57600080fd5b506100de61015936600461062c565b61038c565b34801561016a57600080fd5b506100de610179366004610608565b6103e8565b34801561018a57600080fd5b506100a0610199366004610608565b6104a4565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907f5c60da1b00000000000000000000000000000000000000000000000000000000815260040190565b600060405180830381855afa9150503d8060008114610225576040519150601f19603f3d011682016040523d82523d6000602084013e61022a565b606091505b50915091508161023957600080fd5b8080602001905181019061024d9190610788565b949350505050565b61025d6104f0565b6102676000610571565b565b6102716104f0565b6040517f8f28397000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690638f283970906024015b600060405180830381600087803b1580156102db57600080fd5b505af11580156102ef573d6000803e3d6000fd5b505050505050565b6102ff6104f0565b6040517f4f1ef28600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690634f1ef28690349061035590869086906004016107a5565b6000604051808303818588803b15801561036e57600080fd5b505af1158015610382573d6000803e3d6000fd5b5050505050505050565b6103946104f0565b6040517f3659cfe600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690633659cfe6906024016102c1565b6103f06104f0565b73ffffffffffffffffffffffffffffffffffffffff8116610498576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6104a181610571565b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907ff851a44000000000000000000000000000000000000000000000000000000000815260040190565b60005473ffffffffffffffffffffffffffffffffffffffff163314610267576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161048f565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b73ffffffffffffffffffffffffffffffffffffffff811681146104a157600080fd5b60006020828403121561061a57600080fd5b8135610625816105e6565b9392505050565b6000806040838503121561063f57600080fd5b823561064a816105e6565b9150602083013561065a816105e6565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000606084860312156106a957600080fd5b83356106b4816105e6565b925060208401356106c4816105e6565b9150604084013567ffffffffffffffff808211156106e157600080fd5b818601915086601f8301126106f557600080fd5b81358181111561070757610707610665565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561074d5761074d610665565b8160405282815289602084870101111561076657600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b60006020828403121561079a57600080fd5b8151610625816105e6565b73ffffffffffffffffffffffffffffffffffffffff8316815260006020604081840152835180604085015260005b818110156107ef578581018301518582016060015282016107d3565b5060006060828601015260607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010192505050939250505056fea2646970667358221220babd4ff1f5daee002b96cc86d8bb6c2c2c210ae3132df5ea384713352f7f15fe64736f6c63430008110033", +   + ethTxManager := mocks.NewEthTxManager(t)
    - 31 + + 687 +
    - - - "storage": { +   + etherman := mocks.NewEtherman(t)
    - 32 + + 688 +
    - - - "0x0000000000000000000000000000000000000000000000000000000000000000": "0x00000000000000000000000002245d7b6cb0b6870d1e28ac877ee355b9588869" +   + proverMock := mocks.NewProverMock(t)
    - 33 + + 689 +
    - - - } + + + a, err := New(cfg, stateMock, ethTxManager, etherman, nil, nil)
    - 34 + + 690 +
    - - - }, +   + require.NoError(err)
    - 35 + + 691 +
    - - - { +   + aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck
    - 36 + + 692 +
    - - - "contractName": "PolygonZkEVMBridge implementation", +   + a.ctx, a.exit = context.WithCancel(aggregatorCtx)
    - 37 + +
     
    +
    + 701 +
    - - - "balance": "0", +   + }
    - 38 + + 702 +
    - - - "nonce": "1", +   + a.resetVerifyProofTime()
    - 39 + + 703 +
    - - - "address": "0x39e780D8800f7396e8B7530A8925B14025AedC77", +   +
    - 40 + + 704 +
    - - - "bytecode": "0x6080604052600436106200019f5760003560e01c8063647c576c11620000e7578063be5831c71162000089578063dbc169761162000060578063dbc169761462000639578063ee25560b1462000651578063fb570834146200068257600080fd5b8063be5831c714620005ae578063cd58657914620005ea578063d02103ca146200060157600080fd5b80639e34070f11620000be5780639e34070f146200050a578063aaa13cc2146200054f578063bab161bf146200057457600080fd5b8063647c576c146200048657806379e2cf9714620004ab57806381b1c17414620004c357600080fd5b80632d2c9d94116200015157806334ac9cf2116200012857806334ac9cf2146200034b5780633ae05047146200037a5780633e197043146200039257600080fd5b80632d2c9d9414620002765780632dfdf0b5146200029b578063318aee3d14620002c257600080fd5b806322e95f2c116200018657806322e95f2c14620001ef578063240ff378146200023a5780632cffd02e146200025157600080fd5b806315064c9614620001a45780632072f6c514620001d5575b600080fd5b348015620001b157600080fd5b50606854620001c09060ff1681565b60405190151581526020015b60405180910390f35b348015620001e257600080fd5b50620001ed620006a7565b005b348015620001fc57600080fd5b50620002146200020e366004620032db565b62000705565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001620001cc565b620001ed6200024b36600462003372565b620007a8565b3480156200025e57600080fd5b50620001ed6200027036600462003409565b620009d0565b3480156200028357600080fd5b50620001ed6200029536600462003409565b62000f74565b348015620002a857600080fd5b50620002b360535481565b604051908152602001620001cc565b348015620002cf57600080fd5b5062000319620002e1366004620034ef565b606b6020526000908152604090205463ffffffff811690640100000000900473ffffffffffffffffffffffffffffffffffffffff1682565b6040805163ffffffff909316835273ffffffffffffffffffffffffffffffffffffffff909116602083015201620001cc565b3480156200035857600080fd5b50606c54620002149073ffffffffffffffffffffffffffffffffffffffff1681565b3480156200038757600080fd5b50620002b362001178565b3480156200039f57600080fd5b50620002b3620003b136600462003526565b6040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b3480156200049357600080fd5b50620001ed620004a5366004620035b0565b6200125e565b348015620004b857600080fd5b50620001ed620014ad565b348015620004d057600080fd5b5062000214620004e236600462003600565b606a6020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b3480156200051757600080fd5b50620001c06200052936600462003600565b600881901c600090815260696020526040902054600160ff9092169190911b9081161490565b3480156200055c57600080fd5b50620002146200056e3660046200361a565b620014e7565b3480156200058157600080fd5b506068546200059890610100900463ffffffff1681565b60405163ffffffff9091168152602001620001cc565b348015620005bb57600080fd5b506068546200059890790100000000000000000000000000000000000000000000000000900463ffffffff1681565b620001ed620005fb366004620036ce565b620016d3565b3480156200060e57600080fd5b50606854620002149065010000000000900473ffffffffffffffffffffffffffffffffffffffff1681565b3480156200064657600080fd5b50620001ed62001c37565b3480156200065e57600080fd5b50620002b36200067036600462003600565b60696020526000908152604090205481565b3480156200068f57600080fd5b50620001c0620006a136600462003770565b62001c93565b606c5473ffffffffffffffffffffffffffffffffffffffff163314620006f9576040517fe2e8106b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200070362001d7c565b565b6040805160e084901b7fffffffff0000000000000000000000000000000000000000000000000000000016602080830191909152606084901b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602483015282516018818403018152603890920183528151918101919091206000908152606a909152205473ffffffffffffffffffffffffffffffffffffffff165b92915050565b60685460ff1615620007e6576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60685463ffffffff8681166101009092041614806200080c5750600263ffffffff861610155b1562000844576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b6001606860019054906101000a900463ffffffff163388883488886053546040516200089a9998979695949392919062003806565b60405180910390a1620009b8620009b26001606860019054906101000a900463ffffffff16338989348989604051620008d592919062003881565b60405180910390206040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b62001e10565b8215620009c957620009c962001f27565b5050505050565b60685460ff161562000a0e576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000a258b8b8b8b8b8b8b8b8b8b8b600062001ffc565b73ffffffffffffffffffffffffffffffffffffffff861662000b01576040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff861690859060405162000a7a9190620038e6565b60006040518083038185875af1925050503d806000811462000ab9576040519150601f19603f3d011682016040523d82523d6000602084013e62000abe565b606091505b505090508062000afa576040517f6747a28800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5062000efc565b60685463ffffffff61010090910481169088160362000b435762000b3d73ffffffffffffffffffffffffffffffffffffffff87168585620021ed565b62000efc565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b1660208201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b166024820152600090603801604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291815281516020928301206000818152606a90935291205490915073ffffffffffffffffffffffffffffffffffffffff168062000e6e576000808062000c1886880188620039fb565b92509250925060008584848460405162000c329062003292565b62000c409392919062003abd565b8190604051809103906000f590508015801562000c61573d6000803e3d6000fd5b506040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8c81166004830152602482018c9052919250908216906340c10f1990604401600060405180830381600087803b15801562000cd757600080fd5b505af115801562000cec573d6000803e3d6000fd5b5050505080606a600088815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060405180604001604052808e63ffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff16815250606b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509050507f490e59a1701b938786ac72570a1efeac994a3dbe96e2e883e19e902ace6e6a398d8d838b8b60405162000e5c95949392919062003afa565b60405180910390a15050505062000ef9565b6040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152602482018790528216906340c10f1990604401600060405180830381600087803b15801562000edf57600080fd5b505af115801562000ef4573d6000803e3d6000fd5b505050505b50505b6040805163ffffffff8c811682528916602082015273ffffffffffffffffffffffffffffffffffffffff88811682840152861660608201526080810185905290517f25308c93ceeed162da955b3f7ce3e3f93606579e40fb92029faa9efe275459839181900360a00190a15050505050505050505050565b60685460ff161562000fb2576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000fc98b8b8b8b8b8b8b8b8b8b8b600162001ffc565b60008473ffffffffffffffffffffffffffffffffffffffff1684888a868660405160240162000ffc949392919062003b42565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f1806b5f200000000000000000000000000000000000000000000000000000000179052516200107f9190620038e6565b60006040518083038185875af1925050503d8060008114620010be576040519150601f19603f3d011682016040523d82523d6000602084013e620010c3565b606091505b5050905080620010ff576040517f37e391c300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805163ffffffff8d811682528a16602082015273ffffffffffffffffffffffffffffffffffffffff89811682840152871660608201526080810186905290517f25308c93ceeed162da955b3f7ce3e3f93606579e40fb92029faa9efe275459839181900360a00190a1505050505050505050505050565b605354600090819081805b602081101562001255578083901c600116600103620011e65760338160208110620011b257620011b262003b8a565b0154604080516020810192909252810185905260600160405160208183030381529060405280519060200120935062001213565b60408051602081018690529081018390526060016040516020818303038152906040528051906020012093505b604080516020810184905290810183905260600160405160208183030381529060405280519060200120915080806200124c9062003be8565b91505062001183565b50919392505050565b600054610100900460ff16158080156200127f5750600054600160ff909116105b806200129b5750303b1580156200129b575060005460ff166001145b6200132d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156200138c57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b606880547fffffffffffffff000000000000000000000000000000000000000000000000ff1661010063ffffffff8716027fffffffffffffff0000000000000000000000000000000000000000ffffffffff16176501000000000073ffffffffffffffffffffffffffffffffffffffff8681169190910291909117909155606c80547fffffffffffffffffffffffff00000000000000000000000000000000000000001691841691909117905562001443620022c3565b8015620014a757600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b605354606854790100000000000000000000000000000000000000000000000000900463ffffffff16101562000703576200070362001f27565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b1660208201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b1660248201526000908190603801604051602081830303815290604052805190602001209050600060ff60f81b3083604051806020016200157d9062003292565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082820381018352601f909101166040819052620015c8908d908d908d908d908d9060200162003c23565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905262001606929160200162003c64565b604051602081830303815290604052805190602001206040516020016200168f94939291907fff0000000000000000000000000000000000000000000000000000000000000094909416845260609290921b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660018401526015830152603582015260550190565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001815291905280516020909101209a9950505050505050505050565b60685460ff161562001711576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200171b62002366565b60685463ffffffff888116610100909204161480620017415750600263ffffffff881610155b1562001779576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008060608773ffffffffffffffffffffffffffffffffffffffff8816620017df57883414620017d5576040517fb89240f500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000925062001ad9565b341562001818576040517f798ee6f100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8089166000908152606b602090815260409182902082518084019093525463ffffffff811683526401000000009004909216918101829052901562001908576040517f9dc29fac000000000000000000000000000000000000000000000000000000008152336004820152602481018b905273ffffffffffffffffffffffffffffffffffffffff8a1690639dc29fac90604401600060405180830381600087803b158015620018db57600080fd5b505af1158015620018f0573d6000803e3d6000fd5b50505050806020015194508060000151935062001ad7565b85156200191d576200191d898b8989620023db565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8b16906370a0823190602401602060405180830381865afa1580156200198b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620019b1919062003c97565b9050620019d773ffffffffffffffffffffffffffffffffffffffff8b1633308e620028f9565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa15801562001a45573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001a6b919062003c97565b905062001a79828262003cb1565b6068548c9850610100900463ffffffff169650935062001a998762002959565b62001aa48c62002a71565b62001aaf8d62002b7e565b60405160200162001ac39392919062003abd565b604051602081830303815290604052945050505b505b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b600084868e8e868860535460405162001b1b98979695949392919062003cc7565b60405180910390a162001c0f620009b2600085878f8f8789805190602001206040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b861562001c205762001c2062001f27565b5050505062001c2e60018055565b50505050505050565b606c5473ffffffffffffffffffffffffffffffffffffffff16331462001c89576040517fe2e8106b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200070362002c80565b600084815b602081101562001d6e57600163ffffffff8616821c8116900362001d0a5785816020811062001ccb5762001ccb62003b8a565b60200201358260405160200162001cec929190918252602082015260400190565b60405160208183030381529060405280519060200120915062001d59565b8186826020811062001d205762001d2062003b8a565b602002013560405160200162001d40929190918252602082015260400190565b6040516020818303038152906040528051906020012091505b8062001d658162003be8565b91505062001c98565b50821490505b949350505050565b60685460ff161562001dba576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556040517f2261efe5aef6fedc1fd1550b25facc9181745623049c7901287030b9ad1a549790600090a1565b80600162001e216020600262003e79565b62001e2d919062003cb1565b6053541062001e68576040517fef5ccf6600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060536000815462001e7b9062003be8565b9182905550905060005b602081101562001f17578082901c60011660010362001ebd57826033826020811062001eb55762001eb562003b8a565b015550505050565b6033816020811062001ed35762001ed362003b8a565b01546040805160208101929092528101849052606001604051602081830303815290604052805190602001209250808062001f0e9062003be8565b91505062001e85565b5062001f2262003e87565b505050565b6053546068805463ffffffff909216790100000000000000000000000000000000000000000000000000027fffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffffff909216919091179081905573ffffffffffffffffffffffffffffffffffffffff65010000000000909104166333d6247d62001fad62001178565b6040518263ffffffff1660e01b815260040162001fcc91815260200190565b600060405180830381600087803b15801562001fe757600080fd5b505af1158015620014a7573d6000803e3d6000fd5b6200200d8b63ffffffff1662002d10565b6068546040805160208082018e90528183018d9052825180830384018152606083019384905280519101207f257b363200000000000000000000000000000000000000000000000000000000909252606481019190915260009165010000000000900473ffffffffffffffffffffffffffffffffffffffff169063257b3632906084016020604051808303816000875af1158015620020b0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620020d6919062003c97565b90508060000362002112576040517e2f6fad00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60685463ffffffff88811661010090920416146200215c576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606854600090610100900463ffffffff166200217a5750896200217d565b508a5b620021a66200219d848c8c8c8c8c8c8c604051620008d592919062003881565b8f8f8462001c93565b620021dd576040517fe0417cec00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505050505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905262001f229084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915262002d75565b600054610100900460ff166200235c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162001324565b6200070362002e88565b600260015403620023d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640162001324565b6002600155565b6000620023ec600482848662003eb6565b620023f79162003ee2565b90507f2afa5331000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000821601620026765760008080808080806200245a896004818d62003eb6565b81019062002469919062003f2b565b96509650965096509650965096503373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614620024dd576040517f912ecce700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff861630146200252d576040517f750643af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8a851462002567576040517f03fffc4b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff89811660248301528881166044830152606482018890526084820187905260ff861660a483015260c4820185905260e48083018590528351808403909101815261010490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fd505accf000000000000000000000000000000000000000000000000000000001790529151918e1691620026229190620038e6565b6000604051808303816000865af19150503d806000811462002661576040519150601f19603f3d011682016040523d82523d6000602084013e62002666565b606091505b50505050505050505050620009c9565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f8fcbaf0c0000000000000000000000000000000000000000000000000000000014620026f2576040517fe282c0ba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808080808080806200270a8a6004818e62003eb6565b81019062002719919062003f86565b975097509750975097509750975097503373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff16146200278f576040517f912ecce700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff87163014620027df576040517f750643af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff8a811660248301528981166044830152606482018990526084820188905286151560a483015260ff861660c483015260e482018590526101048083018590528351808403909101815261012490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f8fcbaf0c000000000000000000000000000000000000000000000000000000001790529151918f1691620028a39190620038e6565b6000604051808303816000865af19150503d8060008114620028e2576040519150601f19603f3d011682016040523d82523d6000602084013e620028e7565b606091505b50505050505050505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052620014a79085907f23b872dd000000000000000000000000000000000000000000000000000000009060840162002240565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f06fdde03000000000000000000000000000000000000000000000000000000001790529051606091600091829173ffffffffffffffffffffffffffffffffffffffff861691620029dd9190620038e6565b600060405180830381855afa9150503d806000811462002a1a576040519150601f19603f3d011682016040523d82523d6000602084013e62002a1f565b606091505b50915091508162002a66576040518060400160405280600781526020017f4e4f5f4e414d450000000000000000000000000000000000000000000000000081525062001d74565b62001d748162002f21565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f95d89b41000000000000000000000000000000000000000000000000000000001790529051606091600091829173ffffffffffffffffffffffffffffffffffffffff86169162002af59190620038e6565b600060405180830381855afa9150503d806000811462002b32576040519150601f19603f3d011682016040523d82523d6000602084013e62002b37565b606091505b50915091508162002a66576040518060400160405280600981526020017f4e4f5f53594d424f4c000000000000000000000000000000000000000000000081525062001d74565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f313ce5670000000000000000000000000000000000000000000000000000000017905290516000918291829173ffffffffffffffffffffffffffffffffffffffff86169162002c019190620038e6565b600060405180830381855afa9150503d806000811462002c3e576040519150601f19603f3d011682016040523d82523d6000602084013e62002c43565b606091505b509150915081801562002c57575080516020145b62002c6457601262001d74565b8080602001905181019062001d74919062004012565b60018055565b60685460ff1662002cbd576040517f5386698100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040517f1e5e34eea33501aecf2ebec9fe0e884a40804275ea7fe10b2ba084c8374308b390600090a1565b600881901c60008181526069602052604081208054600160ff861690811b91821892839055929091908183169003620009c9576040517f646cf55800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600062002dd9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16620031119092919063ffffffff16565b80519091501562001f22578080602001905181019062002dfa919062004032565b62001f22576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840162001324565b600054610100900460ff1662002c7a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162001324565b6060604082511062002f435781806020019051810190620007a2919062004052565b8151602003620030d35760005b60208110801562002f9b575082818151811062002f715762002f7162003b8a565b01602001517fff000000000000000000000000000000000000000000000000000000000000001615155b1562002fb6578062002fad8162003be8565b91505062002f50565b8060000362002ffa57505060408051808201909152601281527f4e4f545f56414c49445f454e434f44494e4700000000000000000000000000006020820152919050565b60008167ffffffffffffffff81111562003018576200301862003891565b6040519080825280601f01601f19166020018201604052801562003043576020820181803683370190505b50905060005b82811015620030cb5784818151811062003067576200306762003b8a565b602001015160f81c60f81b82828151811062003087576200308762003b8a565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080620030c28162003be8565b91505062003049565b509392505050565b505060408051808201909152601281527f4e4f545f56414c49445f454e434f44494e470000000000000000000000000000602082015290565b919050565b606062001d748484600085856000808673ffffffffffffffffffffffffffffffffffffffff168587604051620031489190620038e6565b60006040518083038185875af1925050503d806000811462003187576040519150601f19603f3d011682016040523d82523d6000602084013e6200318c565b606091505b50915091506200319f87838387620031aa565b979650505050505050565b60608315620032455782516000036200323d5773ffffffffffffffffffffffffffffffffffffffff85163b6200323d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162001324565b508162001d74565b62001d7483838151156200325c5781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620013249190620040d2565b611b6680620040e883390190565b803563ffffffff811681146200310c57600080fd5b73ffffffffffffffffffffffffffffffffffffffff81168114620032d857600080fd5b50565b60008060408385031215620032ef57600080fd5b620032fa83620032a0565b915060208301356200330c81620032b5565b809150509250929050565b8015158114620032d857600080fd5b60008083601f8401126200333957600080fd5b50813567ffffffffffffffff8111156200335257600080fd5b6020830191508360208285010111156200336b57600080fd5b9250929050565b6000806000806000608086880312156200338b57600080fd5b6200339686620032a0565b94506020860135620033a881620032b5565b93506040860135620033ba8162003317565b9250606086013567ffffffffffffffff811115620033d757600080fd5b620033e58882890162003326565b969995985093965092949392505050565b806104008101831015620007a257600080fd5b60008060008060008060008060008060006105208c8e0312156200342c57600080fd5b620034388d8d620033f6565b9a50620034496104008d01620032a0565b99506104208c013598506104408c013597506200346a6104608d01620032a0565b96506104808c01356200347d81620032b5565b95506200348e6104a08d01620032a0565b94506104c08c0135620034a181620032b5565b93506104e08c013592506105008c013567ffffffffffffffff811115620034c757600080fd5b620034d58e828f0162003326565b915080935050809150509295989b509295989b9093969950565b6000602082840312156200350257600080fd5b81356200350f81620032b5565b9392505050565b60ff81168114620032d857600080fd5b600080600080600080600060e0888a0312156200354257600080fd5b87356200354f8162003516565b96506200355f60208901620032a0565b955060408801356200357181620032b5565b94506200358160608901620032a0565b935060808801356200359381620032b5565b9699959850939692959460a0840135945060c09093013592915050565b600080600060608486031215620035c657600080fd5b620035d184620032a0565b92506020840135620035e381620032b5565b91506040840135620035f581620032b5565b809150509250925092565b6000602082840312156200361357600080fd5b5035919050565b600080600080600080600060a0888a0312156200363657600080fd5b6200364188620032a0565b965060208801356200365381620032b5565b9550604088013567ffffffffffffffff808211156200367157600080fd5b6200367f8b838c0162003326565b909750955060608a01359150808211156200369957600080fd5b50620036a88a828b0162003326565b9094509250506080880135620036be8162003516565b8091505092959891949750929550565b600080600080600080600060c0888a031215620036ea57600080fd5b620036f588620032a0565b965060208801356200370781620032b5565b95506040880135945060608801356200372081620032b5565b93506080880135620037328162003317565b925060a088013567ffffffffffffffff8111156200374f57600080fd5b6200375d8a828b0162003326565b989b979a50959850939692959293505050565b60008060008061046085870312156200378857600080fd5b843593506200379b8660208701620033f6565b9250620037ac6104208601620032a0565b939692955092936104400135925050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b600061010060ff8c16835263ffffffff808c16602085015273ffffffffffffffffffffffffffffffffffffffff808c166040860152818b166060860152808a166080860152508760a08501528160c0850152620038678285018789620037bd565b925080851660e085015250509a9950505050505050505050565b8183823760009101908152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60005b83811015620038dd578181015183820152602001620038c3565b50506000910152565b60008251620038fa818460208701620038c0565b9190910192915050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156200394e576200394e62003891565b604052919050565b600067ffffffffffffffff82111562003973576200397362003891565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112620039b157600080fd5b8135620039c8620039c28262003956565b62003904565b818152846020838601011115620039de57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121562003a1157600080fd5b833567ffffffffffffffff8082111562003a2a57600080fd5b62003a38878388016200399f565b9450602086013591508082111562003a4f57600080fd5b5062003a5e868287016200399f565b9250506040840135620035f58162003516565b6000815180845262003a8b816020860160208601620038c0565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60608152600062003ad2606083018662003a71565b828103602084015262003ae6818662003a71565b91505060ff83166040830152949350505050565b63ffffffff86168152600073ffffffffffffffffffffffffffffffffffffffff8087166020840152808616604084015250608060608301526200319f608083018486620037bd565b73ffffffffffffffffffffffffffffffffffffffff8516815263ffffffff8416602082015260606040820152600062003b80606083018486620037bd565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820362003c1c5762003c1c62003bb9565b5060010190565b60608152600062003c39606083018789620037bd565b828103602084015262003c4e818688620037bd565b91505060ff831660408301529695505050505050565b6000835162003c78818460208801620038c0565b83519083019062003c8e818360208801620038c0565b01949350505050565b60006020828403121562003caa57600080fd5b5051919050565b81810381811115620007a257620007a262003bb9565b600061010060ff8b16835263ffffffff808b16602085015273ffffffffffffffffffffffffffffffffffffffff808b166040860152818a1660608601528089166080860152508660a08501528160c085015262003d278285018762003a71565b925080851660e085015250509998505050505050505050565b600181815b8085111562003d9f57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111562003d835762003d8362003bb9565b8085161562003d9157918102915b93841c939080029062003d45565b509250929050565b60008262003db857506001620007a2565b8162003dc757506000620007a2565b816001811462003de0576002811462003deb5762003e0b565b6001915050620007a2565b60ff84111562003dff5762003dff62003bb9565b50506001821b620007a2565b5060208310610133831016604e8410600b841016171562003e30575081810a620007a2565b62003e3c838362003d40565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111562003e715762003e7162003bb9565b029392505050565b60006200350f838362003da7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b6000808585111562003ec757600080fd5b8386111562003ed557600080fd5b5050820193919092039150565b7fffffffff00000000000000000000000000000000000000000000000000000000813581811691600485101562003f235780818660040360031b1b83161692505b505092915050565b600080600080600080600060e0888a03121562003f4757600080fd5b873562003f5481620032b5565b9650602088013562003f6681620032b5565b955060408801359450606088013593506080880135620035938162003516565b600080600080600080600080610100898b03121562003fa457600080fd5b883562003fb181620032b5565b9750602089013562003fc381620032b5565b96506040890135955060608901359450608089013562003fe38162003317565b935060a089013562003ff58162003516565b979a969950949793969295929450505060c08201359160e0013590565b6000602082840312156200402557600080fd5b81516200350f8162003516565b6000602082840312156200404557600080fd5b81516200350f8162003317565b6000602082840312156200406557600080fd5b815167ffffffffffffffff8111156200407d57600080fd5b8201601f810184136200408f57600080fd5b8051620040a0620039c28262003956565b818152856020838501011115620040b657600080fd5b620040c9826020830160208601620038c0565b95945050505050565b6020815260006200350f602083018462003a7156fe6101006040523480156200001257600080fd5b5060405162001b6638038062001b6683398101604081905262000035916200028d565b82826003620000458382620003a1565b506004620000548282620003a1565b50503360c0525060ff811660e052466080819052620000739062000080565b60a052506200046d915050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f620000ad6200012e565b805160209182012060408051808201825260018152603160f81b90840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b6060600380546200013f9062000312565b80601f01602080910402602001604051908101604052809291908181526020018280546200016d9062000312565b8015620001be5780601f106200019257610100808354040283529160200191620001be565b820191906000526020600020905b815481529060010190602001808311620001a057829003601f168201915b5050505050905090565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620001f057600080fd5b81516001600160401b03808211156200020d576200020d620001c8565b604051601f8301601f19908116603f01168101908282118183101715620002385762000238620001c8565b816040528381526020925086838588010111156200025557600080fd5b600091505b838210156200027957858201830151818301840152908201906200025a565b600093810190920192909252949350505050565b600080600060608486031215620002a357600080fd5b83516001600160401b0380821115620002bb57600080fd5b620002c987838801620001de565b94506020860151915080821115620002e057600080fd5b50620002ef86828701620001de565b925050604084015160ff811681146200030757600080fd5b809150509250925092565b600181811c908216806200032757607f821691505b6020821081036200034857634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200039c57600081815260208120601f850160051c81016020861015620003775750805b601f850160051c820191505b81811015620003985782815560010162000383565b5050505b505050565b81516001600160401b03811115620003bd57620003bd620001c8565b620003d581620003ce845462000312565b846200034e565b602080601f8311600181146200040d5760008415620003f45750858301515b600019600386901b1c1916600185901b17855562000398565b600085815260208120601f198616915b828110156200043e578886015182559484019460019091019084016200041d565b50858210156200045d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e0516116aa620004bc6000396000610237015260008181610307015281816105c001526106a70152600061053a015260008181610379015261050401526116aa6000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806370a08231116100d8578063a457c2d71161008c578063d505accf11610066578063d505accf1461039b578063dd62ed3e146103ae578063ffa1ad74146103f457600080fd5b8063a457c2d71461034e578063a9059cbb14610361578063cd0d00961461037457600080fd5b806395d89b41116100bd57806395d89b41146102e75780639dc29fac146102ef578063a3c573eb1461030257600080fd5b806370a08231146102915780637ecebe00146102c757600080fd5b806330adf81f1161012f5780633644e515116101145780633644e51514610261578063395093511461026957806340c10f191461027c57600080fd5b806330adf81f14610209578063313ce5671461023057600080fd5b806318160ddd1161016057806318160ddd146101bd57806320606b70146101cf57806323b872dd146101f657600080fd5b806306fdde031461017c578063095ea7b31461019a575b600080fd5b610184610430565b60405161019191906113e4565b60405180910390f35b6101ad6101a8366004611479565b6104c2565b6040519015158152602001610191565b6002545b604051908152602001610191565b6101c17f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81565b6101ad6102043660046114a3565b6104dc565b6101c17f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152602001610191565b6101c1610500565b6101ad610277366004611479565b61055c565b61028f61028a366004611479565b6105a8565b005b6101c161029f3660046114df565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6101c16102d53660046114df565b60056020526000908152604090205481565b610184610680565b61028f6102fd366004611479565b61068f565b6103297f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610191565b6101ad61035c366004611479565b61075e565b6101ad61036f366004611479565b61082f565b6101c17f000000000000000000000000000000000000000000000000000000000000000081565b61028f6103a9366004611501565b61083d565b6101c16103bc366004611574565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6101846040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525081565b60606003805461043f906115a7565b80601f016020809104026020016040519081016040528092919081815260200182805461046b906115a7565b80156104b85780601f1061048d576101008083540402835291602001916104b8565b820191906000526020600020905b81548152906001019060200180831161049b57829003601f168201915b5050505050905090565b6000336104d0818585610b73565b60019150505b92915050565b6000336104ea858285610d27565b6104f5858585610dfe565b506001949350505050565b60007f00000000000000000000000000000000000000000000000000000000000000004614610537576105324661106d565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091906104d090829086906105a3908790611629565b610b73565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610672576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d4272696467650000000000000000000000000000000060648201526084015b60405180910390fd5b61067c8282611135565b5050565b60606004805461043f906115a7565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610754576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d427269646765000000000000000000000000000000006064820152608401610669565b61067c8282611228565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015610822576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610669565b6104f58286868403610b73565b6000336104d0818585610dfe565b834211156108cc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f546f6b656e577261707065643a3a7065726d69743a204578706972656420706560448201527f726d6974000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8716600090815260056020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918a918a918a9190866109268361163c565b9091555060408051602081019690965273ffffffffffffffffffffffffffffffffffffffff94851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000610991610500565b6040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281019190915260428101839052606201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa158015610a55573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590610ad057508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b610b5c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f546f6b656e577261707065643a3a7065726d69743a20496e76616c696420736960448201527f676e6174757265000000000000000000000000000000000000000000000000006064820152608401610669565b610b678a8a8a610b73565b50505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff8316610c15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610cb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610df85781811015610deb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610669565b610df88484848403610b73565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610ea1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610f44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610ffa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610df8565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f611098610430565b8051602091820120604080518082018252600181527f310000000000000000000000000000000000000000000000000000000000000090840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b73ffffffffffffffffffffffffffffffffffffffff82166111b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610669565b80600260008282546111c49190611629565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff82166112cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205481811015611381576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610d1a565b600060208083528351808285015260005b81811015611411578581018301518582016040015282016113f5565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461147457600080fd5b919050565b6000806040838503121561148c57600080fd5b61149583611450565b946020939093013593505050565b6000806000606084860312156114b857600080fd5b6114c184611450565b92506114cf60208501611450565b9150604084013590509250925092565b6000602082840312156114f157600080fd5b6114fa82611450565b9392505050565b600080600080600080600060e0888a03121561151c57600080fd5b61152588611450565b965061153360208901611450565b95506040880135945060608801359350608088013560ff8116811461155757600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561158757600080fd5b61159083611450565b915061159e60208401611450565b90509250929050565b600181811c908216806115bb57607f821691505b6020821081036115f4577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156104d6576104d66115fa565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361166d5761166d6115fa565b506001019056fea26469706673582212208d88fee561cff7120d381c345cfc534cef8229a272dc5809d4bbb685ad67141164736f6c63430008110033a2646970667358221220addfd62f466d34ee002afbb4ae37b6be56ad421fe773f800badeb4ce1025089864736f6c63430008110033" + + + result, err := a.tryAggregateProofs(proverCtx, proverMock)
    - 41 + + 705 +
    - - - }, +   +
    - 42 + + 706 +
    - - - { +   + if tc.asserts != nil {
    - 43 + + 707 +
    - - - "contractName": "PolygonZkEVMBridge proxy", +   + tc.asserts(result, &a, err)
    - 44 + +
     
    +
    + 777 +
    - - - "balance": "200000000000000000000000000", +   + m.proverMock.On("Addr").Return("addr")
    - 45 + + 778 +
    - - - "nonce": "1", +   + m.stateMock.On("GetLastVerifiedBatch", mock.MatchedBy(matchProverCtxFn), nil).Return(&lastVerifiedBatch, nil).Once()
    - 46 + + 779 +
    - - - "address": "0xF6BEEeBB578e214CA9E23B0e9683454Ff88Ed2A7", +   + m.stateMock.On("GetVirtualBatchToProve", mock.MatchedBy(matchProverCtxFn), lastVerifiedBatchNum, mock.Anything, nil).Return(&batchToProve, nil).Once()
    - 47 + + 780 +
    - - - "bytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461088b565b610135565b61006b6100a33660046108a6565b61017f565b3480156100b457600080fd5b506100bd6101f3565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461088b565b610231565b34801561011257600080fd5b506100bd61025e565b6101236102d4565b61013361012e6103ab565b6103b5565b565b61013d6103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481604051806020016040528060008152506000610419565b50565b61017461011b565b6101876103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101eb576101e68383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610419915050565b505050565b6101e661011b565b60006101fd6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103ab565b905090565b61022e61011b565b90565b6102396103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481610444565b60006102686103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103d9565b60606102b183836040518060600160405280602781526020016109bb602791396104a5565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b6102dc6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b600061022161052a565b3660008037600080366000845af43d6000803e8080156103d4573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b61042283610552565b60008251118061042f5750805b156101e65761043e838361028c565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61046d6103d9565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a16101748161059f565b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516104cf919061094d565b600060405180830381855af49150503d806000811461050a576040519150601f19603f3d011682016040523d82523d6000602084013e61050f565b606091505b5091509150610520868383876106ab565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6103fd565b61055b81610753565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff8116610642576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103a2565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b6060831561074157825160000361073a5773ffffffffffffffffffffffffffffffffffffffff85163b61073a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103a2565b508161074b565b61074b838361081e565b949350505050565b73ffffffffffffffffffffffffffffffffffffffff81163b6107f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e74726163740000000000000000000000000000000000000060648201526084016103a2565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610665565b81511561082e5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a29190610969565b803573ffffffffffffffffffffffffffffffffffffffff8116811461088657600080fd5b919050565b60006020828403121561089d57600080fd5b6102b182610862565b6000806000604084860312156108bb57600080fd5b6108c484610862565b9250602084013567ffffffffffffffff808211156108e157600080fd5b818601915086601f8301126108f557600080fd5b81358181111561090457600080fd5b87602082850101111561091657600080fd5b6020830194508093505050509250925092565b60005b8381101561094457818101518382015260200161092c565b50506000910152565b6000825161095f818460208701610929565b9190910192915050565b6020815260008251806020840152610988816040850160208701610929565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220a1af0d6cb4f1e31496a4c5c1448913bce4bd6ad3a39e47c6f7190c114d6f9bf464736f6c63430008110033", + + + m.stateMock.On("AddGeneratedProof", mock.MatchedBy(matchProverCtxFn), mock.Anything, nil).Run(
    - 48 + + 781 +
    - - - "storage": { +   + func(args mock.Arguments) {
    - 49 + + 782 +
    - - - "0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000000000000000000000000000000000000000000001", +   + proof := args[1].(*state.Proof)
    - 50 + + 783 +
    - - - "0x0000000000000000000000000000000000000000000000000000000000000001": "0x0000000000000000000000000000000000000000000000000000000000000001", +   + assert.Equal(batchToProve.BatchNumber, proof.BatchNumber)
    - 51 + +
     
    +
    + 805 +
    - - - "0x0000000000000000000000000000000000000000000000000000000000000068": "0x00000000000000a40d5f56745a118d0906a34e69aec8c0db1cb8fa0000000100", +   + expectedInputProver, err := a.buildInputProver(context.Background(), &batchToProve)
    - 52 + + 806 +
    - - - "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x00000000000000000000000040797c2f93298a44a893f43edf1b33b63d7ba333", +   + require.NoError(err)
    - 53 + + 807 +
    - - - "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x00000000000000000000000039e780d8800f7396e8b7530a8925b14025aedc77" +   + m.proverMock.On("BatchProof", expectedInputProver).Return(nil, errBanana).Once()
    - 54 + + 808 +
    - - - } + + + m.stateMock.On("DeleteGeneratedProofs", mock.MatchedBy(matchAggregatorCtxFn), batchToProve.BatchNumber, batchToProve.BatchNumber, nil).Return(nil).Once()
    - 55 + + 809 +
    - - - }, +   + },
    - 56 + + 810 +
    - - - { +   + asserts: func(result bool, a *Aggregator, err error) {
    - 57 + + 811 +
    - - - "contractName": "PolygonZkEVMGlobalExitRootL2 implementation", +   + assert.False(result)
    - 58 + +
     
    +
    + 820 +
    - - - "balance": "0", +   + m.proverMock.On("Addr").Return("addr")
    - 59 + + 821 +
    - - - "nonce": "1", +   + m.stateMock.On("GetLastVerifiedBatch", mock.MatchedBy(matchProverCtxFn), nil).Return(&lastVerifiedBatch, nil).Once()
    - 60 + + 822 +
    - - - "address": "0x77Fc57b154fCF8320Df2C2e6C044AA50141c023b", +   + m.stateMock.On("GetVirtualBatchToProve", mock.MatchedBy(matchProverCtxFn), lastVerifiedBatchNum, mock.Anything, nil).Return(&batchToProve, nil).Once()
    - 61 + + 823 +
    - - - "bytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806301fd904414610051578063257b36321461006d57806333d6247d1461008d578063a3c573eb146100a2575b600080fd5b61005a60015481565b6040519081526020015b60405180910390f35b61005a61007b366004610162565b60006020819052908152604090205481565b6100a061009b366004610162565b6100ee565b005b6100c97f000000000000000000000000f6beeebb578e214ca9e23b0e9683454ff88ed2a781565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610064565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000f6beeebb578e214ca9e23b0e9683454ff88ed2a7161461015d576040517fb49365dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600155565b60006020828403121561017457600080fd5b503591905056fea2646970667358221220a187fc278346c1b61c449ea3641002b6eac2bda3351a122a12c35099f933696864736f6c63430008110033" + + + m.stateMock.On("AddGeneratedProof", mock.MatchedBy(matchProverCtxFn), mock.Anything, nil).Run(
    - 62 + + 824 +
    - - - }, +   + func(args mock.Arguments) {
    - 63 + + 825 +
    - - - { +   + proof := args[1].(*state.Proof)
    - 64 + + 826 +
    - - - "contractName": "PolygonZkEVMGlobalExitRootL2 proxy", +   + assert.Equal(batchToProve.BatchNumber, proof.BatchNumber)
    - 65 + +
     
    +
    + 849 +
    - - - "balance": "0", +   + require.NoError(err)
    - 66 + + 850 +
    - - - "nonce": "1", +   + m.proverMock.On("BatchProof", expectedInputProver).Return(&proofID, nil).Once()
    - 67 + + 851 +
    - - - "address": "0xa40d5f56745a118d0906a34e69aec8c0db1cb8fa", +   + m.proverMock.On("WaitRecursiveProof", mock.MatchedBy(matchProverCtxFn), proofID).Return("", errBanana).Once()
    - 68 + + 852 +
    - - - "bytecode": "0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100855780635c60da1b146100985780638f283970146100c9578063f851a440146100e95761005d565b3661005d5761005b6100fe565b005b61005b6100fe565b34801561007157600080fd5b5061005b6100803660046106ca565b610118565b61005b6100933660046106e5565b61015f565b3480156100a457600080fd5b506100ad6101d0565b6040516001600160a01b03909116815260200160405180910390f35b3480156100d557600080fd5b5061005b6100e43660046106ca565b61020b565b3480156100f557600080fd5b506100ad610235565b610106610292565b610116610111610331565b61033b565b565b61012061035f565b6001600160a01b0316336001600160a01b031614156101575761015481604051806020016040528060008152506000610392565b50565b6101546100fe565b61016761035f565b6001600160a01b0316336001600160a01b031614156101c8576101c38383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610392915050565b505050565b6101c36100fe565b60006101da61035f565b6001600160a01b0316336001600160a01b03161415610200576101fb610331565b905090565b6102086100fe565b90565b61021361035f565b6001600160a01b0316336001600160a01b0316141561015757610154816103f1565b600061023f61035f565b6001600160a01b0316336001600160a01b03161415610200576101fb61035f565b606061028583836040518060600160405280602781526020016107e460279139610445565b9392505050565b3b151590565b61029a61035f565b6001600160a01b0316336001600160a01b031614156101165760405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b60006101fb610519565b3660008037600080366000845af43d6000803e80801561035a573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b61039b83610541565b6040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a26000825111806103dc5750805b156101c3576103eb8383610260565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61041a61035f565b604080516001600160a01b03928316815291841660208301520160405180910390a1610154816105e9565b6060833b6104a45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610328565b600080856001600160a01b0316856040516104bf9190610794565b600060405180830381855af49150503d80600081146104fa576040519150601f19603f3d011682016040523d82523d6000602084013e6104ff565b606091505b509150915061050f828286610675565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610383565b803b6105a55760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610328565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5b80546001600160a01b0319166001600160a01b039290921691909117905550565b6001600160a01b03811661064e5760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401610328565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61036105c8565b60608315610684575081610285565b8251156106945782518084602001fd5b8160405162461bcd60e51b815260040161032891906107b0565b80356001600160a01b03811681146106c557600080fd5b919050565b6000602082840312156106dc57600080fd5b610285826106ae565b6000806000604084860312156106fa57600080fd5b610703846106ae565b9250602084013567ffffffffffffffff8082111561072057600080fd5b818601915086601f83011261073457600080fd5b81358181111561074357600080fd5b87602082850101111561075557600080fd5b6020830194508093505050509250925092565b60005b8381101561078357818101518382015260200161076b565b838111156103eb5750506000910152565b600082516107a6818460208701610768565b9190910192915050565b60208152600082518060208401526107cf816040850160208701610768565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212204675187caf3a43285d9a2c1844a981e977bd52a85ff073e7fc649f73847d70a464736f6c63430008090033", + + + m.stateMock.On("DeleteGeneratedProofs", mock.MatchedBy(matchAggregatorCtxFn), batchToProve.BatchNumber, batchToProve.BatchNumber, nil).Return(nil).Once()
    - 69 + + 853 +
    - - - "storage": { +   + },
    - 70 + + 854 +
    - - - "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x00000000000000000000000040797c2f93298a44a893f43edf1b33b63d7ba333", +   + asserts: func(result bool, a *Aggregator, err error) {
    - 71 + + 855 +
    - - - "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x00000000000000000000000077fc57b154fcf8320df2c2e6c044aa50141c023b" +   + assert.False(result)
    - 72 - -
    - - - } -
    +
    +
     
    - 73 + + 857 +
    - - - }, +   + },
    - 74 + + 858 +
    - - - { +   + },
    - 75 + + 859 +
    - - - "contractName": "PolygonZkEVMTimelock", +   + {
    - 76 + + 860 +
    - - - "balance": "0", + + + name: "DeleteGeneratedProofs error after WaitRecursiveProof prover error",
    - 77 + + 861 +
    - - - "nonce": "1", +   + setup: func(m mox, a *Aggregator) {
    - 78 + + 862 +
    - - - "address": "0x02245d7B6CB0b6870d1e28AC877EE355b9588869", +   + m.proverMock.On("Name").Return(proverName).Twice()
    - 79 + + 863 +
    - - - "bytecode": "0x6080604052600436106101c65760003560e01c806364d62353116100f7578063b1c5f42711610095578063d547741f11610064578063d547741f14610661578063e38335e514610681578063f23a6e6114610694578063f27a0c92146106d957600080fd5b8063b1c5f427146105af578063bc197c81146105cf578063c4d252f514610614578063d45c44351461063457600080fd5b80638f61f4f5116100d15780638f61f4f5146104e157806391d1485414610515578063a217fddf14610566578063b08e51c01461057b57600080fd5b806364d62353146104815780638065657f146104a15780638f2a0bb0146104c157600080fd5b8063248a9ca31161016457806331d507501161013e57806331d50750146103c857806336568abe146103e85780633a6aae7214610408578063584b153e1461046157600080fd5b8063248a9ca3146103475780632ab0f529146103775780632f2ff15d146103a857600080fd5b80630d3cf6fc116101a05780630d3cf6fc1461026b578063134008d31461029f57806313bc9f20146102b2578063150b7a02146102d257600080fd5b806301d5062a146101d257806301ffc9a7146101f457806307bd02651461022957600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506101f26101ed366004611c12565b6106ee565b005b34801561020057600080fd5b5061021461020f366004611c87565b610783565b60405190151581526020015b60405180910390f35b34801561023557600080fd5b5061025d7fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e6381565b604051908152602001610220565b34801561027757600080fd5b5061025d7f5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca581565b6101f26102ad366004611cc9565b6107df565b3480156102be57600080fd5b506102146102cd366004611d35565b6108d7565b3480156102de57600080fd5b506103166102ed366004611e5a565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610220565b34801561035357600080fd5b5061025d610362366004611d35565b60009081526020819052604090206001015490565b34801561038357600080fd5b50610214610392366004611d35565b6000908152600160208190526040909120541490565b3480156103b457600080fd5b506101f26103c3366004611ec2565b6108fd565b3480156103d457600080fd5b506102146103e3366004611d35565b610927565b3480156103f457600080fd5b506101f2610403366004611ec2565b610940565b34801561041457600080fd5b5061043c7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610220565b34801561046d57600080fd5b5061021461047c366004611d35565b6109f8565b34801561048d57600080fd5b506101f261049c366004611d35565b610a0e565b3480156104ad57600080fd5b5061025d6104bc366004611cc9565b610ade565b3480156104cd57600080fd5b506101f26104dc366004611f33565b610b1d565b3480156104ed57600080fd5b5061025d7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc181565b34801561052157600080fd5b50610214610530366004611ec2565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b34801561057257600080fd5b5061025d600081565b34801561058757600080fd5b5061025d7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f78381565b3480156105bb57600080fd5b5061025d6105ca366004611fe5565b610d4f565b3480156105db57600080fd5b506103166105ea36600461210e565b7fbc197c810000000000000000000000000000000000000000000000000000000095945050505050565b34801561062057600080fd5b506101f261062f366004611d35565b610d94565b34801561064057600080fd5b5061025d61064f366004611d35565b60009081526001602052604090205490565b34801561066d57600080fd5b506101f261067c366004611ec2565b610e8f565b6101f261068f366004611fe5565b610eb4565b3480156106a057600080fd5b506103166106af3660046121b8565b7ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b3480156106e557600080fd5b5061025d611161565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc161071881611204565b6000610728898989898989610ade565b90506107348184611211565b6000817f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8b8b8b8b8b8a60405161077096959493929190612266565b60405180910390a3505050505050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f4e2312e00000000000000000000000000000000000000000000000000000000014806107d957506107d98261135e565b92915050565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff1661085c5761085c81336113f5565b600061086c888888888888610ade565b905061087881856114ad565b610884888888886115ea565b6000817fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588a8a8a8a6040516108bc94939291906122b1565b60405180910390a36108cd816116ee565b5050505050505050565b6000818152600160205260408120546001811180156108f65750428111155b9392505050565b60008281526020819052604090206001015461091881611204565b6109228383611797565b505050565b60008181526001602052604081205481905b1192915050565b73ffffffffffffffffffffffffffffffffffffffff811633146109ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6109f48282611887565b5050565b6000818152600160208190526040822054610939565b333014610a9d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f54696d656c6f636b436f6e74726f6c6c65723a2063616c6c6572206d7573742060448201527f62652074696d656c6f636b00000000000000000000000000000000000000000060648201526084016109e1565b60025460408051918252602082018390527f11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d5910160405180910390a1600255565b6000868686868686604051602001610afb96959493929190612266565b6040516020818303038152906040528051906020012090509695505050505050565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1610b4781611204565b888714610bd6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b888514610c65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b6000610c778b8b8b8b8b8b8b8b610d4f565b9050610c838184611211565b60005b8a811015610d415780827f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8e8e85818110610cc357610cc36122f1565b9050602002016020810190610cd89190612320565b8d8d86818110610cea57610cea6122f1565b905060200201358c8c87818110610d0357610d036122f1565b9050602002810190610d15919061233b565b8c8b604051610d2996959493929190612266565b60405180910390a3610d3a816123cf565b9050610c86565b505050505050505050505050565b60008888888888888888604051602001610d709897969594939291906124b7565b60405160208183030381529060405280519060200120905098975050505050505050565b7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f783610dbe81611204565b610dc7826109f8565b610e53576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20636160448201527f6e6e6f742062652063616e63656c6c656400000000000000000000000000000060648201526084016109e1565b6000828152600160205260408082208290555183917fbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb7091a25050565b600082815260208190526040902060010154610eaa81611204565b6109228383611887565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff16610f3157610f3181336113f5565b878614610fc0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b87841461104f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b60006110618a8a8a8a8a8a8a8a610d4f565b905061106d81856114ad565b60005b8981101561114b5760008b8b8381811061108c5761108c6122f1565b90506020020160208101906110a19190612320565b905060008a8a848181106110b7576110b76122f1565b9050602002013590503660008a8a868181106110d5576110d56122f1565b90506020028101906110e7919061233b565b915091506110f7848484846115ea565b84867fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588686868660405161112e94939291906122b1565b60405180910390a35050505080611144906123cf565b9050611070565b50611155816116ee565b50505050505050505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166315064c966040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111f2919061257e565b156111fd5750600090565b5060025490565b61120e81336113f5565b50565b61121a82610927565b156112a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20616c60448201527f7265616479207363686564756c6564000000000000000000000000000000000060648201526084016109e1565b6112af611161565b81101561133e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a20696e73756666696369656e7460448201527f2064656c6179000000000000000000000000000000000000000000000000000060648201526084016109e1565b61134881426125a0565b6000928352600160205260409092209190915550565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806107d957507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146107d9565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f4576114338161193e565b61143e83602061195d565b60405160200161144f9291906125d7565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526109e191600401612658565b6114b6826108d7565b611542576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b80158061155e5750600081815260016020819052604090912054145b6109f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a206d697373696e67206465706560448201527f6e64656e6379000000000000000000000000000000000000000000000000000060648201526084016109e1565b60008473ffffffffffffffffffffffffffffffffffffffff168484846040516116149291906126a9565b60006040518083038185875af1925050503d8060008114611651576040519150601f19603f3d011682016040523d82523d6000602084013e611656565b606091505b50509050806116e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f54696d656c6f636b436f6e74726f6c6c65723a20756e6465726c79696e67207460448201527f72616e73616374696f6e2072657665727465640000000000000000000000000060648201526084016109e1565b5050505050565b6116f7816108d7565b611783576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b600090815260016020819052604090912055565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556118293390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60606107d973ffffffffffffffffffffffffffffffffffffffff831660145b6060600061196c8360026126b9565b6119779060026125a0565b67ffffffffffffffff81111561198f5761198f611d4e565b6040519080825280601f01601f1916602001820160405280156119b9576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106119f0576119f06122f1565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611a5357611a536122f1565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000611a8f8460026126b9565b611a9a9060016125a0565b90505b6001811115611b37577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611adb57611adb6122f1565b1a60f81b828281518110611af157611af16122f1565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611b30816126d0565b9050611a9d565b5083156108f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109e1565b803573ffffffffffffffffffffffffffffffffffffffff81168114611bc457600080fd5b919050565b60008083601f840112611bdb57600080fd5b50813567ffffffffffffffff811115611bf357600080fd5b602083019150836020828501011115611c0b57600080fd5b9250929050565b600080600080600080600060c0888a031215611c2d57600080fd5b611c3688611ba0565b965060208801359550604088013567ffffffffffffffff811115611c5957600080fd5b611c658a828b01611bc9565b989b979a50986060810135976080820135975060a09091013595509350505050565b600060208284031215611c9957600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146108f657600080fd5b60008060008060008060a08789031215611ce257600080fd5b611ceb87611ba0565b955060208701359450604087013567ffffffffffffffff811115611d0e57600080fd5b611d1a89828a01611bc9565b979a9699509760608101359660809091013595509350505050565b600060208284031215611d4757600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611dc457611dc4611d4e565b604052919050565b600082601f830112611ddd57600080fd5b813567ffffffffffffffff811115611df757611df7611d4e565b611e2860207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601611d7d565b818152846020838601011115611e3d57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215611e7057600080fd5b611e7985611ba0565b9350611e8760208601611ba0565b925060408501359150606085013567ffffffffffffffff811115611eaa57600080fd5b611eb687828801611dcc565b91505092959194509250565b60008060408385031215611ed557600080fd5b82359150611ee560208401611ba0565b90509250929050565b60008083601f840112611f0057600080fd5b50813567ffffffffffffffff811115611f1857600080fd5b6020830191508360208260051b8501011115611c0b57600080fd5b600080600080600080600080600060c08a8c031215611f5157600080fd5b893567ffffffffffffffff80821115611f6957600080fd5b611f758d838e01611eee565b909b50995060208c0135915080821115611f8e57600080fd5b611f9a8d838e01611eee565b909950975060408c0135915080821115611fb357600080fd5b50611fc08c828d01611eee565b9a9d999c50979a969997986060880135976080810135975060a0013595509350505050565b60008060008060008060008060a0898b03121561200157600080fd5b883567ffffffffffffffff8082111561201957600080fd5b6120258c838d01611eee565b909a50985060208b013591508082111561203e57600080fd5b61204a8c838d01611eee565b909850965060408b013591508082111561206357600080fd5b506120708b828c01611eee565b999c989b509699959896976060870135966080013595509350505050565b600082601f83011261209f57600080fd5b8135602067ffffffffffffffff8211156120bb576120bb611d4e565b8160051b6120ca828201611d7d565b92835284810182019282810190878511156120e457600080fd5b83870192505b84831015612103578235825291830191908301906120ea565b979650505050505050565b600080600080600060a0868803121561212657600080fd5b61212f86611ba0565b945061213d60208701611ba0565b9350604086013567ffffffffffffffff8082111561215a57600080fd5b61216689838a0161208e565b9450606088013591508082111561217c57600080fd5b61218889838a0161208e565b9350608088013591508082111561219e57600080fd5b506121ab88828901611dcc565b9150509295509295909350565b600080600080600060a086880312156121d057600080fd5b6121d986611ba0565b94506121e760208701611ba0565b93506040860135925060608601359150608086013567ffffffffffffffff81111561221157600080fd5b6121ab88828901611dcc565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b73ffffffffffffffffffffffffffffffffffffffff8716815285602082015260a06040820152600061229c60a08301868861221d565b60608301949094525060800152949350505050565b73ffffffffffffffffffffffffffffffffffffffff851681528360208201526060604082015260006122e760608301848661221d565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561233257600080fd5b6108f682611ba0565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261237057600080fd5b83018035915067ffffffffffffffff82111561238b57600080fd5b602001915036819003821315611c0b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612400576124006123a0565b5060010190565b81835260006020808501808196508560051b810191508460005b878110156124aa57828403895281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe188360301811261246057600080fd5b8701858101903567ffffffffffffffff81111561247c57600080fd5b80360382131561248b57600080fd5b61249686828461221d565b9a87019a9550505090840190600101612421565b5091979650505050505050565b60a0808252810188905260008960c08301825b8b8110156125055773ffffffffffffffffffffffffffffffffffffffff6124f084611ba0565b168252602092830192909101906001016124ca565b5083810360208501528881527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff89111561253e57600080fd5b8860051b9150818a602083013701828103602090810160408501526125669082018789612407565b60608401959095525050608001529695505050505050565b60006020828403121561259057600080fd5b815180151581146108f657600080fd5b808201808211156107d9576107d96123a0565b60005b838110156125ce5781810151838201526020016125b6565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161260f8160178501602088016125b3565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161264c8160288401602088016125b3565b01602801949350505050565b60208152600082518060208401526126778160408501602087016125b3565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b8183823760009101908152919050565b80820281158282048414176107d9576107d96123a0565b6000816126df576126df6123a0565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea2646970667358221220288c3dd40a2ba96edf066502722584177809ebdb47c0cf9ee8df6f07954c373064736f6c63430008110033", +   + m.proverMock.On("ID").Return(proverID).Twice()
    - 80 + + 864 +
    - - - "storage": { +   + m.proverMock.On("Addr").Return(proverID)
    - 81 + + 865 +
    - - - "0x0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000000000000000015180", +   + m.stateMock.On("GetLastVerifiedBatch", mock.MatchedBy(matchProverCtxFn), nil).Return(&lastVerifiedBatch, nil).Once()
    - 82 + + 866 +
    - - - "0xbdd73c6ebfb442c137537be0985acf11af8e6133078bc51ef9094071cb0ca475": "0x0000000000000000000000000000000000000000000000000000000000000001", +   + m.stateMock.On("GetVirtualBatchToProve", mock.MatchedBy(matchProverCtxFn), lastVerifiedBatchNum, mock.Anything, nil).Return(&batchToProve, nil).Once()
    - 83 + + 867 +
    - - - "0x92b79801e6a3d148a516c908cc0bbad93771fa74468b7757a14aa55532d092de": "0x0000000000000000000000000000000000000000000000000000000000000001", + + + m.stateMock.On("AddGeneratedProof", mock.MatchedBy(matchProverCtxFn), mock.Anything, nil).Run(
    - 84 + + 868 +
    - - - "0x64494413541ff93b31aa309254e3fed72a7456e9845988b915b4c7a7ceba8814": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", +   + func(args mock.Arguments) {
    - 85 + + 869 +
    - - - "0x43e090632490f7d46c400129311fff008a7688bb3d4aebdf80607456b452cf04": "0x0000000000000000000000000000000000000000000000000000000000000001", +   + proof := args[1].(*state.Proof)
    - 86 + + 870 +
    - - - "0x3412d5605ac6cd444957cedb533e5dacad6378b4bc819ebe3652188a665066d6": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", +   + assert.Equal(batchToProve.BatchNumber, proof.BatchNumber)
    - 87 - -
    - - - "0x5af21cf0316499c6925cf9be0331b8bd150a1fa4c19d24a043b45f0cf15357c3": "0x0000000000000000000000000000000000000000000000000000000000000001", -
    +
    +
     
    - 88 + + 893 +
    - - - "0xdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d706a": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", +   + require.NoError(err)
    - 89 + + 894 +
    - - - "0xaf021eeb38644155cd697b3ce0ec4fdac818d29c448a9f9d9bafc293723c6cd8": "0x0000000000000000000000000000000000000000000000000000000000000001", +   + m.proverMock.On("BatchProof", expectedInputProver).Return(&proofID, nil).Once()
    - 90 + + 895 +
    - - - "0xc3ad33e20b0c56a223ad5104fff154aa010f8715b9c981fd38fdc60a4d1a52fc": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5" +   + m.proverMock.On("WaitRecursiveProof", mock.MatchedBy(matchProverCtxFn), proofID).Return("", errBanana).Once()
    - 91 + + 896 +
    - - - } + + + m.stateMock.On("DeleteGeneratedProofs", mock.MatchedBy(matchAggregatorCtxFn), batchToProve.BatchNumber, batchToProve.BatchNumber, nil).Return(errBanana).Once()
    - 92 + + 897 +
    - - - }, +   + },
    - 93 + + 898 +
    - - - { +   + asserts: func(result bool, a *Aggregator, err error) {
    - 94 + + 899 +
    - - - "accountName": "keyless Deployer", +   + assert.False(result)
    - 95 + +
     
    +
    + 908 +
    - - - "balance": "0", +   + m.proverMock.On("Addr").Return("addr")
    - 96 + + 909 +
    - - - "nonce": "1", +   + m.stateMock.On("GetLastVerifiedBatch", mock.MatchedBy(matchProverCtxFn), nil).Return(&lastVerifiedBatch, nil).Once()
    - 97 + + 910 +
    - - - "address": "0xB83a574B3966F7dc1d38d162FA154F2A57D608Bb" +   + m.stateMock.On("GetVirtualBatchToProve", mock.MatchedBy(matchProverCtxFn), lastVerifiedBatchNum, mock.Anything, nil).Return(&batchToProve, nil).Once()
    - 98 + + 911 +
    - - - }, + + + m.stateMock.On("AddGeneratedProof", mock.MatchedBy(matchProverCtxFn), mock.Anything, nil).Run(
    - 99 + + 912 +
    - - - { +   + func(args mock.Arguments) {
    - 100 + + 913 +
    - - - "accountName": "deployer", +   + proof := args[1].(*state.Proof)
    - 101 + + 914 +
    - - - "balance": "0", +   + assert.Equal(batchToProve.BatchNumber, proof.BatchNumber)
    - 102 + +
     
    +
    + 939 +
    - - - "nonce": "8", +   + m.proverMock.On("WaitRecursiveProof", mock.MatchedBy(matchProverCtxFn), proofID).Return(recursiveProof, nil).Once()
    - 103 + + 940 +
    - - - "address": "0xA0B02B28920812324f1cC3255bd8840867d3f227" +   + b, err := json.Marshal(expectedInputProver)
    - 104 + + 941 +
    - - - } +   + require.NoError(err)
    - 105 + + 942 +
    - - - ] + + + m.stateMock.On("UpdateGeneratedProof", mock.MatchedBy(matchAggregatorCtxFn), mock.Anything, nil).Run(
    - 106 + + 943 +
    - - - } +   + func(args mock.Arguments) {
    - 107 + + 944 +
    - - -
    +   + proof := args[1].(*state.Proof)
    - 108 + + 945 +
    - - - ` +   + assert.Equal(batchToProve.BatchNumber, proof.BatchNumber)
    -
    -
    -
    -
    - - - + - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - @@ -32310,704 +33177,658 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     
    - + + 966 -
    +
    +
      -
    + m.proverMock.On("Addr").Return("addr")
    - + + 967 -
    +
    +
      -
    + m.stateMock.On("GetLastVerifiedBatch", mock.MatchedBy(matchProverCtxFn), nil).Return(&lastVerifiedBatch, nil).Once()
    - + + 968 -
    +
    +
      -
    + m.stateMock.On("GetVirtualBatchToProve", mock.MatchedBy(matchProverCtxFn), lastVerifiedBatchNum, mock.Anything, nil).Return(&batchToProve, nil).Once()
    - + + 969 -
    -   -
    +
    +
    + + + m.stateMock.On("AddGeneratedProof", mock.MatchedBy(matchProverCtxFn), mock.Anything, nil).Run(
    - + + 970 -
    +
    +
      -
    + func(args mock.Arguments) {
    - + + 971 -
    +
    +
      -
    + proof := args[1].(*state.Proof)
    - + + 972 -
    +
    +
      -
    + assert.Equal(batchToProve.BatchNumber, proof.BatchNumber)
    - - -
    -   -
    -
    +
    +
     
    - + + 1003 -
    +
    +
      -
    + m.etherman.On("GetLatestBlockHeader", mock.Anything).Return(&types.Header{Number: new(big.Int).SetUint64(1)}, nil).Once()
    - + + 1004 -
    +
    +
      -
    + // make tryBuildFinalProof fail ASAP
    - + + 1005 -
    +
    +
      -
    + m.stateMock.On("GetLastVerifiedBatch", mock.MatchedBy(matchProverCtxFn), nil).Return(nil, errBanana).Once().NotBefore(isSyncedCall)
    - + + 1006 -
    -   -
    +
    +
    + + + m.stateMock.On("UpdateGeneratedProof", mock.MatchedBy(matchAggregatorCtxFn), mock.Anything, nil).Run(
    - + + 1007 -
    +
    +
      -
    + func(args mock.Arguments) {
    - + + 1008 -
    +
    +
      -
    + proof := args[1].(*state.Proof)
    - + + 1009 -
    +
    +
      -
    + assert.Equal(batchToProve.BatchNumber, proof.BatchNumber)
    - + +
     
    -
    +
    + 1029 + +
      -
    + ethTxManager := mocks.NewEthTxManager(t)
    - + + 1030 -
    +
    +
      -
    + etherman := mocks.NewEtherman(t)
    - + + 1031 -
    +
    +
      -
    + proverMock := mocks.NewProverMock(t)
    - + + 1032 -
    -   -
    +
    +
    + + + a, err := New(cfg, stateMock, ethTxManager, etherman, nil, nil)
    - + + 1033 -
    +
    +
      -
    + require.NoError(err)
    - + + 1034 -
    +
    +
      -
    + aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck
    - + + 1035 -
    +
    +
      -
    + a.ctx, a.exit = context.WithCancel(aggregatorCtx)
    - + +
     
    -
    +
    + 1138 + +
      -
    + m.proverMock.On("Addr").Return("addr").Twice()
    - + + 1139 -
    +
    +
      -
    + m.stateMock.On("GetLastVerifiedBatch", mock.MatchedBy(matchProverCtxFn), nil).Return(&verifiedBatch, nil).Twice()
    - + + 1140 -
    +
    +
      -
    + m.etherman.On("GetLatestVerifiedBatchNum").Return(latestVerifiedBatchNum, nil).Once()
    - + + 1141 -
    -   -
    +
    +
    + + + m.stateMock.On("GetProofReadyToVerify", mock.MatchedBy(matchProverCtxFn), latestVerifiedBatchNum, nil).Return(&proofToVerify, nil).Once()
    - + + 1142 -
    -   -
    +
    +
    + + + proofGeneratingTrueCall := m.stateMock.On("UpdateGeneratedProof", mock.MatchedBy(matchProverCtxFn), &proofToVerify, nil).Return(nil).Once()
    - + + 1143 -
    +
    +
      -
    + m.proverMock.On("FinalProof", proofToVerify.Proof, from.String()).Return(nil, errBanana).Once()
    - + + 1144 -
    +
    +
      -
    + m.stateMock.
    - + + 1145 -
    -   -
    +
    +
    + + + On("UpdateGeneratedProof", mock.MatchedBy(matchAggregatorCtxFn), &proofToVerify, nil).
    - + + 1146 -
    +
    +
      -
    + Return(nil).
    - + + 1147 -
    +
    +
      -
    + Once().
    - + + 1148 -
    +
    +
      -
    + NotBefore(proofGeneratingTrueCall)
    - + +
     
    -
    +
    + 1160 + +
      -
    + m.proverMock.On("Addr").Return("addr").Twice()
    - + + 1161 -
    +
    +
      -
    + m.stateMock.On("GetLastVerifiedBatch", mock.MatchedBy(matchProverCtxFn), nil).Return(&verifiedBatch, nil).Twice()
    - + + 1162 -
    +
    +
      -
    + m.etherman.On("GetLatestVerifiedBatchNum").Return(latestVerifiedBatchNum, nil).Once()
    - + + 1163 -
    -   -
    +
    +
    + + + m.stateMock.On("GetProofReadyToVerify", mock.MatchedBy(matchProverCtxFn), latestVerifiedBatchNum, nil).Return(&proofToVerify, nil).Once()
    - + + 1164 -
    -   -
    +
    +
    + + + proofGeneratingTrueCall := m.stateMock.On("UpdateGeneratedProof", mock.MatchedBy(matchProverCtxFn), &proofToVerify, nil).Return(nil).Once()
    - + + 1165 -
    +
    +
      -
    + m.proverMock.On("FinalProof", proofToVerify.Proof, from.String()).Return(&finalProofID, nil).Once()
    - + + 1166 -
    +
    +
      -
    + m.proverMock.On("WaitFinalProof", mock.MatchedBy(matchProverCtxFn), finalProofID).Return(nil, errBanana).Once()
    - + + 1167 -
    +
    +
      -
    + m.stateMock.
    - + + 1168 -
    -   -
    +
    +
    + + + On("UpdateGeneratedProof", mock.MatchedBy(matchAggregatorCtxFn), &proofToVerify, nil).
    - + + 1169 -
    +
    +
      -
    + Return(nil).
    - + + 1170 -
    +
    +
      -
    + Once().
    - + + 1171 -
    +
    +
      -
    + NotBefore(proofGeneratingTrueCall)
    - + +
     
    -
    +
    + 1183 + +
      -
    + m.proverMock.On("Addr").Return(proverID).Once()
    - + + 1184 -
    +
    +
      -
    + m.stateMock.On("GetLastVerifiedBatch", mock.MatchedBy(matchProverCtxFn), nil).Return(&verifiedBatch, nil).Twice()
    - + + 1185 -
    +
    +
      -
    + m.etherman.On("GetLatestVerifiedBatchNum").Return(latestVerifiedBatchNum, nil).Once()
    - + + 1186 -
    -   -
    +
    +
    + + + m.stateMock.On("GetProofReadyToVerify", mock.MatchedBy(matchProverCtxFn), latestVerifiedBatchNum, nil).Return(nil, errBanana).Once()
    - + + 1187 -
    +
    +
      -
    + },
    - + + 1188 -
    +
    +
      -
    + asserts: func(result bool, a *Aggregator, err error) {
    - + + 1189 -
    +
    +
      -
    + assert.False(result)
    - + +
     
    -
    +
    + 1198 + +
      -
    + m.proverMock.On("Addr").Return(proverID).Once()
    - + + 1199 -
    +
    +
      -
    + m.stateMock.On("GetLastVerifiedBatch", mock.MatchedBy(matchProverCtxFn), nil).Return(&verifiedBatch, nil).Twice()
    - + + 1200 -
    +
    +
      -
    + m.etherman.On("GetLatestVerifiedBatchNum").Return(latestVerifiedBatchNum, nil).Once()
    - + + 1201 -
    -   -
    +
    +
    + + + m.stateMock.On("GetProofReadyToVerify", mock.MatchedBy(matchProverCtxFn), latestVerifiedBatchNum, nil).Return(nil, state.ErrNotFound).Once()
    - + + 1202 -
    +
    +
      -
    + },
    - + + 1203 -
    +
    +
      -
    + asserts: func(result bool, a *Aggregator, err error) {
    - + + 1204 -
    +
    +
      -
    + assert.False(result)
    - + +
     
    -
    +
    + 1213 + +
      -
    + m.proverMock.On("Addr").Return(proverID).Twice()
    - + + 1214 -
    +
    +
      -
    + m.stateMock.On("GetLastVerifiedBatch", mock.MatchedBy(matchProverCtxFn), nil).Return(&verifiedBatch, nil).Twice()
    - + + 1215 -
    +
    +
      -
    + m.etherman.On("GetLatestVerifiedBatchNum").Return(latestVerifiedBatchNum, nil).Once()
    - + + 1216 -
    -   -
    +
    +
    + + + m.stateMock.On("GetProofReadyToVerify", mock.MatchedBy(matchProverCtxFn), latestVerifiedBatchNum, nil).Return(&proofToVerify, nil).Once()
    - + + 1217 -
    -   -
    +
    +
    + + + m.stateMock.On("UpdateGeneratedProof", mock.MatchedBy(matchProverCtxFn), &proofToVerify, nil).Return(nil).Once()
    - + + 1218 -
    +
    +
      -
    + m.proverMock.On("FinalProof", proofToVerify.Proof, from.String()).Return(&finalProofID, nil).Once()
    - + + 1219 -
    +
    +
      -
    + m.proverMock.On("WaitFinalProof", mock.MatchedBy(matchProverCtxFn), finalProofID).Return(&finalProof, nil).Once()
    - + + 1220 -
    +
    +
      -
    + },
    - + +
     
    -
    +
    + 1306 + +
      -
    + ethTxManager := mocks.NewEthTxManager(t)
    - + + 1307 -
    +
    +
      -
    + etherman := mocks.NewEtherman(t)
    - + + 1308 -
    +
    +
      -
    + proverMock := mocks.NewProverMock(t)
    - + + 1309 -
    -   -
    +
    +
    + + + a, err := New(cfg, stateMock, ethTxManager, etherman, nil, nil)
    - + + 1310 -
    +
    +
      -
    + require.NoError(err)
    - + + 1311 -
    +
    +
      -
    + aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck
    - + + 1312 -
    +
    +
      -
    + a.ctx, a.exit = context.WithCancel(aggregatorCtx)
    - + +
     
    -
    +
    + 1436 + +
      -
    + ethTxManager := mocks.NewEthTxManager(t)
    - + + 1437 -
    +
    +
      -
    + etherman := mocks.NewEtherman(t)
    - + + 1438 -
    +
    +
      -
    + proverMock := mocks.NewProverMock(t)
    - + + 1439 -
    -   -
    +
    +
    + + + a, err := New(cfg, stateMock, ethTxManager, etherman, nil, nil)
    - + + 1440 -
    +
    +
      -
    + require.NoError(err)
    - + + 1441 -
    +
    +
      -
    + aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck
    - + + 1442 -
    +
    +
      -
    + a.ctx, a.exit = context.WithCancel(aggregatorCtx)
    - + +
     
    -
    +
    + 1450 + +
      -
    + tc.setup(m, &a)
    - + + 1451 -
    +
    +
      -
    + }
    - + + 1452 -
    +
    +
     
    - + + 1453 -
    -   -
    +
    +
    + + + synced, _ := a.isSynced(a.ctx, tc.batchNum)
    - + + 1454 -
    +
    +
      -
    + assert.Equal(tc.synced, synced)
    - + + 1455 -
    +
    +
      -
    + })
    - + + 1456 -
    +
    +
      -
    + }
    - + + 1457 -
    +
    +
      -
    + }
    - + + 1458 -
    -   +
    +
    + +
    - + + 1459 -
    -   -
    +
    +
    + + + func TestWaitForSynchronizerToSyncUp(t *testing.T) {
    - + + 1460 -
    -   -
    +
    +
    + + + t.Parallel()
    - + + 1461 -
    -   +
    +
    + +
    - + + 1462 -
    -   -
    +
    +
    + + + cfg := Config{}
    - + + 1463 -
    -   -
    +
    +
    + + + batchNum := uint64(42)
    - + + 1464 -
    -   -
    +
    +
    + + + testCases := []struct {
    - + + 1465 -
    -   -
    +
    +
    + + + name string
    - + + 1466 -
    -   -
    +
    +
    + + + setup func(mox, *Aggregator)
    - + + 1467 -
    -   -
    +
    +
    + + + batchNum *uint64
    - + + 1468 -
    -   -
    +
    +
    + + + synced bool
    - + + 1469 -
    -   -
    +
    +
    + + + }{
    - + + 1470 -
    -   -
    +
    +
    + + + {
    - + + 1471 -
    -   -
    +
    +
    + + + name: "state context canceled",
    - + + 1472 -
    -   -
    +
    +
    + + + synced: false,
    - + + 1473 -
    -   -
    +
    +
    + + + batchNum: &batchNum,
    - + + 1474 -
    -   -
    +
    +
    + + + setup: func(m mox, a *Aggregator) {
    - + + 1475 -
    -   -
    +
    +
    + + + m.stateMock.On("GetLastVerifiedBatch", mock.Anything, nil).Return(nil, context.Canceled).Once()
    -
    + + + 1476 + + +
    + + + },
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/config/types/duration.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    @@ -38,3 +38,13 @@
    - 38 + + 1477 +
    -   + + },
    - 39 + + 1478 +
    -   - } + + + {
    - 40 + + 1479 +
    -   - } + + + name: "ok after multiple iterations",
    - + + 1480 -
    -   -
    +
    +
    + + + synced: true,
    - + + 1481 -
    -   -
    +
    +
    + + + batchNum: &batchNum,
    - + + 1482 -
    -   -
    +
    +
    + + + setup: func(m mox, a *Aggregator) {
    - + + 1483 -
    -   -
    +
    +
    + + + latestVerifiedBatch := state.VerifiedBatch{BatchNumber: batchNum}
    - + + 1484 -
    -   -
    +
    +
    + + + m.stateMock.On("GetLastVerifiedBatch", mock.Anything, nil).Return(nil, nil).Once()
    - + + 1485 -
    -   -
    +
    +
    + + + m.stateMock.On("GetLastVerifiedBatch", mock.Anything, nil).Return(&latestVerifiedBatch, nil).Once()
    - + + 1486 -
    -   -
    +
    +
    + + + m.etherman.On("GetLatestVerifiedBatchNum").Return(batchNum, nil).Once()
    - + + 1487 -
    -   -
    +
    +
    + + + },
    - + + 1488 -
    -   -
    +
    +
    + + + },
    - + + 1489 -
    -   -
    +
    +
    + + + {
    -
    + + + 1490 + + +
    + + + name: "ok with batch number",
    -
    -
    - - - - - - - - - - - - - -
    -
     
    - 38 + + 1491 +
    -   - }, + + + synced: true,
    - 39 + + 1492 +
    -   - } + + + batchNum: &batchNum,
    - 40 + + 1493 +
    -   - } + + + setup: func(m mox, a *Aggregator) {
    - 41 + 1494
    + -
    + latestVerifiedBatch := state.VerifiedBatch{BatchNumber: batchNum}
    - 42 + 1495
    + - // MarshalJSON marshalls time duration into text. + m.stateMock.On("GetLastVerifiedBatch", mock.Anything, nil).Return(&latestVerifiedBatch, nil).Once()
    - 43 + 1496
    + - func (d Duration) MarshalJSON() ([]byte, error) { + m.etherman.On("GetLatestVerifiedBatchNum").Return(batchNum, nil).Once()
    - 44 + 1497
    + - return []byte(`"` + d.String() + `"`), nil + },
    - 45 + 1498
    + - } + },
    - 46 + 1499
    + -
    + }
    - 47 + 1500
    + - // MarshalText marshalls time duration into text. + for _, tc := range testCases {
    - 48 + 1501
    + - func (d *Duration) MarshalText() ([]byte, error) { + t.Run(tc.name, func(t *testing.T) {
    - 49 + 1502
    + - return []byte(d.String()), nil + stateMock := mocks.NewStateMock(t)
    - 50 + 1503
    + - } + ethTxManager := mocks.NewEthTxManager(t)
    -
    + + + 1504 + + +
    + + + etherman := mocks.NewEtherman(t)
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/config.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    @@ -0,0 +1,9 @@
    - + + 1505 -
    -   -
    +
    +
    + + + proverMock := mocks.NewProverMock(t)
    - + + 1506 -
    -   -
    +
    +
    + + + a, err := New(cfg, stateMock, ethTxManager, etherman, nil, nil)
    - + + 1507 -
    -   -
    +
    +
    + + + require.NoError(t, err)
    - + + 1508 -
    -   -
    +
    +
    + + + aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck
    - + + 1509 -
    -   -
    +
    +
    + + + a.ctx, a.exit = context.WithCancel(aggregatorCtx)
    - + + 1510 -
    -   -
    +
    +
    + + + m := mox{
    - + + 1511 -
    -   -
    +
    +
    + + + stateMock: stateMock,
    - + + 1512 -
    -   -
    +
    +
    + + + ethTxManager: ethTxManager,
    - + + 1513 -
    -   -
    +
    +
    + + + etherman: etherman,
    -
    + + + 1514 + + +
    + + + proverMock: proverMock,
    -
    -
    - - - - - + + + + + + + + + + + + + + + @@ -33062,12 +33933,12 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    +
    {/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/dataavailability.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/batch.go RENAMED
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    - 1 + 1515
    + - package dataavailability + }
    - 2 + 1516
    + -
    + if tc.setup != nil {
    - 3 + 1517
    + - // DABackendType is the data availability protocol for the CDK + tc.setup(m, &a)
    - 4 + 1518
    + - type DABackendType string + }
    - 5 + 1519
    @@ -33017,42 +33838,92 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 6 + 1520
    + - const ( + err = a.waitForSynchronizerToSyncUp(a.ctx, tc.batchNum)
    - 7 + 1521
    + - // DataAvailabilityCommittee is the DAC protocol backend + if tc.synced {
    - 8 + 1522
    + - DataAvailabilityCommittee DABackendType = "DataAvailabilityCommittee" + assert.NoError(t, err)
    - 9 + 1523
    + - ) + } else { +
    +
    + 1524 + +
    + + + assert.Error(t, err) +
    +
    + 1525 + +
    + + + } +
    +
    + 1526 + +
    + + + }) +
    +
    + 1527 + +
    + + + } +
    +
    + 1528 + +
    + + + }
    -
    @@ -0,0 +1,139 @@
    +
    @@ -1,427 +0,0 @@
    - + + 1 -
    -   -
    +
    +
    + - + package aggregator
    - + + 2 -
    -   +
    +
    + -
    - + + 3 -
    -   -
    +
    +
    + - + import (
    - + + 4 -
    -   -
    +
    +
    + - + "context"
    - + + 5 -
    -   -
    +
    +
    + - + "encoding/json"
    - + + 6 -
    -   -
    +
    +
    + - + "errors"
    - + + 7 -
    -   -
    +
    +
    + - + "fmt"
    - + + 8 -
    -   -
    +
    +
    + - + "math/big"
    - + + 9 -
    -   -
    +
    +
    + - + "time"
    - + + 10 -
    -   +
    +
    + -
    - + + 11 -
    -   -
    +
    +
    + - + "github.com/0xPolygonHermez/zkevm-node/log"
    - + + 12 -
    -   -
    +
    +
    + - + "github.com/0xPolygonHermez/zkevm-node/state"
    - + + 13 -
    -   -
    +
    +
    + - + )
    - + + 14 -
    -   +
    +
    + -
    - + + 15 -
    -   -
    +
    +
    + - + func (a *Aggregator) tryGenerateBatchProof(ctx context.Context, prover proverInterface) (bool, error) {
    - + + 16 -
    -   -
    +
    +
    + - + log := log.WithFields(
    - + + 17 -
    -   -
    +
    +
    + - + "prover", prover.Name(),
    - + + 18 -
    -   -
    +
    +
    + - + "proverId", prover.ID(),
    - + + 19 -
    -   -
    +
    +
    + - + "proverAddr", prover.Addr(),
    - + + 20 -
    -   -
    +
    +
    + - + )
    - + + 21 -
    -   -
    +
    +
    + - + log.Debug("tryGenerateBatchProof start")
    - + + 22 -
    -   +
    +
    + -
    - + + 23 -
    -   -
    +
    +
    + - + batchToProve, proof, err0 := a.getAndLockBatchToProve(ctx, prover)
    - + + 24 -
    -   -
    +
    +
    + - + if errors.Is(err0, state.ErrNotFound) {
    - + + 25 -
    -   -
    +
    +
    + - + // nothing to proof, swallow the error
    - + + 26 -
    -   -
    +
    +
    + - + log.Debug("Nothing to generate proof")
    - + + 27 -
    -   -
    +
    +
    + - + return false, nil
    - + + 28 -
    -   -
    +
    +
    + - + }
    - + + 29 -
    -   -
    +
    +
    + - + if err0 != nil {
    - + + 30 -
    -   -
    +
    +
    + - + return false, err0
    - + + 31 -
    -   -
    +
    +
    + - + }
    - + + 32 -
    -   +
    +
    + -
    - + + 33 -
    -   -
    +
    +
    + - + log = log.WithFields("batch", batchToProve.BatchNumber)
    - + + 34 -
    -   +
    +
    + -
    - + + 35 -
    -   -
    +
    +
    + - + var (
    - + + 36 -
    -   -
    +
    +
    + - + genProofID *string
    - + + 37 -
    -   -
    +
    +
    + - + err error
    - + + 38 -
    -   -
    +
    +
    + - + )
    - + + 39 -
    -   +
    +
    + -
    - + + 40 -
    -   -
    +
    +
    + - + defer func() {
    - + + 41 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 42 -
    -   -
    +
    +
    + - + err2 := a.State.DeleteBatchProofs(a.ctx, proof.BatchNumber, proof.BatchNumberFinal, nil)
    - + + 43 -
    -   -
    +
    +
    + - + if err2 != nil {
    - + + 44 -
    -   -
    +
    +
    + - + log.Errorf("Failed to delete proof in progress, err: %v", err2)
    - + + 45 -
    -   -
    +
    +
    + - + }
    - + + 46 -
    -   -
    +
    +
    + - + }
    - + + 47 -
    -   -
    +
    +
    + - + log.Debug("tryGenerateBatchProof end")
    - + + 48 -
    -   -
    +
    +
    + - + }()
    - + + 49 -
    -   +
    +
    + -
    - + + 50 -
    -   -
    +
    +
    + - + log.Info("Generating proof from batch")
    - + + 51 -
    -   +
    +
    + -
    - + + 52 -
    -   -
    +
    +
    + - + log.Infof("Sending zki + batch to the prover, batchNumber [%d]", batchToProve.BatchNumber)
    - + + 53 -
    -   -
    +
    +
    + - + inputProver, err := a.buildInputProver(ctx, batchToProve)
    - + + 54 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 55 -
    -   -
    +
    +
    + - + err = fmt.Errorf("failed to build input prover, %w", err)
    - + + 56 -
    -   -
    +
    +
    + - + log.Error(FirstToUpper(err.Error()))
    - + + 57 -
    -   -
    +
    +
    + - + return false, err
    - + + 58 -
    -   -
    +
    +
    + - + }
    - + + 59 -
    -   +
    +
    + -
    - + + 60 -
    -   -
    +
    +
    + - + b, err := json.Marshal(inputProver)
    - + + 61 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 62 -
    -   -
    +
    +
    + - + err = fmt.Errorf("failed to serialize input prover, %w", err)
    - + + 63 -
    -   -
    +
    +
    + - + log.Error(FirstToUpper(err.Error()))
    - + + 64 -
    -   -
    +
    +
    + - + return false, err
    - + + 65 -
    -   -
    +
    +
    + - + }
    - + + 66 -
    -   +
    +
    + -
    - + + 67 -
    -   -
    +
    +
    + - + proof.InputProver = string(b)
    - + + 68 -
    -   +
    +
    + -
    - + + 69 -
    -   -
    +
    +
    + - + log.Infof("Sending a batch to the prover. OldStateRoot [%#x], OldBatchNum [%d]",
    - + + 70 -
    -   -
    +
    +
    + - + inputProver.PublicInputs.OldStateRoot, inputProver.PublicInputs.OldBatchNum)
    - + + 71 -
    -   +
    +
    + -
    - + + 72 -
    -   -
    +
    +
    + - + genProofID, err = prover.BatchProof(inputProver)
    - + + 73 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 74 -
    -   -
    +
    +
    + - + err = fmt.Errorf("failed to get batch proof id, %w", err)
    - + + 75 -
    -   -
    +
    +
    + - + log.Error(FirstToUpper(err.Error()))
    - + + 76 -
    -   -
    +
    +
    + - + return false, err
    - + + 77 -
    -   -
    +
    +
    + - + }
    - + + 78 -
    -   +
    +
    + -
    - + + 79 -
    -   -
    +
    +
    + - + proof.ProofID = genProofID
    - + + 80 -
    -   +
    +
    + -
    - + + 81 -
    -   -
    +
    +
    + - + log.Infof("Proof ID %v", *proof.ProofID)
    - + + 82 -
    -   -
    +
    +
    + - + log = log.WithFields("proofId", *proof.ProofID)
    - + + 83 -
    -   +
    +
    + -
    - + + 84 -
    -   -
    +
    +
    + - + resGetProof, err := prover.WaitRecursiveProof(ctx, *proof.ProofID)
    - + + 85 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 86 -
    -   -
    +
    +
    + - + err = fmt.Errorf("failed to get proof from prover, %w", err)
    - + + 87 -
    -   -
    +
    +
    + - + log.Error(FirstToUpper(err.Error()))
    - + + 88 -
    -   -
    +
    +
    + - + return false, err
    - + + 89 -
    -   -
    +
    +
    + - + }
    - + + 90 -
    -   +
    +
    + -
    - + + 91 -
    -   -
    +
    +
    + - + log.Info("Batch proof generated")
    - + + 92 -
    -   +
    +
    + -
    - + + 93 -
    -   -
    +
    +
    + - + proof.Proof = resGetProof
    - + + 94 -
    -   +
    +
    + -
    - + + 95 -
    -   -
    +
    +
    + - + // NOTE(pg): the defer func is useless from now on, use a different variable
    - + + 96 -
    -   -
    +
    +
    + - + // name for errors (or shadow err in inner scopes) to not trigger it.
    - + + 97 -
    -   +
    +
    + -
    - + + 98 -
    -   -
    +
    +
    + - + finalProofBuilt, finalProofErr := a.tryBuildFinalProof(ctx, prover, proof)
    - + + 99 -
    -   -
    +
    +
    + - + if finalProofErr != nil {
    - + + 100 -
    -   -
    +
    +
    + - + // just log the error and continue to handle the generated proof
    - + + 101 -
    -   -
    +
    +
    + - + log.Errorf("Error trying to build final proof: %v", finalProofErr)
    - + + 102 -
    -   -
    +
    +
    + - + }
    - + + 103 -
    -   +
    +
    + -
    - - -
    -   -
    -
    +
    + 104
    - - -
    -   -
    +
    +
    + - + // NOTE(pg): prover is done, use a.ctx from now on
    - + + 105 -
    -   +
    +
    + -
    - + + 106 -
    -   -
    +
    +
    + - + if !finalProofBuilt {
    - + + 107 -
    -   -
    +
    +
    + - + proof.GeneratingSince = nil
    - + + 108 -
    -   +
    +
    + -
    - + + 109 -
    -   -
    +
    +
    + - + // final proof has not been generated, update the batch proof
    - + + 110 -
    -   -
    +
    +
    + - + err := a.State.UpdateBatchProof(a.ctx, proof, nil)
    - + + 111 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 112 -
    -   -
    +
    +
    + - + err = fmt.Errorf("failed to store batch proof result, %w", err)
    - + + 113 -
    -   -
    +
    +
    + - + log.Error(FirstToUpper(err.Error()))
    - + + 114 -
    -   -
    +
    +
    + - + return false, err
    - + + 115 -
    -   -
    +
    +
    + - + }
    - + + 116 -
    -   -
    +
    +
    + - + }
    - + + 117 -
    -   +
    +
    + -
    - + + 118 -
    -   -
    +
    +
    + - + return true, nil
    - + + 119 -
    -   -
    +
    +
    + - + }
    - + + 120 -
    -   +
    +
    + -
    - + + 121 -
    -   -
    +
    +
    + - + func (a *Aggregator) getAndLockBatchToProve(ctx context.Context, prover proverInterface) (*state.Batch, *state.Proof, error) {
    - + + 122 -
    -   -
    +
    +
    + - + proverID := prover.ID()
    - + + 123 -
    -   -
    +
    +
    + - + proverName := prover.Name()
    - + + 124 -
    -   +
    +
    + -
    - + + 125 -
    -   -
    +
    +
    + - + log := log.WithFields(
    - + + 126 -
    -   -
    +
    +
    + - + "prover", proverName,
    - + + 127 -
    -   -
    +
    +
    + - + "proverId", proverID,
    - + + 128 -
    -   -
    +
    +
    + - + "proverAddr", prover.Addr(),
    - + + 129 -
    -   -
    +
    +
    + - + )
    - + + 130 -
    -   +
    +
    + -
    - + + 131 -
    -   -
    +
    +
    + - + a.StateDBMutex.Lock()
    - + + 132 -
    -   -
    +
    +
    + - + defer a.StateDBMutex.Unlock()
    - + + 133 -
    -   +
    +
    + -
    - + + 134 -
    -   -
    +
    +
    + - + lastVerifiedBatch, err := a.State.GetLastVerifiedBatch(ctx, nil)
    - + + 135 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 136 -
    -   -
    +
    +
    + - + return nil, nil, err
    - + + 137 -
    -   -
    +
    +
    + - + }
    - + + 138 -
    -   +
    +
    + -
    -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    -
    - 1 + + 139 +
    - + - package dataavailability + - + // Get header of the last L1 block
    - 2 + + 140 +
    - + -
    + - + lastL1BlockHeader, err := a.Ethman.GetLatestBlockHeader(ctx)
    - 3 + + 141 +
    - + - import ( + - + if err != nil {
    - 4 + + 142 +
    - + - "context" + - + log.Errorf("Failed to get last L1 block header, err: %v", err)
    - 5 + + 143 +
    - + - "fmt" + - + return nil, nil, err
    - 6 + + 144 +
    - + - "math/big" + - + }
    - 7 + + 145 +
    - + -
    + - + lastL1BlockNumber := lastL1BlockHeader.Number.Uint64()
    - 8 + + 146 +
    - + - "github.com/0xPolygonHermez/zkevm-node/etherman/types" + - +
    - 9 + + 147 +
    - + - "github.com/0xPolygonHermez/zkevm-node/log" + - + // Calculate max L1 block number for getting next virtual batch to prove
    - 10 + + 148 +
    - + - "github.com/ethereum/go-ethereum/common" + - + maxL1BlockNumber := uint64(0)
    - 11 + + 149 +
    - + - "github.com/ethereum/go-ethereum/crypto" + - + if a.cfg.BatchProofL1BlockConfirmations <= lastL1BlockNumber {
    - 12 + + 150 +
    - + - ) + - + maxL1BlockNumber = lastL1BlockNumber - a.cfg.BatchProofL1BlockConfirmations
    - 13 + + 151 +
    - + -
    + - + }
    - 14 + + 152 +
    - + - const unexpectedHashTemplate = "mismatch on transaction data for batch num %d. Expected hash %s, actual hash: %s" + - + log.Debugf("Max L1 block number for getting next virtual batch to prove: %d", maxL1BlockNumber)
    - 15 + + 153 +
    - + + -
    - 16 + + 154 +
    - + - // DataAvailability implements an abstract data availability integration + - + // Get virtual batch pending to generate proof
    - 17 + + 155 +
    - + - type DataAvailability struct { + - + batchToVerify, err := a.State.GetVirtualBatchToProve(ctx, lastVerifiedBatch.BatchNumber, maxL1BlockNumber, nil)
    - 18 + + 156 +
    - + - isTrustedSequencer bool + - + if err != nil {
    - 19 + + 157 +
    - + -
    + - + return nil, nil, err
    - 20 + + 158 +
    - + - state stateInterface + - + }
    - 21 + + 159 +
    - + - zkEVMClient ZKEVMClientTrustedBatchesGetter + - +
    - 22 + + 160 +
    - + - backend DABackender + - + log.Infof("Found virtual batch %d pending to generate proof", batchToVerify.BatchNumber)
    - 23 + + 161 +
    - + -
    + - + log = log.WithFields("batch", batchToVerify.BatchNumber)
    - 24 + + 162 +
    - + - ctx context.Context + - +
    - 25 + + 163 +
    - + - } + - + log.Info("Checking profitability to aggregate batch")
    - 26 + + 164 +
    - + + -
    - 27 + + 165 +
    - + - // New creates a DataAvailability instance + - + // pass pol collateral as zero here, bcs in smart contract fee for aggregator is not defined yet
    - 28 + + 166 +
    - + - func New( + - + isProfitable, err := a.ProfitabilityChecker.IsProfitable(ctx, big.NewInt(0))
    - 29 + + 167 +
    - + - isTrustedSequencer bool, + - + if err != nil {
    - 30 + + 168 +
    - + - backend DABackender, + - + log.Errorf("Failed to check aggregator profitability, err: %v", err)
    - 31 + + 169 +
    - + - state stateInterface, + - + return nil, nil, err
    - 32 + + 170 +
    - + - zkEVMClient ZKEVMClientTrustedBatchesGetter, + - + }
    - 33 + + 171 +
    - + - ) (*DataAvailability, error) { + - +
    - 34 + + 172 +
    - + - da := &DataAvailability{ + - + if !isProfitable {
    - 35 + + 173 +
    - + - isTrustedSequencer: isTrustedSequencer, + - + log.Infof("Batch is not profitable, pol collateral %d", big.NewInt(0))
    - 36 + + 174 +
    - + - backend: backend, + - + return nil, nil, err
    - 37 + + 175 +
    - + - state: state, + - + }
    - 38 + + 176 +
    - + - zkEVMClient: zkEVMClient, + - +
    - 39 + + 177 +
    - + - ctx: context.Background(), + - + now := time.Now().Round(time.Microsecond)
    - 40 + + 178 +
    - + - } + - + proof := &state.Proof{
    - 41 + + 179 +
    - + - err := da.backend.Init() + - + BatchNumber: batchToVerify.BatchNumber,
    - 42 + + 180 +
    - + - return da, err + - + BatchNumberFinal: batchToVerify.BatchNumber,
    - 43 + + 181 +
    - + - } + - + Prover: &proverName,
    - 44 + + 182 +
    - + -
    + - + ProverID: &proverID,
    - 45 + + 183 +
    - + - // PostSequence sends the sequence data to the data availability backend, and returns the dataAvailabilityMessage + - + GeneratingSince: &now,
    - 46 + + 184 +
    - + - // as expected by the contract + - + }
    - 47 + + 185 +
    - + - func (d *DataAvailability) PostSequence(ctx context.Context, sequences []types.Sequence) ([]byte, error) { + - +
    - 48 + + 186 +
    - + - batchesData := [][]byte{} + - + // Avoid other prover to process the same batch
    - 49 + + 187 +
    - + - for _, batch := range sequences { + - + err = a.State.AddBatchProof(ctx, proof, nil)
    - 50 + + 188 +
    - + - // Do not send to the DA backend data that will be stored to L1 + - + if err != nil {
    - 51 + + 189 +
    - + - if batch.ForcedBatchTimestamp == 0 { + - + log.Errorf("Failed to add batch proof, err: %v", err)
    - 52 + + 190 +
    - + - batchesData = append(batchesData, batch.BatchL2Data) + - + return nil, nil, err
    - 53 + + 191 +
    - + - } + - + }
    - 54 + + 192 +
    - + - } + - +
    - 55 + + 193 +
    - + - return d.backend.PostSequence(ctx, batchesData) + - + return batchToVerify, proof, nil
    - 56 + + 194 +
    - + + - }
    - 57 + + 195 +
    - + + -
    - 58 + + 196 +
    - + - // GetBatchL2Data tries to return the data from a batch, in the following priorities + - + func (a *Aggregator) tryAggregateBatchProofs(ctx context.Context, prover proverInterface) (bool, error) {
    - 59 + + 197 +
    - + - // 1. From local DB + - + proverName := prover.Name()
    - 60 + + 198 +
    - + - // 2. From Sequencer + - + proverID := prover.ID()
    - 61 + + 199 +
    - + - // 3. From DA backend + - +
    - 62 + + 200 +
    - + - func (d *DataAvailability) GetBatchL2Data(batchNums []uint64, batchHashes []common.Hash, dataAvailabilityMessage []byte) ([][]byte, error) { + - + log := log.WithFields(
    - 63 + + 201 +
    - + - if len(batchNums) != len(batchHashes) { + - + "prover", proverName,
    - 64 + + 202 +
    - + - return nil, fmt.Errorf("invalid L2 batch data retrieval arguments, %d != %d", len(batchNums), len(batchHashes)) + - + "proverId", proverID,
    - 65 + + 203 +
    - + - } + - + "proverAddr", prover.Addr(),
    - 66 + + 204 +
    - + -
    + - + )
    - 67 + + 205 +
    - + - data, err := d.localData(batchNums, batchHashes) + - + log.Debug("tryAggregateProofs start")
    - 68 + + 206 +
    - + - if err == nil { + - +
    - 69 + + 207 +
    - + - return data, nil + - + proof1, proof2, err0 := a.getAndLockBatchProofsToAggregate(ctx, prover)
    - 70 + + 208 +
    - + - } + - + if errors.Is(err0, state.ErrNotFound) {
    - 71 + + 209 +
    - + -
    + - + // nothing to aggregate, swallow the error
    - 72 + + 210 +
    - + - if !d.isTrustedSequencer { + - + log.Debug("Nothing to aggregate")
    - 73 + + 211 +
    - + - data, err = d.trustedSequencerData(batchNums, batchHashes) + - + return false, nil
    - 74 + + 212 +
    - + - if err != nil { + - + }
    - 75 + + 213 +
    - + - log.Warnf("trusted sequencer failed to return data for batches %v: %s", batchNums, err.Error()) + - + if err0 != nil {
    - 76 + + 214 +
    - + - } else { + - + return false, err0
    - 77 + + 215 +
    - + - return data, nil + - + }
    - 78 + + 216 +
    - + - } + - +
    - 79 + + 217 +
    - + - } + - + var (
    - 80 + + 218 +
    - + -
    + - + aggrProofID *string
    - 81 + + 219 +
    - + - return d.backend.GetSequence(d.ctx, batchHashes, dataAvailabilityMessage) + - + err error
    - 82 + + 220 +
    - + - } + - + )
    - 83 + + 221 +
    - + + -
    - 84 + + 222 +
    - + - // localData retrieves batches from local database and returns an error unless all are found + - + defer func() {
    - 85 + + 223 +
    - + - func (d *DataAvailability) localData(numbers []uint64, hashes []common.Hash) ([][]byte, error) { + - + if err != nil {
    - 86 + + 224 +
    - + - data, err := d.state.GetBatchL2DataByNumbers(d.ctx, numbers, nil) + - + err2 := a.unlockBatchProofsToAggregate(a.ctx, proof1, proof2)
    - 87 + + 225 +
    - + - if err != nil { + - + if err2 != nil {
    - 88 + + 226 +
    - + - return nil, err + - + log.Errorf("Failed to release aggregated proofs, err: %v", err2)
    - 89 + + 227 +
    - + - } + - + }
    - 90 + + 228 +
    - + - var batches [][]byte + - + }
    - 91 + + 229 +
    - + - for i := 0; i < len(numbers); i++ { + - + log.Debug("tryAggregateProofs end")
    - 92 + + 230 +
    - + - batchNumber := numbers[i] + - + }()
    - 93 + + 231 +
    - + - expectedHash := hashes[i] + - +
    - 94 + + 232 +
    - + - batchData, ok := data[batchNumber] + - + log.Infof("Aggregating proofs: %d-%d and %d-%d", proof1.BatchNumber, proof1.BatchNumberFinal, proof2.BatchNumber, proof2.BatchNumberFinal)
    - 95 + + 233 +
    - + - if !ok { + - +
    - 96 + + 234 +
    - + - return nil, fmt.Errorf("missing batch %v", batchNumber) + - + batches := fmt.Sprintf("%d-%d", proof1.BatchNumber, proof2.BatchNumberFinal)
    - 97 + + 235 +
    - + - } + - + log = log.WithFields("batches", batches)
    - 98 + + 236 +
    - + - actualHash := crypto.Keccak256Hash(batchData) + - +
    - 99 + + 237 +
    - + - if actualHash != expectedHash { + - + inputProver := map[string]interface{}{
    - 100 + + 238 +
    - + - err = fmt.Errorf(unexpectedHashTemplate, batchNumber, expectedHash, actualHash) + - + "recursive_proof_1": proof1.Proof,
    - 101 + + 239 +
    - + - log.Warnf("wrong local data for hash: %s", err.Error()) + - + "recursive_proof_2": proof2.Proof,
    - 102 + + 240 +
    - + - return nil, err + - + }
    - 103 + + 241 +
    - + - } else { + - + b, err := json.Marshal(inputProver)
    - 104 + + 242 +
    - + - batches = append(batches, batchData) + - + if err != nil {
    - 105 + + 243 +
    - + - } + - + err = fmt.Errorf("failed to serialize input prover, %w", err)
    - 106 + + 244 +
    - + - } + - + log.Error(FirstToUpper(err.Error()))
    - 107 + + 245 +
    - + - return batches, nil + - + return false, err
    - 108 + + 246 +
    - + - } + - + }
    - 109 + + 247 +
    - + + -
    - 110 + + 248 +
    - + - // trustedSequencerData retrieved batch data from the trusted sequencer and returns an error unless all are found + - + proof := &state.Proof{
    - 111 + + 249 +
    - + - func (d *DataAvailability) trustedSequencerData(batchNums []uint64, expectedHashes []common.Hash) ([][]byte, error) { + - + BatchNumber: proof1.BatchNumber,
    - 112 + + 250 +
    - + - if len(batchNums) != len(expectedHashes) { + - + BatchNumberFinal: proof2.BatchNumberFinal,
    - 113 + + 251 +
    - + - return nil, fmt.Errorf("invalid arguments, len of batch numbers does not equal length of expected hashes: %d != %d", + - + Prover: &proverName,
    - 114 + + 252 +
    - + - len(batchNums), len(expectedHashes)) + - + ProverID: &proverID,
    - 115 + + 253 +
    - + - } + - + InputProver: string(b),
    - 116 + + 254 +
    - + - nums := make([]*big.Int, 0, len(batchNums)) + - + }
    - 117 + + 255 +
    - + - for _, n := range batchNums { + - +
    - 118 + + 256 +
    - + - nums = append(nums, new(big.Int).SetUint64(n)) + - + aggrProofID, err = prover.AggregatedProof(proof1.Proof, proof2.Proof)
    - 119 + + 257 +
    - + - } + - + if err != nil {
    - 120 + + 258 +
    - + - batchData, err := d.zkEVMClient.BatchesByNumbers(d.ctx, nums) + - + err = fmt.Errorf("failed to get aggregated proof id, %w", err)
    - 121 + + 259 +
    - + - if err != nil { + - + log.Error(FirstToUpper(err.Error()))
    - 122 + + 260 +
    - + - return nil, err + - + return false, err
    - 123 + + 261 +
    - + + - }
    - 124 + + 262 +
    - + - if len(batchData) != len(batchNums) { + - +
    - 125 + + 263 +
    - + - return nil, fmt.Errorf("missing batch data, expected %d, got %d", len(batchNums), len(batchData)) + - + proof.ProofID = aggrProofID
    - 126 + + 264 +
    - + - } + - +
    - 127 + + 265 +
    - + - result := make([][]byte, 0, len(batchNums)) + - + log.Infof("Proof ID for aggregated proof: %v", *proof.ProofID)
    - 128 + + 266 +
    - + - for i := 0; i < len(batchNums); i++ { + - + log = log.WithFields("proofId", *proof.ProofID)
    - 129 + + 267 +
    - + - number := batchNums[i] + - +
    - 130 + + 268 +
    - + - batch := batchData[i] + - + recursiveProof, err := prover.WaitRecursiveProof(ctx, *proof.ProofID)
    - 131 + + 269 +
    - + - expectedTransactionsHash := expectedHashes[i] + - + if err != nil {
    - 132 + + 270 +
    - + - actualTransactionsHash := crypto.Keccak256Hash(batch.BatchL2Data) + - + err = fmt.Errorf("failed to get aggregated proof from prover, %w", err)
    - 133 + + 271 +
    - + - if expectedTransactionsHash != actualTransactionsHash { + - + log.Error(FirstToUpper(err.Error()))
    - 134 + + 272 +
    - + - return nil, fmt.Errorf(unexpectedHashTemplate, number, expectedTransactionsHash, actualTransactionsHash) + - + return false, err
    - 135 + + 273 +
    - + - } + - + }
    - 136 + + 274 +
    - + - result = append(result, batch.BatchL2Data) + - +
    - 137 + + 275 +
    - + - } + - + log.Info("Aggregated proof generated")
    - 138 + + 276 +
    - + - return result, nil + - +
    - 139 + + 277 +
    - + - } -
    -
    -
    + - + proof.Proof = recursiveProof
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/datacommittee/datacommittee.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + - - + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + +
    -
    @@ -0,0 +1,309 @@
    - + + 278 -
    -   +
    +
    + -
    - + + 279 -
    -   -
    +
    +
    + - + // update the state by removing the 2 aggregated proofs and storing the
    - + + 280 -
    -   -
    +
    +
    + - + // newly generated recursive proof
    - + + 281 -
    -   -
    +
    +
    + - + dbTx, err := a.State.BeginStateTransaction(ctx)
    - + + 282 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 283 -
    -   -
    +
    +
    + - + err = fmt.Errorf("failed to begin transaction to update proof aggregation state, %w", err)
    - + + 284 -
    -   -
    +
    +
    + - + log.Error(FirstToUpper(err.Error()))
    - + + 285 -
    -   -
    +
    +
    + - + return false, err
    - + + 286 -
    -   -
    +
    +
    + - + }
    - + + 287 -
    -   +
    +
    + -
    - + + 288 -
    -   -
    +
    +
    + - + err = a.State.DeleteBatchProofs(ctx, proof1.BatchNumber, proof2.BatchNumberFinal, dbTx)
    - + + 289 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 290 -
    -   -
    +
    +
    + - + if err := dbTx.Rollback(ctx); err != nil {
    - + + 291 -
    -   -
    +
    +
    + - + err := fmt.Errorf("failed to rollback proof aggregation state, %w", err)
    - + + 292 -
    -   -
    +
    +
    + - + log.Error(FirstToUpper(err.Error()))
    - + + 293 -
    -   -
    +
    +
    + - + return false, err
    - + + 294 -
    -   -
    +
    +
    + - + }
    - + + 295 -
    -   -
    +
    +
    + - + err = fmt.Errorf("failed to delete previously aggregated proofs, %w", err)
    - + + 296 -
    -   -
    +
    +
    + - + log.Error(FirstToUpper(err.Error()))
    - + + 297 -
    -   -
    +
    +
    + - + return false, err
    - + + 298 -
    -   -
    +
    +
    + - + }
    - + + 299 -
    -   +
    +
    + -
    - + + 300 -
    -   -
    +
    +
    + - + now := time.Now().Round(time.Microsecond)
    - + + 301 -
    -   -
    +
    +
    + - + proof.GeneratingSince = &now
    - + + 302 -
    -   +
    +
    + -
    - + + 303 -
    -   -
    +
    +
    + - + err = a.State.AddBatchProof(ctx, proof, dbTx)
    - + + 304 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 305 -
    -   -
    +
    +
    + - + if err := dbTx.Rollback(ctx); err != nil {
    - + + 306 -
    -   -
    +
    +
    + - + err := fmt.Errorf("failed to rollback proof aggregation state, %w", err)
    - + + 307 -
    -   -
    +
    +
    + - + log.Error(FirstToUpper(err.Error()))
    - + + 308 -
    -   -
    +
    +
    + - + return false, err
    - + + 309 -
    -   -
    +
    +
    + - + }
    - + + 310 -
    -   -
    +
    +
    + - + err = fmt.Errorf("failed to store the recursive proof, %w", err)
    - + + 311 -
    -   -
    +
    +
    + - + log.Error(FirstToUpper(err.Error()))
    - + + 312 -
    -   -
    +
    +
    + - + return false, err
    - + + 313 -
    -   -
    +
    +
    + - + }
    - + + 314 -
    -   +
    +
    + -
    - + + 315 -
    -   -
    +
    +
    + - + err = dbTx.Commit(ctx)
    - + + 316 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 317 -
    -   -
    +
    +
    + - + err = fmt.Errorf("failed to store the recursive proof, %w", err)
    - + + 318 -
    -   -
    +
    +
    + - + log.Error(FirstToUpper(err.Error()))
    - + + 319 -
    -   -
    +
    +
    + - + return false, err
    - + + 320 -
    -   -
    +
    +
    + - + }
    - + + 321 -
    -   +
    +
    + -
    - + + 322 -
    -   -
    +
    +
    + - + // The defer func is useless from now on, use a different variable
    - + + 323 -
    -   -
    +
    +
    + - + // name for errors (or shadow err in inner scopes) to not trigger it.
    - + + 324 -
    -   +
    +
    + -
    - + + 325 -
    -   -
    +
    +
    + - + // state is up to date, check if we can send the final proof using the
    - + + 326 -
    -   -
    +
    +
    + - + // one just crafted.
    - + + 327 -
    -   -
    +
    +
    + - + finalProofBuilt, finalProofErr := a.tryBuildFinalProof(ctx, prover, proof)
    - + + 328 -
    -   -
    +
    +
    + - + if finalProofErr != nil {
    - + + 329 -
    -   -
    +
    +
    + - + // just log the error and continue to handle the aggregated proof
    - + + 330 -
    -   -
    +
    +
    + - + log.Errorf("Failed trying to check if recursive proof can be verified: %v", finalProofErr)
    - + + 331 -
    -   -
    +
    +
    + - + }
    - + + 332 -
    -   +
    +
    + -
    - + + 333 -
    -   -
    +
    +
    + - + // Prover is done, use a.ctx from now on
    - + + 334 -
    -   +
    +
    + -
    - + + 335 -
    -   -
    +
    +
    + - + if !finalProofBuilt {
    - + + 336 -
    -   -
    +
    +
    + - + proof.GeneratingSince = nil
    - + + 337 -
    -   +
    +
    + -
    - + + 338 -
    -   -
    +
    +
    + - + // final proof has not been generated, update the recursive proof
    - + + 339 -
    -   -
    +
    +
    + - + err := a.State.UpdateBatchProof(a.ctx, proof, nil)
    - + + 340 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 341 -
    -   -
    +
    +
    + - + err = fmt.Errorf("failed to store batch proof result, %w", err)
    - + + 342 -
    -   -
    +
    +
    + - + log.Error(FirstToUpper(err.Error()))
    - + + 343 -
    -   -
    +
    +
    + - + return false, err
    - + + 344 -
    -   -
    +
    +
    + - + }
    - + + 345 -
    -   -
    +
    +
    + - + }
    - + + 346 -
    -   +
    +
    + -
    - + + 347 -
    -   -
    +
    +
    + - + return true, nil
    - + + 348 -
    -   -
    +
    +
    + - + }
    - + + 349 -
    -   +
    +
    + -
    - + + 350 -
    -   -
    +
    +
    + - + func (a *Aggregator) getAndLockBatchProofsToAggregate(ctx context.Context, prover proverInterface) (*state.Proof, *state.Proof, error) {
    - + + 351 -
    -   -
    +
    +
    + - + log := log.WithFields(
    - + + 352 -
    -   -
    +
    +
    + - + "prover", prover.Name(),
    - + + 353 -
    -   -
    +
    +
    + - + "proverId", prover.ID(),
    - + + 354 -
    -   -
    +
    +
    + - + "proverAddr", prover.Addr(),
    - + + 355 -
    -   -
    +
    +
    + - + )
    - + + 356 -
    -   +
    +
    + -
    - + + 357 -
    -   -
    +
    +
    + - + a.StateDBMutex.Lock()
    - + + 358 -
    -   -
    +
    +
    + - + defer a.StateDBMutex.Unlock()
    - + + 359 -
    -   +
    +
    + -
    - + + 360 -
    -   -
    +
    +
    + - + proof1, proof2, err := a.State.GetBatchProofsToAggregate(ctx, nil)
    - + + 361 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 362 -
    -   -
    +
    +
    + - + return nil, nil, err
    - + + 363 -
    -   -
    +
    +
    + - + }
    - + + 364 -
    -   +
    +
    + -
    - + + 365 -
    -   -
    +
    +
    + - + // Set proofs in generating state in a single transaction
    - + + 366 -
    -   -
    +
    +
    + - + dbTx, err := a.State.BeginStateTransaction(ctx)
    - + + 367 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 368 -
    -   -
    +
    +
    + - + log.Errorf("Failed to begin transaction to set proof aggregation state, err: %v", err)
    - + + 369 -
    -   -
    +
    +
    + - + return nil, nil, err
    - + + 370 -
    -   -
    +
    +
    + - + }
    - + + 371 -
    -   +
    +
    + -
    - + + 372 -
    -   -
    +
    +
    + - + now := time.Now().Round(time.Microsecond)
    - + + 373 -
    -   -
    +
    +
    + - + proof1.GeneratingSince = &now
    - + + 374 -
    -   -
    +
    +
    + - + err = a.State.UpdateBatchProof(ctx, proof1, dbTx)
    - + + 375 -
    -   -
    +
    +
    + - + if err == nil {
    - + + 376 -
    -   -
    +
    +
    + - + proof2.GeneratingSince = &now
    - + + 377 -
    -   -
    +
    +
    + - + err = a.State.UpdateBatchProof(ctx, proof2, dbTx)
    - + + 378 -
    -   -
    +
    +
    + - + }
    - + + 379 -
    -   +
    +
    + -
    - + + 380 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 381 -
    -   -
    +
    +
    + - + if err := dbTx.Rollback(ctx); err != nil {
    - + + 382 -
    -   -
    +
    +
    + - + err := fmt.Errorf("failed to rollback proof aggregation state %w", err)
    - + + 383 -
    -   -
    +
    +
    + - + log.Error(FirstToUpper(err.Error()))
    - + + 384 -
    -   -
    +
    +
    + - + return nil, nil, err
    - + + 385 -
    -   -
    +
    +
    + - + }
    - + + 386 -
    -   -
    +
    +
    + - + return nil, nil, fmt.Errorf("failed to set proof aggregation state %w", err)
    - + + 387 -
    -   -
    +
    +
    + - + }
    - + + 388 -
    -   +
    +
    + -
    - + + 389 -
    -   -
    +
    +
    + - + err = dbTx.Commit(ctx)
    - + + 390 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 391 -
    -   -
    +
    +
    + - + return nil, nil, fmt.Errorf("failed to set proof aggregation state %w", err)
    - + + 392 -
    -   -
    +
    +
    + - + }
    - + + 393 -
    -   +
    +
    + -
    - + + 394 -
    -   -
    +
    +
    + - + return proof1, proof2, nil
    - + + 395 -
    -   -
    +
    +
    + - + }
    - + + 396 -
    -   +
    +
    + -
    - + + 397 -
    -   -
    +
    +
    + - + func (a *Aggregator) unlockBatchProofsToAggregate(ctx context.Context, proof1 *state.Proof, proof2 *state.Proof) error {
    - + + 398 -
    -   -
    +
    +
    + - + // Release proofs from generating state in a single transaction
    - + + 399 -
    -   -
    +
    +
    + - + dbTx, err := a.State.BeginStateTransaction(ctx)
    - + + 400 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 401 -
    -   +
    +
    + - + log.Warnf("Failed to begin transaction to release proof aggregation state, err: %v", err) +
    +
    + 402 + +
    + - + return err +
    +
    + 403 + +
    + - + } +
    +
    + 404 + +
    + -
    - + + 405 -
    -   +
    +
    + - + proof1.GeneratingSince = nil +
    +
    + 406 + +
    + - + err = a.State.UpdateBatchProof(ctx, proof1, dbTx) +
    +
    + 407 + +
    + - + if err == nil { +
    +
    + 408 + +
    + - + proof2.GeneratingSince = nil +
    +
    + 409 + +
    + - + err = a.State.UpdateBatchProof(ctx, proof2, dbTx) +
    +
    + 410 + +
    + - + } +
    +
    + 411 + +
    + -
    - + + 412 -
    -   +
    +
    + - + if err != nil { +
    +
    + 413 + +
    + - + if err := dbTx.Rollback(ctx); err != nil { +
    +
    + 414 + +
    + - + err := fmt.Errorf("failed to rollback proof aggregation state: %w", err) +
    +
    + 415 + +
    + - + log.Error(FirstToUpper(err.Error())) +
    +
    + 416 + +
    + - + return err +
    +
    + 417 + +
    + - + } +
    +
    + 418 + +
    + - + return fmt.Errorf("failed to release proof aggregation state: %w", err) +
    +
    + 419 + +
    + - + } +
    +
    + 420 + +
    + -
    - + + 421 -
    -   +
    +
    + - + err = dbTx.Commit(ctx) +
    +
    + 422 + +
    + - + if err != nil { +
    +
    + 423 + +
    + - + return fmt.Errorf("failed to release proof aggregation state %w", err) +
    +
    + 424 + +
    + - + } +
    +
    + 425 + +
    + -
    + 426 + +
    + - + return nil +
    +
    + 427 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    @@ -38990,6 +40052,190259 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/blobinner.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,7 +0,0 @@
    +
    + 1 + +
    + - + package aggregator +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + import "context" +
    +
    + 4 + +
    + - +
    +
    +
    + 5 + +
    + - + func (a *Aggregator) tryGenerateBlobInnerProof(ctx context.Context, prover proverInterface) (bool, error) { +
    +
    + 6 + +
    + - + return false, nil +
    +
    + 7 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/blobouter.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,11 +0,0 @@
    +
    + 1 + +
    + - + package aggregator +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + import "context" +
    +
    + 4 + +
    + - +
    +
    +
    + 5 + +
    + - + func (a *Aggregator) tryGenerateBlobOuterProof(ctx context.Context, prover proverInterface) (bool, error) { +
    +
    + 6 + +
    + - + return false, nil +
    +
    + 7 + +
    + - + } +
    +
    + 8 + +
    + - +
    +
    +
    + 9 + +
    + - + func (a *Aggregator) tryAggregateBlobOuterProofs(ctx context.Context, prover proverInterface) (bool, error) { +
    +
    + 10 + +
    + - + return false, nil +
    +
    + 11 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/config.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -8,6 +8,17 @@
    +
    + 8 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/encoding" +
    +
    + 9 + +
    +   + ) +
    +
    + 10 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 11 + +
    +   + // TokenAmountWithDecimals is a wrapper type that parses token amount with decimals to big int +
    +
    + 12 + +
    +   + type TokenAmountWithDecimals struct { +
    +
    + 13 + +
    +   + *big.Int `validate:"required"` +
    +
    +
    @@ -89,6 +100,18 @@
    +
    + 89 + +
    +   + // UpgradeEtrogBatchNumber is the number of the first batch after upgrading to etrog +
    +
    + 90 + +
    +   + UpgradeEtrogBatchNumber uint64 `mapstructure:"UpgradeEtrogBatchNumber"` +
    +
    + 91 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 92 + +
    +   + // BatchProofL1BlockConfirmations is number of L1 blocks to consider we can generate the proof for a virtual batch +
    +
    + 93 + +
    +   + BatchProofL1BlockConfirmations uint64 `mapstructure:"BatchProofL1BlockConfirmations"` +
    +
    + 94 + +
    +   + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 8 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/encoding" +
    +
    + 9 + +
    +   + ) +
    +
    + 10 + +
    +   +
    +
    +
    + 11 + +
    + + + // SettlementBackend is the type of the settlement backend +
    +
    + 12 + +
    + + + type SettlementBackend string +
    +
    + 13 + +
    + + +
    +
    +
    + 14 + +
    + + + const ( +
    +
    + 15 + +
    + + + // AggLayer settlement backend +
    +
    + 16 + +
    + + + AggLayer SettlementBackend = "agglayer" +
    +
    + 17 + +
    + + +
    +
    +
    + 18 + +
    + + + // L1 settlement backend +
    +
    + 19 + +
    + + + L1 SettlementBackend = "l1" +
    +
    + 20 + +
    + + + ) +
    +
    + 21 + +
    + + +
    +
    +
    + 22 + +
    +   + // TokenAmountWithDecimals is a wrapper type that parses token amount with decimals to big int +
    +
    + 23 + +
    +   + type TokenAmountWithDecimals struct { +
    +
    + 24 + +
    +   + *big.Int `validate:"required"` +
    +
    +
     
    +
    + 100 + +
    +   + // UpgradeEtrogBatchNumber is the number of the first batch after upgrading to etrog +
    +
    + 101 + +
    +   + UpgradeEtrogBatchNumber uint64 `mapstructure:"UpgradeEtrogBatchNumber"` +
    +
    + 102 + +
    +   +
    +
    +
    + 103 + +
    + + + // SettlementBackend configuration defines how a final ZKP should be settled. Directly to L1 or over the Beethoven service. +
    +
    + 104 + +
    + + + SettlementBackend SettlementBackend `mapstructure:"SettlementBackend"` +
    +
    + 105 + +
    + + +
    +
    +
    + 106 + +
    + + + // AggLayerTxTimeout is the interval time to wait for a tx to be mined from the agglayer +
    +
    + 107 + +
    + + + AggLayerTxTimeout types.Duration `mapstructure:"AggLayerTxTimeout"` +
    +
    + 108 + +
    + + +
    +
    +
    + 109 + +
    + + + // AggLayerURL url of the agglayer service +
    +
    + 110 + +
    + + + AggLayerURL string `mapstructure:"AggLayerURL"` +
    +
    + 111 + +
    + + +
    +
    +
    + 112 + +
    + + + // SequencerPrivateKey Private key of the trusted sequencer +
    +
    + 113 + +
    + + + SequencerPrivateKey types.KeystoreFileConfig `mapstructure:"SequencerPrivateKey"` +
    +
    + 114 + +
    + + +
    +
    +
    + 115 + +
    +   + // BatchProofL1BlockConfirmations is number of L1 blocks to consider we can generate the proof for a virtual batch +
    +
    + 116 + +
    +   + BatchProofL1BlockConfirmations uint64 `mapstructure:"BatchProofL1BlockConfirmations"` +
    +
    + 117 + +
    +   + } +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/final.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,288 +0,0 @@
    +
    + 1 + +
    + - + package aggregator +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + import ( +
    +
    + 4 + +
    + - + "context" +
    +
    + 5 + +
    + - + "errors" +
    +
    + 6 + +
    + - + "fmt" +
    +
    + 7 + +
    + - + "time" +
    +
    + 8 + +
    + - +
    +
    +
    + 9 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/aggregator/prover" +
    +
    + 10 + +
    + - + ethmanTypes "github.com/0xPolygonHermez/zkevm-node/etherman/types" +
    +
    + 11 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/ethtxmanager" +
    +
    + 12 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/log" +
    +
    + 13 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/state" +
    +
    + 14 + +
    + - + "github.com/ethereum/go-ethereum/common" +
    +
    + 15 + +
    + - + "github.com/jackc/pgx/v4" +
    +
    + 16 + +
    + - + ) +
    +
    + 17 + +
    + - +
    +
    +
    + 18 + +
    + - + // tryBuildFinalProof checks if the provided proof is eligible to be used to +
    +
    + 19 + +
    + - + // build the final proof. If no proof is provided it looks for a previously +
    +
    + 20 + +
    + - + // generated proof. If the proof is eligible, then the final proof generation +
    +
    + 21 + +
    + - + // is triggered. +
    +
    + 22 + +
    + - + func (a *Aggregator) tryBuildFinalProof(ctx context.Context, prover proverInterface, proof *state.Proof) (bool, error) { +
    +
    + 23 + +
    + - + proverName := prover.Name() +
    +
    + 24 + +
    + - + proverID := prover.ID() +
    +
    + 25 + +
    + - +
    +
    +
    + 26 + +
    + - + log := log.WithFields( +
    +
    + 27 + +
    + - + "prover", proverName, +
    +
    + 28 + +
    + - + "proverId", proverID, +
    +
    + 29 + +
    + - + "proverAddr", prover.Addr(), +
    +
    + 30 + +
    + - + ) +
    +
    + 31 + +
    + - + log.Debug("tryBuildFinalProof start") +
    +
    + 32 + +
    + - +
    +
    +
    + 33 + +
    + - + var err error +
    +
    + 34 + +
    + - + if !a.canVerifyProof() { +
    +
    + 35 + +
    + - + log.Debug("Time to verify proof not reached or proof verification in progress") +
    +
    + 36 + +
    + - + return false, nil +
    +
    + 37 + +
    + - + } +
    +
    + 38 + +
    + - + log.Debug("Send final proof time reached") +
    +
    + 39 + +
    + - +
    +
    +
    + 40 + +
    + - + for !a.isSynced(ctx, nil) { +
    +
    + 41 + +
    + - + log.Info("Waiting for synchronizer to sync...") +
    +
    + 42 + +
    + - + time.Sleep(a.cfg.RetryTime.Duration) +
    +
    + 43 + +
    + - + continue +
    +
    + 44 + +
    + - + } +
    +
    + 45 + +
    + - +
    +
    +
    + 46 + +
    + - + var lastVerifiedBatchNum uint64 +
    +
    + 47 + +
    + - + lastVerifiedBatch, err := a.State.GetLastVerifiedBatch(ctx, nil) +
    +
    + 48 + +
    + - + if err != nil && !errors.Is(err, state.ErrNotFound) { +
    +
    + 49 + +
    + - + return false, fmt.Errorf("failed to get last verified batch, %w", err) +
    +
    + 50 + +
    + - + } +
    +
    + 51 + +
    + - + if lastVerifiedBatch != nil { +
    +
    + 52 + +
    + - + lastVerifiedBatchNum = lastVerifiedBatch.BatchNumber +
    +
    + 53 + +
    + - + } +
    +
    + 54 + +
    + - +
    +
    +
    + 55 + +
    + - + if proof == nil { +
    +
    + 56 + +
    + - + // we don't have a proof generating at the moment, check if we +
    +
    + 57 + +
    + - + // have a proof ready to verify +
    +
    + 58 + +
    + - +
    +
    +
    + 59 + +
    + - + proof, err = a.getAndLockProofReadyForFinal(ctx, prover, lastVerifiedBatchNum) +
    +
    + 60 + +
    + - + if errors.Is(err, state.ErrNotFound) { +
    +
    + 61 + +
    + - + // nothing to verify, swallow the error +
    +
    + 62 + +
    + - + log.Debug("No proof ready to verify") +
    +
    + 63 + +
    + - + return false, nil +
    +
    + 64 + +
    + - + } +
    +
    + 65 + +
    + - + if err != nil { +
    +
    + 66 + +
    + - + return false, err +
    +
    + 67 + +
    + - + } +
    +
    + 68 + +
    + - +
    +
    +
    + 69 + +
    + - + defer func() { +
    +
    + 70 + +
    + - + if err != nil { +
    +
    + 71 + +
    + - + // Set the generating state to false for the proof ("unlock" it) +
    +
    + 72 + +
    + - + proof.GeneratingSince = nil +
    +
    + 73 + +
    + - + err2 := a.State.UpdateBatchProof(a.ctx, proof, nil) +
    +
    + 74 + +
    + - + if err2 != nil { +
    +
    + 75 + +
    + - + log.Errorf("Failed to unlock proof: %v", err2) +
    +
    + 76 + +
    + - + } +
    +
    + 77 + +
    + - + } +
    +
    + 78 + +
    + - + }() +
    +
    + 79 + +
    + - + } else { +
    +
    + 80 + +
    + - + // we do have a proof generating at the moment, check if it is +
    +
    + 81 + +
    + - + // eligible to be verified +
    +
    + 82 + +
    + - + eligible, err := a.validateEligibleFinalProof(ctx, proof, lastVerifiedBatchNum) +
    +
    + 83 + +
    + - + if err != nil { +
    +
    + 84 + +
    + - + return false, fmt.Errorf("failed to validate eligible final proof, %w", err) +
    +
    + 85 + +
    + - + } +
    +
    + 86 + +
    + - + if !eligible { +
    +
    + 87 + +
    + - + return false, nil +
    +
    + 88 + +
    + - + } +
    +
    + 89 + +
    + - + } +
    +
    + 90 + +
    + - +
    +
    +
    + 91 + +
    + - + log = log.WithFields( +
    +
    + 92 + +
    + - + "proofId", *proof.ProofID, +
    +
    + 93 + +
    + - + "batches", fmt.Sprintf("%d-%d", proof.BatchNumber, proof.BatchNumberFinal), +
    +
    + 94 + +
    + - + ) +
    +
    + 95 + +
    + - +
    +
    +
    + 96 + +
    + - + // at this point we have an eligible proof, build the final one using it +
    +
    + 97 + +
    + - + finalProof, err := a.buildFinalProof(ctx, prover, proof) +
    +
    + 98 + +
    + - + if err != nil { +
    +
    + 99 + +
    + - + err = fmt.Errorf("failed to build final proof, %w", err) +
    +
    + 100 + +
    + - + log.Error(FirstToUpper(err.Error())) +
    +
    + 101 + +
    + - + return false, err +
    +
    + 102 + +
    + - + } +
    +
    + 103 + +
    + - +
    +
    +
    + 104 + +
    + - + msg := finalProofMsg{ +
    +
    + 105 + +
    + - + proverName: proverName, +
    +
    + 106 + +
    + - + proverID: proverID, +
    +
    + 107 + +
    + - + recursiveProof: proof, +
    +
    + 108 + +
    + - + finalProof: finalProof, +
    +
    + 109 + +
    + - + } +
    +
    + 110 + +
    + - +
    +
    +
    + 111 + +
    + - + select { +
    +
    + 112 + +
    + - + case <-a.ctx.Done(): +
    +
    + 113 + +
    + - + return false, a.ctx.Err() +
    +
    + 114 + +
    + - + case a.finalProof <- msg: +
    +
    + 115 + +
    + - + } +
    +
    + 116 + +
    + - +
    +
    +
    + 117 + +
    + - + log.Debug("tryBuildFinalProof end") +
    +
    + 118 + +
    + - + return true, nil +
    +
    + 119 + +
    + - + } +
    +
    + 120 + +
    + - +
    +
    +
    + 121 + +
    + - + // buildFinalProof builds and return the final proof for an aggregated/batch proof. +
    +
    + 122 + +
    + - + func (a *Aggregator) buildFinalProof(ctx context.Context, prover proverInterface, proof *state.Proof) (*prover.FinalProof, error) { +
    +
    + 123 + +
    + - + log := log.WithFields( +
    +
    + 124 + +
    + - + "prover", prover.Name(), +
    +
    + 125 + +
    + - + "proverId", prover.ID(), +
    +
    + 126 + +
    + - + "proverAddr", prover.Addr(), +
    +
    + 127 + +
    + - + "recursiveProofId", *proof.ProofID, +
    +
    + 128 + +
    + - + "batches", fmt.Sprintf("%d-%d", proof.BatchNumber, proof.BatchNumberFinal), +
    +
    + 129 + +
    + - + ) +
    +
    + 130 + +
    + - + log.Info("Generating final proof") +
    +
    + 131 + +
    + - +
    +
    +
    + 132 + +
    + - + finalProofID, err := prover.FinalProof(proof.Proof, a.cfg.SenderAddress) +
    +
    + 133 + +
    + - + if err != nil { +
    +
    + 134 + +
    + - + return nil, fmt.Errorf("failed to get final proof id: %w", err) +
    +
    + 135 + +
    + - + } +
    +
    + 136 + +
    + - + proof.ProofID = finalProofID +
    +
    + 137 + +
    + - +
    +
    +
    + 138 + +
    + - + log.Infof("Final proof ID for batches [%d-%d]: %s", proof.BatchNumber, proof.BatchNumberFinal, *proof.ProofID) +
    +
    + 139 + +
    + - + log = log.WithFields("finalProofId", finalProofID) +
    +
    + 140 + +
    + - +
    +
    +
    + 141 + +
    + - + finalProof, err := prover.WaitFinalProof(ctx, *proof.ProofID) +
    +
    + 142 + +
    + - + if err != nil { +
    +
    + 143 + +
    + - + return nil, fmt.Errorf("failed to get final proof from prover: %w", err) +
    +
    + 144 + +
    + - + } +
    +
    + 145 + +
    + - +
    +
    +
    + 146 + +
    + - + log.Info("Final proof generated") +
    +
    + 147 + +
    + - +
    +
    +
    + 148 + +
    + - + // mock prover sanity check +
    +
    + 149 + +
    + - + if string(finalProof.Public.NewStateRoot) == mockedStateRoot && string(finalProof.Public.NewLocalExitRoot) == mockedLocalExitRoot { +
    +
    + 150 + +
    + - + // This local exit root and state root come from the mock +
    +
    + 151 + +
    + - + // prover, use the one captured by the executor instead +
    +
    + 152 + +
    + - + finalBatch, err := a.State.GetBatchByNumber(ctx, proof.BatchNumberFinal, nil) +
    +
    + 153 + +
    + - + if err != nil { +
    +
    + 154 + +
    + - + return nil, fmt.Errorf("failed to retrieve batch with number [%d]", proof.BatchNumberFinal) +
    +
    + 155 + +
    + - + } +
    +
    + 156 + +
    + - + log.Warnf("NewLocalExitRoot and NewStateRoot look like a mock values, using values from executor instead: LER: %v, SR: %v", +
    +
    + 157 + +
    + - + finalBatch.LocalExitRoot.TerminalString(), finalBatch.StateRoot.TerminalString()) +
    +
    + 158 + +
    + - + finalProof.Public.NewStateRoot = finalBatch.StateRoot.Bytes() +
    +
    + 159 + +
    + - + finalProof.Public.NewLocalExitRoot = finalBatch.LocalExitRoot.Bytes() +
    +
    + 160 + +
    + - + } +
    +
    + 161 + +
    + - +
    +
    +
    + 162 + +
    + - + return finalProof, nil +
    +
    + 163 + +
    + - + } +
    +
    + 164 + +
    + - +
    +
    +
    + 165 + +
    + - + func (a *Aggregator) getAndLockProofReadyForFinal(ctx context.Context, prover proverInterface, lastVerifiedBatchNum uint64) (*state.Proof, error) { +
    +
    + 166 + +
    + - + a.StateDBMutex.Lock() +
    +
    + 167 + +
    + - + defer a.StateDBMutex.Unlock() +
    +
    + 168 + +
    + - +
    +
    +
    + 169 + +
    + - + // Get proof ready to be verified +
    +
    + 170 + +
    + - + proofToVerify, err := a.State.GetProofReadyForFinal(ctx, lastVerifiedBatchNum, nil) +
    +
    + 171 + +
    + - + if err != nil { +
    +
    + 172 + +
    + - + return nil, err +
    +
    + 173 + +
    + - + } +
    +
    + 174 + +
    + - +
    +
    +
    + 175 + +
    + - + now := time.Now().Round(time.Microsecond) +
    +
    + 176 + +
    + - + proofToVerify.GeneratingSince = &now +
    +
    + 177 + +
    + - +
    +
    +
    + 178 + +
    + - + err = a.State.UpdateBatchProof(ctx, proofToVerify, nil) +
    +
    + 179 + +
    + - + if err != nil { +
    +
    + 180 + +
    + - + return nil, err +
    +
    + 181 + +
    + - + } +
    +
    + 182 + +
    + - +
    +
    +
    + 183 + +
    + - + return proofToVerify, nil +
    +
    + 184 + +
    + - + } +
    +
    + 185 + +
    + - +
    +
    +
    + 186 + +
    + - + func (a *Aggregator) validateEligibleFinalProof(ctx context.Context, proof *state.Proof, lastVerifiedBatchNum uint64) (bool, error) { +
    +
    + 187 + +
    + - + batchNumberToVerify := lastVerifiedBatchNum + 1 +
    +
    + 188 + +
    + - +
    +
    +
    + 189 + +
    + - + if proof.BatchNumber != batchNumberToVerify { +
    +
    + 190 + +
    + - + if proof.BatchNumber < batchNumberToVerify && proof.BatchNumberFinal >= batchNumberToVerify { +
    +
    + 191 + +
    + - + // We have a proof that contains some batches below the last batch verified, anyway can be eligible as final proof +
    +
    + 192 + +
    + - + log.Warnf("Proof %d-%d contains some batches lower than last batch verified %d. Check anyway if it is eligible", proof.BatchNumber, proof.BatchNumberFinal, lastVerifiedBatchNum) +
    +
    + 193 + +
    + - + } else if proof.BatchNumberFinal < batchNumberToVerify { +
    +
    + 194 + +
    + - + // We have a proof that contains batches below that the last batch verified, we need to delete this proof +
    +
    + 195 + +
    + - + log.Warnf("Proof %d-%d lower than next batch to verify %d. Deleting it", proof.BatchNumber, proof.BatchNumberFinal, batchNumberToVerify) +
    +
    + 196 + +
    + - + err := a.State.DeleteBatchProofs(ctx, proof.BatchNumber, proof.BatchNumberFinal, nil) +
    +
    + 197 + +
    + - + if err != nil { +
    +
    + 198 + +
    + - + return false, fmt.Errorf("failed to delete discarded proof, err: %w", err) +
    +
    + 199 + +
    + - + } +
    +
    + 200 + +
    + - + return false, nil +
    +
    + 201 + +
    + - + } else { +
    +
    + 202 + +
    + - + log.Debugf("Proof batch number %d is not the following to last verfied batch number %d", proof.BatchNumber, lastVerifiedBatchNum) +
    +
    + 203 + +
    + - + return false, nil +
    +
    + 204 + +
    + - + } +
    +
    + 205 + +
    + - + } +
    +
    + 206 + +
    + - +
    +
    +
    + 207 + +
    + - + bComplete, err := a.State.CheckProofContainsCompleteSequences(ctx, proof, nil) +
    +
    + 208 + +
    + - + if err != nil { +
    +
    + 209 + +
    + - + return false, fmt.Errorf("failed to check if proof contains complete sequences, %w", err) +
    +
    + 210 + +
    + - + } +
    +
    + 211 + +
    + - + if !bComplete { +
    +
    + 212 + +
    + - + log.Infof("Recursive proof %d-%d not eligible to be verified: not containing complete sequences", proof.BatchNumber, proof.BatchNumberFinal) +
    +
    + 213 + +
    + - + return false, nil +
    +
    + 214 + +
    + - + } +
    +
    + 215 + +
    + - + return true, nil +
    +
    + 216 + +
    + - + } +
    +
    + 217 + +
    + - +
    +
    +
    + 218 + +
    + - + // This function waits to receive a final proof from a prover. Once it receives +
    +
    + 219 + +
    + - + // the proof, it performs these steps in order: +
    +
    + 220 + +
    + - + // - send the final proof to L1 +
    +
    + 221 + +
    + - + // - wait for the synchronizer to catch up +
    +
    + 222 + +
    + - + // - clean up the cache of recursive proofs +
    +
    + 223 + +
    + - + func (a *Aggregator) sendFinalProof() { +
    +
    + 224 + +
    + - + for { +
    +
    + 225 + +
    + - + select { +
    +
    + 226 + +
    + - + case <-a.ctx.Done(): +
    +
    + 227 + +
    + - + return +
    +
    + 228 + +
    + - + case msg := <-a.finalProof: +
    +
    + 229 + +
    + - + ctx := a.ctx +
    +
    + 230 + +
    + - + proof := msg.recursiveProof +
    +
    + 231 + +
    + - +
    +
    +
    + 232 + +
    + - + log.WithFields("proofId", proof.ProofID, "batches", fmt.Sprintf("%d-%d", proof.BatchNumber, proof.BatchNumberFinal)) +
    +
    + 233 + +
    + - + log.Info("Verifying final proof with ethereum smart contract") +
    +
    + 234 + +
    + - +
    +
    +
    + 235 + +
    + - + a.startProofVerification() +
    +
    + 236 + +
    + - +
    +
    +
    + 237 + +
    + - + finalBatch, err := a.State.GetBatchByNumber(ctx, proof.BatchNumberFinal, nil) +
    +
    + 238 + +
    + - + if err != nil { +
    +
    + 239 + +
    + - + log.Errorf("Failed to retrieve batch with number [%d]: %v", proof.BatchNumberFinal, err) +
    +
    + 240 + +
    + - + a.endProofVerification() +
    +
    + 241 + +
    + - + continue +
    +
    + 242 + +
    + - + } +
    +
    + 243 + +
    + - +
    +
    +
    + 244 + +
    + - + inputs := ethmanTypes.FinalProofInputs{ +
    +
    + 245 + +
    + - + FinalProof: msg.finalProof, +
    +
    + 246 + +
    + - + NewLocalExitRoot: finalBatch.LocalExitRoot.Bytes(), +
    +
    + 247 + +
    + - + NewStateRoot: finalBatch.StateRoot.Bytes(), +
    +
    + 248 + +
    + - + } +
    +
    + 249 + +
    + - +
    +
    +
    + 250 + +
    + - + log.Infof("Final proof inputs: NewLocalExitRoot [%#x], NewStateRoot [%#x]", inputs.NewLocalExitRoot, inputs.NewStateRoot) +
    +
    + 251 + +
    + - +
    +
    +
    + 252 + +
    + - + // add batch verification to be monitored +
    +
    + 253 + +
    + - + sender := common.HexToAddress(a.cfg.SenderAddress) +
    +
    + 254 + +
    + - + to, data, err := a.Ethman.BuildTrustedVerifyBatchesTxData(proof.BatchNumber-1, proof.BatchNumberFinal, &inputs, sender) +
    +
    + 255 + +
    + - + if err != nil { +
    +
    + 256 + +
    + - + log.Errorf("Error estimating batch verification to add to eth tx manager: %v", err) +
    +
    + 257 + +
    + - + a.handleErrorSendFinalProof(ctx, proof) +
    +
    + 258 + +
    + - + continue +
    +
    + 259 + +
    + - + } +
    +
    + 260 + +
    + - + monitoredTxID := buildMonitoredTxID(proof.BatchNumber, proof.BatchNumberFinal) +
    +
    + 261 + +
    + - + err = a.EthTxManager.Add(ctx, ethTxManagerOwner, monitoredTxID, sender, to, nil, data, a.cfg.GasOffset, nil) +
    +
    + 262 + +
    + - + if err != nil { +
    +
    + 263 + +
    + - + mTxLogger := ethtxmanager.CreateLogger(ethTxManagerOwner, monitoredTxID, sender, to) +
    +
    + 264 + +
    + - + mTxLogger.Errorf("Error to add batch verification tx to eth tx manager: %v", err) +
    +
    + 265 + +
    + - + a.handleErrorSendFinalProof(ctx, proof) +
    +
    + 266 + +
    + - + continue +
    +
    + 267 + +
    + - + } +
    +
    + 268 + +
    + - +
    +
    +
    + 269 + +
    + - + // process monitored batch verifications before starting a next cycle +
    +
    + 270 + +
    + - + a.EthTxManager.ProcessPendingMonitoredTxs(ctx, ethTxManagerOwner, func(result ethtxmanager.MonitoredTxResult, dbTx pgx.Tx) { +
    +
    + 271 + +
    + - + a.handleMonitoredTxResult(result) +
    +
    + 272 + +
    + - + }, nil) +
    +
    + 273 + +
    + - +
    +
    +
    + 274 + +
    + - + a.resetVerifyProofTime() +
    +
    + 275 + +
    + - + a.endProofVerification() +
    +
    + 276 + +
    + - + } +
    +
    + 277 + +
    + - + } +
    +
    + 278 + +
    + - + } +
    +
    + 279 + +
    + - +
    +
    +
    + 280 + +
    + - + func (a *Aggregator) handleErrorSendFinalProof(ctx context.Context, proof *state.Proof) { +
    +
    + 281 + +
    + - + log := log.WithFields("proofId", proof.ProofID, "batches", fmt.Sprintf("%d-%d", proof.BatchNumber, proof.BatchNumberFinal)) +
    +
    + 282 + +
    + - + proof.GeneratingSince = nil +
    +
    + 283 + +
    + - + err := a.State.UpdateBatchProof(ctx, proof, nil) +
    +
    + 284 + +
    + - + if err != nil { +
    +
    + 285 + +
    + - + log.Errorf("Failed updating proof state (false): %v", err) +
    +
    + 286 + +
    + - + } +
    +
    + 287 + +
    + - + a.endProofVerification() +
    +
    + 288 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/interfaces.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -38,6 +38,7 @@
    +
    + 38 + +
    +   +
    +
    +
    + 39 + +
    +   + // etherman contains the methods required to interact with ethereum +
    +
    + 40 + +
    +   + type etherman interface { +
    +
    + + +
    +   +
    +
    +
    + 41 + +
    +   + GetLatestVerifiedBatchNum() (uint64, error) +
    +
    + 42 + +
    +   + BuildTrustedVerifyBatchesTxData(lastVerifiedBatch, newVerifiedBatch uint64, inputs *ethmanTypes.FinalProofInputs, beneficiary common.Address) (to *common.Address, data []byte, err error) +
    +
    + 43 + +
    +   + GetLatestBlockHeader(ctx context.Context) (*types.Header, error) +
    +
    +
    @@ -54,16 +55,16 @@
    +
    + 54 + +
    +   + BeginStateTransaction(ctx context.Context) (pgx.Tx, error) +
    +
    + 55 + +
    +   + CheckProofContainsCompleteSequences(ctx context.Context, proof *state.Proof, dbTx pgx.Tx) (bool, error) +
    +
    + 56 + +
    +   + GetLastVerifiedBatch(ctx context.Context, dbTx pgx.Tx) (*state.VerifiedBatch, error) +
    +
    + 57 + +
    + - + GetProofReadyForFinal(ctx context.Context, lastVerfiedBatchNumber uint64, dbTx pgx.Tx) (*state.Proof, error) +
    +
    + 58 + +
    +   + GetVirtualBatchToProve(ctx context.Context, lastVerfiedBatchNumber uint64, maxL1Block uint64, dbTx pgx.Tx) (*state.Batch, error) +
    +
    + 59 + +
    + - + GetBatchProofsToAggregate(ctx context.Context, dbTx pgx.Tx) (*state.Proof, *state.Proof, error) +
    +
    + 60 + +
    +   + GetBatchByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.Batch, error) +
    +
    + 61 + +
    + - + AddBatchProof(ctx context.Context, proof *state.Proof, dbTx pgx.Tx) error +
    +
    + 62 + +
    + - + UpdateBatchProof(ctx context.Context, proof *state.Proof, dbTx pgx.Tx) error +
    +
    + 63 + +
    + - + DeleteBatchProofs(ctx context.Context, batchNumber uint64, batchNumberFinal uint64, dbTx pgx.Tx) error +
    +
    + 64 + +
    + - + DeleteUngeneratedBatchProofs(ctx context.Context, dbTx pgx.Tx) error +
    +
    + 65 + +
    + - + CleanupBatchProofs(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error +
    +
    + 66 + +
    + - + CleanupLockedBatchProofs(ctx context.Context, duration string, dbTx pgx.Tx) (int64, error) +
    +
    + 67 + +
    +   + GetL1InfoRootLeafByIndex(ctx context.Context, l1InfoTreeIndex uint32, dbTx pgx.Tx) (state.L1InfoTreeExitRootStorageEntry, error) +
    +
    + 68 + +
    +   + GetLeavesByL1InfoRoot(ctx context.Context, l1InfoRoot common.Hash, dbTx pgx.Tx) ([]state.L1InfoTreeExitRootStorageEntry, error) +
    +
    + 69 + +
    +   + GetVirtualBatchParentHash(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (common.Hash, error) +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 38 + +
    +   +
    +
    +
    + 39 + +
    +   + // etherman contains the methods required to interact with ethereum +
    +
    + 40 + +
    +   + type etherman interface { +
    +
    + 41 + +
    + + + GetRollupId() uint32 +
    +
    + 42 + +
    +   + GetLatestVerifiedBatchNum() (uint64, error) +
    +
    + 43 + +
    +   + BuildTrustedVerifyBatchesTxData(lastVerifiedBatch, newVerifiedBatch uint64, inputs *ethmanTypes.FinalProofInputs, beneficiary common.Address) (to *common.Address, data []byte, err error) +
    +
    + 44 + +
    +   + GetLatestBlockHeader(ctx context.Context) (*types.Header, error) +
    +
    +
     
    +
    + 55 + +
    +   + BeginStateTransaction(ctx context.Context) (pgx.Tx, error) +
    +
    + 56 + +
    +   + CheckProofContainsCompleteSequences(ctx context.Context, proof *state.Proof, dbTx pgx.Tx) (bool, error) +
    +
    + 57 + +
    +   + GetLastVerifiedBatch(ctx context.Context, dbTx pgx.Tx) (*state.VerifiedBatch, error) +
    +
    + 58 + +
    + + + GetProofReadyToVerify(ctx context.Context, lastVerfiedBatchNumber uint64, dbTx pgx.Tx) (*state.Proof, error) +
    +
    + 59 + +
    +   + GetVirtualBatchToProve(ctx context.Context, lastVerfiedBatchNumber uint64, maxL1Block uint64, dbTx pgx.Tx) (*state.Batch, error) +
    +
    + 60 + +
    + + + GetProofsToAggregate(ctx context.Context, dbTx pgx.Tx) (*state.Proof, *state.Proof, error) +
    +
    + 61 + +
    +   + GetBatchByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.Batch, error) +
    +
    + 62 + +
    + + + AddGeneratedProof(ctx context.Context, proof *state.Proof, dbTx pgx.Tx) error +
    +
    + 63 + +
    + + + UpdateGeneratedProof(ctx context.Context, proof *state.Proof, dbTx pgx.Tx) error +
    +
    + 64 + +
    + + + DeleteGeneratedProofs(ctx context.Context, batchNumber uint64, batchNumberFinal uint64, dbTx pgx.Tx) error +
    +
    + 65 + +
    + + + DeleteUngeneratedProofs(ctx context.Context, dbTx pgx.Tx) error +
    +
    + 66 + +
    + + + CleanupGeneratedProofs(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error +
    +
    + 67 + +
    + + + CleanupLockedProofs(ctx context.Context, duration string, dbTx pgx.Tx) (int64, error) +
    +
    + 68 + +
    +   + GetL1InfoRootLeafByIndex(ctx context.Context, l1InfoTreeIndex uint32, dbTx pgx.Tx) (state.L1InfoTreeExitRootStorageEntry, error) +
    +
    + 69 + +
    +   + GetLeavesByL1InfoRoot(ctx context.Context, l1InfoRoot common.Hash, dbTx pgx.Tx) ([]state.L1InfoTreeExitRootStorageEntry, error) +
    +
    + 70 + +
    +   + GetVirtualBatchParentHash(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (common.Hash, error) +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/beacon_client/beacon_client.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,68 +0,0 @@
    +
    + 1 + +
    + - + //go:generate oapi-codegen -package=examplepkg -generate=types,client,spec -o=examplepkg/example-client.go beacon-node-oapi.json +
    +
    + 2 + +
    + - + package beaconclient +
    +
    + 3 + +
    + - +
    +
    +
    + 4 + +
    + - + import ( +
    +
    + 5 + +
    + - + "context" +
    +
    + 6 + +
    + - + "encoding/json" +
    +
    + 7 + +
    + - + "fmt" +
    +
    + 8 + +
    + - + "io" +
    +
    + 9 + +
    + - + "net/http" +
    +
    + 10 + +
    + - + ) +
    +
    + 11 + +
    + - +
    +
    +
    + 12 + +
    + - + // BeaconAPIClient client of Beacon API +
    +
    + 13 + +
    + - + // https://ethereum.github.io/beacon-APIs/ +
    +
    + 14 + +
    + - + type BeaconAPIClient struct { +
    +
    + 15 + +
    + - + urlBase string +
    +
    + 16 + +
    + - + } +
    +
    + 17 + +
    + - +
    +
    +
    + 18 + +
    + - + // NewBeaconAPIClient creates an instance of client +
    +
    + 19 + +
    + - + func NewBeaconAPIClient(url string) *BeaconAPIClient { +
    +
    + 20 + +
    + - + return &BeaconAPIClient{ +
    +
    + 21 + +
    + - + urlBase: url, +
    +
    + 22 + +
    + - + } +
    +
    + 23 + +
    + - + } +
    +
    + 24 + +
    + - +
    +
    +
    + 25 + +
    + - + // BeaconAPIResponse represents the response of the beacon API +
    +
    + 26 + +
    + - + type BeaconAPIResponse struct { +
    +
    + 27 + +
    + - + Result json.RawMessage +
    +
    + 28 + +
    + - + } +
    +
    + 29 + +
    + - +
    +
    +
    + 30 + +
    + - + // JSONRPCBeaconCall executes restapi call to beacon-api node +
    +
    + 31 + +
    + - + func JSONRPCBeaconCall(ctx context.Context, urlBase, methodPath string) (BeaconAPIResponse, error) { +
    +
    + 32 + +
    + - + //url := path.Join(urlBase, methodPath) +
    +
    + 33 + +
    + - + url := fmt.Sprintf("%s%s", urlBase, methodPath) +
    +
    + 34 + +
    + - + httpReq, err := http.NewRequestWithContext(ctx, http.MethodGet, url, http.NoBody) +
    +
    + 35 + +
    + - + if err != nil { +
    +
    + 36 + +
    + - + return BeaconAPIResponse{}, err +
    +
    + 37 + +
    + - + } +
    +
    + 38 + +
    + - + httpReq.Header.Add("Content-type", "application/json") +
    +
    + 39 + +
    + - +
    +
    +
    + 40 + +
    + - + httpRes, err := http.DefaultClient.Do(httpReq) +
    +
    + 41 + +
    + - + if err != nil { +
    +
    + 42 + +
    + - + return BeaconAPIResponse{}, err +
    +
    + 43 + +
    + - + } +
    +
    + 44 + +
    + - +
    +
    +
    + 45 + +
    + - + resBody, err := io.ReadAll(httpRes.Body) +
    +
    + 46 + +
    + - + if err != nil { +
    +
    + 47 + +
    + - + return BeaconAPIResponse{}, err +
    +
    + 48 + +
    + - + } +
    +
    + 49 + +
    + - + defer httpRes.Body.Close() +
    +
    + 50 + +
    + - +
    +
    +
    + 51 + +
    + - + if httpRes.StatusCode != http.StatusOK { +
    +
    + 52 + +
    + - + return BeaconAPIResponse{}, fmt.Errorf("BeaconClient fails url:%s status_code:%v response:%v", url, httpRes.StatusCode, string(resBody)) +
    +
    + 53 + +
    + - + } +
    +
    + 54 + +
    + - +
    +
    +
    + 55 + +
    + - + return BeaconAPIResponse{ +
    +
    + 56 + +
    + - + Result: resBody, +
    +
    + 57 + +
    + - + }, nil +
    +
    + 58 + +
    + - + } +
    +
    + 59 + +
    + - +
    +
    +
    + 60 + +
    + - + func unserializeGenericResponse[T any](response BeaconAPIResponse) (T, error) { +
    +
    + 61 + +
    + - + var result T +
    +
    + 62 + +
    + - + err := json.Unmarshal(response.Result, &result) +
    +
    + 63 + +
    + - + if err != nil { +
    +
    + 64 + +
    + - + var zero T +
    +
    + 65 + +
    + - + return zero, err +
    +
    + 66 + +
    + - + } +
    +
    + 67 + +
    + - + return result, nil +
    +
    + 68 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/beacon_client/req_beacon_blob_sidecars.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,92 +0,0 @@
    +
    + 1 + +
    + - + package beaconclient +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + import ( +
    +
    + 4 + +
    + - + "context" +
    +
    + 5 + +
    + - + "fmt" +
    +
    + 6 + +
    + - + "strconv" +
    +
    + 7 + +
    + - +
    +
    +
    + 8 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/hex" +
    +
    + 9 + +
    + - + ) +
    +
    + 10 + +
    + - +
    +
    +
    + 11 + +
    + - + const beaconBlobSidecarsPath = "/eth/v1/beacon/blob_sidecars/" +
    +
    + 12 + +
    + - +
    +
    +
    + 13 + +
    + - + // BeaconBlobSidecarsResponse represents the response of the beacon blob sidecars endpoint +
    +
    + 14 + +
    + - + type BeaconBlobSidecarsResponse struct { +
    +
    + 15 + +
    + - + Sidecars map[uint64]BeaconBlobSidecarResponse +
    +
    + 16 + +
    + - + } +
    +
    + 17 + +
    + - +
    +
    +
    + 18 + +
    + - + // BeaconBlobSidecarResponse represents the response of the config spec endpoint +
    +
    + 19 + +
    + - + type BeaconBlobSidecarResponse struct { +
    +
    + 20 + +
    + - + Index uint64 +
    +
    + 21 + +
    + - + KzgCommitment string +
    +
    + 22 + +
    + - + Blob []byte +
    +
    + 23 + +
    + - + } +
    +
    + 24 + +
    + - +
    +
    +
    + 25 + +
    + - + type beaconBlobSidecarsResponseInternal struct { +
    +
    + 26 + +
    + - + Data []struct { +
    +
    + 27 + +
    + - + Index string `json:"index"` +
    +
    + 28 + +
    + - + Blob string `json:"blob"` +
    +
    + 29 + +
    + - + KzgCommitment string `json:"kzg_commitment"` +
    +
    + 30 + +
    + - + KzgProof string `json:"kzg_proof"` +
    +
    + 31 + +
    + - + SignedBlockHeader struct { +
    +
    + 32 + +
    + - + Message struct { +
    +
    + 33 + +
    + - + Slot string `json:"slot"` +
    +
    + 34 + +
    + - + ProposerIndex string `json:"proposer_index"` +
    +
    + 35 + +
    + - + ParentRoot string `json:"parent_root"` +
    +
    + 36 + +
    + - + StateRoot string `json:"state_root"` +
    +
    + 37 + +
    + - + BodyRoot string `json:"body_root"` +
    +
    + 38 + +
    + - + } `json:"message"` +
    +
    + 39 + +
    + - + Signature string `json:"signature"` +
    +
    + 40 + +
    + - + } `json:"signed_block_header"` +
    +
    + 41 + +
    + - + KzgCommitmentInclusionProof []string `json:"kzg_commitment_inclusion_proof"` +
    +
    + 42 + +
    + - + } `json:"data"` +
    +
    + 43 + +
    + - + } +
    +
    + 44 + +
    + - +
    +
    +
    + 45 + +
    + - + func has0xPrefix(str string) bool { +
    +
    + 46 + +
    + - + return len(str) >= 2 && str[0] == '0' && (str[1] == 'x' || str[1] == 'X') +
    +
    + 47 + +
    + - + } +
    +
    + 48 + +
    + - +
    +
    +
    + 49 + +
    + - + func convertBeaconBlobSidecarsResponseInternal(data beaconBlobSidecarsResponseInternal) (*BeaconBlobSidecarsResponse, error) { +
    +
    + 50 + +
    + - + response := BeaconBlobSidecarsResponse{ +
    +
    + 51 + +
    + - + Sidecars: make(map[uint64]BeaconBlobSidecarResponse), +
    +
    + 52 + +
    + - + } +
    +
    + 53 + +
    + - + for _, sidecar := range data.Data { +
    +
    + 54 + +
    + - + index, err := strconv.ParseUint(sidecar.Index, 0, hex.BitSize64) +
    +
    + 55 + +
    + - + if err != nil { +
    +
    + 56 + +
    + - + return nil, fmt.Errorf("error parsing Index: %v", err) +
    +
    + 57 + +
    + - + } +
    +
    + 58 + +
    + - + //common.Hex2Bytes(sidecar.Blob) +
    +
    + 59 + +
    + - + if has0xPrefix(sidecar.Blob) { +
    +
    + 60 + +
    + - + sidecar.Blob = sidecar.Blob[2:] +
    +
    + 61 + +
    + - + } +
    +
    + 62 + +
    + - + blob, err := hex.DecodeHex(sidecar.Blob) +
    +
    + 63 + +
    + - + if err != nil { +
    +
    + 64 + +
    + - + return nil, fmt.Errorf("error decoding Blob: %v", err) +
    +
    + 65 + +
    + - + } +
    +
    + 66 + +
    + - + response.Sidecars[index] = BeaconBlobSidecarResponse{ +
    +
    + 67 + +
    + - + Index: index, +
    +
    + 68 + +
    + - + KzgCommitment: sidecar.KzgCommitment, +
    +
    + 69 + +
    + - + Blob: blob, +
    +
    + 70 + +
    + - + } +
    +
    + 71 + +
    + - + } +
    +
    + 72 + +
    + - + return &response, nil +
    +
    + 73 + +
    + - + } +
    +
    + 74 + +
    + - +
    +
    +
    + 75 + +
    + - + // BeaconBlobSidecars fetches the blob sidecars for a given blockID +
    +
    + 76 + +
    + - + func (c *BeaconAPIClient) BeaconBlobSidecars(ctx context.Context, blockID uint64) (*BeaconBlobSidecarsResponse, error) { +
    +
    + 77 + +
    + - + response, err := JSONRPCBeaconCall(ctx, c.urlBase, beaconBlobSidecarsPath+fmt.Sprintf("%d", blockID)) +
    +
    + 78 + +
    + - + if err != nil { +
    +
    + 79 + +
    + - + return nil, err +
    +
    + 80 + +
    + - + } +
    +
    + 81 + +
    + - +
    +
    +
    + 82 + +
    + - + internalStruct, err := unserializeGenericResponse[beaconBlobSidecarsResponseInternal](response) +
    +
    + 83 + +
    + - + if err != nil { +
    +
    + 84 + +
    + - + return nil, err +
    +
    + 85 + +
    + - + } +
    +
    + 86 + +
    + - +
    +
    +
    + 87 + +
    + - + responseData, err := convertBeaconBlobSidecarsResponseInternal(internalStruct) +
    +
    + 88 + +
    + - + if err != nil { +
    +
    + 89 + +
    + - + return nil, err +
    +
    + 90 + +
    + - + } +
    +
    + 91 + +
    + - + return responseData, nil +
    +
    + 92 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/beacon_client/req_beacon_genesis.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,60 +0,0 @@
    +
    + 1 + +
    + - + package beaconclient +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + import ( +
    +
    + 4 + +
    + - + "context" +
    +
    + 5 + +
    + - + "fmt" +
    +
    + 6 + +
    + - + "strconv" +
    +
    + 7 + +
    + - +
    +
    +
    + 8 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/hex" +
    +
    + 9 + +
    + - + "github.com/ethereum/go-ethereum/common" +
    +
    + 10 + +
    + - + ) +
    +
    + 11 + +
    + - +
    +
    +
    + 12 + +
    + - + // /eth/v1/beacon/genesis +
    +
    + 13 + +
    + - + const beaconGenesisPath = "/eth/v1/beacon/genesis" +
    +
    + 14 + +
    + - +
    +
    +
    + 15 + +
    + - + // BeaconGenesisResponse represents the response of the beacon genesis endpoint +
    +
    + 16 + +
    + - + type BeaconGenesisResponse struct { +
    +
    + 17 + +
    + - + GenesisTime uint64 +
    +
    + 18 + +
    + - + GenesisValidatorsRoot common.Address +
    +
    + 19 + +
    + - + GenesisForkVersion string +
    +
    + 20 + +
    + - + } +
    +
    + 21 + +
    + - +
    +
    +
    + 22 + +
    + - + type beaconGenesisResponseInternal struct { +
    +
    + 23 + +
    + - + Data struct { +
    +
    + 24 + +
    + - + GenesisTime string `json:"genesis_time"` +
    +
    + 25 + +
    + - + GenesisValidatorsRoot string `json:"genesis_validators_root"` +
    +
    + 26 + +
    + - + GenesisForkVersion string `json:"genesis_fork_version"` +
    +
    + 27 + +
    + - + } `json:"data"` +
    +
    + 28 + +
    + - + } +
    +
    + 29 + +
    + - +
    +
    +
    + 30 + +
    + - + func convertBeaconGenesisResponseInternal(data beaconGenesisResponseInternal) (BeaconGenesisResponse, error) { +
    +
    + 31 + +
    + - + genesisTime, err := strconv.ParseUint(data.Data.GenesisTime, 0, hex.BitSize64) +
    +
    + 32 + +
    + - + if err != nil { +
    +
    + 33 + +
    + - + return BeaconGenesisResponse{}, fmt.Errorf("error parsing genesisTime: %v", err) +
    +
    + 34 + +
    + - + } +
    +
    + 35 + +
    + - + res := BeaconGenesisResponse{ +
    +
    + 36 + +
    + - + GenesisTime: genesisTime, +
    +
    + 37 + +
    + - + GenesisValidatorsRoot: common.HexToAddress(data.Data.GenesisValidatorsRoot), +
    +
    + 38 + +
    + - + GenesisForkVersion: data.Data.GenesisForkVersion, +
    +
    + 39 + +
    + - + } +
    +
    + 40 + +
    + - + return res, nil +
    +
    + 41 + +
    + - + } +
    +
    + 42 + +
    + - +
    +
    +
    + 43 + +
    + - + // BeaconGenesis request the current beacon chain genesis +
    +
    + 44 + +
    + - + func (c *BeaconAPIClient) BeaconGenesis(ctx context.Context) (*BeaconGenesisResponse, error) { +
    +
    + 45 + +
    + - + response, err := JSONRPCBeaconCall(ctx, c.urlBase, beaconGenesisPath) +
    +
    + 46 + +
    + - + if err != nil { +
    +
    + 47 + +
    + - + return nil, err +
    +
    + 48 + +
    + - + } +
    +
    + 49 + +
    + - +
    +
    +
    + 50 + +
    + - + internalStruct, err := unserializeGenericResponse[beaconGenesisResponseInternal](response) +
    +
    + 51 + +
    + - + if err != nil { +
    +
    + 52 + +
    + - + return nil, err +
    +
    + 53 + +
    + - + } +
    +
    + 54 + +
    + - +
    +
    +
    + 55 + +
    + - + responseData, err := convertBeaconGenesisResponseInternal(internalStruct) +
    +
    + 56 + +
    + - + if err != nil { +
    +
    + 57 + +
    + - + return nil, err +
    +
    + 58 + +
    + - + } +
    +
    + 59 + +
    + - + return &responseData, nil +
    +
    + 60 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/beacon_client/req_config_spec.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,64 +0,0 @@
    +
    + 1 + +
    + - + package beaconclient +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + import ( +
    +
    + 4 + +
    + - + "context" +
    +
    + 5 + +
    + - + "fmt" +
    +
    + 6 + +
    + - + "strconv" +
    +
    + 7 + +
    + - +
    +
    +
    + 8 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/hex" +
    +
    + 9 + +
    + - + ) +
    +
    + 10 + +
    + - +
    +
    +
    + 11 + +
    + - + // ConfigSpec returns the current beacon chain configuration +
    +
    + 12 + +
    + - + // Curl example: +
    +
    + 13 + +
    + - + // curl -X 'GET' \ +
    +
    + 14 + +
    + - + // 'http://localhost/eth/v1/config/spec' \ +
    +
    + 15 + +
    + - + // -H 'accept: application/json' +
    +
    + 16 + +
    + - + const configSpecPath = "/eth/v1/config/spec" +
    +
    + 17 + +
    + - +
    +
    +
    + 18 + +
    + - + // ConfigSpecNodeResponse represents the response of the config spec endpoint +
    +
    + 19 + +
    + - + type ConfigSpecNodeResponse struct { +
    +
    + 20 + +
    + - + SecondsPerSlot uint64 +
    +
    + 21 + +
    + - + SecondsPerEth1Block uint64 +
    +
    + 22 + +
    + - + } +
    +
    + 23 + +
    + - +
    +
    +
    + 24 + +
    + - + type configSpecNodeResponseInternal struct { +
    +
    + 25 + +
    + - + Data struct { +
    +
    + 26 + +
    + - + SecondsPerSlot string `json:"SECONDS_PER_SLOT"` +
    +
    + 27 + +
    + - + SecondsPerEth1Block string `json:"SECONDS_PER_ETH1_BLOCK"` +
    +
    + 28 + +
    + - + } +
    +
    + 29 + +
    + - + } +
    +
    + 30 + +
    + - +
    +
    +
    + 31 + +
    + - + func convertConfigSpecResponseInternal(data configSpecNodeResponseInternal) (ConfigSpecNodeResponse, error) { +
    +
    + 32 + +
    + - + tmpSecondsPerSlot, err := strconv.ParseUint(data.Data.SecondsPerSlot, 0, hex.BitSize64) +
    +
    + 33 + +
    + - + if err != nil { +
    +
    + 34 + +
    + - + return ConfigSpecNodeResponse{}, fmt.Errorf("error parsing SecondsPerSlot: %v", err) +
    +
    + 35 + +
    + - + } +
    +
    + 36 + +
    + - + tmpSecondsPerEth1Block, err := strconv.ParseUint(data.Data.SecondsPerEth1Block, 0, hex.BitSize64) +
    +
    + 37 + +
    + - + if err != nil { +
    +
    + 38 + +
    + - + return ConfigSpecNodeResponse{}, fmt.Errorf("error parsing SecondsPerSlot: %v", err) +
    +
    + 39 + +
    + - + } +
    +
    + 40 + +
    + - + res := ConfigSpecNodeResponse{ +
    +
    + 41 + +
    + - + SecondsPerSlot: tmpSecondsPerSlot, +
    +
    + 42 + +
    + - + SecondsPerEth1Block: tmpSecondsPerEth1Block, +
    +
    + 43 + +
    + - + } +
    +
    + 44 + +
    + - + return res, nil +
    +
    + 45 + +
    + - + } +
    +
    + 46 + +
    + - +
    +
    +
    + 47 + +
    + - + // ConfigSpec returns the current beacon chain configuration +
    +
    + 48 + +
    + - + func (c *BeaconAPIClient) ConfigSpec(ctx context.Context) (*ConfigSpecNodeResponse, error) { +
    +
    + 49 + +
    + - + response, err := JSONRPCBeaconCall(ctx, c.urlBase, configSpecPath) +
    +
    + 50 + +
    + - + if err != nil { +
    +
    + 51 + +
    + - + return nil, err +
    +
    + 52 + +
    + - + } +
    +
    + 53 + +
    + - +
    +
    +
    + 54 + +
    + - + internalStruct, err := unserializeGenericResponse[configSpecNodeResponseInternal](response) +
    +
    + 55 + +
    + - + if err != nil { +
    +
    + 56 + +
    + - + return nil, err +
    +
    + 57 + +
    + - + } +
    +
    + 58 + +
    + - +
    +
    +
    + 59 + +
    + - + responseData, err := convertConfigSpecResponseInternal(internalStruct) +
    +
    + 60 + +
    + - + if err != nil { +
    +
    + 61 + +
    + - + return nil, err +
    +
    + 62 + +
    + - + } +
    +
    + 63 + +
    + - + return &responseData, nil +
    +
    + 64 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/approve.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -51,14 +51,14 @@
    +
    + 51 + +
    +   + setupLog(c.Log) +
    +
    + 52 + +
    +   +
    +
    +
    + 53 + +
    +   + // Check if it is already registered +
    +
    + 54 + +
    + - + etherman, err := newEtherman(*c) +
    +
    + 55 + +
    +   + if err != nil { +
    +
    + 56 + +
    +   + log.Fatal(err) +
    +
    + 57 + +
    +   + return err +
    +
    + 58 + +
    +   + } +
    +
    + 59 + +
    +   +
    +
    +
    + 60 + +
    +   + // load auth from keystore file +
    +
    + 61 + +
    + - + auth, err := etherman.LoadAuthFromKeyStore(addrKeyStorePath, addrPassword) +
    +
    + 62 + +
    +   + if err != nil { +
    +
    + 63 + +
    +   + log.Fatal(err) +
    +
    + 64 + +
    +   + return err +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 51 + +
    +   + setupLog(c.Log) +
    +
    + 52 + +
    +   +
    +
    +
    + 53 + +
    +   + // Check if it is already registered +
    +
    + 54 + +
    + + + etherman, err := newEtherman(*c, nil) +
    +
    + 55 + +
    +   + if err != nil { +
    +
    + 56 + +
    +   + log.Fatal(err) +
    +
    + 57 + +
    +   + return err +
    +
    + 58 + +
    +   + } +
    +
    + 59 + +
    +   +
    +
    +
    + 60 + +
    +   + // load auth from keystore file +
    +
    + 61 + +
    + + + auth, _, err := etherman.LoadAuthFromKeyStore(addrKeyStorePath, addrPassword) +
    +
    + 62 + +
    +   + if err != nil { +
    +
    + 63 + +
    +   + log.Fatal(err) +
    +
    + 64 + +
    +   + return err +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/main.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -47,7 +47,7 @@
    +
    + 47 + +
    +   + networkFlag = cli.StringFlag{ +
    +
    + 48 + +
    +   + Name: config.FlagNetwork, +
    +
    + 49 + +
    +   + Aliases: []string{"net"}, +
    +
    + 50 + +
    + - + Usage: "Load default network configuration. Supported values: [`mainnet`, `testnet`, `cardona`, `custom`]", +
    +
    + 51 + +
    +   + Required: true, +
    +
    + 52 + +
    +   + } +
    +
    + 53 + +
    +   + customNetworkFlag = cli.StringFlag{ +
    +
    +
    @@ -186,6 +186,13 @@
    +
    + 186 + +
    +   + Action: restore, +
    +
    + 187 + +
    +   + Flags: restoreFlags, +
    +
    + 188 + +
    +   + }, +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 189 + +
    +   + } +
    +
    + 190 + +
    +   +
    +
    +
    + 191 + +
    +   + err := app.Run(os.Args) +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 47 + +
    +   + networkFlag = cli.StringFlag{ +
    +
    + 48 + +
    +   + Name: config.FlagNetwork, +
    +
    + 49 + +
    +   + Aliases: []string{"net"}, +
    +
    + 50 + +
    + + + Usage: "Load default network configuration. Supported values: [`custom`]", +
    +
    + 51 + +
    +   + Required: true, +
    +
    + 52 + +
    +   + } +
    +
    + 53 + +
    +   + customNetworkFlag = cli.StringFlag{ +
    +
    +
     
    +
    + 186 + +
    +   + Action: restore, +
    +
    + 187 + +
    +   + Flags: restoreFlags, +
    +
    + 188 + +
    +   + }, +
    +
    + 189 + +
    + + + { +
    +
    + 190 + +
    + + + Name: "set-data-availability-protocol", +
    +
    + 191 + +
    + + + Aliases: []string{"set-dap"}, +
    +
    + 192 + +
    + + + Usage: "Sets the new data availability protocol", +
    +
    + 193 + +
    + + + Action: setDataAvailabilityProtocol, +
    +
    + 194 + +
    + + + Flags: setDataAvailabilityProtocolFlags, +
    +
    + 195 + +
    + + + }, +
    +
    + 196 + +
    +   + } +
    +
    + 197 + +
    +   +
    +
    +
    + 198 + +
    +   + err := app.Run(os.Args) +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/policy.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -0,0 +1,308 @@
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 1 + +
    + + + package main +
    +
    + 2 + +
    + + +
    +
    +
    + 3 + +
    + + + import ( +
    +
    + 4 + +
    + + + "context" +
    +
    + 5 + +
    + + + "encoding/csv" +
    +
    + 6 + +
    + + + "errors" +
    +
    + 7 + +
    + + + "fmt" +
    +
    + 8 + +
    + + + "os" +
    +
    + 9 + +
    + + + "strings" +
    +
    + 10 + +
    + + +
    +
    +
    + 11 + +
    + + + "github.com/0xPolygonHermez/zkevm-node/config" +
    +
    + 12 + +
    + + + "github.com/0xPolygonHermez/zkevm-node/pool" +
    +
    + 13 + +
    + + + "github.com/0xPolygonHermez/zkevm-node/pool/pgpoolstorage" +
    +
    + 14 + +
    + + + "github.com/ethereum/go-ethereum/common" +
    +
    + 15 + +
    + + + "github.com/urfave/cli/v2" +
    +
    + 16 + +
    + + + ) +
    +
    + 17 + +
    + + +
    +
    +
    + 18 + +
    + + + var ( +
    +
    + 19 + +
    + + + policyFlag = cli.StringFlag{ +
    +
    + 20 + +
    + + + Name: "policy", +
    +
    + 21 + +
    + + + Aliases: []string{"p"}, +
    +
    + 22 + +
    + + + Usage: "Name of policy to operate on", +
    +
    + 23 + +
    + + + Required: false, +
    +
    + 24 + +
    + + + } +
    +
    + 25 + +
    + + + csvFlag = cli.StringFlag{ +
    +
    + 26 + +
    + + + Name: "csv", +
    +
    + 27 + +
    + + + Usage: "CSV file with addresses", +
    +
    + 28 + +
    + + + Required: false, +
    +
    + 29 + +
    + + + } +
    +
    + 30 + +
    + + + allowFlag = cli.BoolFlag{ +
    +
    + 31 + +
    + + + Name: "allow", +
    +
    + 32 + +
    + + + Usage: "Update policy to 'allow' addresses on list", +
    +
    + 33 + +
    + + + Required: false, +
    +
    + 34 + +
    + + + } +
    +
    + 35 + +
    + + + denyFlag = cli.BoolFlag{ +
    +
    + 36 + +
    + + + Name: "deny", +
    +
    + 37 + +
    + + + Usage: "Update policy to 'deny' addresses on list", +
    +
    + 38 + +
    + + + Required: false, +
    +
    + 39 + +
    + + + } +
    +
    + 40 + +
    + + + noHeaderFlag = cli.BoolFlag{ +
    +
    + 41 + +
    + + + Name: "no-header", +
    +
    + 42 + +
    + + + Value: false, +
    +
    + 43 + +
    + + + Required: false, +
    +
    + 44 + +
    + + + } +
    +
    + 45 + +
    + + +
    +
    +
    + 46 + +
    + + + policyActionFlags = []cli.Flag{&policyFlag} +
    +
    + 47 + +
    + + + ) +
    +
    + 48 + +
    + + +
    +
    +
    + 49 + +
    + + + var policyCommands = cli.Command{ +
    +
    + 50 + +
    + + + Name: "policy", +
    +
    + 51 + +
    + + + Usage: "View, update, and apply policies", +
    +
    + 52 + +
    + + + Action: describe, +
    +
    + 53 + +
    + + + Flags: []cli.Flag{&configFileFlag}, +
    +
    + 54 + +
    + + + Subcommands: []*cli.Command{ +
    +
    + 55 + +
    + + + { +
    +
    + 56 + +
    + + + Name: "add", +
    +
    + 57 + +
    + + + Usage: "Add address(es) to a policy exclusion list", +
    +
    + 58 + +
    + + + Action: addAcl, +
    +
    + 59 + +
    + + + Flags: append(policyActionFlags, &csvFlag), +
    +
    + 60 + +
    + + + }, { +
    +
    + 61 + +
    + + + Name: "clear", +
    +
    + 62 + +
    + + + Usage: "Clear the addresses listed as exceptions to a policy", +
    +
    + 63 + +
    + + + Action: clearAcl, +
    +
    + 64 + +
    + + + Flags: policyActionFlags, +
    +
    + 65 + +
    + + + }, { +
    +
    + 66 + +
    + + + Name: "describe", +
    +
    + 67 + +
    + + + Usage: "Describe the default actions for the policies", +
    +
    + 68 + +
    + + + Action: describe, +
    +
    + 69 + +
    + + + Flags: append(policyActionFlags, &noHeaderFlag), +
    +
    + 70 + +
    + + + }, { +
    +
    + 71 + +
    + + + Name: "remove", +
    +
    + 72 + +
    + + + Usage: "Remove address(es) from a policy exclusion list", +
    +
    + 73 + +
    + + + Action: removeAcl, +
    +
    + 74 + +
    + + + Flags: append(policyActionFlags, &csvFlag), +
    +
    + 75 + +
    + + + }, { +
    +
    + 76 + +
    + + + Name: "update", +
    +
    + 77 + +
    + + + Usage: "Update the default action for a policy", +
    +
    + 78 + +
    + + + Action: updatePolicy, +
    +
    + 79 + +
    + + + Flags: append(policyActionFlags, &allowFlag, &denyFlag), +
    +
    + 80 + +
    + + + }, +
    +
    + 81 + +
    + + + }, +
    +
    + 82 + +
    + + + } +
    +
    + 83 + +
    + + +
    +
    +
    + 84 + +
    + + + func updatePolicy(cli *cli.Context) error { +
    +
    + 85 + +
    + + + _, db, err := configAndStorage(cli) +
    +
    + 86 + +
    + + + if err != nil { +
    +
    + 87 + +
    + + + return err +
    +
    + 88 + +
    + + + } +
    +
    + 89 + +
    + + + policy, err := resolvePolicy(cli) +
    +
    + 90 + +
    + + + if err != nil { +
    +
    + 91 + +
    + + + return err +
    +
    + 92 + +
    + + + } +
    +
    + 93 + +
    + + +
    +
    +
    + 94 + +
    + + + allow := cli.Bool(allowFlag.Name) +
    +
    + 95 + +
    + + + deny := cli.Bool(denyFlag.Name) +
    +
    + 96 + +
    + + +
    +
    +
    + 97 + +
    + + + // exactly one must be set +
    +
    + 98 + +
    + + + if (allow && deny) || (!allow && !deny) { +
    +
    + 99 + +
    + + + return errors.New("supply one policy action [--allow or --deny]") +
    +
    + 100 + +
    + + + } +
    +
    + 101 + +
    + + +
    +
    +
    + 102 + +
    + + + var setting bool +
    +
    + 103 + +
    + + + if allow { +
    +
    + 104 + +
    + + + setting = true +
    +
    + 105 + +
    + + + } else if deny { +
    +
    + 106 + +
    + + + setting = false +
    +
    + 107 + +
    + + + } +
    +
    + 108 + +
    + + +
    +
    +
    + 109 + +
    + + + err = db.UpdatePolicy(context.Background(), policy, setting) +
    +
    + 110 + +
    + + + if err != nil { +
    +
    + 111 + +
    + + + return err +
    +
    + 112 + +
    + + + } +
    +
    + 113 + +
    + + + return nil +
    +
    + 114 + +
    + + + } +
    +
    + 115 + +
    + + +
    +
    +
    + 116 + +
    + + + func addAcl(cli *cli.Context) error { +
    +
    + 117 + +
    + + + _, db, err := configAndStorage(cli) +
    +
    + 118 + +
    + + + if err != nil { +
    +
    + 119 + +
    + + + return err +
    +
    + 120 + +
    + + + } +
    +
    + 121 + +
    + + + policy, addresses, err := requirePolicyAndAddresses(cli) +
    +
    + 122 + +
    + + + if err != nil { +
    +
    + 123 + +
    + + + return err +
    +
    + 124 + +
    + + + } +
    +
    + 125 + +
    + + + err = db.AddAddressesToPolicy(context.Background(), policy, addresses) +
    +
    + 126 + +
    + + + if err != nil { +
    +
    + 127 + +
    + + + return err +
    +
    + 128 + +
    + + + } +
    +
    + 129 + +
    + + + return nil +
    +
    + 130 + +
    + + + } +
    +
    + 131 + +
    + + +
    +
    +
    + 132 + +
    + + + func removeAcl(cli *cli.Context) error { +
    +
    + 133 + +
    + + + _, db, err := configAndStorage(cli) +
    +
    + 134 + +
    + + + if err != nil { +
    +
    + 135 + +
    + + + return err +
    +
    + 136 + +
    + + + } +
    +
    + 137 + +
    + + + policy, addresses, err := requirePolicyAndAddresses(cli) +
    +
    + 138 + +
    + + + if err != nil { +
    +
    + 139 + +
    + + + return err +
    +
    + 140 + +
    + + + } +
    +
    + 141 + +
    + + + err = db.RemoveAddressesFromPolicy(context.Background(), policy, addresses) +
    +
    + 142 + +
    + + + if err != nil { +
    +
    + 143 + +
    + + + return err +
    +
    + 144 + +
    + + + } +
    +
    + 145 + +
    + + + return nil +
    +
    + 146 + +
    + + + } +
    +
    + 147 + +
    + + +
    +
    +
    + 148 + +
    + + + func clearAcl(cli *cli.Context) error { +
    +
    + 149 + +
    + + + _, db, err := configAndStorage(cli) +
    +
    + 150 + +
    + + + if err != nil { +
    +
    + 151 + +
    + + + return err +
    +
    + 152 + +
    + + + } +
    +
    + 153 + +
    + + + policy, err := resolvePolicy(cli) +
    +
    + 154 + +
    + + + if err != nil { +
    +
    + 155 + +
    + + + return err +
    +
    + 156 + +
    + + + } +
    +
    + 157 + +
    + + + err = db.ClearPolicy(context.Background(), policy) +
    +
    + 158 + +
    + + + if err != nil { +
    +
    + 159 + +
    + + + return err +
    +
    + 160 + +
    + + + } +
    +
    + 161 + +
    + + + return nil +
    +
    + 162 + +
    + + + } +
    +
    + 163 + +
    + + +
    +
    +
    + 164 + +
    + + + func describe(cli *cli.Context) error { +
    +
    + 165 + +
    + + + showHeader := !cli.Bool(noHeaderFlag.Name) +
    +
    + 166 + +
    + + + if cli.IsSet(policyFlag.Name) { +
    +
    + 167 + +
    + + + return describePolicy(cli, showHeader) +
    +
    + 168 + +
    + + + } +
    +
    + 169 + +
    + + + return describePolicies(cli, showHeader) +
    +
    + 170 + +
    + + + } +
    +
    + 171 + +
    + + +
    +
    +
    + 172 + +
    + + + func describePolicy(cli *cli.Context, showHeader bool) error { +
    +
    + 173 + +
    + + + _, db, err := configAndStorage(cli) +
    +
    + 174 + +
    + + + if err != nil { +
    +
    + 175 + +
    + + + return err +
    +
    + 176 + +
    + + + } +
    +
    + 177 + +
    + + +
    +
    +
    + 178 + +
    + + + policyName, err := resolvePolicy(cli) +
    +
    + 179 + +
    + + + if err != nil { +
    +
    + 180 + +
    + + + return err +
    +
    + 181 + +
    + + + } +
    +
    + 182 + +
    + + +
    +
    +
    + 183 + +
    + + + if showHeader { +
    +
    + 184 + +
    + + + policy, err := db.DescribePolicy(context.Background(), policyName) +
    +
    + 185 + +
    + + + if err != nil { +
    +
    + 186 + +
    + + + return err +
    +
    + 187 + +
    + + + } +
    +
    + 188 + +
    + + + fmt.Printf("%s: %s\n", "Policy", policy.Name) +
    +
    + 189 + +
    + + + fmt.Printf("%s: %s\n", "Action", policy.Desc()) +
    +
    + 190 + +
    + + + } +
    +
    + 191 + +
    + + + query, err := resolveAddresses(cli, false) +
    +
    + 192 + +
    + + + if err != nil { +
    +
    + 193 + +
    + + + return nil +
    +
    + 194 + +
    + + + } +
    +
    + 195 + +
    + + + list, err := db.ListAcl(context.Background(), policyName, query) +
    +
    + 196 + +
    + + + if err != nil { +
    +
    + 197 + +
    + + + return err +
    +
    + 198 + +
    + + + } +
    +
    + 199 + +
    + + +
    +
    +
    + 200 + +
    + + + if showHeader { +
    +
    + 201 + +
    + + + fmt.Println("Addresses:") +
    +
    + 202 + +
    + + + } +
    +
    + 203 + +
    + + + for _, address := range list { +
    +
    + 204 + +
    + + + fmt.Println(address.Hex()) +
    +
    + 205 + +
    + + + } +
    +
    + 206 + +
    + + + return nil +
    +
    + 207 + +
    + + + } +
    +
    + 208 + +
    + + +
    +
    +
    + 209 + +
    + + + func describePolicies(cli *cli.Context, showHeader bool) error { +
    +
    + 210 + +
    + + + _, db, err := configAndStorage(cli) +
    +
    + 211 + +
    + + + if err != nil { +
    +
    + 212 + +
    + + + return err +
    +
    + 213 + +
    + + + } +
    +
    + 214 + +
    + + + list, err := db.DescribePolicies(context.Background()) +
    +
    + 215 + +
    + + + if err != nil { +
    +
    + 216 + +
    + + + return err +
    +
    + 217 + +
    + + + } +
    +
    + 218 + +
    + + +
    +
    +
    + 219 + +
    + + + if showHeader { +
    +
    + 220 + +
    + + + fmt.Printf("%7s: %s\n", "Policy", "Action") +
    +
    + 221 + +
    + + + } +
    +
    + 222 + +
    + + + for _, p := range list { +
    +
    + 223 + +
    + + + fmt.Printf("%7s: %s\n", p.Name, p.Desc()) +
    +
    + 224 + +
    + + + } +
    +
    + 225 + +
    + + +
    +
    +
    + 226 + +
    + + + return nil +
    +
    + 227 + +
    + + + } +
    +
    + 228 + +
    + + +
    +
    +
    + 229 + +
    + + + func configAndStorage(cli *cli.Context) (*config.Config, *pgpoolstorage.PostgresPoolStorage, error) { +
    +
    + 230 + +
    + + + c, err := config.Load(cli, false) +
    +
    + 231 + +
    + + + if err != nil { +
    +
    + 232 + +
    + + + return nil, nil, err +
    +
    + 233 + +
    + + + } +
    +
    + 234 + +
    + + + setupLog(c.Log) +
    +
    + 235 + +
    + + +
    +
    +
    + 236 + +
    + + + db, err := pgpoolstorage.NewPostgresPoolStorage(c.Pool.DB) +
    +
    + 237 + +
    + + + if err != nil { +
    +
    + 238 + +
    + + + return nil, nil, err +
    +
    + 239 + +
    + + + } +
    +
    + 240 + +
    + + + return c, db, nil +
    +
    + 241 + +
    + + + } +
    +
    + 242 + +
    + + +
    +
    +
    + 243 + +
    + + + func requirePolicyAndAddresses(cli *cli.Context) (pool.PolicyName, []common.Address, error) { +
    +
    + 244 + +
    + + + policy, err := resolvePolicy(cli) +
    +
    + 245 + +
    + + + if err != nil { +
    +
    + 246 + +
    + + + return "", nil, err +
    +
    + 247 + +
    + + + } +
    +
    + 248 + +
    + + + addresses, err := resolveAddresses(cli, true) +
    +
    + 249 + +
    + + + if err != nil { +
    +
    + 250 + +
    + + + return "", nil, err +
    +
    + 251 + +
    + + + } +
    +
    + 252 + +
    + + + return policy, addresses, nil +
    +
    + 253 + +
    + + + } +
    +
    + 254 + +
    + + +
    +
    +
    + 255 + +
    + + + func resolvePolicy(cli *cli.Context) (pool.PolicyName, error) { +
    +
    + 256 + +
    + + + policy := cli.String(policyFlag.Name) +
    +
    + 257 + +
    + + + if policy == "" { +
    +
    + 258 + +
    + + + return "", nil +
    +
    + 259 + +
    + + + } +
    +
    + 260 + +
    + + + if !pool.IsPolicy(policy) { +
    +
    + 261 + +
    + + + return "", fmt.Errorf("invalid policy name: %s", policy) +
    +
    + 262 + +
    + + + } +
    +
    + 263 + +
    + + + return pool.PolicyName(policy), nil +
    +
    + 264 + +
    + + + } +
    +
    + 265 + +
    + + +
    +
    +
    + 266 + +
    + + + func resolveAddresses(cli *cli.Context, failIfEmpty bool) ([]common.Address, error) { +
    +
    + 267 + +
    + + + var set = make(map[common.Address]struct{}) +
    +
    + 268 + +
    + + + if cli.IsSet("csv") { +
    +
    + 269 + +
    + + + file := cli.String(csvFlag.Name) +
    +
    + 270 + +
    + + + fd, err := os.Open(file) +
    +
    + 271 + +
    + + + if err != nil { +
    +
    + 272 + +
    + + + return nil, err +
    +
    + 273 + +
    + + + } +
    +
    + 274 + +
    + + + defer func(fd *os.File) { +
    +
    + 275 + +
    + + + _ = fd.Close() +
    +
    + 276 + +
    + + + }(fd) +
    +
    + 277 + +
    + + +
    +
    +
    + 278 + +
    + + + fileReader := csv.NewReader(fd) +
    +
    + 279 + +
    + + + records, err := fileReader.ReadAll() +
    +
    + 280 + +
    + + +
    +
    +
    + 281 + +
    + + + if err != nil { +
    +
    + 282 + +
    + + + return nil, err +
    +
    + 283 + +
    + + + } +
    +
    + 284 + +
    + + + for _, row := range records { +
    +
    + 285 + +
    + + + for _, cell := range row { +
    +
    + 286 + +
    + + + hex := strings.TrimSpace(cell) +
    +
    + 287 + +
    + + + set[common.HexToAddress(hex)] = struct{}{} +
    +
    + 288 + +
    + + + } +
    +
    + 289 + +
    + + + } +
    +
    + 290 + +
    + + + } +
    +
    + 291 + +
    + + +
    +
    +
    + 292 + +
    + + + for _, a := range cli.Args().Slice() { +
    +
    + 293 + +
    + + + a = strings.TrimSpace(a) +
    +
    + 294 + +
    + + + a = strings.Trim(a, ",|") +
    +
    + 295 + +
    + + + if !strings.HasPrefix(a, "0x") { +
    +
    + 296 + +
    + + + a = "0x" + a +
    +
    + 297 + +
    + + + } +
    +
    + 298 + +
    + + + set[common.HexToAddress(a)] = struct{}{} +
    +
    + 299 + +
    + + + } +
    +
    + 300 + +
    + + + var ret []common.Address +
    +
    + 301 + +
    + + + for a := range set { +
    +
    + 302 + +
    + + + ret = append(ret, a) +
    +
    + 303 + +
    + + + } +
    +
    + 304 + +
    + + + if failIfEmpty && len(ret) == 0 { +
    +
    + 305 + +
    + + + return nil, errors.New("no addresses given") +
    +
    + 306 + +
    + + + } +
    +
    + 307 + +
    + + + return ret, nil +
    +
    + 308 + +
    + + + } +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/run.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -2,6 +2,7 @@
    +
    + 2 + +
    +   +
    +
    +
    + 3 + +
    +   + import ( +
    +
    + 4 + +
    +   + "context" +
    +
    + + +
    +   +
    +
    +
    + 5 + +
    +   + "errors" +
    +
    + 6 + +
    +   + "fmt" +
    +
    + 7 + +
    +   + "net" +
    +
    +
    @@ -108,19 +113,27 @@
    +
    + 108 + +
    +   + log.Fatal(err) +
    +
    + 109 + +
    +   + } +
    +
    + 110 + +
    +   +
    +
    +
    + 111 + +
    + - + etherman, err := newEtherman(*c) +
    +
    + + +
    +   +
    +
    +
    + 112 + +
    +   + if err != nil { +
    +
    + 113 + +
    +   + log.Fatal(err) +
    +
    + 114 + +
    +   + } +
    +
    + 115 + +
    + - +
    +
    +
    + 116 + +
    + - + // READ CHAIN ID FROM POE SC +
    +
    + 117 + +
    + - + l2ChainID, err := etherman.GetL2ChainID() +
    +
    + 118 + +
    +   + if err != nil { +
    +
    + 119 + +
    +   + log.Fatal(err) +
    +
    + 120 + +
    +   + } +
    +
    + 121 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 122 + +
    +   + st, currentForkID := newState(cliCtx.Context, c, etherman, l2ChainID, stateSqlDB, eventLog, needsExecutor, needsStateTree, false) +
    +
    + 123 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 124 + +
    +   + c.Aggregator.ChainID = l2ChainID +
    +
    + 125 + +
    +   + c.Sequencer.StreamServer.ChainID = l2ChainID +
    +
    + 126 + +
    +   + log.Infof("Chain ID read from POE SC = %v", l2ChainID) +
    +
    +
    @@ -277,8 +290,79 @@
    +
    + 277 + +
    +   + } +
    +
    + 278 + +
    +   + } +
    +
    + 279 + +
    +   +
    +
    +
    + 280 + +
    + - + func newEtherman(c config.Config) (*etherman.Client, error) { +
    +
    + 281 + +
    + - + return etherman.NewClient(c.Etherman, c.NetworkConfig.L1Config) +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 282 + +
    +   + } +
    +
    + 283 + +
    +   +
    +
    +
    + 284 + +
    +   + func newL2EthClient(url string) (*ethclient.Client, error) { +
    +
    +
    @@ -321,7 +405,7 @@
    +
    + 321 + +
    +   + // If synchronizer are using sequential mode, we only need one etherman client +
    +
    + 322 + +
    +   + if cfg.Synchronizer.L1SynchronizationMode == synchronizer.ParallelMode { +
    +
    + 323 + +
    +   + for i := 0; i < int(cfg.Synchronizer.L1ParallelSynchronization.MaxClients+1); i++ { +
    +
    + 324 + +
    + - + eth, err := newEtherman(cfg) +
    +
    + 325 + +
    +   + if err != nil { +
    +
    + 326 + +
    +   + log.Fatal(err) +
    +
    + 327 + +
    +   + } +
    +
    +
    @@ -424,12 +508,12 @@
    +
    + 424 + +
    +   + } +
    +
    + 425 + +
    +   +
    +
    +
    + 426 + +
    +   + func createSequenceSender(cfg config.Config, pool *pool.Pool, etmStorage *ethtxmanager.PostgresStorage, st *state.State, eventLog *event.EventLog) *sequencesender.SequenceSender { +
    +
    + 427 + +
    + - + etherman, err := newEtherman(cfg) +
    +
    + 428 + +
    +   + if err != nil { +
    +
    + 429 + +
    +   + log.Fatal(err) +
    +
    + 430 + +
    +   + } +
    +
    + 431 + +
    +   +
    +
    +
    + 432 + +
    + - + auth, err := etherman.LoadAuthFromKeyStore(cfg.SequenceSender.PrivateKey.Path, cfg.SequenceSender.PrivateKey.Password) +
    +
    + 433 + +
    +   + if err != nil { +
    +
    + 434 + +
    +   + log.Fatal(err) +
    +
    + 435 + +
    +   + } +
    +
    +
    @@ -439,7 +523,12 @@
    +
    + 439 + +
    +   +
    +
    +
    + 440 + +
    +   + ethTxManager := ethtxmanager.New(cfg.EthTxManager, etherman, etmStorage, st) +
    +
    + 441 + +
    +   +
    +
    +
    + 442 + +
    + - + seqSender, err := sequencesender.New(cfg.SequenceSender, st, etherman, ethTxManager, eventLog) +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 443 + +
    +   + if err != nil { +
    +
    + 444 + +
    +   + log.Fatal(err) +
    +
    + 445 + +
    +   + } +
    +
    +
    @@ -448,7 +537,23 @@
    +
    + 448 + +
    +   + } +
    +
    + 449 + +
    +   +
    +
    +
    + 450 + +
    +   + func runAggregator(ctx context.Context, c aggregator.Config, etherman *etherman.Client, ethTxManager *ethtxmanager.Client, st *state.State) { +
    +
    + 451 + +
    + - + agg, err := aggregator.New(c, st, ethTxManager, etherman) +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 452 + +
    +   + if err != nil { +
    +
    + 453 + +
    +   + log.Fatal(err) +
    +
    + 454 + +
    +   + } +
    +
    +
    @@ -510,29 +615,22 @@
    +
    + 510 + +
    +   + AvoidForkIDInMemory: avoidForkIDInMemory, +
    +
    + 511 + +
    +   + } +
    +
    + 512 + +
    +   + stateDb := pgstatestorage.NewPostgresStorage(stateCfg, sqlDB) +
    +
    + 513 + +
    + - +
    +
    +
    + 514 + +
    + - + st := state.NewState(stateCfg, stateDb, executorClient, stateTree, eventLog, nil, nil) +
    +
    + 515 + +
    +   + // This is to force to build cache, and check that DB is ok before starting the application +
    +
    + 516 + +
    + - + l1InfoRoot, err := st.GetCurrentL1InfoRoot(ctx, nil) +
    +
    + 517 + +
    +   + if err != nil { +
    +
    + 518 + +
    +   + log.Fatal("error getting current L1InfoRoot. Error: ", err) +
    +
    + 519 + +
    +   + } +
    +
    + 520 + +
    + - + log.Infof("Starting L1InfoRoot: %v", l1InfoRoot.String()) +
    +
    + 521 + +
    +   +
    +
    +
    + 522 + +
    + - + l1InfoTreeRecursiveRoot, err := st.GetCurrentL1InfoTreeRecursiveRoot(ctx, nil) +
    +
    + 523 + +
    + - + if err != nil { +
    +
    + 524 + +
    + - + log.Fatal("error getting current l1InfoTreeRecursiveRoot. Error: ", err) +
    +
    + 525 + +
    + - + } +
    +
    + 526 + +
    + - + log.Infof("Starting l1InfoTreeRecursiveRoot: %v", l1InfoTreeRecursiveRoot.String()) +
    +
    + 527 + +
    + - +
    +
    +
    + 528 + +
    + - + forkIDIntervals, err := forkIDIntervals(ctx, st, etherman, c.NetworkConfig.Genesis.BlockNumber) +
    +
    + 529 + +
    +   + if err != nil { +
    +
    + 530 + +
    +   + log.Fatal("error getting forkIDs. Error: ", err) +
    +
    + 531 + +
    +   + } +
    +
    + 532 + +
    +   + st.UpdateForkIDIntervalsInMemory(forkIDIntervals) +
    +
    + 533 + +
    +   +
    +
    +
    + 534 + +
    +   + currentForkID := forkIDIntervals[len(forkIDIntervals)-1].ForkId +
    +
    + 535 + +
    + - + log.Infof("Fork ID read from POE SC = %v", forkIDIntervals[len(forkIDIntervals)-1].ForkId) +
    +
    + 536 + +
    +   +
    +
    +
    + 537 + +
    +   + return st, currentForkID +
    +
    + 538 + +
    +   + } +
    +
    +
    @@ -548,13 +646,13 @@
    +
    + 548 + +
    +   + } +
    +
    + 549 + +
    +   +
    +
    +
    + 550 + +
    +   + func createEthTxManager(cfg config.Config, etmStorage *ethtxmanager.PostgresStorage, st *state.State) *ethtxmanager.Client { +
    +
    + 551 + +
    + - + etherman, err := newEtherman(cfg) +
    +
    + 552 + +
    +   + if err != nil { +
    +
    + 553 + +
    +   + log.Fatal(err) +
    +
    + 554 + +
    +   + } +
    +
    + 555 + +
    +   +
    +
    +
    + 556 + +
    +   + for _, privateKey := range cfg.EthTxManager.PrivateKeys { +
    +
    + 557 + +
    + - + _, err := etherman.LoadAuthFromKeyStore(privateKey.Path, privateKey.Password) +
    +
    + 558 + +
    +   + if err != nil { +
    +
    + 559 + +
    +   + log.Fatal(err) +
    +
    + 560 + +
    +   + } +
    +
    +
    @@ -646,8 +744,7 @@
    +
    + 646 + +
    +   + if err != nil && !errors.Is(err, state.ErrStateNotSynchronized) { +
    +
    + 647 + +
    +   + return []state.ForkIDInterval{}, fmt.Errorf("error checking lastL1BlockSynced. Error: %v", err) +
    +
    + 648 + +
    +   + } +
    +
    + 649 + +
    + - + // If lastBlock is below genesisBlock means state.ErrStateNotSynchronized (haven't started yet the sync process, is doing pregenesis sync) +
    +
    + 650 + +
    + - + if lastBlock != nil && lastBlock.BlockNumber > genesisBlockNumber { +
    +
    + 651 + +
    +   + log.Info("Getting forkIDs intervals. Please wait...") +
    +
    + 652 + +
    +   + // Read Fork ID FROM POE SC +
    +
    + 653 + +
    +   + forkIntervals, err := etherman.GetForks(ctx, genesisBlockNumber, lastBlock.BlockNumber) +
    +
    +
    @@ -687,14 +784,32 @@
    +
    + 687 + +
    +   + } +
    +
    + 688 + +
    +   + forkIDIntervals = forkIntervals +
    +
    + 689 + +
    +   + } else { +
    +
    + 690 + +
    + - + log.Debug("Getting initial forkID") +
    +
    + 691 + +
    + - + forkIntervals, err := etherman.GetForks(ctx, genesisBlockNumber, genesisBlockNumber) +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 692 + +
    +   + if err != nil { +
    +
    + 693 + +
    +   + return []state.ForkIDInterval{}, fmt.Errorf("error getting forks. Please check the configuration. Error: %v", err) +
    +
    + 694 + +
    +   + } else if len(forkIntervals) == 0 { +
    +
    + 695 + +
    +   + return []state.ForkIDInterval{}, fmt.Errorf("error: no forkID received. It should receive at least one, please check the configuration...") +
    +
    + 696 + +
    +   + } +
    +
    + 697 + +
    +   + forkIDIntervals = forkIntervals +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 698 + +
    +   + } +
    +
    + 699 + +
    +   + } +
    +
    + 700 + +
    +   + return forkIDIntervals, nil +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 2 + +
    +   +
    +
    +
    + 3 + +
    +   + import ( +
    +
    + 4 + +
    +   + "context" +
    +
    + 5 + +
    + + + "crypto/ecdsa" +
    +
    + 6 + +
    +   + "errors" +
    +
    + 7 + +
    +   + "fmt" +
    +
    + 8 + +
    +   + "net" +
    +
    +
     
    +
    + 113 + +
    +   + log.Fatal(err) +
    +
    + 114 + +
    +   + } +
    +
    + 115 + +
    +   +
    +
    +
    + 116 + +
    + + + // READ CHAIN ID FROM POE SC +
    +
    + 117 + +
    + + + tmpEthMan, err := etherman.NewClient(c.Etherman, c.NetworkConfig.L1Config, nil, nil) +
    +
    + 118 + +
    +   + if err != nil { +
    +
    + 119 + +
    +   + log.Fatal(err) +
    +
    + 120 + +
    +   + } +
    +
    + 121 + +
    + + + l2ChainID, err := tmpEthMan.GetL2ChainID() +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 122 + +
    +   + if err != nil { +
    +
    + 123 + +
    +   + log.Fatal(err) +
    +
    + 124 + +
    +   + } +
    +
    + 125 + +
    +   +
    +
    +
    + 126 + +
    + + + etherman, err := etherman.NewClient(c.Etherman, c.NetworkConfig.L1Config, nil, nil) +
    +
    + 127 + +
    + + + if err != nil { +
    +
    + 128 + +
    + + + log.Fatal(err) +
    +
    + 129 + +
    + + + } +
    +
    + 130 + +
    +   + st, currentForkID := newState(cliCtx.Context, c, etherman, l2ChainID, stateSqlDB, eventLog, needsExecutor, needsStateTree, false) +
    +
    + 131 + +
    +   +
    +
    +
    + 132 + +
    + + + etherman, err = newEtherman(*c, st) +
    +
    + 133 + +
    + + + if err != nil { +
    +
    + 134 + +
    + + + log.Fatal(err) +
    +
    + 135 + +
    + + + } +
    +
    + 136 + +
    + + +
    +
    +
    + 137 + +
    +   + c.Aggregator.ChainID = l2ChainID +
    +
    + 138 + +
    +   + c.Sequencer.StreamServer.ChainID = l2ChainID +
    +
    + 139 + +
    +   + log.Infof("Chain ID read from POE SC = %v", l2ChainID) +
    +
    +
     
    +
    + 290 + +
    +   + } +
    +
    + 291 + +
    +   + } +
    +
    + 292 + +
    +   +
    +
    +
    + 293 + +
    + + + func newEtherman(c config.Config, st *state.State) (*etherman.Client, error) { +
    +
    + 294 + +
    + + + ethman, err := etherman.NewClient(c.Etherman, c.NetworkConfig.L1Config, nil, nil) +
    +
    + 295 + +
    + + + if err != nil { +
    +
    + 296 + +
    + + + return nil, err +
    +
    + 297 + +
    + + + } +
    +
    + 298 + +
    + + + da, err := newDataAvailability(c, st, ethman, false) +
    +
    + 299 + +
    + + + if err != nil { +
    +
    + 300 + +
    + + + return nil, err +
    +
    + 301 + +
    + + + } +
    +
    + 302 + +
    + + + return etherman.NewClient(c.Etherman, c.NetworkConfig.L1Config, da, st) +
    +
    + 303 + +
    + + + } +
    +
    + 304 + +
    + + +
    +
    +
    + 305 + +
    + + + func newDataAvailability(c config.Config, st *state.State, etherman *etherman.Client, isSequenceSender bool) (*dataavailability.DataAvailability, error) { +
    +
    + 306 + +
    + + + var ( +
    +
    + 307 + +
    + + + trustedSequencerURL string +
    +
    + 308 + +
    + + + err error +
    +
    + 309 + +
    + + + ) +
    +
    + 310 + +
    + + + if !c.IsTrustedSequencer { +
    +
    + 311 + +
    + + + if c.Synchronizer.TrustedSequencerURL != "" { +
    +
    + 312 + +
    + + + trustedSequencerURL = c.Synchronizer.TrustedSequencerURL +
    +
    + 313 + +
    + + + } else { +
    +
    + 314 + +
    + + + log.Debug("getting trusted sequencer URL from smc") +
    +
    + 315 + +
    + + + trustedSequencerURL, err = etherman.GetTrustedSequencerURL() +
    +
    + 316 + +
    + + + if err != nil { +
    +
    + 317 + +
    + + + return nil, fmt.Errorf("error getting trusted sequencer URI. Error: %v", err) +
    +
    + 318 + +
    + + + } +
    +
    + 319 + +
    + + + } +
    +
    + 320 + +
    + + + log.Debug("trustedSequencerURL ", trustedSequencerURL) +
    +
    + 321 + +
    + + + } +
    +
    + 322 + +
    + + + zkEVMClient := client.NewClient(trustedSequencerURL) +
    +
    + 323 + +
    + + +
    +
    +
    + 324 + +
    + + + // Backend specific config +
    +
    + 325 + +
    + + + daProtocolName, err := etherman.GetDAProtocolName() +
    +
    + 326 + +
    + + + if err != nil { +
    +
    + 327 + +
    + + + return nil, fmt.Errorf("error getting data availability protocol name: %v", err) +
    +
    + 328 + +
    + + + } +
    +
    + 329 + +
    + + + var daBackend dataavailability.DABackender +
    +
    + 330 + +
    + + + switch daProtocolName { +
    +
    + 331 + +
    + + + case string(dataavailability.DataAvailabilityCommittee): +
    +
    + 332 + +
    + + + var ( +
    +
    + 333 + +
    + + + pk *ecdsa.PrivateKey +
    +
    + 334 + +
    + + + err error +
    +
    + 335 + +
    + + + ) +
    +
    + 336 + +
    + + + if isSequenceSender { +
    +
    + 337 + +
    + + + _, pk, err = etherman.LoadAuthFromKeyStore(c.SequenceSender.PrivateKey.Path, c.SequenceSender.PrivateKey.Password) +
    +
    + 338 + +
    + + + if err != nil { +
    +
    + 339 + +
    + + + return nil, err +
    +
    + 340 + +
    + + + } +
    +
    + 341 + +
    + + + } +
    +
    + 342 + +
    + + + dacAddr, err := etherman.GetDAProtocolAddr() +
    +
    + 343 + +
    + + + if err != nil { +
    +
    + 344 + +
    + + + return nil, fmt.Errorf("error getting trusted sequencer URI. Error: %v", err) +
    +
    + 345 + +
    + + + } +
    +
    + 346 + +
    + + +
    +
    +
    + 347 + +
    + + + daBackend, err = datacommittee.New( +
    +
    + 348 + +
    + + + c.Etherman.URL, +
    +
    + 349 + +
    + + + dacAddr, +
    +
    + 350 + +
    + + + pk, +
    +
    + 351 + +
    + + + dataCommitteeClient.NewFactory(), +
    +
    + 352 + +
    + + + ) +
    +
    + 353 + +
    + + + if err != nil { +
    +
    + 354 + +
    + + + return nil, err +
    +
    + 355 + +
    + + + } +
    +
    + 356 + +
    + + + default: +
    +
    + 357 + +
    + + + return nil, fmt.Errorf("unexpected / unsupported DA protocol: %s", daProtocolName) +
    +
    + 358 + +
    + + + } +
    +
    + 359 + +
    + + +
    +
    +
    + 360 + +
    + + + return dataavailability.New( +
    +
    + 361 + +
    + + + c.IsTrustedSequencer, +
    +
    + 362 + +
    + + + daBackend, +
    +
    + 363 + +
    + + + st, +
    +
    + 364 + +
    + + + zkEVMClient, +
    +
    + 365 + +
    + + + ) +
    +
    + 366 + +
    +   + } +
    +
    + 367 + +
    +   +
    +
    +
    + 368 + +
    +   + func newL2EthClient(url string) (*ethclient.Client, error) { +
    +
    +
     
    +
    + 405 + +
    +   + // If synchronizer are using sequential mode, we only need one etherman client +
    +
    + 406 + +
    +   + if cfg.Synchronizer.L1SynchronizationMode == synchronizer.ParallelMode { +
    +
    + 407 + +
    +   + for i := 0; i < int(cfg.Synchronizer.L1ParallelSynchronization.MaxClients+1); i++ { +
    +
    + 408 + +
    + + + eth, err := newEtherman(cfg, st) +
    +
    + 409 + +
    +   + if err != nil { +
    +
    + 410 + +
    +   + log.Fatal(err) +
    +
    + 411 + +
    +   + } +
    +
    +
     
    +
    + 508 + +
    +   + } +
    +
    + 509 + +
    +   +
    +
    +
    + 510 + +
    +   + func createSequenceSender(cfg config.Config, pool *pool.Pool, etmStorage *ethtxmanager.PostgresStorage, st *state.State, eventLog *event.EventLog) *sequencesender.SequenceSender { +
    +
    + 511 + +
    + + + etherman, err := newEtherman(cfg, st) +
    +
    + 512 + +
    +   + if err != nil { +
    +
    + 513 + +
    +   + log.Fatal(err) +
    +
    + 514 + +
    +   + } +
    +
    + 515 + +
    +   +
    +
    +
    + 516 + +
    + + + auth, _, err := etherman.LoadAuthFromKeyStore(cfg.SequenceSender.PrivateKey.Path, cfg.SequenceSender.PrivateKey.Password) +
    +
    + 517 + +
    +   + if err != nil { +
    +
    + 518 + +
    +   + log.Fatal(err) +
    +
    + 519 + +
    +   + } +
    +
    +
     
    +
    + 523 + +
    +   +
    +
    +
    + 524 + +
    +   + ethTxManager := ethtxmanager.New(cfg.EthTxManager, etherman, etmStorage, st) +
    +
    + 525 + +
    +   +
    +
    +
    + 526 + +
    + + + da, err := newDataAvailability(cfg, st, etherman, true) +
    +
    + 527 + +
    + + + if err != nil { +
    +
    + 528 + +
    + + + log.Fatal(err) +
    +
    + 529 + +
    + + + } +
    +
    + 530 + +
    + + +
    +
    +
    + 531 + +
    + + + seqSender, err := sequencesender.New(cfg.SequenceSender, st, etherman, ethTxManager, eventLog, da) +
    +
    + 532 + +
    +   + if err != nil { +
    +
    + 533 + +
    +   + log.Fatal(err) +
    +
    + 534 + +
    +   + } +
    +
    +
     
    +
    + 537 + +
    +   + } +
    +
    + 538 + +
    +   +
    +
    +
    + 539 + +
    +   + func runAggregator(ctx context.Context, c aggregator.Config, etherman *etherman.Client, ethTxManager *ethtxmanager.Client, st *state.State) { +
    +
    + 540 + +
    + + + var ( +
    +
    + 541 + +
    + + + aggCli *agglayerClient.Client +
    +
    + 542 + +
    + + + pk *ecdsa.PrivateKey +
    +
    + 543 + +
    + + + err error +
    +
    + 544 + +
    + + + ) +
    +
    + 545 + +
    + + +
    +
    +
    + 546 + +
    + + + if c.SettlementBackend == aggregator.AggLayer { +
    +
    + 547 + +
    + + + aggCli = agglayerClient.New(c.AggLayerURL) +
    +
    + 548 + +
    + + +
    +
    +
    + 549 + +
    + + + // Load private key +
    +
    + 550 + +
    + + + pk, err = config.NewKeyFromKeystore(c.SequencerPrivateKey) +
    +
    + 551 + +
    + + + if err != nil { +
    +
    + 552 + +
    + + + log.Fatal(err) +
    +
    + 553 + +
    + + + } +
    +
    + 554 + +
    + + + } +
    +
    + 555 + +
    + + +
    +
    +
    + 556 + +
    + + + agg, err := aggregator.New(c, st, ethTxManager, etherman, aggCli, pk) +
    +
    + 557 + +
    +   + if err != nil { +
    +
    + 558 + +
    +   + log.Fatal(err) +
    +
    + 559 + +
    +   + } +
    +
    +
     
    +
    + 615 + +
    +   + AvoidForkIDInMemory: avoidForkIDInMemory, +
    +
    + 616 + +
    +   + } +
    +
    + 617 + +
    +   + stateDb := pgstatestorage.NewPostgresStorage(stateCfg, sqlDB) +
    +
    + 618 + +
    + + + st := state.NewState(stateCfg, stateDb, executorClient, stateTree, eventLog, nil) +
    +
    + + +
    +   +
    +
    +
    + 619 + +
    +   + // This is to force to build cache, and check that DB is ok before starting the application +
    +
    + 620 + +
    + + + l1inforoot, err := st.GetCurrentL1InfoRoot(ctx, nil) +
    +
    + 621 + +
    +   + if err != nil { +
    +
    + 622 + +
    +   + log.Fatal("error getting current L1InfoRoot. Error: ", err) +
    +
    + 623 + +
    +   + } +
    +
    + 624 + +
    + + + log.Infof("Starting L1InfoRoot: %v", l1inforoot.String()) +
    +
    + 625 + +
    +   +
    +
    +
    + 626 + +
    + + + forkIDIntervals, err := forkIDIntervals(ctx, st, etherman, c.NetworkConfig.Genesis.RollupBlockNumber) +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 627 + +
    +   + if err != nil { +
    +
    + 628 + +
    +   + log.Fatal("error getting forkIDs. Error: ", err) +
    +
    + 629 + +
    +   + } +
    +
    + 630 + +
    +   + st.UpdateForkIDIntervalsInMemory(forkIDIntervals) +
    +
    + 631 + +
    +   +
    +
    +
    + 632 + +
    +   + currentForkID := forkIDIntervals[len(forkIDIntervals)-1].ForkId +
    +
    + 633 + +
    + + + log.Infof("Fork ID read from POE SC = %v", currentForkID) +
    +
    + 634 + +
    +   +
    +
    +
    + 635 + +
    +   + return st, currentForkID +
    +
    + 636 + +
    +   + } +
    +
    +
     
    +
    + 646 + +
    +   + } +
    +
    + 647 + +
    +   +
    +
    +
    + 648 + +
    +   + func createEthTxManager(cfg config.Config, etmStorage *ethtxmanager.PostgresStorage, st *state.State) *ethtxmanager.Client { +
    +
    + 649 + +
    + + + etherman, err := newEtherman(cfg, st) +
    +
    + 650 + +
    +   + if err != nil { +
    +
    + 651 + +
    +   + log.Fatal(err) +
    +
    + 652 + +
    +   + } +
    +
    + 653 + +
    +   +
    +
    +
    + 654 + +
    +   + for _, privateKey := range cfg.EthTxManager.PrivateKeys { +
    +
    + 655 + +
    + + + _, _, err := etherman.LoadAuthFromKeyStore(privateKey.Path, privateKey.Password) +
    +
    + 656 + +
    +   + if err != nil { +
    +
    + 657 + +
    +   + log.Fatal(err) +
    +
    + 658 + +
    +   + } +
    +
    +
     
    +
    + 744 + +
    +   + if err != nil && !errors.Is(err, state.ErrStateNotSynchronized) { +
    +
    + 745 + +
    +   + return []state.ForkIDInterval{}, fmt.Errorf("error checking lastL1BlockSynced. Error: %v", err) +
    +
    + 746 + +
    +   + } +
    +
    + 747 + +
    + + + if lastBlock != nil { +
    +
    + + +
    +   +
    +
    +
    + 748 + +
    +   + log.Info("Getting forkIDs intervals. Please wait...") +
    +
    + 749 + +
    +   + // Read Fork ID FROM POE SC +
    +
    + 750 + +
    +   + forkIntervals, err := etherman.GetForks(ctx, genesisBlockNumber, lastBlock.BlockNumber) +
    +
    +
     
    +
    + 784 + +
    +   + } +
    +
    + 785 + +
    +   + forkIDIntervals = forkIntervals +
    +
    + 786 + +
    +   + } else { +
    +
    + 787 + +
    + + + log.Debug("Getting all forkIDs") +
    +
    + 788 + +
    + + +
    +
    +
    + 789 + +
    + + + // Get last L1 block number +
    +
    + 790 + +
    + + + bn, err := etherman.GetLatestBlockNumber(ctx) +
    +
    + 791 + +
    + + + if err != nil { +
    +
    + 792 + +
    + + + return []state.ForkIDInterval{}, fmt.Errorf("error getting latest block number. Error: %v", err) +
    +
    + 793 + +
    + + + } +
    +
    + 794 + +
    + + +
    +
    +
    + 795 + +
    + + + // Get all forkIDs since genesis +
    +
    + 796 + +
    + + + forkIntervals, err := etherman.GetForks(ctx, genesisBlockNumber, bn) +
    +
    + 797 + +
    +   + if err != nil { +
    +
    + 798 + +
    +   + return []state.ForkIDInterval{}, fmt.Errorf("error getting forks. Please check the configuration. Error: %v", err) +
    +
    + 799 + +
    +   + } else if len(forkIntervals) == 0 { +
    +
    + 800 + +
    +   + return []state.ForkIDInterval{}, fmt.Errorf("error: no forkID received. It should receive at least one, please check the configuration...") +
    +
    + 801 + +
    +   + } +
    +
    + 802 + +
    +   + forkIDIntervals = forkIntervals +
    +
    + 803 + +
    + + +
    +
    +
    + 804 + +
    + + + log.Debugf("Retrieved %d forkIDs", len(forkIDIntervals)) +
    +
    + 805 + +
    + + +
    +
    +
    + 806 + +
    + + + log.Debug("Adding forkIDs to db and memory") +
    +
    + 807 + +
    + + + for _, forkID := range forkIDIntervals { +
    +
    + 808 + +
    + + + err = st.AddForkIDInterval(ctx, forkID, nil) +
    +
    + 809 + +
    + + + if err != nil { +
    +
    + 810 + +
    + + + log.Fatal("error adding forkID to db. Error: ", err) +
    +
    + 811 + +
    + + + } +
    +
    + 812 + +
    + + + } +
    +
    + 813 + +
    +   + } +
    +
    + 814 + +
    +   + } +
    +
    + 815 + +
    +   + return forkIDIntervals, nil +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/set_data_availability_protocol.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -0,0 +1,68 @@
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 1 + +
    + + + package main +
    +
    + 2 + +
    + + +
    +
    +
    + 3 + +
    + + + import ( +
    +
    + 4 + +
    + + + "github.com/0xPolygonHermez/zkevm-node/config" +
    +
    + 5 + +
    + + + "github.com/0xPolygonHermez/zkevm-node/log" +
    +
    + 6 + +
    + + + "github.com/ethereum/go-ethereum/common" +
    +
    + 7 + +
    + + + "github.com/urfave/cli/v2" +
    +
    + 8 + +
    + + + ) +
    +
    + 9 + +
    + + +
    +
    +
    + 10 + +
    + + + const flagDAAddress = "data-availability-address" +
    +
    + 11 + +
    + + +
    +
    +
    + 12 + +
    + + + var setDataAvailabilityProtocolFlags = []cli.Flag{ +
    +
    + 13 + +
    + + + &cli.StringFlag{ +
    +
    + 14 + +
    + + + Name: flagDAAddress, +
    +
    + 15 + +
    + + + Aliases: []string{"da-addr"}, +
    +
    + 16 + +
    + + + Usage: "address of the new data availibility protocol", +
    +
    + 17 + +
    + + + Required: true, +
    +
    + 18 + +
    + + + }, +
    +
    + 19 + +
    + + + &cli.StringFlag{ +
    +
    + 20 + +
    + + + Name: config.FlagKeyStorePath, +
    +
    + 21 + +
    + + + Aliases: []string{"ksp"}, +
    +
    + 22 + +
    + + + Usage: "the path of the key store file containing the private key of the account going to set new data availability protocol", +
    +
    + 23 + +
    + + + Required: true, +
    +
    + 24 + +
    + + + }, +
    +
    + 25 + +
    + + + &cli.StringFlag{ +
    +
    + 26 + +
    + + + Name: config.FlagPassword, +
    +
    + 27 + +
    + + + Aliases: []string{"pw"}, +
    +
    + 28 + +
    + + + Usage: "the password do decrypt the key store file", +
    +
    + 29 + +
    + + + Required: true, +
    +
    + 30 + +
    + + + }, +
    +
    + 31 + +
    + + + &configFileFlag, +
    +
    + 32 + +
    + + + &networkFlag, +
    +
    + 33 + +
    + + + &customNetworkFlag, +
    +
    + 34 + +
    + + + } +
    +
    + 35 + +
    + + +
    +
    +
    + 36 + +
    + + + func setDataAvailabilityProtocol(ctx *cli.Context) error { +
    +
    + 37 + +
    + + + c, err := config.Load(ctx, true) +
    +
    + 38 + +
    + + + if err != nil { +
    +
    + 39 + +
    + + + return err +
    +
    + 40 + +
    + + + } +
    +
    + 41 + +
    + + +
    +
    +
    + 42 + +
    + + + setupLog(c.Log) +
    +
    + 43 + +
    + + +
    +
    +
    + 44 + +
    + + + daAddress := common.HexToAddress(ctx.String(flagDAAddress)) +
    +
    + 45 + +
    + + + addrKeyStorePath := ctx.String(config.FlagKeyStorePath) +
    +
    + 46 + +
    + + + addrPassword := ctx.String(config.FlagPassword) +
    +
    + 47 + +
    + + +
    +
    +
    + 48 + +
    + + + etherman, err := newEtherman(*c, nil) +
    +
    + 49 + +
    + + + if err != nil { +
    +
    + 50 + +
    + + + log.Fatal(err) +
    +
    + 51 + +
    + + + return err +
    +
    + 52 + +
    + + + } +
    +
    + 53 + +
    + + +
    +
    +
    + 54 + +
    + + + auth, _, err := etherman.LoadAuthFromKeyStore(addrKeyStorePath, addrPassword) +
    +
    + 55 + +
    + + + if err != nil { +
    +
    + 56 + +
    + + + log.Fatal(err) +
    +
    + 57 + +
    + + + return err +
    +
    + 58 + +
    + + + } +
    +
    + 59 + +
    + + +
    +
    +
    + 60 + +
    + + + tx, err := etherman.SetDataAvailabilityProtocol(auth.From, daAddress) +
    +
    + 61 + +
    + + + if err != nil { +
    +
    + 62 + +
    + + + return err +
    +
    + 63 + +
    + + + } +
    +
    + 64 + +
    + + +
    +
    +
    + 65 + +
    + + + log.Infof("Transaction to set new data availability protocol sent. Hash: %s", tx.Hash()) +
    +
    + 66 + +
    + + +
    +
    +
    + 67 + +
    + + + return nil +
    +
    + 68 + +
    + + + } +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/config/cardonagenesis.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,109 +0,0 @@
    +
    + 1 + +
    + - + package config +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + // CardonaNetworkConfigJSON is the hardcoded network configuration to be used for the official mainnet setup +
    +
    + 4 + +
    + - + const CardonaNetworkConfigJSON = ` +
    +
    + 5 + +
    + - + { +
    +
    + 6 + +
    + - + "l1Config": { +
    +
    + 7 + +
    + - + "polygonZkEVMAddress": "0xA13Ddb14437A8F34897131367ad3ca78416d6bCa", +
    +
    + 8 + +
    + - + "polygonZkEVMBridgeAddress": "0x528e26b25a34a4A5d0dbDa1d57D318153d2ED582", +
    +
    + 9 + +
    + - + "polygonZkEVMGlobalExitRootAddress": "0xAd1490c248c5d3CbAE399Fd529b79B42984277DF", +
    +
    + 10 + +
    + - + "polTokenAddress": "0x6a7c3F4B0651d6DA389AD1d11D962ea458cDCA70", +
    +
    + 11 + +
    + - + "polygonRollupManagerAddress": "0x32d33D5137a7cFFb54c5Bf8371172bcEc5f310ff", +
    +
    + 12 + +
    + - + "chainId": 11155111 +
    +
    + 13 + +
    + - + }, +
    +
    + 14 + +
    + - + "genesisBlockNumber": 4789190, +
    +
    + 15 + +
    + - + "root": "0x91dfcdeb628dfdc51f3a2ee38cb17c78581e4e7ff91bcc2e327d24a9dfa46982", +
    +
    + 16 + +
    + - + "genesis": [ +
    +
    + 17 + +
    + - + { +
    +
    + 18 + +
    + - + "contractName": "PolygonZkEVMDeployer", +
    +
    + 19 + +
    + - + "balance": "0", +
    +
    + 20 + +
    + - + "nonce": "4", +
    +
    + 21 + +
    + - + "address": "0x36810012486fc134D0679c07f85fe5ba5A087D8C", +
    +
    + 22 + +
    + - + "bytecode": "0x6080604052600436106100705760003560e01c8063715018a61161004e578063715018a6146100e65780638da5cb5b146100fb578063e11ae6cb14610126578063f2fde38b1461013957600080fd5b80632b79805a146100755780634a94d4871461008a5780636d07dbf81461009d575b600080fd5b610088610083366004610927565b610159565b005b6100886100983660046109c7565b6101cb565b3480156100a957600080fd5b506100bd6100b8366004610a1e565b61020d565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b50610088610220565b34801561010757600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100bd565b610088610134366004610a40565b610234565b34801561014557600080fd5b50610088610154366004610a90565b61029b565b610161610357565b600061016e8585856103d8565b905061017a8183610537565b5060405173ffffffffffffffffffffffffffffffffffffffff821681527fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a15050505050565b6101d3610357565b6101de83838361057b565b506040517f25adb19089b6a549831a273acdf7908cff8b7ee5f551f8d1d37996cf01c5df5b90600090a1505050565b600061021983836105a9565b9392505050565b610228610357565b61023260006105b6565b565b61023c610357565b60006102498484846103d8565b60405173ffffffffffffffffffffffffffffffffffffffff821681529091507fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a150505050565b6102a3610357565b73ffffffffffffffffffffffffffffffffffffffff811661034b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610354816105b6565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610232576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610342565b600083471015610444576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e63650000006044820152606401610342565b81516000036104af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f6044820152606401610342565b8282516020840186f5905073ffffffffffffffffffffffffffffffffffffffff8116610219576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f79000000000000006044820152606401610342565b6060610219838360006040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c6564000081525061062b565b60606105a1848484604051806060016040528060298152602001610b3d6029913961062b565b949350505050565b6000610219838330610744565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060824710156106bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610342565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516106e69190610acf565b60006040518083038185875af1925050503d8060008114610723576040519150601f19603f3d011682016040523d82523d6000602084013e610728565b606091505b50915091506107398783838761076e565b979650505050505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b606083156108045782516000036107fd5773ffffffffffffffffffffffffffffffffffffffff85163b6107fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610342565b50816105a1565b6105a183838151156108195781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103429190610aeb565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f83011261088d57600080fd5b813567ffffffffffffffff808211156108a8576108a861084d565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156108ee576108ee61084d565b8160405283815286602085880101111561090757600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000806080858703121561093d57600080fd5b8435935060208501359250604085013567ffffffffffffffff8082111561096357600080fd5b61096f8883890161087c565b9350606087013591508082111561098557600080fd5b506109928782880161087c565b91505092959194509250565b803573ffffffffffffffffffffffffffffffffffffffff811681146109c257600080fd5b919050565b6000806000606084860312156109dc57600080fd5b6109e58461099e565b9250602084013567ffffffffffffffff811115610a0157600080fd5b610a0d8682870161087c565b925050604084013590509250925092565b60008060408385031215610a3157600080fd5b50508035926020909101359150565b600080600060608486031215610a5557600080fd5b8335925060208401359150604084013567ffffffffffffffff811115610a7a57600080fd5b610a868682870161087c565b9150509250925092565b600060208284031215610aa257600080fd5b6102198261099e565b60005b83811015610ac6578181015183820152602001610aae565b50506000910152565b60008251610ae1818460208701610aab565b9190910192915050565b6020815260008251806020840152610b0a816040850160208701610aab565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a26469706673582212203e70ce334e8ec9d8d03e87415afd36dce4e82633bd277b08937095a6bd66367764736f6c63430008110033", +
    +
    + 23 + +
    + - + "storage": { +
    +
    + 24 + +
    + - + "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000ff6250d0e86a2465b0c1bf8e36409503d6a26963" +
    +
    + 25 + +
    + - + } +
    +
    + 26 + +
    + - + }, +
    +
    + 27 + +
    + - + { +
    +
    + 28 + +
    + - + "contractName": "ProxyAdmin", +
    +
    + 29 + +
    + - + "balance": "0", +
    +
    + 30 + +
    + - + "nonce": "1", +
    +
    + 31 + +
    + - + "address": "0x85cEB41028B1a5ED2b88E395145344837308b251", +
    +
    + 32 + +
    + - + "bytecode": "0x60806040526004361061007b5760003560e01c80639623609d1161004e5780639623609d1461012b57806399a88ec41461013e578063f2fde38b1461015e578063f3b7dead1461017e57600080fd5b8063204e1c7a14610080578063715018a6146100c95780637eff275e146100e05780638da5cb5b14610100575b600080fd5b34801561008c57600080fd5b506100a061009b366004610608565b61019e565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100d557600080fd5b506100de610255565b005b3480156100ec57600080fd5b506100de6100fb36600461062c565b610269565b34801561010c57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100a0565b6100de610139366004610694565b6102f7565b34801561014a57600080fd5b506100de61015936600461062c565b61038c565b34801561016a57600080fd5b506100de610179366004610608565b6103e8565b34801561018a57600080fd5b506100a0610199366004610608565b6104a4565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907f5c60da1b00000000000000000000000000000000000000000000000000000000815260040190565b600060405180830381855afa9150503d8060008114610225576040519150601f19603f3d011682016040523d82523d6000602084013e61022a565b606091505b50915091508161023957600080fd5b8080602001905181019061024d9190610788565b949350505050565b61025d6104f0565b6102676000610571565b565b6102716104f0565b6040517f8f28397000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690638f283970906024015b600060405180830381600087803b1580156102db57600080fd5b505af11580156102ef573d6000803e3d6000fd5b505050505050565b6102ff6104f0565b6040517f4f1ef28600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690634f1ef28690349061035590869086906004016107a5565b6000604051808303818588803b15801561036e57600080fd5b505af1158015610382573d6000803e3d6000fd5b5050505050505050565b6103946104f0565b6040517f3659cfe600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690633659cfe6906024016102c1565b6103f06104f0565b73ffffffffffffffffffffffffffffffffffffffff8116610498576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6104a181610571565b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907ff851a44000000000000000000000000000000000000000000000000000000000815260040190565b60005473ffffffffffffffffffffffffffffffffffffffff163314610267576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161048f565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b73ffffffffffffffffffffffffffffffffffffffff811681146104a157600080fd5b60006020828403121561061a57600080fd5b8135610625816105e6565b9392505050565b6000806040838503121561063f57600080fd5b823561064a816105e6565b9150602083013561065a816105e6565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000606084860312156106a957600080fd5b83356106b4816105e6565b925060208401356106c4816105e6565b9150604084013567ffffffffffffffff808211156106e157600080fd5b818601915086601f8301126106f557600080fd5b81358181111561070757610707610665565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561074d5761074d610665565b8160405282815289602084870101111561076657600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b60006020828403121561079a57600080fd5b8151610625816105e6565b73ffffffffffffffffffffffffffffffffffffffff8316815260006020604081840152835180604085015260005b818110156107ef578581018301518582016060015282016107d3565b5060006060828601015260607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010192505050939250505056fea2646970667358221220372a0e10eebea1b7fa43ae4c976994e6ed01d85eedc3637b83f01d3f06be442064736f6c63430008110033", +
    +
    + 33 + +
    + - + "storage": { +
    +
    + 34 + +
    + - + "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000dbc6981a11fc2b000c635bfa7c47676b25c87d39" +
    +
    + 35 + +
    + - + } +
    +
    + 36 + +
    + - + }, +
    +
    + 37 + +
    + - + { +
    +
    + 38 + +
    + - + "contractName": "PolygonZkEVMBridge implementation", +
    +
    + 39 + +
    + - + "balance": "0", +
    +
    + 40 + +
    + - + "nonce": "1", +
    +
    + 41 + +
    + - + "address": "0x8BD36ca1A55e389335004872aA3C3Be0969D3aA7", +
    +
    + 42 + +
    + - + "bytecode": "0x6080604052600436106200019f5760003560e01c8063647c576c11620000e7578063be5831c71162000089578063dbc169761162000060578063dbc169761462000639578063ee25560b1462000651578063fb570834146200068257600080fd5b8063be5831c714620005ae578063cd58657914620005ea578063d02103ca146200060157600080fd5b80639e34070f11620000be5780639e34070f146200050a578063aaa13cc2146200054f578063bab161bf146200057457600080fd5b8063647c576c146200048657806379e2cf9714620004ab57806381b1c17414620004c357600080fd5b80632d2c9d94116200015157806334ac9cf2116200012857806334ac9cf2146200034b5780633ae05047146200037a5780633e197043146200039257600080fd5b80632d2c9d9414620002765780632dfdf0b5146200029b578063318aee3d14620002c257600080fd5b806322e95f2c116200018657806322e95f2c14620001ef578063240ff378146200023a5780632cffd02e146200025157600080fd5b806315064c9614620001a45780632072f6c514620001d5575b600080fd5b348015620001b157600080fd5b50606854620001c09060ff1681565b60405190151581526020015b60405180910390f35b348015620001e257600080fd5b50620001ed620006a7565b005b348015620001fc57600080fd5b50620002146200020e366004620032db565b62000705565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001620001cc565b620001ed6200024b36600462003372565b620007a8565b3480156200025e57600080fd5b50620001ed6200027036600462003409565b620009d0565b3480156200028357600080fd5b50620001ed6200029536600462003409565b62000f74565b348015620002a857600080fd5b50620002b360535481565b604051908152602001620001cc565b348015620002cf57600080fd5b5062000319620002e1366004620034ef565b606b6020526000908152604090205463ffffffff811690640100000000900473ffffffffffffffffffffffffffffffffffffffff1682565b6040805163ffffffff909316835273ffffffffffffffffffffffffffffffffffffffff909116602083015201620001cc565b3480156200035857600080fd5b50606c54620002149073ffffffffffffffffffffffffffffffffffffffff1681565b3480156200038757600080fd5b50620002b362001178565b3480156200039f57600080fd5b50620002b3620003b136600462003526565b6040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b3480156200049357600080fd5b50620001ed620004a5366004620035b0565b6200125e565b348015620004b857600080fd5b50620001ed620014ad565b348015620004d057600080fd5b5062000214620004e236600462003600565b606a6020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b3480156200051757600080fd5b50620001c06200052936600462003600565b600881901c600090815260696020526040902054600160ff9092169190911b9081161490565b3480156200055c57600080fd5b50620002146200056e3660046200361a565b620014e7565b3480156200058157600080fd5b506068546200059890610100900463ffffffff1681565b60405163ffffffff9091168152602001620001cc565b348015620005bb57600080fd5b506068546200059890790100000000000000000000000000000000000000000000000000900463ffffffff1681565b620001ed620005fb366004620036ce565b620016d3565b3480156200060e57600080fd5b50606854620002149065010000000000900473ffffffffffffffffffffffffffffffffffffffff1681565b3480156200064657600080fd5b50620001ed62001c37565b3480156200065e57600080fd5b50620002b36200067036600462003600565b60696020526000908152604090205481565b3480156200068f57600080fd5b50620001c0620006a136600462003770565b62001c93565b606c5473ffffffffffffffffffffffffffffffffffffffff163314620006f9576040517fe2e8106b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200070362001d7c565b565b6040805160e084901b7fffffffff0000000000000000000000000000000000000000000000000000000016602080830191909152606084901b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602483015282516018818403018152603890920183528151918101919091206000908152606a909152205473ffffffffffffffffffffffffffffffffffffffff165b92915050565b60685460ff1615620007e6576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60685463ffffffff8681166101009092041614806200080c5750600263ffffffff861610155b1562000844576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b6001606860019054906101000a900463ffffffff163388883488886053546040516200089a9998979695949392919062003806565b60405180910390a1620009b8620009b26001606860019054906101000a900463ffffffff16338989348989604051620008d592919062003881565b60405180910390206040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b62001e10565b8215620009c957620009c962001f27565b5050505050565b60685460ff161562000a0e576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000a258b8b8b8b8b8b8b8b8b8b8b600062001ffc565b73ffffffffffffffffffffffffffffffffffffffff861662000b01576040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff861690859060405162000a7a9190620038e6565b60006040518083038185875af1925050503d806000811462000ab9576040519150601f19603f3d011682016040523d82523d6000602084013e62000abe565b606091505b505090508062000afa576040517f6747a28800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5062000efc565b60685463ffffffff61010090910481169088160362000b435762000b3d73ffffffffffffffffffffffffffffffffffffffff87168585620021ed565b62000efc565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b1660208201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b166024820152600090603801604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291815281516020928301206000818152606a90935291205490915073ffffffffffffffffffffffffffffffffffffffff168062000e6e576000808062000c1886880188620039fb565b92509250925060008584848460405162000c329062003292565b62000c409392919062003abd565b8190604051809103906000f590508015801562000c61573d6000803e3d6000fd5b506040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8c81166004830152602482018c9052919250908216906340c10f1990604401600060405180830381600087803b15801562000cd757600080fd5b505af115801562000cec573d6000803e3d6000fd5b5050505080606a600088815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060405180604001604052808e63ffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff16815250606b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509050507f490e59a1701b938786ac72570a1efeac994a3dbe96e2e883e19e902ace6e6a398d8d838b8b60405162000e5c95949392919062003afa565b60405180910390a15050505062000ef9565b6040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152602482018790528216906340c10f1990604401600060405180830381600087803b15801562000edf57600080fd5b505af115801562000ef4573d6000803e3d6000fd5b505050505b50505b6040805163ffffffff8c811682528916602082015273ffffffffffffffffffffffffffffffffffffffff88811682840152861660608201526080810185905290517f25308c93ceeed162da955b3f7ce3e3f93606579e40fb92029faa9efe275459839181900360a00190a15050505050505050505050565b60685460ff161562000fb2576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000fc98b8b8b8b8b8b8b8b8b8b8b600162001ffc565b60008473ffffffffffffffffffffffffffffffffffffffff1684888a868660405160240162000ffc949392919062003b42565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f1806b5f200000000000000000000000000000000000000000000000000000000179052516200107f9190620038e6565b60006040518083038185875af1925050503d8060008114620010be576040519150601f19603f3d011682016040523d82523d6000602084013e620010c3565b606091505b5050905080620010ff576040517f37e391c300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805163ffffffff8d811682528a16602082015273ffffffffffffffffffffffffffffffffffffffff89811682840152871660608201526080810186905290517f25308c93ceeed162da955b3f7ce3e3f93606579e40fb92029faa9efe275459839181900360a00190a1505050505050505050505050565b605354600090819081805b602081101562001255578083901c600116600103620011e65760338160208110620011b257620011b262003b8a565b0154604080516020810192909252810185905260600160405160208183030381529060405280519060200120935062001213565b60408051602081018690529081018390526060016040516020818303038152906040528051906020012093505b604080516020810184905290810183905260600160405160208183030381529060405280519060200120915080806200124c9062003be8565b91505062001183565b50919392505050565b600054610100900460ff16158080156200127f5750600054600160ff909116105b806200129b5750303b1580156200129b575060005460ff166001145b6200132d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156200138c57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b606880547fffffffffffffff000000000000000000000000000000000000000000000000ff1661010063ffffffff8716027fffffffffffffff0000000000000000000000000000000000000000ffffffffff16176501000000000073ffffffffffffffffffffffffffffffffffffffff8681169190910291909117909155606c80547fffffffffffffffffffffffff00000000000000000000000000000000000000001691841691909117905562001443620022c3565b8015620014a757600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b605354606854790100000000000000000000000000000000000000000000000000900463ffffffff16101562000703576200070362001f27565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b1660208201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b1660248201526000908190603801604051602081830303815290604052805190602001209050600060ff60f81b3083604051806020016200157d9062003292565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082820381018352601f909101166040819052620015c8908d908d908d908d908d9060200162003c23565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905262001606929160200162003c64565b604051602081830303815290604052805190602001206040516020016200168f94939291907fff0000000000000000000000000000000000000000000000000000000000000094909416845260609290921b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660018401526015830152603582015260550190565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001815291905280516020909101209a9950505050505050505050565b60685460ff161562001711576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200171b62002366565b60685463ffffffff888116610100909204161480620017415750600263ffffffff881610155b1562001779576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008060608773ffffffffffffffffffffffffffffffffffffffff8816620017df57883414620017d5576040517fb89240f500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000925062001ad9565b341562001818576040517f798ee6f100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8089166000908152606b602090815260409182902082518084019093525463ffffffff811683526401000000009004909216918101829052901562001908576040517f9dc29fac000000000000000000000000000000000000000000000000000000008152336004820152602481018b905273ffffffffffffffffffffffffffffffffffffffff8a1690639dc29fac90604401600060405180830381600087803b158015620018db57600080fd5b505af1158015620018f0573d6000803e3d6000fd5b50505050806020015194508060000151935062001ad7565b85156200191d576200191d898b8989620023db565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8b16906370a0823190602401602060405180830381865afa1580156200198b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620019b1919062003c97565b9050620019d773ffffffffffffffffffffffffffffffffffffffff8b1633308e620028f9565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa15801562001a45573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001a6b919062003c97565b905062001a79828262003cb1565b6068548c9850610100900463ffffffff169650935062001a998762002959565b62001aa48c62002a71565b62001aaf8d62002b7e565b60405160200162001ac39392919062003abd565b604051602081830303815290604052945050505b505b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b600084868e8e868860535460405162001b1b98979695949392919062003cc7565b60405180910390a162001c0f620009b2600085878f8f8789805190602001206040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b861562001c205762001c2062001f27565b5050505062001c2e60018055565b50505050505050565b606c5473ffffffffffffffffffffffffffffffffffffffff16331462001c89576040517fe2e8106b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200070362002c80565b600084815b602081101562001d6e57600163ffffffff8616821c8116900362001d0a5785816020811062001ccb5762001ccb62003b8a565b60200201358260405160200162001cec929190918252602082015260400190565b60405160208183030381529060405280519060200120915062001d59565b8186826020811062001d205762001d2062003b8a565b602002013560405160200162001d40929190918252602082015260400190565b6040516020818303038152906040528051906020012091505b8062001d658162003be8565b91505062001c98565b50821490505b949350505050565b60685460ff161562001dba576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556040517f2261efe5aef6fedc1fd1550b25facc9181745623049c7901287030b9ad1a549790600090a1565b80600162001e216020600262003e79565b62001e2d919062003cb1565b6053541062001e68576040517fef5ccf6600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060536000815462001e7b9062003be8565b9182905550905060005b602081101562001f17578082901c60011660010362001ebd57826033826020811062001eb55762001eb562003b8a565b015550505050565b6033816020811062001ed35762001ed362003b8a565b01546040805160208101929092528101849052606001604051602081830303815290604052805190602001209250808062001f0e9062003be8565b91505062001e85565b5062001f2262003e87565b505050565b6053546068805463ffffffff909216790100000000000000000000000000000000000000000000000000027fffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffffff909216919091179081905573ffffffffffffffffffffffffffffffffffffffff65010000000000909104166333d6247d62001fad62001178565b6040518263ffffffff1660e01b815260040162001fcc91815260200190565b600060405180830381600087803b15801562001fe757600080fd5b505af1158015620014a7573d6000803e3d6000fd5b6200200d8b63ffffffff1662002d10565b6068546040805160208082018e90528183018d9052825180830384018152606083019384905280519101207f257b363200000000000000000000000000000000000000000000000000000000909252606481019190915260009165010000000000900473ffffffffffffffffffffffffffffffffffffffff169063257b3632906084016020604051808303816000875af1158015620020b0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620020d6919062003c97565b90508060000362002112576040517e2f6fad00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60685463ffffffff88811661010090920416146200215c576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606854600090610100900463ffffffff166200217a5750896200217d565b508a5b620021a66200219d848c8c8c8c8c8c8c604051620008d592919062003881565b8f8f8462001c93565b620021dd576040517fe0417cec00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505050505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905262001f229084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915262002d75565b600054610100900460ff166200235c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162001324565b6200070362002e88565b600260015403620023d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640162001324565b6002600155565b6000620023ec600482848662003eb6565b620023f79162003ee2565b90507f2afa5331000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000821601620026765760008080808080806200245a896004818d62003eb6565b81019062002469919062003f2b565b96509650965096509650965096503373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614620024dd576040517f912ecce700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff861630146200252d576040517f750643af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8a851462002567576040517f03fffc4b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff89811660248301528881166044830152606482018890526084820187905260ff861660a483015260c4820185905260e48083018590528351808403909101815261010490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fd505accf000000000000000000000000000000000000000000000000000000001790529151918e1691620026229190620038e6565b6000604051808303816000865af19150503d806000811462002661576040519150601f19603f3d011682016040523d82523d6000602084013e62002666565b606091505b50505050505050505050620009c9565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f8fcbaf0c0000000000000000000000000000000000000000000000000000000014620026f2576040517fe282c0ba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808080808080806200270a8a6004818e62003eb6565b81019062002719919062003f86565b975097509750975097509750975097503373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff16146200278f576040517f912ecce700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff87163014620027df576040517f750643af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff8a811660248301528981166044830152606482018990526084820188905286151560a483015260ff861660c483015260e482018590526101048083018590528351808403909101815261012490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f8fcbaf0c000000000000000000000000000000000000000000000000000000001790529151918f1691620028a39190620038e6565b6000604051808303816000865af19150503d8060008114620028e2576040519150601f19603f3d011682016040523d82523d6000602084013e620028e7565b606091505b50505050505050505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052620014a79085907f23b872dd000000000000000000000000000000000000000000000000000000009060840162002240565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f06fdde03000000000000000000000000000000000000000000000000000000001790529051606091600091829173ffffffffffffffffffffffffffffffffffffffff861691620029dd9190620038e6565b600060405180830381855afa9150503d806000811462002a1a576040519150601f19603f3d011682016040523d82523d6000602084013e62002a1f565b606091505b50915091508162002a66576040518060400160405280600781526020017f4e4f5f4e414d450000000000000000000000000000000000000000000000000081525062001d74565b62001d748162002f21565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f95d89b41000000000000000000000000000000000000000000000000000000001790529051606091600091829173ffffffffffffffffffffffffffffffffffffffff86169162002af59190620038e6565b600060405180830381855afa9150503d806000811462002b32576040519150601f19603f3d011682016040523d82523d6000602084013e62002b37565b606091505b50915091508162002a66576040518060400160405280600981526020017f4e4f5f53594d424f4c000000000000000000000000000000000000000000000081525062001d74565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f313ce5670000000000000000000000000000000000000000000000000000000017905290516000918291829173ffffffffffffffffffffffffffffffffffffffff86169162002c019190620038e6565b600060405180830381855afa9150503d806000811462002c3e576040519150601f19603f3d011682016040523d82523d6000602084013e62002c43565b606091505b509150915081801562002c57575080516020145b62002c6457601262001d74565b8080602001905181019062001d74919062004012565b60018055565b60685460ff1662002cbd576040517f5386698100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040517f1e5e34eea33501aecf2ebec9fe0e884a40804275ea7fe10b2ba084c8374308b390600090a1565b600881901c60008181526069602052604081208054600160ff861690811b91821892839055929091908183169003620009c9576040517f646cf55800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600062002dd9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16620031119092919063ffffffff16565b80519091501562001f22578080602001905181019062002dfa919062004032565b62001f22576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840162001324565b600054610100900460ff1662002c7a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162001324565b6060604082511062002f435781806020019051810190620007a2919062004052565b8151602003620030d35760005b60208110801562002f9b575082818151811062002f715762002f7162003b8a565b01602001517fff000000000000000000000000000000000000000000000000000000000000001615155b1562002fb6578062002fad8162003be8565b91505062002f50565b8060000362002ffa57505060408051808201909152601281527f4e4f545f56414c49445f454e434f44494e4700000000000000000000000000006020820152919050565b60008167ffffffffffffffff81111562003018576200301862003891565b6040519080825280601f01601f19166020018201604052801562003043576020820181803683370190505b50905060005b82811015620030cb5784818151811062003067576200306762003b8a565b602001015160f81c60f81b82828151811062003087576200308762003b8a565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080620030c28162003be8565b91505062003049565b509392505050565b505060408051808201909152601281527f4e4f545f56414c49445f454e434f44494e470000000000000000000000000000602082015290565b919050565b606062001d748484600085856000808673ffffffffffffffffffffffffffffffffffffffff168587604051620031489190620038e6565b60006040518083038185875af1925050503d806000811462003187576040519150601f19603f3d011682016040523d82523d6000602084013e6200318c565b606091505b50915091506200319f87838387620031aa565b979650505050505050565b60608315620032455782516000036200323d5773ffffffffffffffffffffffffffffffffffffffff85163b6200323d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162001324565b508162001d74565b62001d7483838151156200325c5781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620013249190620040d2565b611b6680620040e883390190565b803563ffffffff811681146200310c57600080fd5b73ffffffffffffffffffffffffffffffffffffffff81168114620032d857600080fd5b50565b60008060408385031215620032ef57600080fd5b620032fa83620032a0565b915060208301356200330c81620032b5565b809150509250929050565b8015158114620032d857600080fd5b60008083601f8401126200333957600080fd5b50813567ffffffffffffffff8111156200335257600080fd5b6020830191508360208285010111156200336b57600080fd5b9250929050565b6000806000806000608086880312156200338b57600080fd5b6200339686620032a0565b94506020860135620033a881620032b5565b93506040860135620033ba8162003317565b9250606086013567ffffffffffffffff811115620033d757600080fd5b620033e58882890162003326565b969995985093965092949392505050565b806104008101831015620007a257600080fd5b60008060008060008060008060008060006105208c8e0312156200342c57600080fd5b620034388d8d620033f6565b9a50620034496104008d01620032a0565b99506104208c013598506104408c013597506200346a6104608d01620032a0565b96506104808c01356200347d81620032b5565b95506200348e6104a08d01620032a0565b94506104c08c0135620034a181620032b5565b93506104e08c013592506105008c013567ffffffffffffffff811115620034c757600080fd5b620034d58e828f0162003326565b915080935050809150509295989b509295989b9093969950565b6000602082840312156200350257600080fd5b81356200350f81620032b5565b9392505050565b60ff81168114620032d857600080fd5b600080600080600080600060e0888a0312156200354257600080fd5b87356200354f8162003516565b96506200355f60208901620032a0565b955060408801356200357181620032b5565b94506200358160608901620032a0565b935060808801356200359381620032b5565b9699959850939692959460a0840135945060c09093013592915050565b600080600060608486031215620035c657600080fd5b620035d184620032a0565b92506020840135620035e381620032b5565b91506040840135620035f581620032b5565b809150509250925092565b6000602082840312156200361357600080fd5b5035919050565b600080600080600080600060a0888a0312156200363657600080fd5b6200364188620032a0565b965060208801356200365381620032b5565b9550604088013567ffffffffffffffff808211156200367157600080fd5b6200367f8b838c0162003326565b909750955060608a01359150808211156200369957600080fd5b50620036a88a828b0162003326565b9094509250506080880135620036be8162003516565b8091505092959891949750929550565b600080600080600080600060c0888a031215620036ea57600080fd5b620036f588620032a0565b965060208801356200370781620032b5565b95506040880135945060608801356200372081620032b5565b93506080880135620037328162003317565b925060a088013567ffffffffffffffff8111156200374f57600080fd5b6200375d8a828b0162003326565b989b979a50959850939692959293505050565b60008060008061046085870312156200378857600080fd5b843593506200379b8660208701620033f6565b9250620037ac6104208601620032a0565b939692955092936104400135925050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b600061010060ff8c16835263ffffffff808c16602085015273ffffffffffffffffffffffffffffffffffffffff808c166040860152818b166060860152808a166080860152508760a08501528160c0850152620038678285018789620037bd565b925080851660e085015250509a9950505050505050505050565b8183823760009101908152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60005b83811015620038dd578181015183820152602001620038c3565b50506000910152565b60008251620038fa818460208701620038c0565b9190910192915050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156200394e576200394e62003891565b604052919050565b600067ffffffffffffffff82111562003973576200397362003891565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112620039b157600080fd5b8135620039c8620039c28262003956565b62003904565b818152846020838601011115620039de57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121562003a1157600080fd5b833567ffffffffffffffff8082111562003a2a57600080fd5b62003a38878388016200399f565b9450602086013591508082111562003a4f57600080fd5b5062003a5e868287016200399f565b9250506040840135620035f58162003516565b6000815180845262003a8b816020860160208601620038c0565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60608152600062003ad2606083018662003a71565b828103602084015262003ae6818662003a71565b91505060ff83166040830152949350505050565b63ffffffff86168152600073ffffffffffffffffffffffffffffffffffffffff8087166020840152808616604084015250608060608301526200319f608083018486620037bd565b73ffffffffffffffffffffffffffffffffffffffff8516815263ffffffff8416602082015260606040820152600062003b80606083018486620037bd565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820362003c1c5762003c1c62003bb9565b5060010190565b60608152600062003c39606083018789620037bd565b828103602084015262003c4e818688620037bd565b91505060ff831660408301529695505050505050565b6000835162003c78818460208801620038c0565b83519083019062003c8e818360208801620038c0565b01949350505050565b60006020828403121562003caa57600080fd5b5051919050565b81810381811115620007a257620007a262003bb9565b600061010060ff8b16835263ffffffff808b16602085015273ffffffffffffffffffffffffffffffffffffffff808b166040860152818a1660608601528089166080860152508660a08501528160c085015262003d278285018762003a71565b925080851660e085015250509998505050505050505050565b600181815b8085111562003d9f57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111562003d835762003d8362003bb9565b8085161562003d9157918102915b93841c939080029062003d45565b509250929050565b60008262003db857506001620007a2565b8162003dc757506000620007a2565b816001811462003de0576002811462003deb5762003e0b565b6001915050620007a2565b60ff84111562003dff5762003dff62003bb9565b50506001821b620007a2565b5060208310610133831016604e8410600b841016171562003e30575081810a620007a2565b62003e3c838362003d40565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111562003e715762003e7162003bb9565b029392505050565b60006200350f838362003da7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b6000808585111562003ec757600080fd5b8386111562003ed557600080fd5b5050820193919092039150565b7fffffffff00000000000000000000000000000000000000000000000000000000813581811691600485101562003f235780818660040360031b1b83161692505b505092915050565b600080600080600080600060e0888a03121562003f4757600080fd5b873562003f5481620032b5565b9650602088013562003f6681620032b5565b955060408801359450606088013593506080880135620035938162003516565b600080600080600080600080610100898b03121562003fa457600080fd5b883562003fb181620032b5565b9750602089013562003fc381620032b5565b96506040890135955060608901359450608089013562003fe38162003317565b935060a089013562003ff58162003516565b979a969950949793969295929450505060c08201359160e0013590565b6000602082840312156200402557600080fd5b81516200350f8162003516565b6000602082840312156200404557600080fd5b81516200350f8162003317565b6000602082840312156200406557600080fd5b815167ffffffffffffffff8111156200407d57600080fd5b8201601f810184136200408f57600080fd5b8051620040a0620039c28262003956565b818152856020838501011115620040b657600080fd5b620040c9826020830160208601620038c0565b95945050505050565b6020815260006200350f602083018462003a7156fe6101006040523480156200001257600080fd5b5060405162001b6638038062001b6683398101604081905262000035916200028d565b82826003620000458382620003a1565b506004620000548282620003a1565b50503360c0525060ff811660e052466080819052620000739062000080565b60a052506200046d915050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f620000ad6200012e565b805160209182012060408051808201825260018152603160f81b90840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b6060600380546200013f9062000312565b80601f01602080910402602001604051908101604052809291908181526020018280546200016d9062000312565b8015620001be5780601f106200019257610100808354040283529160200191620001be565b820191906000526020600020905b815481529060010190602001808311620001a057829003601f168201915b5050505050905090565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620001f057600080fd5b81516001600160401b03808211156200020d576200020d620001c8565b604051601f8301601f19908116603f01168101908282118183101715620002385762000238620001c8565b816040528381526020925086838588010111156200025557600080fd5b600091505b838210156200027957858201830151818301840152908201906200025a565b600093810190920192909252949350505050565b600080600060608486031215620002a357600080fd5b83516001600160401b0380821115620002bb57600080fd5b620002c987838801620001de565b94506020860151915080821115620002e057600080fd5b50620002ef86828701620001de565b925050604084015160ff811681146200030757600080fd5b809150509250925092565b600181811c908216806200032757607f821691505b6020821081036200034857634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200039c57600081815260208120601f850160051c81016020861015620003775750805b601f850160051c820191505b81811015620003985782815560010162000383565b5050505b505050565b81516001600160401b03811115620003bd57620003bd620001c8565b620003d581620003ce845462000312565b846200034e565b602080601f8311600181146200040d5760008415620003f45750858301515b600019600386901b1c1916600185901b17855562000398565b600085815260208120601f198616915b828110156200043e578886015182559484019460019091019084016200041d565b50858210156200045d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e0516116aa620004bc6000396000610237015260008181610307015281816105c001526106a70152600061053a015260008181610379015261050401526116aa6000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806370a08231116100d8578063a457c2d71161008c578063d505accf11610066578063d505accf1461039b578063dd62ed3e146103ae578063ffa1ad74146103f457600080fd5b8063a457c2d71461034e578063a9059cbb14610361578063cd0d00961461037457600080fd5b806395d89b41116100bd57806395d89b41146102e75780639dc29fac146102ef578063a3c573eb1461030257600080fd5b806370a08231146102915780637ecebe00146102c757600080fd5b806330adf81f1161012f5780633644e515116101145780633644e51514610261578063395093511461026957806340c10f191461027c57600080fd5b806330adf81f14610209578063313ce5671461023057600080fd5b806318160ddd1161016057806318160ddd146101bd57806320606b70146101cf57806323b872dd146101f657600080fd5b806306fdde031461017c578063095ea7b31461019a575b600080fd5b610184610430565b60405161019191906113e4565b60405180910390f35b6101ad6101a8366004611479565b6104c2565b6040519015158152602001610191565b6002545b604051908152602001610191565b6101c17f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81565b6101ad6102043660046114a3565b6104dc565b6101c17f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152602001610191565b6101c1610500565b6101ad610277366004611479565b61055c565b61028f61028a366004611479565b6105a8565b005b6101c161029f3660046114df565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6101c16102d53660046114df565b60056020526000908152604090205481565b610184610680565b61028f6102fd366004611479565b61068f565b6103297f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610191565b6101ad61035c366004611479565b61075e565b6101ad61036f366004611479565b61082f565b6101c17f000000000000000000000000000000000000000000000000000000000000000081565b61028f6103a9366004611501565b61083d565b6101c16103bc366004611574565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6101846040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525081565b60606003805461043f906115a7565b80601f016020809104026020016040519081016040528092919081815260200182805461046b906115a7565b80156104b85780601f1061048d576101008083540402835291602001916104b8565b820191906000526020600020905b81548152906001019060200180831161049b57829003601f168201915b5050505050905090565b6000336104d0818585610b73565b60019150505b92915050565b6000336104ea858285610d27565b6104f5858585610dfe565b506001949350505050565b60007f00000000000000000000000000000000000000000000000000000000000000004614610537576105324661106d565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091906104d090829086906105a3908790611629565b610b73565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610672576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d4272696467650000000000000000000000000000000060648201526084015b60405180910390fd5b61067c8282611135565b5050565b60606004805461043f906115a7565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610754576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d427269646765000000000000000000000000000000006064820152608401610669565b61067c8282611228565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015610822576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610669565b6104f58286868403610b73565b6000336104d0818585610dfe565b834211156108cc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f546f6b656e577261707065643a3a7065726d69743a204578706972656420706560448201527f726d6974000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8716600090815260056020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918a918a918a9190866109268361163c565b9091555060408051602081019690965273ffffffffffffffffffffffffffffffffffffffff94851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000610991610500565b6040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281019190915260428101839052606201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa158015610a55573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590610ad057508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b610b5c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f546f6b656e577261707065643a3a7065726d69743a20496e76616c696420736960448201527f676e6174757265000000000000000000000000000000000000000000000000006064820152608401610669565b610b678a8a8a610b73565b50505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff8316610c15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610cb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610df85781811015610deb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610669565b610df88484848403610b73565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610ea1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610f44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610ffa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610df8565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f611098610430565b8051602091820120604080518082018252600181527f310000000000000000000000000000000000000000000000000000000000000090840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b73ffffffffffffffffffffffffffffffffffffffff82166111b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610669565b80600260008282546111c49190611629565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff82166112cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205481811015611381576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610d1a565b600060208083528351808285015260005b81811015611411578581018301518582016040015282016113f5565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461147457600080fd5b919050565b6000806040838503121561148c57600080fd5b61149583611450565b946020939093013593505050565b6000806000606084860312156114b857600080fd5b6114c184611450565b92506114cf60208501611450565b9150604084013590509250925092565b6000602082840312156114f157600080fd5b6114fa82611450565b9392505050565b600080600080600080600060e0888a03121561151c57600080fd5b61152588611450565b965061153360208901611450565b95506040880135945060608801359350608088013560ff8116811461155757600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561158757600080fd5b61159083611450565b915061159e60208401611450565b90509250929050565b600181811c908216806115bb57607f821691505b6020821081036115f4577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156104d6576104d66115fa565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361166d5761166d6115fa565b506001019056fea26469706673582212208d88fee561cff7120d381c345cfc534cef8229a272dc5809d4bbb685ad67141164736f6c63430008110033a2646970667358221220d9b3ca7b13ec80ac58634ddf0ecebe71e209a71f532614949b9e720413f50c8364736f6c63430008110033" +
    +
    + 43 + +
    + - + }, +
    +
    + 44 + +
    + - + { +
    +
    + 45 + +
    + - + "contractName": "PolygonZkEVMBridge proxy", +
    +
    + 46 + +
    + - + "balance": "200000000000000000000000000", +
    +
    + 47 + +
    + - + "nonce": "1", +
    +
    + 48 + +
    + - + "address": "0x528e26b25a34a4A5d0dbDa1d57D318153d2ED582", +
    +
    + 49 + +
    + - + "bytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461088b565b610135565b61006b6100a33660046108a6565b61017f565b3480156100b457600080fd5b506100bd6101f3565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461088b565b610231565b34801561011257600080fd5b506100bd61025e565b6101236102d4565b61013361012e6103ab565b6103b5565b565b61013d6103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481604051806020016040528060008152506000610419565b50565b61017461011b565b6101876103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101eb576101e68383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610419915050565b505050565b6101e661011b565b60006101fd6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103ab565b905090565b61022e61011b565b90565b6102396103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481610444565b60006102686103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103d9565b60606102b183836040518060600160405280602781526020016109bb602791396104a5565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b6102dc6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b600061022161052a565b3660008037600080366000845af43d6000803e8080156103d4573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b61042283610552565b60008251118061042f5750805b156101e65761043e838361028c565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61046d6103d9565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a16101748161059f565b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516104cf919061094d565b600060405180830381855af49150503d806000811461050a576040519150601f19603f3d011682016040523d82523d6000602084013e61050f565b606091505b5091509150610520868383876106ab565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6103fd565b61055b81610753565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff8116610642576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103a2565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b6060831561074157825160000361073a5773ffffffffffffffffffffffffffffffffffffffff85163b61073a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103a2565b508161074b565b61074b838361081e565b949350505050565b73ffffffffffffffffffffffffffffffffffffffff81163b6107f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e74726163740000000000000000000000000000000000000060648201526084016103a2565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610665565b81511561082e5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a29190610969565b803573ffffffffffffffffffffffffffffffffffffffff8116811461088657600080fd5b919050565b60006020828403121561089d57600080fd5b6102b182610862565b6000806000604084860312156108bb57600080fd5b6108c484610862565b9250602084013567ffffffffffffffff808211156108e157600080fd5b818601915086601f8301126108f557600080fd5b81358181111561090457600080fd5b87602082850101111561091657600080fd5b6020830194508093505050509250925092565b60005b8381101561094457818101518382015260200161092c565b50506000910152565b6000825161095f818460208701610929565b9190910192915050565b6020815260008251806020840152610988816040850160208701610929565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220a1af0d6cb4f1e31496a4c5c1448913bce4bd6ad3a39e47c6f7190c114d6f9bf464736f6c63430008110033", +
    +
    + 50 + +
    + - + "storage": { +
    +
    + 51 + +
    + - + "0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000000000000000000000000000000000000000000001", +
    +
    + 52 + +
    + - + "0x0000000000000000000000000000000000000000000000000000000000000001": "0x0000000000000000000000000000000000000000000000000000000000000001", +
    +
    + 53 + +
    + - + "0x0000000000000000000000000000000000000000000000000000000000000068": "0x00000000000000a40d5f56745a118d0906a34e69aec8c0db1cb8fa0000000100", +
    +
    + 54 + +
    + - + "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x00000000000000000000000085ceb41028b1a5ed2b88e395145344837308b251", +
    +
    + 55 + +
    + - + "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x0000000000000000000000008bd36ca1a55e389335004872aa3c3be0969d3aa7" +
    +
    + 56 + +
    + - + } +
    +
    + 57 + +
    + - + }, +
    +
    + 58 + +
    + - + { +
    +
    + 59 + +
    + - + "contractName": "PolygonZkEVMGlobalExitRootL2 implementation", +
    +
    + 60 + +
    + - + "balance": "0", +
    +
    + 61 + +
    + - + "nonce": "1", +
    +
    + 62 + +
    + - + "address": "0x282a631D9F3Ef04Bf1A44B4C9e8bDC8EB278917f", +
    +
    + 63 + +
    + - + "bytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806301fd904414610051578063257b36321461006d57806333d6247d1461008d578063a3c573eb146100a2575b600080fd5b61005a60015481565b6040519081526020015b60405180910390f35b61005a61007b366004610162565b60006020819052908152604090205481565b6100a061009b366004610162565b6100ee565b005b6100c97f000000000000000000000000528e26b25a34a4a5d0dbda1d57d318153d2ed58281565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610064565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000528e26b25a34a4a5d0dbda1d57d318153d2ed582161461015d576040517fb49365dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600155565b60006020828403121561017457600080fd5b503591905056fea2646970667358221220a187fc278346c1b61c449ea3641002b6eac2bda3351a122a12c35099f933696864736f6c63430008110033" +
    +
    + 64 + +
    + - + }, +
    +
    + 65 + +
    + - + { +
    +
    + 66 + +
    + - + "contractName": "PolygonZkEVMGlobalExitRootL2 proxy", +
    +
    + 67 + +
    + - + "balance": "0", +
    +
    + 68 + +
    + - + "nonce": "1", +
    +
    + 69 + +
    + - + "address": "0xa40d5f56745a118d0906a34e69aec8c0db1cb8fa", +
    +
    + 70 + +
    + - + "bytecode": "0x60806040523661001357610011610017565b005b6100115b61001f6101b7565b6001600160a01b0316336001600160a01b0316141561016f5760606001600160e01b031960003516631b2ce7f360e11b8114156100655761005e6101ea565b9150610167565b6001600160e01b0319811663278f794360e11b14156100865761005e610241565b6001600160e01b031981166308f2839760e41b14156100a75761005e610287565b6001600160e01b031981166303e1469160e61b14156100c85761005e6102b8565b6001600160e01b03198116635c60da1b60e01b14156100e95761005e6102f8565b60405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b815160208301f35b61017761030c565b565b606061019e83836040518060600160405280602781526020016108576027913961031c565b9392505050565b90565b6001600160a01b03163b151590565b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b60606101f4610394565b600061020336600481846106a2565b81019061021091906106e8565b905061022d8160405180602001604052806000815250600061039f565b505060408051602081019091526000815290565b606060008061025336600481846106a2565b8101906102609190610719565b915091506102708282600161039f565b604051806020016040528060008152509250505090565b6060610291610394565b60006102a036600481846106a2565b8101906102ad91906106e8565b905061022d816103cb565b60606102c2610394565b60006102cc6101b7565b604080516001600160a01b03831660208201529192500160405160208183030381529060405291505090565b6060610302610394565b60006102cc610422565b610177610317610422565b610431565b6060600080856001600160a01b0316856040516103399190610807565b600060405180830381855af49150503d8060008114610374576040519150601f19603f3d011682016040523d82523d6000602084013e610379565b606091505b509150915061038a86838387610455565b9695505050505050565b341561017757600080fd5b6103a8836104d3565b6000825111806103b55750805b156103c6576103c48383610179565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6103f46101b7565b604080516001600160a01b03928316815291841660208301520160405180910390a161041f81610513565b50565b600061042c6105bc565b905090565b3660008037600080366000845af43d6000803e808015610450573d6000f35b3d6000fd5b606083156104c15782516104ba576001600160a01b0385163b6104ba5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161015e565b50816104cb565b6104cb83836105e4565b949350505050565b6104dc8161060e565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6001600160a01b0381166105785760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b606482015260840161015e565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80546001600160a01b0319166001600160a01b039290921691909117905550565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6101db565b8151156105f45781518083602001fd5b8060405162461bcd60e51b815260040161015e9190610823565b6001600160a01b0381163b61067b5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161015e565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc61059b565b600080858511156106b257600080fd5b838611156106bf57600080fd5b5050820193919092039150565b80356001600160a01b03811681146106e357600080fd5b919050565b6000602082840312156106fa57600080fd5b61019e826106cc565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561072c57600080fd5b610735836106cc565b9150602083013567ffffffffffffffff8082111561075257600080fd5b818501915085601f83011261076657600080fd5b81358181111561077857610778610703565b604051601f8201601f19908116603f011681019083821181831017156107a0576107a0610703565b816040528281528860208487010111156107b957600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b838110156107f65781810151838201526020016107de565b838111156103c45750506000910152565b600082516108198184602087016107db565b9190910192915050565b60208152600082518060208401526108428160408501602087016107db565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122012bb4f564f73959a03513dc74fc3c6e40e8386e6f02c16b78d6db00ce0aa16af64736f6c63430008090033", +
    +
    + 71 + +
    + - + "storage": { +
    +
    + 72 + +
    + - + "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x00000000000000000000000085ceb41028b1a5ed2b88e395145344837308b251", +
    +
    + 73 + +
    + - + "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x000000000000000000000000282a631d9f3ef04bf1a44b4c9e8bdc8eb278917f" +
    +
    + 74 + +
    + - + } +
    +
    + 75 + +
    + - + }, +
    +
    + 76 + +
    + - + { +
    +
    + 77 + +
    + - + "contractName": "PolygonZkEVMTimelock", +
    +
    + 78 + +
    + - + "balance": "0", +
    +
    + 79 + +
    + - + "nonce": "1", +
    +
    + 80 + +
    + - + "address": "0xdbC6981a11fc2B000c635bFA7C47676b25C87D39", +
    +
    + 81 + +
    + - + "bytecode": "0x6080604052600436106101c65760003560e01c806364d62353116100f7578063b1c5f42711610095578063d547741f11610064578063d547741f14610661578063e38335e514610681578063f23a6e6114610694578063f27a0c92146106d957600080fd5b8063b1c5f427146105af578063bc197c81146105cf578063c4d252f514610614578063d45c44351461063457600080fd5b80638f61f4f5116100d15780638f61f4f5146104e157806391d1485414610515578063a217fddf14610566578063b08e51c01461057b57600080fd5b806364d62353146104815780638065657f146104a15780638f2a0bb0146104c157600080fd5b8063248a9ca31161016457806331d507501161013e57806331d50750146103c857806336568abe146103e85780633a6aae7214610408578063584b153e1461046157600080fd5b8063248a9ca3146103475780632ab0f529146103775780632f2ff15d146103a857600080fd5b80630d3cf6fc116101a05780630d3cf6fc1461026b578063134008d31461029f57806313bc9f20146102b2578063150b7a02146102d257600080fd5b806301d5062a146101d257806301ffc9a7146101f457806307bd02651461022957600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506101f26101ed366004611c52565b6106ee565b005b34801561020057600080fd5b5061021461020f366004611cc7565b610783565b60405190151581526020015b60405180910390f35b34801561023557600080fd5b5061025d7fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e6381565b604051908152602001610220565b34801561027757600080fd5b5061025d7f5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca581565b6101f26102ad366004611d09565b6107df565b3480156102be57600080fd5b506102146102cd366004611d75565b6108d7565b3480156102de57600080fd5b506103166102ed366004611e9a565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610220565b34801561035357600080fd5b5061025d610362366004611d75565b60009081526020819052604090206001015490565b34801561038357600080fd5b50610214610392366004611d75565b6000908152600160208190526040909120541490565b3480156103b457600080fd5b506101f26103c3366004611f02565b6108fd565b3480156103d457600080fd5b506102146103e3366004611d75565b610927565b3480156103f457600080fd5b506101f2610403366004611f02565b610940565b34801561041457600080fd5b5061043c7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610220565b34801561046d57600080fd5b5061021461047c366004611d75565b6109f8565b34801561048d57600080fd5b506101f261049c366004611d75565b610a0e565b3480156104ad57600080fd5b5061025d6104bc366004611d09565b610ade565b3480156104cd57600080fd5b506101f26104dc366004611f73565b610b1d565b3480156104ed57600080fd5b5061025d7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc181565b34801561052157600080fd5b50610214610530366004611f02565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b34801561057257600080fd5b5061025d600081565b34801561058757600080fd5b5061025d7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f78381565b3480156105bb57600080fd5b5061025d6105ca366004612025565b610d4f565b3480156105db57600080fd5b506103166105ea36600461214e565b7fbc197c810000000000000000000000000000000000000000000000000000000095945050505050565b34801561062057600080fd5b506101f261062f366004611d75565b610d94565b34801561064057600080fd5b5061025d61064f366004611d75565b60009081526001602052604090205490565b34801561066d57600080fd5b506101f261067c366004611f02565b610e8f565b6101f261068f366004612025565b610eb4565b3480156106a057600080fd5b506103166106af3660046121f8565b7ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b3480156106e557600080fd5b5061025d611161565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc161071881611244565b6000610728898989898989610ade565b90506107348184611251565b6000817f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8b8b8b8b8b8a604051610770969594939291906122a6565b60405180910390a3505050505050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f4e2312e00000000000000000000000000000000000000000000000000000000014806107d957506107d98261139e565b92915050565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff1661085c5761085c8133611435565b600061086c888888888888610ade565b905061087881856114ed565b6108848888888861162a565b6000817fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588a8a8a8a6040516108bc94939291906122f1565b60405180910390a36108cd8161172e565b5050505050505050565b6000818152600160205260408120546001811180156108f65750428111155b9392505050565b60008281526020819052604090206001015461091881611244565b61092283836117d7565b505050565b60008181526001602052604081205481905b1192915050565b73ffffffffffffffffffffffffffffffffffffffff811633146109ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6109f482826118c7565b5050565b6000818152600160208190526040822054610939565b333014610a9d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f54696d656c6f636b436f6e74726f6c6c65723a2063616c6c6572206d7573742060448201527f62652074696d656c6f636b00000000000000000000000000000000000000000060648201526084016109e1565b60025460408051918252602082018390527f11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d5910160405180910390a1600255565b6000868686868686604051602001610afb969594939291906122a6565b6040516020818303038152906040528051906020012090509695505050505050565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1610b4781611244565b888714610bd6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b888514610c65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b6000610c778b8b8b8b8b8b8b8b610d4f565b9050610c838184611251565b60005b8a811015610d415780827f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8e8e85818110610cc357610cc3612331565b9050602002016020810190610cd89190612360565b8d8d86818110610cea57610cea612331565b905060200201358c8c87818110610d0357610d03612331565b9050602002810190610d15919061237b565b8c8b604051610d29969594939291906122a6565b60405180910390a3610d3a8161240f565b9050610c86565b505050505050505050505050565b60008888888888888888604051602001610d709897969594939291906124f7565b60405160208183030381529060405280519060200120905098975050505050505050565b7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f783610dbe81611244565b610dc7826109f8565b610e53576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20636160448201527f6e6e6f742062652063616e63656c6c656400000000000000000000000000000060648201526084016109e1565b6000828152600160205260408082208290555183917fbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb7091a25050565b600082815260208190526040902060010154610eaa81611244565b61092283836118c7565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff16610f3157610f318133611435565b878614610fc0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b87841461104f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b60006110618a8a8a8a8a8a8a8a610d4f565b905061106d81856114ed565b60005b8981101561114b5760008b8b8381811061108c5761108c612331565b90506020020160208101906110a19190612360565b905060008a8a848181106110b7576110b7612331565b9050602002013590503660008a8a868181106110d5576110d5612331565b90506020028101906110e7919061237b565b915091506110f78484848461162a565b84867fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588686868660405161112e94939291906122f1565b60405180910390a350505050806111449061240f565b9050611070565b506111558161172e565b50505050505050505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff161580159061123257507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166315064c966040518163ffffffff1660e01b8152600401602060405180830381865afa15801561120e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123291906125be565b1561123d5750600090565b5060025490565b61124e8133611435565b50565b61125a82610927565b156112e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20616c60448201527f7265616479207363686564756c6564000000000000000000000000000000000060648201526084016109e1565b6112ef611161565b81101561137e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a20696e73756666696369656e7460448201527f2064656c6179000000000000000000000000000000000000000000000000000060648201526084016109e1565b61138881426125e0565b6000928352600160205260409092209190915550565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806107d957507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146107d9565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f4576114738161197e565b61147e83602061199d565b60405160200161148f929190612617565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526109e191600401612698565b6114f6826108d7565b611582576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b80158061159e5750600081815260016020819052604090912054145b6109f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a206d697373696e67206465706560448201527f6e64656e6379000000000000000000000000000000000000000000000000000060648201526084016109e1565b60008473ffffffffffffffffffffffffffffffffffffffff168484846040516116549291906126e9565b60006040518083038185875af1925050503d8060008114611691576040519150601f19603f3d011682016040523d82523d6000602084013e611696565b606091505b5050905080611727576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f54696d656c6f636b436f6e74726f6c6c65723a20756e6465726c79696e67207460448201527f72616e73616374696f6e2072657665727465640000000000000000000000000060648201526084016109e1565b5050505050565b611737816108d7565b6117c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b600090815260016020819052604090912055565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556118693390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60606107d973ffffffffffffffffffffffffffffffffffffffff831660145b606060006119ac8360026126f9565b6119b79060026125e0565b67ffffffffffffffff8111156119cf576119cf611d8e565b6040519080825280601f01601f1916602001820160405280156119f9576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611a3057611a30612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611a9357611a93612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000611acf8460026126f9565b611ada9060016125e0565b90505b6001811115611b77577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611b1b57611b1b612331565b1a60f81b828281518110611b3157611b31612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611b7081612710565b9050611add565b5083156108f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109e1565b803573ffffffffffffffffffffffffffffffffffffffff81168114611c0457600080fd5b919050565b60008083601f840112611c1b57600080fd5b50813567ffffffffffffffff811115611c3357600080fd5b602083019150836020828501011115611c4b57600080fd5b9250929050565b600080600080600080600060c0888a031215611c6d57600080fd5b611c7688611be0565b965060208801359550604088013567ffffffffffffffff811115611c9957600080fd5b611ca58a828b01611c09565b989b979a50986060810135976080820135975060a09091013595509350505050565b600060208284031215611cd957600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146108f657600080fd5b60008060008060008060a08789031215611d2257600080fd5b611d2b87611be0565b955060208701359450604087013567ffffffffffffffff811115611d4e57600080fd5b611d5a89828a01611c09565b979a9699509760608101359660809091013595509350505050565b600060208284031215611d8757600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611e0457611e04611d8e565b604052919050565b600082601f830112611e1d57600080fd5b813567ffffffffffffffff811115611e3757611e37611d8e565b611e6860207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601611dbd565b818152846020838601011115611e7d57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215611eb057600080fd5b611eb985611be0565b9350611ec760208601611be0565b925060408501359150606085013567ffffffffffffffff811115611eea57600080fd5b611ef687828801611e0c565b91505092959194509250565b60008060408385031215611f1557600080fd5b82359150611f2560208401611be0565b90509250929050565b60008083601f840112611f4057600080fd5b50813567ffffffffffffffff811115611f5857600080fd5b6020830191508360208260051b8501011115611c4b57600080fd5b600080600080600080600080600060c08a8c031215611f9157600080fd5b893567ffffffffffffffff80821115611fa957600080fd5b611fb58d838e01611f2e565b909b50995060208c0135915080821115611fce57600080fd5b611fda8d838e01611f2e565b909950975060408c0135915080821115611ff357600080fd5b506120008c828d01611f2e565b9a9d999c50979a969997986060880135976080810135975060a0013595509350505050565b60008060008060008060008060a0898b03121561204157600080fd5b883567ffffffffffffffff8082111561205957600080fd5b6120658c838d01611f2e565b909a50985060208b013591508082111561207e57600080fd5b61208a8c838d01611f2e565b909850965060408b01359150808211156120a357600080fd5b506120b08b828c01611f2e565b999c989b509699959896976060870135966080013595509350505050565b600082601f8301126120df57600080fd5b8135602067ffffffffffffffff8211156120fb576120fb611d8e565b8160051b61210a828201611dbd565b928352848101820192828101908785111561212457600080fd5b83870192505b848310156121435782358252918301919083019061212a565b979650505050505050565b600080600080600060a0868803121561216657600080fd5b61216f86611be0565b945061217d60208701611be0565b9350604086013567ffffffffffffffff8082111561219a57600080fd5b6121a689838a016120ce565b945060608801359150808211156121bc57600080fd5b6121c889838a016120ce565b935060808801359150808211156121de57600080fd5b506121eb88828901611e0c565b9150509295509295909350565b600080600080600060a0868803121561221057600080fd5b61221986611be0565b945061222760208701611be0565b93506040860135925060608601359150608086013567ffffffffffffffff81111561225157600080fd5b6121eb88828901611e0c565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b73ffffffffffffffffffffffffffffffffffffffff8716815285602082015260a0604082015260006122dc60a08301868861225d565b60608301949094525060800152949350505050565b73ffffffffffffffffffffffffffffffffffffffff8516815283602082015260606040820152600061232760608301848661225d565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561237257600080fd5b6108f682611be0565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126123b057600080fd5b83018035915067ffffffffffffffff8211156123cb57600080fd5b602001915036819003821315611c4b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612440576124406123e0565b5060010190565b81835260006020808501808196508560051b810191508460005b878110156124ea57828403895281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18836030181126124a057600080fd5b8701858101903567ffffffffffffffff8111156124bc57600080fd5b8036038213156124cb57600080fd5b6124d686828461225d565b9a87019a9550505090840190600101612461565b5091979650505050505050565b60a0808252810188905260008960c08301825b8b8110156125455773ffffffffffffffffffffffffffffffffffffffff61253084611be0565b1682526020928301929091019060010161250a565b5083810360208501528881527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff89111561257e57600080fd5b8860051b9150818a602083013701828103602090810160408501526125a69082018789612447565b60608401959095525050608001529695505050505050565b6000602082840312156125d057600080fd5b815180151581146108f657600080fd5b808201808211156107d9576107d96123e0565b60005b8381101561260e5781810151838201526020016125f6565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161264f8160178501602088016125f3565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161268c8160288401602088016125f3565b01602801949350505050565b60208152600082518060208401526126b78160408501602087016125f3565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b8183823760009101908152919050565b80820281158282048414176107d9576107d96123e0565b60008161271f5761271f6123e0565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea26469706673582212206416c4e08f97752b4bb06159524dac058d3dccd8775e57ef1b01505751ebf7af64736f6c63430008110033", +
    +
    + 82 + +
    + - + "storage": { +
    +
    + 83 + +
    + - + "0x0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000000000000000000e10", +
    +
    + 84 + +
    + - + "0xf587dde6f8846415188f807710a3304f72092565918b30307d60efdc8014f20b": "0x0000000000000000000000000000000000000000000000000000000000000001", +
    +
    + 85 + +
    + - + "0x07020fe9de9b8274d1e6cc0668a6f6344a870f35e5a847590c8069dfa85ac78f": "0x0000000000000000000000000000000000000000000000000000000000000001", +
    +
    + 86 + +
    + - + "0x64494413541ff93b31aa309254e3fed72a7456e9845988b915b4c7a7ceba8814": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", +
    +
    + 87 + +
    + - + "0xc8e266e0814671642b74f3807affd27009fcc23f713ea92d1743e0ee0c1e7603": "0x0000000000000000000000000000000000000000000000000000000000000001", +
    +
    + 88 + +
    + - + "0x3412d5605ac6cd444957cedb533e5dacad6378b4bc819ebe3652188a665066d6": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", +
    +
    + 89 + +
    + - + "0x9b3efc411c5f69533db363941e091f6f3af8b7e306525413577a56d27e5dbe73": "0x0000000000000000000000000000000000000000000000000000000000000001", +
    +
    + 90 + +
    + - + "0xdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d706a": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", +
    +
    + 91 + +
    + - + "0xa2001bdd6a5944149e83176d089ee9a8246bd56aecf38fe4d6c66f5fbac18675": "0x0000000000000000000000000000000000000000000000000000000000000001", +
    +
    + 92 + +
    + - + "0xc3ad33e20b0c56a223ad5104fff154aa010f8715b9c981fd38fdc60a4d1a52fc": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5" +
    +
    + 93 + +
    + - + } +
    +
    + 94 + +
    + - + }, +
    +
    + 95 + +
    + - + { +
    +
    + 96 + +
    + - + "accountName": "keyless Deployer", +
    +
    + 97 + +
    + - + "balance": "0", +
    +
    + 98 + +
    + - + "nonce": "1", +
    +
    + 99 + +
    + - + "address": "0x1754175c450BEbB9B6E14dEe542649c0402A25d2" +
    +
    + 100 + +
    + - + }, +
    +
    + 101 + +
    + - + { +
    +
    + 102 + +
    + - + "accountName": "deployer", +
    +
    + 103 + +
    + - + "balance": "100000000000000000000000", +
    +
    + 104 + +
    + - + "nonce": "8", +
    +
    + 105 + +
    + - + "address": "0xff6250d0E86A2465B0C1bF8e36409503d6a26963" +
    +
    + 106 + +
    + - + } +
    +
    + 107 + +
    + - + ] +
    +
    + 108 + +
    + - + } +
    +
    + 109 + +
    + - + ` +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/config/config.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -2,6 +2,8 @@
    +
    + 2 + +
    +   +
    +
    +
    + 3 + +
    +   + import ( +
    +
    + 4 + +
    +   + "bytes" +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 5 + +
    +   + "path/filepath" +
    +
    + 6 + +
    +   + "strings" +
    +
    + 7 + +
    +   +
    +
    +
    +
    @@ -21,6 +24,7 @@
    +
    + 21 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/state" +
    +
    + 22 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/state/runtime/executor" +
    +
    + 23 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/synchronizer" +
    +
    + + +
    +   +
    +
    +
    + 24 + +
    +   + "github.com/mitchellh/mapstructure" +
    +
    + 25 + +
    +   + "github.com/spf13/viper" +
    +
    + 26 + +
    +   + "github.com/urfave/cli/v2" +
    +
    +
    @@ -31,7 +35,7 @@
    +
    + 31 + +
    +   + FlagYes = "yes" +
    +
    + 32 + +
    +   + // FlagCfg is the flag for cfg. +
    +
    + 33 + +
    +   + FlagCfg = "cfg" +
    +
    + 34 + +
    + - + // FlagNetwork is the flag for the network name. Valid values: ["testnet", "mainnet", "cardona", "custom"]. +
    +
    + 35 + +
    +   + FlagNetwork = "network" +
    +
    + 36 + +
    +   + // FlagCustomNetwork is the flag for the custom network file. This is required if --network=custom +
    +
    + 37 + +
    +   + FlagCustomNetwork = "custom-network-file" +
    +
    +
    @@ -183,3 +187,19 @@
    +
    + 183 + +
    +   + } +
    +
    + 184 + +
    +   + return cfg, nil +
    +
    + 185 + +
    +   + } +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 2 + +
    +   +
    +
    +
    + 3 + +
    +   + import ( +
    +
    + 4 + +
    +   + "bytes" +
    +
    + 5 + +
    + + + "crypto/ecdsa" +
    +
    + 6 + +
    + + + "os" +
    +
    + 7 + +
    +   + "path/filepath" +
    +
    + 8 + +
    +   + "strings" +
    +
    + 9 + +
    +   +
    +
    +
    +
     
    +
    + 24 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/state" +
    +
    + 25 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/state/runtime/executor" +
    +
    + 26 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/synchronizer" +
    +
    + 27 + +
    + + + "github.com/ethereum/go-ethereum/accounts/keystore" +
    +
    + 28 + +
    +   + "github.com/mitchellh/mapstructure" +
    +
    + 29 + +
    +   + "github.com/spf13/viper" +
    +
    + 30 + +
    +   + "github.com/urfave/cli/v2" +
    +
    +
     
    +
    + 35 + +
    +   + FlagYes = "yes" +
    +
    + 36 + +
    +   + // FlagCfg is the flag for cfg. +
    +
    + 37 + +
    +   + FlagCfg = "cfg" +
    +
    + 38 + +
    + + + // FlagNetwork is the flag for the network name. Valid values: ["custom"]. +
    +
    + 39 + +
    +   + FlagNetwork = "network" +
    +
    + 40 + +
    +   + // FlagCustomNetwork is the flag for the custom network file. This is required if --network=custom +
    +
    + 41 + +
    +   + FlagCustomNetwork = "custom-network-file" +
    +
    +
     
    +
    + 187 + +
    +   + } +
    +
    + 188 + +
    +   + return cfg, nil +
    +
    + 189 + +
    +   + } +
    +
    + 190 + +
    + + +
    +
    +
    + 191 + +
    + + + // NewKeyFromKeystore creates a private key from a keystore file +
    +
    + 192 + +
    + + + func NewKeyFromKeystore(cfg types.KeystoreFileConfig) (*ecdsa.PrivateKey, error) { +
    +
    + 193 + +
    + + + if cfg.Path == "" && cfg.Password == "" { +
    +
    + 194 + +
    + + + return nil, nil +
    +
    + 195 + +
    + + + } +
    +
    + 196 + +
    + + + keystoreEncrypted, err := os.ReadFile(filepath.Clean(cfg.Path)) +
    +
    + 197 + +
    + + + if err != nil { +
    +
    + 198 + +
    + + + return nil, err +
    +
    + 199 + +
    + + + } +
    +
    + 200 + +
    + + + key, err := keystore.DecryptKey(keystoreEncrypted, cfg.Password) +
    +
    + 201 + +
    + + + if err != nil { +
    +
    + 202 + +
    + + + return nil, err +
    +
    + 203 + +
    + + + } +
    +
    + 204 + +
    + + + return key.PrivateKey, nil +
    +
    + 205 + +
    + + + } +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/config/config_test.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -58,7 +58,7 @@
    +
    + 58 + +
    +   + }, +
    +
    + 59 + +
    +   + { +
    +
    + 60 + +
    +   + path: "Synchronizer.L2Synchronization.ReprocessFullBatchOnClose", +
    +
    + 61 + +
    + - + expectedValue: true, +
    +
    + 62 + +
    +   + }, +
    +
    + 63 + +
    +   + { +
    +
    + 64 + +
    +   + path: "Synchronizer.L2Synchronization.CheckLastL2BlockHashOnCloseBatch", +
    +
    +
    @@ -174,24 +174,28 @@
    +
    + 174 + +
    +   + expectedValue: uint64(80000), +
    +
    + 175 + +
    +   + }, +
    +
    + 176 + +
    +   + { +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 177 + +
    +   + path: "Etherman.URL", +
    +
    + 178 + +
    +   + expectedValue: "http://localhost:8545", +
    +
    + 179 + +
    +   + }, +
    +
    + 180 + +
    +   + { +
    +
    + 181 + +
    +   + path: "NetworkConfig.L1Config.L1ChainID", +
    +
    + 182 + +
    + - + expectedValue: uint64(5), +
    +
    + 183 + +
    +   + }, +
    +
    + 184 + +
    +   + { +
    +
    + 185 + +
    +   + path: "NetworkConfig.L1Config.ZkEVMAddr", +
    +
    + 186 + +
    + - + expectedValue: common.HexToAddress("0xa997cfD539E703921fD1e3Cf25b4c241a27a4c7A"), +
    +
    + 187 + +
    +   + }, +
    +
    + 188 + +
    +   + { +
    +
    + 189 + +
    +   + path: "NetworkConfig.L1Config.PolAddr", +
    +
    + 190 + +
    + - + expectedValue: common.HexToAddress("0x1319D23c2F7034F52Eb07399702B040bA278Ca49"), +
    +
    + 191 + +
    +   + }, +
    +
    + 192 + +
    +   + { +
    +
    + 193 + +
    +   + path: "NetworkConfig.L1Config.GlobalExitRootManagerAddr", +
    +
    + 194 + +
    + - + expectedValue: common.HexToAddress("0x4d9427DCA0406358445bC0a8F88C26b704004f74"), +
    +
    + 195 + +
    +   + }, +
    +
    + 196 + +
    +   + { +
    +
    + 197 + +
    +   + path: "Etherman.MultiGasProvider", +
    +
    +
    @@ -547,7 +551,8 @@
    +
    + 547 + +
    +   + require.NoError(t, os.WriteFile(file.Name(), []byte("{}"), 0600)) +
    +
    + 548 + +
    +   +
    +
    +
    + 549 + +
    +   + flagSet := flag.NewFlagSet("", flag.PanicOnError) +
    +
    + 550 + +
    + - + flagSet.String(config.FlagNetwork, "testnet", "") +
    +
    + + +
    +   +
    +
    +
    + 551 + +
    +   + ctx := cli.NewContext(cli.NewApp(), flagSet, nil) +
    +
    + 552 + +
    +   + cfg, err := config.Load(ctx, true) +
    +
    + 553 + +
    +   + if err != nil { +
    +
    +
    @@ -585,7 +590,8 @@
    +
    + 585 + +
    +   + }() +
    +
    + 586 + +
    +   + require.NoError(t, os.WriteFile(file.Name(), []byte("{}"), 0600)) +
    +
    + 587 + +
    +   + flagSet := flag.NewFlagSet("", flag.PanicOnError) +
    +
    + 588 + +
    + - + flagSet.String(config.FlagNetwork, "testnet", "") +
    +
    + + +
    +   +
    +
    +
    + 589 + +
    +   + ctx := cli.NewContext(cli.NewApp(), flagSet, nil) +
    +
    + 590 + +
    +   +
    +
    +
    + 591 + +
    +   + os.Setenv("ZKEVM_NODE_LOG_OUTPUTS", "a,b,c") +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 58 + +
    +   + }, +
    +
    + 59 + +
    +   + { +
    +
    + 60 + +
    +   + path: "Synchronizer.L2Synchronization.ReprocessFullBatchOnClose", +
    +
    + 61 + +
    + + + expectedValue: false, +
    +
    + 62 + +
    +   + }, +
    +
    + 63 + +
    +   + { +
    +
    + 64 + +
    +   + path: "Synchronizer.L2Synchronization.CheckLastL2BlockHashOnCloseBatch", +
    +
    +
     
    +
    + 174 + +
    +   + expectedValue: uint64(80000), +
    +
    + 175 + +
    +   + }, +
    +
    + 176 + +
    +   + { +
    +
    + 177 + +
    + + + path: "SequenceSender.MaxBatchesForL1", +
    +
    + 178 + +
    + + + expectedValue: uint64(300), +
    +
    + 179 + +
    + + + }, +
    +
    + 180 + +
    + + + { +
    +
    + 181 + +
    +   + path: "Etherman.URL", +
    +
    + 182 + +
    +   + expectedValue: "http://localhost:8545", +
    +
    + 183 + +
    +   + }, +
    +
    + 184 + +
    +   + { +
    +
    + 185 + +
    +   + path: "NetworkConfig.L1Config.L1ChainID", +
    +
    + 186 + +
    + + + expectedValue: uint64(1337), +
    +
    + 187 + +
    +   + }, +
    +
    + 188 + +
    +   + { +
    +
    + 189 + +
    +   + path: "NetworkConfig.L1Config.ZkEVMAddr", +
    +
    + 190 + +
    + + + expectedValue: common.HexToAddress("0x8dAF17A20c9DBA35f005b6324F493785D239719d"), +
    +
    + 191 + +
    +   + }, +
    +
    + 192 + +
    +   + { +
    +
    + 193 + +
    +   + path: "NetworkConfig.L1Config.PolAddr", +
    +
    + 194 + +
    + + + expectedValue: common.HexToAddress("0x5FbDB2315678afecb367f032d93F642f64180aa3"), +
    +
    + 195 + +
    +   + }, +
    +
    + 196 + +
    +   + { +
    +
    + 197 + +
    +   + path: "NetworkConfig.L1Config.GlobalExitRootManagerAddr", +
    +
    + 198 + +
    + + + expectedValue: common.HexToAddress("0x8A791620dd6260079BF849Dc5567aDC3F2FdC318"), +
    +
    + 199 + +
    +   + }, +
    +
    + 200 + +
    +   + { +
    +
    + 201 + +
    +   + path: "Etherman.MultiGasProvider", +
    +
    +
     
    +
    + 551 + +
    +   + require.NoError(t, os.WriteFile(file.Name(), []byte("{}"), 0600)) +
    +
    + 552 + +
    +   +
    +
    +
    + 553 + +
    +   + flagSet := flag.NewFlagSet("", flag.PanicOnError) +
    +
    + 554 + +
    + + + flagSet.String(config.FlagNetwork, "custom", "") +
    +
    + 555 + +
    + + + flagSet.String(config.FlagCustomNetwork, "../test/config/test.genesis.config.json", "") +
    +
    + 556 + +
    +   + ctx := cli.NewContext(cli.NewApp(), flagSet, nil) +
    +
    + 557 + +
    +   + cfg, err := config.Load(ctx, true) +
    +
    + 558 + +
    +   + if err != nil { +
    +
    +
     
    +
    + 590 + +
    +   + }() +
    +
    + 591 + +
    +   + require.NoError(t, os.WriteFile(file.Name(), []byte("{}"), 0600)) +
    +
    + 592 + +
    +   + flagSet := flag.NewFlagSet("", flag.PanicOnError) +
    +
    + 593 + +
    + + + flagSet.String(config.FlagNetwork, "custom", "") +
    +
    + 594 + +
    + + + flagSet.String(config.FlagCustomNetwork, "../test/config/test.genesis.config.json", "") +
    +
    + 595 + +
    +   + ctx := cli.NewContext(cli.NewApp(), flagSet, nil) +
    +
    + 596 + +
    +   +
    +
    +
    + 597 + +
    +   + os.Setenv("ZKEVM_NODE_LOG_OUTPUTS", "a,b,c") +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/config/default.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -105,7 +105,7 @@
    +
    + 105 + +
    +   + SyncBlockProtection = "safe" # latest, finalized, safe +
    +
    + 106 + +
    +   + L1SynchronizationMode = "sequential" +
    +
    + 107 + +
    +   + L1SyncCheckL2BlockHash = true +
    +
    + 108 + +
    + - + L1SyncCheckL2BlockNumberModulus = 600 +
    +
    + 109 + +
    +   + [Synchronizer.L1BlockCheck] +
    +
    + 110 + +
    +   + Enable = true +
    +
    + 111 + +
    +   + L1SafeBlockPoint = "finalized" +
    +
    +
    @@ -129,7 +129,7 @@
    +
    + 129 + +
    +   + ApplyAfterNumRollupReceived = 10 +
    +
    + 130 + +
    +   + [Synchronizer.L2Synchronization] +
    +
    + 131 + +
    +   + AcceptEmptyClosedBatches = false +
    +
    + 132 + +
    + - + ReprocessFullBatchOnClose = true +
    +
    + 133 + +
    +   + CheckLastL2BlockHashOnCloseBatch = true +
    +
    + 134 + +
    +   +
    +
    +
    + 135 + +
    +   + [Sequencer] +
    +
    +
    @@ -169,6 +169,7 @@
    +
    + 169 + +
    +   + L2Coinbase = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266" +
    +
    + 170 + +
    +   + PrivateKey = {Path = "/pk/sequencer.keystore", Password = "testonly"} +
    +
    + 171 + +
    +   + GasOffset = 80000 +
    +
    + + +
    +   +
    +
    +
    + 172 + +
    +   +
    +
    +
    + 173 + +
    +   + [Aggregator] +
    +
    + 174 + +
    +   + Host = "0.0.0.0" +
    +
    +
    @@ -183,6 +184,10 @@
    +
    + 183 + +
    +   + GasOffset = 0 +
    +
    + 184 + +
    +   + UpgradeEtrogBatchNumber = 0 +
    +
    + 185 + +
    +   + BatchProofL1BlockConfirmations = 2 +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 186 + +
    +   +
    +
    +
    + 187 + +
    +   + [L2GasPriceSuggester] +
    +
    + 188 + +
    +   + Type = "follower" +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 105 + +
    +   + SyncBlockProtection = "safe" # latest, finalized, safe +
    +
    + 106 + +
    +   + L1SynchronizationMode = "sequential" +
    +
    + 107 + +
    +   + L1SyncCheckL2BlockHash = true +
    +
    + 108 + +
    + + + L1SyncCheckL2BlockNumberhModulus = 600 +
    +
    + 109 + +
    +   + [Synchronizer.L1BlockCheck] +
    +
    + 110 + +
    +   + Enable = true +
    +
    + 111 + +
    +   + L1SafeBlockPoint = "finalized" +
    +
    +
     
    +
    + 129 + +
    +   + ApplyAfterNumRollupReceived = 10 +
    +
    + 130 + +
    +   + [Synchronizer.L2Synchronization] +
    +
    + 131 + +
    +   + AcceptEmptyClosedBatches = false +
    +
    + 132 + +
    + + + ReprocessFullBatchOnClose = false +
    +
    + 133 + +
    +   + CheckLastL2BlockHashOnCloseBatch = true +
    +
    + 134 + +
    +   +
    +
    +
    + 135 + +
    +   + [Sequencer] +
    +
    +
     
    +
    + 169 + +
    +   + L2Coinbase = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266" +
    +
    + 170 + +
    +   + PrivateKey = {Path = "/pk/sequencer.keystore", Password = "testonly"} +
    +
    + 171 + +
    +   + GasOffset = 80000 +
    +
    + 172 + +
    + + + MaxBatchesForL1 = 300 +
    +
    + 173 + +
    +   +
    +
    +
    + 174 + +
    +   + [Aggregator] +
    +
    + 175 + +
    +   + Host = "0.0.0.0" +
    +
    +
     
    +
    + 184 + +
    +   + GasOffset = 0 +
    +
    + 185 + +
    +   + UpgradeEtrogBatchNumber = 0 +
    +
    + 186 + +
    +   + BatchProofL1BlockConfirmations = 2 +
    +
    + 187 + +
    + + + SettlementBackend = "agglayer" +
    +
    + 188 + +
    + + + AggLayerTxTimeout = "5m" +
    +
    + 189 + +
    + + + AggLayerURL = "http://zkevm-agglayer" +
    +
    + 190 + +
    + + + SequencerPrivateKey = {Path = "/pk/sequencer.keystore", Password = "testonly"} +
    +
    + 191 + +
    +   +
    +
    +
    + 192 + +
    +   + [L2GasPriceSuggester] +
    +
    + 193 + +
    +   + Type = "follower" +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/config/mainnetgenesis.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,108 +0,0 @@
    +
    + 1 + +
    + - + package config +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + // MainnetNetworkConfigJSON is the hardcoded network configuration to be used for the official mainnet setup +
    +
    + 4 + +
    + - + const MainnetNetworkConfigJSON = ` +
    +
    + 5 + +
    + - + { +
    +
    + 6 + +
    + - + "l1Config" : { +
    +
    + 7 + +
    + - + "chainId": 1, +
    +
    + 8 + +
    + - + "polygonZkEVMAddress": "0x519E42c24163192Dca44CD3fBDCEBF6be9130987", +
    +
    + 9 + +
    + - + "polygonRollupManagerAddress": "0x5132A183E9F3CB7C848b0AAC5Ae0c4f0491B7aB2", +
    +
    + 10 + +
    + - + "polTokenAddress": "0x455e53CBB86018Ac2B8092FdCd39d8444aFFC3F6", +
    +
    + 11 + +
    + - + "polygonZkEVMGlobalExitRootAddress": "0x580bda1e7A0CFAe92Fa7F6c20A3794F169CE3CFb" +
    +
    + 12 + +
    + - + }, +
    +
    + 13 + +
    + - + "root": "0x3f86b09b43e3e49a41fc20a07579b79eba044253367817d5c241d23c0e2bc5c9", +
    +
    + 14 + +
    + - + "genesisBlockNumber": 16896721, +
    +
    + 15 + +
    + - + "genesis": [ +
    +
    + 16 + +
    + - + { +
    +
    + 17 + +
    + - + "contractName": "PolygonZkEVMDeployer", +
    +
    + 18 + +
    + - + "balance": "0", +
    +
    + 19 + +
    + - + "nonce": "4", +
    +
    + 20 + +
    + - + "address": "0xCB19eDdE626906eB1EE52357a27F62dd519608C2", +
    +
    + 21 + +
    + - + "bytecode": "0x6080604052600436106100705760003560e01c8063715018a61161004e578063715018a6146100e65780638da5cb5b146100fb578063e11ae6cb14610126578063f2fde38b1461013957600080fd5b80632b79805a146100755780634a94d4871461008a5780636d07dbf81461009d575b600080fd5b610088610083366004610927565b610159565b005b6100886100983660046109c7565b6101cb565b3480156100a957600080fd5b506100bd6100b8366004610a1e565b61020d565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b50610088610220565b34801561010757600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100bd565b610088610134366004610a40565b610234565b34801561014557600080fd5b50610088610154366004610a90565b61029b565b610161610357565b600061016e8585856103d8565b905061017a8183610537565b5060405173ffffffffffffffffffffffffffffffffffffffff821681527fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a15050505050565b6101d3610357565b6101de83838361057b565b506040517f25adb19089b6a549831a273acdf7908cff8b7ee5f551f8d1d37996cf01c5df5b90600090a1505050565b600061021983836105a9565b9392505050565b610228610357565b61023260006105b6565b565b61023c610357565b60006102498484846103d8565b60405173ffffffffffffffffffffffffffffffffffffffff821681529091507fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a150505050565b6102a3610357565b73ffffffffffffffffffffffffffffffffffffffff811661034b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610354816105b6565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610232576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610342565b600083471015610444576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e63650000006044820152606401610342565b81516000036104af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f6044820152606401610342565b8282516020840186f5905073ffffffffffffffffffffffffffffffffffffffff8116610219576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f79000000000000006044820152606401610342565b6060610219838360006040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c6564000081525061062b565b60606105a1848484604051806060016040528060298152602001610b3d6029913961062b565b949350505050565b6000610219838330610744565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060824710156106bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610342565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516106e69190610acf565b60006040518083038185875af1925050503d8060008114610723576040519150601f19603f3d011682016040523d82523d6000602084013e610728565b606091505b50915091506107398783838761076e565b979650505050505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b606083156108045782516000036107fd5773ffffffffffffffffffffffffffffffffffffffff85163b6107fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610342565b50816105a1565b6105a183838151156108195781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103429190610aeb565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f83011261088d57600080fd5b813567ffffffffffffffff808211156108a8576108a861084d565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156108ee576108ee61084d565b8160405283815286602085880101111561090757600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000806080858703121561093d57600080fd5b8435935060208501359250604085013567ffffffffffffffff8082111561096357600080fd5b61096f8883890161087c565b9350606087013591508082111561098557600080fd5b506109928782880161087c565b91505092959194509250565b803573ffffffffffffffffffffffffffffffffffffffff811681146109c257600080fd5b919050565b6000806000606084860312156109dc57600080fd5b6109e58461099e565b9250602084013567ffffffffffffffff811115610a0157600080fd5b610a0d8682870161087c565b925050604084013590509250925092565b60008060408385031215610a3157600080fd5b50508035926020909101359150565b600080600060608486031215610a5557600080fd5b8335925060208401359150604084013567ffffffffffffffff811115610a7a57600080fd5b610a868682870161087c565b9150509250925092565b600060208284031215610aa257600080fd5b6102198261099e565b60005b83811015610ac6578181015183820152602001610aae565b50506000910152565b60008251610ae1818460208701610aab565b9190910192915050565b6020815260008251806020840152610b0a816040850160208701610aab565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a26469706673582212203e70ce334e8ec9d8d03e87415afd36dce4e82633bd277b08937095a6bd66367764736f6c63430008110033", +
    +
    + 22 + +
    + - + "storage": { +
    +
    + 23 + +
    + - + "0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000004c1665d6651ecefa59b9b3041951608468b18891" +
    +
    + 24 + +
    + - + } +
    +
    + 25 + +
    + - + }, +
    +
    + 26 + +
    + - + { +
    +
    + 27 + +
    + - + "contractName": "ProxyAdmin", +
    +
    + 28 + +
    + - + "balance": "0", +
    +
    + 29 + +
    + - + "nonce": "1", +
    +
    + 30 + +
    + - + "address": "0x0F99738B2Fc14D77308337f3e2596b63aE7BCC4A", +
    +
    + 31 + +
    + - + "bytecode": "0x60806040526004361061007b5760003560e01c80639623609d1161004e5780639623609d1461012b57806399a88ec41461013e578063f2fde38b1461015e578063f3b7dead1461017e57600080fd5b8063204e1c7a14610080578063715018a6146100c95780637eff275e146100e05780638da5cb5b14610100575b600080fd5b34801561008c57600080fd5b506100a061009b366004610608565b61019e565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100d557600080fd5b506100de610255565b005b3480156100ec57600080fd5b506100de6100fb36600461062c565b610269565b34801561010c57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100a0565b6100de610139366004610694565b6102f7565b34801561014a57600080fd5b506100de61015936600461062c565b61038c565b34801561016a57600080fd5b506100de610179366004610608565b6103e8565b34801561018a57600080fd5b506100a0610199366004610608565b6104a4565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907f5c60da1b00000000000000000000000000000000000000000000000000000000815260040190565b600060405180830381855afa9150503d8060008114610225576040519150601f19603f3d011682016040523d82523d6000602084013e61022a565b606091505b50915091508161023957600080fd5b8080602001905181019061024d9190610788565b949350505050565b61025d6104f0565b6102676000610571565b565b6102716104f0565b6040517f8f28397000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690638f283970906024015b600060405180830381600087803b1580156102db57600080fd5b505af11580156102ef573d6000803e3d6000fd5b505050505050565b6102ff6104f0565b6040517f4f1ef28600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690634f1ef28690349061035590869086906004016107a5565b6000604051808303818588803b15801561036e57600080fd5b505af1158015610382573d6000803e3d6000fd5b5050505050505050565b6103946104f0565b6040517f3659cfe600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690633659cfe6906024016102c1565b6103f06104f0565b73ffffffffffffffffffffffffffffffffffffffff8116610498576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6104a181610571565b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907ff851a44000000000000000000000000000000000000000000000000000000000815260040190565b60005473ffffffffffffffffffffffffffffffffffffffff163314610267576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161048f565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b73ffffffffffffffffffffffffffffffffffffffff811681146104a157600080fd5b60006020828403121561061a57600080fd5b8135610625816105e6565b9392505050565b6000806040838503121561063f57600080fd5b823561064a816105e6565b9150602083013561065a816105e6565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000606084860312156106a957600080fd5b83356106b4816105e6565b925060208401356106c4816105e6565b9150604084013567ffffffffffffffff808211156106e157600080fd5b818601915086601f8301126106f557600080fd5b81358181111561070757610707610665565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561074d5761074d610665565b8160405282815289602084870101111561076657600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b60006020828403121561079a57600080fd5b8151610625816105e6565b73ffffffffffffffffffffffffffffffffffffffff8316815260006020604081840152835180604085015260005b818110156107ef578581018301518582016060015282016107d3565b5060006060828601015260607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010192505050939250505056fea2646970667358221220372a0e10eebea1b7fa43ae4c976994e6ed01d85eedc3637b83f01d3f06be442064736f6c63430008110033", +
    +
    + 32 + +
    + - + "storage": { +
    +
    + 33 + +
    + - + "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000bba0935fa93eb23de7990b47f0d96a8f75766d13" +
    +
    + 34 + +
    + - + } +
    +
    + 35 + +
    + - + }, +
    +
    + 36 + +
    + - + { +
    +
    + 37 + +
    + - + "contractName": "PolygonZkEVMBridge implementation", +
    +
    + 38 + +
    + - + "balance": "0", +
    +
    + 39 + +
    + - + "nonce": "1", +
    +
    + 40 + +
    + - + "address": "0x5ac4182A1dd41AeEf465E40B82fd326BF66AB82C", +
    +
    + 41 + +
    + - + "bytecode": "0x6080604052600436106200019f5760003560e01c8063647c576c11620000e7578063be5831c71162000089578063dbc169761162000060578063dbc169761462000639578063ee25560b1462000651578063fb570834146200068257600080fd5b8063be5831c714620005ae578063cd58657914620005ea578063d02103ca146200060157600080fd5b80639e34070f11620000be5780639e34070f146200050a578063aaa13cc2146200054f578063bab161bf146200057457600080fd5b8063647c576c146200048657806379e2cf9714620004ab57806381b1c17414620004c357600080fd5b80632d2c9d94116200015157806334ac9cf2116200012857806334ac9cf2146200034b5780633ae05047146200037a5780633e197043146200039257600080fd5b80632d2c9d9414620002765780632dfdf0b5146200029b578063318aee3d14620002c257600080fd5b806322e95f2c116200018657806322e95f2c14620001ef578063240ff378146200023a5780632cffd02e146200025157600080fd5b806315064c9614620001a45780632072f6c514620001d5575b600080fd5b348015620001b157600080fd5b50606854620001c09060ff1681565b60405190151581526020015b60405180910390f35b348015620001e257600080fd5b50620001ed620006a7565b005b348015620001fc57600080fd5b50620002146200020e366004620032db565b62000705565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001620001cc565b620001ed6200024b36600462003372565b620007a8565b3480156200025e57600080fd5b50620001ed6200027036600462003409565b620009d0565b3480156200028357600080fd5b50620001ed6200029536600462003409565b62000f74565b348015620002a857600080fd5b50620002b360535481565b604051908152602001620001cc565b348015620002cf57600080fd5b5062000319620002e1366004620034ef565b606b6020526000908152604090205463ffffffff811690640100000000900473ffffffffffffffffffffffffffffffffffffffff1682565b6040805163ffffffff909316835273ffffffffffffffffffffffffffffffffffffffff909116602083015201620001cc565b3480156200035857600080fd5b50606c54620002149073ffffffffffffffffffffffffffffffffffffffff1681565b3480156200038757600080fd5b50620002b362001178565b3480156200039f57600080fd5b50620002b3620003b136600462003526565b6040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b3480156200049357600080fd5b50620001ed620004a5366004620035b0565b6200125e565b348015620004b857600080fd5b50620001ed620014ad565b348015620004d057600080fd5b5062000214620004e236600462003600565b606a6020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b3480156200051757600080fd5b50620001c06200052936600462003600565b600881901c600090815260696020526040902054600160ff9092169190911b9081161490565b3480156200055c57600080fd5b50620002146200056e3660046200361a565b620014e7565b3480156200058157600080fd5b506068546200059890610100900463ffffffff1681565b60405163ffffffff9091168152602001620001cc565b348015620005bb57600080fd5b506068546200059890790100000000000000000000000000000000000000000000000000900463ffffffff1681565b620001ed620005fb366004620036ce565b620016d3565b3480156200060e57600080fd5b50606854620002149065010000000000900473ffffffffffffffffffffffffffffffffffffffff1681565b3480156200064657600080fd5b50620001ed62001c37565b3480156200065e57600080fd5b50620002b36200067036600462003600565b60696020526000908152604090205481565b3480156200068f57600080fd5b50620001c0620006a136600462003770565b62001c93565b606c5473ffffffffffffffffffffffffffffffffffffffff163314620006f9576040517fe2e8106b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200070362001d7c565b565b6040805160e084901b7fffffffff0000000000000000000000000000000000000000000000000000000016602080830191909152606084901b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602483015282516018818403018152603890920183528151918101919091206000908152606a909152205473ffffffffffffffffffffffffffffffffffffffff165b92915050565b60685460ff1615620007e6576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60685463ffffffff8681166101009092041614806200080c5750600263ffffffff861610155b1562000844576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b6001606860019054906101000a900463ffffffff163388883488886053546040516200089a9998979695949392919062003806565b60405180910390a1620009b8620009b26001606860019054906101000a900463ffffffff16338989348989604051620008d592919062003881565b60405180910390206040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b62001e10565b8215620009c957620009c962001f27565b5050505050565b60685460ff161562000a0e576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000a258b8b8b8b8b8b8b8b8b8b8b600062001ffc565b73ffffffffffffffffffffffffffffffffffffffff861662000b01576040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff861690859060405162000a7a9190620038e6565b60006040518083038185875af1925050503d806000811462000ab9576040519150601f19603f3d011682016040523d82523d6000602084013e62000abe565b606091505b505090508062000afa576040517f6747a28800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5062000efc565b60685463ffffffff61010090910481169088160362000b435762000b3d73ffffffffffffffffffffffffffffffffffffffff87168585620021ed565b62000efc565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b1660208201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b166024820152600090603801604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291815281516020928301206000818152606a90935291205490915073ffffffffffffffffffffffffffffffffffffffff168062000e6e576000808062000c1886880188620039fb565b92509250925060008584848460405162000c329062003292565b62000c409392919062003abd565b8190604051809103906000f590508015801562000c61573d6000803e3d6000fd5b506040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8c81166004830152602482018c9052919250908216906340c10f1990604401600060405180830381600087803b15801562000cd757600080fd5b505af115801562000cec573d6000803e3d6000fd5b5050505080606a600088815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060405180604001604052808e63ffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff16815250606b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509050507f490e59a1701b938786ac72570a1efeac994a3dbe96e2e883e19e902ace6e6a398d8d838b8b60405162000e5c95949392919062003afa565b60405180910390a15050505062000ef9565b6040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152602482018790528216906340c10f1990604401600060405180830381600087803b15801562000edf57600080fd5b505af115801562000ef4573d6000803e3d6000fd5b505050505b50505b6040805163ffffffff8c811682528916602082015273ffffffffffffffffffffffffffffffffffffffff88811682840152861660608201526080810185905290517f25308c93ceeed162da955b3f7ce3e3f93606579e40fb92029faa9efe275459839181900360a00190a15050505050505050505050565b60685460ff161562000fb2576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000fc98b8b8b8b8b8b8b8b8b8b8b600162001ffc565b60008473ffffffffffffffffffffffffffffffffffffffff1684888a868660405160240162000ffc949392919062003b42565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f1806b5f200000000000000000000000000000000000000000000000000000000179052516200107f9190620038e6565b60006040518083038185875af1925050503d8060008114620010be576040519150601f19603f3d011682016040523d82523d6000602084013e620010c3565b606091505b5050905080620010ff576040517f37e391c300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805163ffffffff8d811682528a16602082015273ffffffffffffffffffffffffffffffffffffffff89811682840152871660608201526080810186905290517f25308c93ceeed162da955b3f7ce3e3f93606579e40fb92029faa9efe275459839181900360a00190a1505050505050505050505050565b605354600090819081805b602081101562001255578083901c600116600103620011e65760338160208110620011b257620011b262003b8a565b0154604080516020810192909252810185905260600160405160208183030381529060405280519060200120935062001213565b60408051602081018690529081018390526060016040516020818303038152906040528051906020012093505b604080516020810184905290810183905260600160405160208183030381529060405280519060200120915080806200124c9062003be8565b91505062001183565b50919392505050565b600054610100900460ff16158080156200127f5750600054600160ff909116105b806200129b5750303b1580156200129b575060005460ff166001145b6200132d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156200138c57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b606880547fffffffffffffff000000000000000000000000000000000000000000000000ff1661010063ffffffff8716027fffffffffffffff0000000000000000000000000000000000000000ffffffffff16176501000000000073ffffffffffffffffffffffffffffffffffffffff8681169190910291909117909155606c80547fffffffffffffffffffffffff00000000000000000000000000000000000000001691841691909117905562001443620022c3565b8015620014a757600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b605354606854790100000000000000000000000000000000000000000000000000900463ffffffff16101562000703576200070362001f27565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b1660208201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b1660248201526000908190603801604051602081830303815290604052805190602001209050600060ff60f81b3083604051806020016200157d9062003292565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082820381018352601f909101166040819052620015c8908d908d908d908d908d9060200162003c23565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905262001606929160200162003c64565b604051602081830303815290604052805190602001206040516020016200168f94939291907fff0000000000000000000000000000000000000000000000000000000000000094909416845260609290921b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660018401526015830152603582015260550190565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001815291905280516020909101209a9950505050505050505050565b60685460ff161562001711576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200171b62002366565b60685463ffffffff888116610100909204161480620017415750600263ffffffff881610155b1562001779576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008060608773ffffffffffffffffffffffffffffffffffffffff8816620017df57883414620017d5576040517fb89240f500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000925062001ad9565b341562001818576040517f798ee6f100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8089166000908152606b602090815260409182902082518084019093525463ffffffff811683526401000000009004909216918101829052901562001908576040517f9dc29fac000000000000000000000000000000000000000000000000000000008152336004820152602481018b905273ffffffffffffffffffffffffffffffffffffffff8a1690639dc29fac90604401600060405180830381600087803b158015620018db57600080fd5b505af1158015620018f0573d6000803e3d6000fd5b50505050806020015194508060000151935062001ad7565b85156200191d576200191d898b8989620023db565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8b16906370a0823190602401602060405180830381865afa1580156200198b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620019b1919062003c97565b9050620019d773ffffffffffffffffffffffffffffffffffffffff8b1633308e620028f9565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa15801562001a45573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001a6b919062003c97565b905062001a79828262003cb1565b6068548c9850610100900463ffffffff169650935062001a998762002959565b62001aa48c62002a71565b62001aaf8d62002b7e565b60405160200162001ac39392919062003abd565b604051602081830303815290604052945050505b505b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b600084868e8e868860535460405162001b1b98979695949392919062003cc7565b60405180910390a162001c0f620009b2600085878f8f8789805190602001206040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b861562001c205762001c2062001f27565b5050505062001c2e60018055565b50505050505050565b606c5473ffffffffffffffffffffffffffffffffffffffff16331462001c89576040517fe2e8106b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200070362002c80565b600084815b602081101562001d6e57600163ffffffff8616821c8116900362001d0a5785816020811062001ccb5762001ccb62003b8a565b60200201358260405160200162001cec929190918252602082015260400190565b60405160208183030381529060405280519060200120915062001d59565b8186826020811062001d205762001d2062003b8a565b602002013560405160200162001d40929190918252602082015260400190565b6040516020818303038152906040528051906020012091505b8062001d658162003be8565b91505062001c98565b50821490505b949350505050565b60685460ff161562001dba576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556040517f2261efe5aef6fedc1fd1550b25facc9181745623049c7901287030b9ad1a549790600090a1565b80600162001e216020600262003e79565b62001e2d919062003cb1565b6053541062001e68576040517fef5ccf6600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060536000815462001e7b9062003be8565b9182905550905060005b602081101562001f17578082901c60011660010362001ebd57826033826020811062001eb55762001eb562003b8a565b015550505050565b6033816020811062001ed35762001ed362003b8a565b01546040805160208101929092528101849052606001604051602081830303815290604052805190602001209250808062001f0e9062003be8565b91505062001e85565b5062001f2262003e87565b505050565b6053546068805463ffffffff909216790100000000000000000000000000000000000000000000000000027fffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffffff909216919091179081905573ffffffffffffffffffffffffffffffffffffffff65010000000000909104166333d6247d62001fad62001178565b6040518263ffffffff1660e01b815260040162001fcc91815260200190565b600060405180830381600087803b15801562001fe757600080fd5b505af1158015620014a7573d6000803e3d6000fd5b6200200d8b63ffffffff1662002d10565b6068546040805160208082018e90528183018d9052825180830384018152606083019384905280519101207f257b363200000000000000000000000000000000000000000000000000000000909252606481019190915260009165010000000000900473ffffffffffffffffffffffffffffffffffffffff169063257b3632906084016020604051808303816000875af1158015620020b0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620020d6919062003c97565b90508060000362002112576040517e2f6fad00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60685463ffffffff88811661010090920416146200215c576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606854600090610100900463ffffffff166200217a5750896200217d565b508a5b620021a66200219d848c8c8c8c8c8c8c604051620008d592919062003881565b8f8f8462001c93565b620021dd576040517fe0417cec00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505050505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905262001f229084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915262002d75565b600054610100900460ff166200235c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162001324565b6200070362002e88565b600260015403620023d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640162001324565b6002600155565b6000620023ec600482848662003eb6565b620023f79162003ee2565b90507f2afa5331000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000821601620026765760008080808080806200245a896004818d62003eb6565b81019062002469919062003f2b565b96509650965096509650965096503373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614620024dd576040517f912ecce700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff861630146200252d576040517f750643af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8a851462002567576040517f03fffc4b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff89811660248301528881166044830152606482018890526084820187905260ff861660a483015260c4820185905260e48083018590528351808403909101815261010490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fd505accf000000000000000000000000000000000000000000000000000000001790529151918e1691620026229190620038e6565b6000604051808303816000865af19150503d806000811462002661576040519150601f19603f3d011682016040523d82523d6000602084013e62002666565b606091505b50505050505050505050620009c9565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f8fcbaf0c0000000000000000000000000000000000000000000000000000000014620026f2576040517fe282c0ba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808080808080806200270a8a6004818e62003eb6565b81019062002719919062003f86565b975097509750975097509750975097503373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff16146200278f576040517f912ecce700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff87163014620027df576040517f750643af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff8a811660248301528981166044830152606482018990526084820188905286151560a483015260ff861660c483015260e482018590526101048083018590528351808403909101815261012490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f8fcbaf0c000000000000000000000000000000000000000000000000000000001790529151918f1691620028a39190620038e6565b6000604051808303816000865af19150503d8060008114620028e2576040519150601f19603f3d011682016040523d82523d6000602084013e620028e7565b606091505b50505050505050505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052620014a79085907f23b872dd000000000000000000000000000000000000000000000000000000009060840162002240565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f06fdde03000000000000000000000000000000000000000000000000000000001790529051606091600091829173ffffffffffffffffffffffffffffffffffffffff861691620029dd9190620038e6565b600060405180830381855afa9150503d806000811462002a1a576040519150601f19603f3d011682016040523d82523d6000602084013e62002a1f565b606091505b50915091508162002a66576040518060400160405280600781526020017f4e4f5f4e414d450000000000000000000000000000000000000000000000000081525062001d74565b62001d748162002f21565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f95d89b41000000000000000000000000000000000000000000000000000000001790529051606091600091829173ffffffffffffffffffffffffffffffffffffffff86169162002af59190620038e6565b600060405180830381855afa9150503d806000811462002b32576040519150601f19603f3d011682016040523d82523d6000602084013e62002b37565b606091505b50915091508162002a66576040518060400160405280600981526020017f4e4f5f53594d424f4c000000000000000000000000000000000000000000000081525062001d74565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f313ce5670000000000000000000000000000000000000000000000000000000017905290516000918291829173ffffffffffffffffffffffffffffffffffffffff86169162002c019190620038e6565b600060405180830381855afa9150503d806000811462002c3e576040519150601f19603f3d011682016040523d82523d6000602084013e62002c43565b606091505b509150915081801562002c57575080516020145b62002c6457601262001d74565b8080602001905181019062001d74919062004012565b60018055565b60685460ff1662002cbd576040517f5386698100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040517f1e5e34eea33501aecf2ebec9fe0e884a40804275ea7fe10b2ba084c8374308b390600090a1565b600881901c60008181526069602052604081208054600160ff861690811b91821892839055929091908183169003620009c9576040517f646cf55800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600062002dd9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16620031119092919063ffffffff16565b80519091501562001f22578080602001905181019062002dfa919062004032565b62001f22576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840162001324565b600054610100900460ff1662002c7a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162001324565b6060604082511062002f435781806020019051810190620007a2919062004052565b8151602003620030d35760005b60208110801562002f9b575082818151811062002f715762002f7162003b8a565b01602001517fff000000000000000000000000000000000000000000000000000000000000001615155b1562002fb6578062002fad8162003be8565b91505062002f50565b8060000362002ffa57505060408051808201909152601281527f4e4f545f56414c49445f454e434f44494e4700000000000000000000000000006020820152919050565b60008167ffffffffffffffff81111562003018576200301862003891565b6040519080825280601f01601f19166020018201604052801562003043576020820181803683370190505b50905060005b82811015620030cb5784818151811062003067576200306762003b8a565b602001015160f81c60f81b82828151811062003087576200308762003b8a565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080620030c28162003be8565b91505062003049565b509392505050565b505060408051808201909152601281527f4e4f545f56414c49445f454e434f44494e470000000000000000000000000000602082015290565b919050565b606062001d748484600085856000808673ffffffffffffffffffffffffffffffffffffffff168587604051620031489190620038e6565b60006040518083038185875af1925050503d806000811462003187576040519150601f19603f3d011682016040523d82523d6000602084013e6200318c565b606091505b50915091506200319f87838387620031aa565b979650505050505050565b60608315620032455782516000036200323d5773ffffffffffffffffffffffffffffffffffffffff85163b6200323d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162001324565b508162001d74565b62001d7483838151156200325c5781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620013249190620040d2565b611b6680620040e883390190565b803563ffffffff811681146200310c57600080fd5b73ffffffffffffffffffffffffffffffffffffffff81168114620032d857600080fd5b50565b60008060408385031215620032ef57600080fd5b620032fa83620032a0565b915060208301356200330c81620032b5565b809150509250929050565b8015158114620032d857600080fd5b60008083601f8401126200333957600080fd5b50813567ffffffffffffffff8111156200335257600080fd5b6020830191508360208285010111156200336b57600080fd5b9250929050565b6000806000806000608086880312156200338b57600080fd5b6200339686620032a0565b94506020860135620033a881620032b5565b93506040860135620033ba8162003317565b9250606086013567ffffffffffffffff811115620033d757600080fd5b620033e58882890162003326565b969995985093965092949392505050565b806104008101831015620007a257600080fd5b60008060008060008060008060008060006105208c8e0312156200342c57600080fd5b620034388d8d620033f6565b9a50620034496104008d01620032a0565b99506104208c013598506104408c013597506200346a6104608d01620032a0565b96506104808c01356200347d81620032b5565b95506200348e6104a08d01620032a0565b94506104c08c0135620034a181620032b5565b93506104e08c013592506105008c013567ffffffffffffffff811115620034c757600080fd5b620034d58e828f0162003326565b915080935050809150509295989b509295989b9093969950565b6000602082840312156200350257600080fd5b81356200350f81620032b5565b9392505050565b60ff81168114620032d857600080fd5b600080600080600080600060e0888a0312156200354257600080fd5b87356200354f8162003516565b96506200355f60208901620032a0565b955060408801356200357181620032b5565b94506200358160608901620032a0565b935060808801356200359381620032b5565b9699959850939692959460a0840135945060c09093013592915050565b600080600060608486031215620035c657600080fd5b620035d184620032a0565b92506020840135620035e381620032b5565b91506040840135620035f581620032b5565b809150509250925092565b6000602082840312156200361357600080fd5b5035919050565b600080600080600080600060a0888a0312156200363657600080fd5b6200364188620032a0565b965060208801356200365381620032b5565b9550604088013567ffffffffffffffff808211156200367157600080fd5b6200367f8b838c0162003326565b909750955060608a01359150808211156200369957600080fd5b50620036a88a828b0162003326565b9094509250506080880135620036be8162003516565b8091505092959891949750929550565b600080600080600080600060c0888a031215620036ea57600080fd5b620036f588620032a0565b965060208801356200370781620032b5565b95506040880135945060608801356200372081620032b5565b93506080880135620037328162003317565b925060a088013567ffffffffffffffff8111156200374f57600080fd5b6200375d8a828b0162003326565b989b979a50959850939692959293505050565b60008060008061046085870312156200378857600080fd5b843593506200379b8660208701620033f6565b9250620037ac6104208601620032a0565b939692955092936104400135925050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b600061010060ff8c16835263ffffffff808c16602085015273ffffffffffffffffffffffffffffffffffffffff808c166040860152818b166060860152808a166080860152508760a08501528160c0850152620038678285018789620037bd565b925080851660e085015250509a9950505050505050505050565b8183823760009101908152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60005b83811015620038dd578181015183820152602001620038c3565b50506000910152565b60008251620038fa818460208701620038c0565b9190910192915050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156200394e576200394e62003891565b604052919050565b600067ffffffffffffffff82111562003973576200397362003891565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112620039b157600080fd5b8135620039c8620039c28262003956565b62003904565b818152846020838601011115620039de57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121562003a1157600080fd5b833567ffffffffffffffff8082111562003a2a57600080fd5b62003a38878388016200399f565b9450602086013591508082111562003a4f57600080fd5b5062003a5e868287016200399f565b9250506040840135620035f58162003516565b6000815180845262003a8b816020860160208601620038c0565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60608152600062003ad2606083018662003a71565b828103602084015262003ae6818662003a71565b91505060ff83166040830152949350505050565b63ffffffff86168152600073ffffffffffffffffffffffffffffffffffffffff8087166020840152808616604084015250608060608301526200319f608083018486620037bd565b73ffffffffffffffffffffffffffffffffffffffff8516815263ffffffff8416602082015260606040820152600062003b80606083018486620037bd565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820362003c1c5762003c1c62003bb9565b5060010190565b60608152600062003c39606083018789620037bd565b828103602084015262003c4e818688620037bd565b91505060ff831660408301529695505050505050565b6000835162003c78818460208801620038c0565b83519083019062003c8e818360208801620038c0565b01949350505050565b60006020828403121562003caa57600080fd5b5051919050565b81810381811115620007a257620007a262003bb9565b600061010060ff8b16835263ffffffff808b16602085015273ffffffffffffffffffffffffffffffffffffffff808b166040860152818a1660608601528089166080860152508660a08501528160c085015262003d278285018762003a71565b925080851660e085015250509998505050505050505050565b600181815b8085111562003d9f57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111562003d835762003d8362003bb9565b8085161562003d9157918102915b93841c939080029062003d45565b509250929050565b60008262003db857506001620007a2565b8162003dc757506000620007a2565b816001811462003de0576002811462003deb5762003e0b565b6001915050620007a2565b60ff84111562003dff5762003dff62003bb9565b50506001821b620007a2565b5060208310610133831016604e8410600b841016171562003e30575081810a620007a2565b62003e3c838362003d40565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111562003e715762003e7162003bb9565b029392505050565b60006200350f838362003da7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b6000808585111562003ec757600080fd5b8386111562003ed557600080fd5b5050820193919092039150565b7fffffffff00000000000000000000000000000000000000000000000000000000813581811691600485101562003f235780818660040360031b1b83161692505b505092915050565b600080600080600080600060e0888a03121562003f4757600080fd5b873562003f5481620032b5565b9650602088013562003f6681620032b5565b955060408801359450606088013593506080880135620035938162003516565b600080600080600080600080610100898b03121562003fa457600080fd5b883562003fb181620032b5565b9750602089013562003fc381620032b5565b96506040890135955060608901359450608089013562003fe38162003317565b935060a089013562003ff58162003516565b979a969950949793969295929450505060c08201359160e0013590565b6000602082840312156200402557600080fd5b81516200350f8162003516565b6000602082840312156200404557600080fd5b81516200350f8162003317565b6000602082840312156200406557600080fd5b815167ffffffffffffffff8111156200407d57600080fd5b8201601f810184136200408f57600080fd5b8051620040a0620039c28262003956565b818152856020838501011115620040b657600080fd5b620040c9826020830160208601620038c0565b95945050505050565b6020815260006200350f602083018462003a7156fe6101006040523480156200001257600080fd5b5060405162001b6638038062001b6683398101604081905262000035916200028d565b82826003620000458382620003a1565b506004620000548282620003a1565b50503360c0525060ff811660e052466080819052620000739062000080565b60a052506200046d915050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f620000ad6200012e565b805160209182012060408051808201825260018152603160f81b90840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b6060600380546200013f9062000312565b80601f01602080910402602001604051908101604052809291908181526020018280546200016d9062000312565b8015620001be5780601f106200019257610100808354040283529160200191620001be565b820191906000526020600020905b815481529060010190602001808311620001a057829003601f168201915b5050505050905090565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620001f057600080fd5b81516001600160401b03808211156200020d576200020d620001c8565b604051601f8301601f19908116603f01168101908282118183101715620002385762000238620001c8565b816040528381526020925086838588010111156200025557600080fd5b600091505b838210156200027957858201830151818301840152908201906200025a565b600093810190920192909252949350505050565b600080600060608486031215620002a357600080fd5b83516001600160401b0380821115620002bb57600080fd5b620002c987838801620001de565b94506020860151915080821115620002e057600080fd5b50620002ef86828701620001de565b925050604084015160ff811681146200030757600080fd5b809150509250925092565b600181811c908216806200032757607f821691505b6020821081036200034857634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200039c57600081815260208120601f850160051c81016020861015620003775750805b601f850160051c820191505b81811015620003985782815560010162000383565b5050505b505050565b81516001600160401b03811115620003bd57620003bd620001c8565b620003d581620003ce845462000312565b846200034e565b602080601f8311600181146200040d5760008415620003f45750858301515b600019600386901b1c1916600185901b17855562000398565b600085815260208120601f198616915b828110156200043e578886015182559484019460019091019084016200041d565b50858210156200045d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e0516116aa620004bc6000396000610237015260008181610307015281816105c001526106a70152600061053a015260008181610379015261050401526116aa6000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806370a08231116100d8578063a457c2d71161008c578063d505accf11610066578063d505accf1461039b578063dd62ed3e146103ae578063ffa1ad74146103f457600080fd5b8063a457c2d71461034e578063a9059cbb14610361578063cd0d00961461037457600080fd5b806395d89b41116100bd57806395d89b41146102e75780639dc29fac146102ef578063a3c573eb1461030257600080fd5b806370a08231146102915780637ecebe00146102c757600080fd5b806330adf81f1161012f5780633644e515116101145780633644e51514610261578063395093511461026957806340c10f191461027c57600080fd5b806330adf81f14610209578063313ce5671461023057600080fd5b806318160ddd1161016057806318160ddd146101bd57806320606b70146101cf57806323b872dd146101f657600080fd5b806306fdde031461017c578063095ea7b31461019a575b600080fd5b610184610430565b60405161019191906113e4565b60405180910390f35b6101ad6101a8366004611479565b6104c2565b6040519015158152602001610191565b6002545b604051908152602001610191565b6101c17f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81565b6101ad6102043660046114a3565b6104dc565b6101c17f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152602001610191565b6101c1610500565b6101ad610277366004611479565b61055c565b61028f61028a366004611479565b6105a8565b005b6101c161029f3660046114df565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6101c16102d53660046114df565b60056020526000908152604090205481565b610184610680565b61028f6102fd366004611479565b61068f565b6103297f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610191565b6101ad61035c366004611479565b61075e565b6101ad61036f366004611479565b61082f565b6101c17f000000000000000000000000000000000000000000000000000000000000000081565b61028f6103a9366004611501565b61083d565b6101c16103bc366004611574565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6101846040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525081565b60606003805461043f906115a7565b80601f016020809104026020016040519081016040528092919081815260200182805461046b906115a7565b80156104b85780601f1061048d576101008083540402835291602001916104b8565b820191906000526020600020905b81548152906001019060200180831161049b57829003601f168201915b5050505050905090565b6000336104d0818585610b73565b60019150505b92915050565b6000336104ea858285610d27565b6104f5858585610dfe565b506001949350505050565b60007f00000000000000000000000000000000000000000000000000000000000000004614610537576105324661106d565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091906104d090829086906105a3908790611629565b610b73565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610672576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d4272696467650000000000000000000000000000000060648201526084015b60405180910390fd5b61067c8282611135565b5050565b60606004805461043f906115a7565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610754576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d427269646765000000000000000000000000000000006064820152608401610669565b61067c8282611228565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015610822576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610669565b6104f58286868403610b73565b6000336104d0818585610dfe565b834211156108cc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f546f6b656e577261707065643a3a7065726d69743a204578706972656420706560448201527f726d6974000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8716600090815260056020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918a918a918a9190866109268361163c565b9091555060408051602081019690965273ffffffffffffffffffffffffffffffffffffffff94851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000610991610500565b6040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281019190915260428101839052606201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa158015610a55573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590610ad057508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b610b5c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f546f6b656e577261707065643a3a7065726d69743a20496e76616c696420736960448201527f676e6174757265000000000000000000000000000000000000000000000000006064820152608401610669565b610b678a8a8a610b73565b50505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff8316610c15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610cb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610df85781811015610deb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610669565b610df88484848403610b73565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610ea1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610f44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610ffa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610df8565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f611098610430565b8051602091820120604080518082018252600181527f310000000000000000000000000000000000000000000000000000000000000090840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b73ffffffffffffffffffffffffffffffffffffffff82166111b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610669565b80600260008282546111c49190611629565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff82166112cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205481811015611381576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610d1a565b600060208083528351808285015260005b81811015611411578581018301518582016040015282016113f5565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461147457600080fd5b919050565b6000806040838503121561148c57600080fd5b61149583611450565b946020939093013593505050565b6000806000606084860312156114b857600080fd5b6114c184611450565b92506114cf60208501611450565b9150604084013590509250925092565b6000602082840312156114f157600080fd5b6114fa82611450565b9392505050565b600080600080600080600060e0888a03121561151c57600080fd5b61152588611450565b965061153360208901611450565b95506040880135945060608801359350608088013560ff8116811461155757600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561158757600080fd5b61159083611450565b915061159e60208401611450565b90509250929050565b600181811c908216806115bb57607f821691505b6020821081036115f4577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156104d6576104d66115fa565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361166d5761166d6115fa565b506001019056fea26469706673582212208d88fee561cff7120d381c345cfc534cef8229a272dc5809d4bbb685ad67141164736f6c63430008110033a2646970667358221220d9b3ca7b13ec80ac58634ddf0ecebe71e209a71f532614949b9e720413f50c8364736f6c63430008110033" +
    +
    + 42 + +
    + - + }, +
    +
    + 43 + +
    + - + { +
    +
    + 44 + +
    + - + "contractName": "PolygonZkEVMBridge proxy", +
    +
    + 45 + +
    + - + "balance": "200000000000000000000000000", +
    +
    + 46 + +
    + - + "nonce": "1", +
    +
    + 47 + +
    + - + "address": "0x2a3DD3EB832aF982ec71669E178424b10Dca2EDe", +
    +
    + 48 + +
    + - + "bytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461088b565b610135565b61006b6100a33660046108a6565b61017f565b3480156100b457600080fd5b506100bd6101f3565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461088b565b610231565b34801561011257600080fd5b506100bd61025e565b6101236102d4565b61013361012e6103ab565b6103b5565b565b61013d6103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481604051806020016040528060008152506000610419565b50565b61017461011b565b6101876103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101eb576101e68383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610419915050565b505050565b6101e661011b565b60006101fd6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103ab565b905090565b61022e61011b565b90565b6102396103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481610444565b60006102686103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103d9565b60606102b183836040518060600160405280602781526020016109bb602791396104a5565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b6102dc6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b600061022161052a565b3660008037600080366000845af43d6000803e8080156103d4573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b61042283610552565b60008251118061042f5750805b156101e65761043e838361028c565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61046d6103d9565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a16101748161059f565b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516104cf919061094d565b600060405180830381855af49150503d806000811461050a576040519150601f19603f3d011682016040523d82523d6000602084013e61050f565b606091505b5091509150610520868383876106ab565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6103fd565b61055b81610753565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff8116610642576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103a2565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b6060831561074157825160000361073a5773ffffffffffffffffffffffffffffffffffffffff85163b61073a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103a2565b508161074b565b61074b838361081e565b949350505050565b73ffffffffffffffffffffffffffffffffffffffff81163b6107f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e74726163740000000000000000000000000000000000000060648201526084016103a2565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610665565b81511561082e5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a29190610969565b803573ffffffffffffffffffffffffffffffffffffffff8116811461088657600080fd5b919050565b60006020828403121561089d57600080fd5b6102b182610862565b6000806000604084860312156108bb57600080fd5b6108c484610862565b9250602084013567ffffffffffffffff808211156108e157600080fd5b818601915086601f8301126108f557600080fd5b81358181111561090457600080fd5b87602082850101111561091657600080fd5b6020830194508093505050509250925092565b60005b8381101561094457818101518382015260200161092c565b50506000910152565b6000825161095f818460208701610929565b9190910192915050565b6020815260008251806020840152610988816040850160208701610929565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220a1af0d6cb4f1e31496a4c5c1448913bce4bd6ad3a39e47c6f7190c114d6f9bf464736f6c63430008110033", +
    +
    + 49 + +
    + - + "storage": { +
    +
    + 50 + +
    + - + "0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000000000000000000000000000000000000000000001", +
    +
    + 51 + +
    + - + "0x0000000000000000000000000000000000000000000000000000000000000001": "0x0000000000000000000000000000000000000000000000000000000000000001", +
    +
    + 52 + +
    + - + "0x0000000000000000000000000000000000000000000000000000000000000068": "0x00000000000000a40d5f56745a118d0906a34e69aec8c0db1cb8fa0000000100", +
    +
    + 53 + +
    + - + "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x0000000000000000000000000f99738b2fc14d77308337f3e2596b63ae7bcc4a", +
    +
    + 54 + +
    + - + "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x0000000000000000000000005ac4182a1dd41aeef465e40b82fd326bf66ab82c" +
    +
    + 55 + +
    + - + } +
    +
    + 56 + +
    + - + }, +
    +
    + 57 + +
    + - + { +
    +
    + 58 + +
    + - + "contractName": "PolygonZkEVMGlobalExitRootL2 implementation", +
    +
    + 59 + +
    + - + "balance": "0", +
    +
    + 60 + +
    + - + "nonce": "1", +
    +
    + 61 + +
    + - + "address": "0x0200143Fa295EE4dffEF22eE2616c2E008D81688", +
    +
    + 62 + +
    + - + "bytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806301fd904414610051578063257b36321461006d57806333d6247d1461008d578063a3c573eb146100a2575b600080fd5b61005a60015481565b6040519081526020015b60405180910390f35b61005a61007b366004610162565b60006020819052908152604090205481565b6100a061009b366004610162565b6100ee565b005b6100c97f0000000000000000000000002a3dd3eb832af982ec71669e178424b10dca2ede81565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610064565b3373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000002a3dd3eb832af982ec71669e178424b10dca2ede161461015d576040517fb49365dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600155565b60006020828403121561017457600080fd5b503591905056fea2646970667358221220a187fc278346c1b61c449ea3641002b6eac2bda3351a122a12c35099f933696864736f6c63430008110033" +
    +
    + 63 + +
    + - + }, +
    +
    + 64 + +
    + - + { +
    +
    + 65 + +
    + - + "contractName": "PolygonZkEVMGlobalExitRootL2 proxy", +
    +
    + 66 + +
    + - + "balance": "0", +
    +
    + 67 + +
    + - + "nonce": "1", +
    +
    + 68 + +
    + - + "address": "0xa40d5f56745a118d0906a34e69aec8c0db1cb8fa", +
    +
    + 69 + +
    + - + "bytecode": "0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100855780635c60da1b146100985780638f283970146100c9578063f851a440146100e95761005d565b3661005d5761005b6100fe565b005b61005b6100fe565b34801561007157600080fd5b5061005b6100803660046106ca565b610118565b61005b6100933660046106e5565b61015f565b3480156100a457600080fd5b506100ad6101d0565b6040516001600160a01b03909116815260200160405180910390f35b3480156100d557600080fd5b5061005b6100e43660046106ca565b61020b565b3480156100f557600080fd5b506100ad610235565b610106610292565b610116610111610331565b61033b565b565b61012061035f565b6001600160a01b0316336001600160a01b031614156101575761015481604051806020016040528060008152506000610392565b50565b6101546100fe565b61016761035f565b6001600160a01b0316336001600160a01b031614156101c8576101c38383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610392915050565b505050565b6101c36100fe565b60006101da61035f565b6001600160a01b0316336001600160a01b03161415610200576101fb610331565b905090565b6102086100fe565b90565b61021361035f565b6001600160a01b0316336001600160a01b0316141561015757610154816103f1565b600061023f61035f565b6001600160a01b0316336001600160a01b03161415610200576101fb61035f565b606061028583836040518060600160405280602781526020016107e460279139610445565b9392505050565b3b151590565b61029a61035f565b6001600160a01b0316336001600160a01b031614156101165760405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b60006101fb610519565b3660008037600080366000845af43d6000803e80801561035a573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b61039b83610541565b6040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a26000825111806103dc5750805b156101c3576103eb8383610260565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61041a61035f565b604080516001600160a01b03928316815291841660208301520160405180910390a1610154816105e9565b6060833b6104a45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610328565b600080856001600160a01b0316856040516104bf9190610794565b600060405180830381855af49150503d80600081146104fa576040519150601f19603f3d011682016040523d82523d6000602084013e6104ff565b606091505b509150915061050f828286610675565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610383565b803b6105a55760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610328565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5b80546001600160a01b0319166001600160a01b039290921691909117905550565b6001600160a01b03811661064e5760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401610328565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61036105c8565b60608315610684575081610285565b8251156106945782518084602001fd5b8160405162461bcd60e51b815260040161032891906107b0565b80356001600160a01b03811681146106c557600080fd5b919050565b6000602082840312156106dc57600080fd5b610285826106ae565b6000806000604084860312156106fa57600080fd5b610703846106ae565b9250602084013567ffffffffffffffff8082111561072057600080fd5b818601915086601f83011261073457600080fd5b81358181111561074357600080fd5b87602082850101111561075557600080fd5b6020830194508093505050509250925092565b60005b8381101561078357818101518382015260200161076b565b838111156103eb5750506000910152565b600082516107a6818460208701610768565b9190910192915050565b60208152600082518060208401526107cf816040850160208701610768565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212204675187caf3a43285d9a2c1844a981e977bd52a85ff073e7fc649f73847d70a464736f6c63430008090033", +
    +
    + 70 + +
    + - + "storage": { +
    +
    + 71 + +
    + - + "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x0000000000000000000000000f99738b2fc14d77308337f3e2596b63ae7bcc4a", +
    +
    + 72 + +
    + - + "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x0000000000000000000000000200143fa295ee4dffef22ee2616c2e008d81688" +
    +
    + 73 + +
    + - + } +
    +
    + 74 + +
    + - + }, +
    +
    + 75 + +
    + - + { +
    +
    + 76 + +
    + - + "contractName": "PolygonZkEVMTimelock", +
    +
    + 77 + +
    + - + "balance": "0", +
    +
    + 78 + +
    + - + "nonce": "1", +
    +
    + 79 + +
    + - + "address": "0xBBa0935Fa93Eb23de7990b47F0D96a8f75766d13", +
    +
    + 80 + +
    + - + "bytecode": "0x6080604052600436106101c65760003560e01c806364d62353116100f7578063b1c5f42711610095578063d547741f11610064578063d547741f14610661578063e38335e514610681578063f23a6e6114610694578063f27a0c92146106d957600080fd5b8063b1c5f427146105af578063bc197c81146105cf578063c4d252f514610614578063d45c44351461063457600080fd5b80638f61f4f5116100d15780638f61f4f5146104e157806391d1485414610515578063a217fddf14610566578063b08e51c01461057b57600080fd5b806364d62353146104815780638065657f146104a15780638f2a0bb0146104c157600080fd5b8063248a9ca31161016457806331d507501161013e57806331d50750146103c857806336568abe146103e85780633a6aae7214610408578063584b153e1461046157600080fd5b8063248a9ca3146103475780632ab0f529146103775780632f2ff15d146103a857600080fd5b80630d3cf6fc116101a05780630d3cf6fc1461026b578063134008d31461029f57806313bc9f20146102b2578063150b7a02146102d257600080fd5b806301d5062a146101d257806301ffc9a7146101f457806307bd02651461022957600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506101f26101ed366004611c52565b6106ee565b005b34801561020057600080fd5b5061021461020f366004611cc7565b610783565b60405190151581526020015b60405180910390f35b34801561023557600080fd5b5061025d7fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e6381565b604051908152602001610220565b34801561027757600080fd5b5061025d7f5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca581565b6101f26102ad366004611d09565b6107df565b3480156102be57600080fd5b506102146102cd366004611d75565b6108d7565b3480156102de57600080fd5b506103166102ed366004611e9a565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610220565b34801561035357600080fd5b5061025d610362366004611d75565b60009081526020819052604090206001015490565b34801561038357600080fd5b50610214610392366004611d75565b6000908152600160208190526040909120541490565b3480156103b457600080fd5b506101f26103c3366004611f02565b6108fd565b3480156103d457600080fd5b506102146103e3366004611d75565b610927565b3480156103f457600080fd5b506101f2610403366004611f02565b610940565b34801561041457600080fd5b5061043c7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610220565b34801561046d57600080fd5b5061021461047c366004611d75565b6109f8565b34801561048d57600080fd5b506101f261049c366004611d75565b610a0e565b3480156104ad57600080fd5b5061025d6104bc366004611d09565b610ade565b3480156104cd57600080fd5b506101f26104dc366004611f73565b610b1d565b3480156104ed57600080fd5b5061025d7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc181565b34801561052157600080fd5b50610214610530366004611f02565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b34801561057257600080fd5b5061025d600081565b34801561058757600080fd5b5061025d7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f78381565b3480156105bb57600080fd5b5061025d6105ca366004612025565b610d4f565b3480156105db57600080fd5b506103166105ea36600461214e565b7fbc197c810000000000000000000000000000000000000000000000000000000095945050505050565b34801561062057600080fd5b506101f261062f366004611d75565b610d94565b34801561064057600080fd5b5061025d61064f366004611d75565b60009081526001602052604090205490565b34801561066d57600080fd5b506101f261067c366004611f02565b610e8f565b6101f261068f366004612025565b610eb4565b3480156106a057600080fd5b506103166106af3660046121f8565b7ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b3480156106e557600080fd5b5061025d611161565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc161071881611244565b6000610728898989898989610ade565b90506107348184611251565b6000817f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8b8b8b8b8b8a604051610770969594939291906122a6565b60405180910390a3505050505050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f4e2312e00000000000000000000000000000000000000000000000000000000014806107d957506107d98261139e565b92915050565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff1661085c5761085c8133611435565b600061086c888888888888610ade565b905061087881856114ed565b6108848888888861162a565b6000817fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588a8a8a8a6040516108bc94939291906122f1565b60405180910390a36108cd8161172e565b5050505050505050565b6000818152600160205260408120546001811180156108f65750428111155b9392505050565b60008281526020819052604090206001015461091881611244565b61092283836117d7565b505050565b60008181526001602052604081205481905b1192915050565b73ffffffffffffffffffffffffffffffffffffffff811633146109ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6109f482826118c7565b5050565b6000818152600160208190526040822054610939565b333014610a9d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f54696d656c6f636b436f6e74726f6c6c65723a2063616c6c6572206d7573742060448201527f62652074696d656c6f636b00000000000000000000000000000000000000000060648201526084016109e1565b60025460408051918252602082018390527f11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d5910160405180910390a1600255565b6000868686868686604051602001610afb969594939291906122a6565b6040516020818303038152906040528051906020012090509695505050505050565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1610b4781611244565b888714610bd6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b888514610c65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b6000610c778b8b8b8b8b8b8b8b610d4f565b9050610c838184611251565b60005b8a811015610d415780827f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8e8e85818110610cc357610cc3612331565b9050602002016020810190610cd89190612360565b8d8d86818110610cea57610cea612331565b905060200201358c8c87818110610d0357610d03612331565b9050602002810190610d15919061237b565b8c8b604051610d29969594939291906122a6565b60405180910390a3610d3a8161240f565b9050610c86565b505050505050505050505050565b60008888888888888888604051602001610d709897969594939291906124f7565b60405160208183030381529060405280519060200120905098975050505050505050565b7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f783610dbe81611244565b610dc7826109f8565b610e53576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20636160448201527f6e6e6f742062652063616e63656c6c656400000000000000000000000000000060648201526084016109e1565b6000828152600160205260408082208290555183917fbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb7091a25050565b600082815260208190526040902060010154610eaa81611244565b61092283836118c7565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff16610f3157610f318133611435565b878614610fc0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b87841461104f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b60006110618a8a8a8a8a8a8a8a610d4f565b905061106d81856114ed565b60005b8981101561114b5760008b8b8381811061108c5761108c612331565b90506020020160208101906110a19190612360565b905060008a8a848181106110b7576110b7612331565b9050602002013590503660008a8a868181106110d5576110d5612331565b90506020028101906110e7919061237b565b915091506110f78484848461162a565b84867fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588686868660405161112e94939291906122f1565b60405180910390a350505050806111449061240f565b9050611070565b506111558161172e565b50505050505050505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff161580159061123257507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166315064c966040518163ffffffff1660e01b8152600401602060405180830381865afa15801561120e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123291906125be565b1561123d5750600090565b5060025490565b61124e8133611435565b50565b61125a82610927565b156112e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20616c60448201527f7265616479207363686564756c6564000000000000000000000000000000000060648201526084016109e1565b6112ef611161565b81101561137e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a20696e73756666696369656e7460448201527f2064656c6179000000000000000000000000000000000000000000000000000060648201526084016109e1565b61138881426125e0565b6000928352600160205260409092209190915550565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806107d957507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146107d9565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f4576114738161197e565b61147e83602061199d565b60405160200161148f929190612617565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526109e191600401612698565b6114f6826108d7565b611582576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b80158061159e5750600081815260016020819052604090912054145b6109f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a206d697373696e67206465706560448201527f6e64656e6379000000000000000000000000000000000000000000000000000060648201526084016109e1565b60008473ffffffffffffffffffffffffffffffffffffffff168484846040516116549291906126e9565b60006040518083038185875af1925050503d8060008114611691576040519150601f19603f3d011682016040523d82523d6000602084013e611696565b606091505b5050905080611727576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f54696d656c6f636b436f6e74726f6c6c65723a20756e6465726c79696e67207460448201527f72616e73616374696f6e2072657665727465640000000000000000000000000060648201526084016109e1565b5050505050565b611737816108d7565b6117c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b600090815260016020819052604090912055565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556118693390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60606107d973ffffffffffffffffffffffffffffffffffffffff831660145b606060006119ac8360026126f9565b6119b79060026125e0565b67ffffffffffffffff8111156119cf576119cf611d8e565b6040519080825280601f01601f1916602001820160405280156119f9576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611a3057611a30612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611a9357611a93612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000611acf8460026126f9565b611ada9060016125e0565b90505b6001811115611b77577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611b1b57611b1b612331565b1a60f81b828281518110611b3157611b31612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611b7081612710565b9050611add565b5083156108f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109e1565b803573ffffffffffffffffffffffffffffffffffffffff81168114611c0457600080fd5b919050565b60008083601f840112611c1b57600080fd5b50813567ffffffffffffffff811115611c3357600080fd5b602083019150836020828501011115611c4b57600080fd5b9250929050565b600080600080600080600060c0888a031215611c6d57600080fd5b611c7688611be0565b965060208801359550604088013567ffffffffffffffff811115611c9957600080fd5b611ca58a828b01611c09565b989b979a50986060810135976080820135975060a09091013595509350505050565b600060208284031215611cd957600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146108f657600080fd5b60008060008060008060a08789031215611d2257600080fd5b611d2b87611be0565b955060208701359450604087013567ffffffffffffffff811115611d4e57600080fd5b611d5a89828a01611c09565b979a9699509760608101359660809091013595509350505050565b600060208284031215611d8757600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611e0457611e04611d8e565b604052919050565b600082601f830112611e1d57600080fd5b813567ffffffffffffffff811115611e3757611e37611d8e565b611e6860207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601611dbd565b818152846020838601011115611e7d57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215611eb057600080fd5b611eb985611be0565b9350611ec760208601611be0565b925060408501359150606085013567ffffffffffffffff811115611eea57600080fd5b611ef687828801611e0c565b91505092959194509250565b60008060408385031215611f1557600080fd5b82359150611f2560208401611be0565b90509250929050565b60008083601f840112611f4057600080fd5b50813567ffffffffffffffff811115611f5857600080fd5b6020830191508360208260051b8501011115611c4b57600080fd5b600080600080600080600080600060c08a8c031215611f9157600080fd5b893567ffffffffffffffff80821115611fa957600080fd5b611fb58d838e01611f2e565b909b50995060208c0135915080821115611fce57600080fd5b611fda8d838e01611f2e565b909950975060408c0135915080821115611ff357600080fd5b506120008c828d01611f2e565b9a9d999c50979a969997986060880135976080810135975060a0013595509350505050565b60008060008060008060008060a0898b03121561204157600080fd5b883567ffffffffffffffff8082111561205957600080fd5b6120658c838d01611f2e565b909a50985060208b013591508082111561207e57600080fd5b61208a8c838d01611f2e565b909850965060408b01359150808211156120a357600080fd5b506120b08b828c01611f2e565b999c989b509699959896976060870135966080013595509350505050565b600082601f8301126120df57600080fd5b8135602067ffffffffffffffff8211156120fb576120fb611d8e565b8160051b61210a828201611dbd565b928352848101820192828101908785111561212457600080fd5b83870192505b848310156121435782358252918301919083019061212a565b979650505050505050565b600080600080600060a0868803121561216657600080fd5b61216f86611be0565b945061217d60208701611be0565b9350604086013567ffffffffffffffff8082111561219a57600080fd5b6121a689838a016120ce565b945060608801359150808211156121bc57600080fd5b6121c889838a016120ce565b935060808801359150808211156121de57600080fd5b506121eb88828901611e0c565b9150509295509295909350565b600080600080600060a0868803121561221057600080fd5b61221986611be0565b945061222760208701611be0565b93506040860135925060608601359150608086013567ffffffffffffffff81111561225157600080fd5b6121eb88828901611e0c565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b73ffffffffffffffffffffffffffffffffffffffff8716815285602082015260a0604082015260006122dc60a08301868861225d565b60608301949094525060800152949350505050565b73ffffffffffffffffffffffffffffffffffffffff8516815283602082015260606040820152600061232760608301848661225d565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561237257600080fd5b6108f682611be0565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126123b057600080fd5b83018035915067ffffffffffffffff8211156123cb57600080fd5b602001915036819003821315611c4b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612440576124406123e0565b5060010190565b81835260006020808501808196508560051b810191508460005b878110156124ea57828403895281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18836030181126124a057600080fd5b8701858101903567ffffffffffffffff8111156124bc57600080fd5b8036038213156124cb57600080fd5b6124d686828461225d565b9a87019a9550505090840190600101612461565b5091979650505050505050565b60a0808252810188905260008960c08301825b8b8110156125455773ffffffffffffffffffffffffffffffffffffffff61253084611be0565b1682526020928301929091019060010161250a565b5083810360208501528881527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff89111561257e57600080fd5b8860051b9150818a602083013701828103602090810160408501526125a69082018789612447565b60608401959095525050608001529695505050505050565b6000602082840312156125d057600080fd5b815180151581146108f657600080fd5b808201808211156107d9576107d96123e0565b60005b8381101561260e5781810151838201526020016125f6565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161264f8160178501602088016125f3565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161268c8160288401602088016125f3565b01602801949350505050565b60208152600082518060208401526126b78160408501602087016125f3565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b8183823760009101908152919050565b80820281158282048414176107d9576107d96123e0565b60008161271f5761271f6123e0565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea26469706673582212206416c4e08f97752b4bb06159524dac058d3dccd8775e57ef1b01505751ebf7af64736f6c63430008110033", +
    +
    + 81 + +
    + - + "storage": { +
    +
    + 82 + +
    + - + "0x0000000000000000000000000000000000000000000000000000000000000002": "0x00000000000000000000000000000000000000000000000000000000000d2f00", +
    +
    + 83 + +
    + - + "0x33d4aa03df3f12c4f615b40676f67fdafecd3edb5a9c0ca2a47a923dae33a023": "0x0000000000000000000000000000000000000000000000000000000000000001", +
    +
    + 84 + +
    + - + "0x9fa2d8034dbcb437bee38d61fbd100910e1342ffc07f128aa1b8e6790b7f3f68": "0x0000000000000000000000000000000000000000000000000000000000000001", +
    +
    + 85 + +
    + - + "0x64494413541ff93b31aa309254e3fed72a7456e9845988b915b4c7a7ceba8814": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", +
    +
    + 86 + +
    + - + "0x531a7c25761aa4b0f2310edca9bb25e1e3ceb49ad4b0422aec866b3ce7567c87": "0x0000000000000000000000000000000000000000000000000000000000000001", +
    +
    + 87 + +
    + - + "0x3412d5605ac6cd444957cedb533e5dacad6378b4bc819ebe3652188a665066d6": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", +
    +
    + 88 + +
    + - + "0xedbedc78c4240c7613622a35de050b48bd6c6d9a31b3d485b68fbbed54a4802d": "0x0000000000000000000000000000000000000000000000000000000000000001", +
    +
    + 89 + +
    + - + "0xdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d706a": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", +
    +
    + 90 + +
    + - + "0x76616448da8d124a07383c26a6b2433b3259de946aa40f51524ec96ee05e871a": "0x0000000000000000000000000000000000000000000000000000000000000001", +
    +
    + 91 + +
    + - + "0xc3ad33e20b0c56a223ad5104fff154aa010f8715b9c981fd38fdc60a4d1a52fc": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5" +
    +
    + 92 + +
    + - + } +
    +
    + 93 + +
    + - + }, +
    +
    + 94 + +
    + - + { +
    +
    + 95 + +
    + - + "accountName": "keyless Deployer", +
    +
    + 96 + +
    + - + "balance": "0", +
    +
    + 97 + +
    + - + "nonce": "1", +
    +
    + 98 + +
    + - + "address": "0x9d90066e7478496e2284E54c3548106bb4F90E50" +
    +
    + 99 + +
    + - + }, +
    +
    + 100 + +
    + - + { +
    +
    + 101 + +
    + - + "accountName": "deployer", +
    +
    + 102 + +
    + - + "balance": "0", +
    +
    + 103 + +
    + - + "nonce": "8", +
    +
    + 104 + +
    + - + "address": "0x4c1665d6651ecEfa59B9B3041951608468b18891" +
    +
    + 105 + +
    + - + } +
    +
    + 106 + +
    + - + ] +
    +
    + 107 + +
    + - + } +
    +
    + 108 + +
    + - + ` +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/config/network.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -25,17 +25,16 @@
    +
    + 25 + +
    +   +
    +
    +
    + 26 + +
    +   + type network string +
    +
    + 27 + +
    +   +
    +
    +
    + 28 + +
    + - + const mainnet network = "mainnet" +
    +
    + 29 + +
    + - + const testnet network = "testnet" +
    +
    + 30 + +
    + - + const cardona network = "cardona" +
    +
    + 31 + +
    +   + const custom network = "custom" +
    +
    + 32 + +
    +   +
    +
    +
    + 33 + +
    +   + // GenesisFromJSON is the config file for network_custom +
    +
    + 34 + +
    +   + type GenesisFromJSON struct { +
    +
    + 35 + +
    +   + // L1: root hash of the genesis block +
    +
    + 36 + +
    +   + Root string `json:"root"` +
    +
    + 37 + +
    + - + // L1: block number of the genesis block +
    +
    + 38 + +
    + - + GenesisBlockNum uint64 `json:"genesisBlockNumber"` +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 39 + +
    +   + // L2: List of states contracts used to populate merkle tree at initial state +
    +
    + 40 + +
    +   + Genesis []genesisAccountFromJSON `json:"genesis"` +
    +
    + 41 + +
    +   + // L1: configuration of the network +
    +
    +
    @@ -60,12 +59,6 @@
    +
    + 60 + +
    +   + func (cfg *Config) loadNetworkConfig(ctx *cli.Context) { +
    +
    + 61 + +
    +   + var networkJSON string +
    +
    + 62 + +
    +   + switch ctx.String(FlagNetwork) { +
    +
    + 63 + +
    + - + case string(mainnet): +
    +
    + 64 + +
    + - + networkJSON = MainnetNetworkConfigJSON +
    +
    + 65 + +
    + - + case string(testnet): +
    +
    + 66 + +
    + - + networkJSON = TestnetNetworkConfigJSON +
    +
    + 67 + +
    + - + case string(cardona): +
    +
    + 68 + +
    + - + networkJSON = CardonaNetworkConfigJSON +
    +
    + 69 + +
    +   + case string(custom): +
    +
    + 70 + +
    +   + var err error +
    +
    + 71 + +
    +   + cfgPath := ctx.String(FlagCustomNetwork) +
    +
    +
    @@ -74,7 +67,7 @@
    +
    + 74 + +
    +   + panic(err.Error()) +
    +
    + 75 + +
    +   + } +
    +
    + 76 + +
    +   + default: +
    +
    + 77 + +
    + - + log.Fatalf("unsupported --network value. Must be one of: [%s, %s, %s]", mainnet, testnet, cardona, custom) +
    +
    + 78 + +
    +   + } +
    +
    + 79 + +
    +   + config, err := LoadGenesisFromJSONString(networkJSON) +
    +
    + 80 + +
    +   + if err != nil { +
    +
    +
    @@ -122,9 +115,10 @@
    +
    + 122 + +
    +   +
    +
    +
    + 123 + +
    +   + cfg.L1Config = cfgJSON.L1Config +
    +
    + 124 + +
    +   + cfg.Genesis = state.Genesis{ +
    +
    + 125 + +
    + - + BlockNumber: cfgJSON.GenesisBlockNum, +
    +
    + 126 + +
    + - + Root: common.HexToHash(cfgJSON.Root), +
    +
    + 127 + +
    + - + Actions: []*state.GenesisAction{}, +
    +
    + + +
    +   +
    +
    +
    + 128 + +
    +   + } +
    +
    + 129 + +
    +   +
    +
    +
    + 130 + +
    +   + for _, account := range cfgJSON.Genesis { +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 25 + +
    +   +
    +
    +
    + 26 + +
    +   + type network string +
    +
    + 27 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 28 + +
    +   + const custom network = "custom" +
    +
    + 29 + +
    +   +
    +
    +
    + 30 + +
    +   + // GenesisFromJSON is the config file for network_custom +
    +
    + 31 + +
    +   + type GenesisFromJSON struct { +
    +
    + 32 + +
    +   + // L1: root hash of the genesis block +
    +
    + 33 + +
    +   + Root string `json:"root"` +
    +
    + 34 + +
    + + + // L1: block number in which the rollup was created +
    +
    + 35 + +
    + + + RollupCreationBlockNum uint64 `json:"rollupCreationBlockNumber"` +
    +
    + 36 + +
    + + + // L1: block number in which the rollup manager was created +
    +
    + 37 + +
    + + + RollupManagerCreationBlockNum uint64 `json:"rollupManagerCreationBlockNumber"` +
    +
    + 38 + +
    +   + // L2: List of states contracts used to populate merkle tree at initial state +
    +
    + 39 + +
    +   + Genesis []genesisAccountFromJSON `json:"genesis"` +
    +
    + 40 + +
    +   + // L1: configuration of the network +
    +
    +
     
    +
    + 59 + +
    +   + func (cfg *Config) loadNetworkConfig(ctx *cli.Context) { +
    +
    + 60 + +
    +   + var networkJSON string +
    +
    + 61 + +
    +   + switch ctx.String(FlagNetwork) { +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 62 + +
    +   + case string(custom): +
    +
    + 63 + +
    +   + var err error +
    +
    + 64 + +
    +   + cfgPath := ctx.String(FlagCustomNetwork) +
    +
    +
     
    +
    + 67 + +
    +   + panic(err.Error()) +
    +
    + 68 + +
    +   + } +
    +
    + 69 + +
    +   + default: +
    +
    + 70 + +
    + + + log.Fatalf("unsupported --network value. Must be %s", custom) +
    +
    + 71 + +
    +   + } +
    +
    + 72 + +
    +   + config, err := LoadGenesisFromJSONString(networkJSON) +
    +
    + 73 + +
    +   + if err != nil { +
    +
    +
     
    +
    + 115 + +
    +   +
    +
    +
    + 116 + +
    +   + cfg.L1Config = cfgJSON.L1Config +
    +
    + 117 + +
    +   + cfg.Genesis = state.Genesis{ +
    +
    + 118 + +
    + + + RollupBlockNumber: cfgJSON.RollupCreationBlockNum, +
    +
    + 119 + +
    + + + RollupManagerBlockNumber: cfgJSON.RollupManagerCreationBlockNum, +
    +
    + 120 + +
    + + + Root: common.HexToHash(cfgJSON.Root), +
    +
    + 121 + +
    + + + Actions: []*state.GenesisAction{}, +
    +
    + 122 + +
    +   + } +
    +
    + 123 + +
    +   +
    +
    +
    + 124 + +
    +   + for _, account := range cfgJSON.Genesis { +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/config/network_test.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -14,18 +13,6 @@
    +
    + 14 + +
    +   + "github.com/urfave/cli/v2" +
    +
    + 15 + +
    +   + ) +
    +
    + 16 + +
    +   +
    +
    +
    + 17 + +
    + - + func TestCardona(t *testing.T) { +
    +
    + 18 + +
    + - + cfg := Config{} +
    +
    + 19 + +
    + - + fs := flag.NewFlagSet("", flag.ExitOnError) +
    +
    + 20 + +
    + - + fs.String(FlagNetwork, string(cardona), string(cardona)) +
    +
    + 21 + +
    + - + err := fs.Set(FlagNetwork, string(cardona)) +
    +
    + 22 + +
    + - + require.NoError(t, err) +
    +
    + 23 + +
    + - + app := cli.NewApp() +
    +
    + 24 + +
    + - + ctx := cli.NewContext(app, fs, nil) +
    +
    + 25 + +
    + - +
    +
    +
    + 26 + +
    + - + log.Info("flag=", ctx.String(FlagNetwork)) +
    +
    + 27 + +
    + - + cfg.loadNetworkConfig(ctx) +
    +
    + 28 + +
    + - + } +
    +
    + 29 + +
    +   + func TestLoadCustomNetworkConfig(t *testing.T) { +
    +
    + 30 + +
    +   + tcs := []struct { +
    +
    + 31 + +
    +   + description string +
    +
    +
    @@ -37,7 +24,8 @@
    +
    + 37 + +
    +   + description: "happy path", +
    +
    + 38 + +
    +   + inputConfigStr: `{ +
    +
    + 39 + +
    +   + "root": "0xBEEF", +
    +
    + 40 + +
    + - + "genesisBlockNumber": 69, +
    +
    + + +
    +   +
    +
    +
    + 41 + +
    +   + "l1Config" : { +
    +
    + 42 + +
    +   + "chainId": 420, +
    +
    + 43 + +
    +   + "polygonZkEVMAddress": "0xc949254d682d8c9ad5682521675b8f43b102aec4", +
    +
    +
    @@ -89,8 +77,9 @@
    +
    + 89 + +
    +   + GlobalExitRootManagerAddr: common.HexToAddress("0xc949254d682d8c9ad5682521675b8f43b102aec4"), +
    +
    + 90 + +
    +   + }, +
    +
    + 91 + +
    +   + Genesis: state.Genesis{ +
    +
    + 92 + +
    + - + Root: common.HexToHash("0xBEEF"), +
    +
    + 93 + +
    + - + BlockNumber: 69, +
    +
    + + +
    +   +
    +
    +
    + 94 + +
    +   + Actions: []*state.GenesisAction{ +
    +
    + 95 + +
    +   + { +
    +
    + 96 + +
    +   + Address: "0xc949254d682d8c9ad5682521675b8f43b102aec4", +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 13 + +
    +   + "github.com/urfave/cli/v2" +
    +
    + 14 + +
    +   + ) +
    +
    + 15 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 16 + +
    +   + func TestLoadCustomNetworkConfig(t *testing.T) { +
    +
    + 17 + +
    +   + tcs := []struct { +
    +
    + 18 + +
    +   + description string +
    +
    +
     
    +
    + 24 + +
    +   + description: "happy path", +
    +
    + 25 + +
    +   + inputConfigStr: `{ +
    +
    + 26 + +
    +   + "root": "0xBEEF", +
    +
    + 27 + +
    + + + "rollupCreationBlockNumber": 69, +
    +
    + 28 + +
    + + + "rollupManagerCreationBlockNumber": 60, +
    +
    + 29 + +
    +   + "l1Config" : { +
    +
    + 30 + +
    +   + "chainId": 420, +
    +
    + 31 + +
    +   + "polygonZkEVMAddress": "0xc949254d682d8c9ad5682521675b8f43b102aec4", +
    +
    +
     
    +
    + 77 + +
    +   + GlobalExitRootManagerAddr: common.HexToAddress("0xc949254d682d8c9ad5682521675b8f43b102aec4"), +
    +
    + 78 + +
    +   + }, +
    +
    + 79 + +
    +   + Genesis: state.Genesis{ +
    +
    + 80 + +
    + + + Root: common.HexToHash("0xBEEF"), +
    +
    + 81 + +
    + + + RollupBlockNumber: 69, +
    +
    + 82 + +
    + + + RollupManagerBlockNumber: 60, +
    +
    + 83 + +
    +   + Actions: []*state.GenesisAction{ +
    +
    + 84 + +
    +   + { +
    +
    + 85 + +
    +   + Address: "0xc949254d682d8c9ad5682521675b8f43b102aec4", +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/config/testnetgenesis.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,108 +0,0 @@
    +
    + 1 + +
    + - + package config +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + // TestnetNetworkConfigJSON is the hardcoded network configuration to be used for the official mainnet setup +
    +
    + 4 + +
    + - + const TestnetNetworkConfigJSON = ` +
    +
    + 5 + +
    + - + { +
    +
    + 6 + +
    + - + "l1Config" : { +
    +
    + 7 + +
    + - + "chainId": 5, +
    +
    + 8 + +
    + - + "polygonZkEVMAddress": "0xa997cfD539E703921fD1e3Cf25b4c241a27a4c7A", +
    +
    + 9 + +
    + - + "polTokenAddress": "0x1319D23c2F7034F52Eb07399702B040bA278Ca49", +
    +
    + 10 + +
    + - + "polygonZkEVMGlobalExitRootAddress": "0x4d9427DCA0406358445bC0a8F88C26b704004f74" +
    +
    + 11 + +
    + - + }, +
    +
    + 12 + +
    + - + "root": "0x13a14c4a8288e782863d7ce916d224546c69dc428fbfa7115a0cc33a27a05b26", +
    +
    + 13 + +
    + - + "genesisBlockNumber": 8572998, +
    +
    + 14 + +
    + - + "genesis": [ +
    +
    + 15 + +
    + - + { +
    +
    + 16 + +
    + - + "contractName": "PolygonZkEVMDeployer", +
    +
    + 17 + +
    + - + "balance": "0", +
    +
    + 18 + +
    + - + "nonce": "4", +
    +
    + 19 + +
    + - + "address": "0x39877a0c3cd148476DaA2475c77c478C62eC7509", +
    +
    + 20 + +
    + - + "bytecode": "0x6080604052600436106100705760003560e01c8063715018a61161004e578063715018a6146100e65780638da5cb5b146100fb578063e11ae6cb14610126578063f2fde38b1461013957600080fd5b80632b79805a146100755780634a94d4871461008a5780636d07dbf81461009d575b600080fd5b610088610083366004610927565b610159565b005b6100886100983660046109c7565b6101cb565b3480156100a957600080fd5b506100bd6100b8366004610a1e565b61020d565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b50610088610220565b34801561010757600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100bd565b610088610134366004610a40565b610234565b34801561014557600080fd5b50610088610154366004610a90565b61029b565b610161610357565b600061016e8585856103d8565b905061017a8183610537565b5060405173ffffffffffffffffffffffffffffffffffffffff821681527fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a15050505050565b6101d3610357565b6101de83838361057b565b506040517f25adb19089b6a549831a273acdf7908cff8b7ee5f551f8d1d37996cf01c5df5b90600090a1505050565b600061021983836105a9565b9392505050565b610228610357565b61023260006105b6565b565b61023c610357565b60006102498484846103d8565b60405173ffffffffffffffffffffffffffffffffffffffff821681529091507fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a150505050565b6102a3610357565b73ffffffffffffffffffffffffffffffffffffffff811661034b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610354816105b6565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610232576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610342565b600083471015610444576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e63650000006044820152606401610342565b81516000036104af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f6044820152606401610342565b8282516020840186f5905073ffffffffffffffffffffffffffffffffffffffff8116610219576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f79000000000000006044820152606401610342565b6060610219838360006040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c6564000081525061062b565b60606105a1848484604051806060016040528060298152602001610b3d6029913961062b565b949350505050565b6000610219838330610744565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060824710156106bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610342565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516106e69190610acf565b60006040518083038185875af1925050503d8060008114610723576040519150601f19603f3d011682016040523d82523d6000602084013e610728565b606091505b50915091506107398783838761076e565b979650505050505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b606083156108045782516000036107fd5773ffffffffffffffffffffffffffffffffffffffff85163b6107fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610342565b50816105a1565b6105a183838151156108195781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103429190610aeb565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f83011261088d57600080fd5b813567ffffffffffffffff808211156108a8576108a861084d565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156108ee576108ee61084d565b8160405283815286602085880101111561090757600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000806080858703121561093d57600080fd5b8435935060208501359250604085013567ffffffffffffffff8082111561096357600080fd5b61096f8883890161087c565b9350606087013591508082111561098557600080fd5b506109928782880161087c565b91505092959194509250565b803573ffffffffffffffffffffffffffffffffffffffff811681146109c257600080fd5b919050565b6000806000606084860312156109dc57600080fd5b6109e58461099e565b9250602084013567ffffffffffffffff811115610a0157600080fd5b610a0d8682870161087c565b925050604084013590509250925092565b60008060408385031215610a3157600080fd5b50508035926020909101359150565b600080600060608486031215610a5557600080fd5b8335925060208401359150604084013567ffffffffffffffff811115610a7a57600080fd5b610a868682870161087c565b9150509250925092565b600060208284031215610aa257600080fd5b6102198261099e565b60005b83811015610ac6578181015183820152602001610aae565b50506000910152565b60008251610ae1818460208701610aab565b9190910192915050565b6020815260008251806020840152610b0a816040850160208701610aab565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a26469706673582212200b8e3cd6bd762444a7eeff86e1cfcd7e1ce9524b715dcb70b2a4c2b70fd5188464736f6c63430008110033", +
    +
    + 21 + +
    + - + "storage": { +
    +
    + 22 + +
    + - + "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000a0b02b28920812324f1cc3255bd8840867d3f227" +
    +
    + 23 + +
    + - + } +
    +
    + 24 + +
    + - + }, +
    +
    + 25 + +
    + - + { +
    +
    + 26 + +
    + - + "contractName": "ProxyAdmin", +
    +
    + 27 + +
    + - + "balance": "0", +
    +
    + 28 + +
    + - + "nonce": "1", +
    +
    + 29 + +
    + - + "address": "0x40797c2f93298a44a893F43EdF1B33B63d7BA333", +
    +
    + 30 + +
    + - + "bytecode": "0x60806040526004361061007b5760003560e01c80639623609d1161004e5780639623609d1461012b57806399a88ec41461013e578063f2fde38b1461015e578063f3b7dead1461017e57600080fd5b8063204e1c7a14610080578063715018a6146100c95780637eff275e146100e05780638da5cb5b14610100575b600080fd5b34801561008c57600080fd5b506100a061009b366004610608565b61019e565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100d557600080fd5b506100de610255565b005b3480156100ec57600080fd5b506100de6100fb36600461062c565b610269565b34801561010c57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100a0565b6100de610139366004610694565b6102f7565b34801561014a57600080fd5b506100de61015936600461062c565b61038c565b34801561016a57600080fd5b506100de610179366004610608565b6103e8565b34801561018a57600080fd5b506100a0610199366004610608565b6104a4565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907f5c60da1b00000000000000000000000000000000000000000000000000000000815260040190565b600060405180830381855afa9150503d8060008114610225576040519150601f19603f3d011682016040523d82523d6000602084013e61022a565b606091505b50915091508161023957600080fd5b8080602001905181019061024d9190610788565b949350505050565b61025d6104f0565b6102676000610571565b565b6102716104f0565b6040517f8f28397000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690638f283970906024015b600060405180830381600087803b1580156102db57600080fd5b505af11580156102ef573d6000803e3d6000fd5b505050505050565b6102ff6104f0565b6040517f4f1ef28600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690634f1ef28690349061035590869086906004016107a5565b6000604051808303818588803b15801561036e57600080fd5b505af1158015610382573d6000803e3d6000fd5b5050505050505050565b6103946104f0565b6040517f3659cfe600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690633659cfe6906024016102c1565b6103f06104f0565b73ffffffffffffffffffffffffffffffffffffffff8116610498576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6104a181610571565b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907ff851a44000000000000000000000000000000000000000000000000000000000815260040190565b60005473ffffffffffffffffffffffffffffffffffffffff163314610267576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161048f565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b73ffffffffffffffffffffffffffffffffffffffff811681146104a157600080fd5b60006020828403121561061a57600080fd5b8135610625816105e6565b9392505050565b6000806040838503121561063f57600080fd5b823561064a816105e6565b9150602083013561065a816105e6565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000606084860312156106a957600080fd5b83356106b4816105e6565b925060208401356106c4816105e6565b9150604084013567ffffffffffffffff808211156106e157600080fd5b818601915086601f8301126106f557600080fd5b81358181111561070757610707610665565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561074d5761074d610665565b8160405282815289602084870101111561076657600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b60006020828403121561079a57600080fd5b8151610625816105e6565b73ffffffffffffffffffffffffffffffffffffffff8316815260006020604081840152835180604085015260005b818110156107ef578581018301518582016060015282016107d3565b5060006060828601015260607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010192505050939250505056fea2646970667358221220babd4ff1f5daee002b96cc86d8bb6c2c2c210ae3132df5ea384713352f7f15fe64736f6c63430008110033", +
    +
    + 31 + +
    + - + "storage": { +
    +
    + 32 + +
    + - + "0x0000000000000000000000000000000000000000000000000000000000000000": "0x00000000000000000000000002245d7b6cb0b6870d1e28ac877ee355b9588869" +
    +
    + 33 + +
    + - + } +
    +
    + 34 + +
    + - + }, +
    +
    + 35 + +
    + - + { +
    +
    + 36 + +
    + - + "contractName": "PolygonZkEVMBridge implementation", +
    +
    + 37 + +
    + - + "balance": "0", +
    +
    + 38 + +
    + - + "nonce": "1", +
    +
    + 39 + +
    + - + "address": "0x39e780D8800f7396e8B7530A8925B14025AedC77", +
    +
    + 40 + +
    + - + "bytecode": "0x6080604052600436106200019f5760003560e01c8063647c576c11620000e7578063be5831c71162000089578063dbc169761162000060578063dbc169761462000639578063ee25560b1462000651578063fb570834146200068257600080fd5b8063be5831c714620005ae578063cd58657914620005ea578063d02103ca146200060157600080fd5b80639e34070f11620000be5780639e34070f146200050a578063aaa13cc2146200054f578063bab161bf146200057457600080fd5b8063647c576c146200048657806379e2cf9714620004ab57806381b1c17414620004c357600080fd5b80632d2c9d94116200015157806334ac9cf2116200012857806334ac9cf2146200034b5780633ae05047146200037a5780633e197043146200039257600080fd5b80632d2c9d9414620002765780632dfdf0b5146200029b578063318aee3d14620002c257600080fd5b806322e95f2c116200018657806322e95f2c14620001ef578063240ff378146200023a5780632cffd02e146200025157600080fd5b806315064c9614620001a45780632072f6c514620001d5575b600080fd5b348015620001b157600080fd5b50606854620001c09060ff1681565b60405190151581526020015b60405180910390f35b348015620001e257600080fd5b50620001ed620006a7565b005b348015620001fc57600080fd5b50620002146200020e366004620032db565b62000705565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001620001cc565b620001ed6200024b36600462003372565b620007a8565b3480156200025e57600080fd5b50620001ed6200027036600462003409565b620009d0565b3480156200028357600080fd5b50620001ed6200029536600462003409565b62000f74565b348015620002a857600080fd5b50620002b360535481565b604051908152602001620001cc565b348015620002cf57600080fd5b5062000319620002e1366004620034ef565b606b6020526000908152604090205463ffffffff811690640100000000900473ffffffffffffffffffffffffffffffffffffffff1682565b6040805163ffffffff909316835273ffffffffffffffffffffffffffffffffffffffff909116602083015201620001cc565b3480156200035857600080fd5b50606c54620002149073ffffffffffffffffffffffffffffffffffffffff1681565b3480156200038757600080fd5b50620002b362001178565b3480156200039f57600080fd5b50620002b3620003b136600462003526565b6040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b3480156200049357600080fd5b50620001ed620004a5366004620035b0565b6200125e565b348015620004b857600080fd5b50620001ed620014ad565b348015620004d057600080fd5b5062000214620004e236600462003600565b606a6020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b3480156200051757600080fd5b50620001c06200052936600462003600565b600881901c600090815260696020526040902054600160ff9092169190911b9081161490565b3480156200055c57600080fd5b50620002146200056e3660046200361a565b620014e7565b3480156200058157600080fd5b506068546200059890610100900463ffffffff1681565b60405163ffffffff9091168152602001620001cc565b348015620005bb57600080fd5b506068546200059890790100000000000000000000000000000000000000000000000000900463ffffffff1681565b620001ed620005fb366004620036ce565b620016d3565b3480156200060e57600080fd5b50606854620002149065010000000000900473ffffffffffffffffffffffffffffffffffffffff1681565b3480156200064657600080fd5b50620001ed62001c37565b3480156200065e57600080fd5b50620002b36200067036600462003600565b60696020526000908152604090205481565b3480156200068f57600080fd5b50620001c0620006a136600462003770565b62001c93565b606c5473ffffffffffffffffffffffffffffffffffffffff163314620006f9576040517fe2e8106b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200070362001d7c565b565b6040805160e084901b7fffffffff0000000000000000000000000000000000000000000000000000000016602080830191909152606084901b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602483015282516018818403018152603890920183528151918101919091206000908152606a909152205473ffffffffffffffffffffffffffffffffffffffff165b92915050565b60685460ff1615620007e6576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60685463ffffffff8681166101009092041614806200080c5750600263ffffffff861610155b1562000844576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b6001606860019054906101000a900463ffffffff163388883488886053546040516200089a9998979695949392919062003806565b60405180910390a1620009b8620009b26001606860019054906101000a900463ffffffff16338989348989604051620008d592919062003881565b60405180910390206040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b62001e10565b8215620009c957620009c962001f27565b5050505050565b60685460ff161562000a0e576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000a258b8b8b8b8b8b8b8b8b8b8b600062001ffc565b73ffffffffffffffffffffffffffffffffffffffff861662000b01576040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff861690859060405162000a7a9190620038e6565b60006040518083038185875af1925050503d806000811462000ab9576040519150601f19603f3d011682016040523d82523d6000602084013e62000abe565b606091505b505090508062000afa576040517f6747a28800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5062000efc565b60685463ffffffff61010090910481169088160362000b435762000b3d73ffffffffffffffffffffffffffffffffffffffff87168585620021ed565b62000efc565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b1660208201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b166024820152600090603801604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291815281516020928301206000818152606a90935291205490915073ffffffffffffffffffffffffffffffffffffffff168062000e6e576000808062000c1886880188620039fb565b92509250925060008584848460405162000c329062003292565b62000c409392919062003abd565b8190604051809103906000f590508015801562000c61573d6000803e3d6000fd5b506040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8c81166004830152602482018c9052919250908216906340c10f1990604401600060405180830381600087803b15801562000cd757600080fd5b505af115801562000cec573d6000803e3d6000fd5b5050505080606a600088815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060405180604001604052808e63ffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff16815250606b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509050507f490e59a1701b938786ac72570a1efeac994a3dbe96e2e883e19e902ace6e6a398d8d838b8b60405162000e5c95949392919062003afa565b60405180910390a15050505062000ef9565b6040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152602482018790528216906340c10f1990604401600060405180830381600087803b15801562000edf57600080fd5b505af115801562000ef4573d6000803e3d6000fd5b505050505b50505b6040805163ffffffff8c811682528916602082015273ffffffffffffffffffffffffffffffffffffffff88811682840152861660608201526080810185905290517f25308c93ceeed162da955b3f7ce3e3f93606579e40fb92029faa9efe275459839181900360a00190a15050505050505050505050565b60685460ff161562000fb2576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000fc98b8b8b8b8b8b8b8b8b8b8b600162001ffc565b60008473ffffffffffffffffffffffffffffffffffffffff1684888a868660405160240162000ffc949392919062003b42565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f1806b5f200000000000000000000000000000000000000000000000000000000179052516200107f9190620038e6565b60006040518083038185875af1925050503d8060008114620010be576040519150601f19603f3d011682016040523d82523d6000602084013e620010c3565b606091505b5050905080620010ff576040517f37e391c300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805163ffffffff8d811682528a16602082015273ffffffffffffffffffffffffffffffffffffffff89811682840152871660608201526080810186905290517f25308c93ceeed162da955b3f7ce3e3f93606579e40fb92029faa9efe275459839181900360a00190a1505050505050505050505050565b605354600090819081805b602081101562001255578083901c600116600103620011e65760338160208110620011b257620011b262003b8a565b0154604080516020810192909252810185905260600160405160208183030381529060405280519060200120935062001213565b60408051602081018690529081018390526060016040516020818303038152906040528051906020012093505b604080516020810184905290810183905260600160405160208183030381529060405280519060200120915080806200124c9062003be8565b91505062001183565b50919392505050565b600054610100900460ff16158080156200127f5750600054600160ff909116105b806200129b5750303b1580156200129b575060005460ff166001145b6200132d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156200138c57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b606880547fffffffffffffff000000000000000000000000000000000000000000000000ff1661010063ffffffff8716027fffffffffffffff0000000000000000000000000000000000000000ffffffffff16176501000000000073ffffffffffffffffffffffffffffffffffffffff8681169190910291909117909155606c80547fffffffffffffffffffffffff00000000000000000000000000000000000000001691841691909117905562001443620022c3565b8015620014a757600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b605354606854790100000000000000000000000000000000000000000000000000900463ffffffff16101562000703576200070362001f27565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b1660208201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b1660248201526000908190603801604051602081830303815290604052805190602001209050600060ff60f81b3083604051806020016200157d9062003292565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082820381018352601f909101166040819052620015c8908d908d908d908d908d9060200162003c23565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905262001606929160200162003c64565b604051602081830303815290604052805190602001206040516020016200168f94939291907fff0000000000000000000000000000000000000000000000000000000000000094909416845260609290921b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660018401526015830152603582015260550190565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001815291905280516020909101209a9950505050505050505050565b60685460ff161562001711576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200171b62002366565b60685463ffffffff888116610100909204161480620017415750600263ffffffff881610155b1562001779576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008060608773ffffffffffffffffffffffffffffffffffffffff8816620017df57883414620017d5576040517fb89240f500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000925062001ad9565b341562001818576040517f798ee6f100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8089166000908152606b602090815260409182902082518084019093525463ffffffff811683526401000000009004909216918101829052901562001908576040517f9dc29fac000000000000000000000000000000000000000000000000000000008152336004820152602481018b905273ffffffffffffffffffffffffffffffffffffffff8a1690639dc29fac90604401600060405180830381600087803b158015620018db57600080fd5b505af1158015620018f0573d6000803e3d6000fd5b50505050806020015194508060000151935062001ad7565b85156200191d576200191d898b8989620023db565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8b16906370a0823190602401602060405180830381865afa1580156200198b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620019b1919062003c97565b9050620019d773ffffffffffffffffffffffffffffffffffffffff8b1633308e620028f9565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa15801562001a45573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001a6b919062003c97565b905062001a79828262003cb1565b6068548c9850610100900463ffffffff169650935062001a998762002959565b62001aa48c62002a71565b62001aaf8d62002b7e565b60405160200162001ac39392919062003abd565b604051602081830303815290604052945050505b505b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b600084868e8e868860535460405162001b1b98979695949392919062003cc7565b60405180910390a162001c0f620009b2600085878f8f8789805190602001206040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b861562001c205762001c2062001f27565b5050505062001c2e60018055565b50505050505050565b606c5473ffffffffffffffffffffffffffffffffffffffff16331462001c89576040517fe2e8106b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200070362002c80565b600084815b602081101562001d6e57600163ffffffff8616821c8116900362001d0a5785816020811062001ccb5762001ccb62003b8a565b60200201358260405160200162001cec929190918252602082015260400190565b60405160208183030381529060405280519060200120915062001d59565b8186826020811062001d205762001d2062003b8a565b602002013560405160200162001d40929190918252602082015260400190565b6040516020818303038152906040528051906020012091505b8062001d658162003be8565b91505062001c98565b50821490505b949350505050565b60685460ff161562001dba576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556040517f2261efe5aef6fedc1fd1550b25facc9181745623049c7901287030b9ad1a549790600090a1565b80600162001e216020600262003e79565b62001e2d919062003cb1565b6053541062001e68576040517fef5ccf6600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060536000815462001e7b9062003be8565b9182905550905060005b602081101562001f17578082901c60011660010362001ebd57826033826020811062001eb55762001eb562003b8a565b015550505050565b6033816020811062001ed35762001ed362003b8a565b01546040805160208101929092528101849052606001604051602081830303815290604052805190602001209250808062001f0e9062003be8565b91505062001e85565b5062001f2262003e87565b505050565b6053546068805463ffffffff909216790100000000000000000000000000000000000000000000000000027fffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffffff909216919091179081905573ffffffffffffffffffffffffffffffffffffffff65010000000000909104166333d6247d62001fad62001178565b6040518263ffffffff1660e01b815260040162001fcc91815260200190565b600060405180830381600087803b15801562001fe757600080fd5b505af1158015620014a7573d6000803e3d6000fd5b6200200d8b63ffffffff1662002d10565b6068546040805160208082018e90528183018d9052825180830384018152606083019384905280519101207f257b363200000000000000000000000000000000000000000000000000000000909252606481019190915260009165010000000000900473ffffffffffffffffffffffffffffffffffffffff169063257b3632906084016020604051808303816000875af1158015620020b0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620020d6919062003c97565b90508060000362002112576040517e2f6fad00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60685463ffffffff88811661010090920416146200215c576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606854600090610100900463ffffffff166200217a5750896200217d565b508a5b620021a66200219d848c8c8c8c8c8c8c604051620008d592919062003881565b8f8f8462001c93565b620021dd576040517fe0417cec00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505050505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905262001f229084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915262002d75565b600054610100900460ff166200235c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162001324565b6200070362002e88565b600260015403620023d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640162001324565b6002600155565b6000620023ec600482848662003eb6565b620023f79162003ee2565b90507f2afa5331000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000821601620026765760008080808080806200245a896004818d62003eb6565b81019062002469919062003f2b565b96509650965096509650965096503373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614620024dd576040517f912ecce700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff861630146200252d576040517f750643af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8a851462002567576040517f03fffc4b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff89811660248301528881166044830152606482018890526084820187905260ff861660a483015260c4820185905260e48083018590528351808403909101815261010490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fd505accf000000000000000000000000000000000000000000000000000000001790529151918e1691620026229190620038e6565b6000604051808303816000865af19150503d806000811462002661576040519150601f19603f3d011682016040523d82523d6000602084013e62002666565b606091505b50505050505050505050620009c9565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f8fcbaf0c0000000000000000000000000000000000000000000000000000000014620026f2576040517fe282c0ba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808080808080806200270a8a6004818e62003eb6565b81019062002719919062003f86565b975097509750975097509750975097503373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff16146200278f576040517f912ecce700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff87163014620027df576040517f750643af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff8a811660248301528981166044830152606482018990526084820188905286151560a483015260ff861660c483015260e482018590526101048083018590528351808403909101815261012490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f8fcbaf0c000000000000000000000000000000000000000000000000000000001790529151918f1691620028a39190620038e6565b6000604051808303816000865af19150503d8060008114620028e2576040519150601f19603f3d011682016040523d82523d6000602084013e620028e7565b606091505b50505050505050505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052620014a79085907f23b872dd000000000000000000000000000000000000000000000000000000009060840162002240565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f06fdde03000000000000000000000000000000000000000000000000000000001790529051606091600091829173ffffffffffffffffffffffffffffffffffffffff861691620029dd9190620038e6565b600060405180830381855afa9150503d806000811462002a1a576040519150601f19603f3d011682016040523d82523d6000602084013e62002a1f565b606091505b50915091508162002a66576040518060400160405280600781526020017f4e4f5f4e414d450000000000000000000000000000000000000000000000000081525062001d74565b62001d748162002f21565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f95d89b41000000000000000000000000000000000000000000000000000000001790529051606091600091829173ffffffffffffffffffffffffffffffffffffffff86169162002af59190620038e6565b600060405180830381855afa9150503d806000811462002b32576040519150601f19603f3d011682016040523d82523d6000602084013e62002b37565b606091505b50915091508162002a66576040518060400160405280600981526020017f4e4f5f53594d424f4c000000000000000000000000000000000000000000000081525062001d74565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f313ce5670000000000000000000000000000000000000000000000000000000017905290516000918291829173ffffffffffffffffffffffffffffffffffffffff86169162002c019190620038e6565b600060405180830381855afa9150503d806000811462002c3e576040519150601f19603f3d011682016040523d82523d6000602084013e62002c43565b606091505b509150915081801562002c57575080516020145b62002c6457601262001d74565b8080602001905181019062001d74919062004012565b60018055565b60685460ff1662002cbd576040517f5386698100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040517f1e5e34eea33501aecf2ebec9fe0e884a40804275ea7fe10b2ba084c8374308b390600090a1565b600881901c60008181526069602052604081208054600160ff861690811b91821892839055929091908183169003620009c9576040517f646cf55800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600062002dd9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16620031119092919063ffffffff16565b80519091501562001f22578080602001905181019062002dfa919062004032565b62001f22576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840162001324565b600054610100900460ff1662002c7a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162001324565b6060604082511062002f435781806020019051810190620007a2919062004052565b8151602003620030d35760005b60208110801562002f9b575082818151811062002f715762002f7162003b8a565b01602001517fff000000000000000000000000000000000000000000000000000000000000001615155b1562002fb6578062002fad8162003be8565b91505062002f50565b8060000362002ffa57505060408051808201909152601281527f4e4f545f56414c49445f454e434f44494e4700000000000000000000000000006020820152919050565b60008167ffffffffffffffff81111562003018576200301862003891565b6040519080825280601f01601f19166020018201604052801562003043576020820181803683370190505b50905060005b82811015620030cb5784818151811062003067576200306762003b8a565b602001015160f81c60f81b82828151811062003087576200308762003b8a565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080620030c28162003be8565b91505062003049565b509392505050565b505060408051808201909152601281527f4e4f545f56414c49445f454e434f44494e470000000000000000000000000000602082015290565b919050565b606062001d748484600085856000808673ffffffffffffffffffffffffffffffffffffffff168587604051620031489190620038e6565b60006040518083038185875af1925050503d806000811462003187576040519150601f19603f3d011682016040523d82523d6000602084013e6200318c565b606091505b50915091506200319f87838387620031aa565b979650505050505050565b60608315620032455782516000036200323d5773ffffffffffffffffffffffffffffffffffffffff85163b6200323d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162001324565b508162001d74565b62001d7483838151156200325c5781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620013249190620040d2565b611b6680620040e883390190565b803563ffffffff811681146200310c57600080fd5b73ffffffffffffffffffffffffffffffffffffffff81168114620032d857600080fd5b50565b60008060408385031215620032ef57600080fd5b620032fa83620032a0565b915060208301356200330c81620032b5565b809150509250929050565b8015158114620032d857600080fd5b60008083601f8401126200333957600080fd5b50813567ffffffffffffffff8111156200335257600080fd5b6020830191508360208285010111156200336b57600080fd5b9250929050565b6000806000806000608086880312156200338b57600080fd5b6200339686620032a0565b94506020860135620033a881620032b5565b93506040860135620033ba8162003317565b9250606086013567ffffffffffffffff811115620033d757600080fd5b620033e58882890162003326565b969995985093965092949392505050565b806104008101831015620007a257600080fd5b60008060008060008060008060008060006105208c8e0312156200342c57600080fd5b620034388d8d620033f6565b9a50620034496104008d01620032a0565b99506104208c013598506104408c013597506200346a6104608d01620032a0565b96506104808c01356200347d81620032b5565b95506200348e6104a08d01620032a0565b94506104c08c0135620034a181620032b5565b93506104e08c013592506105008c013567ffffffffffffffff811115620034c757600080fd5b620034d58e828f0162003326565b915080935050809150509295989b509295989b9093969950565b6000602082840312156200350257600080fd5b81356200350f81620032b5565b9392505050565b60ff81168114620032d857600080fd5b600080600080600080600060e0888a0312156200354257600080fd5b87356200354f8162003516565b96506200355f60208901620032a0565b955060408801356200357181620032b5565b94506200358160608901620032a0565b935060808801356200359381620032b5565b9699959850939692959460a0840135945060c09093013592915050565b600080600060608486031215620035c657600080fd5b620035d184620032a0565b92506020840135620035e381620032b5565b91506040840135620035f581620032b5565b809150509250925092565b6000602082840312156200361357600080fd5b5035919050565b600080600080600080600060a0888a0312156200363657600080fd5b6200364188620032a0565b965060208801356200365381620032b5565b9550604088013567ffffffffffffffff808211156200367157600080fd5b6200367f8b838c0162003326565b909750955060608a01359150808211156200369957600080fd5b50620036a88a828b0162003326565b9094509250506080880135620036be8162003516565b8091505092959891949750929550565b600080600080600080600060c0888a031215620036ea57600080fd5b620036f588620032a0565b965060208801356200370781620032b5565b95506040880135945060608801356200372081620032b5565b93506080880135620037328162003317565b925060a088013567ffffffffffffffff8111156200374f57600080fd5b6200375d8a828b0162003326565b989b979a50959850939692959293505050565b60008060008061046085870312156200378857600080fd5b843593506200379b8660208701620033f6565b9250620037ac6104208601620032a0565b939692955092936104400135925050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b600061010060ff8c16835263ffffffff808c16602085015273ffffffffffffffffffffffffffffffffffffffff808c166040860152818b166060860152808a166080860152508760a08501528160c0850152620038678285018789620037bd565b925080851660e085015250509a9950505050505050505050565b8183823760009101908152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60005b83811015620038dd578181015183820152602001620038c3565b50506000910152565b60008251620038fa818460208701620038c0565b9190910192915050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156200394e576200394e62003891565b604052919050565b600067ffffffffffffffff82111562003973576200397362003891565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112620039b157600080fd5b8135620039c8620039c28262003956565b62003904565b818152846020838601011115620039de57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121562003a1157600080fd5b833567ffffffffffffffff8082111562003a2a57600080fd5b62003a38878388016200399f565b9450602086013591508082111562003a4f57600080fd5b5062003a5e868287016200399f565b9250506040840135620035f58162003516565b6000815180845262003a8b816020860160208601620038c0565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60608152600062003ad2606083018662003a71565b828103602084015262003ae6818662003a71565b91505060ff83166040830152949350505050565b63ffffffff86168152600073ffffffffffffffffffffffffffffffffffffffff8087166020840152808616604084015250608060608301526200319f608083018486620037bd565b73ffffffffffffffffffffffffffffffffffffffff8516815263ffffffff8416602082015260606040820152600062003b80606083018486620037bd565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820362003c1c5762003c1c62003bb9565b5060010190565b60608152600062003c39606083018789620037bd565b828103602084015262003c4e818688620037bd565b91505060ff831660408301529695505050505050565b6000835162003c78818460208801620038c0565b83519083019062003c8e818360208801620038c0565b01949350505050565b60006020828403121562003caa57600080fd5b5051919050565b81810381811115620007a257620007a262003bb9565b600061010060ff8b16835263ffffffff808b16602085015273ffffffffffffffffffffffffffffffffffffffff808b166040860152818a1660608601528089166080860152508660a08501528160c085015262003d278285018762003a71565b925080851660e085015250509998505050505050505050565b600181815b8085111562003d9f57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111562003d835762003d8362003bb9565b8085161562003d9157918102915b93841c939080029062003d45565b509250929050565b60008262003db857506001620007a2565b8162003dc757506000620007a2565b816001811462003de0576002811462003deb5762003e0b565b6001915050620007a2565b60ff84111562003dff5762003dff62003bb9565b50506001821b620007a2565b5060208310610133831016604e8410600b841016171562003e30575081810a620007a2565b62003e3c838362003d40565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111562003e715762003e7162003bb9565b029392505050565b60006200350f838362003da7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b6000808585111562003ec757600080fd5b8386111562003ed557600080fd5b5050820193919092039150565b7fffffffff00000000000000000000000000000000000000000000000000000000813581811691600485101562003f235780818660040360031b1b83161692505b505092915050565b600080600080600080600060e0888a03121562003f4757600080fd5b873562003f5481620032b5565b9650602088013562003f6681620032b5565b955060408801359450606088013593506080880135620035938162003516565b600080600080600080600080610100898b03121562003fa457600080fd5b883562003fb181620032b5565b9750602089013562003fc381620032b5565b96506040890135955060608901359450608089013562003fe38162003317565b935060a089013562003ff58162003516565b979a969950949793969295929450505060c08201359160e0013590565b6000602082840312156200402557600080fd5b81516200350f8162003516565b6000602082840312156200404557600080fd5b81516200350f8162003317565b6000602082840312156200406557600080fd5b815167ffffffffffffffff8111156200407d57600080fd5b8201601f810184136200408f57600080fd5b8051620040a0620039c28262003956565b818152856020838501011115620040b657600080fd5b620040c9826020830160208601620038c0565b95945050505050565b6020815260006200350f602083018462003a7156fe6101006040523480156200001257600080fd5b5060405162001b6638038062001b6683398101604081905262000035916200028d565b82826003620000458382620003a1565b506004620000548282620003a1565b50503360c0525060ff811660e052466080819052620000739062000080565b60a052506200046d915050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f620000ad6200012e565b805160209182012060408051808201825260018152603160f81b90840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b6060600380546200013f9062000312565b80601f01602080910402602001604051908101604052809291908181526020018280546200016d9062000312565b8015620001be5780601f106200019257610100808354040283529160200191620001be565b820191906000526020600020905b815481529060010190602001808311620001a057829003601f168201915b5050505050905090565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620001f057600080fd5b81516001600160401b03808211156200020d576200020d620001c8565b604051601f8301601f19908116603f01168101908282118183101715620002385762000238620001c8565b816040528381526020925086838588010111156200025557600080fd5b600091505b838210156200027957858201830151818301840152908201906200025a565b600093810190920192909252949350505050565b600080600060608486031215620002a357600080fd5b83516001600160401b0380821115620002bb57600080fd5b620002c987838801620001de565b94506020860151915080821115620002e057600080fd5b50620002ef86828701620001de565b925050604084015160ff811681146200030757600080fd5b809150509250925092565b600181811c908216806200032757607f821691505b6020821081036200034857634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200039c57600081815260208120601f850160051c81016020861015620003775750805b601f850160051c820191505b81811015620003985782815560010162000383565b5050505b505050565b81516001600160401b03811115620003bd57620003bd620001c8565b620003d581620003ce845462000312565b846200034e565b602080601f8311600181146200040d5760008415620003f45750858301515b600019600386901b1c1916600185901b17855562000398565b600085815260208120601f198616915b828110156200043e578886015182559484019460019091019084016200041d565b50858210156200045d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e0516116aa620004bc6000396000610237015260008181610307015281816105c001526106a70152600061053a015260008181610379015261050401526116aa6000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806370a08231116100d8578063a457c2d71161008c578063d505accf11610066578063d505accf1461039b578063dd62ed3e146103ae578063ffa1ad74146103f457600080fd5b8063a457c2d71461034e578063a9059cbb14610361578063cd0d00961461037457600080fd5b806395d89b41116100bd57806395d89b41146102e75780639dc29fac146102ef578063a3c573eb1461030257600080fd5b806370a08231146102915780637ecebe00146102c757600080fd5b806330adf81f1161012f5780633644e515116101145780633644e51514610261578063395093511461026957806340c10f191461027c57600080fd5b806330adf81f14610209578063313ce5671461023057600080fd5b806318160ddd1161016057806318160ddd146101bd57806320606b70146101cf57806323b872dd146101f657600080fd5b806306fdde031461017c578063095ea7b31461019a575b600080fd5b610184610430565b60405161019191906113e4565b60405180910390f35b6101ad6101a8366004611479565b6104c2565b6040519015158152602001610191565b6002545b604051908152602001610191565b6101c17f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81565b6101ad6102043660046114a3565b6104dc565b6101c17f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152602001610191565b6101c1610500565b6101ad610277366004611479565b61055c565b61028f61028a366004611479565b6105a8565b005b6101c161029f3660046114df565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6101c16102d53660046114df565b60056020526000908152604090205481565b610184610680565b61028f6102fd366004611479565b61068f565b6103297f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610191565b6101ad61035c366004611479565b61075e565b6101ad61036f366004611479565b61082f565b6101c17f000000000000000000000000000000000000000000000000000000000000000081565b61028f6103a9366004611501565b61083d565b6101c16103bc366004611574565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6101846040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525081565b60606003805461043f906115a7565b80601f016020809104026020016040519081016040528092919081815260200182805461046b906115a7565b80156104b85780601f1061048d576101008083540402835291602001916104b8565b820191906000526020600020905b81548152906001019060200180831161049b57829003601f168201915b5050505050905090565b6000336104d0818585610b73565b60019150505b92915050565b6000336104ea858285610d27565b6104f5858585610dfe565b506001949350505050565b60007f00000000000000000000000000000000000000000000000000000000000000004614610537576105324661106d565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091906104d090829086906105a3908790611629565b610b73565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610672576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d4272696467650000000000000000000000000000000060648201526084015b60405180910390fd5b61067c8282611135565b5050565b60606004805461043f906115a7565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610754576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d427269646765000000000000000000000000000000006064820152608401610669565b61067c8282611228565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015610822576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610669565b6104f58286868403610b73565b6000336104d0818585610dfe565b834211156108cc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f546f6b656e577261707065643a3a7065726d69743a204578706972656420706560448201527f726d6974000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8716600090815260056020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918a918a918a9190866109268361163c565b9091555060408051602081019690965273ffffffffffffffffffffffffffffffffffffffff94851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000610991610500565b6040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281019190915260428101839052606201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa158015610a55573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590610ad057508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b610b5c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f546f6b656e577261707065643a3a7065726d69743a20496e76616c696420736960448201527f676e6174757265000000000000000000000000000000000000000000000000006064820152608401610669565b610b678a8a8a610b73565b50505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff8316610c15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610cb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610df85781811015610deb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610669565b610df88484848403610b73565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610ea1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610f44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610ffa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610df8565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f611098610430565b8051602091820120604080518082018252600181527f310000000000000000000000000000000000000000000000000000000000000090840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b73ffffffffffffffffffffffffffffffffffffffff82166111b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610669565b80600260008282546111c49190611629565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff82166112cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205481811015611381576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610d1a565b600060208083528351808285015260005b81811015611411578581018301518582016040015282016113f5565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461147457600080fd5b919050565b6000806040838503121561148c57600080fd5b61149583611450565b946020939093013593505050565b6000806000606084860312156114b857600080fd5b6114c184611450565b92506114cf60208501611450565b9150604084013590509250925092565b6000602082840312156114f157600080fd5b6114fa82611450565b9392505050565b600080600080600080600060e0888a03121561151c57600080fd5b61152588611450565b965061153360208901611450565b95506040880135945060608801359350608088013560ff8116811461155757600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561158757600080fd5b61159083611450565b915061159e60208401611450565b90509250929050565b600181811c908216806115bb57607f821691505b6020821081036115f4577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156104d6576104d66115fa565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361166d5761166d6115fa565b506001019056fea26469706673582212208d88fee561cff7120d381c345cfc534cef8229a272dc5809d4bbb685ad67141164736f6c63430008110033a2646970667358221220addfd62f466d34ee002afbb4ae37b6be56ad421fe773f800badeb4ce1025089864736f6c63430008110033" +
    +
    + 41 + +
    + - + }, +
    +
    + 42 + +
    + - + { +
    +
    + 43 + +
    + - + "contractName": "PolygonZkEVMBridge proxy", +
    +
    + 44 + +
    + - + "balance": "200000000000000000000000000", +
    +
    + 45 + +
    + - + "nonce": "1", +
    +
    + 46 + +
    + - + "address": "0xF6BEEeBB578e214CA9E23B0e9683454Ff88Ed2A7", +
    +
    + 47 + +
    + - + "bytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461088b565b610135565b61006b6100a33660046108a6565b61017f565b3480156100b457600080fd5b506100bd6101f3565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461088b565b610231565b34801561011257600080fd5b506100bd61025e565b6101236102d4565b61013361012e6103ab565b6103b5565b565b61013d6103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481604051806020016040528060008152506000610419565b50565b61017461011b565b6101876103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101eb576101e68383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610419915050565b505050565b6101e661011b565b60006101fd6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103ab565b905090565b61022e61011b565b90565b6102396103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481610444565b60006102686103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103d9565b60606102b183836040518060600160405280602781526020016109bb602791396104a5565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b6102dc6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b600061022161052a565b3660008037600080366000845af43d6000803e8080156103d4573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b61042283610552565b60008251118061042f5750805b156101e65761043e838361028c565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61046d6103d9565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a16101748161059f565b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516104cf919061094d565b600060405180830381855af49150503d806000811461050a576040519150601f19603f3d011682016040523d82523d6000602084013e61050f565b606091505b5091509150610520868383876106ab565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6103fd565b61055b81610753565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff8116610642576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103a2565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b6060831561074157825160000361073a5773ffffffffffffffffffffffffffffffffffffffff85163b61073a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103a2565b508161074b565b61074b838361081e565b949350505050565b73ffffffffffffffffffffffffffffffffffffffff81163b6107f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e74726163740000000000000000000000000000000000000060648201526084016103a2565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610665565b81511561082e5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a29190610969565b803573ffffffffffffffffffffffffffffffffffffffff8116811461088657600080fd5b919050565b60006020828403121561089d57600080fd5b6102b182610862565b6000806000604084860312156108bb57600080fd5b6108c484610862565b9250602084013567ffffffffffffffff808211156108e157600080fd5b818601915086601f8301126108f557600080fd5b81358181111561090457600080fd5b87602082850101111561091657600080fd5b6020830194508093505050509250925092565b60005b8381101561094457818101518382015260200161092c565b50506000910152565b6000825161095f818460208701610929565b9190910192915050565b6020815260008251806020840152610988816040850160208701610929565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220a1af0d6cb4f1e31496a4c5c1448913bce4bd6ad3a39e47c6f7190c114d6f9bf464736f6c63430008110033", +
    +
    + 48 + +
    + - + "storage": { +
    +
    + 49 + +
    + - + "0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000000000000000000000000000000000000000000001", +
    +
    + 50 + +
    + - + "0x0000000000000000000000000000000000000000000000000000000000000001": "0x0000000000000000000000000000000000000000000000000000000000000001", +
    +
    + 51 + +
    + - + "0x0000000000000000000000000000000000000000000000000000000000000068": "0x00000000000000a40d5f56745a118d0906a34e69aec8c0db1cb8fa0000000100", +
    +
    + 52 + +
    + - + "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x00000000000000000000000040797c2f93298a44a893f43edf1b33b63d7ba333", +
    +
    + 53 + +
    + - + "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x00000000000000000000000039e780d8800f7396e8b7530a8925b14025aedc77" +
    +
    + 54 + +
    + - + } +
    +
    + 55 + +
    + - + }, +
    +
    + 56 + +
    + - + { +
    +
    + 57 + +
    + - + "contractName": "PolygonZkEVMGlobalExitRootL2 implementation", +
    +
    + 58 + +
    + - + "balance": "0", +
    +
    + 59 + +
    + - + "nonce": "1", +
    +
    + 60 + +
    + - + "address": "0x77Fc57b154fCF8320Df2C2e6C044AA50141c023b", +
    +
    + 61 + +
    + - + "bytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806301fd904414610051578063257b36321461006d57806333d6247d1461008d578063a3c573eb146100a2575b600080fd5b61005a60015481565b6040519081526020015b60405180910390f35b61005a61007b366004610162565b60006020819052908152604090205481565b6100a061009b366004610162565b6100ee565b005b6100c97f000000000000000000000000f6beeebb578e214ca9e23b0e9683454ff88ed2a781565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610064565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000f6beeebb578e214ca9e23b0e9683454ff88ed2a7161461015d576040517fb49365dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600155565b60006020828403121561017457600080fd5b503591905056fea2646970667358221220a187fc278346c1b61c449ea3641002b6eac2bda3351a122a12c35099f933696864736f6c63430008110033" +
    +
    + 62 + +
    + - + }, +
    +
    + 63 + +
    + - + { +
    +
    + 64 + +
    + - + "contractName": "PolygonZkEVMGlobalExitRootL2 proxy", +
    +
    + 65 + +
    + - + "balance": "0", +
    +
    + 66 + +
    + - + "nonce": "1", +
    +
    + 67 + +
    + - + "address": "0xa40d5f56745a118d0906a34e69aec8c0db1cb8fa", +
    +
    + 68 + +
    + - + "bytecode": "0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100855780635c60da1b146100985780638f283970146100c9578063f851a440146100e95761005d565b3661005d5761005b6100fe565b005b61005b6100fe565b34801561007157600080fd5b5061005b6100803660046106ca565b610118565b61005b6100933660046106e5565b61015f565b3480156100a457600080fd5b506100ad6101d0565b6040516001600160a01b03909116815260200160405180910390f35b3480156100d557600080fd5b5061005b6100e43660046106ca565b61020b565b3480156100f557600080fd5b506100ad610235565b610106610292565b610116610111610331565b61033b565b565b61012061035f565b6001600160a01b0316336001600160a01b031614156101575761015481604051806020016040528060008152506000610392565b50565b6101546100fe565b61016761035f565b6001600160a01b0316336001600160a01b031614156101c8576101c38383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610392915050565b505050565b6101c36100fe565b60006101da61035f565b6001600160a01b0316336001600160a01b03161415610200576101fb610331565b905090565b6102086100fe565b90565b61021361035f565b6001600160a01b0316336001600160a01b0316141561015757610154816103f1565b600061023f61035f565b6001600160a01b0316336001600160a01b03161415610200576101fb61035f565b606061028583836040518060600160405280602781526020016107e460279139610445565b9392505050565b3b151590565b61029a61035f565b6001600160a01b0316336001600160a01b031614156101165760405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b60006101fb610519565b3660008037600080366000845af43d6000803e80801561035a573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b61039b83610541565b6040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a26000825111806103dc5750805b156101c3576103eb8383610260565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61041a61035f565b604080516001600160a01b03928316815291841660208301520160405180910390a1610154816105e9565b6060833b6104a45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610328565b600080856001600160a01b0316856040516104bf9190610794565b600060405180830381855af49150503d80600081146104fa576040519150601f19603f3d011682016040523d82523d6000602084013e6104ff565b606091505b509150915061050f828286610675565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610383565b803b6105a55760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610328565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5b80546001600160a01b0319166001600160a01b039290921691909117905550565b6001600160a01b03811661064e5760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401610328565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61036105c8565b60608315610684575081610285565b8251156106945782518084602001fd5b8160405162461bcd60e51b815260040161032891906107b0565b80356001600160a01b03811681146106c557600080fd5b919050565b6000602082840312156106dc57600080fd5b610285826106ae565b6000806000604084860312156106fa57600080fd5b610703846106ae565b9250602084013567ffffffffffffffff8082111561072057600080fd5b818601915086601f83011261073457600080fd5b81358181111561074357600080fd5b87602082850101111561075557600080fd5b6020830194508093505050509250925092565b60005b8381101561078357818101518382015260200161076b565b838111156103eb5750506000910152565b600082516107a6818460208701610768565b9190910192915050565b60208152600082518060208401526107cf816040850160208701610768565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212204675187caf3a43285d9a2c1844a981e977bd52a85ff073e7fc649f73847d70a464736f6c63430008090033", +
    +
    + 69 + +
    + - + "storage": { +
    +
    + 70 + +
    + - + "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x00000000000000000000000040797c2f93298a44a893f43edf1b33b63d7ba333", +
    +
    + 71 + +
    + - + "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x00000000000000000000000077fc57b154fcf8320df2c2e6c044aa50141c023b" +
    +
    + 72 + +
    + - + } +
    +
    + 73 + +
    + - + }, +
    +
    + 74 + +
    + - + { +
    +
    + 75 + +
    + - + "contractName": "PolygonZkEVMTimelock", +
    +
    + 76 + +
    + - + "balance": "0", +
    +
    + 77 + +
    + - + "nonce": "1", +
    +
    + 78 + +
    + - + "address": "0x02245d7B6CB0b6870d1e28AC877EE355b9588869", +
    +
    + 79 + +
    + - + "bytecode": "0x6080604052600436106101c65760003560e01c806364d62353116100f7578063b1c5f42711610095578063d547741f11610064578063d547741f14610661578063e38335e514610681578063f23a6e6114610694578063f27a0c92146106d957600080fd5b8063b1c5f427146105af578063bc197c81146105cf578063c4d252f514610614578063d45c44351461063457600080fd5b80638f61f4f5116100d15780638f61f4f5146104e157806391d1485414610515578063a217fddf14610566578063b08e51c01461057b57600080fd5b806364d62353146104815780638065657f146104a15780638f2a0bb0146104c157600080fd5b8063248a9ca31161016457806331d507501161013e57806331d50750146103c857806336568abe146103e85780633a6aae7214610408578063584b153e1461046157600080fd5b8063248a9ca3146103475780632ab0f529146103775780632f2ff15d146103a857600080fd5b80630d3cf6fc116101a05780630d3cf6fc1461026b578063134008d31461029f57806313bc9f20146102b2578063150b7a02146102d257600080fd5b806301d5062a146101d257806301ffc9a7146101f457806307bd02651461022957600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506101f26101ed366004611c12565b6106ee565b005b34801561020057600080fd5b5061021461020f366004611c87565b610783565b60405190151581526020015b60405180910390f35b34801561023557600080fd5b5061025d7fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e6381565b604051908152602001610220565b34801561027757600080fd5b5061025d7f5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca581565b6101f26102ad366004611cc9565b6107df565b3480156102be57600080fd5b506102146102cd366004611d35565b6108d7565b3480156102de57600080fd5b506103166102ed366004611e5a565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610220565b34801561035357600080fd5b5061025d610362366004611d35565b60009081526020819052604090206001015490565b34801561038357600080fd5b50610214610392366004611d35565b6000908152600160208190526040909120541490565b3480156103b457600080fd5b506101f26103c3366004611ec2565b6108fd565b3480156103d457600080fd5b506102146103e3366004611d35565b610927565b3480156103f457600080fd5b506101f2610403366004611ec2565b610940565b34801561041457600080fd5b5061043c7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610220565b34801561046d57600080fd5b5061021461047c366004611d35565b6109f8565b34801561048d57600080fd5b506101f261049c366004611d35565b610a0e565b3480156104ad57600080fd5b5061025d6104bc366004611cc9565b610ade565b3480156104cd57600080fd5b506101f26104dc366004611f33565b610b1d565b3480156104ed57600080fd5b5061025d7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc181565b34801561052157600080fd5b50610214610530366004611ec2565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b34801561057257600080fd5b5061025d600081565b34801561058757600080fd5b5061025d7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f78381565b3480156105bb57600080fd5b5061025d6105ca366004611fe5565b610d4f565b3480156105db57600080fd5b506103166105ea36600461210e565b7fbc197c810000000000000000000000000000000000000000000000000000000095945050505050565b34801561062057600080fd5b506101f261062f366004611d35565b610d94565b34801561064057600080fd5b5061025d61064f366004611d35565b60009081526001602052604090205490565b34801561066d57600080fd5b506101f261067c366004611ec2565b610e8f565b6101f261068f366004611fe5565b610eb4565b3480156106a057600080fd5b506103166106af3660046121b8565b7ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b3480156106e557600080fd5b5061025d611161565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc161071881611204565b6000610728898989898989610ade565b90506107348184611211565b6000817f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8b8b8b8b8b8a60405161077096959493929190612266565b60405180910390a3505050505050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f4e2312e00000000000000000000000000000000000000000000000000000000014806107d957506107d98261135e565b92915050565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff1661085c5761085c81336113f5565b600061086c888888888888610ade565b905061087881856114ad565b610884888888886115ea565b6000817fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588a8a8a8a6040516108bc94939291906122b1565b60405180910390a36108cd816116ee565b5050505050505050565b6000818152600160205260408120546001811180156108f65750428111155b9392505050565b60008281526020819052604090206001015461091881611204565b6109228383611797565b505050565b60008181526001602052604081205481905b1192915050565b73ffffffffffffffffffffffffffffffffffffffff811633146109ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6109f48282611887565b5050565b6000818152600160208190526040822054610939565b333014610a9d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f54696d656c6f636b436f6e74726f6c6c65723a2063616c6c6572206d7573742060448201527f62652074696d656c6f636b00000000000000000000000000000000000000000060648201526084016109e1565b60025460408051918252602082018390527f11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d5910160405180910390a1600255565b6000868686868686604051602001610afb96959493929190612266565b6040516020818303038152906040528051906020012090509695505050505050565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1610b4781611204565b888714610bd6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b888514610c65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b6000610c778b8b8b8b8b8b8b8b610d4f565b9050610c838184611211565b60005b8a811015610d415780827f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8e8e85818110610cc357610cc36122f1565b9050602002016020810190610cd89190612320565b8d8d86818110610cea57610cea6122f1565b905060200201358c8c87818110610d0357610d036122f1565b9050602002810190610d15919061233b565b8c8b604051610d2996959493929190612266565b60405180910390a3610d3a816123cf565b9050610c86565b505050505050505050505050565b60008888888888888888604051602001610d709897969594939291906124b7565b60405160208183030381529060405280519060200120905098975050505050505050565b7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f783610dbe81611204565b610dc7826109f8565b610e53576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20636160448201527f6e6e6f742062652063616e63656c6c656400000000000000000000000000000060648201526084016109e1565b6000828152600160205260408082208290555183917fbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb7091a25050565b600082815260208190526040902060010154610eaa81611204565b6109228383611887565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff16610f3157610f3181336113f5565b878614610fc0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b87841461104f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b60006110618a8a8a8a8a8a8a8a610d4f565b905061106d81856114ad565b60005b8981101561114b5760008b8b8381811061108c5761108c6122f1565b90506020020160208101906110a19190612320565b905060008a8a848181106110b7576110b76122f1565b9050602002013590503660008a8a868181106110d5576110d56122f1565b90506020028101906110e7919061233b565b915091506110f7848484846115ea565b84867fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588686868660405161112e94939291906122b1565b60405180910390a35050505080611144906123cf565b9050611070565b50611155816116ee565b50505050505050505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166315064c966040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111f2919061257e565b156111fd5750600090565b5060025490565b61120e81336113f5565b50565b61121a82610927565b156112a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20616c60448201527f7265616479207363686564756c6564000000000000000000000000000000000060648201526084016109e1565b6112af611161565b81101561133e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a20696e73756666696369656e7460448201527f2064656c6179000000000000000000000000000000000000000000000000000060648201526084016109e1565b61134881426125a0565b6000928352600160205260409092209190915550565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806107d957507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146107d9565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f4576114338161193e565b61143e83602061195d565b60405160200161144f9291906125d7565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526109e191600401612658565b6114b6826108d7565b611542576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b80158061155e5750600081815260016020819052604090912054145b6109f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a206d697373696e67206465706560448201527f6e64656e6379000000000000000000000000000000000000000000000000000060648201526084016109e1565b60008473ffffffffffffffffffffffffffffffffffffffff168484846040516116149291906126a9565b60006040518083038185875af1925050503d8060008114611651576040519150601f19603f3d011682016040523d82523d6000602084013e611656565b606091505b50509050806116e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f54696d656c6f636b436f6e74726f6c6c65723a20756e6465726c79696e67207460448201527f72616e73616374696f6e2072657665727465640000000000000000000000000060648201526084016109e1565b5050505050565b6116f7816108d7565b611783576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b600090815260016020819052604090912055565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556118293390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60606107d973ffffffffffffffffffffffffffffffffffffffff831660145b6060600061196c8360026126b9565b6119779060026125a0565b67ffffffffffffffff81111561198f5761198f611d4e565b6040519080825280601f01601f1916602001820160405280156119b9576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106119f0576119f06122f1565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611a5357611a536122f1565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000611a8f8460026126b9565b611a9a9060016125a0565b90505b6001811115611b37577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611adb57611adb6122f1565b1a60f81b828281518110611af157611af16122f1565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611b30816126d0565b9050611a9d565b5083156108f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109e1565b803573ffffffffffffffffffffffffffffffffffffffff81168114611bc457600080fd5b919050565b60008083601f840112611bdb57600080fd5b50813567ffffffffffffffff811115611bf357600080fd5b602083019150836020828501011115611c0b57600080fd5b9250929050565b600080600080600080600060c0888a031215611c2d57600080fd5b611c3688611ba0565b965060208801359550604088013567ffffffffffffffff811115611c5957600080fd5b611c658a828b01611bc9565b989b979a50986060810135976080820135975060a09091013595509350505050565b600060208284031215611c9957600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146108f657600080fd5b60008060008060008060a08789031215611ce257600080fd5b611ceb87611ba0565b955060208701359450604087013567ffffffffffffffff811115611d0e57600080fd5b611d1a89828a01611bc9565b979a9699509760608101359660809091013595509350505050565b600060208284031215611d4757600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611dc457611dc4611d4e565b604052919050565b600082601f830112611ddd57600080fd5b813567ffffffffffffffff811115611df757611df7611d4e565b611e2860207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601611d7d565b818152846020838601011115611e3d57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215611e7057600080fd5b611e7985611ba0565b9350611e8760208601611ba0565b925060408501359150606085013567ffffffffffffffff811115611eaa57600080fd5b611eb687828801611dcc565b91505092959194509250565b60008060408385031215611ed557600080fd5b82359150611ee560208401611ba0565b90509250929050565b60008083601f840112611f0057600080fd5b50813567ffffffffffffffff811115611f1857600080fd5b6020830191508360208260051b8501011115611c0b57600080fd5b600080600080600080600080600060c08a8c031215611f5157600080fd5b893567ffffffffffffffff80821115611f6957600080fd5b611f758d838e01611eee565b909b50995060208c0135915080821115611f8e57600080fd5b611f9a8d838e01611eee565b909950975060408c0135915080821115611fb357600080fd5b50611fc08c828d01611eee565b9a9d999c50979a969997986060880135976080810135975060a0013595509350505050565b60008060008060008060008060a0898b03121561200157600080fd5b883567ffffffffffffffff8082111561201957600080fd5b6120258c838d01611eee565b909a50985060208b013591508082111561203e57600080fd5b61204a8c838d01611eee565b909850965060408b013591508082111561206357600080fd5b506120708b828c01611eee565b999c989b509699959896976060870135966080013595509350505050565b600082601f83011261209f57600080fd5b8135602067ffffffffffffffff8211156120bb576120bb611d4e565b8160051b6120ca828201611d7d565b92835284810182019282810190878511156120e457600080fd5b83870192505b84831015612103578235825291830191908301906120ea565b979650505050505050565b600080600080600060a0868803121561212657600080fd5b61212f86611ba0565b945061213d60208701611ba0565b9350604086013567ffffffffffffffff8082111561215a57600080fd5b61216689838a0161208e565b9450606088013591508082111561217c57600080fd5b61218889838a0161208e565b9350608088013591508082111561219e57600080fd5b506121ab88828901611dcc565b9150509295509295909350565b600080600080600060a086880312156121d057600080fd5b6121d986611ba0565b94506121e760208701611ba0565b93506040860135925060608601359150608086013567ffffffffffffffff81111561221157600080fd5b6121ab88828901611dcc565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b73ffffffffffffffffffffffffffffffffffffffff8716815285602082015260a06040820152600061229c60a08301868861221d565b60608301949094525060800152949350505050565b73ffffffffffffffffffffffffffffffffffffffff851681528360208201526060604082015260006122e760608301848661221d565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561233257600080fd5b6108f682611ba0565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261237057600080fd5b83018035915067ffffffffffffffff82111561238b57600080fd5b602001915036819003821315611c0b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612400576124006123a0565b5060010190565b81835260006020808501808196508560051b810191508460005b878110156124aa57828403895281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe188360301811261246057600080fd5b8701858101903567ffffffffffffffff81111561247c57600080fd5b80360382131561248b57600080fd5b61249686828461221d565b9a87019a9550505090840190600101612421565b5091979650505050505050565b60a0808252810188905260008960c08301825b8b8110156125055773ffffffffffffffffffffffffffffffffffffffff6124f084611ba0565b168252602092830192909101906001016124ca565b5083810360208501528881527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff89111561253e57600080fd5b8860051b9150818a602083013701828103602090810160408501526125669082018789612407565b60608401959095525050608001529695505050505050565b60006020828403121561259057600080fd5b815180151581146108f657600080fd5b808201808211156107d9576107d96123a0565b60005b838110156125ce5781810151838201526020016125b6565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161260f8160178501602088016125b3565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161264c8160288401602088016125b3565b01602801949350505050565b60208152600082518060208401526126778160408501602087016125b3565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b8183823760009101908152919050565b80820281158282048414176107d9576107d96123a0565b6000816126df576126df6123a0565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea2646970667358221220288c3dd40a2ba96edf066502722584177809ebdb47c0cf9ee8df6f07954c373064736f6c63430008110033", +
    +
    + 80 + +
    + - + "storage": { +
    +
    + 81 + +
    + - + "0x0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000000000000000015180", +
    +
    + 82 + +
    + - + "0xbdd73c6ebfb442c137537be0985acf11af8e6133078bc51ef9094071cb0ca475": "0x0000000000000000000000000000000000000000000000000000000000000001", +
    +
    + 83 + +
    + - + "0x92b79801e6a3d148a516c908cc0bbad93771fa74468b7757a14aa55532d092de": "0x0000000000000000000000000000000000000000000000000000000000000001", +
    +
    + 84 + +
    + - + "0x64494413541ff93b31aa309254e3fed72a7456e9845988b915b4c7a7ceba8814": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", +
    +
    + 85 + +
    + - + "0x43e090632490f7d46c400129311fff008a7688bb3d4aebdf80607456b452cf04": "0x0000000000000000000000000000000000000000000000000000000000000001", +
    +
    + 86 + +
    + - + "0x3412d5605ac6cd444957cedb533e5dacad6378b4bc819ebe3652188a665066d6": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", +
    +
    + 87 + +
    + - + "0x5af21cf0316499c6925cf9be0331b8bd150a1fa4c19d24a043b45f0cf15357c3": "0x0000000000000000000000000000000000000000000000000000000000000001", +
    +
    + 88 + +
    + - + "0xdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d706a": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", +
    +
    + 89 + +
    + - + "0xaf021eeb38644155cd697b3ce0ec4fdac818d29c448a9f9d9bafc293723c6cd8": "0x0000000000000000000000000000000000000000000000000000000000000001", +
    +
    + 90 + +
    + - + "0xc3ad33e20b0c56a223ad5104fff154aa010f8715b9c981fd38fdc60a4d1a52fc": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5" +
    +
    + 91 + +
    + - + } +
    +
    + 92 + +
    + - + }, +
    +
    + 93 + +
    + - + { +
    +
    + 94 + +
    + - + "accountName": "keyless Deployer", +
    +
    + 95 + +
    + - + "balance": "0", +
    +
    + 96 + +
    + - + "nonce": "1", +
    +
    + 97 + +
    + - + "address": "0xB83a574B3966F7dc1d38d162FA154F2A57D608Bb" +
    +
    + 98 + +
    + - + }, +
    +
    + 99 + +
    + - + { +
    +
    + 100 + +
    + - + "accountName": "deployer", +
    +
    + 101 + +
    + - + "balance": "0", +
    +
    + 102 + +
    + - + "nonce": "8", +
    +
    + 103 + +
    + - + "address": "0xA0B02B28920812324f1cC3255bd8840867d3f227" +
    +
    + 104 + +
    + - + } +
    +
    + 105 + +
    + - + ] +
    +
    + 106 + +
    + - + } +
    +
    + 107 + +
    + - +
    +
    +
    + 108 + +
    + - + ` +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/config/types/duration.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -38,3 +38,13 @@
    +
    + 38 + +
    +   + }, +
    +
    + 39 + +
    +   + } +
    +
    + 40 + +
    +   + } +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 38 + +
    +   + }, +
    +
    + 39 + +
    +   + } +
    +
    + 40 + +
    +   + } +
    +
    + 41 + +
    + + +
    +
    +
    + 42 + +
    + + + // MarshalJSON marshalls time duration into text. +
    +
    + 43 + +
    + + + func (d Duration) MarshalJSON() ([]byte, error) { +
    +
    + 44 + +
    + + + return []byte(`"` + d.String() + `"`), nil +
    +
    + 45 + +
    + + + } +
    +
    + 46 + +
    + + +
    +
    +
    + 47 + +
    + + + // MarshalText marshalls time duration into text. +
    +
    + 48 + +
    + + + func (d *Duration) MarshalText() ([]byte, error) { +
    +
    + 49 + +
    + + + return []byte(d.String()), nil +
    +
    + 50 + +
    + + + } +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/config.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -0,0 +1,9 @@
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 1 + +
    + + + package dataavailability +
    +
    + 2 + +
    + + +
    +
    +
    + 3 + +
    + + + // DABackendType is the data availability protocol for the CDK +
    +
    + 4 + +
    + + + type DABackendType string +
    +
    + 5 + +
    + + +
    +
    +
    + 6 + +
    + + + const ( +
    +
    + 7 + +
    + + + // DataAvailabilityCommittee is the DAC protocol backend +
    +
    + 8 + +
    + + + DataAvailabilityCommittee DABackendType = "DataAvailabilityCommittee" +
    +
    + 9 + +
    + + + ) +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/dataavailability.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -0,0 +1,152 @@
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 1 + +
    + + + package dataavailability +
    +
    + 2 + +
    + + +
    +
    +
    + 3 + +
    + + + import ( +
    +
    + 4 + +
    + + + "context" +
    +
    + 5 + +
    + + + "fmt" +
    +
    + 6 + +
    + + + "math/big" +
    +
    + 7 + +
    + + +
    +
    +
    + 8 + +
    + + + "github.com/0xPolygonHermez/zkevm-node/etherman/types" +
    +
    + 9 + +
    + + + jsontypes "github.com/0xPolygonHermez/zkevm-node/jsonrpc/types" +
    +
    + 10 + +
    + + + "github.com/0xPolygonHermez/zkevm-node/log" +
    +
    + 11 + +
    + + + "github.com/ethereum/go-ethereum/common" +
    +
    + 12 + +
    + + + "github.com/ethereum/go-ethereum/crypto" +
    +
    + 13 + +
    + + + ) +
    +
    + 14 + +
    + + +
    +
    +
    + 15 + +
    + + + const ( +
    +
    + 16 + +
    + + + unexpectedHashTemplate = "mismatch on transaction data for batch num %d. Expected hash %s, actual hash: %s" +
    +
    + 17 + +
    + + + failedDataRetrievalTemplate = "failed to retrieve local data for batches %v: %s" +
    +
    + 18 + +
    + + + invalidBatchRetrievalArgs = "invalid L2 batch data retrieval arguments, %d != %d" +
    +
    + 19 + +
    + + + ) +
    +
    + 20 + +
    + + +
    +
    +
    + 21 + +
    + + + // DataAvailability implements an abstract data availability integration +
    +
    + 22 + +
    + + + type DataAvailability struct { +
    +
    + 23 + +
    + + + isTrustedSequencer bool +
    +
    + 24 + +
    + + +
    +
    +
    + 25 + +
    + + + state stateInterface +
    +
    + 26 + +
    + + + zkEVMClient ZKEVMClientTrustedBatchesGetter +
    +
    + 27 + +
    + + + backend DABackender +
    +
    + 28 + +
    + + +
    +
    +
    + 29 + +
    + + + ctx context.Context +
    +
    + 30 + +
    + + + } +
    +
    + 31 + +
    + + +
    +
    +
    + 32 + +
    + + + // New creates a DataAvailability instance +
    +
    + 33 + +
    + + + func New( +
    +
    + 34 + +
    + + + isTrustedSequencer bool, +
    +
    + 35 + +
    + + + backend DABackender, +
    +
    + 36 + +
    + + + state stateInterface, +
    +
    + 37 + +
    + + + zkEVMClient ZKEVMClientTrustedBatchesGetter, +
    +
    + 38 + +
    + + + ) (*DataAvailability, error) { +
    +
    + 39 + +
    + + + da := &DataAvailability{ +
    +
    + 40 + +
    + + + isTrustedSequencer: isTrustedSequencer, +
    +
    + 41 + +
    + + + backend: backend, +
    +
    + 42 + +
    + + + state: state, +
    +
    + 43 + +
    + + + zkEVMClient: zkEVMClient, +
    +
    + 44 + +
    + + + ctx: context.Background(), +
    +
    + 45 + +
    + + + } +
    +
    + 46 + +
    + + + err := da.backend.Init() +
    +
    + 47 + +
    + + + return da, err +
    +
    + 48 + +
    + + + } +
    +
    + 49 + +
    + + +
    +
    +
    + 50 + +
    + + + // PostSequence sends the sequence data to the data availability backend, and returns the dataAvailabilityMessage +
    +
    + 51 + +
    + + + // as expected by the contract +
    +
    + 52 + +
    + + + func (d *DataAvailability) PostSequence(ctx context.Context, sequences []types.Sequence) ([]byte, error) { +
    +
    + 53 + +
    + + + batchesData := [][]byte{} +
    +
    + 54 + +
    + + + for _, batch := range sequences { +
    +
    + 55 + +
    + + + // Do not send to the DA backend data that will be stored to L1 +
    +
    + 56 + +
    + + + if batch.ForcedBatchTimestamp == 0 { +
    +
    + 57 + +
    + + + batchesData = append(batchesData, batch.BatchL2Data) +
    +
    + 58 + +
    + + + } +
    +
    + 59 + +
    + + + } +
    +
    + 60 + +
    + + + return d.backend.PostSequence(ctx, batchesData) +
    +
    + 61 + +
    + + + } +
    +
    + 62 + +
    + + +
    +
    +
    + 63 + +
    + + + // GetBatchL2Data tries to return the data from a batch, in the following priorities. batchNums should not include forced batches. +
    +
    + 64 + +
    + + + // 1. From local DB +
    +
    + 65 + +
    + + + // 2. From Trusted Sequencer (if not self) +
    +
    + 66 + +
    + + + // 3. From DA backend +
    +
    + 67 + +
    + + + func (d *DataAvailability) GetBatchL2Data(batchNums []uint64, batchHashes []common.Hash, dataAvailabilityMessage []byte) ([][]byte, error) { +
    +
    + 68 + +
    + + + if len(batchNums) != len(batchHashes) { +
    +
    + 69 + +
    + + + return nil, fmt.Errorf(invalidBatchRetrievalArgs, len(batchNums), len(batchHashes)) +
    +
    + 70 + +
    + + + } +
    +
    + 71 + +
    + + + localData, err := d.state.GetBatchL2DataByNumbers(d.ctx, batchNums, nil) +
    +
    + 72 + +
    + + + if err != nil { +
    +
    + 73 + +
    + + + return nil, err +
    +
    + 74 + +
    + + + } +
    +
    + 75 + +
    + + +
    +
    +
    + 76 + +
    + + + data, err := checkBatches(batchNums, batchHashes, localData) +
    +
    + 77 + +
    + + + if err != nil { +
    +
    + 78 + +
    + + + log.Warnf(failedDataRetrievalTemplate, batchNums, err.Error()) +
    +
    + 79 + +
    + + + } else { +
    +
    + 80 + +
    + + + return data, nil +
    +
    + 81 + +
    + + + } +
    +
    + 82 + +
    + + +
    +
    +
    + 83 + +
    + + + if !d.isTrustedSequencer { +
    +
    + 84 + +
    + + + data, err = d.rpcData(batchNums, batchHashes, d.zkEVMClient.BatchesByNumbers) +
    +
    + 85 + +
    + + + if err != nil { +
    +
    + 86 + +
    + + + log.Warnf(failedDataRetrievalTemplate, batchNums, err.Error()) +
    +
    + 87 + +
    + + + } else { +
    +
    + 88 + +
    + + + return data, nil +
    +
    + 89 + +
    + + + } +
    +
    + 90 + +
    + + + } +
    +
    + 91 + +
    + + + return d.backend.GetSequence(d.ctx, batchHashes, dataAvailabilityMessage) +
    +
    + 92 + +
    + + + } +
    +
    + 93 + +
    + + +
    +
    +
    + 94 + +
    + + + func checkBatches(batchNumbers []uint64, expectedHashes []common.Hash, batchData map[uint64][]byte) ([][]byte, error) { +
    +
    + 95 + +
    + + + if len(batchNumbers) != len(expectedHashes) { +
    +
    + 96 + +
    + + + return nil, fmt.Errorf("invalid batch parameters") +
    +
    + 97 + +
    + + + } +
    +
    + 98 + +
    + + + result := make([][]byte, len(batchNumbers)) +
    +
    + 99 + +
    + + + for i := 0; i < len(batchNumbers); i++ { +
    +
    + 100 + +
    + + + batchNumber := batchNumbers[i] +
    +
    + 101 + +
    + + + expectedHash := expectedHashes[i] +
    +
    + 102 + +
    + + + bd, ok := batchData[batchNumber] +
    +
    + 103 + +
    + + + if !ok { +
    +
    + 104 + +
    + + + return nil, fmt.Errorf("missing batch data: [%d] %s", batchNumber, expectedHash.Hex()) +
    +
    + 105 + +
    + + + } +
    +
    + 106 + +
    + + + actualHash := crypto.Keccak256Hash(bd) +
    +
    + 107 + +
    + + + if actualHash != expectedHash { +
    +
    + 108 + +
    + + + err := fmt.Errorf(unexpectedHashTemplate, batchNumber, expectedHash, actualHash) +
    +
    + 109 + +
    + + + log.Warnf("wrong local data for hash: %s", err.Error()) +
    +
    + 110 + +
    + + + return nil, err +
    +
    + 111 + +
    + + + } +
    +
    + 112 + +
    + + + result[i] = bd +
    +
    + 113 + +
    + + + } +
    +
    + 114 + +
    + + + return result, nil +
    +
    + 115 + +
    + + + } +
    +
    + 116 + +
    + + +
    +
    +
    + 117 + +
    + + + type rpcBatchDataFunc func(ctx context.Context, numbers []*big.Int) ([]*jsontypes.BatchData, error) +
    +
    + 118 + +
    + + +
    +
    +
    + 119 + +
    + + + // rpcData retrieves batch data from rpcBatchDataFunc, returns an error unless all are found and correct +
    +
    + 120 + +
    + + + func (d *DataAvailability) rpcData(batchNums []uint64, expectedHashes []common.Hash, rpcFunc rpcBatchDataFunc) ([][]byte, error) { +
    +
    + 121 + +
    + + + if len(batchNums) != len(expectedHashes) { +
    +
    + 122 + +
    + + + return nil, fmt.Errorf("invalid arguments, len of batch numbers does not equal length of expected hashes: %d != %d", +
    +
    + 123 + +
    + + + len(batchNums), len(expectedHashes)) +
    +
    + 124 + +
    + + + } +
    +
    + 125 + +
    + + + nums := make([]*big.Int, 0, len(batchNums)) +
    +
    + 126 + +
    + + + for _, n := range batchNums { +
    +
    + 127 + +
    + + + nums = append(nums, new(big.Int).SetUint64(n)) +
    +
    + 128 + +
    + + + } +
    +
    + 129 + +
    + + + batchData, err := rpcFunc(d.ctx, nums) +
    +
    + 130 + +
    + + + if err != nil { +
    +
    + 131 + +
    + + + return nil, err +
    +
    + 132 + +
    + + + } +
    +
    + 133 + +
    + + + if len(batchData) != len(batchNums) { +
    +
    + 134 + +
    + + + return nil, fmt.Errorf("missing batch data, expected %d, got %d", len(batchNums), len(batchData)) +
    +
    + 135 + +
    + + + } +
    +
    + 136 + +
    + + + result := make(map[uint64][]byte) +
    +
    + 137 + +
    + + + for i := 0; i < len(batchNums); i++ { +
    +
    + 138 + +
    + + + number := batchNums[i] +
    +
    + 139 + +
    + + + batch := batchData[i] +
    +
    + 140 + +
    + + + expectedTransactionsHash := expectedHashes[i] +
    +
    + 141 + +
    + + + actualTransactionsHash := crypto.Keccak256Hash(batch.BatchL2Data) +
    +
    + 142 + +
    + + + if expectedTransactionsHash != actualTransactionsHash { +
    +
    + 143 + +
    + + + return nil, fmt.Errorf(unexpectedHashTemplate, number, expectedTransactionsHash, actualTransactionsHash) +
    +
    + 144 + +
    + + + } +
    +
    + 145 + +
    + + + result[number] = batch.BatchL2Data +
    +
    + 146 + +
    + + + } +
    +
    + 147 + +
    + + + checked, err := checkBatches(batchNums, expectedHashes, result) +
    +
    + 148 + +
    + + + if err != nil { +
    +
    + 149 + +
    + + + return nil, err +
    +
    + 150 + +
    + + + } +
    +
    + 151 + +
    + + + return checked, nil +
    +
    + 152 + +
    + + + } +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/datacommittee/datacommittee.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -0,0 +1,309 @@
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 1 + +
    + + + package datacommittee +
    +
    + 2 + +
    + + +
    +
    +
    + 3 + +
    + + + import ( +
    +
    + 4 + +
    + + + "crypto/ecdsa" +
    +
    + 5 + +
    + + + "errors" +
    +
    + 6 + +
    + + + "fmt" +
    +
    + 7 + +
    + + + "math/big" +
    +
    + 8 + +
    + + + "math/rand" +
    +
    + 9 + +
    + + + "sort" +
    +
    + 10 + +
    + + + "strings" +
    +
    + 11 + +
    + + +
    +
    +
    + 12 + +
    + + + "github.com/0xPolygon/cdk-data-availability/client" +
    +
    + 13 + +
    + + + daTypes "github.com/0xPolygon/cdk-data-availability/types" +
    +
    + 14 + +
    + + + "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/polygondatacommittee" +
    +
    + 15 + +
    + + + "github.com/0xPolygonHermez/zkevm-node/log" +
    +
    + 16 + +
    + + + "github.com/ethereum/go-ethereum/accounts/abi/bind" +
    +
    + 17 + +
    + + + "github.com/ethereum/go-ethereum/common" +
    +
    + 18 + +
    + + + "github.com/ethereum/go-ethereum/crypto" +
    +
    + 19 + +
    + + + "github.com/ethereum/go-ethereum/ethclient" +
    +
    + 20 + +
    + + + "golang.org/x/net/context" +
    +
    + 21 + +
    + + + ) +
    +
    + 22 + +
    + + +
    +
    +
    + 23 + +
    + + + const unexpectedHashTemplate = "missmatch on transaction data. Expected hash %s, actual hash: %s" +
    +
    + 24 + +
    + + +
    +
    +
    + 25 + +
    + + + // DataCommitteeMember represents a member of the Data Committee +
    +
    + 26 + +
    + + + type DataCommitteeMember struct { +
    +
    + 27 + +
    + + + Addr common.Address +
    +
    + 28 + +
    + + + URL string +
    +
    + 29 + +
    + + + } +
    +
    + 30 + +
    + + +
    +
    +
    + 31 + +
    + + + // DataCommittee represents a specific committee +
    +
    + 32 + +
    + + + type DataCommittee struct { +
    +
    + 33 + +
    + + + AddressesHash common.Hash +
    +
    + 34 + +
    + + + Members []DataCommitteeMember +
    +
    + 35 + +
    + + + RequiredSignatures uint64 +
    +
    + 36 + +
    + + + } +
    +
    + 37 + +
    + + +
    +
    +
    + 38 + +
    + + + // DataCommitteeBackend implements the DAC integration +
    +
    + 39 + +
    + + + type DataCommitteeBackend struct { +
    +
    + 40 + +
    + + + dataCommitteeContract *polygondatacommittee.Polygondatacommittee +
    +
    + 41 + +
    + + + privKey *ecdsa.PrivateKey +
    +
    + 42 + +
    + + + dataCommitteeClientFactory client.Factory +
    +
    + 43 + +
    + + +
    +
    +
    + 44 + +
    + + + committeeMembers []DataCommitteeMember +
    +
    + 45 + +
    + + + selectedCommitteeMember int +
    +
    + 46 + +
    + + + ctx context.Context +
    +
    + 47 + +
    + + + } +
    +
    + 48 + +
    + + +
    +
    +
    + 49 + +
    + + + // New creates an instance of DataCommitteeBackend +
    +
    + 50 + +
    + + + func New( +
    +
    + 51 + +
    + + + l1RPCURL string, +
    +
    + 52 + +
    + + + dataCommitteeAddr common.Address, +
    +
    + 53 + +
    + + + privKey *ecdsa.PrivateKey, +
    +
    + 54 + +
    + + + dataCommitteeClientFactory client.Factory, +
    +
    + 55 + +
    + + + ) (*DataCommitteeBackend, error) { +
    +
    + 56 + +
    + + + ethClient, err := ethclient.Dial(l1RPCURL) +
    +
    + 57 + +
    + + + if err != nil { +
    +
    + 58 + +
    + + + log.Errorf("error connecting to %s: %+v", l1RPCURL, err) +
    +
    + 59 + +
    + + + return nil, err +
    +
    + 60 + +
    + + + } +
    +
    + 61 + +
    + + + dataCommittee, err := polygondatacommittee.NewPolygondatacommittee(dataCommitteeAddr, ethClient) +
    +
    + 62 + +
    + + + if err != nil { +
    +
    + 63 + +
    + + + return nil, err +
    +
    + 64 + +
    + + + } +
    +
    + 65 + +
    + + + return &DataCommitteeBackend{ +
    +
    + 66 + +
    + + + dataCommitteeContract: dataCommittee, +
    +
    + 67 + +
    + + + privKey: privKey, +
    +
    + 68 + +
    + + + dataCommitteeClientFactory: dataCommitteeClientFactory, +
    +
    + 69 + +
    + + + ctx: context.Background(), +
    +
    + 70 + +
    + + + }, nil +
    +
    + 71 + +
    + + + } +
    +
    + 72 + +
    + + +
    +
    +
    + 73 + +
    + + + // Init loads the DAC to be cached when needed +
    +
    + 74 + +
    + + + func (d *DataCommitteeBackend) Init() error { +
    +
    + 75 + +
    + + + committee, err := d.getCurrentDataCommittee() +
    +
    + 76 + +
    + + + if err != nil { +
    +
    + 77 + +
    + + + return err +
    +
    + 78 + +
    + + + } +
    +
    + 79 + +
    + + + selectedCommitteeMember := -1 +
    +
    + 80 + +
    + + + if committee != nil { +
    +
    + 81 + +
    + + + d.committeeMembers = committee.Members +
    +
    + 82 + +
    + + + if len(committee.Members) > 0 { +
    +
    + 83 + +
    + + + selectedCommitteeMember = rand.Intn(len(committee.Members)) //nolint:gosec +
    +
    + 84 + +
    + + + } +
    +
    + 85 + +
    + + + } +
    +
    + 86 + +
    + + + d.selectedCommitteeMember = selectedCommitteeMember +
    +
    + 87 + +
    + + + return nil +
    +
    + 88 + +
    + + + } +
    +
    + 89 + +
    + + +
    +
    +
    + 90 + +
    + + + // GetSequence gets backend data one hash at a time. This should be optimized on the DAC side to get them all at once. +
    +
    + 91 + +
    + + + func (d *DataCommitteeBackend) GetSequence(ctx context.Context, hashes []common.Hash, dataAvailabilityMessage []byte) ([][]byte, error) { +
    +
    + 92 + +
    + + + // TODO: optimize this on the DAC side by implementing a multi batch retrieve api +
    +
    + 93 + +
    + + + var batchData [][]byte +
    +
    + 94 + +
    + + + for _, h := range hashes { +
    +
    + 95 + +
    + + + data, err := d.GetBatchL2Data(h) +
    +
    + 96 + +
    + + + if err != nil { +
    +
    + 97 + +
    + + + return nil, err +
    +
    + 98 + +
    + + + } +
    +
    + 99 + +
    + + + batchData = append(batchData, data) +
    +
    + 100 + +
    + + + } +
    +
    + 101 + +
    + + + return batchData, nil +
    +
    + 102 + +
    + + + } +
    +
    + 103 + +
    + + +
    +
    +
    + 104 + +
    + + + // GetBatchL2Data returns the data from the DAC. It checks that it matches with the expected hash +
    +
    + 105 + +
    + + + func (d *DataCommitteeBackend) GetBatchL2Data(hash common.Hash) ([]byte, error) { +
    +
    + 106 + +
    + + + intialMember := d.selectedCommitteeMember +
    +
    + 107 + +
    + + + found := false +
    +
    + 108 + +
    + + + for !found && intialMember != -1 { +
    +
    + 109 + +
    + + + member := d.committeeMembers[d.selectedCommitteeMember] +
    +
    + 110 + +
    + + + log.Infof("trying to get data from %s at %s", member.Addr.Hex(), member.URL) +
    +
    + 111 + +
    + + + c := d.dataCommitteeClientFactory.New(member.URL) +
    +
    + 112 + +
    + + + data, err := c.GetOffChainData(d.ctx, hash) +
    +
    + 113 + +
    + + + if err != nil { +
    +
    + 114 + +
    + + + log.Warnf( +
    +
    + 115 + +
    + + + "error getting data from DAC node %s at %s: %s", +
    +
    + 116 + +
    + + + member.Addr.Hex(), member.URL, err, +
    +
    + 117 + +
    + + + ) +
    +
    + 118 + +
    + + + d.selectedCommitteeMember = (d.selectedCommitteeMember + 1) % len(d.committeeMembers) +
    +
    + 119 + +
    + + + if d.selectedCommitteeMember == intialMember { +
    +
    + 120 + +
    + + + break +
    +
    + 121 + +
    + + + } +
    +
    + 122 + +
    + + + continue +
    +
    + 123 + +
    + + + } +
    +
    + 124 + +
    + + + actualTransactionsHash := crypto.Keccak256Hash(data) +
    +
    + 125 + +
    + + + if actualTransactionsHash != hash { +
    +
    + 126 + +
    + + + unexpectedHash := fmt.Errorf( +
    +
    + 127 + +
    + + + unexpectedHashTemplate, hash, actualTransactionsHash, +
    +
    + 128 + +
    + + + ) +
    +
    + 129 + +
    + + + log.Warnf( +
    +
    + 130 + +
    + + + "error getting data from DAC node %s at %s: %s", +
    +
    + 131 + +
    + + + member.Addr.Hex(), member.URL, unexpectedHash, +
    +
    + 132 + +
    + + + ) +
    +
    + 133 + +
    + + + d.selectedCommitteeMember = (d.selectedCommitteeMember + 1) % len(d.committeeMembers) +
    +
    + 134 + +
    + + + if d.selectedCommitteeMember == intialMember { +
    +
    + 135 + +
    + + + break +
    +
    + 136 + +
    + + + } +
    +
    + 137 + +
    + + + continue +
    +
    + 138 + +
    + + + } +
    +
    + 139 + +
    + + + return data, nil +
    +
    + 140 + +
    + + + } +
    +
    + 141 + +
    + + + if err := d.Init(); err != nil { +
    +
    + 142 + +
    + + + return nil, fmt.Errorf("error loading data committee: %s", err) +
    +
    + 143 + +
    + + + } +
    +
    + 144 + +
    + + + return nil, fmt.Errorf("couldn't get the data from any committee member") +
    +
    + 145 + +
    + + + } +
    +
    + 146 + +
    + + +
    +
    +
    + 147 + +
    + + + type signatureMsg struct { +
    +
    + 148 + +
    + + + addr common.Address +
    +
    + 149 + +
    + + + signature []byte +
    +
    + 150 + +
    + + + err error +
    +
    + 151 + +
    + + + } +
    +
    + 152 + +
    + + +
    +
    +
    + 153 + +
    + + + // PostSequence sends the sequence data to the data availability backend, and returns the dataAvailabilityMessage +
    +
    + 154 + +
    + + + // as expected by the contract +
    +
    + 155 + +
    + + + func (s *DataCommitteeBackend) PostSequence(ctx context.Context, batchesData [][]byte) ([]byte, error) { +
    +
    + 156 + +
    + + + // Get current committee +
    +
    + 157 + +
    + + + committee, err := s.getCurrentDataCommittee() +
    +
    + 158 + +
    + + + if err != nil { +
    +
    + 159 + +
    + + + return nil, err +
    +
    + 160 + +
    + + + } +
    +
    + 161 + +
    + + +
    +
    +
    + 162 + +
    + + + // Authenticate as trusted sequencer by signing the sequences +
    +
    + 163 + +
    + + + sequence := daTypes.Sequence{} +
    +
    + 164 + +
    + + + for _, seq := range batchesData { +
    +
    + 165 + +
    + + + sequence = append(sequence, seq) +
    +
    + 166 + +
    + + + } +
    +
    + 167 + +
    + + + signedSequence, err := sequence.Sign(s.privKey) +
    +
    + 168 + +
    + + + if err != nil { +
    +
    + 169 + +
    + + + return nil, err +
    +
    + 170 + +
    + + + } +
    +
    + 171 + +
    + + +
    +
    +
    + 172 + +
    + + + // Request signatures to all members in parallel +
    +
    + 173 + +
    + + + ch := make(chan signatureMsg, len(committee.Members)) +
    +
    + 174 + +
    + + + signatureCtx, cancelSignatureCollection := context.WithCancel(ctx) +
    +
    + 175 + +
    + + + for _, member := range committee.Members { +
    +
    + 176 + +
    + + + go requestSignatureFromMember(signatureCtx, *signedSequence, member, ch) +
    +
    + 177 + +
    + + + } +
    +
    + 178 + +
    + + +
    +
    +
    + 179 + +
    + + + // Collect signatures +
    +
    + 180 + +
    + + + msgs := []signatureMsg{} +
    +
    + 181 + +
    + + + var ( +
    +
    + 182 + +
    + + + collectedSignatures uint64 +
    +
    + 183 + +
    + + + failedToCollect uint64 +
    +
    + 184 + +
    + + + ) +
    +
    + 185 + +
    + + + for collectedSignatures < committee.RequiredSignatures { +
    +
    + 186 + +
    + + + msg := <-ch +
    +
    + 187 + +
    + + + if msg.err != nil { +
    +
    + 188 + +
    + + + log.Errorf("error when trying to get signature from %s: %s", msg.addr, msg.err) +
    +
    + 189 + +
    + + + failedToCollect++ +
    +
    + 190 + +
    + + + if len(committee.Members)-int(failedToCollect) < int(committee.RequiredSignatures) { +
    +
    + 191 + +
    + + + cancelSignatureCollection() +
    +
    + 192 + +
    + + + return nil, errors.New("too many members failed to send their signature") +
    +
    + 193 + +
    + + + } +
    +
    + 194 + +
    + + + } else { +
    +
    + 195 + +
    + + + log.Infof("received signature from %s", msg.addr) +
    +
    + 196 + +
    + + + collectedSignatures++ +
    +
    + 197 + +
    + + + } +
    +
    + 198 + +
    + + + msgs = append(msgs, msg) +
    +
    + 199 + +
    + + + } +
    +
    + 200 + +
    + + +
    +
    +
    + 201 + +
    + + + // Stop requesting as soon as we have N valid signatures +
    +
    + 202 + +
    + + + cancelSignatureCollection() +
    +
    + 203 + +
    + + +
    +
    +
    + 204 + +
    + + + return buildSignaturesAndAddrs(signatureMsgs(msgs), committee.Members), nil +
    +
    + 205 + +
    + + + } +
    +
    + 206 + +
    + + +
    +
    +
    + 207 + +
    + + + func requestSignatureFromMember(ctx context.Context, signedSequence daTypes.SignedSequence, member DataCommitteeMember, ch chan signatureMsg) { +
    +
    + 208 + +
    + + + // request +
    +
    + 209 + +
    + + + c := client.New(member.URL) +
    +
    + 210 + +
    + + + log.Infof("sending request to sign the sequence to %s at %s", member.Addr.Hex(), member.URL) +
    +
    + 211 + +
    + + + signature, err := c.SignSequence(signedSequence) +
    +
    + 212 + +
    + + + if err != nil { +
    +
    + 213 + +
    + + + ch <- signatureMsg{ +
    +
    + 214 + +
    + + + addr: member.Addr, +
    +
    + 215 + +
    + + + err: err, +
    +
    + 216 + +
    + + + } +
    +
    + 217 + +
    + + + return +
    +
    + 218 + +
    + + + } +
    +
    + 219 + +
    + + + // verify returned signature +
    +
    + 220 + +
    + + + signedSequence.Signature = signature +
    +
    + 221 + +
    + + + signer, err := signedSequence.Signer() +
    +
    + 222 + +
    + + + if err != nil { +
    +
    + 223 + +
    + + + ch <- signatureMsg{ +
    +
    + 224 + +
    + + + addr: member.Addr, +
    +
    + 225 + +
    + + + err: err, +
    +
    + 226 + +
    + + + } +
    +
    + 227 + +
    + + + return +
    +
    + 228 + +
    + + + } +
    +
    + 229 + +
    + + + if signer != member.Addr { +
    +
    + 230 + +
    + + + ch <- signatureMsg{ +
    +
    + 231 + +
    + + + addr: member.Addr, +
    +
    + 232 + +
    + + + err: fmt.Errorf("invalid signer. Expected %s, actual %s", member.Addr.Hex(), signer.Hex()), +
    +
    + 233 + +
    + + + } +
    +
    + 234 + +
    + + + return +
    +
    + 235 + +
    + + + } +
    +
    + 236 + +
    + + + ch <- signatureMsg{ +
    +
    + 237 + +
    + + + addr: member.Addr, +
    +
    + 238 + +
    + + + signature: signature, +
    +
    + 239 + +
    + + + } +
    +
    + 240 + +
    + + + } +
    +
    + 241 + +
    + + +
    +
    +
    + 242 + +
    + + + func buildSignaturesAndAddrs(sigs signatureMsgs, members []DataCommitteeMember) []byte { +
    +
    + 243 + +
    + + + const ( +
    +
    + 244 + +
    + + + sigLen = 65 +
    +
    + 245 + +
    + + + addrLen = 20 +
    +
    + 246 + +
    + + + ) +
    +
    + 247 + +
    + + + res := make([]byte, 0, len(sigs)*sigLen+len(members)*addrLen) +
    +
    + 248 + +
    + + + sort.Sort(sigs) +
    +
    + 249 + +
    + + + for _, msg := range sigs { +
    +
    + 250 + +
    + + + log.Debugf("adding signature %s from %s", common.Bytes2Hex(msg.signature), msg.addr.Hex()) +
    +
    + 251 + +
    + + + res = append(res, msg.signature...) +
    +
    + 252 + +
    + + + } +
    +
    + 253 + +
    + + + for _, member := range members { +
    +
    + 254 + +
    + + + log.Debugf("adding addr %s", common.Bytes2Hex(member.Addr.Bytes())) +
    +
    + 255 + +
    + + + res = append(res, member.Addr.Bytes()...) +
    +
    + 256 + +
    + + + } +
    +
    + 257 + +
    + + + log.Debugf("full res %s", common.Bytes2Hex(res)) +
    +
    + 258 + +
    + + + return res +
    +
    + 259 + +
    + + + } +
    +
    + 260 + +
    + + +
    +
    +
    + 261 + +
    + + + type signatureMsgs []signatureMsg +
    +
    + 262 + +
    + + +
    +
    +
    + 263 + +
    + + + func (s signatureMsgs) Len() int { return len(s) } +
    +
    + 264 + +
    + + + func (s signatureMsgs) Less(i, j int) bool { +
    +
    + 265 + +
    + + + return strings.ToUpper(s[i].addr.Hex()) < strings.ToUpper(s[j].addr.Hex()) +
    +
    + 266 + +
    + + + } +
    +
    + 267 + +
    + + + func (s signatureMsgs) Swap(i, j int) { s[i], s[j] = s[j], s[i] } +
    +
    + 268 + +
    + + +
    +
    +
    + 269 + +
    + + + // getCurrentDataCommittee return the currently registered data committee +
    +
    + 270 + +
    + + + func (d *DataCommitteeBackend) getCurrentDataCommittee() (*DataCommittee, error) { +
    +
    + 271 + +
    + + + addrsHash, err := d.dataCommitteeContract.CommitteeHash(&bind.CallOpts{Pending: false}) +
    +
    + 272 + +
    + + + if err != nil { +
    +
    + 273 + +
    + + + return nil, fmt.Errorf("error getting CommitteeHash from L1 SC: %w", err) +
    +
    + 274 + +
    + + + } +
    +
    + 275 + +
    + + + reqSign, err := d.dataCommitteeContract.RequiredAmountOfSignatures(&bind.CallOpts{Pending: false}) +
    +
    + 276 + +
    + + + if err != nil { +
    +
    + 277 + +
    + + + return nil, fmt.Errorf("error getting RequiredAmountOfSignatures from L1 SC: %w", err) +
    +
    + 278 + +
    + + + } +
    +
    + 279 + +
    + + + members, err := d.getCurrentDataCommitteeMembers() +
    +
    + 280 + +
    + + + if err != nil { +
    +
    + 281 + +
    + + + return nil, err +
    +
    + 282 + +
    + + + } +
    +
    + 283 + +
    + + +
    +
    +
    + 284 + +
    + + + return &DataCommittee{ +
    +
    + 285 + +
    + + + AddressesHash: common.Hash(addrsHash), +
    +
    + 286 + +
    + + + RequiredSignatures: reqSign.Uint64(), +
    +
    + 287 + +
    + + + Members: members, +
    +
    + 288 + +
    + + + }, nil +
    +
    + 289 + +
    + + + } +
    +
    + 290 + +
    + + +
    +
    +
    + 291 + +
    + + + // getCurrentDataCommitteeMembers return the currently registered data committee members +
    +
    + 292 + +
    + + + func (d *DataCommitteeBackend) getCurrentDataCommitteeMembers() ([]DataCommitteeMember, error) { +
    +
    + 293 + +
    + + + nMembers, err := d.dataCommitteeContract.GetAmountOfMembers(&bind.CallOpts{Pending: false}) +
    +
    + 294 + +
    + + + if err != nil { +
    +
    + 295 + +
    + + + return nil, fmt.Errorf("error getting GetAmountOfMembers from L1 SC: %w", err) +
    +
    + 296 + +
    + + + } +
    +
    + 297 + +
    + + + members := make([]DataCommitteeMember, 0, nMembers.Int64()) +
    +
    + 298 + +
    + + + for i := int64(0); i < nMembers.Int64(); i++ { +
    +
    + 299 + +
    + + + member, err := d.dataCommitteeContract.Members(&bind.CallOpts{Pending: false}, big.NewInt(i)) +
    +
    + 300 + +
    + + + if err != nil { +
    +
    + 301 + +
    + + + return nil, fmt.Errorf("error getting Members %d from L1 SC: %w", i, err) +
    +
    + 302 + +
    + + + } +
    +
    + 303 + +
    + + + members = append(members, DataCommitteeMember{ +
    +
    + 304 + +
    + + + Addr: member.Addr, +
    +
    + 305 + +
    + + + URL: member.Url, +
    +
    + 306 + +
    + + + }) +
    +
    + 307 + +
    + + + } +
    +
    + 308 + +
    + + + return members, nil +
    +
    + 309 + +
    + + + } +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/datacommittee/datacommittee_test.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -0,0 +1,131 @@
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 1 + +
    + + + package datacommittee +
    +
    + 2 + +
    + + +
    +
    +
    + 3 + +
    + + + import ( +
    +
    + 4 + +
    + + + "math/big" +
    +
    + 5 + +
    + + + "testing" +
    +
    + 6 + +
    + + +
    +
    +
    + 7 + +
    + + + "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/polygondatacommittee" +
    +
    + 8 + +
    + + + "github.com/0xPolygonHermez/zkevm-node/log" +
    +
    + 9 + +
    + + + "github.com/ethereum/go-ethereum/accounts/abi/bind" +
    +
    + 10 + +
    + + + "github.com/ethereum/go-ethereum/common" +
    +
    + 11 + +
    + + + "github.com/ethereum/go-ethereum/core" +
    +
    + 12 + +
    + + + "github.com/ethereum/go-ethereum/crypto" +
    +
    + 13 + +
    + + + "github.com/ethereum/go-ethereum/ethclient/simulated" +
    +
    + 14 + +
    + + + "github.com/stretchr/testify/assert" +
    +
    + 15 + +
    + + + "github.com/stretchr/testify/require" +
    +
    + 16 + +
    + + + ) +
    +
    + 17 + +
    + + +
    +
    +
    + 18 + +
    + + + func TestUpdateDataCommitteeEvent(t *testing.T) { +
    +
    + 19 + +
    + + + // Set up testing environment +
    +
    + 20 + +
    + + + dac, ethBackend, auth, da := newTestingEnv(t) +
    +
    + 21 + +
    + + +
    +
    +
    + 22 + +
    + + + // Update the committee +
    +
    + 23 + +
    + + + requiredAmountOfSignatures := big.NewInt(2) +
    +
    + 24 + +
    + + + URLs := []string{"1", "2", "3"} +
    +
    + 25 + +
    + + + addrs := []common.Address{ +
    +
    + 26 + +
    + + + common.HexToAddress("0x1"), +
    +
    + 27 + +
    + + + common.HexToAddress("0x2"), +
    +
    + 28 + +
    + + + common.HexToAddress("0x3"), +
    +
    + 29 + +
    + + + } +
    +
    + 30 + +
    + + + addrsBytes := []byte{} +
    +
    + 31 + +
    + + + for _, addr := range addrs { +
    +
    + 32 + +
    + + + addrsBytes = append(addrsBytes, addr.Bytes()...) +
    +
    + 33 + +
    + + + } +
    +
    + 34 + +
    + + + _, err := da.SetupCommittee(auth, requiredAmountOfSignatures, URLs, addrsBytes) +
    +
    + 35 + +
    + + + require.NoError(t, err) +
    +
    + 36 + +
    + + + ethBackend.Commit() +
    +
    + 37 + +
    + + +
    +
    +
    + 38 + +
    + + + // Assert the committee update +
    +
    + 39 + +
    + + + actualSetup, err := dac.getCurrentDataCommittee() +
    +
    + 40 + +
    + + + require.NoError(t, err) +
    +
    + 41 + +
    + + + expectedMembers := []DataCommitteeMember{} +
    +
    + 42 + +
    + + + expectedSetup := DataCommittee{ +
    +
    + 43 + +
    + + + RequiredSignatures: uint64(len(URLs) - 1), +
    +
    + 44 + +
    + + + AddressesHash: crypto.Keccak256Hash(addrsBytes), +
    +
    + 45 + +
    + + + } +
    +
    + 46 + +
    + + + for i, url := range URLs { +
    +
    + 47 + +
    + + + expectedMembers = append(expectedMembers, DataCommitteeMember{ +
    +
    + 48 + +
    + + + URL: url, +
    +
    + 49 + +
    + + + Addr: addrs[i], +
    +
    + 50 + +
    + + + }) +
    +
    + 51 + +
    + + + } +
    +
    + 52 + +
    + + + expectedSetup.Members = expectedMembers +
    +
    + 53 + +
    + + + assert.Equal(t, expectedSetup, *actualSetup) +
    +
    + 54 + +
    + + + } +
    +
    + 55 + +
    + + +
    +
    +
    + 56 + +
    + + + func init() { +
    +
    + 57 + +
    + + + log.Init(log.Config{ +
    +
    + 58 + +
    + + + Level: "debug", +
    +
    + 59 + +
    + + + Outputs: []string{"stderr"}, +
    +
    + 60 + +
    + + + }) +
    +
    + 61 + +
    + + + } +
    +
    + 62 + +
    + + +
    +
    +
    + 63 + +
    + + + // This function prepare the blockchain, the wallet with funds and deploy the smc +
    +
    + 64 + +
    + + + func newTestingEnv(t *testing.T) ( +
    +
    + 65 + +
    + + + dac *DataCommitteeBackend, +
    +
    + 66 + +
    + + + ethBackend *simulated.Backend, +
    +
    + 67 + +
    + + + auth *bind.TransactOpts, +
    +
    + 68 + +
    + + + da *polygondatacommittee.Polygondatacommittee, +
    +
    + 69 + +
    + + + ) { +
    +
    + 70 + +
    + + + t.Helper() +
    +
    + 71 + +
    + + + privateKey, err := crypto.GenerateKey() +
    +
    + 72 + +
    + + + if err != nil { +
    +
    + 73 + +
    + + + log.Fatal(err) +
    +
    + 74 + +
    + + + } +
    +
    + 75 + +
    + + + auth, err = bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(1337)) +
    +
    + 76 + +
    + + + if err != nil { +
    +
    + 77 + +
    + + + log.Fatal(err) +
    +
    + 78 + +
    + + + } +
    +
    + 79 + +
    + + + dac, ethBackend, da, err = newSimulatedDacman(t, auth) +
    +
    + 80 + +
    + + + if err != nil { +
    +
    + 81 + +
    + + + log.Fatal(err) +
    +
    + 82 + +
    + + + } +
    +
    + 83 + +
    + + + return dac, ethBackend, auth, da +
    +
    + 84 + +
    + + + } +
    +
    + 85 + +
    + + +
    +
    +
    + 86 + +
    + + + // NewSimulatedEtherman creates an etherman that uses a simulated blockchain. It's important to notice that the ChainID of the auth +
    +
    + 87 + +
    + + + // must be 1337. The address that holds the auth will have an initial balance of 10 ETH +
    +
    + 88 + +
    + + + func newSimulatedDacman(t *testing.T, auth *bind.TransactOpts) ( +
    +
    + 89 + +
    + + + dacman *DataCommitteeBackend, +
    +
    + 90 + +
    + + + ethBackend *simulated.Backend, +
    +
    + 91 + +
    + + + da *polygondatacommittee.Polygondatacommittee, +
    +
    + 92 + +
    + + + err error, +
    +
    + 93 + +
    + + + ) { +
    +
    + 94 + +
    + + + t.Helper() +
    +
    + 95 + +
    + + + if auth == nil { +
    +
    + 96 + +
    + + + // read only client +
    +
    + 97 + +
    + + + return &DataCommitteeBackend{}, nil, nil, nil +
    +
    + 98 + +
    + + + } +
    +
    + 99 + +
    + + + // 10000000 ETH in wei +
    +
    + 100 + +
    + + + balance, _ := new(big.Int).SetString("10000000000000000000000000", 10) //nolint:gomnd +
    +
    + 101 + +
    + + + address := auth.From +
    +
    + 102 + +
    + + + genesisAlloc := map[common.Address]core.GenesisAccount{ +
    +
    + 103 + +
    + + + address: { +
    +
    + 104 + +
    + + + Balance: balance, +
    +
    + 105 + +
    + + + }, +
    +
    + 106 + +
    + + + } +
    +
    + 107 + +
    + + + blockGasLimit := uint64(999999999999999999) //nolint:gomnd +
    +
    + 108 + +
    + + + client := simulated.NewBackend(genesisAlloc, simulated.WithBlockGasLimit(blockGasLimit)) +
    +
    + 109 + +
    + + +
    +
    +
    + 110 + +
    + + + // DAC Setup +
    +
    + 111 + +
    + + + _, _, da, err = polygondatacommittee.DeployPolygondatacommittee(auth, client.Client()) +
    +
    + 112 + +
    + + + if err != nil { +
    +
    + 113 + +
    + + + return &DataCommitteeBackend{}, nil, nil, err +
    +
    + 114 + +
    + + + } +
    +
    + 115 + +
    + + + client.Commit() +
    +
    + 116 + +
    + + + _, err = da.Initialize(auth) +
    +
    + 117 + +
    + + + if err != nil { +
    +
    + 118 + +
    + + + return &DataCommitteeBackend{}, nil, nil, err +
    +
    + 119 + +
    + + + } +
    +
    + 120 + +
    + + + client.Commit() +
    +
    + 121 + +
    + + + _, err = da.SetupCommittee(auth, big.NewInt(0), []string{}, []byte{}) +
    +
    + 122 + +
    + + + if err != nil { +
    +
    + 123 + +
    + + + return &DataCommitteeBackend{}, nil, nil, err +
    +
    + 124 + +
    + + + } +
    +
    + 125 + +
    + + + client.Commit() +
    +
    + 126 + +
    + + +
    +
    +
    + 127 + +
    + + + c := &DataCommitteeBackend{ +
    +
    + 128 + +
    + + + dataCommitteeContract: da, +
    +
    + 129 + +
    + + + } +
    +
    + 130 + +
    + + + return c, client, da, nil +
    +
    + 131 + +
    + + + } +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/interfaces.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -0,0 +1,60 @@
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 1 + +
    + + + package dataavailability +
    +
    + 2 + +
    + + +
    +
    +
    + 3 + +
    + + + import ( +
    +
    + 4 + +
    + + + "context" +
    +
    + 5 + +
    + + + "math/big" +
    +
    + 6 + +
    + + +
    +
    +
    + 7 + +
    + + + "github.com/0xPolygonHermez/zkevm-node/jsonrpc/types" +
    +
    + 8 + +
    + + + "github.com/0xPolygonHermez/zkevm-node/state" +
    +
    + 9 + +
    + + + "github.com/ethereum/go-ethereum/common" +
    +
    + 10 + +
    + + + "github.com/jackc/pgx/v4" +
    +
    + 11 + +
    + + + ) +
    +
    + 12 + +
    + + +
    +
    +
    + 13 + +
    + + + // DABackender is an interface for components that store and retrieve batch data +
    +
    + 14 + +
    + + + type DABackender interface { +
    +
    + 15 + +
    + + + SequenceRetriever +
    +
    + 16 + +
    + + + SequenceSender +
    +
    + 17 + +
    + + + // Init initializes the DABackend +
    +
    + 18 + +
    + + + Init() error +
    +
    + 19 + +
    + + + } +
    +
    + 20 + +
    + + +
    +
    +
    + 21 + +
    + + + // SequenceSender is used to send provided sequence of batches +
    +
    + 22 + +
    + + + type SequenceSender interface { +
    +
    + 23 + +
    + + + // PostSequence sends the sequence data to the data availability backend, and returns the dataAvailabilityMessage +
    +
    + 24 + +
    + + + // as expected by the contract +
    +
    + 25 + +
    + + + PostSequence(ctx context.Context, batchesData [][]byte) ([]byte, error) +
    +
    + 26 + +
    + + + } +
    +
    + 27 + +
    + + +
    +
    +
    + 28 + +
    + + + // SequenceRetriever is used to retrieve batch data +
    +
    + 29 + +
    + + + type SequenceRetriever interface { +
    +
    + 30 + +
    + + + // GetSequence retrieves the sequence data from the data availability backend +
    +
    + 31 + +
    + + + GetSequence(ctx context.Context, batchHashes []common.Hash, dataAvailabilityMessage []byte) ([][]byte, error) +
    +
    + 32 + +
    + + + } +
    +
    + 33 + +
    + + +
    +
    +
    + 34 + +
    + + + // === Internal interfaces === +
    +
    + 35 + +
    + + +
    +
    +
    + 36 + +
    + + + type stateInterface interface { +
    +
    + 37 + +
    + + + GetBatchL2DataByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) ([]byte, error) +
    +
    + 38 + +
    + + + GetBatchL2DataByNumbers(ctx context.Context, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error) +
    +
    + 39 + +
    + + + GetBatchByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.Batch, error) +
    +
    + 40 + +
    + + + GetForcedBatchDataByNumbers(ctx context.Context, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error) +
    +
    + 41 + +
    + + + } +
    +
    + 42 + +
    + + +
    +
    +
    + 43 + +
    + + + // BatchDataProvider is used to retrieve batch data +
    +
    + 44 + +
    + + + type BatchDataProvider interface { +
    +
    + 45 + +
    + + + // GetBatchL2Data retrieve the data of a batch from the DA backend. The returned data must be the pre-image of the hash +
    +
    + 46 + +
    + + + GetBatchL2Data(batchNum []uint64, batchHashes []common.Hash, dataAvailabilityMessage []byte) ([][]byte, error) +
    +
    + 47 + +
    + + + } +
    +
    + 48 + +
    + + +
    +
    +
    + 49 + +
    + + + // DataManager is an interface for components that send and retrieve batch data +
    +
    + 50 + +
    + + + type DataManager interface { +
    +
    + 51 + +
    + + + BatchDataProvider +
    +
    + 52 + +
    + + + SequenceSender +
    +
    + 53 + +
    + + + } +
    +
    + 54 + +
    + + +
    +
    +
    + 55 + +
    + + + // ZKEVMClientTrustedBatchesGetter contains the methods required to interact with zkEVM-RPC +
    +
    + 56 + +
    + + + type ZKEVMClientTrustedBatchesGetter interface { +
    +
    + 57 + +
    + + + BatchByNumber(ctx context.Context, number *big.Int) (*types.Batch, error) +
    +
    + 58 + +
    + + + BatchesByNumbers(ctx context.Context, numbers []*big.Int) ([]*types.BatchData, error) +
    +
    + 59 + +
    + + + ForcedBatchesByNumbers(ctx context.Context, numbers []*big.Int) ([]*types.BatchData, error) +
    +
    + 60 + +
    + + + } +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/pool/validium-001.sql + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -0,0 +1,20 @@
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 1 + +
    + + + -- +migrate Down +
    +
    + 2 + +
    + + + DROP TABLE IF EXISTS pool.acl CASCADE; +
    +
    + 3 + +
    + + + DROP TABLE IF EXISTS pool.policy CASCADE; +
    +
    + 4 + +
    + + +
    +
    +
    + 5 + +
    + + + -- +migrate Up +
    +
    + 6 + +
    + + + CREATE TABLE pool.policy +
    +
    + 7 + +
    + + + ( +
    +
    + 8 + +
    + + + name VARCHAR PRIMARY KEY, +
    +
    + 9 + +
    + + + allow BOOLEAN NOT NULL DEFAULT false +
    +
    + 10 + +
    + + + ); +
    +
    + 11 + +
    + + +
    +
    +
    + 12 + +
    + + + INSERT INTO pool.policy (name, allow) VALUES ('send_tx', false); +
    +
    + 13 + +
    + + + INSERT INTO pool.policy (name, allow) VALUES ('deploy', false); +
    +
    + 14 + +
    + + +
    +
    +
    + 15 + +
    + + + CREATE TABLE pool.acl +
    +
    + 16 + +
    + + + ( +
    +
    + 17 + +
    + + + address VARCHAR, +
    +
    + 18 + +
    + + + policy VARCHAR, +
    +
    + 19 + +
    + + + PRIMARY KEY (address, policy) +
    +
    + 20 + +
    + + + ); +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/state/0013_test.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -8,19 +8,21 @@
    +
    + 8 + +
    +   + "github.com/stretchr/testify/assert" +
    +
    + 9 + +
    +   + ) +
    +
    + 10 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 11 + +
    +   + // this migration changes length of the token name +
    +
    + 12 + +
    + - + type migrationTest0013 struct { +
    +
    + 13 + +
    + - + blockHashValue string +
    +
    + 14 + +
    + - + mainExitRootValue string +
    +
    + 15 + +
    + - + rollupExitRootValue string +
    +
    + 16 + +
    + - + globalExitRootValue string +
    +
    + 17 + +
    + - + previousBlockHashValue string +
    +
    + 18 + +
    + - + l1InfoRootValue string +
    +
    + 19 + +
    + - + } +
    +
    + 20 + +
    +   +
    +
    +
    + 21 + +
    +   + func (m migrationTest0013) insertBlock(blockNumber uint64, db *sql.DB) error { +
    +
    + 22 + +
    +   + const addBlock = "INSERT INTO state.block (block_num, received_at, block_hash) VALUES ($1, $2, $3)" +
    +
    + 23 + +
    + - + if _, err := db.Exec(addBlock, blockNumber, time.Now(), m.blockHashValue); err != nil { +
    +
    + 24 + +
    +   + return err +
    +
    + 25 + +
    +   + } +
    +
    + 26 + +
    +   + return nil +
    +
    +
    @@ -43,10 +45,10 @@
    +
    + 43 + +
    +   + if err = m.insertBlock(uint64(124), db); err != nil { +
    +
    + 44 + +
    +   + return err +
    +
    + 45 + +
    +   + } +
    +
    + 46 + +
    + - + if err = m.insertRowInOldTable(db, []interface{}{123, time.Now(), m.mainExitRootValue, m.rollupExitRootValue, m.globalExitRootValue}); err != nil { +
    +
    + 47 + +
    +   + return err +
    +
    + 48 + +
    +   + } +
    +
    + 49 + +
    + - + if err = m.insertRowInOldTable(db, []interface{}{124, time.Now(), m.mainExitRootValue, m.rollupExitRootValue, m.globalExitRootValue}); err != nil { +
    +
    + 50 + +
    +   + return err +
    +
    + 51 + +
    +   + } +
    +
    + 52 + +
    +   +
    +
    +
    +
    @@ -111,16 +113,16 @@
    +
    + 111 + +
    +   + assert.NoError(t, err) +
    +
    + 112 + +
    +   + err = m.insertBlock(uint64(127), db) +
    +
    + 113 + +
    +   + assert.NoError(t, err) +
    +
    + 114 + +
    + - + prevBlockHash := m.previousBlockHashValue +
    +
    + 115 + +
    + - + l1InfoRoot := m.l1InfoRootValue +
    +
    + 116 + +
    + - + err = m.insertRowInMigratedTable(db, []interface{}{125, time.Now(), m.mainExitRootValue, m.rollupExitRootValue, m.globalExitRootValue, prevBlockHash, l1InfoRoot, 1}) +
    +
    + 117 + +
    +   + assert.NoError(t, err) +
    +
    + 118 + +
    +   + // insert duplicated l1_info_root +
    +
    + 119 + +
    + - + err = m.insertRowInMigratedTable(db, []interface{}{126, time.Now(), m.mainExitRootValue, m.rollupExitRootValue, m.globalExitRootValue, prevBlockHash, l1InfoRoot, 1}) +
    +
    + 120 + +
    +   + assert.Error(t, err) +
    +
    + 121 + +
    +   +
    +
    +
    + 122 + +
    +   + // insert in the old way must work +
    +
    + 123 + +
    + - + err = m.insertRowInOldTable(db, []interface{}{127, time.Now(), m.mainExitRootValue, m.rollupExitRootValue, m.globalExitRootValue}) +
    +
    + 124 + +
    +   + assert.NoError(t, err) +
    +
    + 125 + +
    +   +
    +
    +
    + 126 + +
    +   + sqlSelect := `SELECT prev_block_hash, l1_info_root FROM state.exit_root WHERE l1_info_tree_index = $1` +
    +
    +
    @@ -183,13 +185,5 @@
    +
    + 183 + +
    +   + } +
    +
    + 184 + +
    +   +
    +
    +
    + 185 + +
    +   + func TestMigration0013(t *testing.T) { +
    +
    + 186 + +
    + - + m := migrationTest0013{ +
    +
    + 187 + +
    + - + blockHashValue: "0x29e885edaf8e4b51e1d2e05f9da28161d2fb4f6b1d53827d9b80a23cf2d7d9f1", +
    +
    + 188 + +
    + - + mainExitRootValue: "0x83fc198de31e1b2b1a8212d2430fbb7766c13d9ad305637dea3759065606475d", +
    +
    + 189 + +
    + - + rollupExitRootValue: "0xadb91a6a1fce56eaea561002bc9a993f4e65a7710bd72f4eee3067cbd73a743c", +
    +
    + 190 + +
    + - + globalExitRootValue: "0x5bf4af1a651a2a74b36e6eb208481f94c69fc959f756223dfa49608061937585", +
    +
    + 191 + +
    + - + previousBlockHashValue: "0xe865e912b504572a4d80ad018e29797e3c11f00bf9ae2549548a25779c9d7e57", +
    +
    + 192 + +
    + - + l1InfoRootValue: "0x2b9484b83c6398033241865b015fb9430eb3e159182a6075d00c924845cc393e", +
    +
    + 193 + +
    + - + } +
    +
    + 194 + +
    + - + runMigrationTest(t, 13, m) +
    +
    + 195 + +
    +   + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 8 + +
    +   + "github.com/stretchr/testify/assert" +
    +
    + 9 + +
    +   + ) +
    +
    + 10 + +
    +   +
    +
    +
    + 11 + +
    + + + const ( +
    +
    + 12 + +
    + + + blockHashValue = "0x29e885edaf8e4b51e1d2e05f9da28161d2fb4f6b1d53827d9b80a23cf2d7d9f1" +
    +
    + 13 + +
    + + + mainExitRootValue = "0x83fc198de31e1b2b1a8212d2430fbb7766c13d9ad305637dea3759065606475d" +
    +
    + 14 + +
    + + + rollupExitRootValue = "0xadb91a6a1fce56eaea561002bc9a993f4e65a7710bd72f4eee3067cbd73a743c" +
    +
    + 15 + +
    + + + globalExitRootValue = "0x5bf4af1a651a2a74b36e6eb208481f94c69fc959f756223dfa49608061937585" +
    +
    + 16 + +
    + + + previousBlockHashValue = "0xe865e912b504572a4d80ad018e29797e3c11f00bf9ae2549548a25779c9d7e57" +
    +
    + 17 + +
    + + + l1InfoRootValue = "0x2b9484b83c6398033241865b015fb9430eb3e159182a6075d00c924845cc393e" +
    +
    + 18 + +
    + + + ) +
    +
    + 19 + +
    + + +
    +
    +
    + 20 + +
    +   + // this migration changes length of the token name +
    +
    + 21 + +
    + + + type migrationTest0013 struct{} +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 22 + +
    +   +
    +
    +
    + 23 + +
    +   + func (m migrationTest0013) insertBlock(blockNumber uint64, db *sql.DB) error { +
    +
    + 24 + +
    +   + const addBlock = "INSERT INTO state.block (block_num, received_at, block_hash) VALUES ($1, $2, $3)" +
    +
    + 25 + +
    + + + if _, err := db.Exec(addBlock, blockNumber, time.Now(), blockHashValue); err != nil { +
    +
    + 26 + +
    +   + return err +
    +
    + 27 + +
    +   + } +
    +
    + 28 + +
    +   + return nil +
    +
    +
     
    +
    + 45 + +
    +   + if err = m.insertBlock(uint64(124), db); err != nil { +
    +
    + 46 + +
    +   + return err +
    +
    + 47 + +
    +   + } +
    +
    + 48 + +
    + + + if err = m.insertRowInOldTable(db, []interface{}{123, time.Now(), mainExitRootValue, rollupExitRootValue, globalExitRootValue}); err != nil { +
    +
    + 49 + +
    +   + return err +
    +
    + 50 + +
    +   + } +
    +
    + 51 + +
    + + + if err = m.insertRowInOldTable(db, []interface{}{124, time.Now(), mainExitRootValue, rollupExitRootValue, globalExitRootValue}); err != nil { +
    +
    + 52 + +
    +   + return err +
    +
    + 53 + +
    +   + } +
    +
    + 54 + +
    +   +
    +
    +
    +
     
    +
    + 113 + +
    +   + assert.NoError(t, err) +
    +
    + 114 + +
    +   + err = m.insertBlock(uint64(127), db) +
    +
    + 115 + +
    +   + assert.NoError(t, err) +
    +
    + 116 + +
    + + + prevBlockHash := previousBlockHashValue +
    +
    + 117 + +
    + + + l1InfoRoot := l1InfoRootValue +
    +
    + 118 + +
    + + + err = m.insertRowInMigratedTable(db, []interface{}{125, time.Now(), mainExitRootValue, rollupExitRootValue, globalExitRootValue, prevBlockHash, l1InfoRoot, 1}) +
    +
    + 119 + +
    +   + assert.NoError(t, err) +
    +
    + 120 + +
    +   + // insert duplicated l1_info_root +
    +
    + 121 + +
    + + + err = m.insertRowInMigratedTable(db, []interface{}{126, time.Now(), mainExitRootValue, rollupExitRootValue, globalExitRootValue, prevBlockHash, l1InfoRoot, 1}) +
    +
    + 122 + +
    +   + assert.Error(t, err) +
    +
    + 123 + +
    +   +
    +
    +
    + 124 + +
    +   + // insert in the old way must work +
    +
    + 125 + +
    + + + err = m.insertRowInOldTable(db, []interface{}{127, time.Now(), mainExitRootValue, rollupExitRootValue, globalExitRootValue}) +
    +
    + 126 + +
    +   + assert.NoError(t, err) +
    +
    + 127 + +
    +   +
    +
    +
    + 128 + +
    +   + sqlSelect := `SELECT prev_block_hash, l1_info_root FROM state.exit_root WHERE l1_info_tree_index = $1` +
    +
    +
     
    +
    + 185 + +
    +   + } +
    +
    + 186 + +
    +   +
    +
    +
    + 187 + +
    +   + func TestMigration0013(t *testing.T) { +
    +
    + 188 + +
    + + + runMigrationTest(t, 13, migrationTest0013{}) +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 189 + +
    +   + } +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/state/0019.sql + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,81 +1,25 @@
    +
    + 1 + +
    +   + -- +migrate Up +
    +
    + 2 + +
    + - + CREATE TABLE state.blob_inner +
    +
    + 3 + +
    + - + ( +
    +
    + 4 + +
    + - + blob_inner_num BIGINT PRIMARY KEY, +
    +
    + 5 + +
    + - + data BYTEA, +
    +
    + 6 + +
    + - + block_num BIGINT NOT NULL REFERENCES state.block (block_num) ON DELETE CASCADE +
    +
    + 7 + +
    + - + ); +
    +
    + 8 + +
    +   +
    +
    +
    + 9 + +
    + - + ALTER TABLE state.virtual_batch +
    +
    + 10 + +
    + - + ADD COLUMN IF NOT EXISTS blob_inner_num BIGINT, -- REFERENCES state.blob_inner (blob_inner_num), +
    +
    + 11 + +
    + - + ADD COLUMN IF NOT EXISTS prev_l1_it_root VARCHAR, +
    +
    + 12 + +
    + - + ADD COLUMN IF NOT EXISTS prev_l1_it_index BIGINT; +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 13 + +
    +   +
    +
    +
    + 14 + +
    + - + ALTER TABLE IF EXISTS state.proof RENAME TO batch_proof; +
    +
    + 15 + +
    + - +
    +
    +
    + 16 + +
    + - + ALTER TABLE state.batch_proof +
    +
    + 17 + +
    + - + ADD COLUMN IF NOT EXISTS blob_inner_num BIGINT; -- NOT NULL REFERENCES state.blob_inner (blob_inner_num) ON DELETE CASCADE; +
    +
    + 18 + +
    + - +
    +
    +
    + 19 + +
    + - + CREATE TABLE state.blob_inner_proof +
    +
    + 20 + +
    + - + ( +
    +
    + 21 + +
    + - + blob_inner_num BIGINT NOT NULL, -- REFERENCES state.blob_inner (blob_inner_num) ON DELETE CASCADE, +
    +
    + 22 + +
    + - + proof_id VARCHAR, +
    +
    + 23 + +
    + - + proof VARCHAR, +
    +
    + 24 + +
    + - + input_prover VARCHAR, +
    +
    + 25 + +
    + - + prover VARCHAR, +
    +
    + 26 + +
    + - + prover_id VARCHAR, +
    +
    + 27 + +
    + - + created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), +
    +
    + 28 + +
    + - + updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), +
    +
    + 29 + +
    + - + generating_since TIMESTAMP WITH TIME ZONE, +
    +
    + 30 + +
    + - + PRIMARY KEY (blob_inner_num) +
    +
    + 31 + +
    + - + ); +
    +
    + 32 + +
    + - +
    +
    +
    + 33 + +
    + - + CREATE TABLE state.blob_outer_proof +
    +
    + 34 + +
    + - + ( +
    +
    + 35 + +
    + - + blob_outer_num BIGINT NOT NULL, -- REFERENCES state.blob_inner (blob_inner_num) ON DELETE CASCADE, +
    +
    + 36 + +
    + - + blob_outer_num_final BIGINT NOT NULL, -- REFERENCES state.blob_inner (blob_inner_num) ON DELETE CASCADE, +
    +
    + 37 + +
    + - + proof_id VARCHAR, +
    +
    + 38 + +
    + - + proof VARCHAR, +
    +
    + 39 + +
    + - + input_prover VARCHAR, +
    +
    + 40 + +
    + - + prover VARCHAR, +
    +
    + 41 + +
    + - + prover_id VARCHAR, +
    +
    + 42 + +
    + - + created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), +
    +
    + 43 + +
    + - + updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), +
    +
    + 44 + +
    + - + generating_since TIMESTAMP WITH TIME ZONE, +
    +
    + 45 + +
    + - + PRIMARY KEY (blob_outer_num, blob_outer_num_final) +
    +
    + 46 + +
    + - + ); +
    +
    + 47 + +
    +   +
    +
    +
    + 48 + +
    +   + -- +migrate Down +
    +
    + 49 + +
    + - + ALTER TABLE state.virtual_batch +
    +
    + 50 + +
    + - + DROP COLUMN IF EXISTS blob_inner_num, +
    +
    + 51 + +
    + - + DROP COLUMN IF EXISTS prev_l1_it_root, +
    +
    + 52 + +
    + - + DROP COLUMN IF EXISTS prev_l1_it_index; +
    +
    + 53 + +
    + - +
    +
    +
    + 54 + +
    + - + DROP TABLE state.blob_outer_proof; +
    +
    + 55 + +
    + - +
    +
    +
    + 56 + +
    + - + DROP TABLE state.blob_inner_proof; +
    +
    + 57 + +
    + - +
    +
    +
    + 58 + +
    + - + DROP TABLE state.batch_proof; +
    +
    + 59 + +
    + - +
    +
    +
    + 60 + +
    + - + DROP TABLE state.blob_inner; +
    +
    + 61 + +
    + - +
    +
    +
    + 62 + +
    + - + CREATE TABLE state.proof +
    +
    + 63 + +
    + - + ( +
    +
    + 64 + +
    + - + batch_num BIGINT NOT NULL REFERENCES state.batch (batch_num) ON DELETE CASCADE, +
    +
    + 65 + +
    + - + batch_num_final BIGINT NOT NULL REFERENCES state.batch (batch_num) ON DELETE CASCADE, +
    +
    + 66 + +
    + - + proof_id VARCHAR, +
    +
    + 67 + +
    + - + proof VARCHAR, +
    +
    + 68 + +
    + - + input_prover VARCHAR, +
    +
    + 69 + +
    + - + prover VARCHAR, +
    +
    + 70 + +
    + - + prover_id VARCHAR, +
    +
    + 71 + +
    + - + created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), +
    +
    + 72 + +
    + - + updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), +
    +
    + 73 + +
    + - + generating_since TIMESTAMP WITH TIME ZONE, +
    +
    + 74 + +
    + - + PRIMARY KEY (batch_num, batch_num_final) +
    +
    + 75 + +
    + - + ); +
    +
    + 76 + +
    +   +
    +
    +
    + 77 + +
    + - + ALTER TABLE state.virtual_batch +
    +
    + 78 + +
    + - + DROP COLUMN IF EXISTS blob_inner_num, +
    +
    + 79 + +
    + - + DROP COLUMN IF EXISTS prev_l1_it_root, +
    +
    + 80 + +
    + - + DROP COLUMN IF EXISTS prev_l1_it_index; +
    +
    + 81 + +
    + - + +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 1 + +
    +   + -- +migrate Up +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 2 + +
    +   +
    +
    +
    + 3 + +
    + + + -- the update below fix the wrong receipt TX indexes +
    +
    + 4 + +
    + + + WITH map_fix_tx_index AS ( +
    +
    + 5 + +
    + + + SELECT t.l2_block_num AS block_num +
    +
    + 6 + +
    + + + , t.hash AS tx_hash +
    +
    + 7 + +
    + + + , r.tx_index AS current_index +
    +
    + 8 + +
    + + + , (ROW_NUMBER() OVER (PARTITION BY t.l2_block_num ORDER BY r.tx_index))-1 AS correct_index +
    +
    + 9 + +
    + + + FROM state.receipt r +
    +
    + 10 + +
    + + + INNER JOIN state."transaction" t +
    +
    + 11 + +
    + + + ON t.hash = r.tx_hash +
    +
    + 12 + +
    + + + ) +
    +
    + 13 + +
    + + + UPDATE state.receipt AS r +
    +
    + 14 + +
    + + + SET tx_index = m.correct_index +
    +
    + 15 + +
    + + + FROM map_fix_tx_index m +
    +
    + 16 + +
    + + + WHERE m.block_num = r.block_num +
    +
    + 17 + +
    + + + AND m.tx_hash = r.tx_hash +
    +
    + 18 + +
    + + + AND m.current_index = r.tx_index +
    +
    + 19 + +
    + + + AND m.current_index != m.correct_index; +
    +
    + 20 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 21 + +
    +   +
    +
    +
    + 22 + +
    +   + -- +migrate Down +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 23 + +
    +   +
    +
    +
    + 24 + +
    + + + -- no action is needed, the data fixed by the +
    +
    + 25 + +
    + + + -- migrate up must remain fixed +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/state/0019_test.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -4,116 +4,142 @@
    +
    + 4 + +
    +   + "database/sql" +
    +
    + 5 + +
    +   + "testing" +
    +
    + 6 + +
    +   +
    +
    +
    + 7 + +
    + - + "github.com/stretchr/testify/assert" +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 8 + +
    +   + ) +
    +
    + 9 + +
    +   +
    +
    +
    + 10 + +
    + - + type migrationTest0019 struct { +
    +
    + 11 + +
    + - + migrationBase +
    +
    + + +
    +   +
    +
    +
    + 12 + +
    +   + } +
    +
    + 13 + +
    +   +
    +
    +
    + 14 + +
    + - + func (m migrationTest0019) InsertData(db *sql.DB) error { +
    +
    + 15 + +
    + - + const insertBatch1 = ` +
    +
    + 16 + +
    + - + INSERT INTO state.batch (batch_num, global_exit_root, local_exit_root, acc_input_hash, state_root, timestamp, coinbase, raw_txs_data, forced_batch_num, wip) +
    +
    + 17 + +
    + - + VALUES (1,'0x0001', '0x0001', '0x0001', '0x0001', now(), '0x0001', null, null, true)` +
    +
    + 18 + +
    +   +
    +
    +
    + 19 + +
    + - + _, err := db.Exec(insertBatch1) +
    +
    + 20 + +
    + - + if err != nil { +
    +
    + 21 + +
    + - + return err +
    +
    + 22 + +
    + - + } +
    +
    + 23 + +
    +   +
    +
    +
    + 24 + +
    + - + const insertBatch2 = ` +
    +
    + 25 + +
    + - + INSERT INTO state.batch (batch_num, global_exit_root, local_exit_root, acc_input_hash, state_root, timestamp, coinbase, raw_txs_data, forced_batch_num, wip) +
    +
    + 26 + +
    + - + VALUES (2,'0x0002', '0x0002', '0x0002', '0x0002', now(), '0x0002', null, null, true)` +
    +
    + 27 + +
    +   +
    +
    +
    + 28 + +
    + - + _, err = db.Exec(insertBatch2) +
    +
    + 29 + +
    + - + if err != nil { +
    +
    + + +
    +   +
    +
    +
    + 30 + +
    +   + return err +
    +
    + 31 + +
    +   + } +
    +
    + 32 + +
    +   +
    +
    +
    + 33 + +
    + - + const insertBlock1 = "INSERT INTO state.block (block_num, block_hash, parent_hash, received_at) VALUES (1,'0x0001', '0x0001', now())" +
    +
    + 34 + +
    + - +
    +
    +
    + 35 + +
    + - + _, err = db.Exec(insertBlock1) +
    +
    + 36 + +
    + - + if err != nil { +
    +
    + 37 + +
    +   + return err +
    +
    + 38 + +
    +   + } +
    +
    + 39 + +
    +   +
    +
    +
    + 40 + +
    + - + const insertBlock2 = "INSERT INTO state.block (block_num, block_hash, parent_hash, received_at) VALUES (2,'0x0002', '0x0002', now())" +
    +
    + 41 + +
    + - +
    +
    +
    + 42 + +
    + - + _, err = db.Exec(insertBlock2) +
    +
    + 43 + +
    + - + if err != nil { +
    +
    + 44 + +
    + - + return err +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 45 + +
    +   + } +
    +
    + 46 + +
    +   +
    +
    +
    + 47 + +
    +   + return nil +
    +
    + 48 + +
    +   + } +
    +
    + 49 + +
    +   +
    +
    +
    + 50 + +
    +   + func (m migrationTest0019) RunAssertsAfterMigrationUp(t *testing.T, db *sql.DB) { +
    +
    + 51 + +
    + - + m.AssertNewAndRemovedItemsAfterMigrationUp(t, db) +
    +
    + 52 + +
    +   +
    +
    +
    + 53 + +
    + - + // Insert blobInner 1 +
    +
    + 54 + +
    + - + const insertBlobInner = `INSERT INTO state.blob_inner (blob_inner_num, data, block_num) VALUES (1, E'\\x1234', 1);` +
    +
    + 55 + +
    + - + _, err := db.Exec(insertBlobInner) +
    +
    + 56 + +
    + - + assert.NoError(t, err) +
    +
    + 57 + +
    + - +
    +
    +
    + 58 + +
    + - + const insertBatch1 = ` +
    +
    + 59 + +
    + - + INSERT INTO state.virtual_batch (batch_num, tx_hash, coinbase, block_num, sequencer_addr, timestamp_batch_etrog, l1_info_root, blob_inner_num, prev_l1_it_root, prev_l1_it_index) +
    +
    + 60 + +
    + - + VALUES (1,'0x0001', '0x0001', 1, '0x0001', now(), '0x0001', 1, '0x0001', 1)` +
    +
    + 61 + +
    + - +
    +
    +
    + 62 + +
    + - + _, err = db.Exec(insertBatch1) +
    +
    + 63 + +
    + - + assert.NoError(t, err) +
    +
    + 64 + +
    + - +
    +
    +
    + 65 + +
    + - + const insertBatch2 = ` +
    +
    + 66 + +
    + - + INSERT INTO state.virtual_batch (batch_num, tx_hash, coinbase, block_num, sequencer_addr, timestamp_batch_etrog, l1_info_root, blob_inner_num, prev_l1_it_root, prev_l1_it_index) +
    +
    + 67 + +
    + - + VALUES (2,'0x0002', '0x0002', 2, '0x0002', now(), '0x0002', 1, '0x0002', 2)` +
    +
    + 68 + +
    +   +
    +
    +
    + 69 + +
    + - + _, err = db.Exec(insertBatch2) +
    +
    + 70 + +
    + - + assert.NoError(t, err) +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 71 + +
    +   + } +
    +
    + 72 + +
    +   +
    +
    +
    + 73 + +
    +   + func (m migrationTest0019) RunAssertsAfterMigrationDown(t *testing.T, db *sql.DB) { +
    +
    + 74 + +
    + - + var result int +
    +
    + 75 + +
    + - +
    +
    +
    + 76 + +
    + - + m.AssertNewAndRemovedItemsAfterMigrationDown(t, db) +
    +
    + 77 + +
    + - +
    +
    +
    + 78 + +
    + - + // Check column blob_inner_num doesn't exists in state.virtual_batch table +
    +
    + 79 + +
    + - + const getBlobInnerNumColumn = `SELECT count(*) FROM information_schema.columns WHERE table_name='virtual_batch' and column_name='blob_inner_num'` +
    +
    + 80 + +
    + - + row := db.QueryRow(getBlobInnerNumColumn) +
    +
    + 81 + +
    + - + assert.NoError(t, row.Scan(&result)) +
    +
    + 82 + +
    + - + assert.Equal(t, 0, result) +
    +
    + 83 + +
    + - +
    +
    +
    + 84 + +
    + - + // Check column prev_l1_it_root doesn't exists in state.virtual_batch table +
    +
    + 85 + +
    + - + const getPrevL1ITRootColumn = `SELECT count(*) FROM information_schema.columns WHERE table_name='virtual_batch' and column_name='prev_l1_it_root'` +
    +
    + 86 + +
    + - + row = db.QueryRow(getPrevL1ITRootColumn) +
    +
    + 87 + +
    + - + assert.NoError(t, row.Scan(&result)) +
    +
    + 88 + +
    + - + assert.Equal(t, 0, result) +
    +
    + 89 + +
    + - +
    +
    +
    + 90 + +
    + - + // Check column prev_l1_it_index doesn't exists in state.virtual_batch table +
    +
    + 91 + +
    + - + const getPrevL1ITIndexColumn = `SELECT count(*) FROM information_schema.columns WHERE table_name='virtual_batch' and column_name='prev_l1_it_index'` +
    +
    + 92 + +
    + - + row = db.QueryRow(getPrevL1ITIndexColumn) +
    +
    + 93 + +
    + - + assert.NoError(t, row.Scan(&result)) +
    +
    + 94 + +
    + - + assert.Equal(t, 0, result) +
    +
    + 95 + +
    +   + } +
    +
    + 96 + +
    +   +
    +
    +
    + 97 + +
    +   + func TestMigration0019(t *testing.T) { +
    +
    + 98 + +
    + - + m := migrationTest0019{ +
    +
    + 99 + +
    + - + migrationBase: migrationBase{ +
    +
    + 100 + +
    + - + removedTables: []tableMetadata{ +
    +
    + 101 + +
    + - + {"state", "proof"}, +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 102 + +
    +   + }, +
    +
    + 103 + +
    + - +
    +
    +
    + 104 + +
    + - + newTables: []tableMetadata{ +
    +
    + 105 + +
    + - + {"state", "blob_inner"}, +
    +
    + 106 + +
    + - + {"state", "batch_proof"}, +
    +
    + 107 + +
    + - + {"state", "blob_inner_proof"}, +
    +
    + 108 + +
    + - + {"state", "blob_outer_proof"}, +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 109 + +
    +   + }, +
    +
    + 110 + +
    + - +
    +
    +
    + 111 + +
    + - + newColumns: []columnMetadata{ +
    +
    + 112 + +
    + - + {"state", "virtual_batch", "blob_inner_num"}, +
    +
    + 113 + +
    + - + {"state", "virtual_batch", "prev_l1_it_root"}, +
    +
    + 114 + +
    + - + {"state", "virtual_batch", "prev_l1_it_index"}, +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 115 + +
    +   + }, +
    +
    + 116 + +
    +   + }, +
    +
    + 117 + +
    + - + } +
    +
    + 118 + +
    + - + runMigrationTest(t, 19, m) +
    +
    + 119 + +
    +   + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 4 + +
    +   + "database/sql" +
    +
    + 5 + +
    +   + "testing" +
    +
    + 6 + +
    +   +
    +
    +
    + 7 + +
    + + + "github.com/0xPolygonHermez/zkevm-node/hex" +
    +
    + 8 + +
    + + + "github.com/ethereum/go-ethereum/common" +
    +
    + 9 + +
    + + + "github.com/stretchr/testify/require" +
    +
    + 10 + +
    +   + ) +
    +
    + 11 + +
    +   +
    +
    +
    + 12 + +
    + + + type migrationTest0019TestCase struct { +
    +
    + 13 + +
    + + + Name string +
    +
    + 14 + +
    + + + Block migrationTest0019TestCaseBlock +
    +
    + 15 + +
    +   + } +
    +
    + 16 + +
    +   +
    +
    +
    + 17 + +
    + + + type migrationTest0019TestCaseBlock struct { +
    +
    + 18 + +
    + + + Transactions []migrationTest0019TestCaseTransaction +
    +
    + 19 + +
    + + + } +
    +
    + + +
    +   +
    +
    +
    + 20 + +
    +   +
    +
    +
    + 21 + +
    + + + type migrationTest0019TestCaseTransaction struct { +
    +
    + 22 + +
    + + + CurrentIndex uint +
    +
    + 23 + +
    + + + } +
    +
    + + +
    +   +
    +
    +
    + 24 + +
    +   +
    +
    +
    + 25 + +
    + + + type migrationTest0019 struct { +
    +
    + 26 + +
    + + + TestCases []migrationTest0019TestCase +
    +
    + 27 + +
    + + + } +
    +
    + 28 + +
    +   +
    +
    +
    + 29 + +
    + + + func (m migrationTest0019) InsertData(db *sql.DB) error { +
    +
    + 30 + +
    + + + const addBlock0 = "INSERT INTO state.block (block_num, received_at, block_hash) VALUES (0, now(), '0x0')" +
    +
    + 31 + +
    + + + if _, err := db.Exec(addBlock0); err != nil { +
    +
    + 32 + +
    +   + return err +
    +
    + 33 + +
    +   + } +
    +
    + 34 + +
    +   +
    +
    +
    + 35 + +
    + + + const addBatch0 = ` +
    +
    + 36 + +
    + + + INSERT INTO state.batch (batch_num, global_exit_root, local_exit_root, acc_input_hash, state_root, timestamp, coinbase, raw_txs_data, forced_batch_num, wip) +
    +
    + 37 + +
    + + + VALUES (0,'0x0000', '0x0000', '0x0000', '0x0000', now(), '0x0000', null, null, true)` +
    +
    + 38 + +
    + + + if _, err := db.Exec(addBatch0); err != nil { +
    +
    + 39 + +
    +   + return err +
    +
    + 40 + +
    +   + } +
    +
    + 41 + +
    +   +
    +
    +
    + 42 + +
    + + + const addL2Block = "INSERT INTO state.l2block (block_num, block_hash, header, uncles, parent_hash, state_root, received_at, batch_num, created_at) VALUES ($1, $2, '{}', '{}', '0x0', '0x0', now(), 0, now())" +
    +
    + 43 + +
    + + + const addTransaction = "INSERT INTO state.transaction (hash, encoded, decoded, l2_block_num, effective_percentage, l2_hash) VALUES ($1, 'ABCDEF', '{}', $2, 255, $1)" +
    +
    + 44 + +
    + + + const addReceipt = "INSERT INTO state.receipt (tx_hash, type, post_state, status, cumulative_gas_used, gas_used, effective_gas_price, block_num, tx_index, contract_address) VALUES ($1, 1, null, 1, 1234, 1234, 1, $2, $3, '')" +
    +
    + 45 + +
    + + +
    +
    +
    + 46 + +
    + + + txUnique := 0 +
    +
    + 47 + +
    + + + for tci, testCase := range m.TestCases { +
    +
    + 48 + +
    + + + blockNum := uint64(tci + 1) +
    +
    + 49 + +
    + + + blockHash := common.HexToHash(hex.EncodeUint64(blockNum)).String() +
    +
    + 50 + +
    + + + if _, err := db.Exec(addL2Block, blockNum, blockHash); err != nil { +
    +
    + 51 + +
    + + + return err +
    +
    + 52 + +
    + + + } +
    +
    + 53 + +
    + + + for _, tx := range testCase.Block.Transactions { +
    +
    + 54 + +
    + + + txUnique++ +
    +
    + 55 + +
    + + + txHash := common.HexToHash(hex.EncodeUint64(uint64(txUnique))).String() +
    +
    + 56 + +
    + + + if _, err := db.Exec(addTransaction, txHash, blockNum); err != nil { +
    +
    + 57 + +
    + + + return err +
    +
    + 58 + +
    + + + } +
    +
    + 59 + +
    + + + if _, err := db.Exec(addReceipt, txHash, blockNum, tx.CurrentIndex); err != nil { +
    +
    + 60 + +
    + + + return err +
    +
    + 61 + +
    + + + } +
    +
    + 62 + +
    + + + } +
    +
    + 63 + +
    +   + } +
    +
    + 64 + +
    +   +
    +
    +
    + 65 + +
    +   + return nil +
    +
    + 66 + +
    +   + } +
    +
    + 67 + +
    +   +
    +
    +
    + 68 + +
    +   + func (m migrationTest0019) RunAssertsAfterMigrationUp(t *testing.T, db *sql.DB) { +
    +
    + 69 + +
    + + + const getReceiptsByBlock = "SELECT r.tx_index FROM state.receipt r WHERE r.block_num = $1 ORDER BY r.tx_index" +
    +
    + 70 + +
    +   +
    +
    +
    + 71 + +
    + + + for tci := range m.TestCases { +
    +
    + 72 + +
    + + + blockNum := uint64(tci + 1) +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 73 + +
    +   +
    +
    +
    + 74 + +
    + + + rows, err := db.Query(getReceiptsByBlock, blockNum) +
    +
    + 75 + +
    + + + require.NoError(t, err) +
    +
    + 76 + +
    + + +
    +
    +
    + 77 + +
    + + + var expectedIndex = uint(0) +
    +
    + 78 + +
    + + + var txIndex uint +
    +
    + 79 + +
    + + + for rows.Next() { +
    +
    + 80 + +
    + + + err := rows.Scan(&txIndex) +
    +
    + 81 + +
    + + + require.NoError(t, err) +
    +
    + 82 + +
    + + + require.Equal(t, expectedIndex, txIndex) +
    +
    + 83 + +
    + + + expectedIndex++ +
    +
    + 84 + +
    + + + } +
    +
    + 85 + +
    + + + } +
    +
    + 86 + +
    +   + } +
    +
    + 87 + +
    +   +
    +
    +
    + 88 + +
    +   + func (m migrationTest0019) RunAssertsAfterMigrationDown(t *testing.T, db *sql.DB) { +
    +
    + 89 + +
    + + + m.RunAssertsAfterMigrationUp(t, db) +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 90 + +
    +   + } +
    +
    + 91 + +
    +   +
    +
    +
    + 92 + +
    +   + func TestMigration0019(t *testing.T) { +
    +
    + 93 + +
    + + + runMigrationTest(t, 19, migrationTest0019{ +
    +
    + 94 + +
    + + + TestCases: []migrationTest0019TestCase{ +
    +
    + 95 + +
    + + + { +
    +
    + 96 + +
    + + + Name: "single tx with correct index", +
    +
    + 97 + +
    + + + Block: migrationTest0019TestCaseBlock{ +
    +
    + 98 + +
    + + + Transactions: []migrationTest0019TestCaseTransaction{ +
    +
    + 99 + +
    + + + {CurrentIndex: 0}, +
    +
    + 100 + +
    + + + }, +
    +
    + 101 + +
    + + + }, +
    +
    + 102 + +
    +   + }, +
    +
    + 103 + +
    + + + { +
    +
    + 104 + +
    + + + Name: "multiple txs indexes are correct", +
    +
    + 105 + +
    + + + Block: migrationTest0019TestCaseBlock{ +
    +
    + 106 + +
    + + + Transactions: []migrationTest0019TestCaseTransaction{ +
    +
    + 107 + +
    + + + {CurrentIndex: 0}, +
    +
    + 108 + +
    + + + {CurrentIndex: 1}, +
    +
    + 109 + +
    + + + {CurrentIndex: 2}, +
    +
    + 110 + +
    + + + }, +
    +
    + 111 + +
    + + + }, +
    +
    + 112 + +
    +   + }, +
    +
    + 113 + +
    + + + { +
    +
    + 114 + +
    + + + Name: "single tx with wrong tx index", +
    +
    + 115 + +
    + + + Block: migrationTest0019TestCaseBlock{ +
    +
    + 116 + +
    + + + Transactions: []migrationTest0019TestCaseTransaction{ +
    +
    + 117 + +
    + + + {CurrentIndex: 3}, +
    +
    + 118 + +
    + + + }, +
    +
    + 119 + +
    + + + }, +
    +
    + 120 + +
    + + + }, +
    +
    + 121 + +
    + + + { +
    +
    + 122 + +
    + + + Name: "multiple txs missing 0 index", +
    +
    + 123 + +
    + + + Block: migrationTest0019TestCaseBlock{ +
    +
    + 124 + +
    + + + Transactions: []migrationTest0019TestCaseTransaction{ +
    +
    + 125 + +
    + + + {CurrentIndex: 1}, +
    +
    + 126 + +
    + + + {CurrentIndex: 2}, +
    +
    + 127 + +
    + + + {CurrentIndex: 3}, +
    +
    + 128 + +
    + + + {CurrentIndex: 4}, +
    +
    + 129 + +
    + + + }, +
    +
    + 130 + +
    + + + }, +
    +
    + 131 + +
    + + + }, +
    +
    + 132 + +
    + + + { +
    +
    + 133 + +
    + + + Name: "multiple has index 0 but also txs index gap", +
    +
    + 134 + +
    + + + Block: migrationTest0019TestCaseBlock{ +
    +
    + 135 + +
    + + + Transactions: []migrationTest0019TestCaseTransaction{ +
    +
    + 136 + +
    + + + {CurrentIndex: 0}, +
    +
    + 137 + +
    + + + {CurrentIndex: 2}, +
    +
    + 138 + +
    + + + {CurrentIndex: 4}, +
    +
    + 139 + +
    + + + {CurrentIndex: 6}, +
    +
    + 140 + +
    + + + }, +
    +
    + 141 + +
    + + + }, +
    +
    + 142 + +
    +   + }, +
    +
    + 143 + +
    +   + }, +
    +
    + 144 + +
    + + + }) +
    +
    + + +
    +   +
    +
    +
    + 145 + +
    +   + } +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/state/0021.sql + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,25 +0,0 @@
    +
    + 1 + +
    + - + -- +migrate Up +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + -- the update below fix the wrong receipt TX indexes +
    +
    + 4 + +
    + - + WITH map_fix_tx_index AS ( +
    +
    + 5 + +
    + - + SELECT t.l2_block_num AS block_num +
    +
    + 6 + +
    + - + , t.hash AS tx_hash +
    +
    + 7 + +
    + - + , r.tx_index AS current_index +
    +
    + 8 + +
    + - + , (ROW_NUMBER() OVER (PARTITION BY t.l2_block_num ORDER BY r.tx_index))-1 AS correct_index +
    +
    + 9 + +
    + - + FROM state.receipt r +
    +
    + 10 + +
    + - + INNER JOIN state."transaction" t +
    +
    + 11 + +
    + - + ON t.hash = r.tx_hash +
    +
    + 12 + +
    + - + ) +
    +
    + 13 + +
    + - + UPDATE state.receipt AS r +
    +
    + 14 + +
    + - + SET tx_index = m.correct_index +
    +
    + 15 + +
    + - + FROM map_fix_tx_index m +
    +
    + 16 + +
    + - + WHERE m.block_num = r.block_num +
    +
    + 17 + +
    + - + AND m.tx_hash = r.tx_hash +
    +
    + 18 + +
    + - + AND m.current_index = r.tx_index +
    +
    + 19 + +
    + - + AND m.current_index != m.correct_index; +
    +
    + 20 + +
    + - +
    +
    +
    + 21 + +
    + - +
    +
    +
    + 22 + +
    + - + -- +migrate Down +
    +
    + 23 + +
    + - +
    +
    +
    + 24 + +
    + - + -- no action is needed, the data fixed by the +
    +
    + 25 + +
    + - + -- migrate up must remain fixed +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/state/0021_test.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,145 +0,0 @@
    +
    + 1 + +
    + - + package migrations_test +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + import ( +
    +
    + 4 + +
    + - + "database/sql" +
    +
    + 5 + +
    + - + "testing" +
    +
    + 6 + +
    + - +
    +
    +
    + 7 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/hex" +
    +
    + 8 + +
    + - + "github.com/ethereum/go-ethereum/common" +
    +
    + 9 + +
    + - + "github.com/stretchr/testify/require" +
    +
    + 10 + +
    + - + ) +
    +
    + 11 + +
    + - +
    +
    +
    + 12 + +
    + - + type migrationTest0021TestCase struct { +
    +
    + 13 + +
    + - + Name string +
    +
    + 14 + +
    + - + Block migrationTest0021TestCaseBlock +
    +
    + 15 + +
    + - + } +
    +
    + 16 + +
    + - +
    +
    +
    + 17 + +
    + - + type migrationTest0021TestCaseBlock struct { +
    +
    + 18 + +
    + - + Transactions []migrationTest0021TestCaseTransaction +
    +
    + 19 + +
    + - + } +
    +
    + 20 + +
    + - +
    +
    +
    + 21 + +
    + - + type migrationTest0021TestCaseTransaction struct { +
    +
    + 22 + +
    + - + CurrentIndex uint +
    +
    + 23 + +
    + - + } +
    +
    + 24 + +
    + - +
    +
    +
    + 25 + +
    + - + type migrationTest0021 struct { +
    +
    + 26 + +
    + - + TestCases []migrationTest0021TestCase +
    +
    + 27 + +
    + - + } +
    +
    + 28 + +
    + - +
    +
    +
    + 29 + +
    + - + func (m migrationTest0021) InsertData(db *sql.DB) error { +
    +
    + 30 + +
    + - + const addBlock0 = "INSERT INTO state.block (block_num, received_at, block_hash) VALUES (0, now(), '0x0')" +
    +
    + 31 + +
    + - + if _, err := db.Exec(addBlock0); err != nil { +
    +
    + 32 + +
    + - + return err +
    +
    + 33 + +
    + - + } +
    +
    + 34 + +
    + - +
    +
    +
    + 35 + +
    + - + const addBatch0 = ` +
    +
    + 36 + +
    + - + INSERT INTO state.batch (batch_num, global_exit_root, local_exit_root, acc_input_hash, state_root, timestamp, coinbase, raw_txs_data, forced_batch_num, wip) +
    +
    + 37 + +
    + - + VALUES (0,'0x0000', '0x0000', '0x0000', '0x0000', now(), '0x0000', null, null, true)` +
    +
    + 38 + +
    + - + if _, err := db.Exec(addBatch0); err != nil { +
    +
    + 39 + +
    + - + return err +
    +
    + 40 + +
    + - + } +
    +
    + 41 + +
    + - +
    +
    +
    + 42 + +
    + - + const addL2Block = "INSERT INTO state.l2block (block_num, block_hash, header, uncles, parent_hash, state_root, received_at, batch_num, created_at) VALUES ($1, $2, '{}', '{}', '0x0', '0x0', now(), 0, now())" +
    +
    + 43 + +
    + - + const addTransaction = "INSERT INTO state.transaction (hash, encoded, decoded, l2_block_num, effective_percentage, l2_hash) VALUES ($1, 'ABCDEF', '{}', $2, 255, $1)" +
    +
    + 44 + +
    + - + const addReceipt = "INSERT INTO state.receipt (tx_hash, type, post_state, status, cumulative_gas_used, gas_used, effective_gas_price, block_num, tx_index, contract_address) VALUES ($1, 1, null, 1, 1234, 1234, 1, $2, $3, '')" +
    +
    + 45 + +
    + - +
    +
    +
    + 46 + +
    + - + txUnique := 0 +
    +
    + 47 + +
    + - + for tci, testCase := range m.TestCases { +
    +
    + 48 + +
    + - + blockNum := uint64(tci + 1) +
    +
    + 49 + +
    + - + blockHash := common.HexToHash(hex.EncodeUint64(blockNum)).String() +
    +
    + 50 + +
    + - + if _, err := db.Exec(addL2Block, blockNum, blockHash); err != nil { +
    +
    + 51 + +
    + - + return err +
    +
    + 52 + +
    + - + } +
    +
    + 53 + +
    + - + for _, tx := range testCase.Block.Transactions { +
    +
    + 54 + +
    + - + txUnique++ +
    +
    + 55 + +
    + - + txHash := common.HexToHash(hex.EncodeUint64(uint64(txUnique))).String() +
    +
    + 56 + +
    + - + if _, err := db.Exec(addTransaction, txHash, blockNum); err != nil { +
    +
    + 57 + +
    + - + return err +
    +
    + 58 + +
    + - + } +
    +
    + 59 + +
    + - + if _, err := db.Exec(addReceipt, txHash, blockNum, tx.CurrentIndex); err != nil { +
    +
    + 60 + +
    + - + return err +
    +
    + 61 + +
    + - + } +
    +
    + 62 + +
    + - + } +
    +
    + 63 + +
    + - + } +
    +
    + 64 + +
    + - +
    +
    +
    + 65 + +
    + - + return nil +
    +
    + 66 + +
    + - + } +
    +
    + 67 + +
    + - +
    +
    +
    + 68 + +
    + - + func (m migrationTest0021) RunAssertsAfterMigrationUp(t *testing.T, db *sql.DB) { +
    +
    + 69 + +
    + - + const getReceiptsByBlock = "SELECT r.tx_index FROM state.receipt r WHERE r.block_num = $1 ORDER BY r.tx_index" +
    +
    + 70 + +
    + - +
    +
    +
    + 71 + +
    + - + for tci := range m.TestCases { +
    +
    + 72 + +
    + - + blockNum := uint64(tci + 1) +
    +
    + 73 + +
    + - +
    +
    +
    + 74 + +
    + - + rows, err := db.Query(getReceiptsByBlock, blockNum) +
    +
    + 75 + +
    + - + require.NoError(t, err) +
    +
    + 76 + +
    + - +
    +
    +
    + 77 + +
    + - + var expectedIndex = uint(0) +
    +
    + 78 + +
    + - + var txIndex uint +
    +
    + 79 + +
    + - + for rows.Next() { +
    +
    + 80 + +
    + - + err := rows.Scan(&txIndex) +
    +
    + 81 + +
    + - + require.NoError(t, err) +
    +
    + 82 + +
    + - + require.Equal(t, expectedIndex, txIndex) +
    +
    + 83 + +
    + - + expectedIndex++ +
    +
    + 84 + +
    + - + } +
    +
    + 85 + +
    + - + } +
    +
    + 86 + +
    + - + } +
    +
    + 87 + +
    + - +
    +
    +
    + 88 + +
    + - + func (m migrationTest0021) RunAssertsAfterMigrationDown(t *testing.T, db *sql.DB) { +
    +
    + 89 + +
    + - + m.RunAssertsAfterMigrationUp(t, db) +
    +
    + 90 + +
    + - + } +
    +
    + 91 + +
    + - +
    +
    +
    + 92 + +
    + - + func TestMigration0021(t *testing.T) { +
    +
    + 93 + +
    + - + runMigrationTest(t, 21, migrationTest0021{ +
    +
    + 94 + +
    + - + TestCases: []migrationTest0021TestCase{ +
    +
    + 95 + +
    + - + { +
    +
    + 96 + +
    + - + Name: "single tx with correct index", +
    +
    + 97 + +
    + - + Block: migrationTest0021TestCaseBlock{ +
    +
    + 98 + +
    + - + Transactions: []migrationTest0021TestCaseTransaction{ +
    +
    + 99 + +
    + - + {CurrentIndex: 0}, +
    +
    + 100 + +
    + - + }, +
    +
    + 101 + +
    + - + }, +
    +
    + 102 + +
    + - + }, +
    +
    + 103 + +
    + - + { +
    +
    + 104 + +
    + - + Name: "multiple txs indexes are correct", +
    +
    + 105 + +
    + - + Block: migrationTest0021TestCaseBlock{ +
    +
    + 106 + +
    + - + Transactions: []migrationTest0021TestCaseTransaction{ +
    +
    + 107 + +
    + - + {CurrentIndex: 0}, +
    +
    + 108 + +
    + - + {CurrentIndex: 1}, +
    +
    + 109 + +
    + - + {CurrentIndex: 2}, +
    +
    + 110 + +
    + - + }, +
    +
    + 111 + +
    + - + }, +
    +
    + 112 + +
    + - + }, +
    +
    + 113 + +
    + - + { +
    +
    + 114 + +
    + - + Name: "single tx with wrong tx index", +
    +
    + 115 + +
    + - + Block: migrationTest0021TestCaseBlock{ +
    +
    + 116 + +
    + - + Transactions: []migrationTest0021TestCaseTransaction{ +
    +
    + 117 + +
    + - + {CurrentIndex: 3}, +
    +
    + 118 + +
    + - + }, +
    +
    + 119 + +
    + - + }, +
    +
    + 120 + +
    + - + }, +
    +
    + 121 + +
    + - + { +
    +
    + 122 + +
    + - + Name: "multiple txs missing 0 index", +
    +
    + 123 + +
    + - + Block: migrationTest0021TestCaseBlock{ +
    +
    + 124 + +
    + - + Transactions: []migrationTest0021TestCaseTransaction{ +
    +
    + 125 + +
    + - + {CurrentIndex: 1}, +
    +
    + 126 + +
    + - + {CurrentIndex: 2}, +
    +
    + 127 + +
    + - + {CurrentIndex: 3}, +
    +
    + 128 + +
    + - + {CurrentIndex: 4}, +
    +
    + 129 + +
    + - + }, +
    +
    + 130 + +
    + - + }, +
    +
    + 131 + +
    + - + }, +
    +
    + 132 + +
    + - + { +
    +
    + 133 + +
    + - + Name: "multiple has index 0 but also txs index gap", +
    +
    + 134 + +
    + - + Block: migrationTest0021TestCaseBlock{ +
    +
    + 135 + +
    + - + Transactions: []migrationTest0021TestCaseTransaction{ +
    +
    + 136 + +
    + - + {CurrentIndex: 0}, +
    +
    + 137 + +
    + - + {CurrentIndex: 2}, +
    +
    + 138 + +
    + - + {CurrentIndex: 4}, +
    +
    + 139 + +
    + - + {CurrentIndex: 6}, +
    +
    + 140 + +
    + - + }, +
    +
    + 141 + +
    + - + }, +
    +
    + 142 + +
    + - + }, +
    +
    + 143 + +
    + - + }, +
    +
    + 144 + +
    + - + }) +
    +
    + 145 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/state/0022.sql + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,12 +0,0 @@
    +
    + 1 + +
    + - + -- +migrate Up +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + -- +migrate Up +
    +
    + 4 + +
    + - + ALTER TABLE state.exit_root +
    +
    + 5 + +
    + - + ADD COLUMN IF NOT EXISTS l1_info_tree_recursive_index BIGINT DEFAULT NULL UNIQUE; +
    +
    + 6 + +
    + - + CREATE INDEX IF NOT EXISTS idx_exit_root_l1_info_tree_recursive_index ON state.exit_root (l1_info_tree_recursive_index); +
    +
    + 7 + +
    + - +
    +
    +
    + 8 + +
    + - + -- +migrate Down +
    +
    + 9 + +
    + - + ALTER TABLE state.exit_root +
    +
    + 10 + +
    + - + DROP COLUMN IF EXISTS l1_info_tree_recursive_index; +
    +
    + 11 + +
    + - + DROP INDEX IF EXISTS state.idx_exit_root_l1_info_tree_recursive_index; +
    +
    + 12 + +
    + - +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/state/0022_test.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,106 +0,0 @@
    +
    + 1 + +
    + - + package migrations_test +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + import ( +
    +
    + 4 + +
    + - + "database/sql" +
    +
    + 5 + +
    + - + "testing" +
    +
    + 6 + +
    + - + "time" +
    +
    + 7 + +
    + - +
    +
    +
    + 8 + +
    + - + "github.com/stretchr/testify/assert" +
    +
    + 9 + +
    + - + ) +
    +
    + 10 + +
    + - +
    +
    +
    + 11 + +
    + - + type migrationTest0022 struct { +
    +
    + 12 + +
    + - + migrationBase +
    +
    + 13 + +
    + - +
    +
    +
    + 14 + +
    + - + blockHashValue string +
    +
    + 15 + +
    + - + mainExitRootValue string +
    +
    + 16 + +
    + - + rollupExitRootValue string +
    +
    + 17 + +
    + - + globalExitRootValue string +
    +
    + 18 + +
    + - + previousBlockHashValue string +
    +
    + 19 + +
    + - + l1InfoRootValue string +
    +
    + 20 + +
    + - + } +
    +
    + 21 + +
    + - +
    +
    +
    + 22 + +
    + - + func (m migrationTest0022) insertBlock(blockNumber uint64, db *sql.DB) error { +
    +
    + 23 + +
    + - + const addBlock = "INSERT INTO state.block (block_num, received_at, block_hash) VALUES ($1, $2, $3)" +
    +
    + 24 + +
    + - + if _, err := db.Exec(addBlock, blockNumber, time.Now(), m.blockHashValue); err != nil { +
    +
    + 25 + +
    + - + return err +
    +
    + 26 + +
    + - + } +
    +
    + 27 + +
    + - + return nil +
    +
    + 28 + +
    + - + } +
    +
    + 29 + +
    + - +
    +
    +
    + 30 + +
    + - + func (m migrationTest0022) insertRowInOldTable(db *sql.DB, args ...interface{}) error { +
    +
    + 31 + +
    + - + sql := ` +
    +
    + 32 + +
    + - + INSERT INTO state.exit_root (block_num, "timestamp", mainnet_exit_root, rollup_exit_root, global_exit_root, prev_block_hash, l1_info_root, l1_info_tree_index) +
    +
    + 33 + +
    + - + VALUES ( $1, $2, $3, $4, $5, $6, $7, $8);` +
    +
    + 34 + +
    + - +
    +
    +
    + 35 + +
    + - + _, err := db.Exec(sql, args...) +
    +
    + 36 + +
    + - + return err +
    +
    + 37 + +
    + - + } +
    +
    + 38 + +
    + - +
    +
    +
    + 39 + +
    + - + func (m migrationTest0022) insertRowInMigratedTable(db *sql.DB, args ...interface{}) error { +
    +
    + 40 + +
    + - + sql := ` +
    +
    + 41 + +
    + - + INSERT INTO state.exit_root (block_num, "timestamp", mainnet_exit_root, rollup_exit_root, global_exit_root, prev_block_hash, l1_info_root, l1_info_tree_index, l1_info_tree_recursive_index) +
    +
    + 42 + +
    + - + VALUES ( $1, $2, $3, $4, $5, $6, $7, $8, $9);` +
    +
    + 43 + +
    + - +
    +
    +
    + 44 + +
    + - + _, err := db.Exec(sql, args...) +
    +
    + 45 + +
    + - + return err +
    +
    + 46 + +
    + - + } +
    +
    + 47 + +
    + - +
    +
    +
    + 48 + +
    + - + func (m migrationTest0022) InsertData(db *sql.DB) error { +
    +
    + 49 + +
    + - + var err error +
    +
    + 50 + +
    + - + for i := uint64(1); i <= 6; i++ { +
    +
    + 51 + +
    + - + if err = m.insertBlock(i, db); err != nil { +
    +
    + 52 + +
    + - + return err +
    +
    + 53 + +
    + - + } +
    +
    + 54 + +
    + - + } +
    +
    + 55 + +
    + - +
    +
    +
    + 56 + +
    + - + return nil +
    +
    + 57 + +
    + - + } +
    +
    + 58 + +
    + - +
    +
    +
    + 59 + +
    + - + func (m migrationTest0022) RunAssertsAfterMigrationUp(t *testing.T, db *sql.DB) { +
    +
    + 60 + +
    + - + m.AssertNewAndRemovedItemsAfterMigrationUp(t, db) +
    +
    + 61 + +
    + - +
    +
    +
    + 62 + +
    + - + var nilL1InfoTreeIndex *uint = nil +
    +
    + 63 + +
    + - + err := m.insertRowInOldTable(db, 1, time.Now().UTC(), m.mainExitRootValue, m.rollupExitRootValue, m.globalExitRootValue, m.previousBlockHashValue, m.l1InfoRootValue, nilL1InfoTreeIndex) +
    +
    + 64 + +
    + - + assert.NoError(t, err) +
    +
    + 65 + +
    + - +
    +
    +
    + 66 + +
    + - + err = m.insertRowInOldTable(db, 2, time.Now().UTC(), m.mainExitRootValue, m.rollupExitRootValue, m.globalExitRootValue, m.previousBlockHashValue, m.l1InfoRootValue, uint(1)) +
    +
    + 67 + +
    + - + assert.NoError(t, err) +
    +
    + 68 + +
    + - +
    +
    +
    + 69 + +
    + - + err = m.insertRowInMigratedTable(db, 3, time.Now().UTC(), m.mainExitRootValue, m.rollupExitRootValue, m.globalExitRootValue, m.previousBlockHashValue, m.l1InfoRootValue, nilL1InfoTreeIndex, 1) +
    +
    + 70 + +
    + - + assert.NoError(t, err) +
    +
    + 71 + +
    + - + } +
    +
    + 72 + +
    + - +
    +
    +
    + 73 + +
    + - + func (m migrationTest0022) RunAssertsAfterMigrationDown(t *testing.T, db *sql.DB) { +
    +
    + 74 + +
    + - + m.AssertNewAndRemovedItemsAfterMigrationDown(t, db) +
    +
    + 75 + +
    + - +
    +
    +
    + 76 + +
    + - + var nilL1InfoTreeIndex *uint = nil +
    +
    + 77 + +
    + - + err := m.insertRowInOldTable(db, 4, time.Now().UTC(), m.mainExitRootValue, m.rollupExitRootValue, m.globalExitRootValue, m.previousBlockHashValue, m.l1InfoRootValue, nilL1InfoTreeIndex) +
    +
    + 78 + +
    + - + assert.NoError(t, err) +
    +
    + 79 + +
    + - +
    +
    +
    + 80 + +
    + - + err = m.insertRowInOldTable(db, 5, time.Now().UTC(), m.mainExitRootValue, m.rollupExitRootValue, m.globalExitRootValue, m.previousBlockHashValue, m.l1InfoRootValue, uint(2)) +
    +
    + 81 + +
    + - + assert.NoError(t, err) +
    +
    + 82 + +
    + - +
    +
    +
    + 83 + +
    + - + err = m.insertRowInMigratedTable(db, 6, time.Now().UTC(), m.mainExitRootValue, m.rollupExitRootValue, m.globalExitRootValue, m.previousBlockHashValue, m.l1InfoRootValue, nilL1InfoTreeIndex, 2) +
    +
    + 84 + +
    + - + assert.Error(t, err) +
    +
    + 85 + +
    + - + } +
    +
    + 86 + +
    + - +
    +
    +
    + 87 + +
    + - + func TestMigration0022(t *testing.T) { +
    +
    + 88 + +
    + - + m := migrationTest0022{ +
    +
    + 89 + +
    + - + migrationBase: migrationBase{ +
    +
    + 90 + +
    + - + newIndexes: []string{ +
    +
    + 91 + +
    + - + "idx_exit_root_l1_info_tree_recursive_index", +
    +
    + 92 + +
    + - + }, +
    +
    + 93 + +
    + - + newColumns: []columnMetadata{ +
    +
    + 94 + +
    + - + {"state", "exit_root", "l1_info_tree_recursive_index"}, +
    +
    + 95 + +
    + - + }, +
    +
    + 96 + +
    + - + }, +
    +
    + 97 + +
    + - +
    +
    +
    + 98 + +
    + - + blockHashValue: "0x29e885edaf8e4b51e1d2e05f9da28161d2fb4f6b1d53827d9b80a23cf2d7d9f1", +
    +
    + 99 + +
    + - + mainExitRootValue: "0x83fc198de31e1b2b1a8212d2430fbb7766c13d9ad305637dea3759065606475d", +
    +
    + 100 + +
    + - + rollupExitRootValue: "0xadb91a6a1fce56eaea561002bc9a993f4e65a7710bd72f4eee3067cbd73a743c", +
    +
    + 101 + +
    + - + globalExitRootValue: "0x5bf4af1a651a2a74b36e6eb208481f94c69fc959f756223dfa49608061937585", +
    +
    + 102 + +
    + - + previousBlockHashValue: "0xe865e912b504572a4d80ad018e29797e3c11f00bf9ae2549548a25779c9d7e57", +
    +
    + 103 + +
    + - + l1InfoRootValue: "0x2b9484b83c6398033241865b015fb9430eb3e159182a6075d00c924845cc393e", +
    +
    + 104 + +
    + - + } +
    +
    + 105 + +
    + - + runMigrationTest(t, 22, m) +
    +
    + 106 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/state/0023.sql + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,57 +0,0 @@
    +
    + 1 + +
    + - + -- +migrate Up +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + CREATE TABLE IF NOT EXISTS state.blob_sequence +
    +
    + 4 + +
    + - + ( +
    +
    + 5 + +
    + - + index BIGINT PRIMARY KEY, +
    +
    + 6 + +
    + - + coinbase VARCHAR, +
    +
    + 7 + +
    + - + final_acc_input_hash VARCHAR, +
    +
    + 8 + +
    + - + first_blob_sequenced BIGINT, +
    +
    + 9 + +
    + - + last_blob_sequenced BIGINT, +
    +
    + 10 + +
    + - + created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), +
    +
    + 11 + +
    + - + received_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), +
    +
    + 12 + +
    + - + block_num BIGINT NOT NULL REFERENCES state.block (block_num) ON DELETE CASCADE +
    +
    + 13 + +
    + - + ); +
    +
    + 14 + +
    + - +
    +
    +
    + 15 + +
    + - + comment on column state.blob_sequence.index is 'It is the id of this sequence, this value is internal and incremental'; +
    +
    + 16 + +
    + - + comment on column state.blob_sequence.block_num is 'L1 Block where appear this sequence'; +
    +
    + 17 + +
    + - + comment on column state.blob_sequence.first_blob_sequenced is 'first (included) blob_inner_num of this sequence (state.blob_inner.blob_inner_num)'; +
    +
    + 18 + +
    + - + comment on column state.blob_sequence.first_blob_sequenced is 'last (included) blob_inner_num of this sequence (state.blob_inner.blob_inner_num)'; +
    +
    + 19 + +
    + - + comment on column state.blob_sequence.received_at is 'time when it was received in node'; +
    +
    + 20 + +
    + - + comment on column state.blob_sequence.created_at is 'time when was created on L1 (L1block tstamp)'; +
    +
    + 21 + +
    + - +
    +
    +
    + 22 + +
    + - + CREATE TABLE IF NOT EXISTS state.blob_inner_in +
    +
    + 23 + +
    + - + ( +
    +
    + 24 + +
    + - + blob_inner_num BIGINT PRIMARY KEY, +
    +
    + 25 + +
    + - + blob_sequence_index BIGINT NOT NULL REFERENCES state.blob_sequence (index) ON DELETE CASCADE, +
    +
    + 26 + +
    + - + blob_type VARCHAR, +
    +
    + 27 + +
    + - + max_sequence_timestamp TIMESTAMP WITH TIME ZONE, +
    +
    + 28 + +
    + - + zk_gas_limit BIGINT, +
    +
    + 29 + +
    + - + l1_info_tree_leaf_index BIGINT, +
    +
    + 30 + +
    + - + l1_info_tree_root VARCHAR, +
    +
    + 31 + +
    + - + blob_data_hash VARCHAR, +
    +
    + 32 + +
    + - + updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), +
    +
    + 33 + +
    + - + -- if blob_type== blob +
    +
    + 34 + +
    + - + blob_type_index BIGINT, +
    +
    + 35 + +
    + - + blob_type_z VARCHAR, +
    +
    + 36 + +
    + - + blob_type_y VARCHAR, +
    +
    + 37 + +
    + - + blob_type_commitment VARCHAR, +
    +
    + 38 + +
    + - + blob_type_proof VARCHAR +
    +
    + 39 + +
    + - + ); +
    +
    + 40 + +
    + - +
    +
    +
    + 41 + +
    + - + comment on column state.blob_inner_in.updated_at is 'the creation time is blob_sequence.created_at, this is the last time when was updated (tipically Now() )'; +
    +
    + 42 + +
    + - + comment on column state.blob_inner_in.blob_type is 'call_data, blob or forced'; +
    +
    + 43 + +
    + - + comment on column state.blob_inner_in.blob_data_hash is 'is the hash of the blobData'; +
    +
    + 44 + +
    + - +
    +
    +
    + 45 + +
    + - + CREATE TABLE IF NOT EXISTS state.incoming_batch +
    +
    + 46 + +
    + - + ( +
    +
    + 47 + +
    + - + batch_num BIGINT PRIMARY KEY, +
    +
    + 48 + +
    + - + blob_inner_num BIGINT NOT NULL REFERENCES state.blob_inner_in (blob_inner_num) ON DELETE CASCADE, +
    +
    + 49 + +
    + - + data BYTEA, +
    +
    + 50 + +
    + - + created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), +
    +
    + 51 + +
    + - + updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW() +
    +
    + 52 + +
    + - + ); +
    +
    + 53 + +
    + - +
    +
    +
    + 54 + +
    + - + -- +migrate Down +
    +
    + 55 + +
    + - + DROP TABLE IF EXISTS state.incoming_batch; +
    +
    + 56 + +
    + - + DROP TABLE IF EXISTS state.blob_inner_in; +
    +
    + 57 + +
    + - + DROP TABLE IF EXISTS state.blob_sequence; +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/state/utils_test.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -2,7 +2,6 @@
    +
    + 2 + +
    +   +
    +
    +
    + 3 + +
    +   + import ( +
    +
    + 4 + +
    +   + "database/sql" +
    +
    + 5 + +
    + - + "errors" +
    +
    + 6 + +
    +   + "fmt" +
    +
    + 7 + +
    +   + "testing" +
    +
    + 8 + +
    +   +
    +
    +
    +
    @@ -13,7 +12,6 @@
    +
    + 13 + +
    +   + "github.com/jackc/pgx/v4" +
    +
    + 14 + +
    +   + "github.com/jackc/pgx/v4/stdlib" +
    +
    + 15 + +
    +   + migrate "github.com/rubenv/sql-migrate" +
    +
    + 16 + +
    + - + "github.com/stretchr/testify/assert" +
    +
    + 17 + +
    +   + "github.com/stretchr/testify/require" +
    +
    + 18 + +
    +   + ) +
    +
    + 19 + +
    +   +
    +
    +
    +
    @@ -33,36 +31,6 @@
    +
    + 33 + +
    +   + }) +
    +
    + 34 + +
    +   + } +
    +
    + 35 + +
    +   +
    +
    +
    + 36 + +
    + - + type migrationBase struct { +
    +
    + 37 + +
    + - + newIndexes []string +
    +
    + 38 + +
    + - + newTables []tableMetadata +
    +
    + 39 + +
    + - + newColumns []columnMetadata +
    +
    + 40 + +
    + - +
    +
    +
    + 41 + +
    + - + removedIndexes []string +
    +
    + 42 + +
    + - + removedTables []tableMetadata +
    +
    + 43 + +
    + - + removedColumns []columnMetadata +
    +
    + 44 + +
    + - + } +
    +
    + 45 + +
    + - +
    +
    +
    + 46 + +
    + - + func (m migrationBase) AssertNewAndRemovedItemsAfterMigrationUp(t *testing.T, db *sql.DB) { +
    +
    + 47 + +
    + - + assertIndexesNotExist(t, db, m.removedIndexes) +
    +
    + 48 + +
    + - + assertTablesNotExist(t, db, m.removedTables) +
    +
    + 49 + +
    + - + assertColumnsNotExist(t, db, m.removedColumns) +
    +
    + 50 + +
    + - +
    +
    +
    + 51 + +
    + - + assertIndexesExist(t, db, m.newIndexes) +
    +
    + 52 + +
    + - + assertTablesExist(t, db, m.newTables) +
    +
    + 53 + +
    + - + assertColumnsExist(t, db, m.newColumns) +
    +
    + 54 + +
    + - + } +
    +
    + 55 + +
    + - +
    +
    +
    + 56 + +
    + - + func (m migrationBase) AssertNewAndRemovedItemsAfterMigrationDown(t *testing.T, db *sql.DB) { +
    +
    + 57 + +
    + - + assertIndexesExist(t, db, m.removedIndexes) +
    +
    + 58 + +
    + - + assertTablesExist(t, db, m.removedTables) +
    +
    + 59 + +
    + - + assertColumnsExist(t, db, m.removedColumns) +
    +
    + 60 + +
    + - +
    +
    +
    + 61 + +
    + - + assertIndexesNotExist(t, db, m.newIndexes) +
    +
    + 62 + +
    + - + assertTablesNotExist(t, db, m.newTables) +
    +
    + 63 + +
    + - + assertColumnsNotExist(t, db, m.newColumns) +
    +
    + 64 + +
    + - + } +
    +
    + 65 + +
    + - +
    +
    +
    + 66 + +
    +   + type migrationTester interface { +
    +
    + 67 + +
    +   + // InsertData used to insert data in the affected tables of the migration that is being tested +
    +
    + 68 + +
    +   + // data will be inserted with the schema as it was previous the migration that is being tested +
    +
    +
    @@ -75,14 +43,6 @@
    +
    + 75 + +
    +   + RunAssertsAfterMigrationDown(*testing.T, *sql.DB) +
    +
    + 76 + +
    +   + } +
    +
    + 77 + +
    +   +
    +
    +
    + 78 + +
    + - + type tableMetadata struct { +
    +
    + 79 + +
    + - + schema, name string +
    +
    + 80 + +
    + - + } +
    +
    + 81 + +
    + - +
    +
    +
    + 82 + +
    + - + type columnMetadata struct { +
    +
    + 83 + +
    + - + schema, tableName, name string +
    +
    + 84 + +
    + - + } +
    +
    + 85 + +
    + - +
    +
    +
    + 86 + +
    +   + var ( +
    +
    + 87 + +
    +   + stateDBCfg = dbutils.NewStateConfigFromEnv() +
    +
    + 88 + +
    +   + packrMigrations = map[string]*packr.Box{ +
    +
    +
    @@ -156,122 +116,3 @@
    +
    + 156 + +
    +   + } +
    +
    + 157 + +
    +   + return nil +
    +
    + 158 + +
    +   + } +
    +
    + 159 + +
    + - +
    +
    +
    + 160 + +
    + - + func checkColumnExists(db *sql.DB, column columnMetadata) (bool, error) { +
    +
    + 161 + +
    + - + const getColumn = `SELECT count(*) FROM information_schema.columns WHERE table_schema=$1 AND table_name=$2 AND column_name=$3` +
    +
    + 162 + +
    + - + var result int +
    +
    + 163 + +
    + - +
    +
    +
    + 164 + +
    + - + row := db.QueryRow(getColumn, column.schema, column.tableName, column.name) +
    +
    + 165 + +
    + - + err := row.Scan(&result) +
    +
    + 166 + +
    + - +
    +
    +
    + 167 + +
    + - + if errors.Is(err, pgx.ErrNoRows) { +
    +
    + 168 + +
    + - + return false, nil +
    +
    + 169 + +
    + - + } else if err != nil { +
    +
    + 170 + +
    + - + return false, err +
    +
    + 171 + +
    + - + } +
    +
    + 172 + +
    + - +
    +
    +
    + 173 + +
    + - + return (result == 1), nil +
    +
    + 174 + +
    + - + } +
    +
    + 175 + +
    + - +
    +
    +
    + 176 + +
    + - + func assertColumnExists(t *testing.T, db *sql.DB, column columnMetadata) { +
    +
    + 177 + +
    + - + exists, err := checkColumnExists(db, column) +
    +
    + 178 + +
    + - + assert.NoError(t, err) +
    +
    + 179 + +
    + - + assert.True(t, exists) +
    +
    + 180 + +
    + - + } +
    +
    + 181 + +
    + - +
    +
    +
    + 182 + +
    + - + func assertColumnNotExists(t *testing.T, db *sql.DB, column columnMetadata) { +
    +
    + 183 + +
    + - + exists, err := checkColumnExists(db, column) +
    +
    + 184 + +
    + - + assert.NoError(t, err) +
    +
    + 185 + +
    + - + assert.False(t, exists) +
    +
    + 186 + +
    + - + } +
    +
    + 187 + +
    + - +
    +
    +
    + 188 + +
    + - + func assertColumnsExist(t *testing.T, db *sql.DB, columns []columnMetadata) { +
    +
    + 189 + +
    + - + for _, column := range columns { +
    +
    + 190 + +
    + - + assertColumnExists(t, db, column) +
    +
    + 191 + +
    + - + } +
    +
    + 192 + +
    + - + } +
    +
    + 193 + +
    + - +
    +
    +
    + 194 + +
    + - + func assertColumnsNotExist(t *testing.T, db *sql.DB, columns []columnMetadata) { +
    +
    + 195 + +
    + - + for _, column := range columns { +
    +
    + 196 + +
    + - + assertColumnNotExists(t, db, column) +
    +
    + 197 + +
    + - + } +
    +
    + 198 + +
    + - + } +
    +
    + 199 + +
    + - +
    +
    +
    + 200 + +
    + - + func checkTableExists(db *sql.DB, table tableMetadata) (bool, error) { +
    +
    + 201 + +
    + - + const getTable = `SELECT count(*) FROM information_schema.tables WHERE table_schema=$1 AND table_name=$2` +
    +
    + 202 + +
    + - + var result int +
    +
    + 203 + +
    + - +
    +
    +
    + 204 + +
    + - + row := db.QueryRow(getTable, table.schema, table.name) +
    +
    + 205 + +
    + - + err := row.Scan(&result) +
    +
    + 206 + +
    + - +
    +
    +
    + 207 + +
    + - + if errors.Is(err, pgx.ErrNoRows) { +
    +
    + 208 + +
    + - + return false, nil +
    +
    + 209 + +
    + - + } else if err != nil { +
    +
    + 210 + +
    + - + return false, err +
    +
    + 211 + +
    + - + } +
    +
    + 212 + +
    + - +
    +
    +
    + 213 + +
    + - + return (result == 1), nil +
    +
    + 214 + +
    + - + } +
    +
    + 215 + +
    + - +
    +
    +
    + 216 + +
    + - + func assertTableExists(t *testing.T, db *sql.DB, table tableMetadata) { +
    +
    + 217 + +
    + - + exists, err := checkTableExists(db, table) +
    +
    + 218 + +
    + - + assert.NoError(t, err) +
    +
    + 219 + +
    + - + assert.True(t, exists) +
    +
    + 220 + +
    + - + } +
    +
    + 221 + +
    + - +
    +
    +
    + 222 + +
    + - + func assertTableNotExists(t *testing.T, db *sql.DB, table tableMetadata) { +
    +
    + 223 + +
    + - + exists, err := checkTableExists(db, table) +
    +
    + 224 + +
    + - + assert.NoError(t, err) +
    +
    + 225 + +
    + - + assert.False(t, exists) +
    +
    + 226 + +
    + - + } +
    +
    + 227 + +
    + - +
    +
    +
    + 228 + +
    + - + func assertTablesExist(t *testing.T, db *sql.DB, tables []tableMetadata) { +
    +
    + 229 + +
    + - + for _, table := range tables { +
    +
    + 230 + +
    + - + assertTableExists(t, db, table) +
    +
    + 231 + +
    + - + } +
    +
    + 232 + +
    + - + } +
    +
    + 233 + +
    + - +
    +
    +
    + 234 + +
    + - + func assertTablesNotExist(t *testing.T, db *sql.DB, tables []tableMetadata) { +
    +
    + 235 + +
    + - + for _, table := range tables { +
    +
    + 236 + +
    + - + assertTableNotExists(t, db, table) +
    +
    + 237 + +
    + - + } +
    +
    + 238 + +
    + - + } +
    +
    + 239 + +
    + - +
    +
    +
    + 240 + +
    + - + func checkIndexExists(db *sql.DB, index string) (bool, error) { +
    +
    + 241 + +
    + - + const getIndex = `SELECT count(*) FROM pg_indexes WHERE indexname = $1;` +
    +
    + 242 + +
    + - + row := db.QueryRow(getIndex, index) +
    +
    + 243 + +
    + - +
    +
    +
    + 244 + +
    + - + var result int +
    +
    + 245 + +
    + - + err := row.Scan(&result) +
    +
    + 246 + +
    + - + if errors.Is(err, pgx.ErrNoRows) { +
    +
    + 247 + +
    + - + return false, nil +
    +
    + 248 + +
    + - + } else if err != nil { +
    +
    + 249 + +
    + - + return false, err +
    +
    + 250 + +
    + - + } +
    +
    + 251 + +
    + - +
    +
    +
    + 252 + +
    + - + return (result == 1), nil +
    +
    + 253 + +
    + - + } +
    +
    + 254 + +
    + - +
    +
    +
    + 255 + +
    + - + func assertIndexExists(t *testing.T, db *sql.DB, index string) { +
    +
    + 256 + +
    + - + exists, err := checkIndexExists(db, index) +
    +
    + 257 + +
    + - + assert.NoError(t, err) +
    +
    + 258 + +
    + - + assert.True(t, exists) +
    +
    + 259 + +
    + - + } +
    +
    + 260 + +
    + - +
    +
    +
    + 261 + +
    + - + func assertIndexNotExists(t *testing.T, db *sql.DB, index string) { +
    +
    + 262 + +
    + - + exists, err := checkIndexExists(db, index) +
    +
    + 263 + +
    + - + assert.NoError(t, err) +
    +
    + 264 + +
    + - + assert.False(t, exists) +
    +
    + 265 + +
    + - + } +
    +
    + 266 + +
    + - +
    +
    +
    + 267 + +
    + - + func assertIndexesExist(t *testing.T, db *sql.DB, indexes []string) { +
    +
    + 268 + +
    + - + for _, index := range indexes { +
    +
    + 269 + +
    + - + assertIndexExists(t, db, index) +
    +
    + 270 + +
    + - + } +
    +
    + 271 + +
    + - + } +
    +
    + 272 + +
    + - +
    +
    +
    + 273 + +
    + - + func assertIndexesNotExist(t *testing.T, db *sql.DB, indexes []string) { +
    +
    + 274 + +
    + - + for _, index := range indexes { +
    +
    + 275 + +
    + - + assertIndexNotExists(t, db, index) +
    +
    + 276 + +
    + - + } +
    +
    + 277 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 2 + +
    +   +
    +
    +
    + 3 + +
    +   + import ( +
    +
    + 4 + +
    +   + "database/sql" +
    +
    + + +
    +   +
    +
    +
    + 5 + +
    +   + "fmt" +
    +
    + 6 + +
    +   + "testing" +
    +
    + 7 + +
    +   +
    +
    +
    +
     
    +
    + 12 + +
    +   + "github.com/jackc/pgx/v4" +
    +
    + 13 + +
    +   + "github.com/jackc/pgx/v4/stdlib" +
    +
    + 14 + +
    +   + migrate "github.com/rubenv/sql-migrate" +
    +
    + + +
    +   +
    +
    +
    + 15 + +
    +   + "github.com/stretchr/testify/require" +
    +
    + 16 + +
    +   + ) +
    +
    + 17 + +
    +   +
    +
    +
    +
     
    +
    + 31 + +
    +   + }) +
    +
    + 32 + +
    +   + } +
    +
    + 33 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 34 + +
    +   + type migrationTester interface { +
    +
    + 35 + +
    +   + // InsertData used to insert data in the affected tables of the migration that is being tested +
    +
    + 36 + +
    +   + // data will be inserted with the schema as it was previous the migration that is being tested +
    +
    +
     
    +
    + 43 + +
    +   + RunAssertsAfterMigrationDown(*testing.T, *sql.DB) +
    +
    + 44 + +
    +   + } +
    +
    + 45 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 46 + +
    +   + var ( +
    +
    + 47 + +
    +   + stateDBCfg = dbutils.NewStateConfigFromEnv() +
    +
    + 48 + +
    +   + packrMigrations = map[string]*packr.Box{ +
    +
    +
     
    +
    + 116 + +
    +   + } +
    +
    + 117 + +
    +   + return nil +
    +
    + 118 + +
    +   + } +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/state/validium-001.sql + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -0,0 +1,32 @@
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 1 + +
    + + + -- +migrate Up +
    +
    + 2 + +
    + + +
    +
    +
    + 3 + +
    + + + CREATE TABLE IF NOT EXISTS state.batch_data_backup +
    +
    + 4 + +
    + + + ( +
    +
    + 5 + +
    + + + batch_num BIGINT, +
    +
    + 6 + +
    + + + data BYTEA, +
    +
    + 7 + +
    + + + created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP, +
    +
    + 8 + +
    + + + PRIMARY KEY (batch_num, created_at) +
    +
    + 9 + +
    + + + ); +
    +
    + 10 + +
    + + +
    +
    +
    + 11 + +
    + + + -- +migrate StatementBegin +
    +
    + 12 + +
    + + + CREATE OR REPLACE FUNCTION backup_batch() RETURNS trigger AS $$ +
    +
    + 13 + +
    + + + BEGIN +
    +
    + 14 + +
    + + + INSERT INTO state.batch_data_backup (batch_num, data) +
    +
    + 15 + +
    + + + VALUES (OLD.batch_num, OLD.raw_txs_data) +
    +
    + 16 + +
    + + + ON CONFLICT (batch_num, created_at) DO UPDATE SET +
    +
    + 17 + +
    + + + data = EXCLUDED.data; +
    +
    + 18 + +
    + + + RETURN OLD; +
    +
    + 19 + +
    + + + END; +
    +
    + 20 + +
    + + + $$ +
    +
    + 21 + +
    + + + LANGUAGE plpgsql; +
    +
    + 22 + +
    + + + -- +migrate StatementEnd +
    +
    + 23 + +
    + + +
    +
    +
    + 24 + +
    + + + CREATE TRIGGER backup_batch +
    +
    + 25 + +
    + + + BEFORE DELETE ON state.batch FOR EACH ROW +
    +
    + 26 + +
    + + + EXECUTE PROCEDURE backup_batch(); +
    +
    + 27 + +
    + + +
    +
    +
    + 28 + +
    + + + -- +migrate Down +
    +
    + 29 + +
    + + +
    +
    +
    + 30 + +
    + + + DROP TRIGGER IF EXISTS backup_batch ON state.batch; +
    +
    + 31 + +
    + + + DROP FUNCTION IF EXISTS backup_batch(); +
    +
    + 32 + +
    + + + DROP TABLE IF EXISTS state.batch_data_backup; +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/diffgen.sh + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -0,0 +1,47 @@
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 1 + +
    + + + PATH_TO_ZKEVM_NODE_REPO="/home/stefan/go/src/Polygon/zkevm-node/" +
    +
    + 2 + +
    + + + diff -ruN \ +
    +
    + 3 + +
    + + + -I ".*github.com\/0x.*" \ +
    +
    + 4 + +
    + + + -x "*mock*" -x ".git" \ +
    +
    + 5 + +
    + + + -x ".github" \ +
    +
    + 6 + +
    + + + -x ".gitignore" \ +
    +
    + 7 + +
    + + + -x ".vscode" \ +
    +
    + 8 + +
    + + + -x "ci" \ +
    +
    + 9 + +
    + + + -x "environments" \ +
    +
    + 10 + +
    + + + -x "*.md" \ +
    +
    + 11 + +
    + + + -x "*.html" \ +
    +
    + 12 + +
    + + + -x "*.html" \ +
    +
    + 13 + +
    + + + -x "*.json" \ +
    +
    + 14 + +
    + + + -x "*.toml" \ +
    +
    + 15 + +
    + + + -x "*.abi" \ +
    +
    + 16 + +
    + + + -x "*.bin" \ +
    +
    + 17 + +
    + + + -x "*.pb.go" \ +
    +
    + 18 + +
    + + + -x "smartcontracts" \ +
    +
    + 19 + +
    + + + -x "go.sum" \ +
    +
    + 20 + +
    + + + -x "mock*.go" \ +
    +
    + 21 + +
    + + + -x "*venv*" \ +
    +
    + 22 + +
    + + + -x "/dist/" \ +
    +
    + 23 + +
    + + + -x "/test/e2e/keystore" \ +
    +
    + 24 + +
    + + + -x "/test/vectors/src/**/*md" \ +
    +
    + 25 + +
    + + + -x "/test/vectors/src/**/*js" \ +
    +
    + 26 + +
    + + + -x "/test/vectors/src/**/*sol" \ +
    +
    + 27 + +
    + + + -x "/test/vectors/src/**/*sh" \ +
    +
    + 28 + +
    + + + -x "/test/vectors/src/package.json" \ +
    +
    + 29 + +
    + + + -x "/test/contracts/bin/**/*.bin" \ +
    +
    + 30 + +
    + + + -x "/test/contracts/bin/**/*.abi" \ +
    +
    + 31 + +
    + + + -x "/tools/datastreamer/*.bin" \ +
    +
    + 32 + +
    + + + -x "/test/datastreamer/*.db/*" \ +
    +
    + 33 + +
    + + + -x "/test/*.bin" \ +
    +
    + 34 + +
    + + + -x "/test/*.db/*" \ +
    +
    + 35 + +
    + + + -x "**/.DS_Store" \ +
    +
    + 36 + +
    + + + -x ".vscode" \ +
    +
    + 37 + +
    + + + -x ".idea/" \ +
    +
    + 38 + +
    + + + -x ".env" \ +
    +
    + 39 + +
    + + + -x "out.dat" \ +
    +
    + 40 + +
    + + + -x "cmd/__debug_bin" \ +
    +
    + 41 + +
    + + + -x ".venv" \ +
    +
    + 42 + +
    + + + -x "*metrics.txt" \ +
    +
    + 43 + +
    + + + -x "coverage.out" \ +
    +
    + 44 + +
    + + + -x "*datastream.db*" \ +
    +
    + 45 + +
    + + + ${PATH_TO_ZKEVM_NODE_REPO} . | \ +
    +
    + 46 + +
    + + + diff2html -i stdin -s side -t "zkEVM node vs CDK validium node</br><h2>zkevm-node version: v0.6.0<h2/>" \ +
    +
    + 47 + +
    + + + -F ./docs/diff/diff.html +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/docker-compose.yml + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -107,7 +107,7 @@
    +
    + 107 + +
    +   + zkevm-prover: +
    +
    + 108 + +
    +   + container_name: zkevm-prover +
    +
    + 109 + +
    +   + restart: unless-stopped +
    +
    + 110 + +
    + - + image: hermeznetwork/zkevm-prover:v6.0.2-RC2 +
    +
    + 111 + +
    +   + depends_on: +
    +
    + 112 + +
    +   + zkevm-state-db: +
    +
    + 113 + +
    +   + condition: service_healthy +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 107 + +
    +   + zkevm-prover: +
    +
    + 108 + +
    +   + container_name: zkevm-prover +
    +
    + 109 + +
    +   + restart: unless-stopped +
    +
    + 110 + +
    + + + image: hermeznetwork/zkevm-prover:v6.0.0 +
    +
    + 111 + +
    +   + depends_on: +
    +
    + 112 + +
    +   + zkevm-state-db: +
    +
    + 113 + +
    +   + condition: service_healthy +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/Dockerfile + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -14,7 +14,6 @@
    +
    + 14 + +
    +   + # CONTAINER FOR RUNNING BINARY +
    +
    + 15 + +
    +   + FROM alpine:3.18 +
    +
    + 16 + +
    +   + COPY --from=build /src/dist/zkevm-node /app/zkevm-node +
    +
    + 17 + +
    + - + COPY --from=build /src/config/environments/testnet/node.config.toml /app/example.config.toml +
    +
    + 18 + +
    +   + RUN apk update && apk add postgresql15-client +
    +
    + 19 + +
    +   + EXPOSE 8123 +
    +
    + 20 + +
    +   + CMD ["/bin/sh", "-c", "/app/zkevm-node run"] +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 14 + +
    +   + # CONTAINER FOR RUNNING BINARY +
    +
    + 15 + +
    +   + FROM alpine:3.18 +
    +
    + 16 + +
    +   + COPY --from=build /src/dist/zkevm-node /app/zkevm-node +
    +
    + + +
    +   +
    +
    +
    + 17 + +
    +   + RUN apk update && apk add postgresql15-client +
    +
    + 18 + +
    +   + EXPOSE 8123 +
    +
    + 19 + +
    +   + CMD ["/bin/sh", "-c", "/app/zkevm-node run"] +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/Dockerfile.release + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -0,0 +1,15 @@
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 1 + +
    + + + FROM alpine:3.18 +
    +
    + 2 + +
    + + +
    +
    +
    + 3 + +
    + + + COPY zkevm-node /app/zkevm-node +
    +
    + 4 + +
    + + +
    +
    +
    + 5 + +
    + + + EXPOSE 8123 +
    +
    + 6 + +
    + + +
    +
    +
    + 7 + +
    + + + RUN addgroup -S zkevm-group \ +
    +
    + 8 + +
    + + + && adduser -S zkevm-user -G zkevm-group +
    +
    + 9 + +
    + + +
    +
    +
    + 10 + +
    + + + RUN chown -R zkevm-user:zkevm-group /app +
    +
    + 11 + +
    + + +
    +
    +
    + 12 + +
    + + + USER zkevm-user +
    +
    + 13 + +
    + + +
    +
    +
    + 14 + +
    + + + CMD ["/app/zkevm-node"] +
    +
    + 15 + +
    + + +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/config.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -6,8 +6,6 @@
    +
    + 6 + +
    +   + type Config struct { +
    +
    + 7 + +
    +   + // URL is the URL of the Ethereum node for L1 +
    +
    + 8 + +
    +   + URL string `mapstructure:"URL"` +
    +
    + 9 + +
    + - + // ConsensusL1URL is the URL of the consensus L1 RPC endpoint +
    +
    + 10 + +
    + - + ConsensusL1URL string `mapstructure:"ConsensusL1URL"` +
    +
    + 11 + +
    +   +
    +
    +
    + 12 + +
    +   + // ForkIDChunkSize is the max interval for each call to L1 provider to get the forkIDs +
    +
    + 13 + +
    +   + ForkIDChunkSize uint64 `mapstructure:"ForkIDChunkSize"` +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 6 + +
    +   + type Config struct { +
    +
    + 7 + +
    +   + // URL is the URL of the Ethereum node for L1 +
    +
    + 8 + +
    +   + URL string `mapstructure:"URL"` +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 9 + +
    +   +
    +
    +
    + 10 + +
    +   + // ForkIDChunkSize is the max interval for each call to L1 provider to get the forkIDs +
    +
    + 11 + +
    +   + ForkIDChunkSize uint64 `mapstructure:"ForkIDChunkSize"` +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/eip4844/eip4844.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,86 +0,0 @@
    +
    + 1 + +
    + - + package eip4844 +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + import ( +
    +
    + 4 + +
    + - + "context" +
    +
    + 5 + +
    + - + "fmt" +
    +
    + 6 + +
    + - +
    +
    +
    + 7 + +
    + - + beaconclient "github.com/0xPolygonHermez/zkevm-node/beacon_client" +
    +
    + 8 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/log" +
    +
    + 9 + +
    + - + ) +
    +
    + 10 + +
    + - +
    +
    +
    + 11 + +
    + - + // EthermanEIP4844 represents the EIP-4844 implementation +
    +
    + 12 + +
    + - + type EthermanEIP4844 struct { +
    +
    + 13 + +
    + - + beaconClient *beaconclient.BeaconAPIClient +
    +
    + 14 + +
    + - + initialized bool +
    +
    + 15 + +
    + - + genesisTime uint64 +
    +
    + 16 + +
    + - + secondsPerSlot uint64 +
    +
    + 17 + +
    + - + } +
    +
    + 18 + +
    + - +
    +
    +
    + 19 + +
    + - + // NewEthermanEIP4844 creates a new EthermanEIP4844 +
    +
    + 20 + +
    + - + func NewEthermanEIP4844(beaconClient *beaconclient.BeaconAPIClient) *EthermanEIP4844 { +
    +
    + 21 + +
    + - + return &EthermanEIP4844{ +
    +
    + 22 + +
    + - + beaconClient: beaconClient, +
    +
    + 23 + +
    + - + initialized: false, +
    +
    + 24 + +
    + - + } +
    +
    + 25 + +
    + - + } +
    +
    + 26 + +
    + - +
    +
    +
    + 27 + +
    + - + // IsInitialized returns if the EthermanEIP4844 is initialized +
    +
    + 28 + +
    + - + func (e *EthermanEIP4844) IsInitialized() bool { +
    +
    + 29 + +
    + - + return e.initialized && e.genesisTime != 0 && e.secondsPerSlot != 0 +
    +
    + 30 + +
    + - + } +
    +
    + 31 + +
    + - +
    +
    +
    + 32 + +
    + - + // Initialize initializes the EthermanEIP4844 +
    +
    + 33 + +
    + - + func (e *EthermanEIP4844) Initialize(ctx context.Context) error { +
    +
    + 34 + +
    + - + // You can initialize multiples times and will fetch again the data +
    +
    + 35 + +
    + - +
    +
    +
    + 36 + +
    + - + configSpec, err := e.beaconClient.ConfigSpec(ctx) +
    +
    + 37 + +
    + - + if err != nil { +
    +
    + 38 + +
    + - + return fmt.Errorf("error fetching config spec: %v", err) +
    +
    + 39 + +
    + - + } +
    +
    + 40 + +
    + - +
    +
    +
    + 41 + +
    + - + e.secondsPerSlot = configSpec.SecondsPerSlot +
    +
    + 42 + +
    + - +
    +
    +
    + 43 + +
    + - + genesis, err := e.beaconClient.BeaconGenesis(ctx) +
    +
    + 44 + +
    + - + if err != nil { +
    +
    + 45 + +
    + - + return fmt.Errorf("error fetching beacon genesis: %v", err) +
    +
    + 46 + +
    + - + } +
    +
    + 47 + +
    + - + e.genesisTime = genesis.GenesisTime +
    +
    + 48 + +
    + - + if e.secondsPerSlot == 0 || e.genesisTime == 0 { +
    +
    + 49 + +
    + - + return fmt.Errorf("genesisTime:%d or secondsPerSlot: %d is 0", e.genesisTime, e.secondsPerSlot) +
    +
    + 50 + +
    + - + } +
    +
    + 51 + +
    + - + e.initialized = true +
    +
    + 52 + +
    + - +
    +
    +
    + 53 + +
    + - + return nil +
    +
    + 54 + +
    + - + } +
    +
    + 55 + +
    + - +
    +
    +
    + 56 + +
    + - + // GetBlobSidecar returns the blob sidecar for a given blockTime and kzgCommitment +
    +
    + 57 + +
    + - + func (e *EthermanEIP4844) GetBlobSidecar(ctx context.Context, blockTime uint64, kzgCommitment string) ([]byte, error) { +
    +
    + 58 + +
    + - + slot, err := e.CalculateSlot(blockTime) +
    +
    + 59 + +
    + - + if err != nil { +
    +
    + 60 + +
    + - + errComposed := fmt.Errorf("error calculating Slot blob sidecars: %v", err) +
    +
    + 61 + +
    + - + log.Error(errComposed.Error()) +
    +
    + 62 + +
    + - + return nil, errComposed +
    +
    + 63 + +
    + - + } +
    +
    + 64 + +
    + - + sidecars, err := e.beaconClient.BeaconBlobSidecars(ctx, slot) +
    +
    + 65 + +
    + - + if err != nil { +
    +
    + 66 + +
    + - + errComposed := fmt.Errorf("error fetching beacon blob sidecars: %v", err) +
    +
    + 67 + +
    + - + log.Error(errComposed.Error()) +
    +
    + 68 + +
    + - + return nil, errComposed +
    +
    + 69 + +
    + - + } +
    +
    + 70 + +
    + - + for _, sidecar := range sidecars.Sidecars { +
    +
    + 71 + +
    + - + if sidecar.KzgCommitment == kzgCommitment { +
    +
    + 72 + +
    + - + return sidecar.Blob, nil +
    +
    + 73 + +
    + - + } +
    +
    + 74 + +
    + - + } +
    +
    + 75 + +
    + - + err = fmt.Errorf("sidecar not found") +
    +
    + 76 + +
    + - + log.Error(err.Error()) +
    +
    + 77 + +
    + - + return nil, err +
    +
    + 78 + +
    + - + } +
    +
    + 79 + +
    + - +
    +
    +
    + 80 + +
    + - + // CalculateSlot calculates the slot for a given blockTime +
    +
    + 81 + +
    + - + func (e *EthermanEIP4844) CalculateSlot(blockTime uint64) (uint64, error) { +
    +
    + 82 + +
    + - + if !e.IsInitialized() { +
    +
    + 83 + +
    + - + return 0, fmt.Errorf("EIP-4844 not initialized,please call Initialize(..) function first") +
    +
    + 84 + +
    + - + } +
    +
    + 85 + +
    + - + return (blockTime - e.genesisTime) / e.secondsPerSlot, nil +
    +
    + 86 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/etherman.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -3,6 +3,7 @@
    +
    + 3 + +
    +   + import ( +
    +
    + 4 + +
    +   + "bytes" +
    +
    + 5 + +
    +   + "context" +
    +
    + + +
    +   +
    +
    +
    + 6 + +
    +   + "encoding/json" +
    +
    + 7 + +
    +   + "errors" +
    +
    + 8 + +
    +   + "fmt" +
    +
    +
    @@ -43,13 +44,8 @@
    +
    + 43 + +
    +   + "golang.org/x/crypto/sha3" +
    +
    + 44 + +
    +   + ) +
    +
    + 45 + +
    +   +
    +
    +
    + 46 + +
    + - + const ( +
    +
    + 47 + +
    + - + // ETrogUpgradeVersion is the version of the LxLy upgrade +
    +
    + 48 + +
    + - + ETrogUpgradeVersion = 2 +
    +
    + 49 + +
    + - + ) +
    +
    + 50 + +
    + - +
    +
    +
    + 51 + +
    +   + var ( +
    +
    + 52 + +
    + - + // Events EtrogRollupManager +
    +
    + 53 + +
    +   + setBatchFeeSignatureHash = crypto.Keccak256Hash([]byte("SetBatchFee(uint256)")) +
    +
    + 54 + +
    +   + setTrustedAggregatorSignatureHash = crypto.Keccak256Hash([]byte("SetTrustedAggregator(address)")) // Used in oldZkEvm as well +
    +
    + 55 + +
    +   + setVerifyBatchTimeTargetSignatureHash = crypto.Keccak256Hash([]byte("SetVerifyBatchTimeTarget(uint64)")) // Used in oldZkEvm as well +
    +
    +
    @@ -94,13 +90,13 @@
    +
    + 94 + +
    +   + updateL1InfoTreeSignatureHash = crypto.Keccak256Hash([]byte("UpdateL1InfoTree(bytes32,bytes32)")) +
    +
    + 95 + +
    +   +
    +
    +
    + 96 + +
    +   + // PreLxLy events +
    +
    + 97 + +
    + - + updateGlobalExitRootSignatureHash = crypto.Keccak256Hash([]byte("UpdateGlobalExitRoot(bytes32,bytes32)")) +
    +
    + 98 + +
    + - + preEtrogVerifyBatchesTrustedAggregatorSignatureHash = crypto.Keccak256Hash([]byte("VerifyBatchesTrustedAggregator(uint64,bytes32,address)")) +
    +
    + 99 + +
    + - + transferOwnershipSignatureHash = crypto.Keccak256Hash([]byte("OwnershipTransferred(address,address)")) +
    +
    + 100 + +
    + - + updateZkEVMVersionSignatureHash = crypto.Keccak256Hash([]byte("UpdateZkEVMVersion(uint64,uint64,string)")) +
    +
    + 101 + +
    + - + preEtrogConsolidatePendingStateSignatureHash = crypto.Keccak256Hash([]byte("ConsolidatePendingState(uint64,bytes32,uint64)")) +
    +
    + 102 + +
    + - + preEtrogOverridePendingStateSignatureHash = crypto.Keccak256Hash([]byte("OverridePendingState(uint64,bytes32,address)")) +
    +
    + 103 + +
    + - + sequenceBatchesPreEtrogSignatureHash = crypto.Keccak256Hash([]byte("SequenceBatches(uint64)")) +
    +
    + 104 + +
    +   +
    +
    +
    + 105 + +
    +   + // Proxy events +
    +
    + 106 + +
    +   + initializedProxySignatureHash = crypto.Keccak256Hash([]byte("Initialized(uint8)")) +
    +
    +
    @@ -113,6 +109,11 @@
    +
    + 113 + +
    +   + // methodIDSequenceBatchesElderberry: MethodID for sequenceBatches in Elderberry +
    +
    + 114 + +
    +   + methodIDSequenceBatchesElderberry = []byte{0xde, 0xf5, 0x7e, 0x54} // 0xdef57e54 sequenceBatches((bytes,bytes32,uint64,bytes32)[],uint64,uint64,address) +
    +
    + 115 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 116 + +
    +   + // ErrNotFound is used when the object is not found +
    +
    + 117 + +
    +   + ErrNotFound = errors.New("not found") +
    +
    + 118 + +
    +   + // ErrIsReadOnlyMode is used when the EtherMan client is in read-only mode. +
    +
    +
    @@ -163,7 +164,6 @@
    +
    + 163 + +
    +   + ethereum.LogFilterer +
    +
    + 164 + +
    +   + ethereum.TransactionReader +
    +
    + 165 + +
    +   + ethereum.TransactionSender +
    +
    + 166 + +
    + - + ethereum.PendingStateReader +
    +
    + 167 + +
    +   +
    +
    +
    + 168 + +
    +   + bind.DeployBackend +
    +
    + 169 + +
    +   + } +
    +
    +
    @@ -189,78 +189,66 @@
    +
    + 189 + +
    +   +
    +
    +
    + 190 + +
    +   + // Client is a simple implementation of EtherMan. +
    +
    + 191 + +
    +   + type Client struct { +
    +
    + 192 + +
    + - + EthClient ethereumClient +
    +
    + 193 + +
    + - + PreEtrogZkEVM *preetrogpolygonzkevm.Preetrogpolygonzkevm +
    +
    + 194 + +
    + - + ElderberryZKEVM *elderberrypolygonzkevm.Elderberrypolygonzkevm +
    +
    + 195 + +
    + - + EtrogZkEVM *etrogpolygonzkevm.Etrogpolygonzkevm +
    +
    + 196 + +
    + - + EtrogRollupManager *etrogpolygonrollupmanager.Etrogpolygonrollupmanager +
    +
    + 197 + +
    + - + EtrogGlobalExitRootManager *etrogpolygonzkevmglobalexitroot.Etrogpolygonzkevmglobalexitroot +
    +
    + 198 + +
    + - + PreEtrogGlobalExitRootManager *preetrogpolygonzkevmglobalexitroot.Preetrogpolygonzkevmglobalexitroot +
    +
    + 199 + +
    + - + FeijoaContracts *FeijoaContracts +
    +
    + 200 + +
    + - + Pol *pol.Pol +
    +
    + 201 + +
    + - + SCAddresses []common.Address +
    +
    + 202 + +
    +   +
    +
    +
    + 203 + +
    +   + RollupID uint32 +
    +
    + 204 + +
    +   +
    +
    +
    + 205 + +
    +   + GasProviders externalGasProviders +
    +
    + 206 + +
    +   +
    +
    +
    + 207 + +
    + - + l1Cfg L1Config +
    +
    + 208 + +
    + - + cfg Config +
    +
    + 209 + +
    + - + auth map[common.Address]bind.TransactOpts // empty in case of read-only client +
    +
    + 210 + +
    + - + EIP4844 *eip4844.EthermanEIP4844 +
    +
    + 211 + +
    + - + eventFeijoaManager *EventManager +
    +
    + + +
    +   +
    +
    +
    + 212 + +
    +   + } +
    +
    + 213 + +
    +   +
    +
    +
    + 214 + +
    +   + // NewClient creates a new etherman. +
    +
    + 215 + +
    + - + func NewClient(cfg Config, l1Config L1Config) (*Client, error) { +
    +
    + 216 + +
    +   + // Connect to ethereum node +
    +
    + 217 + +
    +   + ethClient, err := ethclient.Dial(cfg.URL) +
    +
    + 218 + +
    +   + if err != nil { +
    +
    + 219 + +
    +   + log.Errorf("error connecting to %s: %+v", cfg.URL, err) +
    +
    + 220 + +
    +   + return nil, err +
    +
    + 221 + +
    +   + } +
    +
    + 222 + +
    + - + if cfg.ConsensusL1URL == "" { +
    +
    + 223 + +
    + - + log.Warn("ConsensusL1URL is not set, so Feijoa is not going to work") +
    +
    + 224 + +
    + - + } +
    +
    + 225 + +
    + - + feijoaEnabled := true +
    +
    + 226 + +
    + - + beaconClient := beaconclient.NewBeaconAPIClient(cfg.ConsensusL1URL) +
    +
    + 227 + +
    + - + eip4844 := eip4844.NewEthermanEIP4844(beaconClient) +
    +
    + 228 + +
    + - + if err := eip4844.Initialize(context.Background()); err != nil { +
    +
    + 229 + +
    + - + // TODO: Must be mandatory to have a consensusL1URL configured, but +
    +
    + 230 + +
    + - + // for maintain compatibility allow to disable Feijoa +
    +
    + 231 + +
    + - + // so the log.Warnf must be an Errorf and must return nil, err +
    +
    + 232 + +
    + - + log.Warnf("error initializing EIP-4844,Feijoa is going to be disabled. URL:%s : %+v", cfg.ConsensusL1URL, err) +
    +
    + 233 + +
    + - + feijoaEnabled = false +
    +
    + 234 + +
    + - + } +
    +
    + 235 + +
    +   + // Create smc clients +
    +
    + 236 + +
    + - + etrogZkevm, err := etrogpolygonzkevm.NewEtrogpolygonzkevm(l1Config.ZkEVMAddr, ethClient) +
    +
    + 237 + +
    +   + if err != nil { +
    +
    + 238 + +
    +   + log.Errorf("error creating Polygonzkevm client (%s). Error: %w", l1Config.ZkEVMAddr.String(), err) +
    +
    + 239 + +
    +   + return nil, err +
    +
    + 240 + +
    +   + } +
    +
    + 241 + +
    + - + elderberryZkevm, err := elderberrypolygonzkevm.NewElderberrypolygonzkevm(l1Config.RollupManagerAddr, ethClient) +
    +
    + 242 + +
    +   + if err != nil { +
    +
    + 243 + +
    + - + log.Errorf("error creating NewElderberryPolygonzkevm client (%s). Error: %w", l1Config.RollupManagerAddr.String(), err) +
    +
    + 244 + +
    +   + return nil, err +
    +
    + 245 + +
    +   + } +
    +
    + 246 + +
    + - + preEtrogZkevm, err := preetrogpolygonzkevm.NewPreetrogpolygonzkevm(l1Config.RollupManagerAddr, ethClient) +
    +
    + 247 + +
    +   + if err != nil { +
    +
    + 248 + +
    + - + log.Errorf("error creating Newpreetrogpolygonzkevm client (%s). Error: %w", l1Config.RollupManagerAddr.String(), err) +
    +
    + 249 + +
    +   + return nil, err +
    +
    + 250 + +
    +   + } +
    +
    + 251 + +
    + - + etrogRollupManager, err := etrogpolygonrollupmanager.NewEtrogpolygonrollupmanager(l1Config.RollupManagerAddr, ethClient) +
    +
    + 252 + +
    +   + if err != nil { +
    +
    + 253 + +
    +   + log.Errorf("error creating NewPolygonrollupmanager client (%s). Error: %w", l1Config.RollupManagerAddr.String(), err) +
    +
    + 254 + +
    +   + return nil, err +
    +
    + 255 + +
    +   + } +
    +
    + 256 + +
    + - + etrogGlobalExitRoot, err := etrogpolygonzkevmglobalexitroot.NewEtrogpolygonzkevmglobalexitroot(l1Config.GlobalExitRootManagerAddr, ethClient) +
    +
    + 257 + +
    +   + if err != nil { +
    +
    + 258 + +
    +   + log.Errorf("error creating NewPolygonzkevmglobalexitroot client (%s). Error: %w", l1Config.GlobalExitRootManagerAddr.String(), err) +
    +
    + 259 + +
    +   + return nil, err +
    +
    + 260 + +
    +   + } +
    +
    + 261 + +
    + - + preEtrogGlobalExitRoot, err := preetrogpolygonzkevmglobalexitroot.NewPreetrogpolygonzkevmglobalexitroot(l1Config.GlobalExitRootManagerAddr, ethClient) +
    +
    + 262 + +
    +   + if err != nil { +
    +
    + 263 + +
    + - + log.Errorf("error creating Newpreetrogpolygonzkevmglobalexitroot client (%s). Error: %w", l1Config.GlobalExitRootManagerAddr.String(), err) +
    +
    + 264 + +
    +   + return nil, err +
    +
    + 265 + +
    +   + } +
    +
    + 266 + +
    +   + pol, err := pol.NewPol(l1Config.PolAddr, ethClient) +
    +
    +
    @@ -268,12 +256,15 @@
    +
    + 268 + +
    +   + log.Errorf("error creating NewPol client (%s). Error: %w", l1Config.PolAddr.String(), err) +
    +
    + 269 + +
    +   + return nil, err +
    +
    + 270 + +
    +   + } +
    +
    + 271 + +
    + - + feijoaContracts, err := NewFeijoaContracts(ethClient, l1Config) +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 272 + +
    +   + if err != nil { +
    +
    + 273 + +
    + - + log.Errorf("error creating NewFeijoaContracts client (%s). Error: %w", l1Config.RollupManagerAddr.String(), err) +
    +
    + 274 + +
    +   + return nil, err +
    +
    + 275 + +
    +   + } +
    +
    + 276 + +
    + - + scAddresses := feijoaContracts.GetAddresses() +
    +
    + 277 + +
    +   + scAddresses = append(scAddresses, l1Config.ZkEVMAddr, l1Config.RollupManagerAddr, l1Config.GlobalExitRootManagerAddr) +
    +
    + 278 + +
    +   +
    +
    +
    + 279 + +
    +   + gProviders := []ethereum.GasPricer{ethClient} +
    +
    +
    @@ -288,43 +279,40 @@
    +
    + 288 + +
    +   + } +
    +
    + 289 + +
    +   + metrics.Register() +
    +
    + 290 + +
    +   + // Get RollupID +
    +
    + 291 + +
    + - + rollupID, err := etrogRollupManager.RollupAddressToID(&bind.CallOpts{Pending: false}, l1Config.ZkEVMAddr) +
    +
    + 292 + +
    +   + if err != nil { +
    +
    + 293 + +
    +   + log.Debugf("error rollupManager.RollupAddressToID(%s). Error: %w", l1Config.RollupManagerAddr, err) +
    +
    + 294 + +
    +   + return nil, err +
    +
    + 295 + +
    +   + } +
    +
    + 296 + +
    +   + log.Debug("rollupID: ", rollupID) +
    +
    + 297 + +
    +   +
    +
    +
    + 298 + +
    + - + client := &Client{ +
    +
    + 299 + +
    + - + EthClient: ethClient, +
    +
    + 300 + +
    + - + EtrogZkEVM: etrogZkevm, +
    +
    + 301 + +
    + - + ElderberryZKEVM: elderberryZkevm, +
    +
    + 302 + +
    + - + PreEtrogZkEVM: preEtrogZkevm, +
    +
    + 303 + +
    + - + EtrogRollupManager: etrogRollupManager, +
    +
    + 304 + +
    + - + Pol: pol, +
    +
    + 305 + +
    + - + EtrogGlobalExitRootManager: etrogGlobalExitRoot, +
    +
    + 306 + +
    + - + PreEtrogGlobalExitRootManager: preEtrogGlobalExitRoot, +
    +
    + 307 + +
    + - + SCAddresses: scAddresses, +
    +
    + 308 + +
    + - + RollupID: rollupID, +
    +
    + + +
    +   +
    +
    +
    + 309 + +
    +   + GasProviders: externalGasProviders{ +
    +
    + 310 + +
    +   + MultiGasProvider: cfg.MultiGasProvider, +
    +
    + 311 + +
    +   + Providers: gProviders, +
    +
    + 312 + +
    +   + }, +
    +
    + 313 + +
    + - + l1Cfg: l1Config, +
    +
    + 314 + +
    + - + cfg: cfg, +
    +
    + 315 + +
    + - + auth: map[common.Address]bind.TransactOpts{}, +
    +
    + 316 + +
    + - + EIP4844: eip4844, +
    +
    + 317 + +
    + - + } +
    +
    + 318 + +
    + - + if feijoaEnabled { +
    +
    + 319 + +
    + - + eventFeijoaManager := NewEventManager(client, NewCallDataExtratorGeth(ethClient)) +
    +
    + 320 + +
    + - + eventFeijoaManager.AddProcessor(NewEventFeijoaSequenceBlobsProcessor(feijoaContracts)) +
    +
    + 321 + +
    + - + client.eventFeijoaManager = eventFeijoaManager +
    +
    + 322 + +
    + - + } +
    +
    + 323 + +
    + - + return client, nil +
    +
    + 324 + +
    +   + } +
    +
    + 325 + +
    +   +
    +
    +
    + 326 + +
    +   + // VerifyGenBlockNumber verifies if the genesis Block Number is valid +
    +
    + 327 + +
    +   + func (etherMan *Client) VerifyGenBlockNumber(ctx context.Context, genBlockNumber uint64) (bool, error) { +
    +
    + + +
    +   +
    +
    +
    + 328 + +
    +   + start := time.Now() +
    +
    + 329 + +
    +   + log.Info("Verifying genesis blockNumber: ", genBlockNumber) +
    +
    + 330 + +
    +   + // Filter query +
    +
    +
    @@ -342,11 +330,11 @@
    +
    + 342 + +
    +   + if len(logs) == 0 { +
    +
    + 343 + +
    +   + return false, fmt.Errorf("the specified genBlockNumber in config file does not contain any forkID event. Please use the proper blockNumber.") +
    +
    + 344 + +
    +   + } +
    +
    + 345 + +
    + - + var zkevmVersion preetrogpolygonzkevm.PreetrogpolygonzkevmUpdateZkEVMVersion +
    +
    + 346 + +
    +   + switch logs[0].Topics[0] { +
    +
    + 347 + +
    +   + case updateZkEVMVersionSignatureHash: +
    +
    + 348 + +
    +   + log.Debug("UpdateZkEVMVersion event detected during the Verification of the GenBlockNumber") +
    +
    + 349 + +
    + - + zkevmV, err := etherMan.PreEtrogZkEVM.ParseUpdateZkEVMVersion(logs[0]) +
    +
    + 350 + +
    +   + if err != nil { +
    +
    + 351 + +
    +   + return false, err +
    +
    + 352 + +
    +   + } +
    +
    +
    @@ -355,12 +343,12 @@
    +
    + 355 + +
    +   + } +
    +
    + 356 + +
    +   + case createNewRollupSignatureHash: +
    +
    + 357 + +
    +   + log.Debug("CreateNewRollup event detected during the Verification of the GenBlockNumber") +
    +
    + 358 + +
    + - + createNewRollupEvent, err := etherMan.EtrogRollupManager.ParseCreateNewRollup(logs[0]) +
    +
    + 359 + +
    +   + if err != nil { +
    +
    + 360 + +
    +   + return false, err +
    +
    + 361 + +
    +   + } +
    +
    + 362 + +
    +   + // Query to get the forkID +
    +
    + 363 + +
    + - + rollupType, err := etherMan.EtrogRollupManager.RollupTypeMap(&bind.CallOpts{Pending: false}, createNewRollupEvent.RollupTypeID) +
    +
    + 364 + +
    +   + if err != nil { +
    +
    + 365 + +
    +   + log.Error(err) +
    +
    + 366 + +
    +   + return false, err +
    +
    +
    @@ -375,36 +363,16 @@
    +
    + 375 + +
    +   + return true, nil +
    +
    + 376 + +
    +   + } +
    +
    + 377 + +
    +   +
    +
    +
    + 378 + +
    + - + // GetL1BlockUpgradeLxLy It returns the block genesis for LxLy before genesisBlock or error +
    +
    + 379 + +
    + - + // TODO: Check if all RPC providers support this range of blocks +
    +
    + 380 + +
    + - + func (etherMan *Client) GetL1BlockUpgradeLxLy(ctx context.Context, genesisBlock uint64) (uint64, error) { +
    +
    + 381 + +
    + - + it, err := etherMan.EtrogRollupManager.FilterInitialized(&bind.FilterOpts{ +
    +
    + 382 + +
    + - + Start: 1, +
    +
    + 383 + +
    + - + End: &genesisBlock, +
    +
    + 384 + +
    + - + Context: ctx, +
    +
    + 385 + +
    + - + }) +
    +
    + 386 + +
    + - + if err != nil { +
    +
    + 387 + +
    + - + return uint64(0), err +
    +
    + 388 + +
    + - + } +
    +
    + 389 + +
    + - + for it.Next() { +
    +
    + 390 + +
    + - + log.Debugf("BlockNumber: %d Topics:Initialized(%d)", it.Event.Raw.BlockNumber, it.Event.Version) +
    +
    + 391 + +
    + - + if it.Event.Version == ETrogUpgradeVersion { // 2 is ETROG (LxLy upgrade) +
    +
    + 392 + +
    + - + log.Infof("LxLy upgrade found at blockNumber: %d", it.Event.Raw.BlockNumber) +
    +
    + 393 + +
    + - + return it.Event.Raw.BlockNumber, nil +
    +
    + 394 + +
    + - + } +
    +
    + 395 + +
    + - + } +
    +
    + 396 + +
    + - + return uint64(0), ErrNotFound +
    +
    + 397 + +
    + - + } +
    +
    + 398 + +
    + - +
    +
    +
    + 399 + +
    +   + // GetForks returns fork information +
    +
    + 400 + +
    +   + func (etherMan *Client) GetForks(ctx context.Context, genBlockNumber uint64, lastL1BlockSynced uint64) ([]state.ForkIDInterval, error) { +
    +
    + 401 + +
    +   + log.Debug("Getting forkIDs from blockNumber: ", genBlockNumber) +
    +
    + 402 + +
    +   + start := time.Now() +
    +
    + 403 + +
    +   + var logs []types.Log +
    +
    + 404 + +
    + - + // At minimum it checks the GenesisBlock +
    +
    + 405 + +
    +   + if lastL1BlockSynced < genBlockNumber { +
    +
    + 406 + +
    +   + lastL1BlockSynced = genBlockNumber +
    +
    + 407 + +
    +   + } +
    +
    + + +
    +   +
    +
    +
    + 408 + +
    +   + log.Debug("Using ForkIDChunkSize: ", etherMan.cfg.ForkIDChunkSize) +
    +
    + 409 + +
    +   + for i := genBlockNumber; i <= lastL1BlockSynced; i = i + etherMan.cfg.ForkIDChunkSize + 1 { +
    +
    + 410 + +
    +   + final := i + etherMan.cfg.ForkIDChunkSize +
    +
    +
    @@ -429,11 +397,11 @@
    +
    + 429 + +
    +   +
    +
    +
    + 430 + +
    +   + var forks []state.ForkIDInterval +
    +
    + 431 + +
    +   + for i, l := range logs { +
    +
    + 432 + +
    + - + var zkevmVersion preetrogpolygonzkevm.PreetrogpolygonzkevmUpdateZkEVMVersion +
    +
    + 433 + +
    +   + switch l.Topics[0] { +
    +
    + 434 + +
    +   + case updateZkEVMVersionSignatureHash: +
    +
    + 435 + +
    +   + log.Debug("updateZkEVMVersion Event received") +
    +
    + 436 + +
    + - + zkevmV, err := etherMan.PreEtrogZkEVM.ParseUpdateZkEVMVersion(l) +
    +
    + 437 + +
    +   + if err != nil { +
    +
    + 438 + +
    +   + return []state.ForkIDInterval{}, err +
    +
    + 439 + +
    +   + } +
    +
    +
    @@ -442,7 +410,7 @@
    +
    + 442 + +
    +   + } +
    +
    + 443 + +
    +   + case updateRollupSignatureHash: +
    +
    + 444 + +
    +   + log.Debug("updateRollup Event received") +
    +
    + 445 + +
    + - + updateRollupEvent, err := etherMan.EtrogRollupManager.ParseUpdateRollup(l) +
    +
    + 446 + +
    +   + if err != nil { +
    +
    + 447 + +
    +   + return []state.ForkIDInterval{}, err +
    +
    + 448 + +
    +   + } +
    +
    +
    @@ -450,7 +418,7 @@
    +
    + 450 + +
    +   + continue +
    +
    + 451 + +
    +   + } +
    +
    + 452 + +
    +   + // Query to get the forkID +
    +
    + 453 + +
    + - + rollupType, err := etherMan.EtrogRollupManager.RollupTypeMap(&bind.CallOpts{Pending: false}, updateRollupEvent.NewRollupTypeID) +
    +
    + 454 + +
    +   + if err != nil { +
    +
    + 455 + +
    +   + return []state.ForkIDInterval{}, err +
    +
    + 456 + +
    +   + } +
    +
    +
    @@ -459,7 +427,7 @@
    +
    + 459 + +
    +   +
    +
    +
    + 460 + +
    +   + case addExistingRollupSignatureHash: +
    +
    + 461 + +
    +   + log.Debug("addExistingRollup Event received") +
    +
    + 462 + +
    + - + addExistingRollupEvent, err := etherMan.EtrogRollupManager.ParseAddExistingRollup(l) +
    +
    + 463 + +
    +   + if err != nil { +
    +
    + 464 + +
    +   + return []state.ForkIDInterval{}, err +
    +
    + 465 + +
    +   + } +
    +
    +
    @@ -471,7 +439,7 @@
    +
    + 471 + +
    +   +
    +
    +
    + 472 + +
    +   + case createNewRollupSignatureHash: +
    +
    + 473 + +
    +   + log.Debug("createNewRollup Event received") +
    +
    + 474 + +
    + - + createNewRollupEvent, err := etherMan.EtrogRollupManager.ParseCreateNewRollup(l) +
    +
    + 475 + +
    +   + if err != nil { +
    +
    + 476 + +
    +   + return []state.ForkIDInterval{}, err +
    +
    + 477 + +
    +   + } +
    +
    +
    @@ -479,7 +447,7 @@
    +
    + 479 + +
    +   + continue +
    +
    + 480 + +
    +   + } +
    +
    + 481 + +
    +   + // Query to get the forkID +
    +
    + 482 + +
    + - + rollupType, err := etherMan.EtrogRollupManager.RollupTypeMap(&bind.CallOpts{Pending: false}, createNewRollupEvent.RollupTypeID) +
    +
    + 483 + +
    +   + if err != nil { +
    +
    + 484 + +
    +   + log.Error(err) +
    +
    + 485 + +
    +   + return []state.ForkIDInterval{}, err +
    +
    +
    @@ -531,25 +499,6 @@
    +
    + 531 + +
    +   + return blocks, blocksOrder, nil +
    +
    + 532 + +
    +   + } +
    +
    + 533 + +
    +   +
    +
    +
    + 534 + +
    + - + // GetRollupInfoByBlockRangePreviousRollupGenesis function retrieves the Rollup information that are included in all this ethereum blocks +
    +
    + 535 + +
    + - + // but it only retrieves the information from the previous rollup genesis block to the current block. +
    +
    + 536 + +
    + - + func (etherMan *Client) GetRollupInfoByBlockRangePreviousRollupGenesis(ctx context.Context, fromBlock uint64, toBlock *uint64) ([]Block, map[common.Hash][]Order, error) { +
    +
    + 537 + +
    + - + // Filter query +
    +
    + 538 + +
    + - + query := ethereum.FilterQuery{ +
    +
    + 539 + +
    + - + FromBlock: new(big.Int).SetUint64(fromBlock), +
    +
    + 540 + +
    + - + Addresses: []common.Address{etherMan.l1Cfg.GlobalExitRootManagerAddr}, +
    +
    + 541 + +
    + - + Topics: [][]common.Hash{{updateL1InfoTreeSignatureHash}}, +
    +
    + 542 + +
    + - + } +
    +
    + 543 + +
    + - + if toBlock != nil { +
    +
    + 544 + +
    + - + query.ToBlock = new(big.Int).SetUint64(*toBlock) +
    +
    + 545 + +
    + - + } +
    +
    + 546 + +
    + - + blocks, blocksOrder, err := etherMan.readEvents(ctx, query) +
    +
    + 547 + +
    + - + if err != nil { +
    +
    + 548 + +
    + - + return nil, nil, err +
    +
    + 549 + +
    + - + } +
    +
    + 550 + +
    + - + return blocks, blocksOrder, nil +
    +
    + 551 + +
    + - + } +
    +
    + 552 + +
    + - +
    +
    +
    + 553 + +
    +   + // Order contains the event order to let the synchronizer store the information following this order. +
    +
    + 554 + +
    +   + type Order struct { +
    +
    + 555 + +
    +   + Name EventOrder +
    +
    +
    @@ -580,17 +529,8 @@
    +
    + 580 + +
    +   + metrics.ReadAndProcessAllEventsTime(time.Since(start)) +
    +
    + 581 + +
    +   + return blocks, blocksOrder, nil +
    +
    + 582 + +
    +   + } +
    +
    + 583 + +
    + - + func (etherMan *Client) processEvent(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 584 + +
    + - + if etherMan.eventFeijoaManager != nil { +
    +
    + 585 + +
    + - + processed, err := etherMan.eventFeijoaManager.ProcessEvent(ctx, vLog, blocks, blocksOrder) +
    +
    + 586 + +
    + - + if processed || err != nil { +
    +
    + 587 + +
    + - + return err +
    +
    + 588 + +
    + - + } +
    +
    + 589 + +
    + - + } +
    +
    + 590 + +
    + - + return etherMan.processEventLegacy(ctx, vLog, blocks, blocksOrder) +
    +
    + 591 + +
    + - + } +
    +
    + 592 + +
    +   +
    +
    +
    + 593 + +
    + - + func (etherMan *Client) processEventLegacy(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 594 + +
    +   + switch vLog.Topics[0] { +
    +
    + 595 + +
    +   + case sequenceBatchesSignatureHash: +
    +
    + 596 + +
    +   + return etherMan.sequencedBatchesEvent(ctx, vLog, blocks, blocksOrder) +
    +
    +
    @@ -612,8 +552,8 @@
    +
    + 612 + +
    +   + case rollupManagerVerifyBatchesSignatureHash: +
    +
    + 613 + +
    +   + log.Debug("RollupManagerVerifyBatches event detected. Ignoring...") +
    +
    + 614 + +
    +   + return nil +
    +
    + 615 + +
    + - + case preEtrogVerifyBatchesTrustedAggregatorSignatureHash: +
    +
    + 616 + +
    + - + return etherMan.preEtrogVerifyBatchesTrustedAggregatorEvent(ctx, vLog, blocks, blocksOrder) +
    +
    + 617 + +
    +   + case verifyBatchesSignatureHash: +
    +
    + 618 + +
    +   + return etherMan.verifyBatchesEvent(ctx, vLog, blocks, blocksOrder) +
    +
    + 619 + +
    +   + case sequenceForceBatchesSignatureHash: +
    +
    +
    @@ -653,8 +593,8 @@
    +
    + 653 + +
    +   + case consolidatePendingStateSignatureHash: +
    +
    + 654 + +
    +   + log.Debug("ConsolidatePendingState event detected. Ignoring...") +
    +
    + 655 + +
    +   + return nil +
    +
    + 656 + +
    + - + case preEtrogConsolidatePendingStateSignatureHash: +
    +
    + 657 + +
    + - + log.Debug("PreEtrogConsolidatePendingState event detected. Ignoring...") +
    +
    + 658 + +
    +   + return nil +
    +
    + 659 + +
    +   + case setTrustedAggregatorTimeoutSignatureHash: +
    +
    + 660 + +
    +   + log.Debug("SetTrustedAggregatorTimeout event detected. Ignoring...") +
    +
    +
    @@ -689,8 +629,8 @@
    +
    + 689 + +
    +   + case overridePendingStateSignatureHash: +
    +
    + 690 + +
    +   + log.Debug("OverridePendingState event detected. Ignoring...") +
    +
    + 691 + +
    +   + return nil +
    +
    + 692 + +
    + - + case preEtrogOverridePendingStateSignatureHash: +
    +
    + 693 + +
    + - + log.Debug("PreEtrogOverridePendingState event detected. Ignoring...") +
    +
    + 694 + +
    +   + return nil +
    +
    + 695 + +
    +   + case roleAdminChangedSignatureHash: +
    +
    + 696 + +
    +   + log.Debug("RoleAdminChanged event detected. Ignoring...") +
    +
    +
    @@ -726,7 +666,7 @@
    +
    + 726 + +
    +   +
    +
    +
    + 727 + +
    +   + func (etherMan *Client) updateZkevmVersion(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 728 + +
    +   + log.Debug("UpdateZkEVMVersion event detected") +
    +
    + 729 + +
    + - + zkevmVersion, err := etherMan.PreEtrogZkEVM.ParseUpdateZkEVMVersion(vLog) +
    +
    + 730 + +
    +   + if err != nil { +
    +
    + 731 + +
    +   + log.Error("error parsing UpdateZkEVMVersion event. Error: ", err) +
    +
    + 732 + +
    +   + return err +
    +
    +
    @@ -736,12 +676,12 @@
    +
    + 736 + +
    +   +
    +
    +
    + 737 + +
    +   + func (etherMan *Client) updateRollup(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 738 + +
    +   + log.Debug("UpdateRollup event detected") +
    +
    + 739 + +
    + - + updateRollup, err := etherMan.EtrogRollupManager.ParseUpdateRollup(vLog) +
    +
    + 740 + +
    +   + if err != nil { +
    +
    + 741 + +
    +   + log.Error("error parsing UpdateRollup event. Error: ", err) +
    +
    + 742 + +
    +   + return err +
    +
    + 743 + +
    +   + } +
    +
    + 744 + +
    + - + rollupType, err := etherMan.EtrogRollupManager.RollupTypeMap(&bind.CallOpts{Pending: false}, updateRollup.NewRollupTypeID) +
    +
    + 745 + +
    +   + if err != nil { +
    +
    + 746 + +
    +   + return err +
    +
    + 747 + +
    +   + } +
    +
    +
    @@ -750,12 +690,12 @@
    +
    + 750 + +
    +   +
    +
    +
    + 751 + +
    +   + func (etherMan *Client) createNewRollup(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 752 + +
    +   + log.Debug("createNewRollup event detected") +
    +
    + 753 + +
    + - + createRollup, err := etherMan.EtrogRollupManager.ParseCreateNewRollup(vLog) +
    +
    + 754 + +
    +   + if err != nil { +
    +
    + 755 + +
    +   + log.Error("error parsing createNewRollup event. Error: ", err) +
    +
    + 756 + +
    +   + return err +
    +
    + 757 + +
    +   + } +
    +
    + 758 + +
    + - + rollupType, err := etherMan.EtrogRollupManager.RollupTypeMap(&bind.CallOpts{Pending: false}, createRollup.RollupTypeID) +
    +
    + 759 + +
    +   + if err != nil { +
    +
    + 760 + +
    +   + return err +
    +
    + 761 + +
    +   + } +
    +
    +
    @@ -764,7 +704,7 @@
    +
    + 764 + +
    +   +
    +
    +
    + 765 + +
    +   + func (etherMan *Client) addExistingRollup(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 766 + +
    +   + log.Debug("addExistingRollup event detected") +
    +
    + 767 + +
    + - + addExistingRollup, err := etherMan.EtrogRollupManager.ParseAddExistingRollup(vLog) +
    +
    + 768 + +
    +   + if err != nil { +
    +
    + 769 + +
    +   + log.Error("error parsing createNewRollup event. Error: ", err) +
    +
    + 770 + +
    +   + return err +
    +
    +
    @@ -773,66 +713,13 @@
    +
    + 773 + +
    +   + return etherMan.updateForkId(ctx, vLog, blocks, blocksOrder, addExistingRollup.LastVerifiedBatchBeforeUpgrade, addExistingRollup.ForkID, "", addExistingRollup.RollupID) +
    +
    + 774 + +
    +   + } +
    +
    + 775 + +
    +   +
    +
    +
    + 776 + +
    + - + func (etherMan *Client) updateEtrogSequence(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 777 + +
    + - + log.Debug("updateEtrogSequence event detected") +
    +
    + 778 + +
    + - + updateEtrogSequence, err := etherMan.ElderberryZKEVM.ParseUpdateEtrogSequence(vLog) +
    +
    + 779 + +
    + - + if err != nil { +
    +
    + 780 + +
    + - + log.Error("error parsing updateEtrogSequence event. Error: ", err) +
    +
    + 781 + +
    + - + return err +
    +
    + 782 + +
    + - + } +
    +
    + 783 + +
    + - +
    +
    +
    + 784 + +
    + - + // Read the tx for this event. +
    +
    + 785 + +
    + - + tx, err := etherMan.EthClient.TransactionInBlock(ctx, vLog.BlockHash, vLog.TxIndex) +
    +
    + 786 + +
    + - + if err != nil { +
    +
    + 787 + +
    + - + return err +
    +
    + 788 + +
    + - + } +
    +
    + 789 + +
    + - + if tx.Hash() != vLog.TxHash { +
    +
    + 790 + +
    + - + return fmt.Errorf("error: tx hash mismatch. want: %s have: %s", vLog.TxHash, tx.Hash().String()) +
    +
    + 791 + +
    + - + } +
    +
    + 792 + +
    + - + msg, err := core.TransactionToMessage(tx, types.NewLondonSigner(tx.ChainId()), big.NewInt(0)) +
    +
    + 793 + +
    + - + if err != nil { +
    +
    + 794 + +
    + - + return err +
    +
    + 795 + +
    + - + } +
    +
    + 796 + +
    + - + fullBlock, err := etherMan.EthClient.BlockByHash(ctx, vLog.BlockHash) +
    +
    + 797 + +
    + - + if err != nil { +
    +
    + 798 + +
    + - + return fmt.Errorf("error getting fullBlockInfo. BlockNumber: %d. Error: %w", vLog.BlockNumber, err) +
    +
    + 799 + +
    + - + } +
    +
    + 800 + +
    + - +
    +
    +
    + 801 + +
    + - + log.Info("update Etrog transaction sequence...") +
    +
    + 802 + +
    + - + sequence := UpdateEtrogSequence{ +
    +
    + 803 + +
    + - + BatchNumber: updateEtrogSequence.NumBatch, +
    +
    + 804 + +
    + - + SequencerAddr: updateEtrogSequence.Sequencer, +
    +
    + 805 + +
    + - + TxHash: vLog.TxHash, +
    +
    + 806 + +
    + - + Nonce: msg.Nonce, +
    +
    + 807 + +
    + - + PolygonRollupBaseEtrogBatchData: &etrogpolygonzkevm.PolygonRollupBaseEtrogBatchData{ +
    +
    + 808 + +
    + - + Transactions: updateEtrogSequence.Transactions, +
    +
    + 809 + +
    + - + ForcedGlobalExitRoot: updateEtrogSequence.LastGlobalExitRoot, +
    +
    + 810 + +
    + - + ForcedTimestamp: fullBlock.Time(), +
    +
    + 811 + +
    + - + ForcedBlockHashL1: fullBlock.ParentHash(), +
    +
    + 812 + +
    + - + }, +
    +
    + 813 + +
    + - + } +
    +
    + 814 + +
    + - +
    +
    +
    + 815 + +
    + - + if len(*blocks) == 0 || ((*blocks)[len(*blocks)-1].BlockHash != vLog.BlockHash || (*blocks)[len(*blocks)-1].BlockNumber != vLog.BlockNumber) { +
    +
    + 816 + +
    + - + block := prepareBlock(vLog, time.Unix(int64(fullBlock.Time()), 0), fullBlock) +
    +
    + 817 + +
    + - + block.UpdateEtrogSequence = sequence +
    +
    + 818 + +
    + - + *blocks = append(*blocks, block) +
    +
    + 819 + +
    + - + } else if (*blocks)[len(*blocks)-1].BlockHash == vLog.BlockHash && (*blocks)[len(*blocks)-1].BlockNumber == vLog.BlockNumber { +
    +
    + 820 + +
    + - + (*blocks)[len(*blocks)-1].UpdateEtrogSequence = sequence +
    +
    + 821 + +
    + - + } else { +
    +
    + 822 + +
    + - + log.Error("Error processing UpdateEtrogSequence event. BlockHash:", vLog.BlockHash, ". BlockNumber: ", vLog.BlockNumber) +
    +
    + 823 + +
    + - + return fmt.Errorf("error processing UpdateEtrogSequence event") +
    +
    + 824 + +
    + - + } +
    +
    + 825 + +
    + - + or := Order{ +
    +
    + 826 + +
    + - + Name: UpdateEtrogSequenceOrder, +
    +
    + 827 + +
    + - + Pos: 0, +
    +
    + 828 + +
    + - + } +
    +
    + 829 + +
    + - + (*blocksOrder)[(*blocks)[len(*blocks)-1].BlockHash] = append((*blocksOrder)[(*blocks)[len(*blocks)-1].BlockHash], or) +
    +
    + 830 + +
    + - + return nil +
    +
    + 831 + +
    +   + } +
    +
    + 832 + +
    +   +
    +
    +
    + 833 + +
    +   + func (etherMan *Client) initialSequenceBatches(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 834 + +
    +   + log.Debug("initialSequenceBatches event detected") +
    +
    + 835 + +
    + - + initialSequenceBatches, err := etherMan.EtrogZkEVM.ParseInitialSequenceBatches(vLog) +
    +
    + 836 + +
    +   + if err != nil { +
    +
    + 837 + +
    +   + log.Error("error parsing initialSequenceBatches event. Error: ", err) +
    +
    + 838 + +
    +   + return err +
    +
    +
    @@ -862,7 +749,7 @@
    +
    + 862 + +
    +   + SequencerAddr: initialSequenceBatches.Sequencer, +
    +
    + 863 + +
    +   + TxHash: vLog.TxHash, +
    +
    + 864 + +
    +   + Nonce: msg.Nonce, +
    +
    + 865 + +
    + - + PolygonRollupBaseEtrogBatchData: &etrogpolygonzkevm.PolygonRollupBaseEtrogBatchData{ +
    +
    + 866 + +
    +   + Transactions: initialSequenceBatches.Transactions, +
    +
    + 867 + +
    +   + ForcedGlobalExitRoot: initialSequenceBatches.LastGlobalExitRoot, +
    +
    + 868 + +
    +   + ForcedTimestamp: fullBlock.Time(), +
    +
    +
    @@ -922,20 +809,20 @@
    +
    + 922 + +
    +   +
    +
    +
    + 923 + +
    +   + func (etherMan *Client) updateL1InfoTreeEvent(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 924 + +
    +   + log.Debug("UpdateL1InfoTree event detected") +
    +
    + 925 + +
    + - + etrogGlobalExitRootL1InfoTree, err := etherMan.EtrogGlobalExitRootManager.ParseUpdateL1InfoTree(vLog) +
    +
    + 926 + +
    +   + if err != nil { +
    +
    + 927 + +
    +   + return err +
    +
    + 928 + +
    +   + } +
    +
    + 929 + +
    +   +
    +
    +
    + 930 + +
    +   + var gExitRoot GlobalExitRoot +
    +
    + 931 + +
    + - + gExitRoot.MainnetExitRoot = etrogGlobalExitRootL1InfoTree.MainnetExitRoot +
    +
    + 932 + +
    + - + gExitRoot.RollupExitRoot = etrogGlobalExitRootL1InfoTree.RollupExitRoot +
    +
    + 933 + +
    +   + gExitRoot.BlockNumber = vLog.BlockNumber +
    +
    + 934 + +
    + - + gExitRoot.GlobalExitRoot = hash(etrogGlobalExitRootL1InfoTree.MainnetExitRoot, etrogGlobalExitRootL1InfoTree.RollupExitRoot) +
    +
    + 935 + +
    +   + var block *Block +
    +
    + 936 + +
    +   + if !isheadBlockInArray(blocks, vLog.BlockHash, vLog.BlockNumber) { +
    +
    + 937 + +
    +   + // Need to add the block, doesnt mind if inside the blocks because I have to respect the order so insert at end +
    +
    + 938 + +
    + - + block, err = etherMan.RetrieveFullBlockForEvent(ctx, vLog) +
    +
    + 939 + +
    +   + if err != nil { +
    +
    + 940 + +
    +   + return err +
    +
    + 941 + +
    +   + } +
    +
    +
    @@ -955,8 +842,7 @@
    +
    + 955 + +
    +   + return nil +
    +
    + 956 + +
    +   + } +
    +
    + 957 + +
    +   +
    +
    +
    + 958 + +
    + - + // RetrieveFullBlockForEvent retrieves the full block for a given event +
    +
    + 959 + +
    + - + func (etherMan *Client) RetrieveFullBlockForEvent(ctx context.Context, vLog types.Log) (*Block, error) { +
    +
    + 960 + +
    +   + fullBlock, err := etherMan.EthClient.BlockByHash(ctx, vLog.BlockHash) +
    +
    + 961 + +
    +   + if err != nil { +
    +
    + 962 + +
    +   + return nil, fmt.Errorf("error getting hashParent. BlockNumber: %d. Error: %w", vLog.BlockNumber, err) +
    +
    +
    @@ -975,11 +861,11 @@
    +
    + 975 + +
    +   +
    +
    +
    + 976 + +
    +   + func (etherMan *Client) updateGlobalExitRootEvent(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 977 + +
    +   + log.Debug("UpdateGlobalExitRoot event detected") +
    +
    + 978 + +
    + - + preEtrogGlobalExitRoot, err := etherMan.PreEtrogGlobalExitRootManager.ParseUpdateGlobalExitRoot(vLog) +
    +
    + 979 + +
    +   + if err != nil { +
    +
    + 980 + +
    +   + return err +
    +
    + 981 + +
    +   + } +
    +
    + 982 + +
    + - + return etherMan.processUpdateGlobalExitRootEvent(ctx, preEtrogGlobalExitRoot.MainnetExitRoot, preEtrogGlobalExitRoot.RollupExitRoot, vLog, blocks, blocksOrder) +
    +
    + 983 + +
    +   + } +
    +
    + 984 + +
    +   +
    +
    +
    + 985 + +
    +   + func (etherMan *Client) processUpdateGlobalExitRootEvent(ctx context.Context, mainnetExitRoot, rollupExitRoot common.Hash, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    +
    @@ -1027,14 +913,14 @@
    +
    + 1027 + +
    +   + } +
    +
    + 1028 + +
    +   +
    +
    +
    + 1029 + +
    +   + // EstimateGasSequenceBatches estimates gas for sending batches +
    +
    + 1030 + +
    + - + func (etherMan *Client) EstimateGasSequenceBatches(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, lastSequencedBatchNumber uint64, l2Coinbase common.Address) (*types.Transaction, error) { +
    +
    + 1031 + +
    +   + opts, err := etherMan.getAuthByAddress(sender) +
    +
    + 1032 + +
    +   + if err == ErrNotFound { +
    +
    + 1033 + +
    +   + return nil, ErrPrivateKeyNotFound +
    +
    + 1034 + +
    +   + } +
    +
    + 1035 + +
    +   + opts.NoSend = true +
    +
    + 1036 + +
    +   +
    +
    +
    + 1037 + +
    + - + tx, err := etherMan.sequenceBatches(opts, sequences, maxSequenceTimestamp, lastSequencedBatchNumber, l2Coinbase) +
    +
    + 1038 + +
    +   + if err != nil { +
    +
    + 1039 + +
    +   + return nil, err +
    +
    + 1040 + +
    +   + } +
    +
    +
    @@ -1043,7 +929,7 @@
    +
    + 1043 + +
    +   + } +
    +
    + 1044 + +
    +   +
    +
    +
    + 1045 + +
    +   + // BuildSequenceBatchesTxData builds a []bytes to be sent to the PoE SC method SequenceBatches. +
    +
    + 1046 + +
    + - + func (etherMan *Client) BuildSequenceBatchesTxData(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, lastSequencedBatchNumber uint64, l2Coinbase common.Address) (to *common.Address, data []byte, err error) { +
    +
    + 1047 + +
    +   + opts, err := etherMan.getAuthByAddress(sender) +
    +
    + 1048 + +
    +   + if err == ErrNotFound { +
    +
    + 1049 + +
    +   + return nil, nil, fmt.Errorf("failed to build sequence batches, err: %w", ErrPrivateKeyNotFound) +
    +
    +
    @@ -1054,7 +940,7 @@
    +
    + 1054 + +
    +   + opts.GasLimit = uint64(1) +
    +
    + 1055 + +
    +   + opts.GasPrice = big.NewInt(1) +
    +
    + 1056 + +
    +   +
    +
    +
    + 1057 + +
    + - + tx, err := etherMan.sequenceBatches(opts, sequences, maxSequenceTimestamp, lastSequencedBatchNumber, l2Coinbase) +
    +
    + 1058 + +
    +   + if err != nil { +
    +
    + 1059 + +
    +   + return nil, nil, err +
    +
    + 1060 + +
    +   + } +
    +
    +
    @@ -1062,15 +948,15 @@
    +
    + 1062 + +
    +   + return tx.To(), tx.Data(), nil +
    +
    + 1063 + +
    +   + } +
    +
    + 1064 + +
    +   +
    +
    +
    + 1065 + +
    + - + func (etherMan *Client) sequenceBatches(opts bind.TransactOpts, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, lastSequencedBatchNumber uint64, l2Coinbase common.Address) (*types.Transaction, error) { +
    +
    + 1066 + +
    + - + var batches []etrogpolygonzkevm.PolygonRollupBaseEtrogBatchData +
    +
    + 1067 + +
    +   + for _, seq := range sequences { +
    +
    + 1068 + +
    +   + var ger common.Hash +
    +
    + 1069 + +
    +   + if seq.ForcedBatchTimestamp > 0 { +
    +
    + 1070 + +
    +   + ger = seq.GlobalExitRoot +
    +
    + 1071 + +
    +   + } +
    +
    + 1072 + +
    + - + batch := etrogpolygonzkevm.PolygonRollupBaseEtrogBatchData{ +
    +
    + 1073 + +
    + - + Transactions: seq.BatchL2Data, +
    +
    + 1074 + +
    +   + ForcedGlobalExitRoot: ger, +
    +
    + 1075 + +
    +   + ForcedTimestamp: uint64(seq.ForcedBatchTimestamp), +
    +
    + 1076 + +
    +   + ForcedBlockHashL1: seq.PrevBlockHash, +
    +
    +
    @@ -1079,12 +965,12 @@
    +
    + 1079 + +
    +   + batches = append(batches, batch) +
    +
    + 1080 + +
    +   + } +
    +
    + 1081 + +
    +   +
    +
    +
    + 1082 + +
    + - + tx, err := etherMan.EtrogZkEVM.SequenceBatches(&opts, batches, maxSequenceTimestamp, lastSequencedBatchNumber, l2Coinbase) +
    +
    + 1083 + +
    +   + if err != nil { +
    +
    + 1084 + +
    +   + log.Debugf("Batches to send: %+v", batches) +
    +
    + 1085 + +
    +   + log.Debug("l2CoinBase: ", l2Coinbase) +
    +
    + 1086 + +
    +   + log.Debug("Sequencer address: ", opts.From) +
    +
    + 1087 + +
    + - + a, err2 := etrogpolygonzkevm.EtrogpolygonzkevmMetaData.GetAbi() +
    +
    + 1088 + +
    +   + if err2 != nil { +
    +
    + 1089 + +
    +   + log.Error("error getting abi. Error: ", err2) +
    +
    + 1090 + +
    +   + } +
    +
    +
    @@ -1144,7 +1030,7 @@
    +
    + 1144 + +
    +   +
    +
    +
    + 1145 + +
    +   + const pendStateNum = 0 // TODO hardcoded for now until we implement the pending state feature +
    +
    + 1146 + +
    +   +
    +
    +
    + 1147 + +
    + - + tx, err := etherMan.EtrogRollupManager.VerifyBatchesTrustedAggregator( +
    +
    + 1148 + +
    +   + &opts, +
    +
    + 1149 + +
    +   + etherMan.RollupID, +
    +
    + 1150 + +
    +   + pendStateNum, +
    +
    +
    @@ -1186,7 +1072,7 @@
    +
    + 1186 + +
    +   +
    +
    +
    + 1187 + +
    +   + // GetSendSequenceFee get super/trusted sequencer fee +
    +
    + 1188 + +
    +   + func (etherMan *Client) GetSendSequenceFee(numBatches uint64) (*big.Int, error) { +
    +
    + 1189 + +
    + - + f, err := etherMan.EtrogRollupManager.GetBatchFee(&bind.CallOpts{Pending: false}) +
    +
    + 1190 + +
    +   + if err != nil { +
    +
    + 1191 + +
    +   + return nil, err +
    +
    + 1192 + +
    +   + } +
    +
    +
    @@ -1196,12 +1082,12 @@
    +
    + 1196 + +
    +   +
    +
    +
    + 1197 + +
    +   + // TrustedSequencer gets trusted sequencer address +
    +
    + 1198 + +
    +   + func (etherMan *Client) TrustedSequencer() (common.Address, error) { +
    +
    + 1199 + +
    + - + return etherMan.EtrogZkEVM.TrustedSequencer(&bind.CallOpts{Pending: false}) +
    +
    + 1200 + +
    +   + } +
    +
    + 1201 + +
    +   +
    +
    +
    + 1202 + +
    +   + func (etherMan *Client) forcedBatchEvent(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 1203 + +
    +   + log.Debug("ForceBatch event detected") +
    +
    + 1204 + +
    + - + fb, err := etherMan.EtrogZkEVM.ParseForceBatch(vLog) +
    +
    + 1205 + +
    +   + if err != nil { +
    +
    + 1206 + +
    +   + return err +
    +
    + 1207 + +
    +   + } +
    +
    +
    @@ -1227,7 +1113,7 @@
    +
    + 1227 + +
    +   + txData := tx.Data() +
    +
    + 1228 + +
    +   + // Extract coded txs. +
    +
    + 1229 + +
    +   + // Load contract ABI +
    +
    + 1230 + +
    + - + abi, err := abi.JSON(strings.NewReader(etrogpolygonzkevm.EtrogpolygonzkevmABI)) +
    +
    + 1231 + +
    +   + if err != nil { +
    +
    + 1232 + +
    +   + return err +
    +
    + 1233 + +
    +   + } +
    +
    +
    @@ -1276,7 +1162,7 @@
    +
    + 1276 + +
    +   + func (etherMan *Client) sequencedBatchesEvent(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 1277 + +
    +   + log.Debugf("SequenceBatches event detected: txHash: %s", common.Bytes2Hex(vLog.TxHash[:])) +
    +
    + 1278 + +
    +   +
    +
    +
    + 1279 + +
    + - + sb, err := etherMan.EtrogZkEVM.ParseSequenceBatches(vLog) +
    +
    + 1280 + +
    +   + if err != nil { +
    +
    + 1281 + +
    +   + return err +
    +
    + 1282 + +
    +   + } +
    +
    +
    @@ -1289,7 +1175,7 @@
    +
    + 1289 + +
    +   + if tx.Hash() != vLog.TxHash { +
    +
    + 1290 + +
    +   + return fmt.Errorf("error: tx hash mismatch. want: %s have: %s", vLog.TxHash, tx.Hash().String()) +
    +
    + 1291 + +
    +   + } +
    +
    + 1292 + +
    + - + msg, err := core.TransactionToMessage(tx, types.NewCancunSigner(tx.ChainId()), big.NewInt(0)) +
    +
    + 1293 + +
    +   + if err != nil { +
    +
    + 1294 + +
    +   + return err +
    +
    + 1295 + +
    +   + } +
    +
    +
    @@ -1298,13 +1184,15 @@
    +
    + 1298 + +
    +   + if sb.NumBatch != 1 { +
    +
    + 1299 + +
    +   + methodId := tx.Data()[:4] +
    +
    + 1300 + +
    +   + log.Debugf("MethodId: %s", common.Bytes2Hex(methodId)) +
    +
    + 1301 + +
    + - + if bytes.Equal(methodId, methodIDSequenceBatchesEtrog) { +
    +
    + 1302 + +
    + - + sequences, err = decodeSequencesEtrog(tx.Data(), sb.NumBatch, msg.From, vLog.TxHash, msg.Nonce, sb.L1InfoRoot) +
    +
    + + +
    +   +
    +
    +
    + 1303 + +
    +   + if err != nil { +
    +
    + 1304 + +
    +   + return fmt.Errorf("error decoding the sequences (etrog): %v", err) +
    +
    + 1305 + +
    +   + } +
    +
    + 1306 + +
    + - + } else if bytes.Equal(methodId, methodIDSequenceBatchesElderberry) { +
    +
    + 1307 + +
    + - + sequences, err = decodeSequencesElderberry(tx.Data(), sb.NumBatch, msg.From, vLog.TxHash, msg.Nonce, sb.L1InfoRoot) +
    +
    + + +
    +   +
    +
    +
    + 1308 + +
    +   + if err != nil { +
    +
    + 1309 + +
    +   + return fmt.Errorf("error decoding the sequences (elderberry): %v", err) +
    +
    + 1310 + +
    +   + } +
    +
    +
    @@ -1345,7 +1233,7 @@
    +
    + 1345 + +
    +   +
    +
    +
    + 1346 + +
    +   + func (etherMan *Client) sequencedBatchesPreEtrogEvent(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 1347 + +
    +   + log.Debug("Pre etrog SequenceBatches event detected") +
    +
    + 1348 + +
    + - + sb, err := etherMan.PreEtrogZkEVM.ParseSequenceBatches(vLog) +
    +
    + 1349 + +
    +   + if err != nil { +
    +
    + 1350 + +
    +   + return err +
    +
    + 1351 + +
    +   + } +
    +
    +
    @@ -1390,7 +1278,20 @@
    +
    + 1390 + +
    +   + return nil +
    +
    + 1391 + +
    +   + } +
    +
    + 1392 + +
    +   +
    +
    +
    + 1393 + +
    + - + func decodeSequencesElderberry(txData []byte, lastBatchNumber uint64, sequencer common.Address, txHash common.Hash, nonce uint64, l1InfoRoot common.Hash) ([]SequencedBatch, error) { +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 1394 + +
    +   + // Extract coded txs. +
    +
    + 1395 + +
    +   + // Load contract ABI +
    +
    + 1396 + +
    +   + smcAbi, err := abi.JSON(strings.NewReader(etrogpolygonzkevm.EtrogpolygonzkevmABI)) +
    +
    +
    @@ -1398,6 +1299,13 @@
    +
    + 1398 + +
    +   + return nil, err +
    +
    + 1399 + +
    +   + } +
    +
    + 1400 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 1401 + +
    +   + // Recover Method from signature and ABI +
    +
    + 1402 + +
    +   + method, err := smcAbi.MethodById(txData[:4]) +
    +
    + 1403 + +
    +   + if err != nil { +
    +
    +
    @@ -1409,93 +1317,218 @@
    +
    + 1409 + +
    +   + if err != nil { +
    +
    + 1410 + +
    +   + return nil, err +
    +
    + 1411 + +
    +   + } +
    +
    + 1412 + +
    + - + var sequences []etrogpolygonzkevm.PolygonRollupBaseEtrogBatchData +
    +
    + 1413 + +
    +   + bytedata, err := json.Marshal(data[0]) +
    +
    + 1414 + +
    +   + if err != nil { +
    +
    + 1415 + +
    +   + return nil, err +
    +
    + 1416 + +
    +   + } +
    +
    + 1417 + +
    + - + err = json.Unmarshal(bytedata, &sequences) +
    +
    + 1418 + +
    + - + if err != nil { +
    +
    + 1419 + +
    + - + return nil, err +
    +
    + 1420 + +
    + - + } +
    +
    + 1421 + +
    + - + maxSequenceTimestamp := data[1].(uint64) +
    +
    + 1422 + +
    + - + initSequencedBatchNumber := data[2].(uint64) +
    +
    + 1423 + +
    + - + coinbase := (data[3]).(common.Address) +
    +
    + 1424 + +
    + - + sequencedBatches := make([]SequencedBatch, len(sequences)) +
    +
    + 1425 + +
    +   +
    +
    +
    + 1426 + +
    + - + for i, seq := range sequences { +
    +
    + 1427 + +
    + - + elderberry := SequencedBatchElderberryData{ +
    +
    + 1428 + +
    + - + MaxSequenceTimestamp: maxSequenceTimestamp, +
    +
    + 1429 + +
    + - + InitSequencedBatchNumber: initSequencedBatchNumber, +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 1430 + +
    +   + } +
    +
    + 1431 + +
    + - + bn := lastBatchNumber - uint64(len(sequences)-(i+1)) +
    +
    + 1432 + +
    + - + s := seq +
    +
    + 1433 + +
    + - + sequencedBatches[i] = SequencedBatch{ +
    +
    + 1434 + +
    + - + BatchNumber: bn, +
    +
    + 1435 + +
    + - + L1InfoRoot: &l1InfoRoot, +
    +
    + 1436 + +
    + - + SequencerAddr: sequencer, +
    +
    + 1437 + +
    + - + TxHash: txHash, +
    +
    + 1438 + +
    + - + Nonce: nonce, +
    +
    + 1439 + +
    + - + Coinbase: coinbase, +
    +
    + 1440 + +
    + - + PolygonRollupBaseEtrogBatchData: &s, +
    +
    + 1441 + +
    + - + SequencedBatchElderberryData: &elderberry, +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 1442 + +
    +   + } +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 1443 + +
    +   + } +
    +
    + 1444 + +
    +   +
    +
    +
    + 1445 + +
    + - + return sequencedBatches, nil +
    +
    + 1446 + +
    +   + } +
    +
    + 1447 + +
    +   +
    +
    +
    + 1448 + +
    + - + func decodeSequencesEtrog(txData []byte, lastBatchNumber uint64, sequencer common.Address, txHash common.Hash, nonce uint64, l1InfoRoot common.Hash) ([]SequencedBatch, error) { +
    +
    + 1449 + +
    + - + // Extract coded txs. +
    +
    + 1450 + +
    + - + // Load contract ABI +
    +
    + 1451 + +
    + - + smcAbi, err := abi.JSON(strings.NewReader(elderberrypolygonzkevm.ElderberrypolygonzkevmABI)) +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 1452 + +
    +   + if err != nil { +
    +
    + 1453 + +
    +   + return nil, err +
    +
    + 1454 + +
    +   + } +
    +
    + 1455 + +
    + - +
    +
    +
    + 1456 + +
    + - + // Recover Method from signature and ABI +
    +
    + 1457 + +
    + - + method, err := smcAbi.MethodById(txData[:4]) +
    +
    + 1458 + +
    +   + if err != nil { +
    +
    + 1459 + +
    +   + return nil, err +
    +
    + 1460 + +
    +   + } +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 1461 + +
    +   +
    +
    +
    + 1462 + +
    + - + // Unpack method inputs +
    +
    + 1463 + +
    + - + data, err := method.Inputs.Unpack(txData[4:]) +
    +
    + 1464 + +
    + - + if err != nil { +
    +
    + 1465 + +
    + - + return nil, err +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 1466 + +
    +   + } +
    +
    + 1467 + +
    + - + var sequences []etrogpolygonzkevm.PolygonRollupBaseEtrogBatchData +
    +
    + 1468 + +
    + - + bytedata, err := json.Marshal(data[0]) +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 1469 + +
    +   + if err != nil { +
    +
    + 1470 + +
    +   + return nil, err +
    +
    + 1471 + +
    +   + } +
    +
    + 1472 + +
    + - + err = json.Unmarshal(bytedata, &sequences) +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 1473 + +
    +   + if err != nil { +
    +
    + 1474 + +
    +   + return nil, err +
    +
    + 1475 + +
    +   + } +
    +
    + 1476 + +
    + - + coinbase := (data[1]).(common.Address) +
    +
    + 1477 + +
    + - + sequencedBatches := make([]SequencedBatch, len(sequences)) +
    +
    + 1478 + +
    + - + for i, seq := range sequences { +
    +
    + 1479 + +
    + - + bn := lastBatchNumber - uint64(len(sequences)-(i+1)) +
    +
    + 1480 + +
    + - + s := seq +
    +
    + 1481 + +
    + - + sequencedBatches[i] = SequencedBatch{ +
    +
    + 1482 + +
    + - + BatchNumber: bn, +
    +
    + 1483 + +
    + - + L1InfoRoot: &l1InfoRoot, +
    +
    + 1484 + +
    + - + SequencerAddr: sequencer, +
    +
    + 1485 + +
    + - + TxHash: txHash, +
    +
    + 1486 + +
    + - + Nonce: nonce, +
    +
    + 1487 + +
    + - + Coinbase: coinbase, +
    +
    + 1488 + +
    + - + PolygonRollupBaseEtrogBatchData: &s, +
    +
    + 1489 + +
    +   + } +
    +
    + 1490 + +
    +   + } +
    +
    + 1491 + +
    + - +
    +
    +
    + 1492 + +
    + - + return sequencedBatches, nil +
    +
    + 1493 + +
    +   + } +
    +
    + 1494 + +
    +   +
    +
    +
    + 1495 + +
    +   + func decodeSequencesPreEtrog(txData []byte, lastBatchNumber uint64, sequencer common.Address, txHash common.Hash, nonce uint64) ([]SequencedBatch, error) { +
    +
    + 1496 + +
    +   + // Extract coded txs. +
    +
    + 1497 + +
    +   + // Load contract ABI +
    +
    + 1498 + +
    + - + smcAbi, err := abi.JSON(strings.NewReader(preetrogpolygonzkevm.PreetrogpolygonzkevmABI)) +
    +
    + 1499 + +
    +   + if err != nil { +
    +
    + 1500 + +
    +   + return nil, err +
    +
    + 1501 + +
    +   + } +
    +
    +
    @@ -1511,7 +1544,7 @@
    +
    + 1511 + +
    +   + if err != nil { +
    +
    + 1512 + +
    +   + return nil, err +
    +
    + 1513 + +
    +   + } +
    +
    + 1514 + +
    + - + var sequences []preetrogpolygonzkevm.PolygonZkEVMBatchData +
    +
    + 1515 + +
    +   + bytedata, err := json.Marshal(data[0]) +
    +
    + 1516 + +
    +   + if err != nil { +
    +
    + 1517 + +
    +   + return nil, err +
    +
    +
    @@ -1538,10 +1571,10 @@
    +
    + 1538 + +
    +   + return sequencedBatches, nil +
    +
    + 1539 + +
    +   + } +
    +
    + 1540 + +
    +   +
    +
    +
    + 1541 + +
    + - + func (etherMan *Client) preEtrogVerifyBatchesTrustedAggregatorEvent(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 1542 + +
    +   + log.Debug("TrustedVerifyBatches event detected") +
    +
    + 1543 + +
    + - + var vb *preetrogpolygonzkevm.PreetrogpolygonzkevmVerifyBatchesTrustedAggregator +
    +
    + 1544 + +
    + - + vb, err := etherMan.PreEtrogZkEVM.ParseVerifyBatchesTrustedAggregator(vLog) +
    +
    + 1545 + +
    +   + if err != nil { +
    +
    + 1546 + +
    +   + log.Error("error parsing TrustedVerifyBatches event. Error: ", err) +
    +
    + 1547 + +
    +   + return err +
    +
    +
    @@ -1551,7 +1584,7 @@
    +
    + 1551 + +
    +   +
    +
    +
    + 1552 + +
    +   + func (etherMan *Client) verifyBatchesEvent(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 1553 + +
    +   + log.Debug("VerifyBatches event detected") +
    +
    + 1554 + +
    + - + vb, err := etherMan.EtrogZkEVM.ParseVerifyBatches(vLog) +
    +
    + 1555 + +
    +   + if err != nil { +
    +
    + 1556 + +
    +   + log.Error("error parsing VerifyBatches event. Error: ", err) +
    +
    + 1557 + +
    +   + return err +
    +
    +
    @@ -1598,7 +1631,7 @@
    +
    + 1598 + +
    +   +
    +
    +
    + 1599 + +
    +   + func (etherMan *Client) forceSequencedBatchesEvent(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 1600 + +
    +   + log.Debug("SequenceForceBatches event detect") +
    +
    + 1601 + +
    + - + fsb, err := etherMan.EtrogZkEVM.ParseSequenceForceBatches(vLog) +
    +
    + 1602 + +
    +   + if err != nil { +
    +
    + 1603 + +
    +   + return err +
    +
    + 1604 + +
    +   + } +
    +
    +
    @@ -1647,7 +1680,7 @@
    +
    + 1647 + +
    +   + func decodeSequencedForceBatches(txData []byte, lastBatchNumber uint64, sequencer common.Address, txHash common.Hash, block *types.Block, nonce uint64) ([]SequencedForceBatch, error) { +
    +
    + 1648 + +
    +   + // Extract coded txs. +
    +
    + 1649 + +
    +   + // Load contract ABI +
    +
    + 1650 + +
    + - + abi, err := abi.JSON(strings.NewReader(etrogpolygonzkevm.EtrogpolygonzkevmABI)) +
    +
    + 1651 + +
    +   + if err != nil { +
    +
    + 1652 + +
    +   + return nil, err +
    +
    + 1653 + +
    +   + } +
    +
    +
    @@ -1664,7 +1697,7 @@
    +
    + 1664 + +
    +   + return nil, err +
    +
    + 1665 + +
    +   + } +
    +
    + 1666 + +
    +   +
    +
    +
    + 1667 + +
    + - + var forceBatches []etrogpolygonzkevm.PolygonRollupBaseEtrogBatchData +
    +
    + 1668 + +
    +   + bytedata, err := json.Marshal(data[0]) +
    +
    + 1669 + +
    +   + if err != nil { +
    +
    + 1670 + +
    +   + return nil, err +
    +
    +
    @@ -1728,11 +1761,18 @@
    +
    + 1728 + +
    +   +
    +
    +
    + 1729 + +
    +   + // GetLatestBatchNumber function allows to retrieve the latest proposed batch in the smc +
    +
    + 1730 + +
    +   + func (etherMan *Client) GetLatestBatchNumber() (uint64, error) { +
    +
    + 1731 + +
    + - + rollupData, err := etherMan.EtrogRollupManager.RollupIDToRollupData(&bind.CallOpts{Pending: false}, etherMan.RollupID) +
    +
    + + +
    +   +
    +
    +
    + 1732 + +
    +   + if err != nil { +
    +
    + 1733 + +
    + - + return 0, err +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 1734 + +
    +   + } +
    +
    + 1735 + +
    + - + return rollupData.LastBatchSequenced, nil +
    +
    + 1736 + +
    +   + } +
    +
    + 1737 + +
    +   +
    +
    +
    + 1738 + +
    +   + // GetLatestBlockHeader gets the latest block header from the ethereum +
    +
    +
    @@ -1779,11 +1819,18 @@
    +
    + 1779 + +
    +   +
    +
    +
    + 1780 + +
    +   + // GetLatestVerifiedBatchNum gets latest verified batch from ethereum +
    +
    + 1781 + +
    +   + func (etherMan *Client) GetLatestVerifiedBatchNum() (uint64, error) { +
    +
    + 1782 + +
    + - + rollupData, err := etherMan.EtrogRollupManager.RollupIDToRollupData(&bind.CallOpts{Pending: false}, etherMan.RollupID) +
    +
    + + +
    +   +
    +
    +
    + 1783 + +
    +   + if err != nil { +
    +
    + 1784 + +
    + - + return 0, err +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 1785 + +
    +   + } +
    +
    + 1786 + +
    + - + return rollupData.LastVerifiedBatch, nil +
    +
    + 1787 + +
    +   + } +
    +
    + 1788 + +
    +   +
    +
    +
    + 1789 + +
    +   + // GetTx function get ethereum tx +
    +
    +
    @@ -1818,19 +1865,27 @@
    +
    + 1818 + +
    +   +
    +
    +
    + 1819 + +
    +   + // GetTrustedSequencerURL Gets the trusted sequencer url from rollup smc +
    +
    + 1820 + +
    +   + func (etherMan *Client) GetTrustedSequencerURL() (string, error) { +
    +
    + 1821 + +
    + - + return etherMan.EtrogZkEVM.TrustedSequencerURL(&bind.CallOpts{Pending: false}) +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 1822 + +
    +   + } +
    +
    + 1823 + +
    +   +
    +
    +
    + 1824 + +
    +   + // GetL2ChainID returns L2 Chain ID +
    +
    + 1825 + +
    +   + func (etherMan *Client) GetL2ChainID() (uint64, error) { +
    +
    + 1826 + +
    + - + chainID, err := etherMan.PreEtrogZkEVM.ChainID(&bind.CallOpts{Pending: false}) +
    +
    + 1827 + +
    + - + log.Debug("chainID read from preEtrogZkevm: ", chainID) +
    +
    + 1828 + +
    +   + if err != nil || chainID == 0 { +
    +
    + 1829 + +
    + - + log.Debug("error from preEtrogZkevm: ", err) +
    +
    + 1830 + +
    + - + rollupData, err := etherMan.EtrogRollupManager.RollupIDToRollupData(&bind.CallOpts{Pending: false}, etherMan.RollupID) +
    +
    + 1831 + +
    + - + log.Debugf("ChainID read from EtrogRollupManager: %d using rollupID: %d", rollupData.ChainID, etherMan.RollupID) +
    +
    + 1832 + +
    +   + if err != nil { +
    +
    + 1833 + +
    + - + log.Debug("error from EtrogRollupManager: ", err) +
    +
    + 1834 + +
    +   + return 0, err +
    +
    + 1835 + +
    +   + } else if rollupData.ChainID == 0 { +
    +
    + 1836 + +
    +   + return rollupData.ChainID, fmt.Errorf("error: chainID received is 0!!") +
    +
    +
    @@ -1861,11 +1916,6 @@
    +
    + 1861 + +
    +   + return etherMan.EthClient.SendTransaction(ctx, tx) +
    +
    + 1862 + +
    +   + } +
    +
    + 1863 + +
    +   +
    +
    +
    + 1864 + +
    + - + // PendingNonce returns the pending nonce for the provided account +
    +
    + 1865 + +
    + - + func (etherMan *Client) PendingNonce(ctx context.Context, account common.Address) (uint64, error) { +
    +
    + 1866 + +
    + - + return etherMan.EthClient.PendingNonceAt(ctx, account) +
    +
    + 1867 + +
    + - + } +
    +
    + 1868 + +
    + - +
    +
    +
    + 1869 + +
    +   + // CurrentNonce returns the current nonce for the provided account +
    +
    + 1870 + +
    +   + func (etherMan *Client) CurrentNonce(ctx context.Context, account common.Address) (uint64, error) { +
    +
    + 1871 + +
    +   + return etherMan.EthClient.NonceAt(ctx, account, nil) +
    +
    +
    @@ -1898,7 +1948,7 @@
    +
    + 1898 + +
    +   + opts.BlockNumber = new(big.Int).SetUint64(*blockNumber) +
    +
    + 1899 + +
    +   + } +
    +
    + 1900 + +
    +   +
    +
    +
    + 1901 + +
    + - + return etherman.EtrogGlobalExitRootManager.DepositCount(opts) +
    +
    + 1902 + +
    +   + } +
    +
    + 1903 + +
    +   +
    +
    +
    + 1904 + +
    +   + // CheckTxWasMined check if a tx was already mined +
    +
    +
    @@ -1955,15 +2005,15 @@
    +
    + 1955 + +
    +   + } +
    +
    + 1956 + +
    +   +
    +
    +
    + 1957 + +
    +   + // LoadAuthFromKeyStore loads an authorization from a key store file +
    +
    + 1958 + +
    + - + func (etherMan *Client) LoadAuthFromKeyStore(path, password string) (*bind.TransactOpts, error) { +
    +
    + 1959 + +
    + - + auth, err := newAuthFromKeystore(path, password, etherMan.l1Cfg.L1ChainID) +
    +
    + 1960 + +
    +   + if err != nil { +
    +
    + 1961 + +
    + - + return nil, err +
    +
    + 1962 + +
    +   + } +
    +
    + 1963 + +
    +   +
    +
    +
    + 1964 + +
    +   + log.Infof("loaded authorization for address: %v", auth.From.String()) +
    +
    + 1965 + +
    +   + etherMan.auth[auth.From] = auth +
    +
    + 1966 + +
    + - + return &auth, nil +
    +
    + 1967 + +
    +   + } +
    +
    + 1968 + +
    +   +
    +
    +
    + 1969 + +
    +   + // newKeyFromKeystore creates an instance of a keystore key from a keystore file +
    +
    +
    @@ -1984,20 +2034,20 @@
    +
    + 1984 + +
    +   + } +
    +
    + 1985 + +
    +   +
    +
    +
    + 1986 + +
    +   + // newAuthFromKeystore an authorization instance from a keystore file +
    +
    + 1987 + +
    + - + func newAuthFromKeystore(path, password string, chainID uint64) (bind.TransactOpts, error) { +
    +
    + 1988 + +
    +   + log.Infof("reading key from: %v", path) +
    +
    + 1989 + +
    +   + key, err := newKeyFromKeystore(path, password) +
    +
    + 1990 + +
    +   + if err != nil { +
    +
    + 1991 + +
    + - + return bind.TransactOpts{}, err +
    +
    + 1992 + +
    +   + } +
    +
    + 1993 + +
    +   + if key == nil { +
    +
    + 1994 + +
    + - + return bind.TransactOpts{}, nil +
    +
    + 1995 + +
    +   + } +
    +
    + 1996 + +
    +   + auth, err := bind.NewKeyedTransactorWithChainID(key.PrivateKey, new(big.Int).SetUint64(chainID)) +
    +
    + 1997 + +
    +   + if err != nil { +
    +
    + 1998 + +
    + - + return bind.TransactOpts{}, err +
    +
    + 1999 + +
    +   + } +
    +
    + 2000 + +
    + - + return *auth, nil +
    +
    + 2001 + +
    +   + } +
    +
    + 2002 + +
    +   +
    +
    +
    + 2003 + +
    +   + // getAuthByAddress tries to get an authorization from the authorizations map +
    +
    +
    @@ -2025,3 +2075,28 @@
    +
    + 2025 + +
    +   +
    +
    +
    + 2026 + +
    +   + return *auth, nil +
    +
    + 2027 + +
    +   + } +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 3 + +
    +   + import ( +
    +
    + 4 + +
    +   + "bytes" +
    +
    + 5 + +
    +   + "context" +
    +
    + 6 + +
    + + + "crypto/ecdsa" +
    +
    + 7 + +
    +   + "encoding/json" +
    +
    + 8 + +
    +   + "errors" +
    +
    + 9 + +
    +   + "fmt" +
    +
    +
     
    +
    + 44 + +
    +   + "golang.org/x/crypto/sha3" +
    +
    + 45 + +
    +   + ) +
    +
    + 46 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 47 + +
    +   + var ( +
    +
    + 48 + +
    + + + // Events RollupManager +
    +
    + 49 + +
    +   + setBatchFeeSignatureHash = crypto.Keccak256Hash([]byte("SetBatchFee(uint256)")) +
    +
    + 50 + +
    +   + setTrustedAggregatorSignatureHash = crypto.Keccak256Hash([]byte("SetTrustedAggregator(address)")) // Used in oldZkEvm as well +
    +
    + 51 + +
    +   + setVerifyBatchTimeTargetSignatureHash = crypto.Keccak256Hash([]byte("SetVerifyBatchTimeTarget(uint64)")) // Used in oldZkEvm as well +
    +
    +
     
    +
    + 90 + +
    +   + updateL1InfoTreeSignatureHash = crypto.Keccak256Hash([]byte("UpdateL1InfoTree(bytes32,bytes32)")) +
    +
    + 91 + +
    +   +
    +
    +
    + 92 + +
    +   + // PreLxLy events +
    +
    + 93 + +
    + + + updateGlobalExitRootSignatureHash = crypto.Keccak256Hash([]byte("UpdateGlobalExitRoot(bytes32,bytes32)")) +
    +
    + 94 + +
    + + + oldVerifyBatchesTrustedAggregatorSignatureHash = crypto.Keccak256Hash([]byte("VerifyBatchesTrustedAggregator(uint64,bytes32,address)")) +
    +
    + 95 + +
    + + + transferOwnershipSignatureHash = crypto.Keccak256Hash([]byte("OwnershipTransferred(address,address)")) +
    +
    + 96 + +
    + + + updateZkEVMVersionSignatureHash = crypto.Keccak256Hash([]byte("UpdateZkEVMVersion(uint64,uint64,string)")) +
    +
    + 97 + +
    + + + oldConsolidatePendingStateSignatureHash = crypto.Keccak256Hash([]byte("ConsolidatePendingState(uint64,bytes32,uint64)")) +
    +
    + 98 + +
    + + + oldOverridePendingStateSignatureHash = crypto.Keccak256Hash([]byte("OverridePendingState(uint64,bytes32,address)")) +
    +
    + 99 + +
    + + + sequenceBatchesPreEtrogSignatureHash = crypto.Keccak256Hash([]byte("SequenceBatches(uint64)")) +
    +
    + 100 + +
    +   +
    +
    +
    + 101 + +
    +   + // Proxy events +
    +
    + 102 + +
    +   + initializedProxySignatureHash = crypto.Keccak256Hash([]byte("Initialized(uint8)")) +
    +
    +
     
    +
    + 109 + +
    +   + // methodIDSequenceBatchesElderberry: MethodID for sequenceBatches in Elderberry +
    +
    + 110 + +
    +   + methodIDSequenceBatchesElderberry = []byte{0xde, 0xf5, 0x7e, 0x54} // 0xdef57e54 sequenceBatches((bytes,bytes32,uint64,bytes32)[],uint64,uint64,address) +
    +
    + 111 + +
    +   +
    +
    +
    + 112 + +
    + + + // methodIDSequenceBatchesValidiumEtrog: MethodID for sequenceBatchesValidium in Etrog +
    +
    + 113 + +
    + + + methodIDSequenceBatchesValidiumEtrog = []byte{0x2d, 0x72, 0xc2, 0x48} // 0x2d72c248 sequenceBatchesValidium((bytes32,bytes32,uint64,bytes32)[],address,bytes) +
    +
    + 114 + +
    + + + // methodIDSequenceBatchesValidiumElderberry: MethodID for sequenceBatchesValidium in Elderberry +
    +
    + 115 + +
    + + + methodIDSequenceBatchesValidiumElderberry = []byte{0xdb, 0x5b, 0x0e, 0xd7} // 0xdb5b0ed7 sequenceBatchesValidium((bytes32,bytes32,uint64,bytes32)[],uint64,uint64,address,bytes) +
    +
    + 116 + +
    + + +
    +
    +
    + 117 + +
    +   + // ErrNotFound is used when the object is not found +
    +
    + 118 + +
    +   + ErrNotFound = errors.New("not found") +
    +
    + 119 + +
    +   + // ErrIsReadOnlyMode is used when the EtherMan client is in read-only mode. +
    +
    +
     
    +
    + 164 + +
    +   + ethereum.LogFilterer +
    +
    + 165 + +
    +   + ethereum.TransactionReader +
    +
    + 166 + +
    +   + ethereum.TransactionSender +
    +
    + + +
    +   +
    +
    +
    + 167 + +
    +   +
    +
    +
    + 168 + +
    +   + bind.DeployBackend +
    +
    + 169 + +
    +   + } +
    +
    +
     
    +
    + 189 + +
    +   +
    +
    +
    + 190 + +
    +   + // Client is a simple implementation of EtherMan. +
    +
    + 191 + +
    +   + type Client struct { +
    +
    + 192 + +
    + + + EthClient ethereumClient +
    +
    + 193 + +
    + + + OldZkEVM *oldpolygonzkevm.Oldpolygonzkevm +
    +
    + 194 + +
    + + + EtrogZKEVM *etrogpolygonzkevm.Etrogpolygonzkevm +
    +
    + 195 + +
    + + + ZkEVM *polygonzkevm.Polygonzkevm +
    +
    + 196 + +
    + + + RollupManager *polygonrollupmanager.Polygonrollupmanager +
    +
    + 197 + +
    + + + GlobalExitRootManager *polygonzkevmglobalexitroot.Polygonzkevmglobalexitroot +
    +
    + 198 + +
    + + + OldGlobalExitRootManager *oldpolygonzkevmglobalexitroot.Oldpolygonzkevmglobalexitroot +
    +
    + 199 + +
    + + + Pol *pol.Pol +
    +
    + 200 + +
    + + + DAProtocol *dataavailabilityprotocol.Dataavailabilityprotocol +
    +
    + 201 + +
    + + + SCAddresses []common.Address +
    +
    + 202 + +
    +   +
    +
    +
    + 203 + +
    +   + RollupID uint32 +
    +
    + 204 + +
    +   +
    +
    +
    + 205 + +
    +   + GasProviders externalGasProviders +
    +
    + 206 + +
    +   +
    +
    +
    + 207 + +
    + + + l1Cfg L1Config +
    +
    + 208 + +
    + + + cfg Config +
    +
    + 209 + +
    + + + auth map[common.Address]bind.TransactOpts // empty in case of read-only client +
    +
    + 210 + +
    + + +
    +
    +
    + 211 + +
    + + + da dataavailability.BatchDataProvider +
    +
    + 212 + +
    + + + state stateProvider +
    +
    + 213 + +
    +   + } +
    +
    + 214 + +
    +   +
    +
    +
    + 215 + +
    +   + // NewClient creates a new etherman. +
    +
    + 216 + +
    + + + func NewClient(cfg Config, l1Config L1Config, da dataavailability.BatchDataProvider, st stateProvider) (*Client, error) { +
    +
    + 217 + +
    +   + // Connect to ethereum node +
    +
    + 218 + +
    +   + ethClient, err := ethclient.Dial(cfg.URL) +
    +
    + 219 + +
    +   + if err != nil { +
    +
    + 220 + +
    +   + log.Errorf("error connecting to %s: %+v", cfg.URL, err) +
    +
    + 221 + +
    +   + return nil, err +
    +
    + 222 + +
    +   + } +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 223 + +
    +   + // Create smc clients +
    +
    + 224 + +
    + + + zkevm, err := polygonzkevm.NewPolygonzkevm(l1Config.ZkEVMAddr, ethClient) +
    +
    + 225 + +
    +   + if err != nil { +
    +
    + 226 + +
    +   + log.Errorf("error creating Polygonzkevm client (%s). Error: %w", l1Config.ZkEVMAddr.String(), err) +
    +
    + 227 + +
    +   + return nil, err +
    +
    + 228 + +
    +   + } +
    +
    + 229 + +
    + + + etrogZkevm, err := etrogpolygonzkevm.NewEtrogpolygonzkevm(l1Config.RollupManagerAddr, ethClient) +
    +
    + 230 + +
    +   + if err != nil { +
    +
    + 231 + +
    + + + log.Errorf("error creating NewEtrogPolygonzkevm client (%s). Error: %w", l1Config.RollupManagerAddr.String(), err) +
    +
    + 232 + +
    +   + return nil, err +
    +
    + 233 + +
    +   + } +
    +
    + 234 + +
    + + + oldZkevm, err := oldpolygonzkevm.NewOldpolygonzkevm(l1Config.RollupManagerAddr, ethClient) +
    +
    + 235 + +
    +   + if err != nil { +
    +
    + 236 + +
    + + + log.Errorf("error creating NewOldpolygonzkevm client (%s). Error: %w", l1Config.RollupManagerAddr.String(), err) +
    +
    + 237 + +
    +   + return nil, err +
    +
    + 238 + +
    +   + } +
    +
    + 239 + +
    + + + rollupManager, err := polygonrollupmanager.NewPolygonrollupmanager(l1Config.RollupManagerAddr, ethClient) +
    +
    + 240 + +
    +   + if err != nil { +
    +
    + 241 + +
    +   + log.Errorf("error creating NewPolygonrollupmanager client (%s). Error: %w", l1Config.RollupManagerAddr.String(), err) +
    +
    + 242 + +
    +   + return nil, err +
    +
    + 243 + +
    +   + } +
    +
    + 244 + +
    + + + globalExitRoot, err := polygonzkevmglobalexitroot.NewPolygonzkevmglobalexitroot(l1Config.GlobalExitRootManagerAddr, ethClient) +
    +
    + 245 + +
    +   + if err != nil { +
    +
    + 246 + +
    +   + log.Errorf("error creating NewPolygonzkevmglobalexitroot client (%s). Error: %w", l1Config.GlobalExitRootManagerAddr.String(), err) +
    +
    + 247 + +
    +   + return nil, err +
    +
    + 248 + +
    +   + } +
    +
    + 249 + +
    + + + oldGlobalExitRoot, err := oldpolygonzkevmglobalexitroot.NewOldpolygonzkevmglobalexitroot(l1Config.GlobalExitRootManagerAddr, ethClient) +
    +
    + 250 + +
    +   + if err != nil { +
    +
    + 251 + +
    + + + log.Errorf("error creating NewOldpolygonzkevmglobalexitroot client (%s). Error: %w", l1Config.GlobalExitRootManagerAddr.String(), err) +
    +
    + 252 + +
    +   + return nil, err +
    +
    + 253 + +
    +   + } +
    +
    + 254 + +
    +   + pol, err := pol.NewPol(l1Config.PolAddr, ethClient) +
    +
    +
     
    +
    + 256 + +
    +   + log.Errorf("error creating NewPol client (%s). Error: %w", l1Config.PolAddr.String(), err) +
    +
    + 257 + +
    +   + return nil, err +
    +
    + 258 + +
    +   + } +
    +
    + 259 + +
    + + + dapAddr, err := zkevm.DataAvailabilityProtocol(&bind.CallOpts{Pending: false}) +
    +
    + 260 + +
    + + + if err != nil { +
    +
    + 261 + +
    + + + return nil, err +
    +
    + 262 + +
    + + + } +
    +
    + 263 + +
    + + + dap, err := dataavailabilityprotocol.NewDataavailabilityprotocol(dapAddr, ethClient) +
    +
    + 264 + +
    +   + if err != nil { +
    +
    + + +
    +   +
    +
    +
    + 265 + +
    +   + return nil, err +
    +
    + 266 + +
    +   + } +
    +
    + 267 + +
    + + + var scAddresses []common.Address +
    +
    + 268 + +
    +   + scAddresses = append(scAddresses, l1Config.ZkEVMAddr, l1Config.RollupManagerAddr, l1Config.GlobalExitRootManagerAddr) +
    +
    + 269 + +
    +   +
    +
    +
    + 270 + +
    +   + gProviders := []ethereum.GasPricer{ethClient} +
    +
    +
     
    +
    + 279 + +
    +   + } +
    +
    + 280 + +
    +   + metrics.Register() +
    +
    + 281 + +
    +   + // Get RollupID +
    +
    + 282 + +
    + + + rollupID, err := rollupManager.RollupAddressToID(&bind.CallOpts{Pending: false}, l1Config.ZkEVMAddr) +
    +
    + 283 + +
    +   + if err != nil { +
    +
    + 284 + +
    +   + log.Debugf("error rollupManager.RollupAddressToID(%s). Error: %w", l1Config.RollupManagerAddr, err) +
    +
    + 285 + +
    +   + return nil, err +
    +
    + 286 + +
    +   + } +
    +
    + 287 + +
    +   + log.Debug("rollupID: ", rollupID) +
    +
    + 288 + +
    +   +
    +
    +
    + 289 + +
    + + + return &Client{ +
    +
    + 290 + +
    + + + EthClient: ethClient, +
    +
    + 291 + +
    + + + ZkEVM: zkevm, +
    +
    + 292 + +
    + + + EtrogZKEVM: etrogZkevm, +
    +
    + 293 + +
    + + + OldZkEVM: oldZkevm, +
    +
    + 294 + +
    + + + RollupManager: rollupManager, +
    +
    + 295 + +
    + + + Pol: pol, +
    +
    + 296 + +
    + + + GlobalExitRootManager: globalExitRoot, +
    +
    + 297 + +
    + + + DAProtocol: dap, +
    +
    + 298 + +
    + + + OldGlobalExitRootManager: oldGlobalExitRoot, +
    +
    + 299 + +
    + + + SCAddresses: scAddresses, +
    +
    + 300 + +
    + + + RollupID: rollupID, +
    +
    + 301 + +
    +   + GasProviders: externalGasProviders{ +
    +
    + 302 + +
    +   + MultiGasProvider: cfg.MultiGasProvider, +
    +
    + 303 + +
    +   + Providers: gProviders, +
    +
    + 304 + +
    +   + }, +
    +
    + 305 + +
    + + + l1Cfg: l1Config, +
    +
    + 306 + +
    + + + cfg: cfg, +
    +
    + 307 + +
    + + + auth: map[common.Address]bind.TransactOpts{}, +
    +
    + 308 + +
    + + + da: da, +
    +
    + 309 + +
    + + + state: st, +
    +
    + 310 + +
    + + + }, nil +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 311 + +
    +   + } +
    +
    + 312 + +
    +   +
    +
    +
    + 313 + +
    +   + // VerifyGenBlockNumber verifies if the genesis Block Number is valid +
    +
    + 314 + +
    +   + func (etherMan *Client) VerifyGenBlockNumber(ctx context.Context, genBlockNumber uint64) (bool, error) { +
    +
    + 315 + +
    + + + // TODO: do not assume that only one rollup will be attached to the rollup manager in the same L1 block +
    +
    + 316 + +
    +   + start := time.Now() +
    +
    + 317 + +
    +   + log.Info("Verifying genesis blockNumber: ", genBlockNumber) +
    +
    + 318 + +
    +   + // Filter query +
    +
    +
     
    +
    + 330 + +
    +   + if len(logs) == 0 { +
    +
    + 331 + +
    +   + return false, fmt.Errorf("the specified genBlockNumber in config file does not contain any forkID event. Please use the proper blockNumber.") +
    +
    + 332 + +
    +   + } +
    +
    + 333 + +
    + + + var zkevmVersion oldpolygonzkevm.OldpolygonzkevmUpdateZkEVMVersion +
    +
    + 334 + +
    +   + switch logs[0].Topics[0] { +
    +
    + 335 + +
    +   + case updateZkEVMVersionSignatureHash: +
    +
    + 336 + +
    +   + log.Debug("UpdateZkEVMVersion event detected during the Verification of the GenBlockNumber") +
    +
    + 337 + +
    + + + zkevmV, err := etherMan.OldZkEVM.ParseUpdateZkEVMVersion(logs[0]) +
    +
    + 338 + +
    +   + if err != nil { +
    +
    + 339 + +
    +   + return false, err +
    +
    + 340 + +
    +   + } +
    +
    +
     
    +
    + 343 + +
    +   + } +
    +
    + 344 + +
    +   + case createNewRollupSignatureHash: +
    +
    + 345 + +
    +   + log.Debug("CreateNewRollup event detected during the Verification of the GenBlockNumber") +
    +
    + 346 + +
    + + + createNewRollupEvent, err := etherMan.RollupManager.ParseCreateNewRollup(logs[0]) +
    +
    + 347 + +
    +   + if err != nil { +
    +
    + 348 + +
    +   + return false, err +
    +
    + 349 + +
    +   + } +
    +
    + 350 + +
    +   + // Query to get the forkID +
    +
    + 351 + +
    + + + rollupType, err := etherMan.RollupManager.RollupTypeMap(&bind.CallOpts{Pending: false}, createNewRollupEvent.RollupTypeID) +
    +
    + 352 + +
    +   + if err != nil { +
    +
    + 353 + +
    +   + log.Error(err) +
    +
    + 354 + +
    +   + return false, err +
    +
    +
     
    +
    + 363 + +
    +   + return true, nil +
    +
    + 364 + +
    +   + } +
    +
    + 365 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 366 + +
    +   + // GetForks returns fork information +
    +
    + 367 + +
    +   + func (etherMan *Client) GetForks(ctx context.Context, genBlockNumber uint64, lastL1BlockSynced uint64) ([]state.ForkIDInterval, error) { +
    +
    + 368 + +
    +   + log.Debug("Getting forkIDs from blockNumber: ", genBlockNumber) +
    +
    + 369 + +
    +   + start := time.Now() +
    +
    + 370 + +
    +   + var logs []types.Log +
    +
    + 371 + +
    + + +
    +
    +
    + 372 + +
    +   + if lastL1BlockSynced < genBlockNumber { +
    +
    + 373 + +
    +   + lastL1BlockSynced = genBlockNumber +
    +
    + 374 + +
    +   + } +
    +
    + 375 + +
    + + +
    +
    +
    + 376 + +
    +   + log.Debug("Using ForkIDChunkSize: ", etherMan.cfg.ForkIDChunkSize) +
    +
    + 377 + +
    +   + for i := genBlockNumber; i <= lastL1BlockSynced; i = i + etherMan.cfg.ForkIDChunkSize + 1 { +
    +
    + 378 + +
    +   + final := i + etherMan.cfg.ForkIDChunkSize +
    +
    +
     
    +
    + 397 + +
    +   +
    +
    +
    + 398 + +
    +   + var forks []state.ForkIDInterval +
    +
    + 399 + +
    +   + for i, l := range logs { +
    +
    + 400 + +
    + + + var zkevmVersion oldpolygonzkevm.OldpolygonzkevmUpdateZkEVMVersion +
    +
    + 401 + +
    +   + switch l.Topics[0] { +
    +
    + 402 + +
    +   + case updateZkEVMVersionSignatureHash: +
    +
    + 403 + +
    +   + log.Debug("updateZkEVMVersion Event received") +
    +
    + 404 + +
    + + + zkevmV, err := etherMan.OldZkEVM.ParseUpdateZkEVMVersion(l) +
    +
    + 405 + +
    +   + if err != nil { +
    +
    + 406 + +
    +   + return []state.ForkIDInterval{}, err +
    +
    + 407 + +
    +   + } +
    +
    +
     
    +
    + 410 + +
    +   + } +
    +
    + 411 + +
    +   + case updateRollupSignatureHash: +
    +
    + 412 + +
    +   + log.Debug("updateRollup Event received") +
    +
    + 413 + +
    + + + updateRollupEvent, err := etherMan.RollupManager.ParseUpdateRollup(l) +
    +
    + 414 + +
    +   + if err != nil { +
    +
    + 415 + +
    +   + return []state.ForkIDInterval{}, err +
    +
    + 416 + +
    +   + } +
    +
    +
     
    +
    + 418 + +
    +   + continue +
    +
    + 419 + +
    +   + } +
    +
    + 420 + +
    +   + // Query to get the forkID +
    +
    + 421 + +
    + + + rollupType, err := etherMan.RollupManager.RollupTypeMap(&bind.CallOpts{Pending: false}, updateRollupEvent.NewRollupTypeID) +
    +
    + 422 + +
    +   + if err != nil { +
    +
    + 423 + +
    +   + return []state.ForkIDInterval{}, err +
    +
    + 424 + +
    +   + } +
    +
    +
     
    +
    + 427 + +
    +   +
    +
    +
    + 428 + +
    +   + case addExistingRollupSignatureHash: +
    +
    + 429 + +
    +   + log.Debug("addExistingRollup Event received") +
    +
    + 430 + +
    + + + addExistingRollupEvent, err := etherMan.RollupManager.ParseAddExistingRollup(l) +
    +
    + 431 + +
    +   + if err != nil { +
    +
    + 432 + +
    +   + return []state.ForkIDInterval{}, err +
    +
    + 433 + +
    +   + } +
    +
    +
     
    +
    + 439 + +
    +   +
    +
    +
    + 440 + +
    +   + case createNewRollupSignatureHash: +
    +
    + 441 + +
    +   + log.Debug("createNewRollup Event received") +
    +
    + 442 + +
    + + + createNewRollupEvent, err := etherMan.RollupManager.ParseCreateNewRollup(l) +
    +
    + 443 + +
    +   + if err != nil { +
    +
    + 444 + +
    +   + return []state.ForkIDInterval{}, err +
    +
    + 445 + +
    +   + } +
    +
    +
     
    +
    + 447 + +
    +   + continue +
    +
    + 448 + +
    +   + } +
    +
    + 449 + +
    +   + // Query to get the forkID +
    +
    + 450 + +
    + + + rollupType, err := etherMan.RollupManager.RollupTypeMap(&bind.CallOpts{Pending: false}, createNewRollupEvent.RollupTypeID) +
    +
    + 451 + +
    +   + if err != nil { +
    +
    + 452 + +
    +   + log.Error(err) +
    +
    + 453 + +
    +   + return []state.ForkIDInterval{}, err +
    +
    +
     
    +
    + 499 + +
    +   + return blocks, blocksOrder, nil +
    +
    + 500 + +
    +   + } +
    +
    + 501 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 502 + +
    +   + // Order contains the event order to let the synchronizer store the information following this order. +
    +
    + 503 + +
    +   + type Order struct { +
    +
    + 504 + +
    +   + Name EventOrder +
    +
    +
     
    +
    + 529 + +
    +   + metrics.ReadAndProcessAllEventsTime(time.Since(start)) +
    +
    + 530 + +
    +   + return blocks, blocksOrder, nil +
    +
    + 531 + +
    +   + } +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 532 + +
    +   +
    +
    +
    + 533 + +
    + + + func (etherMan *Client) processEvent(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 534 + +
    +   + switch vLog.Topics[0] { +
    +
    + 535 + +
    +   + case sequenceBatchesSignatureHash: +
    +
    + 536 + +
    +   + return etherMan.sequencedBatchesEvent(ctx, vLog, blocks, blocksOrder) +
    +
    +
     
    +
    + 552 + +
    +   + case rollupManagerVerifyBatchesSignatureHash: +
    +
    + 553 + +
    +   + log.Debug("RollupManagerVerifyBatches event detected. Ignoring...") +
    +
    + 554 + +
    +   + return nil +
    +
    + 555 + +
    + + + case oldVerifyBatchesTrustedAggregatorSignatureHash: +
    +
    + 556 + +
    + + + return etherMan.oldVerifyBatchesTrustedAggregatorEvent(ctx, vLog, blocks, blocksOrder) +
    +
    + 557 + +
    +   + case verifyBatchesSignatureHash: +
    +
    + 558 + +
    +   + return etherMan.verifyBatchesEvent(ctx, vLog, blocks, blocksOrder) +
    +
    + 559 + +
    +   + case sequenceForceBatchesSignatureHash: +
    +
    +
     
    +
    + 593 + +
    +   + case consolidatePendingStateSignatureHash: +
    +
    + 594 + +
    +   + log.Debug("ConsolidatePendingState event detected. Ignoring...") +
    +
    + 595 + +
    +   + return nil +
    +
    + 596 + +
    + + + case oldConsolidatePendingStateSignatureHash: +
    +
    + 597 + +
    + + + log.Debug("OldConsolidatePendingState event detected. Ignoring...") +
    +
    + 598 + +
    +   + return nil +
    +
    + 599 + +
    +   + case setTrustedAggregatorTimeoutSignatureHash: +
    +
    + 600 + +
    +   + log.Debug("SetTrustedAggregatorTimeout event detected. Ignoring...") +
    +
    +
     
    +
    + 629 + +
    +   + case overridePendingStateSignatureHash: +
    +
    + 630 + +
    +   + log.Debug("OverridePendingState event detected. Ignoring...") +
    +
    + 631 + +
    +   + return nil +
    +
    + 632 + +
    + + + case oldOverridePendingStateSignatureHash: +
    +
    + 633 + +
    + + + log.Debug("OldOverridePendingState event detected. Ignoring...") +
    +
    + 634 + +
    +   + return nil +
    +
    + 635 + +
    +   + case roleAdminChangedSignatureHash: +
    +
    + 636 + +
    +   + log.Debug("RoleAdminChanged event detected. Ignoring...") +
    +
    +
     
    +
    + 666 + +
    +   +
    +
    +
    + 667 + +
    +   + func (etherMan *Client) updateZkevmVersion(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 668 + +
    +   + log.Debug("UpdateZkEVMVersion event detected") +
    +
    + 669 + +
    + + + zkevmVersion, err := etherMan.OldZkEVM.ParseUpdateZkEVMVersion(vLog) +
    +
    + 670 + +
    +   + if err != nil { +
    +
    + 671 + +
    +   + log.Error("error parsing UpdateZkEVMVersion event. Error: ", err) +
    +
    + 672 + +
    +   + return err +
    +
    +
     
    +
    + 676 + +
    +   +
    +
    +
    + 677 + +
    +   + func (etherMan *Client) updateRollup(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 678 + +
    +   + log.Debug("UpdateRollup event detected") +
    +
    + 679 + +
    + + + updateRollup, err := etherMan.RollupManager.ParseUpdateRollup(vLog) +
    +
    + 680 + +
    +   + if err != nil { +
    +
    + 681 + +
    +   + log.Error("error parsing UpdateRollup event. Error: ", err) +
    +
    + 682 + +
    +   + return err +
    +
    + 683 + +
    +   + } +
    +
    + 684 + +
    + + + rollupType, err := etherMan.RollupManager.RollupTypeMap(&bind.CallOpts{Pending: false}, updateRollup.NewRollupTypeID) +
    +
    + 685 + +
    +   + if err != nil { +
    +
    + 686 + +
    +   + return err +
    +
    + 687 + +
    +   + } +
    +
    +
     
    +
    + 690 + +
    +   +
    +
    +
    + 691 + +
    +   + func (etherMan *Client) createNewRollup(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 692 + +
    +   + log.Debug("createNewRollup event detected") +
    +
    + 693 + +
    + + + createRollup, err := etherMan.RollupManager.ParseCreateNewRollup(vLog) +
    +
    + 694 + +
    +   + if err != nil { +
    +
    + 695 + +
    +   + log.Error("error parsing createNewRollup event. Error: ", err) +
    +
    + 696 + +
    +   + return err +
    +
    + 697 + +
    +   + } +
    +
    + 698 + +
    + + + rollupType, err := etherMan.RollupManager.RollupTypeMap(&bind.CallOpts{Pending: false}, createRollup.RollupTypeID) +
    +
    + 699 + +
    +   + if err != nil { +
    +
    + 700 + +
    +   + return err +
    +
    + 701 + +
    +   + } +
    +
    +
     
    +
    + 704 + +
    +   +
    +
    +
    + 705 + +
    +   + func (etherMan *Client) addExistingRollup(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 706 + +
    +   + log.Debug("addExistingRollup event detected") +
    +
    + 707 + +
    + + + addExistingRollup, err := etherMan.RollupManager.ParseAddExistingRollup(vLog) +
    +
    + 708 + +
    +   + if err != nil { +
    +
    + 709 + +
    +   + log.Error("error parsing createNewRollup event. Error: ", err) +
    +
    + 710 + +
    +   + return err +
    +
    +
     
    +
    + 713 + +
    +   + return etherMan.updateForkId(ctx, vLog, blocks, blocksOrder, addExistingRollup.LastVerifiedBatchBeforeUpgrade, addExistingRollup.ForkID, "", addExistingRollup.RollupID) +
    +
    + 714 + +
    +   + } +
    +
    + 715 + +
    +   +
    +
    +
    + 716 + +
    + + + func (etherMan *Client) updateEtrogSequence(_ context.Context, _ types.Log, _ *[]Block, _ *map[common.Hash][]Order) error { +
    +
    + 717 + +
    + + + return errors.New("upgrading validiums to etrog not supported") +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 718 + +
    +   + } +
    +
    + 719 + +
    +   +
    +
    +
    + 720 + +
    +   + func (etherMan *Client) initialSequenceBatches(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 721 + +
    +   + log.Debug("initialSequenceBatches event detected") +
    +
    + 722 + +
    + + + initialSequenceBatches, err := etherMan.ZkEVM.ParseInitialSequenceBatches(vLog) +
    +
    + 723 + +
    +   + if err != nil { +
    +
    + 724 + +
    +   + log.Error("error parsing initialSequenceBatches event. Error: ", err) +
    +
    + 725 + +
    +   + return err +
    +
    +
     
    +
    + 749 + +
    +   + SequencerAddr: initialSequenceBatches.Sequencer, +
    +
    + 750 + +
    +   + TxHash: vLog.TxHash, +
    +
    + 751 + +
    +   + Nonce: msg.Nonce, +
    +
    + 752 + +
    + + + PolygonRollupBaseEtrogBatchData: &polygonzkevm.PolygonRollupBaseEtrogBatchData{ +
    +
    + 753 + +
    +   + Transactions: initialSequenceBatches.Transactions, +
    +
    + 754 + +
    +   + ForcedGlobalExitRoot: initialSequenceBatches.LastGlobalExitRoot, +
    +
    + 755 + +
    +   + ForcedTimestamp: fullBlock.Time(), +
    +
    +
     
    +
    + 809 + +
    +   +
    +
    +
    + 810 + +
    +   + func (etherMan *Client) updateL1InfoTreeEvent(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 811 + +
    +   + log.Debug("UpdateL1InfoTree event detected") +
    +
    + 812 + +
    + + + globalExitRootL1InfoTree, err := etherMan.GlobalExitRootManager.ParseUpdateL1InfoTree(vLog) +
    +
    + 813 + +
    +   + if err != nil { +
    +
    + 814 + +
    +   + return err +
    +
    + 815 + +
    +   + } +
    +
    + 816 + +
    +   +
    +
    +
    + 817 + +
    +   + var gExitRoot GlobalExitRoot +
    +
    + 818 + +
    + + + gExitRoot.MainnetExitRoot = globalExitRootL1InfoTree.MainnetExitRoot +
    +
    + 819 + +
    + + + gExitRoot.RollupExitRoot = globalExitRootL1InfoTree.RollupExitRoot +
    +
    + 820 + +
    +   + gExitRoot.BlockNumber = vLog.BlockNumber +
    +
    + 821 + +
    + + + gExitRoot.GlobalExitRoot = hash(globalExitRootL1InfoTree.MainnetExitRoot, globalExitRootL1InfoTree.RollupExitRoot) +
    +
    + 822 + +
    +   + var block *Block +
    +
    + 823 + +
    +   + if !isheadBlockInArray(blocks, vLog.BlockHash, vLog.BlockNumber) { +
    +
    + 824 + +
    +   + // Need to add the block, doesnt mind if inside the blocks because I have to respect the order so insert at end +
    +
    + 825 + +
    + + + block, err = etherMan.retrieveFullBlockForEvent(ctx, vLog) +
    +
    + 826 + +
    +   + if err != nil { +
    +
    + 827 + +
    +   + return err +
    +
    + 828 + +
    +   + } +
    +
    +
     
    +
    + 842 + +
    +   + return nil +
    +
    + 843 + +
    +   + } +
    +
    + 844 + +
    +   +
    +
    +
    + 845 + +
    + + + func (etherMan *Client) retrieveFullBlockForEvent(ctx context.Context, vLog types.Log) (*Block, error) { +
    +
    + + +
    +   +
    +
    +
    + 846 + +
    +   + fullBlock, err := etherMan.EthClient.BlockByHash(ctx, vLog.BlockHash) +
    +
    + 847 + +
    +   + if err != nil { +
    +
    + 848 + +
    +   + return nil, fmt.Errorf("error getting hashParent. BlockNumber: %d. Error: %w", vLog.BlockNumber, err) +
    +
    +
     
    +
    + 861 + +
    +   +
    +
    +
    + 862 + +
    +   + func (etherMan *Client) updateGlobalExitRootEvent(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 863 + +
    +   + log.Debug("UpdateGlobalExitRoot event detected") +
    +
    + 864 + +
    + + + oldglobalExitRoot, err := etherMan.OldGlobalExitRootManager.ParseUpdateGlobalExitRoot(vLog) +
    +
    + 865 + +
    +   + if err != nil { +
    +
    + 866 + +
    +   + return err +
    +
    + 867 + +
    +   + } +
    +
    + 868 + +
    + + + return etherMan.processUpdateGlobalExitRootEvent(ctx, oldglobalExitRoot.MainnetExitRoot, oldglobalExitRoot.RollupExitRoot, vLog, blocks, blocksOrder) +
    +
    + 869 + +
    +   + } +
    +
    + 870 + +
    +   +
    +
    +
    + 871 + +
    +   + func (etherMan *Client) processUpdateGlobalExitRootEvent(ctx context.Context, mainnetExitRoot, rollupExitRoot common.Hash, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    +
     
    +
    + 913 + +
    +   + } +
    +
    + 914 + +
    +   +
    +
    +
    + 915 + +
    +   + // EstimateGasSequenceBatches estimates gas for sending batches +
    +
    + 916 + +
    + + + func (etherMan *Client) EstimateGasSequenceBatches(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, lastSequencedBatchNumber uint64, l2Coinbase common.Address, dataAvailabilityMessage []byte) (*types.Transaction, error) { +
    +
    + 917 + +
    +   + opts, err := etherMan.getAuthByAddress(sender) +
    +
    + 918 + +
    +   + if err == ErrNotFound { +
    +
    + 919 + +
    +   + return nil, ErrPrivateKeyNotFound +
    +
    + 920 + +
    +   + } +
    +
    + 921 + +
    +   + opts.NoSend = true +
    +
    + 922 + +
    +   +
    +
    +
    + 923 + +
    + + + tx, err := etherMan.sequenceBatches(opts, sequences, maxSequenceTimestamp, lastSequencedBatchNumber, l2Coinbase, dataAvailabilityMessage) +
    +
    + 924 + +
    +   + if err != nil { +
    +
    + 925 + +
    +   + return nil, err +
    +
    + 926 + +
    +   + } +
    +
    +
     
    +
    + 929 + +
    +   + } +
    +
    + 930 + +
    +   +
    +
    +
    + 931 + +
    +   + // BuildSequenceBatchesTxData builds a []bytes to be sent to the PoE SC method SequenceBatches. +
    +
    + 932 + +
    + + + func (etherMan *Client) BuildSequenceBatchesTxData(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, lastSequencedBatchNumber uint64, l2Coinbase common.Address, dataAvailabilityMessage []byte) (to *common.Address, data []byte, err error) { +
    +
    + 933 + +
    +   + opts, err := etherMan.getAuthByAddress(sender) +
    +
    + 934 + +
    +   + if err == ErrNotFound { +
    +
    + 935 + +
    +   + return nil, nil, fmt.Errorf("failed to build sequence batches, err: %w", ErrPrivateKeyNotFound) +
    +
    +
     
    +
    + 940 + +
    +   + opts.GasLimit = uint64(1) +
    +
    + 941 + +
    +   + opts.GasPrice = big.NewInt(1) +
    +
    + 942 + +
    +   +
    +
    +
    + 943 + +
    + + + tx, err := etherMan.sequenceBatches(opts, sequences, maxSequenceTimestamp, lastSequencedBatchNumber, l2Coinbase, dataAvailabilityMessage) +
    +
    + 944 + +
    +   + if err != nil { +
    +
    + 945 + +
    +   + return nil, nil, err +
    +
    + 946 + +
    +   + } +
    +
    +
     
    +
    + 948 + +
    +   + return tx.To(), tx.Data(), nil +
    +
    + 949 + +
    +   + } +
    +
    + 950 + +
    +   +
    +
    +
    + 951 + +
    + + + func (etherMan *Client) sequenceBatches(opts bind.TransactOpts, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, lastSequencedBatchNumber uint64, l2Coinbase common.Address, dataAvailabilityMessage []byte) (*types.Transaction, error) { +
    +
    + 952 + +
    + + + var batches []polygonzkevm.PolygonValidiumEtrogValidiumBatchData +
    +
    + 953 + +
    +   + for _, seq := range sequences { +
    +
    + 954 + +
    +   + var ger common.Hash +
    +
    + 955 + +
    +   + if seq.ForcedBatchTimestamp > 0 { +
    +
    + 956 + +
    +   + ger = seq.GlobalExitRoot +
    +
    + 957 + +
    +   + } +
    +
    + 958 + +
    + + + batch := polygonzkevm.PolygonValidiumEtrogValidiumBatchData{ +
    +
    + 959 + +
    + + + TransactionsHash: crypto.Keccak256Hash(seq.BatchL2Data), +
    +
    + 960 + +
    +   + ForcedGlobalExitRoot: ger, +
    +
    + 961 + +
    +   + ForcedTimestamp: uint64(seq.ForcedBatchTimestamp), +
    +
    + 962 + +
    +   + ForcedBlockHashL1: seq.PrevBlockHash, +
    +
    +
     
    +
    + 965 + +
    +   + batches = append(batches, batch) +
    +
    + 966 + +
    +   + } +
    +
    + 967 + +
    +   +
    +
    +
    + 968 + +
    + + + tx, err := etherMan.ZkEVM.SequenceBatchesValidium(&opts, batches, maxSequenceTimestamp, lastSequencedBatchNumber, l2Coinbase, dataAvailabilityMessage) +
    +
    + 969 + +
    +   + if err != nil { +
    +
    + 970 + +
    +   + log.Debugf("Batches to send: %+v", batches) +
    +
    + 971 + +
    +   + log.Debug("l2CoinBase: ", l2Coinbase) +
    +
    + 972 + +
    +   + log.Debug("Sequencer address: ", opts.From) +
    +
    + 973 + +
    + + + a, err2 := polygonzkevm.PolygonzkevmMetaData.GetAbi() +
    +
    + 974 + +
    +   + if err2 != nil { +
    +
    + 975 + +
    +   + log.Error("error getting abi. Error: ", err2) +
    +
    + 976 + +
    +   + } +
    +
    +
     
    +
    + 1030 + +
    +   +
    +
    +
    + 1031 + +
    +   + const pendStateNum = 0 // TODO hardcoded for now until we implement the pending state feature +
    +
    + 1032 + +
    +   +
    +
    +
    + 1033 + +
    + + + tx, err := etherMan.RollupManager.VerifyBatchesTrustedAggregator( +
    +
    + 1034 + +
    +   + &opts, +
    +
    + 1035 + +
    +   + etherMan.RollupID, +
    +
    + 1036 + +
    +   + pendStateNum, +
    +
    +
     
    +
    + 1072 + +
    +   +
    +
    +
    + 1073 + +
    +   + // GetSendSequenceFee get super/trusted sequencer fee +
    +
    + 1074 + +
    +   + func (etherMan *Client) GetSendSequenceFee(numBatches uint64) (*big.Int, error) { +
    +
    + 1075 + +
    + + + f, err := etherMan.RollupManager.GetBatchFee(&bind.CallOpts{Pending: false}) +
    +
    + 1076 + +
    +   + if err != nil { +
    +
    + 1077 + +
    +   + return nil, err +
    +
    + 1078 + +
    +   + } +
    +
    +
     
    +
    + 1082 + +
    +   +
    +
    +
    + 1083 + +
    +   + // TrustedSequencer gets trusted sequencer address +
    +
    + 1084 + +
    +   + func (etherMan *Client) TrustedSequencer() (common.Address, error) { +
    +
    + 1085 + +
    + + + return etherMan.ZkEVM.TrustedSequencer(&bind.CallOpts{Pending: false}) +
    +
    + 1086 + +
    +   + } +
    +
    + 1087 + +
    +   +
    +
    +
    + 1088 + +
    +   + func (etherMan *Client) forcedBatchEvent(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 1089 + +
    +   + log.Debug("ForceBatch event detected") +
    +
    + 1090 + +
    + + + fb, err := etherMan.ZkEVM.ParseForceBatch(vLog) +
    +
    + 1091 + +
    +   + if err != nil { +
    +
    + 1092 + +
    +   + return err +
    +
    + 1093 + +
    +   + } +
    +
    +
     
    +
    + 1113 + +
    +   + txData := tx.Data() +
    +
    + 1114 + +
    +   + // Extract coded txs. +
    +
    + 1115 + +
    +   + // Load contract ABI +
    +
    + 1116 + +
    + + + abi, err := abi.JSON(strings.NewReader(polygonzkevm.PolygonzkevmABI)) +
    +
    + 1117 + +
    +   + if err != nil { +
    +
    + 1118 + +
    +   + return err +
    +
    + 1119 + +
    +   + } +
    +
    +
     
    +
    + 1162 + +
    +   + func (etherMan *Client) sequencedBatchesEvent(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 1163 + +
    +   + log.Debugf("SequenceBatches event detected: txHash: %s", common.Bytes2Hex(vLog.TxHash[:])) +
    +
    + 1164 + +
    +   +
    +
    +
    + 1165 + +
    + + + sb, err := etherMan.ZkEVM.ParseSequenceBatches(vLog) +
    +
    + 1166 + +
    +   + if err != nil { +
    +
    + 1167 + +
    +   + return err +
    +
    + 1168 + +
    +   + } +
    +
    +
     
    +
    + 1175 + +
    +   + if tx.Hash() != vLog.TxHash { +
    +
    + 1176 + +
    +   + return fmt.Errorf("error: tx hash mismatch. want: %s have: %s", vLog.TxHash, tx.Hash().String()) +
    +
    + 1177 + +
    +   + } +
    +
    + 1178 + +
    + + + msg, err := core.TransactionToMessage(tx, types.NewLondonSigner(tx.ChainId()), big.NewInt(0)) +
    +
    + 1179 + +
    +   + if err != nil { +
    +
    + 1180 + +
    +   + return err +
    +
    + 1181 + +
    +   + } +
    +
    +
     
    +
    + 1184 + +
    +   + if sb.NumBatch != 1 { +
    +
    + 1185 + +
    +   + methodId := tx.Data()[:4] +
    +
    + 1186 + +
    +   + log.Debugf("MethodId: %s", common.Bytes2Hex(methodId)) +
    +
    + 1187 + +
    + + + if bytes.Equal(methodId, methodIDSequenceBatchesEtrog) || +
    +
    + 1188 + +
    + + + bytes.Equal(methodId, methodIDSequenceBatchesValidiumEtrog) { +
    +
    + 1189 + +
    + + + sequences, err = decodeSequencesEtrog(tx.Data(), sb.NumBatch, msg.From, vLog.TxHash, msg.Nonce, sb.L1InfoRoot, etherMan.da, etherMan.state) +
    +
    + 1190 + +
    +   + if err != nil { +
    +
    + 1191 + +
    +   + return fmt.Errorf("error decoding the sequences (etrog): %v", err) +
    +
    + 1192 + +
    +   + } +
    +
    + 1193 + +
    + + + } else if bytes.Equal(methodId, methodIDSequenceBatchesElderberry) || +
    +
    + 1194 + +
    + + + bytes.Equal(methodId, methodIDSequenceBatchesValidiumElderberry) { +
    +
    + 1195 + +
    + + + sequences, err = decodeSequencesElderberry(tx.Data(), sb.NumBatch, msg.From, vLog.TxHash, msg.Nonce, sb.L1InfoRoot, etherMan.da, etherMan.state) +
    +
    + 1196 + +
    +   + if err != nil { +
    +
    + 1197 + +
    +   + return fmt.Errorf("error decoding the sequences (elderberry): %v", err) +
    +
    + 1198 + +
    +   + } +
    +
    +
     
    +
    + 1233 + +
    +   +
    +
    +
    + 1234 + +
    +   + func (etherMan *Client) sequencedBatchesPreEtrogEvent(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 1235 + +
    +   + log.Debug("Pre etrog SequenceBatches event detected") +
    +
    + 1236 + +
    + + + sb, err := etherMan.OldZkEVM.ParseSequenceBatches(vLog) +
    +
    + 1237 + +
    +   + if err != nil { +
    +
    + 1238 + +
    +   + return err +
    +
    + 1239 + +
    +   + } +
    +
    +
     
    +
    + 1278 + +
    +   + return nil +
    +
    + 1279 + +
    +   + } +
    +
    + 1280 + +
    +   +
    +
    +
    + 1281 + +
    + + + func decodeSequencesElderberry(txData []byte, lastBatchNumber uint64, sequencer common.Address, txHash common.Hash, nonce uint64, +
    +
    + 1282 + +
    + + + l1InfoRoot common.Hash, da dataavailability.BatchDataProvider, st stateProvider) ([]SequencedBatch, error) { +
    +
    + 1283 + +
    + + + // Extract coded txs. +
    +
    + 1284 + +
    + + + // Load contract ABI +
    +
    + 1285 + +
    + + + smcAbi, err := abi.JSON(strings.NewReader(polygonzkevm.PolygonzkevmABI)) +
    +
    + 1286 + +
    + + + if err != nil { +
    +
    + 1287 + +
    + + + return nil, err +
    +
    + 1288 + +
    + + + } +
    +
    + 1289 + +
    + + +
    +
    +
    + 1290 + +
    + + + return decodeSequencedBatches(smcAbi, txData, state.FORKID_ELDERBERRY, lastBatchNumber, sequencer, txHash, nonce, l1InfoRoot, da, st) +
    +
    + 1291 + +
    + + + } +
    +
    + 1292 + +
    + + +
    +
    +
    + 1293 + +
    + + + func decodeSequencesEtrog(txData []byte, lastBatchNumber uint64, sequencer common.Address, txHash common.Hash, nonce uint64, l1InfoRoot common.Hash, +
    +
    + 1294 + +
    + + + da dataavailability.BatchDataProvider, st stateProvider) ([]SequencedBatch, error) { +
    +
    + 1295 + +
    +   + // Extract coded txs. +
    +
    + 1296 + +
    +   + // Load contract ABI +
    +
    + 1297 + +
    +   + smcAbi, err := abi.JSON(strings.NewReader(etrogpolygonzkevm.EtrogpolygonzkevmABI)) +
    +
    +
     
    +
    + 1299 + +
    +   + return nil, err +
    +
    + 1300 + +
    +   + } +
    +
    + 1301 + +
    +   +
    +
    +
    + 1302 + +
    + + + return decodeSequencedBatches(smcAbi, txData, state.FORKID_ETROG, lastBatchNumber, sequencer, txHash, nonce, l1InfoRoot, da, st) +
    +
    + 1303 + +
    + + + } +
    +
    + 1304 + +
    + + +
    +
    +
    + 1305 + +
    + + + // decodeSequencedBatches decodes provided data, based on the funcName, whether it is rollup or validium data and returns sequenced batches +
    +
    + 1306 + +
    + + + func decodeSequencedBatches(smcAbi abi.ABI, txData []byte, forkID uint64, lastBatchNumber uint64, +
    +
    + 1307 + +
    + + + sequencer common.Address, txHash common.Hash, nonce uint64, l1InfoRoot common.Hash, +
    +
    + 1308 + +
    + + + da dataavailability.BatchDataProvider, st stateProvider) ([]SequencedBatch, error) { +
    +
    + 1309 + +
    +   + // Recover Method from signature and ABI +
    +
    + 1310 + +
    +   + method, err := smcAbi.MethodById(txData[:4]) +
    +
    + 1311 + +
    +   + if err != nil { +
    +
    +
     
    +
    + 1317 + +
    +   + if err != nil { +
    +
    + 1318 + +
    +   + return nil, err +
    +
    + 1319 + +
    +   + } +
    +
    + + +
    +   +
    +
    +
    + 1320 + +
    +   + bytedata, err := json.Marshal(data[0]) +
    +
    + 1321 + +
    +   + if err != nil { +
    +
    + 1322 + +
    +   + return nil, err +
    +
    + 1323 + +
    +   + } +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 1324 + +
    +   +
    +
    +
    + 1325 + +
    + + + var ( +
    +
    + 1326 + +
    + + + maxSequenceTimestamp uint64 +
    +
    + 1327 + +
    + + + initSequencedBatchNumber uint64 +
    +
    + 1328 + +
    + + + coinbase common.Address +
    +
    + 1329 + +
    + + + ) +
    +
    + 1330 + +
    + + +
    +
    +
    + 1331 + +
    + + + switch method.Name { +
    +
    + 1332 + +
    + + + case "sequenceBatches": +
    +
    + 1333 + +
    + + + var sequences []polygonzkevm.PolygonRollupBaseEtrogBatchData +
    +
    + 1334 + +
    + + + err := json.Unmarshal(bytedata, &sequences) +
    +
    + 1335 + +
    + + + if err != nil { +
    +
    + 1336 + +
    + + + return nil, err +
    +
    + 1337 + +
    +   + } +
    +
    + 1338 + +
    + + +
    +
    +
    + 1339 + +
    + + + switch forkID { +
    +
    + 1340 + +
    + + + case state.FORKID_ETROG: +
    +
    + 1341 + +
    + + + coinbase = data[1].(common.Address) +
    +
    + 1342 + +
    + + +
    +
    +
    + 1343 + +
    + + + case state.FORKID_ELDERBERRY: +
    +
    + 1344 + +
    + + + maxSequenceTimestamp = data[1].(uint64) +
    +
    + 1345 + +
    + + + initSequencedBatchNumber = data[2].(uint64) +
    +
    + 1346 + +
    + + + coinbase = data[3].(common.Address) +
    +
    + 1347 + +
    + + + } +
    +
    + 1348 + +
    + + +
    +
    +
    + 1349 + +
    + + + sequencedBatches := make([]SequencedBatch, len(sequences)) +
    +
    + 1350 + +
    + + + for i, seq := range sequences { +
    +
    + 1351 + +
    + + + bn := lastBatchNumber - uint64(len(sequences)-(i+1)) +
    +
    + 1352 + +
    + + + s := seq +
    +
    + 1353 + +
    + + + batch := SequencedBatch{ +
    +
    + 1354 + +
    + + + BatchNumber: bn, +
    +
    + 1355 + +
    + + + L1InfoRoot: &l1InfoRoot, +
    +
    + 1356 + +
    + + + SequencerAddr: sequencer, +
    +
    + 1357 + +
    + + + TxHash: txHash, +
    +
    + 1358 + +
    + + + Nonce: nonce, +
    +
    + 1359 + +
    + + + Coinbase: coinbase, +
    +
    + 1360 + +
    + + + PolygonRollupBaseEtrogBatchData: &s, +
    +
    + 1361 + +
    + + + } +
    +
    + 1362 + +
    + + + if forkID >= state.FORKID_ELDERBERRY { +
    +
    + 1363 + +
    + + + batch.SequencedBatchElderberryData = &SequencedBatchElderberryData{ +
    +
    + 1364 + +
    + + + MaxSequenceTimestamp: maxSequenceTimestamp, +
    +
    + 1365 + +
    + + + InitSequencedBatchNumber: initSequencedBatchNumber, +
    +
    + 1366 + +
    + + + } +
    +
    + 1367 + +
    + + + } +
    +
    + 1368 + +
    + + + sequencedBatches[i] = batch +
    +
    + 1369 + +
    + + + } +
    +
    + 1370 + +
    + + +
    +
    +
    + 1371 + +
    + + + return sequencedBatches, nil +
    +
    + 1372 + +
    + + + case "sequenceBatchesValidium": +
    +
    + 1373 + +
    + + + var ( +
    +
    + 1374 + +
    + + + sequencesValidium []polygonzkevm.PolygonValidiumEtrogValidiumBatchData +
    +
    + 1375 + +
    + + + dataAvailabilityMsg []byte +
    +
    + 1376 + +
    + + + ) +
    +
    + 1377 + +
    + + + err := json.Unmarshal(bytedata, &sequencesValidium) +
    +
    + 1378 + +
    + + + if err != nil { +
    +
    + 1379 + +
    + + + return nil, err +
    +
    + 1380 + +
    + + + } +
    +
    + 1381 + +
    + + +
    +
    +
    + 1382 + +
    + + + switch forkID { +
    +
    + 1383 + +
    + + + case state.FORKID_ETROG: +
    +
    + 1384 + +
    + + + coinbase = data[1].(common.Address) +
    +
    + 1385 + +
    + + + dataAvailabilityMsg = data[2].([]byte) +
    +
    + 1386 + +
    + + +
    +
    +
    + 1387 + +
    + + + case state.FORKID_ELDERBERRY: +
    +
    + 1388 + +
    + + + maxSequenceTimestamp = data[1].(uint64) +
    +
    + 1389 + +
    + + + initSequencedBatchNumber = data[2].(uint64) +
    +
    + 1390 + +
    + + + coinbase = data[3].(common.Address) +
    +
    + 1391 + +
    + + + dataAvailabilityMsg = data[4].([]byte) +
    +
    + 1392 + +
    + + + } +
    +
    + 1393 + +
    + + +
    +
    +
    + 1394 + +
    + + + // Pair the batch number, hash, and if it is forced. This will allow +
    +
    + 1395 + +
    + + + // retrieval from different sources, and keep them in original order. +
    +
    + 1396 + +
    + + + var batchInfos []batchInfo +
    +
    + 1397 + +
    + + + for i, d := range sequencesValidium { +
    +
    + 1398 + +
    + + + bn := lastBatchNumber - uint64(len(sequencesValidium)-(i+1)) +
    +
    + 1399 + +
    + + + forced := d.ForcedTimestamp > 0 +
    +
    + 1400 + +
    + + + h := d.TransactionsHash +
    +
    + 1401 + +
    + + + batchInfos = append(batchInfos, batchInfo{num: bn, hash: h, isForced: forced}) +
    +
    + 1402 + +
    + + + } +
    +
    + 1403 + +
    + + +
    +
    +
    + 1404 + +
    + + + batchData, err := retrieveBatchData(da, st, batchInfos, dataAvailabilityMsg) +
    +
    + 1405 + +
    + + + if err != nil { +
    +
    + 1406 + +
    + + + return nil, err +
    +
    + 1407 + +
    + + + } +
    +
    + 1408 + +
    + + +
    +
    +
    + 1409 + +
    + + + sequencedBatches := make([]SequencedBatch, len(sequencesValidium)) +
    +
    + 1410 + +
    + + + for i, info := range batchInfos { +
    +
    + 1411 + +
    + + + bn := info.num +
    +
    + 1412 + +
    + + + s := polygonzkevm.PolygonRollupBaseEtrogBatchData{ +
    +
    + 1413 + +
    + + + Transactions: batchData[i], +
    +
    + 1414 + +
    + + + ForcedGlobalExitRoot: sequencesValidium[i].ForcedGlobalExitRoot, +
    +
    + 1415 + +
    + + + ForcedTimestamp: sequencesValidium[i].ForcedTimestamp, +
    +
    + 1416 + +
    + + + ForcedBlockHashL1: sequencesValidium[i].ForcedBlockHashL1, +
    +
    + 1417 + +
    + + + } +
    +
    + 1418 + +
    + + + batch := SequencedBatch{ +
    +
    + 1419 + +
    + + + BatchNumber: bn, +
    +
    + 1420 + +
    + + + L1InfoRoot: &l1InfoRoot, +
    +
    + 1421 + +
    + + + SequencerAddr: sequencer, +
    +
    + 1422 + +
    + + + TxHash: txHash, +
    +
    + 1423 + +
    + + + Nonce: nonce, +
    +
    + 1424 + +
    + + + Coinbase: coinbase, +
    +
    + 1425 + +
    + + + PolygonRollupBaseEtrogBatchData: &s, +
    +
    + 1426 + +
    + + + } +
    +
    + 1427 + +
    + + + if forkID >= state.FORKID_ELDERBERRY { +
    +
    + 1428 + +
    + + + elderberry := &SequencedBatchElderberryData{ +
    +
    + 1429 + +
    + + + MaxSequenceTimestamp: maxSequenceTimestamp, +
    +
    + 1430 + +
    + + + InitSequencedBatchNumber: initSequencedBatchNumber, +
    +
    + 1431 + +
    + + + } +
    +
    + 1432 + +
    + + + batch.SequencedBatchElderberryData = elderberry +
    +
    + 1433 + +
    + + + } +
    +
    + 1434 + +
    + + + sequencedBatches[i] = batch +
    +
    + 1435 + +
    +   + } +
    +
    + 1436 + +
    + + +
    +
    +
    + 1437 + +
    + + + return sequencedBatches, nil +
    +
    + 1438 + +
    +   + } +
    +
    + 1439 + +
    +   +
    +
    +
    + 1440 + +
    + + + return nil, fmt.Errorf("unexpected method called in sequence batches transaction: %s", method.RawName) +
    +
    + 1441 + +
    +   + } +
    +
    + 1442 + +
    +   +
    +
    +
    + 1443 + +
    + + + type batchInfo struct { +
    +
    + 1444 + +
    + + + num uint64 +
    +
    + 1445 + +
    + + + hash common.Hash +
    +
    + 1446 + +
    + + + isForced bool +
    +
    + 1447 + +
    + + + } +
    +
    + 1448 + +
    + + +
    +
    +
    + 1449 + +
    + + + func retrieveBatchData(da dataavailability.BatchDataProvider, st stateProvider, batchInfos []batchInfo, daMessage []byte) ([][]byte, error) { +
    +
    + 1450 + +
    + + + validiumData, err := getBatchL2Data(da, batchInfos, daMessage) +
    +
    + 1451 + +
    +   + if err != nil { +
    +
    + 1452 + +
    +   + return nil, err +
    +
    + 1453 + +
    +   + } +
    +
    + 1454 + +
    + + + forcedData, err := getForcedBatchData(st, batchInfos) +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 1455 + +
    +   + if err != nil { +
    +
    + 1456 + +
    +   + return nil, err +
    +
    + 1457 + +
    +   + } +
    +
    + 1458 + +
    + + + data := make([][]byte, len(batchInfos)) +
    +
    + 1459 + +
    + + + for i, info := range batchInfos { +
    +
    + 1460 + +
    + + + bn := info.num +
    +
    + 1461 + +
    + + + if info.isForced { +
    +
    + 1462 + +
    + + + data[i] = forcedData[bn] +
    +
    + 1463 + +
    + + + } else { +
    +
    + 1464 + +
    + + + data[i] = validiumData[bn] +
    +
    + 1465 + +
    + + + } +
    +
    + 1466 + +
    + + + } +
    +
    + 1467 + +
    + + + return data, nil +
    +
    + 1468 + +
    + + + } +
    +
    + 1469 + +
    +   +
    +
    +
    + 1470 + +
    + + + func getBatchL2Data(da dataavailability.BatchDataProvider, batchInfos []batchInfo, daMessage []byte) (map[uint64][]byte, error) { +
    +
    + 1471 + +
    + + + var batchNums []uint64 +
    +
    + 1472 + +
    + + + var batchHashes []common.Hash +
    +
    + 1473 + +
    + + + for _, info := range batchInfos { +
    +
    + 1474 + +
    + + + if !info.isForced { +
    +
    + 1475 + +
    + + + batchNums = append(batchNums, info.num) +
    +
    + 1476 + +
    + + + batchHashes = append(batchHashes, info.hash) +
    +
    + 1477 + +
    + + + } +
    +
    + 1478 + +
    +   + } +
    +
    + 1479 + +
    + + + if len(batchNums) == 0 { +
    +
    + 1480 + +
    + + + return nil, nil +
    +
    + 1481 + +
    + + + } +
    +
    + 1482 + +
    + + + batchL2Data, err := da.GetBatchL2Data(batchNums, batchHashes, daMessage) +
    +
    + 1483 + +
    +   + if err != nil { +
    +
    + 1484 + +
    +   + return nil, err +
    +
    + 1485 + +
    +   + } +
    +
    + 1486 + +
    + + + if len(batchL2Data) != len(batchNums) { +
    +
    + 1487 + +
    + + + return nil, +
    +
    + 1488 + +
    + + + fmt.Errorf("failed to retrieve all batch data. Expected %d, got %d", len(batchNums), len(batchL2Data)) +
    +
    + 1489 + +
    + + + } +
    +
    + 1490 + +
    + + + data := make(map[uint64][]byte) +
    +
    + 1491 + +
    + + + for i, bn := range batchNums { +
    +
    + 1492 + +
    + + + data[bn] = batchL2Data[i] +
    +
    + 1493 + +
    + + + } +
    +
    + 1494 + +
    + + + return data, nil +
    +
    + 1495 + +
    + + + } +
    +
    + 1496 + +
    + + +
    +
    +
    + 1497 + +
    + + + func getForcedBatchData(st stateProvider, batchInfos []batchInfo) (map[uint64][]byte, error) { +
    +
    + 1498 + +
    + + + var batchNums []uint64 +
    +
    + 1499 + +
    + + + var batchHashes []common.Hash +
    +
    + 1500 + +
    + + + for _, info := range batchInfos { +
    +
    + 1501 + +
    + + + if info.isForced { +
    +
    + 1502 + +
    + + + batchNums = append(batchNums, info.num) +
    +
    + 1503 + +
    + + + batchHashes = append(batchHashes, info.hash) +
    +
    + 1504 + +
    + + + } +
    +
    + 1505 + +
    + + + } +
    +
    + 1506 + +
    + + + if len(batchNums) == 0 { +
    +
    + 1507 + +
    + + + return nil, nil +
    +
    + 1508 + +
    + + + } +
    +
    + 1509 + +
    + + + data, err := st.GetForcedBatchDataByNumbers(context.Background(), batchNums, nil) +
    +
    + 1510 + +
    +   + if err != nil { +
    +
    + 1511 + +
    +   + return nil, err +
    +
    + 1512 + +
    +   + } +
    +
    + 1513 + +
    + + +
    +
    +
    + 1514 + +
    + + + for i, bn := range batchNums { +
    +
    + 1515 + +
    + + + expectedHash := batchHashes[i] +
    +
    + 1516 + +
    + + + d, ok := data[bn] +
    +
    + 1517 + +
    + + + if !ok { +
    +
    + 1518 + +
    + + + return nil, fmt.Errorf("missing forced batch data for number %d", bn) +
    +
    + 1519 + +
    + + + } +
    +
    + 1520 + +
    + + + actualHash := crypto.Keccak256Hash(d) +
    +
    + 1521 + +
    + + + if actualHash != expectedHash { +
    +
    + 1522 + +
    + + + return nil, fmt.Errorf("got wrong hash for forced batch data number %d", bn) +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 1523 + +
    +   + } +
    +
    + 1524 + +
    +   + } +
    +
    + 1525 + +
    + + + return data, nil +
    +
    + + +
    +   +
    +
    +
    + 1526 + +
    +   + } +
    +
    + 1527 + +
    +   +
    +
    +
    + 1528 + +
    +   + func decodeSequencesPreEtrog(txData []byte, lastBatchNumber uint64, sequencer common.Address, txHash common.Hash, nonce uint64) ([]SequencedBatch, error) { +
    +
    + 1529 + +
    +   + // Extract coded txs. +
    +
    + 1530 + +
    +   + // Load contract ABI +
    +
    + 1531 + +
    + + + smcAbi, err := abi.JSON(strings.NewReader(oldpolygonzkevm.OldpolygonzkevmABI)) +
    +
    + 1532 + +
    +   + if err != nil { +
    +
    + 1533 + +
    +   + return nil, err +
    +
    + 1534 + +
    +   + } +
    +
    +
     
    +
    + 1544 + +
    +   + if err != nil { +
    +
    + 1545 + +
    +   + return nil, err +
    +
    + 1546 + +
    +   + } +
    +
    + 1547 + +
    + + + var sequences []oldpolygonzkevm.PolygonZkEVMBatchData +
    +
    + 1548 + +
    +   + bytedata, err := json.Marshal(data[0]) +
    +
    + 1549 + +
    +   + if err != nil { +
    +
    + 1550 + +
    +   + return nil, err +
    +
    +
     
    +
    + 1571 + +
    +   + return sequencedBatches, nil +
    +
    + 1572 + +
    +   + } +
    +
    + 1573 + +
    +   +
    +
    +
    + 1574 + +
    + + + func (etherMan *Client) oldVerifyBatchesTrustedAggregatorEvent(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 1575 + +
    +   + log.Debug("TrustedVerifyBatches event detected") +
    +
    + 1576 + +
    + + + var vb *oldpolygonzkevm.OldpolygonzkevmVerifyBatchesTrustedAggregator +
    +
    + 1577 + +
    + + + vb, err := etherMan.OldZkEVM.ParseVerifyBatchesTrustedAggregator(vLog) +
    +
    + 1578 + +
    +   + if err != nil { +
    +
    + 1579 + +
    +   + log.Error("error parsing TrustedVerifyBatches event. Error: ", err) +
    +
    + 1580 + +
    +   + return err +
    +
    +
     
    +
    + 1584 + +
    +   +
    +
    +
    + 1585 + +
    +   + func (etherMan *Client) verifyBatchesEvent(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 1586 + +
    +   + log.Debug("VerifyBatches event detected") +
    +
    + 1587 + +
    + + + vb, err := etherMan.ZkEVM.ParseVerifyBatches(vLog) +
    +
    + 1588 + +
    +   + if err != nil { +
    +
    + 1589 + +
    +   + log.Error("error parsing VerifyBatches event. Error: ", err) +
    +
    + 1590 + +
    +   + return err +
    +
    +
     
    +
    + 1631 + +
    +   +
    +
    +
    + 1632 + +
    +   + func (etherMan *Client) forceSequencedBatchesEvent(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    +
    + 1633 + +
    +   + log.Debug("SequenceForceBatches event detect") +
    +
    + 1634 + +
    + + + fsb, err := etherMan.ZkEVM.ParseSequenceForceBatches(vLog) +
    +
    + 1635 + +
    +   + if err != nil { +
    +
    + 1636 + +
    +   + return err +
    +
    + 1637 + +
    +   + } +
    +
    +
     
    +
    + 1680 + +
    +   + func decodeSequencedForceBatches(txData []byte, lastBatchNumber uint64, sequencer common.Address, txHash common.Hash, block *types.Block, nonce uint64) ([]SequencedForceBatch, error) { +
    +
    + 1681 + +
    +   + // Extract coded txs. +
    +
    + 1682 + +
    +   + // Load contract ABI +
    +
    + 1683 + +
    + + + abi, err := abi.JSON(strings.NewReader(polygonzkevm.PolygonzkevmABI)) +
    +
    + 1684 + +
    +   + if err != nil { +
    +
    + 1685 + +
    +   + return nil, err +
    +
    + 1686 + +
    +   + } +
    +
    +
     
    +
    + 1697 + +
    +   + return nil, err +
    +
    + 1698 + +
    +   + } +
    +
    + 1699 + +
    +   +
    +
    +
    + 1700 + +
    + + + var forceBatches []polygonzkevm.PolygonRollupBaseEtrogBatchData +
    +
    + 1701 + +
    +   + bytedata, err := json.Marshal(data[0]) +
    +
    + 1702 + +
    +   + if err != nil { +
    +
    + 1703 + +
    +   + return nil, err +
    +
    +
     
    +
    + 1761 + +
    +   +
    +
    +
    + 1762 + +
    +   + // GetLatestBatchNumber function allows to retrieve the latest proposed batch in the smc +
    +
    + 1763 + +
    +   + func (etherMan *Client) GetLatestBatchNumber() (uint64, error) { +
    +
    + 1764 + +
    + + + var latestBatchNum uint64 +
    +
    + 1765 + +
    + + + rollupData, err := etherMan.RollupManager.RollupIDToRollupData(&bind.CallOpts{Pending: false}, etherMan.RollupID) +
    +
    + 1766 + +
    +   + if err != nil { +
    +
    + 1767 + +
    + + + log.Debug("error getting latestBatchNum from rollupManager. Trying old zkevm smc... Error: ", err) +
    +
    + 1768 + +
    + + + latestBatchNum, err = etherMan.OldZkEVM.LastBatchSequenced(&bind.CallOpts{Pending: false}) +
    +
    + 1769 + +
    + + + if err != nil { +
    +
    + 1770 + +
    + + + return latestBatchNum, err +
    +
    + 1771 + +
    + + + } +
    +
    + 1772 + +
    + + + } else { +
    +
    + 1773 + +
    + + + latestBatchNum = rollupData.LastBatchSequenced +
    +
    + 1774 + +
    +   + } +
    +
    + 1775 + +
    + + + return latestBatchNum, nil +
    +
    + 1776 + +
    +   + } +
    +
    + 1777 + +
    +   +
    +
    +
    + 1778 + +
    +   + // GetLatestBlockHeader gets the latest block header from the ethereum +
    +
    +
     
    +
    + 1819 + +
    +   +
    +
    +
    + 1820 + +
    +   + // GetLatestVerifiedBatchNum gets latest verified batch from ethereum +
    +
    + 1821 + +
    +   + func (etherMan *Client) GetLatestVerifiedBatchNum() (uint64, error) { +
    +
    + 1822 + +
    + + + var lastVerifiedBatchNum uint64 +
    +
    + 1823 + +
    + + + rollupData, err := etherMan.RollupManager.RollupIDToRollupData(&bind.CallOpts{Pending: false}, etherMan.RollupID) +
    +
    + 1824 + +
    +   + if err != nil { +
    +
    + 1825 + +
    + + + log.Debug("error getting lastVerifiedBatchNum from rollupManager. Trying old zkevm smc... Error: ", err) +
    +
    + 1826 + +
    + + + lastVerifiedBatchNum, err = etherMan.OldZkEVM.LastVerifiedBatch(&bind.CallOpts{Pending: false}) +
    +
    + 1827 + +
    + + + if err != nil { +
    +
    + 1828 + +
    + + + return lastVerifiedBatchNum, err +
    +
    + 1829 + +
    + + + } +
    +
    + 1830 + +
    + + + } else { +
    +
    + 1831 + +
    + + + lastVerifiedBatchNum = rollupData.LastVerifiedBatch +
    +
    + 1832 + +
    +   + } +
    +
    + 1833 + +
    + + + return lastVerifiedBatchNum, nil +
    +
    + 1834 + +
    +   + } +
    +
    + 1835 + +
    +   +
    +
    +
    + 1836 + +
    +   + // GetTx function get ethereum tx +
    +
    +
     
    +
    + 1865 + +
    +   +
    +
    +
    + 1866 + +
    +   + // GetTrustedSequencerURL Gets the trusted sequencer url from rollup smc +
    +
    + 1867 + +
    +   + func (etherMan *Client) GetTrustedSequencerURL() (string, error) { +
    +
    + 1868 + +
    + + + url, err := etherMan.ZkEVM.TrustedSequencerURL(&bind.CallOpts{Pending: false}) +
    +
    + 1869 + +
    + + + //TODO: remove this code because is for compatibility with oldZkEVM +
    +
    + 1870 + +
    + + + if err != nil || url == "" { +
    +
    + 1871 + +
    + + + // Getting from oldZkEVM Contract +
    +
    + 1872 + +
    + + + log.Debug("getting trusted sequencer URL from oldZkevm smc") +
    +
    + 1873 + +
    + + + return etherMan.OldZkEVM.TrustedSequencerURL(&bind.CallOpts{Pending: false}) +
    +
    + 1874 + +
    + + + } +
    +
    + 1875 + +
    + + + // err is always nil +
    +
    + 1876 + +
    + + + return url, nil +
    +
    + 1877 + +
    +   + } +
    +
    + 1878 + +
    +   +
    +
    +
    + 1879 + +
    +   + // GetL2ChainID returns L2 Chain ID +
    +
    + 1880 + +
    +   + func (etherMan *Client) GetL2ChainID() (uint64, error) { +
    +
    + 1881 + +
    + + + chainID, err := etherMan.OldZkEVM.ChainID(&bind.CallOpts{Pending: false}) +
    +
    + 1882 + +
    + + + log.Debug("chainID read from oldZkevm: ", chainID) +
    +
    + 1883 + +
    +   + if err != nil || chainID == 0 { +
    +
    + 1884 + +
    + + + log.Debug("error from oldZkevm: ", err) +
    +
    + 1885 + +
    + + + rollupData, err := etherMan.RollupManager.RollupIDToRollupData(&bind.CallOpts{Pending: false}, etherMan.RollupID) +
    +
    + 1886 + +
    + + + log.Debugf("ChainID read from rollupManager: %d using rollupID: %d", rollupData.ChainID, etherMan.RollupID) +
    +
    + 1887 + +
    +   + if err != nil { +
    +
    + 1888 + +
    + + + log.Debug("error from rollupManager: ", err) +
    +
    + 1889 + +
    +   + return 0, err +
    +
    + 1890 + +
    +   + } else if rollupData.ChainID == 0 { +
    +
    + 1891 + +
    +   + return rollupData.ChainID, fmt.Errorf("error: chainID received is 0!!") +
    +
    +
     
    +
    + 1916 + +
    +   + return etherMan.EthClient.SendTransaction(ctx, tx) +
    +
    + 1917 + +
    +   + } +
    +
    + 1918 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 1919 + +
    +   + // CurrentNonce returns the current nonce for the provided account +
    +
    + 1920 + +
    +   + func (etherMan *Client) CurrentNonce(ctx context.Context, account common.Address) (uint64, error) { +
    +
    + 1921 + +
    +   + return etherMan.EthClient.NonceAt(ctx, account, nil) +
    +
    +
     
    +
    + 1948 + +
    +   + opts.BlockNumber = new(big.Int).SetUint64(*blockNumber) +
    +
    + 1949 + +
    +   + } +
    +
    + 1950 + +
    +   +
    +
    +
    + 1951 + +
    + + + return etherman.GlobalExitRootManager.DepositCount(opts) +
    +
    + 1952 + +
    +   + } +
    +
    + 1953 + +
    +   +
    +
    +
    + 1954 + +
    +   + // CheckTxWasMined check if a tx was already mined +
    +
    +
     
    +
    + 2005 + +
    +   + } +
    +
    + 2006 + +
    +   +
    +
    +
    + 2007 + +
    +   + // LoadAuthFromKeyStore loads an authorization from a key store file +
    +
    + 2008 + +
    + + + func (etherMan *Client) LoadAuthFromKeyStore(path, password string) (*bind.TransactOpts, *ecdsa.PrivateKey, error) { +
    +
    + 2009 + +
    + + + auth, pk, err := newAuthFromKeystore(path, password, etherMan.l1Cfg.L1ChainID) +
    +
    + 2010 + +
    +   + if err != nil { +
    +
    + 2011 + +
    + + + return nil, nil, err +
    +
    + 2012 + +
    +   + } +
    +
    + 2013 + +
    +   +
    +
    +
    + 2014 + +
    +   + log.Infof("loaded authorization for address: %v", auth.From.String()) +
    +
    + 2015 + +
    +   + etherMan.auth[auth.From] = auth +
    +
    + 2016 + +
    + + + return &auth, pk, nil +
    +
    + 2017 + +
    +   + } +
    +
    + 2018 + +
    +   +
    +
    +
    + 2019 + +
    +   + // newKeyFromKeystore creates an instance of a keystore key from a keystore file +
    +
    +
     
    +
    + 2034 + +
    +   + } +
    +
    + 2035 + +
    +   +
    +
    +
    + 2036 + +
    +   + // newAuthFromKeystore an authorization instance from a keystore file +
    +
    + 2037 + +
    + + + func newAuthFromKeystore(path, password string, chainID uint64) (bind.TransactOpts, *ecdsa.PrivateKey, error) { +
    +
    + 2038 + +
    +   + log.Infof("reading key from: %v", path) +
    +
    + 2039 + +
    +   + key, err := newKeyFromKeystore(path, password) +
    +
    + 2040 + +
    +   + if err != nil { +
    +
    + 2041 + +
    + + + return bind.TransactOpts{}, nil, err +
    +
    + 2042 + +
    +   + } +
    +
    + 2043 + +
    +   + if key == nil { +
    +
    + 2044 + +
    + + + return bind.TransactOpts{}, nil, nil +
    +
    + 2045 + +
    +   + } +
    +
    + 2046 + +
    +   + auth, err := bind.NewKeyedTransactorWithChainID(key.PrivateKey, new(big.Int).SetUint64(chainID)) +
    +
    + 2047 + +
    +   + if err != nil { +
    +
    + 2048 + +
    + + + return bind.TransactOpts{}, nil, err +
    +
    + 2049 + +
    +   + } +
    +
    + 2050 + +
    + + + return *auth, key.PrivateKey, nil +
    +
    + 2051 + +
    +   + } +
    +
    + 2052 + +
    +   +
    +
    +
    + 2053 + +
    +   + // getAuthByAddress tries to get an authorization from the authorizations map +
    +
    +
     
    +
    + 2075 + +
    +   +
    +
    +
    + 2076 + +
    +   + return *auth, nil +
    +
    + 2077 + +
    +   + } +
    +
    + 2078 + +
    + + +
    +
    +
    + 2079 + +
    + + + // GetDAProtocolAddr returns the address of the data availability protocol +
    +
    + 2080 + +
    + + + func (etherMan *Client) GetDAProtocolAddr() (common.Address, error) { +
    +
    + 2081 + +
    + + + return etherMan.ZkEVM.DataAvailabilityProtocol(&bind.CallOpts{Pending: false}) +
    +
    + 2082 + +
    + + + } +
    +
    + 2083 + +
    + + +
    +
    +
    + 2084 + +
    + + + // GetDAProtocolName returns the name of the data availability protocol +
    +
    + 2085 + +
    + + + func (etherMan *Client) GetDAProtocolName() (string, error) { +
    +
    + 2086 + +
    + + + return etherMan.DAProtocol.GetProcotolName(&bind.CallOpts{Pending: false}) +
    +
    + 2087 + +
    + + + } +
    +
    + 2088 + +
    + + +
    +
    +
    + 2089 + +
    + + + // SetDataAvailabilityProtocol sets the address for the new data availability protocol +
    +
    + 2090 + +
    + + + func (etherMan *Client) SetDataAvailabilityProtocol(from, daAddress common.Address) (*types.Transaction, error) { +
    +
    + 2091 + +
    + + + auth, err := etherMan.getAuthByAddress(from) +
    +
    + 2092 + +
    + + + if err != nil { +
    +
    + 2093 + +
    + + + return nil, err +
    +
    + 2094 + +
    + + + } +
    +
    + 2095 + +
    + + +
    +
    +
    + 2096 + +
    + + + return etherMan.ZkEVM.SetDataAvailabilityProtocol(&auth, daAddress) +
    +
    + 2097 + +
    + + + } +
    +
    + 2098 + +
    + + +
    +
    +
    + 2099 + +
    + + + // GetRollupId returns the rollup id +
    +
    + 2100 + +
    + + + func (etherMan *Client) GetRollupId() uint32 { +
    +
    + 2101 + +
    + + + return etherMan.RollupID +
    +
    + 2102 + +
    + + + } +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/etherman_test.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -38,7 +38,7 @@
    +
    + 38 + +
    +   + } +
    +
    + 39 + +
    +   +
    +
    +
    + 40 + +
    +   + // This function prepare the blockchain, the wallet with funds and deploy the smc +
    +
    + 41 + +
    + - + func newTestingEnv() (ethman *Client, ethBackend *simulated.Backend, auth *bind.TransactOpts, polAddr common.Address, br *etrogpolygonzkevmbridge.Etrogpolygonzkevmbridge) { +
    +
    + 42 + +
    +   + privateKey, err := crypto.GenerateKey() +
    +
    + 43 + +
    +   + if err != nil { +
    +
    + 44 + +
    +   + log.Fatal(err) +
    +
    +
    @@ -47,7 +47,9 @@
    +
    + 47 + +
    +   + if err != nil { +
    +
    + 48 + +
    +   + log.Fatal(err) +
    +
    + 49 + +
    +   + } +
    +
    + 50 + +
    + - + ethman, ethBackend, polAddr, br, err = NewSimulatedEtherman(Config{ForkIDChunkSize: 10}, auth) +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 51 + +
    +   + if err != nil { +
    +
    + 52 + +
    +   + log.Fatal(err) +
    +
    + 53 + +
    +   + } +
    +
    +
    @@ -55,12 +57,12 @@
    +
    + 55 + +
    +   + if err != nil { +
    +
    + 56 + +
    +   + log.Fatal(err) +
    +
    + 57 + +
    +   + } +
    +
    + 58 + +
    + - + return ethman, ethBackend, auth, polAddr, br +
    +
    + 59 + +
    +   + } +
    +
    + 60 + +
    +   +
    +
    +
    + 61 + +
    +   + func TestGEREvent(t *testing.T) { +
    +
    + 62 + +
    +   + // Set up testing environment +
    +
    + 63 + +
    + - + etherman, ethBackend, auth, _, br := newTestingEnv() +
    +
    + 64 + +
    +   +
    +
    +
    + 65 + +
    +   + // Read currentBlock +
    +
    + 66 + +
    +   + ctx := context.Background() +
    +
    +
    @@ -82,26 +84,26 @@
    +
    + 82 + +
    +   + blocks, _, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber) +
    +
    + 83 + +
    +   + require.NoError(t, err) +
    +
    + 84 + +
    +   + t.Logf("Blocks: %+v", blocks) +
    +
    + 85 + +
    + - + assert.Equal(t, uint64(8), blocks[0].L1InfoTree[0].BlockNumber) +
    +
    + 86 + +
    +   + assert.NotEqual(t, common.Hash{}, blocks[0].L1InfoTree[0].MainnetExitRoot) +
    +
    + 87 + +
    +   + assert.Equal(t, common.Hash{}, blocks[0].L1InfoTree[0].RollupExitRoot) +
    +
    + 88 + +
    +   + } +
    +
    + 89 + +
    +   +
    +
    +
    + 90 + +
    +   + func TestForcedBatchEvent(t *testing.T) { +
    +
    + 91 + +
    +   + // Set up testing environment +
    +
    + 92 + +
    + - + etherman, ethBackend, auth, _, _ := newTestingEnv() +
    +
    + 93 + +
    +   +
    +
    +
    + 94 + +
    +   + // Read currentBlock +
    +
    + 95 + +
    +   + ctx := context.Background() +
    +
    + 96 + +
    +   + initBlock, err := etherman.EthClient.BlockByNumber(ctx, nil) +
    +
    + 97 + +
    +   + require.NoError(t, err) +
    +
    + 98 + +
    +   +
    +
    +
    + 99 + +
    + - + amount, err := etherman.EtrogRollupManager.GetForcedBatchFee(&bind.CallOpts{Pending: false}) +
    +
    + 100 + +
    +   + require.NoError(t, err) +
    +
    + 101 + +
    +   + rawTxs := "f84901843b9aca00827b0c945fbdb2315678afecb367f032d93f642f64180aa380a46057361d00000000000000000000000000000000000000000000000000000000000000048203e9808073efe1fa2d3e27f26f32208550ea9b0274d49050b816cadab05a771f4275d0242fd5d92b3fb89575c070e6c930587c520ee65a3aa8cfe382fcad20421bf51d621c" +
    +
    + 102 + +
    +   + data, err := hex.DecodeString(rawTxs) +
    +
    + 103 + +
    +   + require.NoError(t, err) +
    +
    + 104 + +
    + - + _, err = etherman.EtrogZkEVM.ForceBatch(auth, data, amount) +
    +
    + 105 + +
    +   + require.NoError(t, err) +
    +
    + 106 + +
    +   +
    +
    +
    + 107 + +
    +   + // Mine the tx in a block +
    +
    +
    @@ -114,8 +116,8 @@
    +
    + 114 + +
    +   + blocks, _, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber) +
    +
    + 115 + +
    +   + require.NoError(t, err) +
    +
    + 116 + +
    +   + t.Logf("Blocks: %+v", blocks) +
    +
    + 117 + +
    + - + assert.Equal(t, uint64(8), blocks[0].BlockNumber) +
    +
    + 118 + +
    + - + assert.Equal(t, uint64(8), blocks[0].ForcedBatches[0].BlockNumber) +
    +
    + 119 + +
    +   + assert.NotEqual(t, common.Hash{}, blocks[0].ForcedBatches[0].GlobalExitRoot) +
    +
    + 120 + +
    +   + assert.NotEqual(t, time.Time{}, blocks[0].ForcedBatches[0].ForcedAt) +
    +
    + 121 + +
    +   + assert.Equal(t, uint64(1), blocks[0].ForcedBatches[0].ForcedBatchNumber) +
    +
    +
    @@ -125,7 +127,7 @@
    +
    + 125 + +
    +   +
    +
    +
    + 126 + +
    +   + func TestSequencedBatchesEvent(t *testing.T) { +
    +
    + 127 + +
    +   + // Set up testing environment +
    +
    + 128 + +
    + - + etherman, ethBackend, auth, _, br := newTestingEnv() +
    +
    + 129 + +
    +   +
    +
    +
    + 130 + +
    +   + // Read currentBlock +
    +
    + 131 + +
    +   + ctx := context.Background() +
    +
    +
    @@ -139,12 +141,12 @@
    +
    + 139 + +
    +   + ethBackend.Commit() +
    +
    + 140 + +
    +   + auth.Value = big.NewInt(0) +
    +
    + 141 + +
    +   +
    +
    +
    + 142 + +
    + - + amount, err := etherman.EtrogRollupManager.GetForcedBatchFee(&bind.CallOpts{Pending: false}) +
    +
    + 143 + +
    +   + require.NoError(t, err) +
    +
    + 144 + +
    +   + rawTxs := "f84901843b9aca00827b0c945fbdb2315678afecb367f032d93f642f64180aa380a46057361d00000000000000000000000000000000000000000000000000000000000000048203e9808073efe1fa2d3e27f26f32208550ea9b0274d49050b816cadab05a771f4275d0242fd5d92b3fb89575c070e6c930587c520ee65a3aa8cfe382fcad20421bf51d621c" +
    +
    + 145 + +
    +   + data, err := hex.DecodeString(rawTxs) +
    +
    + 146 + +
    +   + require.NoError(t, err) +
    +
    + 147 + +
    + - + _, err = etherman.EtrogZkEVM.ForceBatch(auth, data, amount) +
    +
    + 148 + +
    +   + require.NoError(t, err) +
    +
    + 149 + +
    +   + require.NoError(t, err) +
    +
    + 150 + +
    +   + ethBackend.Commit() +
    +
    +
    @@ -156,13 +158,19 @@
    +
    + 156 + +
    +   + blocks, _, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &currentBlockNumber) +
    +
    + 157 + +
    +   + require.NoError(t, err) +
    +
    + 158 + +
    +   + t.Log("Blocks: ", blocks) +
    +
    + 159 + +
    + - + var sequences []etrogpolygonzkevm.PolygonRollupBaseEtrogBatchData +
    +
    + 160 + +
    + - + sequences = append(sequences, etrogpolygonzkevm.PolygonRollupBaseEtrogBatchData{ +
    +
    + 161 + +
    + - + Transactions: common.Hex2Bytes(rawTxs), +
    +
    + 162 + +
    + - + }, etrogpolygonzkevm.PolygonRollupBaseEtrogBatchData{ +
    +
    + 163 + +
    + - + Transactions: common.Hex2Bytes(rawTxs), +
    +
    + + +
    +   +
    +
    +
    + 164 + +
    +   + }) +
    +
    + 165 + +
    + - + _, err = etherman.EtrogZkEVM.SequenceBatches(auth, sequences, uint64(time.Now().Unix()), uint64(1), auth.From) +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 166 + +
    +   + require.NoError(t, err) +
    +
    + 167 + +
    +   +
    +
    +
    + 168 + +
    +   + // Mine the tx in a block +
    +
    +
    @@ -188,7 +196,7 @@
    +
    + 188 + +
    +   +
    +
    +
    + 189 + +
    +   + func TestVerifyBatchEvent(t *testing.T) { +
    +
    + 190 + +
    +   + // Set up testing environment +
    +
    + 191 + +
    + - + etherman, ethBackend, auth, _, _ := newTestingEnv() +
    +
    + 192 + +
    +   +
    +
    +
    + 193 + +
    +   + // Read currentBlock +
    +
    + 194 + +
    +   + ctx := context.Background() +
    +
    +
    @@ -197,17 +205,18 @@
    +
    + 197 + +
    +   + require.NoError(t, err) +
    +
    + 198 + +
    +   +
    +
    +
    + 199 + +
    +   + rawTxs := "f84901843b9aca00827b0c945fbdb2315678afecb367f032d93f642f64180aa380a46057361d00000000000000000000000000000000000000000000000000000000000000048203e9808073efe1fa2d3e27f26f32208550ea9b0274d49050b816cadab05a771f4275d0242fd5d92b3fb89575c070e6c930587c520ee65a3aa8cfe382fcad20421bf51d621c" +
    +
    + 200 + +
    + - + tx := etrogpolygonzkevm.PolygonRollupBaseEtrogBatchData{ +
    +
    + 201 + +
    + - + Transactions: common.Hex2Bytes(rawTxs), +
    +
    + 202 + +
    +   + } +
    +
    + 203 + +
    + - + //TODO: Fix params +
    +
    + 204 + +
    + - + _, err = etherman.EtrogZkEVM.SequenceBatches(auth, []etrogpolygonzkevm.PolygonRollupBaseEtrogBatchData{tx}, uint64(time.Now().Unix()), uint64(1), auth.From) +
    +
    + 205 + +
    +   + require.NoError(t, err) +
    +
    + + +
    +   +
    +
    +
    + 206 + +
    +   +
    +
    +
    + 207 + +
    +   + // Mine the tx in a block +
    +
    + 208 + +
    +   + ethBackend.Commit() +
    +
    + 209 + +
    +   +
    +
    +
    + 210 + +
    + - + _, err = etherman.EtrogRollupManager.VerifyBatchesTrustedAggregator(auth, 1, uint64(0), uint64(0), uint64(1), [32]byte{}, [32]byte{}, auth.From, [24][32]byte{}) +
    +
    + 211 + +
    +   + require.NoError(t, err) +
    +
    + 212 + +
    +   +
    +
    +
    + 213 + +
    +   + // Mine the tx in a block +
    +
    +
    @@ -220,7 +229,7 @@
    +
    + 220 + +
    +   + blocks, order, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber) +
    +
    + 221 + +
    +   + require.NoError(t, err) +
    +
    + 222 + +
    +   + t.Logf("Blocks: %+v, \nOrder: %+v", blocks, order) +
    +
    + 223 + +
    + - + assert.Equal(t, uint64(9), blocks[1].BlockNumber) +
    +
    + 224 + +
    +   + assert.Equal(t, uint64(1), blocks[1].VerifiedBatches[0].BatchNumber) +
    +
    + 225 + +
    +   + assert.NotEqual(t, common.Address{}, blocks[1].VerifiedBatches[0].Aggregator) +
    +
    + 226 + +
    +   + assert.NotEqual(t, common.Hash{}, blocks[1].VerifiedBatches[0].TxHash) +
    +
    +
    @@ -232,19 +241,19 @@
    +
    + 232 + +
    +   +
    +
    +
    + 233 + +
    +   + func TestSequenceForceBatchesEvent(t *testing.T) { +
    +
    + 234 + +
    +   + // Set up testing environment +
    +
    + 235 + +
    + - + etherman, ethBackend, auth, _, _ := newTestingEnv() +
    +
    + 236 + +
    +   +
    +
    +
    + 237 + +
    +   + // Read currentBlock +
    +
    + 238 + +
    +   + ctx := context.Background() +
    +
    + 239 + +
    +   + initBlock, err := etherman.EthClient.BlockByNumber(ctx, nil) +
    +
    + 240 + +
    +   + require.NoError(t, err) +
    +
    + 241 + +
    +   +
    +
    +
    + 242 + +
    + - + amount, err := etherman.EtrogRollupManager.GetForcedBatchFee(&bind.CallOpts{Pending: false}) +
    +
    + 243 + +
    +   + require.NoError(t, err) +
    +
    + 244 + +
    +   + rawTxs := "f84901843b9aca00827b0c945fbdb2315678afecb367f032d93f642f64180aa380a46057361d00000000000000000000000000000000000000000000000000000000000000048203e9808073efe1fa2d3e27f26f32208550ea9b0274d49050b816cadab05a771f4275d0242fd5d92b3fb89575c070e6c930587c520ee65a3aa8cfe382fcad20421bf51d621c" +
    +
    + 245 + +
    +   + data, err := hex.DecodeString(rawTxs) +
    +
    + 246 + +
    +   + require.NoError(t, err) +
    +
    + 247 + +
    + - + _, err = etherman.EtrogZkEVM.ForceBatch(auth, data, amount) +
    +
    + 248 + +
    +   + require.NoError(t, err) +
    +
    + 249 + +
    +   + ethBackend.Commit() +
    +
    + 250 + +
    +   + ethBackend.Commit() +
    +
    +
    @@ -266,13 +275,13 @@
    +
    + 266 + +
    +   + prevBlock, err := etherman.EthClient.BlockByNumber(ctx, big.NewInt(0).SetUint64(blocks[0].BlockNumber-1)) +
    +
    + 267 + +
    +   + require.NoError(t, err) +
    +
    + 268 + +
    +   + forcedBlockHashL1 := prevBlock.Hash() +
    +
    + 269 + +
    + - + forceBatchData := etrogpolygonzkevm.PolygonRollupBaseEtrogBatchData{ +
    +
    + 270 + +
    +   + Transactions: blocks[0].ForcedBatches[0].RawTxsData, +
    +
    + 271 + +
    +   + ForcedGlobalExitRoot: forcedGer, +
    +
    + 272 + +
    +   + ForcedTimestamp: forcedTimestamp, +
    +
    + 273 + +
    +   + ForcedBlockHashL1: forcedBlockHashL1, +
    +
    + 274 + +
    +   + } +
    +
    + 275 + +
    + - + _, err = etherman.EtrogZkEVM.SequenceForceBatches(auth, []etrogpolygonzkevm.PolygonRollupBaseEtrogBatchData{forceBatchData}) +
    +
    + 276 + +
    +   + require.NoError(t, err) +
    +
    + 277 + +
    +   + ethBackend.Commit() +
    +
    + 278 + +
    +   +
    +
    +
    +
    @@ -283,7 +292,7 @@
    +
    + 283 + +
    +   + blocks, order, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber) +
    +
    + 284 + +
    +   + require.NoError(t, err) +
    +
    + 285 + +
    +   + t.Logf("Blocks: %+v", blocks) +
    +
    + 286 + +
    + - + assert.Equal(t, uint64(12), blocks[1].BlockNumber) +
    +
    + 287 + +
    +   + assert.Equal(t, uint64(2), blocks[1].SequencedForceBatches[0][0].BatchNumber) +
    +
    + 288 + +
    +   + assert.Equal(t, forcedGer, common.BytesToHash(blocks[1].SequencedForceBatches[0][0].ForcedGlobalExitRoot[:])) +
    +
    + 289 + +
    +   + assert.Equal(t, forcedTimestamp, blocks[1].SequencedForceBatches[0][0].ForcedTimestamp) +
    +
    +
    @@ -293,7 +302,7 @@
    +
    + 293 + +
    +   +
    +
    +
    + 294 + +
    +   + func TestSendSequences(t *testing.T) { +
    +
    + 295 + +
    +   + // Set up testing environment +
    +
    + 296 + +
    + - + etherman, ethBackend, auth, _, br := newTestingEnv() +
    +
    + 297 + +
    +   +
    +
    +
    + 298 + +
    +   + // Read currentBlock +
    +
    + 299 + +
    +   + ctx := context.Background() +
    +
    +
    @@ -315,10 +324,12 @@
    +
    + 315 + +
    +   + BatchL2Data: batchL2Data, +
    +
    + 316 + +
    +   + LastL2BLockTimestamp: time.Now().Unix(), +
    +
    + 317 + +
    +   + } +
    +
    + + +
    +   +
    +
    +
    + 318 + +
    +   + lastL2BlockTStamp := tx1.Time().Unix() +
    +
    + 319 + +
    + - + // TODO: fix params +
    +
    + 320 + +
    + - + tx, err := etherman.sequenceBatches(*auth, []ethmanTypes.Sequence{sequence}, uint64(lastL2BlockTStamp), uint64(1), auth.From) +
    +
    + 321 + +
    +   + require.NoError(t, err) +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 322 + +
    +   + log.Debug("TX: ", tx.Hash()) +
    +
    + 323 + +
    +   + ethBackend.Commit() +
    +
    + 324 + +
    +   +
    +
    +
    +
    @@ -341,7 +352,7 @@
    +
    + 341 + +
    +   +
    +
    +
    + 342 + +
    +   + func TestGasPrice(t *testing.T) { +
    +
    + 343 + +
    +   + // Set up testing environment +
    +
    + 344 + +
    + - + etherman, _, _, _, _ := newTestingEnv() +
    +
    + 345 + +
    +   + etherscanM := new(etherscanMock) +
    +
    + 346 + +
    +   + ethGasStationM := new(ethGasStationMock) +
    +
    + 347 + +
    +   + etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, etherscanM, ethGasStationM} +
    +
    +
    @@ -360,14 +371,14 @@
    +
    + 360 + +
    +   +
    +
    +
    + 361 + +
    +   + func TestErrorEthGasStationPrice(t *testing.T) { +
    +
    + 362 + +
    +   + // Set up testing environment +
    +
    + 363 + +
    + - + etherman, _, _, _, _ := newTestingEnv() +
    +
    + 364 + +
    +   + ethGasStationM := new(ethGasStationMock) +
    +
    + 365 + +
    +   + etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, ethGasStationM} +
    +
    + 366 + +
    +   + ctx := context.Background() +
    +
    + 367 + +
    +   +
    +
    +
    + 368 + +
    +   + ethGasStationM.On("SuggestGasPrice", ctx).Return(big.NewInt(0), fmt.Errorf("error getting gasPrice from ethGasStation")) +
    +
    + 369 + +
    +   + gp := etherman.GetL1GasPrice(ctx) +
    +
    + 370 + +
    + - + assert.Equal(t, big.NewInt(1392695906), gp) +
    +
    + 371 + +
    +   +
    +
    +
    + 372 + +
    +   + etherscanM := new(etherscanMock) +
    +
    + 373 + +
    +   + etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, etherscanM, ethGasStationM} +
    +
    +
    @@ -379,7 +390,7 @@
    +
    + 379 + +
    +   +
    +
    +
    + 380 + +
    +   + func TestErrorEtherScanPrice(t *testing.T) { +
    +
    + 381 + +
    +   + // Set up testing environment +
    +
    + 382 + +
    + - + etherman, _, _, _, _ := newTestingEnv() +
    +
    + 383 + +
    +   + etherscanM := new(etherscanMock) +
    +
    + 384 + +
    +   + ethGasStationM := new(ethGasStationMock) +
    +
    + 385 + +
    +   + etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, etherscanM, ethGasStationM} +
    +
    +
    @@ -393,7 +404,7 @@
    +
    + 393 + +
    +   +
    +
    +
    + 394 + +
    +   + func TestGetForks(t *testing.T) { +
    +
    + 395 + +
    +   + // Set up testing environment +
    +
    + 396 + +
    + - + etherman, _, _, _, _ := newTestingEnv() +
    +
    + 397 + +
    +   + ctx := context.Background() +
    +
    + 398 + +
    +   + forks, err := etherman.GetForks(ctx, 0, 132) +
    +
    + 399 + +
    +   + require.NoError(t, err) +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 38 + +
    +   + } +
    +
    + 39 + +
    +   +
    +
    +
    + 40 + +
    +   + // This function prepare the blockchain, the wallet with funds and deploy the smc +
    +
    + 41 + +
    + + + func newTestingEnv(t *testing.T) (ethman *Client, ethBackend *simulated.Backend, auth *bind.TransactOpts, polAddr common.Address, br *polygonzkevmbridge.Polygonzkevmbridge, da *daMock, st *stateMock) { +
    +
    + 42 + +
    +   + privateKey, err := crypto.GenerateKey() +
    +
    + 43 + +
    +   + if err != nil { +
    +
    + 44 + +
    +   + log.Fatal(err) +
    +
    +
     
    +
    + 47 + +
    +   + if err != nil { +
    +
    + 48 + +
    +   + log.Fatal(err) +
    +
    + 49 + +
    +   + } +
    +
    + 50 + +
    + + + da = newDaMock(t) +
    +
    + 51 + +
    + + + st = newStateMock(t) +
    +
    + 52 + +
    + + + ethman, ethBackend, polAddr, br, err = NewSimulatedEtherman(Config{ForkIDChunkSize: 10}, auth, da, st) +
    +
    + 53 + +
    +   + if err != nil { +
    +
    + 54 + +
    +   + log.Fatal(err) +
    +
    + 55 + +
    +   + } +
    +
    +
     
    +
    + 57 + +
    +   + if err != nil { +
    +
    + 58 + +
    +   + log.Fatal(err) +
    +
    + 59 + +
    +   + } +
    +
    + 60 + +
    + + + return ethman, ethBackend, auth, polAddr, br, da, st +
    +
    + 61 + +
    +   + } +
    +
    + 62 + +
    +   +
    +
    +
    + 63 + +
    +   + func TestGEREvent(t *testing.T) { +
    +
    + 64 + +
    +   + // Set up testing environment +
    +
    + 65 + +
    + + + etherman, ethBackend, auth, _, br, _, _ := newTestingEnv(t) +
    +
    + 66 + +
    +   +
    +
    +
    + 67 + +
    +   + // Read currentBlock +
    +
    + 68 + +
    +   + ctx := context.Background() +
    +
    +
     
    +
    + 84 + +
    +   + blocks, _, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber) +
    +
    + 85 + +
    +   + require.NoError(t, err) +
    +
    + 86 + +
    +   + t.Logf("Blocks: %+v", blocks) +
    +
    + 87 + +
    + + + assert.Equal(t, uint64(11), blocks[0].L1InfoTree[0].BlockNumber) +
    +
    + 88 + +
    +   + assert.NotEqual(t, common.Hash{}, blocks[0].L1InfoTree[0].MainnetExitRoot) +
    +
    + 89 + +
    +   + assert.Equal(t, common.Hash{}, blocks[0].L1InfoTree[0].RollupExitRoot) +
    +
    + 90 + +
    +   + } +
    +
    + 91 + +
    +   +
    +
    +
    + 92 + +
    +   + func TestForcedBatchEvent(t *testing.T) { +
    +
    + 93 + +
    +   + // Set up testing environment +
    +
    + 94 + +
    + + + etherman, ethBackend, auth, _, _, _, _ := newTestingEnv(t) +
    +
    + 95 + +
    +   +
    +
    +
    + 96 + +
    +   + // Read currentBlock +
    +
    + 97 + +
    +   + ctx := context.Background() +
    +
    + 98 + +
    +   + initBlock, err := etherman.EthClient.BlockByNumber(ctx, nil) +
    +
    + 99 + +
    +   + require.NoError(t, err) +
    +
    + 100 + +
    +   +
    +
    +
    + 101 + +
    + + + amount, err := etherman.RollupManager.GetForcedBatchFee(&bind.CallOpts{Pending: false}) +
    +
    + 102 + +
    +   + require.NoError(t, err) +
    +
    + 103 + +
    +   + rawTxs := "f84901843b9aca00827b0c945fbdb2315678afecb367f032d93f642f64180aa380a46057361d00000000000000000000000000000000000000000000000000000000000000048203e9808073efe1fa2d3e27f26f32208550ea9b0274d49050b816cadab05a771f4275d0242fd5d92b3fb89575c070e6c930587c520ee65a3aa8cfe382fcad20421bf51d621c" +
    +
    + 104 + +
    +   + data, err := hex.DecodeString(rawTxs) +
    +
    + 105 + +
    +   + require.NoError(t, err) +
    +
    + 106 + +
    + + + _, err = etherman.ZkEVM.ForceBatch(auth, data, amount) +
    +
    + 107 + +
    +   + require.NoError(t, err) +
    +
    + 108 + +
    +   +
    +
    +
    + 109 + +
    +   + // Mine the tx in a block +
    +
    +
     
    +
    + 116 + +
    +   + blocks, _, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber) +
    +
    + 117 + +
    +   + require.NoError(t, err) +
    +
    + 118 + +
    +   + t.Logf("Blocks: %+v", blocks) +
    +
    + 119 + +
    + + + assert.Equal(t, uint64(11), blocks[0].BlockNumber) +
    +
    + 120 + +
    + + + assert.Equal(t, uint64(11), blocks[0].ForcedBatches[0].BlockNumber) +
    +
    + 121 + +
    +   + assert.NotEqual(t, common.Hash{}, blocks[0].ForcedBatches[0].GlobalExitRoot) +
    +
    + 122 + +
    +   + assert.NotEqual(t, time.Time{}, blocks[0].ForcedBatches[0].ForcedAt) +
    +
    + 123 + +
    +   + assert.Equal(t, uint64(1), blocks[0].ForcedBatches[0].ForcedBatchNumber) +
    +
    +
     
    +
    + 127 + +
    +   +
    +
    +
    + 128 + +
    +   + func TestSequencedBatchesEvent(t *testing.T) { +
    +
    + 129 + +
    +   + // Set up testing environment +
    +
    + 130 + +
    + + + etherman, ethBackend, auth, _, br, da, _ := newTestingEnv(t) +
    +
    + 131 + +
    +   +
    +
    +
    + 132 + +
    +   + // Read currentBlock +
    +
    + 133 + +
    +   + ctx := context.Background() +
    +
    +
     
    +
    + 141 + +
    +   + ethBackend.Commit() +
    +
    + 142 + +
    +   + auth.Value = big.NewInt(0) +
    +
    + 143 + +
    +   +
    +
    +
    + 144 + +
    + + + amount, err := etherman.RollupManager.GetForcedBatchFee(&bind.CallOpts{Pending: false}) +
    +
    + 145 + +
    +   + require.NoError(t, err) +
    +
    + 146 + +
    +   + rawTxs := "f84901843b9aca00827b0c945fbdb2315678afecb367f032d93f642f64180aa380a46057361d00000000000000000000000000000000000000000000000000000000000000048203e9808073efe1fa2d3e27f26f32208550ea9b0274d49050b816cadab05a771f4275d0242fd5d92b3fb89575c070e6c930587c520ee65a3aa8cfe382fcad20421bf51d621c" +
    +
    + 147 + +
    +   + data, err := hex.DecodeString(rawTxs) +
    +
    + 148 + +
    +   + require.NoError(t, err) +
    +
    + 149 + +
    + + + _, err = etherman.ZkEVM.ForceBatch(auth, data, amount) +
    +
    + 150 + +
    +   + require.NoError(t, err) +
    +
    + 151 + +
    +   + require.NoError(t, err) +
    +
    + 152 + +
    +   + ethBackend.Commit() +
    +
    +
     
    +
    + 158 + +
    +   + blocks, _, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &currentBlockNumber) +
    +
    + 159 + +
    +   + require.NoError(t, err) +
    +
    + 160 + +
    +   + t.Log("Blocks: ", blocks) +
    +
    + 161 + +
    + + + var sequences []polygonzkevm.PolygonValidiumEtrogValidiumBatchData +
    +
    + 162 + +
    + + + txsHash := crypto.Keccak256Hash(common.Hex2Bytes(rawTxs)) +
    +
    + 163 + +
    + + + sequences = append(sequences, polygonzkevm.PolygonValidiumEtrogValidiumBatchData{ +
    +
    + 164 + +
    + + + TransactionsHash: txsHash, +
    +
    + 165 + +
    + + + }, polygonzkevm.PolygonValidiumEtrogValidiumBatchData{ +
    +
    + 166 + +
    + + + TransactionsHash: txsHash, +
    +
    + 167 + +
    +   + }) +
    +
    + 168 + +
    + + + batchNums := []uint64{2, 3} +
    +
    + 169 + +
    + + + batchHashes := []common.Hash{txsHash, txsHash} +
    +
    + 170 + +
    + + + batchData := [][]byte{data, data} +
    +
    + 171 + +
    + + + daMessage, _ := hex.DecodeString("0x123456789123456789") +
    +
    + 172 + +
    + + + da.Mock.On("GetBatchL2Data", batchNums, batchHashes, daMessage).Return(batchData, nil) +
    +
    + 173 + +
    + + + _, err = etherman.ZkEVM.SequenceBatchesValidium(auth, sequences, uint64(time.Now().Unix()), uint64(1), auth.From, daMessage) +
    +
    + 174 + +
    +   + require.NoError(t, err) +
    +
    + 175 + +
    +   +
    +
    +
    + 176 + +
    +   + // Mine the tx in a block +
    +
    +
     
    +
    + 196 + +
    +   +
    +
    +
    + 197 + +
    +   + func TestVerifyBatchEvent(t *testing.T) { +
    +
    + 198 + +
    +   + // Set up testing environment +
    +
    + 199 + +
    + + + etherman, ethBackend, auth, _, _, da, _ := newTestingEnv(t) +
    +
    + 200 + +
    +   +
    +
    +
    + 201 + +
    +   + // Read currentBlock +
    +
    + 202 + +
    +   + ctx := context.Background() +
    +
    +
     
    +
    + 205 + +
    +   + require.NoError(t, err) +
    +
    + 206 + +
    +   +
    +
    +
    + 207 + +
    +   + rawTxs := "f84901843b9aca00827b0c945fbdb2315678afecb367f032d93f642f64180aa380a46057361d00000000000000000000000000000000000000000000000000000000000000048203e9808073efe1fa2d3e27f26f32208550ea9b0274d49050b816cadab05a771f4275d0242fd5d92b3fb89575c070e6c930587c520ee65a3aa8cfe382fcad20421bf51d621c" +
    +
    + 208 + +
    + + + tx := polygonzkevm.PolygonValidiumEtrogValidiumBatchData{ +
    +
    + 209 + +
    + + + TransactionsHash: crypto.Keccak256Hash(common.Hex2Bytes(rawTxs)), +
    +
    + 210 + +
    +   + } +
    +
    + 211 + +
    + + + daMessage, _ := hex.DecodeString("0x1234") +
    +
    + 212 + +
    + + + _, err = etherman.ZkEVM.SequenceBatchesValidium(auth, []polygonzkevm.PolygonValidiumEtrogValidiumBatchData{tx}, uint64(time.Now().Unix()), uint64(1), auth.From, daMessage) +
    +
    + 213 + +
    +   + require.NoError(t, err) +
    +
    + 214 + +
    + + + da.Mock.On("GetBatchL2Data", []uint64{2}, []common.Hash{crypto.Keccak256Hash(common.Hex2Bytes(rawTxs))}, daMessage).Return([][]byte{common.Hex2Bytes(rawTxs)}, nil) +
    +
    + 215 + +
    +   +
    +
    +
    + 216 + +
    +   + // Mine the tx in a block +
    +
    + 217 + +
    +   + ethBackend.Commit() +
    +
    + 218 + +
    +   +
    +
    +
    + 219 + +
    + + + _, err = etherman.RollupManager.VerifyBatchesTrustedAggregator(auth, 1, uint64(0), uint64(0), uint64(1), [32]byte{}, [32]byte{}, auth.From, [24][32]byte{}) +
    +
    + 220 + +
    +   + require.NoError(t, err) +
    +
    + 221 + +
    +   +
    +
    +
    + 222 + +
    +   + // Mine the tx in a block +
    +
    +
     
    +
    + 229 + +
    +   + blocks, order, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber) +
    +
    + 230 + +
    +   + require.NoError(t, err) +
    +
    + 231 + +
    +   + t.Logf("Blocks: %+v, \nOrder: %+v", blocks, order) +
    +
    + 232 + +
    + + + assert.Equal(t, uint64(12), blocks[1].BlockNumber) +
    +
    + 233 + +
    +   + assert.Equal(t, uint64(1), blocks[1].VerifiedBatches[0].BatchNumber) +
    +
    + 234 + +
    +   + assert.NotEqual(t, common.Address{}, blocks[1].VerifiedBatches[0].Aggregator) +
    +
    + 235 + +
    +   + assert.NotEqual(t, common.Hash{}, blocks[1].VerifiedBatches[0].TxHash) +
    +
    +
     
    +
    + 241 + +
    +   +
    +
    +
    + 242 + +
    +   + func TestSequenceForceBatchesEvent(t *testing.T) { +
    +
    + 243 + +
    +   + // Set up testing environment +
    +
    + 244 + +
    + + + etherman, ethBackend, auth, _, _, _, _ := newTestingEnv(t) +
    +
    + 245 + +
    +   +
    +
    +
    + 246 + +
    +   + // Read currentBlock +
    +
    + 247 + +
    +   + ctx := context.Background() +
    +
    + 248 + +
    +   + initBlock, err := etherman.EthClient.BlockByNumber(ctx, nil) +
    +
    + 249 + +
    +   + require.NoError(t, err) +
    +
    + 250 + +
    +   +
    +
    +
    + 251 + +
    + + + amount, err := etherman.RollupManager.GetForcedBatchFee(&bind.CallOpts{Pending: false}) +
    +
    + 252 + +
    +   + require.NoError(t, err) +
    +
    + 253 + +
    +   + rawTxs := "f84901843b9aca00827b0c945fbdb2315678afecb367f032d93f642f64180aa380a46057361d00000000000000000000000000000000000000000000000000000000000000048203e9808073efe1fa2d3e27f26f32208550ea9b0274d49050b816cadab05a771f4275d0242fd5d92b3fb89575c070e6c930587c520ee65a3aa8cfe382fcad20421bf51d621c" +
    +
    + 254 + +
    +   + data, err := hex.DecodeString(rawTxs) +
    +
    + 255 + +
    +   + require.NoError(t, err) +
    +
    + 256 + +
    + + + _, err = etherman.ZkEVM.ForceBatch(auth, data, amount) +
    +
    + 257 + +
    +   + require.NoError(t, err) +
    +
    + 258 + +
    +   + ethBackend.Commit() +
    +
    + 259 + +
    +   + ethBackend.Commit() +
    +
    +
     
    +
    + 275 + +
    +   + prevBlock, err := etherman.EthClient.BlockByNumber(ctx, big.NewInt(0).SetUint64(blocks[0].BlockNumber-1)) +
    +
    + 276 + +
    +   + require.NoError(t, err) +
    +
    + 277 + +
    +   + forcedBlockHashL1 := prevBlock.Hash() +
    +
    + 278 + +
    + + + forceBatchData := polygonzkevm.PolygonRollupBaseEtrogBatchData{ +
    +
    + 279 + +
    +   + Transactions: blocks[0].ForcedBatches[0].RawTxsData, +
    +
    + 280 + +
    +   + ForcedGlobalExitRoot: forcedGer, +
    +
    + 281 + +
    +   + ForcedTimestamp: forcedTimestamp, +
    +
    + 282 + +
    +   + ForcedBlockHashL1: forcedBlockHashL1, +
    +
    + 283 + +
    +   + } +
    +
    + 284 + +
    + + + _, err = etherman.ZkEVM.SequenceForceBatches(auth, []polygonzkevm.PolygonRollupBaseEtrogBatchData{forceBatchData}) +
    +
    + 285 + +
    +   + require.NoError(t, err) +
    +
    + 286 + +
    +   + ethBackend.Commit() +
    +
    + 287 + +
    +   +
    +
    +
    +
     
    +
    + 292 + +
    +   + blocks, order, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber) +
    +
    + 293 + +
    +   + require.NoError(t, err) +
    +
    + 294 + +
    +   + t.Logf("Blocks: %+v", blocks) +
    +
    + 295 + +
    + + + assert.Equal(t, uint64(15), blocks[1].BlockNumber) +
    +
    + 296 + +
    +   + assert.Equal(t, uint64(2), blocks[1].SequencedForceBatches[0][0].BatchNumber) +
    +
    + 297 + +
    +   + assert.Equal(t, forcedGer, common.BytesToHash(blocks[1].SequencedForceBatches[0][0].ForcedGlobalExitRoot[:])) +
    +
    + 298 + +
    +   + assert.Equal(t, forcedTimestamp, blocks[1].SequencedForceBatches[0][0].ForcedTimestamp) +
    +
    +
     
    +
    + 302 + +
    +   +
    +
    +
    + 303 + +
    +   + func TestSendSequences(t *testing.T) { +
    +
    + 304 + +
    +   + // Set up testing environment +
    +
    + 305 + +
    + + + etherman, ethBackend, auth, _, br, da, _ := newTestingEnv(t) +
    +
    + 306 + +
    +   +
    +
    +
    + 307 + +
    +   + // Read currentBlock +
    +
    + 308 + +
    +   + ctx := context.Background() +
    +
    +
     
    +
    + 324 + +
    +   + BatchL2Data: batchL2Data, +
    +
    + 325 + +
    +   + LastL2BLockTimestamp: time.Now().Unix(), +
    +
    + 326 + +
    +   + } +
    +
    + 327 + +
    + + + daMessage, _ := hex.DecodeString("0x1234") +
    +
    + 328 + +
    +   + lastL2BlockTStamp := tx1.Time().Unix() +
    +
    + 329 + +
    + + + tx, err := etherman.sequenceBatches(*auth, []ethmanTypes.Sequence{sequence}, uint64(lastL2BlockTStamp), uint64(1), auth.From, daMessage) +
    +
    + + +
    +   +
    +
    +
    + 330 + +
    +   + require.NoError(t, err) +
    +
    + 331 + +
    + + + da.Mock.On("GetBatchL2Data", []uint64{2}, []common.Hash{crypto.Keccak256Hash(batchL2Data)}, daMessage).Return([][]byte{batchL2Data}, nil) +
    +
    + 332 + +
    + + +
    +
    +
    + 333 + +
    +   + log.Debug("TX: ", tx.Hash()) +
    +
    + 334 + +
    +   + ethBackend.Commit() +
    +
    + 335 + +
    +   +
    +
    +
    +
     
    +
    + 352 + +
    +   +
    +
    +
    + 353 + +
    +   + func TestGasPrice(t *testing.T) { +
    +
    + 354 + +
    +   + // Set up testing environment +
    +
    + 355 + +
    + + + etherman, _, _, _, _, _, _ := newTestingEnv(t) +
    +
    + 356 + +
    +   + etherscanM := new(etherscanMock) +
    +
    + 357 + +
    +   + ethGasStationM := new(ethGasStationMock) +
    +
    + 358 + +
    +   + etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, etherscanM, ethGasStationM} +
    +
    +
     
    +
    + 371 + +
    +   +
    +
    +
    + 372 + +
    +   + func TestErrorEthGasStationPrice(t *testing.T) { +
    +
    + 373 + +
    +   + // Set up testing environment +
    +
    + 374 + +
    + + + etherman, _, _, _, _, _, _ := newTestingEnv(t) +
    +
    + 375 + +
    +   + ethGasStationM := new(ethGasStationMock) +
    +
    + 376 + +
    +   + etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, ethGasStationM} +
    +
    + 377 + +
    +   + ctx := context.Background() +
    +
    + 378 + +
    +   +
    +
    +
    + 379 + +
    +   + ethGasStationM.On("SuggestGasPrice", ctx).Return(big.NewInt(0), fmt.Errorf("error getting gasPrice from ethGasStation")) +
    +
    + 380 + +
    +   + gp := etherman.GetL1GasPrice(ctx) +
    +
    + 381 + +
    + + + assert.Equal(t, big.NewInt(1263075579), gp) +
    +
    + 382 + +
    +   +
    +
    +
    + 383 + +
    +   + etherscanM := new(etherscanMock) +
    +
    + 384 + +
    +   + etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, etherscanM, ethGasStationM} +
    +
    +
     
    +
    + 390 + +
    +   +
    +
    +
    + 391 + +
    +   + func TestErrorEtherScanPrice(t *testing.T) { +
    +
    + 392 + +
    +   + // Set up testing environment +
    +
    + 393 + +
    + + + etherman, _, _, _, _, _, _ := newTestingEnv(t) +
    +
    + 394 + +
    +   + etherscanM := new(etherscanMock) +
    +
    + 395 + +
    +   + ethGasStationM := new(ethGasStationMock) +
    +
    + 396 + +
    +   + etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, etherscanM, ethGasStationM} +
    +
    +
     
    +
    + 404 + +
    +   +
    +
    +
    + 405 + +
    +   + func TestGetForks(t *testing.T) { +
    +
    + 406 + +
    +   + // Set up testing environment +
    +
    + 407 + +
    + + + etherman, _, _, _, _, _, _ := newTestingEnv(t) +
    +
    + 408 + +
    +   + ctx := context.Background() +
    +
    + 409 + +
    +   + forks, err := etherman.GetForks(ctx, 0, 132) +
    +
    + 410 + +
    +   + require.NoError(t, err) +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/events_helper.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,191 +0,0 @@
    +
    + 1 + +
    + - + package etherman +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + import ( +
    +
    + 4 + +
    + - + "bytes" +
    +
    + 5 + +
    + - + "context" +
    +
    + 6 + +
    + - + "fmt" +
    +
    + 7 + +
    + - + "math/big" +
    +
    + 8 + +
    + - +
    +
    +
    + 9 + +
    + - + "github.com/ethereum/go-ethereum" +
    +
    + 10 + +
    + - + "github.com/ethereum/go-ethereum/common" +
    +
    + 11 + +
    + - + "github.com/ethereum/go-ethereum/core" +
    +
    + 12 + +
    + - + "github.com/ethereum/go-ethereum/core/types" +
    +
    + 13 + +
    + - + ) +
    +
    + 14 + +
    + - +
    +
    +
    + 15 + +
    + - + // BlockRetriever is the interface required from etherman main object +
    +
    + 16 + +
    + - + type BlockRetriever interface { +
    +
    + 17 + +
    + - + RetrieveFullBlockForEvent(ctx context.Context, vLog types.Log) (*Block, error) +
    +
    + 18 + +
    + - + } +
    +
    + 19 + +
    + - +
    +
    +
    + 20 + +
    + - + // GenericEventProcessor is the interface that a processor must implement +
    +
    + 21 + +
    + - + type GenericEventProcessor interface { +
    +
    + 22 + +
    + - + // EventSignature returns the signature of the event supported +
    +
    + 23 + +
    + - + // evaluate if make sens to support multiples signatures +
    +
    + 24 + +
    + - + EventSignature() common.Hash +
    +
    + 25 + +
    + - + AddEventDataToBlock(ctx context.Context, vLog types.Log, block *Block, callData *CallData) (*Order, error) +
    +
    + 26 + +
    + - + } +
    +
    + 27 + +
    + - +
    +
    +
    + 28 + +
    + - + // CallDataExtractor is the interface required to extract the call data from a transaction +
    +
    + 29 + +
    + - + type CallDataExtractor interface { +
    +
    + 30 + +
    + - + ExtractCallData(ctx context.Context, blockHash, txHash common.Hash, txIndex uint) (*CallData, error) +
    +
    + 31 + +
    + - + } +
    +
    + 32 + +
    + - +
    +
    +
    + 33 + +
    + - + // EventManager is a struct that manages the L1 events +
    +
    + 34 + +
    + - + // The way of using this is create and add Processor +
    +
    + 35 + +
    + - + // A processor only need to code the specific part of adding specific data +
    +
    + 36 + +
    + - + // to the block +
    +
    + 37 + +
    + - + type EventManager struct { +
    +
    + 38 + +
    + - + blockRetriever BlockRetriever +
    +
    + 39 + +
    + - + callDataExtractor CallDataExtractor +
    +
    + 40 + +
    + - +
    +
    +
    + 41 + +
    + - + processors []GenericEventProcessor +
    +
    + 42 + +
    + - + } +
    +
    + 43 + +
    + - +
    +
    +
    + 44 + +
    + - + // NewEventManager creates a new EventManager +
    +
    + 45 + +
    + - + func NewEventManager(blockRetriever BlockRetriever, callDataExtractor CallDataExtractor) *EventManager { +
    +
    + 46 + +
    + - + return &EventManager{ +
    +
    + 47 + +
    + - + blockRetriever: blockRetriever, +
    +
    + 48 + +
    + - + callDataExtractor: callDataExtractor, +
    +
    + 49 + +
    + - + processors: []GenericEventProcessor{}, +
    +
    + 50 + +
    + - + } +
    +
    + 51 + +
    + - + } +
    +
    + 52 + +
    + - +
    +
    +
    + 53 + +
    + - + // AddProcessor adds a new processor to the EventManager +
    +
    + 54 + +
    + - + func (e *EventManager) AddProcessor(processor GenericEventProcessor) { +
    +
    + 55 + +
    + - + e.processors = append(e.processors, processor) +
    +
    + 56 + +
    + - + } +
    +
    + 57 + +
    + - +
    +
    +
    + 58 + +
    + - + // ProcessEvent processes an event +
    +
    + 59 + +
    + - + // this is the interface with etherman +
    +
    + 60 + +
    + - + // it returns true if this event belong to this processor +
    +
    + 61 + +
    + - + func (e *EventManager) ProcessEvent(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) (bool, error) { +
    +
    + 62 + +
    + - + for idx := range e.processors { +
    +
    + 63 + +
    + - + processor := e.processors[idx] +
    +
    + 64 + +
    + - + if len(vLog.Topics) > 0 && vLog.Topics[0] == processor.EventSignature() { +
    +
    + 65 + +
    + - + return true, e.processGenericEvent(ctx, vLog, blocks, blocksOrder, processor) +
    +
    + 66 + +
    + - + } +
    +
    + 67 + +
    + - + } +
    +
    + 68 + +
    + - + return false, nil +
    +
    + 69 + +
    + - + } +
    +
    + 70 + +
    + - +
    +
    +
    + 71 + +
    + - + func (e *EventManager) processGenericEvent(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order, processor GenericEventProcessor) error { +
    +
    + 72 + +
    + - + callData, err := e.callDataExtractor.ExtractCallData(ctx, vLog.BlockHash, vLog.TxHash, vLog.TxIndex) +
    +
    + 73 + +
    + - + if err != nil { +
    +
    + 74 + +
    + - + return err +
    +
    + 75 + +
    + - + } +
    +
    + 76 + +
    + - + block, err := e.addNewBlockToResult(ctx, vLog, blocks, blocksOrder) +
    +
    + 77 + +
    + - + if err != nil { +
    +
    + 78 + +
    + - + return err +
    +
    + 79 + +
    + - + } +
    +
    + 80 + +
    + - + order, err := processor.AddEventDataToBlock(ctx, vLog, block, callData) +
    +
    + 81 + +
    + - + if err != nil { +
    +
    + 82 + +
    + - + return err +
    +
    + 83 + +
    + - + } +
    +
    + 84 + +
    + - + addNewOrder(order, block.BlockHash, blocksOrder) +
    +
    + 85 + +
    + - + return nil +
    +
    + 86 + +
    + - + } +
    +
    + 87 + +
    + - +
    +
    +
    + 88 + +
    + - + func addNewOrder(order *Order, blockHash common.Hash, blocksOrder *map[common.Hash][]Order) { +
    +
    + 89 + +
    + - + (*blocksOrder)[blockHash] = append((*blocksOrder)[blockHash], *order) +
    +
    + 90 + +
    + - + } +
    +
    + 91 + +
    + - +
    +
    +
    + 92 + +
    + - + // addNewEvent adds a new event to the blocks array and order array. +
    +
    + 93 + +
    + - + // it returns the block that must be filled with event data +
    +
    + 94 + +
    + - + func (e *EventManager) addNewBlockToResult(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) (*Block, error) { +
    +
    + 95 + +
    + - + var block *Block +
    +
    + 96 + +
    + - + var err error +
    +
    + 97 + +
    + - + if !isheadBlockInArray(blocks, vLog.BlockHash, vLog.BlockNumber) { +
    +
    + 98 + +
    + - + // Need to add the block, doesnt mind if inside the blocks because I have to respect the order so insert at end +
    +
    + 99 + +
    + - + //TODO: Check if the block is already in the blocks array and copy it instead of retrieve it again +
    +
    + 100 + +
    + - + block, err = e.blockRetriever.RetrieveFullBlockForEvent(ctx, vLog) +
    +
    + 101 + +
    + - + if err != nil { +
    +
    + 102 + +
    + - + return nil, err +
    +
    + 103 + +
    + - + } +
    +
    + 104 + +
    + - + *blocks = append(*blocks, *block) +
    +
    + 105 + +
    + - + } +
    +
    + 106 + +
    + - + block = &(*blocks)[len(*blocks)-1] +
    +
    + 107 + +
    + - + return block, nil +
    +
    + 108 + +
    + - + } +
    +
    + 109 + +
    + - +
    +
    +
    + 110 + +
    + - + // CallData is a struct that contains the calldata of a transaction +
    +
    + 111 + +
    + - + type CallData struct { +
    +
    + 112 + +
    + - + data []byte +
    +
    + 113 + +
    + - + nonce uint64 +
    +
    + 114 + +
    + - + from common.Address +
    +
    + 115 + +
    + - + } +
    +
    + 116 + +
    + - +
    +
    +
    + 117 + +
    + - + // NewCallData creates a new CallData struct +
    +
    + 118 + +
    + - + func NewCallData(data []byte, nonce uint64, from common.Address) *CallData { +
    +
    + 119 + +
    + - + return &CallData{ +
    +
    + 120 + +
    + - + data: data, +
    +
    + 121 + +
    + - + nonce: nonce, +
    +
    + 122 + +
    + - + from: from, +
    +
    + 123 + +
    + - + } +
    +
    + 124 + +
    + - + } +
    +
    + 125 + +
    + - +
    +
    +
    + 126 + +
    + - + // MethodID returns the method ID of the transaction +
    +
    + 127 + +
    + - + func (c *CallData) MethodID() []byte { +
    +
    + 128 + +
    + - + return c.data[:4] +
    +
    + 129 + +
    + - + } +
    +
    + 130 + +
    + - +
    +
    +
    + 131 + +
    + - + // InputData returns the input data of the transaction +
    +
    + 132 + +
    + - + func (c *CallData) InputData() []byte { +
    +
    + 133 + +
    + - + return c.data[4:] +
    +
    + 134 + +
    + - + } +
    +
    + 135 + +
    + - +
    +
    +
    + 136 + +
    + - + // Nonce returns the nonce of the transaction +
    +
    + 137 + +
    + - + func (c *CallData) Nonce() uint64 { +
    +
    + 138 + +
    + - + return c.nonce +
    +
    + 139 + +
    + - + } +
    +
    + 140 + +
    + - +
    +
    +
    + 141 + +
    + - + // From returns the address of the sender of the transaction +
    +
    + 142 + +
    + - + func (c *CallData) From() common.Address { +
    +
    + 143 + +
    + - + return c.from +
    +
    + 144 + +
    + - + } +
    +
    + 145 + +
    + - +
    +
    +
    + 146 + +
    + - + // CallDataExtratorGeth is a CallDataExtractor based on Geth +
    +
    + 147 + +
    + - + type CallDataExtratorGeth struct { +
    +
    + 148 + +
    + - + ethClient ethereum.ChainReader +
    +
    + 149 + +
    + - + } +
    +
    + 150 + +
    + - +
    +
    +
    + 151 + +
    + - + // NewCallDataExtratorGeth creates a new CallDataExtrator based on Geth +
    +
    + 152 + +
    + - + func NewCallDataExtratorGeth(ethClient ethereum.ChainReader) *CallDataExtratorGeth { +
    +
    + 153 + +
    + - + return &CallDataExtratorGeth{ +
    +
    + 154 + +
    + - + ethClient: ethClient, +
    +
    + 155 + +
    + - + } +
    +
    + 156 + +
    + - + } +
    +
    + 157 + +
    + - +
    +
    +
    + 158 + +
    + - + // ExtractCallData get the call data from a transaction +
    +
    + 159 + +
    + - + func (e *CallDataExtratorGeth) ExtractCallData(ctx context.Context, blockHash, txHash common.Hash, txIndex uint) (*CallData, error) { +
    +
    + 160 + +
    + - + // Read the tx for this event. +
    +
    + 161 + +
    + - + tx, err := e.ethClient.TransactionInBlock(ctx, blockHash, txIndex) +
    +
    + 162 + +
    + - + if err != nil { +
    +
    + 163 + +
    + - + return nil, err +
    +
    + 164 + +
    + - + } +
    +
    + 165 + +
    + - + if tx == nil { +
    +
    + 166 + +
    + - + return nil, fmt.Errorf("error: tx not found in block %s at index %d", blockHash.String(), txIndex) +
    +
    + 167 + +
    + - + } +
    +
    + 168 + +
    + - + //log.Debug("tx: ", tx2string(tx)) +
    +
    + 169 + +
    + - + if tx.Hash() != txHash { +
    +
    + 170 + +
    + - + return nil, fmt.Errorf("error: tx hash mismatch. want: %s have: %s", txHash, tx.Hash().String()) +
    +
    + 171 + +
    + - + } +
    +
    + 172 + +
    + - + msg, err := core.TransactionToMessage(tx, types.NewLondonSigner(tx.ChainId()), big.NewInt(0)) +
    +
    + 173 + +
    + - + if err != nil { +
    +
    + 174 + +
    + - + return nil, err +
    +
    + 175 + +
    + - + } +
    +
    + 176 + +
    + - + return &CallData{ +
    +
    + 177 + +
    + - + data: tx.Data(), +
    +
    + 178 + +
    + - + nonce: msg.Nonce, +
    +
    + 179 + +
    + - + from: msg.From, +
    +
    + 180 + +
    + - + }, nil +
    +
    + 181 + +
    + - + } +
    +
    + 182 + +
    + - +
    +
    +
    + 183 + +
    + - + // Function used to convert a transaction to a string to used as input data for unittest +
    +
    + 184 + +
    + - + func tx2string(tx *types.Transaction) string { //nolint:unused +
    +
    + 185 + +
    + - + writer := new(bytes.Buffer) +
    +
    + 186 + +
    + - + err := tx.EncodeRLP(writer) +
    +
    + 187 + +
    + - + if err != nil { +
    +
    + 188 + +
    + - + return "error:" + err.Error() +
    +
    + 189 + +
    + - + } +
    +
    + 190 + +
    + - + return common.Bytes2Hex(writer.Bytes()) +
    +
    + 191 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/events_helper_test.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,180 +0,0 @@
    +
    + 1 + +
    + - + package etherman_test +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + import ( +
    +
    + 4 + +
    + - + "bytes" +
    +
    + 5 + +
    + - + "context" +
    +
    + 6 + +
    + - + "fmt" +
    +
    + 7 + +
    + - + "math/big" +
    +
    + 8 + +
    + - + "testing" +
    +
    + 9 + +
    + - +
    +
    +
    + 10 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/etherman" +
    +
    + 11 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/etherman/mockseth" +
    +
    + 12 + +
    + - + "github.com/ethereum/go-ethereum/common" +
    +
    + 13 + +
    + - + "github.com/ethereum/go-ethereum/core/types" +
    +
    + 14 + +
    + - + "github.com/ethereum/go-ethereum/rlp" +
    +
    + 15 + +
    + - + "github.com/stretchr/testify/mock" +
    +
    + 16 + +
    + - + "github.com/stretchr/testify/require" +
    +
    + 17 + +
    + - + ) +
    +
    + 18 + +
    + - +
    +
    +
    + 19 + +
    + - + type EventManagerTestData struct { +
    +
    + 20 + +
    + - + mockBlockRetiever *mockseth.BlockRetriever +
    +
    + 21 + +
    + - +
    +
    +
    + 22 + +
    + - + mockProcessor *mockseth.GenericEventProcessor +
    +
    + 23 + +
    + - + mockCallDataExtractor *mockseth.CallDataExtractor +
    +
    + 24 + +
    + - + sut *etherman.EventManager +
    +
    + 25 + +
    + - + ctx context.Context +
    +
    + 26 + +
    + - + } +
    +
    + 27 + +
    + - +
    +
    +
    + 28 + +
    + - + func NewEventManagerTestData(t *testing.T) *EventManagerTestData { +
    +
    + 29 + +
    + - + mockBlockRetriever := mockseth.NewBlockRetriever(t) +
    +
    + 30 + +
    + - + mockCallDataExtractor := mockseth.NewCallDataExtractor(t) +
    +
    + 31 + +
    + - + return &EventManagerTestData{ +
    +
    + 32 + +
    + - + mockBlockRetiever: mockBlockRetriever, +
    +
    + 33 + +
    + - + mockCallDataExtractor: mockCallDataExtractor, +
    +
    + 34 + +
    + - + mockProcessor: mockseth.NewGenericEventProcessor(t), +
    +
    + 35 + +
    + - + sut: etherman.NewEventManager(mockBlockRetriever, mockCallDataExtractor), +
    +
    + 36 + +
    + - + ctx: context.TODO(), +
    +
    + 37 + +
    + - + } +
    +
    + 38 + +
    + - + } +
    +
    + 39 + +
    + - +
    +
    +
    + 40 + +
    + - + func TestEventManagerNoEventToProcess(t *testing.T) { +
    +
    + 41 + +
    + - + data := NewEventManagerTestData(t) +
    +
    + 42 + +
    + - + vLog := types.Log{} +
    +
    + 43 + +
    + - +
    +
    +
    + 44 + +
    + - + processed, err := data.sut.ProcessEvent(context.TODO(), vLog, nil, nil) +
    +
    + 45 + +
    + - + require.False(t, processed) +
    +
    + 46 + +
    + - + require.NoError(t, err) +
    +
    + 47 + +
    + - + } +
    +
    + 48 + +
    + - +
    +
    +
    + 49 + +
    + - + func TestEventManagerEventToProcessHappyPathIntegratedWithSequenceBlobs(t *testing.T) { +
    +
    + 50 + +
    + - + data := NewEventManagerTestData(t) +
    +
    + 51 + +
    + - + mockChainReader := etherman.NewChainReaderMock(t) +
    +
    + 52 + +
    + - + data.sut = etherman.NewEventManager(data.mockBlockRetiever, etherman.NewCallDataExtratorGeth(mockChainReader)) +
    +
    + 53 + +
    + - + contracts, err := etherman.NewFeijoaContracts(nil, etherman.L1Config{}) +
    +
    + 54 + +
    + - + require.NoError(t, err) +
    +
    + 55 + +
    + - + processor := etherman.NewEventFeijoaSequenceBlobsProcessor(contracts) +
    +
    + 56 + +
    + - + data.sut.AddProcessor(processor) +
    +
    + 57 + +
    + - + block := etherman.Block{ +
    +
    + 58 + +
    + - + BlockHash: common.HexToHash("0x1"), +
    +
    + 59 + +
    + - + BlockNumber: 1234, +
    +
    + 60 + +
    + - + } +
    +
    + 61 + +
    + - +
    +
    +
    + 62 + +
    + - + tx := txExample() +
    +
    + 63 + +
    + - + vLog := types.Log{ +
    +
    + 64 + +
    + - + Topics: []common.Hash{processor.EventSignature(), +
    +
    + 65 + +
    + - + common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000074")}, +
    +
    + 66 + +
    + - + BlockNumber: block.BlockNumber, +
    +
    + 67 + +
    + - + BlockHash: block.BlockHash, +
    +
    + 68 + +
    + - + TxHash: tx.Hash(), +
    +
    + 69 + +
    + - + } +
    +
    + 70 + +
    + - + blocks := []etherman.Block{} +
    +
    + 71 + +
    + - +
    +
    +
    + 72 + +
    + - + data.mockBlockRetiever.EXPECT().RetrieveFullBlockForEvent(data.ctx, vLog).Return(&block, nil).Once() +
    +
    + 73 + +
    + - + mockChainReader.EXPECT().TransactionInBlock(data.ctx, block.BlockHash, uint(0)).Return(tx, nil).Once() +
    +
    + 74 + +
    + - + blocksOrder := map[common.Hash][]etherman.Order{} +
    +
    + 75 + +
    + - +
    +
    +
    + 76 + +
    + - + processed, err := data.sut.ProcessEvent(data.ctx, vLog, &blocks, &blocksOrder) +
    +
    + 77 + +
    + - +
    +
    +
    + 78 + +
    + - + require.True(t, processed) +
    +
    + 79 + +
    + - + require.NoError(t, err) +
    +
    + 80 + +
    + - + } +
    +
    + 81 + +
    + - +
    +
    +
    + 82 + +
    + - + func TestEventManagerEventToProcessHappyPath(t *testing.T) { +
    +
    + 83 + +
    + - + data := NewEventManagerTestData(t) +
    +
    + 84 + +
    + - + block := etherman.Block{ +
    +
    + 85 + +
    + - + BlockHash: common.HexToHash("0x1"), +
    +
    + 86 + +
    + - + BlockNumber: 1234, +
    +
    + 87 + +
    + - + } +
    +
    + 88 + +
    + - + eventSignature := common.HexToHash("0x2") +
    +
    + 89 + +
    + - + tx := txExample() +
    +
    + 90 + +
    + - + vLog := types.Log{ +
    +
    + 91 + +
    + - + Topics: []common.Hash{eventSignature}, +
    +
    + 92 + +
    + - + BlockNumber: block.BlockNumber, +
    +
    + 93 + +
    + - + BlockHash: block.BlockHash, +
    +
    + 94 + +
    + - + TxHash: tx.Hash(), +
    +
    + 95 + +
    + - + } +
    +
    + 96 + +
    + - + blocks := []etherman.Block{} +
    +
    + 97 + +
    + - + data.mockProcessor.EXPECT().EventSignature().Return(eventSignature).Once() +
    +
    + 98 + +
    + - +
    +
    +
    + 99 + +
    + - + data.mockBlockRetiever.EXPECT().RetrieveFullBlockForEvent(data.ctx, vLog).Return(&block, nil).Once() +
    +
    + 100 + +
    + - + data.mockCallDataExtractor.EXPECT().ExtractCallData(data.ctx, block.BlockHash, tx.Hash(), uint(0)).Return(&etherman.CallData{}, nil) +
    +
    + 101 + +
    + - + data.mockProcessor.EXPECT().AddEventDataToBlock(data.ctx, vLog, &block, mock.Anything).Return(&etherman.Order{}, nil).Once() +
    +
    + 102 + +
    + - + data.sut.AddProcessor(data.mockProcessor) +
    +
    + 103 + +
    + - +
    +
    +
    + 104 + +
    + - + blocksOrder := map[common.Hash][]etherman.Order{} +
    +
    + 105 + +
    + - +
    +
    +
    + 106 + +
    + - + processed, err := data.sut.ProcessEvent(data.ctx, vLog, &blocks, &blocksOrder) +
    +
    + 107 + +
    + - +
    +
    +
    + 108 + +
    + - + require.True(t, processed) +
    +
    + 109 + +
    + - + require.NoError(t, err) +
    +
    + 110 + +
    + - + } +
    +
    + 111 + +
    + - +
    +
    +
    + 112 + +
    + - + func TestCallDataExtractorExtarctCallDataHappyPath(t *testing.T) { +
    +
    + 113 + +
    + - + mockChainRetriever := etherman.NewChainReaderMock(t) +
    +
    + 114 + +
    + - + blockHash := common.HexToHash("0x1") +
    +
    + 115 + +
    + - + indexTx := uint(12) +
    +
    + 116 + +
    + - + tx := txExample() +
    +
    + 117 + +
    + - + mockChainRetriever.EXPECT().TransactionInBlock(context.TODO(), blockHash, indexTx).Return(tx, nil).Once() +
    +
    + 118 + +
    + - + callDataExtractor := etherman.NewCallDataExtratorGeth(mockChainRetriever) +
    +
    + 119 + +
    + - + _, err := callDataExtractor.ExtractCallData(context.TODO(), blockHash, tx.Hash(), indexTx) +
    +
    + 120 + +
    + - + require.NoError(t, err) +
    +
    + 121 + +
    + - + } +
    +
    + 122 + +
    + - +
    +
    +
    + 123 + +
    + - + func TestCallDataExtractorExtarctCallDataTransactionInBlockReturnsErr(t *testing.T) { +
    +
    + 124 + +
    + - + mockChainRetriever := etherman.NewChainReaderMock(t) +
    +
    + 125 + +
    + - + blockHash := common.HexToHash("0x1") +
    +
    + 126 + +
    + - + indexTx := uint(12) +
    +
    + 127 + +
    + - + errReturned := fmt.Errorf("mock error") +
    +
    + 128 + +
    + - + mockChainRetriever.EXPECT().TransactionInBlock(context.TODO(), blockHash, indexTx).Return(nil, errReturned).Once() +
    +
    + 129 + +
    + - + callDataExtractor := etherman.NewCallDataExtratorGeth(mockChainRetriever) +
    +
    + 130 + +
    + - + _, err := callDataExtractor.ExtractCallData(context.TODO(), blockHash, common.Hash{}, indexTx) +
    +
    + 131 + +
    + - + require.ErrorIs(t, err, errReturned) +
    +
    + 132 + +
    + - + } +
    +
    + 133 + +
    + - +
    +
    +
    + 134 + +
    + - + func TestCallDataExtractorExtarctCallDataTransactionInBlockReturnsNilTx(t *testing.T) { +
    +
    + 135 + +
    + - + mockChainRetriever := etherman.NewChainReaderMock(t) +
    +
    + 136 + +
    + - + blockHash := common.HexToHash("0x1") +
    +
    + 137 + +
    + - + indexTx := uint(12) +
    +
    + 138 + +
    + - +
    +
    +
    + 139 + +
    + - + mockChainRetriever.EXPECT().TransactionInBlock(context.TODO(), blockHash, indexTx).Return(nil, nil).Once() +
    +
    + 140 + +
    + - + callDataExtractor := etherman.NewCallDataExtratorGeth(mockChainRetriever) +
    +
    + 141 + +
    + - + _, err := callDataExtractor.ExtractCallData(context.TODO(), blockHash, common.Hash{}, indexTx) +
    +
    + 142 + +
    + - + require.Error(t, err) +
    +
    + 143 + +
    + - + } +
    +
    + 144 + +
    + - +
    +
    +
    + 145 + +
    + - + func TestCallDataExtractorExtarctCallDataTransactionInBlockReturnTxHashNotMatch(t *testing.T) { +
    +
    + 146 + +
    + - + mockChainRetriever := etherman.NewChainReaderMock(t) +
    +
    + 147 + +
    + - + blockHash := common.HexToHash("0x1") +
    +
    + 148 + +
    + - + indexTx := uint(12) +
    +
    + 149 + +
    + - + tx := types.NewTransaction(0, common.Address{}, big.NewInt(0), 0, big.NewInt(0), nil) +
    +
    + 150 + +
    + - + mockChainRetriever.EXPECT().TransactionInBlock(context.TODO(), blockHash, indexTx).Return(tx, nil).Once() +
    +
    + 151 + +
    + - + callDataExtractor := etherman.NewCallDataExtratorGeth(mockChainRetriever) +
    +
    + 152 + +
    + - + _, err := callDataExtractor.ExtractCallData(context.TODO(), blockHash, common.Hash{}, indexTx) +
    +
    + 153 + +
    + - + require.Error(t, err) +
    +
    + 154 + +
    + - + } +
    +
    + 155 + +
    + - +
    +
    +
    + 156 + +
    + - + func TestCallDataExtractorExtarctCallDataWrongTxData(t *testing.T) { +
    +
    + 157 + +
    + - + mockChainRetriever := etherman.NewChainReaderMock(t) +
    +
    + 158 + +
    + - + blockHash := common.HexToHash("0x1") +
    +
    + 159 + +
    + - + indexTx := uint(12) +
    +
    + 160 + +
    + - + tx := types.NewTransaction(0, common.Address{}, big.NewInt(0), 0, big.NewInt(0), nil) +
    +
    + 161 + +
    + - + mockChainRetriever.EXPECT().TransactionInBlock(context.TODO(), blockHash, indexTx).Return(tx, nil).Once() +
    +
    + 162 + +
    + - + callDataExtractor := etherman.NewCallDataExtratorGeth(mockChainRetriever) +
    +
    + 163 + +
    + - + _, err := callDataExtractor.ExtractCallData(context.TODO(), blockHash, tx.Hash(), indexTx) +
    +
    + 164 + +
    + - + require.Error(t, err) +
    +
    + 165 + +
    + - + } +
    +
    + 166 + +
    + - +
    +
    +
    + 167 + +
    + - + func txExample() *types.Transaction { +
    +
    + 168 + +
    + - + var tx types.Transaction +
    +
    + 169 + +
    + - + reader := bytes.NewBuffer(common.Hex2Bytes(txExampleRLP)) +
    +
    + 170 + +
    + - + stream := rlp.NewStream(reader, 0) +
    +
    + 171 + +
    + - + err := tx.DecodeRLP(stream) +
    +
    + 172 + +
    + - + if err != nil { +
    +
    + 173 + +
    + - + panic(err) +
    +
    + 174 + +
    + - + } +
    +
    + 175 + +
    + - + return &tx +
    +
    + 176 + +
    + - + } +
    +
    + 177 + +
    + - +
    +
    +
    + 178 + +
    + - + const ( +
    +
    + 179 + +
    + - + txExampleRLP = "fa01cc3181c28501699d83808310360194d23c761025306cf5038d74feeb077cf66de134da80ba01cbc438793b4f00000000000000000000000000000000000000000000000000000000000000600000000000000000000000006c50a878df81d7e49424968dfac5e1409bccb68fde08efdeb2225f233039b7f5fa2bb0dc95bcf9c884b2f388092e3db6ff3484770000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000001cac00000000000000000000000000000000000000000000000000000000065f3006b00000000000000000000000000000000000000000000000000000001836e210000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000001ca1a000001ca15000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007110b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b0000000300000000000007080b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000b00000003000000000000000000008401546d72a04a4304c05e4033d414115b3ad1f652e9da459614f84e7ac2eec2ed6c07660023a013aa534e2b3544baadeb9b82b368d3587b50495086318f0d8289f77912180d18" +
    +
    + 180 + +
    + - + ) +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/feijoa_contracts.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,38 +0,0 @@
    +
    + 1 + +
    + - + package etherman +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + import ( +
    +
    + 4 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/feijoapolygonzkevm" +
    +
    + 5 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/log" +
    +
    + 6 + +
    + - + "github.com/ethereum/go-ethereum/accounts/abi/bind" +
    +
    + 7 + +
    + - + "github.com/ethereum/go-ethereum/common" +
    +
    + 8 + +
    + - + ) +
    +
    + 9 + +
    + - +
    +
    +
    + 10 + +
    + - + // FeijoaContracts represents the contracts of the Feijoa upgrade +
    +
    + 11 + +
    + - + type FeijoaContracts struct { +
    +
    + 12 + +
    + - + FeijoaZKEVMAddress common.Address +
    +
    + 13 + +
    + - + FeijoaZKEVM *feijoapolygonzkevm.Feijoapolygonzkevm +
    +
    + 14 + +
    + - + //FeijoaRollupManager *feijoapolygonrollupmanager.Feijoapolygonrollupmanager +
    +
    + 15 + +
    + - + //FeijoaGlobalExitRootManager *feijoapolygonzkevmglobalexitroot.Feijoapolygonzkevmglobalexitroot +
    +
    + 16 + +
    + - + } +
    +
    + 17 + +
    + - +
    +
    +
    + 18 + +
    + - + // NewFeijoaContracts creates a new FeijoaContracts +
    +
    + 19 + +
    + - + func NewFeijoaContracts(ethClient bind.ContractBackend, l1Config L1Config) (*FeijoaContracts, error) { +
    +
    + 20 + +
    + - + FeijoaZKEVMAddress := l1Config.ZkEVMAddr +
    +
    + 21 + +
    + - + FeijoaZKEVM, err := feijoapolygonzkevm.NewFeijoapolygonzkevm(FeijoaZKEVMAddress, ethClient) +
    +
    + 22 + +
    + - + if err != nil { +
    +
    + 23 + +
    + - + log.Errorf("error creating FeijoaZKEVM client (addr: %s). Error: %w", FeijoaZKEVMAddress.String(), err) +
    +
    + 24 + +
    + - + return nil, err +
    +
    + 25 + +
    + - + } +
    +
    + 26 + +
    + - +
    +
    +
    + 27 + +
    + - + return &FeijoaContracts{ +
    +
    + 28 + +
    + - + FeijoaZKEVMAddress: FeijoaZKEVMAddress, +
    +
    + 29 + +
    + - + FeijoaZKEVM: FeijoaZKEVM, +
    +
    + 30 + +
    + - + }, nil +
    +
    + 31 + +
    + - + } +
    +
    + 32 + +
    + - +
    +
    +
    + 33 + +
    + - + // GetAddresses returns the addresses of the contracts +
    +
    + 34 + +
    + - + func (f *FeijoaContracts) GetAddresses() []common.Address { +
    +
    + 35 + +
    + - + return []common.Address{ +
    +
    + 36 + +
    + - + f.FeijoaZKEVMAddress, +
    +
    + 37 + +
    + - + } +
    +
    + 38 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/feijoa_event_sequence_blobs.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,173 +0,0 @@
    +
    + 1 + +
    + - + package etherman +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + import ( +
    +
    + 4 + +
    + - + "context" +
    +
    + 5 + +
    + - + "encoding/json" +
    +
    + 6 + +
    + - + "fmt" +
    +
    + 7 + +
    + - + "strings" +
    +
    + 8 + +
    + - +
    +
    +
    + 9 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/feijoapolygonzkevm" +
    +
    + 10 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/log" +
    +
    + 11 + +
    + - + "github.com/ethereum/go-ethereum/accounts/abi" +
    +
    + 12 + +
    + - + "github.com/ethereum/go-ethereum/common" +
    +
    + 13 + +
    + - + "github.com/ethereum/go-ethereum/core/types" +
    +
    + 14 + +
    + - + "github.com/ethereum/go-ethereum/crypto" +
    +
    + 15 + +
    + - + ) +
    +
    + 16 + +
    + - +
    +
    +
    + 17 + +
    + - + const ( +
    +
    + 18 + +
    + - + // SequenceBlobsOrder identifies a SequenceBlobs order +
    +
    + 19 + +
    + - + SequenceBlobsOrder EventOrder = "SequenceBlobs" +
    +
    + 20 + +
    + - + ) +
    +
    + 21 + +
    + - +
    +
    +
    + 22 + +
    + - + var ( +
    +
    + 23 + +
    + - + // Events Feijoa Signatures +
    +
    + 24 + +
    + - + // Events new ZkEvm/RollupBase +
    +
    + 25 + +
    + - + // lastBlobSequenced is the count of blob sequenced after process this event +
    +
    + 26 + +
    + - + // if the first event have 1 blob -> lastBlobSequenced=1 +
    +
    + 27 + +
    + - + eventSequenceBlobsSignatureHash = crypto.Keccak256Hash([]byte("SequenceBlobs(uint64)")) +
    +
    + 28 + +
    + - + ) +
    +
    + 29 + +
    + - +
    +
    +
    + 30 + +
    + - + // EventFeijoaSequenceBlobsProcessor is the processor for event SequenceBlobs(uint64) +
    +
    + 31 + +
    + - + type EventFeijoaSequenceBlobsProcessor struct { +
    +
    + 32 + +
    + - + contracts *FeijoaContracts +
    +
    + 33 + +
    + - + } +
    +
    + 34 + +
    + - +
    +
    +
    + 35 + +
    + - + // NewEventFeijoaSequenceBlobsProcessor creates a new EventFeijoaSequenceBlobsProcessor +
    +
    + 36 + +
    + - + func NewEventFeijoaSequenceBlobsProcessor(contracts *FeijoaContracts) *EventFeijoaSequenceBlobsProcessor { +
    +
    + 37 + +
    + - + return &EventFeijoaSequenceBlobsProcessor{ +
    +
    + 38 + +
    + - + contracts: contracts, +
    +
    + 39 + +
    + - + } +
    +
    + 40 + +
    + - + } +
    +
    + 41 + +
    + - +
    +
    +
    + 42 + +
    + - + // EventSignature returns the event signature supported +
    +
    + 43 + +
    + - + func (e *EventFeijoaSequenceBlobsProcessor) EventSignature() common.Hash { +
    +
    + 44 + +
    + - + return eventSequenceBlobsSignatureHash +
    +
    + 45 + +
    + - + } +
    +
    + 46 + +
    + - +
    +
    +
    + 47 + +
    + - + // AddEventDataToBlock adds the event data to the block and returns the Order +
    +
    + 48 + +
    + - + func (e *EventFeijoaSequenceBlobsProcessor) AddEventDataToBlock(ctx context.Context, vLog types.Log, block *Block, callData *CallData) (*Order, error) { +
    +
    + 49 + +
    + - + //err := contract.UnpackLog(&event, "SequenceBlobs", vLog.Data) +
    +
    + 50 + +
    + - + eventData, err := e.contracts.FeijoaZKEVM.ParseSequenceBlobs(vLog) +
    +
    + 51 + +
    + - + if err != nil { +
    +
    + 52 + +
    + - + return nil, err +
    +
    + 53 + +
    + - + } +
    +
    + 54 + +
    + - + for idx := range vLog.Topics { +
    +
    + 55 + +
    + - + log.Debugf("vlog.Topics[%d]: %s ", idx, vLog.Topics[idx].Hex()) +
    +
    + 56 + +
    + - + } +
    +
    + 57 + +
    + - + log.Debugf("LastBlobSequenced: %d", eventData.LastBlobSequenced) +
    +
    + 58 + +
    + - + // decode Data +
    +
    + 59 + +
    + - + inputData, err := e.parseCallData(callData) +
    +
    + 60 + +
    + - + if err != nil { +
    +
    + 61 + +
    + - + return nil, err +
    +
    + 62 + +
    + - + } +
    +
    + 63 + +
    + - + inputData.EventData = &SequenceBlobsEventData{ +
    +
    + 64 + +
    + - + LastBlobSequenced: eventData.LastBlobSequenced, +
    +
    + 65 + +
    + - + } +
    +
    + 66 + +
    + - +
    +
    +
    + 67 + +
    + - + if inputData.thereIsAnyBlobType() { +
    +
    + 68 + +
    + - + // TODO:Retrieve blobs +
    +
    + 69 + +
    + - + return nil, fmt.Errorf("data-availability in blobs: not supported yet") +
    +
    + 70 + +
    + - + } +
    +
    + 71 + +
    + - + // Add the blobs to the block list +
    +
    + 72 + +
    + - + block.SequenceBlobs = append(block.SequenceBlobs, *inputData) +
    +
    + 73 + +
    + - + order := Order{ +
    +
    + 74 + +
    + - + Name: SequenceBatchesOrder, +
    +
    + 75 + +
    + - + Pos: len(block.SequenceBlobs) - 1, +
    +
    + 76 + +
    + - + } +
    +
    + 77 + +
    + - +
    +
    +
    + 78 + +
    + - + return &order, nil +
    +
    + 79 + +
    + - + // Extract Calldata +
    +
    + 80 + +
    + - + } +
    +
    + 81 + +
    + - +
    +
    +
    + 82 + +
    + - + func (e *EventFeijoaSequenceBlobsProcessor) parseCallData(callData *CallData) (*SequenceBlobs, error) { +
    +
    + 83 + +
    + - + //smcAbi, err := abi.JSON(strings.NewReader(etrogpolygonzkevm.EtrogpolygonzkevmABI)) +
    +
    + 84 + +
    + - + smcAbi, err := abi.JSON(strings.NewReader(feijoapolygonzkevm.FeijoapolygonzkevmABI)) +
    +
    + 85 + +
    + - + if err != nil { +
    +
    + 86 + +
    + - + return nil, err +
    +
    + 87 + +
    + - + } +
    +
    + 88 + +
    + - + method, err := smcAbi.MethodById(callData.MethodID()) +
    +
    + 89 + +
    + - + if err != nil { +
    +
    + 90 + +
    + - + return nil, err +
    +
    + 91 + +
    + - + } +
    +
    + 92 + +
    + - + // Unpack method inputs +
    +
    + 93 + +
    + - + data, err := method.Inputs.Unpack(callData.InputData()) +
    +
    + 94 + +
    + - + if err != nil { +
    +
    + 95 + +
    + - + return nil, err +
    +
    + 96 + +
    + - + } +
    +
    + 97 + +
    + - + bytedata, err := json.Marshal(data[0]) +
    +
    + 98 + +
    + - + if err != nil { +
    +
    + 99 + +
    + - + return nil, err +
    +
    + 100 + +
    + - + } +
    +
    + 101 + +
    + - + // Solidity: function sequenceBlobs((uint8,bytes)[] blobsRaw, address l2Coinbase, bytes32 finalAccInputHash) returns() +
    +
    + 102 + +
    + - + var blobsRaw []feijoapolygonzkevm.PolygonRollupBaseFeijoaBlobData +
    +
    + 103 + +
    + - + err = json.Unmarshal(bytedata, &blobsRaw) +
    +
    + 104 + +
    + - + if err != nil { +
    +
    + 105 + +
    + - + return nil, err +
    +
    + 106 + +
    + - + } +
    +
    + 107 + +
    + - + blobs := make([]SequenceBlob, 0) +
    +
    + 108 + +
    + - +
    +
    +
    + 109 + +
    + - + for i := range blobsRaw { +
    +
    + 110 + +
    + - + //log.Debugf("BlobType: %d", blobs[i].BlobType) +
    +
    + 111 + +
    + - + var blobBlobTypeParams *BlobBlobTypeParams +
    +
    + 112 + +
    + - + var blobTypeParams *BlobCommonParams +
    +
    + 113 + +
    + - + var txData []byte +
    +
    + 114 + +
    + - + switch BlobType(blobsRaw[i].BlobType) { +
    +
    + 115 + +
    + - + case TypeCallData: +
    +
    + 116 + +
    + - + blobTypeParams, txData, err = parseBlobCallDataTypeParams(blobsRaw[i].BlobTypeParams) +
    +
    + 117 + +
    + - + if err != nil { +
    +
    + 118 + +
    + - + return nil, err +
    +
    + 119 + +
    + - + } +
    +
    + 120 + +
    + - + case TypeBlobTransaction: +
    +
    + 121 + +
    + - + return nil, fmt.Errorf("blobType 'BlobTransaction' not supported yet") +
    +
    + 122 + +
    + - + default: +
    +
    + 123 + +
    + - + return nil, fmt.Errorf("blobType not supported") +
    +
    + 124 + +
    + - + } +
    +
    + 125 + +
    + - + blobs = append(blobs, SequenceBlob{ +
    +
    + 126 + +
    + - + Type: BlobType(blobsRaw[i].BlobType), +
    +
    + 127 + +
    + - + Params: *blobTypeParams, +
    +
    + 128 + +
    + - + Data: txData, +
    +
    + 129 + +
    + - + BlobBlobTypeParams: blobBlobTypeParams, +
    +
    + 130 + +
    + - + }) +
    +
    + 131 + +
    + - + } +
    +
    + 132 + +
    + - + l1CoinBase := (data[1]).(common.Address) +
    +
    + 133 + +
    + - + finalAccInputHashRaw := (data[2]).([32]byte) +
    +
    + 134 + +
    + - + finalAccInputHash := common.Hash(finalAccInputHashRaw) +
    +
    + 135 + +
    + - +
    +
    +
    + 136 + +
    + - + return &SequenceBlobs{ +
    +
    + 137 + +
    + - + Blobs: blobs, +
    +
    + 138 + +
    + - + L2Coinbase: l1CoinBase, +
    +
    + 139 + +
    + - + FinalAccInputHash: finalAccInputHash, +
    +
    + 140 + +
    + - + }, nil +
    +
    + 141 + +
    + - + } +
    +
    + 142 + +
    + - +
    +
    +
    + 143 + +
    + - + // returns data and the transtaction_data +
    +
    + 144 + +
    + - + func parseBlobCallDataTypeParams(data []byte) (*BlobCommonParams, []byte, error) { +
    +
    + 145 + +
    + - + // https://github.com/0xPolygonHermez/zkevm-contracts/blob/feature/feijoa/contracts/v2/lib/PolygonRollupBaseFeijoa.sol +
    +
    + 146 + +
    + - + // case: if (currentBlob.blobType == CALLDATA_BLOB_TYPE) +
    +
    + 147 + +
    + - + // +
    +
    + 148 + +
    + - + // maxSequenceTimestamp uint64 +
    +
    + 149 + +
    + - + // zkGasLimit uint64 +
    +
    + 150 + +
    + - + // l1InfoLeafIndex uint32 +
    +
    + 151 + +
    + - + // transactions []byte +
    +
    + 152 + +
    + - +
    +
    +
    + 153 + +
    + - + // Prepare blob params using ABI encoder +
    +
    + 154 + +
    + - + uint64Ty, _ := abi.NewType("uint64", "", nil) +
    +
    + 155 + +
    + - + uint32Ty, _ := abi.NewType("uint32", "", nil) +
    +
    + 156 + +
    + - + bytesTy, _ := abi.NewType("bytes", "", nil) +
    +
    + 157 + +
    + - + arguments := abi.Arguments{ +
    +
    + 158 + +
    + - + {Type: uint64Ty}, +
    +
    + 159 + +
    + - + {Type: uint64Ty}, +
    +
    + 160 + +
    + - + {Type: uint32Ty}, +
    +
    + 161 + +
    + - + {Type: bytesTy}, +
    +
    + 162 + +
    + - + } +
    +
    + 163 + +
    + - + unpacked, err := arguments.Unpack(data) +
    +
    + 164 + +
    + - + if err != nil { +
    +
    + 165 + +
    + - + return nil, nil, err +
    +
    + 166 + +
    + - + } +
    +
    + 167 + +
    + - + result := &BlobCommonParams{} +
    +
    + 168 + +
    + - + result.MaxSequenceTimestamp = unpacked[0].(uint64) +
    +
    + 169 + +
    + - + result.ZkGasLimit = unpacked[1].(uint64) +
    +
    + 170 + +
    + - + result.L1InfoLeafIndex = unpacked[2].(uint32) +
    +
    + 171 + +
    + - + transactionData := unpacked[3].([]byte) +
    +
    + 172 + +
    + - + return result, transactionData, nil +
    +
    + 173 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/feijoa_events.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,76 +0,0 @@
    +
    + 1 + +
    + - + package etherman +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + import ( +
    +
    + 4 + +
    + - + "fmt" +
    +
    + 5 + +
    + - + "math/big" +
    +
    + 6 + +
    + - +
    +
    +
    + 7 + +
    + - + "github.com/ethereum/go-ethereum/common" +
    +
    + 8 + +
    + - + "github.com/ethereum/go-ethereum/crypto/kzg4844" +
    +
    + 9 + +
    + - + ) +
    +
    + 10 + +
    + - +
    +
    +
    + 11 + +
    + - + // BlobType is the type of the blob type +
    +
    + 12 + +
    + - + type BlobType uint8 +
    +
    + 13 + +
    + - +
    +
    +
    + 14 + +
    + - + const ( +
    +
    + 15 + +
    + - + // TypeCallData The data is stored on call data directly +
    +
    + 16 + +
    + - + TypeCallData BlobType = 0 +
    +
    + 17 + +
    + - + // TypeBlobTransaction The data is stored on a blob +
    +
    + 18 + +
    + - + TypeBlobTransaction BlobType = 1 +
    +
    + 19 + +
    + - + // TypeForcedBlob The data is a forced Blob +
    +
    + 20 + +
    + - + TypeForcedBlob BlobType = 2 +
    +
    + 21 + +
    + - + ) +
    +
    + 22 + +
    + - +
    +
    +
    + 23 + +
    + - + // SequenceBlob is for each Blob inside a SequenceBlobs +
    +
    + 24 + +
    + - + type SequenceBlob struct { +
    +
    + 25 + +
    + - + Type BlobType +
    +
    + 26 + +
    + - + Params BlobCommonParams +
    +
    + 27 + +
    + - + Data []byte +
    +
    + 28 + +
    + - + // Field only valid if BlobType == BlobTransaction +
    +
    + 29 + +
    + - + BlobBlobTypeParams *BlobBlobTypeParams +
    +
    + 30 + +
    + - + } +
    +
    + 31 + +
    + - +
    +
    +
    + 32 + +
    + - + func (s *SequenceBlob) String() string { +
    +
    + 33 + +
    + - + return fmt.Sprintf("Type: %d, Params: %v, Data: %v, BlobBlobTypeParams: %v", s.Type, s.Params, s.Data, s.BlobBlobTypeParams) +
    +
    + 34 + +
    + - + } +
    +
    + 35 + +
    + - +
    +
    +
    + 36 + +
    + - + // BlobCommonParams is the data for a SequenceBlob +
    +
    + 37 + +
    + - + type BlobCommonParams struct { +
    +
    + 38 + +
    + - + MaxSequenceTimestamp uint64 +
    +
    + 39 + +
    + - + ZkGasLimit uint64 +
    +
    + 40 + +
    + - + L1InfoLeafIndex uint32 +
    +
    + 41 + +
    + - + } +
    +
    + 42 + +
    + - +
    +
    +
    + 43 + +
    + - + // BlobBlobTypeParams is the data for a SequenceBlob stored on a Blob +
    +
    + 44 + +
    + - + // case: if (currentBlob.blobType ==> BLOBTX_BLOB_TYPE) +
    +
    + 45 + +
    + - + // sames as calldata plus BlobIndex, ... +
    +
    + 46 + +
    + - + type BlobBlobTypeParams struct { +
    +
    + 47 + +
    + - + BlobIndex *big.Int +
    +
    + 48 + +
    + - + Z []byte +
    +
    + 49 + +
    + - + Y []byte +
    +
    + 50 + +
    + - + Commitment kzg4844.Commitment +
    +
    + 51 + +
    + - + Proof kzg4844.Proof +
    +
    + 52 + +
    + - + } +
    +
    + 53 + +
    + - +
    +
    +
    + 54 + +
    + - + // SequenceBlobs is the data in the event SequenceBlobs +
    +
    + 55 + +
    + - + type SequenceBlobs struct { +
    +
    + 56 + +
    + - + Blobs []SequenceBlob +
    +
    + 57 + +
    + - + L2Coinbase common.Address // from Calldata +
    +
    + 58 + +
    + - + FinalAccInputHash common.Hash +
    +
    + 59 + +
    + - + EventData *SequenceBlobsEventData +
    +
    + 60 + +
    + - + } +
    +
    + 61 + +
    + - +
    +
    +
    + 62 + +
    + - + // SequenceBlobsEventData is the data in the event SequenceBlobs +
    +
    + 63 + +
    + - + type SequenceBlobsEventData struct { +
    +
    + 64 + +
    + - + // LastBlobSequenced is the count of blob sequenced after process this event +
    +
    + 65 + +
    + - + // if the first event have 1 blob -> lastBlobSequenced=1 +
    +
    + 66 + +
    + - + LastBlobSequenced uint64 +
    +
    + 67 + +
    + - + } +
    +
    + 68 + +
    + - +
    +
    +
    + 69 + +
    + - + func (s *SequenceBlobs) thereIsAnyBlobType() bool { +
    +
    + 70 + +
    + - + for blobIndex := range s.Blobs { +
    +
    + 71 + +
    + - + if s.Blobs[blobIndex].Type == TypeBlobTransaction { +
    +
    + 72 + +
    + - + return true +
    +
    + 73 + +
    + - + } +
    +
    + 74 + +
    + - + } +
    +
    + 75 + +
    + - + return false +
    +
    + 76 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/feijoa_events_test.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,17 +0,0 @@
    +
    + 1 + +
    + - + package etherman +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + import ( +
    +
    + 4 + +
    + - + "testing" +
    +
    + 5 + +
    + - +
    +
    +
    + 6 + +
    + - + "github.com/stretchr/testify/require" +
    +
    + 7 + +
    + - + ) +
    +
    + 8 + +
    + - +
    +
    +
    + 9 + +
    + - + func TestXxx(t *testing.T) { +
    +
    + 10 + +
    + - + _, err := NewFeijoaContracts(nil, L1Config{}) +
    +
    + 11 + +
    + - + require.NoError(t, err) +
    +
    + 12 + +
    + - + } +
    +
    + 13 + +
    + - +
    +
    +
    + 14 + +
    + - + func TestFeijoaEventsSignature(t *testing.T) { +
    +
    + 15 + +
    + - + // Signature extracted from https://sepolia.etherscan.io/tx/0x644699c839d34a61c531d7ecf12390bf38c06a62715ca4edce978b9213ce3cd1#eventlog +
    +
    + 16 + +
    + - + require.Equal(t, "0x470f4ca4b003755c839b80ab00c3efbeb69d6eafec00e1a3677482933ec1fd0c", eventSequenceBlobsSignatureHash.String()) +
    +
    + 17 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/interfaces.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -0,0 +1,16 @@
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 1 + +
    + + + package etherman +
    +
    + 2 + +
    + + +
    +
    +
    + 3 + +
    + + + import ( +
    +
    + 4 + +
    + + + "context" +
    +
    + 5 + +
    + + +
    +
    +
    + 6 + +
    + + + "github.com/ethereum/go-ethereum/common" +
    +
    + 7 + +
    + + + "github.com/jackc/pgx/v4" +
    +
    + 8 + +
    + + + ) +
    +
    + 9 + +
    + + +
    +
    +
    + 10 + +
    + + + type dataAvailabilityProvider interface { +
    +
    + 11 + +
    + + + GetBatchL2Data(batchNum []uint64, hash []common.Hash, dataAvailabilityMessage []byte) ([][]byte, error) +
    +
    + 12 + +
    + + + } +
    +
    + 13 + +
    + + +
    +
    +
    + 14 + +
    + + + type stateProvider interface { +
    +
    + 15 + +
    + + + GetForcedBatchDataByNumbers(ctx context.Context, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error) +
    +
    + 16 + +
    + + + } +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/simulated.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -5,25 +5,26 @@
    +
    + 5 + +
    +   + "fmt" +
    +
    + 6 + +
    +   + "math/big" +
    +
    + 7 + +
    +   +
    +
    +
    + 8 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/etrogpolygonrollupmanager" +
    +
    + 9 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/etrogpolygonzkevm" +
    +
    + 10 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/etrogpolygonzkevmbridge" +
    +
    + 11 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/etrogpolygonzkevmglobalexitroot" +
    +
    + 12 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/mocketrogpolygonrollupmanager" +
    +
    + 13 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/mockverifier" +
    +
    + 14 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/pol" +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 15 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/proxy" +
    +
    + 16 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/log" +
    +
    + 17 + +
    +   + "github.com/ethereum/go-ethereum/accounts/abi/bind" +
    +
    + 18 + +
    +   + "github.com/ethereum/go-ethereum/common" +
    +
    + 19 + +
    + - + "github.com/ethereum/go-ethereum/core/types" +
    +
    + 20 + +
    +   + "github.com/ethereum/go-ethereum/crypto" +
    +
    + 21 + +
    +   + "github.com/ethereum/go-ethereum/ethclient/simulated" +
    +
    + 22 + +
    +   + ) +
    +
    + 23 + +
    +   +
    +
    +
    + 24 + +
    +   + // NewSimulatedEtherman creates an etherman that uses a simulated blockchain. It's important to notice that the ChainID of the auth +
    +
    + 25 + +
    +   + // must be 1337. The address that holds the auth will have an initial balance of 10 ETH +
    +
    + 26 + +
    + - + func NewSimulatedEtherman(cfg Config, auth *bind.TransactOpts) (*Client, *simulated.Backend, common.Address, *etrogpolygonzkevmbridge.Etrogpolygonzkevmbridge, error) { +
    +
    + 27 + +
    +   + if auth == nil { +
    +
    + 28 + +
    +   + // read only client +
    +
    + 29 + +
    +   + return &Client{}, nil, common.Address{}, nil, nil +
    +
    +
    @@ -31,14 +32,32 @@
    +
    + 31 + +
    +   + // 10000000 ETH in wei +
    +
    + 32 + +
    +   + balance, _ := new(big.Int).SetString("10000000000000000000000000", 10) //nolint:gomnd +
    +
    + 33 + +
    +   + address := auth.From +
    +
    + 34 + +
    + - + genesisAlloc := map[common.Address]types.Account{ +
    +
    + 35 + +
    +   + address: { +
    +
    + 36 + +
    +   + Balance: balance, +
    +
    + 37 + +
    +   + }, +
    +
    + 38 + +
    +   + } +
    +
    + 39 + +
    +   + blockGasLimit := uint64(999999999999999999) //nolint:gomnd +
    +
    + + +
    +   +
    +
    +
    + 40 + +
    +   + client := simulated.NewBackend(genesisAlloc, simulated.WithBlockGasLimit(blockGasLimit)) +
    +
    + 41 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 42 + +
    +   + // Deploy contracts +
    +
    + 43 + +
    +   + const polDecimalPlaces = 18 +
    +
    + 44 + +
    +   + totalSupply, _ := new(big.Int).SetString("10000000000000000000000000000", 10) //nolint:gomnd +
    +
    +
    @@ -61,18 +80,18 @@
    +
    + 61 + +
    +   + const posRollupManager = 4 +
    +
    + 62 + +
    +   + calculatedRollupManagerAddr := crypto.CreateAddress(auth.From, nonce+posRollupManager) +
    +
    + 63 + +
    +   + genesis := common.HexToHash("0xfd3434cd8f67e59d73488a2b8da242dd1f02849ea5dd99f0ca22c836c3d5b4a9") // Random value. Needs to be different to 0x0 +
    +
    + 64 + +
    + - + exitManagerAddr, _, globalExitRoot, err := etrogpolygonzkevmglobalexitroot.DeployEtrogpolygonzkevmglobalexitroot(auth, client.Client(), calculatedRollupManagerAddr, calculatedBridgeAddr) +
    +
    + 65 + +
    +   + if err != nil { +
    +
    + 66 + +
    +   + log.Error("error: ", err) +
    +
    + 67 + +
    +   + return nil, nil, common.Address{}, nil, err +
    +
    + 68 + +
    +   + } +
    +
    + 69 + +
    + - + implementationBridgeAddr, _, _, err := etrogpolygonzkevmbridge.DeployEtrogpolygonzkevmbridge(auth, client.Client()) +
    +
    + 70 + +
    +   + if err != nil { +
    +
    + 71 + +
    +   + log.Error("error: ", err) +
    +
    + 72 + +
    +   + return nil, nil, common.Address{}, nil, err +
    +
    + 73 + +
    +   + } +
    +
    + 74 + +
    +   +
    +
    +
    + 75 + +
    + - + implementationMockRollupManagerAddr, _, _, err := mocketrogpolygonrollupmanager.DeployMocketrogpolygonrollupmanager(auth, client.Client(), exitManagerAddr, polAddr, calculatedBridgeAddr) +
    +
    + 76 + +
    +   + if err != nil { +
    +
    + 77 + +
    +   + log.Error("error: ", err) +
    +
    + 78 + +
    +   + return nil, nil, common.Address{}, nil, err +
    +
    +
    @@ -92,17 +111,17 @@
    +
    + 92 + +
    +   + return nil, nil, common.Address{}, nil, fmt.Errorf("RollupManagerAddr (%s) is different from the expected contract address (%s)", +
    +
    + 93 + +
    +   + mockRollupManagerAddr.String(), calculatedRollupManagerAddr.String()) +
    +
    + 94 + +
    +   + } +
    +
    + 95 + +
    + - + initZkevmAddr, _, _, err := etrogpolygonzkevm.DeployEtrogpolygonzkevm(auth, client.Client(), exitManagerAddr, polAddr, bridgeAddr, mockRollupManagerAddr) +
    +
    + 96 + +
    +   + if err != nil { +
    +
    + 97 + +
    +   + log.Error("error: ", err) +
    +
    + 98 + +
    +   + return nil, nil, common.Address{}, nil, err +
    +
    + 99 + +
    +   + } +
    +
    + 100 + +
    + - + mockRollupManager, err := mocketrogpolygonrollupmanager.NewMocketrogpolygonrollupmanager(mockRollupManagerAddr, client.Client()) +
    +
    + 101 + +
    +   + if err != nil { +
    +
    + 102 + +
    +   + log.Error("error: ", err) +
    +
    + 103 + +
    +   + return nil, nil, common.Address{}, nil, err +
    +
    + 104 + +
    +   + } +
    +
    + 105 + +
    + - + br, err := etrogpolygonzkevmbridge.NewEtrogpolygonzkevmbridge(bridgeAddr, client.Client()) +
    +
    + 106 + +
    +   + if err != nil { +
    +
    + 107 + +
    +   + log.Error("error: ", err) +
    +
    + 108 + +
    +   + return nil, nil, common.Address{}, nil, err +
    +
    +
    @@ -157,13 +176,13 @@
    +
    + 157 + +
    +   + bridgeAddr.String(), calculatedBridgeAddr.String()) +
    +
    + 158 + +
    +   + } +
    +
    + 159 + +
    +   +
    +
    +
    + 160 + +
    + - + rollupManager, err := etrogpolygonrollupmanager.NewEtrogpolygonrollupmanager(mockRollupManagerAddr, client.Client()) +
    +
    + 161 + +
    +   + if err != nil { +
    +
    + 162 + +
    +   + log.Error("error: ", err) +
    +
    + 163 + +
    +   + return nil, nil, common.Address{}, nil, err +
    +
    + 164 + +
    +   + } +
    +
    + 165 + +
    +   +
    +
    +
    + 166 + +
    + - + trueZkevm, err := etrogpolygonzkevm.NewEtrogpolygonzkevm(zkevmAddr, client.Client()) //nolint +
    +
    + 167 + +
    +   + if err != nil { +
    +
    + 168 + +
    +   + log.Error("error: ", err) +
    +
    + 169 + +
    +   + return nil, nil, common.Address{}, nil, err +
    +
    +
    @@ -182,6 +201,11 @@
    +
    + 182 + +
    +   + return nil, nil, common.Address{}, nil, err +
    +
    + 183 + +
    +   + } +
    +
    + 184 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 185 + +
    +   + _, err = trueZkevm.SetForceBatchAddress(auth, common.Address{}) +
    +
    + 186 + +
    +   + if err != nil { +
    +
    + 187 + +
    +   + log.Error("error: ", err) +
    +
    +
    @@ -190,15 +214,17 @@
    +
    + 190 + +
    +   + client.Commit() +
    +
    + 191 + +
    +   +
    +
    +
    + 192 + +
    +   + c := &Client{ +
    +
    + 193 + +
    + - + EthClient: client.Client(), +
    +
    + 194 + +
    + - + EtrogZkEVM: trueZkevm, +
    +
    + 195 + +
    + - + EtrogRollupManager: rollupManager, +
    +
    + 196 + +
    + - + Pol: polContract, +
    +
    + 197 + +
    + - + EtrogGlobalExitRootManager: globalExitRoot, +
    +
    + 198 + +
    + - + RollupID: rollupID, +
    +
    + 199 + +
    + - + SCAddresses: []common.Address{zkevmAddr, mockRollupManagerAddr, exitManagerAddr}, +
    +
    + 200 + +
    + - + auth: map[common.Address]bind.TransactOpts{}, +
    +
    + 201 + +
    + - + cfg: cfg, +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 202 + +
    +   + } +
    +
    + 203 + +
    +   + err = c.AddOrReplaceAuth(*auth) +
    +
    + 204 + +
    +   + if err != nil { +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 5 + +
    +   + "fmt" +
    +
    + 6 + +
    +   + "math/big" +
    +
    + 7 + +
    +   +
    +
    +
    + 8 + +
    + + + "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/mockpolygonrollupmanager" +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 9 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/mockverifier" +
    +
    + 10 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/pol" +
    +
    + 11 + +
    + + + "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/polygondatacommittee" +
    +
    + 12 + +
    + + + "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/polygonrollupmanager" +
    +
    + 13 + +
    + + + "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/polygonzkevm" +
    +
    + 14 + +
    + + + "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/polygonzkevmbridge" +
    +
    + 15 + +
    + + + "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/polygonzkevmglobalexitroot" +
    +
    + 16 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/proxy" +
    +
    + 17 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/log" +
    +
    + 18 + +
    +   + "github.com/ethereum/go-ethereum/accounts/abi/bind" +
    +
    + 19 + +
    +   + "github.com/ethereum/go-ethereum/common" +
    +
    + 20 + +
    + + + "github.com/ethereum/go-ethereum/core" +
    +
    + 21 + +
    +   + "github.com/ethereum/go-ethereum/crypto" +
    +
    + 22 + +
    +   + "github.com/ethereum/go-ethereum/ethclient/simulated" +
    +
    + 23 + +
    +   + ) +
    +
    + 24 + +
    +   +
    +
    +
    + 25 + +
    +   + // NewSimulatedEtherman creates an etherman that uses a simulated blockchain. It's important to notice that the ChainID of the auth +
    +
    + 26 + +
    +   + // must be 1337. The address that holds the auth will have an initial balance of 10 ETH +
    +
    + 27 + +
    + + + func NewSimulatedEtherman(cfg Config, auth *bind.TransactOpts, daBackend dataAvailabilityProvider, st stateProvider) (etherman *Client, ethBackend *simulated.Backend, polAddr common.Address, br *polygonzkevmbridge.Polygonzkevmbridge, err error) { +
    +
    + 28 + +
    +   + if auth == nil { +
    +
    + 29 + +
    +   + // read only client +
    +
    + 30 + +
    +   + return &Client{}, nil, common.Address{}, nil, nil +
    +
    +
     
    +
    + 32 + +
    +   + // 10000000 ETH in wei +
    +
    + 33 + +
    +   + balance, _ := new(big.Int).SetString("10000000000000000000000000", 10) //nolint:gomnd +
    +
    + 34 + +
    +   + address := auth.From +
    +
    + 35 + +
    + + + genesisAlloc := map[common.Address]core.GenesisAccount{ +
    +
    + 36 + +
    +   + address: { +
    +
    + 37 + +
    +   + Balance: balance, +
    +
    + 38 + +
    +   + }, +
    +
    + 39 + +
    +   + } +
    +
    + 40 + +
    +   + blockGasLimit := uint64(999999999999999999) //nolint:gomnd +
    +
    + 41 + +
    + + + // client := simulated.NewBackend(genesisAlloc, simulated.WithBlockGasLimit(blockGasLimit)) +
    +
    + 42 + +
    +   + client := simulated.NewBackend(genesisAlloc, simulated.WithBlockGasLimit(blockGasLimit)) +
    +
    + 43 + +
    +   +
    +
    +
    + 44 + +
    + + + // DAC Setup +
    +
    + 45 + +
    + + + daAddr, _, da, err := polygondatacommittee.DeployPolygondatacommittee(auth, client.Client()) +
    +
    + 46 + +
    + + + if err != nil { +
    +
    + 47 + +
    + + + return nil, nil, common.Address{}, nil, err +
    +
    + 48 + +
    + + + } +
    +
    + 49 + +
    + + + client.Commit() +
    +
    + 50 + +
    + + + _, err = da.Initialize(auth) +
    +
    + 51 + +
    + + + if err != nil { +
    +
    + 52 + +
    + + + return nil, nil, common.Address{}, nil, err +
    +
    + 53 + +
    + + + } +
    +
    + 54 + +
    + + + client.Commit() +
    +
    + 55 + +
    + + + _, err = da.SetupCommittee(auth, big.NewInt(0), []string{}, []byte{}) +
    +
    + 56 + +
    + + + if err != nil { +
    +
    + 57 + +
    + + + return nil, nil, common.Address{}, nil, err +
    +
    + 58 + +
    + + + } +
    +
    + 59 + +
    + + + client.Commit() +
    +
    + 60 + +
    + + +
    +
    +
    + 61 + +
    +   + // Deploy contracts +
    +
    + 62 + +
    +   + const polDecimalPlaces = 18 +
    +
    + 63 + +
    +   + totalSupply, _ := new(big.Int).SetString("10000000000000000000000000000", 10) //nolint:gomnd +
    +
    +
     
    +
    + 80 + +
    +   + const posRollupManager = 4 +
    +
    + 81 + +
    +   + calculatedRollupManagerAddr := crypto.CreateAddress(auth.From, nonce+posRollupManager) +
    +
    + 82 + +
    +   + genesis := common.HexToHash("0xfd3434cd8f67e59d73488a2b8da242dd1f02849ea5dd99f0ca22c836c3d5b4a9") // Random value. Needs to be different to 0x0 +
    +
    + 83 + +
    + + + exitManagerAddr, _, globalExitRoot, err := polygonzkevmglobalexitroot.DeployPolygonzkevmglobalexitroot(auth, client.Client(), calculatedRollupManagerAddr, calculatedBridgeAddr) +
    +
    + 84 + +
    +   + if err != nil { +
    +
    + 85 + +
    +   + log.Error("error: ", err) +
    +
    + 86 + +
    +   + return nil, nil, common.Address{}, nil, err +
    +
    + 87 + +
    +   + } +
    +
    + 88 + +
    + + + implementationBridgeAddr, _, _, err := polygonzkevmbridge.DeployPolygonzkevmbridge(auth, client.Client()) +
    +
    + 89 + +
    +   + if err != nil { +
    +
    + 90 + +
    +   + log.Error("error: ", err) +
    +
    + 91 + +
    +   + return nil, nil, common.Address{}, nil, err +
    +
    + 92 + +
    +   + } +
    +
    + 93 + +
    +   +
    +
    +
    + 94 + +
    + + + implementationMockRollupManagerAddr, _, _, err := mockpolygonrollupmanager.DeployMockpolygonrollupmanager(auth, client.Client(), exitManagerAddr, polAddr, calculatedBridgeAddr) +
    +
    + 95 + +
    +   + if err != nil { +
    +
    + 96 + +
    +   + log.Error("error: ", err) +
    +
    + 97 + +
    +   + return nil, nil, common.Address{}, nil, err +
    +
    +
     
    +
    + 111 + +
    +   + return nil, nil, common.Address{}, nil, fmt.Errorf("RollupManagerAddr (%s) is different from the expected contract address (%s)", +
    +
    + 112 + +
    +   + mockRollupManagerAddr.String(), calculatedRollupManagerAddr.String()) +
    +
    + 113 + +
    +   + } +
    +
    + 114 + +
    + + + initZkevmAddr, _, _, err := polygonzkevm.DeployPolygonzkevm(auth, client.Client(), exitManagerAddr, polAddr, bridgeAddr, mockRollupManagerAddr) +
    +
    + 115 + +
    +   + if err != nil { +
    +
    + 116 + +
    +   + log.Error("error: ", err) +
    +
    + 117 + +
    +   + return nil, nil, common.Address{}, nil, err +
    +
    + 118 + +
    +   + } +
    +
    + 119 + +
    + + + mockRollupManager, err := mockpolygonrollupmanager.NewMockpolygonrollupmanager(mockRollupManagerAddr, client.Client()) +
    +
    + 120 + +
    +   + if err != nil { +
    +
    + 121 + +
    +   + log.Error("error: ", err) +
    +
    + 122 + +
    +   + return nil, nil, common.Address{}, nil, err +
    +
    + 123 + +
    +   + } +
    +
    + 124 + +
    + + + br, err = polygonzkevmbridge.NewPolygonzkevmbridge(bridgeAddr, client.Client()) +
    +
    + 125 + +
    +   + if err != nil { +
    +
    + 126 + +
    +   + log.Error("error: ", err) +
    +
    + 127 + +
    +   + return nil, nil, common.Address{}, nil, err +
    +
    +
     
    +
    + 176 + +
    +   + bridgeAddr.String(), calculatedBridgeAddr.String()) +
    +
    + 177 + +
    +   + } +
    +
    + 178 + +
    +   +
    +
    +
    + 179 + +
    + + + rollupManager, err := polygonrollupmanager.NewPolygonrollupmanager(mockRollupManagerAddr, client.Client()) +
    +
    + 180 + +
    +   + if err != nil { +
    +
    + 181 + +
    +   + log.Error("error: ", err) +
    +
    + 182 + +
    +   + return nil, nil, common.Address{}, nil, err +
    +
    + 183 + +
    +   + } +
    +
    + 184 + +
    +   +
    +
    +
    + 185 + +
    + + + trueZkevm, err := polygonzkevm.NewPolygonzkevm(zkevmAddr, client.Client()) //nolint +
    +
    + 186 + +
    +   + if err != nil { +
    +
    + 187 + +
    +   + log.Error("error: ", err) +
    +
    + 188 + +
    +   + return nil, nil, common.Address{}, nil, err +
    +
    +
     
    +
    + 201 + +
    +   + return nil, nil, common.Address{}, nil, err +
    +
    + 202 + +
    +   + } +
    +
    + 203 + +
    +   +
    +
    +
    + 204 + +
    + + + _, err = trueZkevm.SetDataAvailabilityProtocol(auth, daAddr) +
    +
    + 205 + +
    + + + if err != nil { +
    +
    + 206 + +
    + + + log.Error("error: ", err) +
    +
    + 207 + +
    + + + return nil, nil, common.Address{}, nil, err +
    +
    + 208 + +
    + + + } +
    +
    + 209 + +
    +   + _, err = trueZkevm.SetForceBatchAddress(auth, common.Address{}) +
    +
    + 210 + +
    +   + if err != nil { +
    +
    + 211 + +
    +   + log.Error("error: ", err) +
    +
    +
     
    +
    + 214 + +
    +   + client.Commit() +
    +
    + 215 + +
    +   +
    +
    +
    + 216 + +
    +   + c := &Client{ +
    +
    + 217 + +
    + + + EthClient: client.Client(), +
    +
    + 218 + +
    + + + ZkEVM: trueZkevm, +
    +
    + 219 + +
    + + + RollupManager: rollupManager, +
    +
    + 220 + +
    + + + Pol: polContract, +
    +
    + 221 + +
    + + + GlobalExitRootManager: globalExitRoot, +
    +
    + 222 + +
    + + + RollupID: rollupID, +
    +
    + 223 + +
    + + + SCAddresses: []common.Address{zkevmAddr, mockRollupManagerAddr, exitManagerAddr}, +
    +
    + 224 + +
    + + + auth: map[common.Address]bind.TransactOpts{}, +
    +
    + 225 + +
    + + + cfg: cfg, +
    +
    + 226 + +
    + + + da: daBackend, +
    +
    + 227 + +
    + + + state: st, +
    +
    + 228 + +
    +   + } +
    +
    + 229 + +
    +   + err = c.AddOrReplaceAuth(*auth) +
    +
    + 230 + +
    +   + if err != nil { +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/types.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -19,7 +19,6 @@
    +
    + 19 + +
    +   + VerifiedBatches []VerifiedBatch +
    +
    + 20 + +
    +   + SequencedForceBatches [][]SequencedForceBatch +
    +
    + 21 + +
    +   + ForkIDs []ForkID +
    +
    + 22 + +
    + - + SequenceBlobs []SequenceBlobs +
    +
    + 23 + +
    +   + ReceivedAt time.Time +
    +
    + 24 + +
    +   + // GER data +
    +
    + 25 + +
    +   + GlobalExitRoots, L1InfoTree []GlobalExitRoot +
    +
    +
    @@ -50,9 +49,9 @@
    +
    + 50 + +
    +   + Nonce uint64 +
    +
    + 51 + +
    +   + Coinbase common.Address +
    +
    + 52 + +
    +   + // Struct used in preEtrog forks +
    +
    + 53 + +
    + - + *preetrogpolygonzkevm.PolygonZkEVMBatchData +
    +
    + 54 + +
    +   + // Struct used in Etrog +
    +
    + 55 + +
    + - + *etrogpolygonzkevm.PolygonRollupBaseEtrogBatchData +
    +
    + 56 + +
    +   + // Struct used in Elderberry +
    +
    + 57 + +
    +   + *SequencedBatchElderberryData +
    +
    + 58 + +
    +   + } +
    +
    +
    @@ -64,7 +63,7 @@
    +
    + 64 + +
    +   + TxHash common.Hash +
    +
    + 65 + +
    +   + Nonce uint64 +
    +
    + 66 + +
    +   + // Struct used in Etrog +
    +
    + 67 + +
    + - + *etrogpolygonzkevm.PolygonRollupBaseEtrogBatchData +
    +
    + 68 + +
    +   + } +
    +
    + 69 + +
    +   +
    +
    +
    + 70 + +
    +   + // ForcedBatch represents a ForcedBatch +
    +
    +
    @@ -93,7 +92,7 @@
    +
    + 93 + +
    +   + TxHash common.Hash +
    +
    + 94 + +
    +   + Timestamp time.Time +
    +
    + 95 + +
    +   + Nonce uint64 +
    +
    + 96 + +
    + - + etrogpolygonzkevm.PolygonRollupBaseEtrogBatchData +
    +
    + 97 + +
    +   + } +
    +
    + 98 + +
    +   +
    +
    +
    + 99 + +
    +   + // ForkID is a sturct to track the ForkID event. +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 19 + +
    +   + VerifiedBatches []VerifiedBatch +
    +
    + 20 + +
    +   + SequencedForceBatches [][]SequencedForceBatch +
    +
    + 21 + +
    +   + ForkIDs []ForkID +
    +
    + + +
    +   +
    +
    +
    + 22 + +
    +   + ReceivedAt time.Time +
    +
    + 23 + +
    +   + // GER data +
    +
    + 24 + +
    +   + GlobalExitRoots, L1InfoTree []GlobalExitRoot +
    +
    +
     
    +
    + 49 + +
    +   + Nonce uint64 +
    +
    + 50 + +
    +   + Coinbase common.Address +
    +
    + 51 + +
    +   + // Struct used in preEtrog forks +
    +
    + 52 + +
    + + + *oldpolygonzkevm.PolygonZkEVMBatchData +
    +
    + 53 + +
    +   + // Struct used in Etrog +
    +
    + 54 + +
    + + + *polygonzkevm.PolygonRollupBaseEtrogBatchData +
    +
    + 55 + +
    +   + // Struct used in Elderberry +
    +
    + 56 + +
    +   + *SequencedBatchElderberryData +
    +
    + 57 + +
    +   + } +
    +
    +
     
    +
    + 63 + +
    +   + TxHash common.Hash +
    +
    + 64 + +
    +   + Nonce uint64 +
    +
    + 65 + +
    +   + // Struct used in Etrog +
    +
    + 66 + +
    + + + *polygonzkevm.PolygonRollupBaseEtrogBatchData +
    +
    + 67 + +
    +   + } +
    +
    + 68 + +
    +   +
    +
    +
    + 69 + +
    +   + // ForcedBatch represents a ForcedBatch +
    +
    +
     
    +
    + 92 + +
    +   + TxHash common.Hash +
    +
    + 93 + +
    +   + Timestamp time.Time +
    +
    + 94 + +
    +   + Nonce uint64 +
    +
    + 95 + +
    + + + polygonzkevm.PolygonRollupBaseEtrogBatchData +
    +
    + 96 + +
    +   + } +
    +
    + 97 + +
    +   +
    +
    +
    + 98 + +
    +   + // ForkID is a sturct to track the ForkID event. +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/ethtxmanager/ethtxmanager.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -59,44 +59,15 @@
    +
    + 59 + +
    +   + return c +
    +
    + 60 + +
    +   + } +
    +
    + 61 + +
    +   +
    +
    +
    + 62 + +
    + - + // getTxNonce get the nonce for the given account +
    +
    + 63 + +
    + - + func (c *Client) getTxNonce(ctx context.Context, from common.Address) (uint64, error) { +
    +
    + 64 + +
    + - + // Get created transactions from the database for the given account +
    +
    + 65 + +
    + - + createdTxs, err := c.storage.GetBySenderAndStatus(ctx, from, []MonitoredTxStatus{MonitoredTxStatusCreated}, nil) +
    +
    + 66 + +
    + - + if err != nil { +
    +
    + 67 + +
    + - + return 0, fmt.Errorf("failed to get created monitored txs: %w", err) +
    +
    + 68 + +
    + - + } +
    +
    + 69 + +
    + - +
    +
    +
    + 70 + +
    + - + var nonce uint64 +
    +
    + 71 + +
    + - + if len(createdTxs) > 0 { +
    +
    + 72 + +
    + - + // if there are pending txs, we adjust the nonce accordingly +
    +
    + 73 + +
    + - + for _, createdTx := range createdTxs { +
    +
    + 74 + +
    + - + if createdTx.nonce > nonce { +
    +
    + 75 + +
    + - + nonce = createdTx.nonce +
    +
    + 76 + +
    + - + } +
    +
    + 77 + +
    + - + } +
    +
    + 78 + +
    + - +
    +
    +
    + 79 + +
    + - + nonce++ +
    +
    + 80 + +
    + - + } else { +
    +
    + 81 + +
    + - + // if there are no pending txs, we get the pending nonce from the etherman +
    +
    + 82 + +
    + - + if nonce, err = c.etherman.PendingNonce(ctx, from); err != nil { +
    +
    + 83 + +
    + - + return 0, fmt.Errorf("failed to get pending nonce: %w", err) +
    +
    + 84 + +
    + - + } +
    +
    + 85 + +
    + - + } +
    +
    + 86 + +
    + - +
    +
    +
    + 87 + +
    + - + return nonce, nil +
    +
    + 88 + +
    + - + } +
    +
    + 89 + +
    + - +
    +
    +
    + 90 + +
    +   + // Add a transaction to be sent and monitored +
    +
    + 91 + +
    +   + func (c *Client) Add(ctx context.Context, owner, id string, from common.Address, to *common.Address, value *big.Int, data []byte, gasOffset uint64, dbTx pgx.Tx) error { +
    +
    + 92 + +
    + - + // get nonce +
    +
    + 93 + +
    + - + nonce, err := c.getTxNonce(ctx, from) +
    +
    + 94 + +
    +   + if err != nil { +
    +
    + 95 + +
    + - + err := fmt.Errorf("failed to get nonce: %w", err) +
    +
    + 96 + +
    +   + log.Errorf(err.Error()) +
    +
    + 97 + +
    +   + return err +
    +
    + 98 + +
    +   + } +
    +
    + 99 + +
    + - +
    +
    +
    + 100 + +
    +   + // get gas +
    +
    + 101 + +
    +   + gas, err := c.etherman.EstimateGas(ctx, from, to, value, data) +
    +
    + 102 + +
    +   + if err != nil { +
    +
    +
    @@ -594,7 +565,7 @@
    +
    + 594 + +
    +   + // causing possible side effects and wasting resources. +
    +
    + 595 + +
    +   + func (c *Client) reviewMonitoredTxNonce(ctx context.Context, mTx *monitoredTx, mTxLogger *log.Logger) error { +
    +
    + 596 + +
    +   + mTxLogger.Debug("reviewing nonce") +
    +
    + 597 + +
    + - + nonce, err := c.getTxNonce(ctx, mTx.from) +
    +
    + 598 + +
    +   + if err != nil { +
    +
    + 599 + +
    +   + err := fmt.Errorf("failed to load current nonce for acc %v: %w", mTx.from.String(), err) +
    +
    + 600 + +
    +   + mTxLogger.Errorf(err.Error()) +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 59 + +
    +   + return c +
    +
    + 60 + +
    +   + } +
    +
    + 61 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 62 + +
    +   + // Add a transaction to be sent and monitored +
    +
    + 63 + +
    +   + func (c *Client) Add(ctx context.Context, owner, id string, from common.Address, to *common.Address, value *big.Int, data []byte, gasOffset uint64, dbTx pgx.Tx) error { +
    +
    + 64 + +
    + + + // get next nonce +
    +
    + 65 + +
    + + + nonce, err := c.etherman.CurrentNonce(ctx, from) +
    +
    + 66 + +
    +   + if err != nil { +
    +
    + 67 + +
    + + + err := fmt.Errorf("failed to get current nonce: %w", err) +
    +
    + 68 + +
    +   + log.Errorf(err.Error()) +
    +
    + 69 + +
    +   + return err +
    +
    + 70 + +
    +   + } +
    +
    + + +
    +   +
    +
    +
    + 71 + +
    +   + // get gas +
    +
    + 72 + +
    +   + gas, err := c.etherman.EstimateGas(ctx, from, to, value, data) +
    +
    + 73 + +
    +   + if err != nil { +
    +
    +
     
    +
    + 565 + +
    +   + // causing possible side effects and wasting resources. +
    +
    + 566 + +
    +   + func (c *Client) reviewMonitoredTxNonce(ctx context.Context, mTx *monitoredTx, mTxLogger *log.Logger) error { +
    +
    + 567 + +
    +   + mTxLogger.Debug("reviewing nonce") +
    +
    + 568 + +
    + + + nonce, err := c.etherman.CurrentNonce(ctx, mTx.from) +
    +
    + 569 + +
    +   + if err != nil { +
    +
    + 570 + +
    +   + err := fmt.Errorf("failed to load current nonce for acc %v: %w", mTx.from.String(), err) +
    +
    + 571 + +
    +   + mTxLogger.Errorf(err.Error()) +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/ethtxmanager/ethtxmanager_test.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -47,7 +47,7 @@
    +
    + 47 + +
    +   +
    +
    +
    + 48 + +
    +   + currentNonce := uint64(1) +
    +
    + 49 + +
    +   + etherman. +
    +
    + 50 + +
    + - + On("PendingNonce", ctx, from). +
    +
    + 51 + +
    +   + Return(currentNonce, nil). +
    +
    + 52 + +
    +   + Once() +
    +
    + 53 + +
    +   +
    +
    +
    +
    @@ -165,7 +165,7 @@
    +
    + 165 + +
    +   + // Add +
    +
    + 166 + +
    +   + currentNonce := uint64(1) +
    +
    + 167 + +
    +   + etherman. +
    +
    + 168 + +
    + - + On("PendingNonce", ctx, from). +
    +
    + 169 + +
    +   + Return(currentNonce, nil). +
    +
    + 170 + +
    +   + Once() +
    +
    + 171 + +
    +   +
    +
    +
    +
    @@ -331,7 +331,7 @@
    +
    + 331 + +
    +   + // Add +
    +
    + 332 + +
    +   + currentNonce := uint64(1) +
    +
    + 333 + +
    +   + etherman. +
    +
    + 334 + +
    + - + On("PendingNonce", ctx, from). +
    +
    + 335 + +
    +   + Return(currentNonce, nil). +
    +
    + 336 + +
    +   + Once() +
    +
    + 337 + +
    +   +
    +
    +
    +
    @@ -521,7 +521,7 @@
    +
    + 521 + +
    +   + // Add +
    +
    + 522 + +
    +   + currentNonce := uint64(1) +
    +
    + 523 + +
    +   + etherman. +
    +
    + 524 + +
    + - + On("PendingNonce", ctx, from). +
    +
    + 525 + +
    +   + Return(currentNonce, nil). +
    +
    + 526 + +
    +   + Once() +
    +
    + 527 + +
    +   +
    +
    +
    +
    @@ -593,7 +593,7 @@
    +
    + 593 + +
    +   +
    +
    +
    + 594 + +
    +   + currentNonce = uint64(2) +
    +
    + 595 + +
    +   + etherman. +
    +
    + 596 + +
    + - + On("PendingNonce", ctx, from). +
    +
    + 597 + +
    +   + Return(currentNonce, nil). +
    +
    + 598 + +
    +   + Once() +
    +
    + 599 + +
    +   + secondGasEstimation := uint64(2) +
    +
    +
    @@ -751,7 +751,7 @@
    +
    + 751 + +
    +   +
    +
    +
    + 752 + +
    +   + currentNonce := uint64(1) +
    +
    + 753 + +
    +   + etherman. +
    +
    + 754 + +
    + - + On("PendingNonce", ctx, from). +
    +
    + 755 + +
    +   + Return(currentNonce, nil). +
    +
    + 756 + +
    +   + Once() +
    +
    + 757 + +
    +   +
    +
    +
    +
    @@ -832,7 +832,7 @@
    +
    + 832 + +
    +   +
    +
    +
    + 833 + +
    +   + currentNonce := uint64(1) +
    +
    + 834 + +
    +   + etherman. +
    +
    + 835 + +
    + - + On("PendingNonce", ctx, from). +
    +
    + 836 + +
    +   + Return(currentNonce, nil). +
    +
    + 837 + +
    +   + Once() +
    +
    + 838 + +
    +   +
    +
    +
    +
    @@ -886,7 +886,7 @@
    +
    + 886 + +
    +   +
    +
    +
    + 887 + +
    +   + currentNonce := uint64(1) +
    +
    + 888 + +
    +   + etherman. +
    +
    + 889 + +
    + - + On("PendingNonce", ctx, from). +
    +
    + 890 + +
    +   + Return(currentNonce, nil). +
    +
    + 891 + +
    +   + Once() +
    +
    + 892 + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 47 + +
    +   +
    +
    +
    + 48 + +
    +   + currentNonce := uint64(1) +
    +
    + 49 + +
    +   + etherman. +
    +
    + 50 + +
    + + + On("CurrentNonce", ctx, from). +
    +
    + 51 + +
    +   + Return(currentNonce, nil). +
    +
    + 52 + +
    +   + Once() +
    +
    + 53 + +
    +   +
    +
    +
    +
     
    +
    + 165 + +
    +   + // Add +
    +
    + 166 + +
    +   + currentNonce := uint64(1) +
    +
    + 167 + +
    +   + etherman. +
    +
    + 168 + +
    + + + On("CurrentNonce", ctx, from). +
    +
    + 169 + +
    +   + Return(currentNonce, nil). +
    +
    + 170 + +
    +   + Once() +
    +
    + 171 + +
    +   +
    +
    +
    +
     
    +
    + 331 + +
    +   + // Add +
    +
    + 332 + +
    +   + currentNonce := uint64(1) +
    +
    + 333 + +
    +   + etherman. +
    +
    + 334 + +
    + + + On("CurrentNonce", ctx, from). +
    +
    + 335 + +
    +   + Return(currentNonce, nil). +
    +
    + 336 + +
    +   + Once() +
    +
    + 337 + +
    +   +
    +
    +
    +
     
    +
    + 521 + +
    +   + // Add +
    +
    + 522 + +
    +   + currentNonce := uint64(1) +
    +
    + 523 + +
    +   + etherman. +
    +
    + 524 + +
    + + + On("CurrentNonce", ctx, from). +
    +
    + 525 + +
    +   + Return(currentNonce, nil). +
    +
    + 526 + +
    +   + Once() +
    +
    + 527 + +
    +   +
    +
    +
    +
     
    +
    + 593 + +
    +   +
    +
    +
    + 594 + +
    +   + currentNonce = uint64(2) +
    +
    + 595 + +
    +   + etherman. +
    +
    + 596 + +
    + + + On("CurrentNonce", ctx, from). +
    +
    + 597 + +
    +   + Return(currentNonce, nil). +
    +
    + 598 + +
    +   + Once() +
    +
    + 599 + +
    +   + secondGasEstimation := uint64(2) +
    +
    +
     
    +
    + 751 + +
    +   +
    +
    +
    + 752 + +
    +   + currentNonce := uint64(1) +
    +
    + 753 + +
    +   + etherman. +
    +
    + 754 + +
    + + + On("CurrentNonce", ctx, from). +
    +
    + 755 + +
    +   + Return(currentNonce, nil). +
    +
    + 756 + +
    +   + Once() +
    +
    + 757 + +
    +   +
    +
    +
    +
     
    +
    + 832 + +
    +   +
    +
    +
    + 833 + +
    +   + currentNonce := uint64(1) +
    +
    + 834 + +
    +   + etherman. +
    +
    + 835 + +
    + + + On("CurrentNonce", ctx, from). +
    +
    + 836 + +
    +   + Return(currentNonce, nil). +
    +
    + 837 + +
    +   + Once() +
    +
    + 838 + +
    +   +
    +
    +
    +
     
    +
    + 886 + +
    +   +
    +
    +
    + 887 + +
    +   + currentNonce := uint64(1) +
    +
    + 888 + +
    +   + etherman. +
    +
    + 889 + +
    + + + On("CurrentNonce", ctx, from). +
    +
    + 890 + +
    +   + Return(currentNonce, nil). +
    +
    + 891 + +
    +   + Once() +
    +
    + 892 + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/ethtxmanager/interfaces.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -16,7 +16,6 @@
    +
    + 16 + +
    +   + GetTxReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) +
    +
    + 17 + +
    +   + WaitTxToBeMined(ctx context.Context, tx *types.Transaction, timeout time.Duration) (bool, error) +
    +
    + 18 + +
    +   + SendTx(ctx context.Context, tx *types.Transaction) error +
    +
    + 19 + +
    + - + PendingNonce(ctx context.Context, account common.Address) (uint64, error) +
    +
    + 20 + +
    +   + CurrentNonce(ctx context.Context, account common.Address) (uint64, error) +
    +
    + 21 + +
    +   + SuggestedGasPrice(ctx context.Context) (*big.Int, error) +
    +
    + 22 + +
    +   + EstimateGas(ctx context.Context, from common.Address, to *common.Address, value *big.Int, data []byte) (uint64, error) +
    +
    +
    @@ -29,7 +28,6 @@
    +
    + 29 + +
    +   + Add(ctx context.Context, mTx monitoredTx, dbTx pgx.Tx) error +
    +
    + 30 + +
    +   + Get(ctx context.Context, owner, id string, dbTx pgx.Tx) (monitoredTx, error) +
    +
    + 31 + +
    +   + GetByStatus(ctx context.Context, owner *string, statuses []MonitoredTxStatus, dbTx pgx.Tx) ([]monitoredTx, error) +
    +
    + 32 + +
    + - + GetBySenderAndStatus(ctx context.Context, sender common.Address, statuses []MonitoredTxStatus, dbTx pgx.Tx) ([]monitoredTx, error) +
    +
    + 33 + +
    +   + GetByBlock(ctx context.Context, fromBlock, toBlock *uint64, dbTx pgx.Tx) ([]monitoredTx, error) +
    +
    + 34 + +
    +   + Update(ctx context.Context, mTx monitoredTx, dbTx pgx.Tx) error +
    +
    + 35 + +
    +   + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 16 + +
    +   + GetTxReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) +
    +
    + 17 + +
    +   + WaitTxToBeMined(ctx context.Context, tx *types.Transaction, timeout time.Duration) (bool, error) +
    +
    + 18 + +
    +   + SendTx(ctx context.Context, tx *types.Transaction) error +
    +
    + + +
    +   +
    +
    +
    + 19 + +
    +   + CurrentNonce(ctx context.Context, account common.Address) (uint64, error) +
    +
    + 20 + +
    +   + SuggestedGasPrice(ctx context.Context) (*big.Int, error) +
    +
    + 21 + +
    +   + EstimateGas(ctx context.Context, from common.Address, to *common.Address, value *big.Int, data []byte) (uint64, error) +
    +
    +
     
    +
    + 28 + +
    +   + Add(ctx context.Context, mTx monitoredTx, dbTx pgx.Tx) error +
    +
    + 29 + +
    +   + Get(ctx context.Context, owner, id string, dbTx pgx.Tx) (monitoredTx, error) +
    +
    + 30 + +
    +   + GetByStatus(ctx context.Context, owner *string, statuses []MonitoredTxStatus, dbTx pgx.Tx) ([]monitoredTx, error) +
    +
    + + +
    +   +
    +
    +
    + 31 + +
    +   + GetByBlock(ctx context.Context, fromBlock, toBlock *uint64, dbTx pgx.Tx) ([]monitoredTx, error) +
    +
    + 32 + +
    +   + Update(ctx context.Context, mTx monitoredTx, dbTx pgx.Tx) error +
    +
    + 33 + +
    +   + } +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/ethtxmanager/pgstorage.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -123,50 +123,6 @@
    +
    + 123 + +
    +   + return mTxs, nil +
    +
    + 124 + +
    +   + } +
    +
    + 125 + +
    +   +
    +
    +
    + 126 + +
    + - + // GetBySenderAndStatus loads all monitored txs of the given sender that match the provided status +
    +
    + 127 + +
    + - + func (s *PostgresStorage) GetBySenderAndStatus(ctx context.Context, sender common.Address, statuses []MonitoredTxStatus, dbTx pgx.Tx) ([]monitoredTx, error) { +
    +
    + 128 + +
    + - + hasStatusToFilter := len(statuses) > 0 +
    +
    + 129 + +
    + - +
    +
    +
    + 130 + +
    + - + conn := s.dbConn(dbTx) +
    +
    + 131 + +
    + - + cmd := ` +
    +
    + 132 + +
    + - + SELECT owner, id, from_addr, to_addr, nonce, value, data, gas, gas_offset, gas_price, status, block_num, history, created_at, updated_at +
    +
    + 133 + +
    + - + FROM state.monitored_txs +
    +
    + 134 + +
    + - + WHERE from_addr = $1` +
    +
    + 135 + +
    + - + if hasStatusToFilter { +
    +
    + 136 + +
    + - + cmd += ` +
    +
    + 137 + +
    + - + AND status = ANY($2)` +
    +
    + 138 + +
    + - + } +
    +
    + 139 + +
    + - + cmd += ` +
    +
    + 140 + +
    + - + ORDER BY created_at` +
    +
    + 141 + +
    + - +
    +
    +
    + 142 + +
    + - + mTxs := []monitoredTx{} +
    +
    + 143 + +
    + - +
    +
    +
    + 144 + +
    + - + var rows pgx.Rows +
    +
    + 145 + +
    + - + var err error +
    +
    + 146 + +
    + - + if hasStatusToFilter { +
    +
    + 147 + +
    + - + rows, err = conn.Query(ctx, cmd, sender.String(), statuses) +
    +
    + 148 + +
    + - + } else { +
    +
    + 149 + +
    + - + rows, err = conn.Query(ctx, cmd, sender.String()) +
    +
    + 150 + +
    + - + } +
    +
    + 151 + +
    + - +
    +
    +
    + 152 + +
    + - + if errors.Is(err, pgx.ErrNoRows) { +
    +
    + 153 + +
    + - + return []monitoredTx{}, nil +
    +
    + 154 + +
    + - + } else if err != nil { +
    +
    + 155 + +
    + - + return nil, err +
    +
    + 156 + +
    + - + } +
    +
    + 157 + +
    + - +
    +
    +
    + 158 + +
    + - + for rows.Next() { +
    +
    + 159 + +
    + - + mTx := monitoredTx{} +
    +
    + 160 + +
    + - + err := s.scanMtx(rows, &mTx) +
    +
    + 161 + +
    + - + if err != nil { +
    +
    + 162 + +
    + - + return nil, err +
    +
    + 163 + +
    + - + } +
    +
    + 164 + +
    + - + mTxs = append(mTxs, mTx) +
    +
    + 165 + +
    + - + } +
    +
    + 166 + +
    + - +
    +
    +
    + 167 + +
    + - + return mTxs, nil +
    +
    + 168 + +
    + - + } +
    +
    + 169 + +
    + - +
    +
    +
    + 170 + +
    +   + // GetByBlock loads all monitored tx that have the blockNumber between +
    +
    + 171 + +
    +   + // fromBlock and toBlock +
    +
    + 172 + +
    +   + func (s *PostgresStorage) GetByBlock(ctx context.Context, fromBlock, toBlock *uint64, dbTx pgx.Tx) ([]monitoredTx, error) { +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 123 + +
    +   + return mTxs, nil +
    +
    + 124 + +
    +   + } +
    +
    + 125 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 126 + +
    +   + // GetByBlock loads all monitored tx that have the blockNumber between +
    +
    + 127 + +
    +   + // fromBlock and toBlock +
    +
    + 128 + +
    +   + func (s *PostgresStorage) GetByBlock(ctx context.Context, fromBlock, toBlock *uint64, dbTx pgx.Tx) ([]monitoredTx, error) { +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/ethtxmanager/pgstorage_test.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -163,72 +163,6 @@
    +
    + 163 + +
    +   + assert.Equal(t, "confirmed2", mTxs[7].id) +
    +
    + 164 + +
    +   + } +
    +
    + 165 + +
    +   +
    +
    +
    + 166 + +
    + - + func TestAddAndGetBySenderAndStatus(t *testing.T) { +
    +
    + 167 + +
    + - + dbCfg := dbutils.NewStateConfigFromEnv() +
    +
    + 168 + +
    + - + require.NoError(t, dbutils.InitOrResetState(dbCfg)) +
    +
    + 169 + +
    + - +
    +
    +
    + 170 + +
    + - + storage, err := NewPostgresStorage(dbCfg) +
    +
    + 171 + +
    + - + require.NoError(t, err) +
    +
    + 172 + +
    + - +
    +
    +
    + 173 + +
    + - + from := common.HexToAddress("0x1") +
    +
    + 174 + +
    + - + to := common.HexToAddress("0x2") +
    +
    + 175 + +
    + - + baseMtx := monitoredTx{ +
    +
    + 176 + +
    + - + owner: "owner", from: common.HexToAddress("0x1"), to: &to, nonce: uint64(1), value: big.NewInt(2), data: []byte("data"), blockNumber: big.NewInt(1), +
    +
    + 177 + +
    + - + gas: uint64(3), gasPrice: big.NewInt(4), history: map[common.Hash]bool{common.HexToHash("0x3"): true, common.HexToHash("0x4"): true}, +
    +
    + 178 + +
    + - + } +
    +
    + 179 + +
    + - +
    +
    +
    + 180 + +
    + - + type mTxReplaceInfo struct { +
    +
    + 181 + +
    + - + id string +
    +
    + 182 + +
    + - + status MonitoredTxStatus +
    +
    + 183 + +
    + - + } +
    +
    + 184 + +
    + - +
    +
    +
    + 185 + +
    + - + mTxsReplaceInfo := []mTxReplaceInfo{ +
    +
    + 186 + +
    + - + {id: "created1", status: MonitoredTxStatusCreated}, +
    +
    + 187 + +
    + - + {id: "sent1", status: MonitoredTxStatusSent}, +
    +
    + 188 + +
    + - + {id: "failed1", status: MonitoredTxStatusFailed}, +
    +
    + 189 + +
    + - + {id: "confirmed1", status: MonitoredTxStatusConfirmed}, +
    +
    + 190 + +
    + - + {id: "created2", status: MonitoredTxStatusCreated}, +
    +
    + 191 + +
    + - + {id: "sent2", status: MonitoredTxStatusSent}, +
    +
    + 192 + +
    + - + {id: "failed2", status: MonitoredTxStatusFailed}, +
    +
    + 193 + +
    + - + {id: "confirmed2", status: MonitoredTxStatusConfirmed}, +
    +
    + 194 + +
    + - + } +
    +
    + 195 + +
    + - +
    +
    +
    + 196 + +
    + - + for _, replaceInfo := range mTxsReplaceInfo { +
    +
    + 197 + +
    + - + baseMtx.id = replaceInfo.id +
    +
    + 198 + +
    + - + baseMtx.status = replaceInfo.status +
    +
    + 199 + +
    + - + baseMtx.createdAt = baseMtx.createdAt.Add(time.Microsecond) +
    +
    + 200 + +
    + - + baseMtx.updatedAt = baseMtx.updatedAt.Add(time.Microsecond) +
    +
    + 201 + +
    + - + err = storage.Add(context.Background(), baseMtx, nil) +
    +
    + 202 + +
    + - + require.NoError(t, err) +
    +
    + 203 + +
    + - + } +
    +
    + 204 + +
    + - +
    +
    +
    + 205 + +
    + - + mTxs, err := storage.GetBySenderAndStatus(context.Background(), from, []MonitoredTxStatus{MonitoredTxStatusConfirmed}, nil) +
    +
    + 206 + +
    + - + require.NoError(t, err) +
    +
    + 207 + +
    + - + assert.Equal(t, 2, len(mTxs)) +
    +
    + 208 + +
    + - + assert.Equal(t, "confirmed1", mTxs[0].id) +
    +
    + 209 + +
    + - + assert.Equal(t, "confirmed2", mTxs[1].id) +
    +
    + 210 + +
    + - +
    +
    +
    + 211 + +
    + - + mTxs, err = storage.GetBySenderAndStatus(context.Background(), from, []MonitoredTxStatus{MonitoredTxStatusSent, MonitoredTxStatusCreated}, nil) +
    +
    + 212 + +
    + - + require.NoError(t, err) +
    +
    + 213 + +
    + - + assert.Equal(t, 4, len(mTxs)) +
    +
    + 214 + +
    + - + assert.Equal(t, "created1", mTxs[0].id) +
    +
    + 215 + +
    + - + assert.Equal(t, "sent1", mTxs[1].id) +
    +
    + 216 + +
    + - + assert.Equal(t, "created2", mTxs[2].id) +
    +
    + 217 + +
    + - + assert.Equal(t, "sent2", mTxs[3].id) +
    +
    + 218 + +
    + - +
    +
    +
    + 219 + +
    + - + mTxs, err = storage.GetBySenderAndStatus(context.Background(), from, []MonitoredTxStatus{}, nil) +
    +
    + 220 + +
    + - + require.NoError(t, err) +
    +
    + 221 + +
    + - + assert.Equal(t, 8, len(mTxs)) +
    +
    + 222 + +
    + - + assert.Equal(t, "created1", mTxs[0].id) +
    +
    + 223 + +
    + - + assert.Equal(t, "sent1", mTxs[1].id) +
    +
    + 224 + +
    + - + assert.Equal(t, "failed1", mTxs[2].id) +
    +
    + 225 + +
    + - + assert.Equal(t, "confirmed1", mTxs[3].id) +
    +
    + 226 + +
    + - + assert.Equal(t, "created2", mTxs[4].id) +
    +
    + 227 + +
    + - + assert.Equal(t, "sent2", mTxs[5].id) +
    +
    + 228 + +
    + - + assert.Equal(t, "failed2", mTxs[6].id) +
    +
    + 229 + +
    + - + assert.Equal(t, "confirmed2", mTxs[7].id) +
    +
    + 230 + +
    + - + } +
    +
    + 231 + +
    + - +
    +
    +
    + 232 + +
    +   + func TestAddRepeated(t *testing.T) { +
    +
    + 233 + +
    +   + dbCfg := dbutils.NewStateConfigFromEnv() +
    +
    + 234 + +
    +   + require.NoError(t, dbutils.InitOrResetState(dbCfg)) +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 163 + +
    +   + assert.Equal(t, "confirmed2", mTxs[7].id) +
    +
    + 164 + +
    +   + } +
    +
    + 165 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 166 + +
    +   + func TestAddRepeated(t *testing.T) { +
    +
    + 167 + +
    +   + dbCfg := dbutils.NewStateConfigFromEnv() +
    +
    + 168 + +
    +   + require.NoError(t, dbutils.InitOrResetState(dbCfg)) +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/event/event.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -42,6 +42,9 @@
    +
    + 42 + +
    +   + EventID_SynchronizerHalt EventID = "SYNCHRONIZER HALT" +
    +
    + 43 + +
    +   + // EventID_SequenceSenderHalt is triggered when the SequenceSender halts +
    +
    + 44 + +
    +   + EventID_SequenceSenderHalt EventID = "SEQUENCESENDER HALT" +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 45 + +
    +   + // EventID_NodeOOC is triggered when an OOC at node level is detected +
    +
    + 46 + +
    +   + EventID_NodeOOC EventID = "NODE OOC" +
    +
    + 47 + +
    +   + // EventID_UsedZKCountersOverflow is triggered when used ZK counters exceeds remaining batch ZK counters +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 42 + +
    +   + EventID_SynchronizerHalt EventID = "SYNCHRONIZER HALT" +
    +
    + 43 + +
    +   + // EventID_SequenceSenderHalt is triggered when the SequenceSender halts +
    +
    + 44 + +
    +   + EventID_SequenceSenderHalt EventID = "SEQUENCESENDER HALT" +
    +
    + 45 + +
    + + + // EventID_UnsupportedPrecompile is triggered when the executor returns an unsupported precompile error +
    +
    + 46 + +
    + + + EventID_UnsupportedPrecompile EventID = "UNSUPPORTED PRECOMPILE" +
    +
    + 47 + +
    + + +
    +
    +
    + 48 + +
    +   + // EventID_NodeOOC is triggered when an OOC at node level is detected +
    +
    + 49 + +
    +   + EventID_NodeOOC EventID = "NODE OOC" +
    +
    + 50 + +
    +   + // EventID_UsedZKCountersOverflow is triggered when used ZK counters exceeds remaining batch ZK counters +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/event/eventlog.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -29,7 +29,7 @@
    +
    + 29 + +
    +   + } +
    +
    + 30 + +
    +   +
    +
    +
    + 31 + +
    +   + // LogExecutorError is used to store Executor error for runtime debugging +
    +
    + 32 + +
    + - + func (e *EventLog) LogExecutorError(ctx context.Context, responseError executor.ExecutorError, processBatchRequest interface{}) { +
    +
    + 33 + +
    +   + timestamp := time.Now() +
    +
    + 34 + +
    +   +
    +
    +
    + 35 + +
    +   + // if it's a user related error, ignore it +
    +
    +
    @@ -47,6 +47,30 @@
    +
    + 47 + +
    +   + log.Errorf("error found in the executor: %v at %v", responseError, timestamp) +
    +
    + 48 + +
    +   + payload, err := json.Marshal(processBatchRequest) +
    +
    + 49 + +
    +   + if err != nil { +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 50 + +
    +   + log.Errorf("error marshaling payload: %v", err) +
    +
    + 51 + +
    +   + } else { +
    +
    + 52 + +
    +   + event := &Event{ +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 29 + +
    +   + } +
    +
    + 30 + +
    +   +
    +
    +
    + 31 + +
    +   + // LogExecutorError is used to store Executor error for runtime debugging +
    +
    + 32 + +
    + + + func (e *EventLog) LogExecutorError(ctx context.Context, responseError executor.ExecutorError, processBatchRequest *executor.ProcessBatchRequest) { +
    +
    + 33 + +
    +   + timestamp := time.Now() +
    +
    + 34 + +
    +   +
    +
    +
    + 35 + +
    +   + // if it's a user related error, ignore it +
    +
    +
     
    +
    + 47 + +
    +   + log.Errorf("error found in the executor: %v at %v", responseError, timestamp) +
    +
    + 48 + +
    +   + payload, err := json.Marshal(processBatchRequest) +
    +
    + 49 + +
    +   + if err != nil { +
    +
    + 50 + +
    + + + log.Errorf("error marshaling payload: %v", err) +
    +
    + 51 + +
    + + + } else { +
    +
    + 52 + +
    + + + event := &Event{ +
    +
    + 53 + +
    + + + ReceivedAt: timestamp, +
    +
    + 54 + +
    + + + Source: Source_Node, +
    +
    + 55 + +
    + + + Component: Component_Executor, +
    +
    + 56 + +
    + + + Level: Level_Error, +
    +
    + 57 + +
    + + + EventID: EventID_ExecutorError, +
    +
    + 58 + +
    + + + Description: responseError.String(), +
    +
    + 59 + +
    + + + Json: string(payload), +
    +
    + 60 + +
    + + + } +
    +
    + 61 + +
    + + + err = e.storage.LogEvent(ctx, event) +
    +
    + 62 + +
    + + + if err != nil { +
    +
    + 63 + +
    + + + log.Errorf("error storing event: %v", err) +
    +
    + 64 + +
    + + + } +
    +
    + 65 + +
    + + + } +
    +
    + 66 + +
    + + + } +
    +
    + 67 + +
    + + +
    +
    +
    + 68 + +
    + + + // LogExecutorErrorV2 is used to store Executor error for runtime debugging +
    +
    + 69 + +
    + + + func (e *EventLog) LogExecutorErrorV2(ctx context.Context, responseError executor.ExecutorError, processBatchRequest *executor.ProcessBatchRequestV2) { +
    +
    + 70 + +
    + + + timestamp := time.Now() +
    +
    + 71 + +
    + + + log.Errorf("error found in the executor: %v at %v", responseError, timestamp) +
    +
    + 72 + +
    + + + payload, err := json.Marshal(processBatchRequest) +
    +
    + 73 + +
    + + + if err != nil { +
    +
    + 74 + +
    +   + log.Errorf("error marshaling payload: %v", err) +
    +
    + 75 + +
    +   + } else { +
    +
    + 76 + +
    +   + event := &Event{ +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/.golangci.yml + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -30,3 +30,6 @@
    +
    + 30 + +
    +   + include: +
    +
    + 31 + +
    +   + - EXC0012 # EXC0012 revive: Annoying issue about not having a comment. The rare codebase has such comments +
    +
    + 32 + +
    +   + - EXC0014 # EXC0014 revive: Annoying issue about not having a comment. The rare codebase has such comments +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 30 + +
    +   + include: +
    +
    + 31 + +
    +   + - EXC0012 # EXC0012 revive: Annoying issue about not having a comment. The rare codebase has such comments +
    +
    + 32 + +
    +   + - EXC0014 # EXC0014 revive: Annoying issue about not having a comment. The rare codebase has such comments +
    +
    + 33 + +
    + + + exclude-rules: +
    +
    + 34 + +
    + + + - path: cmd/policy.go +
    +
    + 35 + +
    + + + text: "unused" +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/go.mod + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -3,35 +3,35 @@
    +
    + 3 + +
    +   + go 1.21 +
    +
    + 4 + +
    +   +
    +
    +
    + 5 + +
    +   + require ( +
    +
    + 6 + +
    + - + github.com/0xPolygonHermez/zkevm-data-streamer v0.2.2 +
    +
    + 7 + +
    +   + github.com/didip/tollbooth/v6 v6.1.2 +
    +
    + 8 + +
    +   + github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 +
    +
    + 9 + +
    + - + github.com/ethereum/go-ethereum v1.13.14 +
    +
    + 10 + +
    +   + github.com/go-git/go-billy/v5 v5.5.0 +
    +
    + 11 + +
    + - + github.com/go-git/go-git/v5 v5.12.0 +
    +
    + 12 + +
    +   + github.com/gobuffalo/packr/v2 v2.8.3 +
    +
    + 13 + +
    + - + github.com/google/uuid v1.6.0 +
    +
    + 14 + +
    +   + github.com/habx/pg-commands v0.6.1 +
    +
    + 15 + +
    +   + github.com/hermeznetwork/tracerr v0.3.2 +
    +
    + 16 + +
    + - + github.com/iden3/go-iden3-crypto v0.0.16 +
    +
    + 17 + +
    +   + github.com/invopop/jsonschema v0.12.0 +
    +
    + 18 + +
    + - + github.com/jackc/pgconn v1.14.3 +
    +
    + 19 + +
    + - + github.com/jackc/pgx/v4 v4.18.3 +
    +
    + 20 + +
    +   + github.com/mitchellh/mapstructure v1.5.0 +
    +
    + 21 + +
    + - + github.com/prometheus/client_model v0.6.1 +
    +
    + 22 + +
    + - + github.com/prometheus/common v0.53.0 +
    +
    + 23 + +
    +   + github.com/rubenv/sql-migrate v1.6.1 +
    +
    + 24 + +
    +   + github.com/spf13/afero v1.11.0 +
    +
    + 25 + +
    + - + github.com/spf13/viper v1.17.0 +
    +
    + 26 + +
    + - + github.com/stretchr/testify v1.9.0 +
    +
    + 27 + +
    + - + github.com/umbracle/ethgo v0.1.3 +
    +
    + 28 + +
    + - + github.com/urfave/cli/v2 v2.27.2 +
    +
    + 29 + +
    + - + go.uber.org/zap v1.27.0 +
    +
    + 30 + +
    + - + golang.org/x/crypto v0.22.0 +
    +
    + 31 + +
    + - + golang.org/x/net v0.24.0 +
    +
    + 32 + +
    + - + golang.org/x/sync v0.7.0 +
    +
    + 33 + +
    + - + google.golang.org/grpc v1.63.2 +
    +
    + 34 + +
    + - + google.golang.org/protobuf v1.34.0 +
    +
    + 35 + +
    +   + gopkg.in/yaml.v2 v2.4.0 +
    +
    + 36 + +
    +   + gopkg.in/yaml.v3 v3.0.1 +
    +
    + 37 + +
    +   + ) +
    +
    +
    @@ -40,16 +40,16 @@
    +
    + 40 + +
    +   + dario.cat/mergo v1.0.0 // indirect +
    +
    + 41 + +
    +   + github.com/DataDog/zstd v1.5.2 // indirect +
    +
    + 42 + +
    +   + github.com/Microsoft/go-winio v0.6.1 // indirect +
    +
    + 43 + +
    + - + github.com/ProtonMail/go-crypto v1.0.0 // indirect +
    +
    + 44 + +
    +   + github.com/StackExchange/wmi v1.2.1 // indirect +
    +
    + 45 + +
    +   + github.com/VictoriaMetrics/fastcache v1.12.1 // indirect +
    +
    + 46 + +
    +   + github.com/bahlo/generic-list-go v0.2.0 // indirect +
    +
    + 47 + +
    +   + github.com/beorn7/perks v1.0.1 // indirect +
    +
    + 48 + +
    + - + github.com/bits-and-blooms/bitset v1.10.0 // indirect +
    +
    + 49 + +
    +   + github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect +
    +
    + 50 + +
    +   + github.com/buger/jsonparser v1.1.1 // indirect +
    +
    + 51 + +
    +   + github.com/cespare/xxhash/v2 v2.2.0 // indirect +
    +
    + 52 + +
    + - + github.com/cloudflare/circl v1.3.7 // indirect +
    +
    + 53 + +
    +   + github.com/cockroachdb/errors v1.9.1 // indirect +
    +
    + 54 + +
    +   + github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect +
    +
    + 55 + +
    +   + github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593 // indirect +
    +
    +
    @@ -57,18 +57,18 @@
    +
    + 57 + +
    +   + github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect +
    +
    + 58 + +
    +   + github.com/consensys/bavard v0.1.13 // indirect +
    +
    + 59 + +
    +   + github.com/consensys/gnark-crypto v0.12.1 // indirect +
    +
    + 60 + +
    + - + github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect +
    +
    + 61 + +
    +   + github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233 // indirect +
    +
    + 62 + +
    +   + github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect +
    +
    + 63 + +
    +   + github.com/cyphar/filepath-securejoin v0.2.4 // indirect +
    +
    + 64 + +
    +   + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect +
    +
    + 65 + +
    +   + github.com/deckarep/golang-set/v2 v2.1.0 // indirect +
    +
    + 66 + +
    + - + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect +
    +
    + 67 + +
    +   + github.com/dlclark/regexp2 v1.7.0 // indirect +
    +
    + 68 + +
    +   + github.com/emirpasic/gods v1.18.1 // indirect +
    +
    + 69 + +
    +   + github.com/ethereum/c-kzg-4844 v0.4.0 // indirect +
    +
    + 70 + +
    + - + github.com/fjl/memsize v0.0.2 // indirect +
    +
    + 71 + +
    + - + github.com/fsnotify/fsnotify v1.6.0 // indirect +
    +
    + 72 + +
    +   + github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect +
    +
    + 73 + +
    +   + github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 // indirect +
    +
    + 74 + +
    +   + github.com/getsentry/sentry-go v0.18.0 // indirect +
    +
    +
    @@ -83,23 +83,25 @@
    +
    + 83 + +
    +   + github.com/gogo/protobuf v1.3.2 // indirect +
    +
    + 84 + +
    +   + github.com/golang-jwt/jwt/v4 v4.5.0 // indirect +
    +
    + 85 + +
    +   + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect +
    +
    + + +
    +   +
    +
    +
    + 86 + +
    +   + github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect +
    +
    + 87 + +
    +   + github.com/google/gofuzz v1.2.0 // indirect +
    +
    + 88 + +
    +   + github.com/google/pprof v0.0.0-20230207041349-798e818bf904 // indirect +
    +
    + 89 + +
    +   + github.com/hashicorp/go-bexpr v0.1.10 // indirect +
    +
    + 90 + +
    +   + github.com/hashicorp/hcl v1.0.0 // indirect +
    +
    + 91 + +
    + - + github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4 // indirect +
    +
    + 92 + +
    +   + github.com/holiman/bloomfilter/v2 v2.0.3 // indirect +
    +
    + 93 + +
    +   + github.com/huin/goupnp v1.3.0 // indirect +
    +
    + 94 + +
    +   + github.com/jackc/chunkreader/v2 v2.0.1 // indirect +
    +
    + 95 + +
    +   + github.com/jackc/pgio v1.0.0 // indirect +
    +
    + 96 + +
    +   + github.com/jackc/pgpassfile v1.0.0 // indirect +
    +
    + 97 + +
    + - + github.com/jackc/pgproto3/v2 v2.3.3 // indirect +
    +
    + 98 + +
    +   + github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect +
    +
    + 99 + +
    +   + github.com/jackc/pgtype v1.14.0 // indirect +
    +
    + 100 + +
    +   + github.com/jackc/puddle v1.3.0 // indirect +
    +
    + 101 + +
    +   + github.com/jackpal/go-nat-pmp v1.0.2 // indirect +
    +
    + 102 + +
    +   + github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect +
    +
    + + +
    +   +
    +
    +
    + 103 + +
    +   + github.com/karrick/godirwalk v1.17.0 // indirect +
    +
    + 104 + +
    +   + github.com/kevinburke/ssh_config v1.2.0 // indirect +
    +
    + 105 + +
    +   + github.com/klauspost/compress v1.17.0 // indirect +
    +
    +
    @@ -114,6 +116,8 @@
    +
    + 114 + +
    +   + github.com/mattn/go-colorable v0.1.13 // indirect +
    +
    + 115 + +
    +   + github.com/mattn/go-isatty v0.0.20 // indirect +
    +
    + 116 + +
    +   + github.com/mattn/go-runewidth v0.0.13 // indirect +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 117 + +
    +   + github.com/mitchellh/pointerstructure v1.2.0 // indirect +
    +
    + 118 + +
    +   + github.com/mmcloughlin/addchain v0.4.0 // indirect +
    +
    + 119 + +
    +   + github.com/olekukonko/tablewriter v0.0.5 // indirect +
    +
    +
    @@ -126,17 +130,17 @@
    +
    + 126 + +
    +   + github.com/rogpeppe/go-internal v1.11.0 // indirect +
    +
    + 127 + +
    +   + github.com/rs/cors v1.7.0 // indirect +
    +
    + 128 + +
    +   + github.com/russross/blackfriday/v2 v2.1.0 // indirect +
    +
    + 129 + +
    + - + github.com/sagikazarmark/locafero v0.3.0 // indirect +
    +
    + 130 + +
    +   + github.com/sagikazarmark/slog-shim v0.1.0 // indirect +
    +
    + 131 + +
    + - + github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect +
    +
    + 132 + +
    +   + github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect +
    +
    + 133 + +
    +   + github.com/sirupsen/logrus v1.9.0 // indirect +
    +
    + 134 + +
    + - + github.com/skeema/knownhosts v1.2.2 // indirect +
    +
    + 135 + +
    +   + github.com/sourcegraph/conc v0.3.0 // indirect +
    +
    + 136 + +
    + - + github.com/spf13/cast v1.5.1 // indirect +
    +
    + 137 + +
    +   + github.com/spf13/pflag v1.0.5 // indirect +
    +
    + 138 + +
    +   + github.com/status-im/keycard-go v0.2.0 // indirect +
    +
    + 139 + +
    + - + github.com/stretchr/objx v0.5.2 // indirect +
    +
    + 140 + +
    +   + github.com/subosito/gotenv v1.6.0 // indirect +
    +
    + 141 + +
    +   + github.com/supranational/blst v0.3.11 // indirect +
    +
    + 142 + +
    +   + github.com/tklauser/go-sysconf v0.3.12 // indirect +
    +
    +
    @@ -146,15 +150,15 @@
    +
    + 146 + +
    +   + github.com/valyala/fastjson v1.4.1 // indirect +
    +
    + 147 + +
    +   + github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect +
    +
    + 148 + +
    +   + github.com/xanzy/ssh-agent v0.3.3 // indirect +
    +
    + 149 + +
    + - + github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 // indirect +
    +
    + 150 + +
    +   + go.uber.org/multierr v1.10.0 // indirect +
    +
    + 151 + +
    +   + golang.org/x/mod v0.14.0 // indirect +
    +
    + 152 + +
    + - + golang.org/x/sys v0.19.0 // indirect +
    +
    + 153 + +
    + - + golang.org/x/term v0.19.0 // indirect +
    +
    + 154 + +
    +   + golang.org/x/text v0.14.0 // indirect +
    +
    + 155 + +
    +   + golang.org/x/time v0.5.0 // indirect +
    +
    + 156 + +
    +   + golang.org/x/tools v0.15.0 // indirect +
    +
    + 157 + +
    + - + google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect +
    +
    + 158 + +
    +   + gopkg.in/ini.v1 v1.67.0 // indirect +
    +
    + 159 + +
    +   + gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect +
    +
    + 160 + +
    +   + gopkg.in/warnings.v0 v0.1.2 // indirect +
    +
    +
    @@ -168,7 +172,9 @@
    +
    + 168 + +
    +   + ) +
    +
    + 169 + +
    +   +
    +
    +
    + 170 + +
    +   + require ( +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 171 + +
    +   + github.com/fatih/color v1.16.0 +
    +
    + 172 + +
    + - + github.com/prometheus/client_golang v1.19.0 +
    +
    + 173 + +
    +   + golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa +
    +
    + 174 + +
    +   + ) +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 3 + +
    +   + go 1.21 +
    +
    + 4 + +
    +   +
    +
    +
    + 5 + +
    +   + require ( +
    +
    + 6 + +
    + + + github.com/0xPolygonHermez/zkevm-data-streamer v0.2.3-0.20240422135400-0df0d27226b3 +
    +
    + 7 + +
    +   + github.com/didip/tollbooth/v6 v6.1.2 +
    +
    + 8 + +
    +   + github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 +
    +
    + 9 + +
    + + + github.com/ethereum/go-ethereum v1.13.11 +
    +
    + 10 + +
    +   + github.com/go-git/go-billy/v5 v5.5.0 +
    +
    + 11 + +
    + + + github.com/go-git/go-git/v5 v5.11.0 +
    +
    + 12 + +
    +   + github.com/gobuffalo/packr/v2 v2.8.3 +
    +
    + 13 + +
    + + + github.com/google/uuid v1.5.0 +
    +
    + 14 + +
    +   + github.com/habx/pg-commands v0.6.1 +
    +
    + 15 + +
    +   + github.com/hermeznetwork/tracerr v0.3.2 +
    +
    + 16 + +
    + + + github.com/iden3/go-iden3-crypto v0.0.15 +
    +
    + 17 + +
    +   + github.com/invopop/jsonschema v0.12.0 +
    +
    + 18 + +
    + + + github.com/jackc/pgconn v1.14.1 +
    +
    + 19 + +
    + + + github.com/jackc/pgx/v4 v4.18.1 +
    +
    + 20 + +
    +   + github.com/mitchellh/mapstructure v1.5.0 +
    +
    + 21 + +
    + + + github.com/prometheus/client_model v0.5.0 +
    +
    + 22 + +
    + + + github.com/prometheus/common v0.45.0 +
    +
    + 23 + +
    +   + github.com/rubenv/sql-migrate v1.6.1 +
    +
    + 24 + +
    +   + github.com/spf13/afero v1.11.0 +
    +
    + 25 + +
    + + + github.com/spf13/viper v1.18.2 +
    +
    + 26 + +
    + + + github.com/stretchr/testify v1.8.4 +
    +
    + 27 + +
    + + + github.com/umbracle/ethgo v0.1.4-0.20230712173909-df37dddf16f0 +
    +
    + 28 + +
    + + + github.com/urfave/cli/v2 v2.26.0 +
    +
    + 29 + +
    + + + go.uber.org/zap v1.26.0 +
    +
    + 30 + +
    + + + golang.org/x/crypto v0.18.0 +
    +
    + 31 + +
    + + + golang.org/x/net v0.20.0 +
    +
    + 32 + +
    + + + golang.org/x/sync v0.5.0 +
    +
    + 33 + +
    + + + google.golang.org/grpc v1.60.1 +
    +
    + 34 + +
    + + + google.golang.org/protobuf v1.32.0 +
    +
    + 35 + +
    +   + gopkg.in/yaml.v2 v2.4.0 +
    +
    + 36 + +
    +   + gopkg.in/yaml.v3 v3.0.1 +
    +
    + 37 + +
    +   + ) +
    +
    +
     
    +
    + 40 + +
    +   + dario.cat/mergo v1.0.0 // indirect +
    +
    + 41 + +
    +   + github.com/DataDog/zstd v1.5.2 // indirect +
    +
    + 42 + +
    +   + github.com/Microsoft/go-winio v0.6.1 // indirect +
    +
    + 43 + +
    + + + github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect +
    +
    + 44 + +
    +   + github.com/StackExchange/wmi v1.2.1 // indirect +
    +
    + 45 + +
    +   + github.com/VictoriaMetrics/fastcache v1.12.1 // indirect +
    +
    + 46 + +
    +   + github.com/bahlo/generic-list-go v0.2.0 // indirect +
    +
    + 47 + +
    +   + github.com/beorn7/perks v1.0.1 // indirect +
    +
    + 48 + +
    + + + github.com/bits-and-blooms/bitset v1.12.0 // indirect +
    +
    + 49 + +
    +   + github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect +
    +
    + 50 + +
    +   + github.com/buger/jsonparser v1.1.1 // indirect +
    +
    + 51 + +
    +   + github.com/cespare/xxhash/v2 v2.2.0 // indirect +
    +
    + 52 + +
    + + + github.com/cloudflare/circl v1.3.3 // indirect +
    +
    + 53 + +
    +   + github.com/cockroachdb/errors v1.9.1 // indirect +
    +
    + 54 + +
    +   + github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect +
    +
    + 55 + +
    +   + github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593 // indirect +
    +
    +
     
    +
    + 57 + +
    +   + github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect +
    +
    + 58 + +
    +   + github.com/consensys/bavard v0.1.13 // indirect +
    +
    + 59 + +
    +   + github.com/consensys/gnark-crypto v0.12.1 // indirect +
    +
    + 60 + +
    + + + github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect +
    +
    + 61 + +
    +   + github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233 // indirect +
    +
    + 62 + +
    +   + github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect +
    +
    + 63 + +
    +   + github.com/cyphar/filepath-securejoin v0.2.4 // indirect +
    +
    + 64 + +
    +   + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect +
    +
    + 65 + +
    +   + github.com/deckarep/golang-set/v2 v2.1.0 // indirect +
    +
    + 66 + +
    + + + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect +
    +
    + 67 + +
    +   + github.com/dlclark/regexp2 v1.7.0 // indirect +
    +
    + 68 + +
    +   + github.com/emirpasic/gods v1.18.1 // indirect +
    +
    + 69 + +
    +   + github.com/ethereum/c-kzg-4844 v0.4.0 // indirect +
    +
    + 70 + +
    + + + github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 // indirect +
    +
    + 71 + +
    + + + github.com/fsnotify/fsnotify v1.7.0 // indirect +
    +
    + 72 + +
    +   + github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect +
    +
    + 73 + +
    +   + github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 // indirect +
    +
    + 74 + +
    +   + github.com/getsentry/sentry-go v0.18.0 // indirect +
    +
    +
     
    +
    + 83 + +
    +   + github.com/gogo/protobuf v1.3.2 // indirect +
    +
    + 84 + +
    +   + github.com/golang-jwt/jwt/v4 v4.5.0 // indirect +
    +
    + 85 + +
    +   + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect +
    +
    + 86 + +
    + + + github.com/golang/protobuf v1.5.3 // indirect +
    +
    + 87 + +
    +   + github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect +
    +
    + 88 + +
    +   + github.com/google/gofuzz v1.2.0 // indirect +
    +
    + 89 + +
    +   + github.com/google/pprof v0.0.0-20230207041349-798e818bf904 // indirect +
    +
    + 90 + +
    +   + github.com/hashicorp/go-bexpr v0.1.10 // indirect +
    +
    + 91 + +
    +   + github.com/hashicorp/hcl v1.0.0 // indirect +
    +
    + 92 + +
    + + + github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7 // indirect +
    +
    + 93 + +
    +   + github.com/holiman/bloomfilter/v2 v2.0.3 // indirect +
    +
    + 94 + +
    +   + github.com/huin/goupnp v1.3.0 // indirect +
    +
    + 95 + +
    +   + github.com/jackc/chunkreader/v2 v2.0.1 // indirect +
    +
    + 96 + +
    +   + github.com/jackc/pgio v1.0.0 // indirect +
    +
    + 97 + +
    +   + github.com/jackc/pgpassfile v1.0.0 // indirect +
    +
    + 98 + +
    + + + github.com/jackc/pgproto3/v2 v2.3.2 // indirect +
    +
    + 99 + +
    +   + github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect +
    +
    + 100 + +
    +   + github.com/jackc/pgtype v1.14.0 // indirect +
    +
    + 101 + +
    +   + github.com/jackc/puddle v1.3.0 // indirect +
    +
    + 102 + +
    +   + github.com/jackpal/go-nat-pmp v1.0.2 // indirect +
    +
    + 103 + +
    +   + github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect +
    +
    + 104 + +
    + + + github.com/jmoiron/sqlx v1.2.0 // indirect +
    +
    + 105 + +
    +   + github.com/karrick/godirwalk v1.17.0 // indirect +
    +
    + 106 + +
    +   + github.com/kevinburke/ssh_config v1.2.0 // indirect +
    +
    + 107 + +
    +   + github.com/klauspost/compress v1.17.0 // indirect +
    +
    +
     
    +
    + 116 + +
    +   + github.com/mattn/go-colorable v0.1.13 // indirect +
    +
    + 117 + +
    +   + github.com/mattn/go-isatty v0.0.20 // indirect +
    +
    + 118 + +
    +   + github.com/mattn/go-runewidth v0.0.13 // indirect +
    +
    + 119 + +
    + + + github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect +
    +
    + 120 + +
    + + + github.com/miguelmota/go-solidity-sha3 v0.1.1 // indirect +
    +
    + 121 + +
    +   + github.com/mitchellh/pointerstructure v1.2.0 // indirect +
    +
    + 122 + +
    +   + github.com/mmcloughlin/addchain v0.4.0 // indirect +
    +
    + 123 + +
    +   + github.com/olekukonko/tablewriter v0.0.5 // indirect +
    +
    +
     
    +
    + 130 + +
    +   + github.com/rogpeppe/go-internal v1.11.0 // indirect +
    +
    + 131 + +
    +   + github.com/rs/cors v1.7.0 // indirect +
    +
    + 132 + +
    +   + github.com/russross/blackfriday/v2 v2.1.0 // indirect +
    +
    + 133 + +
    + + + github.com/sagikazarmark/locafero v0.4.0 // indirect +
    +
    + 134 + +
    +   + github.com/sagikazarmark/slog-shim v0.1.0 // indirect +
    +
    + 135 + +
    + + + github.com/sergi/go-diff v1.2.0 // indirect +
    +
    + 136 + +
    +   + github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect +
    +
    + 137 + +
    +   + github.com/sirupsen/logrus v1.9.0 // indirect +
    +
    + 138 + +
    + + + github.com/skeema/knownhosts v1.2.1 // indirect +
    +
    + 139 + +
    +   + github.com/sourcegraph/conc v0.3.0 // indirect +
    +
    + 140 + +
    + + + github.com/spf13/cast v1.6.0 // indirect +
    +
    + 141 + +
    +   + github.com/spf13/pflag v1.0.5 // indirect +
    +
    + 142 + +
    +   + github.com/status-im/keycard-go v0.2.0 // indirect +
    +
    + 143 + +
    + + + github.com/stretchr/objx v0.5.0 // indirect +
    +
    + 144 + +
    +   + github.com/subosito/gotenv v1.6.0 // indirect +
    +
    + 145 + +
    +   + github.com/supranational/blst v0.3.11 // indirect +
    +
    + 146 + +
    +   + github.com/tklauser/go-sysconf v0.3.12 // indirect +
    +
    +
     
    +
    + 150 + +
    +   + github.com/valyala/fastjson v1.4.1 // indirect +
    +
    + 151 + +
    +   + github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect +
    +
    + 152 + +
    +   + github.com/xanzy/ssh-agent v0.3.3 // indirect +
    +
    + 153 + +
    + + + github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect +
    +
    + 154 + +
    +   + go.uber.org/multierr v1.10.0 // indirect +
    +
    + 155 + +
    +   + golang.org/x/mod v0.14.0 // indirect +
    +
    + 156 + +
    + + + golang.org/x/sys v0.16.0 // indirect +
    +
    + 157 + +
    + + + golang.org/x/term v0.16.0 // indirect +
    +
    + 158 + +
    +   + golang.org/x/text v0.14.0 // indirect +
    +
    + 159 + +
    +   + golang.org/x/time v0.5.0 // indirect +
    +
    + 160 + +
    +   + golang.org/x/tools v0.15.0 // indirect +
    +
    + 161 + +
    + + + google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect +
    +
    + 162 + +
    +   + gopkg.in/ini.v1 v1.67.0 // indirect +
    +
    + 163 + +
    +   + gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect +
    +
    + 164 + +
    +   + gopkg.in/warnings.v0 v0.1.2 // indirect +
    +
    +
     
    +
    + 172 + +
    +   + ) +
    +
    + 173 + +
    +   +
    +
    +
    + 174 + +
    +   + require ( +
    +
    + 175 + +
    + + + github.com/0xPolygon/agglayer v0.0.1 +
    +
    + 176 + +
    + + + github.com/0xPolygon/cdk-data-availability v0.0.5 +
    +
    + 177 + +
    +   + github.com/fatih/color v1.16.0 +
    +
    + 178 + +
    + + + github.com/prometheus/client_golang v1.18.0 +
    +
    + 179 + +
    +   + golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa +
    +
    + 180 + +
    +   + ) +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/.goreleaser-cdk.yaml + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -0,0 +1,84 @@
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 1 + +
    + + + # .goreleaser-cdk.yaml +
    +
    + 2 + +
    + + + project_name: cdk-validium-node +
    +
    + 3 + +
    + + +
    +
    +
    + 4 + +
    + + + release: +
    +
    + 5 + +
    + + + disable: false +
    +
    + 6 + +
    + + + draft: true +
    +
    + 7 + +
    + + + prerelease: auto +
    +
    + 8 + +
    + + +
    +
    +
    + 9 + +
    + + + before: +
    +
    + 10 + +
    + + + hooks: +
    +
    + 11 + +
    + + + - go mod download +
    +
    + 12 + +
    + + + - go install github.com/gobuffalo/packr/v2/packr2@v2.8.3 +
    +
    + 13 + +
    + + + - packr2 +
    +
    + 14 + +
    + + +
    +
    +
    + 15 + +
    + + + builds: +
    +
    + 16 + +
    + + + - main: ./cmd/ +
    +
    + 17 + +
    + + + binary: zkevm-node +
    +
    + 18 + +
    + + + goos: +
    +
    + 19 + +
    + + + - linux +
    +
    + 20 + +
    + + + - darwin +
    +
    + 21 + +
    + + + goarch: +
    +
    + 22 + +
    + + + - amd64 +
    +
    + 23 + +
    + + + - arm64 +
    +
    + 24 + +
    + + + env: +
    +
    + 25 + +
    + + + - CGO_ENABLED=0 +
    +
    + 26 + +
    + + + ldflags: +
    +
    + 27 + +
    + + + - -s -w +
    +
    + 28 + +
    + + + - -X github.com/0xPolygonHermez/zkevm-node.Version={{ .Version }} +
    +
    + 29 + +
    + + + - -X github.com/0xPolygonHermez/zkevm-node.GitRev={{ .Commit }} +
    +
    + 30 + +
    + + + - -X github.com/0xPolygonHermez/zkevm-node.BuildDate={{ .Date }} +
    +
    + 31 + +
    + + + - -X github.com/0xPolygonHermez/zkevm-node.GitBranch={{ .Branch }} +
    +
    + 32 + +
    + + +
    +
    +
    + 33 + +
    + + + archives: +
    +
    + 34 + +
    + + + - files: +
    +
    + 35 + +
    + + + - LICENSE +
    +
    + 36 + +
    + + + - README.md +
    +
    + 37 + +
    + + +
    +
    +
    + 38 + +
    + + + dockers: +
    +
    + 39 + +
    + + + - image_templates: +
    +
    + 40 + +
    + + + - 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}-amd64 +
    +
    + 41 + +
    + + + dockerfile: Dockerfile.release +
    +
    + 42 + +
    + + + use: buildx +
    +
    + 43 + +
    + + + goos: linux +
    +
    + 44 + +
    + + + goarch: amd64 +
    +
    + 45 + +
    + + + build_flag_templates: +
    +
    + 46 + +
    + + + - --platform=linux/amd64 +
    +
    + 47 + +
    + + + - --label=org.opencontainers.image.title={{ .ProjectName }} +
    +
    + 48 + +
    + + + - --label=org.opencontainers.image.description={{ .ProjectName }} +
    +
    + 49 + +
    + + + - --label=org.opencontainers.image.url=https://github.com/{{ .ProjectName }} +
    +
    + 50 + +
    + + + - --label=org.opencontainers.image.source=https://github.com/{{ .ProjectName }} +
    +
    + 51 + +
    + + + - --label=org.opencontainers.image.version={{ replace .Version "+" "-" }} +
    +
    + 52 + +
    + + + - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} +
    +
    + 53 + +
    + + + - --label=org.opencontainers.image.revision={{ .FullCommit }} +
    +
    + 54 + +
    + + + skip_push: false +
    +
    + 55 + +
    + + +
    +
    +
    + 56 + +
    + + + - image_templates: +
    +
    + 57 + +
    + + + - 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}-arm64 +
    +
    + 58 + +
    + + + dockerfile: Dockerfile.release +
    +
    + 59 + +
    + + + use: buildx +
    +
    + 60 + +
    + + + goos: linux +
    +
    + 61 + +
    + + + goarch: arm64 +
    +
    + 62 + +
    + + + build_flag_templates: +
    +
    + 63 + +
    + + + - --platform=linux/arm64 +
    +
    + 64 + +
    + + + - --label=org.opencontainers.image.title={{ .ProjectName }} +
    +
    + 65 + +
    + + + - --label=org.opencontainers.image.description={{ .ProjectName }} +
    +
    + 66 + +
    + + + - --label=org.opencontainers.image.url=https://github.com/{{ .ProjectName }} +
    +
    + 67 + +
    + + + - --label=org.opencontainers.image.source=https://github.com/{{ .ProjectName }} +
    +
    + 68 + +
    + + + - --label=org.opencontainers.image.version={{ replace .Version "+" "-" }} +
    +
    + 69 + +
    + + + - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} +
    +
    + 70 + +
    + + + - --label=org.opencontainers.image.revision={{ .FullCommit }} +
    +
    + 71 + +
    + + + skip_push: false +
    +
    + 72 + +
    + + +
    +
    +
    + 73 + +
    + + + docker_manifests: +
    +
    + 74 + +
    + + + - name_template: 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }} +
    +
    + 75 + +
    + + + image_templates: +
    +
    + 76 + +
    + + + - 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}-amd64 +
    +
    + 77 + +
    + + + - 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}-arm64 +
    +
    + 78 + +
    + + + skip_push: false +
    +
    + 79 + +
    + + +
    +
    +
    + 80 + +
    + + + - name_template: 0xpolygon/{{ .ProjectName }}:latest +
    +
    + 81 + +
    + + + image_templates: +
    +
    + 82 + +
    + + + - 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}-amd64 +
    +
    + 83 + +
    + + + - 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}-arm64 +
    +
    + 84 + +
    + + + skip_push: false +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/client/zkevm.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -58,6 +58,46 @@
    +
    + 58 + +
    +   + return result, nil +
    +
    + 59 + +
    +   + } +
    +
    + 60 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 61 + +
    +   + // ExitRootsByGER returns the exit roots accordingly to the provided Global Exit Root +
    +
    + 62 + +
    +   + func (c *Client) ExitRootsByGER(ctx context.Context, globalExitRoot common.Hash) (*types.ExitRoots, error) { +
    +
    + 63 + +
    +   + response, err := JSONRPCCall(c.url, "zkevm_getExitRootsByGER", globalExitRoot.String()) +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 58 + +
    +   + return result, nil +
    +
    + 59 + +
    +   + } +
    +
    + 60 + +
    +   +
    +
    +
    + 61 + +
    + + + // BatchesByNumbers returns batches from the current canonical chain by batch numbers. If the list is empty, the last +
    +
    + 62 + +
    + + + // known batch is returned as a list. +
    +
    + 63 + +
    + + + func (c *Client) BatchesByNumbers(ctx context.Context, numbers []*big.Int) ([]*types.BatchData, error) { +
    +
    + 64 + +
    + + + return c.batchesByNumbers(ctx, numbers, "zkevm_getBatchDataByNumbers") +
    +
    + 65 + +
    + + + } +
    +
    + 66 + +
    + + +
    +
    +
    + 67 + +
    + + + // ForcedBatchesByNumbers returns forced batches data. +
    +
    + 68 + +
    + + + func (c *Client) ForcedBatchesByNumbers(ctx context.Context, numbers []*big.Int) ([]*types.BatchData, error) { +
    +
    + 69 + +
    + + + return c.batchesByNumbers(ctx, numbers, "zkevm_getForcedBatchDataByNumbers") +
    +
    + 70 + +
    + + + } +
    +
    + 71 + +
    + + +
    +
    +
    + 72 + +
    + + + // BatchesByNumbers returns batches from the current canonical chain by batch numbers. If the list is empty, the last +
    +
    + 73 + +
    + + + // known batch is returned as a list. +
    +
    + 74 + +
    + + + func (c *Client) batchesByNumbers(_ context.Context, numbers []*big.Int, method string) ([]*types.BatchData, error) { +
    +
    + 75 + +
    + + + batchNumbers := make([]types.BatchNumber, 0, len(numbers)) +
    +
    + 76 + +
    + + + for _, n := range numbers { +
    +
    + 77 + +
    + + + batchNumbers = append(batchNumbers, types.BatchNumber(n.Int64())) +
    +
    + 78 + +
    + + + } +
    +
    + 79 + +
    + + + if len(batchNumbers) == 0 { +
    +
    + 80 + +
    + + + batchNumbers = append(batchNumbers, types.LatestBatchNumber) +
    +
    + 81 + +
    + + + } +
    +
    + 82 + +
    + + +
    +
    +
    + 83 + +
    + + + response, err := JSONRPCCall(c.url, method, &types.BatchFilter{Numbers: batchNumbers}) +
    +
    + 84 + +
    + + + if err != nil { +
    +
    + 85 + +
    + + + return nil, err +
    +
    + 86 + +
    + + + } +
    +
    + 87 + +
    + + +
    +
    +
    + 88 + +
    + + + if response.Error != nil { +
    +
    + 89 + +
    + + + return nil, response.Error.RPCError() +
    +
    + 90 + +
    + + + } +
    +
    + 91 + +
    + + +
    +
    +
    + 92 + +
    + + + var result *types.BatchDataResult +
    +
    + 93 + +
    + + + err = json.Unmarshal(response.Result, &result) +
    +
    + 94 + +
    + + + if err != nil { +
    +
    + 95 + +
    + + + return nil, err +
    +
    + 96 + +
    + + + } +
    +
    + 97 + +
    + + +
    +
    +
    + 98 + +
    + + + return result.Data, nil +
    +
    + 99 + +
    + + + } +
    +
    + 100 + +
    + + +
    +
    +
    + 101 + +
    +   + // ExitRootsByGER returns the exit roots accordingly to the provided Global Exit Root +
    +
    + 102 + +
    +   + func (c *Client) ExitRootsByGER(ctx context.Context, globalExitRoot common.Hash) (*types.ExitRoots, error) { +
    +
    + 103 + +
    +   + response, err := JSONRPCCall(c.url, "zkevm_getExitRootsByGER", globalExitRoot.String()) +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/endpoints_eth.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -104,7 +104,7 @@
    +
    + 104 + +
    +   + result, err := e.state.ProcessUnsignedTransaction(ctx, tx, sender, blockToProcess, true, dbTx) +
    +
    + 105 + +
    +   + if err != nil { +
    +
    + 106 + +
    +   + errMsg := fmt.Sprintf("failed to execute the unsigned transaction: %v", err.Error()) +
    +
    + 107 + +
    + - + logError := !executor.IsROMOutOfCountersError(executor.RomErrorCode(err)) && !errors.Is(err, runtime.ErrOutOfGas) +
    +
    + 108 + +
    +   + return RPCErrorResponse(types.DefaultErrorCode, errMsg, nil, logError) +
    +
    + 109 + +
    +   + } +
    +
    + 110 + +
    +   +
    +
    +
    +
    @@ -945,6 +945,9 @@
    +
    + 945 + +
    +   + if e.cfg.SequencerNodeURI != "" { +
    +
    + 946 + +
    +   + return e.relayTxToSequencerNode(input) +
    +
    + 947 + +
    +   + } else { +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 948 + +
    +   + ip := "" +
    +
    + 949 + +
    +   + ips := httpRequest.Header.Get("X-Forwarded-For") +
    +
    + 950 + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 104 + +
    +   + result, err := e.state.ProcessUnsignedTransaction(ctx, tx, sender, blockToProcess, true, dbTx) +
    +
    + 105 + +
    +   + if err != nil { +
    +
    + 106 + +
    +   + errMsg := fmt.Sprintf("failed to execute the unsigned transaction: %v", err.Error()) +
    +
    + 107 + +
    + + + logError := !executor.IsROMOutOfCountersError(executor.RomErrorCode(err)) && !(errors.Is(err, runtime.ErrOutOfGas)) +
    +
    + 108 + +
    +   + return RPCErrorResponse(types.DefaultErrorCode, errMsg, nil, logError) +
    +
    + 109 + +
    +   + } +
    +
    + 110 + +
    +   +
    +
    +
    +
     
    +
    + 945 + +
    +   + if e.cfg.SequencerNodeURI != "" { +
    +
    + 946 + +
    +   + return e.relayTxToSequencerNode(input) +
    +
    + 947 + +
    +   + } else { +
    +
    + 948 + +
    + + + if err := checkPolicy(context.Background(), e.pool, input); err != nil { +
    +
    + 949 + +
    + + + return RPCErrorResponse(types.AccessDeniedCode, err.Error(), nil, false) +
    +
    + 950 + +
    + + + } +
    +
    + 951 + +
    +   + ip := "" +
    +
    + 952 + +
    +   + ips := httpRequest.Header.Get("X-Forwarded-For") +
    +
    + 953 + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/endpoints_eth_test.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -6,6 +6,7 @@
    +
    + 6 + +
    +   + "errors" +
    +
    + 7 + +
    +   + "fmt" +
    +
    + 8 + +
    +   + "math/big" +
    +
    + + +
    +   +
    +
    +
    + 9 + +
    +   + "sync" +
    +
    + 10 + +
    +   + "testing" +
    +
    + 11 + +
    +   + "time" +
    +
    +
    @@ -5416,3 +5417,237 @@
    +
    + 5416 + +
    +   + assert.ElementsMatch(t, []int{13, 14, 15}, results[4]) +
    +
    + 5417 + +
    +   + assert.ElementsMatch(t, []int{16}, results[5]) +
    +
    + 5418 + +
    +   + } +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 6 + +
    +   + "errors" +
    +
    + 7 + +
    +   + "fmt" +
    +
    + 8 + +
    +   + "math/big" +
    +
    + 9 + +
    + + + "strings" +
    +
    + 10 + +
    +   + "sync" +
    +
    + 11 + +
    +   + "testing" +
    +
    + 12 + +
    +   + "time" +
    +
    +
     
    +
    + 5417 + +
    +   + assert.ElementsMatch(t, []int{13, 14, 15}, results[4]) +
    +
    + 5418 + +
    +   + assert.ElementsMatch(t, []int{16}, results[5]) +
    +
    + 5419 + +
    +   + } +
    +
    + 5420 + +
    + + +
    +
    +
    + 5421 + +
    + + + func TestSendRawTransactionJSONRPCCallWithPolicyApplied(t *testing.T) { +
    +
    + 5422 + +
    + + + // Set up the sender +
    +
    + 5423 + +
    + + + allowedPrivateKey, err := crypto.HexToECDSA(strings.TrimPrefix("0x28b2b0318721be8c8339199172cd7cc8f5e273800a35616ec893083a4b32c02e", "0x")) +
    +
    + 5424 + +
    + + + require.NoError(t, err) +
    +
    + 5425 + +
    + + + allowed, err := bind.NewKeyedTransactorWithChainID(allowedPrivateKey, big.NewInt(1)) +
    +
    + 5426 + +
    + + + require.NoError(t, err) +
    +
    + 5427 + +
    + + +
    +
    +
    + 5428 + +
    + + + disallowedPrivateKey, err := crypto.HexToECDSA(strings.TrimPrefix("0xdeadbeef8721be8c8339199172cd7cc8f5e273800a35616ec893083a4b32c02e", "0x")) +
    +
    + 5429 + +
    + + + require.NoError(t, err) +
    +
    + 5430 + +
    + + + disallowed, err := bind.NewKeyedTransactorWithChainID(disallowedPrivateKey, big.NewInt(1)) +
    +
    + 5431 + +
    + + + require.NoError(t, err) +
    +
    + 5432 + +
    + + + require.NotNil(t, disallowed) +
    +
    + 5433 + +
    + + +
    +
    +
    + 5434 + +
    + + + allowedContract := common.HexToAddress("0x1") +
    +
    + 5435 + +
    + + + disallowedContract := common.HexToAddress("0x2") +
    +
    + 5436 + +
    + + +
    +
    +
    + 5437 + +
    + + + senderDenied := types.NewRPCError(types.AccessDeniedCode, "sender disallowed send_tx by policy") +
    +
    + 5438 + +
    + + + contractDenied := types.NewRPCError(types.AccessDeniedCode, "contract disallowed send_tx by policy") +
    +
    + 5439 + +
    + + + deployDenied := types.NewRPCError(types.AccessDeniedCode, "sender disallowed deploy by policy") +
    +
    + 5440 + +
    + + +
    +
    +
    + 5441 + +
    + + + cfg := getSequencerDefaultConfig() +
    +
    + 5442 + +
    + + + s, m, _ := newMockedServerWithCustomConfig(t, cfg) +
    +
    + 5443 + +
    + + + defer s.Stop() +
    +
    + 5444 + +
    + + +
    +
    +
    + 5445 + +
    + + + type testCase struct { +
    +
    + 5446 + +
    + + + Name string +
    +
    + 5447 + +
    + + + Input string +
    +
    + 5448 + +
    + + + ExpectedResult *common.Hash +
    +
    + 5449 + +
    + + + ExpectedError types.Error +
    +
    + 5450 + +
    + + + Prepare func(t *testing.T, tc *testCase) +
    +
    + 5451 + +
    + + + SetupMocks func(t *testing.T, m *mocksWrapper, tc testCase) +
    +
    + 5452 + +
    + + + } +
    +
    + 5453 + +
    + + +
    +
    +
    + 5454 + +
    + + + testCases := []testCase{ +
    +
    + 5455 + +
    + + + { +
    +
    + 5456 + +
    + + + Name: "Sender & contract on allow list, accepted", +
    +
    + 5457 + +
    + + + Prepare: func(t *testing.T, tc *testCase) { +
    +
    + 5458 + +
    + + + tx := ethTypes.NewTransaction(1, allowedContract, big.NewInt(1), uint64(1), big.NewInt(1), []byte{}) +
    +
    + 5459 + +
    + + +
    +
    +
    + 5460 + +
    + + + signedTx, err := allowed.Signer(allowed.From, tx) +
    +
    + 5461 + +
    + + + require.NoError(t, err) +
    +
    + 5462 + +
    + + +
    +
    +
    + 5463 + +
    + + + txBinary, err := signedTx.MarshalBinary() +
    +
    + 5464 + +
    + + + require.NoError(t, err) +
    +
    + 5465 + +
    + + +
    +
    +
    + 5466 + +
    + + + rawTx := hex.EncodeToHex(txBinary) +
    +
    + 5467 + +
    + + + require.NoError(t, err) +
    +
    + 5468 + +
    + + +
    +
    +
    + 5469 + +
    + + + tc.Input = rawTx +
    +
    + 5470 + +
    + + + expectedHash := signedTx.Hash() +
    +
    + 5471 + +
    + + + tc.ExpectedResult = &expectedHash +
    +
    + 5472 + +
    + + + tc.ExpectedError = nil +
    +
    + 5473 + +
    + + + }, +
    +
    + 5474 + +
    + + + SetupMocks: func(t *testing.T, m *mocksWrapper, tc testCase) { +
    +
    + 5475 + +
    + + + m.Pool. +
    +
    + 5476 + +
    + + + On("AddTx", context.Background(), mock.IsType(ethTypes.Transaction{}), ""). +
    +
    + 5477 + +
    + + + Return(nil). +
    +
    + 5478 + +
    + + + Once() +
    +
    + 5479 + +
    + + + m.Pool. +
    +
    + 5480 + +
    + + + On("CheckPolicy", context.Background(), pool.SendTx, allowedContract). +
    +
    + 5481 + +
    + + + Return(true, nil). +
    +
    + 5482 + +
    + + + Once() +
    +
    + 5483 + +
    + + + m.Pool. +
    +
    + 5484 + +
    + + + On("CheckPolicy", context.Background(), pool.SendTx, allowed.From). +
    +
    + 5485 + +
    + + + Return(true, nil). +
    +
    + 5486 + +
    + + + Once() +
    +
    + 5487 + +
    + + + }, +
    +
    + 5488 + +
    + + + }, +
    +
    + 5489 + +
    + + + { +
    +
    + 5490 + +
    + + + Name: "Contract not on allow list, rejected", +
    +
    + 5491 + +
    + + + Prepare: func(t *testing.T, tc *testCase) { +
    +
    + 5492 + +
    + + + tx := ethTypes.NewTransaction(1, disallowedContract, big.NewInt(1), uint64(1), big.NewInt(1), []byte{}) +
    +
    + 5493 + +
    + + +
    +
    +
    + 5494 + +
    + + + signedTx, err := allowed.Signer(allowed.From, tx) +
    +
    + 5495 + +
    + + + require.NoError(t, err) +
    +
    + 5496 + +
    + + +
    +
    +
    + 5497 + +
    + + + txBinary, err := signedTx.MarshalBinary() +
    +
    + 5498 + +
    + + + require.NoError(t, err) +
    +
    + 5499 + +
    + + +
    +
    +
    + 5500 + +
    + + + rawTx := hex.EncodeToHex(txBinary) +
    +
    + 5501 + +
    + + + require.NoError(t, err) +
    +
    + 5502 + +
    + + +
    +
    +
    + 5503 + +
    + + + tc.Input = rawTx +
    +
    + 5504 + +
    + + + tc.ExpectedResult = nil +
    +
    + 5505 + +
    + + + tc.ExpectedError = contractDenied +
    +
    + 5506 + +
    + + + }, +
    +
    + 5507 + +
    + + + SetupMocks: func(t *testing.T, m *mocksWrapper, tc testCase) { +
    +
    + 5508 + +
    + + + m.Pool. +
    +
    + 5509 + +
    + + + On("CheckPolicy", context.Background(), pool.SendTx, disallowedContract). +
    +
    + 5510 + +
    + + + Return(false, contractDenied). +
    +
    + 5511 + +
    + + + Once() +
    +
    + 5512 + +
    + + + }, +
    +
    + 5513 + +
    + + + }, +
    +
    + 5514 + +
    + + + { +
    +
    + 5515 + +
    + + + Name: "Sender not on allow list, rejected", +
    +
    + 5516 + +
    + + + Prepare: func(t *testing.T, tc *testCase) { +
    +
    + 5517 + +
    + + + tx := ethTypes.NewTransaction(1, allowedContract, big.NewInt(1), uint64(1), big.NewInt(1), []byte{}) +
    +
    + 5518 + +
    + + +
    +
    +
    + 5519 + +
    + + + signedTx, err := disallowed.Signer(disallowed.From, tx) +
    +
    + 5520 + +
    + + + require.NoError(t, err) +
    +
    + 5521 + +
    + + +
    +
    +
    + 5522 + +
    + + + txBinary, err := signedTx.MarshalBinary() +
    +
    + 5523 + +
    + + + require.NoError(t, err) +
    +
    + 5524 + +
    + + +
    +
    +
    + 5525 + +
    + + + rawTx := hex.EncodeToHex(txBinary) +
    +
    + 5526 + +
    + + + require.NoError(t, err) +
    +
    + 5527 + +
    + + +
    +
    +
    + 5528 + +
    + + + tc.Input = rawTx +
    +
    + 5529 + +
    + + + tc.ExpectedResult = nil +
    +
    + 5530 + +
    + + + tc.ExpectedError = senderDenied +
    +
    + 5531 + +
    + + + }, +
    +
    + 5532 + +
    + + + SetupMocks: func(t *testing.T, m *mocksWrapper, tc testCase) { +
    +
    + 5533 + +
    + + + m.Pool. +
    +
    + 5534 + +
    + + + On("CheckPolicy", context.Background(), pool.SendTx, allowedContract). +
    +
    + 5535 + +
    + + + Return(true, nil). +
    +
    + 5536 + +
    + + + Once() +
    +
    + 5537 + +
    + + + m.Pool. +
    +
    + 5538 + +
    + + + On("CheckPolicy", context.Background(), pool.SendTx, disallowed.From). +
    +
    + 5539 + +
    + + + Return(false, senderDenied). +
    +
    + 5540 + +
    + + + Once() +
    +
    + 5541 + +
    + + + }, +
    +
    + 5542 + +
    + + + }, +
    +
    + 5543 + +
    + + + { +
    +
    + 5544 + +
    + + + Name: "Unsigned tx with allowed contract, accepted", // for backward compatibility +
    +
    + 5545 + +
    + + + Prepare: func(t *testing.T, tc *testCase) { +
    +
    + 5546 + +
    + + + tx := ethTypes.NewTransaction(1, allowedContract, big.NewInt(1), uint64(1), big.NewInt(1), []byte{}) +
    +
    + 5547 + +
    + + +
    +
    +
    + 5548 + +
    + + + txBinary, err := tx.MarshalBinary() +
    +
    + 5549 + +
    + + + require.NoError(t, err) +
    +
    + 5550 + +
    + + +
    +
    +
    + 5551 + +
    + + + rawTx := hex.EncodeToHex(txBinary) +
    +
    + 5552 + +
    + + + require.NoError(t, err) +
    +
    + 5553 + +
    + + +
    +
    +
    + 5554 + +
    + + + tc.Input = rawTx +
    +
    + 5555 + +
    + + + expectedHash := tx.Hash() +
    +
    + 5556 + +
    + + + tc.ExpectedResult = &expectedHash +
    +
    + 5557 + +
    + + + tc.ExpectedError = nil +
    +
    + 5558 + +
    + + + }, +
    +
    + 5559 + +
    + + + SetupMocks: func(t *testing.T, m *mocksWrapper, tc testCase) { +
    +
    + 5560 + +
    + + + m.Pool. +
    +
    + 5561 + +
    + + + On("AddTx", context.Background(), mock.IsType(ethTypes.Transaction{}), ""). +
    +
    + 5562 + +
    + + + Return(nil). +
    +
    + 5563 + +
    + + + Once() +
    +
    + 5564 + +
    + + + // policy does not reject this case for backward compat +
    +
    + 5565 + +
    + + + }, +
    +
    + 5566 + +
    + + + }, +
    +
    + 5567 + +
    + + + { +
    +
    + 5568 + +
    + + + Name: "Unsigned tx with disallowed contract, rejected", +
    +
    + 5569 + +
    + + + Prepare: func(t *testing.T, tc *testCase) { +
    +
    + 5570 + +
    + + + tx := ethTypes.NewTransaction(1, disallowedContract, big.NewInt(1), uint64(1), big.NewInt(1), []byte{}) +
    +
    + 5571 + +
    + + +
    +
    +
    + 5572 + +
    + + + signedTx, err := disallowed.Signer(disallowed.From, tx) +
    +
    + 5573 + +
    + + + require.NoError(t, err) +
    +
    + 5574 + +
    + + +
    +
    +
    + 5575 + +
    + + + txBinary, err := signedTx.MarshalBinary() +
    +
    + 5576 + +
    + + + require.NoError(t, err) +
    +
    + 5577 + +
    + + +
    +
    +
    + 5578 + +
    + + + rawTx := hex.EncodeToHex(txBinary) +
    +
    + 5579 + +
    + + + require.NoError(t, err) +
    +
    + 5580 + +
    + + +
    +
    +
    + 5581 + +
    + + + tc.Input = rawTx +
    +
    + 5582 + +
    + + + tc.ExpectedResult = nil +
    +
    + 5583 + +
    + + + tc.ExpectedError = contractDenied +
    +
    + 5584 + +
    + + + }, +
    +
    + 5585 + +
    + + + SetupMocks: func(t *testing.T, m *mocksWrapper, tc testCase) { +
    +
    + 5586 + +
    + + + m.Pool. +
    +
    + 5587 + +
    + + + On("CheckPolicy", context.Background(), pool.SendTx, disallowedContract). +
    +
    + 5588 + +
    + + + Return(false, contractDenied). +
    +
    + 5589 + +
    + + + Once() +
    +
    + 5590 + +
    + + + }, +
    +
    + 5591 + +
    + + + }, +
    +
    + 5592 + +
    + + + { +
    +
    + 5593 + +
    + + + Name: "Send invalid tx input", // for backward compatibility +
    +
    + 5594 + +
    + + + Prepare: func(t *testing.T, tc *testCase) { +
    +
    + 5595 + +
    + + + tc.Input = "0x1234" +
    +
    + 5596 + +
    + + + tc.ExpectedResult = nil +
    +
    + 5597 + +
    + + + tc.ExpectedError = types.NewRPCError(types.InvalidParamsErrorCode, "invalid tx input") +
    +
    + 5598 + +
    + + + }, +
    +
    + 5599 + +
    + + + SetupMocks: func(t *testing.T, m *mocksWrapper, tc testCase) {}, +
    +
    + 5600 + +
    + + + }, +
    +
    + 5601 + +
    + + + { +
    +
    + 5602 + +
    + + + Name: "Sender not on deploy allow list, rejected", +
    +
    + 5603 + +
    + + + Prepare: func(t *testing.T, tc *testCase) { +
    +
    + 5604 + +
    + + + deployAddr := common.HexToAddress("0x0") +
    +
    + 5605 + +
    + + + tx := ethTypes.NewTransaction(1, deployAddr, big.NewInt(1), uint64(1), big.NewInt(1), []byte{}) +
    +
    + 5606 + +
    + + +
    +
    +
    + 5607 + +
    + + + signedTx, err := disallowed.Signer(disallowed.From, tx) +
    +
    + 5608 + +
    + + + require.NoError(t, err) +
    +
    + 5609 + +
    + + +
    +
    +
    + 5610 + +
    + + + txBinary, err := signedTx.MarshalBinary() +
    +
    + 5611 + +
    + + + require.NoError(t, err) +
    +
    + 5612 + +
    + + +
    +
    +
    + 5613 + +
    + + + rawTx := hex.EncodeToHex(txBinary) +
    +
    + 5614 + +
    + + + require.NoError(t, err) +
    +
    + 5615 + +
    + + +
    +
    +
    + 5616 + +
    + + + tc.Input = rawTx +
    +
    + 5617 + +
    + + + tc.ExpectedResult = nil +
    +
    + 5618 + +
    + + + tc.ExpectedError = deployDenied +
    +
    + 5619 + +
    + + + }, +
    +
    + 5620 + +
    + + + SetupMocks: func(t *testing.T, m *mocksWrapper, tc testCase) { +
    +
    + 5621 + +
    + + + m.Pool. +
    +
    + 5622 + +
    + + + On("CheckPolicy", context.Background(), pool.Deploy, disallowed.From). +
    +
    + 5623 + +
    + + + Return(false, nil). +
    +
    + 5624 + +
    + + + Once() +
    +
    + 5625 + +
    + + + }, +
    +
    + 5626 + +
    + + + }, +
    +
    + 5627 + +
    + + + } +
    +
    + 5628 + +
    + + +
    +
    +
    + 5629 + +
    + + + for _, testCase := range testCases { +
    +
    + 5630 + +
    + + + t.Run(testCase.Name, func(t *testing.T) { +
    +
    + 5631 + +
    + + + tc := testCase +
    +
    + 5632 + +
    + + + tc.Prepare(t, &tc) +
    +
    + 5633 + +
    + + + tc.SetupMocks(t, m, tc) +
    +
    + 5634 + +
    + + +
    +
    +
    + 5635 + +
    + + + res, err := s.JSONRPCCall("eth_sendRawTransaction", tc.Input) +
    +
    + 5636 + +
    + + + require.NoError(t, err) +
    +
    + 5637 + +
    + + +
    +
    +
    + 5638 + +
    + + + assert.Equal(t, float64(1), res.ID) +
    +
    + 5639 + +
    + + + assert.Equal(t, "2.0", res.JSONRPC) +
    +
    + 5640 + +
    + + +
    +
    +
    + 5641 + +
    + + + if res.Result != nil || tc.ExpectedResult != nil { +
    +
    + 5642 + +
    + + + var result common.Hash +
    +
    + 5643 + +
    + + + err = json.Unmarshal(res.Result, &result) +
    +
    + 5644 + +
    + + + require.NoError(t, err) +
    +
    + 5645 + +
    + + + assert.Equal(t, *tc.ExpectedResult, result) +
    +
    + 5646 + +
    + + + } +
    +
    + 5647 + +
    + + + if res.Error != nil || tc.ExpectedError != nil { +
    +
    + 5648 + +
    + + + assert.Equal(t, tc.ExpectedError.ErrorCode(), res.Error.Code) +
    +
    + 5649 + +
    + + + assert.Equal(t, tc.ExpectedError.Error(), res.Error.Message) +
    +
    + 5650 + +
    + + + } +
    +
    + 5651 + +
    + + + }) +
    +
    + 5652 + +
    + + + } +
    +
    + 5653 + +
    + + + } +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/endpoints_zkevm.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -204,6 +204,53 @@
    +
    + 204 + +
    +   + }) +
    +
    + 205 + +
    +   + } +
    +
    + 206 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 207 + +
    +   + // GetFullBlockByNumber returns information about a block by block number +
    +
    + 208 + +
    +   + func (z *ZKEVMEndpoints) GetFullBlockByNumber(number types.BlockNumber, fullTx bool) (interface{}, types.Error) { +
    +
    + 209 + +
    +   + return z.txMan.NewDbTxScope(z.state, func(ctx context.Context, dbTx pgx.Tx) (interface{}, types.Error) { +
    +
    +
    @@ -516,7 +563,7 @@
    +
    + 516 + +
    +   +
    +
    +
    + 517 + +
    +   + if txEGP.Cmp(txGasPrice) == -1 { // txEGP < txGasPrice +
    +
    + 518 + +
    +   + // We need to "round" the final effectiveGasPrice to a 256 fraction of the txGasPrice +
    +
    + 519 + +
    + - + txEGPPct, err = z.pool.CalculateEffectiveGasPricePercentage(txGasPrice, txEGP) +
    +
    + 520 + +
    +   + if err != nil { +
    +
    + 521 + +
    +   + return nil, nil, types.NewRPCError(types.DefaultErrorCode, "failed to calculate effective gas price percentage", err, false) +
    +
    + 522 + +
    +   + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 204 + +
    +   + }) +
    +
    + 205 + +
    +   + } +
    +
    + 206 + +
    +   +
    +
    +
    + 207 + +
    + + + type batchDataFunc func(ctx context.Context, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error) +
    +
    + 208 + +
    + + +
    +
    +
    + 209 + +
    + + + // GetBatchDataByNumbers returns L2 batch data by batch numbers. +
    +
    + 210 + +
    + + + func (z *ZKEVMEndpoints) GetBatchDataByNumbers(filter types.BatchFilter) (interface{}, types.Error) { +
    +
    + 211 + +
    + + + return z.getBatchData(filter, z.state.GetBatchL2DataByNumbers) +
    +
    + 212 + +
    + + + } +
    +
    + 213 + +
    + + +
    +
    +
    + 214 + +
    + + + // GetForcedBatchDataByNumbers returns forced batch data by batch numbers. +
    +
    + 215 + +
    + + + func (z *ZKEVMEndpoints) GetForcedBatchDataByNumbers(filter types.BatchFilter) (interface{}, types.Error) { +
    +
    + 216 + +
    + + + return z.getBatchData(filter, z.state.GetForcedBatchDataByNumbers) +
    +
    + 217 + +
    + + + } +
    +
    + 218 + +
    + + +
    +
    +
    + 219 + +
    + + + func (z *ZKEVMEndpoints) getBatchData(filter types.BatchFilter, f batchDataFunc) (interface{}, types.Error) { +
    +
    + 220 + +
    + + + return z.txMan.NewDbTxScope(z.state, func(ctx context.Context, dbTx pgx.Tx) (interface{}, types.Error) { +
    +
    + 221 + +
    + + + batchNumbers := make([]uint64, 0, len(filter.Numbers)) +
    +
    + 222 + +
    + + + for _, bn := range filter.Numbers { +
    +
    + 223 + +
    + + + n, rpcErr := bn.GetNumericBatchNumber(ctx, z.state, z.etherman, dbTx) +
    +
    + 224 + +
    + + + if rpcErr != nil { +
    +
    + 225 + +
    + + + return nil, rpcErr +
    +
    + 226 + +
    + + + } +
    +
    + 227 + +
    + + + batchNumbers = append(batchNumbers, n) +
    +
    + 228 + +
    + + + } +
    +
    + 229 + +
    + + +
    +
    +
    + 230 + +
    + + + batchesData, err := f(ctx, batchNumbers, dbTx) +
    +
    + 231 + +
    + + + if errors.Is(err, state.ErrNotFound) { +
    +
    + 232 + +
    + + + return nil, nil +
    +
    + 233 + +
    + + + } else if err != nil { +
    +
    + 234 + +
    + + + return RPCErrorResponse(types.DefaultErrorCode, +
    +
    + 235 + +
    + + + fmt.Sprintf("couldn't load batch data from state by numbers %v", filter.Numbers), err, true) +
    +
    + 236 + +
    + + + } +
    +
    + 237 + +
    + + +
    +
    +
    + 238 + +
    + + + ret := make([]*types.BatchData, 0, len(batchNumbers)) +
    +
    + 239 + +
    + + + for _, n := range batchNumbers { +
    +
    + 240 + +
    + + + data := &types.BatchData{Number: types.ArgUint64(n)} +
    +
    + 241 + +
    + + + if b, ok := batchesData[n]; ok { +
    +
    + 242 + +
    + + + data.BatchL2Data = b +
    +
    + 243 + +
    + + + data.Empty = false +
    +
    + 244 + +
    + + + } else { +
    +
    + 245 + +
    + + + data.Empty = true +
    +
    + 246 + +
    + + + } +
    +
    + 247 + +
    + + + ret = append(ret, data) +
    +
    + 248 + +
    + + + } +
    +
    + 249 + +
    + + +
    +
    +
    + 250 + +
    + + + return types.BatchDataResult{Data: ret}, nil +
    +
    + 251 + +
    + + + }) +
    +
    + 252 + +
    + + + } +
    +
    + 253 + +
    + + +
    +
    +
    + 254 + +
    +   + // GetFullBlockByNumber returns information about a block by block number +
    +
    + 255 + +
    +   + func (z *ZKEVMEndpoints) GetFullBlockByNumber(number types.BlockNumber, fullTx bool) (interface{}, types.Error) { +
    +
    + 256 + +
    +   + return z.txMan.NewDbTxScope(z.state, func(ctx context.Context, dbTx pgx.Tx) (interface{}, types.Error) { +
    +
    +
     
    +
    + 563 + +
    +   +
    +
    +
    + 564 + +
    +   + if txEGP.Cmp(txGasPrice) == -1 { // txEGP < txGasPrice +
    +
    + 565 + +
    +   + // We need to "round" the final effectiveGasPrice to a 256 fraction of the txGasPrice +
    +
    + 566 + +
    + + + txEGPPct, err = state.CalculateEffectiveGasPricePercentage(txGasPrice, txEGP) +
    +
    + 567 + +
    +   + if err != nil { +
    +
    + 568 + +
    +   + return nil, nil, types.NewRPCError(types.DefaultErrorCode, "failed to calculate effective gas price percentage", err, false) +
    +
    + 569 + +
    +   + } +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/endpoints_zkevm_test.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -2705,3 +2705,32 @@
    +
    + 2705 + +
    +   + }) +
    +
    + 2706 + +
    +   + } +
    +
    + 2707 + +
    +   + } +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 2705 + +
    +   + }) +
    +
    + 2706 + +
    +   + } +
    +
    + 2707 + +
    +   + } +
    +
    + 2708 + +
    + + +
    +
    +
    + 2709 + +
    + + + func TestClient_BatchesByNumbers(t *testing.T) { +
    +
    + 2710 + +
    + + + const batchesCount = 6 +
    +
    + 2711 + +
    + + +
    +
    +
    + 2712 + +
    + + + s, m, _ := newSequencerMockedServer(t) +
    +
    + 2713 + +
    + + + defer s.Stop() +
    +
    + 2714 + +
    + + +
    +
    +
    + 2715 + +
    + + + batchesDataMap := make(map[uint64][]byte, batchesCount) +
    +
    + 2716 + +
    + + + for i := 0; i < batchesCount; i++ { +
    +
    + 2717 + +
    + + + batchesDataMap[uint64(i+1)] = []byte(fmt.Sprintf("batch %d data", i+1)) +
    +
    + 2718 + +
    + + + } +
    +
    + 2719 + +
    + + +
    +
    +
    + 2720 + +
    + + + m.State.On("GetBatchL2DataByNumbers", mock.Anything, mock.Anything, mock.Anything). +
    +
    + 2721 + +
    + + + Return(batchesDataMap, nil).Once() +
    +
    + 2722 + +
    + + +
    +
    +
    + 2723 + +
    + + + m.State.On("BeginStateTransaction", context.Background()). +
    +
    + 2724 + +
    + + + Return(m.DbTx, nil).Once() +
    +
    + 2725 + +
    + + +
    +
    +
    + 2726 + +
    + + + m.DbTx.On("Commit", context.Background()).Return(nil).Once() +
    +
    + 2727 + +
    + + +
    +
    +
    + 2728 + +
    + + + zkEVMClient := client.NewClient(s.ServerURL) +
    +
    + 2729 + +
    + + + reqBatchesNum := []*big.Int{big.NewInt(1), big.NewInt(3), big.NewInt(4)} +
    +
    + 2730 + +
    + + + result, err := zkEVMClient.BatchesByNumbers(context.Background(), reqBatchesNum) +
    +
    + 2731 + +
    + + + require.NoError(t, err) +
    +
    + 2732 + +
    + + + require.Len(t, result, len(reqBatchesNum)) +
    +
    + 2733 + +
    + + + for i, batchNum := range reqBatchesNum { +
    +
    + 2734 + +
    + + + require.Equal(t, hex.EncodeToHex(batchesDataMap[batchNum.Uint64()]), result[i].BatchL2Data.Hex()) +
    +
    + 2735 + +
    + + + } +
    +
    + 2736 + +
    + + + } +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/policy.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -0,0 +1,61 @@
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 1 + +
    + + + package jsonrpc +
    +
    + 2 + +
    + + +
    +
    +
    + 3 + +
    + + + import ( +
    +
    + 4 + +
    + + + "context" +
    +
    + 5 + +
    + + +
    +
    +
    + 6 + +
    + + + "github.com/0xPolygonHermez/zkevm-node/jsonrpc/types" +
    +
    + 7 + +
    + + + "github.com/0xPolygonHermez/zkevm-node/pool" +
    +
    + 8 + +
    + + + "github.com/0xPolygonHermez/zkevm-node/state" +
    +
    + 9 + +
    + + + "github.com/ethereum/go-ethereum/common" +
    +
    + 10 + +
    + + + ethTypes "github.com/ethereum/go-ethereum/core/types" +
    +
    + 11 + +
    + + + ) +
    +
    + 12 + +
    + + +
    +
    +
    + 13 + +
    + + + func checkPolicy(ctx context.Context, p types.PoolInterface, input string) error { +
    +
    + 14 + +
    + + + tx, err := hexToTx(input) +
    +
    + 15 + +
    + + + if err != nil { +
    +
    + 16 + +
    + + + // ignore it, let the later processing reject +
    +
    + 17 + +
    + + + return nil +
    +
    + 18 + +
    + + + } +
    +
    + 19 + +
    + + +
    +
    +
    + 20 + +
    + + + // if the tx is signed, check the from address. If there is no from address, the tx is not rejected as it +
    +
    + 21 + +
    + + + // will get rejected later. This maintains backward compatibility with RPC expectations. TODO: verify this is ok behavior +
    +
    + 22 + +
    + + + var from common.Address +
    +
    + 23 + +
    + + + if from, err = state.GetSender(*tx); err != nil { +
    +
    + 24 + +
    + + + // if not signed, then skip check, it fails later on its own +
    +
    + 25 + +
    + + + return nil +
    +
    + 26 + +
    + + + } +
    +
    + 27 + +
    + + +
    +
    +
    + 28 + +
    + + + switch resolvePolicy(tx) { +
    +
    + 29 + +
    + + + case pool.SendTx: +
    +
    + 30 + +
    + + + var allow bool +
    +
    + 31 + +
    + + + if allow, err = p.CheckPolicy(ctx, pool.SendTx, *tx.To()); err != nil { +
    +
    + 32 + +
    + + + return err +
    +
    + 33 + +
    + + + } +
    +
    + 34 + +
    + + + if !allow { +
    +
    + 35 + +
    + + + return pool.ErrContractDisallowedSendTx +
    +
    + 36 + +
    + + + } +
    +
    + 37 + +
    + + + if allow, err = p.CheckPolicy(ctx, pool.SendTx, from); err != nil { +
    +
    + 38 + +
    + + + return err +
    +
    + 39 + +
    + + + } +
    +
    + 40 + +
    + + + if !allow { +
    +
    + 41 + +
    + + + return pool.ErrSenderDisallowedSendTx +
    +
    + 42 + +
    + + + } +
    +
    + 43 + +
    + + + case pool.Deploy: +
    +
    + 44 + +
    + + + var allow bool +
    +
    + 45 + +
    + + + // check that sender may deploy contracts +
    +
    + 46 + +
    + + + if allow, err = p.CheckPolicy(ctx, pool.Deploy, from); err != nil { +
    +
    + 47 + +
    + + + return err +
    +
    + 48 + +
    + + + } +
    +
    + 49 + +
    + + + if !allow { +
    +
    + 50 + +
    + + + return pool.ErrSenderDisallowedDeploy +
    +
    + 51 + +
    + + + } +
    +
    + 52 + +
    + + + } +
    +
    + 53 + +
    + + + return nil +
    +
    + 54 + +
    + + + } +
    +
    + 55 + +
    + + +
    +
    +
    + 56 + +
    + + + func resolvePolicy(tx *ethTypes.Transaction) pool.PolicyName { +
    +
    + 57 + +
    + + + if tx.To() == nil || tx.To().Hex() == common.HexToAddress("0x0").Hex() { +
    +
    + 58 + +
    + + + return pool.Deploy +
    +
    + 59 + +
    + + + } +
    +
    + 60 + +
    + + + return pool.SendTx +
    +
    + 61 + +
    + + + } +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/types/errors.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -15,6 +15,8 @@
    +
    + 15 + +
    +   + InvalidParamsErrorCode = -32602 +
    +
    + 16 + +
    +   + // ParserErrorCode error code for parsing errors +
    +
    + 17 + +
    +   + ParserErrorCode = -32700 +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 18 + +
    +   + ) +
    +
    + 19 + +
    +   +
    +
    +
    + 20 + +
    +   + var ( +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 15 + +
    +   + InvalidParamsErrorCode = -32602 +
    +
    + 16 + +
    +   + // ParserErrorCode error code for parsing errors +
    +
    + 17 + +
    +   + ParserErrorCode = -32700 +
    +
    + 18 + +
    + + + // AccessDeniedCode error code when requests are denied +
    +
    + 19 + +
    + + + AccessDeniedCode = -32800 +
    +
    + 20 + +
    +   + ) +
    +
    + 21 + +
    +   +
    +
    +
    + 22 + +
    +   + var ( +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/types/interfaces.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -23,8 +23,8 @@
    +
    + 23 + +
    +   + CountPendingTransactions(ctx context.Context) (uint64, error) +
    +
    + 24 + +
    +   + GetTransactionByHash(ctx context.Context, hash common.Hash) (*pool.Transaction, error) +
    +
    + 25 + +
    +   + GetTransactionByL2Hash(ctx context.Context, hash common.Hash) (*pool.Transaction, error) +
    +
    + + +
    +   +
    +
    +
    + 26 + +
    +   + CalculateEffectiveGasPrice(rawTx []byte, txGasPrice *big.Int, txGasUsed uint64, l1GasPrice uint64, l2GasPrice uint64) (*big.Int, error) +
    +
    + 27 + +
    + - + CalculateEffectiveGasPricePercentage(gasPrice *big.Int, effectiveGasPrice *big.Int) (uint8, error) +
    +
    + 28 + +
    +   + EffectiveGasPriceEnabled() bool +
    +
    + 29 + +
    +   + } +
    +
    + 30 + +
    +   +
    +
    +
    +
    @@ -64,6 +64,8 @@
    +
    + 64 + +
    +   + GetLastVerifiedBatch(ctx context.Context, dbTx pgx.Tx) (*state.VerifiedBatch, error) +
    +
    + 65 + +
    +   + GetLastBatchNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error) +
    +
    + 66 + +
    +   + GetBatchByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.Batch, error) +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 67 + +
    +   + GetTransactionsByBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (txs []types.Transaction, effectivePercentages []uint8, err error) +
    +
    + 68 + +
    +   + GetVirtualBatch(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.VirtualBatch, error) +
    +
    + 69 + +
    +   + GetVerifiedBatch(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.VerifiedBatch, error) +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 23 + +
    +   + CountPendingTransactions(ctx context.Context) (uint64, error) +
    +
    + 24 + +
    +   + GetTransactionByHash(ctx context.Context, hash common.Hash) (*pool.Transaction, error) +
    +
    + 25 + +
    +   + GetTransactionByL2Hash(ctx context.Context, hash common.Hash) (*pool.Transaction, error) +
    +
    + 26 + +
    + + + CheckPolicy(ctx context.Context, policy pool.PolicyName, address common.Address) (bool, error) +
    +
    + 27 + +
    +   + CalculateEffectiveGasPrice(rawTx []byte, txGasPrice *big.Int, txGasUsed uint64, l1GasPrice uint64, l2GasPrice uint64) (*big.Int, error) +
    +
    + + +
    +   +
    +
    +
    + 28 + +
    +   + EffectiveGasPriceEnabled() bool +
    +
    + 29 + +
    +   + } +
    +
    + 30 + +
    +   +
    +
    +
    +
     
    +
    + 64 + +
    +   + GetLastVerifiedBatch(ctx context.Context, dbTx pgx.Tx) (*state.VerifiedBatch, error) +
    +
    + 65 + +
    +   + GetLastBatchNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error) +
    +
    + 66 + +
    +   + GetBatchByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.Batch, error) +
    +
    + 67 + +
    + + + GetBatchL2DataByNumbers(ctx context.Context, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error) +
    +
    + 68 + +
    + + + GetForcedBatchDataByNumbers(ctx context.Context, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error) +
    +
    + 69 + +
    +   + GetTransactionsByBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (txs []types.Transaction, effectivePercentages []uint8, err error) +
    +
    + 70 + +
    +   + GetVirtualBatch(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.VirtualBatch, error) +
    +
    + 71 + +
    +   + GetVerifiedBatch(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.VerifiedBatch, error) +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/types/types.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -446,6 +446,23 @@
    +
    + 446 + +
    +   + return res, nil +
    +
    + 447 + +
    +   + } +
    +
    + 448 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 449 + +
    +   + // TransactionOrHash for union type of transaction and types.Hash +
    +
    + 450 + +
    +   + type TransactionOrHash struct { +
    +
    + 451 + +
    +   + Hash *common.Hash +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 446 + +
    +   + return res, nil +
    +
    + 447 + +
    +   + } +
    +
    + 448 + +
    +   +
    +
    +
    + 449 + +
    + + + // BatchFilter is a list of batch numbers to retrieve +
    +
    + 450 + +
    + + + type BatchFilter struct { +
    +
    + 451 + +
    + + + Numbers []BatchNumber `json:"numbers"` +
    +
    + 452 + +
    + + + } +
    +
    + 453 + +
    + + +
    +
    +
    + 454 + +
    + + + // BatchData is an abbreviated structure that only contains the number and L2 batch data +
    +
    + 455 + +
    + + + type BatchData struct { +
    +
    + 456 + +
    + + + Number ArgUint64 `json:"number"` +
    +
    + 457 + +
    + + + BatchL2Data ArgBytes `json:"batchL2Data,omitempty"` +
    +
    + 458 + +
    + + + Empty bool `json:"empty"` +
    +
    + 459 + +
    + + + } +
    +
    + 460 + +
    + + +
    +
    +
    + 461 + +
    + + + // BatchDataResult is a list of BatchData for a BatchFilter +
    +
    + 462 + +
    + + + type BatchDataResult struct { +
    +
    + 463 + +
    + + + Data []*BatchData `json:"data"` +
    +
    + 464 + +
    + + + } +
    +
    + 465 + +
    + + +
    +
    +
    + 466 + +
    +   + // TransactionOrHash for union type of transaction and types.Hash +
    +
    + 467 + +
    +   + type TransactionOrHash struct { +
    +
    + 468 + +
    +   + Hash *common.Hash +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/l1infotree/tree.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -192,11 +192,6 @@
    +
    + 192 + +
    +   + return mt.ComputeMerkleProof(mt.count, initialLeaves) +
    +
    + 193 + +
    +   + } +
    +
    + 194 + +
    +   +
    +
    +
    + 195 + +
    + - + // GetRoot returns the root of the L1InfoTree +
    +
    + 196 + +
    + - + func (mt *L1InfoTree) GetRoot() common.Hash { +
    +
    + 197 + +
    + - + return mt.currentRoot +
    +
    + 198 + +
    + - + } +
    +
    + 199 + +
    + - +
    +
    +
    + 200 + +
    +   + // GetCurrentRootCountAndSiblings returns the latest root, count and sibblings +
    +
    + 201 + +
    +   + func (mt *L1InfoTree) GetCurrentRootCountAndSiblings() (common.Hash, uint32, [][32]byte) { +
    +
    + 202 + +
    +   + return mt.currentRoot, mt.count, mt.siblings +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 192 + +
    +   + return mt.ComputeMerkleProof(mt.count, initialLeaves) +
    +
    + 193 + +
    +   + } +
    +
    + 194 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 195 + +
    +   + // GetCurrentRootCountAndSiblings returns the latest root, count and sibblings +
    +
    + 196 + +
    +   + func (mt *L1InfoTree) GetCurrentRootCountAndSiblings() (common.Hash, uint32, [][32]byte) { +
    +
    + 197 + +
    +   + return mt.currentRoot, mt.count, mt.siblings +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/l1infotree/tree_recursive.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,94 +0,0 @@
    +
    + 1 + +
    + - + package l1infotree +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + import ( +
    +
    + 4 + +
    + - + "github.com/ethereum/go-ethereum/common" +
    +
    + 5 + +
    + - + "github.com/ethereum/go-ethereum/crypto" +
    +
    + 6 + +
    + - + ) +
    +
    + 7 + +
    + - +
    +
    +
    + 8 + +
    + - + const ( +
    +
    + 9 + +
    + - + emptyHistoricL1InfoTreeRoot = "0x27ae5ba08d7291c96c8cbddcc148bf48a6d68c7974b94356f53754ef6171d757" +
    +
    + 10 + +
    + - + ) +
    +
    + 11 + +
    + - +
    +
    +
    + 12 + +
    + - + // L1InfoTreeRecursive is a recursive implementation of the L1InfoTree of Feijoa +
    +
    + 13 + +
    + - + type L1InfoTreeRecursive struct { +
    +
    + 14 + +
    + - + historicL1InfoTree *L1InfoTree +
    +
    + 15 + +
    + - + currentLeaf common.Hash +
    +
    + 16 + +
    + - + } +
    +
    + 17 + +
    + - +
    +
    +
    + 18 + +
    + - + // L1InfoTreeRecursiveSnapshot provides the information generated when a new +
    +
    + 19 + +
    + - + // leaf is added to the tree +
    +
    + 20 + +
    + - + type L1InfoTreeRecursiveSnapshot struct { +
    +
    + 21 + +
    + - + HistoricL1InfoTreeRoot common.Hash +
    +
    + 22 + +
    + - + L1Data common.Hash +
    +
    + 23 + +
    + - + L1InfoTreeRoot common.Hash +
    +
    + 24 + +
    + - + } +
    +
    + 25 + +
    + - +
    +
    +
    + 26 + +
    + - + // NewL1InfoTreeRecursive creates a new empty L1InfoTreeRecursive +
    +
    + 27 + +
    + - + func NewL1InfoTreeRecursive(height uint8) (*L1InfoTreeRecursive, error) { +
    +
    + 28 + +
    + - + historic, err := NewL1InfoTree(height, nil) +
    +
    + 29 + +
    + - + if err != nil { +
    +
    + 30 + +
    + - + return nil, err +
    +
    + 31 + +
    + - + } +
    +
    + 32 + +
    + - +
    +
    +
    + 33 + +
    + - + mtr := &L1InfoTreeRecursive{ +
    +
    + 34 + +
    + - + historicL1InfoTree: historic, +
    +
    + 35 + +
    + - + currentLeaf: common.Hash{}, +
    +
    + 36 + +
    + - + } +
    +
    + 37 + +
    + - + return mtr, nil +
    +
    + 38 + +
    + - + } +
    +
    + 39 + +
    + - +
    +
    +
    + 40 + +
    + - + // NewL1InfoTreeRecursiveFromLeaves creates a new L1InfoTreeRecursive from leaves as they are +
    +
    + 41 + +
    + - + func NewL1InfoTreeRecursiveFromLeaves(height uint8, leaves [][32]byte) (*L1InfoTreeRecursive, error) { +
    +
    + 42 + +
    + - + mtr, err := NewL1InfoTreeRecursive(height) +
    +
    + 43 + +
    + - + if err != nil { +
    +
    + 44 + +
    + - + return nil, err +
    +
    + 45 + +
    + - + } +
    +
    + 46 + +
    + - +
    +
    +
    + 47 + +
    + - + for i, leaf := range leaves { +
    +
    + 48 + +
    + - + _, err := mtr.AddLeaf(uint32(i), leaf) +
    +
    + 49 + +
    + - + if err != nil { +
    +
    + 50 + +
    + - + return nil, err +
    +
    + 51 + +
    + - + } +
    +
    + 52 + +
    + - + mtr.currentLeaf = leaf +
    +
    + 53 + +
    + - + } +
    +
    + 54 + +
    + - + return mtr, nil +
    +
    + 55 + +
    + - + } +
    +
    + 56 + +
    + - +
    +
    +
    + 57 + +
    + - + // AddLeaf hashes the current historicL1InfoRoot + currentLeaf data into the new historicLeaf value, +
    +
    + 58 + +
    + - + // then adds it to the historicL1InfoTree and finally stores the new leaf as the currentLeaf +
    +
    + 59 + +
    + - + func (mt *L1InfoTreeRecursive) AddLeaf(index uint32, leaf [32]byte) (common.Hash, error) { +
    +
    + 60 + +
    + - + // adds the current l1InfoTreeRoot into the historic tree to generate +
    +
    + 61 + +
    + - + // the next historicL2InfoTreeRoot +
    +
    + 62 + +
    + - + l1InfoTreeRoot := mt.GetRoot() +
    +
    + 63 + +
    + - + _, err := mt.historicL1InfoTree.AddLeaf(index, l1InfoTreeRoot) +
    +
    + 64 + +
    + - + if err != nil { +
    +
    + 65 + +
    + - + return common.Hash{}, err +
    +
    + 66 + +
    + - + } +
    +
    + 67 + +
    + - +
    +
    +
    + 68 + +
    + - + mt.currentLeaf = leaf +
    +
    + 69 + +
    + - +
    +
    +
    + 70 + +
    + - + return mt.GetRoot(), nil +
    +
    + 71 + +
    + - + } +
    +
    + 72 + +
    + - +
    +
    +
    + 73 + +
    + - + // GetRoot returns the root of the L1InfoTreeRecursive +
    +
    + 74 + +
    + - + func (mt *L1InfoTreeRecursive) GetRoot() common.Hash { +
    +
    + 75 + +
    + - + // if the historicL1InfoTree is empty and the the current leaf is also empty +
    +
    + 76 + +
    + - + // returns the root as all zeros 0x0000...0000 +
    +
    + 77 + +
    + - + if mt.historicL1InfoTree.GetRoot().String() == emptyHistoricL1InfoTreeRoot && +
    +
    + 78 + +
    + - + mt.currentLeaf.Cmp(common.Hash{}) == 0 { +
    +
    + 79 + +
    + - + return common.Hash{} +
    +
    + 80 + +
    + - + } +
    +
    + 81 + +
    + - +
    +
    +
    + 82 + +
    + - + l1InfoTreeRoot := crypto.Keccak256Hash(mt.historicL1InfoTree.GetRoot().Bytes(), mt.currentLeaf[:]) +
    +
    + 83 + +
    + - + return l1InfoTreeRoot +
    +
    + 84 + +
    + - + } +
    +
    + 85 + +
    + - +
    +
    +
    + 86 + +
    + - + // GetHistoricRoot returns the root of the HistoricL1InfoTree +
    +
    + 87 + +
    + - + func (mt *L1InfoTreeRecursive) GetHistoricRoot() common.Hash { +
    +
    + 88 + +
    + - + return mt.historicL1InfoTree.GetRoot() +
    +
    + 89 + +
    + - + } +
    +
    + 90 + +
    + - +
    +
    +
    + 91 + +
    + - + // ComputeMerkleProof computes the Merkle proof from the leaves +
    +
    + 92 + +
    + - + func (mt *L1InfoTreeRecursive) ComputeMerkleProof(gerIndex uint32, leaves [][32]byte) ([][32]byte, common.Hash, error) { +
    +
    + 93 + +
    + - + return mt.historicL1InfoTree.ComputeMerkleProof(gerIndex, leaves) +
    +
    + 94 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/l1infotree/tree_recursive_test.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,113 +0,0 @@
    +
    + 1 + +
    + - + package l1infotree_test +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + import ( +
    +
    + 4 + +
    + - + "encoding/json" +
    +
    + 5 + +
    + - + "os" +
    +
    + 6 + +
    + - + "strconv" +
    +
    + 7 + +
    + - + "testing" +
    +
    + 8 + +
    + - +
    +
    +
    + 9 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/l1infotree" +
    +
    + 10 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/log" +
    +
    + 11 + +
    + - + "github.com/ethereum/go-ethereum/common" +
    +
    + 12 + +
    + - + "github.com/stretchr/testify/assert" +
    +
    + 13 + +
    + - + "github.com/stretchr/testify/require" +
    +
    + 14 + +
    + - + ) +
    +
    + 15 + +
    + - +
    +
    +
    + 16 + +
    + - + const ( +
    +
    + 17 + +
    + - + l1InfoRootRecursiveHeight = uint8(32) +
    +
    + 18 + +
    + - + emptyL1InfoTreeRecursiveRoot = "0x27ae5ba08d7291c96c8cbddcc148bf48a6d68c7974b94356f53754ef6171d757" +
    +
    + 19 + +
    + - + filenameTestData = "../test/vectors/src/merkle-tree/l1-info-tree-recursive/smt-full-output.json" +
    +
    + 20 + +
    + - + ) +
    +
    + 21 + +
    + - +
    +
    +
    + 22 + +
    + - + type vectorTestData struct { +
    +
    + 23 + +
    + - + GlobalExitRoot common.Hash `json:"globalExitRoot"` +
    +
    + 24 + +
    + - + BlockHash common.Hash `json:"blockHash"` +
    +
    + 25 + +
    + - + MinTimestamp string `json:"minTimestamp"` +
    +
    + 26 + +
    + - + SmtProof []common.Hash `json:"smtProof"` +
    +
    + 27 + +
    + - + Index uint32 `json:"index"` +
    +
    + 28 + +
    + - + PreviousIndex uint32 `json:"previousIndex"` +
    +
    + 29 + +
    + - + PreviousL1InfoTreeRoot common.Hash `json:"previousL1InfoTreeRoot"` +
    +
    + 30 + +
    + - + L1DataHash common.Hash `json:"l1DataHash"` +
    +
    + 31 + +
    + - + L1InfoTreeRoot common.Hash `json:"l1InfoTreeRoot"` +
    +
    + 32 + +
    + - + HistoricL1InfoRoot common.Hash `json:"historicL1InfoRoot"` +
    +
    + 33 + +
    + - + } +
    +
    + 34 + +
    + - +
    +
    +
    + 35 + +
    + - + func readData(t *testing.T) []vectorTestData { +
    +
    + 36 + +
    + - + data, err := os.ReadFile(filenameTestData) +
    +
    + 37 + +
    + - + require.NoError(t, err) +
    +
    + 38 + +
    + - + var mtTestVectors []vectorTestData +
    +
    + 39 + +
    + - + err = json.Unmarshal(data, &mtTestVectors) +
    +
    + 40 + +
    + - + require.NoError(t, err) +
    +
    + 41 + +
    + - + return mtTestVectors +
    +
    + 42 + +
    + - + } +
    +
    + 43 + +
    + - +
    +
    +
    + 44 + +
    + - + func TestEmptyL1InfoRootRecursive(t *testing.T) { +
    +
    + 45 + +
    + - + mtr, err := l1infotree.NewL1InfoTreeRecursive(l1InfoRootRecursiveHeight) +
    +
    + 46 + +
    + - + require.NoError(t, err) +
    +
    + 47 + +
    + - + require.NotNil(t, mtr) +
    +
    + 48 + +
    + - + root := mtr.GetRoot() +
    +
    + 49 + +
    + - + require.Equal(t, common.Hash{}.String(), root.String()) +
    +
    + 50 + +
    + - + } +
    +
    + 51 + +
    + - +
    +
    +
    + 52 + +
    + - + func TestEmptyHistoricL1InfoRootRecursive(t *testing.T) { +
    +
    + 53 + +
    + - + mtr, err := l1infotree.NewL1InfoTreeRecursive(l1InfoRootRecursiveHeight) +
    +
    + 54 + +
    + - + require.NoError(t, err) +
    +
    + 55 + +
    + - + require.NotNil(t, mtr) +
    +
    + 56 + +
    + - + root := mtr.GetHistoricRoot() +
    +
    + 57 + +
    + - + require.Equal(t, emptyL1InfoTreeRecursiveRoot, root.String()) +
    +
    + 58 + +
    + - + } +
    +
    + 59 + +
    + - +
    +
    +
    + 60 + +
    + - + func TestBuildTreeVectorData(t *testing.T) { +
    +
    + 61 + +
    + - + data := readData(t) +
    +
    + 62 + +
    + - + mtr, err := l1infotree.NewL1InfoTreeRecursive(l1InfoRootRecursiveHeight) +
    +
    + 63 + +
    + - + require.NoError(t, err) +
    +
    + 64 + +
    + - + for _, testVector := range data { +
    +
    + 65 + +
    + - + minTimestamp, err := strconv.ParseUint(testVector.MinTimestamp, 10, 0) +
    +
    + 66 + +
    + - + require.NoError(t, err) +
    +
    + 67 + +
    + - + l1Data := l1infotree.HashLeafData(testVector.GlobalExitRoot, testVector.BlockHash, minTimestamp) +
    +
    + 68 + +
    + - + l1DataHash := common.BytesToHash(l1Data[:]) +
    +
    + 69 + +
    + - + assert.Equal(t, testVector.L1DataHash.String(), l1DataHash.String(), "l1Data doesn't match leaf", testVector.Index) +
    +
    + 70 + +
    + - +
    +
    +
    + 71 + +
    + - + l1InfoTreeRoot, err := mtr.AddLeaf(testVector.Index-1, l1Data) +
    +
    + 72 + +
    + - + require.NoError(t, err) +
    +
    + 73 + +
    + - + assert.Equal(t, testVector.L1InfoTreeRoot.String(), l1InfoTreeRoot.String(), "l1InfoTreeRoot doesn't match leaf", testVector.Index) +
    +
    + 74 + +
    + - + assert.Equal(t, testVector.L1InfoTreeRoot.String(), mtr.GetRoot().String(), "l1InfoTreeRoot doesn't match leaf", testVector.Index) +
    +
    + 75 + +
    + - + assert.Equal(t, testVector.HistoricL1InfoRoot.String(), mtr.GetHistoricRoot().String(), "HistoricL1InfoTreeRoot doesn't match leaf", testVector.Index) +
    +
    + 76 + +
    + - + } +
    +
    + 77 + +
    + - + } +
    +
    + 78 + +
    + - +
    +
    +
    + 79 + +
    + - + func TestBuildTreeFromLeaves(t *testing.T) { +
    +
    + 80 + +
    + - + data := readData(t) +
    +
    + 81 + +
    + - +
    +
    +
    + 82 + +
    + - + leaves := [][32]byte{} +
    +
    + 83 + +
    + - + for _, testVector := range data { +
    +
    + 84 + +
    + - + leaves = append(leaves, testVector.L1DataHash) +
    +
    + 85 + +
    + - + } +
    +
    + 86 + +
    + - +
    +
    +
    + 87 + +
    + - + newMtr, err := l1infotree.NewL1InfoTreeRecursiveFromLeaves(l1InfoRootRecursiveHeight, leaves) +
    +
    + 88 + +
    + - + require.NoError(t, err) +
    +
    + 89 + +
    + - + assert.Equal(t, data[len(data)-1].L1InfoTreeRoot.String(), newMtr.GetRoot().String(), "L1InfoTreeRoot doesn't match leaf") +
    +
    + 90 + +
    + - + } +
    +
    + 91 + +
    + - +
    +
    +
    + 92 + +
    + - + func TestProofsTreeVectorData(t *testing.T) { +
    +
    + 93 + +
    + - + data := readData(t) +
    +
    + 94 + +
    + - + mtr, err := l1infotree.NewL1InfoTreeRecursive(l1InfoRootRecursiveHeight) +
    +
    + 95 + +
    + - + require.NoError(t, err) +
    +
    + 96 + +
    + - +
    +
    +
    + 97 + +
    + - + leaves := [][32]byte{} +
    +
    + 98 + +
    + - + for _, testVector := range data { +
    +
    + 99 + +
    + - + l1InfoTreeRoot, err := mtr.AddLeaf(testVector.Index-1, testVector.L1DataHash) +
    +
    + 100 + +
    + - + require.NoError(t, err) +
    +
    + 101 + +
    + - +
    +
    +
    + 102 + +
    + - + leaves = append(leaves, l1InfoTreeRoot) +
    +
    + 103 + +
    + - +
    +
    +
    + 104 + +
    + - + mp, _, err := mtr.ComputeMerkleProof(testVector.Index, leaves) +
    +
    + 105 + +
    + - + require.NoError(t, err) +
    +
    + 106 + +
    + - + for i, v := range mp { +
    +
    + 107 + +
    + - + c := common.Hash(v) +
    +
    + 108 + +
    + - + if c.String() != testVector.SmtProof[i].String() { +
    +
    + 109 + +
    + - + log.Info("MerkleProof: index ", testVector.Index, " mk:", i, " v:", c.String(), " expected:", testVector.SmtProof[i].String()) +
    +
    + 110 + +
    + - + } +
    +
    + 111 + +
    + - + } +
    +
    + 112 + +
    + - + } +
    +
    + 113 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/merkletree/client.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -7,7 +7,6 @@
    +
    + 7 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/log" +
    +
    + 8 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/merkletree/hashdb" +
    +
    + 9 + +
    +   + "google.golang.org/grpc" +
    +
    + 10 + +
    + - + "google.golang.org/grpc/connectivity" +
    +
    + 11 + +
    +   + "google.golang.org/grpc/credentials/insecure" +
    +
    + 12 + +
    +   + ) +
    +
    + 13 + +
    +   +
    +
    +
    +
    @@ -15,37 +14,18 @@
    +
    + 15 + +
    +   + func NewMTDBServiceClient(ctx context.Context, c Config) (hashdb.HashDBServiceClient, *grpc.ClientConn, context.CancelFunc) { +
    +
    + 16 + +
    +   + opts := []grpc.DialOption{ +
    +
    + 17 + +
    +   + grpc.WithTransportCredentials(insecure.NewCredentials()), +
    +
    + + +
    +   +
    +
    +
    + 18 + +
    +   + } +
    +
    + 19 + +
    + - +
    +
    +
    + 20 + +
    + - + mtDBConn, err := grpc.NewClient(c.URI, opts...) +
    +
    + 21 + +
    + - + if err != nil { +
    +
    + 22 + +
    + - + log.Fatalf("fail to create grpc connection to merkletree: %v", err) +
    +
    + 23 + +
    + - + } +
    +
    + 24 + +
    + - +
    +
    +
    + 25 + +
    + - + log.Infof("trying to connect to merkletree: %v", c.URI) +
    +
    + 26 + +
    +   + const maxWaitSeconds = 120 +
    +
    + 27 + +
    +   + ctx, cancel := context.WithTimeout(ctx, maxWaitSeconds*time.Second) +
    +
    + 28 + +
    + - + mtDBConn.Connect() +
    +
    + 29 + +
    + - + err = waitForConnection(ctx, mtDBConn) +
    +
    + + +
    +   +
    +
    +
    + 30 + +
    +   + if err != nil { +
    +
    + 31 + +
    + - + log.Fatalf("fail to connect to merkletree: %v", err) +
    +
    + 32 + +
    +   + } +
    +
    + 33 + +
    +   + log.Infof("connected to merkletree") +
    +
    + 34 + +
    +   +
    +
    +
    + 35 + +
    +   + mtDBClient := hashdb.NewHashDBServiceClient(mtDBConn) +
    +
    + 36 + +
    +   + return mtDBClient, mtDBConn, cancel +
    +
    + 37 + +
    +   + } +
    +
    + 38 + +
    + - +
    +
    +
    + 39 + +
    + - + func waitForConnection(ctx context.Context, conn *grpc.ClientConn) error { +
    +
    + 40 + +
    + - + for { +
    +
    + 41 + +
    + - + select { +
    +
    + 42 + +
    + - + case <-ctx.Done(): +
    +
    + 43 + +
    + - + return ctx.Err() +
    +
    + 44 + +
    + - + case <-time.After(time.Second): +
    +
    + 45 + +
    + - + s := conn.GetState() +
    +
    + 46 + +
    + - + if s == connectivity.Ready { +
    +
    + 47 + +
    + - + return nil +
    +
    + 48 + +
    + - + } +
    +
    + 49 + +
    + - + } +
    +
    + 50 + +
    + - + } +
    +
    + 51 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 7 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/log" +
    +
    + 8 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/merkletree/hashdb" +
    +
    + 9 + +
    +   + "google.golang.org/grpc" +
    +
    + + +
    +   +
    +
    +
    + 10 + +
    +   + "google.golang.org/grpc/credentials/insecure" +
    +
    + 11 + +
    +   + ) +
    +
    + 12 + +
    +   +
    +
    +
    +
     
    +
    + 14 + +
    +   + func NewMTDBServiceClient(ctx context.Context, c Config) (hashdb.HashDBServiceClient, *grpc.ClientConn, context.CancelFunc) { +
    +
    + 15 + +
    +   + opts := []grpc.DialOption{ +
    +
    + 16 + +
    +   + grpc.WithTransportCredentials(insecure.NewCredentials()), +
    +
    + 17 + +
    + + + grpc.WithBlock(), +
    +
    + 18 + +
    +   + } +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 19 + +
    +   + const maxWaitSeconds = 120 +
    +
    + 20 + +
    +   + ctx, cancel := context.WithTimeout(ctx, maxWaitSeconds*time.Second) +
    +
    + 21 + +
    + + +
    +
    +
    + 22 + +
    + + + log.Infof("trying to connect to merkletree: %v", c.URI) +
    +
    + 23 + +
    + + + mtDBConn, err := grpc.DialContext(ctx, c.URI, opts...) +
    +
    + 24 + +
    +   + if err != nil { +
    +
    + 25 + +
    + + + log.Fatalf("fail to dial: %v", err) +
    +
    + 26 + +
    +   + } +
    +
    + 27 + +
    +   + log.Infof("connected to merkletree") +
    +
    + 28 + +
    +   +
    +
    +
    + 29 + +
    +   + mtDBClient := hashdb.NewHashDBServiceClient(mtDBConn) +
    +
    + 30 + +
    +   + return mtDBClient, mtDBConn, cancel +
    +
    + 31 + +
    +   + } +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/merkletree/tree.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -93,9 +93,6 @@
    +
    + 93 + +
    +   + } +
    +
    + 94 + +
    +   +
    +
    +
    + 95 + +
    +   + k := new(big.Int).SetBytes(scCodeHash) +
    +
    + 96 + +
    + - + if k.Cmp(big.NewInt(0)) == 0 { +
    +
    + 97 + +
    + - + return []byte{}, nil +
    +
    + 98 + +
    + - + } +
    +
    + 99 + +
    +   +
    +
    +
    + 100 + +
    +   + // this code gets actual smart contract code from sc code storage +
    +
    + 101 + +
    +   + scCode, err := tree.getProgram(ctx, scalarToh4(k)) +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 93 + +
    +   + } +
    +
    + 94 + +
    +   +
    +
    +
    + 95 + +
    +   + k := new(big.Int).SetBytes(scCodeHash) +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 96 + +
    +   +
    +
    +
    + 97 + +
    +   + // this code gets actual smart contract code from sc code storage +
    +
    + 98 + +
    +   + scCode, err := tree.getProgram(ctx, scalarToh4(k)) +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/merkletree/tree_test.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,86 +0,0 @@
    +
    + 1 + +
    + - + package merkletree +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + import ( +
    +
    + 4 + +
    + - + "context" +
    +
    + 5 + +
    + - + "fmt" +
    +
    + 6 + +
    + - + "testing" +
    +
    + 7 + +
    + - +
    +
    +
    + 8 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/hex" +
    +
    + 9 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/test/contracts/bin/EmitLog2" +
    +
    + 10 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/test/testutils" +
    +
    + 11 + +
    + - + "github.com/ethereum/go-ethereum/common" +
    +
    + 12 + +
    + - + "github.com/google/uuid" +
    +
    + 13 + +
    + - + "github.com/stretchr/testify/require" +
    +
    + 14 + +
    + - + ) +
    +
    + 15 + +
    + - +
    +
    +
    + 16 + +
    + - + func TestGetCode(t *testing.T) { +
    +
    + 17 + +
    + - + ctx := context.Background() +
    +
    + 18 + +
    + - + zkProverURI := testutils.GetEnv("ZKPROVER_URI", "localhost") +
    +
    + 19 + +
    + - +
    +
    +
    + 20 + +
    + - + cfg := Config{URI: fmt.Sprintf("%s:50061", zkProverURI)} +
    +
    + 21 + +
    + - + c, _, _ := NewMTDBServiceClient(ctx, cfg) +
    +
    + 22 + +
    + - + sTree := NewStateTree(c) +
    +
    + 23 + +
    + - +
    +
    +
    + 24 + +
    + - + type testCase struct { +
    +
    + 25 + +
    + - + name string +
    +
    + 26 + +
    + - + addr common.Address +
    +
    + 27 + +
    + - + root []byte +
    +
    + 28 + +
    + - + expectedResult []byte +
    +
    + 29 + +
    + - + expectedError error +
    +
    + 30 + +
    + - + setup func(*testing.T, *testCase, *StateTree) +
    +
    + 31 + +
    + - + } +
    +
    + 32 + +
    + - +
    +
    +
    + 33 + +
    + - + testCases := []testCase{ +
    +
    + 34 + +
    + - + { +
    +
    + 35 + +
    + - + name: "get existent code successfully", +
    +
    + 36 + +
    + - + addr: common.HexToAddress("0x1"), +
    +
    + 37 + +
    + - + root: common.HexToHash("0x0").Bytes(), +
    +
    + 38 + +
    + - + expectedResult: hex.DecodeBig(EmitLog2.EmitLog2Bin).Bytes(), +
    +
    + 39 + +
    + - + expectedError: nil, +
    +
    + 40 + +
    + - + setup: func(t *testing.T, tc *testCase, sTree *StateTree) { +
    +
    + 41 + +
    + - + txID := uuid.NewString() +
    +
    + 42 + +
    + - +
    +
    +
    + 43 + +
    + - + err := sTree.StartBlock(ctx, common.Hash(tc.root), txID) +
    +
    + 44 + +
    + - + require.NoError(t, err) +
    +
    + 45 + +
    + - +
    +
    +
    + 46 + +
    + - + newRoot, _, err := sTree.SetCode(ctx, tc.addr, tc.expectedResult, tc.root, txID) +
    +
    + 47 + +
    + - + require.NoError(t, err) +
    +
    + 48 + +
    + - + tc.root = newRoot +
    +
    + 49 + +
    + - +
    +
    +
    + 50 + +
    + - + err = sTree.FinishBlock(ctx, common.Hash(tc.root), txID) +
    +
    + 51 + +
    + - + require.NoError(t, err) +
    +
    + 52 + +
    + - +
    +
    +
    + 53 + +
    + - + err = sTree.Flush(ctx, common.Hash(newRoot), txID) +
    +
    + 54 + +
    + - + require.NoError(t, err) +
    +
    + 55 + +
    + - + }, +
    +
    + 56 + +
    + - + }, +
    +
    + 57 + +
    + - + { +
    +
    + 58 + +
    + - + name: "get non-existent code successfully", +
    +
    + 59 + +
    + - + addr: common.HexToAddress("0x2"), +
    +
    + 60 + +
    + - + root: common.HexToHash("0x0").Bytes(), +
    +
    + 61 + +
    + - + expectedResult: []byte{}, +
    +
    + 62 + +
    + - + expectedError: nil, +
    +
    + 63 + +
    + - + setup: func(t *testing.T, tc *testCase, sTree *StateTree) { +
    +
    + 64 + +
    + - + }, +
    +
    + 65 + +
    + - + }, +
    +
    + 66 + +
    + - + } +
    +
    + 67 + +
    + - +
    +
    +
    + 68 + +
    + - + for _, tc := range testCases { +
    +
    + 69 + +
    + - + t.Run(tc.name, func(t *testing.T) { +
    +
    + 70 + +
    + - + tc := tc +
    +
    + 71 + +
    + - + tc.setup(t, &tc, sTree) +
    +
    + 72 + +
    + - +
    +
    +
    + 73 + +
    + - + result, err := sTree.GetCode(ctx, tc.addr, tc.root) +
    +
    + 74 + +
    + - + require.NoError(t, err) +
    +
    + 75 + +
    + - +
    +
    +
    + 76 + +
    + - + if tc.expectedResult != nil || result != nil { +
    +
    + 77 + +
    + - + require.Equal(t, len(tc.expectedResult), len(result)) +
    +
    + 78 + +
    + - + require.ElementsMatch(t, tc.expectedResult, result) +
    +
    + 79 + +
    + - + } +
    +
    + 80 + +
    + - +
    +
    +
    + 81 + +
    + - + if tc.expectedError != nil || err != nil { +
    +
    + 82 + +
    + - + require.Equal(t, tc.expectedError, err) +
    +
    + 83 + +
    + - + } +
    +
    + 84 + +
    + - + }) +
    +
    + 85 + +
    + - + } +
    +
    + 86 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/effectivegasprice.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -2,21 +2,12 @@
    +
    + 2 + +
    +   +
    +
    +
    + 3 + +
    +   + import ( +
    +
    + 4 + +
    +   + "bytes" +
    +
    + 5 + +
    + - + "errors" +
    +
    + 6 + +
    +   + "math/big" +
    +
    + 7 + +
    +   +
    +
    +
    + 8 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/log" +
    +
    + 9 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/state" +
    +
    + 10 + +
    +   + ) +
    +
    + 11 + +
    +   +
    +
    +
    + 12 + +
    + - + var ( +
    +
    + 13 + +
    + - + // ErrEffectiveGasPriceEmpty happens when the effectiveGasPrice or gasPrice is nil or zero +
    +
    + 14 + +
    + - + ErrEffectiveGasPriceEmpty = errors.New("effectiveGasPrice or gasPrice cannot be nil or zero") +
    +
    + 15 + +
    + - +
    +
    +
    + 16 + +
    + - + // ErrEffectiveGasPriceIsZero happens when the calculated EffectiveGasPrice is zero +
    +
    + 17 + +
    + - + ErrEffectiveGasPriceIsZero = errors.New("effectiveGasPrice cannot be zero") +
    +
    + 18 + +
    + - + ) +
    +
    + 19 + +
    + - +
    +
    +
    + 20 + +
    +   + // EffectiveGasPrice implements the effective gas prices calculations and checks +
    +
    + 21 + +
    +   + type EffectiveGasPrice struct { +
    +
    + 22 + +
    +   + cfg EffectiveGasPriceCfg +
    +
    +
    @@ -122,33 +113,8 @@
    +
    + 122 + +
    +   + bfEffectiveGasPrice.Int(effectiveGasPrice) +
    +
    + 123 + +
    +   +
    +
    +
    + 124 + +
    +   + if effectiveGasPrice.Cmp(new(big.Int).SetUint64(0)) == 0 { +
    +
    + 125 + +
    + - + return nil, ErrEffectiveGasPriceIsZero +
    +
    + 126 + +
    +   + } +
    +
    + 127 + +
    +   +
    +
    +
    + 128 + +
    +   + return effectiveGasPrice, nil +
    +
    + 129 + +
    +   + } +
    +
    + 130 + +
    + - +
    +
    +
    + 131 + +
    + - + // CalculateEffectiveGasPricePercentage calculates the gas price's effective percentage +
    +
    + 132 + +
    + - + func (e *EffectiveGasPrice) CalculateEffectiveGasPricePercentage(gasPrice *big.Int, effectiveGasPrice *big.Int) (uint8, error) { +
    +
    + 133 + +
    + - + const bits = 256 +
    +
    + 134 + +
    + - + var bitsBigInt = big.NewInt(bits) +
    +
    + 135 + +
    + - +
    +
    +
    + 136 + +
    + - + if effectiveGasPrice == nil || gasPrice == nil || +
    +
    + 137 + +
    + - + gasPrice.Cmp(big.NewInt(0)) == 0 || effectiveGasPrice.Cmp(big.NewInt(0)) == 0 { +
    +
    + 138 + +
    + - + return 0, ErrEffectiveGasPriceEmpty +
    +
    + 139 + +
    + - + } +
    +
    + 140 + +
    + - +
    +
    +
    + 141 + +
    + - + if gasPrice.Cmp(effectiveGasPrice) <= 0 { +
    +
    + 142 + +
    + - + return state.MaxEffectivePercentage, nil +
    +
    + 143 + +
    + - + } +
    +
    + 144 + +
    + - +
    +
    +
    + 145 + +
    + - + // Simulate Ceil with integer division +
    +
    + 146 + +
    + - + b := new(big.Int).Mul(effectiveGasPrice, bitsBigInt) +
    +
    + 147 + +
    + - + b = b.Add(b, gasPrice) +
    +
    + 148 + +
    + - + b = b.Sub(b, big.NewInt(1)) //nolint:gomnd +
    +
    + 149 + +
    + - + b = b.Div(b, gasPrice) +
    +
    + 150 + +
    + - + // At this point we have a percentage between 1-256, we need to sub 1 to have it between 0-255 (byte) +
    +
    + 151 + +
    + - + b = b.Sub(b, big.NewInt(1)) //nolint:gomnd +
    +
    + 152 + +
    + - +
    +
    +
    + 153 + +
    + - + return uint8(b.Uint64()), nil +
    +
    + 154 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 2 + +
    +   +
    +
    +
    + 3 + +
    +   + import ( +
    +
    + 4 + +
    +   + "bytes" +
    +
    + + +
    +   +
    +
    +
    + 5 + +
    +   + "math/big" +
    +
    + 6 + +
    +   +
    +
    +
    + 7 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/log" +
    +
    + 8 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/state" +
    +
    + 9 + +
    +   + ) +
    +
    + 10 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 11 + +
    +   + // EffectiveGasPrice implements the effective gas prices calculations and checks +
    +
    + 12 + +
    +   + type EffectiveGasPrice struct { +
    +
    + 13 + +
    +   + cfg EffectiveGasPriceCfg +
    +
    +
     
    +
    + 113 + +
    +   + bfEffectiveGasPrice.Int(effectiveGasPrice) +
    +
    + 114 + +
    +   +
    +
    +
    + 115 + +
    +   + if effectiveGasPrice.Cmp(new(big.Int).SetUint64(0)) == 0 { +
    +
    + 116 + +
    + + + return nil, state.ErrEffectiveGasPriceIsZero +
    +
    + 117 + +
    +   + } +
    +
    + 118 + +
    +   +
    +
    +
    + 119 + +
    +   + return effectiveGasPrice, nil +
    +
    + 120 + +
    +   + } +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/effectivegasprice_test.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -23,8 +24,6 @@
    +
    + 23 + +
    +   + ) +
    +
    + 24 + +
    +   +
    +
    +
    + 25 + +
    +   + func TestCalculateEffectiveGasPricePercentage(t *testing.T) { +
    +
    + 26 + +
    + - + egp := NewEffectiveGasPrice(egpCfg) +
    +
    + 27 + +
    + - +
    +
    +
    + 28 + +
    +   + testCases := []struct { +
    +
    + 29 + +
    +   + name string +
    +
    + 30 + +
    +   + breakEven *big.Int +
    +
    +
    @@ -37,14 +36,14 @@
    +
    + 37 + +
    +   + name: "Nil breakEven or gasPrice", +
    +
    + 38 + +
    +   + gasPrice: big.NewInt(1), +
    +
    + 39 + +
    +   + expectedValue: uint8(0), +
    +
    + 40 + +
    + - + err: ErrEffectiveGasPriceEmpty, +
    +
    + 41 + +
    +   + }, +
    +
    + 42 + +
    +   + { +
    +
    + 43 + +
    +   + name: "Zero breakEven or gasPrice", +
    +
    + 44 + +
    +   + breakEven: big.NewInt(1), +
    +
    + 45 + +
    +   + gasPrice: big.NewInt(0), +
    +
    + 46 + +
    +   + expectedValue: uint8(0), +
    +
    + 47 + +
    + - + err: ErrEffectiveGasPriceEmpty, +
    +
    + 48 + +
    +   + }, +
    +
    + 49 + +
    +   + { +
    +
    + 50 + +
    +   + name: "Both positive, gasPrice less than breakEven", +
    +
    +
    @@ -104,7 +103,7 @@
    +
    + 104 + +
    +   +
    +
    +
    + 105 + +
    +   + for _, tc := range testCases { +
    +
    + 106 + +
    +   + t.Run(tc.name, func(t *testing.T) { +
    +
    + 107 + +
    + - + actual, err := egp.CalculateEffectiveGasPricePercentage(tc.gasPrice, tc.breakEven) +
    +
    + 108 + +
    +   + assert.Equal(t, tc.err, err) +
    +
    + 109 + +
    +   + if actual != 0 { +
    +
    + 110 + +
    +   + assert.Equal(t, tc.expectedValue, actual) +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 24 + +
    +   + ) +
    +
    + 25 + +
    +   +
    +
    +
    + 26 + +
    +   + func TestCalculateEffectiveGasPricePercentage(t *testing.T) { +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 27 + +
    +   + testCases := []struct { +
    +
    + 28 + +
    +   + name string +
    +
    + 29 + +
    +   + breakEven *big.Int +
    +
    +
     
    +
    + 36 + +
    +   + name: "Nil breakEven or gasPrice", +
    +
    + 37 + +
    +   + gasPrice: big.NewInt(1), +
    +
    + 38 + +
    +   + expectedValue: uint8(0), +
    +
    + 39 + +
    + + + err: state.ErrEffectiveGasPriceEmpty, +
    +
    + 40 + +
    +   + }, +
    +
    + 41 + +
    +   + { +
    +
    + 42 + +
    +   + name: "Zero breakEven or gasPrice", +
    +
    + 43 + +
    +   + breakEven: big.NewInt(1), +
    +
    + 44 + +
    +   + gasPrice: big.NewInt(0), +
    +
    + 45 + +
    +   + expectedValue: uint8(0), +
    +
    + 46 + +
    + + + err: state.ErrEffectiveGasPriceEmpty, +
    +
    + 47 + +
    +   + }, +
    +
    + 48 + +
    +   + { +
    +
    + 49 + +
    +   + name: "Both positive, gasPrice less than breakEven", +
    +
    +
     
    +
    + 103 + +
    +   +
    +
    +
    + 104 + +
    +   + for _, tc := range testCases { +
    +
    + 105 + +
    +   + t.Run(tc.name, func(t *testing.T) { +
    +
    + 106 + +
    + + + actual, err := state.CalculateEffectiveGasPricePercentage(tc.gasPrice, tc.breakEven) +
    +
    + 107 + +
    +   + assert.Equal(t, tc.err, err) +
    +
    + 108 + +
    +   + if actual != 0 { +
    +
    + 109 + +
    +   + assert.Equal(t, tc.expectedValue, actual) +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/errors.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -76,4 +76,13 @@
    +
    + 76 + +
    +   +
    +
    +
    + 77 + +
    +   + // ErrZeroL1GasPrice is returned if the L1 gas price is 0. +
    +
    + 78 + +
    +   + ErrZeroL1GasPrice = errors.New("L1 gas price 0") +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 79 + +
    +   + ) +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 76 + +
    +   +
    +
    +
    + 77 + +
    +   + // ErrZeroL1GasPrice is returned if the L1 gas price is 0. +
    +
    + 78 + +
    +   + ErrZeroL1GasPrice = errors.New("L1 gas price 0") +
    +
    + 79 + +
    + + +
    +
    +
    + 80 + +
    + + + // ErrSenderDisallowedSendTx is returned when transactions by sender are is disallowed by policy +
    +
    + 81 + +
    + + + ErrSenderDisallowedSendTx = errors.New("sender disallowed send_tx by policy") +
    +
    + 82 + +
    + + +
    +
    +
    + 83 + +
    + + + // ErrContractDisallowedSendTx is returned when transactions to contract are is disallowed by policy +
    +
    + 84 + +
    + + + ErrContractDisallowedSendTx = errors.New("contract disallowed send_tx by policy") +
    +
    + 85 + +
    + + +
    +
    +
    + 86 + +
    + + + // ErrSenderDisallowedDeploy is returned when deploy transactions are disallowed by policy +
    +
    + 87 + +
    + + + ErrSenderDisallowedDeploy = errors.New("sender disallowed deploy by policy") +
    +
    + 88 + +
    +   + ) +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/interfaces.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -38,6 +38,7 @@
    +
    + 38 + +
    +   + MarkWIPTxsAsPending(ctx context.Context) error +
    +
    + 39 + +
    +   + GetAllAddressesBlocked(ctx context.Context) ([]common.Address, error) +
    +
    + 40 + +
    +   + MinL2GasPriceSince(ctx context.Context, timestamp time.Time) (uint64, error) +
    +
    + + +
    +   +
    +
    +
    + 41 + +
    +   + GetEarliestProcessedTx(ctx context.Context) (common.Hash, error) +
    +
    + 42 + +
    +   + } +
    +
    + 43 + +
    +   +
    +
    +
    +
    @@ -48,3 +49,12 @@
    +
    + 48 + +
    +   + GetTransactionByHash(ctx context.Context, transactionHash common.Hash, dbTx pgx.Tx) (*types.Transaction, error) +
    +
    + 49 + +
    +   + PreProcessTransaction(ctx context.Context, tx *types.Transaction, dbTx pgx.Tx) (*state.ProcessBatchResponse, error) +
    +
    + 50 + +
    +   + } +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 38 + +
    +   + MarkWIPTxsAsPending(ctx context.Context) error +
    +
    + 39 + +
    +   + GetAllAddressesBlocked(ctx context.Context) ([]common.Address, error) +
    +
    + 40 + +
    +   + MinL2GasPriceSince(ctx context.Context, timestamp time.Time) (uint64, error) +
    +
    + 41 + +
    + + + policy +
    +
    + 42 + +
    +   + GetEarliestProcessedTx(ctx context.Context) (common.Hash, error) +
    +
    + 43 + +
    +   + } +
    +
    + 44 + +
    +   +
    +
    +
    +
     
    +
    + 49 + +
    +   + GetTransactionByHash(ctx context.Context, transactionHash common.Hash, dbTx pgx.Tx) (*types.Transaction, error) +
    +
    + 50 + +
    +   + PreProcessTransaction(ctx context.Context, tx *types.Transaction, dbTx pgx.Tx) (*state.ProcessBatchResponse, error) +
    +
    + 51 + +
    +   + } +
    +
    + 52 + +
    + + + type policy interface { +
    +
    + 53 + +
    + + + CheckPolicy(ctx context.Context, policy PolicyName, address common.Address) (bool, error) +
    +
    + 54 + +
    + + + AddAddressesToPolicy(ctx context.Context, policy PolicyName, addresses []common.Address) error +
    +
    + 55 + +
    + + + RemoveAddressesFromPolicy(ctx context.Context, policy PolicyName, addresses []common.Address) error +
    +
    + 56 + +
    + + + ClearPolicy(ctx context.Context, policy PolicyName) error +
    +
    + 57 + +
    + + + DescribePolicies(ctx context.Context) ([]Policy, error) +
    +
    + 58 + +
    + + + DescribePolicy(ctx context.Context, name PolicyName) (Policy, error) +
    +
    + 59 + +
    + + + ListAcl(ctx context.Context, policy PolicyName, query []common.Address) ([]common.Address, error) +
    +
    + 60 + +
    + + + } +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/pgpoolstorage/policy.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -0,0 +1,202 @@
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 1 + +
    + + + package pgpoolstorage +
    +
    + 2 + +
    + + +
    +
    +
    + 3 + +
    + + + import ( +
    +
    + 4 + +
    + + + "context" +
    +
    + 5 + +
    + + + "errors" +
    +
    + 6 + +
    + + + "fmt" +
    +
    + 7 + +
    + + + "strings" +
    +
    + 8 + +
    + + +
    +
    +
    + 9 + +
    + + + "github.com/0xPolygonHermez/zkevm-node/pool" +
    +
    + 10 + +
    + + + "github.com/ethereum/go-ethereum/common" +
    +
    + 11 + +
    + + + "github.com/jackc/pgx/v4" +
    +
    + 12 + +
    + + + ) +
    +
    + 13 + +
    + + +
    +
    +
    + 14 + +
    + + + // CheckPolicy returns the rule for the named policy and address. If the address is associated with the policy, the rule +
    +
    + 15 + +
    + + + // will be the setting for the policy. If the address is no associated with the policy, the rule will be the opposite of +
    +
    + 16 + +
    + + + // the policy setting. +
    +
    + 17 + +
    + + + func (p *PostgresPoolStorage) CheckPolicy(ctx context.Context, policy pool.PolicyName, address common.Address) (bool, error) { +
    +
    + 18 + +
    + + + sql := `SELECT +
    +
    + 19 + +
    + + + CASE WHEN a.address is null THEN +
    +
    + 20 + +
    + + + NOT p.allow +
    +
    + 21 + +
    + + + ELSE +
    +
    + 22 + +
    + + + p.allow +
    +
    + 23 + +
    + + + END +
    +
    + 24 + +
    + + + FROM pool.policy p +
    +
    + 25 + +
    + + + LEFT JOIN pool.acl a +
    +
    + 26 + +
    + + + ON p.name = a.policy +
    +
    + 27 + +
    + + + AND a.address = $1 +
    +
    + 28 + +
    + + + WHERE p.name = $2` +
    +
    + 29 + +
    + + +
    +
    +
    + 30 + +
    + + + rows, err := p.db.Query(ctx, sql, address.Hex(), policy) +
    +
    + 31 + +
    + + +
    +
    +
    + 32 + +
    + + + if errors.Is(err, pgx.ErrNoRows) { +
    +
    + 33 + +
    + + + return false, pool.ErrNotFound +
    +
    + 34 + +
    + + + } else if err != nil { +
    +
    + 35 + +
    + + + return false, err +
    +
    + 36 + +
    + + + } +
    +
    + 37 + +
    + + +
    +
    +
    + 38 + +
    + + + defer rows.Close() +
    +
    + 39 + +
    + + + if !rows.Next() { // should always be a row if the policy exists +
    +
    + 40 + +
    + + + return false, nil +
    +
    + 41 + +
    + + + } +
    +
    + 42 + +
    + + +
    +
    +
    + 43 + +
    + + + var allow bool +
    +
    + 44 + +
    + + + err = rows.Scan(&allow) +
    +
    + 45 + +
    + + + if err != nil { +
    +
    + 46 + +
    + + + return false, err +
    +
    + 47 + +
    + + + } +
    +
    + 48 + +
    + + + return allow, nil +
    +
    + 49 + +
    + + + } +
    +
    + 50 + +
    + + +
    +
    +
    + 51 + +
    + + + // UpdatePolicy sets the allow/deny rule for the named policy +
    +
    + 52 + +
    + + + func (p *PostgresPoolStorage) UpdatePolicy(ctx context.Context, policy pool.PolicyName, allow bool) error { +
    +
    + 53 + +
    + + + sql := "UPDATE pool.policy SET allow = $1 WHERE name = $2" +
    +
    + 54 + +
    + + + _, err := p.db.Exec(ctx, sql, allow, string(policy)) +
    +
    + 55 + +
    + + + if err != nil { +
    +
    + 56 + +
    + + + return err +
    +
    + 57 + +
    + + + } +
    +
    + 58 + +
    + + + return nil +
    +
    + 59 + +
    + + + } +
    +
    + 60 + +
    + + +
    +
    +
    + 61 + +
    + + + // AddAddressesToPolicy adds addresses to the named policy +
    +
    + 62 + +
    + + + func (p *PostgresPoolStorage) AddAddressesToPolicy(ctx context.Context, policy pool.PolicyName, addresses []common.Address) error { +
    +
    + 63 + +
    + + + sql := "INSERT INTO pool.acl (policy, address) VALUES ($1, $2) ON CONFLICT DO NOTHING" +
    +
    + 64 + +
    + + + tx, err := p.db.Begin(ctx) +
    +
    + 65 + +
    + + + if err != nil { +
    +
    + 66 + +
    + + + return err +
    +
    + 67 + +
    + + + } +
    +
    + 68 + +
    + + + defer func(tx pgx.Tx, ctx context.Context) { +
    +
    + 69 + +
    + + + _ = tx.Rollback(ctx) +
    +
    + 70 + +
    + + + }(tx, ctx) +
    +
    + 71 + +
    + + +
    +
    +
    + 72 + +
    + + + for _, a := range addresses { +
    +
    + 73 + +
    + + + _, err = tx.Exec(ctx, sql, policy, a.Hex()) +
    +
    + 74 + +
    + + + if err != nil { +
    +
    + 75 + +
    + + + return err +
    +
    + 76 + +
    + + + } +
    +
    + 77 + +
    + + + } +
    +
    + 78 + +
    + + + err = tx.Commit(ctx) +
    +
    + 79 + +
    + + + if err != nil { +
    +
    + 80 + +
    + + + return nil +
    +
    + 81 + +
    + + + } +
    +
    + 82 + +
    + + + return nil +
    +
    + 83 + +
    + + + } +
    +
    + 84 + +
    + + +
    +
    +
    + 85 + +
    + + + // RemoveAddressesFromPolicy removes addresses from the named policy +
    +
    + 86 + +
    + + + func (p *PostgresPoolStorage) RemoveAddressesFromPolicy(ctx context.Context, policy pool.PolicyName, addresses []common.Address) error { +
    +
    + 87 + +
    + + + sql := "DELETE FROM pool.acl WHERE policy = $1 AND address = $2" +
    +
    + 88 + +
    + + + tx, err := p.db.Begin(ctx) +
    +
    + 89 + +
    + + + if err != nil { +
    +
    + 90 + +
    + + + return err +
    +
    + 91 + +
    + + + } +
    +
    + 92 + +
    + + + defer func(tx pgx.Tx, ctx context.Context) { +
    +
    + 93 + +
    + + + _ = tx.Rollback(ctx) +
    +
    + 94 + +
    + + + }(tx, ctx) +
    +
    + 95 + +
    + + +
    +
    +
    + 96 + +
    + + + for _, a := range addresses { +
    +
    + 97 + +
    + + + _, err = tx.Exec(ctx, sql, policy, a.Hex()) +
    +
    + 98 + +
    + + + if err != nil { +
    +
    + 99 + +
    + + + return err +
    +
    + 100 + +
    + + + } +
    +
    + 101 + +
    + + + } +
    +
    + 102 + +
    + + + err = tx.Commit(ctx) +
    +
    + 103 + +
    + + + if err != nil { +
    +
    + 104 + +
    + + + return err +
    +
    + 105 + +
    + + + } +
    +
    + 106 + +
    + + + return nil +
    +
    + 107 + +
    + + + } +
    +
    + 108 + +
    + + +
    +
    +
    + 109 + +
    + + + // ClearPolicy removes _all_ addresses from the named policy +
    +
    + 110 + +
    + + + func (p *PostgresPoolStorage) ClearPolicy(ctx context.Context, policy pool.PolicyName) error { +
    +
    + 111 + +
    + + + sql := "DELETE FROM pool.acl WHERE policy = $1" +
    +
    + 112 + +
    + + + _, err := p.db.Exec(ctx, sql, policy) +
    +
    + 113 + +
    + + + if err != nil { +
    +
    + 114 + +
    + + + return err +
    +
    + 115 + +
    + + + } +
    +
    + 116 + +
    + + + return nil +
    +
    + 117 + +
    + + + } +
    +
    + 118 + +
    + + +
    +
    +
    + 119 + +
    + + + // DescribePolicies return all the policies +
    +
    + 120 + +
    + + + func (p *PostgresPoolStorage) DescribePolicies(ctx context.Context) ([]pool.Policy, error) { +
    +
    + 121 + +
    + + + sql := "SELECT name, allow FROM pool.policy" +
    +
    + 122 + +
    + + + rows, err := p.db.Query(ctx, sql) +
    +
    + 123 + +
    + + + if err != nil { +
    +
    + 124 + +
    + + + if errors.Is(err, pgx.ErrNoRows) { +
    +
    + 125 + +
    + + + return nil, nil +
    +
    + 126 + +
    + + + } else { +
    +
    + 127 + +
    + + + return nil, err +
    +
    + 128 + +
    + + + } +
    +
    + 129 + +
    + + + } +
    +
    + 130 + +
    + + + defer rows.Close() +
    +
    + 131 + +
    + + +
    +
    +
    + 132 + +
    + + + var list []pool.Policy +
    +
    + 133 + +
    + + + for rows.Next() { +
    +
    + 134 + +
    + + + var name string +
    +
    + 135 + +
    + + + var allow bool +
    +
    + 136 + +
    + + + err = rows.Scan(&name, &allow) +
    +
    + 137 + +
    + + + if err != nil { +
    +
    + 138 + +
    + + + return nil, err +
    +
    + 139 + +
    + + + } +
    +
    + 140 + +
    + + + if pool.IsPolicy(name) { // skip unknown +
    +
    + 141 + +
    + + + p := pool.Policy{ +
    +
    + 142 + +
    + + + Name: pool.PolicyName(name), +
    +
    + 143 + +
    + + + Allow: allow, +
    +
    + 144 + +
    + + + } +
    +
    + 145 + +
    + + + list = append(list, p) +
    +
    + 146 + +
    + + + } +
    +
    + 147 + +
    + + + } +
    +
    + 148 + +
    + + + return list, nil +
    +
    + 149 + +
    + + + } +
    +
    + 150 + +
    + + +
    +
    +
    + 151 + +
    + + + // DescribePolicy returns the named policy +
    +
    + 152 + +
    + + + func (p *PostgresPoolStorage) DescribePolicy(ctx context.Context, name pool.PolicyName) (pool.Policy, error) { +
    +
    + 153 + +
    + + + sql := "SELECT name, allow FROM pool.policy WHERE name = $1 LIMIT 1" +
    +
    + 154 + +
    + + + row := p.db.QueryRow(ctx, sql, name) +
    +
    + 155 + +
    + + + var ( +
    +
    + 156 + +
    + + + pName string +
    +
    + 157 + +
    + + + allow bool +
    +
    + 158 + +
    + + + ) +
    +
    + 159 + +
    + + + err := row.Scan(&pName, &allow) +
    +
    + 160 + +
    + + + if err != nil { +
    +
    + 161 + +
    + + + return pool.Policy{}, err +
    +
    + 162 + +
    + + + } +
    +
    + 163 + +
    + + + return pool.Policy{ +
    +
    + 164 + +
    + + + Name: pool.PolicyName(pName), +
    +
    + 165 + +
    + + + Allow: allow, +
    +
    + 166 + +
    + + + }, nil +
    +
    + 167 + +
    + + + } +
    +
    + 168 + +
    + + +
    +
    +
    + 169 + +
    + + + // ListAcl returns a list of the addresses associated with the policy +
    +
    + 170 + +
    + + + func (p *PostgresPoolStorage) ListAcl( +
    +
    + 171 + +
    + + + ctx context.Context, policy pool.PolicyName, query []common.Address) ([]common.Address, error) { +
    +
    + 172 + +
    + + + sql := "SELECT address FROM pool.acl WHERE policy = $1" +
    +
    + 173 + +
    + + +
    +
    +
    + 174 + +
    + + + if len(query) > 0 { +
    +
    + 175 + +
    + + + var addrs []string +
    +
    + 176 + +
    + + + for _, a := range query { +
    +
    + 177 + +
    + + + addrs = append(addrs, a.Hex()) +
    +
    + 178 + +
    + + + } +
    +
    + 179 + +
    + + + sql = sql + fmt.Sprintf(" IN (%v)", strings.Join(addrs, ",")) +
    +
    + 180 + +
    + + + } +
    +
    + 181 + +
    + + +
    +
    +
    + 182 + +
    + + + rows, err := p.db.Query(ctx, sql, string(policy)) +
    +
    + 183 + +
    + + + if err != nil { +
    +
    + 184 + +
    + + + if errors.Is(err, pgx.ErrNoRows) { +
    +
    + 185 + +
    + + + return nil, nil +
    +
    + 186 + +
    + + + } else { +
    +
    + 187 + +
    + + + return nil, err +
    +
    + 188 + +
    + + + } +
    +
    + 189 + +
    + + + } +
    +
    + 190 + +
    + + + defer rows.Close() +
    +
    + 191 + +
    + + +
    +
    +
    + 192 + +
    + + + var addresses []common.Address +
    +
    + 193 + +
    + + + for rows.Next() { +
    +
    + 194 + +
    + + + var addr string +
    +
    + 195 + +
    + + + err = rows.Scan(&addr) +
    +
    + 196 + +
    + + + if err != nil { +
    +
    + 197 + +
    + + + return nil, err +
    +
    + 198 + +
    + + + } +
    +
    + 199 + +
    + + + addresses = append(addresses, common.HexToAddress(addr)) +
    +
    + 200 + +
    + + + } +
    +
    + 201 + +
    + + + return addresses, nil +
    +
    + 202 + +
    + + + } +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/policy.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -0,0 +1,43 @@
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 1 + +
    + + + package pool +
    +
    + 2 + +
    + + +
    +
    +
    + 3 + +
    + + + import "github.com/ethereum/go-ethereum/common" +
    +
    + 4 + +
    + + +
    +
    +
    + 5 + +
    + + + // PolicyName is a named policy +
    +
    + 6 + +
    + + + type PolicyName string +
    +
    + 7 + +
    + + +
    +
    +
    + 8 + +
    + + + const ( +
    +
    + 9 + +
    + + + // SendTx is the name of the policy that governs that an address may send transactions to pool +
    +
    + 10 + +
    + + + SendTx PolicyName = "send_tx" +
    +
    + 11 + +
    + + + // Deploy is the name of the policy that governs that an address may deploy a contract +
    +
    + 12 + +
    + + + Deploy PolicyName = "deploy" +
    +
    + 13 + +
    + + + ) +
    +
    + 14 + +
    + + +
    +
    +
    + 15 + +
    + + + // Policy describes state of a named policy +
    +
    + 16 + +
    + + + type Policy struct { +
    +
    + 17 + +
    + + + Name PolicyName +
    +
    + 18 + +
    + + + Allow bool +
    +
    + 19 + +
    + + + } +
    +
    + 20 + +
    + + +
    +
    +
    + 21 + +
    + + + // Desc returns the string representation of a policy rule +
    +
    + 22 + +
    + + + func (p *Policy) Desc() string { +
    +
    + 23 + +
    + + + if p.Allow { +
    +
    + 24 + +
    + + + return "allow" +
    +
    + 25 + +
    + + + } +
    +
    + 26 + +
    + + + return "deny" +
    +
    + 27 + +
    + + + } +
    +
    + 28 + +
    + + +
    +
    +
    + 29 + +
    + + + // Acl describes exception to a named Policy by address +
    +
    + 30 + +
    + + + type Acl struct { +
    +
    + 31 + +
    + + + PolicyName PolicyName +
    +
    + 32 + +
    + + + Address common.Address +
    +
    + 33 + +
    + + + } +
    +
    + 34 + +
    + + +
    +
    +
    + 35 + +
    + + + // IsPolicy tests if a string represents a known named Policy +
    +
    + 36 + +
    + + + func IsPolicy(name string) bool { +
    +
    + 37 + +
    + + + for _, p := range []PolicyName{SendTx, Deploy} { +
    +
    + 38 + +
    + + + if name == string(p) { +
    +
    + 39 + +
    + + + return true +
    +
    + 40 + +
    + + + } +
    +
    + 41 + +
    + + + } +
    +
    + 42 + +
    + + + return false +
    +
    + 43 + +
    + + + } +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/pool.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -93,6 +93,13 @@
    +
    + 93 + +
    +   + time.Sleep(cfg.IntervalToRefreshGasPrices.Duration) +
    +
    + 94 + +
    +   + } +
    +
    + 95 + +
    +   + }(&cfg, p) +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 96 + +
    +   +
    +
    +
    + 97 + +
    +   + return p +
    +
    + 98 + +
    +   + } +
    +
    +
    @@ -239,7 +246,6 @@
    +
    + 239 + +
    +   + } +
    +
    + 240 + +
    +   +
    +
    +
    + 241 + +
    +   + poolTx := NewTransaction(tx, ip, isWIP) +
    +
    + 242 + +
    + - + poolTx.GasUsed = preExecutionResponse.txResponse.GasUsed +
    +
    + 243 + +
    +   + poolTx.ZKCounters = preExecutionResponse.usedZKCounters +
    +
    + 244 + +
    +   + poolTx.ReservedZKCounters = preExecutionResponse.reservedZKCounters +
    +
    + 245 + +
    +   +
    +
    +
    +
    @@ -687,7 +693,7 @@
    +
    + 687 + +
    +   +
    +
    +
    + 688 + +
    +   + // CalculateEffectiveGasPricePercentage calculates the gas price's effective percentage +
    +
    + 689 + +
    +   + func (p *Pool) CalculateEffectiveGasPricePercentage(gasPrice *big.Int, effectiveGasPrice *big.Int) (uint8, error) { +
    +
    + 690 + +
    + - + return p.effectiveGasPrice.CalculateEffectiveGasPricePercentage(gasPrice, effectiveGasPrice) +
    +
    + 691 + +
    +   + } +
    +
    + 692 + +
    +   +
    +
    +
    + 693 + +
    +   + // EffectiveGasPriceEnabled returns if effective gas price calculation is enabled or not +
    +
    +
    @@ -729,3 +735,8 @@
    +
    + 729 + +
    +   + } +
    +
    + 730 + +
    +   + return gas, nil +
    +
    + 731 + +
    +   + } +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 93 + +
    +   + time.Sleep(cfg.IntervalToRefreshGasPrices.Duration) +
    +
    + 94 + +
    +   + } +
    +
    + 95 + +
    +   + }(&cfg, p) +
    +
    + 96 + +
    + + + p.refreshBlockedAddresses() +
    +
    + 97 + +
    + + + go func(cfg *Config, p *Pool) { +
    +
    + 98 + +
    + + + for { +
    +
    + 99 + +
    + + + time.Sleep(cfg.IntervalToRefreshBlockedAddresses.Duration) +
    +
    + 100 + +
    + + + p.refreshBlockedAddresses() +
    +
    + 101 + +
    + + + } +
    +
    + 102 + +
    + + + }(&cfg, p) +
    +
    + 103 + +
    +   +
    +
    +
    + 104 + +
    +   + return p +
    +
    + 105 + +
    +   + } +
    +
    +
     
    +
    + 246 + +
    +   + } +
    +
    + 247 + +
    +   +
    +
    +
    + 248 + +
    +   + poolTx := NewTransaction(tx, ip, isWIP) +
    +
    + + +
    +   +
    +
    +
    + 249 + +
    +   + poolTx.ZKCounters = preExecutionResponse.usedZKCounters +
    +
    + 250 + +
    +   + poolTx.ReservedZKCounters = preExecutionResponse.reservedZKCounters +
    +
    + 251 + +
    +   +
    +
    +
    +
     
    +
    + 693 + +
    +   +
    +
    +
    + 694 + +
    +   + // CalculateEffectiveGasPricePercentage calculates the gas price's effective percentage +
    +
    + 695 + +
    +   + func (p *Pool) CalculateEffectiveGasPricePercentage(gasPrice *big.Int, effectiveGasPrice *big.Int) (uint8, error) { +
    +
    + 696 + +
    + + + return state.CalculateEffectiveGasPricePercentage(gasPrice, effectiveGasPrice) +
    +
    + 697 + +
    +   + } +
    +
    + 698 + +
    +   +
    +
    +
    + 699 + +
    +   + // EffectiveGasPriceEnabled returns if effective gas price calculation is enabled or not +
    +
    +
     
    +
    + 735 + +
    +   + } +
    +
    + 736 + +
    +   + return gas, nil +
    +
    + 737 + +
    +   + } +
    +
    + 738 + +
    + + +
    +
    +
    + 739 + +
    + + + // CheckPolicy checks if an address is allowed by policy name +
    +
    + 740 + +
    + + + func (p *Pool) CheckPolicy(ctx context.Context, policy PolicyName, address common.Address) (bool, error) { +
    +
    + 741 + +
    + + + return p.storage.CheckPolicy(ctx, policy, address) +
    +
    + 742 + +
    + + + } +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/pool_test.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1114,7 +1114,7 @@
    +
    + 1114 + +
    +   + stateDBClient, _, _ := merkletree.NewMTDBServiceClient(ctx, mtDBServerConfig) +
    +
    + 1115 + +
    +   + stateTree := merkletree.NewStateTree(stateDBClient) +
    +
    + 1116 + +
    +   +
    +
    +
    + 1117 + +
    + - + st := state.NewState(stCfg, stateDb, executorClient, stateTree, eventLog, nil, nil) +
    +
    + 1118 + +
    +   + return st +
    +
    + 1119 + +
    +   + } +
    +
    + 1120 + +
    +   +
    +
    +
    +
    @@ -2032,3 +2032,69 @@
    +
    + 2032 + +
    +   + require.NoError(t, err) +
    +
    + 2033 + +
    +   + return signedTx +
    +
    + 2034 + +
    +   + } +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 1114 + +
    +   + stateDBClient, _, _ := merkletree.NewMTDBServiceClient(ctx, mtDBServerConfig) +
    +
    + 1115 + +
    +   + stateTree := merkletree.NewStateTree(stateDBClient) +
    +
    + 1116 + +
    +   +
    +
    +
    + 1117 + +
    + + + st := state.NewState(stCfg, stateDb, executorClient, stateTree, eventLog, nil) +
    +
    + 1118 + +
    +   + return st +
    +
    + 1119 + +
    +   + } +
    +
    + 1120 + +
    +   +
    +
    +
    +
     
    +
    + 2032 + +
    +   + require.NoError(t, err) +
    +
    + 2033 + +
    +   + return signedTx +
    +
    + 2034 + +
    +   + } +
    +
    + 2035 + +
    + + +
    +
    +
    + 2036 + +
    + + + func Test_PolicyAcl(t *testing.T) { +
    +
    + 2037 + +
    + + + initOrResetDB(t) +
    +
    + 2038 + +
    + + +
    +
    +
    + 2039 + +
    + + + poolSqlDB, err := db.NewSQLDB(poolDBCfg) +
    +
    + 2040 + +
    + + + require.NoError(t, err) +
    +
    + 2041 + +
    + + + defer poolSqlDB.Close() //nolint:gosec,errcheck +
    +
    + 2042 + +
    + + +
    +
    +
    + 2043 + +
    + + + ctx := context.Background() +
    +
    + 2044 + +
    + + + s, err := pgpoolstorage.NewPostgresPoolStorage(poolDBCfg) +
    +
    + 2045 + +
    + + + require.NoError(t, err) +
    +
    + 2046 + +
    + + +
    +
    +
    + 2047 + +
    + + + p := pool.NewPool(cfg, bc, s, nil, uint64(1), nil) +
    +
    + 2048 + +
    + + +
    +
    +
    + 2049 + +
    + + + randAddr := func() common.Address { +
    +
    + 2050 + +
    + + + buf := make([]byte, 20) +
    +
    + 2051 + +
    + + + _, err = rand.Read(buf) +
    +
    + 2052 + +
    + + + require.NoError(t, err) +
    +
    + 2053 + +
    + + + return common.BytesToAddress(buf) +
    +
    + 2054 + +
    + + + } +
    +
    + 2055 + +
    + + +
    +
    +
    + 2056 + +
    + + + // Policies start out as deny lists, since there are no addresses on the +
    +
    + 2057 + +
    + + + // lists, random addresses will always be allowed +
    +
    + 2058 + +
    + + + for _, policy := range []pool.PolicyName{pool.SendTx, pool.Deploy} { +
    +
    + 2059 + +
    + + + allow, err := p.CheckPolicy(ctx, policy, randAddr()) +
    +
    + 2060 + +
    + + + require.NoError(t, err) +
    +
    + 2061 + +
    + + + require.True(t, allow) +
    +
    + 2062 + +
    + + + } +
    +
    + 2063 + +
    + + +
    +
    +
    + 2064 + +
    + + + addr := randAddr() +
    +
    + 2065 + +
    + + +
    +
    +
    + 2066 + +
    + + + // put addr on lists +
    +
    + 2067 + +
    + + + for _, policy := range []pool.PolicyName{pool.SendTx, pool.Deploy} { +
    +
    + 2068 + +
    + + + ctag, err := poolSqlDB.Exec(ctx, "INSERT INTO pool.acl (policy, address) VALUES ($1,$2)", policy, addr.Hex()) +
    +
    + 2069 + +
    + + + require.NoError(t, err) +
    +
    + 2070 + +
    + + + require.Equal(t, int64(1), ctag.RowsAffected()) +
    +
    + 2071 + +
    + + + } +
    +
    + 2072 + +
    + + +
    +
    +
    + 2073 + +
    + + + // addr should not be denied by policy +
    +
    + 2074 + +
    + + + for _, policy := range []pool.PolicyName{pool.SendTx, pool.Deploy} { +
    +
    + 2075 + +
    + + + allow, err := p.CheckPolicy(ctx, policy, addr) +
    +
    + 2076 + +
    + + + require.NoError(t, err) +
    +
    + 2077 + +
    + + + require.False(t, allow) +
    +
    + 2078 + +
    + + + } +
    +
    + 2079 + +
    + + +
    +
    +
    + 2080 + +
    + + + // change policies to allow by acl +
    +
    + 2081 + +
    + + + ctag, err := poolSqlDB.Exec(ctx, "UPDATE pool.policy SET allow = true") +
    +
    + 2082 + +
    + + + require.NoError(t, err) +
    +
    + 2083 + +
    + + + require.Equal(t, int64(2), ctag.RowsAffected()) +
    +
    + 2084 + +
    + + +
    +
    +
    + 2085 + +
    + + + // addr is now allowed +
    +
    + 2086 + +
    + + + for _, policy := range []pool.PolicyName{pool.SendTx, pool.Deploy} { +
    +
    + 2087 + +
    + + + allow, err := p.CheckPolicy(ctx, policy, addr) +
    +
    + 2088 + +
    + + + require.NoError(t, err) +
    +
    + 2089 + +
    + + + require.True(t, allow) +
    +
    + 2090 + +
    + + + } +
    +
    + 2091 + +
    + + +
    +
    +
    + 2092 + +
    + + + // random addrs are now denied +
    +
    + 2093 + +
    + + + for _, policy := range []pool.PolicyName{pool.SendTx, pool.Deploy} { +
    +
    + 2094 + +
    + + + for _, a := range []common.Address{randAddr(), randAddr()} { +
    +
    + 2095 + +
    + + + allow, err := s.CheckPolicy(ctx, policy, a) +
    +
    + 2096 + +
    + + + require.NoError(t, err) +
    +
    + 2097 + +
    + + + require.False(t, allow) +
    +
    + 2098 + +
    + + + } +
    +
    + 2099 + +
    + + + } +
    +
    + 2100 + +
    + + + } +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/proto/src/proto/executor/v1/executor.proto + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -10,9 +10,6 @@
    +
    + 10 + +
    +   + /// Processes a batch +
    +
    + 11 + +
    +   + rpc ProcessBatch(ProcessBatchRequest) returns (ProcessBatchResponse) {} +
    +
    + 12 + +
    +   + rpc ProcessBatchV2(ProcessBatchRequestV2) returns (ProcessBatchResponseV2) {} +
    +
    + 13 + +
    + - + rpc ProcessBatchV3(ProcessBatchRequestV3) returns (ProcessBatchResponseV3) {} +
    +
    + 14 + +
    + - + rpc ProcessBlobInnerV3(ProcessBlobInnerRequestV3) returns (ProcessBlobInnerResponseV3) {} +
    +
    + 15 + +
    + - + rpc ProcessStatelessBatchV2(ProcessStatelessBatchRequestV2) returns (ProcessBatchResponseV2) {} +
    +
    + 16 + +
    +   + rpc GetFlushStatus (google.protobuf.Empty) returns (GetFlushStatusResponse) {} +
    +
    + 17 + +
    +   + } +
    +
    + 18 + +
    +   +
    +
    +
    +
    @@ -295,27 +292,7 @@
    +
    + 295 + +
    +   + // prior to executing the call. +
    +
    + 296 + +
    +   + map<string, OverrideAccountV2> state_override = 23; +
    +
    + 297 + +
    +   + DebugV2 debug = 24; +
    +
    + 298 + +
    + - + } +
    +
    + 299 + +
    + - +
    +
    +
    + 300 + +
    + - + message ProcessStatelessBatchRequestV2 { +
    +
    + 301 + +
    + - + // Batch data +
    +
    + 302 + +
    + - + bytes witness = 1; // SMT partial tree, SCs, (indirectly) old state root +
    +
    + 303 + +
    + - + bytes data_stream = 2; // txs, old batch num, chain id, fork id, effective gas price, block header, index of L1 info tree (global exit root, min timestamp, ...) +
    +
    + 304 + +
    + - +
    +
    +
    + 305 + +
    + - + string coinbase = 3; // sequencer address +
    +
    + 306 + +
    + - + bytes old_acc_input_hash = 4; // 0 for executor, required for the prover +
    +
    + 307 + +
    + - +
    +
    +
    + 308 + +
    + - + // Used by injected/first batches (do not use it for regular batches) +
    +
    + 309 + +
    + - + bytes l1_info_root = 5; // 0 for executor, required for the prover +
    +
    + 310 + +
    + - + uint64 timestamp_limit = 6; // if 0, replace by now + 10 min internally +
    +
    + 311 + +
    + - + bytes forced_blockhash_l1 = 7; // we need it, 0 in regular batches, hash in forced batches, also used in injected/first batches, 0 by now +
    +
    + 312 + +
    + - +
    +
    +
    + 313 + +
    + - + // Debug +
    +
    + 314 + +
    + - + string context_id = 8; // batch ID to be shown in the executor traces, for your convenience: "Erigon_candidate_batch_N" +
    +
    + 315 + +
    + - + TraceConfigV2 trace_config = 9; +
    +
    + 316 + +
    + - +
    +
    +
    + 317 + +
    + - + // Mapping to provide minTimestamp for each l1InfoTreeIndex in a batch +
    +
    + 318 + +
    + - + map<uint64, uint64> l1_info_tree_index_min_timestamp = 10; +
    +
    + 319 + +
    +   + } +
    +
    + 320 + +
    +   +
    +
    +
    + 321 + +
    +   + message L1DataV2 { +
    +
    +
    @@ -327,7 +304,7 @@
    +
    + 327 + +
    +   +
    +
    +
    + 328 + +
    +   + message DebugV2 { +
    +
    + 329 + +
    +   + uint64 gas_limit = 1; +
    +
    + 330 + +
    + - + bytes new_state_root = 2; +
    +
    + 331 + +
    +   + bytes new_acc_input_hash = 3; +
    +
    + 332 + +
    +   + bytes new_local_exit_root = 4; +
    +
    + 333 + +
    +   + uint64 new_batch_num = 5; +
    +
    +
    @@ -366,13 +343,6 @@
    +
    + 366 + +
    +   + uint32 cnt_reserve_binaries = 30; +
    +
    + 367 + +
    +   + uint32 cnt_reserve_steps = 31; +
    +
    + 368 + +
    +   + uint32 cnt_reserve_sha256_hashes = 32; +
    +
    + 369 + +
    + - + bytes old_state_root = 33; +
    +
    + 370 + +
    + - + ResponseDebug debug = 34; +
    +
    + 371 + +
    + - + } +
    +
    + 372 + +
    + - +
    +
    +
    + 373 + +
    + - + message ResponseDebug { +
    +
    + 374 + +
    + - + string error_log = 1; +
    +
    + 375 + +
    + - + string version = 2; +
    +
    + 376 + +
    +   + } +
    +
    + 377 + +
    +   +
    +
    +
    + 378 + +
    +   + // Trace configuration request params +
    +
    +
    @@ -413,12 +383,6 @@
    +
    + 413 + +
    +   + string nonce = 1; +
    +
    + 414 + +
    +   + // If balance="" then it has not been set; if set, string is in decimal (base 10) +
    +
    + 415 + +
    +   + string balance = 2; +
    +
    + 416 + +
    + - + // If sc_code="" then it has not been set; if set, string is in hexa (base 16) +
    +
    + 417 + +
    + - + string sc_code = 3; +
    +
    + 418 + +
    + - + // Both sc_storage first (key) and second (value) map elements are set in hexa (base 16) +
    +
    + 419 + +
    + - + map<string, string> sc_storage = 4; +
    +
    + 420 + +
    + - + // If sc_length="" then it has not been set; if set, string is in decimal (base 10) +
    +
    + 421 + +
    + - + string sc_length = 5; +
    +
    + 422 + +
    +   + } +
    +
    + 423 + +
    +   +
    +
    +
    + 424 + +
    +   + message FullTraceV2 { +
    +
    +
    @@ -672,8 +636,6 @@
    +
    + 672 + +
    +   + ROM_ERROR_INVALID_TX_CHANGE_L2_BLOCK_LIMIT_TIMESTAMP = 33; +
    +
    + 673 + +
    +   + // ROM_ERROR_INVALID_TX_CHANGE_L2_BLOCK_MIN_TIMESTAMP indicates that the change l2 block transaction has trigger an error during while executing +
    +
    + 674 + +
    +   + ROM_ERROR_INVALID_TX_CHANGE_L2_BLOCK_MIN_TIMESTAMP = 34; +
    +
    + 675 + +
    + - + // ROM_ERROR_INVALID_L1_INFO_TREE_INDEX indicates that the l1 info tree index added is not valid since its value is 0 +
    +
    + 676 + +
    + - + ROM_ERROR_INVALID_L1_INFO_TREE_INDEX = 35; +
    +
    + 677 + +
    +   + } +
    +
    + 678 + +
    +   +
    +
    +
    + 679 + +
    +   + enum ExecutorError { +
    +
    +
    @@ -913,210 +875,4 @@
    +
    + 913 + +
    +   + EXECUTOR_ERROR_INVALID_UPDATE_MERKLE_TREE = 116; +
    +
    + 914 + +
    +   + // EXECUTOR_ERROR_SM_MAIN_INVALID_TX_STATUS_ERROR indicates that a TX has an invalid status-error combination +
    +
    + 915 + +
    +   + EXECUTOR_ERROR_SM_MAIN_INVALID_TX_STATUS_ERROR = 117; +
    +
    + 916 + +
    + - + // EXECUTOR_ERROR_INVALID_PREVIOUS_L1_INFO_TREE_ROOT indicates that the input parameter previous_l1_info_tree_root is invalid +
    +
    + 917 + +
    + - + EXECUTOR_ERROR_INVALID_PREVIOUS_L1_INFO_TREE_ROOT = 118; +
    +
    + 918 + +
    + - + // EXECUTOR_ERROR_INVALID_FORCED_HASH_DATA indicates that the input parameter forced_hash_data is invalid +
    +
    + 919 + +
    + - + EXECUTOR_ERROR_INVALID_FORCED_HASH_DATA = 119; +
    +
    + 920 + +
    + - + // EXECUTOR_ERROR_INVALID_FORCED_DATA_GLOBAL_EXIT_ROOT indicates that the input parameter forced_data.global_exit_root is invalid +
    +
    + 921 + +
    + - + EXECUTOR_ERROR_INVALID_FORCED_DATA_GLOBAL_EXIT_ROOT = 120; +
    +
    + 922 + +
    + - + // EXECUTOR_ERROR_INVALID_FORCED_DATA_BLOCK_HASH_L1 indicates that the input parameter forced_data.block_hash_l1 is invalid +
    +
    + 923 + +
    + - + EXECUTOR_ERROR_INVALID_FORCED_DATA_BLOCK_HASH_L1 = 121; +
    +
    + 924 + +
    + - + // EXECUTOR_ERROR_INVALID_L1_DATA_V3_INITIAL_HISTORIC_ROOT indicates that the input parameter L1 Data initiali_historic_root is invalid +
    +
    + 925 + +
    + - + EXECUTOR_ERROR_INVALID_L1_DATA_V3_INITIAL_HISTORIC_ROOT = 122; +
    +
    + 926 + +
    + - + // EXECUTOR_ERROR_INVALID_OLD_BLOB_STATE_ROOT indicates that the input parameter old_blob_state_root is invalid +
    +
    + 927 + +
    + - + EXECUTOR_ERROR_INVALID_OLD_BLOB_STATE_ROOT = 123; +
    +
    + 928 + +
    + - + // EXECUTOR_ERROR_INVALID_OLD_BLOB_ACC_INPUT_HASH indicates that the input parameter old_blob_acc_input_hash is invalid +
    +
    + 929 + +
    + - + EXECUTOR_ERROR_INVALID_OLD_BLOB_ACC_INPUT_HASH = 124; +
    +
    + 930 + +
    + - + // EXECUTOR_ERROR_INVALID_LAST_L1_INFO_TREE_ROOT indicates that the input parameter last_l1_info_tree_root is invalid +
    +
    + 931 + +
    + - + EXECUTOR_ERROR_INVALID_LAST_L1_INFO_TREE_ROOT = 125; +
    +
    + 932 + +
    + - + // EXECUTOR_ERROR_INVALID_NEW_BLOB_STATE_ROOT indicates that the input parameter new_blob_state_root is invalid +
    +
    + 933 + +
    + - + EXECUTOR_ERROR_INVALID_NEW_BLOB_STATE_ROOT = 126; +
    +
    + 934 + +
    + - + // EXECUTOR_ERROR_INVALID_NEW_BLOB_ACC_INPUT_HASH indicates that the input parameter new_blob_acc_input_hash is invalid +
    +
    + 935 + +
    + - + EXECUTOR_ERROR_INVALID_NEW_BLOB_ACC_INPUT_HASH = 127; +
    +
    + 936 + +
    + - + // EXECUTOR_ERROR_INVALID_BLOB_DATA indicates that the input parameter blob_data is invalid (too long) +
    +
    + 937 + +
    + - + EXECUTOR_ERROR_INVALID_BLOB_DATA = 128; +
    +
    + 938 + +
    + - + // EXECUTOR_ERROR_INVALID_ZK_GAS_LIMIT indicates that the input parameter zk_gas_limit is invalid +
    +
    + 939 + +
    + - + EXECUTOR_ERROR_INVALID_ZK_GAS_LIMIT = 129; +
    +
    + 940 + +
    + - + // EXECUTOR_ERROR_INVALID_POINT_Z indicates that the input parameter point_z is invalid +
    +
    + 941 + +
    + - + EXECUTOR_ERROR_INVALID_POINT_Z = 130; +
    +
    + 942 + +
    + - + // EXECUTOR_ERROR_INVALID_POINT_Y indicates that the input parameter point_y is invalid +
    +
    + 943 + +
    + - + EXECUTOR_ERROR_INVALID_POINT_Y = 131; +
    +
    + 944 + +
    + - + // EXECUTOR_ERROR_SM_MAIN_POINT_Z_MISMATCH indicates that the input parameter point_z is different from the one calculated by the executor +
    +
    + 945 + +
    + - + EXECUTOR_ERROR_SM_MAIN_POINT_Z_MISMATCH = 132; +
    +
    + 946 + +
    + - + // EXECUTOR_ERROR_SM_MAIN_BLOB_L2_HASH_DATA_MISMATCH indicates that the input parameter blob L2 data hash is different from the one calculated by the executor +
    +
    + 947 + +
    + - + EXECUTOR_ERROR_SM_MAIN_BLOB_L2_HASH_DATA_MISMATCH = 133; +
    +
    + 948 + +
    + - + // EXECUTOR_ERROR_SM_MAIN_BATCH_HASH_DATA_MISMATCH indicates that the input parameter batch data hash is different from the one calculated by the executor +
    +
    + 949 + +
    + - + EXECUTOR_ERROR_SM_MAIN_BATCH_HASH_DATA_MISMATCH = 134; +
    +
    + 950 + +
    + - + // EXECUTOR_ERROR_SM_MAIN_INVALID_BLOB_TYPE indicates that the input parameter blob type is invalid +
    +
    + 951 + +
    + - + EXECUTOR_ERROR_SM_MAIN_INVALID_BLOB_TYPE = 135; +
    +
    + 952 + +
    + - + // EXECUTOR_ERROR_SM_MAIN_UNRESTORED_SAVED_CONTEXT indicates that at least one saved context was not restored before finishing the execution +
    +
    + 953 + +
    + - + EXECUTOR_ERROR_SM_MAIN_UNRESTORED_SAVED_CONTEXT = 136; +
    +
    + 954 + +
    + - + // EXECUTOR_ERROR_SM_MAIN_INVALID_MEMORY_CTX indicates that the memory context polynomial was assigned an invalid value +
    +
    + 955 + +
    + - + EXECUTOR_ERROR_SM_MAIN_INVALID_MEMORY_CTX = 137; +
    +
    + 956 + +
    + - + // EXECUTOR_ERROR_INVALID_VERSIONED_HASH indicates that the input parameter versioned_hash is invalid +
    +
    + 957 + +
    + - + EXECUTOR_ERROR_INVALID_VERSIONED_HASH = 138; +
    +
    + 958 + +
    + - + // EXECUTOR_ERROR_INVALID_KZG_COMMITMENT indicates that the input parameter kzg_commitment is invalid +
    +
    + 959 + +
    + - + EXECUTOR_ERROR_INVALID_KZG_COMMITMENT = 139; +
    +
    + 960 + +
    + - + // EXECUTOR_ERROR_INVALID_KZG_PROOF indicates that the input parameter kzg_proof is invalid +
    +
    + 961 + +
    + - + EXECUTOR_ERROR_INVALID_KZG_PROOF = 140; +
    +
    + 962 + +
    + - + } +
    +
    + 963 + +
    + - +
    +
    +
    + 964 + +
    + - + //////////////////////////////////////////////// +
    +
    + 965 + +
    + - + //////////// START V3 SECTION //////////////// +
    +
    + 966 + +
    + - + //////////////////////////////////////////////// +
    +
    + 967 + +
    + - +
    +
    +
    + 968 + +
    + - + message ProcessBatchRequestV3 { +
    +
    + 969 + +
    + - + bytes old_state_root = 1; +
    +
    + 970 + +
    + - + bytes old_acc_input_hash = 2; +
    +
    + 971 + +
    + - + bytes previous_l1_info_tree_root = 3; +
    +
    + 972 + +
    + - + uint32 previous_l1_info_tree_index = 4; +
    +
    + 973 + +
    + - + uint64 chain_id = 5; +
    +
    + 974 + +
    + - + uint64 fork_id = 6; +
    +
    + 975 + +
    + - + bytes batch_l2_data = 7; +
    +
    + 976 + +
    + - + bytes forced_hash_data = 8; +
    +
    + 977 + +
    + - + ForcedData forced_data = 9; +
    +
    + 978 + +
    + - + string coinbase = 10; +
    +
    + 979 + +
    + - + uint32 update_merkle_tree = 11; +
    +
    + 980 + +
    + - + // flag to indicate that counters should not be taken into account +
    +
    + 981 + +
    + - + uint32 no_counters = 12; +
    +
    + 982 + +
    + - + // from is used for unsigned transactions with sender +
    +
    + 983 + +
    + - + string from = 13; +
    +
    + 984 + +
    + - + // flag to skip the restriction to start a batch with a changeL2Block transaction +
    +
    + 985 + +
    + - + uint32 skip_first_change_l2_block = 14; +
    +
    + 986 + +
    + - + // flag to skip writing the block info root in the state +
    +
    + 987 + +
    + - + uint32 skip_write_block_info_root = 15; +
    +
    + 988 + +
    + - + // lInfoTree information +
    +
    + 989 + +
    + - + map<uint32, L1DataV3> l1_info_tree_data = 16; +
    +
    + 990 + +
    + - + // For testing purposes only +
    +
    + 991 + +
    + - + map<string, string> db = 17; +
    +
    + 992 + +
    + - + map<string, string> contracts_bytecode = 18; // For debug/testing purpposes only. Don't fill this on production +
    +
    + 993 + +
    + - + TraceConfigV2 trace_config = 19; +
    +
    + 994 + +
    + - + string context_id = 20; +
    +
    + 995 + +
    + - + uint32 get_keys = 21; // if 1, the keys used to read or write storage values will be returned +
    +
    + 996 + +
    + - + // The state override set is an optional address-to-state mapping, +
    +
    + 997 + +
    + - + // where each entry specifies some state to be ephemerally overridden +
    +
    + 998 + +
    + - + // prior to executing the call. +
    +
    + 999 + +
    + - + map<string, OverrideAccountV2> state_override = 22; +
    +
    + 1000 + +
    + - + DebugV2 debug = 23; +
    +
    + 1001 + +
    + - + } +
    +
    + 1002 + +
    + - +
    +
    +
    + 1003 + +
    + - + message L1DataV3 { +
    +
    + 1004 + +
    + - + bytes global_exit_root = 1; +
    +
    + 1005 + +
    + - + bytes block_hash_l1 = 2; +
    +
    + 1006 + +
    + - + uint64 min_timestamp = 3; +
    +
    + 1007 + +
    + - + repeated bytes smt_proof_previous_index = 4; +
    +
    + 1008 + +
    + - + bytes initial_historic_root = 5; +
    +
    + 1009 + +
    +   + } +
    +
    + 1010 + +
    + - +
    +
    +
    + 1011 + +
    + - + message ProcessBatchResponseV3 { +
    +
    + 1012 + +
    + - + bytes new_state_root = 1; +
    +
    + 1013 + +
    + - + bytes new_acc_input_hash = 2; +
    +
    + 1014 + +
    + - + bytes new_local_exit_root = 3; +
    +
    + 1015 + +
    + - + uint64 new_last_timestamp = 4; +
    +
    + 1016 + +
    + - + bytes current_l1_info_tree_root = 5; +
    +
    + 1017 + +
    + - + uint32 current_l1_info_tree_index = 6; +
    +
    + 1018 + +
    + - + uint32 cnt_keccak_hashes = 7; +
    +
    + 1019 + +
    + - + uint32 cnt_poseidon_hashes = 8; +
    +
    + 1020 + +
    + - + uint32 cnt_poseidon_paddings = 9; +
    +
    + 1021 + +
    + - + uint32 cnt_mem_aligns = 10; +
    +
    + 1022 + +
    + - + uint32 cnt_arithmetics = 11; +
    +
    + 1023 + +
    + - + uint32 cnt_binaries = 12; +
    +
    + 1024 + +
    + - + uint32 cnt_steps = 13; +
    +
    + 1025 + +
    + - + uint32 cnt_sha256_hashes = 14; +
    +
    + 1026 + +
    + - + repeated ProcessBlockResponseV2 block_responses = 15; +
    +
    + 1027 + +
    + - + ExecutorError error = 16; +
    +
    + 1028 + +
    + - + map<string, InfoReadWriteV2> read_write_addresses = 17; +
    +
    + 1029 + +
    + - + uint64 flush_id = 18; +
    +
    + 1030 + +
    + - + uint64 stored_flush_id = 19; +
    +
    + 1031 + +
    + - + string prover_id = 20; +
    +
    + 1032 + +
    + - + uint64 gas_used = 21; +
    +
    + 1033 + +
    + - + repeated bytes smt_keys = 22; +
    +
    + 1034 + +
    + - + repeated bytes program_keys = 23; +
    +
    + 1035 + +
    + - + uint64 fork_id = 24; +
    +
    + 1036 + +
    + - + uint32 invalid_batch = 25; +
    +
    + 1037 + +
    + - + RomError error_rom = 26; +
    +
    + 1038 + +
    + - + uint32 cnt_reserve_keccak_hashes = 27; +
    +
    + 1039 + +
    + - + uint32 cnt_reserve_poseidon_hashes = 28; +
    +
    + 1040 + +
    + - + uint32 cnt_reserve_poseidon_paddings = 29; +
    +
    + 1041 + +
    + - + uint32 cnt_reserve_mem_aligns = 30; +
    +
    + 1042 + +
    + - + uint32 cnt_reserve_arithmetics = 31; +
    +
    + 1043 + +
    + - + uint32 cnt_reserve_binaries = 32; +
    +
    + 1044 + +
    + - + uint32 cnt_reserve_steps = 33; +
    +
    + 1045 + +
    + - + uint32 cnt_reserve_sha256_hashes = 34; +
    +
    + 1046 + +
    + - + bytes old_state_root = 35; +
    +
    + 1047 + +
    + - + ResponseDebug debug = 36; +
    +
    + 1048 + +
    + - + } +
    +
    + 1049 + +
    + - +
    +
    +
    + 1050 + +
    + - + message ForcedData { +
    +
    + 1051 + +
    + - + bytes global_exit_root = 1; +
    +
    + 1052 + +
    + - + bytes block_hash_l1 = 2; +
    +
    + 1053 + +
    + - + uint64 min_timestamp = 3; +
    +
    + 1054 + +
    + - + } +
    +
    + 1055 + +
    + - +
    +
    +
    + 1056 + +
    + - + message ProcessBlobInnerRequestV3 { +
    +
    + 1057 + +
    + - + // inputs +
    +
    + 1058 + +
    + - + bytes old_blob_state_root = 1; +
    +
    + 1059 + +
    + - + bytes old_blob_acc_input_hash = 2; +
    +
    + 1060 + +
    + - + uint64 old_num_blob = 3; +
    +
    + 1061 + +
    + - + bytes old_state_root = 4; +
    +
    + 1062 + +
    + - + uint64 fork_id = 5; +
    +
    + 1063 + +
    + - + // belong to blobAccInputHash +
    +
    + 1064 + +
    + - + uint32 last_l1_info_tree_index = 6; +
    +
    + 1065 + +
    + - + bytes last_l1_info_tree_root = 7; +
    +
    + 1066 + +
    + - + uint64 timestamp_limit = 8; +
    +
    + 1067 + +
    + - + string coinbase = 9; +
    +
    + 1068 + +
    + - + uint64 zk_gas_limit = 10; +
    +
    + 1069 + +
    + - + uint32 blob_type = 11; +
    +
    + 1070 + +
    + - + bytes versioned_hash = 12; +
    +
    + 1071 + +
    + - + bytes kzg_commitment = 13; +
    +
    + 1072 + +
    + - + bytes kzg_proof = 14; +
    +
    + 1073 + +
    + - + bytes point_z = 15; +
    +
    + 1074 + +
    + - + bytes point_y = 16; +
    +
    + 1075 + +
    + - + bytes blob_data = 17; +
    +
    + 1076 + +
    + - + bytes forced_hash_data = 18; +
    +
    + 1077 + +
    + - + string context_id = 19; +
    +
    + 1078 + +
    + - + DebugV3 debug = 20; +
    +
    + 1079 + +
    + - + map<string, string> db = 21; +
    +
    + 1080 + +
    + - + map<string, string> contracts_bytecode = 22; // For debug/testing purpposes only. Don't fill this on production +
    +
    + 1081 + +
    + - + } +
    +
    + 1082 + +
    + - +
    +
    +
    + 1083 + +
    + - + message DebugV3 { +
    +
    + 1084 + +
    + - + bytes new_blob_state_root = 1; +
    +
    + 1085 + +
    + - + bytes new_blob_acc_input_hash = 2; +
    +
    + 1086 + +
    + - + uint64 new_blob_num = 3; +
    +
    + 1087 + +
    + - + } +
    +
    + 1088 + +
    + - +
    +
    +
    + 1089 + +
    + - + message ProcessBlobInnerResponseV3 { +
    +
    + 1090 + +
    + - + // outputs +
    +
    + 1091 + +
    + - + bytes new_blob_state_root = 1; +
    +
    + 1092 + +
    + - + bytes new_blob_acc_input_hash = 2; +
    +
    + 1093 + +
    + - + uint64 new_num_blob = 3; +
    +
    + 1094 + +
    + - + bytes final_acc_batch_hash_data = 4; +
    +
    + 1095 + +
    + - + bytes local_exit_root_from_blob = 5; +
    +
    + 1096 + +
    + - + uint32 is_invalid = 6; +
    +
    + 1097 + +
    + - + // extra +
    +
    + 1098 + +
    + - + repeated bytes batch_data = 7; +
    +
    + 1099 + +
    + - + ExecutorError error = 8; +
    +
    + 1100 + +
    + - + RomBlobError error_rom_blob = 9; +
    +
    + 1101 + +
    + - + ResponseDebug debug = 10; +
    +
    + 1102 + +
    + - + } +
    +
    + 1103 + +
    + - +
    +
    +
    + 1104 + +
    + - + enum RomBlobError { +
    +
    + 1105 + +
    + - + ROM_BLOB_ERROR_UNSPECIFIED = 0; +
    +
    + 1106 + +
    + - + // ROM_ERROR_NO_ERROR indicates the execution ended successfully +
    +
    + 1107 + +
    + - + ROM_BLOB_ERROR_NO_ERROR = 1; +
    +
    + 1108 + +
    + - + // ROM_BLOB_ERROR_INVALID_PARSING indicates that has been an error while parsing the blob data +
    +
    + 1109 + +
    + - + ROM_BLOB_ERROR_INVALID_PARSING = 2; +
    +
    + 1110 + +
    + - + // ROM_BLOB_ERROR_INVALID_MSB_BYTE indicates that the MSB on one field element is different than zero (only for blob_type = 1) +
    +
    + 1111 + +
    + - + ROM_BLOB_ERROR_INVALID_MSB_BYTE = 3; +
    +
    + 1112 + +
    + - + // ROM_BLOB_ERROR_INVALID_ZK_GAS_LIMIT not enough zk_gas_limit supplied to pay for batches proofs +
    +
    + 1113 + +
    + - + ROM_BLOB_ERROR_INVALID_ZK_GAS_LIMIT = 4; +
    +
    + 1114 + +
    + - + // ROM_BLOB_ERROR_INVALID_BLOB_TYPE blob_type not supported +
    +
    + 1115 + +
    + - + ROM_BLOB_ERROR_INVALID_BLOB_TYPE = 5; +
    +
    + 1116 + +
    + - + // ROM_BLOB_ERROR_INVALID_COMPRESSION_TYPE compression type not supported +
    +
    + 1117 + +
    + - + ROM_BLOB_ERROR_INVALID_COMPRESSION_TYPE = 6; +
    +
    + 1118 + +
    + - + // ROM_BLOB_ERROR_INVALID_FORCED_BATCHES blobtype = 2 and numBatches > 1 +
    +
    + 1119 + +
    + - + ROM_BLOB_ERROR_INVALID_FORCED_BATCHES = 7; +
    +
    + 1120 + +
    + - + // ROM_BLOB_ERROR_INVALID_TOTALBODY_LEN totalBodyLen != blobDataLen - 1 (byte compression) - 4 (bytes totalBodyLen) +
    +
    + 1121 + +
    + - + ROM_BLOB_ERROR_INVALID_TOTALBODY_LEN = 8; +
    +
    + 1122 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 10 + +
    +   + /// Processes a batch +
    +
    + 11 + +
    +   + rpc ProcessBatch(ProcessBatchRequest) returns (ProcessBatchResponse) {} +
    +
    + 12 + +
    +   + rpc ProcessBatchV2(ProcessBatchRequestV2) returns (ProcessBatchResponseV2) {} +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 13 + +
    +   + rpc GetFlushStatus (google.protobuf.Empty) returns (GetFlushStatusResponse) {} +
    +
    + 14 + +
    +   + } +
    +
    + 15 + +
    +   +
    +
    +
    +
     
    +
    + 292 + +
    +   + // prior to executing the call. +
    +
    + 293 + +
    +   + map<string, OverrideAccountV2> state_override = 23; +
    +
    + 294 + +
    +   + DebugV2 debug = 24; +
    +
    + 295 + +
    + + + uint64 execution_mode = 25; +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 296 + +
    +   + } +
    +
    + 297 + +
    +   +
    +
    +
    + 298 + +
    +   + message L1DataV2 { +
    +
    +
     
    +
    + 304 + +
    +   +
    +
    +
    + 305 + +
    +   + message DebugV2 { +
    +
    + 306 + +
    +   + uint64 gas_limit = 1; +
    +
    + 307 + +
    + + + bytes new_state_root = 2; +
    +
    + 308 + +
    +   + bytes new_acc_input_hash = 3; +
    +
    + 309 + +
    +   + bytes new_local_exit_root = 4; +
    +
    + 310 + +
    +   + uint64 new_batch_num = 5; +
    +
    +
     
    +
    + 343 + +
    +   + uint32 cnt_reserve_binaries = 30; +
    +
    + 344 + +
    +   + uint32 cnt_reserve_steps = 31; +
    +
    + 345 + +
    +   + uint32 cnt_reserve_sha256_hashes = 32; +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 346 + +
    +   + } +
    +
    + 347 + +
    +   +
    +
    +
    + 348 + +
    +   + // Trace configuration request params +
    +
    +
     
    +
    + 383 + +
    +   + string nonce = 1; +
    +
    + 384 + +
    +   + // If balance="" then it has not been set; if set, string is in decimal (base 10) +
    +
    + 385 + +
    +   + string balance = 2; +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 386 + +
    +   + } +
    +
    + 387 + +
    +   +
    +
    +
    + 388 + +
    +   + message FullTraceV2 { +
    +
    +
     
    +
    + 636 + +
    +   + ROM_ERROR_INVALID_TX_CHANGE_L2_BLOCK_LIMIT_TIMESTAMP = 33; +
    +
    + 637 + +
    +   + // ROM_ERROR_INVALID_TX_CHANGE_L2_BLOCK_MIN_TIMESTAMP indicates that the change l2 block transaction has trigger an error during while executing +
    +
    + 638 + +
    +   + ROM_ERROR_INVALID_TX_CHANGE_L2_BLOCK_MIN_TIMESTAMP = 34; +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 639 + +
    +   + } +
    +
    + 640 + +
    +   +
    +
    +
    + 641 + +
    +   + enum ExecutorError { +
    +
    +
     
    +
    + 875 + +
    +   + EXECUTOR_ERROR_INVALID_UPDATE_MERKLE_TREE = 116; +
    +
    + 876 + +
    +   + // EXECUTOR_ERROR_SM_MAIN_INVALID_TX_STATUS_ERROR indicates that a TX has an invalid status-error combination +
    +
    + 877 + +
    +   + EXECUTOR_ERROR_SM_MAIN_INVALID_TX_STATUS_ERROR = 117; +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 878 + +
    +   + } +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencer/batch.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -345,12 +344,16 @@
    +
    + 345 + +
    +   +
    +
    +
    + 346 + +
    +   + // Log batch detailed info +
    +
    + 347 + +
    +   + log.Errorf("batch %d sanity check error: initialStateRoot: %s, expectedNewStateRoot: %s", batch.BatchNumber, initialStateRoot, expectedNewStateRoot) +
    +
    + 348 + +
    + - + for i, rawL2block := range rawL2Blocks.Blocks { +
    +
    + 349 + +
    + - + log.Infof("block[%d], txs: %d, deltaTimestamp: %d, l1InfoTreeIndex: %d", i, len(rawL2block.Transactions), rawL2block.DeltaTimestamp, rawL2block.IndexL1InfoTree) +
    +
    + 350 + +
    + - + for j, rawTx := range rawL2block.Transactions { +
    +
    + 351 + +
    + - + log.Infof("block[%d].tx[%d]: %s, egpPct: %d, data: %s", batch.BatchNumber, i, j, rawTx.Tx.Hash(), rawTx.EfficiencyPercentage, hex.EncodeToHex(rawTx.Data)) +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 352 + +
    +   + } +
    +
    + 353 + +
    +   + } +
    +
    + + +
    +   +
    +
    +
    + 354 + +
    +   +
    +
    +
    + 355 + +
    +   + f.Halt(ctx, fmt.Errorf("batch sanity check error. Check previous errors in logs to know which was the cause"), false) +
    +
    + 356 + +
    +   + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 344 + +
    +   +
    +
    +
    + 345 + +
    +   + // Log batch detailed info +
    +
    + 346 + +
    +   + log.Errorf("batch %d sanity check error: initialStateRoot: %s, expectedNewStateRoot: %s", batch.BatchNumber, initialStateRoot, expectedNewStateRoot) +
    +
    + 347 + +
    + + + batchLog := "" +
    +
    + 348 + +
    + + + totalTxs := 0 +
    +
    + 349 + +
    + + + for blockIdx, rawL2block := range rawL2Blocks.Blocks { +
    +
    + 350 + +
    + + + totalTxs += len(rawL2block.Transactions) +
    +
    + 351 + +
    + + + batchLog += fmt.Sprintf("block[%d], txs: %d, deltaTimestamp: %d, l1InfoTreeIndex: %d\n", blockIdx, len(rawL2block.Transactions), rawL2block.DeltaTimestamp, rawL2block.IndexL1InfoTree) +
    +
    + 352 + +
    + + + for txIdx, rawTx := range rawL2block.Transactions { +
    +
    + 353 + +
    + + + batchLog += fmt.Sprintf(" tx[%d]: %s, egpPct: %d\n", txIdx, rawTx.Tx.Hash(), rawTx.EfficiencyPercentage) +
    +
    + 354 + +
    +   + } +
    +
    + 355 + +
    +   + } +
    +
    + 356 + +
    + + + log.Infof("DUMP batch %d, blocks: %d, txs: %d\n%s", batch.BatchNumber, len(rawL2Blocks.Blocks), totalTxs, batchLog) +
    +
    + 357 + +
    +   +
    +
    +
    + 358 + +
    +   + f.Halt(ctx, fmt.Errorf("batch sanity check error. Check previous errors in logs to know which was the cause"), false) +
    +
    + 359 + +
    +   + } +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencer/datastreamer.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -42,6 +43,7 @@
    +
    + 42 + +
    +   + l2Transactions = append(l2Transactions, l2Transaction) +
    +
    + 43 + +
    +   + } +
    +
    + 44 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 45 + +
    +   + f.dataToStream <- state.DSL2FullBlock{ +
    +
    + 46 + +
    +   + DSL2Block: l2Block, +
    +
    + 47 + +
    +   + Txs: l2Transactions, +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 43 + +
    +   + l2Transactions = append(l2Transactions, l2Transaction) +
    +
    + 44 + +
    +   + } +
    +
    + 45 + +
    +   +
    +
    +
    + 46 + +
    + + + log.Infof("sending l2block %d to datastream channel", blockResponse.BlockNumber) +
    +
    + 47 + +
    +   + f.dataToStream <- state.DSL2FullBlock{ +
    +
    + 48 + +
    +   + DSL2Block: l2Block, +
    +
    + 49 + +
    +   + Txs: l2Transactions, +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencer/finalizer.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -242,15 +242,15 @@
    +
    + 242 + +
    +   + return false, nil +
    +
    + 243 + +
    +   + } +
    +
    + 244 + +
    +   +
    +
    +
    + 245 + +
    + - + // Check l1InfoRootIndex and GER matches +
    +
    + 246 + +
    + - + // We retrieve first the info of the last l1InfoTree event in the block +
    +
    + 247 + +
    +   + log.Debugf("getting l1InfoRoot events for L1 block %d, hash: %s", l1InfoRoot.BlockNumber, l1BlockState.BlockHash) +
    +
    + 248 + +
    +   + blocks, eventsOrder, err := f.etherman.GetRollupInfoByBlockRange(ctx, l1InfoRoot.BlockNumber, &l1InfoRoot.BlockNumber) +
    +
    + 249 + +
    +   + if err != nil { +
    +
    + 250 + +
    +   + return false, err +
    +
    + 251 + +
    +   + } +
    +
    + 252 + +
    +   +
    +
    +
    + 253 + +
    + - + // Since in the case we have several l1InfoTree events in the same block, we retrieve only the GER of last one and skips the others +
    +
    + 254 + +
    +   + lastGER := state.ZeroHash +
    +
    + 255 + +
    +   + for _, block := range blocks { +
    +
    + 256 + +
    +   + blockEventsOrder := eventsOrder[block.BlockHash] +
    +
    +
    @@ -394,7 +394,8 @@
    +
    + 394 + +
    +   + firstTxProcess := true +
    +
    + 395 + +
    +   +
    +
    +
    + 396 + +
    +   + for { +
    +
    + 397 + +
    + - + _, err := f.processTransaction(ctx, tx, firstTxProcess) +
    +
    + + +
    +   +
    +
    +
    + 398 + +
    +   + if err != nil { +
    +
    + 399 + +
    +   + if err == ErrEffectiveGasPriceReprocess { +
    +
    + 400 + +
    +   + firstTxProcess = false +
    +
    +
    @@ -466,6 +467,7 @@
    +
    + 466 + +
    +   + SkipWriteBlockInfoRoot_V2: true, +
    +
    + 467 + +
    +   + SkipVerifyL1InfoRoot_V2: true, +
    +
    + 468 + +
    +   + L1InfoTreeData_V2: map[uint32]state.L1DataV2{}, +
    +
    + + +
    +   +
    +
    +
    + 469 + +
    +   + } +
    +
    + 470 + +
    +   +
    +
    +
    + 471 + +
    +   + txGasPrice := tx.GasPrice +
    +
    +
    @@ -512,7 +514,7 @@
    +
    + 512 + +
    +   + } +
    +
    + 513 + +
    +   + } +
    +
    + 514 + +
    +   +
    +
    +
    + 515 + +
    + - + egpPercentage, err := f.effectiveGasPrice.CalculateEffectiveGasPricePercentage(txGasPrice, tx.EffectiveGasPrice) +
    +
    + 516 + +
    +   + if err != nil { +
    +
    + 517 + +
    +   + if f.effectiveGasPrice.IsEnabled() { +
    +
    + 518 + +
    +   + return nil, err +
    +
    +
    @@ -625,7 +627,7 @@
    +
    + 625 + +
    +   +
    +
    +
    + 626 + +
    +   + // If EffectiveGasPrice is disabled we will calculate the percentage and save it for later logging +
    +
    + 627 + +
    +   + if !egpEnabled { +
    +
    + 628 + +
    + - + effectivePercentage, err := f.effectiveGasPrice.CalculateEffectiveGasPricePercentage(txGasPrice, tx.EffectiveGasPrice) +
    +
    + 629 + +
    +   + if err != nil { +
    +
    + 630 + +
    +   + log.Warnf("effectiveGasPrice is disabled, but failed to calculate effective gas price percentage (#2), error: %v", err) +
    +
    + 631 + +
    +   + tx.EGPLog.Error = fmt.Sprintf("%s, CalculateEffectiveGasPricePercentage#2: %s", tx.EGPLog.Error, err) +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 242 + +
    +   + return false, nil +
    +
    + 243 + +
    +   + } +
    +
    + 244 + +
    +   +
    +
    +
    + 245 + +
    + + + // Check l1InfoRootIndex and GER matches. We retrieve the info of the last l1InfoTree event in the block, since in the case we have several l1InfoTree events +
    +
    + 246 + +
    + + + // in the same block, the function checkL1InfoTreeUpdate retrieves only the last one and skips the others +
    +
    + 247 + +
    +   + log.Debugf("getting l1InfoRoot events for L1 block %d, hash: %s", l1InfoRoot.BlockNumber, l1BlockState.BlockHash) +
    +
    + 248 + +
    +   + blocks, eventsOrder, err := f.etherman.GetRollupInfoByBlockRange(ctx, l1InfoRoot.BlockNumber, &l1InfoRoot.BlockNumber) +
    +
    + 249 + +
    +   + if err != nil { +
    +
    + 250 + +
    +   + return false, err +
    +
    + 251 + +
    +   + } +
    +
    + 252 + +
    +   +
    +
    +
    + 253 + +
    + + + //Get L1InfoTree events of the L1 block where the l1InforRoot we need to check was synced +
    +
    + 254 + +
    +   + lastGER := state.ZeroHash +
    +
    + 255 + +
    +   + for _, block := range blocks { +
    +
    + 256 + +
    +   + blockEventsOrder := eventsOrder[block.BlockHash] +
    +
    +
     
    +
    + 394 + +
    +   + firstTxProcess := true +
    +
    + 395 + +
    +   +
    +
    +
    + 396 + +
    +   + for { +
    +
    + 397 + +
    + + + var err error +
    +
    + 398 + +
    + + + _, err = f.processTransaction(ctx, tx, firstTxProcess) +
    +
    + 399 + +
    +   + if err != nil { +
    +
    + 400 + +
    +   + if err == ErrEffectiveGasPriceReprocess { +
    +
    + 401 + +
    +   + firstTxProcess = false +
    +
    +
     
    +
    + 467 + +
    +   + SkipWriteBlockInfoRoot_V2: true, +
    +
    + 468 + +
    +   + SkipVerifyL1InfoRoot_V2: true, +
    +
    + 469 + +
    +   + L1InfoTreeData_V2: map[uint32]state.L1DataV2{}, +
    +
    + 470 + +
    + + + ExecutionMode: executor.ExecutionMode0, +
    +
    + 471 + +
    +   + } +
    +
    + 472 + +
    +   +
    +
    +
    + 473 + +
    +   + txGasPrice := tx.GasPrice +
    +
    +
     
    +
    + 514 + +
    +   + } +
    +
    + 515 + +
    +   + } +
    +
    + 516 + +
    +   +
    +
    +
    + 517 + +
    + + + egpPercentage, err := state.CalculateEffectiveGasPricePercentage(txGasPrice, tx.EffectiveGasPrice) +
    +
    + 518 + +
    +   + if err != nil { +
    +
    + 519 + +
    +   + if f.effectiveGasPrice.IsEnabled() { +
    +
    + 520 + +
    +   + return nil, err +
    +
    +
     
    +
    + 627 + +
    +   +
    +
    +
    + 628 + +
    +   + // If EffectiveGasPrice is disabled we will calculate the percentage and save it for later logging +
    +
    + 629 + +
    +   + if !egpEnabled { +
    +
    + 630 + +
    + + + effectivePercentage, err := state.CalculateEffectiveGasPricePercentage(txGasPrice, tx.EffectiveGasPrice) +
    +
    + 631 + +
    +   + if err != nil { +
    +
    + 632 + +
    +   + log.Warnf("effectiveGasPrice is disabled, but failed to calculate effective gas price percentage (#2), error: %v", err) +
    +
    + 633 + +
    +   + tx.EGPLog.Error = fmt.Sprintf("%s, CalculateEffectiveGasPricePercentage#2: %s", tx.EGPLog.Error, err) +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencer/l2block.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -283,6 +284,7 @@
    +
    + 283 + +
    +   + ForkID: f.stateIntf.GetForkIDByBatchNumber(f.wipBatch.batchNumber), +
    +
    + 284 + +
    +   + SkipVerifyL1InfoRoot_V2: true, +
    +
    + 285 + +
    +   + L1InfoTreeData_V2: map[uint32]state.L1DataV2{}, +
    +
    + + +
    +   +
    +
    +
    + 286 + +
    +   + } +
    +
    + 287 + +
    +   + batchRequest.L1InfoTreeData_V2[l2Block.l1InfoTreeExitRoot.L1InfoTreeIndex] = state.L1DataV2{ +
    +
    + 288 + +
    +   + GlobalExitRoot: l2Block.l1InfoTreeExitRoot.GlobalExitRoot.GlobalExitRoot, +
    +
    +
    @@ -310,7 +312,7 @@
    +
    + 310 + +
    +   + } +
    +
    + 311 + +
    +   +
    +
    +
    + 312 + +
    +   + if batchResponse.IsRomOOCError { +
    +
    + 313 + +
    + - + executeL2BLockError(err) +
    +
    + 314 + +
    +   + return nil, 0, ErrProcessBatchOOC +
    +
    + 315 + +
    +   + } +
    +
    + 316 + +
    +   +
    +
    +
    +
    @@ -411,6 +413,9 @@
    +
    + 411 + +
    +   + return err +
    +
    + 412 + +
    +   + } +
    +
    + 413 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 414 + +
    +   + // Update txs status in the pool +
    +
    + 415 + +
    +   + for _, txResponse := range blockResponse.TransactionResponses { +
    +
    + 416 + +
    +   + // Change Tx status to selected +
    +
    +
    @@ -420,6 +425,9 @@
    +
    + 420 + +
    +   + } +
    +
    + 421 + +
    +   + } +
    +
    + 422 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 423 + +
    +   + // Send L2 block to data streamer +
    +
    + 424 + +
    +   + err = f.DSSendL2Block(f.wipBatch.batchNumber, blockResponse, l2Block.getL1InfoTreeIndex()) +
    +
    + 425 + +
    +   + if err != nil { +
    +
    +
    @@ -427,6 +435,9 @@
    +
    + 427 + +
    +   + log.Errorf("error sending L2 block %d [%d] to data streamer, error: %v", blockResponse.BlockNumber, l2Block.trackingNum, err) +
    +
    + 428 + +
    +   + } +
    +
    + 429 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 430 + +
    +   + for _, tx := range l2Block.transactions { +
    +
    + 431 + +
    +   + // Delete the tx from the pending list in the worker (addrQueue) +
    +
    + 432 + +
    +   + f.workerIntf.DeletePendingTxToStore(tx.Hash, tx.From) +
    +
    +
    @@ -582,6 +593,7 @@
    +
    + 582 + +
    +   + SkipFirstChangeL2Block_V2: false, +
    +
    + 583 + +
    +   + Transactions: f.stateIntf.BuildChangeL2Block(f.wipL2Block.deltaTimestamp, f.wipL2Block.getL1InfoTreeIndex()), +
    +
    + 584 + +
    +   + L1InfoTreeData_V2: map[uint32]state.L1DataV2{}, +
    +
    + + +
    +   +
    +
    +
    + 585 + +
    +   + } +
    +
    + 586 + +
    +   +
    +
    +
    + 587 + +
    +   + batchRequest.L1InfoTreeData_V2[f.wipL2Block.l1InfoTreeExitRoot.L1InfoTreeIndex] = state.L1DataV2{ +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 284 + +
    +   + ForkID: f.stateIntf.GetForkIDByBatchNumber(f.wipBatch.batchNumber), +
    +
    + 285 + +
    +   + SkipVerifyL1InfoRoot_V2: true, +
    +
    + 286 + +
    +   + L1InfoTreeData_V2: map[uint32]state.L1DataV2{}, +
    +
    + 287 + +
    + + + ExecutionMode: executor.ExecutionMode0, +
    +
    + 288 + +
    +   + } +
    +
    + 289 + +
    +   + batchRequest.L1InfoTreeData_V2[l2Block.l1InfoTreeExitRoot.L1InfoTreeIndex] = state.L1DataV2{ +
    +
    + 290 + +
    +   + GlobalExitRoot: l2Block.l1InfoTreeExitRoot.GlobalExitRoot.GlobalExitRoot, +
    +
    +
     
    +
    + 312 + +
    +   + } +
    +
    + 313 + +
    +   +
    +
    +
    + 314 + +
    +   + if batchResponse.IsRomOOCError { +
    +
    + 315 + +
    + + + executeL2BLockError(batchResponse.RomError_V2) +
    +
    + 316 + +
    +   + return nil, 0, ErrProcessBatchOOC +
    +
    + 317 + +
    +   + } +
    +
    + 318 + +
    +   +
    +
    +
    +
     
    +
    + 413 + +
    +   + return err +
    +
    + 414 + +
    +   + } +
    +
    + 415 + +
    +   +
    +
    +
    + 416 + +
    + + + //TODO: remove this log +
    +
    + 417 + +
    + + + log.Infof("l2 block %d [%d] stored in statedb", blockResponse.BlockNumber, l2Block.trackingNum) +
    +
    + 418 + +
    + + +
    +
    +
    + 419 + +
    +   + // Update txs status in the pool +
    +
    + 420 + +
    +   + for _, txResponse := range blockResponse.TransactionResponses { +
    +
    + 421 + +
    +   + // Change Tx status to selected +
    +
    +
     
    +
    + 425 + +
    +   + } +
    +
    + 426 + +
    +   + } +
    +
    + 427 + +
    +   +
    +
    +
    + 428 + +
    + + + //TODO: remove this log +
    +
    + 429 + +
    + + + log.Infof("l2 block %d [%d] transactions updated as selected in the pooldb", blockResponse.BlockNumber, l2Block.trackingNum) +
    +
    + 430 + +
    + + +
    +
    +
    + 431 + +
    +   + // Send L2 block to data streamer +
    +
    + 432 + +
    +   + err = f.DSSendL2Block(f.wipBatch.batchNumber, blockResponse, l2Block.getL1InfoTreeIndex()) +
    +
    + 433 + +
    +   + if err != nil { +
    +
    +
     
    +
    + 435 + +
    +   + log.Errorf("error sending L2 block %d [%d] to data streamer, error: %v", blockResponse.BlockNumber, l2Block.trackingNum, err) +
    +
    + 436 + +
    +   + } +
    +
    + 437 + +
    +   +
    +
    +
    + 438 + +
    + + + //TODO: remove this log +
    +
    + 439 + +
    + + + log.Infof("l2 block %d [%d] sent to datastream", blockResponse.BlockNumber, l2Block.trackingNum) +
    +
    + 440 + +
    + + +
    +
    +
    + 441 + +
    +   + for _, tx := range l2Block.transactions { +
    +
    + 442 + +
    +   + // Delete the tx from the pending list in the worker (addrQueue) +
    +
    + 443 + +
    +   + f.workerIntf.DeletePendingTxToStore(tx.Hash, tx.From) +
    +
    +
     
    +
    + 593 + +
    +   + SkipFirstChangeL2Block_V2: false, +
    +
    + 594 + +
    +   + Transactions: f.stateIntf.BuildChangeL2Block(f.wipL2Block.deltaTimestamp, f.wipL2Block.getL1InfoTreeIndex()), +
    +
    + 595 + +
    +   + L1InfoTreeData_V2: map[uint32]state.L1DataV2{}, +
    +
    + 596 + +
    + + + ExecutionMode: executor.ExecutionMode0, +
    +
    + 597 + +
    +   + } +
    +
    + 598 + +
    +   +
    +
    +
    + 599 + +
    +   + batchRequest.L1InfoTreeData_V2[f.wipL2Block.l1InfoTreeExitRoot.L1InfoTreeIndex] = state.L1DataV2{ +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencer/sequencer.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -256,6 +256,8 @@
    +
    + 256 + +
    +   + case state.DSL2FullBlock: +
    +
    + 257 + +
    +   + l2Block := data +
    +
    + 258 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 259 + +
    +   + err = s.streamServer.StartAtomicOp() +
    +
    + 260 + +
    +   + if err != nil { +
    +
    + 261 + +
    +   + log.Errorf("failed to start atomic op for l2block %d, error: %v ", l2Block.L2BlockNumber, err) +
    +
    +
    @@ -267,6 +269,8 @@
    +
    + 267 + +
    +   + Value: l2Block.L2BlockNumber, +
    +
    + 268 + +
    +   + } +
    +
    + 269 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 270 + +
    +   + _, err = s.streamServer.AddStreamBookmark(bookMark.Encode()) +
    +
    + 271 + +
    +   + if err != nil { +
    +
    + 272 + +
    +   + log.Errorf("failed to add stream bookmark for l2block %d, error: %v", l2Block.L2BlockNumber, err) +
    +
    +
    @@ -281,6 +285,8 @@
    +
    + 281 + +
    +   + Value: l2Block.L2BlockNumber - 1, +
    +
    + 282 + +
    +   + } +
    +
    + 283 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 284 + +
    +   + previousL2BlockEntry, err := s.streamServer.GetFirstEventAfterBookmark(bookMark.Encode()) +
    +
    + 285 + +
    +   + if err != nil { +
    +
    + 286 + +
    +   + log.Errorf("failed to get previous l2block %d, error: %v", l2Block.L2BlockNumber-1, err) +
    +
    +
    @@ -303,12 +309,16 @@
    +
    + 303 + +
    +   + ChainID: uint32(chainID), +
    +
    + 304 + +
    +   + } +
    +
    + 305 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 306 + +
    +   + _, err = s.streamServer.AddStreamEntry(state.EntryTypeL2BlockStart, blockStart.Encode()) +
    +
    + 307 + +
    +   + if err != nil { +
    +
    + 308 + +
    +   + log.Errorf("failed to add stream entry for l2block %d, error: %v", l2Block.L2BlockNumber, err) +
    +
    + 309 + +
    +   + continue +
    +
    + 310 + +
    +   + } +
    +
    + 311 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 312 + +
    +   + for _, l2Transaction := range l2Block.Txs { +
    +
    + 313 + +
    +   + _, err = s.streamServer.AddStreamEntry(state.EntryTypeL2Tx, l2Transaction.Encode()) +
    +
    + 314 + +
    +   + if err != nil { +
    +
    +
    @@ -323,18 +333,25 @@
    +
    + 323 + +
    +   + StateRoot: l2Block.StateRoot, +
    +
    + 324 + +
    +   + } +
    +
    + 325 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 326 + +
    +   + _, err = s.streamServer.AddStreamEntry(state.EntryTypeL2BlockEnd, blockEnd.Encode()) +
    +
    + 327 + +
    +   + if err != nil { +
    +
    + 328 + +
    +   + log.Errorf("failed to add stream entry for l2block %d, error: %v", l2Block.L2BlockNumber, err) +
    +
    + 329 + +
    +   + continue +
    +
    + 330 + +
    +   + } +
    +
    + 331 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 332 + +
    +   + err = s.streamServer.CommitAtomicOp() +
    +
    + 333 + +
    +   + if err != nil { +
    +
    + 334 + +
    +   + log.Errorf("failed to commit atomic op for l2block %d, error: %v ", l2Block.L2BlockNumber, err) +
    +
    + 335 + +
    +   + continue +
    +
    + 336 + +
    +   + } +
    +
    + 337 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 338 + +
    +   + // Stream a bookmark +
    +
    + 339 + +
    +   + case state.DSBookMark: +
    +
    + 340 + +
    +   + bookmark := data +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 256 + +
    +   + case state.DSL2FullBlock: +
    +
    + 257 + +
    +   + l2Block := data +
    +
    + 258 + +
    +   +
    +
    +
    + 259 + +
    + + + //TODO: remove this log +
    +
    + 260 + +
    + + + log.Infof("start atomic op for l2block %d", l2Block.L2BlockNumber) +
    +
    + 261 + +
    +   + err = s.streamServer.StartAtomicOp() +
    +
    + 262 + +
    +   + if err != nil { +
    +
    + 263 + +
    +   + log.Errorf("failed to start atomic op for l2block %d, error: %v ", l2Block.L2BlockNumber, err) +
    +
    +
     
    +
    + 269 + +
    +   + Value: l2Block.L2BlockNumber, +
    +
    + 270 + +
    +   + } +
    +
    + 271 + +
    +   +
    +
    +
    + 272 + +
    + + + //TODO: remove this log +
    +
    + 273 + +
    + + + log.Infof("add stream bookmark for l2block %d", l2Block.L2BlockNumber) +
    +
    + 274 + +
    +   + _, err = s.streamServer.AddStreamBookmark(bookMark.Encode()) +
    +
    + 275 + +
    +   + if err != nil { +
    +
    + 276 + +
    +   + log.Errorf("failed to add stream bookmark for l2block %d, error: %v", l2Block.L2BlockNumber, err) +
    +
    +
     
    +
    + 285 + +
    +   + Value: l2Block.L2BlockNumber - 1, +
    +
    + 286 + +
    +   + } +
    +
    + 287 + +
    +   +
    +
    +
    + 288 + +
    + + + //TODO: remove this log +
    +
    + 289 + +
    + + + log.Infof("get previous l2block %d", l2Block.L2BlockNumber-1) +
    +
    + 290 + +
    +   + previousL2BlockEntry, err := s.streamServer.GetFirstEventAfterBookmark(bookMark.Encode()) +
    +
    + 291 + +
    +   + if err != nil { +
    +
    + 292 + +
    +   + log.Errorf("failed to get previous l2block %d, error: %v", l2Block.L2BlockNumber-1, err) +
    +
    +
     
    +
    + 309 + +
    +   + ChainID: uint32(chainID), +
    +
    + 310 + +
    +   + } +
    +
    + 311 + +
    +   +
    +
    +
    + 312 + +
    + + + //TODO: remove this log +
    +
    + 313 + +
    + + + log.Infof("add l2blockStart stream entry for l2block %d", l2Block.L2BlockNumber) +
    +
    + 314 + +
    +   + _, err = s.streamServer.AddStreamEntry(state.EntryTypeL2BlockStart, blockStart.Encode()) +
    +
    + 315 + +
    +   + if err != nil { +
    +
    + 316 + +
    +   + log.Errorf("failed to add stream entry for l2block %d, error: %v", l2Block.L2BlockNumber, err) +
    +
    + 317 + +
    +   + continue +
    +
    + 318 + +
    +   + } +
    +
    + 319 + +
    +   +
    +
    +
    + 320 + +
    + + + //TODO: remove this log +
    +
    + 321 + +
    + + + log.Infof("adding l2tx stream entries for l2block %d", l2Block.L2BlockNumber) +
    +
    + 322 + +
    +   + for _, l2Transaction := range l2Block.Txs { +
    +
    + 323 + +
    +   + _, err = s.streamServer.AddStreamEntry(state.EntryTypeL2Tx, l2Transaction.Encode()) +
    +
    + 324 + +
    +   + if err != nil { +
    +
    +
     
    +
    + 333 + +
    +   + StateRoot: l2Block.StateRoot, +
    +
    + 334 + +
    +   + } +
    +
    + 335 + +
    +   +
    +
    +
    + 336 + +
    + + + //TODO: remove this log +
    +
    + 337 + +
    + + + log.Infof("add l2blockEnd stream entry for l2block %d", l2Block.L2BlockNumber) +
    +
    + 338 + +
    +   + _, err = s.streamServer.AddStreamEntry(state.EntryTypeL2BlockEnd, blockEnd.Encode()) +
    +
    + 339 + +
    +   + if err != nil { +
    +
    + 340 + +
    +   + log.Errorf("failed to add stream entry for l2block %d, error: %v", l2Block.L2BlockNumber, err) +
    +
    + 341 + +
    +   + continue +
    +
    + 342 + +
    +   + } +
    +
    + 343 + +
    +   +
    +
    +
    + 344 + +
    + + + //TODO: remove this log +
    +
    + 345 + +
    + + + log.Infof("commit atomic op for l2block %d", l2Block.L2BlockNumber) +
    +
    + 346 + +
    +   + err = s.streamServer.CommitAtomicOp() +
    +
    + 347 + +
    +   + if err != nil { +
    +
    + 348 + +
    +   + log.Errorf("failed to commit atomic op for l2block %d, error: %v ", l2Block.L2BlockNumber, err) +
    +
    + 349 + +
    +   + continue +
    +
    + 350 + +
    +   + } +
    +
    + 351 + +
    +   +
    +
    +
    + 352 + +
    + + + //TODO: remove this log +
    +
    + 353 + +
    + + + log.Infof("l2block %d sent to datastream", l2Block.L2BlockNumber) +
    +
    + 354 + +
    + + +
    +
    +
    + 355 + +
    +   + // Stream a bookmark +
    +
    + 356 + +
    +   + case state.DSBookMark: +
    +
    + 357 + +
    +   + bookmark := data +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencesender/config.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -41,4 +41,6 @@
    +
    + 41 + +
    +   + // gas offset: 100 +
    +
    + 42 + +
    +   + // final gas: 1100 +
    +
    + 43 + +
    +   + GasOffset uint64 `mapstructure:"GasOffset"` +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 44 + +
    +   + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 41 + +
    +   + // gas offset: 100 +
    +
    + 42 + +
    +   + // final gas: 1100 +
    +
    + 43 + +
    +   + GasOffset uint64 `mapstructure:"GasOffset"` +
    +
    + 44 + +
    + + + // MaxBatchesForL1 is the maximum amount of batches to be sequenced in a single L1 tx +
    +
    + 45 + +
    + + + MaxBatchesForL1 uint64 `mapstructure:"MaxBatchesForL1"` +
    +
    + 46 + +
    +   + } +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencesender/interfaces.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -17,8 +17,8 @@
    +
    + 17 + +
    +   +
    +
    +
    + 18 + +
    +   + // etherman contains the methods required to interact with ethereum. +
    +
    + 19 + +
    +   + type etherman interface { +
    +
    + 20 + +
    + - + BuildSequenceBatchesTxData(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, initSequenceBatchNumber uint64, l2Coinbase common.Address) (to *common.Address, data []byte, err error) +
    +
    + 21 + +
    + - + EstimateGasSequenceBatches(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, initSequenceBatchNumber uint64, l2Coinbase common.Address) (*types.Transaction, error) +
    +
    + 22 + +
    +   + GetLatestBlockHeader(ctx context.Context) (*types.Header, error) +
    +
    + 23 + +
    +   + GetLatestBatchNumber() (uint64, error) +
    +
    + 24 + +
    +   + } +
    +
    +
    @@ -41,3 +41,7 @@
    +
    + 41 + +
    +   + Add(ctx context.Context, owner, id string, from common.Address, to *common.Address, value *big.Int, data []byte, gasOffset uint64, dbTx pgx.Tx) error +
    +
    + 42 + +
    +   + ProcessPendingMonitoredTxs(ctx context.Context, owner string, failedResultHandler ethtxmanager.ResultHandler, dbTx pgx.Tx) +
    +
    + 43 + +
    +   + } +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 17 + +
    +   +
    +
    +
    + 18 + +
    +   + // etherman contains the methods required to interact with ethereum. +
    +
    + 19 + +
    +   + type etherman interface { +
    +
    + 20 + +
    + + + BuildSequenceBatchesTxData(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, initSequenceBatchNumber uint64, l2Coinbase common.Address, committeeSignaturesAndAddrs []byte) (to *common.Address, data []byte, err error) +
    +
    + 21 + +
    + + + EstimateGasSequenceBatches(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, initSequenceBatchNumber uint64, l2Coinbase common.Address, committeeSignaturesAndAddrs []byte) (*types.Transaction, error) +
    +
    + 22 + +
    +   + GetLatestBlockHeader(ctx context.Context) (*types.Header, error) +
    +
    + 23 + +
    +   + GetLatestBatchNumber() (uint64, error) +
    +
    + 24 + +
    +   + } +
    +
    +
     
    +
    + 41 + +
    +   + Add(ctx context.Context, owner, id string, from common.Address, to *common.Address, value *big.Int, data []byte, gasOffset uint64, dbTx pgx.Tx) error +
    +
    + 42 + +
    +   + ProcessPendingMonitoredTxs(ctx context.Context, owner string, failedResultHandler ethtxmanager.ResultHandler, dbTx pgx.Tx) +
    +
    + 43 + +
    +   + } +
    +
    + 44 + +
    + + +
    +
    +
    + 45 + +
    + + + type dataAbilitier interface { +
    +
    + 46 + +
    + + + PostSequence(ctx context.Context, sequences []ethmanTypes.Sequence) ([]byte, error) +
    +
    + 47 + +
    + + + } +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencesender/sequencesender.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -6,13 +6,11 @@
    +
    + 6 + +
    +   + "fmt" +
    +
    + 7 + +
    +   + "time" +
    +
    + 8 + +
    +   +
    +
    +
    + 9 + +
    + - + ethman "github.com/0xPolygonHermez/zkevm-node/etherman" +
    +
    + 10 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/etherman/types" +
    +
    + 11 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/ethtxmanager" +
    +
    + 12 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/event" +
    +
    + 13 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/log" +
    +
    + 14 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/state" +
    +
    + 15 + +
    + - + ethTypes "github.com/ethereum/go-ethereum/core/types" +
    +
    + 16 + +
    +   + "github.com/jackc/pgx/v4" +
    +
    + 17 + +
    +   + ) +
    +
    + 18 + +
    +   +
    +
    +
    +
    @@ -41,16 +39,18 @@
    +
    + 41 + +
    +   + ethTxManager ethTxManager +
    +
    + 42 + +
    +   + etherman etherman +
    +
    + 43 + +
    +   + eventLog *event.EventLog +
    +
    + + +
    +   +
    +
    +
    + 44 + +
    +   + } +
    +
    + 45 + +
    +   +
    +
    +
    + 46 + +
    +   + // New inits sequence sender +
    +
    + 47 + +
    + - + func New(cfg Config, state stateInterface, etherman etherman, manager ethTxManager, eventLog *event.EventLog) (*SequenceSender, error) { +
    +
    + 48 + +
    +   + return &SequenceSender{ +
    +
    + 49 + +
    +   + cfg: cfg, +
    +
    + 50 + +
    +   + state: state, +
    +
    + 51 + +
    +   + etherman: etherman, +
    +
    + 52 + +
    +   + ethTxManager: manager, +
    +
    + 53 + +
    +   + eventLog: eventLog, +
    +
    + + +
    +   +
    +
    +
    + 54 + +
    +   + }, nil +
    +
    + 55 + +
    +   + } +
    +
    + 56 + +
    +   +
    +
    +
    +
    @@ -185,9 +185,14 @@
    +
    + 185 + +
    +   + } +
    +
    + 186 + +
    +   +
    +
    +
    + 187 + +
    +   + // add sequence to be monitored +
    +
    + 188 + +
    + - + firstSequence := sequences[0] +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 189 + +
    +   +
    +
    +
    + 190 + +
    + - + to, data, err := s.etherman.BuildSequenceBatchesTxData(s.cfg.SenderAddress, sequences, uint64(lastSequence.LastL2BLockTimestamp), firstSequence.BatchNumber-1, s.cfg.L2Coinbase) +
    +
    + + +
    +   +
    +
    +
    + 191 + +
    +   + if err != nil { +
    +
    + 192 + +
    +   + log.Error("error estimating new sequenceBatches to add to eth tx manager: ", err) +
    +
    + 193 + +
    +   + return +
    +
    +
    @@ -208,7 +213,7 @@
    +
    + 208 + +
    +   + func (s *SequenceSender) getSequencesToSend(ctx context.Context) ([]types.Sequence, error) { +
    +
    + 209 + +
    +   + lastVirtualBatchNum, err := s.state.GetLastVirtualBatchNum(ctx, nil) +
    +
    + 210 + +
    +   + if err != nil { +
    +
    + 211 + +
    + - + return nil, fmt.Errorf("failed to get last virtual batch num, err: %w", err) +
    +
    + 212 + +
    +   + } +
    +
    + 213 + +
    +   + log.Debugf("last virtual batch number: %d", lastVirtualBatchNum) +
    +
    + 214 + +
    +   +
    +
    +
    +
    @@ -218,8 +223,6 @@
    +
    + 218 + +
    +   + sequences := []types.Sequence{} +
    +
    + 219 + +
    +   + // var estimatedGas uint64 +
    +
    + 220 + +
    +   +
    +
    +
    + 221 + +
    + - + var tx *ethTypes.Transaction +
    +
    + 222 + +
    + - +
    +
    +
    + 223 + +
    +   + // Add sequences until too big for a single L1 tx or last batch is reached +
    +
    + 224 + +
    +   + for { +
    +
    + 225 + +
    +   + //Check if the next batch belongs to a new forkid, in this case we need to stop sequencing as we need to +
    +
    +
    @@ -234,14 +237,14 @@
    +
    + 234 + +
    +   + if err == state.ErrNotFound { +
    +
    + 235 + +
    +   + break +
    +
    + 236 + +
    +   + } +
    +
    + 237 + +
    + - + log.Debugf("failed to get batch by number %d, err: %w", currentBatchNumToSequence, err) +
    +
    + 238 + +
    +   + return nil, err +
    +
    + 239 + +
    +   + } +
    +
    + 240 + +
    +   +
    +
    +
    + 241 + +
    +   + // Check if batch is closed and checked (sequencer sanity check was successful) +
    +
    + 242 + +
    +   + isChecked, err := s.state.IsBatchChecked(ctx, currentBatchNumToSequence, nil) +
    +
    + 243 + +
    +   + if err != nil { +
    +
    + 244 + +
    + - + log.Debugf("failed to check if batch %d is closed and checked, err: %w", currentBatchNumToSequence, err) +
    +
    + 245 + +
    +   + return nil, err +
    +
    + 246 + +
    +   + } +
    +
    + 247 + +
    +   +
    +
    +
    +
    @@ -288,31 +291,11 @@
    +
    + 288 + +
    +   +
    +
    +
    + 289 + +
    +   + sequences = append(sequences, seq) +
    +
    + 290 + +
    +   + // Check if can be send +
    +
    + 291 + +
    + - + firstSequence := sequences[0] +
    +
    + 292 + +
    + - + lastSequence := sequences[len(sequences)-1] +
    +
    + 293 + +
    + - + tx, err = s.etherman.EstimateGasSequenceBatches(s.cfg.SenderAddress, sequences, uint64(lastSequence.LastL2BLockTimestamp), firstSequence.BatchNumber-1, s.cfg.L2Coinbase) +
    +
    + 294 + +
    + - + if err == nil && tx.Size() > s.cfg.MaxTxSizeForL1 { +
    +
    + 295 + +
    + - + log.Infof("oversized Data on TX oldHash %s (txSize %d > %d)", tx.Hash(), tx.Size(), s.cfg.MaxTxSizeForL1) +
    +
    + 296 + +
    + - + err = ErrOversizedData +
    +
    + 297 + +
    + - + } +
    +
    + 298 + +
    + - + if err != nil { +
    +
    + 299 + +
    + - + log.Infof("Handling estimage gas send sequence error: %v", err) +
    +
    + 300 + +
    + - + sequences, err = s.handleEstimateGasSendSequenceErr(ctx, sequences, currentBatchNumToSequence, err) +
    +
    + 301 + +
    + - + if sequences != nil { +
    +
    + 302 + +
    + - + if len(sequences) > 0 { +
    +
    + 303 + +
    + - + // Handling the error gracefully, re-processing the sequence as a sanity check +
    +
    + 304 + +
    + - + lastSequence = sequences[len(sequences)-1] +
    +
    + 305 + +
    + - + _, err = s.etherman.EstimateGasSequenceBatches(s.cfg.SenderAddress, sequences, uint64(lastSequence.LastL2BLockTimestamp), firstSequence.BatchNumber-1, s.cfg.L2Coinbase) +
    +
    + 306 + +
    + - + return sequences, err +
    +
    + 307 + +
    + - + } +
    +
    + 308 + +
    + - + } +
    +
    + 309 + +
    + - + return sequences, err +
    +
    + 310 + +
    + - + } +
    +
    + 311 + +
    + - + // estimatedGas = tx.Gas() +
    +
    + 312 + +
    + - +
    +
    +
    + 313 + +
    + - + //Check if the current batch is the last before a change to a new forkid, in this case we need to close and send the sequence to L1 +
    +
    + 314 + +
    + - + if (s.cfg.ForkUpgradeBatchNumber != 0) && (currentBatchNumToSequence == (s.cfg.ForkUpgradeBatchNumber)) { +
    +
    + 315 + +
    + - + log.Infof("sequence should be sent to L1, as we have reached the batch %d from which a new forkid is applied (upgrade)", s.cfg.ForkUpgradeBatchNumber) +
    +
    + 316 + +
    +   + return sequences, nil +
    +
    + 317 + +
    +   + } +
    +
    + 318 + +
    +   +
    +
    +
    +
    @@ -343,78 +326,6 @@
    +
    + 343 + +
    +   + return nil, nil +
    +
    + 344 + +
    +   + } +
    +
    + 345 + +
    +   +
    +
    +
    + 346 + +
    + - + // handleEstimateGasSendSequenceErr handles an error on the estimate gas. It will return: +
    +
    + 347 + +
    + - + // nil, error: impossible to handle gracefully +
    +
    + 348 + +
    + - + // sequence, nil: handled gracefully. Potentially manipulating the sequences +
    +
    + 349 + +
    + - + // nil, nil: a situation that requires waiting +
    +
    + 350 + +
    + - + func (s *SequenceSender) handleEstimateGasSendSequenceErr( +
    +
    + 351 + +
    + - + ctx context.Context, +
    +
    + 352 + +
    + - + sequences []types.Sequence, +
    +
    + 353 + +
    + - + currentBatchNumToSequence uint64, +
    +
    + 354 + +
    + - + err error, +
    +
    + 355 + +
    + - + ) ([]types.Sequence, error) { +
    +
    + 356 + +
    + - + // Insufficient allowance +
    +
    + 357 + +
    + - + if errors.Is(err, ethman.ErrInsufficientAllowance) { +
    +
    + 358 + +
    + - + return nil, err +
    +
    + 359 + +
    + - + } +
    +
    + 360 + +
    + - + if isDataForEthTxTooBig(err) { +
    +
    + 361 + +
    + - + // Remove the latest item and send the sequences +
    +
    + 362 + +
    + - + log.Infof( +
    +
    + 363 + +
    + - + "Done building sequences, selected batches to %d. Batch %d caused the L1 tx to be too big", +
    +
    + 364 + +
    + - + currentBatchNumToSequence-1, currentBatchNumToSequence, +
    +
    + 365 + +
    + - + ) +
    +
    + 366 + +
    + - + sequences = sequences[:len(sequences)-1] +
    +
    + 367 + +
    + - + return sequences, nil +
    +
    + 368 + +
    + - + } +
    +
    + 369 + +
    + - +
    +
    +
    + 370 + +
    + - + // while estimating gas a new block is not created and the POE SC may return +
    +
    + 371 + +
    + - + // an error regarding timestamp verification, this must be handled +
    +
    + 372 + +
    + - + // if errors.Is(err, ethman.ErrTimestampMustBeInsideRange) { +
    +
    + 373 + +
    + - + // // query the sc about the value of its lastTimestamp variable +
    +
    + 374 + +
    + - + // lastTimestamp, err := s.etherman.GetLastBatchTimestamp() +
    +
    + 375 + +
    + - + // if err != nil { +
    +
    + 376 + +
    + - + // return nil, err +
    +
    + 377 + +
    + - + // } +
    +
    + 378 + +
    + - + // // check POE SC lastTimestamp against sequences' one +
    +
    + 379 + +
    + - + // for _, seq := range sequences { +
    +
    + 380 + +
    + - + // if seq.Timestamp < int64(lastTimestamp) { +
    +
    + 381 + +
    + - + // // TODO: gracefully handle this situation by creating an L2 reorg +
    +
    + 382 + +
    + - + // log.Fatalf("sequence timestamp %d is < POE SC lastTimestamp %d", seq.Timestamp, lastTimestamp) +
    +
    + 383 + +
    + - + // } +
    +
    + 384 + +
    + - + // lastTimestamp = uint64(seq.Timestamp) +
    +
    + 385 + +
    + - + // } +
    +
    + 386 + +
    + - + // blockTimestamp, err := s.etherman.GetLatestBlockTimestamp(ctx) +
    +
    + 387 + +
    + - + // if err != nil { +
    +
    + 388 + +
    + - + // log.Error("error getting block timestamp: ", err) +
    +
    + 389 + +
    + - + // } +
    +
    + 390 + +
    + - + // log.Debugf("block.timestamp: %d is smaller than seq.Timestamp: %d. A new block must be mined in L1 before the gas can be estimated.", blockTimestamp, sequences[0].Timestamp) +
    +
    + 391 + +
    + - + // return nil, nil +
    +
    + 392 + +
    + - + // } +
    +
    + 393 + +
    + - +
    +
    +
    + 394 + +
    + - + // Unknown error +
    +
    + 395 + +
    + - + if len(sequences) == 1 { +
    +
    + 396 + +
    + - + // TODO: gracefully handle this situation by creating an L2 reorg +
    +
    + 397 + +
    + - + log.Errorf( +
    +
    + 398 + +
    + - + "Error when estimating gas for BatchNum %d (alone in the sequences): %v", +
    +
    + 399 + +
    + - + currentBatchNumToSequence, err, +
    +
    + 400 + +
    + - + ) +
    +
    + 401 + +
    + - + } +
    +
    + 402 + +
    + - + // Remove the latest item and send the sequences +
    +
    + 403 + +
    + - + log.Infof( +
    +
    + 404 + +
    + - + "Done building sequences, selected batches to %d. Batch %d excluded due to unknown error: %v", +
    +
    + 405 + +
    + - + currentBatchNumToSequence, currentBatchNumToSequence+1, err, +
    +
    + 406 + +
    + - + ) +
    +
    + 407 + +
    + - + sequences = sequences[:len(sequences)-1] +
    +
    + 408 + +
    + - +
    +
    +
    + 409 + +
    + - + return sequences, nil +
    +
    + 410 + +
    + - + } +
    +
    + 411 + +
    + - +
    +
    +
    + 412 + +
    + - + func isDataForEthTxTooBig(err error) bool { +
    +
    + 413 + +
    + - + return errors.Is(err, ethman.ErrGasRequiredExceedsAllowance) || +
    +
    + 414 + +
    + - + errors.Is(err, ErrOversizedData) || +
    +
    + 415 + +
    + - + errors.Is(err, ethman.ErrContentLengthTooLarge) +
    +
    + 416 + +
    + - + } +
    +
    + 417 + +
    + - +
    +
    +
    + 418 + +
    +   + func (s *SequenceSender) isSynced(ctx context.Context, retries int, waitRetry time.Duration) (bool, error) { +
    +
    + 419 + +
    +   + lastVirtualBatchNum, err := s.state.GetLastVirtualBatchNum(ctx, nil) +
    +
    + 420 + +
    +   + if err != nil && err != state.ErrNotFound { +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 6 + +
    +   + "fmt" +
    +
    + 7 + +
    +   + "time" +
    +
    + 8 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 9 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/etherman/types" +
    +
    + 10 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/ethtxmanager" +
    +
    + 11 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/event" +
    +
    + 12 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/log" +
    +
    + 13 + +
    +   + "github.com/0xPolygonHermez/zkevm-node/state" +
    +
    + + +
    +   +
    +
    +
    + 14 + +
    +   + "github.com/jackc/pgx/v4" +
    +
    + 15 + +
    +   + ) +
    +
    + 16 + +
    +   +
    +
    +
    +
     
    +
    + 39 + +
    +   + ethTxManager ethTxManager +
    +
    + 40 + +
    +   + etherman etherman +
    +
    + 41 + +
    +   + eventLog *event.EventLog +
    +
    + 42 + +
    + + + da dataAbilitier +
    +
    + 43 + +
    +   + } +
    +
    + 44 + +
    +   +
    +
    +
    + 45 + +
    +   + // New inits sequence sender +
    +
    + 46 + +
    + + + func New(cfg Config, state stateInterface, etherman etherman, manager ethTxManager, eventLog *event.EventLog, da dataAbilitier) (*SequenceSender, error) { +
    +
    + 47 + +
    +   + return &SequenceSender{ +
    +
    + 48 + +
    +   + cfg: cfg, +
    +
    + 49 + +
    +   + state: state, +
    +
    + 50 + +
    +   + etherman: etherman, +
    +
    + 51 + +
    +   + ethTxManager: manager, +
    +
    + 52 + +
    +   + eventLog: eventLog, +
    +
    + 53 + +
    + + + da: da, +
    +
    + 54 + +
    +   + }, nil +
    +
    + 55 + +
    +   + } +
    +
    + 56 + +
    +   +
    +
    +
    +
     
    +
    + 185 + +
    +   + } +
    +
    + 186 + +
    +   +
    +
    +
    + 187 + +
    +   + // add sequence to be monitored +
    +
    + 188 + +
    + + + dataAvailabilityMessage, err := s.da.PostSequence(ctx, sequences) +
    +
    + 189 + +
    + + + if err != nil { +
    +
    + 190 + +
    + + + log.Error("error posting sequences to the data availability protocol: ", err) +
    +
    + 191 + +
    + + + return +
    +
    + 192 + +
    + + + } +
    +
    + 193 + +
    +   +
    +
    +
    + 194 + +
    + + + firstSequence := sequences[0] +
    +
    + 195 + +
    + + + to, data, err := s.etherman.BuildSequenceBatchesTxData(s.cfg.SenderAddress, sequences, uint64(lastSequence.LastL2BLockTimestamp), firstSequence.BatchNumber-1, s.cfg.L2Coinbase, dataAvailabilityMessage) +
    +
    + 196 + +
    +   + if err != nil { +
    +
    + 197 + +
    +   + log.Error("error estimating new sequenceBatches to add to eth tx manager: ", err) +
    +
    + 198 + +
    +   + return +
    +
    +
     
    +
    + 213 + +
    +   + func (s *SequenceSender) getSequencesToSend(ctx context.Context) ([]types.Sequence, error) { +
    +
    + 214 + +
    +   + lastVirtualBatchNum, err := s.state.GetLastVirtualBatchNum(ctx, nil) +
    +
    + 215 + +
    +   + if err != nil { +
    +
    + 216 + +
    + + + return nil, fmt.Errorf("failed to get last virtual batch num, err: %v", err) +
    +
    + 217 + +
    +   + } +
    +
    + 218 + +
    +   + log.Debugf("last virtual batch number: %d", lastVirtualBatchNum) +
    +
    + 219 + +
    +   +
    +
    +
    +
     
    +
    + 223 + +
    +   + sequences := []types.Sequence{} +
    +
    + 224 + +
    +   + // var estimatedGas uint64 +
    +
    + 225 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 226 + +
    +   + // Add sequences until too big for a single L1 tx or last batch is reached +
    +
    + 227 + +
    +   + for { +
    +
    + 228 + +
    +   + //Check if the next batch belongs to a new forkid, in this case we need to stop sequencing as we need to +
    +
    +
     
    +
    + 237 + +
    +   + if err == state.ErrNotFound { +
    +
    + 238 + +
    +   + break +
    +
    + 239 + +
    +   + } +
    +
    + 240 + +
    + + + log.Debugf("failed to get batch by number %d, err: %v", currentBatchNumToSequence, err) +
    +
    + 241 + +
    +   + return nil, err +
    +
    + 242 + +
    +   + } +
    +
    + 243 + +
    +   +
    +
    +
    + 244 + +
    +   + // Check if batch is closed and checked (sequencer sanity check was successful) +
    +
    + 245 + +
    +   + isChecked, err := s.state.IsBatchChecked(ctx, currentBatchNumToSequence, nil) +
    +
    + 246 + +
    +   + if err != nil { +
    +
    + 247 + +
    + + + log.Debugf("failed to check if batch %d is closed and checked, err: %v", currentBatchNumToSequence, err) +
    +
    + 248 + +
    +   + return nil, err +
    +
    + 249 + +
    +   + } +
    +
    + 250 + +
    +   +
    +
    +
    +
     
    +
    + 291 + +
    +   +
    +
    +
    + 292 + +
    +   + sequences = append(sequences, seq) +
    +
    + 293 + +
    +   + // Check if can be send +
    +
    + 294 + +
    + + + if len(sequences) == int(s.cfg.MaxBatchesForL1) { +
    +
    + 295 + +
    + + + log.Info( +
    +
    + 296 + +
    + + + "sequence should be sent to L1, because MaxBatchesForL1 (%d) has been reached", +
    +
    + 297 + +
    + + + s.cfg.MaxBatchesForL1, +
    +
    + 298 + +
    + + + ) +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 299 + +
    +   + return sequences, nil +
    +
    + 300 + +
    +   + } +
    +
    + 301 + +
    +   +
    +
    +
    +
     
    +
    + 326 + +
    +   + return nil, nil +
    +
    + 327 + +
    +   + } +
    +
    + 328 + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 329 + +
    +   + func (s *SequenceSender) isSynced(ctx context.Context, retries int, waitRetry time.Duration) (bool, error) { +
    +
    + 330 + +
    +   + lastVirtualBatchNum, err := s.state.GetLastVirtualBatchNum(ctx, nil) +
    +
    + 331 + +
    +   + if err != nil && err != state.ErrNotFound { +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencesender/sequencesender_test.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -30,7 +30,7 @@
    +
    + 30 + +
    +   + stateMock := new(StateMock) +
    +
    + 31 + +
    +   + ethermanMock := new(EthermanMock) +
    +
    + 32 + +
    +   + ethTxManagerMock := new(EthTxManagerMock) +
    +
    + 33 + +
    + - + ssender, err := New(Config{}, stateMock, ethermanMock, ethTxManagerMock, nil) +
    +
    + 34 + +
    +   + assert.NoError(t, err) +
    +
    + 35 + +
    +   +
    +
    +
    + 36 + +
    +   + testCases := []IsSyncedTestCase{ +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 30 + +
    +   + stateMock := new(StateMock) +
    +
    + 31 + +
    +   + ethermanMock := new(EthermanMock) +
    +
    + 32 + +
    +   + ethTxManagerMock := new(EthTxManagerMock) +
    +
    + 33 + +
    + + + ssender, err := New(Config{}, stateMock, ethermanMock, ethTxManagerMock, nil, nil) +
    +
    + 34 + +
    +   + assert.NoError(t, err) +
    +
    + 35 + +
    +   +
    +
    +
    + 36 + +
    +   + testCases := []IsSyncedTestCase{ +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/sonar-project.properties + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,15 +1,10 @@
    +
    + 1 + +
    + - + sonar.projectKey=0xPolygonHermez_zkevm-node +
    +
    + 2 + +
    + - + sonar.organization=0xpolygonhermez +
    +
    + 3 + +
    +   +
    +
    +
    + 4 + +
    +   + sonar.sources=. +
    +
    + 5 + +
    +   + sonar.exclusions=**/*_test.go +
    +
    + 6 + +
    + - + sonar.exclusions=**/mock_*.go, **/mock/** +
    +
    + 7 + +
    +   + +
    +
    + 8 + +
    +   + sonar.tests=. +
    +
    + 9 + +
    +   + sonar.test.inclusions=**/*_test.go +
    +
    + 10 + +
    + - + sonar.test.exclusions=**/mock_*.go, **/mock/** +
    +
    + 11 + +
    + - +
    +
    +
    + 12 + +
    +   + sonar.go.coverage.reportPaths=coverage.out +
    +
    + 13 + +
    + - + #sonar.coverageReportPaths=coverage.out +
    +
    + 14 + +
    + - + #onar.testExecutionReportPaths=report.json +
    +
    + 15 + +
    +   + sonar.go.tests.reportPaths=report.json +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 1 + +
    + + + sonar.projectKey=zkevm-node +
    +
    + + +
    +   +
    +
    +
    + 2 + +
    +   +
    +
    +
    + 3 + +
    +   + sonar.sources=. +
    +
    + 4 + +
    +   + sonar.exclusions=**/*_test.go +
    +
    + 5 + +
    + + + sonar.exclusions=**/mock_*.go +
    +
    + 6 + +
    +   + +
    +
    + 7 + +
    +   + sonar.tests=. +
    +
    + 8 + +
    +   + sonar.test.inclusions=**/*_test.go +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 9 + +
    +   + sonar.go.coverage.reportPaths=coverage.out +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 10 + +
    +   + sonar.go.tests.reportPaths=report.json +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/batch_pending.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,11 +0,0 @@
    +
    + 1 + +
    + - + package state +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + import "time" +
    +
    + 4 + +
    + - +
    +
    +
    + 5 + +
    + - + // PendingBatch represents a batch pending to be executed +
    +
    + 6 + +
    + - + type PendingBatch struct { +
    +
    + 7 + +
    + - + BatchNumber uint64 +
    +
    + 8 + +
    + - + BlobInnerNum uint64 +
    +
    + 9 + +
    + - + CreatedAt time.Time +
    +
    + 10 + +
    + - + Processed bool +
    +
    + 11 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/batchV2.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -33,6 +33,7 @@
    +
    + 33 + +
    +   + ForcedBlockHashL1 *common.Hash +
    +
    + 34 + +
    +   + SkipVerifyL1InfoRoot uint32 +
    +
    + 35 + +
    +   + GlobalExitRoot common.Hash // GlobalExitRoot is not use for execute but use to OpenBatch (data on DB) +
    +
    + + +
    +   +
    +
    +
    + 36 + +
    +   + ClosingReason ClosingReason +
    +
    + 37 + +
    +   + } +
    +
    + 38 + +
    +   +
    +
    +
    +
    @@ -68,6 +69,7 @@
    +
    + 68 + +
    +   + ChainId: s.cfg.ChainID, +
    +
    + 69 + +
    +   + ForkId: request.ForkID, +
    +
    + 70 + +
    +   + ContextId: uuid.NewString(), +
    +
    + + +
    +   +
    +
    +
    + 71 + +
    +   + } +
    +
    + 72 + +
    +   +
    +
    +
    + 73 + +
    +   + if request.SkipFirstChangeL2Block_V2 { +
    +
    +
    @@ -130,6 +132,7 @@
    +
    + 130 + +
    +   + ForkId: forkId, +
    +
    + 131 + +
    +   + ContextId: uuid.NewString(), +
    +
    + 132 + +
    +   + SkipVerifyL1InfoRoot: skipVerifyL1InfoRoot, +
    +
    + + +
    +   +
    +
    +
    + 133 + +
    +   + } +
    +
    + 134 + +
    +   +
    +
    +
    + 135 + +
    +   + if forcedBlockHashL1 != nil { +
    +
    +
    @@ -168,7 +171,7 @@
    +
    + 168 + +
    +   + return nil, err +
    +
    + 169 + +
    +   + } else if processBatchResponse != nil && processBatchResponse.Error != executor.ExecutorError_EXECUTOR_ERROR_NO_ERROR { +
    +
    + 170 + +
    +   + err = executor.ExecutorErr(processBatchResponse.Error) +
    +
    + 171 + +
    + - + s.eventLog.LogExecutorError(ctx, processBatchResponse.Error, processBatchRequest) +
    +
    + 172 + +
    +   + } +
    +
    + 173 + +
    +   +
    +
    +
    + 174 + +
    +   + return processBatchResponse, err +
    +
    +
    @@ -230,6 +233,7 @@
    +
    + 230 + +
    +   + ContextId: uuid.NewString(), +
    +
    + 231 + +
    +   + SkipVerifyL1InfoRoot: processingCtx.SkipVerifyL1InfoRoot, +
    +
    + 232 + +
    +   + L1InfoRoot: processingCtx.L1InfoRoot.Bytes(), +
    +
    + + +
    +   +
    +
    +
    + 233 + +
    +   + } +
    +
    + 234 + +
    +   +
    +
    +
    + 235 + +
    +   + if processingCtx.ForcedBlockHashL1 != nil { +
    +
    +
    @@ -299,12 +303,12 @@
    +
    + 299 + +
    +   + log.Errorf("error executor ProcessBatchV2: %s", err.Error()) +
    +
    + 300 + +
    +   + log.Errorf("error executor ProcessBatchV2 response: %v", batchResponse) +
    +
    + 301 + +
    +   + } else { +
    +
    + 302 + +
    + - + batchResponseToString := processBatchResponseV2ToString(newBatchNum, batchResponse, elapsed) +
    +
    + 303 + +
    +   + if batchResponse.Error != executor.ExecutorError_EXECUTOR_ERROR_NO_ERROR { +
    +
    + 304 + +
    +   + err = executor.ExecutorErr(batchResponse.Error) +
    +
    + 305 + +
    +   + log.Warnf("executor batch %d response, executor error: %v", newBatchNum, err) +
    +
    + 306 + +
    +   + log.Warn(batchResponseToString) +
    +
    + 307 + +
    + - + s.eventLog.LogExecutorError(ctx, batchResponse.Error, batchRequest) +
    +
    + 308 + +
    +   + } else if batchResponse.ErrorRom != executor.RomError_ROM_ERROR_NO_ERROR && executor.IsROMOutOfCountersError(batchResponse.ErrorRom) { +
    +
    + 309 + +
    +   + err = executor.RomErr(batchResponse.ErrorRom) +
    +
    + 310 + +
    +   + log.Warnf("executor batch %d response, ROM OOC, error: %v", newBatchNum, err) +
    +
    +
    @@ -321,32 +325,32 @@
    +
    + 321 + +
    +   + return batchResponse, err +
    +
    + 322 + +
    +   + } +
    +
    + 323 + +
    +   +
    +
    +
    + 324 + +
    + - + func processBatchResponseV2ToString(batchNum uint64, batchResponse *executor.ProcessBatchResponseV2, executionTime time.Duration) string { +
    +
    + 325 + +
    +   + batchResponseLog := "executor batch %d response, Time: %v, NewStateRoot: %v, NewAccInputHash: %v, NewLocalExitRoot: %v, NewBatchNumber: %v, GasUsed: %v, FlushId: %v, StoredFlushId: %v, ProverId:%v, ForkId:%v, Error: %v\n" +
    +
    + 326 + +
    +   + batchResponseLog = fmt.Sprintf(batchResponseLog, batchNum, executionTime, hex.EncodeToHex(batchResponse.NewStateRoot), hex.EncodeToHex(batchResponse.NewAccInputHash), hex.EncodeToHex(batchResponse.NewLocalExitRoot), +
    +
    + 327 + +
    +   + batchResponse.NewBatchNum, batchResponse.GasUsed, batchResponse.FlushId, batchResponse.StoredFlushId, batchResponse.ProverId, batchResponse.ForkId, batchResponse.Error) +
    +
    + 328 + +
    +   +
    +
    +
    + 329 + +
    +   + for blockIndex, block := range batchResponse.BlockResponses { +
    +
    + 330 + +
    +   + prefix := " " + fmt.Sprintf("block[%v]: ", blockIndex) +
    +
    + 331 + +
    + - + batchResponseLog += blockResponseV2ToString(block, prefix) +
    +
    + 332 + +
    +   + } +
    +
    + 333 + +
    +   +
    +
    +
    + 334 + +
    +   + return batchResponseLog +
    +
    + 335 + +
    +   + } +
    +
    + 336 + +
    + - + func blockResponseV2ToString(blockResponse *executor.ProcessBlockResponseV2, prefix string) string { +
    +
    + 337 + +
    +   + blockResponseLog := prefix + "ParentHash: %v, Coinbase: %v, GasLimit: %v, BlockNumber: %v, Timestamp: %v, GlobalExitRoot: %v, BlockHashL1: %v, GasUsed: %v, BlockInfoRoot: %v, BlockHash: %v\n" +
    +
    + 338 + +
    +   + blockResponseLog = fmt.Sprintf(blockResponseLog, common.BytesToHash(blockResponse.ParentHash), blockResponse.Coinbase, blockResponse.GasLimit, blockResponse.BlockNumber, blockResponse.Timestamp, +
    +
    + 339 + +
    +   + common.BytesToHash(blockResponse.Ger), common.BytesToHash(blockResponse.BlockHashL1), blockResponse.GasUsed, common.BytesToHash(blockResponse.BlockInfoRoot), common.BytesToHash(blockResponse.BlockHash)) +
    +
    + 340 + +
    +   +
    +
    +
    + 341 + +
    +   + for txIndex, tx := range blockResponse.Responses { +
    +
    + 342 + +
    +   + prefix := " " + fmt.Sprintf("tx[%v]: ", txIndex) +
    +
    + 343 + +
    + - + blockResponseLog += transactionResponseV2ToString(tx, prefix) +
    +
    + 344 + +
    +   + } +
    +
    + 345 + +
    +   +
    +
    +
    + 346 + +
    +   + return blockResponseLog +
    +
    + 347 + +
    +   + } +
    +
    + 348 + +
    +   +
    +
    +
    + 349 + +
    + - + func transactionResponseV2ToString(txResponse *executor.ProcessTransactionResponseV2, prefix string) string { +
    +
    + 350 + +
    +   + txResponseLog := prefix + "TxHash: %v, TxHashL2: %v, Type: %v, StateRoot:%v, GasUsed: %v, GasLeft: %v, GasRefund: %v, Error: %v\n" +
    +
    + 351 + +
    +   + txResponseLog = fmt.Sprintf(txResponseLog, common.BytesToHash(txResponse.TxHash), common.BytesToHash(txResponse.TxHashL2), txResponse.Type, +
    +
    + 352 + +
    +   + common.BytesToHash(txResponse.StateRoot), txResponse.GasUsed, txResponse.GasLeft, txResponse.GasRefunded, txResponse.Error) +
    +
    +
    @@ -416,14 +420,3 @@
    +
    + 416 + +
    +   + ClosingReason: processingCtx.ClosingReason, +
    +
    + 417 + +
    +   + }, dbTx) +
    +
    + 418 + +
    +   + } +
    +
    + 419 + +
    + - +
    +
    +
    + 420 + +
    + - + // BuildChangeL2Block returns a changeL2Block tx to use in the BatchL2Data +
    +
    + 421 + +
    + - + func (p *State) BuildChangeL2Block(deltaTimestamp uint32, l1InfoTreeIndex uint32) []byte { +
    +
    + 422 + +
    + - + l2block := ChangeL2BlockHeader{ +
    +
    + 423 + +
    + - + DeltaTimestamp: deltaTimestamp, +
    +
    + 424 + +
    + - + IndexL1InfoTree: l1InfoTreeIndex, +
    +
    + 425 + +
    + - + } +
    +
    + 426 + +
    + - + var data []byte +
    +
    + 427 + +
    + - + data = l2block.Encode(data) +
    +
    + 428 + +
    + - + return data +
    +
    + 429 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 33 + +
    +   + ForcedBlockHashL1 *common.Hash +
    +
    + 34 + +
    +   + SkipVerifyL1InfoRoot uint32 +
    +
    + 35 + +
    +   + GlobalExitRoot common.Hash // GlobalExitRoot is not use for execute but use to OpenBatch (data on DB) +
    +
    + 36 + +
    + + + ExecutionMode uint64 +
    +
    + 37 + +
    +   + ClosingReason ClosingReason +
    +
    + 38 + +
    +   + } +
    +
    + 39 + +
    +   +
    +
    +
    +
     
    +
    + 69 + +
    +   + ChainId: s.cfg.ChainID, +
    +
    + 70 + +
    +   + ForkId: request.ForkID, +
    +
    + 71 + +
    +   + ContextId: uuid.NewString(), +
    +
    + 72 + +
    + + + ExecutionMode: request.ExecutionMode, +
    +
    + 73 + +
    +   + } +
    +
    + 74 + +
    +   +
    +
    +
    + 75 + +
    +   + if request.SkipFirstChangeL2Block_V2 { +
    +
    +
     
    +
    + 132 + +
    +   + ForkId: forkId, +
    +
    + 133 + +
    +   + ContextId: uuid.NewString(), +
    +
    + 134 + +
    +   + SkipVerifyL1InfoRoot: skipVerifyL1InfoRoot, +
    +
    + 135 + +
    + + + ExecutionMode: executor.ExecutionMode1, +
    +
    + 136 + +
    +   + } +
    +
    + 137 + +
    +   +
    +
    +
    + 138 + +
    +   + if forcedBlockHashL1 != nil { +
    +
    +
     
    +
    + 171 + +
    +   + return nil, err +
    +
    + 172 + +
    +   + } else if processBatchResponse != nil && processBatchResponse.Error != executor.ExecutorError_EXECUTOR_ERROR_NO_ERROR { +
    +
    + 173 + +
    +   + err = executor.ExecutorErr(processBatchResponse.Error) +
    +
    + 174 + +
    + + + s.eventLog.LogExecutorErrorV2(ctx, processBatchResponse.Error, processBatchRequest) +
    +
    + 175 + +
    +   + } +
    +
    + 176 + +
    +   +
    +
    +
    + 177 + +
    +   + return processBatchResponse, err +
    +
    +
     
    +
    + 233 + +
    +   + ContextId: uuid.NewString(), +
    +
    + 234 + +
    +   + SkipVerifyL1InfoRoot: processingCtx.SkipVerifyL1InfoRoot, +
    +
    + 235 + +
    +   + L1InfoRoot: processingCtx.L1InfoRoot.Bytes(), +
    +
    + 236 + +
    + + + ExecutionMode: processingCtx.ExecutionMode, +
    +
    + 237 + +
    +   + } +
    +
    + 238 + +
    +   +
    +
    +
    + 239 + +
    +   + if processingCtx.ForcedBlockHashL1 != nil { +
    +
    +
     
    +
    + 303 + +
    +   + log.Errorf("error executor ProcessBatchV2: %s", err.Error()) +
    +
    + 304 + +
    +   + log.Errorf("error executor ProcessBatchV2 response: %v", batchResponse) +
    +
    + 305 + +
    +   + } else { +
    +
    + 306 + +
    + + + batchResponseToString := processBatchResponseToString(newBatchNum, batchResponse, elapsed) +
    +
    + 307 + +
    +   + if batchResponse.Error != executor.ExecutorError_EXECUTOR_ERROR_NO_ERROR { +
    +
    + 308 + +
    +   + err = executor.ExecutorErr(batchResponse.Error) +
    +
    + 309 + +
    +   + log.Warnf("executor batch %d response, executor error: %v", newBatchNum, err) +
    +
    + 310 + +
    +   + log.Warn(batchResponseToString) +
    +
    + 311 + +
    + + + s.eventLog.LogExecutorErrorV2(ctx, batchResponse.Error, batchRequest) +
    +
    + 312 + +
    +   + } else if batchResponse.ErrorRom != executor.RomError_ROM_ERROR_NO_ERROR && executor.IsROMOutOfCountersError(batchResponse.ErrorRom) { +
    +
    + 313 + +
    +   + err = executor.RomErr(batchResponse.ErrorRom) +
    +
    + 314 + +
    +   + log.Warnf("executor batch %d response, ROM OOC, error: %v", newBatchNum, err) +
    +
    +
     
    +
    + 325 + +
    +   + return batchResponse, err +
    +
    + 326 + +
    +   + } +
    +
    + 327 + +
    +   +
    +
    +
    + 328 + +
    + + + func processBatchResponseToString(batchNum uint64, batchResponse *executor.ProcessBatchResponseV2, executionTime time.Duration) string { +
    +
    + 329 + +
    +   + batchResponseLog := "executor batch %d response, Time: %v, NewStateRoot: %v, NewAccInputHash: %v, NewLocalExitRoot: %v, NewBatchNumber: %v, GasUsed: %v, FlushId: %v, StoredFlushId: %v, ProverId:%v, ForkId:%v, Error: %v\n" +
    +
    + 330 + +
    +   + batchResponseLog = fmt.Sprintf(batchResponseLog, batchNum, executionTime, hex.EncodeToHex(batchResponse.NewStateRoot), hex.EncodeToHex(batchResponse.NewAccInputHash), hex.EncodeToHex(batchResponse.NewLocalExitRoot), +
    +
    + 331 + +
    +   + batchResponse.NewBatchNum, batchResponse.GasUsed, batchResponse.FlushId, batchResponse.StoredFlushId, batchResponse.ProverId, batchResponse.ForkId, batchResponse.Error) +
    +
    + 332 + +
    +   +
    +
    +
    + 333 + +
    +   + for blockIndex, block := range batchResponse.BlockResponses { +
    +
    + 334 + +
    +   + prefix := " " + fmt.Sprintf("block[%v]: ", blockIndex) +
    +
    + 335 + +
    + + + batchResponseLog += blockResponseToString(block, prefix) +
    +
    + 336 + +
    +   + } +
    +
    + 337 + +
    +   +
    +
    +
    + 338 + +
    +   + return batchResponseLog +
    +
    + 339 + +
    +   + } +
    +
    + 340 + +
    + + + func blockResponseToString(blockResponse *executor.ProcessBlockResponseV2, prefix string) string { +
    +
    + 341 + +
    +   + blockResponseLog := prefix + "ParentHash: %v, Coinbase: %v, GasLimit: %v, BlockNumber: %v, Timestamp: %v, GlobalExitRoot: %v, BlockHashL1: %v, GasUsed: %v, BlockInfoRoot: %v, BlockHash: %v\n" +
    +
    + 342 + +
    +   + blockResponseLog = fmt.Sprintf(blockResponseLog, common.BytesToHash(blockResponse.ParentHash), blockResponse.Coinbase, blockResponse.GasLimit, blockResponse.BlockNumber, blockResponse.Timestamp, +
    +
    + 343 + +
    +   + common.BytesToHash(blockResponse.Ger), common.BytesToHash(blockResponse.BlockHashL1), blockResponse.GasUsed, common.BytesToHash(blockResponse.BlockInfoRoot), common.BytesToHash(blockResponse.BlockHash)) +
    +
    + 344 + +
    +   +
    +
    +
    + 345 + +
    +   + for txIndex, tx := range blockResponse.Responses { +
    +
    + 346 + +
    +   + prefix := " " + fmt.Sprintf("tx[%v]: ", txIndex) +
    +
    + 347 + +
    + + + blockResponseLog += transactionResponseToString(tx, prefix) +
    +
    + 348 + +
    +   + } +
    +
    + 349 + +
    +   +
    +
    +
    + 350 + +
    +   + return blockResponseLog +
    +
    + 351 + +
    +   + } +
    +
    + 352 + +
    +   +
    +
    +
    + 353 + +
    + + + func transactionResponseToString(txResponse *executor.ProcessTransactionResponseV2, prefix string) string { +
    +
    + 354 + +
    +   + txResponseLog := prefix + "TxHash: %v, TxHashL2: %v, Type: %v, StateRoot:%v, GasUsed: %v, GasLeft: %v, GasRefund: %v, Error: %v\n" +
    +
    + 355 + +
    +   + txResponseLog = fmt.Sprintf(txResponseLog, common.BytesToHash(txResponse.TxHash), common.BytesToHash(txResponse.TxHashL2), txResponse.Type, +
    +
    + 356 + +
    +   + common.BytesToHash(txResponse.StateRoot), txResponse.GasUsed, txResponse.GasLeft, txResponse.GasRefunded, txResponse.Error) +
    +
    +
     
    +
    + 420 + +
    +   + ClosingReason: processingCtx.ClosingReason, +
    +
    + 421 + +
    +   + }, dbTx) +
    +
    + 422 + +
    +   + } +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/batchV2_test.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -44,7 +44,7 @@
    +
    + 44 + +
    +   + ctx := context.Background() +
    +
    + 45 + +
    +   + mockStorage := mocks.NewStorageMock(t) +
    +
    + 46 + +
    +   + mockExecutor := mocks.NewExecutorServiceClientMock(t) +
    +
    + 47 + +
    + - + testState := state.NewState(stateCfg, mockStorage, mockExecutor, nil, nil, nil, nil) +
    +
    + 48 + +
    +   + mockStorage.EXPECT().Begin(ctx).Return(mocks.NewDbTxMock(t), nil) +
    +
    + 49 + +
    +   + dbTx, err := testState.BeginStateTransaction(ctx) +
    +
    + 50 + +
    +   + require.NoError(t, err) +
    +
    +
    @@ -122,7 +122,7 @@
    +
    + 122 + +
    +   + ctx := context.Background() +
    +
    + 123 + +
    +   + mockStorage := mocks.NewStorageMock(t) +
    +
    + 124 + +
    +   + mockExecutor := mocks.NewExecutorServiceClientMock(t) +
    +
    + 125 + +
    + - + testState := state.NewState(stateCfg, mockStorage, mockExecutor, nil, nil, nil, nil) +
    +
    + 126 + +
    +   + mockStorage.EXPECT().Begin(ctx).Return(mocks.NewDbTxMock(t), nil) +
    +
    + 127 + +
    +   + dbTx, err := testState.BeginStateTransaction(ctx) +
    +
    + 128 + +
    +   + require.NoError(t, err) +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 44 + +
    +   + ctx := context.Background() +
    +
    + 45 + +
    +   + mockStorage := mocks.NewStorageMock(t) +
    +
    + 46 + +
    +   + mockExecutor := mocks.NewExecutorServiceClientMock(t) +
    +
    + 47 + +
    + + + testState := state.NewState(stateCfg, mockStorage, mockExecutor, nil, nil, nil) +
    +
    + 48 + +
    +   + mockStorage.EXPECT().Begin(ctx).Return(mocks.NewDbTxMock(t), nil) +
    +
    + 49 + +
    +   + dbTx, err := testState.BeginStateTransaction(ctx) +
    +
    + 50 + +
    +   + require.NoError(t, err) +
    +
    +
     
    +
    + 122 + +
    +   + ctx := context.Background() +
    +
    + 123 + +
    +   + mockStorage := mocks.NewStorageMock(t) +
    +
    + 124 + +
    +   + mockExecutor := mocks.NewExecutorServiceClientMock(t) +
    +
    + 125 + +
    + + + testState := state.NewState(stateCfg, mockStorage, mockExecutor, nil, nil, nil) +
    +
    + 126 + +
    +   + mockStorage.EXPECT().Begin(ctx).Return(mocks.NewDbTxMock(t), nil) +
    +
    + 127 + +
    +   + dbTx, err := testState.BeginStateTransaction(ctx) +
    +
    + 128 + +
    +   + require.NoError(t, err) +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/batchV3.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,137 +0,0 @@
    +
    + 1 + +
    + - + package state +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + import ( +
    +
    + 4 + +
    + - + "context" +
    +
    + 5 + +
    + - + "fmt" +
    +
    + 6 + +
    + - + "time" +
    +
    + 7 + +
    + - +
    +
    +
    + 8 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/hex" +
    +
    + 9 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/log" +
    +
    + 10 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/state/metrics" +
    +
    + 11 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/state/runtime/executor" +
    +
    + 12 + +
    + - + "github.com/google/uuid" +
    +
    + 13 + +
    + - + ) +
    +
    + 14 + +
    + - +
    +
    +
    + 15 + +
    + - + // ProcessBatchV3 processes a batch for forkID >= FEIJOA +
    +
    + 16 + +
    + - + func (s *State) ProcessBatchV3(ctx context.Context, request ProcessRequest, updateMerkleTree bool) (*ProcessBatchResponse, error) { +
    +
    + 17 + +
    + - + updateMT := uint32(cFalse) +
    +
    + 18 + +
    + - + if updateMerkleTree { +
    +
    + 19 + +
    + - + updateMT = cTrue +
    +
    + 20 + +
    + - + } +
    +
    + 21 + +
    + - +
    +
    +
    + 22 + +
    + - + l1InfoTreeData := make(map[uint32]*executor.L1DataV3) +
    +
    + 23 + +
    + - +
    +
    +
    + 24 + +
    + - + for k, v := range request.L1InfoTreeData_V3 { +
    +
    + 25 + +
    + - + l1InfoTreeData[k] = &executor.L1DataV3{ +
    +
    + 26 + +
    + - + GlobalExitRoot: v.GlobalExitRoot.Bytes(), +
    +
    + 27 + +
    + - + BlockHashL1: v.BlockHashL1.Bytes(), +
    +
    + 28 + +
    + - + MinTimestamp: v.MinTimestamp, +
    +
    + 29 + +
    + - + SmtProofPreviousIndex: v.SmtProofPreviousIndex, +
    +
    + 30 + +
    + - + InitialHistoricRoot: v.InitialHistoricRoot.Bytes(), +
    +
    + 31 + +
    + - + } +
    +
    + 32 + +
    + - + } +
    +
    + 33 + +
    + - +
    +
    +
    + 34 + +
    + - + // Create Batch +
    +
    + 35 + +
    + - + var processBatchRequest = &executor.ProcessBatchRequestV3{ +
    +
    + 36 + +
    + - + OldStateRoot: request.OldStateRoot.Bytes(), +
    +
    + 37 + +
    + - + OldAccInputHash: request.OldAccInputHash.Bytes(), +
    +
    + 38 + +
    + - + PreviousL1InfoTreeRoot: request.PreviousL1InfoTreeRoot_V3.Bytes(), +
    +
    + 39 + +
    + - + PreviousL1InfoTreeIndex: request.PreviousL1InfoTreeIndex_V3, +
    +
    + 40 + +
    + - + ChainId: s.cfg.ChainID, +
    +
    + 41 + +
    + - + ForkId: request.ForkID, +
    +
    + 42 + +
    + - + BatchL2Data: request.Transactions, +
    +
    + 43 + +
    + - + Coinbase: request.Coinbase.String(), +
    +
    + 44 + +
    + - + UpdateMerkleTree: updateMT, +
    +
    + 45 + +
    + - + L1InfoTreeData: l1InfoTreeData, +
    +
    + 46 + +
    + - + ContextId: uuid.NewString(), +
    +
    + 47 + +
    + - + } +
    +
    + 48 + +
    + - +
    +
    +
    + 49 + +
    + - + if request.SkipFirstChangeL2Block_V2 { +
    +
    + 50 + +
    + - + processBatchRequest.SkipFirstChangeL2Block = cTrue +
    +
    + 51 + +
    + - + } +
    +
    + 52 + +
    + - +
    +
    +
    + 53 + +
    + - + if request.SkipWriteBlockInfoRoot_V2 { +
    +
    + 54 + +
    + - + processBatchRequest.SkipWriteBlockInfoRoot = cTrue +
    +
    + 55 + +
    + - + } +
    +
    + 56 + +
    + - +
    +
    +
    + 57 + +
    + - + res, err := s.sendBatchRequestToExecutorV3(ctx, processBatchRequest, request.Caller) +
    +
    + 58 + +
    + - + if err != nil { +
    +
    + 59 + +
    + - + return nil, err +
    +
    + 60 + +
    + - + } +
    +
    + 61 + +
    + - +
    +
    +
    + 62 + +
    + - + var result *ProcessBatchResponse +
    +
    + 63 + +
    + - + result, err = s.convertToProcessBatchResponseV3(res) +
    +
    + 64 + +
    + - + if err != nil { +
    +
    + 65 + +
    + - + return nil, err +
    +
    + 66 + +
    + - + } +
    +
    + 67 + +
    + - +
    +
    +
    + 68 + +
    + - + return result, nil +
    +
    + 69 + +
    + - + } +
    +
    + 70 + +
    + - +
    +
    +
    + 71 + +
    + - + func (s *State) sendBatchRequestToExecutorV3(ctx context.Context, batchRequest *executor.ProcessBatchRequestV3, caller metrics.CallerLabel) (*executor.ProcessBatchResponseV3, error) { +
    +
    + 72 + +
    + - + if s.executorClient == nil { +
    +
    + 73 + +
    + - + return nil, ErrExecutorNil +
    +
    + 74 + +
    + - + } +
    +
    + 75 + +
    + - +
    +
    +
    + 76 + +
    + - + l1DataStr := "" +
    +
    + 77 + +
    + - + for i, l1Data := range batchRequest.L1InfoTreeData { +
    +
    + 78 + +
    + - + l1DataStr += fmt.Sprintf("[%d]{GlobalExitRoot: %v, BlockHashL1: %v, MinTimestamp: %v},", i, hex.EncodeToHex(l1Data.GlobalExitRoot), hex.EncodeToHex(l1Data.BlockHashL1), l1Data.MinTimestamp) +
    +
    + 79 + +
    + - + } +
    +
    + 80 + +
    + - + if l1DataStr != "" { +
    +
    + 81 + +
    + - + l1DataStr = l1DataStr[:len(l1DataStr)-1] +
    +
    + 82 + +
    + - + } +
    +
    + 83 + +
    + - +
    +
    +
    + 84 + +
    + - + // Log the batch request +
    +
    + 85 + +
    + - + batchRequestLog := "OldStateRoot: %v, OldAccInputHash: %v, PreviousL1InfoTreeRoot: %v, PreviousL1InfoTreeIndex: %v, ChainId: %v, ForkId: %v, BatchL2Data: %v, Coinbase: %v, UpdateMerkleTree: %v, L1InfoTreeData: %+v, ContextId: %v, SkipFirstChangeL2Block: %v, SkipWriteBlockInfoRoot: %v" +
    +
    + 86 + +
    + - + batchRequestLog = fmt.Sprintf(batchRequestLog, hex.EncodeToHex(batchRequest.OldStateRoot), hex.EncodeToHex(batchRequest.OldAccInputHash), hex.EncodeToHex(batchRequest.PreviousL1InfoTreeRoot), batchRequest.PreviousL1InfoTreeIndex, batchRequest.ChainId, batchRequest.ForkId, len(batchRequest.BatchL2Data), batchRequest.Coinbase, batchRequest.UpdateMerkleTree, l1DataStr, batchRequest.ContextId, batchRequest.SkipFirstChangeL2Block, batchRequest.SkipWriteBlockInfoRoot) +
    +
    + 87 + +
    + - +
    +
    +
    + 88 + +
    + - + log.Debugf("executor batch request, %s", batchRequestLog) +
    +
    + 89 + +
    + - +
    +
    +
    + 90 + +
    + - + now := time.Now() +
    +
    + 91 + +
    + - + batchResponse, err := s.executorClient.ProcessBatchV3(ctx, batchRequest) +
    +
    + 92 + +
    + - + elapsed := time.Since(now) +
    +
    + 93 + +
    + - +
    +
    +
    + 94 + +
    + - + // workarroundDuplicatedBlock(res) +
    +
    + 95 + +
    + - + if caller != metrics.DiscardCallerLabel { +
    +
    + 96 + +
    + - + metrics.ExecutorProcessingTime(string(caller), elapsed) +
    +
    + 97 + +
    + - + } +
    +
    + 98 + +
    + - +
    +
    +
    + 99 + +
    + - + if err != nil { +
    +
    + 100 + +
    + - + log.Errorf("error executor ProcessBatchV3: %v", err) +
    +
    + 101 + +
    + - + log.Errorf("error executor ProcessBatchV3: %s", err.Error()) +
    +
    + 102 + +
    + - + log.Errorf("error executor ProcessBatchV3 response: %v", batchResponse) +
    +
    + 103 + +
    + - + } else { +
    +
    + 104 + +
    + - + batchResponseToString := processBatchResponseV3ToString(batchResponse, elapsed) +
    +
    + 105 + +
    + - + if batchResponse.Error != executor.ExecutorError_EXECUTOR_ERROR_NO_ERROR { +
    +
    + 106 + +
    + - + err = executor.ExecutorErr(batchResponse.Error) +
    +
    + 107 + +
    + - + log.Warnf("executor batch response, executor error: %v", err) +
    +
    + 108 + +
    + - + log.Warn(batchResponseToString) +
    +
    + 109 + +
    + - + s.eventLog.LogExecutorError(ctx, batchResponse.Error, batchRequest) +
    +
    + 110 + +
    + - + } else if batchResponse.ErrorRom != executor.RomError_ROM_ERROR_NO_ERROR && executor.IsROMOutOfCountersError(batchResponse.ErrorRom) { +
    +
    + 111 + +
    + - + err = executor.RomErr(batchResponse.ErrorRom) +
    +
    + 112 + +
    + - + log.Warnf("executor batch response, ROM OOC, error: %v", err) +
    +
    + 113 + +
    + - + log.Warn(batchResponseToString) +
    +
    + 114 + +
    + - + } else if batchResponse.ErrorRom != executor.RomError_ROM_ERROR_NO_ERROR { +
    +
    + 115 + +
    + - + err = executor.RomErr(batchResponse.ErrorRom) +
    +
    + 116 + +
    + - + log.Warnf("executor batch response, ROM error: %v", err) +
    +
    + 117 + +
    + - + log.Warn(batchResponseToString) +
    +
    + 118 + +
    + - + } else { +
    +
    + 119 + +
    + - + log.Debug(batchResponseToString) +
    +
    + 120 + +
    + - + } +
    +
    + 121 + +
    + - + } +
    +
    + 122 + +
    + - +
    +
    +
    + 123 + +
    + - + return batchResponse, err +
    +
    + 124 + +
    + - + } +
    +
    + 125 + +
    + - +
    +
    +
    + 126 + +
    + - + func processBatchResponseV3ToString(batchResponse *executor.ProcessBatchResponseV3, executionTime time.Duration) string { +
    +
    + 127 + +
    + - + batchResponseLog := "executor batch response, Time: %v, NewStateRoot: %v, NewAccInputHash: %v, NewLocalExitRoot: %v, GasUsed: %v, FlushId: %v, StoredFlushId: %v, ProverId:%v, ForkId:%v, Error: %v\n" +
    +
    + 128 + +
    + - + batchResponseLog = fmt.Sprintf(batchResponseLog, executionTime, hex.EncodeToHex(batchResponse.NewStateRoot), hex.EncodeToHex(batchResponse.NewAccInputHash), hex.EncodeToHex(batchResponse.NewLocalExitRoot), +
    +
    + 129 + +
    + - + batchResponse.GasUsed, batchResponse.FlushId, batchResponse.StoredFlushId, batchResponse.ProverId, batchResponse.ForkId, batchResponse.Error) +
    +
    + 130 + +
    + - +
    +
    +
    + 131 + +
    + - + for blockIndex, block := range batchResponse.BlockResponses { +
    +
    + 132 + +
    + - + prefix := " " + fmt.Sprintf("block[%v]: ", blockIndex) +
    +
    + 133 + +
    + - + batchResponseLog += blockResponseV2ToString(block, prefix) +
    +
    + 134 + +
    + - + } +
    +
    + 135 + +
    + - +
    +
    +
    + 136 + +
    + - + return batchResponseLog +
    +
    + 137 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/blob_inner_in.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,101 +0,0 @@
    +
    + 1 + +
    + - + package state +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + import ( +
    +
    + 4 + +
    + - + "context" +
    +
    + 5 + +
    + - + "fmt" +
    +
    + 6 + +
    + - + "time" +
    +
    + 7 + +
    + - +
    +
    +
    + 8 + +
    + - + "github.com/ethereum/go-ethereum/common" +
    +
    + 9 + +
    + - + "github.com/ethereum/go-ethereum/crypto/kzg4844" +
    +
    + 10 + +
    + - + "github.com/jackc/pgx/v4" +
    +
    + 11 + +
    + - + ) +
    +
    + 12 + +
    + - +
    +
    +
    + 13 + +
    + - + // BlobType is the type of the blob type +
    +
    + 14 + +
    + - + type BlobType uint8 +
    +
    + 15 + +
    + - +
    +
    +
    + 16 + +
    + - + const ( +
    +
    + 17 + +
    + - + // TypeCallData The data is stored on call data directly +
    +
    + 18 + +
    + - + TypeCallData BlobType = 0 +
    +
    + 19 + +
    + - + // TypeBlobTransaction The data is stored on a blob +
    +
    + 20 + +
    + - + TypeBlobTransaction BlobType = 1 +
    +
    + 21 + +
    + - + // TypeForcedBlob The data is a forced Blob +
    +
    + 22 + +
    + - + TypeForcedBlob BlobType = 2 +
    +
    + 23 + +
    + - + ) +
    +
    + 24 + +
    + - +
    +
    +
    + 25 + +
    + - + func (b BlobType) String() string { +
    +
    + 26 + +
    + - + switch b { +
    +
    + 27 + +
    + - + case TypeCallData: +
    +
    + 28 + +
    + - + return "call_data" +
    +
    + 29 + +
    + - + case TypeBlobTransaction: +
    +
    + 30 + +
    + - + return "blob" +
    +
    + 31 + +
    + - + case TypeForcedBlob: +
    +
    + 32 + +
    + - + return "forced" +
    +
    + 33 + +
    + - + default: +
    +
    + 34 + +
    + - + return "Unknown" +
    +
    + 35 + +
    + - + } +
    +
    + 36 + +
    + - + } +
    +
    + 37 + +
    + - +
    +
    +
    + 38 + +
    + - + // BlobBlobTypeParams is the data for a SequenceBlob stored as a Blob +
    +
    + 39 + +
    + - + type BlobBlobTypeParams struct { +
    +
    + 40 + +
    + - + BlobIndex uint64 +
    +
    + 41 + +
    + - + Z []byte +
    +
    + 42 + +
    + - + Y []byte +
    +
    + 43 + +
    + - + Commitment kzg4844.Commitment +
    +
    + 44 + +
    + - + Proof kzg4844.Proof +
    +
    + 45 + +
    + - + } +
    +
    + 46 + +
    + - +
    +
    +
    + 47 + +
    + - + // BlobInner struct +
    +
    + 48 + +
    + - + type BlobInner struct { +
    +
    + 49 + +
    + - + BlobSequenceIndex uint64 // Index of the blobSequence in DB (is a internal number) +
    +
    + 50 + +
    + - + BlobInnerNum uint64 // Incremental value, starts from 1 +
    +
    + 51 + +
    + - + Type BlobType // Type of the blob +
    +
    + 52 + +
    + - + MaxSequenceTimestamp time.Time // it comes from SequenceBlobs call to contract +
    +
    + 53 + +
    + - + ZkGasLimit uint64 // it comes from SequenceBlobs call to contract +
    +
    + 54 + +
    + - + L1InfoLeafIndex uint32 // it comes from SequenceBlobs call to contract +
    +
    + 55 + +
    + - + L1InfoTreeRoot common.Hash // obtained from the L1InfoTree +
    +
    + 56 + +
    + - + BlobDataHash common.Hash // Hash of the data +
    +
    + 57 + +
    + - + BlobBlobTypeParams *BlobBlobTypeParams // Field only valid if BlobType == BlobTransaction +
    +
    + 58 + +
    + - + //HowManyBatches uint64 // Number of batches in the blob +
    +
    + 59 + +
    + - + //FirstBatchNumber uint64 // First batch number of the blob +
    +
    + 60 + +
    + - + //LastBatchNumber uint64 // Last batch number of the blob +
    +
    + 61 + +
    + - + // We don't need blockNumber because is in BlobSequence +
    +
    + 62 + +
    + - + //BlockNumber uint64 +
    +
    + 63 + +
    + - + //PreviousL1InfoTreeIndex uint32 // ?? we need that? +
    +
    + 64 + +
    + - + //PreviousL1InfoTreeRoot common.Hash // ?? we need that? +
    +
    + 65 + +
    + - + } +
    +
    + 66 + +
    + - +
    +
    +
    + 67 + +
    + - + func (b *BlobInner) String() string { +
    +
    + 68 + +
    + - + res := fmt.Sprintf("BlobInner{BlobSequenceIndex:%d, BlobInnerNum:%d, Type:%s, MaxSequenceTimestamp:%s, ZkGasLimit:%d, L1InfoLeafIndex:%d, L1InfoTreeRoot:%s, BlobDataHash:%s", +
    +
    + 69 + +
    + - + b.BlobSequenceIndex, b.BlobInnerNum, b.Type.String(), b.MaxSequenceTimestamp.String(), b.ZkGasLimit, b.L1InfoLeafIndex, b.L1InfoTreeRoot.String(), b.BlobDataHash.String()) +
    +
    + 70 + +
    + - + if b.BlobBlobTypeParams != nil { +
    +
    + 71 + +
    + - + res += ", BlobBlobTypeParams: " + b.BlobBlobTypeParams.String() +
    +
    + 72 + +
    + - + } +
    +
    + 73 + +
    + - + res += "}" +
    +
    + 74 + +
    + - + return res +
    +
    + 75 + +
    + - + } +
    +
    + 76 + +
    + - +
    +
    +
    + 77 + +
    + - + func (b *BlobBlobTypeParams) String() string { +
    +
    + 78 + +
    + - + return "BlobBlobTypeParams{" + +
    +
    + 79 + +
    + - + "BlobIndex: " + fmt.Sprintf("%d", b.BlobIndex) + +
    +
    + 80 + +
    + - + ", Z: " + common.Bytes2Hex(b.Z) + +
    +
    + 81 + +
    + - + ", Y: " + common.Bytes2Hex(b.Y) + +
    +
    + 82 + +
    + - + ", Commitment: " + common.Bytes2Hex(b.Commitment[:]) + +
    +
    + 83 + +
    + - + ", Proof: " + common.Bytes2Hex(b.Proof[:]) + +
    +
    + 84 + +
    + - + "}" +
    +
    + 85 + +
    + - + } +
    +
    + 86 + +
    + - +
    +
    +
    + 87 + +
    + - + // IsEqual compares two BlobInner +
    +
    + 88 + +
    + - + func (b *BlobInner) IsEqual(other *BlobInner) bool { +
    +
    + 89 + +
    + - + if b == nil && other == nil { +
    +
    + 90 + +
    + - + return true +
    +
    + 91 + +
    + - + } +
    +
    + 92 + +
    + - + if b == nil || other == nil { +
    +
    + 93 + +
    + - + return false +
    +
    + 94 + +
    + - + } +
    +
    + 95 + +
    + - + return b.String() == other.String() +
    +
    + 96 + +
    + - + } +
    +
    + 97 + +
    + - +
    +
    +
    + 98 + +
    + - + // AddBlobInner adds a blob inner to the database, currently is just a call to storage +
    +
    + 99 + +
    + - + func (s *State) AddBlobInner(ctx context.Context, blobInner *BlobInner, dbTx pgx.Tx) error { +
    +
    + 100 + +
    + - + return s.storage.AddBlobInner(ctx, blobInner, dbTx) +
    +
    + 101 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/blob_inner_process.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,18 +0,0 @@
    +
    + 1 + +
    + - + package state +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + import ( +
    +
    + 4 + +
    + - + "context" +
    +
    + 5 + +
    + - +
    +
    +
    + 6 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/log" +
    +
    + 7 + +
    + - + ) +
    +
    + 8 + +
    + - +
    +
    +
    + 9 + +
    + - + // ProcessBlobInner processes a blobInner and returns the splitted batches +
    +
    + 10 + +
    + - + func (s *State) ProcessBlobInner(ctx context.Context, request ProcessBlobInnerProcessRequest, data []byte) (*ProcessBlobInnerResponse, error) { +
    +
    + 11 + +
    + - + requestExecutor := convertBlobInnerProcessRequestToExecutor(request, data) +
    +
    + 12 + +
    + - + processResponse, err := s.executorClient.ProcessBlobInnerV3(ctx, requestExecutor) +
    +
    + 13 + +
    + - + if err != nil { +
    +
    + 14 + +
    + - + log.Errorf("Error processing blobInner: %v", err) +
    +
    + 15 + +
    + - + return nil, err +
    +
    + 16 + +
    + - + } +
    +
    + 17 + +
    + - + return newProcessBlobInnerProcessResponse(processResponse), nil +
    +
    + 18 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/blob_inner_request.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,81 +0,0 @@
    +
    + 1 + +
    + - + package state +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + import ( +
    +
    + 4 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/state/runtime/executor" +
    +
    + 5 + +
    + - + "github.com/ethereum/go-ethereum/common" +
    +
    + 6 + +
    + - + ) +
    +
    + 7 + +
    + - +
    +
    +
    + 8 + +
    + - + // ProcessBlobInnerProcessRequest is the request to process a blob +
    +
    + 9 + +
    + - + // you must use the builder to create the request +
    +
    + 10 + +
    + - + type ProcessBlobInnerProcessRequest struct { +
    +
    + 11 + +
    + - + oldBlobStateRoot common.Hash +
    +
    + 12 + +
    + - + oldBlobAccInputHash common.Hash +
    +
    + 13 + +
    + - + oldNumBlob uint64 +
    +
    + 14 + +
    + - + oldStateRoot common.Hash +
    +
    + 15 + +
    + - + forkId uint64 +
    +
    + 16 + +
    + - + lastL1InfoTreeIndex uint32 +
    +
    + 17 + +
    + - + lastL1InfoTreeRoot common.Hash +
    +
    + 18 + +
    + - + timestampLimit uint64 +
    +
    + 19 + +
    + - + coinbase common.Address +
    +
    + 20 + +
    + - + zkGasLimit uint64 +
    +
    + 21 + +
    + - + blobType BlobType +
    +
    + 22 + +
    + - + } +
    +
    + 23 + +
    + - +
    +
    +
    + 24 + +
    + - + // NewProcessBlobInnerProcessRequest creates a new ProcessBlobInnerProcessRequest +
    +
    + 25 + +
    + - + func NewProcessBlobInnerProcessRequest(forkid uint64, blob *BlobInner, +
    +
    + 26 + +
    + - + previousSequence *BlobSequence, +
    +
    + 27 + +
    + - + currentSequence BlobSequence) (*ProcessBlobInnerProcessRequest, error) { +
    +
    + 28 + +
    + - + res := &ProcessBlobInnerProcessRequest{ +
    +
    + 29 + +
    + - + forkId: forkid, +
    +
    + 30 + +
    + - + blobType: blob.Type, +
    +
    + 31 + +
    + - + oldBlobStateRoot: ZeroHash, // Is always zero! +
    +
    + 32 + +
    + - + } +
    +
    + 33 + +
    + - + if previousSequence == nil { +
    +
    + 34 + +
    + - + res.setAsFirstBlob() +
    +
    + 35 + +
    + - + } else { +
    +
    + 36 + +
    + - + res.setPreviousSequence(*previousSequence) +
    +
    + 37 + +
    + - + } +
    +
    + 38 + +
    + - + res.setBlob(blob) +
    +
    + 39 + +
    + - + res.setCurrentSequence(currentSequence) +
    +
    + 40 + +
    + - + return res, nil +
    +
    + 41 + +
    + - + } +
    +
    + 42 + +
    + - +
    +
    +
    + 43 + +
    + - + func (p *ProcessBlobInnerProcessRequest) setAsFirstBlob() { +
    +
    + 44 + +
    + - + p.oldBlobStateRoot = ZeroHash +
    +
    + 45 + +
    + - + p.oldBlobAccInputHash = ZeroHash +
    +
    + 46 + +
    + - + p.oldNumBlob = 0 +
    +
    + 47 + +
    + - + p.oldStateRoot = ZeroHash +
    +
    + 48 + +
    + - + } +
    +
    + 49 + +
    + - +
    +
    +
    + 50 + +
    + - + func (p *ProcessBlobInnerProcessRequest) setCurrentSequence(seq BlobSequence) { +
    +
    + 51 + +
    + - + p.coinbase = seq.L2Coinbase +
    +
    + 52 + +
    + - + } +
    +
    + 53 + +
    + - +
    +
    +
    + 54 + +
    + - + func (p *ProcessBlobInnerProcessRequest) setPreviousSequence(previousSequence BlobSequence) { +
    +
    + 55 + +
    + - + p.oldBlobAccInputHash = previousSequence.FinalAccInputHash +
    +
    + 56 + +
    + - + p.oldNumBlob = previousSequence.LastBlobSequenced +
    +
    + 57 + +
    + - + } +
    +
    + 58 + +
    + - +
    +
    +
    + 59 + +
    + - + func (p *ProcessBlobInnerProcessRequest) setBlob(blob *BlobInner) { +
    +
    + 60 + +
    + - + p.lastL1InfoTreeIndex = blob.L1InfoLeafIndex +
    +
    + 61 + +
    + - + p.lastL1InfoTreeRoot = blob.L1InfoTreeRoot +
    +
    + 62 + +
    + - + p.timestampLimit = uint64(blob.MaxSequenceTimestamp.Unix()) // Convert time.Time to uint64 +
    +
    + 63 + +
    + - + p.zkGasLimit = blob.ZkGasLimit +
    +
    + 64 + +
    + - + } +
    +
    + 65 + +
    + - +
    +
    +
    + 66 + +
    + - + func convertBlobInnerProcessRequestToExecutor(request ProcessBlobInnerProcessRequest, data []byte) *executor.ProcessBlobInnerRequestV3 { +
    +
    + 67 + +
    + - + return &executor.ProcessBlobInnerRequestV3{ +
    +
    + 68 + +
    + - + OldBlobStateRoot: request.oldBlobStateRoot.Bytes(), +
    +
    + 69 + +
    + - + OldBlobAccInputHash: request.oldBlobAccInputHash.Bytes(), +
    +
    + 70 + +
    + - + OldNumBlob: request.oldNumBlob, +
    +
    + 71 + +
    + - + OldStateRoot: request.oldStateRoot.Bytes(), +
    +
    + 72 + +
    + - + ForkId: request.forkId, +
    +
    + 73 + +
    + - + LastL1InfoTreeIndex: request.lastL1InfoTreeIndex, +
    +
    + 74 + +
    + - + LastL1InfoTreeRoot: request.lastL1InfoTreeRoot.Bytes(), +
    +
    + 75 + +
    + - + TimestampLimit: request.timestampLimit, +
    +
    + 76 + +
    + - + Coinbase: request.coinbase.String(), +
    +
    + 77 + +
    + - + ZkGasLimit: request.zkGasLimit, +
    +
    + 78 + +
    + - + BlobType: uint32(request.blobType), +
    +
    + 79 + +
    + - + BlobData: data, +
    +
    + 80 + +
    + - + } +
    +
    + 81 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/blob_inner_response.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,114 +0,0 @@
    +
    + 1 + +
    + - + package state +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + import ( +
    +
    + 4 + +
    + - + "fmt" +
    +
    + 5 + +
    + - +
    +
    +
    + 6 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/log" +
    +
    + 7 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/state/runtime/executor" +
    +
    + 8 + +
    + - + "github.com/ethereum/go-ethereum/common" +
    +
    + 9 + +
    + - + "github.com/ethereum/go-ethereum/crypto" +
    +
    + 10 + +
    + - + ) +
    +
    + 11 + +
    + - +
    +
    +
    + 12 + +
    + - + // ProcessBlobInnerResponse is the response of the process of a blob +
    +
    + 13 + +
    + - + // the fields are private, so you need the function to access the data +
    +
    + 14 + +
    + - + // To get the outcome of the execution you must use GetSuccesfulData() it will return a nil if the execution was not successful +
    +
    + 15 + +
    + - + // This is for forcing by interface don't access to results fields is it have an error +
    +
    + 16 + +
    + - + type ProcessBlobInnerResponse struct { +
    +
    + 17 + +
    + - + succesfulData ProcessBlobInnerResponseSuccesful // Here is the outcome of the execution +
    +
    + 18 + +
    + - + isInvalid bool // Is a variable of the ROM +
    +
    + 19 + +
    + - + generalError error +
    +
    + 20 + +
    + - + romBlobError error +
    +
    + 21 + +
    + - + executorVersion string // Version of the executor e.g. "v7.0.0" +
    +
    + 22 + +
    + - + errorDebugLog string // This is debug.ErrorLog that is a debug string with context data of error +
    +
    + 23 + +
    + - + } +
    +
    + 24 + +
    + - +
    +
    +
    + 25 + +
    + - + // ProcessBlobInnerResponseSuccesful is the data after a successful call to ProcessBlobInner +
    +
    + 26 + +
    + - + type ProcessBlobInnerResponseSuccesful struct { +
    +
    + 27 + +
    + - + newBlobStateRoot common.Hash +
    +
    + 28 + +
    + - + newBlobAccInputHash common.Hash +
    +
    + 29 + +
    + - + newNumBlob uint64 +
    +
    + 30 + +
    + - + finalAccBatchHashData common.Hash +
    +
    + 31 + +
    + - + batchData [][]byte +
    +
    + 32 + +
    + - + } +
    +
    + 33 + +
    + - +
    +
    +
    + 34 + +
    + - + func (p *ProcessBlobInnerResponseSuccesful) String() string { +
    +
    + 35 + +
    + - + res := fmt.Sprintf("newBlobStateRoot: %s newBlobAccInputHash:%s newNumBlob:%d\n", p.newBlobStateRoot.String(), p.newBlobAccInputHash.String(), p.newNumBlob) +
    +
    + 36 + +
    + - + res += fmt.Sprintf("finalAccBatchHashData: %s\n", p.finalAccBatchHashData.String()) +
    +
    + 37 + +
    + - + res += fmt.Sprintf("HowManyBatches: %d\n", p.HowManyBatches()) +
    +
    + 38 + +
    + - + for i := 0; i < p.HowManyBatches(); i++ { +
    +
    + 39 + +
    + - + res += fmt.Sprintf(" Batch %d: Hash:%s\n", i, p.GetBatchHash(i).String()) +
    +
    + 40 + +
    + - + } +
    +
    + 41 + +
    + - + return res +
    +
    + 42 + +
    + - + } +
    +
    + 43 + +
    + - +
    +
    +
    + 44 + +
    + - + func (p *ProcessBlobInnerResponse) String() string { +
    +
    + 45 + +
    + - + res := fmt.Sprintf("isInvalid: %t\n", p.isInvalid) +
    +
    + 46 + +
    + - + if p.generalError != nil { +
    +
    + 47 + +
    + - + res += fmt.Sprintf("generalError: %s\n", p.generalError.Error()) +
    +
    + 48 + +
    + - + } +
    +
    + 49 + +
    + - + if p.romBlobError != nil { +
    +
    + 50 + +
    + - + res += fmt.Sprintf("romBlobError: %s\n", p.romBlobError.Error()) +
    +
    + 51 + +
    + - + } +
    +
    + 52 + +
    + - + if p.IsSuccessfulExecution() { +
    +
    + 53 + +
    + - + res += p.succesfulData.String() +
    +
    + 54 + +
    + - + } +
    +
    + 55 + +
    + - + return res +
    +
    + 56 + +
    + - + } +
    +
    + 57 + +
    + - +
    +
    +
    + 58 + +
    + - + // GetUnifiedError returns the combinations of errors of the execution +
    +
    + 59 + +
    + - + func (p *ProcessBlobInnerResponse) GetUnifiedError() error { +
    +
    + 60 + +
    + - + if p.IsSuccessfulExecution() { +
    +
    + 61 + +
    + - + return nil +
    +
    + 62 + +
    + - + } +
    +
    + 63 + +
    + - + return fmt.Errorf("ProcessBlobInnerV3 fails:version:%s isInvalid: %t general:%w romBlob:%w errorLog:%s", +
    +
    + 64 + +
    + - + p.executorVersion, p.isInvalid, p.generalError, p.romBlobError, p.errorDebugLog) +
    +
    + 65 + +
    + - + } +
    +
    + 66 + +
    + - +
    +
    +
    + 67 + +
    + - + // IsSuccessfulExecution returns true if the execution was successful +
    +
    + 68 + +
    + - + func (p *ProcessBlobInnerResponse) IsSuccessfulExecution() bool { +
    +
    + 69 + +
    + - + return !p.isInvalid && p.generalError == nil && p.romBlobError == nil +
    +
    + 70 + +
    + - + } +
    +
    + 71 + +
    + - +
    +
    +
    + 72 + +
    + - + // GetSuccesfulData returns the outcome data of the execution +
    +
    + 73 + +
    + - + func (p *ProcessBlobInnerResponse) GetSuccesfulData() *ProcessBlobInnerResponseSuccesful { +
    +
    + 74 + +
    + - + if !p.IsSuccessfulExecution() { +
    +
    + 75 + +
    + - + log.Error("Trying to get successful data from a failed execution") +
    +
    + 76 + +
    + - + return nil +
    +
    + 77 + +
    + - + } +
    +
    + 78 + +
    + - + return &p.succesfulData +
    +
    + 79 + +
    + - + } +
    +
    + 80 + +
    + - +
    +
    +
    + 81 + +
    + - + // HowManyBatches returns the number of batches +
    +
    + 82 + +
    + - + func (p *ProcessBlobInnerResponseSuccesful) HowManyBatches() int { +
    +
    + 83 + +
    + - + return len(p.batchData) +
    +
    + 84 + +
    + - + } +
    +
    + 85 + +
    + - +
    +
    +
    + 86 + +
    + - + // GetBatchData returns the data of the batch +
    +
    + 87 + +
    + - + func (p *ProcessBlobInnerResponseSuccesful) GetBatchData(index int) []byte { +
    +
    + 88 + +
    + - + return p.batchData[index] +
    +
    + 89 + +
    + - + } +
    +
    + 90 + +
    + - +
    +
    +
    + 91 + +
    + - + // GetBatchHash returns the hash of the batch data +
    +
    + 92 + +
    + - + func (p *ProcessBlobInnerResponseSuccesful) GetBatchHash(index int) common.Hash { +
    +
    + 93 + +
    + - + return crypto.Keccak256Hash(p.GetBatchData(index)) +
    +
    + 94 + +
    + - + } +
    +
    + 95 + +
    + - +
    +
    +
    + 96 + +
    + - + func newProcessBlobInnerProcessResponse(response *executor.ProcessBlobInnerResponseV3) *ProcessBlobInnerResponse { +
    +
    + 97 + +
    + - + res := &ProcessBlobInnerResponse{ +
    +
    + 98 + +
    + - + succesfulData: ProcessBlobInnerResponseSuccesful{ +
    +
    + 99 + +
    + - + newBlobStateRoot: common.BytesToHash(response.NewBlobStateRoot), +
    +
    + 100 + +
    + - + newBlobAccInputHash: common.BytesToHash(response.NewBlobAccInputHash), +
    +
    + 101 + +
    + - + newNumBlob: response.NewNumBlob, +
    +
    + 102 + +
    + - + finalAccBatchHashData: common.BytesToHash(response.FinalAccBatchHashData), +
    +
    + 103 + +
    + - + batchData: response.BatchData, +
    +
    + 104 + +
    + - + }, +
    +
    + 105 + +
    + - + isInvalid: response.IsInvalid == cTrue, +
    +
    + 106 + +
    + - + generalError: executor.ExecutorErr(response.Error), +
    +
    + 107 + +
    + - + romBlobError: executor.RomBlobErr(response.ErrorRomBlob), +
    +
    + 108 + +
    + - + } +
    +
    + 109 + +
    + - + if response.Debug != nil { +
    +
    + 110 + +
    + - + res.executorVersion = response.Debug.Version +
    +
    + 111 + +
    + - + res.errorDebugLog = response.Debug.ErrorLog +
    +
    + 112 + +
    + - + } +
    +
    + 113 + +
    + - + return res +
    +
    + 114 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/blob_sequences.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,69 +0,0 @@
    +
    + 1 + +
    + - + package state +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + import ( +
    +
    + 4 + +
    + - + "context" +
    +
    + 5 + +
    + - + "errors" +
    +
    + 6 + +
    + - + "fmt" +
    +
    + 7 + +
    + - + "time" +
    +
    + 8 + +
    + - +
    +
    +
    + 9 + +
    + - + "github.com/ethereum/go-ethereum/common" +
    +
    + 10 + +
    + - + "github.com/jackc/pgx/v4" +
    +
    + 11 + +
    + - + ) +
    +
    + 12 + +
    + - +
    +
    +
    + 13 + +
    + - + var ( +
    +
    + 14 + +
    + - + // ErrBlobSequenceIndex is returned when the blob sequence index is not correct +
    +
    + 15 + +
    + - + ErrBlobSequenceIndex = errors.New("blob sequence index is not correct") +
    +
    + 16 + +
    + - + // ErrBlobSequenceTime is returned when the blob sequence time is not correct +
    +
    + 17 + +
    + - + ErrBlobSequenceTime = errors.New("blob sequence time is not correct") +
    +
    + 18 + +
    + - + ) +
    +
    + 19 + +
    + - +
    +
    +
    + 20 + +
    + - + // BlobSequence represents a blob sequence. +
    +
    + 21 + +
    + - + type BlobSequence struct { +
    +
    + 22 + +
    + - + BlobSequenceIndex uint64 +
    +
    + 23 + +
    + - + L2Coinbase common.Address +
    +
    + 24 + +
    + - + FinalAccInputHash common.Hash +
    +
    + 25 + +
    + - + FirstBlobSequenced uint64 // Is calculated from previous blob sequence +
    +
    + 26 + +
    + - + LastBlobSequenced uint64 // That comes from the event +
    +
    + 27 + +
    + - + CreateAt time.Time // time of the L1block +
    +
    + 28 + +
    + - + ReceivedAt time.Time // time when the blob sequence is received (typically Now()) +
    +
    + 29 + +
    + - + BlockNumber uint64 // L1BlockNumber where appears this event +
    +
    + 30 + +
    + - + } +
    +
    + 31 + +
    + - +
    +
    +
    + 32 + +
    + - + // AddBlobSequence adds a new blob sequence to the state. +
    +
    + 33 + +
    + - + // it override pgstorage.AddBlobSequence to add sanity checks +
    +
    + 34 + +
    + - + func (s *State) AddBlobSequence(ctx context.Context, blobSequence *BlobSequence, dbTx pgx.Tx) error { +
    +
    + 35 + +
    + - + err := s.sanityCheckAddBlobSequence(ctx, blobSequence, dbTx) +
    +
    + 36 + +
    + - + if err != nil { +
    +
    + 37 + +
    + - + return err +
    +
    + 38 + +
    + - + } +
    +
    + 39 + +
    + - + return s.storage.AddBlobSequence(ctx, blobSequence, dbTx) +
    +
    + 40 + +
    + - + } +
    +
    + 41 + +
    + - +
    +
    +
    + 42 + +
    + - + func (s *State) sanityCheckAddBlobSequence(ctx context.Context, blobSequence *BlobSequence, dbTx pgx.Tx) error { +
    +
    + 43 + +
    + - + previousBlobSequence, err := s.GetLastBlobSequence(ctx, dbTx) +
    +
    + 44 + +
    + - + if err != nil { +
    +
    + 45 + +
    + - + return err +
    +
    + 46 + +
    + - + } +
    +
    + 47 + +
    + - + if previousBlobSequence == nil { +
    +
    + 48 + +
    + - + // Is the first one +
    +
    + 49 + +
    + - + if blobSequence.BlobSequenceIndex != 1 { +
    +
    + 50 + +
    + - + return fmt.Errorf("TThe firstBlobSequence index must be 1, not %d. Err: %w", blobSequence.BlobSequenceIndex, ErrBlobSequenceIndex) +
    +
    + 51 + +
    + - + } +
    +
    + 52 + +
    + - + return nil +
    +
    + 53 + +
    + - + } +
    +
    + 54 + +
    + - + // The index must be the previous index + 1 +
    +
    + 55 + +
    + - + if previousBlobSequence.BlobSequenceIndex+1 != blobSequence.BlobSequenceIndex { +
    +
    + 56 + +
    + - + return fmt.Errorf("last_index_on_db:%d try_to_insert:%d. Err: %w", +
    +
    + 57 + +
    + - + previousBlobSequence.BlobSequenceIndex, +
    +
    + 58 + +
    + - + blobSequence.BlobSequenceIndex, +
    +
    + 59 + +
    + - + ErrBlobSequenceIndex) +
    +
    + 60 + +
    + - + } +
    +
    + 61 + +
    + - + // The new blob must be newer than the previous one +
    +
    + 62 + +
    + - + if previousBlobSequence.CreateAt.After(blobSequence.CreateAt) { +
    +
    + 63 + +
    + - + return fmt.Errorf("last_create_at_on_db:%d try_to_insert:%d. Err: %w", +
    +
    + 64 + +
    + - + previousBlobSequence.CreateAt.Unix(), +
    +
    + 65 + +
    + - + blobSequence.CreateAt.Unix(), +
    +
    + 66 + +
    + - + ErrBlobSequenceTime) +
    +
    + 67 + +
    + - + } +
    +
    + 68 + +
    + - + return nil +
    +
    + 69 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/convertersV2.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -66,7 +66,6 @@
    +
    + 66 + +
    +   + ForkID: batchResponse.ForkId, +
    +
    + 67 + +
    +   + InvalidBatch_V2: batchResponse.InvalidBatch != 0, +
    +
    + 68 + +
    +   + RomError_V2: executor.RomErr(batchResponse.ErrorRom), +
    +
    + 69 + +
    + - + OldStateRoot_V2: common.BytesToHash(batchResponse.OldStateRoot), +
    +
    + 70 + +
    +   + }, nil +
    +
    + 71 + +
    +   + } +
    +
    + 72 + +
    +   +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + 66 + +
    +   + ForkID: batchResponse.ForkId, +
    +
    + 67 + +
    +   + InvalidBatch_V2: batchResponse.InvalidBatch != 0, +
    +
    + 68 + +
    +   + RomError_V2: executor.RomErr(batchResponse.ErrorRom), +
    +
    + + +
    +   +
    +
    +
    + 69 + +
    +   + }, nil +
    +
    + 70 + +
    +   + } +
    +
    + 71 + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/convertersV3.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,79 +0,0 @@
    +
    + 1 + +
    + - + package state +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + import ( +
    +
    + 4 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/state/runtime/executor" +
    +
    + 5 + +
    + - + "github.com/ethereum/go-ethereum/common" +
    +
    + 6 + +
    + - + ) +
    +
    + 7 + +
    + - +
    +
    +
    + 8 + +
    + - + // TestConvertToProcessBatchResponseV3 for test purposes +
    +
    + 9 + +
    + - + func (s *State) TestConvertToProcessBatchResponseV3(batchResponse *executor.ProcessBatchResponseV3) (*ProcessBatchResponse, error) { +
    +
    + 10 + +
    + - + return s.convertToProcessBatchResponseV3(batchResponse) +
    +
    + 11 + +
    + - + } +
    +
    + 12 + +
    + - +
    +
    +
    + 13 + +
    + - + func (s *State) convertToProcessBatchResponseV3(batchResponse *executor.ProcessBatchResponseV3) (*ProcessBatchResponse, error) { +
    +
    + 14 + +
    + - + blockResponses, isRomLevelError, isRomOOCError, err := s.convertToProcessBlockResponseV2(batchResponse.BlockResponses) +
    +
    + 15 + +
    + - + if err != nil { +
    +
    + 16 + +
    + - + return nil, err +
    +
    + 17 + +
    + - + } +
    +
    + 18 + +
    + - + isRomOOCError = isRomOOCError || executor.IsROMOutOfCountersError(batchResponse.ErrorRom) +
    +
    + 19 + +
    + - + readWriteAddresses, err := convertToReadWriteAddressesV2(batchResponse.ReadWriteAddresses) +
    +
    + 20 + +
    + - + if err != nil { +
    +
    + 21 + +
    + - + return nil, err +
    +
    + 22 + +
    + - + } +
    +
    + 23 + +
    + - +
    +
    +
    + 24 + +
    + - + return &ProcessBatchResponse{ +
    +
    + 25 + +
    + - + NewStateRoot: common.BytesToHash(batchResponse.NewStateRoot), +
    +
    + 26 + +
    + - + NewAccInputHash: common.BytesToHash(batchResponse.NewAccInputHash), +
    +
    + 27 + +
    + - + NewLocalExitRoot: common.BytesToHash(batchResponse.NewLocalExitRoot), +
    +
    + 28 + +
    + - + UsedZkCounters: convertToUsedZKCountersV3(batchResponse), +
    +
    + 29 + +
    + - + ReservedZkCounters: convertToReservedZKCountersV3(batchResponse), +
    +
    + 30 + +
    + - + BlockResponses: blockResponses, +
    +
    + 31 + +
    + - + ExecutorError: executor.ExecutorErr(batchResponse.Error), +
    +
    + 32 + +
    + - + ReadWriteAddresses: readWriteAddresses, +
    +
    + 33 + +
    + - + FlushID: batchResponse.FlushId, +
    +
    + 34 + +
    + - + StoredFlushID: batchResponse.StoredFlushId, +
    +
    + 35 + +
    + - + ProverID: batchResponse.ProverId, +
    +
    + 36 + +
    + - + IsExecutorLevelError: batchResponse.Error != executor.ExecutorError_EXECUTOR_ERROR_NO_ERROR, +
    +
    + 37 + +
    + - + IsRomLevelError: isRomLevelError, +
    +
    + 38 + +
    + - + IsRomOOCError: isRomOOCError, +
    +
    + 39 + +
    + - + GasUsed_V2: batchResponse.GasUsed, +
    +
    + 40 + +
    + - + SMTKeys_V2: convertToKeys(batchResponse.SmtKeys), +
    +
    + 41 + +
    + - + ProgramKeys_V2: convertToKeys(batchResponse.ProgramKeys), +
    +
    + 42 + +
    + - + ForkID: batchResponse.ForkId, +
    +
    + 43 + +
    + - + InvalidBatch_V2: batchResponse.InvalidBatch != 0, +
    +
    + 44 + +
    + - + RomError_V2: executor.RomErr(batchResponse.ErrorRom), +
    +
    + 45 + +
    + - + OldStateRoot_V2: common.BytesToHash(batchResponse.OldStateRoot), +
    +
    + 46 + +
    + - + NewLastTimestamp_V3: batchResponse.NewLastTimestamp, +
    +
    + 47 + +
    + - + CurrentL1InfoTreeRoot_V3: common.BytesToHash(batchResponse.CurrentL1InfoTreeRoot), +
    +
    + 48 + +
    + - + CurrentL1InfoTreeIndex_V3: batchResponse.CurrentL1InfoTreeIndex, +
    +
    + 49 + +
    + - + }, nil +
    +
    + 50 + +
    + - + } +
    +
    + 51 + +
    + - +
    +
    +
    + 52 + +
    + - + func convertToUsedZKCountersV3(resp *executor.ProcessBatchResponseV3) ZKCounters { +
    +
    + 53 + +
    + - + return ZKCounters{ +
    +
    + 54 + +
    + - + GasUsed: resp.GasUsed, +
    +
    + 55 + +
    + - + KeccakHashes: resp.CntKeccakHashes, +
    +
    + 56 + +
    + - + PoseidonHashes: resp.CntPoseidonHashes, +
    +
    + 57 + +
    + - + PoseidonPaddings: resp.CntPoseidonPaddings, +
    +
    + 58 + +
    + - + MemAligns: resp.CntMemAligns, +
    +
    + 59 + +
    + - + Arithmetics: resp.CntArithmetics, +
    +
    + 60 + +
    + - + Binaries: resp.CntBinaries, +
    +
    + 61 + +
    + - + Steps: resp.CntSteps, +
    +
    + 62 + +
    + - + Sha256Hashes_V2: resp.CntSha256Hashes, +
    +
    + 63 + +
    + - + } +
    +
    + 64 + +
    + - + } +
    +
    + 65 + +
    + - +
    +
    +
    + 66 + +
    + - + func convertToReservedZKCountersV3(resp *executor.ProcessBatchResponseV3) ZKCounters { +
    +
    + 67 + +
    + - + return ZKCounters{ +
    +
    + 68 + +
    + - + // There is no "ReserveGasUsed" in the response, so we use "GasUsed" as it will make calculations easier +
    +
    + 69 + +
    + - + GasUsed: resp.GasUsed, +
    +
    + 70 + +
    + - + KeccakHashes: resp.CntReserveKeccakHashes, +
    +
    + 71 + +
    + - + PoseidonHashes: resp.CntReservePoseidonHashes, +
    +
    + 72 + +
    + - + PoseidonPaddings: resp.CntReservePoseidonPaddings, +
    +
    + 73 + +
    + - + MemAligns: resp.CntReserveMemAligns, +
    +
    + 74 + +
    + - + Arithmetics: resp.CntReserveArithmetics, +
    +
    + 75 + +
    + - + Binaries: resp.CntReserveBinaries, +
    +
    + 76 + +
    + - + Steps: resp.CntReserveSteps, +
    +
    + 77 + +
    + - + Sha256Hashes_V2: resp.CntReserveSha256Hashes, +
    +
    + 78 + +
    + - + } +
    +
    + 79 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    @@ -39002,6 +230317,21 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/datastream.go + RENAMED + +
    +
    @@ -39009,221 +230339,275 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - + + + + + + - - - - - - - + - + + - - - - - - + + + - - - - + + +
    -
     
    +
    @@ -80,6 +80,7 @@
    - 1 + + 80 +
    - + - package datacommittee +   + Coinbase common.Address // 20 bytes
    - 2 + + 81 +
    - + +   + ForkID uint16 // 2 bytes +
    +
    + 82 + +
    +   + ChainID uint32 // 4 bytes +
    +
    + + +
    +  
    - 3 + + 83 +
    - + - import ( +   + }
    - 4 + + 84 +
    - + - "crypto/ecdsa" +   +
    - 5 + + 85 +
    - + - "errors" +   + // Encode returns the encoded DSL2BlockStart as a byte slice
    - 6 + +
    @@ -110,6 +111,7 @@
    +
    + 110 +
    - + - "fmt" +   + b.Coinbase = common.BytesToAddress(data[96:116])
    - 7 + + 111 +
    - + - "math/big" +   + b.ForkID = binary.BigEndian.Uint16(data[116:118])
    - 8 + + 112 +
    - + - "math/rand" +   + b.ChainID = binary.BigEndian.Uint32(data[118:122])
    - 9 + + + +
    +   +
    +
    +
    + 113 +
    - + - "sort" +   + return b
    - 10 + + 114 +
    - + - "strings" +   + }
    - 11 + + 115 +
    - + +  
    +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - + - + + - - - - - - - - - - + + +
    +
     
    +
    - 12 + + 80 +
    - + - "github.com/0xPolygon/cdk-data-availability/client" +   + Coinbase common.Address // 20 bytes
    - 13 + + 81 +
    - + - daTypes "github.com/0xPolygon/cdk-data-availability/types" +   + ForkID uint16 // 2 bytes
    - 14 + + 82 +
    - + - "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/polygondatacommittee" +   + ChainID uint32 // 4 bytes
    - 15 + 83
    + - "github.com/0xPolygonHermez/zkevm-node/log" +
    - 16 + + 84 +
    - + - "github.com/ethereum/go-ethereum/accounts/abi/bind" +   + }
    - 17 + + 85 +
    - + - "github.com/ethereum/go-ethereum/common" +   +
    - 18 + + 86 +
    - + - "github.com/ethereum/go-ethereum/crypto" +   + // Encode returns the encoded DSL2BlockStart as a byte slice
    - 19 + +
     
    +
    + 111 +
    - + - "github.com/ethereum/go-ethereum/ethclient" +   + b.Coinbase = common.BytesToAddress(data[96:116])
    - 20 + + 112 +
    - + - "golang.org/x/net/context" +   + b.ForkID = binary.BigEndian.Uint16(data[116:118])
    - 21 + + 113 +
    - + - ) +   + b.ChainID = binary.BigEndian.Uint32(data[118:122])
    - 22 + 114
    @@ -39232,498 +230616,851 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 23 + + 115 +
    - + - const unexpectedHashTemplate = "missmatch on transaction data. Expected hash %s, actual hash: %s" +   + return b
    - 24 + + 116 +
    - + -
    +   + }
    - 25 + + 117 +
    - + - // DataCommitteeMember represents a member of the Data Committee +   +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/effectivegasprice.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -0,0 +1,44 @@
    - 26 + + -
    - + - type DataCommitteeMember struct { +
    +
    +   +
    - 27 + + -
    - + - Addr common.Address +
    +
    +   +
    - 28 + + -
    - + - URL string +
    +
    +   +
    - 29 + + -
    - + - } +
    +
    +   +
    - 30 + + -
    - + +
    +
    +  
    - 31 + + -
    - + - // DataCommittee represents a specific committee +
    +
    +   +
    - 32 + + -
    - + - type DataCommittee struct { +
    +
    +   +
    - 33 + + -
    - + - AddressesHash common.Hash +
    +
    +   +
    - 34 + + -
    - + - Members []DataCommitteeMember +
    +
    +   +
    - 35 + + -
    - + - RequiredSignatures uint64 +
    +
    +   +
    - 36 + + -
    - + - } +
    +
    +   +
    - 37 + + -
    - + +
    +
    +  
    - 38 + + -
    - + - // DataCommitteeBackend implements the DAC integration +
    +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    + + + + + + + +
    +
     
    - 39 + 1
    + - type DataCommitteeBackend struct { + package state
    - 40 + 2
    + - dataCommitteeContract *polygondatacommittee.Polygondatacommittee +
    - 41 + 3
    + - privKey *ecdsa.PrivateKey + import (
    - 42 + 4
    + - dataCommitteeClientFactory client.Factory + "errors"
    - 43 + 5
    + -
    + "math/big"
    - 44 + 6
    + - committeeMembers []DataCommitteeMember + )
    - 45 + 7
    + - selectedCommitteeMember int +
    - 46 + 8
    + - ctx context.Context + const (
    - 47 + 9
    + - } + // MaxEffectivePercentage is the maximum value that can be used as effective percentage
    - 48 + 10
    + -
    + MaxEffectivePercentage = uint8(255)
    - 49 + 11
    + - // New creates an instance of DataCommitteeBackend + )
    - 50 + 12
    + - func New( +
    - 51 + 13
    + - l1RPCURL string, + var (
    - 52 + 14
    + - dataCommitteeAddr common.Address, + // ErrEffectiveGasPriceEmpty happens when the effectiveGasPrice or gasPrice is nil or zero
    - 53 + 15
    + - privKey *ecdsa.PrivateKey, + ErrEffectiveGasPriceEmpty = errors.New("effectiveGasPrice or gasPrice cannot be nil or zero")
    - 54 + 16
    + - dataCommitteeClientFactory client.Factory, +
    - 55 + 17
    + - ) (*DataCommitteeBackend, error) { + // ErrEffectiveGasPriceIsZero happens when the calculated EffectiveGasPrice is zero
    - 56 + 18
    + - ethClient, err := ethclient.Dial(l1RPCURL) + ErrEffectiveGasPriceIsZero = errors.New("effectiveGasPrice cannot be zero")
    - 57 + 19
    + - if err != nil { + )
    - 58 + 20
    + - log.Errorf("error connecting to %s: %+v", l1RPCURL, err) +
    - 59 + 21
    + - return nil, err + // CalculateEffectiveGasPricePercentage calculates the gas price's effective percentage
    - 60 + 22
    + - } + func CalculateEffectiveGasPricePercentage(gasPrice *big.Int, effectiveGasPrice *big.Int) (uint8, error) {
    - 61 + 23
    + - dataCommittee, err := polygondatacommittee.NewPolygondatacommittee(dataCommitteeAddr, ethClient) + const bits = 256
    - 62 + 24
    + - if err != nil { + var bitsBigInt = big.NewInt(bits)
    - 63 + 25
    + - return nil, err +
    - 64 + 26
    + - } + if effectiveGasPrice == nil || gasPrice == nil ||
    - 65 + 27
    + - return &DataCommitteeBackend{ + gasPrice.Cmp(big.NewInt(0)) == 0 || effectiveGasPrice.Cmp(big.NewInt(0)) == 0 {
    - 66 + 28
    + - dataCommitteeContract: dataCommittee, + return 0, ErrEffectiveGasPriceEmpty
    - 67 + 29
    + - privKey: privKey, + }
    - 68 + 30
    + - dataCommitteeClientFactory: dataCommitteeClientFactory, +
    - 69 + 31
    + - ctx: context.Background(), + if gasPrice.Cmp(effectiveGasPrice) <= 0 {
    - 70 + 32
    + - }, nil + return MaxEffectivePercentage, nil
    - 71 + 33
    + - } + }
    - 72 + 34
    @@ -39733,2371 +231470,2510 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 73 + 35
    + - // Init loads the DAC to be cached when needed + // Simulate Ceil with integer division
    - 74 + 36
    + - func (d *DataCommitteeBackend) Init() error { + b := new(big.Int).Mul(effectiveGasPrice, bitsBigInt)
    - 75 + 37
    + - committee, err := d.getCurrentDataCommittee() + b = b.Add(b, gasPrice)
    - 76 + 38
    + - if err != nil { + b = b.Sub(b, big.NewInt(1)) //nolint:gomnd
    - 77 + 39
    + - return err + b = b.Div(b, gasPrice)
    - 78 + 40
    + - } + // At this point we have a percentage between 1-256, we need to sub 1 to have it between 0-255 (byte)
    - 79 + 41
    + - selectedCommitteeMember := -1 + b = b.Sub(b, big.NewInt(1)) //nolint:gomnd
    - 80 + 42
    + - if committee != nil { +
    - 81 + 43
    + - d.committeeMembers = committee.Members + return uint8(b.Uint64()), nil
    - 82 + 44
    + - if len(committee.Members) > 0 { + } +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/encoding_batch_v2.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - - - + + + - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -42106,21 +233982,6 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    +
    @@ -2,13 +2,7 @@
    - 83 + + 2 +
    - + - selectedCommitteeMember = rand.Intn(len(committee.Members)) //nolint:gosec +   + This file provide functions to work with ETROG batches:
    - 84 + + 3 +
    - + - } +   + - EncodeBatchV2 (equivalent to EncodeTransactions)
    - 85 + + 4 +
    - + - } +   + - DecodeBatchV2 (equivalent to DecodeTxs)
    - 86 + + 5 +
    - + - d.selectedCommitteeMember = selectedCommitteeMember + - + - DecodeForcedBatchV2
    - 87 + + 6 +
    - + - return nil + - +
    - 88 + + 7 +
    - + - } + - + Also provide a builder class to create batches (BatchV2Encoder):
    - 89 + + 8 +
    - + -
    + - + This method doesnt check anything, so is more flexible but you need to know what you are doing
    - 90 + + 9 +
    - + - // GetSequence gets backend data one hash at a time. This should be optimized on the DAC side to get them all at once. + - + - `builder := NewBatchV2Encoder()` : Create a new `BatchV2Encoder``
    - 91 + + 10 +
    - + - func (d *DataCommitteeBackend) GetSequence(ctx context.Context, hashes []common.Hash, dataAvailabilityMessage []byte) ([][]byte, error) { + - + - You can call to `AddBlockHeader` or `AddTransaction` to add a block header or a transaction as you wish
    - 92 + + 11 +
    - + - // TODO: optimize this on the DAC side by implementing a multi batch retrieve api + - + - You can call to `GetResult` to get the batch data
    - 93 + + 12 +
    - + - var batchData [][]byte +   +
    - 94 + + 13 +
    - + - for _, h := range hashes { +   +
    - 95 + + 14 +
    - + - data, err := d.GetBatchL2Data(h) +   + // batch data format:
    - 96 + +
    @@ -33,25 +27,11 @@
    +
    + 33 +
    - + - if err != nil { +   + // 0x00 | 32 | V
    - 97 + + 34 +
    - + - return nil, err +   + // 0x00 | 1 | efficiencyPercentage
    - 98 + + 35 +
    - + - } +   + // Repeat Transaction
    - 99 + + 36 +
    - + - batchData = append(batchData, data) + - + //
    - 100 + + 37 +
    - + - } + - + // Usage:
    - 101 + + 38 +
    - + - return batchData, nil + - + // There are 2 ways of use this module, direct calls or a builder class:
    - 102 + + 39 +
    - + - } + - + // 1) Direct calls:
    - 103 + + 40 +
    - + -
    + - + // - EncodeBatchV2: Encode a batch of transactions
    - 104 + + 41 +
    - + - // GetBatchL2Data returns the data from the DAC. It checks that it matches with the expected hash + - + // - DecodeBatchV2: Decode a batch of transactions
    - 105 + + 42 +
    - + - func (d *DataCommitteeBackend) GetBatchL2Data(hash common.Hash) ([]byte, error) { + - + //
    - 106 + + 43 +
    - + - intialMember := d.selectedCommitteeMember + - + // 2) Builder class:
    - 107 + + 44 +
    - + - found := false + - + // This method doesnt check anything, so is more flexible but you need to know what you are doing
    - 108 + + 45 +
    - + - for !found && intialMember != -1 { + - + // - builder := NewBatchV2Encoder(): Create a new BatchV2Encoder
    - 109 + + 46 +
    - + - member := d.committeeMembers[d.selectedCommitteeMember] + - + // - You can call to `AddBlockHeader` or `AddTransaction` to add a block header or a transaction as you wish
    - 110 + + 47 +
    - + - log.Infof("trying to get data from %s at %s", member.Addr.Hex(), member.URL) + - + // - You can call to `GetResult` to get the batch data
    - 111 + + 48 +
    - + - c := d.dataCommitteeClientFactory.New(member.URL) + - +
    - 112 + + 49 +
    - + - data, err := c.GetOffChainData(d.ctx, hash) +   + */
    - 113 + + 50 +
    - + - if err != nil { +   +
    - 114 + + 51 +
    - + - log.Warnf( +   + package state
    - 115 + + 52 +
    - + - "error getting data from DAC node %s at %s: %s", +   +
    - 116 + + 53 +
    - + - member.Addr.Hex(), member.URL, err, +   + import (
    - 117 + + 54 +
    - + - ) + - + "encoding/binary"
    - 118 + + 55 +
    - + - d.selectedCommitteeMember = (d.selectedCommitteeMember + 1) % len(d.committeeMembers) +   + "errors"
    - 119 + + 56 +
    - + - if d.selectedCommitteeMember == intialMember { +   + "fmt"
    - 120 + + 57 +
    - + - break +   + "strconv"
    - 121 + +
    @@ -62,16 +42,11 @@
    +
    + 62 +
    - + - } +   + "github.com/ethereum/go-ethereum/rlp"
    - 122 + + 63 +
    - + - continue +   + )
    - 123 + + 64 +
    - + - } +   +
    - 124 + + 65 +
    - + - actualTransactionsHash := crypto.Keccak256Hash(data) + - + // ChangeL2BlockHeader is the header of a L2 block.
    - 125 + + 66 +
    - + - if actualTransactionsHash != hash { + - + type ChangeL2BlockHeader struct {
    - 126 + + 67 +
    - + - unexpectedHash := fmt.Errorf( + - + DeltaTimestamp uint32
    - 127 + + 68 +
    - + - unexpectedHashTemplate, hash, actualTransactionsHash, + - + IndexL1InfoTree uint32
    - 128 + + 69 +
    - + - ) + - + }
    - 129 + + 70 +
    - + - log.Warnf( + - +
    - 130 + + 71 +
    - + - "error getting data from DAC node %s at %s: %s", +   + // L2BlockRaw is the raw representation of a L2 block.
    - 131 + + 72 +
    - + - member.Addr.Hex(), member.URL, unexpectedHash, +   + type L2BlockRaw struct {
    - 132 + + 73 +
    - + - ) + - + ChangeL2BlockHeader
    - 133 + + 74 +
    - + - d.selectedCommitteeMember = (d.selectedCommitteeMember + 1) % len(d.committeeMembers) + - + Transactions []L2TxRaw
    - 134 + + -
    - + - if d.selectedCommitteeMember == intialMember { +
    +
    +   +
    - 135 + + 75 +
    - + - break +   + }
    - 136 + + 76 +
    - + - } +   +
    - 137 + + 77 +
    - + - continue +   + // BatchRawV2 is the representation of a batch of transactions.
    - 138 + +
    @@ -86,15 +61,12 @@
    +
    + 86 +
    - + - } +   +
    - 139 + + 87 +
    - + - return data, nil +   + // L2TxRaw is the raw representation of a L2 transaction inside a L2 block.
    - 140 + + 88 +
    - + - } +   + type L2TxRaw struct {
    - 141 + + 89 +
    - + - if err := d.Init(); err != nil { + - + EfficiencyPercentage uint8 // valid always
    - 142 + + 90 +
    - + - return nil, fmt.Errorf("error loading data committee: %s", err) + - + TxAlreadyEncoded bool // If true the tx is already encoded (data field is used)
    - 143 + + 91 +
    - + - } + - + Tx types.Transaction // valid if TxAlreadyEncoded == false
    - 144 + + 92 +
    - + - return nil, fmt.Errorf("couldn't get the data from any committee member") + - + Data []byte // valid if TxAlreadyEncoded == true
    - 145 + + 93 +
    - + +   }
    - 146 + + 94 +
    - + +  
    - 147 + + 95 +
    - + - type signatureMsg struct { +   + const (
    - 148 + + 96 +
    - + - addr common.Address +   + changeL2Block = uint8(0x0b)
    - 149 + + 97 +
    - + - signature []byte + - + sizeUInt32 = 4
    - 150 + + 98 +
    - + - err error +   + )
    - 151 + + 99 +
    - + - } +   +
    - 152 + + 100 +
    - + +   + var ( +
    +
    +
    @@ -120,88 +92,57 @@
    +
    + 120 + +
    +  
    - 153 + + 121 +
    - + - // PostSequence sends the sequence data to the data availability backend, and returns the dataAvailabilityMessage +   + // EncodeBatchV2 encodes a batch of transactions into a byte slice.
    - 154 + + 122 +
    - + - // as expected by the contract +   + func EncodeBatchV2(batch *BatchRawV2) ([]byte, error) {
    - 155 + + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 123 +
    - + - func (s *DataCommitteeBackend) PostSequence(ctx context.Context, batchesData [][]byte) ([]byte, error) { +   + if batch == nil {
    - 156 + + 124 +
    - + - // Get current committee +   + return nil, fmt.Errorf("batch is nil: %w", ErrInvalidBatchV2)
    - 157 + + 125 +
    - + - committee, err := s.getCurrentDataCommittee() +   + }
    - 158 + + 126 +
    - + - if err != nil { + - + if len(batch.Blocks) == 0 {
    - 159 + + + +
    +   +
    +
    +
    + 127 +
    - + - return nil, err +   + return nil, fmt.Errorf("a batch need minimum a L2Block: %w", ErrInvalidBatchV2)
    - 160 + + 128 +
    - + +   }
    - 161 + + 129 +
    - + + -
    - 162 + + 130 +
    - + - // Authenticate as trusted sequencer by signing the sequences + - + encoder := NewBatchV2Encoder()
    - 163 + + 131 +
    - + - sequence := daTypes.Sequence{} + - + for _, block := range batch.Blocks {
    - 164 + + 132 + +
    + - + encoder.AddBlockHeader(block.ChangeL2BlockHeader) +
    +
    + 133 + +
    + - + err := encoder.AddTransactions(block.Transactions) +
    +
    + 134 +
    - + - for _, seq := range batchesData { +   + if err != nil {
    - 165 + + 135 +
    - + - sequence = append(sequence, seq) + - + return nil, fmt.Errorf("can't encode tx: %w", err)
    - 166 + + 136 +
    - + - } +   + }
    - 167 + + 137 +
    - + - signedSequence, err := sequence.Sign(s.privKey) + - + }
    - 168 + + 138 +
    - + - if err != nil { + - + return encoder.GetResult(), nil
    - 169 + + 139 +
    - + - return nil, err + - + }
    - 170 + + 140 +
    - + - } + - +
    - 171 + + 141 +
    - + -
    + - + // BatchV2Encoder is a builder of the batchl2data used by EncodeBatchV2
    - 172 + + 142 +
    - + - // Request signatures to all members in parallel + - + type BatchV2Encoder struct {
    - 173 + + 143 +
    - + - ch := make(chan signatureMsg, len(committee.Members)) + - + batchData []byte
    - 174 + + 144 +
    - + - signatureCtx, cancelSignatureCollection := context.WithCancel(ctx) + - + }
    - 175 + + 145 +
    - + - for _, member := range committee.Members { + - +
    - 176 + + 146 +
    - + - go requestSignatureFromMember(signatureCtx, *signedSequence, member, ch) + - + // NewBatchV2Encoder creates a new BatchV2Encoder.
    - 177 + + 147 +
    - + - } + - + func NewBatchV2Encoder() *BatchV2Encoder {
    - 178 + + 148 +
    - + -
    + - + return &BatchV2Encoder{}
    - 179 + + 149 +
    - + - // Collect signatures + - + }
    - 180 + + 150 +
    - + - msgs := []signatureMsg{} + - +
    - 181 + + 151 +
    - + - var ( + - + // AddBlockHeader adds a block header to the batch.
    - 182 + + 152 +
    - + - collectedSignatures uint64 + - + func (b *BatchV2Encoder) AddBlockHeader(l2BlockHeader ChangeL2BlockHeader) {
    - 183 + + 153 +
    - + - failedToCollect uint64 + - + b.batchData = l2BlockHeader.Encode(b.batchData)
    - 184 + + 154 +
    - + - ) + - + }
    - 185 + + 155 +
    - + - for collectedSignatures < committee.RequiredSignatures { + - +
    - 186 + + 156 +
    - + - msg := <-ch + - + // AddTransactions adds a set of transactions to the batch.
    - 187 + + 157 +
    - + - if msg.err != nil { + - + func (b *BatchV2Encoder) AddTransactions(transactions []L2TxRaw) error {
    - 188 + + 158 +
    - + - log.Errorf("error when trying to get signature from %s: %s", msg.addr, msg.err) + - + for _, tx := range transactions {
    - 189 + + 159 +
    - + - failedToCollect++ + - + err := b.AddTransaction(tx)
    - 190 + + 160 +
    - + - if len(committee.Members)-int(failedToCollect) < int(committee.RequiredSignatures) { + - + if err != nil {
    - 191 + + 161 +
    - + - cancelSignatureCollection() + - + return fmt.Errorf("can't encode tx: %w", err)
    - 192 + + 162 +
    - + - return nil, errors.New("too many members failed to send their signature") +   + }
    - 193 + + 163 +
    - + - } +   + }
    - 194 + + 164 +
    - + - } else { + - + return nil
    - 195 + + 165 +
    - + - log.Infof("received signature from %s", msg.addr) + - + }
    - 196 + + 166 +
    - + - collectedSignatures++ + - +
    - 197 + + 167 +
    - + - } + - + // AddTransaction adds a transaction to the batch.
    - 198 + + 168 +
    - + - msgs = append(msgs, msg) + - + func (b *BatchV2Encoder) AddTransaction(transaction L2TxRaw) error {
    - 199 + + 169 +
    - + - } + - + var err error
    - 200 + + 170 +
    - + -
    + - + b.batchData, err = transaction.Encode(b.batchData)
    - 201 + + 171 +
    - + - // Stop requesting as soon as we have N valid signatures + - + if err != nil {
    - 202 + + 172 +
    - + - cancelSignatureCollection() + - + return fmt.Errorf("can't encode tx: %w", err)
    - 203 + + 173 +
    - + -
    + - + }
    - 204 + + 174 +
    - + - return buildSignaturesAndAddrs(signatureMsgs(msgs), committee.Members), nil + - + return nil
    - 205 + + 175 +
    - + + - }
    - 206 + + 176 +
    - + + -
    - 207 + + 177 +
    - + - func requestSignatureFromMember(ctx context.Context, signedSequence daTypes.SignedSequence, member DataCommitteeMember, ch chan signatureMsg) { + - + // GetResult returns the batch data.
    - 208 + + 178 +
    - + - // request + - + func (b *BatchV2Encoder) GetResult() []byte {
    - 209 + + 179 +
    - + - c := client.New(member.URL) + - + return b.batchData
    - 210 + + 180 +
    - + - log.Infof("sending request to sign the sequence to %s at %s", member.Addr.Hex(), member.URL) +   + }
    - 211 + + 181 +
    - + - signature, err := c.SignSequence(signedSequence) +   +
    - 212 + + 182 +
    - + - if err != nil { + - + // Encode encodes a batch of l2blocks header into a byte slice.
    - 213 + + 183 +
    - + - ch <- signatureMsg{ + - + func (c ChangeL2BlockHeader) Encode(batchData []byte) []byte {
    - 214 + + 184 +
    - + - addr: member.Addr, +   + batchData = append(batchData, changeL2Block)
    - 215 + + 185 +
    - + - err: err, + - + batchData = append(batchData, encodeUint32(c.DeltaTimestamp)...)
    - 216 + + 186 +
    - + - } + - + batchData = append(batchData, encodeUint32(c.IndexL1InfoTree)...)
    - 217 + + 187 +
    - + - return + - + return batchData
    - 218 + + 188 +
    - + - } +   + }
    - 219 + + 189 +
    - + - // verify returned signature +   +
    - 220 + + 190 +
    - + - signedSequence.Signature = signature + - + // Encode encodes a transaction into a byte slice.
    - 221 + + 191 +
    - + - signer, err := signedSequence.Signer() + - + func (tx L2TxRaw) Encode(batchData []byte) ([]byte, error) {
    - 222 + + 192 +
    - + - if err != nil { + - + if tx.TxAlreadyEncoded {
    - 223 + + 193 +
    - + - ch <- signatureMsg{ + - + batchData = append(batchData, tx.Data...)
    - 224 + + 194 +
    - + - addr: member.Addr, + - + } else {
    - 225 + + 195 +
    - + - err: err, + - + rlpTx, err := prepareRLPTxData(tx.Tx)
    - 226 + + 196 +
    - + - } + - + if err != nil {
    - 227 + + 197 +
    - + - return + - + return nil, fmt.Errorf("can't encode tx to RLP: %w", err)
    - 228 + + 198 +
    - + - } + - + }
    - 229 + + 199 +
    - + - if signer != member.Addr { + - + batchData = append(batchData, rlpTx...)
    - 230 + + 200 +
    - + - ch <- signatureMsg{ +   + }
    - 231 + + -
    - + - addr: member.Addr, +
    +
    +   +
    - 232 + + 201 +
    - + - err: fmt.Errorf("invalid signer. Expected %s, actual %s", member.Addr.Hex(), signer.Hex()), +   + batchData = append(batchData, tx.EfficiencyPercentage)
    - 233 + + 202 +
    - + - } +   + return batchData, nil
    - 234 + + 203 +
    - + - return +   + }
    - 235 + + 204 +
    - + - } +   +
    - 236 + + -
    - + - ch <- signatureMsg{ +
    +
    +   +
    - 237 + + -
    - + - addr: member.Addr, +
    +
    +   +
    - 238 + + -
    - + - signature: signature, +
    +
    +   +
    - 239 + + -
    - + - } +
    +
    +   +
    - 240 + + -
    - + - } +
    +
    +   +
    - 241 + + -
    - + +
    +
    +  
    - 242 + + -
    - + - func buildSignaturesAndAddrs(sigs signatureMsgs, members []DataCommitteeMember) []byte { +
    +
    +   +
    - 243 + + -
    - + - const ( +
    +
    +   +
    - 244 + + -
    - + - sigLen = 65 +
    +
    +   +
    - 245 + + 205 +
    - + - addrLen = 20 +   + // DecodeBatchV2 decodes a batch of transactions from a byte slice.
    - 246 + + 206 +
    - + - ) +   + func DecodeBatchV2(txsData []byte) (*BatchRawV2, error) {
    - 247 + + 207 +
    - + - res := make([]byte, 0, len(sigs)*sigLen+len(members)*addrLen) +   + // The transactions is not RLP encoded. Is the raw bytes in this form: 1 byte for the transaction type (always 0b for changeL2Block) + 4 bytes for deltaTimestamp + for bytes for indexL1InfoTree
    - 248 + +
    @@ -223,7 +164,7 @@
    +
    + 223 +
    - + - sort.Sort(sigs) +   + // is a tx
    - 249 + + 224 +
    - + - for _, msg := range sigs { +   + default:
    - 250 + + 225 +
    - + - log.Debugf("adding signature %s from %s", common.Bytes2Hex(msg.signature), msg.addr.Hex()) +   + if currentBlock == nil {
    - 251 + + 226 +
    - + - res = append(res, msg.signature...) + - + _, _, err := DecodeTxRLP(txsData, pos)
    - 252 + + 227 +
    - + - } +   + if err == nil {
    - 253 + + 228 +
    - + - for _, member := range members { +   + // There is no changeL2Block but have a valid RLP transaction
    - 254 + + 229 +
    - + - log.Debugf("adding addr %s", common.Bytes2Hex(member.Addr.Bytes())) +   + return nil, ErrBatchV2DontStartWithChangeL2Block
    - 255 + +
    @@ -233,7 +174,7 @@
    +
    + 233 +
    - + - res = append(res, member.Addr.Bytes()...) +   + }
    - 256 + + 234 +
    - + - } +   + }
    - 257 + + 235 +
    - + - log.Debugf("full res %s", common.Bytes2Hex(res)) +   + var tx *L2TxRaw
    - 258 + + 236 +
    - + - return res + - + pos, tx, err = DecodeTxRLP(txsData, pos)
    - 259 + + 237 +
    - + - } +   + if err != nil {
    - 260 + + 238 +
    - + -
    +   + return nil, fmt.Errorf("can't decode transactions: %w", err)
    - 261 + + 239 +
    - + - type signatureMsgs []signatureMsg +   + }
    - 262 + +
    @@ -274,11 +215,11 @@
    +
    + 274 +
    - + -
    +   + func decodeBlockHeader(txsData []byte, pos int) (int, *L2BlockRaw, error) {
    - 263 + + 275 +
    - + - func (s signatureMsgs) Len() int { return len(s) } +   + var err error
    - 264 + + 276 +
    - + - func (s signatureMsgs) Less(i, j int) bool { +   + currentBlock := &L2BlockRaw{}
    - 265 + + 277 +
    - + - return strings.ToUpper(s[i].addr.Hex()) < strings.ToUpper(s[j].addr.Hex()) + - + pos, currentBlock.DeltaTimestamp, err = decodeUint32(txsData, pos)
    - 266 + + 278 +
    - + - } +   + if err != nil {
    - 267 + + 279 +
    - + - func (s signatureMsgs) Swap(i, j int) { s[i], s[j] = s[j], s[i] } +   + return 0, nil, fmt.Errorf("can't get deltaTimestamp: %w", err)
    - 268 + + 280 +
    - + -
    +   + }
    - 269 + + 281 +
    - + - // getCurrentDataCommittee return the currently registered data committee + - + pos, currentBlock.IndexL1InfoTree, err = decodeUint32(txsData, pos)
    - 270 + + 282 +
    - + - func (d *DataCommitteeBackend) getCurrentDataCommittee() (*DataCommittee, error) { +   + if err != nil {
    - 271 + + 283 +
    - + - addrsHash, err := d.dataCommitteeContract.CommitteeHash(&bind.CallOpts{Pending: false}) +   + return 0, nil, fmt.Errorf("can't get leafIndex: %w", err)
    - 272 + + 284 +
    - + - if err != nil { +   + }
    - 273 + +
    @@ -286,8 +227,7 @@
    +
    + 286 +
    - + - return nil, fmt.Errorf("error getting CommitteeHash from L1 SC: %w", err) +   + return pos, currentBlock, nil
    - 274 + + 287 +
    - + - } +   + }
    - 275 + + 288 +
    - + - reqSign, err := d.dataCommitteeContract.RequiredAmountOfSignatures(&bind.CallOpts{Pending: false}) +   +
    - 276 + + 289 +
    - + - if err != nil { + - + // DecodeTxRLP decodes a transaction from a byte slice.
    - 277 + + 290 +
    - + - return nil, fmt.Errorf("error getting RequiredAmountOfSignatures from L1 SC: %w", err) + - + func DecodeTxRLP(txsData []byte, offset int) (int, *L2TxRaw, error) {
    - 278 + + 291 +
    - + - } +   + var err error
    - 279 + + 292 +
    - + - members, err := d.getCurrentDataCommitteeMembers() +   + length, err := decodeRLPListLengthFromOffset(txsData, offset)
    - 280 + + 293 +
    - + +   if err != nil {
    - 281 + +
    @@ -325,6 +265,13 @@
    +
    + 325 +
    - + - return nil, err +   + return int(endPos), l2Tx, err
    - 282 + + 326 +
    - + - } +   + }
    - 283 + + 327 +
    - + +  
    - 284 + + -
    - + - return &DataCommittee{ +
    +
    +   +
    - 285 + + -
    - + - AddressesHash: common.Hash(addrsHash), +
    +
    +   +
    - 286 + + -
    - + - RequiredSignatures: reqSign.Uint64(), +
    +
    +   +
    - 287 + + -
    - + - Members: members, +
    +
    +   +
    - 288 + + -
    - + - }, nil +
    +
    +   +
    - 289 + + -
    - + - } +
    +
    +   +
    - 290 + + -
    - + +
    +
    +  
    - 291 + + 328 +
    - + - // getCurrentDataCommitteeMembers return the currently registered data committee members +   + // It returns the length of data from the param offset
    - 292 + + 329 +
    - + - func (d *DataCommitteeBackend) getCurrentDataCommitteeMembers() ([]DataCommitteeMember, error) { +   + // ex:
    - 293 + + 330 +
    - + - nMembers, err := d.dataCommitteeContract.GetAmountOfMembers(&bind.CallOpts{Pending: false}) +   + // 0xc0 -> empty data -> 1 byte because it include the 0xc0
    - 294 + +
    @@ -355,16 +302,3 @@
    +
    + 355 +
    - + - if err != nil { +   + }
    - 295 + + 356 +
    - + - return nil, fmt.Errorf("error getting GetAmountOfMembers from L1 SC: %w", err) +   + return length + headerByteLength, nil
    - 296 + + 357 +
    - + - } +   + }
    - 297 + + 358 +
    - + - members := make([]DataCommitteeMember, 0, nMembers.Int64()) + - +
    - 298 + + 359 +
    - + - for i := int64(0); i < nMembers.Int64(); i++ { + - + func encodeUint32(value uint32) []byte {
    - 299 + + 360 +
    - + - member, err := d.dataCommitteeContract.Members(&bind.CallOpts{Pending: false}, big.NewInt(i)) + - + data := make([]byte, sizeUInt32)
    - 300 + + 361 +
    - + - if err != nil { + - + binary.BigEndian.PutUint32(data, value)
    - 301 + + 362 +
    - + - return nil, fmt.Errorf("error getting Members %d from L1 SC: %w", i, err) + - + return data
    - 302 + + 363 +
    - + - } + - + }
    - 303 + + 364 +
    - + - members = append(members, DataCommitteeMember{ + - +
    - 304 + + 365 +
    - + - Addr: member.Addr, + - + func decodeUint32(txsData []byte, pos int) (int, uint32, error) {
    - 305 + + 366 +
    - + - URL: member.Url, + - + if len(txsData)-pos < sizeUInt32 {
    - 306 + + 367 +
    - + - }) + - + return 0, 0, fmt.Errorf("can't get u32 because not enough data: %w", ErrInvalidBatchV2)
    - 307 + + 368 +
    - + + - }
    - 308 + + 369 +
    - + - return members, nil + - + return pos + sizeUInt32, binary.BigEndian.Uint32(txsData[pos : pos+sizeUInt32]), nil
    - 309 + + 370 +
    - + + - }
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/datacommittee/datacommittee_test.go - RENAMED - -
    -
    @@ -42128,46 +233989,46 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - @@ -42231,63 +234092,68 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - + - + + - - - - @@ -42421,53 +234287,53 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - @@ -42481,61 +234347,66 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - @@ -42751,43 +234627,43 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - @@ -42801,113 +234677,178 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - + - + + - - - - - - + + + + + + - - - - - - + + + + + + - - + + + + + + @@ -42941,23 +234882,83 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - + + + + + + + + + + + + + + + + + + @@ -43161,23 +235162,33 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - + + + @@ -43331,55 +235342,145 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - + + + + + + - - + + + + + + + + + - - + + + + + + + + + + + + - - -
    -
    @@ -0,0 +1,131 @@
    +
     
    - + + 2 -
    +
    +
      -
    + This file provide functions to work with ETROG batches:
    - + + 3 -
    +
    +
      -
    + - EncodeBatchV2 (equivalent to EncodeTransactions)
    - + + 4 -
    +
    +
      -
    + - DecodeBatchV2 (equivalent to DecodeTxs)
    - + + 5 -
    -   -
    +
    +
    + + + - DecodeForcedBatchV2)
    - + + 6 -
    +
    +
     
    - + + 7 -
    +
    +
     
    - + + 8 -
    +
    +
      -
    + // batch data format:
    - + +
     
    -
    +
    + 27 + +
      -
    + // 0x00 | 32 | V
    - + + 28 -
    +
    +
      -
    + // 0x00 | 1 | efficiencyPercentage
    - + + 29 -
    +
    +
      -
    + // Repeat Transaction
    - + + 30 -
    +
    +
      -
    + */
    - + + 31 -
    +
    +
     
    - + + 32 -
    +
    +
      -
    + package state
    - + + 33 -
    +
    +
     
    - + + 34 -
    +
    +
      -
    + import (
    - + + 35 -
    +
    +
      -
    + "errors"
    - + + 36 -
    +
    +
      -
    + "fmt"
    - + + 37 -
    +
    +
      -
    + "strconv"
    - + +
     
    -
    +
    + 42 + +
      -
    + "github.com/ethereum/go-ethereum/rlp"
    - + + 43 -
    +
    +
      -
    + )
    - + + 44 -
    +
    +
     
    @@ -42601,133 +234472,138 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - + + 45 -
    +
    +
      -
    + // L2BlockRaw is the raw representation of a L2 block.
    - + + 46 -
    +
    +
      -
    + type L2BlockRaw struct {
    - + + 47 -
    -   -
    +
    +
    + + + DeltaTimestamp uint32
    - + + 48 -
    -   -
    +
    +
    + + + IndexL1InfoTree uint32
    - + + 49 -
    -   -
    +
    +
    + + + Transactions []L2TxRaw
    - + + 50 -
    +
    +
      -
    + }
    - + + 51 -
    +
    +
     
    - + + 52 -
    +
    +
      -
    + // BatchRawV2 is the representation of a batch of transactions.
    - + +
     
    -
    +
    + 61 + +
     
    - + + 62 -
    +
    +
      -
    + // L2TxRaw is the raw representation of a L2 transaction inside a L2 block.
    - + + 63 -
    +
    +
      -
    + type L2TxRaw struct {
    - + + 64 -
    -   -
    +
    +
    + + + Tx types.Transaction
    - + + 65 -
    -   -
    +
    +
    + + + EfficiencyPercentage uint8
    - + + 66 -
    +
    +
      -
    + }
    - + + 67 -
    +
    +
     
    - + + 68 -
    +
    +
      -
    + const (
    - + + 69 -
    +
    +
      -
    + changeL2Block = uint8(0x0b)
    - + + 70 -
    +
    +
      -
    + )
    - + + 71 -
    +
    +
     
    - + + 72 -
    +
    +
      -
    + var (
    - + +
     
    -
    +
    + 92 + +
     
    - + + 93 -
    +
    +
      -
    + // EncodeBatchV2 encodes a batch of transactions into a byte slice.
    - + + 94 -
    +
    +
      -
    + func EncodeBatchV2(batch *BatchRawV2) ([]byte, error) {
    - + + 95 -
    +
    +
    + + + var err error +
    +
    + 96 + +
    + + + var batchData []byte +
    +
    + 97 + +
      -
    + if batch == nil {
    - + + 98 -
    +
    +
      -
    + return nil, fmt.Errorf("batch is nil: %w", ErrInvalidBatchV2)
    - + + 99 -
    +
    +
      -
    + }
    - + + 100 -
    +
    +
    + + + blocks := batch.Blocks +
    +
    + 101 + +
    + + + if len(blocks) == 0 { +
    +
    + 102 + +
      -
    + return nil, fmt.Errorf("a batch need minimum a L2Block: %w", ErrInvalidBatchV2)
    - + + 103 -
    +
    +
      -
    + } +
    +
    + 104 + +
    + + + for _, block := range blocks { +
    +
    + 105 + +
    + + + batchData, err = EncodeBlockHeaderV2(batchData, block)
    - + + 106 -
    +
    +
      -
    + if err != nil {
    - + + 107 -
    +
    +
    + + + return nil, fmt.Errorf("can't encode block header: %w", err) +
    +
    + 108 + +
      -
    + } +
    +
    + 109 + +
    + + + for _, tx := range block.Transactions { +
    +
    + 110 + +
    + + + batchData, err = encodeTxRLP(batchData, tx) +
    +
    + 111 + +
    + + + if err != nil { +
    +
    + 112 + +
    + + + return nil, fmt.Errorf("can't encode tx: %w", err) +
    +
    + 113 + +
    + + + }
    - + + 114 -
    +
    +
      -
    + }
    - + + 115 -
    +
    +
      -
    + } +
    +
    + 116 + +
    + + + return batchData, nil
    - + + 117 -
    +
    +
      -
    + }
    - + + 118 -
    +
    +
     
    - + + 119 -
    +
    +
    + + + // EncodeBlockHeaderV2 encodes a batch of l2blocks header into a byte slice. +
    +
    + 120 + +
    + + + func EncodeBlockHeaderV2(batchData []byte, block L2BlockRaw) ([]byte, error) { +
    +
    + 121 + +
      -
    + batchData = append(batchData, changeL2Block)
    - + + 122 -
    +
    +
    + + + batchData = append(batchData, serializeUint32(block.DeltaTimestamp)...) +
    +
    + 123 + +
    + + + batchData = append(batchData, serializeUint32(block.IndexL1InfoTree)...) +
    +
    + 124 + +
    + + + return batchData, nil +
    +
    + 125 + +
      -
    + }
    - + + 126 -
    +
    +
     
    + 127 + +
    + + + func encodeTxRLP(batchData []byte, tx L2TxRaw) ([]byte, error) { +
    +
    + 128 + +
    + + + rlpTx, err := prepareRPLTxData(tx.Tx) +
    +
    + 129 + +
    + + + if err != nil { +
    +
    + 130 + +
    + + + return nil, fmt.Errorf("can't encode tx to RLP: %w", err) +
    +
    @@ -43440,553 +235541,624 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0


    -
    + + + 131 + + +
    +   + }
    -
    -
    - - - - - - - + + + + + + + + + + + + + + + - + + + + + + - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +
    -
     
    - 1 + 132
    + - package datacommittee + batchData = append(batchData, rlpTx...)
    - 2 + + 133 +
    - + +   + batchData = append(batchData, tx.EfficiencyPercentage) +
    +
    + 134 + +
    +   + return batchData, nil +
    +
    + 135 + +
    +   + } +
    +
    + 136 + +
    +  
    - 3 + 137
    + - import ( + func serializeUint32(value uint32) []byte {
    - 4 + 138
    + - "math/big" + return []byte{
    - 5 + 139
    + - "testing" + byte(value >> 24), // nolint:gomnd
    - 6 + 140
    + -
    + byte(value >> 16), // nolint:gomnd
    - 7 + 141
    + - "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/polygondatacommittee" + byte(value >> 8), // nolint:gomnd
    - 8 + 142
    + - "github.com/0xPolygonHermez/zkevm-node/log" + byte(value),
    - 9 + 143
    + - "github.com/ethereum/go-ethereum/accounts/abi/bind" + } // nolint:gomnd
    - 10 + 144
    + - "github.com/ethereum/go-ethereum/common" + }
    - 11 + 145
    + - "github.com/ethereum/go-ethereum/core" +
    +
    +
    + 146 + +
    +   + // DecodeBatchV2 decodes a batch of transactions from a byte slice. +
    +
    + 147 + +
    +   + func DecodeBatchV2(txsData []byte) (*BatchRawV2, error) {
    - 12 + + 148 + +
    +   + // The transactions is not RLP encoded. Is the raw bytes in this form: 1 byte for the transaction type (always 0b for changeL2Block) + 4 bytes for deltaTimestamp + for bytes for indexL1InfoTree +
    +
    +
     
    +
    + 164 +
    - + - "github.com/ethereum/go-ethereum/crypto" +   + // is a tx
    - 13 + + 165 +
    - + - "github.com/ethereum/go-ethereum/ethclient/simulated" +   + default:
    - 14 + + 166 +
    - + - "github.com/stretchr/testify/assert" +   + if currentBlock == nil {
    - 15 + + 167 +
    + - "github.com/stretchr/testify/require" + _, _, err := decodeTxRLP(txsData, pos)
    - 16 + + 168 +
    - + - ) +   + if err == nil {
    - 17 + + 169 +
    - + -
    +   + // There is no changeL2Block but have a valid RLP transaction
    - 18 + + 170 +
    - + - func TestUpdateDataCommitteeEvent(t *testing.T) { +   + return nil, ErrBatchV2DontStartWithChangeL2Block
    - 19 - -
    - + - // Set up testing environment -
    +
    +
     
    - 20 + + 174 +
    - + - dac, ethBackend, auth, da := newTestingEnv(t) +   + }
    - 21 + + 175 +
    - + -
    +   + }
    - 22 + + 176 +
    - + - // Update the committee +   + var tx *L2TxRaw
    - 23 + + 177 +
    + - requiredAmountOfSignatures := big.NewInt(2) + pos, tx, err = decodeTxRLP(txsData, pos)
    - 24 + + 178 +
    - + - URLs := []string{"1", "2", "3"} +   + if err != nil {
    - 25 + + 179 +
    - + - addrs := []common.Address{ +   + return nil, fmt.Errorf("can't decode transactions: %w", err)
    - 26 + + 180 +
    - + - common.HexToAddress("0x1"), +   + }
    - 27 + +
     
    +
    + 215 +
    - + - common.HexToAddress("0x2"), +   + func decodeBlockHeader(txsData []byte, pos int) (int, *L2BlockRaw, error) {
    - 28 + + 216 +
    - + - common.HexToAddress("0x3"), +   + var err error
    - 29 + + 217 +
    - + - } +   + currentBlock := &L2BlockRaw{}
    - 30 + + 218 +
    + - addrsBytes := []byte{} + pos, currentBlock.DeltaTimestamp, err = deserializeUint32(txsData, pos)
    - 31 + + 219 +
    - + - for _, addr := range addrs { +   + if err != nil {
    - 32 + + 220 +
    - + - addrsBytes = append(addrsBytes, addr.Bytes()...) +   + return 0, nil, fmt.Errorf("can't get deltaTimestamp: %w", err)
    - 33 + + 221 +
    - + +   }
    - 34 + + 222 +
    + - _, err := da.SetupCommittee(auth, requiredAmountOfSignatures, URLs, addrsBytes) + pos, currentBlock.IndexL1InfoTree, err = deserializeUint32(txsData, pos)
    - 35 + + 223 +
    - + - require.NoError(t, err) +   + if err != nil {
    - 36 + + 224 +
    - + - ethBackend.Commit() +   + return 0, nil, fmt.Errorf("can't get leafIndex: %w", err)
    - 37 + + 225 +
    - + -
    +   + }
    - 38 + +
     
    +
    + 227 +
    - + - // Assert the committee update +   + return pos, currentBlock, nil
    - 39 + + 228 +
    - + - actualSetup, err := dac.getCurrentDataCommittee() +   + }
    - 40 + + 229 +
    - + - require.NoError(t, err) +   +
    - 41 + + 230 +
    + - expectedMembers := []DataCommitteeMember{} + func decodeTxRLP(txsData []byte, offset int) (int, *L2TxRaw, error) {
    - 42 + + -
    - + - expectedSetup := DataCommittee{ +
    +
    +   +
    - 43 + + 231 +
    - + - RequiredSignatures: uint64(len(URLs) - 1), +   + var err error
    - 44 + + 232 +
    - + - AddressesHash: crypto.Keccak256Hash(addrsBytes), +   + length, err := decodeRLPListLengthFromOffset(txsData, offset)
    - 45 + + 233 +
    - + - } +   + if err != nil {
    - 46 + +
     
    +
    + 265 +
    - + - for i, url := range URLs { +   + return int(endPos), l2Tx, err
    - 47 + + 266 +
    - + - expectedMembers = append(expectedMembers, DataCommitteeMember{ +   + }
    - 48 + + 267 +
    - + - URL: url, +   +
    - 49 + 268
    + - Addr: addrs[i], + func deserializeUint32(txsData []byte, pos int) (int, uint32, error) {
    - 50 + 269
    + - }) + if len(txsData)-pos < 4 { // nolint:gomnd
    - 51 + 270
    + - } + return 0, 0, fmt.Errorf("can't get u32 because not enough data: %w", ErrInvalidBatchV2)
    - 52 + 271
    + - expectedSetup.Members = expectedMembers + }
    - 53 + 272
    + - assert.Equal(t, expectedSetup, *actualSetup) + return pos + 4, uint32(txsData[pos])<<24 | uint32(txsData[pos+1])<<16 | uint32(txsData[pos+2])<<8 | uint32(txsData[pos+3]), nil // nolint:gomnd
    - 54 + 273
    @@ -43996,7 +236168,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 55 + 274
    @@ -44005,762 +236177,781 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 56 + + 275 +
    - + - func init() { +   + // It returns the length of data from the param offset
    - 57 + + 276 +
    - + - log.Init(log.Config{ +   + // ex:
    - 58 + + 277 +
    - + - Level: "debug", +   + // 0xc0 -> empty data -> 1 byte because it include the 0xc0
    - 59 + +
     
    +
    + 302 +
    - + - Outputs: []string{"stderr"}, +   + }
    - 60 + + 303 +
    - + - }) +   + return length + headerByteLength, nil
    - 61 + + 304 +
    - + +   }
    - 62 + + -
    - + +
    +
    +  
    - 63 + + -
    - + - // This function prepare the blockchain, the wallet with funds and deploy the smc +
    +
    +   +
    - 64 + + -
    - + - func newTestingEnv(t *testing.T) ( +
    +
    +   +
    - 65 + + -
    - + - dac *DataCommitteeBackend, +
    +
    +   +
    - 66 + + -
    - + - ethBackend *simulated.Backend, +
    +
    +   +
    - 67 + + -
    - + - auth *bind.TransactOpts, +
    +
    +   +
    - 68 + + -
    - + - da *polygondatacommittee.Polygondatacommittee, +
    +
    +   +
    - 69 + + -
    - + - ) { +
    +
    +   +
    - 70 + + -
    - + - t.Helper() +
    +
    +   +
    - 71 + + -
    - + - privateKey, err := crypto.GenerateKey() +
    +
    +   +
    - 72 + + -
    - + - if err != nil { +
    +
    +   +
    - 73 + + -
    - + - log.Fatal(err) +
    +
    +   +
    - 74 + + -
    - + - } +
    +
    +   +
    - 75 - -
    - + - auth, err = bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(1337)) +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/encoding_batch_v2_test.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -44769,21 +236960,6 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    +
    @@ -186,19 +186,14 @@
    - 76 + + 186 +
    - + - if err != nil { +   +
    - 77 + + 187 +
    - + - log.Fatal(err) +   + func TestEncodeBatchV2(t *testing.T) {
    - 78 + + 188 +
    - + - } +   + block1 := L2BlockRaw{
    - 79 + + 189 +
    - + - dac, ethBackend, da, err = newSimulatedDacman(t, auth) + - + ChangeL2BlockHeader: ChangeL2BlockHeader{
    - 80 + + 190 +
    - + - if err != nil { + - + DeltaTimestamp: 123,
    - 81 + + 191 +
    - + - log.Fatal(err) + - + IndexL1InfoTree: 456,
    - 82 + + 192 +
    - + - } + - + },
    - 83 + + 193 +
    - + - return dac, ethBackend, auth, da + - + Transactions: []L2TxRaw{},
    - 84 + + 194 +
    - + - } +   + }
    - 85 + + 195 +
    - + + -
    - 86 + + 196 +
    - + - // NewSimulatedEtherman creates an etherman that uses a simulated blockchain. It's important to notice that the ChainID of the auth +   + block2 := L2BlockRaw{
    - 87 + + 197 +
    - + - // must be 1337. The address that holds the auth will have an initial balance of 10 ETH + - + ChangeL2BlockHeader: ChangeL2BlockHeader{
    - 88 + + 198 +
    - + - func newSimulatedDacman(t *testing.T, auth *bind.TransactOpts) ( + - + DeltaTimestamp: 789,
    - 89 + + 199 +
    - + - dacman *DataCommitteeBackend, + - + IndexL1InfoTree: 101112,
    - 90 + + 200 +
    - + - ethBackend *simulated.Backend, + - + },
    - 91 + + 201 +
    - + - da *polygondatacommittee.Polygondatacommittee, + - + Transactions: []L2TxRaw{},
    - 92 + + 202 +
    - + - err error, +   + }
    - 93 + + 203 +
    - + - ) { +   + blocks := []L2BlockRaw{block1, block2}
    - 94 + + 204 +
    - + - t.Helper() +   +
    - 95 - -
    - + - if auth == nil { -
    +
    +
    @@ -244,36 +239,3 @@
    - 96 + + 244 +
    - + - // read only client +   + _, err = DecodeForcedBatchV2(batchL2Data)
    - 97 + + 245 +
    - + - return &DataCommitteeBackend{}, nil, nil, nil +   + require.Error(t, err)
    - 98 + + 246 +
    - + - } +   + }
    - 99 + + 247 +
    - + - // 10000000 ETH in wei + - +
    - 100 + + 248 +
    - + - balance, _ := new(big.Int).SetString("10000000000000000000000000", 10) //nolint:gomnd + - + func TestEncodeBatchV2WithTxInBinary(t *testing.T) {
    - 101 + + 249 +
    - + - address := auth.From + - + block1 := L2BlockRaw{
    - 102 + + 250 +
    - + - genesisAlloc := map[common.Address]core.GenesisAccount{ + - + ChangeL2BlockHeader: ChangeL2BlockHeader{
    - 103 + + 251 +
    - + - address: { + - + DeltaTimestamp: 123,
    - 104 + + 252 +
    - + - Balance: balance, + - + IndexL1InfoTree: 456,
    - 105 + + 253 +
    - + + - },
    - 106 + + 254 +
    - + - } + - + Transactions: []L2TxRaw{
    - 107 + + 255 +
    - + - blockGasLimit := uint64(999999999999999999) //nolint:gomnd + - + {
    - 108 + + 256 +
    - + - client := simulated.NewBackend(genesisAlloc, simulated.WithBlockGasLimit(blockGasLimit)) + - + EfficiencyPercentage: 255,
    - 109 + + 257 +
    - + -
    + - + TxAlreadyEncoded: true,
    - 110 + + 258 +
    - + - // DAC Setup + - + Data: []byte{0x01, 0x02, 0x03},
    - 111 + + 259 +
    - + - _, _, da, err = polygondatacommittee.DeployPolygondatacommittee(auth, client.Client()) + - + },
    - 112 + + 260 +
    - + - if err != nil { + - + },
    - 113 + + 261 +
    - + - return &DataCommitteeBackend{}, nil, nil, err + - + }
    - 114 + + 262 +
    - + - } + - +
    - 115 + + 263 +
    - + - client.Commit() + - + block2 := L2BlockRaw{
    - 116 + + 264 +
    - + - _, err = da.Initialize(auth) + - + ChangeL2BlockHeader: ChangeL2BlockHeader{
    - 117 + + 265 +
    - + - if err != nil { + - + DeltaTimestamp: 789,
    - 118 + + 266 +
    - + - return &DataCommitteeBackend{}, nil, nil, err + - + IndexL1InfoTree: 101112,
    - 119 + + 267 +
    - + - } + - + },
    - 120 + + 268 +
    - + - client.Commit() + - + Transactions: []L2TxRaw{},
    - 121 + + 269 +
    - + - _, err = da.SetupCommittee(auth, big.NewInt(0), []string{}, []byte{}) + - + }
    - 122 + + 270 +
    - + - if err != nil { + - + blocks := []L2BlockRaw{block1, block2}
    - 123 + + 271 +
    - + - return &DataCommitteeBackend{}, nil, nil, err + - +
    - 124 + + 272 +
    - + - } + - + expectedBatchData := []byte{
    - 125 + + 273 +
    - + - client.Commit() + - + 0xb, 0x0, 0x0, 0x0, 0x7b, 0x0, 0x0, 0x1, 0xc8, 0x1, 0x2, 0x3, 0xff, 0xb, 0x0, 0x0, 0x3, 0x15, 0x0, 0x1, 0x8a, 0xf8,
    - 126 + + 274 +
    - + -
    + - + }
    - 127 + + 275 +
    - + - c := &DataCommitteeBackend{ + - +
    - 128 + + 276 +
    - + - dataCommitteeContract: da, + - + batchData, err := EncodeBatchV2(&BatchRawV2{Blocks: blocks})
    - 129 + + 277 +
    - + - } + - + require.NoError(t, err)
    - 130 + + 278 +
    - + - return c, client, da, nil + - + require.Equal(t, expectedBatchData, batchData)
    - 131 + + 279 +
    - + + - }
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/interfaces.go - RENAMED - -
    -
    @@ -44791,86 +236967,66 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - @@ -44894,13 +237050,13 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - @@ -44914,43 +237070,43 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - @@ -44974,73 +237130,68 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - + - - - - - - @@ -45378,6 +237529,21 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    @@ -0,0 +1,58 @@
    -
    - - -
    -   -
    -
    -
    - - -
    -   -
    -
    +
     
    - + + 186 -
    +
    +
     
    - + + 187 -
    +
    +
      -
    + func TestEncodeBatchV2(t *testing.T) {
    - + + 188 -
    +
    +
      -
    + block1 := L2BlockRaw{
    - + + 189 -
    -   -
    +
    +
    + + + DeltaTimestamp: 123,
    - + + 190 -
    -   -
    +
    +
    + + + IndexL1InfoTree: 456,
    - + + 191 -
    -   -
    +
    +
    + + + Transactions: []L2TxRaw{},
    - + + 192 -
    +
    +
      -
    + }
    - + + 193 -
    +
    +
      -
    + block2 := L2BlockRaw{
    - + + 194 -
    -   -
    +
    +
    + + + DeltaTimestamp: 789,
    - + + 195 -
    -   -
    +
    +
    + + + IndexL1InfoTree: 101112,
    - + + 196 -
    -   -
    +
    +
    + + + Transactions: []L2TxRaw{},
    - + + 197 -
    +
    +
      -
    + }
    - + + 198 -
    +
    +
      -
    + blocks := []L2BlockRaw{block1, block2}
    - + + 199 -
    +
    +
     
    - - -
    -   -
    -
    +
    +
     
    - + + 239 -
    +
    +
      -
    + _, err = DecodeForcedBatchV2(batchL2Data)
    - + + 240 -
    +
    +
      -
    + require.Error(t, err)
    - + + 241 -
    +
    +
      -
    + }
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/forkid.go + RENAMED + +
    +
    @@ -45385,586 +237551,106 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -45972,21 +237658,6 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
     
    -
    - 1 - -
    - + - package dataavailability -
    -
    - 2 - -
    - + -
    -
    -
    - 3 - -
    - + - import ( -
    -
    - 4 - -
    - + - "context" -
    -
    - 5 - -
    - + - "math/big" -
    -
    - 6 - -
    - + -
    -
    -
    - 7 - -
    - + - "github.com/0xPolygonHermez/zkevm-node/jsonrpc/types" -
    -
    - 8 - -
    - + - "github.com/0xPolygonHermez/zkevm-node/state" -
    -
    - 9 - -
    - + - "github.com/ethereum/go-ethereum/common" -
    -
    - 10 - -
    - + - "github.com/jackc/pgx/v4" -
    -
    - 11 - -
    - + - ) -
    -
    - 12 - -
    - + -
    -
    -
    - 13 - -
    - + - // DABackender is an interface for components that store and retrieve batch data -
    -
    - 14 - -
    - + - type DABackender interface { -
    -
    - 15 - -
    - + - SequenceRetriever -
    +
    @@ -17,10 +17,8 @@
    - 16 - -
    - + - SequenceSender -
    -
    + 17 +
    - + - // Init initializes the DABackend +   + FORKID_ETROG = 7
    + 18 +
    - + - Init() error +   + // FORKID_ELDERBERRY is the fork id 8
    + 19 +
    - + - } +   + FORKID_ELDERBERRY = 8
    + 20 +
    - + -
    + - + // FORKID_ELDERBERRY_2 is the fork id 9
    + 21 +
    - + - // SequenceSender is used to send provided sequence of batches + - + FORKID_ELDERBERRY_2 = 9
    + 22 +
    - + - type SequenceSender interface { + - + // FORKID_FEIJOA is the fork id 10
    + 23 +
    - + - // PostSequence sends the sequence data to the data availability backend, and returns the dataAvailabilityMessage + - + FORKID_FEIJOA = 10
    + 24 +
    - + - // as expected by the contract +   + )
    + 25 -
    - + - PostSequence(ctx context.Context, batchesData [][]byte) ([]byte, error) -
    -
    - 26 - -
    - + - } -
    -
    - 27 - -
    - + -
    -
    -
    - 28 - -
    - + - // SequenceRetriever is used to retrieve batch data -
    -
    - 29 - -
    - + - type SequenceRetriever interface { -
    -
    - 30 - -
    - + - // GetSequence retrieves the sequence data from the data availability backend -
    -
    - 31 - -
    - + - GetSequence(ctx context.Context, batchHashes []common.Hash, dataAvailabilityMessage []byte) ([][]byte, error) -
    -
    - 32 - -
    - + - } -
    -
    - 33 - -
    - + -
    -
    -
    - 34 - -
    - + - // === Internal interfaces === -
    -
    - 35 - -
    - + -
    -
    -
    - 36 - -
    - + - type stateInterface interface { -
    -
    - 37 - -
    - + - GetBatchL2DataByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) ([]byte, error) -
    -
    - 38 - -
    - + - GetBatchL2DataByNumbers(ctx context.Context, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error) -
    -
    - 39 - -
    - + - GetBatchByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.Batch, error) -
    -
    - 40 - -
    - + - } -
    -
    - 41 - -
    - + -
    -
    -
    - 42 - -
    - + - // BatchDataProvider is used to retrieve batch data -
    -
    - 43 - -
    - + - type BatchDataProvider interface { -
    -
    - 44 - -
    - + - // GetBatchL2Data retrieve the data of a batch from the DA backend. The returned data must be the pre-image of the hash -
    -
    - 45 - -
    - + - GetBatchL2Data(batchNum []uint64, batchHashes []common.Hash, dataAvailabilityMessage []byte) ([][]byte, error) -
    -
    - 46 - -
    - + - } -
    -
    - 47 - -
    - + -
    -
    -
    - 48 - -
    - + - // DataManager is an interface for components that send and retrieve batch data -
    -
    - 49 - -
    - + - type DataManager interface { -
    -
    - 50 - -
    - + - BatchDataProvider -
    -
    - 51 - -
    - + - SequenceSender -
    -
    - 52 - -
    - + - } -
    -
    - 53 - +
    - + +  
    - 54 - -
    - + - // ZKEVMClientTrustedBatchesGetter contains the methods required to interact with zkEVM-RPC -
    -
    - 55 - -
    - + - type ZKEVMClientTrustedBatchesGetter interface { -
    -
    - 56 - -
    - + - BatchByNumber(ctx context.Context, number *big.Int) (*types.Batch, error) -
    -
    - 57 - -
    - + - BatchesByNumbers(ctx context.Context, numbers []*big.Int) ([]*types.BatchData, error) -
    -
    - 58 + + 26 +
    - + - } +   + // ForkIDInterval is a fork id interval
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/pool/validium-001.sql - RENAMED - -
    -
    @@ -45994,156 +237665,56 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -46167,33 +237738,33 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - @@ -46201,6 +237772,21 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    @@ -0,0 +1,20 @@
    -
    - - -
    -   -
    -
    -
    - - -
    -   -
    -
    -
    - - -
    -   -
    -
    -
    - - -
    -   -
    -
    -
    - - -
    -   -
    -
    -
    - - -
    -   -
    -
    -
    - - -
    -   -
    -
    -
    - - -
    -   -
    -
    -
    - - -
    -   -
    -
    -
    - - -
    -   -
    -
    +
     
    - + + 17 -
    +
    +
      -
    + FORKID_ETROG = 7
    - + + 18 -
    +
    +
      -
    + // FORKID_ELDERBERRY is the fork id 8
    - + + 19 -
    +
    +
      -
    + FORKID_ELDERBERRY = 8
    - + + 20 -
    -   -
    +
    +
    + + + // FORKID_9 is the fork id 9
    - + + 21 -
    -   -
    +
    +
    + + + FORKID_9 = 9
    - + + 22 -
    +
    +
      -
    + )
    - + + 23 -
    +
    +
     
    - + + 24 -
    +
    +
      -
    + // ForkIDInterval is a fork id interval
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/genesis.go + RENAMED + +
    +
    @@ -46208,206 +237794,220 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - - + + +
    -
     
    +
    @@ -19,8 +19,10 @@
    - 1 + + 19 +
    - + - -- +migrate Down +   +
    - 2 + + 20 +
    - + - DROP TABLE IF EXISTS pool.acl CASCADE; +   + // Genesis contains the information to populate state on creation
    - 3 + + 21 +
    - + - DROP TABLE IF EXISTS pool.policy CASCADE; +   + type Genesis struct {
    - 4 + + 22 +
    - + -
    + - + // BlockNumber is the block number where the polygonZKEVM smc was deployed on L1
    - 5 + + 23 +
    - + - -- +migrate Up + - + BlockNumber uint64
    - 6 + + -
    - + - CREATE TABLE pool.policy +
    +
    +   +
    - 7 + + -
    - + - ( +
    +
    +   +
    - 8 + + 24 +
    - + - name VARCHAR PRIMARY KEY, +   + // Root hash of the genesis block
    - 9 + + 25 +
    - + - allow BOOLEAN NOT NULL DEFAULT false +   + Root common.Hash
    - 10 + + 26 +
    - + - ); +   + // Actions is the data to populate into the state trie +
    +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - @@ -46417,12 +238017,12 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    +
    {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/state/0018.sql + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/helper.go RENAMED
    - - - - - - - - + + + + + + - - - - - + - + + - - - - - - + + + - - - - -
    +
     
    - 11 + + 19 +
    - + +  
    - 12 + + 20 +
    - + - INSERT INTO pool.policy (name, allow) VALUES ('send_tx', false); +   + // Genesis contains the information to populate state on creation
    - 13 + + 21 +
    - + - INSERT INTO pool.policy (name, allow) VALUES ('deploy', false); +   + type Genesis struct {
    - 14 + + 22 +
    + -
    + // RollupBlockNumber is the block number where the polygonZKEVM smc was deployed on L1
    - 15 + + 23 +
    + - CREATE TABLE pool.acl + RollupBlockNumber uint64
    - 16 + 24
    + - ( + // RollupManagerBlockNumber is the block number where the RollupManager smc was deployed on L1
    - 17 + 25
    + - address VARCHAR, + RollupManagerBlockNumber uint64
    - 18 + + 26 +
    - + - policy VARCHAR, +   + // Root hash of the genesis block
    - 19 + + 27 +
    - + - PRIMARY KEY (address, policy) +   + Root common.Hash
    - 20 + + 28 +
    - + - ); +   + // Actions is the data to populate into the state trie
    -
    @@ -0,0 +1,11 @@
    +
    @@ -18,8 +18,6 @@
    - + + 18 -
    +
    +
      -
    + double = 2
    - + + 19 -
    +
    +
      -
    + ether155V = 27
    - + + 20 -
    +
    +
      -
    + etherPre155V = 35
    - + + 21 -
    +
    +
    + - + // MaxEffectivePercentage is the maximum value that can be used as effective percentage +
    +
    + 22 + +
    + - + MaxEffectivePercentage = uint8(255) +
    +
    + 23 + +
      -
    + // Decoding constants
    - + + 24 -
    +
    +
      -
    + headerByteLength uint64 = 1
    - + + 25 -
    +
    +
      -
    + sLength uint64 = 32
    - + +
    @@ -39,7 +37,7 @@
    -
    +
    + 39 + +
      -
    + var batchL2Data []byte
    - + + 40 -
    +
    +
     
    - + + 41 -
    +
    +
      -
    + for i, tx := range txs {
    - + + 42 -
    +
    +
    + - + txData, err := prepareRLPTxData(tx) +
    +
    + 43 + +
      -
    + if err != nil {
    - + + 44 -
    +
    +
      -
    + return nil, err
    -
    + + + 45 + + +
    +   + }
    -
    -
    - - - + + - - - - - - - - - - - - - - - + - + + - - - - - - + + + + + + + + + @@ -46678,21 +238349,6 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
     
    +
    @@ -57,7 +55,7 @@
    - 1 + + 57 +
    - + - -- +migrate Up +   + return batchL2Data, nil
    - 2 + + 58 +
    - + - ALTER TABLE state.block +   + }
    - 3 + + 59 +
    - + - ADD COLUMN IF NOT EXISTS checked BOOL NOT NULL DEFAULT FALSE; +   +
    - 4 + + 60 +
    - + -
    + - + func prepareRLPTxData(tx types.Transaction) ([]byte, error) {
    - 5 + + 61 +
    - + - -- set block.checked to true for all blocks below max - 100 +   + v, r, s := tx.RawSignatureValues()
    - 6 + + 62 +
    - + - UPDATE state.block SET checked = true WHERE block_num <= (SELECT MAX(block_num) - 1000 FROM state.block); +   + sign := 1 - (v.Uint64() & 1)
    - 7 + + 63 +
    - + +  
    - 8 + +
    @@ -99,7 +97,7 @@
    +
    + 99 +
    - + - -- +migrate Down +   + var batchL2Data []byte
    - 9 + + 100 +
    - + - ALTER TABLE state.block +   +
    - 10 + + 101 +
    - + - DROP COLUMN IF EXISTS checked; +   + for _, tx := range txs {
    - 11 + + 102 +
    - + -
    + - + txData, err := prepareRLPTxData(tx) +
    +
    + 103 + +
    +   + if err != nil { +
    +
    + 104 + +
    +   + return nil, err +
    +
    + 105 + +
    +   + }
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/state/0018_test.go - RENAMED - -
    -
    @@ -46700,36 +238356,36 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - @@ -46753,313 +238409,462 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - + + + - - - - - + - + + - - - - - - + + + - - - - + + +
    -
    @@ -0,0 +1,69 @@
    +
     
    - + + 18 -
    +
    +
      -
    + double = 2
    - + + 19 -
    +
    +
      -
    + ether155V = 27
    - + + 20 -
    +
    +
      -
    + etherPre155V = 35
    - + + 21 -
    +
    +
      -
    + // Decoding constants
    - + + 22 -
    +
    +
      -
    + headerByteLength uint64 = 1
    - + + 23 -
    +
    +
      -
    + sLength uint64 = 32
    - + +
     
    -
    +
    + 37 + +
      -
    + var batchL2Data []byte
    - + + 38 -
    +
    +
     
    - + + 39 -
    +
    +
      -
    + for i, tx := range txs {
    - + + 40 -
    -   -
    +
    +
    + + + txData, err := prepareRPLTxData(tx)
    - + + 41 -
    +
    +
      -
    + if err != nil {
    - + + 42 -
    +
    +
      -
    + return nil, err
    - + + 43 -
    +
    +
      -
    + }
    - + +
     
    -
    +
    + 55 + +
      -
    + return batchL2Data, nil
    - + + 56 -
    +
    +
      -
    + }
    - + + 57 -
    +
    +
     
    - + + 58 -
    +
    +
    + + + func prepareRPLTxData(tx types.Transaction) ([]byte, error) { +
    +
    + 59 + +
      -
    + v, r, s := tx.RawSignatureValues()
    - + + 60 -
    +
    +
      -
    + sign := 1 - (v.Uint64() & 1)
    - + + 61 -
    +
    +
     
    - + +
     
    -
    +
    + 97 + +
      -
    + var batchL2Data []byte
    - + + 98 -
    +
    +
     
    - + + 99 -
    +
    +
      -
    + for _, tx := range txs {
    - + + 100 -
    +
    +
    + + + txData, err := prepareRPLTxData(tx) +
    +
    + 101 + +
      -
    + if err != nil {
    - + + 102 -
    +
    +
      -
    + return nil, err
    - + + 103 -
    +
    +
      -
    + } +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/interfaces.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + - + + - - - - @@ -47073,63 +238878,68 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - + - + + - - - - @@ -47163,233 +238973,238 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -47407,1376 +239222,1377 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

     
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - + - + + - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +
    +
    @@ -103,14 +103,14 @@
    - + + 103 -
    +
    +
      -
    + GetSequences(ctx context.Context, lastVerifiedBatchNumber uint64, dbTx pgx.Tx) ([]Sequence, error)
    - + + 104 -
    +
    +
      -
    + GetVirtualBatchToProve(ctx context.Context, lastVerfiedBatchNumber uint64, maxL1Block uint64, dbTx pgx.Tx) (*Batch, error)
    - + + 105 -
    +
    +
      -
    + CheckProofContainsCompleteSequences(ctx context.Context, proof *Proof, dbTx pgx.Tx) (bool, error)
    - + + 106 -
    +
    +
    + - + GetProofReadyForFinal(ctx context.Context, lastVerfiedBatchNumber uint64, dbTx pgx.Tx) (*Proof, error) +
    +
    + 107 + +
    + - + GetBatchProofsToAggregate(ctx context.Context, dbTx pgx.Tx) (*Proof, *Proof, error) +
    +
    + 108 + +
    + - + AddBatchProof(ctx context.Context, proof *Proof, dbTx pgx.Tx) error +
    +
    + 109 + +
    + - + UpdateBatchProof(ctx context.Context, proof *Proof, dbTx pgx.Tx) error +
    +
    + 110 + +
    + - + DeleteBatchProofs(ctx context.Context, batchNumber uint64, batchNumberFinal uint64, dbTx pgx.Tx) error +
    +
    + 111 + +
    + - + CleanupBatchProofs(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error +
    +
    + 112 + +
    + - + CleanupLockedBatchProofs(ctx context.Context, duration string, dbTx pgx.Tx) (int64, error) +
    +
    + 113 + +
    + - + DeleteUngeneratedBatchProofs(ctx context.Context, dbTx pgx.Tx) error +
    +
    + 114 + +
      -
    + GetLastClosedBatch(ctx context.Context, dbTx pgx.Tx) (*Batch, error)
    - + + 115 -
    +
    +
      -
    + GetLastClosedBatchNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error)
    - + + 116 -
    +
    +
      -
    + UpdateBatchL2Data(ctx context.Context, batchNumber uint64, batchL2Data []byte, dbTx pgx.Tx) error
    - + +
    @@ -145,6 +145,7 @@
    -
    +
    + 145 + +
      -
    + GetForkIDByBlockNumber(blockNumber uint64) uint64
    - + + 146 -
    +
    +
      -
    + GetForkIDByBatchNumber(batchNumber uint64) uint64
    - + + 147 -
    +
    +
      -
    + GetLatestIndex(ctx context.Context, dbTx pgx.Tx) (uint32, error)
    - + + 148 -
    +
    +
      -
    + GetRawBatchTimestamps(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*time.Time, *time.Time, error)
    - + + 149 -
    +
    +
      -
    + GetL1InfoRootLeafByL1InfoRoot(ctx context.Context, l1InfoRoot common.Hash, dbTx pgx.Tx) (L1InfoTreeExitRootStorageEntry, error)
    - + + 150 -
    +
    +
      -
    + GetL1InfoRootLeafByIndex(ctx context.Context, l1InfoTreeIndex uint32, dbTx pgx.Tx) (L1InfoTreeExitRootStorageEntry, error)
    - + +
    @@ -152,6 +153,9 @@
    -
    +
    + 152 + +
      -
    + GetBlockByNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*Block, error)
    - + + 153 -
    +
    +
      -
    + GetVirtualBatchParentHash(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (common.Hash, error)
    - + + 154 -
    +
    +
      -
    + GetForcedBatchParentHash(ctx context.Context, forcedBatchNumber uint64, dbTx pgx.Tx) (common.Hash, error)
    - + + 155 -
    +
    +
      -
    + GetLatestBatchGlobalExitRoot(ctx context.Context, dbTx pgx.Tx) (common.Hash, error)
    - + + 156 -
    +
    +
      -
    + GetL2TxHashByTxHash(ctx context.Context, hash common.Hash, dbTx pgx.Tx) (*common.Hash, error)
    - + + 157 -
    +
    +
      -
    + GetSyncInfoData(ctx context.Context, dbTx pgx.Tx) (SyncInfoDataOnStorage, error)
    - + +
    @@ -162,20 +166,4 @@
    -
    +
    + 162 + +
      -
    + GetNotCheckedBatches(ctx context.Context, dbTx pgx.Tx) ([]*Batch, error)
    - + + 163 -
    +
    +
      -
    + GetLastL2BlockByBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*L2Block, error)
    - + + 164 -
    +
    +
      -
    + GetPreviousBlockToBlockNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*Block, error)
    - + + 165 -
    -   -
    +
    +
    + - + AddL1InfoTreeRecursiveRootToExitRoot(ctx context.Context, exitRoot *L1InfoTreeRecursiveExitRootStorageEntry, dbTx pgx.Tx) error
    - + + 166 -
    -   -
    +
    +
    + - + GetAllL1InfoTreeRecursiveRootEntries(ctx context.Context, dbTx pgx.Tx) ([]L1InfoTreeRecursiveExitRootStorageEntry, error)
    - + + 167 -
    -   -
    +
    +
    + - + GetLatestL1InfoTreeRecursiveRoot(ctx context.Context, maxBlockNumber uint64, dbTx pgx.Tx) (L1InfoTreeRecursiveExitRootStorageEntry, error)
    - + + 168 -
    -   -
    +
    +
    + - + GetL1InfoRecursiveRootLeafByIndex(ctx context.Context, l1InfoTreeIndex uint32, dbTx pgx.Tx) (L1InfoTreeExitRootStorageEntry, error)
    - + + 169 -
    -   +
    +
    + -
    - + + 170 -
    -   -
    +
    +
    + - + storeblobsequences
    - + + 171 -
    -   -
    +
    +
    + - + storeblobinner
    - + + 172 -
    -   -
    +
    +
    + - + }
    - + + 173 -
    -   +
    +
    + -
    - + + 174 -
    -   -
    +
    +
    + - + type storeblobsequences interface {
    - + + 175 -
    -   -
    +
    +
    + - + AddBlobSequence(ctx context.Context, blobSequence *BlobSequence, dbTx pgx.Tx) error
    - + + 176 -
    -   -
    +
    +
    + - + GetLastBlobSequence(ctx context.Context, dbTx pgx.Tx) (*BlobSequence, error)
    - + + 177 -
    -   -
    +
    +
    + - + }
    - + + 178 -
    -   +
    +
    + -
    - + + 179 -
    -   -
    +
    +
    + - + type storeblobinner interface {
    - + + 180 -
    -   -
    +
    +
    + - + AddBlobInner(ctx context.Context, blobInner *BlobInner, dbTx pgx.Tx) error
    - + + 181 -
    +
    +
      -
    + }
    - 1 + + 103 +
    - + - package migrations_test +   + GetSequences(ctx context.Context, lastVerifiedBatchNumber uint64, dbTx pgx.Tx) ([]Sequence, error)
    - 2 + + 104 +
    - + -
    +   + GetVirtualBatchToProve(ctx context.Context, lastVerfiedBatchNumber uint64, maxL1Block uint64, dbTx pgx.Tx) (*Batch, error)
    - 3 + + 105 +
    - + - import ( +   + CheckProofContainsCompleteSequences(ctx context.Context, proof *Proof, dbTx pgx.Tx) (bool, error)
    - 4 + + 106 +
    + - "database/sql" + GetProofReadyToVerify(ctx context.Context, lastVerfiedBatchNumber uint64, dbTx pgx.Tx) (*Proof, error)
    - 5 + + 107 +
    + - "testing" + GetProofsToAggregate(ctx context.Context, dbTx pgx.Tx) (*Proof, *Proof, error)
    - 6 + + 108 +
    + - "time" + AddGeneratedProof(ctx context.Context, proof *Proof, dbTx pgx.Tx) error
    - 7 + + 109 +
    + -
    + UpdateGeneratedProof(ctx context.Context, proof *Proof, dbTx pgx.Tx) error
    - 8 + + 110 +
    + - "github.com/stretchr/testify/assert" + DeleteGeneratedProofs(ctx context.Context, batchNumber uint64, batchNumberFinal uint64, dbTx pgx.Tx) error
    - 9 + + 111 +
    + - ) + CleanupGeneratedProofs(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error
    - 10 + + 112 +
    + -
    + CleanupLockedProofs(ctx context.Context, duration string, dbTx pgx.Tx) (int64, error)
    - 11 + + 113 +
    + - type migrationTest0018 struct{} + DeleteUngeneratedProofs(ctx context.Context, dbTx pgx.Tx) error
    - 12 + + 114 +
    - + -
    +   + GetLastClosedBatch(ctx context.Context, dbTx pgx.Tx) (*Batch, error)
    - 13 + + 115 +
    - + - func (m migrationTest0018) InsertData(db *sql.DB) error { +   + GetLastClosedBatchNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error)
    - 14 + + 116 +
    - + - const addBlock = "INSERT INTO state.block (block_num, received_at, block_hash) VALUES ($1, $2, $3)" +   + UpdateBatchL2Data(ctx context.Context, batchNumber uint64, batchL2Data []byte, dbTx pgx.Tx) error
    - 15 + +
     
    +
    + 145 +
    - + - if _, err := db.Exec(addBlock, 1, time.Now(), "0x29e885edaf8e4b51e1d2e05f9da28161d2fb4f6b1d53827d9b80a23cf2d7d9f1"); err != nil { +   + GetForkIDByBlockNumber(blockNumber uint64) uint64
    - 16 + + 146 +
    - + - return err +   + GetForkIDByBatchNumber(batchNumber uint64) uint64
    - 17 + + 147 +
    - + - } +   + GetLatestIndex(ctx context.Context, dbTx pgx.Tx) (uint32, error)
    - 18 + 148
    + - if _, err := db.Exec(addBlock, 50, time.Now(), "0x29e885edaf8e4b51e1d2e05f9da28161d2fb4f6b1d53827d9b80a23cf2d7d9f1"); err != nil { + BuildChangeL2Block(deltaTimestamp uint32, l1InfoTreeIndex uint32) []byte
    - 19 + + 149 +
    - + - return err +   + GetRawBatchTimestamps(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*time.Time, *time.Time, error)
    - 20 + + 150 +
    - + - } +   + GetL1InfoRootLeafByL1InfoRoot(ctx context.Context, l1InfoRoot common.Hash, dbTx pgx.Tx) (L1InfoTreeExitRootStorageEntry, error)
    - 21 + + 151 +
    - + - if _, err := db.Exec(addBlock, 1050, time.Now(), "0x29e885edaf8e4b51e1d2e05f9da28161d2fb4f6b1d53827d9b80a23cf2d7d9f1"); err != nil { +   + GetL1InfoRootLeafByIndex(ctx context.Context, l1InfoTreeIndex uint32, dbTx pgx.Tx) (L1InfoTreeExitRootStorageEntry, error)
    - 22 + +
     
    +
    + 153 +
    - + - return err +   + GetBlockByNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*Block, error)
    - 23 + + 154 +
    - + - } +   + GetVirtualBatchParentHash(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (common.Hash, error)
    - 24 + + 155 +
    - + - return nil +   + GetForcedBatchParentHash(ctx context.Context, forcedBatchNumber uint64, dbTx pgx.Tx) (common.Hash, error)
    - 25 + 156
    + - } + GetBatchL2DataByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) ([]byte, error)
    - 26 + 157
    + -
    + GetBatchL2DataByNumbers(ctx context.Context, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error)
    - 27 + 158
    + - func (m migrationTest0018) RunAssertsAfterMigrationUp(t *testing.T, db *sql.DB) { + GetForcedBatchDataByNumbers(ctx context.Context, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error)
    - 28 + + 159 +
    - + - var checked bool +   + GetLatestBatchGlobalExitRoot(ctx context.Context, dbTx pgx.Tx) (common.Hash, error)
    - 29 + + 160 +
    - + - row := db.QueryRow("SELECT checked FROM state.block WHERE block_num = $1", 1) +   + GetL2TxHashByTxHash(ctx context.Context, hash common.Hash, dbTx pgx.Tx) (*common.Hash, error)
    - 30 + + 161 +
    - + - assert.NoError(t, row.Scan(&checked)) +   + GetSyncInfoData(ctx context.Context, dbTx pgx.Tx) (SyncInfoDataOnStorage, error)
    - 31 + +
     
    +
    + 166 +
    - + - assert.Equal(t, true, checked) +   + GetNotCheckedBatches(ctx context.Context, dbTx pgx.Tx) ([]*Batch, error)
    - 32 + + 167 +
    - + - row = db.QueryRow("SELECT checked FROM state.block WHERE block_num = $1", 50) +   + GetLastL2BlockByBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*L2Block, error)
    - 33 + + 168 +
    - + - assert.NoError(t, row.Scan(&checked)) +   + GetPreviousBlockToBlockNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*Block, error)
    - 34 + + -
    - + - assert.Equal(t, true, checked) +
    +
    +   +
    - 35 + + -
    - + - row = db.QueryRow("SELECT checked FROM state.block WHERE block_num = $1", 1050) +
    +
    +   +
    - 36 + + -
    - + - assert.NoError(t, row.Scan(&checked)) +
    +
    +   +
    - 37 + + -
    - + - assert.Equal(t, false, checked) +
    +
    +   +
    - 38 + + -
    - + +
    +
    +  
    - 39 + + -
    - + - const addBlock = "INSERT INTO state.block (block_num, received_at, block_hash, checked) VALUES ($1, $2, $3, $4)" +
    +
    +   +
    - 40 + + -
    - + - _, err := db.Exec(addBlock, 2, time.Now(), "0x29e885edaf8e4b51e1d2e05f9da28161d2fb4f6b1d53827d9b80a23cf2d7d9f1", true) +
    +
    +   +
    - 41 + + -
    - + - assert.NoError(t, err) +
    +
    +   +
    - 42 + + -
    - + - _, err = db.Exec(addBlock, 3, time.Now(), "0x29e885edaf8e4b51e1d2e05f9da28161d2fb4f6b1d53827d9b80a23cf2d7d9f1", false) +
    +
    +   +
    - 43 + + -
    - + - assert.NoError(t, err) +
    +
    +   +
    - 44 + + -
    - + - const sql = `SELECT count(*) FROM state.block WHERE checked = true` +
    +
    +   +
    - 45 + + -
    - + - row = db.QueryRow(sql) +
    +
    +   +
    - 46 + + -
    - + - var result int +
    +
    +   +
    - 47 + + -
    - + - assert.NoError(t, row.Scan(&result)) +
    +
    +   +
    - 48 + + -
    - + - assert.Equal(t, 3, result, "must be 1,50 per migration and 2 by insert") +
    +
    +   +
    - 49 + + -
    - + +
    +
    +  
    - 50 + + 169 +
    - + - const sqlCheckedFalse = `SELECT count(*) FROM state.block WHERE checked = false` +   + } +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/l1infotree_recursive.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    +
    @@ -1,83 +0,0 @@
    - 51 + + 1 +
    - + - row = db.QueryRow(sqlCheckedFalse) + - + package state
    - 52 + + 2 +
    - + + -
    - 53 + + 3 +
    - + - assert.NoError(t, row.Scan(&result)) + - + import (
    - 54 + + 4 +
    - + - assert.Equal(t, 2, result, "must be 150 by migration, and 3 by insert") + - + "context"
    - 55 + + 5 +
    - + - } + - + "errors"
    - 56 + + 6 +
    - + -
    + - + "fmt"
    - 57 + + 7 +
    - + - func (m migrationTest0018) RunAssertsAfterMigrationDown(t *testing.T, db *sql.DB) { + - +
    - 58 + + 8 +
    - + - var result int + - + "github.com/0xPolygonHermez/zkevm-node/l1infotree"
    - 59 + + 9 +
    - + -
    + - + "github.com/0xPolygonHermez/zkevm-node/log"
    - 60 + + 10 +
    - + - // Check column wip doesn't exists in state.batch table + - + "github.com/ethereum/go-ethereum/common"
    - 61 + + 11 +
    - + - const sql = `SELECT count(*) FROM state.block` + - + "github.com/jackc/pgx/v4"
    - 62 + + 12 +
    - + - row := db.QueryRow(sql) + - + )
    - 63 + + 13 +
    - + - assert.NoError(t, row.Scan(&result)) + - +
    - 64 + + 14 +
    - + - assert.Equal(t, 5, result) + - + // L1InfoTreeRecursiveExitRootStorageEntry leaf of the L1InfoTreeRecursive
    - 65 + + 15 +
    - + - } + - + type L1InfoTreeRecursiveExitRootStorageEntry L1InfoTreeExitRootStorageEntry
    - 66 + + 16 +
    - + + -
    - 67 + + 17 +
    - + - func TestMigration0018(t *testing.T) { + - + func (s *State) buildL1InfoTreeRecursiveCacheIfNeed(ctx context.Context, dbTx pgx.Tx) error {
    - 68 + + 18 +
    - + - runMigrationTest(t, 18, migrationTest0018{}) + - + if s.l1InfoTreeRecursive != nil {
    - 69 + + 19 +
    - + - } -
    -
    -
    + - + return nil
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/state/validium-001.sql - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    @@ -0,0 +1,32 @@
    - + + 20 -
    -   -
    +
    +
    + - + }
    - + + 21 -
    -   -
    +
    +
    + - + log.Debugf("Building L1InfoTree cache")
    - + + 22 -
    -   -
    +
    +
    + - + allLeaves, err := s.GetAllL1InfoTreeRecursiveRootEntries(ctx, dbTx)
    - + + 23 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 24 -
    -   -
    +
    +
    + - + log.Error("error getting all leaves. Error: ", err)
    - + + 25 -
    -   -
    +
    +
    + - + return fmt.Errorf("error getting all leaves. Error: %w", err)
    - + + 26 -
    -   -
    +
    +
    + - + }
    - + + 27 -
    -   +
    +
    + -
    - + + 28 -
    -   -
    +
    +
    + - + var leaves [][32]byte
    - + + 29 -
    -   -
    +
    +
    + - + for _, leaf := range allLeaves {
    - + + 30 -
    -   -
    +
    +
    + - + leaves = append(leaves, leaf.Hash())
    - + + 31 -
    -   -
    +
    +
    + - + }
    - + + 32 -
    -   -
    +
    +
    + - + mt, err := l1infotree.NewL1InfoTreeRecursiveFromLeaves(uint8(32), leaves) //nolint:gomnd
    - + + 33 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 34 -
    -   -
    +
    +
    + - + log.Error("error creating L1InfoTree. Error: ", err)
    - + + 35 -
    -   -
    +
    +
    + - + return fmt.Errorf("error creating L1InfoTree. Error: %w", err)
    - + + 36 -
    -   -
    +
    +
    + - + }
    - + + 37 -
    -   -
    +
    +
    + - + s.l1InfoTreeRecursive = mt
    - + + 38 -
    -   -
    +
    +
    + - + return nil
    - + + 39 -
    -   -
    +
    +
    + - + }
    - + + 40 -
    -   +
    +
    + -
    - + + 41 -
    -   -
    +
    +
    + - + // AddL1InfoTreeRecursiveLeaf adds a new leaf to the L1InfoTree and returns the entry and error
    - + + 42 -
    -   -
    +
    +
    + - + func (s *State) AddL1InfoTreeRecursiveLeaf(ctx context.Context, l1InfoTreeLeaf *L1InfoTreeLeaf, dbTx pgx.Tx) (*L1InfoTreeExitRootStorageEntry, error) {
    - + + 43 -
    -   -
    +
    +
    + - + var newIndex uint32
    - + + 44 -
    -   -
    +
    +
    + - + gerIndex, err := s.GetLatestIndex(ctx, dbTx)
    - + + 45 -
    -   -
    +
    +
    + - + if err != nil && !errors.Is(err, ErrNotFound) {
    - + + 46 -
    -   -
    +
    +
    + - + log.Error("error getting latest L1InfoTreeRecursive index. Error: ", err)
    - + + 47 -
    -   -
    +
    +
    + - + return nil, err
    - + + 48 -
    -   -
    +
    +
    + - + } else if err == nil {
    - + + 49 -
    -   -
    +
    +
    + - + newIndex = gerIndex + 1
    - + + 50 -
    -   -
    +
    +
    + - + }
    - - -
    -   -
    -
    +
    + 51
    -
    + +
    + - + err = s.buildL1InfoTreeCacheIfNeed(ctx, dbTx)
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -48784,21 +240600,6 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
     
    - 1 + + 52 +
    - + - -- +migrate Up + - + if err != nil {
    - 2 + + 53 +
    - + -
    + - + log.Error("error building L1InfoTreeRecursive cache. Error: ", err)
    - 3 + + 54 +
    - + - CREATE TABLE IF NOT EXISTS state.batch_data_backup + - + return nil, err
    - 4 + + 55 +
    - + - ( + - + }
    - 5 + + 56 +
    - + - batch_num BIGINT, + - + log.Debug("latestIndex: ", gerIndex)
    - 6 + + 57 +
    - + - data BYTEA, + - + l1InfoTreeRoot, err := s.l1InfoTreeRecursive.AddLeaf(newIndex, l1InfoTreeLeaf.Hash())
    - 7 + + 58 +
    - + - created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP, + - + if err != nil {
    - 8 + + 59 +
    - + - PRIMARY KEY (batch_num, created_at) + - + log.Error("error add new leaf to the L1InfoTreeRecursive. Error: ", err)
    - 9 + + 60 +
    - + - ); + - + return nil, err
    - 10 + + 61 +
    - + -
    + - + }
    - 11 + + 62 +
    - + - -- +migrate StatementBegin + - + entry := L1InfoTreeExitRootStorageEntry{
    - 12 + + 63 +
    - + - CREATE OR REPLACE FUNCTION backup_batch() RETURNS trigger AS $$ + - + L1InfoTreeLeaf: *l1InfoTreeLeaf,
    - 13 + + 64 +
    - + - BEGIN + - + L1InfoTreeRoot: l1InfoTreeRoot,
    - 14 + + 65 +
    - + - INSERT INTO state.batch_data_backup (batch_num, data) + - + L1InfoTreeIndex: newIndex,
    - 15 + + 66 +
    - + - VALUES (OLD.batch_num, OLD.raw_txs_data) + - + }
    - 16 + + 67 +
    - + - ON CONFLICT (batch_num, created_at) DO UPDATE SET + - + err = s.AddL1InfoRootToExitRoot(ctx, &entry, dbTx)
    - 17 + + 68 +
    - + - data = EXCLUDED.data; + - + if err != nil {
    - 18 + + 69 +
    - + - RETURN OLD; + - + log.Error("error adding L1InfoRoot to ExitRoot. Error: ", err)
    - 19 + + 70 +
    - + - END; + - + return nil, err
    - 20 + + 71 +
    - + - $$ + - + }
    - 21 + + 72 +
    - + - LANGUAGE plpgsql; + - + return &entry, nil
    - 22 + + 73 +
    - + - -- +migrate StatementEnd + - + }
    - 23 + + 74 +
    - + + -
    - 24 + + 75 +
    - + - CREATE TRIGGER backup_batch + - + // GetCurrentL1InfoTreeRecursiveRoot Return current L1InfoRoot
    - 25 + + 76 +
    - + - BEFORE DELETE ON state.batch FOR EACH ROW + - + func (s *State) GetCurrentL1InfoTreeRecursiveRoot(ctx context.Context, dbTx pgx.Tx) (common.Hash, error) {
    - 26 + + 77 +
    - + - EXECUTE PROCEDURE backup_batch(); + - + err := s.buildL1InfoTreeRecursiveCacheIfNeed(ctx, dbTx)
    - 27 + + 78 +
    - + -
    + - + if err != nil {
    - 28 + + 79 +
    - + - -- +migrate Down + - + log.Error("error building L1InfoTree cache. Error: ", err)
    - 29 + + 80 +
    - + -
    + - + return ZeroHash, err
    - 30 + + 81 +
    - + - DROP TRIGGER IF EXISTS backup_batch ON state.batch; + - + }
    - 31 + + 82 +
    - + - DROP FUNCTION IF EXISTS backup_batch(); + - + return s.l1InfoTreeRecursive.GetRoot(), nil
    - 32 + + 83 +
    - + - DROP TABLE IF EXISTS state.batch_data_backup; + - + }
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/diffgen.sh - RENAMED - -
    -
    @@ -48806,7 +240607,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - -
    -
    @@ -0,0 +1,47 @@
    +
     
    @@ -49278,488 +241079,364 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0


    -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -49769,12 +241446,12 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    +
    {/home/stefan/go/src/Polygon/zkevm-node → .}/Dockerfile + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/l1infotree_test.go RENAMED
    + + + + + + + + + + + + - - -
    -
     
    -
    - 1 - -
    - + - PATH_TO_ZKEVM_NODE_REPO="/home/stefan/go/src/Polygon/zkevm-node/" -
    -
    - 2 - -
    - + - diff -ruN \ -
    -
    - 3 - -
    - + - -I ".*github.com\/0x.*" \ -
    -
    - 4 - -
    - + - -x "*mock*" -x ".git" \ -
    -
    - 5 - -
    - + - -x ".github" \ -
    -
    - 6 - -
    - + - -x ".gitignore" \ -
    -
    - 7 - -
    - + - -x ".vscode" \ -
    -
    - 8 - -
    - + - -x "ci" \ -
    -
    - 9 - -
    - + - -x "environments" \ -
    -
    - 10 - -
    - + - -x "*.md" \ -
    -
    - 11 - -
    - + - -x "*.html" \ -
    -
    - 12 + + -
    - + - -x "*.html" \ +
    +
    +   +
    - 13 + + -
    - + - -x "*.json" \ +
    +
    +   +
    - 14 + + -
    - + - -x "*.toml" \ +
    +
    +   +
    - 15 + + -
    - + - -x "*.abi" \ +
    +
    +   +
    - 16 + + -
    - + - -x "*.bin" \ +
    +
    +   +
    - 17 + + -
    - + - -x "*.pb.go" \ +
    +
    +   +
    - 18 + + -
    - + - -x "smartcontracts" \ +
    +
    +   +
    - 19 + + -
    - + - -x "go.sum" \ +
    +
    +   +
    - 20 + + -
    - + - -x "mock*.go" \ +
    +
    +   +
    - 21 + + -
    - + - -x "*venv*" \ +
    +
    +   +
    - 22 + + -
    - + - -x "/dist/" \ +
    +
    +   +
    - 23 + + -
    - + - -x "/test/e2e/keystore" \ +
    +
    +   +
    - 24 + + -
    - + - -x "/test/vectors/src/**/*md" \ +
    +
    +   +
    - 25 + + -
    - + - -x "/test/vectors/src/**/*js" \ +
    +
    +   +
    - 26 + + -
    - + - -x "/test/vectors/src/**/*sol" \ +
    +
    +   +
    - 27 + + -
    - + - -x "/test/vectors/src/**/*sh" \ +
    +
    +   +
    - 28 + + -
    - + - -x "/test/vectors/src/package.json" \ +
    +
    +   +
    - 29 + + -
    - + - -x "/test/contracts/bin/**/*.bin" \ +
    +
    +   +
    - 30 + + -
    - + - -x "/test/contracts/bin/**/*.abi" \ +
    +
    +   +
    - 31 + + -
    - + - -x "/tools/datastreamer/*.bin" \ +
    +
    +   +
    - 32 + + -
    - + - -x "/test/datastreamer/*.db/*" \ +
    +
    +   +
    - 33 + + -
    - + - -x "/test/*.bin" \ +
    +
    +   +
    - 34 + + -
    - + - -x "/test/*.db/*" \ +
    +
    +   +
    - 35 + + -
    - + - -x "**/.DS_Store" \ +
    +
    +   +
    - 36 + + -
    - + - -x ".vscode" \ +
    +
    +   +
    - 37 + + -
    - + - -x ".idea/" \ +
    +
    +   +
    - 38 + + -
    - + - -x ".env" \ +
    +
    +   +
    - 39 + + -
    - + - -x "out.dat" \ +
    +
    +   +
    - 40 + + -
    - + - -x "cmd/__debug_bin" \ +
    +
    +   +
    - 41 + + -
    - + - -x ".venv" \ +
    +
    +   +
    - 42 + + -
    - + - -x "*metrics.txt" \ +
    +
    +   +
    - 43 + + -
    - + - -x "coverage.out" \ +
    +
    +   +
    - 44 + + -
    - + - -x "*datastream.db*" \ +
    +
    +   +
    - 45 + + -
    - + - ${PATH_TO_ZKEVM_NODE_REPO} . | \ +
    +
    +   +
    - 46 + + -
    - + - diff2html -i stdin -s side -t "zkEVM node vs CDK validium node</br><h2>zkevm-node version: v0.6.0<h2/>" \ +
    +
    +   +
    - 47 + + -
    - + - -F ./docs/diff/diff.html +
    +
    +   +
    -
    @@ -14,7 +14,6 @@
    +
    @@ -45,11 +45,7 @@
    - 14 + 45
      - # CONTAINER FOR RUNNING BINARY + if err != nil {
    - 15 + 46
      - FROM alpine:3.18 + panic(err)
    - 16 + 47
      - COPY --from=build /src/dist/zkevm-node /app/zkevm-node + } +
    +
    + 48 + +
    + - + mtr, err := l1infotree.NewL1InfoTreeRecursive(32)
    - 17 + 49
    - - COPY --from=build /src/config/environments/testnet/node.config.toml /app/example.config.toml + if err != nil { +
    +
    + 50 + +
    + - + panic(err) +
    +
    + 51 + +
    + - + } +
    +
    + 52 + +
    + - + testState := state.NewState(stateCfg, storage, nil, nil, nil, mt, mtr)
    - 18 + 53
      - RUN apk update && apk add postgresql15-client + dbTx, err := testState.BeginStateTransaction(ctx)
    - 19 + 54
      - EXPOSE 8123 + defer func() {
    - 20 + 55
      - CMD ["/bin/sh", "-c", "/app/zkevm-node run"] + _ = dbTx.Rollback(ctx)
    -
    -
    -
    -
    - - - + - - - - -
    -
     
    +
    @@ -86,7 +82,7 @@
    - 14 + 86
      - # CONTAINER FOR RUNNING BINARY + }},
    - 15 + 87
      - FROM alpine:3.18 + }
    - 16 + 88
      - COPY --from=build /src/dist/zkevm-node /app/zkevm-node + ctx := context.Background()
    - + + 89 -
    -   -
    +
    +
    + - + testState := state.NewState(stateCfg, mockStorage, nil, nil, nil, nil, nil)
    - 17 + 90
      - RUN apk update && apk add postgresql15-client +
    - 18 + 91
      - EXPOSE 8123 + mockStorage.EXPECT().GetAllL1InfoRootEntries(ctx, nil).Return([]state.L1InfoTreeExitRootStorageEntry{}, nil)
    - 19 + 92
      - CMD ["/bin/sh", "-c", "/app/zkevm-node run"] +
    -
    -
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/Dockerfile.release - RENAMED - -
    -
    -
    -
    - - - + - - - - - - - - - - - - - - + + + - - - - - + - + + - - - - - - + + + - - - - @@ -50139,307 +241848,233 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

     
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    @@ -0,0 +1,15 @@
    +
    @@ -112,10 +108,7 @@
    - + + 112 -
    +
    +
      -
    + ctx := context.Background()
    - + + 113 -
    +
    +
      -
    + l1InfoTree, err := l1infotree.NewL1InfoTree(uint8(32), nil)
    - + + 114 -
    +
    +
      -
    + require.NoError(t, err)
    - + + 115 -
    -   +
    +
    + -
    - + + 116 -
    -   -
    +
    +
    + - + l1InfoTreeRecursive, err := l1infotree.NewL1InfoTreeRecursive(32)
    - + + 117 -
    -   -
    +
    +
    + - + require.NoError(t, err)
    - + + 118 -
    +
    +
    + - + testState := state.NewState(stateCfg, mockStorage, nil, nil, nil, l1InfoTree, l1InfoTreeRecursive) +
    +
    + 119 + +
     
    - + + 120 -
    +
    +
      -
    + // GetCurrentL1InfoRoot use the cache value in state.l1InfoTree
    - + + 121 -
    +
    +
      -
    + l1InfoRoot, err := testState.GetCurrentL1InfoRoot(ctx, nil)
    - + +
    @@ -138,7 +131,7 @@
    -
    +
    + 138 + +
      -
    + }},
    - + + 139 -
    +
    +
      -
    + }
    - + + 140 -
    +
    +
      -
    + ctx := context.Background()
    - + + 141 -
    +
    +
    + - + testState := state.NewState(stateCfg, mockStorage, nil, nil, nil, nil, nil) +
    +
    + 142 + +
     
    - + + 143 -
    +
    +
      -
    + mockStorage.EXPECT().GetLatestIndex(ctx, mock.Anything).Return(uint32(0), state.ErrNotFound)
    - + + 144 -
    +
    +
      -
    + mockStorage.EXPECT().AddL1InfoRootToExitRoot(ctx, mock.Anything, mock.Anything).Return(nil)
    - 1 - -
    - + - FROM alpine:3.18 -
    -
    - 2 + + 45 +
    - + -
    +   + if err != nil {
    - 3 + + 46 +
    - + - COPY zkevm-node /app/zkevm-node +   + panic(err)
    - 4 + + 47 +
    - + -
    +   + }
    - 5 + + 48 +
    + - EXPOSE 8123 + testState := state.NewState(stateCfg, storage, nil, nil, nil, mt)
    - 6 + + -
    - + +
    +
    +  
    - 7 - -
    - + - RUN addgroup -S zkevm-group \ -
    -
    - 8 - -
    - + - && adduser -S zkevm-user -G zkevm-group -
    -
    - 9 + + -
    - + +
    +
    +  
    - 10 + + -
    - + - RUN chown -R zkevm-user:zkevm-group /app +
    +
    +   +
    - 11 + + -
    - + +
    +
    +  
    - 12 + + 49 +
    - + - USER zkevm-user +   + dbTx, err := testState.BeginStateTransaction(ctx)
    - 13 + + 50 +
    - + -
    +   + defer func() {
    - 14 + + 51 +
    - + - CMD ["/app/zkevm-node"] +   + _ = dbTx.Rollback(ctx)
    - 15 - -
    - + -
    -
    -
    -
    -
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/etherman.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - @@ -50474,142 +242109,166 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - + + +
    -
    @@ -3,6 +3,7 @@
    +
     
    - 3 + 82
      - import ( + }},
    - 4 + 83
      - "bytes" + }
    - 5 + 84
      - "context" + ctx := context.Background()
    - + + 85 -
    -   -
    +
    +
    + + + testState := state.NewState(stateCfg, mockStorage, nil, nil, nil, nil)
    - 6 + 86
      - "encoding/json" +
    - 7 + 87
      - "errors" + mockStorage.EXPECT().GetAllL1InfoRootEntries(ctx, nil).Return([]state.L1InfoTreeExitRootStorageEntry{}, nil)
    - 8 + 88
      - "fmt" +
    -
    @@ -106,6 +109,11 @@
    +
     
    - 106 + 108
      - // methodIDSequenceBatchesElderberry: MethodID for sequenceBatches in Elderberry + ctx := context.Background()
    - 107 + 109
      - methodIDSequenceBatchesElderberry = []byte{0xde, 0xf5, 0x7e, 0x54} // 0xdef57e54 sequenceBatches((bytes,bytes32,uint64,bytes32)[],uint64,uint64,address) + l1InfoTree, err := l1infotree.NewL1InfoTree(uint8(32), nil)
    - 108 + 110
      -
    -
    -
    - - -
    -   -
    + require.NoError(t, err)
    - + + 111 -
    -   -
    +
    +
    + + + testState := state.NewState(stateCfg, mockStorage, nil, nil, nil, l1InfoTree)
    - 109 + 112
      - // ErrNotFound is used when the object is not found +
    - 110 + 113
      - ErrNotFound = errors.New("not found") + // GetCurrentL1InfoRoot use the cache value in state.l1InfoTree
    - 111 + 114
      - // ErrIsReadOnlyMode is used when the EtherMan client is in read-only mode. + l1InfoRoot, err := testState.GetCurrentL1InfoRoot(ctx, nil)
    -
    @@ -189,6 +197,7 @@
    +
     
    - 189 + 131
      - GlobalExitRootManager *polygonzkevmglobalexitroot.Polygonzkevmglobalexitroot + }},
    - 190 + 132
      - OldGlobalExitRootManager *oldpolygonzkevmglobalexitroot.Oldpolygonzkevmglobalexitroot + }
    - 191 + 133
      - Pol *pol.Pol + ctx := context.Background()
    - + + 134 -
    -   -
    +
    +
    + + + testState := state.NewState(stateCfg, mockStorage, nil, nil, nil, nil)
    - 192 + 135
      - SCAddresses []common.Address +
    - 193 + 136
      -
    + mockStorage.EXPECT().GetLatestIndex(ctx, mock.Anything).Return(uint32(0), state.ErrNotFound)
    - 194 + 137
      - RollupID uint32 + mockStorage.EXPECT().AddL1InfoRootToExitRoot(ctx, mock.Anything, mock.Anything).Return(nil)
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/batch.go + RENAMED + +
    +
    +
    +
    + + + @@ -50623,118 +242282,143 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - + + + + + + + + + @@ -50818,68 +242502,53 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - @@ -50893,103 +242562,102 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - + + +
    -
    @@ -198,10 +207,12 @@
    +
    @@ -2,6 +2,7 @@
    - 198 + 2
      - l1Cfg L1Config +
    - 199 + 3
      - cfg Config + import (
    - 200 + 4
      - auth map[common.Address]bind.TransactOpts // empty in case of read-only client + "context"
    - + + 5 -
    +
    +
      -
    + "encoding/json"
    - 201 + 6
      - } + "errors"
    - 202 + 7
      -
    + "fmt"
    +
    @@ -785,7 +786,7 @@
    +
    - 203 + 785
      - // NewClient creates a new etherman. + b.batch_num > $1 AND b.batch_num = v.batch_num AND +
    +
    + 786 + +
    +   + v.block_num <= $2 AND +
    +
    + 787 + +
    +   + NOT EXISTS (
    - 204 + 788
    - - func NewClient(cfg Config, l1Config L1Config) (*Client, error) { + SELECT p.batch_num FROM state.batch_proof p
    - 205 + 789
      - // Connect to ethereum node + WHERE v.batch_num >= p.batch_num AND v.batch_num <= p.batch_num_final
    - 206 + 790
      - ethClient, err := ethclient.Dial(cfg.URL) + )
    - 207 + 791
      - if err != nil { + ORDER BY b.batch_num ASC LIMIT 1
    -
    @@ -244,6 +255,14 @@
    +
    @@ -956,6 +957,25 @@
    - 244 + 956
      - log.Errorf("error creating NewPol client (%s). Error: %w", l1Config.PolAddr.String(), err) + return blockNum, nil
    - 245 + 957
      - return nil, err + }
    - 246 + 958
      - } +
    - 247 - -
    -   - var scAddresses []common.Address -
    -
    - 248 + + -
    +
    +
      - scAddresses = append(scAddresses, l1Config.ZkEVMAddr, l1Config.RollupManagerAddr, l1Config.GlobalExitRootManagerAddr) +
    - 249 + + -
    +
    +
     
    -
    @@ -274,6 +293,7 @@
    -
    - 274 + + -
    +
    +
      - RollupManager: rollupManager, +
    - 275 + + -
    +
    +
      - Pol: pol, +
    - 276 + + -
    +
    +
      - GlobalExitRootManager: globalExitRoot, +
    - 277 + + -
    +
    +
      - OldGlobalExitRootManager: oldGlobalExitRoot, +
    - 278 + + -
    +
    +
      - SCAddresses: scAddresses, +
    - 279 + + -
    +
    +
      - RollupID: rollupID, +
    -
    @@ -284,11 +304,13 @@
    -
    - 284 + + -
    +
    +
      - l1Cfg: l1Config, +
    - 285 + + -
    +
    +
      - cfg: cfg, +
    - 286 + 959
      - auth: map[common.Address]bind.TransactOpts{}, -
    -
    - - -
    -   -
    + // GetRawBatchTimestamps returns the timestamp of the batch with the given number.
    - 287 + 960
      - }, nil + // it returns batch_num.tstamp and virtual_batch.batch_timestamp
    - 288 + 961
      - } + func (p *PostgresStorage) GetRawBatchTimestamps(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*time.Time, *time.Time, error) { +
    +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +
    +
     
    - 289 + 2
    @@ -50999,197 +242667,157 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 290 + 3
      - // VerifyGenBlockNumber verifies if the genesis Block Number is valid + import (
    - 291 + 4
      - func (etherMan *Client) VerifyGenBlockNumber(ctx context.Context, genBlockNumber uint64) (bool, error) { + "context"
    - + + 5 -
    -   -
    +
    +
    + + + "encoding/binary"
    - 292 + 6
      - start := time.Now() + "encoding/json"
    - 293 + 7
      - log.Info("Verifying genesis blockNumber: ", genBlockNumber) + "errors"
    - 294 + 8
      - // Filter query + "fmt"
    -
    @@ -344,6 +366,11 @@
    +
     
    - 344 + 786
      - log.Debug("Getting forkIDs from blockNumber: ", genBlockNumber) + b.batch_num > $1 AND b.batch_num = v.batch_num AND
    - 345 + 787
      - start := time.Now() + v.block_num <= $2 AND
    - 346 + 788
      - var logs []types.Log -
    -
    - - -
    -   -
    -
    -
    - - -
    -   -
    -
    -
    - - -
    -   -
    -
    -
    - - -
    -   -
    + NOT EXISTS (
    - + + 789 -
    -   -
    +
    +
    + + + SELECT p.batch_num FROM state.proof p
    - 347 + 790
      - log.Debug("Using ForkIDChunkSize: ", etherMan.cfg.ForkIDChunkSize) + WHERE v.batch_num >= p.batch_num AND v.batch_num <= p.batch_num_final
    - 348 + 791
      - for i := genBlockNumber; i <= lastL1BlockSynced; i = i + etherMan.cfg.ForkIDChunkSize + 1 { + )
    - 349 + 792
      - final := i + etherMan.cfg.ForkIDChunkSize + ORDER BY b.batch_num ASC LIMIT 1
    -
    @@ -684,61 +711,8 @@
    +
     
    - 684 + 957
      - return etherMan.updateForkId(ctx, vLog, blocks, blocksOrder, addExistingRollup.LastVerifiedBatchBeforeUpgrade, addExistingRollup.ForkID, "", addExistingRollup.RollupID) + return blockNum, nil
    - 685 + 958
    @@ -51199,7 +242827,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 686 + 959
    @@ -51208,388 +242836,450 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 687 + + 960 +
    - - - func (etherMan *Client) updateEtrogSequence(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { + + + // BuildChangeL2Block returns a changeL2Block tx to use in the BatchL2Data
    - 688 + + 961 +
    - - - log.Debug("updateEtrogSequence event detected") + + + func (p *PostgresStorage) BuildChangeL2Block(deltaTimestamp uint32, l1InfoTreeIndex uint32) []byte {
    - 689 + + 962 +
    - - - updateEtrogSequence, err := etherMan.EtrogZKEVM.ParseUpdateEtrogSequence(vLog) + + + changeL2BlockMark := []byte{0x0B}
    - 690 + + 963 +
    - - - if err != nil { + + + changeL2Block := []byte{}
    - 691 + + 964 +
    - - - log.Error("error parsing updateEtrogSequence event. Error: ", err) + + +
    - 692 + + 965 +
    - - - return err + + + // changeL2Block transaction mark
    - 693 + + 966 +
    - - - } + + + changeL2Block = append(changeL2Block, changeL2BlockMark...)
    - 694 + + 967 +
    - - -
    + + + // changeL2Block deltaTimeStamp
    - 695 + + 968 +
    - - - // Read the tx for this event. + + + deltaTimestampBytes := make([]byte, 4) //nolint:gomnd
    - 696 + + 969 +
    - - - tx, err := etherMan.EthClient.TransactionInBlock(ctx, vLog.BlockHash, vLog.TxIndex) + + + binary.BigEndian.PutUint32(deltaTimestampBytes, deltaTimestamp)
    - 697 + + 970 +
    - - - if err != nil { + + + changeL2Block = append(changeL2Block, deltaTimestampBytes...)
    - 698 + + 971 +
    - - - return err + + + // changeL2Block l1InfoTreeIndexBytes
    - 699 + + 972 +
    - - - } + + + l1InfoTreeIndexBytes := make([]byte, 4) //nolint:gomnd
    - 700 + + 973 +
    - - - if tx.Hash() != vLog.TxHash { + + + binary.BigEndian.PutUint32(l1InfoTreeIndexBytes, l1InfoTreeIndex)
    - 701 + + 974 +
    - - - return fmt.Errorf("error: tx hash mismatch. want: %s have: %s", vLog.TxHash, tx.Hash().String()) + + + changeL2Block = append(changeL2Block, l1InfoTreeIndexBytes...)
    - 702 + + 975 +
    - - - } + + +
    - 703 + + 976 +
    - - - msg, err := core.TransactionToMessage(tx, types.NewLondonSigner(tx.ChainId()), big.NewInt(0)) + + + return changeL2Block
    - 704 + + 977 +
    - - - if err != nil { + + + }
    - 705 + + 978 +
    - - - return err + + +
    - 706 + + 979 +
    - - - } +   + // GetRawBatchTimestamps returns the timestamp of the batch with the given number.
    - 707 + + 980 +
    - - - fullBlock, err := etherMan.EthClient.BlockByHash(ctx, vLog.BlockHash) +   + // it returns batch_num.tstamp and virtual_batch.batch_timestamp
    - 708 + + 981 +
    - - - if err != nil { +   + func (p *PostgresStorage) GetRawBatchTimestamps(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*time.Time, *time.Time, error) {
    - 709 - -
    - - - return fmt.Errorf("error getting fullBlockInfo. BlockNumber: %d. Error: %w", vLog.BlockNumber, err) +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/batch_pending.go + RENAMED + +
    +
    +
    +
    + + + + + + + +
    +
    @@ -1 +0,0 @@
    - 710 + 1
    - - } + package pgstatestorage +
    +
    +
    +
    +
    + + + + + - - + + +
    +
     
    - 711 + + -
    - - +
    +
    +  
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/blob_inner_in.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +
    +
    @@ -1,41 +0,0 @@
    +
    - 712 + 1
    - - log.Info("update Etrog transaction sequence...") + package pgstatestorage
    - 713 + 2
    - - sequence := UpdateEtrogSequence{ +
    - 714 + 3
    - - BatchNumber: updateEtrogSequence.NumBatch, + import (
    - 715 + 4
    - - SequencerAddr: updateEtrogSequence.Sequencer, + "context"
    - 716 + 5
    - - TxHash: vLog.TxHash, + "time"
    - 717 + 6
    - - Nonce: msg.Nonce, +
    - 718 + 7
    - - PolygonRollupBaseEtrogBatchData: &polygonzkevm.PolygonRollupBaseEtrogBatchData{ + "github.com/0xPolygonHermez/zkevm-node/state"
    - 719 + 8
    - - Transactions: updateEtrogSequence.Transactions, + "github.com/ethereum/go-ethereum/common"
    - 720 + 9
    - - ForcedGlobalExitRoot: updateEtrogSequence.LastGlobalExitRoot, + "github.com/jackc/pgx/v4"
    - 721 + 10
    - - ForcedTimestamp: fullBlock.Time(), + )
    - 722 + 11
    - - ForcedBlockHashL1: fullBlock.ParentHash(), +
    - 723 + 12
    - - }, + const blobInnerFields = "blob_sequence_index, blob_inner_num, blob_type, max_sequence_timestamp, zk_gas_limit, l1_info_tree_leaf_index, l1_info_tree_root,blob_data_hash, updated_at"
    - 724 + 13
    - - } + const blobInnerFieldsTypeBlob = "blob_type_index,blob_type_z, blob_type_y,blob_type_commitment,blob_type_proof"
    - 725 + 14
    @@ -51599,847 +243289,526 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 726 + 15
    - - if len(*blocks) == 0 || ((*blocks)[len(*blocks)-1].BlockHash != vLog.BlockHash || (*blocks)[len(*blocks)-1].BlockNumber != vLog.BlockNumber) { + func (p *PostgresStorage) AddBlobInner(ctx context.Context, blobInner *state.BlobInner, dbTx pgx.Tx) error {
    - 727 + 16
    - - block := prepareBlock(vLog, time.Unix(int64(fullBlock.Time()), 0), fullBlock) + sql := "INSERT INTO state.blob_inner_in (" + blobInnerFields
    - 728 + 17
    - - block.UpdateEtrogSequence = sequence + if blobInner.Type == state.TypeBlobTransaction {
    - 729 + 18
    - - *blocks = append(*blocks, block) + sql += "," + blobInnerFieldsTypeBlob
    - 730 + 19
    - - } else if (*blocks)[len(*blocks)-1].BlockHash == vLog.BlockHash && (*blocks)[len(*blocks)-1].BlockNumber == vLog.BlockNumber { + }
    - 731 + 20
    - - (*blocks)[len(*blocks)-1].UpdateEtrogSequence = sequence + sql += ") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9"
    - 732 + 21
    - - } else { + if blobInner.Type == state.TypeBlobTransaction {
    - 733 + 22
    - - log.Error("Error processing UpdateEtrogSequence event. BlockHash:", vLog.BlockHash, ". BlockNumber: ", vLog.BlockNumber) + sql += ",$10,$11,$12,$13,$14"
    - 734 + 23
    - - return fmt.Errorf("error processing UpdateEtrogSequence event") + }
    - 735 + 24
    - - } + sql += ")"
    - 736 + 25
    - - or := Order{ + e := p.getExecQuerier(dbTx)
    - 737 + 26
    - - Name: UpdateEtrogSequenceOrder, + arguments := []interface{}{blobInner.BlobSequenceIndex, blobInner.BlobInnerNum, blobInner.Type.String(), blobInner.MaxSequenceTimestamp, blobInner.ZkGasLimit, blobInner.L1InfoLeafIndex, blobInner.L1InfoTreeRoot.String(), blobInner.BlobDataHash.String(), time.Now()}
    - 738 + 27
    - - Pos: 0, + if blobInner.Type == state.TypeBlobTransaction {
    - 739 + 28
    - - } + commitment, err := blobInner.BlobBlobTypeParams.Commitment.MarshalText()
    - 740 + 29
    - - (*blocksOrder)[(*blocks)[len(*blocks)-1].BlockHash] = append((*blocksOrder)[(*blocks)[len(*blocks)-1].BlockHash], or) + if err != nil {
    - 741 + 30
    - - return nil -
    -
    - 742 - -
    -   - } -
    -
    - 743 - -
    -   -
    -
    -
    - 744 - -
    -   - func (etherMan *Client) initialSequenceBatches(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { -
    -
    -
    @@ -937,14 +911,14 @@
    -
    - 937 - -
    -   - } -
    -
    - 938 - -
    -   -
    -
    -
    - 939 - -
    -   - // EstimateGasSequenceBatches estimates gas for sending batches + return err
    - 940 + + 31 +
    - - func (etherMan *Client) EstimateGasSequenceBatches(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, lastSequencedBatchNumber uint64, l2Coinbase common.Address) (*types.Transaction, error) { -
    -
    - 941 - -
    -   - opts, err := etherMan.getAuthByAddress(sender) -
    -
    - 942 - -
    -   - if err == ErrNotFound { -
    -
    - 943 - -
    -   - return nil, ErrPrivateKeyNotFound -
    -
    - 944 - -
    -   - } + }
    - 945 + + 32 +
    -   - opts.NoSend = true + - + proof, err := blobInner.BlobBlobTypeParams.Proof.MarshalText()
    - 946 + + 33 +
    -   -
    + - + if err != nil {
    - 947 + + 34 +
    - - tx, err := etherMan.sequenceBatches(opts, sequences, maxSequenceTimestamp, lastSequencedBatchNumber, l2Coinbase) + return err
    - 948 + + 35 +
    -   - if err != nil { + - + }
    - 949 + + 36 +
    -   - return nil, err + - + arguments = append(arguments, blobInner.BlobBlobTypeParams.BlobIndex, common.Bytes2Hex(blobInner.BlobBlobTypeParams.Z), common.Bytes2Hex(blobInner.BlobBlobTypeParams.Y), commitment, proof)
    - 950 + + 37 +
    -   + - }
    -
    @@ -953,7 +927,7 @@
    -
    - 953 - -
    -   - } -
    -
    - 954 - -
    -   -
    -
    -
    - 955 - -
    -   - // BuildSequenceBatchesTxData builds a []bytes to be sent to the PoE SC method SequenceBatches. -
    -
    - 956 + + 38 +
    - - func (etherMan *Client) BuildSequenceBatchesTxData(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, lastSequencedBatchNumber uint64, l2Coinbase common.Address) (to *common.Address, data []byte, err error) { -
    -
    - 957 - -
    -   - opts, err := etherMan.getAuthByAddress(sender) -
    -
    - 958 - -
    -   - if err == ErrNotFound { -
    -
    - 959 - -
    -   - return nil, nil, fmt.Errorf("failed to build sequence batches, err: %w", ErrPrivateKeyNotFound) -
    -
    -
    @@ -964,7 +938,7 @@
    -
    - 964 - -
    -   - opts.GasLimit = uint64(1) + _, err := e.Exec(ctx, sql, arguments...)
    - 965 + + 39 +
    -   - opts.GasPrice = big.NewInt(1) + - + return err
    - 966 + + 40 +
    -   + -
    - 967 + + 41 +
    - - tx, err := etherMan.sequenceBatches(opts, sequences, maxSequenceTimestamp, lastSequencedBatchNumber, l2Coinbase) -
    -
    - 968 - -
    -   - if err != nil { -
    -
    - 969 - -
    -   - return nil, nil, err + }
    - 970 - -
    -   - } +
    +
    - - +
    +
    + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -52453,53 +243822,53 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - @@ -52513,623 +243882,656 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - - - - - - + + +
    -
    @@ -972,15 +946,15 @@
    -
    - 972 - -
    -   - return tx.To(), tx.Data(), nil -
    -
    - 973 - -
    -   - } -
    +
     
    - 974 + + -
    +
    +
     
    - 975 - -
    - - - func (etherMan *Client) sequenceBatches(opts bind.TransactOpts, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, lastSequencedBatchNumber uint64, l2Coinbase common.Address) (*types.Transaction, error) { -
    -
    - 976 - -
    - - - var batches []polygonzkevm.PolygonRollupBaseEtrogBatchData -
    -
    - 977 - -
    -   - for _, seq := range sequences { -
    -
    - 978 - -
    -   - var ger common.Hash -
    -
    - 979 - -
    -   - if seq.ForcedBatchTimestamp > 0 { -
    -
    - 980 + + -
    +
    +
      - ger = seq.GlobalExitRoot +
    - 981 + + -
    +
    +
      - } -
    -
    - 982 - -
    - - - batch := polygonzkevm.PolygonRollupBaseEtrogBatchData{ -
    -
    - 983 - -
    - - - Transactions: seq.BatchL2Data, +
    - 984 + + -
    +
    +
      - ForcedGlobalExitRoot: ger, +
    - 985 + + -
    +
    +
      - ForcedTimestamp: uint64(seq.ForcedBatchTimestamp), +
    - 986 + + -
    +
    +
      - ForcedBlockHashL1: seq.PrevBlockHash, +
    -
    @@ -989,7 +963,7 @@
    -
    - 989 + + -
    +
    +
      - batches = append(batches, batch) +
    - 990 + + -
    +
    +
      - } +
    - 991 + + -
    +
    +
     
    - 992 - -
    - - - tx, err := etherMan.ZkEVM.SequenceBatches(&opts, batches, maxSequenceTimestamp, lastSequencedBatchNumber, l2Coinbase) -
    -
    - 993 + + -
    +
    +
      - if err != nil { +
    - 994 + + -
    +
    +
      - log.Debugf("Batches to send: %+v", batches) +
    - 995 + + -
    +
    +
      - log.Debug("l2CoinBase: ", l2Coinbase) +
    -
    @@ -1185,7 +1159,6 @@
    -
    - 1185 + + -
    +
    +
     
    - 1186 + + -
    +
    +
      - func (etherMan *Client) sequencedBatchesEvent(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    - 1187 + + -
    +
    +
      - log.Debugf("SequenceBatches event detected: txHash: %s", common.Bytes2Hex(vLog.TxHash[:])) +
    - 1188 + + -
    - - - //tx,isPending, err:=etherMan.EthClient.TransactionByHash(ctx, vLog.TxHash) +
    +
    +   +
    - 1189 + + -
    +
    +
     
    - 1190 + + -
    +
    +
      - sb, err := etherMan.ZkEVM.ParseSequenceBatches(vLog) +
    - 1191 + + -
    +
    +
      - if err != nil { +
    -
    @@ -1209,13 +1182,15 @@
    -
    - 1209 + + -
    +
    +
      - if sb.NumBatch != 1 { +
    - 1210 + + -
    +
    +
      - methodId := tx.Data()[:4] +
    - 1211 + + -
    +
    +
      - log.Debugf("MethodId: %s", common.Bytes2Hex(methodId)) +
    - 1212 + + -
    - - - if bytes.Equal(methodId, methodIDSequenceBatchesEtrog) { +
    +
    +   +
    - 1213 + + -
    - - - sequences, err = decodeSequencesEtrog(tx.Data(), sb.NumBatch, msg.From, vLog.TxHash, msg.Nonce, sb.L1InfoRoot) +
    +
    +   +
    - 1214 + + -
    +
    +
      - if err != nil { +
    - 1215 + + -
    +
    +
      - return fmt.Errorf("error decoding the sequences (etrog): %v", err) +
    - 1216 + + -
    +
    +
      - } +
    - 1217 + + -
    - - - } else if bytes.Equal(methodId, methodIDSequenceBatchesElderberry) { +
    +
    +   +
    - 1218 + + -
    - - - sequences, err = decodeSequencesElderberry(tx.Data(), sb.NumBatch, msg.From, vLog.TxHash, msg.Nonce, sb.L1InfoRoot) +
    +
    +   +
    - 1219 + + -
    +
    +
      - if err != nil { +
    - 1220 + + -
    +
    +
      - return fmt.Errorf("error decoding the sequences (elderberry): %v", err) +
    - 1221 + + -
    +
    +
      - } +
    -
    @@ -1301,7 +1276,7 @@
    -
    - 1301 + + -
    +
    +
      - return nil +
    - 1302 + + -
    +
    +
      - } +
    - 1303 + + -
    +
    +
     
    - 1304 + + -
    - - - func decodeSequencesElderberry(txData []byte, lastBatchNumber uint64, sequencer common.Address, txHash common.Hash, nonce uint64, l1InfoRoot common.Hash) ([]SequencedBatch, error) { +
    +
    +   +
    - 1305 + + -
    +
    +
      - // Extract coded txs. +
    - 1306 + + -
    +
    +
      - // Load contract ABI +
    - 1307 + + -
    +
    +
      - smcAbi, err := abi.JSON(strings.NewReader(polygonzkevm.PolygonzkevmABI)) +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/blob_sequences.go + RENAMED + +
    +
    +
    +
    + + + - - - - - - - - + + +
    -
    @@ -1309,54 +1284,11 @@
    +
    @@ -1,48 +0,0 @@
    - 1309 + + 1 +
    -   - return nil, err + - + package pgstatestorage
    - 1310 + + 2 +
    -   - } + - +
    - 1311 + + 3 +
    -   -
    + - + import (
    - 1312 + + 4 +
    - - // Recover Method from signature and ABI + "context"
    - 1313 + 5
    - - method, err := smcAbi.MethodById(txData[:4]) + "errors"
    - 1314 + 6
    - - if err != nil { + "time"
    - 1315 + 7
    - - return nil, err +
    - 1316 + 8
    - - } + "github.com/0xPolygonHermez/zkevm-node/state"
    - 1317 + 9
    - -
    + "github.com/ethereum/go-ethereum/common"
    - 1318 + 10
    - - // Unpack method inputs + "github.com/jackc/pgx/v4"
    - 1319 + 11
    - - data, err := method.Inputs.Unpack(txData[4:]) + )
    - 1320 + 12
    - - if err != nil { +
    - 1321 + 13
    - - return nil, err + // AddBlobSequence adds a new blob sequence to the state.
    - 1322 + 14
    - - } + // TODO: Add support to ReceivedAt
    - 1323 + 15
    - - var sequences []polygonzkevm.PolygonRollupBaseEtrogBatchData + func (p *PostgresStorage) AddBlobSequence(ctx context.Context, blobSequence *state.BlobSequence, dbTx pgx.Tx) error {
    - 1324 + 16
    - - bytedata, err := json.Marshal(data[0]) + const addBlobSequenceSQL = "INSERT INTO state.blob_sequence (index, block_num, coinbase, final_acc_input_hash, first_blob_sequenced, last_blob_sequenced, created_at) VALUES ($1, $2, $3, $4, $5, $6, $7)"
    - 1325 + 17
    - - if err != nil { +
    - 1326 + 18
    - - return nil, err + e := p.getExecQuerier(dbTx)
    - 1327 + 19
    - - } + _, err := e.Exec(ctx, addBlobSequenceSQL, blobSequence.BlobSequenceIndex, blobSequence.BlockNumber, blobSequence.L2Coinbase.String(), blobSequence.FinalAccInputHash.String(), blobSequence.FirstBlobSequenced, blobSequence.LastBlobSequenced, blobSequence.CreateAt)
    - 1328 + 20
    - - err = json.Unmarshal(bytedata, &sequences) + return err
    - 1329 + 21
    - - if err != nil { + }
    - 1330 + 22
    - - return nil, err +
    - 1331 + 23
    - - } + // GetLastBlobSequence returns the last blob sequence stored in the state.
    - 1332 + 24
    - - maxSequenceTimestamp := data[1].(uint64) + // TODO: Add support to ReceivedAt
    - 1333 + 25
    - - initSequencedBatchNumber := data[2].(uint64) + func (p *PostgresStorage) GetLastBlobSequence(ctx context.Context, dbTx pgx.Tx) (*state.BlobSequence, error) {
    - 1334 + 26
    - - coinbase := (data[3]).(common.Address) + var (
    - 1335 + 27
    - - sequencedBatches := make([]SequencedBatch, len(sequences)) + coinbase string
    - 1336 + 28
    - -
    + finalAccInputHash string
    - 1337 + 29
    - - for i, seq := range sequences { + createAt time.Time
    - 1338 + 30
    - - elderberry := SequencedBatchElderberryData{ + blobSequence state.BlobSequence
    - 1339 + 31
    - - MaxSequenceTimestamp: maxSequenceTimestamp, + )
    - 1340 + 32
    - - InitSequencedBatchNumber: initSequencedBatchNumber, + const getLastBlobSequenceSQL = "SELECT index, coinbase, final_acc_input_hash, first_blob_sequenced, last_blob_sequenced, created_at FROM state.blob_sequence ORDER BY index DESC LIMIT 1"
    - 1341 + 33
    - - } +
    - 1342 + 34
    - - bn := lastBatchNumber - uint64(len(sequences)-(i+1)) + q := p.getExecQuerier(dbTx)
    - 1343 + 35
    - - s := seq +
    - 1344 + 36
    - - sequencedBatches[i] = SequencedBatch{ + err := q.QueryRow(ctx, getLastBlobSequenceSQL).Scan(&blobSequence.BlobSequenceIndex, &coinbase, &finalAccInputHash, &blobSequence.FirstBlobSequenced, &blobSequence.LastBlobSequenced, &createAt)
    - 1345 + 37
    - - BatchNumber: bn, + if errors.Is(err, pgx.ErrNoRows) {
    - 1346 + 38
    - - L1InfoRoot: &l1InfoRoot, + // If none on database return a nil object
    - 1347 + 39
    - - SequencerAddr: sequencer, + return nil, nil
    - 1348 + 40
    - - TxHash: txHash, + }
    - 1349 + 41
    - - Nonce: nonce, + if err != nil {
    - 1350 + 42
    - - Coinbase: coinbase, + return nil, err
    - 1351 + 43
    - - PolygonRollupBaseEtrogBatchData: &s, + }
    - 1352 + 44
    - - SequencedBatchElderberryData: &elderberry, + blobSequence.L2Coinbase = common.HexToAddress(coinbase)
    - 1353 + 45
    - - } + blobSequence.FinalAccInputHash = common.HexToHash(finalAccInputHash)
    - 1354 + 46
    - - } + blobSequence.CreateAt = createAt
    - 1355 + 47
    - -
    + return &blobSequence, nil
    - 1356 + 48
    - - return sequencedBatches, nil + } +
    +
    +
    +
    +
    + + + + + - - - - - - @@ -53143,66 +244545,71 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - + - - - - - - - - - - - - - - + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
     
    - 1357 + + -
    +
    +
      - } +
    - 1358 + + -
    +
    +
     
    - 1359 + + -
    - - - func decodeSequencesEtrog(txData []byte, lastBatchNumber uint64, sequencer common.Address, txHash common.Hash, nonce uint64, l1InfoRoot common.Hash) ([]SequencedBatch, error) { +
    +
    +   +
    - 1360 + + -
    +
    +
      - // Extract coded txs. +
    - 1361 + + -
    +
    +
      - // Load contract ABI +
    - 1362 + + -
    +
    +
      - smcAbi, err := abi.JSON(strings.NewReader(etrogpolygonzkevm.EtrogpolygonzkevmABI)) +
    -
    @@ -1364,6 +1296,13 @@
    +
    + + +
    +   +
    +
    - 1364 + + -
    +
    +
      - return nil, err +
    - 1365 + + -
    +
    +
      - } +
    - 1366 + + -
    +
    +
     
    @@ -53278,1263 +244685,1618 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 1367 + + -
    +
    +
      - // Recover Method from signature and ABI +
    - 1368 + + -
    +
    +
      - method, err := smcAbi.MethodById(txData[:4]) +
    - 1369 + + -
    +
    +
      - if err != nil { +
    -
    @@ -1375,32 +1314,123 @@
    +
    + + +
    +   +
    +
    - 1375 + + -
    +
    +
      - if err != nil { +
    - 1376 + + -
    +
    +
      - return nil, err +
    - 1377 + + -
    +
    +
      - } +
    - 1378 + + -
    - - - var sequences []polygonzkevm.PolygonRollupBaseEtrogBatchData +
    +
    +   +
    - 1379 + + -
    +
    +
      - bytedata, err := json.Marshal(data[0]) +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/forkid_external_test.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - + - + + - - - - - - - - - - - - - - - - - - + + +
    +
    @@ -17,7 +17,7 @@
    - 1380 + 17
      - if err != nil { + panic(err)
    - 1381 + 18
      - return nil, err + }
    - 1382 + 19
      - } + pgStateStorage = pgstatestorage.NewPostgresStorage(state.Config{}, stateDb)
    - 1383 + 20
    - - err = json.Unmarshal(bytedata, &sequences) + testState = state.NewState(stateCfg, pgStateStorage, executorClient, stateTree, nil, nil, nil)
    - 1384 + + 21 +
    - - - if err != nil { +   +
    - 1385 + + 22 +
    - - - return nil, err +   + for i := 1; i <= 6; i++ {
    - 1386 + + 23 +
    - - - } +   + err = testState.AddForkID(ctx, state.ForkIDInterval{ForkId: uint64(i), BlockNumber: uint64(i * 100), FromBatchNumber: uint64(i * 10), ToBatchNumber: uint64(i*10) + 9}, nil)
    - 1387 + +
    @@ -76,13 +76,13 @@
    +
    + 76 +
    - - - coinbase := (data[1]).(common.Address) +   + panic(err)
    - 1388 + + 77 +
    - - - sequencedBatches := make([]SequencedBatch, len(sequences)) +   + }
    - 1389 + + 78 +
    - - - for i, seq := range sequences { +   + pgStateStorage = pgstatestorage.NewPostgresStorage(stateCfg, stateDb)
    - 1390 + 79
    - - bn := lastBatchNumber - uint64(len(sequences)-(i+1)) + testState = state.NewState(stateCfg, pgStateStorage, executorClient, stateTree, nil, nil, nil)
    - 1391 + 80
    - - s := seq + st := state.NewState(stateCfg, pgstatestorage.NewPostgresStorage(stateCfg, stateDb), executorClient, stateTree, nil, nil, nil)
    - 1392 + + 81 +
    - - - sequencedBatches[i] = SequencedBatch{ +   +
    - 1393 + + 82 +
    - - - BatchNumber: bn, +   + avoidMemoryStateCfg := stateCfg
    - 1394 + + 83 +
    - - - L1InfoRoot: &l1InfoRoot, +   + avoidMemoryStateCfg.AvoidForkIDInMemory = true
    - 1395 + + 84 +
    - - - SequencerAddr: sequencer, +   + pgStateStorageAvoidMemory := pgstatestorage.NewPostgresStorage(avoidMemoryStateCfg, stateDb)
    - 1396 + 85
    - - TxHash: txHash, + stAvoidMemory := state.NewState(avoidMemoryStateCfg, pgStateStorageAvoidMemory, executorClient, stateTree, nil, nil, nil)
    - 1397 + + 86 +
    - - - Nonce: nonce, +   +
    - 1398 + + 87 +
    - - - Coinbase: coinbase, +   + // persist forkID intervals
    - 1399 + + 88 +
    - - - PolygonRollupBaseEtrogBatchData: &s, +   + forkIdIntervals := []state.ForkIDInterval{} +
    +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - + + +
    +
     
    - 1400 + 17
      - } + panic(err)
    - + + 18 -
    +
    +
      -
    + }
    - + + 19 -
    +
    +
      -
    + pgStateStorage = pgstatestorage.NewPostgresStorage(state.Config{}, stateDb)
    - + + 20 -
    -   -
    +
    +
    + + + testState = state.NewState(stateCfg, pgStateStorage, executorClient, stateTree, nil, nil)
    - + + 21 -
    +
    +
     
    - + + 22 -
    +
    +
      -
    + for i := 1; i <= 6; i++ {
    - + + 23 -
    +
    +
      -
    + err = testState.AddForkID(ctx, state.ForkIDInterval{ForkId: uint64(i), BlockNumber: uint64(i * 100), FromBatchNumber: uint64(i * 10), ToBatchNumber: uint64(i*10) + 9}, nil)
    - + +
     
    -
    +
    + 76 + +
      -
    + panic(err)
    - + + 77 -
    +
    +
      -
    + }
    - + + 78 -
    +
    +
      -
    + pgStateStorage = pgstatestorage.NewPostgresStorage(stateCfg, stateDb)
    - + + 79 -
    -   -
    +
    +
    + + + testState = state.NewState(stateCfg, pgStateStorage, executorClient, stateTree, nil, nil)
    - + + 80 -
    -   -
    +
    +
    + + + st := state.NewState(stateCfg, pgstatestorage.NewPostgresStorage(stateCfg, stateDb), executorClient, stateTree, nil, nil)
    - + + 81 -
    +
    +
     
    - + + 82 -
    +
    +
      -
    + avoidMemoryStateCfg := stateCfg
    - + + 83 -
    +
    +
      -
    + avoidMemoryStateCfg.AvoidForkIDInMemory = true
    - + + 84 -
    +
    +
      -
    + pgStateStorageAvoidMemory := pgstatestorage.NewPostgresStorage(avoidMemoryStateCfg, stateDb)
    - + + 85 -
    -   -
    +
    +
    + + + stAvoidMemory := state.NewState(avoidMemoryStateCfg, pgStateStorageAvoidMemory, executorClient, stateTree, nil, nil)
    - + + 86 -
    +
    +
     
    - + + 87 -
    +
    +
      -
    + // persist forkID intervals
    - + + 88 -
    +
    +
      -
    + forkIdIntervals := []state.ForkIDInterval{} +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/forkid_test.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - + + +
    +
    @@ -93,7 +93,7 @@
    - + + 93 -
    +
    +
      -
    + }
    - + + 94 -
    +
    +
      -
    + storage := NewPostgresStorage(cfg, nil)
    - + + 95 -
    +
    +
      -
    + // Create a new State instance with test data
    - + + 96 -
    -   -
    +
    +
    + - + state := state.NewState(cfg, storage, nil, nil, nil, nil, nil)
    - + + 97 -
    +
    +
     
    - + + 98 -
    +
    +
      -
    + // Call the function being tested
    - + + 99 -
    +
    +
      -
    + actual := state.GetForkIDByBlockNumber(tc.blockNumber) +
    +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - + + +
    +
     
    - + + 93 -
    +
    +
      -
    + }
    - + + 94 -
    +
    +
      -
    + storage := NewPostgresStorage(cfg, nil)
    - + + 95 -
    +
    +
      -
    + // Create a new State instance with test data
    - + + 96 -
    -   -
    +
    +
    + + + state := state.NewState(cfg, storage, nil, nil, nil, nil)
    - + + 97 -
    +
    +
     
    - + + 98 -
    +
    +
      -
    + // Call the function being tested
    - + + 99 -
    +
    +
      -
    + actual := state.GetForkIDByBlockNumber(tc.blockNumber) +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/l1infotree.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - + + + - - - - - - - - - - - - - - - + + + - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - -
    +
    @@ -3,48 +3,33 @@
    - + + 3 -
    +
    +
      -
    + import (
    - + + 4 -
    +
    +
      -
    + "context"
    - + + 5 -
    +
    +
      -
    + "errors"
    - + + 6 -
    -   -
    +
    +
    + - + "fmt"
    - + + 7 -
    +
    +
     
    - + + 8 -
    +
    +
      -
    + "github.com/0xPolygonHermez/zkevm-node/state"
    - + + 9 -
    +
    +
      -
    + "github.com/ethereum/go-ethereum/common"
    - + + 10 -
    +
    +
      -
    + "github.com/jackc/pgx/v4"
    - + + 11 -
    +
    +
      -
    + )
    - + + 12 -
    +
    +
     
    - + + 13 -
    -   -
    +
    +
    + - + const (
    - + + 14 -
    -   -
    +
    +
    + - + l1InfoTreeIndexFieldName = "l1_info_tree_index"
    - + + 15 -
    -   -
    +
    +
    + - + )
    - + + 16 -
    -   +
    +
    + -
    - + + 17 -
    +
    +
      -
    + // AddL1InfoRootToExitRoot adds a new entry in ExitRoot and returns index of L1InfoTree and error
    - + + 18 -
    +
    +
      -
    + func (p *PostgresStorage) AddL1InfoRootToExitRoot(ctx context.Context, exitRoot *state.L1InfoTreeExitRootStorageEntry, dbTx pgx.Tx) error {
    - + + 19 -
    -   -
    +
    +
    + - + return p.addL1InfoRootToExitRootVx(ctx, exitRoot, dbTx, l1InfoTreeIndexFieldName)
    - + + 20 -
    -   -
    +
    +
    + - + }
    - + + 21 -
    -   +
    +
    + -
    - + + 22 -
    -   -
    +
    +
    + - + func (p *PostgresStorage) addL1InfoRootToExitRootVx(ctx context.Context, exitRoot *state.L1InfoTreeExitRootStorageEntry, dbTx pgx.Tx, indexFieldName string) error {
    - + + 23 -
    +
    +
      -
    + const addGlobalExitRootSQL = `
    - + + 24 -
    -   -
    +
    +
    + - + INSERT INTO state.exit_root(block_num, timestamp, mainnet_exit_root, rollup_exit_root, global_exit_root, prev_block_hash, l1_info_root, %s)
    - + + 25 -
    +
    +
      -
    + VALUES ($1, $2, $3, $4, $5, $6, $7, $8);
    - + + 26 -
    +
    +
      -
    + `
    - + + 27 -
    -   -
    +
    +
    + - + sql := fmt.Sprintf(addGlobalExitRootSQL, indexFieldName)
    - + + 28 -
    +
    +
      -
    + e := p.getExecQuerier(dbTx)
    - + + 29 -
    -   -
    +
    +
    + - + _, err := e.Exec(ctx, sql,
    - + + 30 -
    +
    +
      -
    + exitRoot.BlockNumber, exitRoot.Timestamp, exitRoot.MainnetExitRoot, exitRoot.RollupExitRoot,
    - + + 31 -
    +
    +
      -
    + exitRoot.GlobalExitRoot.GlobalExitRoot, exitRoot.PreviousBlockHash, exitRoot.L1InfoTreeRoot, exitRoot.L1InfoTreeIndex)
    - + + 32 -
    +
    +
      -
    + return err
    - + + 33 -
    +
    +
      -
    + }
    - + + 34 -
    +
    +
     
    - + + 35 -
    +
    +
      -
    + func (p *PostgresStorage) GetAllL1InfoRootEntries(ctx context.Context, dbTx pgx.Tx) ([]state.L1InfoTreeExitRootStorageEntry, error) {
    - + + 36 -
    -   -
    +
    +
    + - + return p.GetAllL1InfoRootEntriesVx(ctx, dbTx, l1InfoTreeIndexFieldName)
    - + + 37 -
    -   -
    +
    +
    + - + }
    - + + 38 -
    -   +
    +
    + -
    - + + 39 -
    -   -
    +
    +
    + - + func (p *PostgresStorage) GetAllL1InfoRootEntriesVx(ctx context.Context, dbTx pgx.Tx, indexFieldName string) ([]state.L1InfoTreeExitRootStorageEntry, error) {
    - + + 40 -
    -   -
    +
    +
    + - + const getL1InfoRootSQL = `SELECT block_num, timestamp, mainnet_exit_root, rollup_exit_root, global_exit_root, prev_block_hash, l1_info_root, %s
    - + + 41 -
    +
    +
      -
    + FROM state.exit_root
    - + + 42 -
    -   -
    +
    +
    + - + WHERE %s IS NOT NULL
    - + + 43 -
    -   -
    +
    +
    + - + ORDER BY %s`
    - + + 44 -
    +
    +
     
    - + + 45 -
    -   -
    +
    +
    + - + sql := fmt.Sprintf(getL1InfoRootSQL, indexFieldName, indexFieldName, indexFieldName)
    - + + 46 -
    +
    +
      -
    + e := p.getExecQuerier(dbTx)
    - + + 47 -
    -   -
    +
    +
    + - + rows, err := e.Query(ctx, sql)
    - + + 48 -
    +
    +
      -
    + if err != nil {
    - + + 49 -
    +
    +
      -
    + return nil, err
    - + + 50 -
    +
    +
      -
    + }
    - + +
    @@ -65,22 +50,15 @@
    -
    +
    + 65 + +
     
    - + + 66 -
    +
    +
      -
    + // GetLatestL1InfoRoot is used to get the latest L1InfoRoot
    - + + 67 -
    +
    +
      -
    + func (p *PostgresStorage) GetLatestL1InfoRoot(ctx context.Context, maxBlockNumber uint64) (state.L1InfoTreeExitRootStorageEntry, error) {
    - + + 68 -
    -   -
    +
    +
    + - + return p.GetLatestL1InfoRootVx(ctx, maxBlockNumber, nil, l1InfoTreeIndexFieldName)
    - + + 69 -
    -   -
    +
    +
    + - + }
    - + + 70 -
    -   +
    +
    + -
    - + + 71 + +
    + - + // GetLatestL1InfoRoot is used to get the latest L1InfoRoot +
    +
    + 72 -
    -   -
    +
    +
    + - + func (p *PostgresStorage) GetLatestL1InfoRootVx(ctx context.Context, maxBlockNumber uint64, dbTx pgx.Tx, indexFieldName string) (state.L1InfoTreeExitRootStorageEntry, error) {
    - + + 73 -
    -   -
    +
    +
    + - + const getL1InfoRootSQL = `SELECT block_num, timestamp, mainnet_exit_root, rollup_exit_root, global_exit_root, prev_block_hash, l1_info_root, %s
    - + + 74 -
    +
    +
      -
    + FROM state.exit_root
    - + + 75 -
    -   -
    +
    +
    + - + WHERE %s IS NOT NULL AND block_num <= $1
    - + + 76 -
    -   -
    +
    +
    + - + ORDER BY %s DESC LIMIT 1`
    - + + 77 -
    -   +
    +
    + -
    - + + 78 -
    -   -
    +
    +
    + - + sql := fmt.Sprintf(getL1InfoRootSQL, indexFieldName, indexFieldName, indexFieldName)
    - + + 79 -
    +
    +
     
    - 1401 + 80
      - } + entry := state.L1InfoTreeExitRootStorageEntry{}
    - 1402 + 81
    @@ -54544,27 +246306,37 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 1403 + 82
    - - return sequencedBatches, nil + e := p.getExecQuerier(dbTx) +
    +
    + 83 + +
    + - + err := e.QueryRow(ctx, sql, maxBlockNumber).Scan(&entry.BlockNumber, &entry.Timestamp, &entry.MainnetExitRoot, &entry.RollupExitRoot, &entry.GlobalExitRoot.GlobalExitRoot,
    - 1404 + 84
      - } + &entry.PreviousBlockHash, &entry.L1InfoTreeRoot, &entry.L1InfoTreeIndex)
    - 1405 + 85
    @@ -54574,177 +246346,187 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 1406 + 86
      - func decodeSequencesPreEtrog(txData []byte, lastBatchNumber uint64, sequencer common.Address, txHash common.Hash, nonce uint64) ([]SequencedBatch, error) { + if !errors.Is(err, pgx.ErrNoRows) {
    -
    @@ -1872,15 +1902,15 @@
    +
    @@ -90,16 +68,11 @@
    - 1872 + 90
      - } + return entry, nil
    - 1873 + 91
      -
    + }
    - 1874 + 92
      - // LoadAuthFromKeyStore loads an authorization from a key store file + func (p *PostgresStorage) GetLatestIndex(ctx context.Context, dbTx pgx.Tx) (uint32, error) {
    - 1875 + 93
    - - func (etherMan *Client) LoadAuthFromKeyStore(path, password string) (*bind.TransactOpts, error) { + return p.GetLatestIndexVx(ctx, dbTx, l1InfoTreeIndexFieldName)
    - 1876 + 94
    - - auth, err := newAuthFromKeystore(path, password, etherMan.l1Cfg.L1ChainID) + }
    - 1877 + + 95 +
    -   - if err != nil { + - + func (p *PostgresStorage) GetLatestIndexVx(ctx context.Context, dbTx pgx.Tx, indexFieldName string) (uint32, error) {
    - 1878 + + 96 +
    - - return nil, err + const getLatestIndexSQL = `SELECT max(%s) as %s FROM state.exit_root
    - 1879 + + 97 +
    -   - } + - + WHERE %s IS NOT NULL`
    - 1880 + + 98 +
    -   + - + sql := fmt.Sprintf(getLatestIndexSQL, indexFieldName, indexFieldName, indexFieldName) +
    +
    + 99 + +
    + -
    - 1881 + 100
      - log.Infof("loaded authorization for address: %v", auth.From.String()) + var l1InfoTreeIndex *uint32
    - 1882 + 101
      - etherMan.auth[auth.From] = auth + e := p.getExecQuerier(dbTx)
    - 1883 + 102
    - - return &auth, nil + err := e.QueryRow(ctx, sql).Scan(&l1InfoTreeIndex)
    - 1884 + 103
      - } + if err != nil {
    - 1885 + 104
      -
    + return 0, err
    - 1886 + 105
      - // newKeyFromKeystore creates an instance of a keystore key from a keystore file + }
    -
    @@ -1901,20 +1931,20 @@
    +
    @@ -110,17 +83,13 @@
    - 1901 + 110
    @@ -54754,7 +246536,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 1902 + 111
    @@ -54764,1086 +246546,1006 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 1903 + 112
      - // newAuthFromKeystore an authorization instance from a keystore file + func (p *PostgresStorage) GetL1InfoRootLeafByL1InfoRoot(ctx context.Context, l1InfoRoot common.Hash, dbTx pgx.Tx) (state.L1InfoTreeExitRootStorageEntry, error) {
    - 1904 + 113
    - - func newAuthFromKeystore(path, password string, chainID uint64) (bind.TransactOpts, error) { -
    -
    - 1905 - -
    -   - log.Infof("reading key from: %v", path) + return p.GetL1InfoRootLeafByL1InfoRootVx(ctx, l1InfoRoot, dbTx, l1InfoTreeIndexFieldName)
    - 1906 + + 114 +
    -   - key, err := newKeyFromKeystore(path, password) + - + }
    - 1907 + + 115 +
    -   - if err != nil { + - +
    - 1908 + + 116 +
    - - return bind.TransactOpts{}, err + func (p *PostgresStorage) GetL1InfoRootLeafByL1InfoRootVx(ctx context.Context, l1InfoRoot common.Hash, dbTx pgx.Tx, indexFieldName string) (state.L1InfoTreeExitRootStorageEntry, error) {
    - 1909 + + 117 +
    -   - } + - + const getL1InfoRootSQL = `SELECT block_num, timestamp, mainnet_exit_root, rollup_exit_root, global_exit_root, prev_block_hash, l1_info_root, %s
    - 1910 + 118
      - if key == nil { + FROM state.exit_root
    - 1911 + 119
    - - return bind.TransactOpts{}, nil -
    -
    - 1912 - -
    -   - } + WHERE %s IS NOT NULL AND l1_info_root=$1`
    - 1913 + + 120 +
    -   - auth, err := bind.NewKeyedTransactorWithChainID(key.PrivateKey, new(big.Int).SetUint64(chainID)) + - + sql := fmt.Sprintf(getL1InfoRootSQL, indexFieldName, indexFieldName)
    - 1914 + 121
      - if err != nil { -
    -
    - 1915 - -
    - - - return bind.TransactOpts{}, err + var entry state.L1InfoTreeExitRootStorageEntry
    - 1916 + 122
      - } + e := p.getExecQuerier(dbTx)
    - 1917 + 123
    - - return *auth, nil + err := e.QueryRow(ctx, sql, l1InfoRoot).Scan(&entry.BlockNumber, &entry.Timestamp, &entry.MainnetExitRoot, &entry.RollupExitRoot, &entry.GlobalExitRoot.GlobalExitRoot,
    - 1918 + 124
      - } + &entry.PreviousBlockHash, &entry.L1InfoTreeRoot, &entry.L1InfoTreeIndex)
    - 1919 + 125
      -
    + if !errors.Is(err, pgx.ErrNoRows) {
    - 1920 + 126
      - // getAuthByAddress tries to get an authorization from the authorizations map + return entry, err
    -
    @@ -1942,3 +1972,28 @@
    +
    @@ -129,17 +98,13 @@
    - 1942 + 129
      -
    + }
    - 1943 + 130
      - return *auth, nil +
    - 1944 + 131
      - } + func (p *PostgresStorage) GetL1InfoRootLeafByIndex(ctx context.Context, l1InfoTreeIndex uint32, dbTx pgx.Tx) (state.L1InfoTreeExitRootStorageEntry, error) {
    - + + 132 -
    -   -
    +
    +
    + - + return p.GetL1InfoRootLeafByIndexVx(ctx, l1InfoTreeIndex, dbTx, l1InfoTreeIndexFieldName)
    - + + 133 -
    -   -
    +
    +
    + - + }
    - + + 134 -
    -   +
    +
    + -
    - + + 135 -
    -   -
    +
    +
    + - + func (p *PostgresStorage) GetL1InfoRootLeafByIndexVx(ctx context.Context, l1InfoTreeIndex uint32, dbTx pgx.Tx, indexFieldName string) (state.L1InfoTreeExitRootStorageEntry, error) {
    - + + 136 -
    -   -
    +
    +
    + - + const getL1InfoRootByIndexSQL = `SELECT block_num, timestamp, mainnet_exit_root, rollup_exit_root, global_exit_root, prev_block_hash, l1_info_root, %s
    - + + 137 -
    +
    +
      -
    + FROM state.exit_root
    - + + 138 -
    -   -
    +
    +
    + - + WHERE %s = $1`
    - + + 139 -
    -   -
    +
    +
    + - + sql := fmt.Sprintf(getL1InfoRootByIndexSQL, indexFieldName, indexFieldName)
    - + + 140 -
    +
    +
      -
    + var entry state.L1InfoTreeExitRootStorageEntry
    - + + 141 -
    +
    +
      -
    + e := p.getExecQuerier(dbTx)
    - + + 142 -
    -   -
    +
    +
    + - + err := e.QueryRow(ctx, sql, l1InfoTreeIndex).Scan(&entry.BlockNumber, &entry.Timestamp, &entry.MainnetExitRoot, &entry.RollupExitRoot, &entry.GlobalExitRoot.GlobalExitRoot,
    - + + 143 -
    +
    +
      -
    + &entry.PreviousBlockHash, &entry.L1InfoTreeRoot, &entry.L1InfoTreeIndex)
    - + + 144 -
    +
    +
      -
    + if !errors.Is(err, pgx.ErrNoRows) {
    - + + 145 -
    +
    +
      -
    + return entry, err
    - - -
    -   -
    -
    +
    +
    @@ -148,18 +113,14 @@
    - + + 148 -
    +
    +
      -
    + }
    - + + 149 -
    +
    +
     
    - + + 150 -
    +
    +
      -
    + func (p *PostgresStorage) GetLeavesByL1InfoRoot(ctx context.Context, l1InfoRoot common.Hash, dbTx pgx.Tx) ([]state.L1InfoTreeExitRootStorageEntry, error) {
    - + + 151 -
    -   -
    +
    +
    + - + return p.GetLeavesByL1InfoRootVx(ctx, l1InfoRoot, dbTx, l1InfoTreeIndexFieldName)
    - + + 152 -
    -   -
    +
    +
    + - + }
    - + + 153 -
    -   +
    +
    + -
    - + + 154 -
    -   -
    +
    +
    + - + func (p *PostgresStorage) GetLeavesByL1InfoRootVx(ctx context.Context, l1InfoRoot common.Hash, dbTx pgx.Tx, indexFieldName string) ([]state.L1InfoTreeExitRootStorageEntry, error) {
    - + + 155 -
    +
    +
      -
    + // TODO: Optimize this query
    - + + 156 -
    -   -
    +
    +
    + - + const getLeavesByL1InfoRootSQL = `SELECT block_num, timestamp, mainnet_exit_root, rollup_exit_root, global_exit_root, prev_block_hash, l1_info_root, %s
    - + + 157 -
    +
    +
      -
    + FROM state.exit_root
    -
    + + + 158 + + +
    + - + WHERE %s IS NOT NULL AND %s <= (SELECT %s FROM state.exit_root WHERE l1_info_root=$1)
    -
    -
    - - - - - - - - - - - - + + +
    -
     
    - 3 + + 159 +
    -   - import ( + - + ORDER BY %s ASC`
    - 4 + + 160 +
    -   - "bytes" + - + sql := fmt.Sprintf(getLeavesByL1InfoRootSQL, indexFieldName, indexFieldName, indexFieldName, indexFieldName, indexFieldName)
    - 5 + 161
      - "context" + e := p.getExecQuerier(dbTx)
    - 6 + + 162 +
    - + - "crypto/ecdsa" + - + rows, err := e.Query(ctx, sql, l1InfoRoot)
    - 7 + 163
      - "encoding/json" + if err != nil {
    - 8 + 164
      - "errors" + return nil, err
    - 9 + 165
      - "fmt" + }
    +
    +
    +
    +
    + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -55853,247 +247555,222 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -56103,17 +247780,17 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -56202,113 +247879,108 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - + - - - - - - - - @@ -56352,133 +248024,138 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - + - + + - - - - - - @@ -56522,123 +248199,128 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - + - + + - - - - @@ -56683,592 +248365,815 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - + - - - - + + +
     
    - 109 + 3
      - // methodIDSequenceBatchesElderberry: MethodID for sequenceBatches in Elderberry + import (
    - 110 + 4
      - methodIDSequenceBatchesElderberry = []byte{0xde, 0xf5, 0x7e, 0x54} // 0xdef57e54 sequenceBatches((bytes,bytes32,uint64,bytes32)[],uint64,uint64,address) + "context"
    - 111 + 5
      -
    -
    -
    - 112 - -
    - + - // methodIDSequenceBatchesValidiumEtrog: MethodID for sequenceBatchesValidium in Etrog + "errors"
    - 113 + + -
    - + - methodIDSequenceBatchesValidiumEtrog = []byte{0x2d, 0x72, 0xc2, 0x48} // 0x2d72c248 sequenceBatchesValidium((bytes32,bytes32,uint64,bytes32)[],address,bytes) +
    +
    +   +
    - 114 + + 6 +
    - + - // methodIDSequenceBatchesValidiumElderberry: MethodID for sequenceBatchesValidium in Elderberry +   +
    - 115 + + 7 +
    - + - methodIDSequenceBatchesValidiumElderberry = []byte{0xdb, 0x5b, 0x0e, 0xd7} // 0xdb5b0ed7 sequenceBatchesValidium((bytes32,bytes32,uint64,bytes32)[],uint64,uint64,address,bytes) +   + "github.com/0xPolygonHermez/zkevm-node/state"
    - 116 + + 8 +
    - + -
    +   + "github.com/ethereum/go-ethereum/common"
    - 117 + 9
      - // ErrNotFound is used when the object is not found + "github.com/jackc/pgx/v4"
    - 118 + 10
      - ErrNotFound = errors.New("not found") + )
    - 119 + 11
      - // ErrIsReadOnlyMode is used when the EtherMan client is in read-only mode. +
    -
     
    -
    - 197 + + -
    +
    +
      - GlobalExitRootManager *polygonzkevmglobalexitroot.Polygonzkevmglobalexitroot +
    - 198 + + -
    +
    +
      - OldGlobalExitRootManager *oldpolygonzkevmglobalexitroot.Oldpolygonzkevmglobalexitroot +
    - 199 + + -
    +
    +
      - Pol *pol.Pol +
    - 200 + + -
    - + - DAProtocol *dataavailabilityprotocol.Dataavailabilityprotocol +
    +
    +   +
    - 201 + 12
      - SCAddresses []common.Address + // AddL1InfoRootToExitRoot adds a new entry in ExitRoot and returns index of L1InfoTree and error
    - 202 + 13
      -
    + func (p *PostgresStorage) AddL1InfoRootToExitRoot(ctx context.Context, exitRoot *state.L1InfoTreeExitRootStorageEntry, dbTx pgx.Tx) error {
    - 203 + + -
    +
    +
      - RollupID uint32 +
    -
     
    +
    + + +
    +   +
    +
    - 207 + + -
    +
    +
      - l1Cfg L1Config +
    - 208 + + -
    +
    +
      - cfg Config +
    - 209 + 14
      - auth map[common.Address]bind.TransactOpts // empty in case of read-only client + const addGlobalExitRootSQL = `
    - 210 + + 15 +
    + -
    + INSERT INTO state.exit_root(block_num, timestamp, mainnet_exit_root, rollup_exit_root, global_exit_root, prev_block_hash, l1_info_root, l1_info_tree_index)
    - 211 + + 16 +
    - + - da dataavailability.BatchDataProvider +   + VALUES ($1, $2, $3, $4, $5, $6, $7, $8);
    - 212 + 17
      - } + `
    - 213 + + -
    +
    +
     
    - 214 + 18
      - // NewClient creates a new etherman. + e := p.getExecQuerier(dbTx)
    - 215 + 19
    + - func NewClient(cfg Config, l1Config L1Config, da dataavailability.BatchDataProvider) (*Client, error) { + _, err := e.Exec(ctx, addGlobalExitRootSQL,
    - 216 + 20
      - // Connect to ethereum node + exitRoot.BlockNumber, exitRoot.Timestamp, exitRoot.MainnetExitRoot, exitRoot.RollupExitRoot,
    - 217 + 21
      - ethClient, err := ethclient.Dial(cfg.URL) + exitRoot.GlobalExitRoot.GlobalExitRoot, exitRoot.PreviousBlockHash, exitRoot.L1InfoTreeRoot, exitRoot.L1InfoTreeIndex)
    - 218 + 22
      - if err != nil { + return err
    -
     
    -
    - 255 + 23
      - log.Errorf("error creating NewPol client (%s). Error: %w", l1Config.PolAddr.String(), err) + }
    - 256 + 24
      - return nil, err +
    - 257 + 25
      - } -
    -
    - 258 - -
    - + - dapAddr, err := zkevm.DataAvailabilityProtocol(&bind.CallOpts{Pending: false}) -
    -
    - 259 - -
    - + - if err != nil { -
    -
    - 260 - -
    - + - return nil, err + func (p *PostgresStorage) GetAllL1InfoRootEntries(ctx context.Context, dbTx pgx.Tx) ([]state.L1InfoTreeExitRootStorageEntry, error) {
    - 261 + + 26 +
    + - } + const getL1InfoRootSQL = `SELECT block_num, timestamp, mainnet_exit_root, rollup_exit_root, global_exit_root, prev_block_hash, l1_info_root, l1_info_tree_index
    - 262 + + -
    - + - dap, err := dataavailabilityprotocol.NewDataavailabilityprotocol(dapAddr, ethClient) +
    +
    +   +
    - 263 + + -
    - + - if err != nil { +
    +
    +   +
    - 264 + + -
    - + - return nil, err +
    +
    +   +
    - 265 + + -
    - + - } +
    +
    +   +
    - 266 + 27
      - var scAddresses []common.Address + FROM state.exit_root
    - 267 + + 28 +
    -   - scAddresses = append(scAddresses, l1Config.ZkEVMAddr, l1Config.RollupManagerAddr, l1Config.GlobalExitRootManagerAddr) + + + WHERE l1_info_tree_index IS NOT NULL
    - 268 + + 29 +
    -   -
    + + + ORDER BY l1_info_tree_index`
    -
     
    -
    - 293 + 30
      - RollupManager: rollupManager, +
    - 294 + + -
    +
    +
      - Pol: pol, +
    - 295 + 31
      - GlobalExitRootManager: globalExitRoot, + e := p.getExecQuerier(dbTx)
    - 296 + + 32 +
    + - DAProtocol: dap, + rows, err := e.Query(ctx, getL1InfoRootSQL)
    - 297 + 33
      - OldGlobalExitRootManager: oldGlobalExitRoot, + if err != nil {
    - 298 + 34
      - SCAddresses: scAddresses, + return nil, err
    - 299 + 35
      - RollupID: rollupID, + }
    - 304 + 50
      - l1Cfg: l1Config, +
    - 305 + 51
      - cfg: cfg, + // GetLatestL1InfoRoot is used to get the latest L1InfoRoot
    - 306 + 52
      - auth: map[common.Address]bind.TransactOpts{}, + func (p *PostgresStorage) GetLatestL1InfoRoot(ctx context.Context, maxBlockNumber uint64) (state.L1InfoTreeExitRootStorageEntry, error) {
    - 307 + + 53 +
    + - da: da, + const getL1InfoRootSQL = `SELECT block_num, timestamp, mainnet_exit_root, rollup_exit_root, global_exit_root, prev_block_hash, l1_info_root, l1_info_tree_index
    - 308 + + -
    +
    +
    +   +
    +
    +
    + + +
      - }, nil +
    - 309 + + -
    +
    +
      - } +
    - 310 + + -
    +
    +
     
    - 311 + + -
    +
    +
      - // VerifyGenBlockNumber verifies if the genesis Block Number is valid +
    - 312 + 54
      - func (etherMan *Client) VerifyGenBlockNumber(ctx context.Context, genBlockNumber uint64) (bool, error) { + FROM state.exit_root
    - 313 + + 55 +
    + - // TODO: do not assume that only one rollup will be attached to the rollup manager in the same L1 block + WHERE l1_info_tree_index IS NOT NULL AND block_num <= $1
    - 314 + + 56 +
    -   - start := time.Now() + + + ORDER BY l1_info_tree_index DESC LIMIT 1`
    - 315 + + -
    +
    +
      - log.Info("Verifying genesis blockNumber: ", genBlockNumber) +
    - 316 + + -
    +
    +
      - // Filter query +
    -
     
    -
    - 366 + 57
      - log.Debug("Getting forkIDs from blockNumber: ", genBlockNumber) +
    - 367 + 58
      - start := time.Now() + entry := state.L1InfoTreeExitRootStorageEntry{}
    - 368 + 59
      - var logs []types.Log -
    -
    - 369 - -
    - +
    - 370 - -
    - + - if lastL1BlockSynced < genBlockNumber { -
    -
    - 371 - -
    - + - lastL1BlockSynced = genBlockNumber -
    -
    - 372 + + 60 +
    + - } + e := p.getExecQuerier(nil)
    - 373 + + 61 +
    + -
    + err := e.QueryRow(ctx, getL1InfoRootSQL, maxBlockNumber).Scan(&entry.BlockNumber, &entry.Timestamp, &entry.MainnetExitRoot, &entry.RollupExitRoot, &entry.GlobalExitRoot.GlobalExitRoot,
    - 374 + 62
      - log.Debug("Using ForkIDChunkSize: ", etherMan.cfg.ForkIDChunkSize) + &entry.PreviousBlockHash, &entry.L1InfoTreeRoot, &entry.L1InfoTreeIndex)
    - 375 + 63
      - for i := genBlockNumber; i <= lastL1BlockSynced; i = i + etherMan.cfg.ForkIDChunkSize + 1 { +
    - 376 + 64
      - final := i + etherMan.cfg.ForkIDChunkSize + if !errors.Is(err, pgx.ErrNoRows) {
    - 711 + 68
      - return etherMan.updateForkId(ctx, vLog, blocks, blocksOrder, addExistingRollup.LastVerifiedBatchBeforeUpgrade, addExistingRollup.ForkID, "", addExistingRollup.RollupID) + return entry, nil
    - 712 + 69
    @@ -56123,32 +247800,32 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 713 + 70
      -
    + func (p *PostgresStorage) GetLatestIndex(ctx context.Context, dbTx pgx.Tx) (uint32, error) {
    - 714 + 71
    + - func (etherMan *Client) updateEtrogSequence(_ context.Context, _ types.Log, _ *[]Block, _ *map[common.Hash][]Order) error { + const getLatestIndexSQL = `SELECT max(l1_info_tree_index) as l1_info_tree_index FROM state.exit_root
    - 715 + 72
    + - return errors.New("upgrading validiums to etrog not supported") + WHERE l1_info_tree_index IS NOT NULL`
    - + + 73 -
    +
    +
      -
    + var l1InfoTreeIndex *uint32
    - + + 74 -
    +
    +
      -
    + e := p.getExecQuerier(dbTx)
    - + + 75 -
    -   -
    +
    +
    + + + err := e.QueryRow(ctx, getLatestIndexSQL).Scan(&l1InfoTreeIndex)
    - + + 76 -
    +
    +
      -
    + if err != nil {
    - + + 77 -
    +
    +
      -
    + return 0, err
    - + + 78 -
    +
    +
      -
    + }
    - - -
    -   -
    -
    +
    +
     
    - + + 83 -
    +
    +
      -
    + }
    - + + 84 -
    +
    +
     
    - + + 85 -
    +
    +
      -
    + func (p *PostgresStorage) GetL1InfoRootLeafByL1InfoRoot(ctx context.Context, l1InfoRoot common.Hash, dbTx pgx.Tx) (state.L1InfoTreeExitRootStorageEntry, error) {
    - + + 86 -
    -   -
    +
    +
    + + + const getL1InfoRootSQL = `SELECT block_num, timestamp, mainnet_exit_root, rollup_exit_root, global_exit_root, prev_block_hash, l1_info_root, l1_info_tree_index
    - + + 87 -
    +
    +
      -
    + FROM state.exit_root
    - + + 88 -
    -   -
    +
    +
    + + + WHERE l1_info_tree_index IS NOT NULL AND l1_info_root=$1`
    - + + 89 -
    -   +
    +
    + +
    - + + 90 -
    +
    +
      -
    + var entry state.L1InfoTreeExitRootStorageEntry
    - + + 91 -
    +
    +
      -
    + e := p.getExecQuerier(dbTx)
    - + + 92 -
    -   -
    +
    +
    + + + err := e.QueryRow(ctx, getL1InfoRootSQL, l1InfoRoot).Scan(&entry.BlockNumber, &entry.Timestamp, &entry.MainnetExitRoot, &entry.RollupExitRoot, &entry.GlobalExitRoot.GlobalExitRoot,
    - + + 93 -
    +
    +
      -
    + &entry.PreviousBlockHash, &entry.L1InfoTreeRoot, &entry.L1InfoTreeIndex)
    - + + 94 -
    +
    +
      -
    + if !errors.Is(err, pgx.ErrNoRows) {
    - + + 95 -
    +
    +
      -
    + return entry, err
    - + +
     
    -
    +
    + 98 + +
      -
    + }
    - + + 99 -
    +
    +
     
    - + + 100 -
    +
    +
      -
    + func (p *PostgresStorage) GetL1InfoRootLeafByIndex(ctx context.Context, l1InfoTreeIndex uint32, dbTx pgx.Tx) (state.L1InfoTreeExitRootStorageEntry, error) {
    - + + 101 -
    -   -
    +
    +
    + + + const getL1InfoRootByIndexSQL = `SELECT block_num, timestamp, mainnet_exit_root, rollup_exit_root, global_exit_root, prev_block_hash, l1_info_root, l1_info_tree_index
    - + + 102 -
    +
    +
      -
    + FROM state.exit_root
    - + + 103 -
    -   -
    +
    +
    + + + WHERE l1_info_tree_index = $1`
    - + + 104 -
    -   +
    +
    + +
    - + + 105 -
    +
    +
      -
    + var entry state.L1InfoTreeExitRootStorageEntry
    - + + 106 -
    +
    +
      -
    + e := p.getExecQuerier(dbTx)
    - + + 107 -
    -   -
    +
    +
    + + + err := e.QueryRow(ctx, getL1InfoRootByIndexSQL, l1InfoTreeIndex).Scan(&entry.BlockNumber, &entry.Timestamp, &entry.MainnetExitRoot, &entry.RollupExitRoot, &entry.GlobalExitRoot.GlobalExitRoot,
    - + + 108 -
    +
    +
      -
    + &entry.PreviousBlockHash, &entry.L1InfoTreeRoot, &entry.L1InfoTreeIndex)
    - + + 109 -
    +
    +
      -
    + if !errors.Is(err, pgx.ErrNoRows) {
    - + + 110 -
    +
    +
      -
    + return entry, err
    - + +
     
    -
    +
    + 113 + +
      -
    + }
    - + + 114 -
    +
    +
     
    - + + 115 -
    +
    +
      -
    + func (p *PostgresStorage) GetLeavesByL1InfoRoot(ctx context.Context, l1InfoRoot common.Hash, dbTx pgx.Tx) ([]state.L1InfoTreeExitRootStorageEntry, error) {
    - 716 + 116
      - } + // TODO: Optimize this query
    - 717 + + 117 +
    -   -
    + + + const getLeafsByL1InfoRootSQL = `SELECT block_num, timestamp, mainnet_exit_root, rollup_exit_root, global_exit_root, prev_block_hash, l1_info_root, l1_info_tree_index
    - 718 + 118
      - func (etherMan *Client) initialSequenceBatches(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { + FROM state.exit_root
    -
     
    +
    + 119 + +
    + + + WHERE l1_info_tree_index IS NOT NULL AND l1_info_tree_index <= (SELECT l1_info_tree_index FROM state.exit_root WHERE l1_info_root=$1) +
    - 911 + + 120 +
    -   - } + + + ORDER BY l1_info_tree_index ASC`
    - 912 + + 121 +
    -   + +
    - 913 + 122
      - // EstimateGasSequenceBatches estimates gas for sending batches + e := p.getExecQuerier(dbTx)
    - 914 + 123
    + - func (etherMan *Client) EstimateGasSequenceBatches(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, lastSequencedBatchNumber uint64, l2Coinbase common.Address, dataAvailabilityMessage []byte) (*types.Transaction, error) { + rows, err := e.Query(ctx, getLeafsByL1InfoRootSQL, l1InfoRoot)
    - 915 + 124
      - opts, err := etherMan.getAuthByAddress(sender) + if err != nil {
    - 916 + 125
      - if err == ErrNotFound { + return nil, err
    - 917 + 126
      - return nil, ErrPrivateKeyNotFound + } +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/l1infotree_recursive.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - + + + + + + - - - - - - - - - - + - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + - - - - - - + + + + + + + + + - - - - + + + - - - - - - + - - - - + + + + + + + + + - - - - - + + + - + + +
    +
    @@ -1,46 +0,0 @@
    - 918 + + 1 +
    -   - } + - + package pgstatestorage
    - 919 + + 2 +
    -   - opts.NoSend = true + - +
    - 920 + + 3 +
    -   + - + import ( +
    +
    + 4 + +
    + - + "context" +
    +
    + 5 + +
    + -
    - 921 + + 6 +
    - + - tx, err := etherMan.sequenceBatches(opts, sequences, maxSequenceTimestamp, lastSequencedBatchNumber, l2Coinbase, dataAvailabilityMessage) + - + "github.com/0xPolygonHermez/zkevm-node/state"
    - 922 + + 7 +
    -   - if err != nil { + - + "github.com/jackc/pgx/v4"
    - 923 + + 8 +
    -   - return nil, err + - + )
    - 924 + + 9 +
    -   - } + - +
    -
     
    +
    + 10 + +
    + - + const ( +
    - 927 + + 11 +
    -   + - + l1InfoTreeRecursiveIndexFieldName = "l1_info_tree_recursive_index" +
    +
    + 12 + +
    + - + ) +
    +
    + 13 + +
    + - +
    +
    +
    + 14 + +
    + - + // AddL1InfoRootToExitRoot adds a new entry in ExitRoot and returns index of L1InfoTree and error +
    +
    + 15 + +
    + - + func (p *PostgresStorage) AddL1InfoTreeRecursiveRootToExitRoot(ctx context.Context, exitRoot *state.L1InfoTreeRecursiveExitRootStorageEntry, dbTx pgx.Tx) error { +
    +
    + 16 + +
    + - + exitRootOld := state.L1InfoTreeExitRootStorageEntry(*exitRoot) +
    +
    + 17 + +
    + - + return p.addL1InfoRootToExitRootVx(ctx, &exitRootOld, dbTx, l1InfoTreeRecursiveIndexFieldName) +
    +
    + 18 + +
    + - }
    - 928 + + 19 +
    -   + -
    - 929 + + 20 +
    -   - // BuildSequenceBatchesTxData builds a []bytes to be sent to the PoE SC method SequenceBatches. + - + func (p *PostgresStorage) GetAllL1InfoTreeRecursiveRootEntries(ctx context.Context, dbTx pgx.Tx) ([]state.L1InfoTreeRecursiveExitRootStorageEntry, error) {
    - 930 + + 21 +
    - + - func (etherMan *Client) BuildSequenceBatchesTxData(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, lastSequencedBatchNumber uint64, l2Coinbase common.Address, dataAvailabilityMessage []byte) (to *common.Address, data []byte, err error) { + - + res, err := p.GetAllL1InfoRootEntriesVx(ctx, dbTx, l1InfoTreeRecursiveIndexFieldName)
    - 931 + + 22 +
    -   - opts, err := etherMan.getAuthByAddress(sender) + - + if err != nil {
    - 932 + + 23 +
    -   - if err == ErrNotFound { + - + return nil, err
    - 933 + + 24 +
    -   - return nil, nil, fmt.Errorf("failed to build sequence batches, err: %w", ErrPrivateKeyNotFound) + - + }
    -
     
    +
    + 25 + +
    + - + var entries []state.L1InfoTreeRecursiveExitRootStorageEntry +
    - 938 + + 26 +
    -   - opts.GasLimit = uint64(1) + - + for _, entry := range res {
    - 939 + + 27 +
    -   - opts.GasPrice = big.NewInt(1) + - + entries = append(entries, state.L1InfoTreeRecursiveExitRootStorageEntry(entry))
    - 940 + + 28 +
    -   + - + } +
    +
    + 29 + +
    + - + return entries, nil +
    +
    + 30 + +
    + - + } +
    +
    + 31 + +
    + -
    - 941 + + 32 +
    - + - tx, err := etherMan.sequenceBatches(opts, sequences, maxSequenceTimestamp, lastSequencedBatchNumber, l2Coinbase, dataAvailabilityMessage) + - + func (p *PostgresStorage) GetLatestL1InfoTreeRecursiveRoot(ctx context.Context, maxBlockNumber uint64, dbTx pgx.Tx) (state.L1InfoTreeRecursiveExitRootStorageEntry, error) {
    - 942 + + 33 +
    -   + - + res, err := p.GetLatestL1InfoRootVx(ctx, maxBlockNumber, dbTx, l1InfoTreeRecursiveIndexFieldName) +
    +
    + 34 + +
    + - if err != nil {
    - 943 + + 35 +
    -   - return nil, nil, err + - + return state.L1InfoTreeRecursiveExitRootStorageEntry{}, err
    - 944 + + 36 +
    -   + - }
    -
     
    +
    + 37 + +
    + - + return state.L1InfoTreeRecursiveExitRootStorageEntry(res), nil +
    - 946 + + 38 +
    -   - return tx.To(), tx.Data(), nil + - + }
    - 947 + + 39 +
    -   + - +
    +
    +
    + 40 + +
    + - + func (p *PostgresStorage) GetLatestL1InfoTreeRecursiveIndex(ctx context.Context, dbTx pgx.Tx) (uint32, error) { +
    +
    + 41 + +
    + - + return p.GetLatestIndexVx(ctx, dbTx, l1InfoTreeRecursiveIndexFieldName) +
    +
    + 42 + +
    + - }
    - 948 + + 43 +
    -   + -
    - 949 + + 44 +
    - + - func (etherMan *Client) sequenceBatches(opts bind.TransactOpts, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, lastSequencedBatchNumber uint64, l2Coinbase common.Address, dataAvailabilityMessage []byte) (*types.Transaction, error) { + - + func (p *PostgresStorage) GetL1InfoRecursiveRootLeafByIndex(ctx context.Context, l1InfoTreeIndex uint32, dbTx pgx.Tx) (state.L1InfoTreeExitRootStorageEntry, error) {
    - 950 + + 45 + +
    + - + return p.GetL1InfoRootLeafByIndexVx(ctx, l1InfoTreeIndex, dbTx, l1InfoTreeIndexFieldName) +
    +
    + 46 +
    - + - var batches []polygonzkevm.PolygonValidiumEtrogValidiumBatchData + - + } +
    +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -57282,308 +249187,312 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +
    +
     
    - 951 + + -
    +
    +
      - for _, seq := range sequences { +
    - 952 + + -
    +
    +
      - var ger common.Hash +
    - 953 + + -
    +
    +
      - if seq.ForcedBatchTimestamp > 0 { +
    - 954 + + -
    +
    +
      - ger = seq.GlobalExitRoot +
    - 955 + + -
    +
    +
      - } +
    - 956 + + -
    - + - batch := polygonzkevm.PolygonValidiumEtrogValidiumBatchData{ +
    +
    +   +
    - 957 + + -
    - + - TransactionsHash: crypto.Keccak256Hash(seq.BatchL2Data), +
    +
    +   +
    - 958 + + -
    +
    +
      - ForcedGlobalExitRoot: ger, +
    - 959 + + -
    +
    +
      - ForcedTimestamp: uint64(seq.ForcedBatchTimestamp), +
    - 960 + + -
    +
    +
      - ForcedBlockHashL1: seq.PrevBlockHash, +
    -
     
    -
    - 963 + + -
    +
    +
      - batches = append(batches, batch) +
    - 964 + + -
    +
    +
      - } +
    - 965 + + -
    +
    +
     
    - 966 + + -
    - + - tx, err := etherMan.ZkEVM.SequenceBatchesValidium(&opts, batches, maxSequenceTimestamp, lastSequencedBatchNumber, l2Coinbase, dataAvailabilityMessage) +
    +
    +   +
    - 967 + + -
    +
    +
      - if err != nil { +
    - 968 + + -
    +
    +
      - log.Debugf("Batches to send: %+v", batches) +
    - 969 + + -
    +
    +
      - log.Debug("l2CoinBase: ", l2Coinbase) +
    -
     
    -
    - 1159 + + -
    +
    +
     
    - 1160 + + -
    +
    +
      - func (etherMan *Client) sequencedBatchesEvent(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error { +
    - 1161 + + -
    +
    +
      - log.Debugf("SequenceBatches event detected: txHash: %s", common.Bytes2Hex(vLog.TxHash[:])) +
    - 1162 + + -
    +
    +
     
    - 1163 + + -
    +
    +
      - sb, err := etherMan.ZkEVM.ParseSequenceBatches(vLog) +
    - 1164 + + -
    +
    +
      - if err != nil { +
    -
     
    -
    - 1182 + + -
    +
    +
      - if sb.NumBatch != 1 { +
    - 1183 + + -
    +
    +
      - methodId := tx.Data()[:4] +
    - 1184 + + -
    +
    +
      - log.Debugf("MethodId: %s", common.Bytes2Hex(methodId)) +
    - 1185 + + -
    - + - if bytes.Equal(methodId, methodIDSequenceBatchesEtrog) || +
    +
    +   +
    - 1186 + + -
    - + - bytes.Equal(methodId, methodIDSequenceBatchesValidiumEtrog) { +
    +
    +   +
    - 1187 + + -
    - + - sequences, err = decodeSequencesEtrog(tx.Data(), sb.NumBatch, msg.From, vLog.TxHash, msg.Nonce, sb.L1InfoRoot, etherMan.da) +
    +
    +   +
    - 1188 + + -
    +
    +
      - if err != nil { +
    - 1189 + + -
    +
    +
      - return fmt.Errorf("error decoding the sequences (etrog): %v", err) +
    - 1190 + + -
    +
    +
      - } +
    - 1191 + + -
    - + - } else if bytes.Equal(methodId, methodIDSequenceBatchesElderberry) || +
    +
    +   +
    - 1192 + + -
    - + - bytes.Equal(methodId, methodIDSequenceBatchesValidiumElderberry) { +
    +
    +   +
    - 1193 + + -
    - + - sequences, err = decodeSequencesElderberry(tx.Data(), sb.NumBatch, msg.From, vLog.TxHash, msg.Nonce, sb.L1InfoRoot, etherMan.da) +
    +
    +   +
    - 1194 + + -
    +
    +
      - if err != nil { +
    - 1195 + + -
    +
    +
      - return fmt.Errorf("error decoding the sequences (elderberry): %v", err) +
    - 1196 + + -
    +
    +
      - } +
    -
     
    -
    - 1276 + + -
    +
    +
      - return nil +
    - 1277 + + -
    +
    +
      - } +
    - 1278 + + -
    +
    +
     
    - 1279 + + -
    - + - func decodeSequencesElderberry(txData []byte, lastBatchNumber uint64, sequencer common.Address, txHash common.Hash, nonce uint64, l1InfoRoot common.Hash, da dataavailability.BatchDataProvider) ([]SequencedBatch, error) { +
    +
    +   +
    - 1280 + + -
    +
    +
      - // Extract coded txs. +
    - 1281 + + -
    +
    +
      - // Load contract ABI +
    - 1282 + + -
    +
    +
      - smcAbi, err := abi.JSON(strings.NewReader(polygonzkevm.PolygonzkevmABI)) +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/pgstatestorage.go + RENAMED + +
    +
    +
    +
    + + + - - - @@ -58027,243 +249936,163 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -58277,183 +250106,183 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -58487,418 +250316,422 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - + +
    -
     
    +
    @@ -355,3 +355,87 @@
    - 1284 + 355
      - return nil, err + }
    - 1285 + 356
      - } + return nativeBlockHashes, nil
    - 1286 + 357
      -
    -
    -
    - 1287 - -
    - + - return decodeSequencedBatches(smcAbi, txData, state.FORKID_ELDERBERRY, lastBatchNumber, sequencer, txHash, nonce, l1InfoRoot, da) + }
    - 1288 + + -
    +
    +
      - } +
    - 1289 + + -
    +
    +
     
    - 1290 - -
    - + - func decodeSequencesEtrog(txData []byte, lastBatchNumber uint64, sequencer common.Address, txHash common.Hash, nonce uint64, l1InfoRoot common.Hash, -
    -
    - 1291 - -
    - + - da dataavailability.BatchDataProvider) ([]SequencedBatch, error) { -
    -
    - 1292 + + -
    +
    +
      - // Extract coded txs. +
    - 1293 + + -
    +
    +
      - // Load contract ABI +
    - 1294 + + -
    +
    +
      - smcAbi, err := abi.JSON(strings.NewReader(etrogpolygonzkevm.EtrogpolygonzkevmABI)) +
    -
     
    -
    - 1296 + + -
    +
    +
      - return nil, err +
    - 1297 + + -
    +
    +
      - } +
    - 1298 + + -
    +
    +
     
    - 1299 - -
    - + - return decodeSequencedBatches(smcAbi, txData, state.FORKID_ETROG, lastBatchNumber, sequencer, txHash, nonce, l1InfoRoot, da) -
    -
    - 1300 - -
    - + - } -
    -
    - 1301 + + -
    - + +
    +
    +  
    - 1302 - -
    - + - // decodeSequencedBatches decodes provided data, based on the funcName, whether it is rollup or validium data and returns sequenced batches -
    -
    - 1303 - -
    - + - func decodeSequencedBatches(smcAbi abi.ABI, txData []byte, forkID uint64, lastBatchNumber uint64, -
    -
    - 1304 - -
    - + - sequencer common.Address, txHash common.Hash, nonce uint64, l1InfoRoot common.Hash, -
    -
    - 1305 + + -
    - + - da dataavailability.BatchDataProvider) ([]SequencedBatch, error) { +
    +
    +   +
    - 1306 + + -
    +
    +
      - // Recover Method from signature and ABI +
    - 1307 + + -
    +
    +
      - method, err := smcAbi.MethodById(txData[:4]) +
    - 1308 + + -
    +
    +
      - if err != nil { +
    -
     
    -
    - 1314 + + -
    +
    +
      - if err != nil { +
    - 1315 + + -
    +
    +
      - return nil, err +
    - 1316 + + -
    +
    +
      - } +
    - 1317 + + -
    +
    +
      - bytedata, err := json.Marshal(data[0]) +
    - 1318 + + -
    +
    +
      - if err != nil { +
    - 1319 + + -
    +
    +
      - return nil, err +
    - 1320 + + -
    +
    +
      - } +
    - 1321 + + -
    - + +
    +
    +  
    - 1322 + + -
    - + - var ( +
    +
    +   +
    - 1323 + + -
    - + - maxSequenceTimestamp uint64 +
    +
    +   +
    - 1324 + + -
    - + - initSequencedBatchNumber uint64 +
    +
    +   +
    - 1325 + + -
    - + - coinbase common.Address +
    +
    +   +
    - 1326 + + -
    - + - dataAvailabilityMsg []byte +
    +
    +   +
    - 1327 + + -
    - + - ) +
    +
    +   +
    - 1328 + + -
    - + +
    +
    +  
    - 1329 + + -
    - + - switch method.Name { +
    +
    +   +
    - 1330 + + -
    - + - case "sequenceBatches": +
    +
    +   +
    - 1331 + + -
    - + - var sequences []polygonzkevm.PolygonRollupBaseEtrogBatchData +
    +
    +   +
    - 1332 + + -
    - + - err := json.Unmarshal(bytedata, &sequences) +
    +
    +   +
    - 1333 + + -
    - + - if err != nil { +
    +
    +   +
    - 1334 + + -
    - + - return nil, err +
    +
    +   +
    - 1335 + + -
    +
    +
      - } +
    - 1336 + + -
    - + +
    +
    +  
    - 1337 - -
    - + - switch forkID { +
    +
    +
    +
    + + + + + - - - - + - - - - - - + +
    +
     
    - 1338 + + 355 +
    - + - case state.FORKID_ETROG: +   + }
    - 1339 +
    + 356 +
    - + - coinbase = data[1].(common.Address) +   + return nativeBlockHashes, nil
    - 1340 + + 357 +
    - + -
    +   + }
    - 1341 + 358
    + - case state.FORKID_ELDERBERRY: +
    - 1342 + 359
    + - maxSequenceTimestamp = data[1].(uint64) + // GetBatchL2DataByNumber returns the batch L2 data of the given batch number.
    - 1343 + 360
    + - initSequencedBatchNumber = data[2].(uint64) + func (p *PostgresStorage) GetBatchL2DataByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) ([]byte, error) {
    - 1344 + 361
    + - coinbase = data[3].(common.Address) + batchData, err := p.GetBatchL2DataByNumbers(ctx, []uint64{batchNumber}, dbTx)
    - 1345 + 362
    + - } + if err != nil {
    - 1346 + 363
    + -
    + return nil, err
    - 1347 + 364
    + - sequencedBatches := make([]SequencedBatch, len(sequences)) + }
    - 1348 + 365
    + - for i, seq := range sequences { + data, ok := batchData[batchNumber]
    - 1349 + 366
    + - bn := lastBatchNumber - uint64(len(sequences)-(i+1)) + if !ok {
    - 1350 + 367
    + - s := seq + return nil, state.ErrNotFound
    - 1351 + 368
    + - batch := SequencedBatch{ + }
    - 1352 + 369
    + - BatchNumber: bn, + return data, nil
    - 1353 + 370
    + - L1InfoRoot: &l1InfoRoot, + }
    - 1354 + 371
    + - SequencerAddr: sequencer, +
    - 1355 + 372
    + - TxHash: txHash, + // GetBatchL2DataByNumbers returns the batch L2 data of the given batch numbers. The data is a union of state.batch and state.forced_batch tables.
    - 1356 + 373
    + - Nonce: nonce, + func (p *PostgresStorage) GetBatchL2DataByNumbers(ctx context.Context, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error) {
    - 1357 + 374
    + - Coinbase: coinbase, + const sql = "SELECT batch_num, raw_txs_data FROM state.batch WHERE batch_num = ANY($1)"
    - 1358 + 375
    + - PolygonRollupBaseEtrogBatchData: &s, + return p.getBatchData(ctx, sql, batchNumbers, dbTx)
    - 1359 + 376
    + - } + }
    - 1360 + 377
    + - if forkID >= state.FORKID_ELDERBERRY { +
    - 1361 + 378
    + - batch.SequencedBatchElderberryData = &SequencedBatchElderberryData{ + // GetForcedBatchDataByNumbers returns the forced batch data of the given batch numbers
    - 1362 + 379
    + - MaxSequenceTimestamp: maxSequenceTimestamp, + func (p *PostgresStorage) GetForcedBatchDataByNumbers(ctx context.Context, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error) {
    - 1363 + 380
    + - InitSequencedBatchNumber: initSequencedBatchNumber, + const sql = "SELECT forced_batch_num, convert_from(decode(raw_txs_data, 'hex'), 'UTF8')::bytea FROM state.forced_batch WHERE forced_batch_num = ANY($1)"
    - 1364 + 381
    + - } + return p.getBatchData(ctx, sql, batchNumbers, dbTx)
    - 1365 + 382
    + - } + }
    - 1366 + 383
    + - sequencedBatches[i] = batch +
    - 1367 + 384
    + - } + func (p *PostgresStorage) getBatchData(ctx context.Context, sql string, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error) {
    - 1368 + 385
    + -
    + q := p.getExecQuerier(dbTx)
    - 1369 + 386
    + - return sequencedBatches, nil + rows, err := q.Query(ctx, sql, batchNumbers)
    - 1370 + 387
    + - case "sequenceBatchesValidium": + if errors.Is(err, pgx.ErrNoRows) {
    - 1371 + 388
    + - var sequencesValidium []polygonzkevm.PolygonValidiumEtrogValidiumBatchData + return p.GetBatchL2DataByNumbersFromBackup(ctx, batchNumbers, dbTx)
    - 1372 + 389
    + - err := json.Unmarshal(bytedata, &sequencesValidium) + } else if err != nil {
    - 1373 + 390
    + - if err != nil { + return nil, err
    - 1374 + 391
    + - return nil, err + }
    - 1375 + 392
    + - } + defer rows.Close()
    - 1376 + 393
    @@ -58908,47 +250741,47 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 1377 + 394
    + - switch forkID { + batchL2DataMap, err := readBatchDataResults(rows, batchNumbers)
    - 1378 + 395
    + - case state.FORKID_ETROG: + if err != nil {
    - 1379 + 396
    + - coinbase = data[1].(common.Address) + return nil, err
    - 1380 + 397
    + - dataAvailabilityMsg = data[2].([]byte) + }
    - 1381 + 398
    @@ -58958,67 +250791,67 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 1382 + 399
    + - case state.FORKID_ELDERBERRY: + if len(batchL2DataMap) == 0 {
    - 1383 + 400
    + - maxSequenceTimestamp = data[1].(uint64) + return p.GetBatchL2DataByNumbersFromBackup(ctx, batchNumbers, dbTx)
    - 1384 + 401
    + - initSequencedBatchNumber = data[2].(uint64) + }
    - 1385 + 402
    + - coinbase = data[3].(common.Address) +
    - 1386 + 403
    + - dataAvailabilityMsg = data[4].([]byte) + return batchL2DataMap, nil
    - 1387 + 404
    + - } + }
    - 1388 + 405
    @@ -59028,572 +250861,606 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 1389 + 406
    + - sequencedBatches := make([]SequencedBatch, len(sequencesValidium)) + // GetBatchL2DataByNumbersFromBackup returns the batch L2 data of the given batch number from the backup table
    - 1390 + 407
    + -
    + func (p *PostgresStorage) GetBatchL2DataByNumbersFromBackup(ctx context.Context, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error) {
    - 1391 + 408
    + - var ( + getBatchL2DataByBatchNumber := `
    - 1392 + 409
    + - batchNums []uint64 + SELECT batch_num, data FROM state.batch_data_backup
    - 1393 + 410
    + - hashes []common.Hash + WHERE batch_num = ANY($1)
    - 1394 + 411
    + - ) + ORDER BY created_at DESC
    - 1395 + 412
    + -
    + `
    - 1396 + 413
    + - for i, validiumData := range sequencesValidium { + q := p.getExecQuerier(dbTx)
    - 1397 + 414
    + - bn := lastBatchNumber - uint64(len(sequencesValidium)-(i+1)) + rows, err := q.Query(ctx, getBatchL2DataByBatchNumber, batchNumbers)
    - 1398 + 415
    + - batchNums = append(batchNums, bn) + if errors.Is(err, pgx.ErrNoRows) {
    - 1399 + 416
    + - hashes = append(hashes, validiumData.TransactionsHash) + return nil, state.ErrNotFound
    - 1400 + 417
    + - } + } else if err != nil {
    - 1401 + 418
    + - batchL2Data, err := da.GetBatchL2Data(batchNums, hashes, dataAvailabilityMsg) + return nil, err
    - 1402 + 419
    + - if err != nil { + }
    - 1403 + 420
    + - return nil, err + defer rows.Close()
    - 1404 + 421
    + - } +
    - 1405 + 422
    + - for i, bn := range batchNums { + return readBatchDataResults(rows, batchNumbers)
    - 1406 + 423
    + - s := polygonzkevm.PolygonRollupBaseEtrogBatchData{ + }
    - 1407 + 424
    + - Transactions: batchL2Data[i], +
    - 1408 + 425
    + - ForcedGlobalExitRoot: sequencesValidium[i].ForcedGlobalExitRoot, + // readBatchDataResults retrieves batch data from the provided result set
    - 1409 + 426
    + - ForcedTimestamp: sequencesValidium[i].ForcedTimestamp, + func readBatchDataResults(results pgx.Rows, batchNumbers []uint64) (map[uint64][]byte, error) {
    - 1410 + 427
    + - ForcedBlockHashL1: sequencesValidium[i].ForcedBlockHashL1, + batchL2DataMap := make(map[uint64][]byte, len(batchNumbers))
    - 1411 + 428
    + - } + for results.Next() {
    - 1412 + 429
    + - batch := SequencedBatch{ + var (
    - 1413 + 430
    + - BatchNumber: bn, + batchNum uint64
    - 1414 + 431
    + - L1InfoRoot: &l1InfoRoot, + batchL2Data []byte
    - 1415 + 432
    + - SequencerAddr: sequencer, + )
    - 1416 + 433
    + - TxHash: txHash, +
    - 1417 + 434
    + - Nonce: nonce, + if err := results.Scan(&batchNum, &batchL2Data); err != nil {
    - 1418 + 435
    + - Coinbase: coinbase, + return nil, err
    - 1419 + 436
    + - PolygonRollupBaseEtrogBatchData: &s, + }
    - 1420 + 437
    + - } + batchL2DataMap[batchNum] = batchL2Data
    - 1421 + 438
    + - if forkID >= state.FORKID_ELDERBERRY { + }
    - 1422 + 439
    + - elderberry := &SequencedBatchElderberryData{ +
    - 1423 + 440
    + - MaxSequenceTimestamp: maxSequenceTimestamp, + return batchL2DataMap, nil
    - 1424 + 441
    + - InitSequencedBatchNumber: initSequencedBatchNumber, + }
    - 1425 - -
    - + - } +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/pgstatestorage_test.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - -
    +
    @@ -110,11 +110,7 @@
    - 1426 + + 110 +
    - + - batch.SequencedBatchElderberryData = elderberry +   + if err != nil {
    - 1427 + + 111 +
    - + - } +   + panic(err)
    - 1428 + + 112 +
    - + - sequencedBatches[i] = batch +   + }
    - 1429 + + 113 +
    - + - } + - + mtr, err := l1infotree.NewL1InfoTreeRecursive(32)
    - 1430 + + 114 +
    - + - return sequencedBatches, nil + - + if err != nil {
    - 1431 + + 115 +
    -   - } + - + panic(err)
    - 1432 + + 116 +
    -   -
    + - + }
    - 1433 + + 117 +
    - + - return nil, fmt.Errorf("unexpected method called in sequence batches transaction: %s", method.RawName) + - + testState = state.NewState(stateCfg, pgstatestorage.NewPostgresStorage(stateCfg, stateDb), executorClient, stateTree, eventLog, mt, mtr)
    - 1434 + 118
      - } +
    - 1435 + 119
      -
    + result := m.Run()
    - 1436 + 120
      - func decodeSequencesPreEtrog(txData []byte, lastBatchNumber uint64, sequencer common.Address, txHash common.Hash, nonce uint64) ([]SequencedBatch, error) { +
    -
     
    +
    @@ -463,7 +459,7 @@
    - 1902 + 463
      - } + batchNumber := uint64(42)
    - 1903 + 464
      -
    + _, err = testState.Exec(ctx, "INSERT INTO state.batch (batch_num,wip) VALUES ($1, FALSE), ($2, FALSE), ($3, FALSE)", batchNumber, batchNumber+1, batchNumber+2)
    - 1904 + 465
      - // LoadAuthFromKeyStore loads an authorization from a key store file + require.NoError(err)
    - 1905 + + 466 +
    - + - func (etherMan *Client) LoadAuthFromKeyStore(path, password string) (*bind.TransactOpts, *ecdsa.PrivateKey, error) { + - + const addGeneratedProofSQL = "INSERT INTO state.batch_proof (batch_num, batch_num_final, proof, proof_id, input_prover, prover, prover_id, generating_since, created_at, updated_at) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)"
    - 1906 + + 467 +
    - + - auth, pk, err := newAuthFromKeystore(path, password, etherMan.l1Cfg.L1ChainID) +   + // proof with `generating_since` older than interval
    - 1907 + 468
      - if err != nil { + now := time.Now().Round(time.Microsecond)
    - 1908 + + 469 +
    - + - return nil, nil, err +   + oneHourAgo := now.Add(-time.Hour).Round(time.Microsecond) +
    +
    +
    @@ -500,10 +496,10 @@
    +
    + 500 + +
    +   + _, err = testState.Exec(ctx, addGeneratedProofSQL, olderNotGenProof.BatchNumber, olderNotGenProof.BatchNumberFinal, olderNotGenProof.Proof, olderNotGenProof.ProofID, olderNotGenProof.InputProver, olderNotGenProof.Prover, olderNotGenProof.ProverID, olderNotGenProof.GeneratingSince, oneHourAgo, oneHourAgo)
    - 1909 + 501
      - } + require.NoError(err)
    - 1910 + 502
    @@ -59601,698 +251468,654 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0


    + 503 + +
    + - + _, err = testState.CleanupLockedBatchProofs(ctx, "1m", nil) +
    +
    - 1911 + 504
      - log.Infof("loaded authorization for address: %v", auth.From.String()) +
    - 1912 + 505
      - etherMan.auth[auth.From] = auth + require.NoError(err)
    - 1913 + + 506 +
    - + - return &auth, pk, nil + - + rows, err := testState.Query(ctx, "SELECT batch_num, batch_num_final, proof, proof_id, input_prover, prover, prover_id, generating_since, created_at, updated_at FROM state.batch_proof")
    - 1914 + 507
      - } + require.NoError(err)
    - 1915 + 508
      -
    + proofs := make([]state.Proof, 0, len(rows.RawValues()))
    - 1916 + 509
      - // newKeyFromKeystore creates an instance of a keystore key from a keystore file + for rows.Next() {
    -
     
    +
    @@ -885,11 +881,7 @@
    - 1931 + 885
      - } + if err != nil {
    - 1932 + 886
      -
    + panic(err)
    - 1933 + 887
      - // newAuthFromKeystore an authorization instance from a keystore file + }
    - 1934 + + 888 +
    - + - func newAuthFromKeystore(path, password string, chainID uint64) (bind.TransactOpts, *ecdsa.PrivateKey, error) { + - + mtr, err := l1infotree.NewL1InfoTreeRecursive(32)
    - 1935 + + 889 +
    -   - log.Infof("reading key from: %v", path) + - + if err != nil {
    - 1936 + + 890 +
    -   - key, err := newKeyFromKeystore(path, password) + - + panic(err)
    - 1937 + + 891 +
    -   - if err != nil { + - + }
    - 1938 + + 892 +
    - + - return bind.TransactOpts{}, nil, err + - + testState = state.NewState(stateCfg, pgstatestorage.NewPostgresStorage(cfg, stateDb), executorClient, stateTree, nil, mt, mtr)
    - 1939 + 893
      - } +
    - 1940 + 894
      - if key == nil { + dbTx, err := testState.BeginStateTransaction(ctx)
    - 1941 + + 895 +
    - + - return bind.TransactOpts{}, nil, nil +   + require.NoError(t, err)
    +
    @@ -1086,11 +1078,7 @@
    +
    - 1942 + 1086
      - } + if err != nil {
    - 1943 + 1087
      - auth, err := bind.NewKeyedTransactorWithChainID(key.PrivateKey, new(big.Int).SetUint64(chainID)) + panic(err)
    - 1944 + 1088
      + } +
    +
    + 1089 + +
    + - + mtr, err := l1infotree.NewL1InfoTreeRecursive(32) +
    +
    + 1090 + +
    + - if err != nil {
    - 1945 + + 1091 +
    - + - return bind.TransactOpts{}, nil, err + - + panic(err)
    - 1946 + + 1092 +
    -   + - }
    - 1947 + + 1093 +
    - + - return *auth, key.PrivateKey, nil + - + testState = state.NewState(stateCfg, pgstatestorage.NewPostgresStorage(cfg, stateDb), executorClient, stateTree, nil, mt, mtr)
    - 1948 + 1094
      - } +
    - 1949 + 1095
      -
    + dbTx, err := testState.BeginStateTransaction(ctx)
    - 1950 + 1096
      - // getAuthByAddress tries to get an authorization from the authorizations map + require.NoError(t, err)
    -
     
    +
    @@ -1268,11 +1256,7 @@
    - 1972 + 1268
      -
    + if err != nil {
    - 1973 + 1269
      - return *auth, nil + panic(err)
    - 1974 + 1270
      - } + }
    - 1975 + + 1271 +
    - + -
    + - + mtr, err := l1infotree.NewL1InfoTreeRecursive(32)
    - 1976 + + 1272 +
    - + - // GetDAProtocolAddr returns the address of the data availability protocol + - + if err != nil {
    - 1977 + + 1273 +
    - + - func (etherMan *Client) GetDAProtocolAddr() (common.Address, error) { + - + panic(err)
    - 1978 + + 1274 +
    - + - return etherMan.ZkEVM.DataAvailabilityProtocol(&bind.CallOpts{Pending: false}) + - + }
    - 1979 + + 1275 +
    - + - } + - + testState = state.NewState(stateCfg, pgstatestorage.NewPostgresStorage(cfg, stateDb), executorClient, stateTree, nil, mt, mtr)
    - 1980 + + 1276 +
    - + +  
    - 1981 - -
    - + - // GetDAProtocolName returns the name of the data availability protocol -
    -
    - 1982 - -
    - + - func (etherMan *Client) GetDAProtocolName() (string, error) { -
    -
    - 1983 - -
    - + - return etherMan.DAProtocol.GetProcotolName(&bind.CallOpts{Pending: false}) -
    -
    - 1984 - -
    - + - } -
    -
    - 1985 + + 1277 +
    - + -
    +   + dbTx, err := testState.BeginStateTransaction(ctx)
    - 1986 + + 1278 +
    - + - // SetDataAvailabilityProtocol sets the address for the new data availability protocol +   + require.NoError(t, err)
    - 1987 - -
    - + - func (etherMan *Client) SetDataAvailabilityProtocol(from, daAddress common.Address) (*types.Transaction, error) { -
    +
    +
    @@ -1387,6 +1371,108 @@
    - 1988 + + 1387 +
    - + - auth, err := etherMan.getAuthByAddress(from) +   + require.NoError(t, dbTx.Commit(ctx))
    - 1989 + + 1388 +
    - + - if err != nil { +   + }
    - 1990 + + 1389 +
    - + - return nil, err +   +
    - 1991 + + -
    - + - } +
    +
    +   +
    - 1992 + + -
    - + +
    +
    +  
    - 1993 + + -
    - + - return etherMan.ZkEVM.SetDataAvailabilityProtocol(&auth, daAddress) +
    +
    +   +
    - 1994 + + -
    - + - } +
    +
    +   +
    - 1995 + + -
    - + +
    +
    +  
    - 1996 + + -
    - + - // GetRollupId returns the rollup id +
    +
    +   +
    - 1997 + + -
    - + - func (etherMan *Client) GetRollupId() uint32 { +
    +
    +   +
    - 1998 + + -
    - + - return etherMan.RollupID +
    +
    +   +
    - 1999 - -
    - + - } -
    +
    +
    -
    + +
    +   +
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/etherman_test.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -60306,548 +252129,523 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -60861,23 +252659,23 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - @@ -60931,203 +252729,203 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - @@ -61142,202 +252940,187 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +
    -
    @@ -38,7 +38,7 @@
    - 38 + + -
    +
    +
      - } +
    - 39 + + -
    +
    +
     
    - 40 + + -
    +
    +
      - // This function prepare the blockchain, the wallet with funds and deploy the smc +
    - 41 + + -
    - - - func newTestingEnv() (ethman *Client, ethBackend *simulated.Backend, auth *bind.TransactOpts, polAddr common.Address, br *polygonzkevmbridge.Polygonzkevmbridge) { +
    +
    +   +
    - 42 + + -
    +
    +
      - privateKey, err := crypto.GenerateKey() +
    - 43 + + -
    +
    +
      - if err != nil { +
    - 44 + + -
    +
    +
      - log.Fatal(err) -
    -
    -
    @@ -47,7 +47,8 @@
    +
    +
    - 47 + + -
    +
    +
      - if err != nil { +
    - 48 + + -
    +
    +
      - log.Fatal(err) +
    - 49 + + -
    +
    +
      - } +
    - 50 + + -
    - - - ethman, ethBackend, polAddr, br, err = NewSimulatedEtherman(Config{ForkIDChunkSize: 10}, auth) +
    +
    +   +
    - 51 + + -
    +
    +
      - if err != nil { +
    - 52 + + -
    +
    +
      - log.Fatal(err) +
    - 53 + + -
    +
    +
      - } +
    -
    @@ -55,12 +56,12 @@
    -
    - 55 + + -
    +
    +
      - if err != nil { +
    - 56 + + -
    +
    +
      - log.Fatal(err) +
    - 57 + + -
    +
    +
      - } +
    - 58 + + -
    - - - return ethman, ethBackend, auth, polAddr, br +
    +
    +   +
    - 59 + + -
    +
    +
      - } +
    - 60 + + -
    +
    +
     
    - 61 + + -
    +
    +
      - func TestGEREvent(t *testing.T) { +
    - 62 + + -
    +
    +
      - // Set up testing environment +
    - 63 + + -
    - - - etherman, ethBackend, auth, _, br := newTestingEnv() +
    +
    +   +
    - 64 + + -
    +
    +
     
    - 65 + + -
    +
    +
      - // Read currentBlock +
    - 66 + + -
    +
    +
      - ctx := context.Background() +
    -
    @@ -82,14 +83,14 @@
    -
    - 82 + + -
    +
    +
      - blocks, _, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber) +
    - 83 + + -
    +
    +
      - require.NoError(t, err) +
    - 84 + + -
    +
    +
      - t.Logf("Blocks: %+v", blocks) +
    - 85 + + -
    - - - assert.Equal(t, uint64(8), blocks[0].L1InfoTree[0].BlockNumber) +
    +
    +   +
    - 86 + + -
    +
    +
      - assert.NotEqual(t, common.Hash{}, blocks[0].L1InfoTree[0].MainnetExitRoot) +
    - 87 + + -
    +
    +
      - assert.Equal(t, common.Hash{}, blocks[0].L1InfoTree[0].RollupExitRoot) +
    - 88 + + -
    +
    +
      - } +
    - 89 + + -
    +
    +
     
    - 90 + + -
    +
    +
      - func TestForcedBatchEvent(t *testing.T) { +
    - 91 + + -
    +
    +
      - // Set up testing environment +
    - 92 + + -
    - - - etherman, ethBackend, auth, _, _ := newTestingEnv() +
    +
    +   +
    - 93 + + -
    +
    +
     
    - 94 + + -
    +
    +
      - // Read currentBlock +
    - 95 + + -
    +
    +
      - ctx := context.Background() +
    -
    @@ -114,8 +115,8 @@
    -
    - 114 + + -
    +
    +
      - blocks, _, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber) +
    - 115 + + -
    +
    +
      - require.NoError(t, err) +
    - 116 + + -
    +
    +
      - t.Logf("Blocks: %+v", blocks) +
    - 117 + + -
    - - - assert.Equal(t, uint64(8), blocks[0].BlockNumber) +
    +
    +   +
    - 118 + + -
    - - - assert.Equal(t, uint64(8), blocks[0].ForcedBatches[0].BlockNumber) +
    +
    +   +
    - 119 + + -
    +
    +
      - assert.NotEqual(t, common.Hash{}, blocks[0].ForcedBatches[0].GlobalExitRoot) +
    - 120 + + -
    +
    +
      - assert.NotEqual(t, time.Time{}, blocks[0].ForcedBatches[0].ForcedAt) +
    - 121 + + -
    +
    +
      - assert.Equal(t, uint64(1), blocks[0].ForcedBatches[0].ForcedBatchNumber) +
    -
    @@ -125,7 +126,7 @@
    -
    - 125 + + -
    +
    +
     
    - 126 + + -
    +
    +
      - func TestSequencedBatchesEvent(t *testing.T) { +
    - 127 + + -
    +
    +
      - // Set up testing environment +
    - 128 + + -
    - - - etherman, ethBackend, auth, _, br := newTestingEnv() +
    +
    +   +
    - 129 + + -
    +
    +
     
    - 130 + + -
    +
    +
      - // Read currentBlock +
    - 131 + + -
    +
    +
      - ctx := context.Background() +
    -
    @@ -156,13 +157,19 @@
    -
    - 156 + + -
    +
    +
      - blocks, _, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &currentBlockNumber) +
    - 157 + + -
    +
    +
      - require.NoError(t, err) +
    - 158 + + -
    +
    +
      - t.Log("Blocks: ", blocks) +
    - 159 + + -
    - - - var sequences []polygonzkevm.PolygonRollupBaseEtrogBatchData +
    +
    +   +
    - 160 + + -
    - - - sequences = append(sequences, polygonzkevm.PolygonRollupBaseEtrogBatchData{ +
    +
    +   +
    - 161 + + -
    - - - Transactions: common.Hex2Bytes(rawTxs), +
    +
    +   +
    - 162 + + -
    - - - }, polygonzkevm.PolygonRollupBaseEtrogBatchData{ +
    +
    +   +
    - 163 + + -
    - - - Transactions: common.Hex2Bytes(rawTxs), +
    +
    +   +
    - 164 + + -
    +
    +
      - }) +
    - 165 + + -
    - - - _, err = etherman.ZkEVM.SequenceBatches(auth, sequences, uint64(time.Now().Unix()), uint64(1), auth.From) +
    +
    +   +
    - 166 + + -
    +
    +
      - require.NoError(t, err) +
    - 167 + + -
    +
    +
     
    - 168 + + -
    +
    +
      - // Mine the tx in a block +
    -
    @@ -188,7 +195,7 @@
    -
    - 188 + + -
    +
    +
     
    - 189 + + -
    +
    +
      - func TestVerifyBatchEvent(t *testing.T) { +
    - 190 + + -
    +
    +
      - // Set up testing environment +
    - 191 + + -
    - - - etherman, ethBackend, auth, _, _ := newTestingEnv() +
    +
    +   +
    - 192 + + -
    +
    +
     
    - 193 + + -
    +
    +
      - // Read currentBlock +
    - 194 + + -
    +
    +
      - ctx := context.Background() +
    -
    @@ -197,12 +204,13 @@
    +
    + + +
    +   +
    +
    - 197 + + -
    +
    +
      - require.NoError(t, err) +
    - 198 + + -
    +
    +
     
    - 199 + + -
    +
    +
      - rawTxs := "f84901843b9aca00827b0c945fbdb2315678afecb367f032d93f642f64180aa380a46057361d00000000000000000000000000000000000000000000000000000000000000048203e9808073efe1fa2d3e27f26f32208550ea9b0274d49050b816cadab05a771f4275d0242fd5d92b3fb89575c070e6c930587c520ee65a3aa8cfe382fcad20421bf51d621c" +
    - 200 + + -
    - - - tx := polygonzkevm.PolygonRollupBaseEtrogBatchData{ +
    +
    +   +
    - 201 + + -
    - - - Transactions: common.Hex2Bytes(rawTxs), +
    +
    +   +
    - 202 + + -
    +
    +
      - } +
    - 203 + + -
    - - - //TODO: Fix params +
    +
    +   +
    - 204 + + -
    - - - _, err = etherman.ZkEVM.SequenceBatches(auth, []polygonzkevm.PolygonRollupBaseEtrogBatchData{tx}, uint64(time.Now().Unix()), uint64(1), auth.From) +
    +
    +   +
    - 205 + + -
    +
    +
      - require.NoError(t, err) +
    - 206 + 1390
      -
    + func createL1InfoTreeExitRootStorageEntryForTest(blockNumber uint64, index uint32) *state.L1InfoTreeExitRootStorageEntry {
    - 207 + 1391
      - // Mine the tx in a block + exitRoot := state.L1InfoTreeExitRootStorageEntry{
    - 208 + 1392
      - ethBackend.Commit() + L1InfoTreeLeaf: state.L1InfoTreeLeaf{
    -
    @@ -220,7 +228,7 @@
    +
    @@ -1588,6 +1674,13 @@
    - 220 + 1588
      - blocks, order, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber) + require.Equal(t, uint64(2002), fb.BlockNumber)
    - 221 + 1589
      - require.NoError(t, err) + require.Equal(t, "0x717e05de47a87a7d1679e183f1c224150675f6302b7da4eaab526b2b91ae0761", fb.GlobalExitRoot.String())
    - 222 + 1590
      - t.Logf("Blocks: %+v, \nOrder: %+v", blocks, order) -
    -
    - 223 - -
    - - - assert.Equal(t, uint64(9), blocks[1].BlockNumber) + require.Equal(t, []byte{0xb}, fb.RawTxsData)
    - 224 + + -
    +
    +
      - assert.Equal(t, uint64(1), blocks[1].VerifiedBatches[0].BatchNumber) +
    - 225 + + -
    +
    +
      - assert.NotEqual(t, common.Address{}, blocks[1].VerifiedBatches[0].Aggregator) +
    - 226 + + -
    +
    +
      - assert.NotEqual(t, common.Hash{}, blocks[1].VerifiedBatches[0].TxHash) +
    -
    @@ -232,7 +240,7 @@
    -
    - 232 + + -
    +
    +
     
    - 233 + + -
    +
    +
      - func TestSequenceForceBatchesEvent(t *testing.T) { +
    - 234 + + -
    +
    +
      - // Set up testing environment +
    - 235 + + -
    - - - etherman, ethBackend, auth, _, _ := newTestingEnv() +
    +
    +   +
    - 236 + 1591
      -
    + }
    - 237 + 1592
      - // Read currentBlock +
    - 238 + 1593
      - ctx := context.Background() + func TestGetLastGER(t *testing.T) {
    -
    @@ -283,7 +291,7 @@
    +
    @@ -1664,49 +1757,6 @@
    - 283 + 1664
      - blocks, order, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber) + ger, err = testState.GetLatestBatchGlobalExitRoot(ctx, dbTx)
    - 284 + 1665
    @@ -61347,706 +253130,671 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 285 + 1666
      - t.Logf("Blocks: %+v", blocks) + require.Equal(t, common.HexToHash("0x2").String(), ger.String())
    - 286 + + 1667 +
    - - assert.Equal(t, uint64(12), blocks[1].BlockNumber) -
    -
    - 287 - -
    -   - assert.Equal(t, uint64(2), blocks[1].SequencedForceBatches[0][0].BatchNumber) +
    - 288 + + 1668 +
    -   - assert.Equal(t, forcedGer, common.BytesToHash(blocks[1].SequencedForceBatches[0][0].ForcedGlobalExitRoot[:])) + - + }
    - 289 + + 1669 +
    -   - assert.Equal(t, forcedTimestamp, blocks[1].SequencedForceBatches[0][0].ForcedTimestamp) + - +
    -
    @@ -293,7 +301,7 @@
    -
    - 293 + + 1670 +
    -   -
    + - + func TestAddBlobSequence(t *testing.T) {
    - 294 + + 1671 +
    -   - func TestSendSequences(t *testing.T) { + - + initOrResetDB()
    - 295 + + 1672 +
    -   - // Set up testing environment + - + ctx := context.Background()
    - 296 + + 1673 +
    - - etherman, ethBackend, auth, _, br := newTestingEnv() + dbTx, err := testState.BeginStateTransaction(ctx)
    - 297 + + 1674 +
    -   -
    + - + require.NoError(t, err)
    - 298 + + 1675 +
    -   - // Read currentBlock + - + defer func() { require.NoError(t, dbTx.Commit(ctx)) }()
    - 299 + + 1676 +
    -   - ctx := context.Background() + - +
    -
    @@ -315,10 +323,11 @@
    -
    - 315 + + 1677 +
    -   - BatchL2Data: batchL2Data, + - + block := state.NewBlock(100)
    - 316 + + 1678 +
    -   - LastL2BLockTimestamp: time.Now().Unix(), + - + err = testState.AddBlock(ctx, block, dbTx)
    - 317 + + 1679 +
    -   - } + - + require.NoError(t, err)
    - + + 1680 -
    -   +
    +
    + -
    - 318 + + 1681 +
    -   - lastL2BlockTStamp := tx1.Time().Unix() + - + blobSeq := state.BlobSequence{
    - 319 + + 1682 +
    - - // TODO: fix params + BlobSequenceIndex: 1,
    - 320 + 1683
    - - tx, err := etherman.sequenceBatches(*auth, []ethmanTypes.Sequence{sequence}, uint64(lastL2BlockTStamp), uint64(1), auth.From) + BlockNumber: 100,
    - 321 + + 1684 +
    -   - require.NoError(t, err) + - + }
    - + + 1685 -
    -   -
    +
    +
    + - + err = testState.AddBlobSequence(ctx, &blobSeq, dbTx)
    - 322 + + 1686 +
    -   - log.Debug("TX: ", tx.Hash()) + - + require.NoError(t, err)
    - 323 + + 1687 +
    -   - ethBackend.Commit() + - + }
    - 324 + + 1688 +
    -   + -
    -
    @@ -341,7 +350,7 @@
    -
    - 341 + + 1689 +
    -   -
    + - + func TestStoreBlobInner(t *testing.T) {
    - 342 + + 1690 +
    -   - func TestGasPrice(t *testing.T) { + - + initOrResetDB()
    - 343 + + 1691 +
    -   - // Set up testing environment + - + ctx := context.Background()
    - 344 + + 1692 +
    - - etherman, _, _, _, _ := newTestingEnv() + dbTx, err := testState.BeginStateTransaction(ctx)
    - 345 + + 1693 +
    -   - etherscanM := new(etherscanMock) + - + require.NoError(t, err)
    - 346 + + 1694 +
    -   - ethGasStationM := new(ethGasStationMock) + - + defer func() { require.NoError(t, dbTx.Commit(ctx)) }()
    - 347 + + 1695 +
    -   - etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, etherscanM, ethGasStationM} + - + block := state.NewBlock(100)
    -
    @@ -360,14 +369,14 @@
    -
    - 360 + + 1696 +
    -   -
    + - + err = testState.AddBlock(ctx, block, dbTx)
    - 361 + + 1697 +
    -   - func TestErrorEthGasStationPrice(t *testing.T) { + - + require.NoError(t, err)
    - 362 + + 1698 +
    -   - // Set up testing environment + - +
    - 363 + + 1699 +
    - - etherman, _, _, _, _ := newTestingEnv() + blobSeq := state.BlobSequence{
    - 364 + + 1700 +
    -   - ethGasStationM := new(ethGasStationMock) + - + BlobSequenceIndex: 1,
    - 365 + + 1701 +
    -   - etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, ethGasStationM} + - + BlockNumber: 100,
    - 366 + + 1702 +
    -   - ctx := context.Background() + - + }
    - 367 + + 1703 +
    -   -
    + - + err = testState.AddBlobSequence(ctx, &blobSeq, dbTx)
    - 368 + + 1704 +
    -   - ethGasStationM.On("SuggestGasPrice", ctx).Return(big.NewInt(0), fmt.Errorf("error getting gasPrice from ethGasStation")) + - + require.NoError(t, err)
    - 369 + + 1705 +
    -   - gp := etherman.GetL1GasPrice(ctx) + - + blobInner := state.BlobInner{
    - 370 + + 1706 +
    - - assert.Equal(t, big.NewInt(1392695906), gp) + BlobSequenceIndex: 1,
    - 371 + + 1707 +
    -   -
    + - + }
    - 372 + + 1708 +
    -   - etherscanM := new(etherscanMock) + - + err = testState.AddBlobInner(ctx, &blobInner, dbTx)
    - 373 + + 1709 +
    -   - etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, etherscanM, ethGasStationM} + - + require.NoError(t, err)
    -
    @@ -379,7 +388,7 @@
    -
    - 379 + 1710
      -
    + }
    - 380 + 1711
      - func TestErrorEtherScanPrice(t *testing.T) { +
    - 381 + 1712
      - // Set up testing environment + func TestGetFirstUncheckedBlock(t *testing.T) {
    - 382 - -
    - - - etherman, _, _, _, _ := newTestingEnv() +
    +
    +
    +
    + + + + + - - + - - - - - - - - - - -
    +
     
    - 383 + 110
      - etherscanM := new(etherscanMock) + if err != nil {
    - 384 + 111
      - ethGasStationM := new(ethGasStationMock) + panic(err)
    - 385 + 112
      - etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, etherscanM, ethGasStationM} + }
    -
    @@ -393,7 +402,7 @@
    +
    + 113 + +
    + + + testState = state.NewState(stateCfg, pgstatestorage.NewPostgresStorage(stateCfg, stateDb), executorClient, stateTree, eventLog, mt) +
    - 393 + + -
    +
    +
     
    - 394 + + -
    +
    +
      - func TestGetForks(t *testing.T) { +
    - 395 + + -
    +
    +
      - // Set up testing environment +
    - 396 + + -
    - - - etherman, _, _, _, _ := newTestingEnv() +
    +
    +   +
    - 397 + 114
      - ctx := context.Background() +
    - 398 + 115
      - forks, err := etherman.GetForks(ctx, 0, 132) + result := m.Run()
    - 399 + 116
      - require.NoError(t, err) +
    -
    -
    -
    -
    - - - + @@ -62056,82 +253804,102 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - + + + + + + @@ -62141,7 +253909,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - @@ -62266,227 +254024,227 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - + + + - - - - - - - - - - - - - @@ -62496,1302 +254254,1253 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - + - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - + - - -
     
    - 38 + 459
      - } + batchNumber := uint64(42)
    - 39 + 460
      -
    + _, err = testState.Exec(ctx, "INSERT INTO state.batch (batch_num,wip) VALUES ($1, FALSE), ($2, FALSE), ($3, FALSE)", batchNumber, batchNumber+1, batchNumber+2)
    - 40 + 461
      - // This function prepare the blockchain, the wallet with funds and deploy the smc + require.NoError(err)
    - 41 + 462
    + - func newTestingEnv(t *testing.T) (ethman *Client, ethBackend *simulated.Backend, auth *bind.TransactOpts, polAddr common.Address, br *polygonzkevmbridge.Polygonzkevmbridge, da *daMock) { + const addGeneratedProofSQL = "INSERT INTO state.proof (batch_num, batch_num_final, proof, proof_id, input_prover, prover, prover_id, generating_since, created_at, updated_at) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)"
    - 42 + 463
      - privateKey, err := crypto.GenerateKey() + // proof with `generating_since` older than interval
    - 43 + 464
      - if err != nil { + now := time.Now().Round(time.Microsecond)
    - 44 + 465
      - log.Fatal(err) + oneHourAgo := now.Add(-time.Hour).Round(time.Microsecond)
    - 47 + 496
      - if err != nil { + _, err = testState.Exec(ctx, addGeneratedProofSQL, olderNotGenProof.BatchNumber, olderNotGenProof.BatchNumberFinal, olderNotGenProof.Proof, olderNotGenProof.ProofID, olderNotGenProof.InputProver, olderNotGenProof.Prover, olderNotGenProof.ProverID, olderNotGenProof.GeneratingSince, oneHourAgo, oneHourAgo)
    - 48 + 497
      - log.Fatal(err) + require.NoError(err)
    - 49 + 498
      - } +
    - 50 + 499
    + - da = newDaMock(t) + _, err = testState.CleanupLockedProofs(ctx, "1m", nil)
    - 51 + + 500 + +
    +   +
    +
    +
    + 501 + +
    +   + require.NoError(err) +
    +
    + 502 +
    + - ethman, ethBackend, polAddr, br, err = NewSimulatedEtherman(Config{ForkIDChunkSize: 10}, auth, da) + rows, err := testState.Query(ctx, "SELECT batch_num, batch_num_final, proof, proof_id, input_prover, prover, prover_id, generating_since, created_at, updated_at FROM state.proof")
    - 52 + 503
      - if err != nil { + require.NoError(err)
    - 53 + 504
      - log.Fatal(err) + proofs := make([]state.Proof, 0, len(rows.RawValues()))
    - 54 + 505
      - } + for rows.Next() {
    - 56 + 881
    @@ -62151,17 +253919,17 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 57 + 882
      - log.Fatal(err) + panic(err)
    - 58 + 883
    @@ -62171,67 +253939,57 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 59 + 884
    + - return ethman, ethBackend, auth, polAddr, br, da + testState = state.NewState(stateCfg, pgstatestorage.NewPostgresStorage(cfg, stateDb), executorClient, stateTree, nil, mt)
    - 60 + + -
    +
    +
      - } +
    - 61 + + -
    +
    +
     
    - 62 + + -
    +
    +
      - func TestGEREvent(t *testing.T) { +
    - 63 + + -
    +
    +
      - // Set up testing environment -
    -
    - 64 - -
    - + - etherman, ethBackend, auth, _, br, _ := newTestingEnv(t) +
    - 65 + 885
    @@ -62241,22 +253999,22 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 66 + 886
      - // Read currentBlock + dbTx, err := testState.BeginStateTransaction(ctx)
    - 67 + 887
      - ctx := context.Background() + require.NoError(t, err)
    - 83 + 1078
      - blocks, _, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber) + if err != nil {
    - 84 + 1079
      - require.NoError(t, err) + panic(err)
    - 85 + 1080
      - t.Logf("Blocks: %+v", blocks) + }
    - 86 + 1081
    + - assert.Equal(t, uint64(11), blocks[0].L1InfoTree[0].BlockNumber) + testState = state.NewState(stateCfg, pgstatestorage.NewPostgresStorage(cfg, stateDb), executorClient, stateTree, nil, mt)
    - 87 + + -
    +
    +
      - assert.NotEqual(t, common.Hash{}, blocks[0].L1InfoTree[0].MainnetExitRoot) +
    - 88 + + -
    +
    +
      - assert.Equal(t, common.Hash{}, blocks[0].L1InfoTree[0].RollupExitRoot) +
    - 89 + + -
    +
    +
      - } +
    - 90 + + -
    +
    +
     
    - 91 + 1082
      - func TestForcedBatchEvent(t *testing.T) { +
    - 92 + 1083
      - // Set up testing environment + dbTx, err := testState.BeginStateTransaction(ctx)
    - 93 + + 1084 +
    - + - etherman, ethBackend, auth, _, _, _ := newTestingEnv(t) +   + require.NoError(t, err)
    +
     
    +
    - 94 + 1256
      -
    + if err != nil {
    - 95 + 1257
      - // Read currentBlock + panic(err)
    - 96 + 1258
      - ctx := context.Background() + }
    -
     
    -
    - 115 + + 1259 +
    -   - blocks, _, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber) + + + testState = state.NewState(stateCfg, pgstatestorage.NewPostgresStorage(cfg, stateDb), executorClient, stateTree, nil, mt)
    - 116 + + -
    +
    +
      - require.NoError(t, err) +
    - 117 + + -
    +
    +
      - t.Logf("Blocks: %+v", blocks) +
    - 118 + + -
    - + - assert.Equal(t, uint64(11), blocks[0].BlockNumber) +
    +
    +   +
    - 119 + + -
    - + - assert.Equal(t, uint64(11), blocks[0].ForcedBatches[0].BlockNumber) +
    +
    +   +
    - 120 + 1260
      - assert.NotEqual(t, common.Hash{}, blocks[0].ForcedBatches[0].GlobalExitRoot) +
    - 121 + 1261
      - assert.NotEqual(t, time.Time{}, blocks[0].ForcedBatches[0].ForcedAt) + dbTx, err := testState.BeginStateTransaction(ctx)
    - 122 + 1262
      - assert.Equal(t, uint64(1), blocks[0].ForcedBatches[0].ForcedBatchNumber) + require.NoError(t, err)
    - 126 + 1371
      -
    + require.NoError(t, dbTx.Commit(ctx))
    - 127 + 1372
      - func TestSequencedBatchesEvent(t *testing.T) { + }
    - 128 + 1373
      - // Set up testing environment +
    - 129 + + 1374 +
    + - etherman, ethBackend, auth, _, br, da := newTestingEnv(t) + func TestGetBatchL2DataByNumber(t *testing.T) {
    - 130 + + 1375 +
    -   -
    + + + // Init database instance
    - 131 + + 1376 +
    -   - // Read currentBlock + + + initOrResetDB()
    - 132 + + 1377 +
    -   + + ctx := context.Background()
    -
     
    -
    - 157 + + 1378 +
    -   - blocks, _, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &currentBlockNumber) + + + tx, err := testState.BeginStateTransaction(ctx)
    - 158 + + 1379 +
    -   + + require.NoError(t, err)
    - 159 + + 1380 +
    -   - t.Log("Blocks: ", blocks) + + + defer func() { require.NoError(t, tx.Commit(ctx)) }()
    - 160 + + 1381 +
    + - var sequences []polygonzkevm.PolygonValidiumEtrogValidiumBatchData +
    - 161 + + 1382 +
    + - txsHash := crypto.Keccak256Hash(common.Hex2Bytes(rawTxs)) + // empty case
    - 162 + + 1383 +
    + - sequences = append(sequences, polygonzkevm.PolygonValidiumEtrogValidiumBatchData{ + var batchNum uint64 = 4
    - 163 + + 1384 +
    + - TransactionsHash: txsHash, + const (
    - 164 + + 1385 +
    + - }, polygonzkevm.PolygonValidiumEtrogValidiumBatchData{ + openBatchSQL = "INSERT INTO state.batch (batch_num, raw_txs_data, wip) VALUES ($1, $2, false)"
    - 165 + 1386
    + - TransactionsHash: txsHash, + resetBatchesSQL = "DELETE FROM state.batch"
    - 166 + + 1387 +
    -   - }) + + + )
    - 167 + + 1388 +
    + - batchNums := []uint64{2, 3} + _, err = tx.Exec(ctx, openBatchSQL, batchNum, nil)
    - 168 + 1389
    + - batchHashes := []common.Hash{txsHash, txsHash} + require.NoError(t, err)
    - 169 + 1390
    + - batchData := [][]byte{data, data} + data, err := testState.GetBatchL2DataByNumber(ctx, batchNum, tx)
    - 170 + 1391
    + - daMessage, _ := hex.DecodeString("0x123456789123456789") + require.NoError(t, err)
    - 171 + 1392
    + - da.Mock.On("GetBatchL2Data", batchNums, batchHashes, daMessage).Return(batchData, nil) + assert.Nil(t, data)
    - 172 + 1393
    + - _, err = etherman.ZkEVM.SequenceBatchesValidium(auth, sequences, uint64(time.Now().Unix()), uint64(1), auth.From, daMessage) +
    - 173 + + 1394 +
    -   - require.NoError(t, err) + + + // not empty case
    - 174 + + 1395 +
    -   -
    + + + expectedData := []byte("foo bar")
    - 175 + + 1396 +
    -   - // Mine the tx in a block + + + batchNum = 5
    -
     
    +
    + 1397 + +
    + + + _, err = tx.Exec(ctx, openBatchSQL, batchNum, expectedData) +
    - 195 + + 1398 +
    -   -
    + + + require.NoError(t, err)
    - 196 + + 1399 +
    -   - func TestVerifyBatchEvent(t *testing.T) { + + + actualData, err := testState.GetBatchL2DataByNumber(ctx, batchNum, tx)
    - 197 + + 1400 +
    -   - // Set up testing environment + + + require.NoError(t, err)
    - 198 + + 1401 +
    + - etherman, ethBackend, auth, _, _, da := newTestingEnv(t) + assert.Equal(t, expectedData, actualData)
    - 199 + + 1402 +
    -   + +
    - 200 + + 1403 +
    -   - // Read currentBlock + + + multiGet := []uint64{uint64(4), uint64(5), uint64(6)}
    - 201 + + 1404 +
    -   - ctx := context.Background() + + + allData, err := testState.GetBatchL2DataByNumbers(ctx, multiGet, tx)
    -
     
    +
    + 1405 + +
    + + + require.NoError(t, err) +
    - 204 + + 1406 +
    -   - require.NoError(t, err) + + + require.Equal(t, expectedData, allData[uint64(5)])
    - 205 + + 1407 +
    -   + +
    - 206 + + 1408 +
    -   - rawTxs := "f84901843b9aca00827b0c945fbdb2315678afecb367f032d93f642f64180aa380a46057361d00000000000000000000000000000000000000000000000000000000000000048203e9808073efe1fa2d3e27f26f32208550ea9b0274d49050b816cadab05a771f4275d0242fd5d92b3fb89575c070e6c930587c520ee65a3aa8cfe382fcad20421bf51d621c" + + + // Force backup
    - 207 + + 1409 + +
    + + + _, err = tx.Exec(ctx, resetBatchesSQL) +
    +
    + 1410 +
    + - tx := polygonzkevm.PolygonValidiumEtrogValidiumBatchData{ + require.NoError(t, err)
    - 208 + + 1411 +
    + - TransactionsHash: crypto.Keccak256Hash(common.Hex2Bytes(rawTxs)), +
    - 209 + + 1412 +
    -   - } + + + // Get batch 4 from backup
    - 210 + + 1413 +
    + - daMessage, _ := hex.DecodeString("0x1234") + batchNum = 4
    - 211 + + 1414 +
    + - _, err = etherman.ZkEVM.SequenceBatchesValidium(auth, []polygonzkevm.PolygonValidiumEtrogValidiumBatchData{tx}, uint64(time.Now().Unix()), uint64(1), auth.From, daMessage) + data, err = testState.GetBatchL2DataByNumber(ctx, batchNum, tx)
    - 212 + + 1415 +
    -   + + require.NoError(t, err)
    - 213 + 1416
    + - da.Mock.On("GetBatchL2Data", []uint64{2}, []common.Hash{crypto.Keccak256Hash(common.Hex2Bytes(rawTxs))}, daMessage).Return([][]byte{common.Hex2Bytes(rawTxs)}, nil) + assert.Nil(t, data)
    - 214 + + 1417 +
    -   + +
    - 215 + + 1418 +
    -   - // Mine the tx in a block + + + // Get batch 5 from backup
    - 216 + + 1419 +
    -   - ethBackend.Commit() + + + batchNum = 5
    -
     
    -
    - 228 + + 1420 +
    -   - blocks, order, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber) + + + actualData, err = testState.GetBatchL2DataByNumber(ctx, batchNum, tx)
    - 229 + + 1421 +
    -   + + require.NoError(t, err)
    - 230 + + 1422 +
    -   - t.Logf("Blocks: %+v, \nOrder: %+v", blocks, order) + + + assert.Equal(t, expectedData, actualData)
    - 231 + + 1423 +
    + - assert.Equal(t, uint64(12), blocks[1].BlockNumber) +
    - 232 + + 1424 +
    -   - assert.Equal(t, uint64(1), blocks[1].VerifiedBatches[0].BatchNumber) + + + // Update batch 5 and get it from backup
    - 233 + + 1425 +
    -   - assert.NotEqual(t, common.Address{}, blocks[1].VerifiedBatches[0].Aggregator) + + + expectedData = []byte("new foo bar")
    - 234 + + 1426 +
    -   - assert.NotEqual(t, common.Hash{}, blocks[1].VerifiedBatches[0].TxHash) + + + _, err = tx.Exec(ctx, openBatchSQL, batchNum, expectedData)
    -
     
    -
    - 240 + + 1427 +
    -   -
    + + + require.NoError(t, err)
    - 241 + + 1428 +
    -   - func TestSequenceForceBatchesEvent(t *testing.T) { + + + _, err = tx.Exec(ctx, resetBatchesSQL)
    - 242 + + 1429 +
    -   - // Set up testing environment + + + require.NoError(t, err)
    - 243 + + 1430 +
    + - etherman, ethBackend, auth, _, _, _ := newTestingEnv(t) + actualData, err = testState.GetBatchL2DataByNumber(ctx, batchNum, tx)
    - 244 + + 1431 +
    -   -
    + + + require.NoError(t, err)
    - 245 + + 1432 +
    -   - // Read currentBlock + + + assert.Equal(t, expectedData, actualData)
    - 246 + + 1433 +
    -   - ctx := context.Background() + + + }
    -
     
    -
    - 291 + + 1434 +
    -   - blocks, order, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber) + + +
    - 292 + + 1435 +
    -   - require.NoError(t, err) + + + func TestGetBatchL2DataByNumbers(t *testing.T) {
    - 293 + + 1436 +
    -   - t.Logf("Blocks: %+v", blocks) + + + initOrResetDB()
    - 294 + + 1437 +
    + - assert.Equal(t, uint64(15), blocks[1].BlockNumber) + ctx := context.Background()
    - 295 + + 1438 +
    -   - assert.Equal(t, uint64(2), blocks[1].SequencedForceBatches[0][0].BatchNumber) + + + tx, err := testState.BeginStateTransaction(ctx)
    - 296 + + 1439 +
    -   - assert.Equal(t, forcedGer, common.BytesToHash(blocks[1].SequencedForceBatches[0][0].ForcedGlobalExitRoot[:])) + + + require.NoError(t, err)
    - 297 + + 1440 +
    -   - assert.Equal(t, forcedTimestamp, blocks[1].SequencedForceBatches[0][0].ForcedTimestamp) + + + defer func() { require.NoError(t, tx.Commit(ctx)) }()
    -
     
    -
    - 301 + + 1441 +
    -   + +
    - 302 + + 1442 +
    -   - func TestSendSequences(t *testing.T) { + + + var i1, i2, i3, i4, i5 = uint64(1), uint64(2), uint64(3), uint64(4), uint64(5)
    - 303 + + 1443 +
    -   - // Set up testing environment + + + var d1, d2, d4 = []byte("foobar"), []byte("dingbat"), []byte{0xb}
    - 304 + + 1444 +
    + - etherman, ethBackend, auth, _, br, da := newTestingEnv(t) +
    - 305 + + 1445 +
    -   -
    + + + const insertBatch = "INSERT INTO state.batch (batch_num, raw_txs_data) VALUES ($1, $2)"
    - 306 + + 1446 +
    -   - // Read currentBlock + + + _, err = tx.Exec(ctx, insertBatch, i1, d1)
    - 307 + + 1447 +
    -   - ctx := context.Background() + + + require.NoError(t, err)
    -
     
    +
    + 1448 + +
    + + + _, err = tx.Exec(ctx, insertBatch, i2, d2) +
    - 323 + + 1449 +
    -   - BatchL2Data: batchL2Data, + + + require.NoError(t, err)
    - 324 + + 1450 +
    -   - LastL2BLockTimestamp: time.Now().Unix(), + + + _, err = tx.Exec(ctx, insertBatch, i3, nil)
    - 325 + + 1451 +
    -   - } + + + require.NoError(t, err)
    - 326 + 1452
    + - daMessage, _ := hex.DecodeString("0x1234") +
    - 327 + + 1453 +
    -   - lastL2BlockTStamp := tx1.Time().Unix() + + + // Add a forced batch too, needs a block
    - 328 + + 1454 +
    + - tx, err := etherman.sequenceBatches(*auth, []ethmanTypes.Sequence{sequence}, uint64(lastL2BlockTStamp), uint64(1), auth.From, daMessage) + block1 := *block
    - + + 1455 -
    -   -
    +
    +
    + + + block1.BlockNumber = 1000
    - 329 + + 1456 +
    -   - require.NoError(t, err) + + + err = testState.AddBlock(ctx, &block1, tx)
    - 330 + 1457
    + - da.Mock.On("GetBatchL2Data", []uint64{2}, []common.Hash{crypto.Keccak256Hash(batchL2Data)}, daMessage).Return([][]byte{batchL2Data}, nil) + require.NoError(t, err)
    - 331 + + 1458 +
    -   - log.Debug("TX: ", tx.Hash()) + + + err = tx.Commit(ctx)
    - 332 + + 1459 +
    -   - ethBackend.Commit() + + + require.NoError(t, err)
    - 333 + + 1460 +
    -   + +
    -
     
    -
    - 350 + + 1461 +
    -   -
    + + + tx, err = testState.BeginStateTransaction(ctx)
    - 351 + + 1462 +
    -   - func TestGasPrice(t *testing.T) { + + + require.NoError(t, err)
    - 352 + + 1463 +
    -   - // Set up testing environment + + +
    - 353 + + 1464 +
    + - etherman, _, _, _, _, _ := newTestingEnv(t) + const insertForcedBatch = "INSERT INTO state.forced_batch (forced_batch_num, timestamp, raw_txs_data, block_num) VALUES (4, now(),'0b', 1000)"
    - 354 + + 1465 +
    -   - etherscanM := new(etherscanMock) + + + _, err = testState.Exec(ctx, insertForcedBatch)
    - 355 + + 1466 +
    -   - ethGasStationM := new(ethGasStationMock) + + + require.NoError(t, err)
    - 356 + + 1467 +
    -   - etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, etherscanM, ethGasStationM} + + +
    -
     
    +
    + 1468 + +
    + + + allData, err := testState.GetForcedBatchDataByNumbers(ctx, []uint64{i4}, tx) +
    - 369 + + 1469 +
    -   -
    + + + require.NoError(t, err)
    - 370 + + 1470 +
    -   - func TestErrorEthGasStationPrice(t *testing.T) { + + + assert.Equal(t, d4, allData[i4])
    - 371 + + 1471 +
    -   - // Set up testing environment + + +
    - 372 + + 1472 +
    + - etherman, _, _, _, _, _ := newTestingEnv(t) + _, ok := allData[i5]
    - 373 + + 1473 +
    -   - ethGasStationM := new(ethGasStationMock) + + + assert.False(t, ok)
    - 374 + + 1474 +
    -   - etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, ethGasStationM} + + + }
    - 375 + + 1475 +
    -   - ctx := context.Background() + + +
    - 376 + 1476
      -
    + func createL1InfoTreeExitRootStorageEntryForTest(blockNumber uint64, index uint32) *state.L1InfoTreeExitRootStorageEntry {
    - 377 + 1477
      - ethGasStationM.On("SuggestGasPrice", ctx).Return(big.NewInt(0), fmt.Errorf("error getting gasPrice from ethGasStation")) + exitRoot := state.L1InfoTreeExitRootStorageEntry{
    - 378 + 1478
      - gp := etherman.GetL1GasPrice(ctx) + L1InfoTreeLeaf: state.L1InfoTreeLeaf{
    - 379 - -
    - + - assert.Equal(t, big.NewInt(1263075579), gp) -
    +
    +
     
    - 380 + 1674
      -
    + require.Equal(t, uint64(2002), fb.BlockNumber)
    - 381 + 1675
      - etherscanM := new(etherscanMock) + require.Equal(t, "0x717e05de47a87a7d1679e183f1c224150675f6302b7da4eaab526b2b91ae0761", fb.GlobalExitRoot.String())
    - 382 + 1676
      - etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, etherscanM, ethGasStationM} + require.Equal(t, []byte{0xb}, fb.RawTxsData)
    -
     
    -
    - 388 + + 1677 +
    -   + +
    - 389 + + 1678 +
    -   - func TestErrorEtherScanPrice(t *testing.T) { + + + // also check data retrieval
    - 390 + + 1679 +
    -   - // Set up testing environment + + + fbData, err := testState.GetForcedBatchDataByNumbers(ctx, []uint64{1}, dbTx)
    - 391 + + 1680 +
    + - etherman, _, _, _, _, _ := newTestingEnv(t) + require.NoError(t, err)
    - 392 + + 1681 +
    -   - etherscanM := new(etherscanMock) + + + var expected = make(map[uint64][]byte)
    - 393 + + 1682 +
    -   - ethGasStationM := new(ethGasStationMock) + + + expected[uint64(1)] = []byte{0xb}
    - 394 + + 1683 +
    -   - etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, etherscanM, ethGasStationM} + + + require.Equal(t, expected, fbData)
    -
     
    -
    - 402 + 1684
      -
    + }
    - 403 + 1685
      - func TestGetForks(t *testing.T) { +
    - 404 + 1686
      - // Set up testing environment + func TestGetLastGER(t *testing.T) {
    - 405 - -
    - + - etherman, _, _, _, _, _ := newTestingEnv(t) -
    +
    +
     
    - 406 + 1757
      - ctx := context.Background() + ger, err = testState.GetLatestBatchGlobalExitRoot(ctx, dbTx)
    - 407 + 1758
      - forks, err := etherman.GetForks(ctx, 0, 132) + require.NoError(t, err)
    - 408 + 1759
      - require.NoError(t, err) -
    -
    -
    + require.Equal(t, common.HexToHash("0x2").String(), ger.String())
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/interfaces.go - RENAMED - -
    -
    -
    -
    - - - - - - - -
    -
    @@ -0,0 +1,7 @@
    @@ -63863,222 +255572,164 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0


    -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    -
    - 1 - -
    - + - package etherman -
    -
    - 2 + + -
    - + +
    +
    +  
    - 3 + + -
    - + - import "github.com/ethereum/go-ethereum/common" +
    +
    +   +
    - 4 + + -
    - + +
    +
    +  
    - 5 + + -
    - + - type dataAvailabilityProvider interface { +
    +
    +   +
    - 6 + + -
    - + - GetBatchL2Data(batchNum []uint64, hash []common.Hash, dataAvailabilityMessage []byte) ([][]byte, error) +
    +
    +   +
    - 7 - -
    - + - } -
    +
    +
    -
    + +
    +   +
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/simulated.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -64092,21 +255743,21 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - + + +
    -
    @@ -23,7 +24,7 @@
    - 23 + + -
    +
    +
     
    - 24 + + -
    +
    +
      - // NewSimulatedEtherman creates an etherman that uses a simulated blockchain. It's important to notice that the ChainID of the auth +
    - 25 + + -
    +
    +
      - // must be 1337. The address that holds the auth will have an initial balance of 10 ETH +
    - 26 + + -
    - - - func NewSimulatedEtherman(cfg Config, auth *bind.TransactOpts) (*Client, *simulated.Backend, common.Address, *polygonzkevmbridge.Polygonzkevmbridge, error) { +
    +
    +   +
    - 27 + + -
    +
    +
      - if auth == nil { +
    - 28 + + -
    +
    +
      - // read only client +
    - 29 + + -
    +
    +
      - return &Client{}, nil, common.Address{}, nil, nil +
    -
    @@ -37,8 +38,26 @@
    -
    - 37 + + -
    +
    +
      - }, +
    - 38 + + -
    +
    +
      - } +
    - 39 + + -
    +
    +
      - blockGasLimit := uint64(999999999999999999) //nolint:gomnd +
    - 40 + + -
    +
    +
      - client := simulated.NewBackend(genesisAlloc, simulated.WithBlockGasLimit(blockGasLimit)) +
    - 41 + + -
    +
    +
     
    @@ -64283,751 +255934,801 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 42 + 1760
      - // Deploy contracts + }
    - 43 + 1761
      - const polDecimalPlaces = 18 +
    - 44 + 1762
      - totalSupply, _ := new(big.Int).SetString("10000000000000000000000000000", 10) //nolint:gomnd + func TestGetFirstUncheckedBlock(t *testing.T) {
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/proof.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + - - - - - - - - - - + - - + - - + - - -
    -
    @@ -102,7 +121,7 @@
    +
    @@ -25,9 +25,9 @@
    - 102 + 25
      - log.Error("error: ", err) + return exists, nil
    - 103 + 26
      - return nil, nil, common.Address{}, nil, err + }
    - 104 + 27
      - } +
    - 105 + 28
    - - br, err := polygonzkevmbridge.NewPolygonzkevmbridge(bridgeAddr, client.Client()) + // GetProofReadyForFinal return the proof that is ready to generate the final proof +
    +
    + 29 + +
    + - + func (p *PostgresStorage) GetProofReadyForFinal(ctx context.Context, lastVerfiedBatchNumber uint64, dbTx pgx.Tx) (*state.Proof, error) { +
    +
    + 30 + +
    + - + const getProofReadyForFinalSQL = `
    - 106 + 31
      - if err != nil { + SELECT
    - 107 + 32
      - log.Error("error: ", err) + p.batch_num,
    - 108 + 33
      - return nil, nil, common.Address{}, nil, err + p.batch_num_final,
    -
    @@ -182,6 +201,11 @@
    +
    @@ -39,7 +39,7 @@
    - 182 + 39
      - return nil, nil, common.Address{}, nil, err + p.generating_since,
    - 183 + 40
      - } + p.created_at,
    - 184 + 41
      -
    + p.updated_at
    - + + 42 -
    -   -
    +
    +
    + - + FROM state.batch_proof p
    - + + 43 -
    +
    +
      -
    + WHERE batch_num = $1 AND generating_since IS NULL AND
    - + + 44 -
    +
    +
      -
    + EXISTS (SELECT 1 FROM state.sequences s1 WHERE s1.from_batch_num = p.batch_num) AND
    - + + 45 -
    +
    +
      -
    + EXISTS (SELECT 1 FROM state.sequences s2 WHERE s2.to_batch_num = p.batch_num_final)
    - - -
    -   -
    -
    +
    +
    @@ -48,7 +48,7 @@
    - 185 + 48
      - _, err = trueZkevm.SetForceBatchAddress(auth, common.Address{}) + var proof *state.Proof = &state.Proof{}
    - 186 + 49
      - if err != nil { +
    - 187 + 50
      - log.Error("error: ", err) + e := p.getExecQuerier(dbTx)
    -
    @@ -199,6 +223,7 @@
    +
    + 51 + +
    + - + row := e.QueryRow(ctx, getProofReadyForFinalSQL, lastVerfiedBatchNumber+1) +
    - 199 + 52
      - SCAddresses: []common.Address{zkevmAddr, mockRollupManagerAddr, exitManagerAddr}, + err := row.Scan(&proof.BatchNumber, &proof.BatchNumberFinal, &proof.Proof, &proof.ProofID, &proof.InputProver, &proof.Prover, &proof.ProverID, &proof.GeneratingSince, &proof.CreatedAt, &proof.UpdatedAt)
    - 200 + 53
      - auth: map[common.Address]bind.TransactOpts{}, +
    - 201 + 54
      - cfg: cfg, + if errors.Is(err, pgx.ErrNoRows) {
    - - -
    -   -
    -
    +
    +
    @@ -60,15 +60,15 @@
    - 202 + 60
      - } + return proof, err
    - 203 + 61
      - err = c.AddOrReplaceAuth(*auth) + }
    - 204 + 62
      - if err != nil { +
    -
    + + + 63 + + +
    + - + // GetBatchProofsToAggregate return the next 2 batch proofs that it are possible to aggregate
    -
    -
    - - - - - - - - - - - + - + - + + - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    - 24 + + 64 +
    -   -
    + - + func (p *PostgresStorage) GetBatchProofsToAggregate(ctx context.Context, dbTx pgx.Tx) (*state.Proof, *state.Proof, error) {
    - 25 + 65
      - // NewSimulatedEtherman creates an etherman that uses a simulated blockchain. It's important to notice that the ChainID of the auth + var (
    - 26 + 66
      - // must be 1337. The address that holds the auth will have an initial balance of 10 ETH + proof1 *state.Proof = &state.Proof{}
    - 27 + + 67 +
    - + - func NewSimulatedEtherman(cfg Config, auth *bind.TransactOpts, daBackend dataAvailabilityProvider) (etherman *Client, ethBackend *simulated.Backend, polAddr common.Address, br *polygonzkevmbridge.Polygonzkevmbridge, err error) { +   + proof2 *state.Proof = &state.Proof{}
    - 28 + 68
      - if auth == nil { + )
    - 29 + 69
      - // read only client +
    - 30 + 70
      - return &Client{}, nil, common.Address{}, nil, nil + // TODO: add comments to explain the query
    -
     
    +
    + 71 + +
    + - + const getBatchProofsToAggregateSQL = ` +
    - 38 + 72
      - }, + SELECT
    - 39 + 73
      - } + p1.batch_num as p1_batch_num,
    - 40 + 74
      - blockGasLimit := uint64(999999999999999999) //nolint:gomnd + p1.batch_num_final as p1_batch_num_final,
    - 41 + +
    @@ -90,16 +90,31 @@
    +
    + 90 +
    - + - // client := simulated.NewBackend(genesisAlloc, simulated.WithBlockGasLimit(blockGasLimit)) +   + p2.generating_since as p2_generating_since,
    - 42 + 91
      - client := simulated.NewBackend(genesisAlloc, simulated.WithBlockGasLimit(blockGasLimit)) + p2.created_at as p2_created_at,
    - 43 + 92
      -
    + p2.updated_at as p2_updated_at
    - 44 + + 93 +
    - + - // DAC Setup + - + FROM state.batch_proof p1 INNER JOIN state.batch_proof p2 ON p1.batch_num_final = p2.batch_num - 1
    - 45 + + 94 +
    - + - daAddr, _, da, err := polygondatacommittee.DeployPolygondatacommittee(auth, client.Client()) + - + WHERE p1.blob_inner_num = p2.blob_inner_num AND
    - 46 + + 95 +
    - + - if err != nil { + - + p1.generating_since IS NULL AND p2.generating_since IS NULL AND
    - 47 + + 96 +
    - + - return nil, nil, common.Address{}, nil, err + - + p1.proof IS NOT NULL AND p2.proof IS NOT NULL
    - 48 + + -
    - + - } +
    +
    +   +
    +
    +
    + + +
    +   +
    - 49 + + -
    - + - client.Commit() +
    +
    +   +
    - 50 + + -
    - + - _, err = da.Initialize(auth) +
    +
    +   +
    - 51 + + -
    - + - if err != nil { +
    +
    +   +
    - 52 + + -
    - + - return nil, nil, common.Address{}, nil, err +
    +
    +   +
    - 53 + + -
    - + - } +
    +
    +   +
    - 54 + + -
    - + - client.Commit() +
    +
    +   +
    - 55 + + -
    - + - _, err = da.SetupCommittee(auth, big.NewInt(0), []string{}, []byte{}) +
    +
    +   +
    - 56 + + -
    - + - if err != nil { +
    +
    +   +
    - 57 + + -
    - + - return nil, nil, common.Address{}, nil, err +
    +
    +   +
    - 58 + + -
    - + - } +
    +
    +   +
    - 59 + + -
    - + - client.Commit() +
    +
    +   +
    - 60 + + -
    - + +
    +
    +  
    - 61 + + -
    +
    +
      - // Deploy contracts +
    - 62 + 97
      - const polDecimalPlaces = 18 + ORDER BY p1.batch_num ASC
    - 63 + 98
      - totalSupply, _ := new(big.Int).SetString("10000000000000000000000000000", 10) //nolint:gomnd + LIMIT 1
    -
     
    -
    - 121 + 99
      - log.Error("error: ", err) + `
    - 122 + 100
      - return nil, nil, common.Address{}, nil, err +
    - 123 + 101
      - } + e := p.getExecQuerier(dbTx)
    - 124 + + 102 +
    - + - br, err = polygonzkevmbridge.NewPolygonzkevmbridge(bridgeAddr, client.Client()) + - + row := e.QueryRow(ctx, getBatchProofsToAggregateSQL)
    - 125 + 103
      - if err != nil { + err := row.Scan(
    - 126 + 104
      - log.Error("error: ", err) + &proof1.BatchNumber, &proof1.BatchNumberFinal, &proof1.Proof, &proof1.ProofID, &proof1.InputProver, &proof1.Prover, &proof1.ProverID, &proof1.GeneratingSince, &proof1.CreatedAt, &proof1.UpdatedAt,
    - 127 + 105
      - return nil, nil, common.Address{}, nil, err + &proof2.BatchNumber, &proof2.BatchNumberFinal, &proof2.Proof, &proof2.ProofID, &proof2.InputProver, &proof2.Prover, &proof2.ProverID, &proof2.GeneratingSince, &proof2.CreatedAt, &proof2.UpdatedAt)
    -
     
    +
    @@ -113,47 +128,50 @@
    - 201 + 113
      - return nil, nil, common.Address{}, nil, err + return proof1, proof2, err
    - 202 + 114
      - } + }
    - 203 + 115
    @@ -65036,237 +256737,213 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 204 - -
    - + - _, err = trueZkevm.SetDataAvailabilityProtocol(auth, daAddr) -
    -
    - 205 + + 116 +
    - + - if err != nil { + - + // AddBatchProof adds a batch proof to the storage
    - 206 + + 117 +
    - + - log.Error("error: ", err) + - + func (p *PostgresStorage) AddBatchProof(ctx context.Context, proof *state.Proof, dbTx pgx.Tx) error {
    - 207 + + 118 +
    - + - return nil, nil, common.Address{}, nil, err + - + const addBatchProofSQL = "INSERT INTO state.batch_proof (batch_num, batch_num_final, proof, proof_id, input_prover, prover, prover_id, generating_since, created_at, updated_at) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)"
    - 208 + + 119 +
    - + - } +   + e := p.getExecQuerier(dbTx)
    - 209 + 120
      - _, err = trueZkevm.SetForceBatchAddress(auth, common.Address{}) + now := time.Now().UTC().Round(time.Microsecond)
    - 210 + + 121 +
    -   - if err != nil { + - + _, err := e.Exec(ctx, addBatchProofSQL, proof.BatchNumber, proof.BatchNumberFinal, proof.Proof, proof.ProofID, proof.InputProver, proof.Prover, proof.ProverID, proof.GeneratingSince, now, now)
    - 211 + 122
      - log.Error("error: ", err) + return err
    -
     
    -
    - 223 + 123
      - SCAddresses: []common.Address{zkevmAddr, mockRollupManagerAddr, exitManagerAddr}, + }
    - 224 + 124
      - auth: map[common.Address]bind.TransactOpts{}, +
    - 225 + + 125 +
    -   - cfg: cfg, + - + // UpdateBatchProof updates a batch proof in the storage
    - 226 + + 126 +
    - + - da: daBackend, + - + func (p *PostgresStorage) UpdateBatchProof(ctx context.Context, proof *state.Proof, dbTx pgx.Tx) error {
    - 227 + + 127 +
    -   - } + - + const addBatchProofSQL = "UPDATE state.batch_proof SET proof = $3, proof_id = $4, input_prover = $5, prover = $6, prover_id = $7, generating_since = $8, updated_at = $9 WHERE batch_num = $1 AND batch_num_final = $2"
    - 228 + 128
      - err = c.AddOrReplaceAuth(*auth) + e := p.getExecQuerier(dbTx)
    - 229 + 129
      - if err != nil { + now := time.Now().UTC().Round(time.Microsecond)
    -
    + + + 130 + + +
    + - + _, err := e.Exec(ctx, addBatchProofSQL, proof.BatchNumber, proof.BatchNumberFinal, proof.Proof, proof.ProofID, proof.InputProver, proof.Prover, proof.ProverID, proof.GeneratingSince, now)
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/event/event.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - + + + @@ -65281,72 +256958,82 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - + + + @@ -65361,211 +257048,192 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - -
    -
    @@ -42,12 +42,17 @@
    - 42 + 131
      - EventID_SynchronizerHalt EventID = "SYNCHRONIZER HALT" + return err
    - 43 + 132
      - // EventID_SequenceSenderHalt is triggered when the SequenceSender halts + }
    - 44 + 133
      - EventID_SequenceSenderHalt EventID = "SEQUENCESENDER HALT" +
    - + + 134 -
    -   -
    +
    +
    + - + // DeleteBatchProofs deletes from the storage the batch proofs falling inside the batch numbers range.
    - + + 135 -
    -   -
    +
    +
    + - + func (p *PostgresStorage) DeleteBatchProofs(ctx context.Context, batchNumber uint64, batchNumberFinal uint64, dbTx pgx.Tx) error { +
    +
    + 136 + +
    + - + const deleteBatchProofSQL = "DELETE FROM state.batch_proof WHERE batch_num >= $1 AND batch_num_final <= $2"
    - 45 + 137
      - // EventID_NodeOOC is triggered when an OOC at node level is detected + e := p.getExecQuerier(dbTx)
    - 46 + + 138 +
    -   - EventID_NodeOOC EventID = "NODE OOC" + - + _, err := e.Exec(ctx, deleteBatchProofSQL, batchNumber, batchNumberFinal)
    - 47 + 139
      - // EventID_UsedZKCountersOverflow is triggered when used ZK counters exceeds remaining batch ZK counters + return err
    - 48 + 140
      - EventID_UsedZKCountersOverflow EventID = "USED ZKCOUNTERS OVERFLOW" + }
    - 49 + 141
      - // EventID_ReservedZKCountersOverflow is triggered when reserved ZK counters exceeds remaining batch ZK counters +
    - 50 + + 142 +
    -   - EventID_ReservedZKCountersOverflow EventID = "RESERVED ZKCOUNTERS OVERFLOW" + - + // CleanupBatchProofs deletes from the storage the batch proofs up to the specified batch number included.
    - + + 143 -
    -   -
    +
    +
    + - + func (p *PostgresStorage) CleanupBatchProofs(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error { +
    +
    + 144 + +
    + - + const deleteBatchProofSQL = "DELETE FROM state.batch_proof WHERE batch_num_final <= $1"
    - 51 + 145
      - // Source_Node is the source of the event + e := p.getExecQuerier(dbTx)
    - 52 + + 146 +
    -   - Source_Node Source = "node" + - + _, err := e.Exec(ctx, deleteBatchProofSQL, batchNumber)
    - 53 + 147
      -
    -
    -
    -
    + return err
    -
    -
    - - - - - - - - - - - - - - - - - - - + - - -
    -
     
    - 42 + 148
      - EventID_SynchronizerHalt EventID = "SYNCHRONIZER HALT" + }
    - 43 + 149
      - // EventID_SequenceSenderHalt is triggered when the SequenceSender halts +
    - 44 + + 150 +
    -   - EventID_SequenceSenderHalt EventID = "SEQUENCESENDER HALT" + - + // CleanupLockedBatchProofs deletes from the storage the proofs locked in generating state for more than the provided threshold.
    - 45 + + 151 +
    - + - // EventID_UnsupportedPrecompile is triggered when the executor returns an unsupported precompile error + - + func (p *PostgresStorage) CleanupLockedBatchProofs(ctx context.Context, duration string, dbTx pgx.Tx) (int64, error) {
    - 46 + + -
    - + - EventID_UnsupportedPrecompile EventID = "UNSUPPORTED PRECOMPILE" +
    +
    +   +
    - 47 + + 152 +
    - + -
    +   + interval, err := toPostgresInterval(duration)
    - 48 + 153
      - // EventID_NodeOOC is triggered when an OOC at node level is detected + if err != nil {
    - 49 + 154
      - EventID_NodeOOC EventID = "NODE OOC" + return 0, err
    - 50 + 155
      - // EventID_UsedZKCountersOverflow is triggered when used ZK counters exceeds remaining batch ZK counters + }
    - 51 + + 156 +
    -   - EventID_UsedZKCountersOverflow EventID = "USED ZKCOUNTERS OVERFLOW" + - + sql := fmt.Sprintf("DELETE FROM state.batch_proof WHERE generating_since < (NOW() - interval '%s')", interval)
    - 52 + 157
      - // EventID_ReservedZKCountersOverflow is triggered when reserved ZK counters exceeds remaining batch ZK counters + e := p.getExecQuerier(dbTx)
    - 53 + 158
      - EventID_ReservedZKCountersOverflow EventID = "RESERVED ZKCOUNTERS OVERFLOW" + ct, err := e.Exec(ctx, sql)
    - 54 + + 159 +
    - + - // EventID_InvalidInfoRoot is triggered when an invalid l1InfoRoot was synced +   + if err != nil {
    - 55 - -
    - + - EventID_InvalidInfoRoot EventID = "INVALID INFOROOT" -
    +
    +
    @@ -162,9 +180,10 @@
    - 56 + 162
      - // Source_Node is the source of the event + return ct.RowsAffected(), nil
    - 57 + 163
      - Source_Node Source = "node" + }
    - 58 + 164
    @@ -65573,63 +257241,34 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0


    -
    -
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/.golangci.yml - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - @@ -65643,23 +257282,33 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - + + + @@ -65678,281 +257327,297 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - -
    -
    @@ -30,3 +30,6 @@
    -
    - 30 + + 165 +
    -   - include: + - + // DeleteUngeneratedBatchProofs deletes ungenerated proofs. This method is meant to be use during aggregator boot-up sequence
    - 31 + + 166 +
    -   - - EXC0012 # EXC0012 revive: Annoying issue about not having a comment. The rare codebase has such comments + - + func (p *PostgresStorage) DeleteUngeneratedBatchProofs(ctx context.Context, dbTx pgx.Tx) error {
    - 32 + + 167 +
    -   - - EXC0014 # EXC0014 revive: Annoying issue about not having a comment. The rare codebase has such comments + - + const deleteUngeneratedProofsSQL = "DELETE FROM state.batch_proof WHERE generating_since IS NOT NULL"
    - + + 168 -
    +
    +
      -
    + e := p.getExecQuerier(dbTx)
    - + + 169 -
    +
    +
      -
    + _, err := e.Exec(ctx, deleteUngeneratedProofsSQL) +
    +
    + 170 + +
    +   + return err
    - 30 + 25
      - include: + return exists, nil
    - 31 + 26
      - - EXC0012 # EXC0012 revive: Annoying issue about not having a comment. The rare codebase has such comments + }
    - 32 + 27
      - - EXC0014 # EXC0014 revive: Annoying issue about not having a comment. The rare codebase has such comments +
    - 33 + + 28 +
    + - exclude-rules: + // GetProofReadyToVerify return the proof that is ready to verify
    - 34 + + 29 +
    + - - path: cmd/policy.go + func (p *PostgresStorage) GetProofReadyToVerify(ctx context.Context, lastVerfiedBatchNumber uint64, dbTx pgx.Tx) (*state.Proof, error) {
    - 35 + + 30 +
    + - text: "unused" + const getProofReadyToVerifySQL = `
    -
    + + + 31 + + +
    +   + SELECT
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/go.mod - RENAMED - -
    -
    -
    -
    - - - - - + + + - - - - - - + + + + + + + + + @@ -65962,17 +257627,17 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - @@ -65982,7 +257647,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -65992,7 +257657,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -66002,7 +257667,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -66012,17 +257677,17 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - @@ -66032,7 +257697,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -66042,7 +257707,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -66052,901 +257717,932 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - + - - - - - - - - - - - - - - - - + - - - - - - - - - + + + - - - - - -
    -
    @@ -22,9 +22,9 @@
    - 22 + 32
      - github.com/prometheus/common v0.45.0 + p.batch_num,
    - 23 + 33
      - github.com/rubenv/sql-migrate v1.6.1 + p.batch_num_final,
    +
     
    +
    - 24 + 39
      - github.com/spf13/afero v1.11.0 + p.generating_since,
    - 25 + + 40 +
    - - - github.com/spf13/viper v1.17.0 +   + p.created_at,
    - 26 + 41
      - github.com/stretchr/testify v1.8.4 + p.updated_at
    - 27 + + 42 +
    - - - github.com/umbracle/ethgo v0.1.3 + + + FROM state.proof p
    - 28 + 43
      - github.com/urfave/cli/v2 v2.26.0 + WHERE batch_num = $1 AND generating_since IS NULL AND
    - 29 + 44
      - go.uber.org/zap v1.26.0 + EXISTS (SELECT 1 FROM state.sequences s1 WHERE s1.from_batch_num = p.batch_num) AND
    - 30 + 45
      - golang.org/x/crypto v0.18.0 + EXISTS (SELECT 1 FROM state.sequences s2 WHERE s2.to_batch_num = p.batch_num_final)
    -
    @@ -45,7 +45,7 @@
    +
     
    - 45 + 48
      - github.com/VictoriaMetrics/fastcache v1.12.1 // indirect + var proof *state.Proof = &state.Proof{}
    - 46 + 49
      - github.com/bahlo/generic-list-go v0.2.0 // indirect +
    - 47 + 50
      - github.com/beorn7/perks v1.0.1 // indirect + e := p.getExecQuerier(dbTx)
    - 48 + + 51 +
    - - - github.com/bits-and-blooms/bitset v1.10.0 // indirect + + + row := e.QueryRow(ctx, getProofReadyToVerifySQL, lastVerfiedBatchNumber+1)
    - 49 + 52
      - github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect + err := row.Scan(&proof.BatchNumber, &proof.BatchNumberFinal, &proof.Proof, &proof.ProofID, &proof.InputProver, &proof.Prover, &proof.ProverID, &proof.GeneratingSince, &proof.CreatedAt, &proof.UpdatedAt)
    - 50 + 53
      - github.com/buger/jsonparser v1.1.1 // indirect +
    - 51 + 54
      - github.com/cespare/xxhash/v2 v2.2.0 // indirect + if errors.Is(err, pgx.ErrNoRows) {
    -
    @@ -63,12 +63,12 @@
    +
     
    - 63 + 60
      - github.com/cyphar/filepath-securejoin v0.2.4 // indirect + return proof, err
    - 64 + 61
      - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + } +
    +
    + 62 + +
    +   +
    +
    +
    + 63 + +
    + + + // GetProofsToAggregate return the next to proof that it is possible to aggregate +
    +
    + 64 + +
    + + + func (p *PostgresStorage) GetProofsToAggregate(ctx context.Context, dbTx pgx.Tx) (*state.Proof, *state.Proof, error) {
      - github.com/deckarep/golang-set/v2 v2.1.0 // indirect + var (
    + 66 +
    - - - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect +   + proof1 *state.Proof = &state.Proof{}
      - github.com/dlclark/regexp2 v1.7.0 // indirect + proof2 *state.Proof = &state.Proof{}
      - github.com/emirpasic/gods v1.18.1 // indirect + )
      - github.com/ethereum/c-kzg-4844 v0.4.0 // indirect +
      - github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 // indirect + // TODO: add comments to explain the query
    + 71 +
    - - - github.com/fsnotify/fsnotify v1.6.0 // indirect + + + const getProofsToAggregateSQL = `
      - github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect + SELECT
      - github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 // indirect + p1.batch_num as p1_batch_num,
      - github.com/getsentry/sentry-go v0.18.0 // indirect + p1.batch_num_final as p1_batch_num_final,
    -
    @@ -101,6 +101,7 @@
    +
     
    - 101 + 90
      - github.com/jackc/puddle v1.3.0 // indirect + p2.generating_since as p2_generating_since,
    - 102 + 91
      - github.com/jackpal/go-nat-pmp v1.0.2 // indirect + p2.created_at as p2_created_at,
    - 103 + 92
      - github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect + p2.updated_at as p2_updated_at
    - + + 93 -
    -   -
    +
    +
    + + + FROM state.proof p1 INNER JOIN state.proof p2 ON p1.batch_num_final = p2.batch_num - 1
    - 104 + + 94 +
    -   - github.com/karrick/godirwalk v1.17.0 // indirect + + + WHERE p1.generating_since IS NULL AND p2.generating_since IS NULL AND
    - 105 + + 95 +
    -   - github.com/kevinburke/ssh_config v1.2.0 // indirect + + + p1.proof IS NOT NULL AND p2.proof IS NOT NULL AND
    - 106 + + 96 +
    -   - github.com/klauspost/compress v1.17.0 // indirect + + + (
    -
    @@ -116,6 +117,7 @@
    +
    + 97 + +
    + + + EXISTS ( +
    - 116 + + 98 +
    -   - github.com/mattn/go-isatty v0.0.20 // indirect + + + SELECT 1 FROM state.sequences s
    - 117 + + 99 +
    -   - github.com/mattn/go-runewidth v0.0.13 // indirect + + + WHERE p1.batch_num >= s.from_batch_num AND p1.batch_num <= s.to_batch_num AND
    - 118 + + 100 +
    -   - github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect + + + p1.batch_num_final >= s.from_batch_num AND p1.batch_num_final <= s.to_batch_num AND
    - + + 101 -
    -   -
    +
    +
    + + + p2.batch_num >= s.from_batch_num AND p2.batch_num <= s.to_batch_num AND
    - 119 + + 102 +
    -   - github.com/mitchellh/pointerstructure v1.2.0 // indirect + + + p2.batch_num_final >= s.from_batch_num AND p2.batch_num_final <= s.to_batch_num
    - 120 + + 103 +
    -   - github.com/mmcloughlin/addchain v0.4.0 // indirect + + + )
    - 121 + + 104 +
    -   - github.com/olekukonko/tablewriter v0.0.5 // indirect + + + OR
    -
    @@ -128,14 +130,14 @@
    +
    + 105 + +
    + + + ( +
    - 128 + + 106 +
    -   - github.com/rogpeppe/go-internal v1.11.0 // indirect + + + EXISTS ( SELECT 1 FROM state.sequences s WHERE p1.batch_num = s.from_batch_num) AND
    - 129 + + 107 +
    -   - github.com/rs/cors v1.7.0 // indirect + + + EXISTS ( SELECT 1 FROM state.sequences s WHERE p1.batch_num_final = s.to_batch_num) AND
    - 130 + + 108 +
    -   - github.com/russross/blackfriday/v2 v2.1.0 // indirect + + + EXISTS ( SELECT 1 FROM state.sequences s WHERE p2.batch_num = s.from_batch_num) AND
    - 131 + + 109 +
    - - - github.com/sagikazarmark/locafero v0.3.0 // indirect + + + EXISTS ( SELECT 1 FROM state.sequences s WHERE p2.batch_num_final = s.to_batch_num)
    - 132 + + 110 + +
    + + + ) +
    +
    + 111 +
    -   - github.com/sagikazarmark/slog-shim v0.1.0 // indirect + + + )
    - 133 + 112
      - github.com/sergi/go-diff v1.2.0 // indirect + ORDER BY p1.batch_num ASC
    - 134 + 113
      - github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect + LIMIT 1
    - 135 + 114
      - github.com/sirupsen/logrus v1.9.0 // indirect + `
    - 136 + 115
      - github.com/skeema/knownhosts v1.2.1 // indirect +
    - 137 + 116
      - github.com/sourcegraph/conc v0.3.0 // indirect + e := p.getExecQuerier(dbTx)
    - 138 + + 117 +
    - - - github.com/spf13/cast v1.5.1 // indirect + + + row := e.QueryRow(ctx, getProofsToAggregateSQL)
    - 139 + 118
      - github.com/spf13/pflag v1.0.5 // indirect + err := row.Scan(
    - 140 + 119
      - github.com/status-im/keycard-go v0.2.0 // indirect + &proof1.BatchNumber, &proof1.BatchNumberFinal, &proof1.Proof, &proof1.ProofID, &proof1.InputProver, &proof1.Prover, &proof1.ProverID, &proof1.GeneratingSince, &proof1.CreatedAt, &proof1.UpdatedAt,
    - 141 + 120
      - github.com/stretchr/objx v0.5.0 // indirect + &proof2.BatchNumber, &proof2.BatchNumberFinal, &proof2.Proof, &proof2.ProofID, &proof2.InputProver, &proof2.Prover, &proof2.ProverID, &proof2.GeneratingSince, &proof2.CreatedAt, &proof2.UpdatedAt)
    -
    -
    -
    -
    - - - + - - - - - - - - - + + + - - + - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - + + + - - - - + + + @@ -66956,12 +258652,12 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    +
    {/home/stefan/go/src/Polygon/zkevm-node → .}/.goreleaser-cdk.yaml + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/transaction.go RENAMED
    - - - - - - - - - - - - - - - - - - - - @@ -67089,123 +258785,168 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - + + + - - - - - - - + - + + - - - - + + + - - + + + - - - - - - + + + @@ -67219,83 +258960,107 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - + + + - - - - - - + + +
     
    - 22 + 128
      - github.com/prometheus/common v0.45.0 + return proof1, proof2, err
    - 23 + 129
      - github.com/rubenv/sql-migrate v1.6.1 + }
    - 24 + 130
      - github.com/spf13/afero v1.11.0 +
    - 25 + 131
    + - github.com/spf13/viper v1.18.2 + // AddGeneratedProof adds a generated proof to the storage
    - 26 + + 132 +
    -   - github.com/stretchr/testify v1.8.4 + + + func (p *PostgresStorage) AddGeneratedProof(ctx context.Context, proof *state.Proof, dbTx pgx.Tx) error {
    - 27 + 133
    + - github.com/umbracle/ethgo v0.1.4-0.20230712173909-df37dddf16f0 + const addGeneratedProofSQL = "INSERT INTO state.proof (batch_num, batch_num_final, proof, proof_id, input_prover, prover, prover_id, generating_since, created_at, updated_at) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)"
    - 28 + 134
      - github.com/urfave/cli/v2 v2.26.0 + e := p.getExecQuerier(dbTx)
    - 29 + 135
      - go.uber.org/zap v1.26.0 + now := time.Now().UTC().Round(time.Microsecond)
    - 30 + + 136 +
    -   - golang.org/x/crypto v0.18.0 + + + _, err := e.Exec(ctx, addGeneratedProofSQL, proof.BatchNumber, proof.BatchNumberFinal, proof.Proof, proof.ProofID, proof.InputProver, proof.Prover, proof.ProverID, proof.GeneratingSince, now, now)
    -
     
    -
    - 45 + 137
      - github.com/VictoriaMetrics/fastcache v1.12.1 // indirect + return err
    - 46 + 138
      - github.com/bahlo/generic-list-go v0.2.0 // indirect + }
    - 47 + 139
      - github.com/beorn7/perks v1.0.1 // indirect +
    - 48 + 140
    + - github.com/bits-and-blooms/bitset v1.12.0 // indirect + // UpdateGeneratedProof updates a generated proof in the storage
    - 49 + + 141 +
    -   - github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect + + + func (p *PostgresStorage) UpdateGeneratedProof(ctx context.Context, proof *state.Proof, dbTx pgx.Tx) error { +
    +
    + 142 + +
    + + + const addGeneratedProofSQL = "UPDATE state.proof SET proof = $3, proof_id = $4, input_prover = $5, prover = $6, prover_id = $7, generating_since = $8, updated_at = $9 WHERE batch_num = $1 AND batch_num_final = $2"
    - 50 + 143
      - github.com/buger/jsonparser v1.1.1 // indirect + e := p.getExecQuerier(dbTx)
    - 51 + 144
      - github.com/cespare/xxhash/v2 v2.2.0 // indirect + now := time.Now().UTC().Round(time.Microsecond)
    -
     
    +
    + 145 + +
    + + + _, err := e.Exec(ctx, addGeneratedProofSQL, proof.BatchNumber, proof.BatchNumberFinal, proof.Proof, proof.ProofID, proof.InputProver, proof.Prover, proof.ProverID, proof.GeneratingSince, now) +
    - 63 + 146
      - github.com/cyphar/filepath-securejoin v0.2.4 // indirect + return err
    - 64 + 147
      - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + }
    - 65 + 148
      - github.com/deckarep/golang-set/v2 v2.1.0 // indirect +
    - 66 + 149
    + - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect + // DeleteGeneratedProofs deletes from the storage the generated proofs falling
    - 67 + + 150 +
    -   - github.com/dlclark/regexp2 v1.7.0 // indirect + + + // inside the batch numbers range.
    - 68 + + 151 +
    -   - github.com/emirpasic/gods v1.18.1 // indirect + + + func (p *PostgresStorage) DeleteGeneratedProofs(ctx context.Context, batchNumber uint64, batchNumberFinal uint64, dbTx pgx.Tx) error {
    - 69 + + 152 +
    -   - github.com/ethereum/c-kzg-4844 v0.4.0 // indirect + + + const deleteGeneratedProofSQL = "DELETE FROM state.proof WHERE batch_num >= $1 AND batch_num_final <= $2"
    - 70 + 153
      - github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 // indirect + e := p.getExecQuerier(dbTx)
    - 71 + 154
    + - github.com/fsnotify/fsnotify v1.7.0 // indirect + _, err := e.Exec(ctx, deleteGeneratedProofSQL, batchNumber, batchNumberFinal)
    - 72 + 155
      - github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect + return err
    - 73 + 156
      - github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 // indirect + }
    - 74 + 157
      - github.com/getsentry/sentry-go v0.18.0 // indirect +
    -
     
    -
    - 101 + + 158 +
    -   - github.com/jackc/puddle v1.3.0 // indirect + + + // CleanupGeneratedProofs deletes from the storage the generated proofs up to
    - 102 + + 159 +
    -   - github.com/jackpal/go-nat-pmp v1.0.2 // indirect + + + // the specified batch number included.
    - 103 + + 160 +
    -   - github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect + + + func (p *PostgresStorage) CleanupGeneratedProofs(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error {
    - 104 + 161
    + - github.com/jmoiron/sqlx v1.2.0 // indirect + const deleteGeneratedProofSQL = "DELETE FROM state.proof WHERE batch_num_final <= $1"
    - 105 + 162
      - github.com/karrick/godirwalk v1.17.0 // indirect + e := p.getExecQuerier(dbTx)
    - 106 + + 163 +
    -   - github.com/kevinburke/ssh_config v1.2.0 // indirect + + + _, err := e.Exec(ctx, deleteGeneratedProofSQL, batchNumber)
    - 107 + 164
      - github.com/klauspost/compress v1.17.0 // indirect + return err
    -
     
    -
    - 117 + 165
      - github.com/mattn/go-isatty v0.0.20 // indirect + }
    - 118 + 166
      - github.com/mattn/go-runewidth v0.0.13 // indirect +
    - 119 + + 167 +
    -   - github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect + + + // CleanupLockedProofs deletes from the storage the proofs locked in generating +
    +
    + 168 + +
    + + + // state for more than the provided threshold.
    - 120 + 169
    + - github.com/miguelmota/go-solidity-sha3 v0.1.1 // indirect + func (p *PostgresStorage) CleanupLockedProofs(ctx context.Context, duration string, dbTx pgx.Tx) (int64, error) {
    - 121 + 170
      - github.com/mitchellh/pointerstructure v1.2.0 // indirect + interval, err := toPostgresInterval(duration)
    - 122 + 171
      - github.com/mmcloughlin/addchain v0.4.0 // indirect + if err != nil {
    - 123 + 172
      - github.com/olekukonko/tablewriter v0.0.5 // indirect + return 0, err
    -
     
    -
    - 130 + 173
      - github.com/rogpeppe/go-internal v1.11.0 // indirect + }
    - 131 + + 174 +
    -   - github.com/rs/cors v1.7.0 // indirect + + + sql := fmt.Sprintf("DELETE FROM state.proof WHERE generating_since < (NOW() - interval '%s')", interval)
    - 132 + 175
      - github.com/russross/blackfriday/v2 v2.1.0 // indirect + e := p.getExecQuerier(dbTx)
    - 133 + + 176 +
    - + - github.com/sagikazarmark/locafero v0.4.0 // indirect +   + ct, err := e.Exec(ctx, sql)
    - 134 + 177
      - github.com/sagikazarmark/slog-shim v0.1.0 // indirect + if err != nil {
    +
     
    +
    - 135 + 180
      - github.com/sergi/go-diff v1.2.0 // indirect + return ct.RowsAffected(), nil
    - 136 + 181
      - github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect + }
    - 137 + 182
      - github.com/sirupsen/logrus v1.9.0 // indirect +
    - 138 + + 183 +
    -   - github.com/skeema/knownhosts v1.2.1 // indirect + + + // DeleteUngeneratedProofs deletes ungenerated proofs.
    - 139 + + 184 +
    -   - github.com/sourcegraph/conc v0.3.0 // indirect + + + // This method is meant to be use during aggregator boot-up sequence
    - 140 + 185
    + - github.com/spf13/cast v1.6.0 // indirect + func (p *PostgresStorage) DeleteUngeneratedProofs(ctx context.Context, dbTx pgx.Tx) error { +
    +
    + 186 + +
    + + + const deleteUngeneratedProofsSQL = "DELETE FROM state.proof WHERE generating_since IS NOT NULL"
    - 141 + 187
      - github.com/spf13/pflag v1.0.5 // indirect + e := p.getExecQuerier(dbTx)
    - 142 + 188
      - github.com/status-im/keycard-go v0.2.0 // indirect + _, err := e.Exec(ctx, deleteUngeneratedProofsSQL)
    - 143 + 189
      - github.com/stretchr/objx v0.5.0 // indirect + return err
    -
    @@ -0,0 +1,84 @@
    +
    @@ -63,16 +63,13 @@
    - + + 63 -
    +
    +
      -
    + } else if err != nil {
    - + + 64 -
    +
    +
      -
    + return nil, err
    - + + 65 -
    +
    +
      -
    + }
    - + + 66 -
    -   +
    +
    + -
    - + + 67 -
    -   -
    +
    +
    + - + defer rows.Close()
    - + + 68 -
    -   +
    +
    + -
    - + + 69 -
    +
    +
      -
    + hashes := make([]common.Hash, 0, len(rows.RawValues()))
    - + + 70 -
    +
    +
      -
    + for rows.Next() {
    - + + 71 -
    +
    +
      -
    + var hash string
    - + + 72 -
    -   -
    +
    +
    + - + if err := rows.Scan(&hash); err != nil {
    - + + 73 -
    +
    +
      -
    + return nil, err
    - + + 74 -
    +
    +
      + } +
    +
    + 75 + +
    + -
    - + + 76 -
    +
    +
      -
    + hashes = append(hashes, common.HexToHash(hash))
    - + + 77 -
    +
    +
      -
    + }
    - + + 78 -
    +
    +
     
    - + +
    @@ -111,16 +108,13 @@
    -
    +
    + 111 + +
      -
    + } else if err != nil {
    - + + 112 -
    +
    +
      -
    + return nil, err
    - + + 113 -
    +
    +
      + } +
    +
    + 114 + +
    + -
    - + + 115 -
    -   +
    +
    + - + defer rows.Close() +
    +
    + 116 + +
    + -
    - + + 117 -
    +
    +
      -
    + hashes := make([]common.Hash, 0, len(rows.RawValues()))
    - + + 118 -
    +
    +
      -
    + for rows.Next() {
    - + + 119 -
    +
    +
      -
    + var hash string +
    +
    + 120 + +
    + - + if err := rows.Scan(&hash); err != nil {
    - + + 121 -
    +
    +
      -
    + return nil, err
    - + + 122 -
    +
    +
      + } +
    +
    + 123 + +
    + -
    - + + 124 -
    +
    +
      -
    + hashes = append(hashes, common.HexToHash(hash))
    - + + 125 -
    +
    +
      -
    + }
    - + + 126 -
    +
    +
     
    +
    +
    +
    +
    + + + + + - - - - - - @@ -67329,53 +259094,73 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - + + + + + + - - @@ -67389,63 +259174,68 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - + - + + - - - - @@ -67479,53 +259269,73 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - + + + + + + - - @@ -67539,193 +259349,231 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - + + +
    +
     
    +
    - + + 63 -
    +
    +
      -
    + } else if err != nil {
    - + + 64 -
    +
    +
      -
    + return nil, err
    - + + 65 -
    +
    +
      -
    + }
    - + + 66 -
    +
    +
      -
    + hashes := make([]common.Hash, 0, len(rows.RawValues()))
    - + + 67 -
    +
    +
      -
    + for rows.Next() {
    - + + 68 -
    +
    +
      -
    + var hash string
    - + + 69 -
    +
    +
    + + + err := rows.Scan(&hash) +
    +
    + 70 + +
    + + + if err != nil { +
    +
    + 71 + +
      -
    + return nil, err
    - + + 72 -
    +
    +
      -
    + }
    - + + 73 -
    +
    +
      -
    + hashes = append(hashes, common.HexToHash(hash))
    - + + 74 -
    +
    +
      -
    + }
    - + + 75 -
    +
    +
     
    - + +
     
    -
    +
    + 108 + +
      -
    + } else if err != nil {
    - + + 109 -
    +
    +
      -
    + return nil, err
    - + + 110 -
    +
    +
      -
    + }
    - + + 111 -
    +
    +
      -
    + hashes := make([]common.Hash, 0, len(rows.RawValues()))
    - + + 112 -
    +
    +
      -
    + for rows.Next() {
    - + + 113 -
    +
    +
      -
    + var hash string
    - + + 114 -
    +
    +
    + + + err := rows.Scan(&hash) +
    +
    + 115 + +
    + + + if err != nil { +
    +
    + 116 + +
      -
    + return nil, err
    - + + 117 -
    +
    +
      -
    + }
    - + + 118 -
    +
    +
      -
    + hashes = append(hashes, common.HexToHash(hash))
    - + + 119 -
    +
    +
      -
    + }
    - + + 120 -
    +
    +
     
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/reset.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - + - - - - - - - - - - + + +
    +
    @@ -14,7 +14,6 @@
    +
    - + + 14 -
    +
    +
      -
    + // - VerifiedBatches
    - + + 15 -
    +
    +
      -
    + // - Entries in exit_root table
    - + + 16 -
    +
    +
      -
    + err := s.ResetToL1BlockNumber(ctx, blockNumber, dbTx)
    - + + 17 -
    -   +
    +
    + -
    - + + 18 -
    +
    +
      -
    + if err != nil {
    - + + 19 -
    +
    +
      -
    + log.Error("error resetting L1BlockNumber. Error: ", err)
    - + + 20 -
    +
    +
      -
    + return err
    - - -
    -   -
    -
    +
    +
    @@ -30,5 +29,4 @@
    - + + 30 -
    +
    +
      -
    + // is going to be a commit or a rollback. So is going to be rebuild on the next
    - + + 31 -
    +
    +
      -
    + // request that needs it.
    - + + 32 -
    +
    +
      -
    + s.l1InfoTree = nil
    - + + 33 -
    -   -
    +
    +
    + - + s.l1InfoTreeRecursive = nil
    - + + 34 -
    +
    +
      -
    + } +
    +
    +
    +
    +
    + + + + + - - - - - - @@ -67739,63 +259587,68 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - + - + + - - - - @@ -67809,13 +259662,13 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - @@ -67823,6 +259676,21 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    +
     
    - + + 14 -
    +
    +
      -
    + // - VerifiedBatches
    - + + 15 -
    +
    +
      -
    + // - Entries in exit_root table
    - + + 16 -
    +
    +
      -
    + err := s.ResetToL1BlockNumber(ctx, blockNumber, dbTx)
    - + + 17 -
    +
    +
      -
    + if err != nil {
    - + + 18 -
    +
    +
      -
    + log.Error("error resetting L1BlockNumber. Error: ", err)
    - + + 19 -
    +
    +
      -
    + return err
    - + +
     
    -
    +
    + 29 + +
      -
    + // is going to be a commit or a rollback. So is going to be rebuild on the next
    - + + 30 -
    +
    +
      -
    + // request that needs it.
    - + + 31 -
    +
    +
      -
    + s.l1InfoTree = nil
    - + + 32 -
    +
    +
      -
    + }
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/runtime/executor/client.go + RENAMED + +
    +
    @@ -67830,721 +259698,765 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +
    -
     
    +
    @@ -7,20 +7,26 @@
    - 1 + + 7 +
    - + - # .goreleaser-cdk.yaml +   +
    - 2 + + 8 +
    - + - project_name: cdk-validium-node +   + "github.com/0xPolygonHermez/zkevm-node/log"
    - 3 + + 9 +
    - + -
    +   + "google.golang.org/grpc"
    - 4 + + 10 +
    - + - release: + - + "google.golang.org/grpc/connectivity"
    - 5 + + 11 +
    - + - disable: false +   + "google.golang.org/grpc/credentials/insecure"
    - 6 + + 12 +
    - + - draft: true +   + )
    - 7 + + 13 +
    - + - prerelease: auto +   +
    - 8 + + -
    - + +
    +
    +  
    - 9 + + -
    - + - before: +
    +
    +   +
    - 10 + + -
    - + - hooks: +
    +
    +   +
    - 11 + + -
    - + - - go mod download +
    +
    +   +
    - 12 + + -
    - + - - go install github.com/gobuffalo/packr/v2/packr2@v2.8.3 +
    +
    +   +
    - 13 + + -
    - + - - packr2 +
    +
    +   +
    + + + +
    +   +
    +
    +
    14 +
    - + -
    +   + // NewExecutorClient is the executor client constructor.
    + 15 +
    - + - builds: +   + func NewExecutorClient(ctx context.Context, c Config) (ExecutorServiceClient, *grpc.ClientConn, context.CancelFunc) {
    + 16 +
    - + - - main: ./cmd/ +   + opts := []grpc.DialOption{
    + 17 +
    - + - binary: zkevm-node +   + grpc.WithTransportCredentials(insecure.NewCredentials()),
    + 18 +
    - + - goos: +   + grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(c.MaxGRPCMessageSize)),
    + + + +
    +   +
    +
    +
    19 +
    - + - - linux +   + }
    + 20 +
    - + - - darwin + - + const maxWaitSeconds = 20
    + 21 +
    - + - goarch: +   + const maxRetries = 5
    + 22 +
    - + - - amd64 + - + var innerCtx context.Context
    + 23 +
    - + - - arm64 + - + var cancel context.CancelFunc
    + 24 +
    - + - env: +   +
    + 25 +
    - + - - CGO_ENABLED=0 +   + connectionRetries := 0
    + 26 +
    - + - ldflags: +   +
    - 27 - -
    - + - - -s -w -
    +
    +
    @@ -28,15 +34,8 @@
    + 28 +
    - + - - -X github.com/0xPolygonHermez/zkevm-node.Version={{ .Version }} +   + var err error
    + 29 +
    - + - - -X github.com/0xPolygonHermez/zkevm-node.GitRev={{ .Commit }} +   + delay := 2
    + 30 +
    - + - - -X github.com/0xPolygonHermez/zkevm-node.BuildDate={{ .Date }} +   + for connectionRetries < maxRetries {
    + 31 +
    - + - - -X github.com/0xPolygonHermez/zkevm-node.GitBranch={{ .Branch }} + - + innerCtx, cancel = context.WithTimeout(ctx, maxWaitSeconds*time.Second)
    + 32 +
    - + -
    + - + executorConn, err = grpc.NewClient(c.URI, opts...)
    + 33 +
    - + - archives: + - + if err != nil {
    + 34 +
    - + - - files: + - + log.Fatalf("fail to create grpc connection to merkletree: %v", err)
    + 35 +
    - + - - LICENSE + - + }
    + 36 +
    - + - - README.md + - +
    + 37 +
    - + -
    +   + log.Infof("trying to connect to executor: %v", c.URI)
    + 38 +
    - + - dockers: + - + executorConn.Connect()
    + 39 +
    - + - - image_templates: + - + err = waitForConnection(innerCtx, executorConn)
    + 40 +
    - + - - 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}-amd64 +   + if err != nil {
    + 41 +
    - + - dockerfile: Dockerfile.release +   + log.Infof("Retrying connection to executor #%d", connectionRetries)
    + 42 +
    - + - use: buildx +   + time.Sleep(time.Duration(delay) * time.Second)
    - 43 + +
    @@ -57,17 +56,3 @@
    +
    + 57 +
    - + - goos: linux +   + executorClient := NewExecutorServiceClient(executorConn)
    - 44 + + 58 +
    - + - goarch: amd64 +   + return executorClient, executorConn, cancel
    - 45 + + 59 +
    - + - build_flag_templates: +   + }
    - 46 + + 60 +
    - + - - --platform=linux/amd64 + - +
    - 47 + + 61 +
    - + - - --label=org.opencontainers.image.title={{ .ProjectName }} + - + func waitForConnection(ctx context.Context, conn *grpc.ClientConn) error {
    - 48 + + 62 +
    - + - - --label=org.opencontainers.image.description={{ .ProjectName }} + - + for {
    - 49 + + 63 +
    - + - - --label=org.opencontainers.image.url=https://github.com/{{ .ProjectName }} + - + select {
    - 50 + + 64 +
    - + - - --label=org.opencontainers.image.source=https://github.com/{{ .ProjectName }} + - + case <-ctx.Done():
    - 51 + + 65 +
    - + - - --label=org.opencontainers.image.version={{ replace .Version "+" "-" }} + - + return ctx.Err()
    - 52 + + 66 +
    - + - - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} + - + case <-time.After(time.Second):
    - 53 + + 67 +
    - + - - --label=org.opencontainers.image.revision={{ .FullCommit }} + - + s := conn.GetState()
    - 54 + + 68 +
    - + - skip_push: false + - + if s == connectivity.Ready {
    - 55 + + 69 +
    - + -
    + - + return nil
    - 56 + + 70 +
    - + - - image_templates: + - + }
    - 57 + + 71 +
    - + - - 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}-arm64 + - + }
    - 58 + + 72 +
    - + - dockerfile: Dockerfile.release + - + }
    - 59 + + 73 +
    - + - use: buildx + - + }
    +
    +
    +
    +
    + + + + + - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    +
     
    +
    - 60 + + 7 +
    - + - goos: linux +   +
    - 61 + + 8 +
    - + - goarch: arm64 +   + "github.com/0xPolygonHermez/zkevm-node/log"
    - 62 + + 9 +
    - + - build_flag_templates: +   + "google.golang.org/grpc"
    - 63 + + + +
    +   +
    +
    +
    + 10 +
    - + - - --platform=linux/arm64 +   + "google.golang.org/grpc/credentials/insecure"
    - 64 + + 11 +
    - + - - --label=org.opencontainers.image.title={{ .ProjectName }} +   + )
    - 65 + + 12 +
    - + - - --label=org.opencontainers.image.description={{ .ProjectName }} +   +
    - 66 + 13
    + - - --label=org.opencontainers.image.url=https://github.com/{{ .ProjectName }} + const (
    - 67 + 14
    + - - --label=org.opencontainers.image.source=https://github.com/{{ .ProjectName }} + // ExecutionMode0 is the execution mode for the sequencer and RPC, default one
    - 68 + 15
    + - - --label=org.opencontainers.image.version={{ replace .Version "+" "-" }} + ExecutionMode0 = uint64(0)
    - 69 + 16
    + - - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} + // ExecutionMode1 is the execution mode for the synchronizer
    - 70 + 17
    + - - --label=org.opencontainers.image.revision={{ .FullCommit }} + ExecutionMode1 = uint64(1)
    - 71 + 18
    + - skip_push: false + )
    - 72 + 19
    @@ -68553,182 +260465,178 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 73 + + 20 +
    - + - docker_manifests: +   + // NewExecutorClient is the executor client constructor.
    - 74 + + 21 +
    - + - - name_template: 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }} +   + func NewExecutorClient(ctx context.Context, c Config) (ExecutorServiceClient, *grpc.ClientConn, context.CancelFunc) {
    - 75 + + 22 +
    - + - image_templates: +   + opts := []grpc.DialOption{
    - 76 + + 23 +
    - + - - 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}-amd64 +   + grpc.WithTransportCredentials(insecure.NewCredentials()),
    - 77 + + 24 +
    - + - - 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}-arm64 +   + grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(c.MaxGRPCMessageSize)),
    - 78 + 25
    + - skip_push: false + grpc.WithBlock(),
    - 79 + + 26 +
    - + -
    +   + }
    - 80 + + 27 +
    + - - name_template: 0xpolygon/{{ .ProjectName }}:latest + const maxWaitSeconds = 120
    - 81 + + 28 +
    - + - image_templates: +   + const maxRetries = 5
    - 82 + + 29 +
    + - - 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}-amd64 + ctx, cancel := context.WithTimeout(ctx, maxWaitSeconds*time.Second)
    - 83 + + -
    - + - - 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}-arm64 +
    +
    +   +
    - 84 + + 30 +
    - + - skip_push: false +   +
    -
    + + + 31 + + +
    +   + connectionRetries := 0
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/client/zkevm.go - RENAMED - -
    -
    -
    -
    - - - + + + + + @@ -68792,23 +260700,23 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - @@ -68822,63 +260730,68 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - + - + + - - - - @@ -69021,41 +260934,26 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0


    - - - - - - - - -
    + 32 + +
    +   +
    +
    +
    -
    @@ -58,6 +58,35 @@
    +
     
    - 58 + 34
      - return result, nil + var err error
    - 59 + 35
      - } + delay := 2
    - 60 + 36
      -
    + for connectionRetries < maxRetries {
    - + + 37 -
    +
    +
      -
    + log.Infof("trying to connect to executor: %v", c.URI)
    - + + 38 -
    -   -
    +
    +
    + + + executorConn, err = grpc.DialContext(ctx, c.URI, opts...)
    - + + 39 -
    +
    +
      -
    + if err != nil {
    - + + 40 -
    +
    +
      -
    + log.Infof("Retrying connection to executor #%d", connectionRetries)
    - + + 41 -
    +
    +
      -
    + time.Sleep(time.Duration(delay) * time.Second)
    - + +
     
    -
    +
    + 56 + +
      -
    + executorClient := NewExecutorServiceClient(executorConn)
    - + + 57 -
    +
    +
      -
    + return executorClient, executorConn, cancel
    - + + 58 -
    +
    +
      -
    + }
    - 61 - -
    -   - // ExitRootsByGER returns the exit roots accordingly to the provided Global Exit Root -
    -
    - 62 - -
    -   - func (c *Client) ExitRootsByGER(ctx context.Context, globalExitRoot common.Hash) (*types.ExitRoots, error) { -
    -
    - 63 - -
    -   - response, err := JSONRPCCall(c.url, "zkevm_getExitRootsByGER", globalExitRoot.String()) -
    -
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/runtime/executor/errors.go + RENAMED + +
    +
    @@ -69063,1983 +260961,1820 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - -
    -
     
    +
    @@ -20,13 +20,6 @@
    - 58 + 20
      - return result, nil + ErrROMUnknown = fmt.Errorf("unknown ROM error")
    - 59 + 21
      - } + // ErrCodeROMUnknown indicates an unknown ROM error
    - 60 + 22
      -
    -
    -
    - 61 - -
    - + - // BatchesByNumbers returns batches from the current canonical chain by batch numbers. If the list is empty, the last -
    -
    - 62 - -
    - + - // known batch is returned as a list. -
    -
    - 63 - -
    - + - func (c *Client) BatchesByNumbers(_ context.Context, numbers []*big.Int) ([]*types.BatchData, error) { -
    -
    - 64 - -
    - + - batchNumbers := make([]types.BatchNumber, 0, len(numbers)) -
    -
    - 65 - -
    - + - for _, n := range numbers { -
    -
    - 66 - -
    - + - batchNumbers = append(batchNumbers, types.BatchNumber(n.Int64())) -
    -
    - 67 - -
    - + - } + ErrCodeROMUnknown = RomError(math.MaxInt32)
    - 68 - -
    - + - if len(batchNumbers) == 0 { -
    -
    - 69 - -
    - + - batchNumbers = append(batchNumbers, types.LatestBatchNumber) -
    -
    - 70 - -
    - + - } -
    -
    - 71 + + 23 +
    - + + -
    - 72 - -
    - + - response, err := JSONRPCCall(c.url, "zkevm_getBatchDataByNumbers", &types.BatchFilter{Numbers: batchNumbers}) -
    -
    - 73 + + 24 +
    - + - if err != nil { + - + // ErrROMBlobUnspecified indicates an unspecified ROM blob error
    - 74 + + 25 +
    - + - return nil, err + - + ErrROMBlobUnspecified = fmt.Errorf("unspecified ROM blob error")
    - 75 + + 26 +
    - + - } + - + // ErrROMBlobUnknown indicates an unknown ROM blob error
    - 76 + + 27 +
    - + -
    + - + ErrROMBlobUnknown = fmt.Errorf("unknown ROM blob error")
    - 77 + + 28 +
    - + - if response.Error != nil { + - + // ErrCodeROMBlobUnknown indicates an unknown ROM blob error
    - 78 + + 29 +
    - + - return nil, response.Error.RPCError() + - + ErrCodeROMBlobUnknown = RomBlobError(math.MaxInt32)
    - 79 + + 30 +
    - + - } +   + )
    - 80 + + 31 +
    - + +  
    - 81 - -
    - + - var result *types.BatchDataResult -
    -
    - 82 + + 32 +
    - + - err = json.Unmarshal(response.Result, &result) +   + // RomErr returns an instance of error related to the ExecutorError
    - 83 - -
    - + - if err != nil { -
    +
    +
    @@ -103,9 +96,6 @@
    - 84 + + 103 +
    - + - return nil, err +   + return runtime.ErrInvalidTxChangeL2BlockLimitTimestamp
    - 85 + + 104 +
    - + - } +   + case RomError_ROM_ERROR_INVALID_TX_CHANGE_L2_BLOCK_MIN_TIMESTAMP:
    - 86 + + 105 +
    - + -
    +   + return runtime.ErrInvalidTxChangeL2BlockMinTimestamp
    - 87 + + 106 +
    - + - return result.Data, nil + - + // Start of V3 errors
    - 88 + + 107 +
    - + - } + - + case RomError_ROM_ERROR_INVALID_L1_INFO_TREE_INDEX:
    - 89 + + 108 +
    - + -
    + - + return runtime.ErrInvalidL1InfoTreeIndex
    - 90 + 109
      - // ExitRootsByGER returns the exit roots accordingly to the provided Global Exit Root + }
    - 91 + 110
      - func (c *Client) ExitRootsByGER(ctx context.Context, globalExitRoot common.Hash) (*types.ExitRoots, error) { + return ErrROMUnknown
    - 92 + 111
      - response, err := JSONRPCCall(c.url, "zkevm_getExitRootsByGER", globalExitRoot.String()) + }
    -
    -
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/endpoints_eth.go - RENAMED - -
    -
    -
    -
    - - - + - - + + + - - - - - - - - - - - - - - -
    -
    @@ -106,7 +106,7 @@
    +
    @@ -182,8 +172,6 @@
    - 106 + 182
      - result, err := e.state.ProcessUnsignedTransaction(ctx, tx, sender, blockToProcess, true, dbTx) + return RomError_ROM_ERROR_INVALID_TX_CHANGE_L2_BLOCK_LIMIT_TIMESTAMP
    - 107 + 183
      - if err != nil { + case runtime.ErrInvalidTxChangeL2BlockMinTimestamp:
    - 108 + 184
      - errMsg := fmt.Sprintf("failed to execute the unsigned transaction: %v", err.Error()) + return RomError_ROM_ERROR_INVALID_TX_CHANGE_L2_BLOCK_MIN_TIMESTAMP
    - 109 + + 185 +
    - - logError := !executor.IsROMOutOfCountersError(executor.RomErrorCode(err)) && !errors.Is(err, runtime.ErrOutOfGas) + case runtime.ErrInvalidL1InfoTreeIndex: +
    +
    + 186 + +
    + - + return RomError_ROM_ERROR_INVALID_L1_INFO_TREE_INDEX
    - 110 + 187
      - return RPCErrorResponse(types.DefaultErrorCode, errMsg, nil, logError) + }
    - 111 + 188
      - } + return ErrCodeROMUnknown
    - 112 + 189
      -
    + }
    -
    @@ -941,6 +941,9 @@
    +
    @@ -468,49 +456,7 @@
    - 941 + 468
      - if e.cfg.SequencerNodeURI != "" { + return runtime.ErrExecutorErrorInvalidUpdateMerkleTree
    - 942 + 469
      - return e.relayTxToSequencerNode(input) + case ExecutorError_EXECUTOR_ERROR_SM_MAIN_INVALID_TX_STATUS_ERROR:
    - 943 + 470
      - } else { + return runtime.ErrExecutorErrorSMMainInvalidTxStatusError
    - + + 471 -
    -   -
    +
    +
    + - + // Start of V3 errors
    - + + 472 -
    -   -
    +
    +
    + - + case ExecutorError_EXECUTOR_ERROR_INVALID_PREVIOUS_L1_INFO_TREE_ROOT:
    - + + 473 -
    -   -
    +
    +
    + - + return runtime.ErrExecutorErrorInvalidPreviousL1InfoTreeRoot
    - 944 + + 474 +
    -   - ip := "" + - + case ExecutorError_EXECUTOR_ERROR_INVALID_FORCED_HASH_DATA:
    - 945 + + 475 +
    -   - ips := httpRequest.Header.Get("X-Forwarded-For") + - + return runtime.ErrExecutorErrorInvalidForcedHashData
    - 946 + + 476 +
    -   -
    -
    -
    -
    + - + case ExecutorError_EXECUTOR_ERROR_INVALID_FORCED_DATA_GLOBAL_EXIT_ROOT:
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    - 106 + + 477 +
    -   - result, err := e.state.ProcessUnsignedTransaction(ctx, tx, sender, blockToProcess, true, dbTx) + - + return runtime.ErrExecutorErrorInvalidForcedDataGlobalExitRoot
    - 107 + + 478 +
    -   - if err != nil { + - + case ExecutorError_EXECUTOR_ERROR_INVALID_FORCED_DATA_BLOCK_HASH_L1:
    - 108 + + 479 +
    -   - errMsg := fmt.Sprintf("failed to execute the unsigned transaction: %v", err.Error()) + - + return runtime.ErrExecutorErrorInvalidForcedDataBlockHashL1
    - 109 + + 480 +
    - + - logError := !executor.IsROMOutOfCountersError(executor.RomErrorCode(err)) && !(errors.Is(err, runtime.ErrOutOfGas)) + - + case ExecutorError_EXECUTOR_ERROR_INVALID_L1_DATA_V3_INITIAL_HISTORIC_ROOT:
    - 110 + + 481 +
    -   - return RPCErrorResponse(types.DefaultErrorCode, errMsg, nil, logError) + - + return runtime.ErrExecutorErrorInvalidL1DataV3InitialHistoricRoot
    - 111 + + 482 +
    -   - } + - + case ExecutorError_EXECUTOR_ERROR_INVALID_OLD_BLOB_STATE_ROOT:
    - 112 + + 483 +
    -   -
    + - + return runtime.ErrExecutorErrorInvalidOldBlobStateRoot
    -
     
    -
    - 941 + + 484 +
    -   - if e.cfg.SequencerNodeURI != "" { + - + case ExecutorError_EXECUTOR_ERROR_INVALID_OLD_BLOB_ACC_INPUT_HASH:
    - 942 + + 485 +
    -   - return e.relayTxToSequencerNode(input) + - + return runtime.ErrExecutorErrorInvalidOldBlobAccInputHash
    - 943 + + 486 +
    -   - } else { + - + case ExecutorError_EXECUTOR_ERROR_INVALID_LAST_L1_INFO_TREE_ROOT:
    - 944 + + 487 +
    - + - if err := checkPolicy(context.Background(), e.pool, input); err != nil { + - + return runtime.ErrExecutorErrorInvalidLastL1InfoTreeRoot
    - 945 + + 488 +
    - + - return RPCErrorResponse(types.AccessDeniedCode, err.Error(), nil, false) + - + case ExecutorError_EXECUTOR_ERROR_INVALID_NEW_BLOB_STATE_ROOT:
    - 946 + + 489 +
    - + - } + - + return runtime.ErrExecutorErrorInvalidNewBlobStateRoot
    - 947 + + 490 +
    -   - ip := "" + - + case ExecutorError_EXECUTOR_ERROR_INVALID_NEW_BLOB_ACC_INPUT_HASH:
    - 948 + + 491 +
    -   - ips := httpRequest.Header.Get("X-Forwarded-For") + - + return runtime.ErrExecutorErrorInvalidNewBlobAccInputHash
    - 949 + + 492 +
    -   -
    + - + case ExecutorError_EXECUTOR_ERROR_INVALID_BLOB_DATA:
    -
    + + + 493 + + +
    + - + return runtime.ErrExecutorErrorInvalidBlobData
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/endpoints_eth_test.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +
    -
    @@ -6,6 +6,7 @@
    - 6 + + 494 +
    -   - "errors" + - + case ExecutorError_EXECUTOR_ERROR_INVALID_ZK_GAS_LIMIT:
    - 7 + + 495 +
    -   - "fmt" + - + return runtime.ErrExecutorErrorInvalidZKGasLimit
    - 8 + + 496 +
    -   - "math/big" + - + case ExecutorError_EXECUTOR_ERROR_INVALID_POINT_Z:
    - + + 497 -
    -   -
    +
    +
    + - + return runtime.ErrExecutorErrorInvalidPointZ
    - 9 + + 498 +
    -   - "sync" + - + case ExecutorError_EXECUTOR_ERROR_INVALID_POINT_Y:
    - 10 + + 499 +
    -   - "testing" + - + return runtime.ErrExecutorErrorInvalidPointY
    - 11 + + 500 +
    -   - "time" + - + case ExecutorError_EXECUTOR_ERROR_SM_MAIN_POINT_Z_MISMATCH:
    -
    @@ -5416,3 +5417,237 @@
    +
    + 501 + +
    + - + return runtime.ErrExecutorErrorSMMainPointZMismatch +
    - 5416 + + 502 +
    -   - assert.ElementsMatch(t, []int{13, 14, 15}, results[4]) + - + case ExecutorError_EXECUTOR_ERROR_SM_MAIN_BLOB_L2_HASH_DATA_MISMATCH:
    - 5417 + + 503 +
    -   - assert.ElementsMatch(t, []int{16}, results[5]) + - + return runtime.ErrExecutorErrorSMMainBlobL2HashDataMismatch
    - 5418 + + 504 +
    -   - } + - + case ExecutorError_EXECUTOR_ERROR_SM_MAIN_BATCH_HASH_DATA_MISMATCH:
    - + + 505 -
    -   -
    +
    +
    + - + return runtime.ErrExecutorErrorSMMainBatchHashDataMismatch
    - + + 506 -
    -   -
    +
    +
    + - + case ExecutorError_EXECUTOR_ERROR_SM_MAIN_INVALID_BLOB_TYPE:
    - + + 507 -
    -   -
    +
    +
    + - + return runtime.ErrExecutorErrorSMMainInvalidBlobType
    - + + 508 -
    -   -
    +
    +
    + - + case ExecutorError_EXECUTOR_ERROR_SM_MAIN_UNRESTORED_SAVED_CONTEXT:
    - + + 509 -
    -   -
    +
    +
    + - + return runtime.ErrExecutorErrorSMMainUnrestoredSavedContext
    - + + 510 -
    -   -
    +
    +
    + - + case ExecutorError_EXECUTOR_ERROR_SM_MAIN_INVALID_MEMORY_CTX:
    - + + 511 -
    -   -
    +
    +
    + - + return runtime.ErrExecutorErrorSMMainInvalidMemoryCtx
    - + + 512 -
    +
    +
      -
    + }
    - + + 513 -
    -   +
    +
    + -
    - + + 514 -
    +
    +
      -
    + return ErrExecutorUnknown
    - + + 515 -
    +
    +
      -
    + }
    - + + 516 -
    +
    +
     
    - + +
    @@ -752,96 +698,7 @@
    -
    +
    + 752 + +
      -
    + return ExecutorError_EXECUTOR_ERROR_INVALID_UPDATE_MERKLE_TREE
    - + + 753 -
    +
    +
      -
    + case runtime.ErrExecutorErrorSMMainInvalidTxStatusError:
    - + + 754 -
    +
    +
      -
    + return ExecutorError_EXECUTOR_ERROR_SM_MAIN_INVALID_TX_STATUS_ERROR
    - + + 755 -
    -   -
    +
    +
    + - + // Start of V3 errors
    - + + 756 -
    -   -
    +
    +
    + - + case runtime.ErrExecutorErrorInvalidPreviousL1InfoTreeRoot:
    - + + 757 -
    -   -
    +
    +
    + - + return ExecutorError_EXECUTOR_ERROR_INVALID_PREVIOUS_L1_INFO_TREE_ROOT
    - + + 758 -
    -   -
    +
    +
    + - + case runtime.ErrExecutorErrorInvalidForcedHashData:
    - + + 759 -
    -   -
    +
    +
    + - + return ExecutorError_EXECUTOR_ERROR_INVALID_FORCED_HASH_DATA
    - + + 760 -
    -   -
    +
    +
    + - + case runtime.ErrExecutorErrorInvalidForcedDataGlobalExitRoot:
    - + + 761 -
    -   -
    +
    +
    + - + return ExecutorError_EXECUTOR_ERROR_INVALID_FORCED_DATA_GLOBAL_EXIT_ROOT
    - + + 762 -
    -   -
    +
    +
    + - + case runtime.ErrExecutorErrorInvalidForcedDataBlockHashL1:
    - + + 763 -
    -   -
    +
    +
    + - + return ExecutorError_EXECUTOR_ERROR_INVALID_FORCED_DATA_BLOCK_HASH_L1
    - + + 764 -
    -   -
    +
    +
    + - + case runtime.ErrExecutorErrorInvalidL1DataV3InitialHistoricRoot:
    - + + 765 -
    -   -
    +
    +
    + - + return ExecutorError_EXECUTOR_ERROR_INVALID_L1_DATA_V3_INITIAL_HISTORIC_ROOT
    - + + 766 -
    -   -
    +
    +
    + - + case runtime.ErrExecutorErrorInvalidOldBlobStateRoot:
    - + + 767 -
    -   -
    +
    +
    + - + return ExecutorError_EXECUTOR_ERROR_INVALID_OLD_BLOB_STATE_ROOT
    - + + 768 -
    -   -
    +
    +
    + - + case runtime.ErrExecutorErrorInvalidOldBlobAccInputHash:
    - + + 769 -
    -   -
    +
    +
    + - + return ExecutorError_EXECUTOR_ERROR_INVALID_OLD_BLOB_ACC_INPUT_HASH
    - + + 770 -
    -   -
    +
    +
    + - + case runtime.ErrExecutorErrorInvalidLastL1InfoTreeRoot:
    - + + 771 -
    -   -
    +
    +
    + - + return ExecutorError_EXECUTOR_ERROR_INVALID_LAST_L1_INFO_TREE_ROOT
    - + + 772 -
    -   -
    +
    +
    + - + case runtime.ErrExecutorErrorInvalidNewBlobStateRoot:
    - + + 773 -
    -   -
    +
    +
    + - + return ExecutorError_EXECUTOR_ERROR_INVALID_NEW_BLOB_STATE_ROOT
    - + + 774 -
    -   -
    +
    +
    + - + case runtime.ErrExecutorErrorInvalidNewBlobAccInputHash:
    - + + 775 -
    -   -
    +
    +
    + - + return ExecutorError_EXECUTOR_ERROR_INVALID_NEW_BLOB_ACC_INPUT_HASH
    - + + 776 -
    -   -
    +
    +
    + - + case runtime.ErrExecutorErrorInvalidBlobData:
    - + + 777 -
    -   -
    +
    +
    + - + return ExecutorError_EXECUTOR_ERROR_INVALID_BLOB_DATA
    - + + 778 -
    -   -
    +
    +
    + - + case runtime.ErrExecutorErrorInvalidZKGasLimit:
    - + + 779 -
    -   -
    +
    +
    + - + return ExecutorError_EXECUTOR_ERROR_INVALID_ZK_GAS_LIMIT
    - + + 780 -
    -   -
    +
    +
    + - + case runtime.ErrExecutorErrorInvalidPointZ:
    - + + 781 -
    -   -
    +
    +
    + - + return ExecutorError_EXECUTOR_ERROR_INVALID_POINT_Z
    - + + 782 -
    -   -
    +
    +
    + - + case runtime.ErrExecutorErrorInvalidPointY:
    - + + 783 -
    -   -
    +
    +
    + - + return ExecutorError_EXECUTOR_ERROR_INVALID_POINT_Y
    - + + 784 -
    -   -
    +
    +
    + - + case runtime.ErrExecutorErrorSMMainPointZMismatch:
    - + + 785 -
    -   -
    +
    +
    + - + return ExecutorError_EXECUTOR_ERROR_SM_MAIN_POINT_Z_MISMATCH
    - + + 786 -
    -   -
    +
    +
    + - + case runtime.ErrExecutorErrorSMMainBlobL2HashDataMismatch:
    - + + 787 -
    -   -
    +
    +
    + - + return ExecutorError_EXECUTOR_ERROR_SM_MAIN_BLOB_L2_HASH_DATA_MISMATCH
    - + + 788 -
    -   -
    +
    +
    + - + case runtime.ErrExecutorErrorSMMainBatchHashDataMismatch:
    - + + 789 -
    -   -
    +
    +
    + - + return ExecutorError_EXECUTOR_ERROR_SM_MAIN_BATCH_HASH_DATA_MISMATCH
    - + + 790 -
    -   -
    +
    +
    + - + case runtime.ErrExecutorErrorSMMainInvalidBlobType:
    - + + 791 -
    -   -
    +
    +
    + - + return ExecutorError_EXECUTOR_ERROR_SM_MAIN_INVALID_BLOB_TYPE
    - + + 792 -
    -   -
    +
    +
    + - + case runtime.ErrExecutorErrorSMMainUnrestoredSavedContext:
    - + + 793 -
    -   -
    +
    +
    + - + return ExecutorError_EXECUTOR_ERROR_SM_MAIN_UNRESTORED_SAVED_CONTEXT
    - + + 794 -
    -   -
    +
    +
    + - + case runtime.ErrExecutorErrorSMMainInvalidMemoryCtx:
    - + + 795 -
    -   -
    +
    +
    + - + return ExecutorError_EXECUTOR_ERROR_SM_MAIN_INVALID_MEMORY_CTX
    - + + 796 -
    +
    +
      -
    + }
    - + + 797 -
    +
    +
     
    - + + 798 -
    +
    +
      -
    + return ErrCodeExecutorUnknown
    - + + 799 -
    +
    +
      -
    + }
    - + + 800 -
    -   +
    +
    + -
    - + + 801 -
    -   -
    +
    +
    + - + // RomBlobErr returns an instance of error related to the ExecutorError
    - + + 802 -
    -   -
    +
    +
    + - + func RomBlobErr(errorCode RomBlobError) error {
    - + + 803 -
    -   -
    +
    +
    + - + switch errorCode {
    - + + 804 -
    -   -
    +
    +
    + - + case RomBlobError_ROM_BLOB_ERROR_UNSPECIFIED:
    - + + 805 -
    -   -
    +
    +
    + - + return ErrROMBlobUnspecified
    - + + 806 -
    -   -
    +
    +
    + - + case RomBlobError_ROM_BLOB_ERROR_NO_ERROR:
    - + + 807 -
    -   -
    +
    +
    + - + return nil
    - + + 808 -
    -   -
    +
    +
    + - + case RomBlobError_ROM_BLOB_ERROR_INVALID_PARSING:
    - + + 809 -
    -   -
    +
    +
    + - + return runtime.ErrROMBlobInvalidParsing
    - + + 810 -
    -   -
    +
    +
    + - + case RomBlobError_ROM_BLOB_ERROR_INVALID_MSB_BYTE:
    - + + 811 -
    -   -
    +
    +
    + - + return runtime.ErrROMBlobInvalidMSBByte
    - + + 812 -
    -   -
    +
    +
    + - + case RomBlobError_ROM_BLOB_ERROR_INVALID_ZK_GAS_LIMIT:
    - + + 813 -
    -   -
    +
    +
    + - + return runtime.ErrROMBlobInvalidZKGasLimit
    - + + 814 -
    -   -
    +
    +
    + - + case RomBlobError_ROM_BLOB_ERROR_INVALID_BLOB_TYPE:
    - + + 815 -
    -   -
    +
    +
    + - + return runtime.ErrROMBlobInvalidBlobType
    - + + 816 -
    -   -
    +
    +
    + - + case RomBlobError_ROM_BLOB_ERROR_INVALID_COMPRESSION_TYPE:
    - + + 817 -
    -   -
    +
    +
    + - + return runtime.ErrROMBlobInvalidCompressionType
    - + + 818 -
    -   -
    +
    +
    + - + case RomBlobError_ROM_BLOB_ERROR_INVALID_FORCED_BATCHES:
    - + + 819 -
    -   -
    +
    +
    + - + return runtime.ErrROMBlobInvalidForcedBatches
    - + + 820 -
    -   -
    +
    +
    + - + case RomBlobError_ROM_BLOB_ERROR_INVALID_TOTALBODY_LEN:
    - + + 821 -
    -   -
    +
    +
    + - + return runtime.ErrROMBlobInvalidTotalBodyLen
    - + + 822 -
    -   -
    +
    +
    + - + }
    - + + 823 -
    -   -
    +
    +
    + - + return ErrROMBlobUnknown
    - + + 824 -
    -   -
    +
    +
    + - + }
    - + + 825 -
    -   +
    +
    + -
    - + + 826 -
    -   -
    +
    +
    + - + // RomBlobErrorCode returns the error code for a given error
    - + + 827 -
    -   -
    +
    +
    + - + func RomBlobErrorCode(err error) RomBlobError {
    - + + 828 -
    -   -
    +
    +
    + - + switch err {
    - + + 829 -
    -   -
    +
    +
    + - + case nil:
    - + + 830 -
    -   -
    +
    +
    + - + return RomBlobError_ROM_BLOB_ERROR_NO_ERROR
    - + + 831 -
    -   -
    +
    +
    + - + case runtime.ErrROMBlobInvalidParsing:
    - + + 832 -
    -   -
    +
    +
    + - + return RomBlobError_ROM_BLOB_ERROR_INVALID_PARSING
    - + + 833 -
    -   -
    +
    +
    + - + case runtime.ErrROMBlobInvalidMSBByte:
    - + + 834 -
    -   -
    +
    +
    + - + return RomBlobError_ROM_BLOB_ERROR_INVALID_MSB_BYTE
    - + + 835 -
    -   -
    +
    +
    + - + case runtime.ErrROMBlobInvalidZKGasLimit:
    - + + 836 -
    -   -
    +
    +
    + - + return RomBlobError_ROM_BLOB_ERROR_INVALID_ZK_GAS_LIMIT
    - + + 837 -
    -   -
    +
    +
    + - + case runtime.ErrROMBlobInvalidBlobType:
    - + + 838 -
    -   -
    +
    +
    + - + return RomBlobError_ROM_BLOB_ERROR_INVALID_BLOB_TYPE
    - + + 839 -
    -   -
    +
    +
    + - + case runtime.ErrROMBlobInvalidCompressionType:
    - + + 840 -
    -   -
    +
    +
    + - + return RomBlobError_ROM_BLOB_ERROR_INVALID_COMPRESSION_TYPE
    - + + 841 -
    -   -
    +
    +
    + - + case runtime.ErrROMBlobInvalidForcedBatches:
    - + + 842 -
    -   -
    +
    +
    + - + return RomBlobError_ROM_BLOB_ERROR_INVALID_FORCED_BATCHES
    - + + 843 -
    -   -
    +
    +
    + - + case runtime.ErrROMBlobInvalidTotalBodyLen:
    - + + 844 -
    -   -
    +
    +
    + - + return RomBlobError_ROM_BLOB_ERROR_INVALID_TOTALBODY_LEN
    - + + 845 -
    -   -
    +
    +
    + - + }
    - + + 846 -
    -   -
    +
    +
    + - + return ErrCodeROMBlobUnknown
    - + + 847 -
    -   -
    +
    +
    + - + }
    - - -
    -   -
    +
    +
    +
    +
    + + + + + - - - - - - @@ -71113,73 +262848,68 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - + - - - - - - @@ -71213,73 +262943,68 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - + - - - - - - @@ -71303,63 +263028,68 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - + - + + - - - - @@ -71773,13 +263503,13 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - @@ -71793,63 +263523,68 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - + - + + - - - - @@ -72262,2520 +263997,2078 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0


    - - -
    +
     
    - + + 20 -
    +
    +
      -
    + ErrROMUnknown = fmt.Errorf("unknown ROM error")
    - + + 21 -
    +
    +
      -
    + // ErrCodeROMUnknown indicates an unknown ROM error
    - + + 22 -
    +
    +
      -
    + ErrCodeROMUnknown = RomError(math.MaxInt32)
    - + + 23 -
    +
    +
      -
    + )
    - + + 24 -
    +
    +
     
    - + + 25 -
    +
    +
      -
    + // RomErr returns an instance of error related to the ExecutorError
    - - -
    -   -
    -
    +
    +
     
    - + + 96 -
    +
    +
      -
    + return runtime.ErrInvalidTxChangeL2BlockLimitTimestamp
    - + + 97 -
    +
    +
      -
    + case RomError_ROM_ERROR_INVALID_TX_CHANGE_L2_BLOCK_MIN_TIMESTAMP:
    - + + 98 -
    +
    +
      -
    + return runtime.ErrInvalidTxChangeL2BlockMinTimestamp
    - + + 99 -
    +
    +
      -
    + }
    - + + 100 -
    +
    +
      -
    + return ErrROMUnknown
    - + + 101 -
    +
    +
      -
    + }
    - - -
    -   -
    -
    +
    +
     
    - + + 172 -
    +
    +
      -
    + return RomError_ROM_ERROR_INVALID_TX_CHANGE_L2_BLOCK_LIMIT_TIMESTAMP
    - + + 173 -
    +
    +
      -
    + case runtime.ErrInvalidTxChangeL2BlockMinTimestamp:
    - + + 174 -
    +
    +
      -
    + return RomError_ROM_ERROR_INVALID_TX_CHANGE_L2_BLOCK_MIN_TIMESTAMP
    - + + 175 -
    +
    +
      -
    + }
    - + + 176 -
    +
    +
      -
    + return ErrCodeROMUnknown
    - + + 177 -
    +
    +
      -
    + }
    - + +
     
    -
    +
    + 456 + +
      -
    + return runtime.ErrExecutorErrorInvalidUpdateMerkleTree
    - + + 457 -
    +
    +
      -
    + case ExecutorError_EXECUTOR_ERROR_SM_MAIN_INVALID_TX_STATUS_ERROR:
    - + + 458 -
    +
    +
      -
    + return runtime.ErrExecutorErrorSMMainInvalidTxStatusError
    - + + 459 -
    +
    +
      -
    + }
    - + + 460 -
    +
    +
      -
    + return ErrExecutorUnknown
    - + + 461 -
    +
    +
      -
    + }
    - + + 462 -
    +
    +
     
    - + +
     
    -
    +
    + 698 + +
      -
    + return ExecutorError_EXECUTOR_ERROR_INVALID_UPDATE_MERKLE_TREE
    - + + 699 -
    +
    +
      -
    + case runtime.ErrExecutorErrorSMMainInvalidTxStatusError:
    - + + 700 -
    +
    +
      -
    + return ExecutorError_EXECUTOR_ERROR_SM_MAIN_INVALID_TX_STATUS_ERROR
    -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +
    -
     
    -
    - 6 + 701
      - "errors" + }
    - 7 + 702
      - "fmt" +
    - 8 + 703
      - "math/big" -
    -
    - 9 - -
    - + - "strings" + return ErrCodeExecutorUnknown
    - 10 + 704
      - "sync" + }
    - 11 + + -
    +
    +
      - "testing" +
    - 12 + + -
    +
    +
      - "time" +
    -
     
    -
    - 5417 + + -
    +
    +
      - assert.ElementsMatch(t, []int{13, 14, 15}, results[4]) +
    - 5418 + + -
    +
    +
      - assert.ElementsMatch(t, []int{16}, results[5]) +
    - 5419 + + -
    +
    +
      - } -
    -
    - 5420 - -
    - +
    - 5421 - -
    - + - func TestSendRawTransactionJSONRPCCallWithPolicyApplied(t *testing.T) { -
    -
    - 5422 - -
    - + - // Set up the sender -
    -
    - 5423 - -
    - + - allowedPrivateKey, err := crypto.HexToECDSA(strings.TrimPrefix("0x28b2b0318721be8c8339199172cd7cc8f5e273800a35616ec893083a4b32c02e", "0x")) -
    -
    - 5424 - -
    - + - require.NoError(t, err) -
    -
    - 5425 - -
    - + - allowed, err := bind.NewKeyedTransactorWithChainID(allowedPrivateKey, big.NewInt(1)) -
    -
    - 5426 - -
    - + - require.NoError(t, err) -
    -
    - 5427 + + -
    - + +
    +
    +  
    - 5428 - -
    - + - disallowedPrivateKey, err := crypto.HexToECDSA(strings.TrimPrefix("0xdeadbeef8721be8c8339199172cd7cc8f5e273800a35616ec893083a4b32c02e", "0x")) -
    -
    - 5429 - -
    - + - require.NoError(t, err) -
    -
    - 5430 - -
    - + - disallowed, err := bind.NewKeyedTransactorWithChainID(disallowedPrivateKey, big.NewInt(1)) -
    -
    - 5431 - -
    - + - require.NoError(t, err) -
    -
    - 5432 - -
    - + - require.NotNil(t, disallowed) -
    -
    - 5433 + + -
    - + +
    +
    +  
    - 5434 - -
    - + - allowedContract := common.HexToAddress("0x1") -
    -
    - 5435 - -
    - + - disallowedContract := common.HexToAddress("0x2") -
    -
    - 5436 + + -
    - + +
    +
    +  
    - 5437 - -
    - + - senderDenied := types.NewRPCError(types.AccessDeniedCode, "sender disallowed send_tx by policy") -
    -
    - 5438 - -
    - + - contractDenied := types.NewRPCError(types.AccessDeniedCode, "contract disallowed send_tx by policy") -
    -
    - 5439 - -
    - + - deployDenied := types.NewRPCError(types.AccessDeniedCode, "sender disallowed deploy by policy") -
    -
    - 5440 + + -
    - + +
    +
    +  
    - 5441 - -
    - + - cfg := getSequencerDefaultConfig() -
    -
    - 5442 - -
    - + - s, m, _ := newMockedServerWithCustomConfig(t, cfg) -
    -
    - 5443 - -
    - + - defer s.Stop() -
    -
    - 5444 + + -
    - + +
    +
    +  
    - 5445 - -
    - + - type testCase struct { -
    -
    - 5446 - -
    - + - Name string -
    -
    - 5447 - -
    - + - Input string -
    -
    - 5448 - -
    - + - ExpectedResult *common.Hash -
    -
    - 5449 - -
    - + - ExpectedError types.Error -
    -
    - 5450 - -
    - + - Prepare func(t *testing.T, tc *testCase) -
    -
    - 5451 - -
    - + - SetupMocks func(t *testing.T, m *mocksWrapper, tc testCase) -
    -
    - 5452 - -
    - + - } -
    -
    - 5453 + + -
    - + +
    +
    +  
    - 5454 - -
    - + - testCases := []testCase{ -
    -
    - 5455 - -
    - + - { -
    -
    - 5456 - -
    - + - Name: "Sender & contract on allow list, accepted", -
    -
    - 5457 - -
    - + - Prepare: func(t *testing.T, tc *testCase) { -
    -
    - 5458 - -
    - + - tx := ethTypes.NewTransaction(1, allowedContract, big.NewInt(1), uint64(1), big.NewInt(1), []byte{}) -
    -
    - 5459 + + -
    - + +
    +
    +  
    - 5460 - -
    - + - signedTx, err := allowed.Signer(allowed.From, tx) -
    -
    - 5461 - -
    - + - require.NoError(t, err) -
    -
    - 5462 + + -
    - + +
    +
    +  
    - 5463 - -
    - + - txBinary, err := signedTx.MarshalBinary() -
    -
    - 5464 - -
    - + - require.NoError(t, err) -
    -
    - 5465 + + -
    - + +
    +
    +  
    - 5466 - -
    - + - rawTx := hex.EncodeToHex(txBinary) -
    -
    - 5467 - -
    - + - require.NoError(t, err) -
    -
    - 5468 + + -
    - + +
    +
    +  
    - 5469 - -
    - + - tc.Input = rawTx -
    -
    - 5470 - -
    - + - expectedHash := signedTx.Hash() -
    -
    - 5471 - -
    - + - tc.ExpectedResult = &expectedHash -
    -
    - 5472 - -
    - + - tc.ExpectedError = nil -
    -
    - 5473 - -
    - + - }, -
    -
    - 5474 - -
    - + - SetupMocks: func(t *testing.T, m *mocksWrapper, tc testCase) { -
    -
    - 5475 - -
    - + - m.Pool. -
    -
    - 5476 - -
    - + - On("AddTx", context.Background(), mock.IsType(ethTypes.Transaction{}), ""). -
    -
    - 5477 - -
    - + - Return(nil). -
    -
    - 5478 - -
    - + - Once() -
    -
    - 5479 + + -
    - + - m.Pool. +
    +
    +   +
    - 5480 + + -
    - + - On("CheckPolicy", context.Background(), pool.SendTx, allowedContract). +
    +
    +   +
    - 5481 + + -
    - + - Return(true, nil). +
    +
    +   +
    - 5482 + + -
    - + - Once() +
    +
    +   +
    - 5483 + + -
    - + - m.Pool. +
    +
    +   +
    - 5484 + + -
    - + - On("CheckPolicy", context.Background(), pool.SendTx, allowed.From). +
    +
    +   +
    - 5485 + + -
    - + - Return(true, nil). +
    +
    +   +
    - 5486 + + -
    - + - Once() +
    +
    +   +
    - 5487 + + -
    - + - }, +
    +
    +   +
    - 5488 + + -
    - + - }, +
    +
    +   +
    - 5489 + + -
    - + - { +
    +
    +   +
    - 5490 + + -
    - + - Name: "Contract not on allow list, rejected", +
    +
    +   +
    - 5491 + + -
    - + - Prepare: func(t *testing.T, tc *testCase) { +
    +
    +   +
    - 5492 + + -
    - + - tx := ethTypes.NewTransaction(1, disallowedContract, big.NewInt(1), uint64(1), big.NewInt(1), []byte{}) +
    +
    +   +
    - 5493 + + -
    - + +
    +
    +  
    - 5494 + + -
    - + - signedTx, err := allowed.Signer(allowed.From, tx) +
    +
    +   +
    - 5495 + + -
    - + - require.NoError(t, err) +
    +
    +   +
    - 5496 + + -
    - + +
    +
    +  
    - 5497 + + -
    - + - txBinary, err := signedTx.MarshalBinary() +
    +
    +   +
    - 5498 + + -
    - + - require.NoError(t, err) +
    +
    +   +
    - 5499 + + -
    - + +
    +
    +  
    - 5500 + + -
    - + - rawTx := hex.EncodeToHex(txBinary) +
    +
    +   +
    - 5501 + + -
    - + - require.NoError(t, err) +
    +
    +   +
    - 5502 + + -
    - + +
    +
    +  
    - 5503 + + -
    - + - tc.Input = rawTx +
    +
    +   +
    - 5504 + + -
    - + - tc.ExpectedResult = nil +
    +
    +   +
    - 5505 + + -
    - + - tc.ExpectedError = contractDenied +
    +
    +   +
    - 5506 + + -
    - + - }, +
    +
    +   +
    - 5507 + + -
    - + - SetupMocks: func(t *testing.T, m *mocksWrapper, tc testCase) { +
    +
    +   +
    - 5508 + + -
    - + - m.Pool. +
    +
    +   +
    - 5509 + + -
    - + - On("CheckPolicy", context.Background(), pool.SendTx, disallowedContract). +
    +
    +   +
    - 5510 + + -
    - + - Return(false, contractDenied). +
    +
    +   +
    - 5511 + + -
    - + - Once() +
    +
    +   +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/runtime/instrumentation/tracers/native/gen_callframe_json.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - + + +
    +
    @@ -16,7 +16,7 @@
    +
    - 5512 + + 16 +
    - + - }, +   + // MarshalJSON marshals as JSON.
    - 5513 + + 17 +
    - + - }, +   + func (c callFrame) MarshalJSON() ([]byte, error) {
    - 5514 + + 18 +
    - + - { +   + type callFrame0 struct {
    - 5515 + + 19 +
    - + - Name: "Sender not on allow list, rejected", + - + Type fakevm.OpCode `json:"-"`
    - 5516 + + 20 +
    - + - Prepare: func(t *testing.T, tc *testCase) { +   + From common.Address `json:"from"`
    - 5517 + + 21 +
    - + - tx := ethTypes.NewTransaction(1, allowedContract, big.NewInt(1), uint64(1), big.NewInt(1), []byte{}) +   + Gas hexutil.Uint64 `json:"gas"`
    - 5518 + + 22 +
    - + -
    +   + GasUsed hexutil.Uint64 `json:"gasUsed"`
    - 5519 + +
    @@ -50,7 +50,7 @@
    +
    + 50 +
    - + - signedTx, err := disallowed.Signer(disallowed.From, tx) +   + // UnmarshalJSON unmarshals from JSON.
    - 5520 + + 51 +
    - + - require.NoError(t, err) +   + func (c *callFrame) UnmarshalJSON(input []byte) error {
    - 5521 + + 52 +
    - + -
    +   + type callFrame0 struct {
    - 5522 + + 53 +
    - + - txBinary, err := signedTx.MarshalBinary() + - + Type *fakevm.OpCode `json:"-"`
    - 5523 + + 54 +
    - + - require.NoError(t, err) +   + From *common.Address `json:"from"`
    - 5524 + + 55 +
    - + -
    +   + Gas *hexutil.Uint64 `json:"gas"`
    - 5525 + + 56 +
    - + - rawTx := hex.EncodeToHex(txBinary) +   + GasUsed *hexutil.Uint64 `json:"gasUsed"` +
    +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - + + +
    +
     
    - 5526 + + 16 +
    - + - require.NoError(t, err) +   + // MarshalJSON marshals as JSON.
    - 5527 + + 17 +
    - + -
    +   + func (c callFrame) MarshalJSON() ([]byte, error) {
    - 5528 + + 18 +
    - + - tc.Input = rawTx +   + type callFrame0 struct {
    - 5529 + + 19 +
    + - tc.ExpectedResult = nil + Type fakevm.OpCode `json:"-"`
    - 5530 + + 20 +
    - + - tc.ExpectedError = senderDenied +   + From common.Address `json:"from"`
    - 5531 + + 21 +
    - + - }, +   + Gas hexutil.Uint64 `json:"gas"`
    - 5532 + + 22 +
    - + - SetupMocks: func(t *testing.T, m *mocksWrapper, tc testCase) { +   + GasUsed hexutil.Uint64 `json:"gasUsed"`
    - 5533 + +
     
    +
    + 50 +
    - + - m.Pool. +   + // UnmarshalJSON unmarshals from JSON.
    - 5534 + + 51 +
    - + - On("CheckPolicy", context.Background(), pool.SendTx, allowedContract). +   + func (c *callFrame) UnmarshalJSON(input []byte) error {
    - 5535 + + 52 +
    - + - Return(true, nil). +   + type callFrame0 struct {
    - 5536 + + 53 +
    + - Once() + Type *fakevm.OpCode `json:"-"`
    - 5537 + + 54 +
    - + - m.Pool. +   + From *common.Address `json:"from"`
    - 5538 + + 55 +
    - + - On("CheckPolicy", context.Background(), pool.SendTx, disallowed.From). +   + Gas *hexutil.Uint64 `json:"gas"`
    - 5539 + + 56 +
    - + - Return(false, senderDenied). +   + GasUsed *hexutil.Uint64 `json:"gasUsed"` +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/runtime/runtime.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +
    +
    @@ -83,11 +83,6 @@
    - 5540 + + 83 +
    - + - Once() +   + // ErrInvalidTxChangeL2BlockMinTimestamp indicates that the change l2 block transaction has trigger an error while executing
    - 5541 + + 84 +
    - + - }, +   + ErrInvalidTxChangeL2BlockMinTimestamp = errors.New("indicates that the change l2 block transaction has trigger an error while executing (min timestamp)")
    - 5542 + + 85 +
    - + - }, +   +
    - 5543 + + 86 +
    - + - { + - + // Start of V3 errors
    - 5544 + + 87 +
    - + - Name: "Unsigned tx with allowed contract, accepted", // for backward compatibility + - +
    - 5545 + + 88 +
    - + - Prepare: func(t *testing.T, tc *testCase) { + - + // ErrInvalidL1InfoTreeIndex indicates that the l1 info tree index added is not valid since its value is 0
    - 5546 + + 89 +
    - + - tx := ethTypes.NewTransaction(1, allowedContract, big.NewInt(1), uint64(1), big.NewInt(1), []byte{}) + - + ErrInvalidL1InfoTreeIndex = errors.New("l1 info tree index is invalid")
    - 5547 + + 90 +
    - + + -
    - 5548 + + 91 +
    - + - txBinary, err := tx.MarshalBinary() +   + // EXECUTOR ERRORS
    - 5549 + + 92 +
    - + - require.NoError(t, err) +   + // ===============
    - 5550 + + 93 +
    - + +  
    - 5551 - -
    - + - rawTx := hex.EncodeToHex(txBinary) -
    +
    +
    @@ -327,67 +322,6 @@
    - 5552 + + 327 +
    - + - require.NoError(t, err) +   + // ErrExecutorErrorSMMainInvalidTxStatusError indicates that the TX has an invalid status-error combination
    - 5553 + + 328 +
    - + -
    +   + ErrExecutorErrorSMMainInvalidTxStatusError = errors.New("tx has an invalid status-error combination")
    - 5554 + + 329 +
    - + - tc.Input = rawTx +   +
    - 5555 + + 330 +
    - + - expectedHash := tx.Hash() + - + // Start of V3 errors
    - 5556 + + 331 +
    - + - tc.ExpectedResult = &expectedHash + - +
    - 5557 + + 332 +
    - + - tc.ExpectedError = nil + - + // ErrExecutorErrorInvalidPreviousL1InfoTreeRoot indicates that the input parameter previous_l1_info_tree_root is invalid
    - 5558 + + 333 +
    - + - }, + - + ErrExecutorErrorInvalidPreviousL1InfoTreeRoot = errors.New("previous_l1_info_tree_root is invalid")
    - 5559 + + 334 +
    - + - SetupMocks: func(t *testing.T, m *mocksWrapper, tc testCase) { + - + // ErrExecutorErrorInvalidForcedHashData indicates that the input parameter forced_hash_data is invalid
    - 5560 + + 335 +
    - + - m.Pool. + - + ErrExecutorErrorInvalidForcedHashData = errors.New("forced_hash_data is invalid")
    - 5561 + + 336 +
    - + - On("AddTx", context.Background(), mock.IsType(ethTypes.Transaction{}), ""). + - + // ErrExecutorErrorInvalidForcedDataGlobalExitRoot indicates that the input parameter forced_data.global_exit_root is invalid
    - 5562 + + 337 +
    - + - Return(nil). + - + ErrExecutorErrorInvalidForcedDataGlobalExitRoot = errors.New("forced_data.global_exit_root is invalid")
    - 5563 + + 338 +
    - + - Once() + - + // ErrExecutorErrorInvalidForcedDataBlockHashL1 indicates that the input parameter forced_data.block_hash_l1 is invalid
    - 5564 + + 339 +
    - + - // policy does not reject this case for backward compat + - + ErrExecutorErrorInvalidForcedDataBlockHashL1 = errors.New("forced_data.block_hash_l1 is invalid")
    - 5565 + + 340 +
    - + - }, + - + // ErrExecutorErrorInvalidL1DataV3InitialHistoricRoot indicates that the input parameter L1 Data initiali_historic_root is invalid
    - 5566 + + 341 +
    - + - }, + - + ErrExecutorErrorInvalidL1DataV3InitialHistoricRoot = errors.New("L1 Data initiali_historic_root is invalid")
    - 5567 + + 342 +
    - + - { + - + // ErrExecutorErrorInvalidOldBlobStateRoot indicates that the input parameter old_blob_state_root is invalid
    - 5568 + + 343 +
    - + - Name: "Unsigned tx with disallowed contract, rejected", + - + ErrExecutorErrorInvalidOldBlobStateRoot = errors.New("old_blob_state_root is invalid")
    - 5569 + + 344 +
    - + - Prepare: func(t *testing.T, tc *testCase) { + - + // ErrExecutorErrorInvalidOldBlobAccInputHash indicates that the input parameter old_blob_acc_input_hash is invalid
    - 5570 + + 345 +
    - + - tx := ethTypes.NewTransaction(1, disallowedContract, big.NewInt(1), uint64(1), big.NewInt(1), []byte{}) + - + ErrExecutorErrorInvalidOldBlobAccInputHash = errors.New("old_blob_acc_input_hash is invalid")
    - 5571 + + 346 +
    - + -
    + - + // ErrExecutorErrorInvalidLastL1InfoTreeRoot indicates that the input parameter last_l1_info_tree_root is invalid
    - 5572 + + 347 +
    - + - signedTx, err := disallowed.Signer(disallowed.From, tx) + - + ErrExecutorErrorInvalidLastL1InfoTreeRoot = errors.New("last_l1_info_tree_root is invalid")
    - 5573 + + 348 +
    - + - require.NoError(t, err) + - + // ErrExecutorErrorInvalidNewBlobStateRoot indicates that the input parameter new_blob_state_root is invalid
    - 5574 + + 349 +
    - + -
    + - + ErrExecutorErrorInvalidNewBlobStateRoot = errors.New("new_blob_state_root is invalid")
    - 5575 + + 350 +
    - + - txBinary, err := signedTx.MarshalBinary() + - + // ErrExecutorErrorInvalidNewBlobAccInputHash indicates that the input parameter new_blob_acc_input_hash is invalid
    - 5576 + + 351 +
    - + - require.NoError(t, err) + - + ErrExecutorErrorInvalidNewBlobAccInputHash = errors.New("new_blob_acc_input_hash is invalid")
    - 5577 + + 352 +
    - + -
    + - + // ErrExecutorErrorInvalidBlobData indicates that the input parameter blob_data is invalid
    - 5578 + + 353 +
    - + - rawTx := hex.EncodeToHex(txBinary) + - + ErrExecutorErrorInvalidBlobData = errors.New("blob_data is invalid")
    - 5579 + + 354 +
    - + - require.NoError(t, err) + - + // ErrExecutorErrorInvalidZKGasLimit indicates that the input parameter zk_gas_limit is invalid
    - 5580 + + 355 +
    - + -
    + - + ErrExecutorErrorInvalidZKGasLimit = errors.New("zk_gas_limit is invalid")
    - 5581 + + 356 +
    - + - tc.Input = rawTx + - + // ErrExecutorErrorInvalidPointZ indicates that the input parameter point_z is invalid
    - 5582 + + 357 +
    - + - tc.ExpectedResult = nil + - + ErrExecutorErrorInvalidPointZ = errors.New("point_z is invalid")
    - 5583 + + 358 +
    - + - tc.ExpectedError = contractDenied + - + // ErrExecutorErrorInvalidPointY indicates that the input parameter point_y is invalid
    - 5584 + + 359 +
    - + - }, + - + ErrExecutorErrorInvalidPointY = errors.New("point_y is invalid")
    - 5585 + + 360 +
    - + - SetupMocks: func(t *testing.T, m *mocksWrapper, tc testCase) { + - + // ErrExecutorErrorSMMainPointZMismatch indicates that the input parameter point_z is different from the one calculated by the executor
    - 5586 + + 361 +
    - + - m.Pool. + - + ErrExecutorErrorSMMainPointZMismatch = errors.New("point_z mismatch")
    - 5587 + + 362 +
    - + - On("CheckPolicy", context.Background(), pool.SendTx, disallowedContract). + - + // ErrExecutorErrorSMMainBlobL2HashDataMismatch indicates that the input parameter blob L2 data hash is different from the one calculated by the executor
    - 5588 + + 363 +
    - + - Return(false, contractDenied). + - + ErrExecutorErrorSMMainBlobL2HashDataMismatch = errors.New("blob L2 hash data mismatch")
    - 5589 + + 364 +
    - + - Once() + - + // ErrExecutorErrorSMMainBatchHashDataMismatch indicates that the input parameter batch data hash is different from the one calculated by the executor
    - 5590 + + 365 +
    - + - }, + - + ErrExecutorErrorSMMainBatchHashDataMismatch = errors.New("batch hash data mismatch")
    - 5591 + + 366 +
    - + - }, + - + // ErrExecutorErrorSMMainInvalidBlobType indicates that the input parameter blob type is invalid
    - 5592 + + 367 +
    - + - { + - + ErrExecutorErrorSMMainInvalidBlobType = errors.New("invalid blob type")
    - 5593 + + 368 +
    - + - Name: "Send invalid tx input", // for backward compatibility + - + // ErrExecutorErrorSMMainUnrestoredSavedContext indicates that at least one saved context was not restored before finishing the execution
    - 5594 + + 369 +
    - + - Prepare: func(t *testing.T, tc *testCase) { + - + ErrExecutorErrorSMMainUnrestoredSavedContext = errors.New("unrestored saved context")
    - 5595 + + 370 +
    - + - tc.Input = "0x1234" + - + // ErrExecutorErrorSMMainInvalidMemoryCtx indicates that the memory context polynomial was assigned an invalid value
    - 5596 + + 371 +
    - + - tc.ExpectedResult = nil + - + ErrExecutorErrorSMMainInvalidMemoryCtx = errors.New("invalid memory ctx")
    - 5597 + + 372 +
    - + - tc.ExpectedError = types.NewRPCError(types.InvalidParamsErrorCode, "invalid tx input") + - +
    - 5598 + + 373 +
    - + - }, + - + // ROM BLOB ERRORS
    - 5599 + + 374 +
    - + - SetupMocks: func(t *testing.T, m *mocksWrapper, tc testCase) {}, + - + // ===============
    - 5600 + + 375 +
    - + - }, + - +
    - 5601 + + 376 +
    - + - { + - + // ErrROMBlobInvalidParsing indicates that has been an error while parsing the blob data
    - 5602 + + 377 +
    - + - Name: "Sender not on deploy allow list, rejected", + - + ErrROMBlobInvalidParsing = errors.New("error while parsing the blob data")
    - 5603 + + 378 +
    - + - Prepare: func(t *testing.T, tc *testCase) { + - + // ErrROMBlobInvalidMSBByte indicates that the MSB on one field element is different than zero (only for blob_type = 1)
    - 5604 + + 379 +
    - + - deployAddr := common.HexToAddress("0x0") + - + ErrROMBlobInvalidMSBByte = errors.New("MSB on one field element is different than zero")
    - 5605 + + 380 +
    - + - tx := ethTypes.NewTransaction(1, deployAddr, big.NewInt(1), uint64(1), big.NewInt(1), []byte{}) + - + // ErrROMBlobInvalidZKGasLimit not enough zk_gas_limit supplied to pay for batches proofs
    - 5606 + + 381 +
    - + -
    + - + ErrROMBlobInvalidZKGasLimit = errors.New("not enough zk_gas_limit supplied to pay for batches proofs")
    - 5607 + + 382 +
    - + - signedTx, err := disallowed.Signer(disallowed.From, tx) + - + // ErrROMBlobInvalidBlobType blob_type not supported
    - 5608 + + 383 +
    - + - require.NoError(t, err) + - + ErrROMBlobInvalidBlobType = errors.New("blob_type not supported")
    - 5609 + + 384 +
    - + -
    + - + // ErrROMBlobInvalidCompressionType compression type not supported
    - 5610 + + 385 +
    - + - txBinary, err := signedTx.MarshalBinary() + - + ErrROMBlobInvalidCompressionType = errors.New("compression type not supported")
    - 5611 + + 386 +
    - + - require.NoError(t, err) + - + // ErrROMBlobInvalidForcedBatches fblobtype = 2 and numBatches > 1
    - 5612 + + 387 +
    - + -
    + - + ErrROMBlobInvalidForcedBatches = errors.New("fblobtype = 2 and numBatches > 1")
    - 5613 + + 388 +
    - + - rawTx := hex.EncodeToHex(txBinary) + - + // ErrROMBlobInvalidTotalBodyLen totalBodyLen != blobDataLen - 1 (byte compression) - 4 (bytes totalBodyLen)
    - 5614 + + 389 +
    - + - require.NoError(t, err) + - + ErrROMBlobInvalidTotalBodyLen = errors.New("totalBodyLen != blobDataLen - 1 (byte compression) - 4 (bytes totalBodyLen)")
    - 5615 + + 390 +
    - + + -
    - 5616 + + 391 +
    - + - tc.Input = rawTx +   + // GRPC ERRORS
    - 5617 + + 392 +
    - + - tc.ExpectedResult = nil +   + // ===========
    - 5618 + + 393 +
    - + - tc.ExpectedError = deployDenied +   +
    +
    +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    +
     
    - 5619 + + 83 +
    - + - }, +   + // ErrInvalidTxChangeL2BlockMinTimestamp indicates that the change l2 block transaction has trigger an error while executing
    - 5620 + + 84 +
    - + - SetupMocks: func(t *testing.T, m *mocksWrapper, tc testCase) { +   + ErrInvalidTxChangeL2BlockMinTimestamp = errors.New("indicates that the change l2 block transaction has trigger an error while executing (min timestamp)")
    - 5621 + + 85 +
    - + - m.Pool. +   +
    - 5622 + + -
    - + - On("CheckPolicy", context.Background(), pool.Deploy, disallowed.From). +
    +
    +   +
    - 5623 + + -
    - + - Return(false, nil). +
    +
    +   +
    - 5624 + + -
    - + - Once() +
    +
    +   +
    - 5625 + + -
    - + - }, +
    +
    +   +
    - 5626 + + -
    - + - }, +
    +
    +   +
    - 5627 + + 86 +
    - + - } +   + // EXECUTOR ERRORS
    - 5628 + + 87 +
    - + -
    +   + // ===============
    - 5629 + + 88 +
    - + - for _, testCase := range testCases { +   +
    - 5630 + +
     
    +
    + 322 +
    - + - t.Run(testCase.Name, func(t *testing.T) { +   + // ErrExecutorErrorSMMainInvalidTxStatusError indicates that the TX has an invalid status-error combination
    - 5631 + + 323 +
    - + - tc := testCase +   + ErrExecutorErrorSMMainInvalidTxStatusError = errors.New("tx has an invalid status-error combination")
    - 5632 + + 324 +
    - + - tc.Prepare(t, &tc) +   +
    - 5633 + + -
    - + - tc.SetupMocks(t, m, tc) +
    +
    +   +
    - 5634 + + -
    - + +
    +
    +  
    - 5635 + + -
    - + - res, err := s.JSONRPCCall("eth_sendRawTransaction", tc.Input) +
    +
    +   +
    - 5636 + + -
    - + - require.NoError(t, err) +
    +
    +   +
    - 5637 + + -
    - + +
    +
    +  
    - 5638 + + -
    - + - assert.Equal(t, float64(1), res.ID) +
    +
    +   +
    - 5639 + + -
    - + - assert.Equal(t, "2.0", res.JSONRPC) +
    +
    +   +
    - 5640 + + -
    - + +
    +
    +  
    - 5641 + + -
    - + - if res.Result != nil || tc.ExpectedResult != nil { +
    +
    +   +
    - 5642 + + -
    - + - var result common.Hash +
    +
    +   +
    - 5643 + + -
    - + - err = json.Unmarshal(res.Result, &result) +
    +
    +   +
    - 5644 + + -
    - + - require.NoError(t, err) +
    +
    +   +
    - 5645 + + -
    - + - assert.Equal(t, *tc.ExpectedResult, result) +
    +
    +   +
    - 5646 + + -
    - + - } +
    +
    +   +
    - 5647 + + -
    - + - if res.Error != nil || tc.ExpectedError != nil { +
    +
    +   +
    - 5648 + + -
    - + - assert.Equal(t, tc.ExpectedError.ErrorCode(), res.Error.Code) +
    +
    +   +
    - 5649 + + -
    - + - assert.Equal(t, tc.ExpectedError.Error(), res.Error.Message) +
    +
    +   +
    - 5650 + + -
    - + - } +
    +
    +   +
    - 5651 + + -
    - + - }) +
    +
    +   +
    - 5652 + + -
    - + - } +
    +
    +   +
    - 5653 + + -
    - + - } +
    +
    +   +
    -
    + + + + + +
    +   +
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/endpoints_zkevm.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - + + +
    -
    @@ -204,6 +204,42 @@
    - 204 + + -
    +
    +
      - }) +
    - 205 + + -
    +
    +
      - } +
    - 206 + + -
    +
    +
     
    @@ -75142,42 +266435,146 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 207 + 325
      - // GetFullBlockByNumber returns information about a block by block number + // GRPC ERRORS
    - 208 + 326
      - func (z *ZKEVMEndpoints) GetFullBlockByNumber(number types.BlockNumber, fullTx bool) (interface{}, types.Error) { + // ===========
    - 209 + 327
      - return z.txMan.NewDbTxScope(z.state, func(ctx context.Context, dbTx pgx.Tx) (interface{}, types.Error) { +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/state.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -75261,422 +266763,515 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - + + + - - - - + + +
    -
    @@ -516,7 +552,7 @@
    +
    @@ -32,18 +32,17 @@
    - 516 + 32 + +
    +   + type State struct { +
    +
    + 33 + +
    +   + cfg Config +
    +
    + 34 + +
    +   + storage +
    +
    + 35 + +
    + - + executorClient executor.ExecutorServiceClient +
    +
    + 36 + +
    + - + tree *merkletree.StateTree +
    +
    + 37 + +
    + - + eventLog *event.EventLog +
    +
    + 38 + +
    + - + l1InfoTree *l1infotree.L1InfoTree +
    +
    + 39 + +
    + - + l1InfoTreeRecursive *l1infotree.L1InfoTreeRecursive +
    +
    + 40
    @@ -75187,62 +266584,167 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 517 + 41
      - if txEGP.Cmp(txGasPrice) == -1 { // txEGP < txGasPrice + newL2BlockEvents chan NewL2BlockEvent
    - 518 + 42
      - // We need to "round" the final effectiveGasPrice to a 256 fraction of the txGasPrice + newL2BlockEventHandlers []NewL2BlockEventHandler +
    +
    + 43 + +
    +   + } +
    +
    + 44 + +
    +   +
    +
    +
    + 45 + +
    +   + // NewState creates a new State
    - 519 + 46
    - - txEGPPct, err = z.pool.CalculateEffectiveGasPricePercentage(txGasPrice, txEGP) + func NewState(cfg Config, storage storage, executorClient executor.ExecutorServiceClient, stateTree *merkletree.StateTree, eventLog *event.EventLog, mt *l1infotree.L1InfoTree, mtr *l1infotree.L1InfoTreeRecursive) *State {
    - 520 + 47
      - if err != nil { + var once sync.Once
    - 521 + 48
      - return nil, nil, types.NewRPCError(types.DefaultErrorCode, "failed to calculate effective gas price percentage", err, false) + once.Do(func() {
    - 522 + 49
      - } + metrics.Register() +
    +
    +
    @@ -58,7 +57,6 @@
    +
    + 58 + +
    +   + newL2BlockEvents: make(chan NewL2BlockEvent, newL2BlockEventBufferSize), +
    +
    + 59 + +
    +   + newL2BlockEventHandlers: []NewL2BlockEventHandler{}, +
    +
    + 60 + +
    +   + l1InfoTree: mt, +
    +
    + 61 + +
    + - + l1InfoTreeRecursive: mtr, +
    +
    + 62 + +
    +   + } +
    +
    + 63 + +
    +   +
    +
    +
    + 64 + +
    +   + return state
    - 204 + 32
      - }) + type State struct {
    - 205 + 33
      - } + cfg Config
    - 206 + 34
      -
    + storage
    - 207 + + 35 +
    + - // GetBatchDataByNumbers returns the batch data for batches by numbers + executorClient executor.ExecutorServiceClient
    - 208 + + 36 +
    + - func (z *ZKEVMEndpoints) GetBatchDataByNumbers(filter types.BatchFilter) (interface{}, types.Error) { + tree *merkletree.StateTree
    - 209 + + 37 +
    + - return z.txMan.NewDbTxScope(z.state, func(ctx context.Context, dbTx pgx.Tx) (interface{}, types.Error) { + eventLog *event.EventLog
    - 210 + + 38 +
    + - batchNumbers := make([]uint64, 0, len(filter.Numbers)) + l1InfoTree *l1infotree.L1InfoTree
    - 211 + + -
    - + - for _, bn := range filter.Numbers { +
    +
    +   +
    - 212 + + 39 +
    - + - n, rpcErr := bn.GetNumericBatchNumber(ctx, z.state, z.etherman, dbTx) +   +
    - 213 + + 40 +
    - + - if rpcErr != nil { +   + newL2BlockEvents chan NewL2BlockEvent
    - 214 + + 41 +
    - + - return nil, rpcErr +   + newL2BlockEventHandlers []NewL2BlockEventHandler
    - 215 + + 42 +
    - + - } +   + }
    - 216 + + 43 +
    - + - batchNumbers = append(batchNumbers, n) +   +
    - 217 + + 44 +
    - + - } +   + // NewState creates a new State
    - 218 + + 45 +
    + -
    + func NewState(cfg Config, storage storage, executorClient executor.ExecutorServiceClient, stateTree *merkletree.StateTree, eventLog *event.EventLog, mt *l1infotree.L1InfoTree) *State {
    - 219 + + 46 +
    - + - batchesData, err := z.state.GetBatchL2DataByNumbers(ctx, batchNumbers, dbTx) +   + var once sync.Once
    - 220 + + 47 +
    - + - if errors.Is(err, state.ErrNotFound) { +   + once.Do(func() {
    - 221 + + 48 +
    - + - return nil, nil +   + metrics.Register()
    - 222 + +
     
    +
    + 57 +
    - + - } else if err != nil { +   + newL2BlockEvents: make(chan NewL2BlockEvent, newL2BlockEventBufferSize),
    - 223 + + 58 +
    - + - return RPCErrorResponse(types.DefaultErrorCode, +   + newL2BlockEventHandlers: []NewL2BlockEventHandler{},
    - 224 + + 59 +
    - + - fmt.Sprintf("couldn't load batch data from state by numbers %v", filter.Numbers), err, true) +   + l1InfoTree: mt,
    - 225 + + + +
    +   +
    +
    +
    + 60 +
    - + - } +   + }
    - 226 + + 61 +
    - + +  
    - 227 + + 62 +
    - + - ret := make([]*types.BatchData, 0, len(batchNumbers)) +   + return state +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/syncinginfo_test.go + RENAMED + +
    +
    +
    +
    + + + + + - - + + + + + + + + + - - - - - - - + - + + - - - - - - - - - - - - + + +
    +
    @@ -28,7 +28,7 @@
    - 228 + + 28 + +
    +   + ctx := context.Background() +
    +
    + 29 + +
    +   + mockStorage := mocks.NewStorageMock(t) +
    +
    + 30 + +
    +   + mockExecutor := mocks.NewExecutorServiceClientMock(t) +
    +
    + 31 +
    - + - for _, n := range batchNumbers { + - + testState := state.NewState(stateCfg, mockStorage, mockExecutor, nil, nil, nil, nil)
    - 229 + + 32 +
    - + - data := &types.BatchData{Number: types.ArgUint64(n)} +   + mockStorage.EXPECT().Begin(ctx).Return(mocks.NewDbTxMock(t), nil)
    - 230 + + 33 +
    - + - if b, ok := batchesData[n]; ok { +   + dbTx, err := testState.BeginStateTransaction(ctx)
    - 231 + + 34 +
    - + - data.BatchL2Data = b +   + require.NoError(t, err)
    - 232 + +
    @@ -74,7 +74,7 @@
    +
    + 74 +
    - + - data.Empty = false +   + ctx := context.Background()
    - 233 + + 75 +
    - + - } else { +   + mockStorage := mocks.NewStorageMock(t)
    - 234 + + 76 +
    - + - data.Empty = true +   + mockExecutor := mocks.NewExecutorServiceClientMock(t)
    - 235 + + 77 +
    - + - } + - + testState := state.NewState(stateCfg, mockStorage, mockExecutor, nil, nil, nil, nil)
    - 236 + + 78 +
    - + - ret = append(ret, data) +   + mockStorage.EXPECT().Begin(ctx).Return(mocks.NewDbTxMock(t), nil)
    - 237 + + 79 +
    - + - } +   + dbTx, err := testState.BeginStateTransaction(ctx)
    - 238 + + 80 +
    - + -
    +   + require.NoError(t, err) +
    +
    +
    +
    +
    + + + + + - - - - - - - - @@ -75686,72 +267281,72 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -75761,12 +267356,12 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    +
    {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/endpoints_zkevm_test.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/test/forkid_common/common.go RENAMED
    - - - - - - - - - + - + + - - - - - - - - - - - - + + + + + + - - - - + + +
    +
     
    - 239 + + 28 +
    - + - return types.BatchDataResult{Data: ret}, nil +   + ctx := context.Background()
    - 240 + + 29 +
    - + - }) +   + mockStorage := mocks.NewStorageMock(t)
    - 241 + + 30 +
    - + - } +   + mockExecutor := mocks.NewExecutorServiceClientMock(t)
    - 242 + + 31 +
    + -
    + testState := state.NewState(stateCfg, mockStorage, mockExecutor, nil, nil, nil)
    - 243 + 32
      - // GetFullBlockByNumber returns information about a block by block number + mockStorage.EXPECT().Begin(ctx).Return(mocks.NewDbTxMock(t), nil)
    - 244 + 33
      - func (z *ZKEVMEndpoints) GetFullBlockByNumber(number types.BlockNumber, fullTx bool) (interface{}, types.Error) { + dbTx, err := testState.BeginStateTransaction(ctx)
    - 245 + 34
      - return z.txMan.NewDbTxScope(z.state, func(ctx context.Context, dbTx pgx.Tx) (interface{}, types.Error) { + require.NoError(t, err)
    - 552 + 74
      -
    + ctx := context.Background()
    - 553 + 75
      - if txEGP.Cmp(txGasPrice) == -1 { // txEGP < txGasPrice + mockStorage := mocks.NewStorageMock(t)
    - 554 + 76
      - // We need to "round" the final effectiveGasPrice to a 256 fraction of the txGasPrice + mockExecutor := mocks.NewExecutorServiceClientMock(t)
    - 555 + 77
    + - txEGPPct, err = state.CalculateEffectiveGasPricePercentage(txGasPrice, txEGP) + testState := state.NewState(stateCfg, mockStorage, mockExecutor, nil, nil, nil)
    - 556 + 78
      - if err != nil { + mockStorage.EXPECT().Begin(ctx).Return(mocks.NewDbTxMock(t), nil)
    - 557 + 79
      - return nil, nil, types.NewRPCError(types.DefaultErrorCode, "failed to calculate effective gas price percentage", err, false) + dbTx, err := testState.BeginStateTransaction(ctx)
    - 558 + 80
      - } + require.NoError(t, err)
    -
    @@ -2705,3 +2705,32 @@
    +
    @@ -53,7 +53,7 @@
    - 2705 + 53
      - }) + panic(err)
    - 2706 + 54
    @@ -75805,232 +267400,296 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 2707 + 55
      - } +
    - + + 56 -
    -   -
    +
    +
    + - + zkProverURI := testutils.GetEnv("ZKPROVER_URI", "localhost")
    - + + 57 -
    +
    +
     
    - + + 58 -
    +
    +
      -
    + executorServerConfig := executor.Config{URI: fmt.Sprintf("%s:50071", zkProverURI), MaxGRPCMessageSize: 100000000}
    - + + 59 -
    +
    +
      -
    + ExecutorClient, executorClientConn, executorCancel = executor.NewExecutorClient(ctx, executorServerConfig)
    - + +
    @@ -76,11 +76,7 @@
    -
    +
    + 76 + +
      -
    + if err != nil {
    - + + 77 -
    +
    +
      -
    + panic(err)
    - + + 78 -
    +
    +
      -
    + }
    - + + 79 -
    -   -
    +
    +
    + - + mtr, err := l1infotree.NewL1InfoTreeRecursive(32)
    - + + 80 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 81 -
    -   -
    +
    +
    + - + panic(err)
    - + + 82 -
    +
    +
    + - + } +
    +
    + 83 + +
    + - + return state.NewState(stateCfg, pgstatestorage.NewPostgresStorage(stateCfg, stateDb), ExecutorClient, stateTree, eventLog, mt, mtr) +
    +
    + 84 + +
      -
    + }
    - + + 85 -
    +
    +
     
    - + + 86 -
    +
    +
      -
    + func InitOrResetDB(cfg db.Config) {
    +
    +
    +
    +
    + + + + + - - - - - - - - + + + - - - - - + - + + - - - - + + + @@ -76074,33 +267733,33 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - @@ -76108,6 +267767,21 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    +
     
    +
    - + + 53 -
    +
    +
      -
    + panic(err)
    - + + 54 -
    +
    +
      -
    + }
    - + + 55 -
    +
    +
     
    - + + 56 -
    +
    +
    + + + zkProverURI := testutils.GetEnv("ZKPROVER_URI", "zkevm-prover") +
    +
    + 57 + +
     
    - + + 58 -
    +
    +
      -
    + executorServerConfig := executor.Config{URI: fmt.Sprintf("%s:50071", zkProverURI), MaxGRPCMessageSize: 100000000}
    - + + 59 -
    +
    +
      -
    + ExecutorClient, executorClientConn, executorCancel = executor.NewExecutorClient(ctx, executorServerConfig)
    - + +
     
    -
    +
    + 76 + +
      -
    + if err != nil {
    - + + 77 -
    +
    +
      -
    + panic(err)
    - + + 78 -
    +
    +
      -
    + } +
    +
    + 79 + +
    + + + return state.NewState(stateCfg, pgstatestorage.NewPostgresStorage(stateCfg, stateDb), ExecutorClient, stateTree, eventLog, mt)
    - + + 80 -
    +
    +
      -
    + }
    - + + 81 -
    +
    +
     
    - + + 82 -
    +
    +
      -
    + func InitOrResetDB(cfg db.Config) {
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/test/forkid_etrog/etrog_test.go + RENAMED + +
    +
    @@ -76115,326 +267789,240 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - - - - - - - + +
    -
     
    +
    @@ -98,11 +98,9 @@
    - 2705 + 98
      - }) + if len(txs) > 0 {
    - 2706 + 99
      - } + // Generate batchdata from the txs in the test and compared with the vector
    - 2707 + 100
      - } + l2block := state.L2BlockRaw{
    - 2708 + + 101 +
    - + -
    + - + ChangeL2BlockHeader: state.ChangeL2BlockHeader{
    - 2709 + + 102 +
    - + - func TestClient_BatchesByNumbers(t *testing.T) { + - + DeltaTimestamp: uint32(timestampLimit.Uint64()),
    - 2710 + + 103 +
    - + - const batchesCount = 6 + - + IndexL1InfoTree: testCase.Txs[0].IndexL1InfoTree,
    - 2711 + + 104 +
    - + -
    + - + },
    - 2712 + + 105 +
    - + - s, m, _ := newSequencerMockedServer(t) + - + Transactions: txs,
    - 2713 + + 106 +
    - + - defer s.Stop() +   + }
    - 2714 + + 107 +
    - + +  
    - 2715 - -
    - + - batchesDataMap := make(map[uint64][]byte, batchesCount) -
    -
    - 2716 - -
    - + - for i := 0; i < batchesCount; i++ { -
    -
    - 2717 + + 108 +
    - + - batchesDataMap[uint64(i+1)] = []byte(fmt.Sprintf("batch %d data", i+1)) +   + batch := state.BatchRawV2{
    - 2718 - -
    - + - } +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -76444,12 +268032,12 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    +
    {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/policy.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/trace.go RENAMED
    - - - - - - + + + @@ -76577,291 +268175,404 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - + - + + - - - - - - + + + - - - - + + +
    +
     
    - 2719 + + 98 +
    - + -
    +   + if len(txs) > 0 {
    - 2720 + + 99 +
    - + - m.State.On("GetBatchL2DataByNumbers", mock.Anything, mock.Anything, mock.Anything). +   + // Generate batchdata from the txs in the test and compared with the vector
    - 2721 + + 100 +
    - + - Return(batchesDataMap, nil).Once() +   + l2block := state.L2BlockRaw{
    - 2722 + + 101 +
    + -
    + DeltaTimestamp: uint32(timestampLimit.Uint64()),
    - 2723 + + 102 +
    + - m.State.On("BeginStateTransaction", context.Background()). + IndexL1InfoTree: testCase.Txs[0].IndexL1InfoTree,
    - 2724 + + 103 +
    + - Return(m.DbTx, nil).Once() + Transactions: txs,
    - 2725 + + -
    - + +
    +
    +  
    - 2726 - -
    - + - m.DbTx.On("Commit", context.Background()).Return(nil).Once() -
    -
    - 2727 + + -
    - + +
    +
    +  
    - 2728 - -
    - + - zkEVMClient := client.NewClient(s.ServerURL) -
    -
    - 2729 - -
    - + - reqBatchesNum := []*big.Int{big.NewInt(1), big.NewInt(3), big.NewInt(4)} -
    -
    - 2730 - -
    - + - result, err := zkEVMClient.BatchesByNumbers(context.Background(), reqBatchesNum) -
    -
    - 2731 - -
    - + - require.NoError(t, err) -
    -
    - 2732 - -
    - + - require.Len(t, result, len(reqBatchesNum)) -
    -
    - 2733 - -
    - + - for i, batchNum := range reqBatchesNum { -
    -
    - 2734 + + 104 +
    - + - require.Equal(t, hex.EncodeToHex(batchesDataMap[batchNum.Uint64()]), result[i].BatchL2Data.Hex()) +   + }
    - 2735 + + 105 +
    - + - } +   +
    - 2736 + + 106 +
    - + - } +   + batch := state.BatchRawV2{
    -
    @@ -0,0 +1,61 @@
    +
    @@ -78,7 +78,15 @@
    - + + 78 -
    +
    +
      -
    + var effectivePercentage []uint8
    - + + 79 -
    +
    +
      -
    + for i := 0; i <= count; i++ {
    - + + 80 -
    +
    +
      -
    + txsToEncode = append(txsToEncode, *l2Block.Transactions()[i]) +
    +
    + 81 + +
    + - + effectivePercentage = append(effectivePercentage, MaxEffectivePercentage)
    - + + 82 -
    +
    +
      -
    + log.Debugf("trace will reprocess tx: %v", l2Block.Transactions()[i].Hash().String())
    - + + 83 -
    +
    +
      -
    + }
    - + + 84 -
    +
    +
     
    - + +
    @@ -307,7 +315,7 @@
    -
    +
    + 307 + +
      -
    + return nil, err
    - + + 308 -
    +
    +
      -
    + } else if processBatchResponseV2.Error != executor.ExecutorError_EXECUTOR_ERROR_NO_ERROR {
    - + + 309 -
    +
    +
      -
    + err = executor.ExecutorErr(processBatchResponseV2.Error)
    - + + 310 -
    +
    +
    + - + s.eventLog.LogExecutorError(ctx, processBatchResponseV2.Error, processBatchRequestV2) +
    +
    + 311 + +
      -
    + return nil, err
    - + + 312 -
    +
    +
      -
    + }
    - + + 313 -
    +
    +
     
    +
    +
    +
    +
    + + + + + - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - + + +
    +
     
    +
    - + + 78 -
    +
    +
      -
    + var effectivePercentage []uint8 +
    +
    + 79 + +
    +   + for i := 0; i <= count; i++ { +
    +
    + 80 + +
    +   + txsToEncode = append(txsToEncode, *l2Block.Transactions()[i]) +
    +
    + 81 + +
    + + + txGasPrice := tx.GasPrice() +
    +
    + 82 + +
    + + + effectiveGasPrice := receipt.EffectiveGasPrice +
    +
    + 83 + +
    + + + egpPercentage, err := CalculateEffectiveGasPricePercentage(txGasPrice, effectiveGasPrice) +
    +
    + 84 + +
    + + + if errors.Is(err, ErrEffectiveGasPriceEmpty) {
    - + + 85 -
    -   -
    +
    +
    + + + egpPercentage = MaxEffectivePercentage
    - + + 86 -
    -   -
    +
    +
    + + + } else if err != nil {
    - + + 87 -
    -   -
    +
    +
    + + + return nil, err
    - + + 88 -
    -   -
    +
    +
    + + + }
    - + + 89 -
    -   -
    +
    +
    + + + effectivePercentage = append(effectivePercentage, egpPercentage)
    - + + 90 -
    +
    +
      -
    + log.Debugf("trace will reprocess tx: %v", l2Block.Transactions()[i].Hash().String())
    - + + 91 -
    +
    +
      -
    + }
    - + + 92 -
    +
    +
     
    - - -
    -   -
    -
    +
    +
     
    - + + 315 -
    +
    +
      -
    + return nil, err
    - + + 316 -
    +
    +
      -
    + } else if processBatchResponseV2.Error != executor.ExecutorError_EXECUTOR_ERROR_NO_ERROR {
    - + + 317 -
    +
    +
      -
    + err = executor.ExecutorErr(processBatchResponseV2.Error)
    - + + 318 -
    -   -
    +
    +
    + + + s.eventLog.LogExecutorErrorV2(ctx, processBatchResponseV2.Error, processBatchRequestV2)
    - + + 319 -
    +
    +
      -
    + return nil, err
    - + + 320 -
    +
    +
      -
    + }
    - + + 321 -
    +
    +
     
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/transaction.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - + - + + - - - - - - - - - - @@ -76977,63 +268693,68 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - + - + + - - - - @@ -77047,766 +268768,747 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - -
    +
    @@ -244,6 +244,7 @@
    +
    - + + 244 -
    +
    +
      -
    + imStateRoots := make([]common.Hash, 0, numTxs)
    - + + 245 -
    +
    +
      -
    + var receipt *types.Receipt
    - + + 246 -
    +
    +
     
    @@ -76877,93 +268588,98 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - + + 247 -
    +
    +
      -
    + for i, txResponse := range l2Block.TransactionResponses {
    - + + 248 -
    +
    +
      -
    + // if the transaction has an intrinsic invalid tx error it means
    - + + 249 -
    +
    +
      -
    + // the transaction has not changed the state, so we don't store it
    - + +
    @@ -263,9 +264,10 @@
    -
    +
    + 263 + +
     
    - + + 264 -
    +
    +
      -
    + storeTxsEGPData = append(storeTxsEGPData, storeTxEGPData)
    - + + 265 -
    +
    +
     
    - + + 266 -
    -   -
    +
    +
    + - + receipt = GenerateReceipt(header.Number, txResponse, uint(i), forkID)
    - + + 267 -
    +
    +
      -
    + receipts = append(receipts, receipt)
    - + + 268 -
    +
    +
      -
    + imStateRoots = append(imStateRoots, txResp.StateRoot)
    - + + 269 -
    +
    +
      -
    + }
    - + + 270 -
    +
    +
     
    - + + 271 -
    +
    +
      -
    + // Create block to be able to calculate its hash
    - + +
    @@ -536,6 +538,7 @@
    -
    +
    + 536 + +
      -
    + TimestampLimit: l2Block.Time(),
    - + + 537 -
    +
    +
      -
    + SkipFirstChangeL2Block: cFalse,
    - + + 538 -
    +
    +
      -
    + SkipWriteBlockInfoRoot: cTrue,
    - + + 539 -
    +
    +
      -
    + }
    - + + 540 -
    +
    +
      -
    + if noZKEVMCounters {
    - + + 541 -
    +
    +
      -
    + processBatchRequestV2.NoCounters = cTrue
    -
    -
    -
    -
    - - - + - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - + +
    -
     
    +
    @@ -600,7 +603,7 @@
    - 1 + + 600 +
    - + - package jsonrpc +   +
    - 2 + + 601 +
    - + -
    +   + if err == nil && processBatchResponseV2.Error != executor.ExecutorError_EXECUTOR_ERROR_NO_ERROR {
    - 3 + + 602 +
    - + - import ( +   + err = executor.ExecutorErr(processBatchResponseV2.Error)
    - 4 + + 603 +
    - + - "context" + - + s.eventLog.LogExecutorError(ctx, processBatchResponseV2.Error, processBatchRequestV2)
    - 5 + + 604 +
    - + -
    +   + return nil, err
    - 6 + + 605 +
    - + - "github.com/0xPolygonHermez/zkevm-node/jsonrpc/types" +   + }
    - 7 + + 606 +
    - + - "github.com/0xPolygonHermez/zkevm-node/pool" +   +
    - 8 - -
    - + - "github.com/0xPolygonHermez/zkevm-node/state" -
    +
    +
    @@ -1014,6 +1017,7 @@
    - 9 + + 1014 +
    - + - "github.com/ethereum/go-ethereum/common" +   + TimestampLimit: uint64(time.Now().Unix()),
    - 10 + + 1015 +
    - + - ethTypes "github.com/ethereum/go-ethereum/core/types" +   + SkipFirstChangeL2Block: cTrue,
    - 11 + + 1016 +
    - + - ) +   + SkipWriteBlockInfoRoot: cTrue,
    - 12 + + -
    - + +
    +
    +  
    - 13 + + 1017 +
    - + - func checkPolicy(ctx context.Context, p types.PoolInterface, input string) error { +   + }
    - 14 + + 1018 +
    - + - tx, err := hexToTx(input) +   +
    - 15 + + 1019 +
    - + - if err != nil { +   + log.Debugf("EstimateGas[processBatchRequestV2.From]: %v", processBatchRequestV2.From)
    - 16 - -
    - + - // ignore it, let the later processing reject -
    +
    +
    @@ -1040,7 +1044,7 @@
    - 17 + + 1040 +
    - + - return nil +   + }
    - 18 + + 1041 +
    - + - } +   + if processBatchResponseV2.Error != executor.ExecutorError_EXECUTOR_ERROR_NO_ERROR {
    - 19 + + 1042 +
    - + -
    +   + err = executor.ExecutorErr(processBatchResponseV2.Error)
    - 20 + + 1043 +
    - + - // if the tx is signed, check the from address. If there is no from address, the tx is not rejected as it + - + s.eventLog.LogExecutorError(ctx, processBatchResponseV2.Error, processBatchRequestV2)
    - 21 + + 1044 +
    - + - // will get rejected later. This maintains backward compatibility with RPC expectations. TODO: verify this is ok behavior +   + return false, false, gasUsed, nil, err
    - 22 + + 1045 +
    - + - var from common.Address +   + }
    - 23 + + 1046 +
    - + - if from, err = state.GetSender(*tx); err != nil { +   + if processBatchResponseV2.ErrorRom != executor.RomError_ROM_ERROR_NO_ERROR {
    - 24 - -
    - + - // if not signed, then skip check, it fails later on its own +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - + - + + - - - - - - - - - - - - - - + - - - - - - - - - - -
    +
     
    - 25 + + 244 +
    - + - return nil +   + imStateRoots := make([]common.Hash, 0, numTxs)
    - 26 + + 245 +
    - + - } +   + var receipt *types.Receipt
    - 27 + + 246 +
    - + +  
    - 28 + 247
    + - switch resolvePolicy(tx) { + txIndex := 0
    - 29 + + 248 +
    - + - case pool.SendTx: +   + for i, txResponse := range l2Block.TransactionResponses {
    - 30 + + 249 +
    - + - var allow bool +   + // if the transaction has an intrinsic invalid tx error it means
    - 31 + + 250 +
    - + - if allow, err = p.CheckPolicy(ctx, pool.SendTx, *tx.To()); err != nil { +   + // the transaction has not changed the state, so we don't store it
    - 32 + +
     
    +
    + 264 +
    - + - return err +   +
    - 33 + + 265 +
    - + - } +   + storeTxsEGPData = append(storeTxsEGPData, storeTxEGPData)
    - 34 + + 266 +
    - + - if !allow { +   +
    - 35 + + 267 +
    + - return pool.ErrContractDisallowedSendTx + receipt = GenerateReceipt(header.Number, txResponse, uint(txIndex), forkID)
    - 36 + + 268 +
    - + - } +   + receipts = append(receipts, receipt)
    - 37 + + 269 +
    - + - if allow, err = p.CheckPolicy(ctx, pool.SendTx, from); err != nil { +   + imStateRoots = append(imStateRoots, txResp.StateRoot)
    - 38 + 270
    + - return err + txIndex++
    - 39 + + 271 +
    - + - } +   + }
    - 40 + + 272 +
    - + - if !allow { +   +
    - 41 + + 273 +
    - + - return pool.ErrSenderDisallowedSendTx +   + // Create block to be able to calculate its hash
    - 42 + +
     
    +
    + 538 +
    - + - } +   + TimestampLimit: l2Block.Time(),
    - 43 + + 539 +
    - + - case pool.Deploy: +   + SkipFirstChangeL2Block: cFalse,
    - 44 + + 540 +
    - + - var allow bool +   + SkipWriteBlockInfoRoot: cTrue,
    - 45 + 541
    + - // check that sender may deploy contracts + ExecutionMode: executor.ExecutionMode0,
    - 46 + + 542 +
    - + - if allow, err = p.CheckPolicy(ctx, pool.Deploy, from); err != nil { +   + }
    - 47 + + 543 +
    - + - return err +   + if noZKEVMCounters {
    - 48 + + 544 +
    - + - } +   + processBatchRequestV2.NoCounters = cTrue
    - 49 + +
     
    +
    + 603 +
    - + - if !allow { +   +
    - 50 + + 604 +
    - + - return pool.ErrSenderDisallowedDeploy +   + if err == nil && processBatchResponseV2.Error != executor.ExecutorError_EXECUTOR_ERROR_NO_ERROR {
    - 51 + + 605 +
    - + - } +   + err = executor.ExecutorErr(processBatchResponseV2.Error)
    - 52 + + 606 +
    + - } + s.eventLog.LogExecutorErrorV2(ctx, processBatchResponseV2.Error, processBatchRequestV2)
    - 53 + + 607 +
    - + - return nil +   + return nil, err
    - 54 + + 608 +
    - + - } +   + }
    - 55 + + 609 +
    - + +  
    - 56 - -
    - + - func resolvePolicy(tx *ethTypes.Transaction) pool.PolicyName { -
    +
    +
     
    - 57 + + 1017 +
    - + - if tx.To() == nil || tx.To().Hex() == common.HexToAddress("0x0").Hex() { +   + TimestampLimit: uint64(time.Now().Unix()),
    - 58 + + 1018 +
    - + - return pool.Deploy +   + SkipFirstChangeL2Block: cTrue,
    - 59 + + 1019 +
    - + - } +   + SkipWriteBlockInfoRoot: cTrue,
    - 60 + 1020
    + - return pool.SendTx + ExecutionMode: executor.ExecutionMode0,
    - 61 + + 1021 +
    - + - } +   + }
    -
    -
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/types/errors.go - RENAMED - -
    -
    -
    -
    - - - - - + + + + + - - - - @@ -77814,6 +269516,21 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    @@ -15,6 +15,8 @@
    +
    + 1022 + +
    +   +
    +
    - 15 + 1023
      - InvalidParamsErrorCode = -32602 + log.Debugf("EstimateGas[processBatchRequestV2.From]: %v", processBatchRequestV2.From)
    +
     
    +
    - 16 + 1044
      - // ParserErrorCode error code for parsing errors + }
    - 17 + 1045
      - ParserErrorCode = -32700 + if processBatchResponseV2.Error != executor.ExecutorError_EXECUTOR_ERROR_NO_ERROR {
    - + + 1046 -
    +
    +
      -
    + err = executor.ExecutorErr(processBatchResponseV2.Error)
    - + + 1047 -
    -   -
    +
    +
    + + + s.eventLog.LogExecutorErrorV2(ctx, processBatchResponseV2.Error, processBatchRequestV2)
    - 18 + 1048
      - ) + return false, false, gasUsed, nil, err
    - 19 + 1049
      -
    + }
    - 20 + 1050
      - var ( + if processBatchResponseV2.ErrorRom != executor.RomError_ROM_ERROR_NO_ERROR {
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/state/types.go + RENAMED + +
    +
    @@ -77821,7 +269538,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -77840,7 +269557,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -77850,689 +269567,637 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - -
    -
     
    +
    @@ -15,25 +15,23 @@
    @@ -77830,7 +269547,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

      - InvalidParamsErrorCode = -32602 +
      - // ParserErrorCode error code for parsing errors + // ProcessRequest represents the request of a batch process.
      - ParserErrorCode = -32700 + type ProcessRequest struct {
    + 18 +
    - + - // AccessDeniedCode error code when requests are denied + - + BatchNumber uint64
    + 19 +
    - + - AccessDeniedCode = -32800 + - + GlobalExitRoot_V1 common.Hash
    + 20 +
    -   - ) + - + L1InfoRoot_V2 common.Hash
    + 21 +
    -   -
    + - + L1InfoTreeData_V2 map[uint32]L1DataV2
    + 22 +
    -   - var ( -
    -
    -
    + - + L1InfoTreeData_V3 map[uint32]L1DataV3
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/types/interfaces.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - + + + - - -
    -
    @@ -23,8 +23,8 @@
    + 23 +
    -   - CountPendingTransactions(ctx context.Context) (uint64, error) + - + OldStateRoot common.Hash
    + 24 +
    -   - GetTransactionByHash(ctx context.Context, hash common.Hash) (*pool.Transaction, error) + - + OldAccInputHash common.Hash
    + 25 +
    -   - GetTransactionByL2Hash(ctx context.Context, hash common.Hash) (*pool.Transaction, error) -
    -
    - - -
    -   -
    + - + Transactions []byte
    + 26 +
    -   - CalculateEffectiveGasPrice(rawTx []byte, txGasPrice *big.Int, txGasUsed uint64, l1GasPrice uint64, l2GasPrice uint64) (*big.Int, error) + - + Coinbase common.Address
    + 27 +
    - - CalculateEffectiveGasPricePercentage(gasPrice *big.Int, effectiveGasPrice *big.Int) (uint8, error) + ForcedBlockHashL1 common.Hash
    + 28 +
    -   - EffectiveGasPriceEnabled() bool + - + Timestamp_V1 time.Time
    + 29 +
    -   - } + - + TimestampLimit_V2 uint64
    + 30 +
    -   -
    + - + Caller metrics.CallerLabel
    -
    @@ -64,6 +64,7 @@
    +
    + 31 + +
    + - + SkipFirstChangeL2Block_V2 bool +
    - 64 + + 32 +
    -   - GetLastVerifiedBatch(ctx context.Context, dbTx pgx.Tx) (*state.VerifiedBatch, error) + - + SkipWriteBlockInfoRoot_V2 bool
    - 65 + + 33 +
    -   - GetLastBatchNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error) + - + SkipVerifyL1InfoRoot_V2 bool
    - 66 + + 34 +
    -   - GetBatchByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.Batch, error) + - + ForkID uint64
    - + + 35 -
    -   -
    +
    +
    + - + PreviousL1InfoTreeRoot_V3 common.Hash +
    +
    + 36 + +
    + - + PreviousL1InfoTreeIndex_V3 uint32
    - 67 + 37
      - GetTransactionsByBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (txs []types.Transaction, effectivePercentages []uint8, err error) + }
    - 68 + 38
      - GetVirtualBatch(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.VirtualBatch, error) +
    - 69 + 39
      - GetVerifiedBatch(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.VerifiedBatch, error) + // L1DataV2 represents the L1InfoTree data used in ProcessRequest.L1InfoTreeData_V2 parameter
    -
    -
    -
    -
    - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    +
    @@ -44,15 +42,6 @@
    - 23 + 44
      - CountPendingTransactions(ctx context.Context) (uint64, error) + SmtProof [][]byte
    - 24 + 45
      - GetTransactionByHash(ctx context.Context, hash common.Hash) (*pool.Transaction, error) + }
    - 25 + 46
      - GetTransactionByL2Hash(ctx context.Context, hash common.Hash) (*pool.Transaction, error) +
    - 26 + + 47 +
    - + - CheckPolicy(ctx context.Context, policy pool.PolicyName, address common.Address) (bool, error) + - + // L1DataV3 represents the L1InfoTree data used in ProcessRequest.L1InfoTreeData_V3 parameter
    - 27 + + 48 +
    -   - CalculateEffectiveGasPrice(rawTx []byte, txGasPrice *big.Int, txGasUsed uint64, l1GasPrice uint64, l2GasPrice uint64) (*big.Int, error) -
    -
    - - -
    -   -
    + - + type L1DataV3 struct {
    - 28 + + 49 +
    -   - EffectiveGasPriceEnabled() bool + - + GlobalExitRoot common.Hash
    - 29 + + 50 +
    -   - } + - + BlockHashL1 common.Hash
    - 30 + + 51 +
    -   -
    + - + MinTimestamp uint64
    -
     
    -
    - 64 + + 52 +
    -   - GetLastVerifiedBatch(ctx context.Context, dbTx pgx.Tx) (*state.VerifiedBatch, error) + - + SmtProofPreviousIndex [][]byte
    - 65 + + 53 +
    -   - GetLastBatchNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error) + - + InitialHistoricRoot common.Hash
    - 66 + + 54 +
    -   - GetBatchByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.Batch, error) + - + }
    - 67 + + 55 +
    - + - GetBatchL2DataByNumbers(ctx context.Context, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error) + - +
    - 68 + 56
      - GetTransactionsByBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (txs []types.Transaction, effectivePercentages []uint8, err error) + // ProcessBatchResponse represents the response of a batch process.
    - 69 + 57
      - GetVirtualBatch(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.VirtualBatch, error) + type ProcessBatchResponse struct {
    - 70 + 58
      - GetVerifiedBatch(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.VerifiedBatch, error) + NewStateRoot common.Hash
    -
    -
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/types/types.go - RENAMED - -
    -
    -
    -
    - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + @@ -78551,364 +270216,295 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    @@ -446,6 +446,23 @@
    +
    @@ -62,25 +51,21 @@
    - 446 + 62
      - return res, nil + UsedZkCounters ZKCounters
    - 447 + 63
      - } + ReservedZkCounters ZKCounters
    - 448 + 64
      -
    + // TransactionResponses_V1 []*ProcessTransactionResponse
    - + + 65 -
    -   -
    +
    +
    + - + BlockResponses []*ProcessBlockResponse
    - + + 66 -
    -   -
    +
    +
    + - + ExecutorError error
    - + + 67 -
    -   -
    +
    +
    + - + ReadWriteAddresses map[common.Address]*InfoReadWrite
    - + + 68 -
    -   -
    +
    +
    + - + IsRomLevelError bool
    - + + 69 -
    -   -
    +
    +
    + - + IsExecutorLevelError bool
    - + + 70 -
    -   -
    +
    +
    + - + IsRomOOCError bool
    - + + 71 -
    -   -
    +
    +
    + - + FlushID uint64
    - + + 72 -
    -   -
    +
    +
    + - + StoredFlushID uint64
    - + + 73 -
    -   -
    +
    +
    + - + ProverID string
    - + + 74 -
    -   -
    +
    +
    + - + GasUsed_V2 uint64
    - + + 75 -
    -   -
    +
    +
    + - + SMTKeys_V2 []merkletree.Key
    - + + 76 -
    -   -
    +
    +
    + - + ProgramKeys_V2 []merkletree.Key
    - + + 77 -
    -   -
    +
    +
    + - + ForkID uint64
    - + + 78 -
    -   -
    +
    +
    + - + InvalidBatch_V2 bool
    - + + 79 -
    -   -
    +
    +
    + - + RomError_V2 error
    - + + 80 -
    -   -
    +
    +
    + - + OldStateRoot_V2 common.Hash
    - + + 81 -
    -   -
    +
    +
    + - + NewLastTimestamp_V3 uint64 +
    +
    + 82 + +
    + - + CurrentL1InfoTreeRoot_V3 common.Hash +
    +
    + 83 + +
    + - + CurrentL1InfoTreeIndex_V3 uint32
    - 449 + 84
      - // TransactionOrHash for union type of transaction and types.Hash + }
    - 450 + 85
      - type TransactionOrHash struct { +
    - 451 + 86
      - Hash *common.Hash + // ProcessBlockResponse represents the response of a block
    - 446 + 15
      - return res, nil +
    - 447 + 16
      - } + // ProcessRequest represents the request of a batch process.
    - 448 + 17
      -
    + type ProcessRequest struct {
    - 449 + + 18 +
    + - // BatchFilter is a list of batch numbers to retrieve + BatchNumber uint64
    - 450 + + 19 +
    + - type BatchFilter struct { + GlobalExitRoot_V1 common.Hash
    - 451 + + 20 +
    + - Numbers []BatchNumber `json:"numbers"` + L1InfoRoot_V2 common.Hash
    - 452 + + 21 +
    + - } + L1InfoTreeData_V2 map[uint32]L1DataV2
    - 453 + + 22 +
    + -
    + OldStateRoot common.Hash
    - 454 + + 23 +
    + - // BatchData is an abbreviated structure that only contains the number and L2 batch data + OldAccInputHash common.Hash
    - 455 + + 24 +
    + - type BatchData struct { + Transactions []byte
    - 456 + + 25 +
    + - Number ArgUint64 `json:"number"` + Coinbase common.Address
    - 457 + + 26 +
    + - BatchL2Data ArgBytes `json:"batchL2Data,omitempty"` + ForcedBlockHashL1 common.Hash
    - 458 + + 27 +
    + - Empty bool `json:"empty"` + Timestamp_V1 time.Time
    - 459 + + 28 +
    + - } + TimestampLimit_V2 uint64
    - 460 + + 29 +
    + -
    + Caller metrics.CallerLabel
    - 461 + + 30 +
    + - // BatchDataResult is a list of BatchData for a BatchFilter + SkipFirstChangeL2Block_V2 bool
    - 462 + + 31 +
    + - type BatchDataResult struct { + SkipWriteBlockInfoRoot_V2 bool
    - 463 + + 32 +
    + - Data []*BatchData `json:"data"` + SkipVerifyL1InfoRoot_V2 bool
    - 464 + + 33 +
    + - } + ForkID uint64
    - 465 + + 34 +
    + -
    -
    -
    - 466 - -
    -   - // TransactionOrHash for union type of transaction and types.Hash + ExecutionMode uint64
    - 467 - -
    -   - type TransactionOrHash struct { -
    -
    - 468 + + -
    +
    +
      - Hash *common.Hash -
    -
    -
    +
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/l1infotree/tree.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - @@ -79105,32 +270846,32 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -79138,6 +270879,21 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    @@ -26,7 +26,7 @@
    - 26 + + -
    +
    +
      - var err error +
    - 27 + 35
      - mt.siblings, mt.currentRoot, err = mt.initSiblings(initialLeaves) + }
    - 28 + 36
      - if err != nil { -
    -
    - 29 - -
    - - - log.Error("error initializing si siblings. Error: ", err) +
    - 30 + 37
      - return nil, err + // L1DataV2 represents the L1InfoTree data used in ProcessRequest.L1InfoTreeData_V2 parameter
    - 31 - -
    -   - } -
    +
    +
     
    - 32 + 42
      - log.Debug("Initial count: ", mt.count) + SmtProof [][]byte
    -
    @@ -34,6 +34,25 @@
    -
    - 34 + 43
      - return mt, nil + }
    - 35 + 44
      - } +
    - 36 + + -
    +
    +
     
    @@ -78994,73 +270590,218 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - + + 45 + +
    +   + // ProcessBatchResponse represents the response of a batch process. +
    +
    + 46 + +
    +   + type ProcessBatchResponse struct { +
    +
    + 47 + +
    +   + NewStateRoot common.Hash +
    +
    +
     
    +
    + 51 + +
    +   + UsedZkCounters ZKCounters +
    +
    + 52 + +
    +   + ReservedZkCounters ZKCounters +
    +
    + 53 + +
    +   + // TransactionResponses_V1 []*ProcessTransactionResponse +
    +
    + 54 + +
    + + + BlockResponses []*ProcessBlockResponse +
    +
    + 55 + +
    + + + ExecutorError error +
    +
    + 56 + +
    + + + ReadWriteAddresses map[common.Address]*InfoReadWrite +
    +
    + 57 + +
    + + + IsRomLevelError bool +
    +
    + 58 + +
    + + + IsExecutorLevelError bool +
    +
    + 59 + +
    + + + IsRomOOCError bool +
    +
    + 60 + +
    + + + FlushID uint64 +
    +
    + 61 + +
    + + + StoredFlushID uint64 +
    +
    + 62 -
    -   -
    +
    +
    + + + ProverID string
    - + + 63 -
    -   -
    +
    +
    + + + GasUsed_V2 uint64
    - + + 64 -
    -   -
    +
    +
    + + + SMTKeys_V2 []merkletree.Key
    - + + 65 -
    -   -
    +
    +
    + + + ProgramKeys_V2 []merkletree.Key
    - + + 66 -
    -   -
    +
    +
    + + + ForkID uint64
    - + + 67 -
    -   -
    +
    +
    + + + InvalidBatch_V2 bool
    - + + 68 -
    -   -
    +
    +
    + + + RomError_V2 error
    - 37 + 69
      - func buildIntermediate(leaves [][32]byte) ([][][]byte, [][32]byte) { + }
    - 38 + 70
      - var ( +
    - 39 + 71
      - nodes [][][]byte + // ProcessBlockResponse represents the response of a block
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/elderberry/processor_l1_initial_sequence_batches.go + RENAMED + +
    +
    @@ -79145,61 +270901,81 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - + + + + + + - + + +
    -
     
    +
    @@ -19,9 +19,9 @@
    - 26 + 19
      - var err error + // NewProcessorL1InitialSequenceBatchesElderberry returns instance of a processor for InitialSequenceBatchesOrder
    - 27 + 20
      - mt.siblings, mt.currentRoot, err = mt.initSiblings(initialLeaves) + func NewProcessorL1InitialSequenceBatchesElderberry(previousProcessor actions.L1EventProcessor) *ProcessorL1InitialSequenceBatchesElderberry {
    - 28 + 21
      - if err != nil { + return &ProcessorL1InitialSequenceBatchesElderberry{
    - 29 + + 22 +
    - + - log.Error("error initializing siblings. Error: ", err) + - + ProcessorBase: *actions.NewProcessorBase[ProcessorL1InitialSequenceBatchesElderberry]( +
    +
    + 23 + +
    + - + []etherman.EventOrder{etherman.InitialSequenceBatchesOrder}, +
    +
    + 24 + +
    + - + actions.ForksIdOnlyElderberry),
    - 30 + 25
      - return nil, err + previousProcessor: previousProcessor,
    - 31 + 26
    @@ -79209,301 +270985,320 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 32 + 27
      - log.Debug("Initial count: ", mt.count) + }
    +
    +
    +
    +
    + + + - - - - - - - - - - - - + + +
     
    - 34 + 19
      - return mt, nil + // NewProcessorL1InitialSequenceBatchesElderberry returns instance of a processor for InitialSequenceBatchesOrder
    - 35 + 20
      - } + func NewProcessorL1InitialSequenceBatchesElderberry(previousProcessor actions.L1EventProcessor) *ProcessorL1InitialSequenceBatchesElderberry {
    - 36 + 21
      -
    + return &ProcessorL1InitialSequenceBatchesElderberry{
    - 37 + + 22 +
    + - // ResetL1InfoTree resets the L1InfoTree. + ProcessorBase: actions.ProcessorBase[ProcessorL1InitialSequenceBatchesElderberry]{
    - 38 + + 23 +
    + - func (mt *L1InfoTree) ResetL1InfoTree(initialLeaves [][32]byte) (*L1InfoTree, error) { + SupportedEvent: []etherman.EventOrder{etherman.InitialSequenceBatchesOrder},
    - 39 + + 24 +
    + - log.Info("Resetting L1InfoTree...") + SupportedForkdIds: &actions.ForksIdOnlyElderberry},
    - 40 + + 25 +
    - + - newMT := &L1InfoTree{ +   + previousProcessor: previousProcessor,
    - 41 + + 26 +
    - + - zeroHashes: generateZeroHashes(32), // nolint:gomnd +   + }
    - 42 + + 27 +
    - + - height: 32, // nolint:gomnd +   + } +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/elderberry/processor_l1_sequence_batches.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - -
    +
    @@ -3,7 +3,6 @@
    - 43 + + 3 +
    - + - count: uint32(len(initialLeaves)), +   + import (
    - 44 + + 4 +
    - + - } +   + "context"
    - 45 + + 5 +
    - + - var err error +   + "errors"
    - 46 + + 6 +
    - + - newMT.siblings, newMT.currentRoot, err = newMT.initSiblings(initialLeaves) + - + "fmt"
    - 47 + + 7 +
    - + - if err != nil { +   + "time"
    - 48 + + 8 +
    - + - log.Error("error initializing siblings. Error: ", err) +   +
    - 49 + + 9 +
    - + - return nil, err +   + "github.com/0xPolygonHermez/zkevm-node/etherman"
    - 50 + +
    @@ -40,9 +39,9 @@
    +
    + 40 +
    - + - } +   + // NewProcessorL1SequenceBatchesElderberry returns instance of a processor for SequenceBatchesOrder
    - 51 + + 41 +
    - + - log.Debug("Reset initial count: ", newMT.count) +   + func NewProcessorL1SequenceBatchesElderberry(previousProcessor PreviousProcessor, state StateL1SequenceBatchesElderberry) *ProcessorL1SequenceBatchesElderberry {
    - 52 + + 42 +
    - + - log.Debug("Reset initial root: ", newMT.currentRoot) +   + return &ProcessorL1SequenceBatchesElderberry{
    - 53 + + 43 +
    - + - return newMT, nil + - + ProcessorBase: *actions.NewProcessorBase[ProcessorL1SequenceBatchesElderberry](
    - 54 + + 44 +
    - + - } + - + []etherman.EventOrder{etherman.SequenceBatchesOrder},
    - 55 + + 45 +
    - + -
    + - + actions.ForksIdOnlyElderberry),
    - 56 + 46
      - func buildIntermediate(leaves [][32]byte) ([][][]byte, [][32]byte) { + previousProcessor: previousProcessor,
    - 57 + 47
      - var ( + state: state,
    - 58 + 48
      - nodes [][][]byte + }
    -
    -
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/effectivegasprice.go - RENAMED - -
    -
    -
    -
    - - - + - - - - - - + + + - - - - - - - - - - - - + - - - - - - - - - - - - - - - - + + + + + + + + + + + + @@ -80062,32 +271912,32 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -80102,17 +271952,17 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + - - - + + + + + + - - - - - - - - - - - - - @@ -80415,6 +272460,26 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0


    + + + + + + + + +
    -
    @@ -2,21 +2,12 @@
    +
    @@ -60,58 +59,12 @@
    - 2 + 60
    @@ -79513,536 +271308,591 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 3 + 61
      - import ( + sbatch := l1Block.SequencedBatches[order.Pos][0]
    - 4 + 62
      - "bytes" +
    - 5 + + -
    - - - "errors" +
    +
    +   +
    - 6 + 63
      - "math/big" + if sbatch.SequencedBatchElderberryData == nil {
    - 7 + + 64 +
    -   -
    + - + log.Errorf("No elderberry sequenced batch data for batch %d", sbatch.BatchNumber)
    - 8 + + 65 +
    + - + return fmt.Errorf("no elderberry sequenced batch data for batch %d", sbatch.BatchNumber) +
    +
    + + +
      - "github.com/0xPolygonHermez/zkevm-node/log" +
    - 9 + 66
      - "github.com/0xPolygonHermez/zkevm-node/state" + }
    - 10 + + 67 +
    -   - ) + - + // We need to check that the sequence match
    - 11 + + 68 +
    -   -
    + - + err := g.sanityCheckExpectedSequence(sbatch.SequencedBatchElderberryData.InitSequencedBatchNumber, dbTx)
    - 12 + 69
    - - var ( + if err != nil {
    - 13 + 70
    - - // ErrEffectiveGasPriceEmpty happens when the effectiveGasPrice or gasPrice is nil or zero + return err
    - 14 + 71
    - - ErrEffectiveGasPriceEmpty = errors.New("effectiveGasPrice or gasPrice cannot be nil or zero") + }
    - 15 + 72
    - -
    + // We known that the MaxSequenceTimestamp is the same for all the batches so we can use the first one
    - 16 + 73
    - - // ErrEffectiveGasPriceIsZero happens when the calculated EffectiveGasPrice is zero + err = g.previousProcessor.ProcessSequenceBatches(ctx, l1Block.SequencedBatches[order.Pos], l1Block.BlockNumber, time.Unix(int64(sbatch.SequencedBatchElderberryData.MaxSequenceTimestamp), 0), dbTx)
    - 17 + 74
    - - ErrEffectiveGasPriceIsZero = errors.New("effectiveGasPrice cannot be zero") + // The last L2block timestamp must match MaxSequenceTimestamp
    - 18 + 75
    - - ) + if err != nil {
    - 19 + 76
    - -
    + return err
    - 20 + + 77 +
    -   - // EffectiveGasPrice implements the effective gas prices calculations and checks + - + }
    - 21 + + 78 +
    -   - type EffectiveGasPrice struct { + - + // It checks the timestamp of the last L2 block, but it's just log an error instead of refusing the event
    - 22 + + 79 +
    -   - cfg EffectiveGasPriceCfg + - + _ = g.sanityCheckTstampLastL2Block(sbatch.SequencedBatchElderberryData.MaxSequenceTimestamp, dbTx)
    -
    @@ -122,33 +113,8 @@
    +
    + 80 + +
    + - + return nil +
    - 122 + + 81 +
    -   - bfEffectiveGasPrice.Int(effectiveGasPrice) + - + }
    - 123 + + 82 +
    -   + -
    - 124 + + 83 +
    -   - if effectiveGasPrice.Cmp(new(big.Int).SetUint64(0)) == 0 { + - + func (g *ProcessorL1SequenceBatchesElderberry) sanityCheckExpectedSequence(initialBatchNumber uint64, dbTx pgx.Tx) error {
    - 125 + + 84 +
    - - return nil, ErrEffectiveGasPriceIsZero + // We need to check that the sequence match
    - 126 + + 85 +
    -   - } + - + lastVirtualBatchNum, err := g.state.GetLastVirtualBatchNum(context.Background(), dbTx)
    - 127 + + 86 +
    -   -
    + - + if err != nil {
    - 128 + + 87 +
    -   - return effectiveGasPrice, nil + - + log.Errorf("Error getting last virtual batch number: %s", err)
    - 129 + + 88 +
    -   - } + - + return err
    - 130 + 89
    - -
    + }
    - 131 + 90
    - - // CalculateEffectiveGasPricePercentage calculates the gas price's effective percentage + if lastVirtualBatchNum != initialBatchNumber {
    - 132 + 91
    - - func (e *EffectiveGasPrice) CalculateEffectiveGasPricePercentage(gasPrice *big.Int, effectiveGasPrice *big.Int) (uint8, error) { + log.Errorf("The last virtual batch number is not the expected one. Expected: %d (last on DB), got: %d (L1 event)", lastVirtualBatchNum+1, initialBatchNumber)
    - 133 + 92
    - - const bits = 256 + return fmt.Errorf("the last virtual batch number is not the expected one. Expected: %d (last on DB), got: %d (L1 event) err:%w", lastVirtualBatchNum+1, initialBatchNumber, ErrInvalidInitialBatchNumber)
    - 134 + 93
    - - var bitsBigInt = big.NewInt(bits) + }
    - 135 + 94 + +
    + - + return nil +
    +
    + 95
    - + } +
    +
    + 96 + +
    +  
    + 97 + +
    + - + func (g *ProcessorL1SequenceBatchesElderberry) sanityCheckTstampLastL2Block(timeLimit uint64, dbTx pgx.Tx) error { +
    +
    - 136 + 98
    - - if effectiveGasPrice == nil || gasPrice == nil || + lastVirtualBatchNum, err := g.state.GetLastVirtualBatchNum(context.Background(), dbTx)
    - 137 + 99
    - - gasPrice.Cmp(big.NewInt(0)) == 0 || effectiveGasPrice.Cmp(big.NewInt(0)) == 0 { + if err != nil {
    - 138 + 100
    - - return 0, ErrEffectiveGasPriceEmpty + log.Errorf("Error getting last virtual batch number: %s", err)
    - 139 + 101
    - - } + return err
    - 140 + 102
    - -
    + }
    - 141 + 103
    - - if gasPrice.Cmp(effectiveGasPrice) <= 0 { + lastL2Block, err := g.state.GetLastL2BlockByBatchNumber(context.Background(), lastVirtualBatchNum, dbTx)
    - 142 + 104
    - - return state.MaxEffectivePercentage, nil + if err != nil {
    - 143 + 105
    - - } + log.Errorf("Error getting last virtual batch number: %s", err)
    - 144 + 106
    - -
    + return err
    - 145 + 107
    - - // Simulate Ceil with integer division + }
    - 146 + 108
    - - b := new(big.Int).Mul(effectiveGasPrice, bitsBigInt) + if lastL2Block == nil {
    - 147 + 109
    - - b = b.Add(b, gasPrice) + //TODO: find the previous batch until we find a L2 block to check the timestamp
    - 148 + 110
    - - b = b.Sub(b, big.NewInt(1)) //nolint:gomnd + return nil
    - 149 + 111
    - - b = b.Div(b, gasPrice) + }
    - 150 + 112
    - - // At this point we have a percentage between 1-256, we need to sub 1 to have it between 0-255 (byte) + if uint64(lastL2Block.ReceivedAt.Unix()) > timeLimit {
    - 151 + 113
    - - b = b.Sub(b, big.NewInt(1)) //nolint:gomnd + log.Errorf("The last L2 block timestamp can't be greater than timeLimit. Expected: %d (L1 event), got: %d (last L2Block)", timeLimit, lastL2Block.ReceivedAt.Unix())
    - 152 + 114
    - -
    + return fmt.Errorf("wrong timestamp of last L2 block timestamp with L1 event timestamp")
    - 153 + 115
    - - return uint8(b.Uint64()), nil + }
    - 154 + 116
    - + return nil +
    +
    + 117 + +
    +   }
    - 2 + 3
      -
    + import (
    - 3 + 4
      - import ( + "context"
    - 4 + 5
      - "bytes" + "errors"
    - 5 + 6
      - "math/big" + "time"
    - 6 + 7
    @@ -80122,40 +271972,210 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 7 + 8
      - "github.com/0xPolygonHermez/zkevm-node/log" + "github.com/0xPolygonHermez/zkevm-node/etherman"
    +
     
    +
    - 8 + 39
      - "github.com/0xPolygonHermez/zkevm-node/state" + // NewProcessorL1SequenceBatchesElderberry returns instance of a processor for SequenceBatchesOrder
    - 9 + 40
      - ) + func NewProcessorL1SequenceBatchesElderberry(previousProcessor PreviousProcessor, state StateL1SequenceBatchesElderberry) *ProcessorL1SequenceBatchesElderberry {
    - 10 + 41 + +
    +   + return &ProcessorL1SequenceBatchesElderberry{ +
    +
    + 42 + +
    + + + ProcessorBase: actions.ProcessorBase[ProcessorL1SequenceBatchesElderberry]{ +
    +
    + 43 + +
    + + + SupportedEvent: []etherman.EventOrder{etherman.SequenceBatchesOrder}, +
    +
    + 44 + +
    + + + SupportedForkdIds: &actions.ForksIdOnlyElderberry}, +
    +
    + 45 + +
    +   + previousProcessor: previousProcessor, +
    +
    + 46 + +
    +   + state: state, +
    +
    + 47 + +
    +   + } +
    +
    +
     
    +
    + 59 + +
    +   +
    +
    +
    + 60 + +
    +   + sbatch := l1Block.SequencedBatches[order.Pos][0] +
    +
    + 61 + +
    +   +
    +
    +
    + 62 + +
    + + + executionTime := l1Block.ReceivedAt +
    +
    + 63 + +
    +   + if sbatch.SequencedBatchElderberryData == nil { +
    +
    + 64 + +
    + + + log.Warnf("No elderberry sequenced batch data for batch %d", sbatch.BatchNumber) +
    +
    + 65 + +
    + + + } else { +
    +
    + 66 + +
    + + + executionTime = time.Unix(int64(sbatch.SequencedBatchElderberryData.MaxSequenceTimestamp), 0) +
    +
    + 67
    +   + } +
    +
    + + +
     
    @@ -80241,118 +272261,143 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 11 + + -
    +
    +
      - // EffectiveGasPrice implements the effective gas prices calculations and checks +
    - 12 + + -
    +
    +
      - type EffectiveGasPrice struct { +
    - 13 + + -
    +
    +
      - cfg EffectiveGasPriceCfg +
    -
     
    +
    + + +
    +   +
    +
    - 113 + + -
    +
    +
      - bfEffectiveGasPrice.Int(effectiveGasPrice) +
    - 114 + + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + -
    +
    +
     
    - 115 + + -
    +
    +
      - if effectiveGasPrice.Cmp(new(big.Int).SetUint64(0)) == 0 { +
    - 116 + + -
    - + - return nil, state.ErrEffectiveGasPriceIsZero +
    +
    +   +
    - 117 + + -
    +
    +
      - } +
    - 118 + + -
    +
    +
     
    - 119 + + -
    +
    +
      - return effectiveGasPrice, nil +
    - 120 + + -
    +
    +
      - } +
    + 68 + +
    +   +
    +
    +
    + 69 + +
    + + + return g.previousProcessor.ProcessSequenceBatches(ctx, l1Block.SequencedBatches[order.Pos], l1Block.BlockNumber, executionTime, dbTx) +
    +
    @@ -80605,6 +272670,16 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0


    + 70 + +
    +   + } +
    +
    @@ -80612,12 +272687,12 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    +
    {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/effectivegasprice_test.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/etrog/processor_l1_info_tree_update.go RENAMED
    +
    +
    +
    + + + - - + + + + + + + + +
    -
    @@ -37,14 +36,14 @@
    +
     
    - 37 + 24
      - name: "Nil breakEven or gasPrice", + // NewProcessorL1InfoTreeUpdate new processor for GlobalExitRootsOrder
    - 38 + 25
      - gasPrice: big.NewInt(1), + func NewProcessorL1InfoTreeUpdate(state stateProcessorL1InfoTreeInterface) *ProcessorL1InfoTreeUpdate {
    - 39 + 26
      - expectedValue: uint8(0), + return &ProcessorL1InfoTreeUpdate{
    - 40 + + 27 +
    - - - err: ErrEffectiveGasPriceEmpty, + + + ProcessorBase: actions.ProcessorBase[ProcessorL1InfoTreeUpdate]{ +
    +
    + 28 + +
    + + + SupportedEvent: []etherman.EventOrder{etherman.L1InfoTreeOrder}, +
    +
    + 29 + +
    + + + SupportedForkdIds: &actions.ForksIdAll},
    - 41 + 30
      - }, + state: state}
    - 42 + 31
      - { + }
    - 43 + 32
      - name: "Zero breakEven or gasPrice", +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/etrog/processor_l1_info_tree_update_test.go + RENAMED + +
    +
    +
    +
    + + + + + - + + +
    +
    @@ -45,7 +45,7 @@
    +
    - 44 + 45
      - breakEven: big.NewInt(1), + if err != nil {
    - 45 + 46
      - gasPrice: big.NewInt(0), + panic(err)
    - 46 + 47
      - expectedValue: uint8(0), + }
    - 47 + 48
    - - err: ErrEffectiveGasPriceEmpty, + testState := state.NewState(stateCfg, pgstatestorage.NewPostgresStorage(stateCfg, stateDb), nil, nil, nil, mt, nil)
    - 48 + 49
      - }, +
    - 49 + 50
      - { + sut := NewProcessorL1InfoTreeUpdate(testState)
    - 50 + 51
      - name: "Both positive, gasPrice less than breakEven", + l1infotree := etherman.GlobalExitRoot{
    +
    +
    +
    +
    + + + - - @@ -80939,6 +273091,21 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    @@ -104,7 +103,7 @@
    +
     
    - 104 + 45
      -
    + if err != nil {
    - 105 + 46
      - for _, tc := range testCases { + panic(err)
    - 106 + 47
      - t.Run(tc.name, func(t *testing.T) { + }
    - 107 + + 48 +
    - - - actual, err := egp.CalculateEffectiveGasPricePercentage(tc.gasPrice, tc.breakEven) + + + testState := state.NewState(stateCfg, pgstatestorage.NewPostgresStorage(stateCfg, stateDb), nil, nil, nil, mt)
    - 108 + 49
      - assert.Equal(t, tc.err, err) +
    - 109 + 50
      - if actual != 0 { + sut := NewProcessorL1InfoTreeUpdate(testState)
    - 110 + 51
      - assert.Equal(t, tc.expectedValue, actual) + l1infotree := etherman.GlobalExitRoot{
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/etrog/processor_l1_sequence_batches.go + RENAMED + +
    +
    @@ -80946,231 +273113,285 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - + + + - - + + + + + +
    -
     
    +
    @@ -55,9 +55,9 @@
    - 24 + 55
      - ) + timeProvider syncCommon.TimeProvider,
    - 25 + 56
      -
    + halter syncinterfaces.CriticalErrorHandler) *ProcessorL1SequenceBatchesEtrog {
    - 26 + 57
      - func TestCalculateEffectiveGasPricePercentage(t *testing.T) { + return &ProcessorL1SequenceBatchesEtrog{
    - + + 58 -
    -   -
    +
    +
    + - + ProcessorBase: *actions.NewProcessorBase[ProcessorL1SequenceBatchesEtrog](
    - + + 59 -
    -   -
    +
    +
    + - + []etherman.EventOrder{etherman.SequenceBatchesOrder, etherman.InitialSequenceBatchesOrder}, +
    +
    + 60 + +
    + - + actions.ForksIdOnlyEtrog),
    - 27 + 61
      - testCases := []struct { + state: state,
    - 28 + 62
      - name string + sync: sync,
    - 29 + 63
      - breakEven *big.Int + timeProvider: timeProvider,
    -
     
    +
    @@ -287,8 +287,8 @@
    - 36 + 287
      - name: "Nil breakEven or gasPrice", +
    - 37 + 288
      - gasPrice: big.NewInt(1), + // Reset trusted state
    - 38 + 289
      - expectedValue: uint8(0), + previousBatchNumber := batch.BatchNumber - 1
    - 39 + + 290 +
    - + - err: state.ErrEffectiveGasPriceEmpty, + - + if tBatch.WIP { +
    +
    + 291 + +
    + - + log.Infof("cleaning state before inserting batch from L1. Clean until batch: %d", previousBatchNumber)
    - 40 + 292
      - }, + } else {
    - 41 + 293
      - { + log.Warnf("missmatch in trusted state detected, discarding batches until batchNum %d", previousBatchNumber)
    - 42 + 294
      - name: "Zero breakEven or gasPrice", + } +
    +
    +
    +
    +
    + + + + + + + + + + + @@ -81180,7 +273401,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    + + + @@ -81255,12 +273486,12 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    +
    {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/errors.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/etrog/processor_l1_sequence_batches_test.go RENAMED
    - - - - - - - - - + - + + - - - - - - + + + - - @@ -81423,132 +273669,147 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - + - + + - - - - - - - - + + + @@ -81558,12 +273819,12 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    +
    {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/interfaces.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/etrog/processor_l1_update_etrog_sequence.go RENAMED
    @@ -81597,7 +273858,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -81607,592 +273868,756 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - + + + + + + - + + +
    +
     
    - 43 + 55
      - breakEven: big.NewInt(1), + timeProvider syncCommon.TimeProvider,
    - 44 + 56
      - gasPrice: big.NewInt(0), + halter syncinterfaces.CriticalErrorHandler) *ProcessorL1SequenceBatchesEtrog {
    - 45 + 57
      - expectedValue: uint8(0), + return &ProcessorL1SequenceBatchesEtrog{
    - 46 + 58
    + - err: state.ErrEffectiveGasPriceEmpty, + ProcessorBase: actions.ProcessorBase[ProcessorL1SequenceBatchesEtrog]{ +
    +
    + 59 + +
    + + + SupportedEvent: []etherman.EventOrder{etherman.SequenceBatchesOrder, etherman.InitialSequenceBatchesOrder}, +
    +
    + 60 + +
    + + + SupportedForkdIds: &actions.ForksIdOnlyEtrog},
    - 47 + 61
      - }, + state: state,
    - 48 + 62
      - { + sync: sync,
    - 49 + 63
      - name: "Both positive, gasPrice less than breakEven", + timeProvider: timeProvider,
    - 103 + 287
    @@ -81190,62 +273411,72 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 104 + 288
      - for _, tc := range testCases { + // Reset trusted state
    - 105 + 289
      - t.Run(tc.name, func(t *testing.T) { + previousBatchNumber := batch.BatchNumber - 1
    - 106 + 290
    + - actual, err := state.CalculateEffectiveGasPricePercentage(tc.gasPrice, tc.breakEven) + if tBatch.StateRoot == (common.Hash{}) { +
    +
    + 291 + +
    + + + log.Warnf("cleaning state before inserting batch from L1. Clean until batch: %d", previousBatchNumber)
    - 107 + 292
      - assert.Equal(t, tc.err, err) + } else {
    - 108 + 293
      - if actual != 0 { + log.Warnf("missmatch in trusted state detected, discarding batches until batchNum %d", previousBatchNumber)
    - 109 + 294
      - assert.Equal(t, tc.expectedValue, actual) + }
    -
    @@ -76,4 +76,13 @@
    +
    @@ -268,7 +268,7 @@
    - 76 + 268
      -
    + TxHash: state.HashByteArray(batch.BatchL2Data),
    - 77 + 269
      - // ErrZeroL1GasPrice is returned if the L1 gas price is 0. + Coinbase: batch.Coinbase,
    - 78 + 270
      - ErrZeroL1GasPrice = errors.New("L1 gas price 0") + SequencerAddr: common.HexToAddress(addrExampleValues[0]),
    - + + 271 -
    -   -
    +
    +
    + - + PolygonRollupBaseEtrogBatchData: &etrogpolygonzkevm.PolygonRollupBaseEtrogBatchData{
    - + + 272 -
    +
    +
      -
    + Transactions: []byte{},
    - + + 273 -
    +
    +
      -
    + ForcedTimestamp: uint64(forcedTimestamp.Unix()),
    - + + 274 -
    +
    +
      -
    + ForcedGlobalExitRoot: forcedGlobalExitRoot,
    - + +
    @@ -284,7 +284,7 @@
    -
    +
    + 284 + +
      -
    + TxHash: state.HashByteArray(batch.BatchL2Data),
    - + + 285 -
    +
    +
      -
    + Coinbase: batch.Coinbase,
    - + + 286 -
    +
    +
      -
    + SequencerAddr: common.HexToAddress(addrExampleValues[0]),
    - + + 287 -
    +
    +
    + - + PolygonRollupBaseEtrogBatchData: &etrogpolygonzkevm.PolygonRollupBaseEtrogBatchData{ +
    +
    + 288 + +
      -
    + Transactions: []byte{},
    - + + 289 -
    +
    +
      -
    + },
    - 79 + 290
      - ) + }
    - 76 + 268
      -
    + TxHash: state.HashByteArray(batch.BatchL2Data),
    - 77 + 269
      - // ErrZeroL1GasPrice is returned if the L1 gas price is 0. + Coinbase: batch.Coinbase,
    - 78 + 270
      - ErrZeroL1GasPrice = errors.New("L1 gas price 0") + SequencerAddr: common.HexToAddress(addrExampleValues[0]),
    - 79 + + 271 +
    + -
    + PolygonRollupBaseEtrogBatchData: &polygonzkevm.PolygonRollupBaseEtrogBatchData{
    - 80 + + 272 +
    - + - // ErrSenderDisallowedSendTx is returned when transactions by sender are is disallowed by policy +   + Transactions: []byte{},
    - 81 + + 273 +
    - + - ErrSenderDisallowedSendTx = errors.New("sender disallowed send_tx by policy") +   + ForcedTimestamp: uint64(forcedTimestamp.Unix()),
    - 82 + + 274 +
    - + -
    +   + ForcedGlobalExitRoot: forcedGlobalExitRoot,
    - 83 + +
     
    +
    + 284 +
    - + - // ErrContractDisallowedSendTx is returned when transactions to contract are is disallowed by policy +   + TxHash: state.HashByteArray(batch.BatchL2Data),
    - 84 + + 285 +
    - + - ErrContractDisallowedSendTx = errors.New("contract disallowed send_tx by policy") +   + Coinbase: batch.Coinbase,
    - 85 + + 286 +
    - + -
    +   + SequencerAddr: common.HexToAddress(addrExampleValues[0]),
    - 86 + + 287 +
    + - // ErrSenderDisallowedDeploy is returned when deploy transactions are disallowed by policy + PolygonRollupBaseEtrogBatchData: &polygonzkevm.PolygonRollupBaseEtrogBatchData{
    - 87 + + 288 +
    - + - ErrSenderDisallowedDeploy = errors.New("sender disallowed deploy by policy") +   + Transactions: []byte{},
    - 88 + 289
      - ) + }, +
    +
    + 290 + +
    +   + }
    -
    @@ -38,6 +38,7 @@
    +
    @@ -38,9 +38,9 @@
    @@ -81587,7 +273848,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

      - MarkWIPTxsAsPending(ctx context.Context) error + sync syncProcessUpdateEtrogSequenceInterface,
      - GetAllAddressesBlocked(ctx context.Context) ([]common.Address, error) + timeProvider syncCommon.TimeProvider) *ProcessorL1UpdateEtrogSequence {
      - MinL2GasPriceSince(ctx context.Context, timestamp time.Time) (uint64, error) + return &ProcessorL1UpdateEtrogSequence{
    - + + 41 -
    -   -
    +
    +
    + - + ProcessorBase: *actions.NewProcessorBase[ProcessorL1UpdateEtrogSequence]( +
    +
    + 42 + +
    + - + []etherman.EventOrder{etherman.UpdateEtrogSequenceOrder}, +
    +
    + 43 + +
    + - + actions.ForksIdOnlyEtrog),
    - 41 + 44
      - GetEarliestProcessedTx(ctx context.Context) (common.Hash, error) + state: state,
    - 42 + 45
      - } + sync: sync,
    - 43 + 46
      -
    + timeProvider: timeProvider,
    +
    +
    +
    +
    + + + - - - - - - - - - - - - + + +
    -
    @@ -48,3 +49,12 @@
    +
     
    - 48 + 38
      - GetTransactionByHash(ctx context.Context, transactionHash common.Hash, dbTx pgx.Tx) (*types.Transaction, error) + sync syncProcessUpdateEtrogSequenceInterface,
    - 49 + 39
      - PreProcessTransaction(ctx context.Context, tx *types.Transaction, dbTx pgx.Tx) (*state.ProcessBatchResponse, error) + timeProvider syncCommon.TimeProvider) *ProcessorL1UpdateEtrogSequence {
    - 50 + 40
      - } + return &ProcessorL1UpdateEtrogSequence{
    - + + 41 -
    -   -
    +
    +
    + + + ProcessorBase: actions.ProcessorBase[ProcessorL1UpdateEtrogSequence]{
    - + + 42 -
    -   -
    +
    +
    + + + SupportedEvent: []etherman.EventOrder{etherman.UpdateEtrogSequenceOrder},
    - + + 43 -
    -   -
    +
    +
    + + + SupportedForkdIds: &actions.ForksIdOnlyEtrog},
    - + + 44 -
    +
    +
      -
    + state: state,
    - + + 45 -
    +
    +
      -
    + sync: sync,
    - + + 46 -
    +
    +
      -
    + timeProvider: timeProvider, +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/feijoa/processor_l1_info_tree_update.go + RENAMED + +
    +
    +
    +
    + + + + + - - + + + - - + + + + + + - - + + + + + + + + + + + + + + + + + + - - -
    +
    @@ -1,54 +0,0 @@
    - + + 1 -
    -   +
    +
    + - + package feijoa +
    +
    + 2 + +
    + -
    - + + 3 -
    -   +
    +
    + - + import ( +
    +
    + 4 + +
    + - + "context" +
    +
    + 5 + +
    + -
    - + + 6 -
    -   +
    +
    + - + "github.com/0xPolygonHermez/zkevm-node/etherman" +
    +
    + 7 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/log" +
    +
    + 8 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/state" +
    +
    + 9 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/synchronizer/actions" +
    +
    + 10 + +
    + - + "github.com/jackc/pgx/v4" +
    +
    + 11 + +
    + - + ) +
    +
    + 12 + +
    + -
    -
    + + + 13 + + +
    + - + // stateProcessorL1InfoTreeInterface interface required from state +
    + + + + 14 + + +
    + - + type stateProcessorL1InfoTreeRecursiveInterface interface { +
    + + + + 15 + + +
    + - + AddL1InfoTreeRecursiveLeaf(ctx context.Context, L1InfoTreeLeaf *state.L1InfoTreeLeaf, dbTx pgx.Tx) (*state.L1InfoTreeExitRootStorageEntry, error) +
    + + + + 16 + + +
    + - + }
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    - 38 + + 17 +
    -   - MarkWIPTxsAsPending(ctx context.Context) error + - +
    - 39 + + 18 +
    -   - GetAllAddressesBlocked(ctx context.Context) ([]common.Address, error) + - + // ProcessorL1InfoTreeUpdate implements L1EventProcessor for GlobalExitRootsOrder
    - 40 + + 19 +
    -   - MinL2GasPriceSince(ctx context.Context, timestamp time.Time) (uint64, error) + - + type ProcessorL1InfoTreeUpdate struct {
    - 41 + + 20 +
    - + - policy + - + actions.ProcessorBase[ProcessorL1InfoTreeUpdate]
    - 42 + + 21 +
    -   - GetEarliestProcessedTx(ctx context.Context) (common.Hash, error) + - + state stateProcessorL1InfoTreeRecursiveInterface
    - 43 + + 22 +
    -   + - }
    - 44 + + 23 +
    -   + -
    -
     
    -
    - 49 + + 24 +
    -   - GetTransactionByHash(ctx context.Context, transactionHash common.Hash, dbTx pgx.Tx) (*types.Transaction, error) + - + // NewProcessorL1InfoTreeUpdate new processor for GlobalExitRootsOrder
    - 50 + + 25 +
    -   - PreProcessTransaction(ctx context.Context, tx *types.Transaction, dbTx pgx.Tx) (*state.ProcessBatchResponse, error) + - + func NewProcessorL1InfoTreeUpdate(state stateProcessorL1InfoTreeRecursiveInterface) *ProcessorL1InfoTreeUpdate {
    - 51 + + 26 +
    -   - } + - + return &ProcessorL1InfoTreeUpdate{
    - 52 + + 27 +
    - + - type policy interface { + - + ProcessorBase: *actions.NewProcessorBase[ProcessorL1InfoTreeUpdate](
    - 53 + + 28 +
    - + - CheckPolicy(ctx context.Context, policy PolicyName, address common.Address) (bool, error) + - + []etherman.EventOrder{etherman.L1InfoTreeOrder},
    - 54 + + 29 +
    - + - AddAddressesToPolicy(ctx context.Context, policy PolicyName, addresses []common.Address) error + - + actions.ForksIdOnlyFeijoa),
    - 55 + + 30 +
    - + - RemoveAddressesFromPolicy(ctx context.Context, policy PolicyName, addresses []common.Address) error + - + state: state}
    - 56 + + 31 +
    - + - ClearPolicy(ctx context.Context, policy PolicyName) error + - + }
    - 57 + + 32 +
    - + - DescribePolicies(ctx context.Context) ([]Policy, error) + - +
    - 58 + + 33 +
    - + - DescribePolicy(ctx context.Context, name PolicyName) (Policy, error) + - + // Process process event
    - 59 + + 34 +
    - + - ListAcl(ctx context.Context, policy PolicyName, query []common.Address) ([]common.Address, error) + - + func (p *ProcessorL1InfoTreeUpdate) Process(ctx context.Context, order etherman.Order, l1Block *etherman.Block, dbTx pgx.Tx) error {
    - 60 + + 35 +
    - + - } + - + l1InfoTree := l1Block.L1InfoTree[order.Pos]
    -
    + + + 36 + + +
    + - + ger := state.GlobalExitRoot{
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/pgpoolstorage/policy.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +
    -
    @@ -0,0 +1,202 @@
    - + + 37 -
    -   -
    +
    +
    + - + BlockNumber: l1InfoTree.BlockNumber,
    - + + 38 -
    -   -
    +
    +
    + - + MainnetExitRoot: l1InfoTree.MainnetExitRoot,
    - + + 39 -
    -   -
    +
    +
    + - + RollupExitRoot: l1InfoTree.RollupExitRoot,
    - + + 40 -
    -   -
    +
    +
    + - + GlobalExitRoot: l1InfoTree.GlobalExitRoot,
    - + + 41 -
    -   -
    +
    +
    + - + Timestamp: l1InfoTree.Timestamp,
    - + + 42 -
    -   -
    +
    +
    + - + }
    - + + 43 -
    -   -
    +
    +
    + - + l1IntoTreeLeaf := state.L1InfoTreeLeaf{
    - + + 44 -
    -   -
    +
    +
    + - + GlobalExitRoot: ger,
    - + + 45 -
    -   -
    +
    +
    + - + PreviousBlockHash: l1InfoTree.PreviousBlockHash,
    - + + 46 -
    -   -
    +
    +
    + - + }
    - + + 47 -
    -   -
    +
    +
    + - + entry, err := p.state.AddL1InfoTreeRecursiveLeaf(ctx, &l1IntoTreeLeaf, dbTx)
    - + + 48 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 49 -
    -   -
    +
    +
    + - + log.Errorf("error storing the l1InfoTree(feijoa). BlockNumber: %d, error: %v", l1Block.BlockNumber, err)
    - + + 50 -
    -   -
    +
    +
    + - + return err
    - + + 51 -
    -   -
    +
    +
    + - + }
    - + + 52 -
    -   -
    +
    +
    + - + log.Infof("L1InfoTree(feijoa) stored. BlockNumber: %d,GER:%s L1InfoTreeIndex: %d L1InfoRoot:%s", l1Block.BlockNumber, entry.GlobalExitRoot.GlobalExitRoot, entry.L1InfoTreeIndex, entry.L1InfoTreeRoot)
    - + + 53 -
    -   -
    +
    +
    + - + return nil
    - + + 54 -
    -   -
    +
    +
    + - + }
    +
    +
    +
    +
    + + + + + + + +
    +
     
    +
    @@ -82733,3368 +275158,3398 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0


    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/feijoa/processor_l1_sequence_blobs.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    +
    @@ -1,189 +0,0 @@
    +
    - + + 1 -
    -   -
    +
    +
    + - + package feijoa
    - + + 2 -
    -   +
    +
    + -
    - + + 3 -
    -   -
    +
    +
    + - + import (
    - + + 4 -
    -   -
    +
    +
    + - + "context"
    - + + 5 -
    -   -
    +
    +
    + - + "errors"
    - + + 6 -
    -   -
    +
    +
    + - + "time"
    - + + 7 -
    -   +
    +
    + -
    - + + 8 -
    -   -
    +
    +
    + - + "github.com/0xPolygonHermez/zkevm-node/etherman"
    - + + 9 -
    -   -
    +
    +
    + - + "github.com/0xPolygonHermez/zkevm-node/log"
    - + + 10 -
    -   -
    +
    +
    + - + "github.com/0xPolygonHermez/zkevm-node/state"
    - + + 11 -
    -   -
    +
    +
    + - + "github.com/0xPolygonHermez/zkevm-node/synchronizer/actions"
    - + + 12 -
    -   -
    +
    +
    + - + commonsync "github.com/0xPolygonHermez/zkevm-node/synchronizer/common"
    - + + 13 -
    -   -
    +
    +
    + - + "github.com/ethereum/go-ethereum/common"
    - + + 14 -
    -   -
    +
    +
    + - + "github.com/jackc/pgx/v4"
    - + + 15 -
    -   -
    +
    +
    + - + )
    - + + 16 -
    -   +
    +
    + -
    - + + 17 -
    -   -
    +
    +
    + - + // stateProcessorSequenceBlobsInterface interface required from state
    - + + 18 -
    -   -
    +
    +
    + - + type stateProcessorSequenceBlobsInterface interface {
    - + + 19 -
    -   -
    +
    +
    + - + AddBlobSequence(ctx context.Context, blobSequence *state.BlobSequence, dbTx pgx.Tx) error
    - + + 20 -
    -   -
    +
    +
    + - + GetLastBlobSequence(ctx context.Context, dbTx pgx.Tx) (*state.BlobSequence, error)
    - + + 21 -
    -   -
    +
    +
    + - + AddBlobInner(ctx context.Context, blobInner *state.BlobInner, dbTx pgx.Tx) error
    - + + 22 -
    -   -
    +
    +
    + - + GetL1InfoRecursiveRootLeafByIndex(ctx context.Context, l1InfoTreeIndex uint32, dbTx pgx.Tx) (state.L1InfoTreeExitRootStorageEntry, error)
    - + + 23 -
    -   -
    +
    +
    + - + }
    - + + 24 -
    -   +
    +
    + -
    - + + 25 -
    -   -
    +
    +
    + - + type stateBlobInnerProcessor interface {
    - + + 26 -
    -   -
    +
    +
    + - + ProcessBlobInner(ctx context.Context, request state.ProcessBlobInnerProcessRequest, data []byte) (*state.ProcessBlobInnerResponse, error)
    - + + 27 -
    -   -
    +
    +
    + - + }
    - + + 28 -
    -   +
    +
    + -
    - + + 29 -
    -   -
    +
    +
    + - + // ProcessorSequenceBlobs processor for SequenceBlobs
    - + + 30 -
    -   -
    +
    +
    + - + type ProcessorSequenceBlobs struct {
    - + + 31 -
    -   -
    +
    +
    + - + actions.ProcessorBase[ProcessorL1InfoTreeUpdate]
    - + + 32 -
    -   -
    +
    +
    + - + state stateProcessorSequenceBlobsInterface
    - + + 33 -
    -   -
    +
    +
    + - + stateBlobInnerProcessor stateBlobInnerProcessor
    - + + 34 -
    -   -
    +
    +
    + - + timeProvider commonsync.TimeProvider
    - + + 35 -
    -   -
    +
    +
    + - + }
    - + + 36 -
    -   +
    +
    + -
    - + + 37 -
    -   -
    +
    +
    + - + // NewProcessorSequenceBlobs new processor for SequenceBlobs
    - + + 38 -
    -   -
    +
    +
    + - + func NewProcessorSequenceBlobs(state stateProcessorSequenceBlobsInterface, stateBlobInnerProcessor stateBlobInnerProcessor, timeProvider commonsync.TimeProvider) *ProcessorSequenceBlobs {
    - + + 39 -
    -   -
    +
    +
    + - + if timeProvider == nil {
    - + + 40 -
    -   -
    +
    +
    + - + timeProvider = &commonsync.DefaultTimeProvider{}
    - + + 41 -
    -   -
    +
    +
    + - + }
    - + + 42 -
    -   -
    +
    +
    + - + return &ProcessorSequenceBlobs{
    - + + 43 -
    -   -
    +
    +
    + - + ProcessorBase: *actions.NewProcessorBase[ProcessorL1InfoTreeUpdate](
    - + + 44 -
    -   -
    +
    +
    + - + []etherman.EventOrder{etherman.SequenceBlobsOrder},
    - + + 45 -
    -   -
    +
    +
    + - + actions.ForksIdOnlyFeijoa),
    - + + 46 -
    -   -
    +
    +
    + - + state: state,
    - + + 47 -
    -   -
    +
    +
    + - + stateBlobInnerProcessor: stateBlobInnerProcessor,
    - + + 48 -
    -   -
    +
    +
    + - + timeProvider: timeProvider,
    - + + 49 -
    -   -
    +
    +
    + - + }
    - + + 50 -
    -   -
    +
    +
    + - + }
    - + + 51 -
    -   +
    +
    + -
    - + + 52 -
    -   -
    +
    +
    + - + // Process process event
    - + + 53 -
    -   -
    +
    +
    + - + // - Store BlobSequence
    - + + 54 -
    -   -
    +
    +
    + - + // - Split BlobInner into Batches (executor)
    - + + 55 -
    -   -
    +
    +
    + - + // - Store BlobInner
    - + + 56 -
    -   -
    +
    +
    + - + func (p *ProcessorSequenceBlobs) Process(ctx context.Context, order etherman.Order, l1Block *etherman.Block, dbTx pgx.Tx) error {
    - + + 57 -
    -   -
    +
    +
    + - + seqBlobs := &l1Block.SequenceBlobs[order.Pos]
    - + + 58 -
    -   -
    +
    +
    + - + previousBlobSequence, newBlobSequence, err := p.doBlobSequence(ctx, seqBlobs, l1Block, dbTx)
    - + + 59 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 60 -
    -   -
    +
    +
    + - + return err
    - + + 61 -
    -   -
    +
    +
    + - + }
    - + + 62 -
    -   +
    +
    + -
    - + + 63 -
    -   -
    +
    +
    + - + for idx := range seqBlobs.Blobs {
    - + + 64 -
    -   -
    +
    +
    + - + blobNum := newBlobSequence.FirstBlobSequenced + uint64(idx)
    - + + 65 -
    -   -
    +
    +
    + - + log.Infof("Blob %d: blobNum:%d", idx, blobNum)
    - + + 66 -
    -   -
    +
    +
    + - + err := p.doBlobInner(ctx, blobNum, &seqBlobs.Blobs[idx], newBlobSequence, previousBlobSequence, dbTx)
    - + + 67 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 68 -
    -   -
    +
    +
    + - + return err
    - + + 69 -
    -   -
    +
    +
    + - + }
    - + + 70 -
    -   -
    +
    +
    + - + }
    - + + 71 -
    -   -
    +
    +
    + - + return nil
    - + + 72 -
    -   -
    +
    +
    + - + }
    - + + 73 -
    -   -
    +
    +
    + - + func (p *ProcessorSequenceBlobs) doBlobInner(ctx context.Context, blobNum uint64, blob *etherman.SequenceBlob, newBlobSequence, previousBlobSequence *state.BlobSequence, dbTx pgx.Tx) error {
    - + + 74 -
    -   -
    +
    +
    + - + // TODO: We have to choose which tree depending on ForkID?
    - + + 75 -
    -   -
    +
    +
    + - + leaf, err := p.state.GetL1InfoRecursiveRootLeafByIndex(ctx, blob.Params.L1InfoLeafIndex, dbTx)
    - + + 76 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 77 -
    -   -
    +
    +
    + - + return err
    - + + 78 -
    -   -
    +
    +
    + - + }
    - + + 79 -
    -   +
    +
    + -
    - + + 80 -
    -   -
    +
    +
    + - + stateBlob, err := p.convertToStateBlobInner(blob, blobNum, newBlobSequence.BlobSequenceIndex, leaf.L1InfoTreeRoot)
    - + + 81 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 82 -
    -   -
    +
    +
    + - + log.Errorf("Error converting blob to state: %v", err)
    - + + 83 -
    -   -
    +
    +
    + - + return err
    - + + 84 -
    -   -
    +
    +
    + - + }
    - + + 85 -
    -   +
    +
    + -
    - + + 86 -
    -   -
    +
    +
    + - + processRequest, err := state.NewProcessBlobInnerProcessRequest(uint64(actions.ForkIDFeijoa), stateBlob, previousBlobSequence, *newBlobSequence)
    - + + 87 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 88 -
    -   -
    +
    +
    + - + return err
    - + + 89 -
    -   -
    +
    +
    + - + }
    - + + 90 -
    -   -
    +
    +
    + - + log.Infof("storing Blob %d: BlobInner: %v", blobNum, stateBlob)
    - + + 91 -
    -   -
    +
    +
    + - + err = p.state.AddBlobInner(ctx, stateBlob, dbTx)
    - + + 92 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 93 -
    -   -
    +
    +
    + - + log.Errorf("Error storing blobInner to state: %v", err)
    - + + 94 -
    -   -
    +
    +
    + - + return err
    - + + 95 -
    -   -
    +
    +
    + - + }
    - + + 96 -
    -   -
    +
    +
    + - + response, err := p.stateBlobInnerProcessor.ProcessBlobInner(ctx, *processRequest, blob.Data)
    - + + 97 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 98 -
    -   -
    +
    +
    + - + return err
    - + + 99 -
    -   -
    +
    +
    + - + }
    - + + 100 -
    -   -
    +
    +
    + - + if response == nil {
    - + + 101 -
    -   -
    +
    +
    + - + return errors.New("response is nil")
    - + + 102 -
    -   -
    +
    +
    + - + }
    - + + 103 -
    -   -
    +
    +
    + - + log.Infof("Blob %d: response: %v", blobNum, response)
    - + + 104 -
    -   -
    +
    +
    + - + if response.IsSuccessfulExecution() {
    - + + 105 -
    -   -
    +
    +
    + - + // We need to store the batches
    - + + 106 -
    -   -
    +
    +
    + - + outcomeData := response.GetSuccesfulData()
    - + + 107 -
    -   -
    +
    +
    + - + for idx := 0; idx < outcomeData.HowManyBatches(); idx++ {
    - + + 108 -
    -   -
    +
    +
    + - + log.Infof("storing Blob %d: Batch %d: Hash:%s", blobNum, idx, outcomeData.GetBatchHash(idx).String())
    - + + 109 -
    -   -
    +
    +
    + - + // TODO: Store batch
    - + + 110 -
    -   -
    +
    +
    + - + }
    - + + 111 -
    -   -
    +
    +
    + - + } else {
    - + + 112 -
    -   -
    +
    +
    + - + err := response.GetUnifiedError()
    - + + 113 -
    -   -
    +
    +
    + - + log.Errorf("Blob %d: response is not successful: Err: %s", blobNum, err.Error())
    - + + 114 -
    -   -
    +
    +
    + - + return err
    - + + 115 -
    -   -
    +
    +
    + - + }
    - + + 116 -
    -   +
    +
    + -
    - + + 117 -
    -   -
    +
    +
    + - + return nil
    - + + 118 -
    -   -
    +
    +
    + - + }
    - + + 119 -
    -   +
    +
    + -
    - + + 120 -
    -   -
    +
    +
    + - + // returns previousBlobSequence and new one
    - + + 121 -
    -   -
    +
    +
    + - + func (p *ProcessorSequenceBlobs) doBlobSequence(ctx context.Context,
    - + + 122 -
    -   -
    +
    +
    + - + incommingSequenceBlobs *etherman.SequenceBlobs, l1Block *etherman.Block, dbTx pgx.Tx) (*state.BlobSequence, *state.BlobSequence, error) {
    - + + 123 -
    -   -
    +
    +
    + - + previousBlobSequence, err := p.state.GetLastBlobSequence(ctx, dbTx)
    - + + 124 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 125 -
    -   -
    +
    +
    + - + return nil, nil, err
    - + + 126 -
    -   -
    +
    +
    + - + }
    - + + 127 -
    -   -
    +
    +
    + - + blobSequenceIndex := p.calculateBlobSequenceIndex(previousBlobSequence)
    - + + 128 -
    -   -
    +
    +
    + - + newBlobSequence := p.convertToStateBlobSequence(incommingSequenceBlobs, blobSequenceIndex, l1Block.ReceivedAt, p.timeProvider.Now(), l1Block.BlockNumber)
    - + + 129 -
    -   -
    +
    +
    + - + log.Infof("storing BlobSequence: %v", newBlobSequence)
    - + + 130 -
    -   -
    +
    +
    + - + err = p.state.AddBlobSequence(ctx, newBlobSequence, dbTx)
    -
    + + + 131 + + +
    + - + if err != nil {
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +
    -
     
    - 1 + + 132 +
    - + - package pgpoolstorage + - + return nil, nil, err
    - 2 + + 133 +
    - + -
    + - + }
    - 3 + + 134 +
    - + - import ( + - + return previousBlobSequence, newBlobSequence, nil
    - 4 + + 135 +
    - + - "context" + - + }
    - 5 + + 136 +
    - + - "errors" + - +
    - 6 + + 137 +
    - + - "fmt" + - + func (p *ProcessorSequenceBlobs) calculateBlobSequenceIndex(previousBlobSequence *state.BlobSequence) uint64 {
    - 7 + + 138 +
    - + - "strings" + - + nextIndex := uint64(1)
    - 8 + + 139 +
    - + -
    + - + if previousBlobSequence != nil {
    - 9 + + 140 +
    - + - "github.com/0xPolygonHermez/zkevm-node/pool" + - + nextIndex = previousBlobSequence.BlobSequenceIndex + 1
    - 10 + + 141 +
    - + - "github.com/ethereum/go-ethereum/common" + - + }
    - 11 + + 142 +
    - + - "github.com/jackc/pgx/v4" + - + return nextIndex
    - 12 + + 143 +
    - + - ) + - + }
    - 13 + + 144 +
    - + + -
    - 14 + + 145 +
    - + - // CheckPolicy returns the rule for the named policy and address. If the address is associated with the policy, the rule + - + func (p *ProcessorSequenceBlobs) convertToStateBlobInner(blobInner *etherman.SequenceBlob, blobInnerNum uint64, blobSequenceIndex uint64, l1InfoTreeRoot common.Hash) (*state.BlobInner, error) {
    - 15 + + 146 +
    - + - // will be the setting for the policy. If the address is no associated with the policy, the rule will be the opposite of + - + res := &state.BlobInner{
    - 16 + + 147 +
    - + - // the policy setting. + - + BlobSequenceIndex: blobSequenceIndex,
    - 17 + + 148 +
    - + - func (p *PostgresPoolStorage) CheckPolicy(ctx context.Context, policy pool.PolicyName, address common.Address) (bool, error) { + - + BlobInnerNum: blobInnerNum, // ho trect del previousBlobSequence
    - 18 + + 149 +
    - + - sql := `SELECT + - + Type: p.convertBlobType(blobInner.Type),
    - 19 + + 150 +
    - + - CASE WHEN a.address is null THEN + - + MaxSequenceTimestamp: time.Unix(int64(blobInner.Params.MaxSequenceTimestamp), 0),
    - 20 + + 151 +
    - + - NOT p.allow + - + ZkGasLimit: blobInner.Params.ZkGasLimit,
    - 21 + + 152 +
    - + - ELSE + - + L1InfoLeafIndex: blobInner.Params.L1InfoLeafIndex,
    - 22 + + 153 +
    - + - p.allow + - + L1InfoTreeRoot: l1InfoTreeRoot,
    - 23 + + 154 +
    - + - END + - + }
    - 24 + + 155 +
    - + - FROM pool.policy p + - + if res.Type == state.TypeBlobTransaction {
    - 25 + + 156 +
    - + - LEFT JOIN pool.acl a + - + if blobInner.BlobBlobTypeParams == nil {
    - 26 + + 157 +
    - + - ON p.name = a.policy + - + return nil, errors.New("BlobBlobTypeParams from etherman is required for BlobTransaction")
    - 27 + + 158 +
    - + - AND a.address = $1 + - + }
    - 28 + + 159 +
    - + - WHERE p.name = $2` + - + res.BlobBlobTypeParams = &state.BlobBlobTypeParams{
    - 29 + + 160 +
    - + -
    + - + BlobIndex: blobInner.BlobBlobTypeParams.BlobIndex.Uint64(),
    - 30 + + 161 +
    - + - rows, err := p.db.Query(ctx, sql, address.Hex(), policy) + - + Z: blobInner.BlobBlobTypeParams.Z,
    - 31 + + 162 +
    - + -
    + - + Y: blobInner.BlobBlobTypeParams.Y,
    - 32 + + 163 +
    - + - if errors.Is(err, pgx.ErrNoRows) { + - + Commitment: blobInner.BlobBlobTypeParams.Commitment,
    - 33 + + 164 +
    - + - return false, pool.ErrNotFound + - + Proof: blobInner.BlobBlobTypeParams.Proof,
    - 34 + + 165 +
    - + - } else if err != nil { + - + }
    - 35 + + 166 +
    - + - return false, err + - + }
    - 36 + + 167 +
    - + - } + - + return res, nil
    - 37 + + 168 +
    - + -
    + - + }
    - 38 + + 169 +
    - + - defer rows.Close() + - +
    - 39 + + 170 +
    - + - if !rows.Next() { // should always be a row if the policy exists + - + func (p *ProcessorSequenceBlobs) convertBlobType(value etherman.BlobType) state.BlobType {
    - 40 + + 171 +
    - + - return false, nil + - + return state.BlobType(value)
    - 41 + + 172 +
    - + - } + - + }
    - 42 + + 173 +
    - + + -
    - 43 + + 174 +
    - + - var allow bool + - + func (p *ProcessorSequenceBlobs) convertToStateBlobSequence(etherSeqBlobs *etherman.SequenceBlobs,
    - 44 + + 175 +
    - + - err = rows.Scan(&allow) + - + nextIndex uint64,
    - 45 + + 176 +
    - + - if err != nil { + - + createAt time.Time,
    - 46 + + 177 +
    - + - return false, err + - + receviedAt time.Time,
    - 47 + + 178 +
    - + - } + - + l1BlockNumber uint64) *state.BlobSequence {
    - 48 + + 179 +
    - + - return allow, nil + - + return &state.BlobSequence{
    - 49 + + 180 +
    - + - } + - + BlobSequenceIndex: nextIndex,
    - 50 + + 181 +
    - + -
    + - + L2Coinbase: etherSeqBlobs.L2Coinbase,
    - 51 + + 182 +
    - + - // UpdatePolicy sets the allow/deny rule for the named policy + - + FirstBlobSequenced: etherSeqBlobs.EventData.LastBlobSequenced - uint64(len(etherSeqBlobs.Blobs)),
    - 52 + + 183 +
    - + - func (p *PostgresPoolStorage) UpdatePolicy(ctx context.Context, policy pool.PolicyName, allow bool) error { + - + LastBlobSequenced: etherSeqBlobs.EventData.LastBlobSequenced,
    - 53 + + 184 +
    - + - sql := "UPDATE pool.policy SET allow = $1 WHERE name = $2" + - + FinalAccInputHash: etherSeqBlobs.FinalAccInputHash,
    - 54 + + 185 +
    - + - _, err := p.db.Exec(ctx, sql, allow, string(policy)) + - + CreateAt: createAt,
    - 55 + + 186 +
    - + - if err != nil { + - + ReceivedAt: receviedAt,
    - 56 + + 187 +
    - + - return err + - + BlockNumber: l1BlockNumber,
    - 57 + + 188 +
    - + + - }
    - 58 + + 189 +
    - + - return nil + - + } +
    +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    +
     
    - 59 + + -
    - + - } +
    +
    +   +
    - 60 + + -
    - + +
    +
    +  
    - 61 + + -
    - + - // AddAddressesToPolicy adds addresses to the named policy +
    +
    +   +
    - 62 + + -
    - + - func (p *PostgresPoolStorage) AddAddressesToPolicy(ctx context.Context, policy pool.PolicyName, addresses []common.Address) error { +
    +
    +   +
    - 63 + + -
    - + - sql := "INSERT INTO pool.acl (policy, address) VALUES ($1, $2) ON CONFLICT DO NOTHING" +
    +
    +   +
    - 64 + + -
    - + - tx, err := p.db.Begin(ctx) +
    +
    +   +
    - 65 + + -
    - + - if err != nil { +
    +
    +   +
    - 66 + + -
    - + - return err +
    +
    +   +
    - 67 + + -
    - + - } +
    +
    +   +
    - 68 + + -
    - + - defer func(tx pgx.Tx, ctx context.Context) { +
    +
    +   +
    - 69 + + -
    - + - _ = tx.Rollback(ctx) +
    +
    +   +
    - 70 + + -
    - + - }(tx, ctx) +
    +
    +   +
    - 71 + + -
    - + +
    +
    +  
    - 72 + + -
    - + - for _, a := range addresses { +
    +
    +   +
    - 73 + + -
    - + - _, err = tx.Exec(ctx, sql, policy, a.Hex()) +
    +
    +   +
    - 74 + + -
    - + - if err != nil { +
    +
    +   +
    - 75 + + -
    - + - return err +
    +
    +   +
    - 76 + + -
    - + - } +
    +
    +   +
    - 77 + + -
    - + - } +
    +
    +   +
    - 78 + + -
    - + - err = tx.Commit(ctx) +
    +
    +   +
    - 79 + + -
    - + - if err != nil { +
    +
    +   +
    - 80 + + -
    - + - return nil +
    +
    +   +
    - 81 + + -
    - + - } +
    +
    +   +
    - 82 + + -
    - + - return nil +
    +
    +   +
    - 83 + + -
    - + - } +
    +
    +   +
    - 84 + + -
    - + +
    +
    +  
    - 85 + + -
    - + - // RemoveAddressesFromPolicy removes addresses from the named policy +
    +
    +   +
    - 86 + + -
    - + - func (p *PostgresPoolStorage) RemoveAddressesFromPolicy(ctx context.Context, policy pool.PolicyName, addresses []common.Address) error { +
    +
    +   +
    - 87 + + -
    - + - sql := "DELETE FROM pool.acl WHERE policy = $1 AND address = $2" +
    +
    +   +
    - 88 + + -
    - + - tx, err := p.db.Begin(ctx) +
    +
    +   +
    - 89 + + -
    - + - if err != nil { +
    +
    +   +
    - 90 + + -
    - + - return err +
    +
    +   +
    - 91 + + -
    - + - } +
    +
    +   +
    - 92 + + -
    - + - defer func(tx pgx.Tx, ctx context.Context) { +
    +
    +   +
    - 93 + + -
    - + - _ = tx.Rollback(ctx) +
    +
    +   +
    - 94 + + -
    - + - }(tx, ctx) +
    +
    +   +
    - 95 + + -
    - + +
    +
    +  
    - 96 + + -
    - + - for _, a := range addresses { +
    +
    +   +
    - 97 + + -
    - + - _, err = tx.Exec(ctx, sql, policy, a.Hex()) +
    +
    +   +
    - 98 + + -
    - + - if err != nil { +
    +
    +   +
    - 99 + + -
    - + - return err +
    +
    +   +
    - 100 + + -
    - + - } +
    +
    +   +
    - 101 + + -
    - + - } +
    +
    +   +
    - 102 + + -
    - + - err = tx.Commit(ctx) +
    +
    +   +
    - 103 + + -
    - + - if err != nil { +
    +
    +   +
    - 104 + + -
    - + - return err +
    +
    +   +
    - 105 + + -
    - + - } +
    +
    +   +
    - 106 + + -
    - + - return nil +
    +
    +   +
    - 107 + + + +
    +   +
    +
    +
    + -
    - + - } +
    +
    +   +
    - 108 + + -
    - + +
    +
    +  
    - 109 + + -
    - + - // ClearPolicy removes _all_ addresses from the named policy +
    +
    +   +
    - 110 + + -
    - + - func (p *PostgresPoolStorage) ClearPolicy(ctx context.Context, policy pool.PolicyName) error { +
    +
    +   +
    - 111 + + -
    - + - sql := "DELETE FROM pool.acl WHERE policy = $1" +
    +
    +   +
    - 112 + + -
    - + - _, err := p.db.Exec(ctx, sql, policy) +
    +
    +   +
    - 113 + + -
    - + - if err != nil { +
    +
    +   +
    - 114 + + -
    - + - return err +
    +
    +   +
    - 115 + + -
    - + - } +
    +
    +   +
    - 116 + + -
    - + - return nil +
    +
    +   +
    - 117 + + -
    - + - } +
    +
    +   +
    - 118 + + -
    - + +
    +
    +  
    - 119 + + -
    - + - // DescribePolicies return all the policies +
    +
    +   +
    - 120 + + -
    - + - func (p *PostgresPoolStorage) DescribePolicies(ctx context.Context) ([]pool.Policy, error) { +
    +
    +   +
    - 121 + + -
    - + - sql := "SELECT name, allow FROM pool.policy" +
    +
    +   +
    - 122 + + -
    - + - rows, err := p.db.Query(ctx, sql) +
    +
    +   +
    - 123 + + -
    - + - if err != nil { +
    +
    +   +
    - 124 + + -
    - + - if errors.Is(err, pgx.ErrNoRows) { +
    +
    +   +
    - 125 + + -
    - + - return nil, nil +
    +
    +   +
    - 126 + + -
    - + - } else { +
    +
    +   +
    - 127 + + -
    - + - return nil, err +
    +
    +   +
    - 128 + + -
    - + - } +
    +
    +   +
    - 129 + + -
    - + - } +
    +
    +   +
    - 130 + + -
    - + - defer rows.Close() +
    +
    +   +
    - 131 + + -
    - + +
    +
    +  
    - 132 + + -
    - + - var list []pool.Policy +
    +
    +   +
    - 133 + + -
    - + - for rows.Next() { +
    +
    +   +
    - 134 + + -
    - + - var name string +
    +
    +   +
    - 135 + + -
    - + - var allow bool +
    +
    +   +
    - 136 + + -
    - + - err = rows.Scan(&name, &allow) +
    +
    +   +
    - 137 + + -
    - + - if err != nil { +
    +
    +   +
    - 138 + + -
    - + - return nil, err +
    +
    +   +
    - 139 + + -
    - + - } +
    +
    +   +
    - 140 + + -
    - + - if pool.IsPolicy(name) { // skip unknown +
    +
    +   +
    - 141 + + -
    - + - p := pool.Policy{ +
    +
    +   +
    - 142 + + -
    - + - Name: pool.PolicyName(name), +
    +
    +   +
    - 143 + + -
    - + - Allow: allow, +
    +
    +   +
    - 144 + + -
    - + - } +
    +
    +   +
    - 145 + + -
    - + - list = append(list, p) +
    +
    +   +
    - 146 + + -
    - + - } +
    +
    +   +
    - 147 + + -
    - + - } +
    +
    +   +
    - 148 + + -
    - + - return list, nil +
    +
    +   +
    - 149 + + -
    - + - } +
    +
    +   +
    - 150 + + -
    - + +
    +
    +  
    - 151 + + -
    - + - // DescribePolicy returns the named policy +
    +
    +   +
    - 152 + + -
    - + - func (p *PostgresPoolStorage) DescribePolicy(ctx context.Context, name pool.PolicyName) (pool.Policy, error) { +
    +
    +   +
    - 153 + + -
    - + - sql := "SELECT name, allow FROM pool.policy WHERE name = $1 LIMIT 1" +
    +
    +   +
    - 154 + + -
    - + - row := p.db.QueryRow(ctx, sql, name) +
    +
    +   +
    - 155 + + -
    - + - var ( +
    +
    +   +
    - 156 + + -
    - + - pName string +
    +
    +   +
    - 157 + + -
    - + - allow bool +
    +
    +   +
    - 158 + + -
    - + - ) +
    +
    +   +
    - 159 + + -
    - + - err := row.Scan(&pName, &allow) +
    +
    +   +
    - 160 + + -
    - + - if err != nil { +
    +
    +   +
    - 161 + + -
    - + - return pool.Policy{}, err +
    +
    +   +
    - 162 + + -
    - + - } +
    +
    +   +
    - 163 + + -
    - + - return pool.Policy{ +
    +
    +   +
    - 164 + + -
    - + - Name: pool.PolicyName(pName), +
    +
    +   +
    - 165 + + -
    - + - Allow: allow, +
    +
    +   +
    - 166 + + -
    - + - }, nil +
    +
    +   +
    - 167 + + -
    - + - } +
    +
    +   +
    - 168 + + -
    - + +
    +
    +  
    - 169 + + -
    - + - // ListAcl returns a list of the addresses associated with the policy +
    +
    +   +
    - 170 + + -
    - + - func (p *PostgresPoolStorage) ListAcl( +
    +
    +   +
    - 171 + + -
    - + - ctx context.Context, policy pool.PolicyName, query []common.Address) ([]common.Address, error) { +
    +
    +   +
    - 172 + + -
    - + - sql := "SELECT address FROM pool.acl WHERE policy = $1" +
    +
    +   +
    - 173 + + -
    - + +
    +
    +  
    - 174 + + -
    - + - if len(query) > 0 { +
    +
    +   +
    - 175 + + -
    - + - var addrs []string +
    +
    +   +
    - 176 + + -
    - + - for _, a := range query { +
    +
    +   +
    - 177 + + -
    - + - addrs = append(addrs, a.Hex()) +
    +
    +   +
    - 178 + + -
    - + - } +
    +
    +   +
    - 179 + + -
    - + - sql = sql + fmt.Sprintf(" IN (%v)", strings.Join(addrs, ",")) +
    +
    +   +
    - 180 + + -
    - + - } +
    +
    +   +
    - 181 + + -
    - + +
    +
    +  
    - 182 + + -
    - + - rows, err := p.db.Query(ctx, sql, string(policy)) +
    +
    +   +
    - 183 + + -
    - + - if err != nil { +
    +
    +   +
    - 184 + + -
    - + - if errors.Is(err, pgx.ErrNoRows) { +
    +
    +   +
    - 185 + + -
    - + - return nil, nil +
    +
    +   +
    - 186 + + -
    - + - } else { +
    +
    +   +
    - 187 + + -
    - + - return nil, err +
    +
    +   +
    - 188 + + -
    - + - } +
    +
    +   +
    - 189 + + -
    - + - } +
    +
    +   +
    - 190 + + -
    - + - defer rows.Close() +
    +
    +   +
    - 191 + + -
    - + +
    +
    +  
    - 192 + + -
    - + - var addresses []common.Address +
    +
    +   +
    - 193 + + -
    - + - for rows.Next() { +
    +
    +   +
    - 194 + + -
    - + - var addr string +
    +
    +   +
    - 195 + + -
    - + - err = rows.Scan(&addr) +
    +
    +   +
    - 196 + + -
    - + - if err != nil { +
    +
    +   +
    - 197 + + -
    - + - return nil, err +
    +
    +   +
    - 198 + + -
    - + - } +
    +
    +   +
    - 199 + + -
    - + - addresses = append(addresses, common.HexToAddress(addr)) +
    +
    +   +
    - 200 + + -
    - + - } +
    +
    +   +
    - 201 + + -
    - + - return addresses, nil +
    +
    +   +
    - 202 + + -
    - + - } +
    +
    +   +
    -
    + + + + + +
    +   +
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/policy.go - RENAMED - -
    -
    -
    -
    - - - - -
    -
    @@ -0,0 +1,43 @@
    @@ -86531,6 +278986,21 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/feijoa/processor_l1_sequence_blobs_test.go + RENAMED + +
    +
    @@ -86538,1058 +279008,1025 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    +
    @@ -1,102 +0,0 @@
    + 1 +
    - + - package pool + - + package feijoa_test
    + 2 +
    - + + -
    + 3 +
    - + - import "github.com/ethereum/go-ethereum/common" + - + import (
    + 4 +
    - + -
    + - + "context"
    + 5 +
    - + - // PolicyName is a named policy + - + "os"
    + 6 +
    - + - type PolicyName string + - + "testing"
    + 7 +
    - + + -
    + 8 +
    - + - const ( + - + "github.com/0xPolygonHermez/zkevm-node/db"
    + 9 +
    - + - // SendTx is the name of the policy that governs that an address may send transactions to pool + - + "github.com/0xPolygonHermez/zkevm-node/etherman"
    + 10 +
    - + - SendTx PolicyName = "send_tx" + - + "github.com/0xPolygonHermez/zkevm-node/log"
    + 11 +
    - + - // Deploy is the name of the policy that governs that an address may deploy a contract + - + "github.com/0xPolygonHermez/zkevm-node/state"
    + 12 +
    - + - Deploy PolicyName = "deploy" + - + "github.com/0xPolygonHermez/zkevm-node/state/pgstatestorage"
    + 13 +
    - + - ) + - + "github.com/0xPolygonHermez/zkevm-node/state/runtime/executor"
    + 14 +
    - + -
    + - + "github.com/0xPolygonHermez/zkevm-node/synchronizer/actions/feijoa"
    + 15 +
    - + - // Policy describes state of a named policy + - + "github.com/0xPolygonHermez/zkevm-node/test/dbutils"
    + 16 +
    - + - type Policy struct { + - + "github.com/ethereum/go-ethereum/common"
    + 17 +
    - + - Name PolicyName + - + "github.com/jackc/pgconn"
    + 18 +
    - + - Allow bool + - + "github.com/jackc/pgx/v4"
    + 19 +
    - + - } + - + "github.com/stretchr/testify/require"
    + 20 +
    - + -
    + - + )
    + 21 +
    - + - // Desc returns the string representation of a policy rule + - +
    + 22 +
    - + - func (p *Policy) Desc() string { + - + // This test is a exploratory test used to develop. It use a sequencedBlob on Sepolia
    + 23 +
    - + - if p.Allow { + - + // It need Database, a prover >7.x and L1 client
    + 24 +
    - + - return "allow" + - + // TODO: Remove this test or convert to a test than can be executed
    + 25 +
    - + - } + - + func TestProcessASequenceBlobUsingCallDataFromSepolia(t *testing.T) {
    + 26 +
    - + - return "deny" + - + l1url := os.Getenv("ZKEVM_NODE_ETHERMAN_URL")
    + 27 +
    - + - } + - + consensusl1url := os.Getenv("ZKEVM_NODE_ETHERMAN_CONSENSUSL1URL")
    + 28 +
    - + -
    + - + if l1url == "" || consensusl1url == "" {
    + 29 +
    - + - // Acl describes exception to a named Policy by address + - + // You can set un vscode editing setings.json
    + 30 +
    - + - type Acl struct { + - + // "go.testEnvVars": {
    + 31 +
    - + - PolicyName PolicyName + - + // "ZKEVM_NODE_ETHERMAN_URL": "url1",
    + 32 +
    - + - Address common.Address + - + // "ZKEVM_NODE_ETHERMAN_CONSENSUSL1URL": "url2",
    + 33 +
    - + - } + - + //}
    + 34 +
    - + -
    + - + t.Skip("ZKEVM_NODE_ETHERMAN_URL or ZKEVM_NODE_ETHERMAN_CONSENSUSL1URL not set")
    + 35 +
    - + - // IsPolicy tests if a string represents a known named Policy + - + }
    + 36 +
    - + - func IsPolicy(name string) bool { + - + cfg := etherman.Config{
    + 37 +
    - + - for _, p := range []PolicyName{SendTx, Deploy} { + - + URL: l1url,
    + 38 +
    - + - if name == string(p) { + - + ConsensusL1URL: consensusl1url,
    + 39 +
    - + - return true + - + }
    + 40 +
    - + - } + - + l1Config := etherman.L1Config{
    + 41 +
    - + - } + - + L1ChainID: 11155111,
    + 42 +
    - + - return false + - + //ZkEVMAddr: common.HexToAddress("0x31A6ae85297DD0EeBD66D7556941c33Bd41d565C"),
    + 43 +
    - + - } -
    -
    -
    + - + //ZkEVMAddr: common.HexToAddress("0xD23C761025306cF5038D74FEEb077Cf66DE134DA"),
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/pool.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    @@ -93,6 +93,13 @@
    - 93 + + 44 +
    -   - time.Sleep(cfg.IntervalToRefreshGasPrices.Duration) + - + ZkEVMAddr: common.HexToAddress("0x5e5880098741d1fbd38eaaac51c4215f80f92d27"),
    - 94 + + 45 +
    -   - } + - + RollupManagerAddr: common.HexToAddress("0x9fB0B4A5d4d60aaCfa8DC20B8DF5528Ab26848d3"),
    - 95 + + 46 +
    -   - }(&cfg, p) + - + GlobalExitRootManagerAddr: common.HexToAddress("0x76216E45Bdd20022eEcC07999e50228d7829534B"),
    - + + 47 -
    -   -
    +
    +
    + - + }
    - + + 48 -
    -   -
    +
    +
    + - + eth, err := etherman.NewClient(cfg, l1Config)
    - + + 49 -
    -   -
    +
    +
    + - + require.NoError(t, err)
    - + + 50 -
    -   -
    +
    +
    + - + ctx := context.Background()
    - + + 51 -
    -   -
    +
    +
    + - + //toBlock := uint64(5611933)
    - + + 52 -
    -   -
    +
    +
    + - + //toBlock := uint64(5704000)
    - + + 53 -
    -   -
    +
    +
    + - + toBlock := uint64(5760696)
    - 96 + + 54 +
    -   -
    + - + blocks, orders, err := eth.GetRollupInfoByBlockRange(ctx, toBlock, &toBlock)
    - 97 + + 55 +
    -   - return p + - + require.NoError(t, err)
    - 98 + + 56 +
    -   - } + - + require.Equal(t, 1, len(blocks))
    -
    @@ -686,7 +693,7 @@
    +
    + 57 + +
    + - + require.Equal(t, 1, len(orders)) +
    - 686 + + 58 +
    -   + -
    - 687 + + 59 +
    -   - // CalculateEffectiveGasPricePercentage calculates the gas price's effective percentage + - + realState := createRealState(t)
    - 688 + + 60 +
    -   - func (p *Pool) CalculateEffectiveGasPricePercentage(gasPrice *big.Int, effectiveGasPrice *big.Int) (uint8, error) { + - + err = addBlock(ctx, &blocks[0], realState, nil)
    - 689 + + 61 +
    - - return p.effectiveGasPrice.CalculateEffectiveGasPricePercentage(gasPrice, effectiveGasPrice) + if err != nil {
    - 690 + + 62 +
    -   - } + - + log.Error(err)
    - 691 + + 63 +
    -   -
    + - + }
    - 692 + + 64 +
    -   - // EffectiveGasPriceEnabled returns if effective gas price calculation is enabled or not + - + sut := feijoa.NewProcessorSequenceBlobs(realState, realState, nil)
    -
    @@ -728,3 +735,8 @@
    -
    - 728 + + 65 +
    -   - } + - + err = sut.Process(ctx, orders[blocks[0].BlockHash][0], &blocks[0], nil)
    - 729 + + 66 +
    -   - return gas, nil + - + require.NoError(t, err)
    - 730 + + 67 +
    -   + - }
    - + + 68 -
    -   +
    +
    + -
    - + + 69 -
    -   -
    +
    +
    + - + const UniqueViolationErr = "23505"
    - + + 70 -
    -   +
    +
    + -
    - + + 71 -
    -   -
    +
    +
    + - + func addBlock(ctx context.Context, block *etherman.Block, storage *state.State, dbTx pgx.Tx) error {
    - - -
    -   -
    -
    +
    + 72
    -
    + +
    + - + b := state.Block{
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - + + + - - - - - - - - - - - - - @@ -87598,21 +280035,6 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
     
    - 93 + + 73 +
    -   - time.Sleep(cfg.IntervalToRefreshGasPrices.Duration) + - + BlockNumber: block.BlockNumber,
    - 94 + + 74 +
    -   - } + - + BlockHash: block.BlockHash,
    - 95 + + 75 +
    -   - }(&cfg, p) + - + ParentHash: block.ParentHash,
    - 96 + + 76 +
    - + - p.refreshBlockedAddresses() + - + ReceivedAt: block.ReceivedAt,
    - 97 + + 77 +
    - + - go func(cfg *Config, p *Pool) { + - + }
    - 98 + + 78 +
    - + - for { + - + // Add block information
    - 99 + + 79 +
    - + - time.Sleep(cfg.IntervalToRefreshBlockedAddresses.Duration) + - + err := storage.AddBlock(ctx, &b, dbTx)
    - 100 + + 80 +
    - + - p.refreshBlockedAddresses() + - +
    - 101 + + 81 +
    - + - } + - + if pgerr, ok := err.(*pgconn.PgError); ok && pgerr.Code == UniqueViolationErr {
    - 102 + + 82 +
    - + - }(&cfg, p) + - + return nil
    - 103 + + 83 +
    -   -
    + - + }
    - 104 + + 84 +
    -   - return p + - + return err
    - 105 + + 85 +
    -   + - }
    -
     
    -
    - 693 + + 86 +
    -   + -
    - 694 + + 87 +
    -   - // CalculateEffectiveGasPricePercentage calculates the gas price's effective percentage + - + func createRealState(t *testing.T) *state.State {
    - 695 + + 88 +
    -   - func (p *Pool) CalculateEffectiveGasPricePercentage(gasPrice *big.Int, effectiveGasPrice *big.Int) (uint8, error) { + - + stateDBCfg := dbutils.NewStateConfigFromEnv()
    - 696 + + 89 +
    - + - return state.CalculateEffectiveGasPricePercentage(gasPrice, effectiveGasPrice) + - + stateCfg := state.Config{}
    - 697 + + 90 +
    -   - } + - + err := db.RunMigrationsUp(stateDBCfg, db.StateMigrationName)
    - 698 + + 91 +
    -   -
    + - + require.NoError(t, err)
    - 699 + + 92 +
    -   - // EffectiveGasPriceEnabled returns if effective gas price calculation is enabled or not + - + stateSqlDB, err := db.NewSQLDB(stateDBCfg)
    -
     
    +
    + 93 + +
    + - + stateDb := pgstatestorage.NewPostgresStorage(stateCfg, stateSqlDB) +
    - 735 + + 94 +
    -   - } + - + executorConfig := executor.Config{
    - 736 + + 95 + +
    + - + URI: "localhost:50071", +
    +
    + 96 +
    -   - return gas, nil + - + MaxGRPCMessageSize: 1024 * 1024 * 1024,
    - 737 + + 97 +
    -   - } + - + }
    - 738 + + 98 +
    - + -
    + - + executorClient, _, _ := executor.NewExecutorClient(context.TODO(), executorConfig)
    - 739 + + 99 +
    - + - // CheckPolicy checks if an address is allowed by policy name + - + require.NoError(t, err)
    - 740 + + 100 +
    - + - func (p *Pool) CheckPolicy(ctx context.Context, policy PolicyName, address common.Address) (bool, error) { + - +
    - 741 + + 101 +
    - + - return p.storage.CheckPolicy(ctx, policy, address) + - + return state.NewState(stateCfg, stateDb, executorClient, nil, nil, nil, nil)
    - 742 + + 102 +
    - + + - }
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/pool_test.go - RENAMED - -
    -
    @@ -87620,37 +280042,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - -
    -
    @@ -2032,3 +2032,69 @@
    -
    - 2032 - -
    -   - require.NoError(t, err) -
    -
    - 2033 - -
    -   - return signedTx -
    -
    - 2034 - -
    -   - } -
    +
     
    @@ -88312,767 +280704,124 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0


    -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    -
    - 2032 - -
    -   - require.NoError(t, err) -
    -
    - 2033 - -
    -   - return signedTx -
    -
    - 2034 + + -
    +
    +
      - } -
    -
    - 2035 - -
    - + -
    -
    -
    - 2036 - -
    - + - func Test_PolicyAcl(t *testing.T) { -
    -
    - 2037 - -
    - + - initOrResetDB(t) -
    -
    - 2038 - -
    - + -
    -
    -
    - 2039 - -
    - + - poolSqlDB, err := db.NewSQLDB(poolDBCfg) -
    -
    - 2040 - -
    - + - require.NoError(t, err) -
    -
    - 2041 - -
    - + - defer poolSqlDB.Close() //nolint:gosec,errcheck -
    -
    - 2042 - -
    - + -
    -
    -
    - 2043 - -
    - + - ctx := context.Background() -
    -
    - 2044 - -
    - + - s, err := pgpoolstorage.NewPostgresPoolStorage(poolDBCfg) -
    -
    - 2045 - -
    - + - require.NoError(t, err) -
    -
    - 2046 - -
    - +
    - 2047 - -
    - + - p := pool.NewPool(cfg, bc, s, nil, uint64(1), nil) -
    -
    - 2048 + + -
    - + +
    +
    +  
    - 2049 - -
    - + - randAddr := func() common.Address { -
    -
    - 2050 - -
    - + - buf := make([]byte, 20) -
    -
    - 2051 - -
    - + - _, err = rand.Read(buf) -
    -
    - 2052 - -
    - + - require.NoError(t, err) -
    -
    - 2053 - -
    - + - return common.BytesToAddress(buf) -
    -
    - 2054 - -
    - + - } -
    -
    - 2055 + + -
    - + +
    +
    +  
    - 2056 - -
    - + - // Policies start out as deny lists, since there are no addresses on the -
    -
    - 2057 - -
    - + - // lists, random addresses will always be allowed -
    -
    - 2058 - -
    - + - for _, policy := range []pool.PolicyName{pool.SendTx, pool.Deploy} { -
    -
    - 2059 - -
    - + - allow, err := p.CheckPolicy(ctx, policy, randAddr()) -
    -
    - 2060 - -
    - + - require.NoError(t, err) -
    -
    - 2061 - -
    - + - require.True(t, allow) -
    -
    - 2062 - -
    - + - } -
    -
    - 2063 + + -
    - + +
    +
    +  
    - 2064 - -
    - + - addr := randAddr() -
    -
    - 2065 + + -
    - + +
    +
    +  
    - 2066 - -
    - + - // put addr on lists -
    -
    - 2067 - -
    - + - for _, policy := range []pool.PolicyName{pool.SendTx, pool.Deploy} { -
    -
    - 2068 - -
    - + - ctag, err := poolSqlDB.Exec(ctx, "INSERT INTO pool.acl (policy, address) VALUES ($1,$2)", policy, addr.Hex()) -
    -
    - 2069 - -
    - + - require.NoError(t, err) -
    -
    - 2070 - -
    - + - require.Equal(t, int64(1), ctag.RowsAffected()) -
    -
    - 2071 - -
    - + - } -
    -
    - 2072 + + -
    - + +
    +
    +  
    - 2073 - -
    - + - // addr should not be denied by policy -
    -
    - 2074 - -
    - + - for _, policy := range []pool.PolicyName{pool.SendTx, pool.Deploy} { -
    -
    - 2075 - -
    - + - allow, err := p.CheckPolicy(ctx, policy, addr) -
    -
    - 2076 - -
    - + - require.NoError(t, err) -
    -
    - 2077 - -
    - + - require.False(t, allow) -
    -
    - 2078 - -
    - + - } -
    -
    - 2079 + + -
    - + +
    +
    +  
    - 2080 - -
    - + - // change policies to allow by acl -
    -
    - 2081 - -
    - + - ctag, err := poolSqlDB.Exec(ctx, "UPDATE pool.policy SET allow = true") -
    -
    - 2082 - -
    - + - require.NoError(t, err) -
    -
    - 2083 - -
    - + - require.Equal(t, int64(2), ctag.RowsAffected()) -
    -
    - 2084 + + -
    - + +
    +
    +  
    - 2085 - -
    - + - // addr is now allowed -
    -
    - 2086 - -
    - + - for _, policy := range []pool.PolicyName{pool.SendTx, pool.Deploy} { -
    -
    - 2087 - -
    - + - allow, err := p.CheckPolicy(ctx, policy, addr) -
    -
    - 2088 - -
    - + - require.NoError(t, err) -
    -
    - 2089 - -
    - + - require.True(t, allow) -
    -
    - 2090 - -
    - + - } -
    -
    - 2091 + + -
    - + +
    +
    +  
    - 2092 - -
    - + - // random addrs are now denied -
    -
    - 2093 - -
    - + - for _, policy := range []pool.PolicyName{pool.SendTx, pool.Deploy} { -
    -
    - 2094 - -
    - + - for _, a := range []common.Address{randAddr(), randAddr()} { -
    -
    - 2095 - -
    - + - allow, err := s.CheckPolicy(ctx, policy, a) -
    -
    - 2096 - -
    - + - require.NoError(t, err) -
    -
    - 2097 - -
    - + - require.False(t, allow) -
    -
    - 2098 - -
    - + - } -
    -
    - 2099 - -
    - + - } -
    -
    - 2100 - -
    - + - } -
    -
    -
    -
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/proto/src/proto/executor/v1/executor.proto - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - @@ -89086,174 +280835,121 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - -
    -
    @@ -292,6 +292,7 @@
    -
    - 292 + + -
    +
    +
      - // prior to executing the call. +
    - 293 + + -
    +
    +
      - map<string, OverrideAccountV2> state_override = 23; +
    - 294 + + -
    +
    +
      - DebugV2 debug = 24; +
    - 295 + + -
    +
    +
      - } +
    - 296 + + -
    +
    +
     
    - 297 + + -
    +
    +
      - message L1DataV2 { -
    -
    -
    +
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    - 292 + + -
    +
    +
      - // prior to executing the call. +
    - 293 + + -
    +
    +
      - map<string, OverrideAccountV2> state_override = 23; +
    - 294 + + -
    +
    +
      - DebugV2 debug = 24; -
    -
    - 295 - -
    - + - uint64 execution_mode = 25; +
    - 296 + + -
    +
    +
      - } +
    - 297 + + -
    +
    +
     
    - 298 + + -
    +
    +
      - message L1DataV2 { -
    -
    -
    +
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencer/finalizer.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - + + +
    -
    @@ -224,6 +224,17 @@
    - 224 + + -
    +
    +
      - firstL1InfoRootUpdate := true +
    - 225 + + -
    +
    +
      - skipFirstSleep := true +
    - 226 + + -
    +
    +
     
    @@ -89368,144 +281064,188 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0


    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/forksids.go + RENAMED + +
    +
    +
    +
    + + + + + - - + - - - - + + + - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - + - - + + + + + + - - - - - - - - - - @@ -89754,282 +281519,526 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - + + + + + + - - - - - - - - + + + + + + - - + + + - - + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -12,41 +12,21 @@
    +
    - 227 + 12
      - for { + ForkIDEtrog = ForkIdType(7) //nolint:gomnd
    - 228 + 13
      - if skipFirstSleep { + // ForkIDElderberry is the forkId for Elderberry
    - 229 + 14
      - skipFirstSleep = false + ForkIDElderberry = ForkIdType(8) //nolint:gomnd
    -
    @@ -271,9 +282,11 @@
    +
    + 15 + +
    + - + // ForkIDElderberry2 is the forkId for Elderberry2 +
    - 271 + + 16 +
    -   - continue + - + ForkIDElderberry2 = ForkIdType(9) //nolint:gomnd
    - 272 + + 17 +
    -   - } + - + // ForkIDFeijoa is the forkId for Feijoa +
    +
    + 18 + +
    + - + ForkIDFeijoa = ForkIdType(10) //nolint:gomnd
    - 273 + 19
      - if l1BlockState.BlockHash != l1BlockEth.Hash() { + )
    - 274 + + 20 +
    - - - log.Warnf("skipping use of l1InfoTreeIndex %d, L1 block %d blockhash %s doesn't match blockhash on ethereum %s (L1 reorg?)", +   +
    - 275 + 21
      - l1InfoRoot.L1InfoTreeIndex, l1InfoRoot.BlockNumber, l1BlockState.BlockHash, l1BlockEth.Hash()) + var (
    - 276 + + 22 +
    - - - continue +   +
    - + + 23 -
    -   -
    +
    +
    + - + /// ************** ALL ***************///
    - + + 24 -
    -   +
    +
    + -
    - 277 + 25
      - } + // ForksIdAll support all forkIds
    - 278 + 26
      - } + ForksIdAll = []ForkIdType{WildcardForkId}
    - 279 + 27
    @@ -89514,108 +281254,108 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    @@ -390,6 +403,7 @@
    +
    + 28 + +
    + - + /// ************** SINGLE ***************/// +
    - 390 + + 29 +
    -   - SkipWriteBlockInfoRoot_V2: true, + - +
    - 391 + + 30 +
    -   - SkipVerifyL1InfoRoot_V2: true, + - + // ForksIdOnlyFeijoa support only etrog forkId
    - 392 + + 31 +
    -   - L1InfoTreeData_V2: map[uint32]state.L1DataV2{}, + - + ForksIdOnlyFeijoa = []ForkIdType{ForkIDFeijoa}
    - + + 32 -
    -   +
    +
    + -
    - 393 + 33
      - } + // ForksIdOnlyElderberry support only elderberry forkId
    - 394 + + 34 +
    -   -
    + - + ForksIdOnlyElderberry = []ForkIdType{ForkIDElderberry, ForkIDElderberry2}
    - 395 + 35
      - txGasPrice := tx.GasPrice +
    -
    @@ -436,7 +450,7 @@
    -
    - 436 + 36
      - } + // ForksIdOnlyEtrog support only etrog forkId
    - 437 + 37
      - } + ForksIdOnlyEtrog = []ForkIdType{ForkIDEtrog}
    - 438 + 38
    @@ -89624,118 +281364,143 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 439 + + 39 +
    - - egpPercentage, err := f.effectiveGasPrice.CalculateEffectiveGasPricePercentage(txGasPrice, tx.EffectiveGasPrice) + /// ************** MULTIPLE ***************///
    - 440 + + 40 +
    -   - if err != nil { + - +
    - 441 + 41
      - if f.effectiveGasPrice.IsEnabled() { + // ForksIdToIncaberry support all forkIds till incaberry
    - 442 + 42
      - return nil, err + ForksIdToIncaberry = []ForkIdType{1, 2, 3, 4, 5, ForkIDIncaberry}
    -
    @@ -549,7 +563,7 @@
    +
    + 43 + +
    + - +
    +
    - 549 + + 44 +
    -   + - + // ForksIdToEtrog support all forkIds till etrog +
    +
    + 45 + +
    + - + ForksIdToEtrog = append(ForksIdToIncaberry, ForksIdOnlyEtrog...) +
    +
    + 46 + +
    + -
    - 550 + + 47 +
    -   - // If EffectiveGasPrice is disabled we will calculate the percentage and save it for later logging + - + // ForksIdToElderberry support all forkIds till elderberry
    - 551 + + 48 +
    -   - if !egpEnabled { + - + ForksIdToElderberry = append(ForksIdToEtrog, ForksIdOnlyElderberry...)
    - 552 + + 49 +
    - - effectivePercentage, err := f.effectiveGasPrice.CalculateEffectiveGasPricePercentage(txGasPrice, tx.EffectiveGasPrice) +
    - 553 + + 50 +
    -   - if err != nil { + - + // ForksIdToFeijoa support all forkIds till feijoa
    - 554 + + 51 +
    -   - log.Warnf("effectiveGasPrice is disabled, but failed to calculate effective gas price percentage (#2), error: %v", err) + - + ForksIdToFeijoa = append(ForksIdToElderberry, ForksIdOnlyFeijoa...)
    - 555 + 52
      - tx.EGPLog.Error = fmt.Sprintf("%s, CalculateEffectiveGasPricePercentage#2: %s", tx.EGPLog.Error, err) + )
    - 224 + 12
      - firstL1InfoRootUpdate := true + ForkIDEtrog = ForkIdType(7) //nolint:gomnd
    - 225 + 13
      - skipFirstSleep := true + // ForkIDElderberry is the forkId for Elderberry
    - 226 + 14
      -
    + ForkIDElderberry = ForkIdType(8) //nolint:gomnd
    - 227 + + 15 +
    + - if f.cfg.L1InfoTreeCheckInterval.Duration.Seconds() == 999999 { //nolint:gomnd + // ForkID9 is the forkId for 9
    - 228 + + 16 +
    + - if !f.lastL1InfoTreeValid { + ForkID9 = ForkIdType(9) //nolint:gomnd
    - 229 + + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 17 +
    - + - f.lastL1InfoTreeCond.L.Lock() +   + )
    - 230 + + 18 +
    - + - f.lastL1InfoTreeValid = true +   +
    - 231 + + 19 +
    - + - f.lastL1InfoTreeCond.Broadcast() +   + var (
    - 232 + + 20 +
    - + - f.lastL1InfoTreeCond.L.Unlock() +   +
    - 233 + + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 21 +
    - + - } +   + // ForksIdAll support all forkIds
    - 234 + + 22 +
    - + +   + ForksIdAll = []ForkIdType{WildcardForkId} +
    +
    + 23 + +
    +  
    - 235 + + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + 24 +
    - + - return +   + // ForksIdOnlyElderberry support only elderberry forkId
    - 236 + + 25 +
    + - } + ForksIdOnlyElderberry = []ForkIdType{ForkIDElderberry, ForkID9}
    - 237 + + 26 +
    - + +  
    - 238 + 27
      - for { + // ForksIdOnlyEtrog support only etrog forkId
    - 239 + 28
      - if skipFirstSleep { + ForksIdOnlyEtrog = []ForkIdType{ForkIDEtrog}
    - 240 + 29
      - skipFirstSleep = false +
    -
     
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    - 282 + 30
      - continue + // ForksIdToIncaberry support all forkIds till incaberry
    - 283 + 31
      - } + ForksIdToIncaberry = []ForkIdType{1, 2, 3, 4, 5, ForkIDIncaberry} +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    - 284 + 32 + +
    +   + ) +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/incaberry/processor_l1_forced_batches.go + RENAMED + +
    +
    +
    +
    + + + + + + + - - - - - - - - - + + +
    +
    @@ -23,9 +23,9 @@
    +
    + 23
      - if l1BlockState.BlockHash != l1BlockEth.Hash() { + // NewProcessL1ForcedBatches returns instance of a processor for ForcedBatchesOrder
    - 285 + + 24 +
    - + - warnmsg := fmt.Sprintf("invalid l1InfoTreeIndex %d, L1 block %d blockhash %s doesn't match blockhash on ethereum %s (L1 reorg?). Stopping syncing l1IntroTreeIndex", +   + func NewProcessL1ForcedBatches(state stateProcessL1ForcedBatchesInterface) *ProcessL1ForcedBatches {
    - 286 + 25
      - l1InfoRoot.L1InfoTreeIndex, l1InfoRoot.BlockNumber, l1BlockState.BlockHash, l1BlockEth.Hash()) + return &ProcessL1ForcedBatches{
    - 287 + + 26 +
    - + - log.Warn(warnmsg) + - + ProcessorBase: *actions.NewProcessorBase[ProcessL1ForcedBatches](
    - 288 + + 27 +
    - + - f.LogEvent(ctx, event.Level_Critical, event.EventID_InvalidInfoRoot, warnmsg, nil) + - + []etherman.EventOrder{etherman.ForcedBatchesOrder},
    - 289 + + 28 +
    - + - return + - + actions.ForksIdAll),
    - 290 + 29
      - } + state: state}
    - 291 + 30
      - } + }
    - 292 + 31
    @@ -90037,229 +282046,351 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0


    +
    +
    +
    +
    + + + - - + + + + + + - + + +
     
    - 403 + 23
      - SkipWriteBlockInfoRoot_V2: true, + // NewProcessL1ForcedBatches returns instance of a processor for ForcedBatchesOrder
    - 404 + 24
      - SkipVerifyL1InfoRoot_V2: true, + func NewProcessL1ForcedBatches(state stateProcessL1ForcedBatchesInterface) *ProcessL1ForcedBatches {
    - 405 + 25
      - L1InfoTreeData_V2: map[uint32]state.L1DataV2{}, + return &ProcessL1ForcedBatches{
    - 406 + + 26 +
    + - ExecutionMode: executor.ExecutionMode0, + ProcessorBase: actions.ProcessorBase[ProcessL1ForcedBatches]{ +
    +
    + 27 + +
    + + + SupportedEvent: []etherman.EventOrder{etherman.ForcedBatchesOrder}, +
    +
    + 28 + +
    + + + SupportedForkdIds: &actions.ForksIdAll},
    - 407 + 29
      - } + state: state}
    - 408 + 30
      -
    + }
    - 409 + 31
      - txGasPrice := tx.GasPrice +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/incaberry/processor_l1_forkid.go + RENAMED + +
    +
    +
    +
    + + + - - + + + + + + + + + - + + +
    -
     
    +
    @@ -36,9 +36,10 @@
    - 450 + 36
      - } + // NewProcessorForkId returns instance of a processor for ForkIDsOrder
    - 451 + 37
      - } + func NewProcessorForkId(state stateProcessorForkIdInterface, sync syncProcessorForkIdInterface) *ProcessorForkId {
    - 452 + 38
      -
    + return &ProcessorForkId{
    - 453 + + 39 +
    - + - egpPercentage, err := state.CalculateEffectiveGasPricePercentage(txGasPrice, tx.EffectiveGasPrice) + - + ProcessorBase: *actions.NewProcessorBase[ProcessorForkId]( +
    +
    + 40 + +
    + - + []etherman.EventOrder{etherman.ForkIDsOrder}, +
    +
    + 41 + +
    + - + actions.ForksIdAll), +
    +
    + + +
    +   +
    - 454 + 42
      - if err != nil { + state: state,
    - 455 + 43
      - if f.effectiveGasPrice.IsEnabled() { + sync: sync}
    - 456 + 44
      - return nil, err + }
    +
    +
    +
    +
    + + + + + + + + + + + + @@ -90269,12 +282400,12 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    +
    {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencer/l2block.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/incaberry/processor_l1_global_exit_root.go RENAMED
    - - + + + + + + - + + +
     
    - 563 + 36
      -
    + // NewProcessorForkId returns instance of a processor for ForkIDsOrder
    - 564 + 37
      - // If EffectiveGasPrice is disabled we will calculate the percentage and save it for later logging + func NewProcessorForkId(state stateProcessorForkIdInterface, sync syncProcessorForkIdInterface) *ProcessorForkId {
    - 565 + 38
      - if !egpEnabled { + return &ProcessorForkId{
    - 566 + 39
    + - effectivePercentage, err := state.CalculateEffectiveGasPricePercentage(txGasPrice, tx.EffectiveGasPrice) + ProcessorBase: actions.ProcessorBase[ProcessorForkId]{ +
    +
    + 40 + +
    + + + SupportedEvent: []etherman.EventOrder{etherman.ForkIDsOrder}, +
    +
    + 41 + +
    + + + SupportedForkdIds: &actions.ForksIdAll, +
    +
    + 42 + +
    + + + },
    - 567 + 43
      - if err != nil { + state: state,
    - 568 + 44
      - log.Warnf("effectiveGasPrice is disabled, but failed to calculate effective gas price percentage (#2), error: %v", err) + sync: sync}
    - 569 + 45
      - tx.EGPLog.Error = fmt.Sprintf("%s, CalculateEffectiveGasPricePercentage#2: %s", tx.EGPLog.Error, err) + }
    -
    @@ -283,6 +284,7 @@
    +
    @@ -24,9 +24,9 @@
    - 283 + 24
      - ForkID: f.stateIntf.GetForkIDByBatchNumber(f.wipBatch.batchNumber), + // NewProcessorL1GlobalExitRoot new processor for GlobalExitRootsOrder
    - 284 + 25
      - SkipVerifyL1InfoRoot_V2: true, + func NewProcessorL1GlobalExitRoot(state stateProcessorL1GlobalExitRootInterface) *ProcessorL1GlobalExitRoot {
    - 285 + 26
      - L1InfoTreeData_V2: map[uint32]state.L1DataV2{}, + return &ProcessorL1GlobalExitRoot{
    - + + 27 -
    -   -
    +
    +
    + - + ProcessorBase: *actions.NewProcessorBase[ProcessorL1GlobalExitRoot]( +
    +
    + 28 + +
    + - + []etherman.EventOrder{etherman.GlobalExitRootsOrder}, +
    +
    + 29 + +
    + - + actions.ForksIdToIncaberry),
    - 286 + 30
      - } + state: state}
    - 287 + 31
      - batchRequest.L1InfoTreeData_V2[l2Block.l1InfoTreeExitRoot.L1InfoTreeIndex] = state.L1DataV2{ + }
    - 288 + 32
      - GlobalExitRoot: l2Block.l1InfoTreeExitRoot.GlobalExitRoot.GlobalExitRoot, +
    +
    +
    +
    +
    + + + - - + + + + + + @@ -90441,6 +282621,21 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    @@ -582,6 +584,7 @@
    +
     
    - 582 + 24
      - SkipFirstChangeL2Block_V2: false, + // NewProcessorL1GlobalExitRoot new processor for GlobalExitRootsOrder
    - 583 + 25
      - Transactions: f.stateIntf.BuildChangeL2Block(f.wipL2Block.deltaTimestamp, f.wipL2Block.getL1InfoTreeIndex()), + func NewProcessorL1GlobalExitRoot(state stateProcessorL1GlobalExitRootInterface) *ProcessorL1GlobalExitRoot {
    - 584 + 26
      - L1InfoTreeData_V2: map[uint32]state.L1DataV2{}, + return &ProcessorL1GlobalExitRoot{
    - + + 27 -
    -   -
    +
    +
    + + + ProcessorBase: actions.ProcessorBase[ProcessorL1GlobalExitRoot]{ +
    +
    + 28 + +
    + + + SupportedEvent: []etherman.EventOrder{etherman.GlobalExitRootsOrder}, +
    +
    + 29 + +
    + + + SupportedForkdIds: &actions.ForksIdToIncaberry},
    - 585 + 30
      - } + state: state}
    - 586 + 31
      -
    + }
    - 587 + 32
      - batchRequest.L1InfoTreeData_V2[f.wipL2Block.l1InfoTreeExitRoot.L1InfoTreeIndex] = state.L1DataV2{ +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/incaberry/processor_l1_sequence_batches.go + RENAMED + +
    +
    @@ -90448,151 +282643,200 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - + + + + + + - + + +
    -
     
    +
    @@ -64,9 +64,9 @@
    - 284 + 64
      - ForkID: f.stateIntf.GetForkIDByBatchNumber(f.wipBatch.batchNumber), + func NewProcessorL1SequenceBatches(state stateProcessSequenceBatches,
    - 285 + 65
      - SkipVerifyL1InfoRoot_V2: true, + etherMan ethermanProcessSequenceBatches, pool poolProcessSequenceBatchesInterface, eventLog syncinterfaces.EventLogInterface, sync syncProcessSequenceBatchesInterface) *ProcessorL1SequenceBatches {
    - 286 + 66
      - L1InfoTreeData_V2: map[uint32]state.L1DataV2{}, + return &ProcessorL1SequenceBatches{
    - 287 + + 67 +
    - + - ExecutionMode: executor.ExecutionMode0, + - + ProcessorBase: *actions.NewProcessorBase[ProcessorL1SequenceBatches]( +
    +
    + 68 + +
    + - + []etherman.EventOrder{etherman.SequenceBatchesOrder}, +
    +
    + 69 + +
    + - + actions.ForksIdToIncaberry),
    - 288 + 70
      - } + state: state,
    - 289 + 71
      - batchRequest.L1InfoTreeData_V2[l2Block.l1InfoTreeExitRoot.L1InfoTreeIndex] = state.L1DataV2{ + etherMan: etherMan,
    - 290 + 72
      - GlobalExitRoot: l2Block.l1InfoTreeExitRoot.GlobalExitRoot.GlobalExitRoot, + pool: pool,
    +
    +
    +
    +
    + + + - - + + + + + + @@ -90602,12 +282846,12 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    +
    {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencesender/config.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/incaberry/processor_l1_sequence_batches_test.go RENAMED
    - - + + + - - - - + + + - - + + + - + + +
     
    - 584 + 64
      - SkipFirstChangeL2Block_V2: false, + func NewProcessorL1SequenceBatches(state stateProcessSequenceBatches,
    - 585 + 65
      - Transactions: f.stateIntf.BuildChangeL2Block(f.wipL2Block.deltaTimestamp, f.wipL2Block.getL1InfoTreeIndex()), + etherMan ethermanProcessSequenceBatches, pool poolProcessSequenceBatchesInterface, eventLog syncinterfaces.EventLogInterface, sync syncProcessSequenceBatchesInterface) *ProcessorL1SequenceBatches {
    - 586 + 66
      - L1InfoTreeData_V2: map[uint32]state.L1DataV2{}, + return &ProcessorL1SequenceBatches{
    - 587 + + 67 +
    + - ExecutionMode: executor.ExecutionMode0, + ProcessorBase: actions.ProcessorBase[ProcessorL1SequenceBatches]{ +
    +
    + 68 + +
    + + + SupportedEvent: []etherman.EventOrder{etherman.SequenceBatchesOrder}, +
    +
    + 69 + +
    + + + SupportedForkdIds: &actions.ForksIdToIncaberry},
    - 588 + 70
      - } + state: state,
    - 589 + 71
      -
    + etherMan: etherMan,
    - 590 + 72
      - batchRequest.L1InfoTreeData_V2[f.wipL2Block.l1InfoTreeExitRoot.L1InfoTreeIndex] = state.L1DataV2{ + pool: pool,
    -
    @@ -41,4 +41,6 @@
    +
    @@ -23,7 +23,6 @@
    - 41 + 23
      - // gas offset: 100 + // Create an instance of ProcessorL1SequenceBatches
    - 42 + 24
      - // final gas: 1100 +
    - 43 + 25
      - GasOffset uint64 `mapstructure:"GasOffset"` + // Test invalid call, no sequenced batches
    - + + 26 -
    +
    +
    + - + sut.ProcessorBase.SupportedEvents() +
    +
    + 27 + +
      -
    + err := sut.Process(ctx, etherman.Order{Name: sut.SupportedEvents()[0], Pos: 0}, l1Block, dbTx)
    - + + 28 -
    +
    +
      -
    + require.Error(t, err)
    - 44 + 29
    @@ -90700,57 +282954,67 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 41 + 23
      - // gas offset: 100 + // Create an instance of ProcessorL1SequenceBatches
    - 42 + 24
      - // final gas: 1100 +
    - 43 + 25
      - GasOffset uint64 `mapstructure:"GasOffset"` + // Test invalid call, no sequenced batches
    - 44 + + + +
    +   +
    +
    +
    + 26 +
    - + - // MaxBatchesForL1 is the maximum amount of batches to be sequenced in a single L1 tx +   + err := sut.Process(ctx, etherman.Order{Name: sut.SupportedEvents()[0], Pos: 0}, l1Block, dbTx)
    - 45 + + 27 +
    - + - MaxBatchesForL1 uint64 `mapstructure:"MaxBatchesForL1"` +   + require.Error(t, err)
    - 46 + 28
    @@ -90765,12 +283029,12 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    +
    {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencesender/interfaces.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/incaberry/processor_l1_sequence_force_batches.go RENAMED
    -
    @@ -17,8 +17,8 @@
    +
    @@ -39,9 +39,9 @@
    - 17 + 39
      -
    + func NewProcessL1SequenceForcedBatches(state stateProcessL1SequenceForcedBatchesInterface,
    - 18 + 40
      - // etherman contains the methods required to interact with ethereum. + sync syncProcessL1SequenceForcedBatchesInterface) *ProcessL1SequenceForcedBatches {
    - 19 + 41
      - type etherman interface { + return &ProcessL1SequenceForcedBatches{
    - 20 + 42
    - - BuildSequenceBatchesTxData(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, initSequenceBatchNumber uint64, l2Coinbase common.Address) (to *common.Address, data []byte, err error) + ProcessorBase: *actions.NewProcessorBase[ProcessL1SequenceForcedBatches](
    - 21 + 43
    - - EstimateGasSequenceBatches(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, initSequenceBatchNumber uint64, l2Coinbase common.Address) (*types.Transaction, error) + []etherman.EventOrder{etherman.SequenceForceBatchesOrder}, +
    +
    + 44 + +
    + - + actions.ForksIdAll),
    - 22 + 45
      - GetLatestBlockHeader(ctx context.Context) (*types.Header, error) + state: state,
    - 23 + 46
      - GetLatestBatchNumber() (uint64, error) + sync: sync}
    - 24 + 47
    @@ -90867,79 +283141,108 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    }
    +
    +
    +
    +
    + + + - - - - + + + + + + - - - - @@ -90947,6 +283250,21 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    @@ -41,3 +41,7 @@
    +
     
    - 41 + 39
      - Add(ctx context.Context, owner, id string, from common.Address, to *common.Address, value *big.Int, data []byte, gasOffset uint64, dbTx pgx.Tx) error + func NewProcessL1SequenceForcedBatches(state stateProcessL1SequenceForcedBatchesInterface,
    - 42 + 40
      - ProcessPendingMonitoredTxs(ctx context.Context, owner string, failedResultHandler ethtxmanager.ResultHandler, dbTx pgx.Tx) + sync syncProcessL1SequenceForcedBatchesInterface) *ProcessL1SequenceForcedBatches {
    - 43 + 41
      - } + return &ProcessL1SequenceForcedBatches{
    - + + 42 -
    -   -
    +
    +
    + + + ProcessorBase: actions.ProcessorBase[ProcessL1SequenceForcedBatches]{
    - + + 43 -
    +
    +
    + + + SupportedEvent: []etherman.EventOrder{etherman.SequenceForceBatchesOrder}, +
    +
    + 44 + +
    + + + SupportedForkdIds: &actions.ForksIdAll}, +
    +
    + 45 + +
      -
    + state: state,
    - + + 46 -
    +
    +
      -
    + sync: sync}
    - + + 47 -
    +
    +
      -
    + }
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/incaberry/processor_l1_verify_batch.go + RENAMED + +
    +
    @@ -90954,81 +283272,91 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - + + + - + + +
    -
     
    +
    @@ -26,9 +26,9 @@
    - 17 + 26
      -
    + // NewProcessorL1VerifyBatch returns instance of a processor for VerifyBatchOrder
    - 18 + 27
      - // etherman contains the methods required to interact with ethereum. + func NewProcessorL1VerifyBatch(state stateL1VerifyBatchInterface) *ProcessorL1VerifyBatch {
    - 19 + 28
      - type etherman interface { + return &ProcessorL1VerifyBatch{
    - 20 + + 29 +
    - + - BuildSequenceBatchesTxData(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, initSequenceBatchNumber uint64, l2Coinbase common.Address, committeeSignaturesAndAddrs []byte) (to *common.Address, data []byte, err error) + - + ProcessorBase: *actions.NewProcessorBase[ProcessorL1VerifyBatch](
    - 21 + + 30 +
    - + - EstimateGasSequenceBatches(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, initSequenceBatchNumber uint64, l2Coinbase common.Address, committeeSignaturesAndAddrs []byte) (*types.Transaction, error) + - + []etherman.EventOrder{etherman.VerifyBatchOrder, etherman.TrustedVerifyBatchOrder}, +
    +
    + 31 + +
    + - + actions.ForksIdAll),
    - 22 + 32
      - GetLatestBlockHeader(ctx context.Context) (*types.Header, error) + state: state,
    - 23 + 33
      - GetLatestBatchNumber() (uint64, error) + }
    - 24 + 34
    @@ -91036,78 +283364,107 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    }
    +
    +
    +
    +
    + + + - - - - - - - - + + + + + + @@ -91118,12 +283475,12 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    +
    {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencesender/sequencesender.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/processor_base.go RENAMED
    + + + + + + + + + + + + - - - - - - - - - - + + + - - - - - - - - - - - - + +
     
    - 41 + 26
      - Add(ctx context.Context, owner, id string, from common.Address, to *common.Address, value *big.Int, data []byte, gasOffset uint64, dbTx pgx.Tx) error + // NewProcessorL1VerifyBatch returns instance of a processor for VerifyBatchOrder
    - 42 + 27
      - ProcessPendingMonitoredTxs(ctx context.Context, owner string, failedResultHandler ethtxmanager.ResultHandler, dbTx pgx.Tx) + func NewProcessorL1VerifyBatch(state stateL1VerifyBatchInterface) *ProcessorL1VerifyBatch {
    - 43 + 28
      - } + return &ProcessorL1VerifyBatch{
    - 44 + + 29 +
    + -
    + ProcessorBase: actions.ProcessorBase[ProcessorL1VerifyBatch]{
    - 45 + + 30 +
    + - type dataAbilitier interface { + SupportedEvent: []etherman.EventOrder{etherman.VerifyBatchOrder, etherman.TrustedVerifyBatchOrder},
    - 46 + + 31 +
    + - PostSequence(ctx context.Context, sequences []ethmanTypes.Sequence) ([]byte, error) + SupportedForkdIds: &actions.ForksIdAll},
    - 47 + + 32 +
    - + +   + state: state, +
    +
    + 33 + +
    +   + } +
    +
    + 34 + +
    +   }
    -
    @@ -6,13 +6,11 @@
    +
    @@ -9,18 +9,8 @@
    - 6 + 9
      - "fmt" + // ProcessorBase is the base struct for all the processors, if reduces the boilerplate
    - 7 + 10
      - "time" + // implementing the Name, SupportedEvents and SupportedForkIds functions
    - 8 + 11
      + type ProcessorBase[T any] struct { +
    +
    + 12 + +
    + - + supportedEvent []etherman.EventOrder +
    +
    + 13 + +
    + - + supportedForkIds []ForkIdType +
    +
    + 14 + +
    + - + } +
    +
    + 15 + +
    + -
    - 9 + 16
    - - ethman "github.com/0xPolygonHermez/zkevm-node/etherman" + // NewProcessorBase creates and initializes internal fields of an new instance of ProcessorBase
    - 10 + + 17 +
    -   - "github.com/0xPolygonHermez/zkevm-node/etherman/types" + - + func NewProcessorBase[T any](supportedEvent []etherman.EventOrder, supportedForkIds []ForkIdType) *ProcessorBase[T] {
    - 11 + + 18 +
    -   - "github.com/0xPolygonHermez/zkevm-node/ethtxmanager" + - + p := &ProcessorBase[T]{
    - 12 + + 19 +
    -   - "github.com/0xPolygonHermez/zkevm-node/event" + - + supportedEvent: supportedEvent,
    - 13 + + 20 +
    -   - "github.com/0xPolygonHermez/zkevm-node/log" + - + supportedForkIds: supportedForkIds,
    - 14 + + 21 +
    -   - "github.com/0xPolygonHermez/zkevm-node/state" + - + }
    - 15 + 22
    - - ethTypes "github.com/ethereum/go-ethereum/core/types" +
    +
    +
    + 23 + +
    + - + return p
    - 16 + 24
      - "github.com/jackc/pgx/v4" + }
    - 17 + 25
      - ) +
    - 18 + 26
      -
    + // Name returns the name of the struct T
    -
    @@ -41,16 +39,18 @@
    +
    @@ -33,13 +23,13 @@
    - 41 + 33
      - ethTxManager ethTxManager +
    - 42 + 34
      - etherman etherman + // SupportedEvents returns the supported events in the struct
    - 43 + 35
      - eventLog *event.EventLog + func (p *ProcessorBase[T]) SupportedEvents() []etherman.EventOrder {
    - + + 36 -
    -   -
    +
    +
    + - + return p.supportedEvent
    - 44 + 37
    @@ -91327,7 +283734,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 45 + 38
    @@ -91335,169 +283742,168 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0


    - 46 - -
    -   - // New inits sequence sender -
    -
    - 47 + 39
    - - func New(cfg Config, state stateInterface, etherman etherman, manager ethTxManager, eventLog *event.EventLog) (*SequenceSender, error) { + // SupportedForkIds returns the supported forkIds in the struct or the default till incaberry forkId
    - 48 + 40
      - return &SequenceSender{ + func (p *ProcessorBase[T]) SupportedForkIds() []ForkIdType {
    - 49 + + 41 +
    -   - cfg: cfg, + - + if len(p.supportedForkIds) != 0 {
    - 50 + + 42 +
    -   - state: state, + - + return p.supportedForkIds
    - 51 + 43
      - etherman: etherman, + }
    - 52 + 44
      - ethTxManager: manager, + // returns none
    - 53 + 45
      - eventLog: eventLog, + return []ForkIdType{}
    - - -
    -   -
    +
    +
    +
    +
    + + + + + - - + - - - - - - - - @@ -91541,23 +283947,23 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - @@ -91572,942 +283978,997 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - - - - - + +
    +
     
    - 54 + 9
      - }, nil + // ProcessorBase is the base struct for all the processors, if reduces the boilerplate
    - 55 + 10
      - } + // implementing the Name, SupportedEvents and SupportedForkIds functions
    - 56 + 11
      -
    + type ProcessorBase[T any] struct {
    -
    @@ -185,9 +185,14 @@
    +
    + 12 + +
    + + + SupportedEvent []etherman.EventOrder +
    - 185 + + 13 +
    -   - } + + + SupportedForkdIds *[]ForkIdType
    - 186 + + -
    +
    +
     
    - 187 + + -
    +
    +
      - // add sequence to be monitored +
    - 188 + + -
    - - - firstSequence := sequences[0] +
    +
    +   +
    - 189 + + -
    +
    +
     
    - 190 + + -
    - - - to, data, err := s.etherman.BuildSequenceBatchesTxData(s.cfg.SenderAddress, sequences, uint64(lastSequence.LastL2BLockTimestamp), firstSequence.BatchNumber-1, s.cfg.L2Coinbase) +
    +
    +   +
    - 191 + 14
      - if err != nil { + }
    - 192 + 15
      - log.Error("error estimating new sequenceBatches to add to eth tx manager: ", err) +
    - 193 + 16
      - return + // Name returns the name of the struct T
    -
    @@ -218,8 +223,6 @@
    +
     
    - 218 + 23
      - sequences := []types.Sequence{} +
    - 219 + 24
      - // var estimatedGas uint64 + // SupportedEvents returns the supported events in the struct
    - 220 + 25
      -
    -
    -
    - 221 - -
    - - - var tx *ethTypes.Transaction + func (p *ProcessorBase[T]) SupportedEvents() []etherman.EventOrder {
    - 222 + + 26 +
    - - -
    + + + return p.SupportedEvent
    - 223 + 27
      - // Add sequences until too big for a single L1 tx or last batch is reached + }
    - 224 + 28
      - for { +
    - 225 + + 29 +
    -   - //Check if the next batch belongs to a new forkid, in this case we need to stop sequencing as we need to + + + // SupportedForkIds returns the supported forkIds in the struct or the dafault till incaberry forkId
    -
    @@ -288,31 +291,11 @@
    -
    - 288 + 30
      -
    + func (p *ProcessorBase[T]) SupportedForkIds() []ForkIdType {
    - 289 + + 31 +
    -   - sequences = append(sequences, seq) + + + if p.SupportedForkdIds != nil {
    - 290 + + 32 +
    -   - // Check if can be send + + + return *p.SupportedForkdIds
    - 291 + + 33 +
    - - - firstSequence := sequences[0] +   + }
    - 292 + + 34 +
    - - - lastSequence := sequences[len(sequences)-1] +   + // returns none
    - 293 + + 35 +
    - - - tx, err = s.etherman.EstimateGasSequenceBatches(s.cfg.SenderAddress, sequences, uint64(lastSequence.LastL2BLockTimestamp), firstSequence.BatchNumber-1, s.cfg.L2Coinbase) +   + return []ForkIdType{}
    - 294 - -
    - - - if err == nil && tx.Size() > s.cfg.MaxTxSizeForL1 { +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/common/syncinterfaces/block_range_processor.go + RENAMED + +
    +
    +
    +
    + + + + + - - + + +
    +
    @@ -1,21 +0,0 @@
    - 295 + + 1 +
    - - log.Infof("oversized Data on TX oldHash %s (txSize %d > %d)", tx.Hash(), tx.Size(), s.cfg.MaxTxSizeForL1) + package syncinterfaces
    - 296 + 2
    - - err = ErrOversizedData +
    - 297 + 3
    - - } + import (
    - 298 + 4
    - - if err != nil { + "context"
    - 299 + 5
    - - log.Infof("Handling estimage gas send sequence error: %v", err) +
    - 300 + 6
    - - sequences, err = s.handleEstimateGasSendSequenceErr(ctx, sequences, currentBatchNumToSequence, err) + "github.com/0xPolygonHermez/zkevm-node/etherman"
    - 301 + 7
    - - if sequences != nil { + "github.com/ethereum/go-ethereum/common"
    - 302 + 8
    - - if len(sequences) > 0 { + "github.com/jackc/pgx/v4"
    - 303 + 9
    - - // Handling the error gracefully, re-processing the sequence as a sanity check + )
    - 304 + 10
    - - lastSequence = sequences[len(sequences)-1] +
    - 305 + 11
    - - _, err = s.etherman.EstimateGasSequenceBatches(s.cfg.SenderAddress, sequences, uint64(lastSequence.LastL2BLockTimestamp), firstSequence.BatchNumber-1, s.cfg.L2Coinbase) + type ProcessBlockRangeL1BlocksMode bool
    - 306 + 12
    - - return sequences, err +
    - 307 + 13
    - - } + const (
    - 308 + 14
    - - } + StoreL1Blocks ProcessBlockRangeL1BlocksMode = true
    - 309 + 15
    - - return sequences, err + NoStoreL1Blocks ProcessBlockRangeL1BlocksMode = false
    - 310 + 16
    - - } + )
    - 311 + 17
    - - // estimatedGas = tx.Gas() +
    - 312 + 18
    - -
    + type BlockRangeProcessor interface {
    - 313 + 19
    - - //Check if the current batch is the last before a change to a new forkid, in this case we need to close and send the sequence to L1 + ProcessBlockRange(ctx context.Context, blocks []etherman.Block, order map[common.Hash][]etherman.Order) error
    - 314 + 20
    - - if (s.cfg.ForkUpgradeBatchNumber != 0) && (currentBatchNumToSequence == (s.cfg.ForkUpgradeBatchNumber)) { + ProcessBlockRangeSingleDbTx(ctx context.Context, blocks []etherman.Block, order map[common.Hash][]etherman.Order, storeBlocks ProcessBlockRangeL1BlocksMode, dbTx pgx.Tx) error
    - 315 + 21
    - - log.Infof("sequence should be sent to L1, as we have reached the batch %d from which a new forkid is applied (upgrade)", s.cfg.ForkUpgradeBatchNumber) + } +
    +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +
    +
     
    - 316 + + -
    +
    +
      - return sequences, nil +
    - 317 + + -
    +
    +
      - } +
    - 318 + + -
    +
    +
     
    -
    @@ -343,78 +326,6 @@
    -
    - 343 + + -
    +
    +
      - return nil, nil +
    - 344 + + -
    +
    +
      - } +
    - 345 + + -
    +
    +
     
    - 346 + + -
    - - - // handleEstimateGasSendSequenceErr handles an error on the estimate gas. It will return: +
    +
    +   +
    - 347 + + -
    - - - // nil, error: impossible to handle gracefully +
    +
    +   +
    - 348 + + -
    - - - // sequence, nil: handled gracefully. Potentially manipulating the sequences +
    +
    +   +
    - 349 + + -
    - - - // nil, nil: a situation that requires waiting +
    +
    +   +
    - 350 + + -
    - - - func (s *SequenceSender) handleEstimateGasSendSequenceErr( +
    +
    +   +
    - 351 + + -
    - - - ctx context.Context, +
    +
    +   +
    - 352 + + -
    - - - sequences []types.Sequence, +
    +
    +   +
    - 353 + + -
    - - - currentBatchNumToSequence uint64, +
    +
    +   +
    - 354 + + -
    - - - err error, +
    +
    +   +
    - 355 + + -
    - - - ) ([]types.Sequence, error) { +
    +
    +   +
    - 356 + + -
    - - - // Insufficient allowance +
    +
    +   +
    - 357 + + -
    - - - if errors.Is(err, ethman.ErrInsufficientAllowance) { +
    +
    +   +
    - 358 + + -
    - - - return nil, err +
    +
    +   +
    - 359 + + -
    - - - } +
    +
    +   +
    - 360 + + -
    - - - if isDataForEthTxTooBig(err) { +
    +
    +   +
    - 361 - -
    - - - // Remove the latest item and send the sequences +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/common/syncinterfaces/etherman.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - + +
    +
    @@ -20,14 +20,8 @@
    - 362 + + 20 +
    - - - log.Infof( +   +
    - 363 + + 21 +
    - - - "Done building sequences, selected batches to %d. Batch %d caused the L1 tx to be too big", +   + EthermanGetLatestBatchNumber
    - 364 + + 22 +
    - - - currentBatchNumToSequence-1, currentBatchNumToSequence, +   + GetFinalizedBlockNumber(ctx context.Context) (uint64, error)
    - 365 + 23
    - - ) + EthermanPreRollup
    - 366 + + 24 +
    - - - sequences = sequences[:len(sequences)-1] +   + }
    - 367 + + 25 +
    - - - return sequences, nil +   +
    - 368 + + 26 +
    - - - } +   + type EthermanGetLatestBatchNumber interface {
    - 369 + + 27 +
    - - -
    +   + GetLatestBatchNumber() (uint64, error)
    - 370 + + 28 +
    - - - // while estimating gas a new block is not created and the POE SC may return +   + }
    - 371 + 29
    - - // an error regarding timestamp verification, this must be handled +
    - 372 + 30
    - - // if errors.Is(err, ethman.ErrTimestampMustBeInsideRange) { + type EthermanPreRollup interface {
    - 373 + 31
    - - // // query the sc about the value of its lastTimestamp variable + GetL1BlockUpgradeLxLy(ctx context.Context, genesisBlock uint64) (uint64, error)
    - 374 + 32
    - - // lastTimestamp, err := s.etherman.GetLastBatchTimestamp() + GetRollupInfoByBlockRangePreviousRollupGenesis(ctx context.Context, fromBlock uint64, toBlock *uint64) ([]etherman.Block, map[common.Hash][]etherman.Order, error)
    - 375 + 33
    - - // if err != nil { + }
    - 376 - -
    - - - // return nil, err +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +
    +
     
    - 377 + + 20 +
    - - - // } +   +
    - 378 + + 21 +
    - - - // // check POE SC lastTimestamp against sequences' one +   + EthermanGetLatestBatchNumber
    - 379 + + 22 +
    - - - // for _, seq := range sequences { +   + GetFinalizedBlockNumber(ctx context.Context) (uint64, error)
    - 380 + + -
    - - - // if seq.Timestamp < int64(lastTimestamp) { +
    +
    +   +
    - 381 + + 23 +
    - - - // // TODO: gracefully handle this situation by creating an L2 reorg +   + }
    - 382 + + 24 +
    - - - // log.Fatalf("sequence timestamp %d is < POE SC lastTimestamp %d", seq.Timestamp, lastTimestamp) +   +
    - 383 + + 25 +
    - - - // } +   + type EthermanGetLatestBatchNumber interface {
    - 384 + + 26 +
    - - - // lastTimestamp = uint64(seq.Timestamp) +   + GetLatestBatchNumber() (uint64, error)
    - 385 + + 27 +
    - - - // } +   + }
    - 386 + + -
    - - - // blockTimestamp, err := s.etherman.GetLatestBlockTimestamp(ctx) +
    +
    +   +
    - 387 + + -
    - - - // if err != nil { +
    +
    +   +
    - 388 + + -
    - - - // log.Error("error getting block timestamp: ", err) +
    +
    +   +
    - 389 + + -
    - - - // } +
    +
    +   +
    - 390 + + -
    - - - // log.Debugf("block.timestamp: %d is smaller than seq.Timestamp: %d. A new block must be mined in L1 before the gas can be estimated.", blockTimestamp, sequences[0].Timestamp) +
    +
    +   +
    - 391 - -
    - - - // return nil, nil +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/common/syncinterfaces/l1_event_processor_manager.go + RENAMED + +
    +
    +
    +
    + + + + + - - - + +
    +
    @@ -1,14 +0,0 @@
    - 392 + 1
    - - // } + package syncinterfaces
    - 393 + 2
    @@ -92517,272 +284978,276 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 394 + 3
    - - // Unknown error + import (
    - 395 + 4
    - - if len(sequences) == 1 { + "context"
    - 396 + 5
    - - // TODO: gracefully handle this situation by creating an L2 reorg +
    - 397 + 6
    - - log.Errorf( + "github.com/0xPolygonHermez/zkevm-node/etherman"
    - 398 + 7
    - - "Error when estimating gas for BatchNum %d (alone in the sequences): %v", + "github.com/0xPolygonHermez/zkevm-node/synchronizer/actions"
    - 399 + 8
    - - currentBatchNumToSequence, err, + "github.com/jackc/pgx/v4"
    - 400 + 9
    - - ) + )
    - 401 + 10
    - - } +
    - 402 + 11
    - - // Remove the latest item and send the sequences + type L1EventProcessorManager interface {
    - 403 + 12
    - - log.Infof( + Process(ctx context.Context, forkId actions.ForkIdType, order etherman.Order, block *etherman.Block, dbTx pgx.Tx) error
    - 404 + 13
    - - "Done building sequences, selected batches to %d. Batch %d excluded due to unknown error: %v", + Get(forkId actions.ForkIdType, event etherman.EventOrder) actions.L1EventProcessor
    - 405 + 14
    - - currentBatchNumToSequence, currentBatchNumToSequence+1, err, + }
    - 406 - -
    - - - ) +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -92790,6 +285255,21 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    +
     
    - 407 + + -
    - - - sequences = sequences[:len(sequences)-1] +
    +
    +   +
    - 408 + + -
    - - +
    +
    +  
    - 409 + + -
    - - - return sequences, nil +
    +
    +   +
    - 410 + + -
    - - - } +
    +
    +   +
    - 411 + + -
    - - +
    +
    +  
    - 412 + + -
    - - - func isDataForEthTxTooBig(err error) bool { +
    +
    +   +
    - 413 + + -
    - - - return errors.Is(err, ethman.ErrGasRequiredExceedsAllowance) || +
    +
    +   +
    - 414 + + -
    - - - errors.Is(err, ErrOversizedData) || +
    +
    +   +
    - 415 + + -
    - - - errors.Is(err, ethman.ErrContentLengthTooLarge) +
    +
    +   +
    - 416 + + -
    - - - } +
    +
    +   +
    - 417 + + -
    - - +
    +
    +  
    - 418 + + -
    +
    +
      - func (s *SequenceSender) isSynced(ctx context.Context, retries int, waitRetry time.Duration) (bool, error) { +
    - 419 + + -
    +
    +
      - lastVirtualBatchNum, err := s.state.GetLastVirtualBatchNum(ctx, nil) +
    - 420 + + -
    +
    +
      - if err != nil && err != state.ErrNotFound { +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/common/syncinterfaces/state.go + RENAMED + +
    +
    @@ -92797,31 +285277,31 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - + - - - - - - - - + + + - + + +
    -
     
    +
    @@ -21,13 +21,6 @@
    - 6 + 21
      - "fmt" + GetBatchByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.Batch, error)
    - 7 + 22
      - "time" + }
    - 8 + 23
    @@ -92830,433 +285310,437 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - + + 24 -
    -   -
    +
    +
    + - + type StateLastBlockGetter interface {
    - 9 + + 25 +
    -   - "github.com/0xPolygonHermez/zkevm-node/etherman/types" + - + GetLastBlock(ctx context.Context, dbTx pgx.Tx) (*state.Block, error)
    - 10 + + 26 +
    -   - "github.com/0xPolygonHermez/zkevm-node/ethtxmanager" + - + }
    - 11 + + 27 +
    -   - "github.com/0xPolygonHermez/zkevm-node/event" + - +
    - 12 + + 28 +
    -   - "github.com/0xPolygonHermez/zkevm-node/log" + - + type StateBlobSequencer interface {
    - 13 + + 29 +
    -   - "github.com/0xPolygonHermez/zkevm-node/state" + - + }
    - + + 30 -
    -   +
    +
    + -
    - 14 + 31
      - "github.com/jackc/pgx/v4" + // StateFullInterface gathers the methods required to interact with the state.
    - 15 + 32
      - ) + type StateFullInterface interface {
    - 16 + 33
      -
    + GetLastBlock(ctx context.Context, dbTx pgx.Tx) (*state.Block, error)
    -
     
    +
    @@ -73,7 +66,6 @@
    - 39 + 73
      - ethTxManager ethTxManager + GetForkIDByBlockNumber(blockNumber uint64) uint64
    - 40 + 74
      - etherman etherman + GetStoredFlushID(ctx context.Context) (uint64, string, error)
    - 41 + 75
      - eventLog *event.EventLog + AddL1InfoTreeLeaf(ctx context.Context, L1InfoTreeLeaf *state.L1InfoTreeLeaf, dbTx pgx.Tx) (*state.L1InfoTreeExitRootStorageEntry, error)
    - 42 + + 76 +
    - + - da dataAbilitier + - + AddL1InfoTreeRecursiveLeaf(ctx context.Context, L1InfoTreeLeaf *state.L1InfoTreeLeaf, dbTx pgx.Tx) (*state.L1InfoTreeExitRootStorageEntry, error)
    - 43 + 77
      - } + StoreL2Block(ctx context.Context, batchNumber uint64, l2Block *state.ProcessBlockResponse, txsEGPLog []*state.EffectiveGasPriceLog, dbTx pgx.Tx) error
    - 44 + 78
      -
    + GetL1InfoRootLeafByL1InfoRoot(ctx context.Context, l1InfoRoot common.Hash, dbTx pgx.Tx) (state.L1InfoTreeExitRootStorageEntry, error)
    - 45 + 79
      - // New inits sequence sender + UpdateWIPBatch(ctx context.Context, receipt state.ProcessingReceipt, dbTx pgx.Tx) error
    - 46 - -
    - + - func New(cfg Config, state stateInterface, etherman etherman, manager ethTxManager, eventLog *event.EventLog, da dataAbilitier) (*SequenceSender, error) { -
    +
    +
    @@ -84,11 +76,6 @@
    - 47 + 84
      - return &SequenceSender{ + UpdateForkIDBlockNumber(ctx context.Context, forkdID uint64, newBlockNumber uint64, updateMemCache bool, dbTx pgx.Tx) error
    - 48 + 85
      - cfg: cfg, + GetLastL2BlockNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error)
    - 49 + 86
      - state: state, + GetL2BlockByNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*state.L2Block, error)
    - 50 + + 87 +
    -   - etherman: etherman, + - + GetLastBlobSequence(ctx context.Context, dbTx pgx.Tx) (*state.BlobSequence, error)
    - 51 + + 88 +
    -   - ethTxManager: manager, + - + AddBlobSequence(ctx context.Context, blobSequence *state.BlobSequence, dbTx pgx.Tx) error
    - 52 + + 89 +
    -   - eventLog: eventLog, + - + GetL1InfoRecursiveRootLeafByIndex(ctx context.Context, l1InfoTreeIndex uint32, dbTx pgx.Tx) (state.L1InfoTreeExitRootStorageEntry, error)
    - 53 + + 90 +
    - + - da: da, + - + ProcessBlobInner(ctx context.Context, request state.ProcessBlobInnerProcessRequest, data []byte) (*state.ProcessBlobInnerResponse, error) +
    +
    + 91 + +
    + - + AddBlobInner(ctx context.Context, blobInner *state.BlobInner, dbTx pgx.Tx) error
    - 54 + 92
      - }, nil + GetUncheckedBlocks(ctx context.Context, fromBlockNumber uint64, toBlockNumber uint64, dbTx pgx.Tx) ([]*state.Block, error)
    - 55 + 93
      - } + GetPreviousBlockToBlockNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*state.Block, error)
    - 56 + 94
      -
    + }
    +
    +
    +
    +
    + + + - - - - - - - - - - - - - - - - - @@ -93266,42 +285750,32 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - @@ -93316,32 +285790,32 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -93351,82 +285825,32 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - @@ -93480,55 +285904,178 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - + + +
     
    - 185 + 21
      - } + GetBatchByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.Batch, error)
    - 186 + 22
      -
    + }
    - 187 + 23
      - // add sequence to be monitored -
    -
    - 188 - -
    - + - dataAvailabilityMessage, err := s.da.PostSequence(ctx, sequences) +
    - 189 + + -
    - + - if err != nil { +
    +
    +   +
    - 190 + + -
    - + - log.Error("error posting sequences to the data availability protocol: ", err) +
    +
    +   +
    - 191 + + -
    - + - return +
    +
    +   +
    - 192 + + -
    - + - } +
    +
    +   +
    - 193 + + -
    +
    +
     
    - 194 + + -
    - + - firstSequence := sequences[0] +
    +
    +   +
    - 195 + + -
    - + - to, data, err := s.etherman.BuildSequenceBatchesTxData(s.cfg.SenderAddress, sequences, uint64(lastSequence.LastL2BLockTimestamp), firstSequence.BatchNumber-1, s.cfg.L2Coinbase, dataAvailabilityMessage) +
    +
    +   +
    - 196 + 24
      - if err != nil { + // StateFullInterface gathers the methods required to interact with the state.
    - 197 + 25
      - log.Error("error estimating new sequenceBatches to add to eth tx manager: ", err) + type StateFullInterface interface {
    - 198 + 26
      - return + GetLastBlock(ctx context.Context, dbTx pgx.Tx) (*state.Block, error)
    - 223 + 66
      - sequences := []types.Sequence{} + GetForkIDByBlockNumber(blockNumber uint64) uint64
    - 224 + 67
      - // var estimatedGas uint64 + GetStoredFlushID(ctx context.Context) (uint64, string, error)
    - 225 + 68
      -
    -
    -
    - - -
    -   -
    + AddL1InfoTreeLeaf(ctx context.Context, L1InfoTreeLeaf *state.L1InfoTreeLeaf, dbTx pgx.Tx) (*state.L1InfoTreeExitRootStorageEntry, error)
    - 226 + 69
      - // Add sequences until too big for a single L1 tx or last batch is reached + StoreL2Block(ctx context.Context, batchNumber uint64, l2Block *state.ProcessBlockResponse, txsEGPLog []*state.EffectiveGasPriceLog, dbTx pgx.Tx) error
    - 227 + 70
      - for { + GetL1InfoRootLeafByL1InfoRoot(ctx context.Context, l1InfoRoot common.Hash, dbTx pgx.Tx) (state.L1InfoTreeExitRootStorageEntry, error)
    - 228 + 71
      - //Check if the next batch belongs to a new forkid, in this case we need to stop sequencing as we need to + UpdateWIPBatch(ctx context.Context, receipt state.ProcessingReceipt, dbTx pgx.Tx) error
    - 291 + 76
      -
    + UpdateForkIDBlockNumber(ctx context.Context, forkdID uint64, newBlockNumber uint64, updateMemCache bool, dbTx pgx.Tx) error
    - 292 + 77
      - sequences = append(sequences, seq) + GetLastL2BlockNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error)
    - 293 + 78
      - // Check if can be send -
    -
    - 294 - -
    - + - if len(sequences) == int(s.cfg.MaxBatchesForL1) { -
    -
    - 295 - -
    - + - log.Info( -
    -
    - 296 - -
    - + - "sequence should be sent to L1, because MaxBatchesForL1 (%d) has been reached", -
    -
    - 297 - -
    - + - s.cfg.MaxBatchesForL1, -
    -
    - 298 - -
    - + - ) + GetL2BlockByNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*state.L2Block, error)
    - + + 79 -
    +
    +
      -
    + GetUncheckedBlocks(ctx context.Context, fromBlockNumber uint64, toBlockNumber uint64, dbTx pgx.Tx) ([]*state.Block, error)
    - + + 80 -
    +
    +
      -
    + GetPreviousBlockToBlockNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*state.Block, error)
    - + + 81 -
    +
    +
      -
    + } +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/common/syncinterfaces/sync_pre_rollup_syncer.go + RENAMED + +
    +
    +
    +
    + + + + + - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -1,10 +0,0 @@
    - + + 1 -
    -   +
    +
    + - + package syncinterfaces +
    +
    + 2 + +
    + -
    - + + 3 -
    -   +
    +
    + - + import ( +
    +
    + 4 + +
    + - + "context" +
    +
    + 5 + +
    + - + ) +
    +
    + 6 + +
    + -
    + 7 + +
    + - + // SyncPreRollupSyncer is the interface for synchronizing pre genesis rollup events +
    +
    + 8 + +
    + - + type SyncPreRollupSyncer interface { +
    +
    + 9 + +
    + - + SynchronizePreGenesisRollupEvents(ctx context.Context) error +
    +
    + 10 + +
    + - + } +
    +
    +
    +
    +
    +
    + + + + + + + +
    +
     
    +
    @@ -93629,64 +286176,98 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0


    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/config.go + RENAMED + +
    +
    +
    +
    + + + + + - - + - - - - - - - - - + +
    +
    @@ -20,9 +20,9 @@
    +
    - 299 + 20
      - return sequences, nil +
    - 300 + 21
      - } + // L1SyncCheckL2BlockHash if is true when a batch is closed is force to check L2Block hash against trustedNode (only apply for permissionless)
    - 301 + 22
      -
    + L1SyncCheckL2BlockHash bool `mapstructure:"L1SyncCheckL2BlockHash"`
    -
     
    +
    + 23 + +
    + - + // L1SyncCheckL2BlockNumberModulus is the modulus used to choose the l2block to check +
    - 326 + 24
      - return nil, nil + // a modules 5, for instance, means check all l2block multiples of 5 (10,15,20,...)
    - 327 + + 25 +
    -   - } + - + L1SyncCheckL2BlockNumberModulus uint64 `mapstructure:"L1SyncCheckL2BlockNumberModulus"`
    - 328 + 26
    @@ -93695,313 +286276,335 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - + + 27 -
    +
    +
      -
    + L1BlockCheck L1BlockCheckConfig `mapstructure:"L1BlockCheck"`
    - + + 28 -
    +
    +
      -
    + // L1SynchronizationMode define how to synchronize with L1:
    - - -
    -   -
    +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - + +
    +
     
    - + + 20 -
    +
    +
     
    - + + 21 -
    +
    +
      -
    + // L1SyncCheckL2BlockHash if is true when a batch is closed is force to check L2Block hash against trustedNode (only apply for permissionless)
    - + + 22 -
    +
    +
      -
    + L1SyncCheckL2BlockHash bool `mapstructure:"L1SyncCheckL2BlockHash"`
    - + + 23 -
    -   -
    +
    +
    + + + // L1SyncCheckL2BlockNumberhModulus is the modulus used to choose the l2block to check
    - + + 24 -
    +
    +
      -
    + // a modules 5, for instance, means check all l2block multiples of 5 (10,15,20,...)
    - + + 25 -
    -   -
    +
    +
    + + + L1SyncCheckL2BlockNumberhModulus uint64 `mapstructure:"L1SyncCheckL2BlockNumberhModulus"`
    - + + 26 -
    +
    +
     
    - + + 27 -
    +
    +
      -
    + L1BlockCheck L1BlockCheckConfig `mapstructure:"L1BlockCheck"`
    - + + 28 -
    +
    +
      -
    + // L1SynchronizationMode define how to synchronize with L1:
    - - -
    -   -
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/default_l1processors.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - + +
    +
    @@ -18,7 +17,6 @@
    - + + 18 -
    +
    +
      -
    + p.Register(actions.NewCheckL2BlockDecorator(incaberry.NewProcessL1SequenceForcedBatches(sync.state, sync), l2Blockchecker))
    - + + 19 -
    +
    +
      -
    + p.Register(incaberry.NewProcessorForkId(sync.state, sync))
    - + + 20 -
    +
    +
      -
    + p.Register(etrog.NewProcessorL1InfoTreeUpdate(sync.state))
    - + + 21 -
    -   -
    +
    +
    + - + p.Register(feijoa.NewProcessorL1InfoTreeUpdate(sync.state))
    - + + 22 -
    +
    +
      -
    + sequenceBatchesProcessor := etrog.NewProcessorL1SequenceBatches(sync.state, sync, common.DefaultTimeProvider{}, sync.halter)
    - + + 23 -
    +
    +
      -
    + p.Register(actions.NewCheckL2BlockDecorator(sequenceBatchesProcessor, l2Blockchecker))
    - + + 24 -
    +
    +
      -
    + p.Register(incaberry.NewProcessorL1VerifyBatch(sync.state))
    - - -
    -   -
    -
    +
    +
    @@ -26,6 +24,5 @@
    - + + 26 -
    +
    +
      -
    + p.Register(actions.NewCheckL2BlockDecorator(elderberry.NewProcessorL1SequenceBatchesElderberry(sequenceBatchesProcessor, sync.state), l2Blockchecker))
    - + + 27 -
    +
    +
      -
    + // intialSequence is process in ETROG by the same class, this is just a wrapper to pass directly to ETROG
    - + + 28 -
    +
    +
      -
    + p.Register(elderberry.NewProcessorL1InitialSequenceBatchesElderberry(sequenceBatchesProcessor))
    - + + 29 -
    -   -
    +
    +
    + - + p.Register(feijoa.NewProcessorSequenceBlobs(sync.state, sync.state, nil))
    - + + 30 -
    +
    +
      -
    + return p.Build()
    - + + 31 -
    +
    +
      -
    + }
    - - -
    -   -
    +
    +
    +
    +
    + + + + + - - - - - - @@ -94015,73 +286618,68 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - + - - - - - - @@ -94095,141 +286693,155 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - + +
    +
     
    - + + 17 -
    +
    +
      -
    + p.Register(actions.NewCheckL2BlockDecorator(incaberry.NewProcessL1SequenceForcedBatches(sync.state, sync), l2Blockchecker))
    - + + 18 -
    +
    +
      -
    + p.Register(incaberry.NewProcessorForkId(sync.state, sync))
    - + + 19 -
    +
    +
      -
    + p.Register(etrog.NewProcessorL1InfoTreeUpdate(sync.state))
    - + + 20 -
    +
    +
      -
    + sequenceBatchesProcessor := etrog.NewProcessorL1SequenceBatches(sync.state, sync, common.DefaultTimeProvider{}, sync.halter)
    - + + 21 -
    +
    +
      -
    + p.Register(actions.NewCheckL2BlockDecorator(sequenceBatchesProcessor, l2Blockchecker))
    - + + 22 -
    +
    +
      -
    + p.Register(incaberry.NewProcessorL1VerifyBatch(sync.state))
    - - -
    -   -
    -
    +
    +
     
    - + + 24 -
    +
    +
      -
    + p.Register(actions.NewCheckL2BlockDecorator(elderberry.NewProcessorL1SequenceBatchesElderberry(sequenceBatchesProcessor, sync.state), l2Blockchecker))
    - + + 25 -
    +
    +
      -
    + // intialSequence is process in ETROG by the same class, this is just a wrapper to pass directly to ETROG
    - + + 26 -
    +
    +
      -
    + p.Register(elderberry.NewProcessorL1InitialSequenceBatchesElderberry(sequenceBatchesProcessor))
    - + + 27 -
    +
    +
      -
    + return p.Build()
    - + + 28 -
    +
    +
      -
    + }
    - - -
    -   -
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l1_parallel_sync/l1_rollup_info_consumer.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - -
    +
    @@ -11,7 +11,7 @@
    - + + 11 -
    +
    +
      -
    + "github.com/0xPolygonHermez/zkevm-node/log"
    - + + 12 -
    +
    +
      -
    + "github.com/0xPolygonHermez/zkevm-node/state"
    - + + 13 -
    +
    +
      -
    + syncCommon "github.com/0xPolygonHermez/zkevm-node/synchronizer/common"
    - + + 14 -
    -   -
    +
    +
    + - + "github.com/0xPolygonHermez/zkevm-node/synchronizer/common/syncinterfaces"
    - + + 15 -
    +
    +
      -
    + types "github.com/ethereum/go-ethereum/core/types"
    - + + 16 -
    +
    +
      -
    + )
    - + + 17 -
    +
    +
     
    - - -
    -   -
    -
    +
    +
    @@ -33,10 +33,16 @@
    - + + 33 -
    +
    +
      -
    + AceptableInacctivityTime time.Duration
    - + + 34 -
    +
    +
      -
    + }
    - + + 35 -
    +
    +
     
    @@ -94295,336 +286907,298 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - + + 36 -
    +
    +
      -
    + // l1RollupInfoConsumer is the object that process the rollup info data incomming from channel chIncommingRollupInfo
    - + + 37 -
    +
    +
      -
    + type l1RollupInfoConsumer struct {
    - + + 38 -
    +
    +
      -
    + mutex sync.Mutex
    - + + 39 -
    -   -
    +
    +
    + - + synchronizer syncinterfaces.BlockRangeProcessor
    - + + 40 -
    +
    +
      -
    + chIncommingRollupInfo chan L1SyncMessage
    - + + 41 -
    +
    +
      -
    + ctx context.Context
    - + + 42 -
    +
    +
      -
    + statistics l1RollupInfoConsumerStatistics
    - - -
    -   -
    -
    +
    +
    @@ -47,7 +53,7 @@
    - + + 47 -
    +
    +
     
    - + + 48 -
    +
    +
      -
    + // NewL1RollupInfoConsumer creates a new l1RollupInfoConsumer
    - + + 49 -
    +
    +
      -
    + func NewL1RollupInfoConsumer(cfg ConfigConsumer,
    - + + 50 -
    -   -
    +
    +
    + - + synchronizer syncinterfaces.BlockRangeProcessor, ch chan L1SyncMessage) *l1RollupInfoConsumer {
    - 329 + 51
      - func (s *SequenceSender) isSynced(ctx context.Context, retries int, waitRetry time.Duration) (bool, error) { + if cfg.AceptableInacctivityTime < minAcceptableTimeWaitingForNewRollupInfoData {
    - 330 + 52
      - lastVirtualBatchNum, err := s.state.GetLastVirtualBatchNum(ctx, nil) + log.Warnf("consumer: the AceptableInacctivityTime is too low (%s) minimum recommended %s", cfg.AceptableInacctivityTime, minAcceptableTimeWaitingForNewRollupInfoData)
    - 331 + 53
      - if err != nil && err != state.ErrNotFound { + }
    -
    -
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencesender/sequencesender_test.go - RENAMED - -
    -
    -
    -
    - - - + - - -
    -
    @@ -30,7 +30,7 @@
    +
    @@ -231,7 +237,7 @@
    - 30 + 231
      - stateMock := new(StateMock) + return nil, nil
    - 31 + 232
      - ethermanMock := new(EthermanMock) + }
    - 32 + 233
      - ethTxManagerMock := new(EthTxManagerMock) + b := convertL1BlockToEthBlock(lb)
    - 33 + 234
    - - ssender, err := New(Config{}, stateMock, ethermanMock, ethTxManagerMock, nil) + err := l.synchronizer.ProcessBlockRange(l.ctx, []etherman.Block{b}, order)
    - 34 + 235
      - assert.NoError(t, err) + if err != nil {
    - 35 + 236
      -
    + log.Error("consumer: Error processing last block of range: ", rollupInfo.blockRange, " err:", err)
    - 36 + 237
      - testCases := []IsSyncedTestCase{ + return nil, err
    -
    -
    -
    -
    - - - + - - @@ -94632,21 +287206,6 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
     
    +
    @@ -243,7 +249,7 @@
    - 30 + 243
      - stateMock := new(StateMock) + tmpStateBlock := convertEthmanBlockToStateBlock(&blocks[len(blocks)-1])
    - 31 + 244
      - ethermanMock := new(EthermanMock) + lastEthBlockSynced = &tmpStateBlock
    - 32 + 245
      - ethTxManagerMock := new(EthTxManagerMock) + logBlocks(blocks)
    - 33 + + 246 +
    - + - ssender, err := New(Config{}, stateMock, ethermanMock, ethTxManagerMock, nil, nil) + - + err := l.synchronizer.ProcessBlockRange(l.ctx, blocks, order)
    - 34 + 247
      - assert.NoError(t, err) + if err != nil {
    - 35 + 248
      -
    + log.Info("consumer: Error processing block range: ", rollupInfo.blockRange, " err:", err)
    - 36 + 249
      - testCases := []IsSyncedTestCase{ + return nil, err
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/state/batchV2.go - RENAMED - -
    -
    @@ -94654,310 +287213,316 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - + + + + - - - - -
    -
    @@ -69,6 +69,7 @@
    +
     
    - 69 + 11
      - ChainId: s.cfg.ChainID, + "github.com/0xPolygonHermez/zkevm-node/log"
    - 70 + 12
      - ForkId: request.ForkID, + "github.com/0xPolygonHermez/zkevm-node/state"
    - 71 + 13
      - ContextId: uuid.NewString(), + syncCommon "github.com/0xPolygonHermez/zkevm-node/synchronizer/common"
    - + + 14 -
    -   -
    +
    +
    + + + "github.com/ethereum/go-ethereum/common"
    - 72 + 15
      - } + types "github.com/ethereum/go-ethereum/core/types"
    - 73 + 16
      -
    + )
    - 74 + 17
      - if request.SkipFirstChangeL2Block_V2 { +
    -
    @@ -131,6 +132,7 @@
    +
     
    - 131 + 33
      - ForkId: forkId, + AceptableInacctivityTime time.Duration
    - 132 + 34
      - ContextId: uuid.NewString(), + }
    - 133 + 35
      - SkipVerifyL1InfoRoot: skipVerifyL1InfoRoot, +
    - + + 36 -
    -   -
    +
    +
    + + + // synchronizerProcessBlockRangeInterface is the interface with synchronizer
    - 134 + + 37 +
    -   - } + + + // to execute blocks. This interface is used to mock the synchronizer in the tests
    - 135 + + 38 +
    -   -
    + + + type synchronizerProcessBlockRangeInterface interface {
    - 136 + + 39 +
    -   - if forcedBlockHashL1 != nil { + + + ProcessBlockRange(blocks []etherman.Block, order map[common.Hash][]etherman.Order) error
    -
    @@ -231,6 +233,7 @@
    +
    + 40 + +
    + + + } +
    +
    + 41 + +
    + + +
    +
    - 231 + 42
      - ContextId: uuid.NewString(), + // l1RollupInfoConsumer is the object that process the rollup info data incomming from channel chIncommingRollupInfo
    - 232 + 43
      - SkipVerifyL1InfoRoot: processingCtx.SkipVerifyL1InfoRoot, + type l1RollupInfoConsumer struct {
    - 233 + 44
      - L1InfoRoot: processingCtx.L1InfoRoot.Bytes(), + mutex sync.Mutex
    - + + 45 -
    -   -
    +
    +
    + + + synchronizer synchronizerProcessBlockRangeInterface
    - 234 + 46
      - } + chIncommingRollupInfo chan L1SyncMessage
    - 235 + 47
      -
    + ctx context.Context
    - 236 + 48
      - if processingCtx.ForcedBlockHashL1 != nil { + statistics l1RollupInfoConsumerStatistics
    -
    -
    -
    -
    - - - + - - @@ -94967,72 +287532,72 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - @@ -95042,72 +287607,72 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - @@ -95117,12 +287682,12 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    +
    {/home/stefan/go/src/Polygon/zkevm-node → .}/state/block.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l1_parallel_sync/l1_rollup_info_consumer_test.go RENAMED
    - - - - -
     
    - 69 + 53
      - ChainId: s.cfg.ChainID, +
    - 70 + 54
      - ForkId: request.ForkID, + // NewL1RollupInfoConsumer creates a new l1RollupInfoConsumer
    - 71 + 55
      - ContextId: uuid.NewString(), + func NewL1RollupInfoConsumer(cfg ConfigConsumer,
    - 72 + + 56 +
    + - ExecutionMode: request.ExecutionMode, + synchronizer synchronizerProcessBlockRangeInterface, ch chan L1SyncMessage) *l1RollupInfoConsumer {
    - 73 + 57
      - } + if cfg.AceptableInacctivityTime < minAcceptableTimeWaitingForNewRollupInfoData {
    - 74 + 58
      -
    + log.Warnf("consumer: the AceptableInacctivityTime is too low (%s) minimum recommended %s", cfg.AceptableInacctivityTime, minAcceptableTimeWaitingForNewRollupInfoData)
    - 75 + 59
      - if request.SkipFirstChangeL2Block_V2 { + }
    - 132 + 237
      - ForkId: forkId, + return nil, nil
    - 133 + 238
      - ContextId: uuid.NewString(), + }
    - 134 + 239
      - SkipVerifyL1InfoRoot: skipVerifyL1InfoRoot, + b := convertL1BlockToEthBlock(lb)
    - 135 + + 240 +
    + - ExecutionMode: executor.ExecutionMode1, + err := l.synchronizer.ProcessBlockRange([]etherman.Block{b}, order)
    - 136 + 241
      - } + if err != nil {
    - 137 + 242
      -
    + log.Error("consumer: Error processing last block of range: ", rollupInfo.blockRange, " err:", err)
    - 138 + 243
      - if forcedBlockHashL1 != nil { + return nil, err
    - 233 + 249
      - ContextId: uuid.NewString(), + tmpStateBlock := convertEthmanBlockToStateBlock(&blocks[len(blocks)-1])
    - 234 + 250
      - SkipVerifyL1InfoRoot: processingCtx.SkipVerifyL1InfoRoot, + lastEthBlockSynced = &tmpStateBlock
    - 235 + 251
      - L1InfoRoot: processingCtx.L1InfoRoot.Bytes(), + logBlocks(blocks)
    - 236 + + 252 +
    + - ExecutionMode: processingCtx.ExecutionMode, + err := l.synchronizer.ProcessBlockRange(blocks, order)
    - 237 + 253
      - } + if err != nil {
    - 238 + 254
      -
    + log.Info("consumer: Error processing block range: ", rollupInfo.blockRange, " err:", err)
    - 239 + 255
      - if processingCtx.ForcedBlockHashL1 != nil { + return nil, err
    -
    @@ -12,6 +12,7 @@
    +
    @@ -17,7 +16,7 @@
    - 12 + 17
      - BlockHash common.Hash +
    - 13 + 18
      - ParentHash common.Hash + type consumerTestData struct {
    - 14 + 19
      - ReceivedAt time.Time + sut *l1RollupInfoConsumer
    - + + 20 -
    -   -
    +
    +
    + - + syncMock *mock_syncinterfaces.BlockRangeProcessor
    - 15 + 21
      - } + ch chan L1SyncMessage
    - 16 + 22
      -
    + }
    - 17 + 23
      - // NewBlock creates a block with the given data. +
    -
    -
    -
    -
    - - - + - - - - -
    -
     
    +
    @@ -55,7 +54,7 @@
    - 12 + 55
      - BlockHash common.Hash + lastBlockOfRange: types.NewBlock(&types.Header{Number: big.NewInt(123)}, nil, nil, nil, nil),
    - 13 + 56
      - ParentHash common.Hash + }
    - 14 + 57
      - ReceivedAt time.Time + data.syncMock.
    - 15 + + 58 +
    - + - Checked bool + - + On("ProcessBlockRange", mock.Anything, mock.Anything, mock.Anything).
    - 16 + 59
      - } + Return(errors.New("error")).
    - 17 + 60
      -
    + Once()
    - 18 + 61
      - // NewBlock creates a block with the given data. + data.ch <- *newL1SyncMessageData(&responseRollupInfoByBlockRange)
    -
    -
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/state/effectivegasprice.go - RENAMED - -
    -
    -
    -
    - - - + - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - + + + - - - - - + - + + - - - - - - + + + - - - - + + +
    -
    @@ -0,0 +1,44 @@
    +
    @@ -107,7 +106,7 @@
    - + + 107 -
    +
    +
      -
    + data.ch <- *newL1SyncMessageData(&responseRollupInfoByBlockRange)
    - + + 108 -
    +
    +
      -
    + data.ch <- *newL1SyncMessageControlWProducerIsFullySynced(200)
    - + + 109 -
    +
    +
      -
    + data.syncMock.
    - + + 110 -
    -   -
    +
    +
    + - + On("ProcessBlockRange", mock.Anything, mock.Anything, mock.Anything).
    - + + 111 -
    +
    +
      -
    + Return(nil).
    - + + 112 -
    +
    +
      -
    + Once()
    - + + 113 -
    +
    +
      -
    + err := data.sut.Start(ctxTimeout, nil)
    - + +
    @@ -134,7 +133,7 @@
    -
    +
    + 134 + +
      -
    + data.ch <- *newL1SyncMessageData(&responseRollupInfoByBlockRange)
    - + + 135 -
    +
    +
      -
    + data.ch <- *newL1SyncMessageControlWProducerIsFullySynced(300)
    - + + 136 -
    +
    +
      -
    + data.syncMock.
    - + + 137 -
    -   -
    +
    +
    + - + On("ProcessBlockRange", mock.Anything, mock.Anything, mock.Anything).
    - + + 138 -
    +
    +
      -
    + Return(nil).
    - + + 139 -
    +
    +
      -
    + Once()
    - + + 140 -
    +
    +
      -
    + err := data.sut.Start(ctxTimeout, nil)
    - + +
    @@ -163,7 +162,7 @@
    -
    +
    + 163 + +
      -
    + data.ch <- *newL1SyncMessageData(&responseRollupInfoByBlockRange)
    - + + 164 -
    +
    +
      -
    + data.ch <- *newL1SyncMessageControlWProducerIsFullySynced(200)
    - + + 165 -
    +
    +
      -
    + data.syncMock.
    - + + 166 -
    -   -
    +
    +
    + - + On("ProcessBlockRange", mock.Anything, mock.Anything, mock.Anything).
    - + + 167 -
    +
    +
      -
    + Return(nil).
    - + + 168 -
    +
    +
      -
    + Once()
    - + + 169 -
    +
    +
      -
    + err := data.sut.Start(ctxTimeout, nil)
    - + +
    @@ -192,7 +191,7 @@
    -
    +
    + 192 + +
      -
    + responseRollupInfoByBlockRange.blockRange.toBlock = 400
    - + + 193 -
    +
    +
      -
    + data.ch <- *newL1SyncMessageData(&responseRollupInfoByBlockRange)
    - + + 194 -
    +
    +
      -
    + data.ch <- *newL1SyncMessageControlWProducerIsFullySynced(200)
    - + + 195 -
    +
    +
    + - + data.syncMock.EXPECT().ProcessBlockRange(mock.Anything, mock.Anything, mock.Anything).Return(nil).Times(1) +
    +
    + 196 + +
      -
    + err := data.sut.Start(ctxTimeout, nil)
    - + + 197 -
    +
    +
      -
    + require.NoError(t, err)
    - + + 198 -
    +
    +
      -
    + }
    - + +
    @@ -207,7 +206,7 @@
    -
    +
    + 207 + +
      -
    + }
    - + + 208 -
    +
    +
     
    - + + 209 -
    +
    +
      -
    + func setupConsumerTest(t *testing.T) consumerTestData {
    - + + 210 -
    +
    +
    + - + syncMock := mock_syncinterfaces.NewBlockRangeProcessor(t) +
    +
    + 211 + +
      -
    + ch := make(chan L1SyncMessage, 10)
    - + + 212 -
    +
    +
     
    - + + 213 -
    +
    +
      -
    + cfg := ConfigConsumer{ +
    +
    +
    +
    +
    + + + + + - - - - - - - - + + + - - - - - + - + + - - - - - - + + + - - - - -
    +
     
    - + + 16 -
    +
    +
     
    - + + 17 -
    +
    +
      -
    + type consumerTestData struct {
    - + + 18 -
    +
    +
      -
    + sut *l1RollupInfoConsumer
    - + + 19 -
    +
    +
    + + + syncMock *synchronizerProcessBlockRangeInterfaceMock +
    +
    + 20 + +
      -
    + ch chan L1SyncMessage
    - + + 21 -
    +
    +
      -
    + }
    - + + 22 -
    +
    +
     
    - + +
     
    -
    +
    + 54 + +
      -
    + lastBlockOfRange: types.NewBlock(&types.Header{Number: big.NewInt(123)}, nil, nil, nil, nil),
    - + + 55 -
    +
    +
      -
    + }
    - + + 56 -
    +
    +
      -
    + data.syncMock.
    - + + 57 -
    +
    +
    + + + On("ProcessBlockRange", mock.Anything, mock.Anything). +
    +
    + 58 + +
      -
    + Return(errors.New("error")).
    - + + 59 -
    +
    +
      -
    + Once()
    -
    + + + 60 + + +
    +   + data.ch <- *newL1SyncMessageData(&responseRollupInfoByBlockRange)
    -
    -
    - - - + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - + + +
     
    - 1 + + 106 +
    - + - package state +   + data.ch <- *newL1SyncMessageData(&responseRollupInfoByBlockRange)
    - 2 + + 107 +
    - + -
    +   + data.ch <- *newL1SyncMessageControlWProducerIsFullySynced(200)
    - 3 + + 108 +
    - + - import ( +   + data.syncMock.
    - 4 + + 109 +
    + - "errors" + On("ProcessBlockRange", mock.Anything, mock.Anything).
    - 5 + + 110 + +
    +   + Return(nil). +
    +
    + 111 + +
    +   + Once() +
    +
    + 112 + +
    +   + err := data.sut.Start(ctxTimeout, nil) +
    +
    +
     
    +
    + 133 + +
    +   + data.ch <- *newL1SyncMessageData(&responseRollupInfoByBlockRange) +
    +
    + 134 + +
    +   + data.ch <- *newL1SyncMessageControlWProducerIsFullySynced(300) +
    +
    + 135 +
    - + - "math/big" +   + data.syncMock.
    - 6 + + 136 +
    + - ) + On("ProcessBlockRange", mock.Anything, mock.Anything).
    - 7 + + 137 +
    - + -
    +   + Return(nil).
    - 8 + + 138 +
    - + - const ( +   + Once()
    - 9 + + 139 +
    - + - // MaxEffectivePercentage is the maximum value that can be used as effective percentage +   + err := data.sut.Start(ctxTimeout, nil)
    - 10 + +
     
    +
    + 162 +
    - + - MaxEffectivePercentage = uint8(255) +   + data.ch <- *newL1SyncMessageData(&responseRollupInfoByBlockRange)
    - 11 + + 163 +
    - + - ) +   + data.ch <- *newL1SyncMessageControlWProducerIsFullySynced(200)
    - 12 + + 164 +
    - + -
    +   + data.syncMock.
    - 13 + + 165 +
    + - var ( + On("ProcessBlockRange", mock.Anything, mock.Anything).
    - 14 + + 166 +
    - + - // ErrEffectiveGasPriceEmpty happens when the effectiveGasPrice or gasPrice is nil or zero +   + Return(nil).
    - 15 + + 167 +
    - + - ErrEffectiveGasPriceEmpty = errors.New("effectiveGasPrice or gasPrice cannot be nil or zero") +   + Once()
    - 16 + + 168 +
    - + -
    +   + err := data.sut.Start(ctxTimeout, nil)
    - 17 + +
     
    +
    + 191 +
    - + - // ErrEffectiveGasPriceIsZero happens when the calculated EffectiveGasPrice is zero +   + responseRollupInfoByBlockRange.blockRange.toBlock = 400
    - 18 + + 192 +
    - + - ErrEffectiveGasPriceIsZero = errors.New("effectiveGasPrice cannot be zero") +   + data.ch <- *newL1SyncMessageData(&responseRollupInfoByBlockRange)
    - 19 + + 193 +
    - + - ) +   + data.ch <- *newL1SyncMessageControlWProducerIsFullySynced(200)
    - 20 + + 194 +
    + -
    + data.syncMock.EXPECT().ProcessBlockRange(mock.Anything, mock.Anything).Return(nil).Times(1)
    - 21 + + 195 +
    - + - // CalculateEffectiveGasPricePercentage calculates the gas price's effective percentage +   + err := data.sut.Start(ctxTimeout, nil)
    - 22 + + 196 +
    - + - func CalculateEffectiveGasPricePercentage(gasPrice *big.Int, effectiveGasPrice *big.Int) (uint8, error) { +   + require.NoError(t, err)
    - 23 + + 197 +
    - + - const bits = 256 +   + }
    - 24 + +
     
    +
    + 206 +
    - + - var bitsBigInt = big.NewInt(bits) +   + }
    - 25 + + 207 +
    - + +  
    - 26 + + 208 +
    - + - if effectiveGasPrice == nil || gasPrice == nil || +   + func setupConsumerTest(t *testing.T) consumerTestData {
    - 27 + + 209 +
    + - gasPrice.Cmp(big.NewInt(0)) == 0 || effectiveGasPrice.Cmp(big.NewInt(0)) == 0 { + syncMock := newSynchronizerProcessBlockRangeInterfaceMock(t)
    - 28 + + 210 +
    - + - return 0, ErrEffectiveGasPriceEmpty +   + ch := make(chan L1SyncMessage, 10)
    - 29 + + 211 +
    - + - } +   +
    - 30 + + 212 +
    - + -
    +   + cfg := ConfigConsumer{ +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l1_parallel_sync/l1_worker_etherman_test.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - + + +
    +
    @@ -31,7 +31,7 @@
    + 31 +
    - + - if gasPrice.Cmp(effectiveGasPrice) <= 0 { +   + GlobalExitRootManagerAddr: common.HexToAddress("0x8A791620dd6260079BF849Dc5567aDC3F2FdC318"),
    + 32 +
    - + - return MaxEffectivePercentage, nil +   + }
    + 33 +
    - + - } +   +
    + 34 +
    - + -
    + - + ethermanClient, err := etherman.NewClient(cfg, l1Config)
    + 35 +
    - + - // Simulate Ceil with integer division +   + require.NoError(t, err)
    + 36 +
    - + - b := new(big.Int).Mul(effectiveGasPrice, bitsBigInt) +   + worker := newWorker(ethermanClient)
    + 37 +
    - + - b = b.Add(b, gasPrice) +   + ch := make(chan responseRollupInfoByBlockRange) +
    +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - @@ -96223,12 +288948,12 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    +
    {/home/stefan/go/src/Polygon/zkevm-node → .}/state/genesis.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l2_sync/l2_sync_etrog/executor_trusted_batch_sync.go RENAMED
    - - - - - - - - - @@ -96317,32 +289012,32 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -96361,102 +289056,72 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - @@ -96466,12 +289131,12 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    +
    {/home/stefan/go/src/Polygon/zkevm-node → .}/state/helper.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l2_sync/l2_sync_incaberry/sync_trusted_state.go RENAMED
    - - - - - @@ -96584,82 +289239,72 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - @@ -96669,12 +289314,12 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    +
    {/home/stefan/go/src/Polygon/zkevm-node → .}/state/interfaces.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/synchronizer_block_range_process.go RENAMED
    - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - -
    +
     
    - 38 + + 31 +
    - + - b = b.Sub(b, big.NewInt(1)) //nolint:gomnd +   + GlobalExitRootManagerAddr: common.HexToAddress("0x8A791620dd6260079BF849Dc5567aDC3F2FdC318"),
    - 39 + + 32 +
    - + - b = b.Div(b, gasPrice) +   + }
    - 40 + + 33 +
    - + - // At this point we have a percentage between 1-256, we need to sub 1 to have it between 0-255 (byte) +   +
    - 41 + + 34 +
    + - b = b.Sub(b, big.NewInt(1)) //nolint:gomnd + ethermanClient, err := etherman.NewClient(cfg, l1Config, nil, nil)
    - 42 + + 35 +
    - + -
    +   + require.NoError(t, err)
    - 43 + + 36 +
    - + - return uint8(b.Uint64()), nil +   + worker := newWorker(ethermanClient)
    - 44 + + 37 +
    - + - } +   + ch := make(chan responseRollupInfoByBlockRange)
    -
    @@ -19,8 +19,10 @@
    +
    @@ -429,6 +430,7 @@
    - 19 + 429
      -
    + Transactions: data.TrustedBatch.BatchL2Data,
    - 20 + 430
      - // Genesis contains the information to populate state on creation + ForkID: b.state.GetForkIDByBatchNumber(uint64(data.TrustedBatch.Number)),
    - 21 + 431
      - type Genesis struct { -
    -
    - 22 - -
    - - - // BlockNumber is the block number where the polygonZKEVM smc was deployed on L1 -
    -
    - 23 - -
    - - - BlockNumber uint64 -
    -
    - - -
    -   -
    + SkipVerifyL1InfoRoot_V2: true,
    - 24 + 432
      - // Root hash of the genesis block + }
    - 25 + 433
      - Root common.Hash + return request
    - 26 + 434
      - // Actions is the data to populate into the state trie + }
    - 19 + 430
      -
    + Transactions: data.TrustedBatch.BatchL2Data,
    - 20 + 431
      - // Genesis contains the information to populate state on creation + ForkID: b.state.GetForkIDByBatchNumber(uint64(data.TrustedBatch.Number)),
    - 21 + 432
      - type Genesis struct { -
    -
    - 22 - -
    - + - // RollupBlockNumber is the block number where the polygonZKEVM smc was deployed on L1 -
    -
    - 23 - -
    - + - RollupBlockNumber uint64 -
    -
    - 24 - -
    - + - // RollupManagerBlockNumber is the block number where the RollupManager smc was deployed on L1 + SkipVerifyL1InfoRoot_V2: true,
    - 25 + 433
    + - RollupManagerBlockNumber uint64 + ExecutionMode: executor.ExecutionMode1,
    - 26 + 434
      - // Root hash of the genesis block + }
    - 27 + 435
      - Root common.Hash + return request
    - 28 + 436
      - // Actions is the data to populate into the state trie + }
    -
    @@ -18,8 +18,6 @@
    +
    @@ -196,6 +196,7 @@
    - 18 + 196
      - double = 2 + OldAccInputHash: batches[1].AccInputHash,
    - 19 + 197
      - ether155V = 27 + Coinbase: common.HexToAddress(trustedBatch.Coinbase.String()),
    - 20 + 198
      - etherPre155V = 35 -
    -
    - 21 - -
    - - - // MaxEffectivePercentage is the maximum value that can be used as effective percentage + Timestamp_V1: time.Unix(int64(trustedBatch.Timestamp), 0),
    - 22 + + -
    - - - MaxEffectivePercentage = uint8(255) +
    +
    +   +
    - 23 + 199
      - // Decoding constants + }
    - 24 + 200
      - headerByteLength uint64 = 1 + // check if batch needs to be synchronized
    - 25 + 201
      - sLength uint64 = 32 + if batches[0] != nil {
    - 18 + 196
      - double = 2 + OldAccInputHash: batches[1].AccInputHash,
    - 19 + 197
      - ether155V = 27 + Coinbase: common.HexToAddress(trustedBatch.Coinbase.String()),
    - 20 + 198
      - etherPre155V = 35 -
    -
    - - -
    -   -
    + Timestamp_V1: time.Unix(int64(trustedBatch.Timestamp), 0),
    - + + 199 -
    -   -
    +
    +
    + + + ExecutionMode: executor.ExecutionMode1,
    - 21 + 200
      - // Decoding constants + }
    - 22 + 201
      - headerByteLength uint64 = 1 + // check if batch needs to be synchronized
    - 23 + 202
      - sLength uint64 = 32 + if batches[0] != nil {
    -
    @@ -24,6 +24,8 @@
    +
    @@ -1,166 +0,0 @@
    + + 1 + +
    + - + package synchronizer +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + import ( +
    +
    + 4 + +
    + - + "context" +
    +
    + 5 + +
    + - + "errors" +
    +
    + 6 + +
    + - +
    +
    +
    + 7 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/etherman" +
    +
    + 8 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/log" +
    +
    + 9 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/state" +
    +
    + 10 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/synchronizer/actions" +
    +
    + 11 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/synchronizer/common/syncinterfaces" +
    +
    + 12 + +
    + - + "github.com/0xPolygonHermez/zkevm-node/synchronizer/l1event_orders" +
    +
    + 13 + +
    + - + "github.com/ethereum/go-ethereum/common" +
    +
    + 14 + +
    + - + "github.com/jackc/pgx/v4" +
    +
    + 15 + +
    + - + ) +
    +
    + 16 + +
    + - +
    +
    +
    + 17 + +
    + - + type stateBlockRangeProcessor interface { +
    +
    + 18 + +
    + - + BeginStateTransaction(ctx context.Context) (pgx.Tx, error) +
    +
    + 19 + +
    + - + AddBlock(ctx context.Context, block *state.Block, dbTx pgx.Tx) error +
    +
    + 20 + +
    + - + GetForkIDByBatchNumber(batchNumber uint64) uint64 +
    +
    + 21 + +
    + - + GetForkIDByBlockNumber(blockNumber uint64) uint64 +
    +
    + 22 + +
    + - + } +
    +
    + 23 + +
    + - +
    +
    +
    24 + +
    + - + type ethermanI interface { +
    +
    + 25 + +
    + - + GetFinalizedBlockNumber(ctx context.Context) (uint64, error) +
    +
    + 26 + +
    + - + } +
    +
    + 27 + +
    + - +
    +
    +
    + 28 + +
    + - + // BlockRangeProcess is the struct that process the block range that implements syncinterfaces.BlockRangeProcessor +
    +
    + 29 + +
    + - + type BlockRangeProcess struct { +
    +
    + 30 + +
    + - + state stateBlockRangeProcessor +
    +
    + 31 + +
    + - + etherMan ethermanI +
    +
    + 32 + +
    + - + l1EventProcessors syncinterfaces.L1EventProcessorManager +
    +
    + 33 + +
    + - + flushIdManager syncinterfaces.SynchronizerFlushIDManager +
    +
    + 34 + +
    + - + } +
    +
    + 35 + +
    + - +
    +
    +
    + 36 + +
    + - + // NewBlockRangeProcessLegacy creates a new BlockRangeProcess +
    +
    + 37 + +
    + - + func NewBlockRangeProcessLegacy( +
    +
    + 38 + +
    + - + state stateBlockRangeProcessor, +
    +
    + 39 + +
    + - + etherMan ethermanI, +
    +
    + 40 + +
    + - + l1EventProcessors syncinterfaces.L1EventProcessorManager, +
    +
    + 41 + +
    + - + flushIdManager syncinterfaces.SynchronizerFlushIDManager, +
    +
    + 42 + +
    + - + ) *BlockRangeProcess { +
    +
    + 43 +
    -   - GetTxsOlderThanNL1BlocksUntilTxHash(ctx context.Context, nL1Blocks uint64, earliestTxHash common.Hash, dbTx pgx.Tx) ([]common.Hash, error) + - + return &BlockRangeProcess{
    - 25 + + 44 +
    -   - GetLastBlock(ctx context.Context, dbTx pgx.Tx) (*Block, error) + - + state: state,
    - 26 + + 45 +
    -   - GetPreviousBlock(ctx context.Context, offset uint64, dbTx pgx.Tx) (*Block, error) + - + etherMan: etherMan,
    - + + 46 -
    -   -
    +
    +
    + - + l1EventProcessors: l1EventProcessors,
    - + + 47 -
    -   -
    +
    +
    + - + flushIdManager: flushIdManager,
    - 27 + + 48 +
    -   - AddGlobalExitRoot(ctx context.Context, exitRoot *GlobalExitRoot, dbTx pgx.Tx) error + - + }
    - 28 + + 49 +
    -   - GetLatestGlobalExitRoot(ctx context.Context, maxBlockNumber uint64, dbTx pgx.Tx) (GlobalExitRoot, time.Time, error) + - + }
    - 29 + + 50 +
    -   - GetNumberOfBlocksSinceLastGERUpdate(ctx context.Context, dbTx pgx.Tx) (uint64, error) + - +
    -
    @@ -146,10 +148,12 @@
    +
    + 51 + +
    + - + // ProcessBlockRangeSingleDbTx process the L1 events and stores the information in the db reusing same DbTx +
    - 146 + + 52 +
    -   - GetRawBatchTimestamps(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*time.Time, *time.Time, error) + - + func (s *BlockRangeProcess) ProcessBlockRangeSingleDbTx(ctx context.Context, blocks []etherman.Block, order map[common.Hash][]etherman.Order, storeBlocks syncinterfaces.ProcessBlockRangeL1BlocksMode, dbTx pgx.Tx) error {
    - 147 + + 53 +
    -   - GetL1InfoRootLeafByL1InfoRoot(ctx context.Context, l1InfoRoot common.Hash, dbTx pgx.Tx) (L1InfoTreeExitRootStorageEntry, error) + - + return s.internalProcessBlockRange(ctx, blocks, order, storeBlocks, &dbTx)
    - 148 + + 54 +
    -   - GetL1InfoRootLeafByIndex(ctx context.Context, l1InfoTreeIndex uint32, dbTx pgx.Tx) (L1InfoTreeExitRootStorageEntry, error) + - + }
    - 149 + + 55 +
    - - GetLeafsByL1InfoRoot(ctx context.Context, l1InfoRoot common.Hash, dbTx pgx.Tx) ([]L1InfoTreeExitRootStorageEntry, error) +
    - 150 + + 56 +
    -   - GetBlockByNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*Block, error) + - + // ProcessBlockRange process the L1 events and stores the information in the db
    - 151 + + 57 +
    -   - GetVirtualBatchParentHash(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (common.Hash, error) + - + func (s *BlockRangeProcess) ProcessBlockRange(ctx context.Context, blocks []etherman.Block, order map[common.Hash][]etherman.Order) error {
    - 152 + + 58 +
    -   - GetForcedBatchParentHash(ctx context.Context, forcedBatchNumber uint64, dbTx pgx.Tx) (common.Hash, error) + - + return s.internalProcessBlockRange(ctx, blocks, order, syncinterfaces.StoreL1Blocks, nil)
    - + + 59 -
    -   -
    +
    +
    + - + }
    - + + 60 -
    -   +
    +
    + -
    - 153 + + 61 +
    -   - GetLatestBatchGlobalExitRoot(ctx context.Context, dbTx pgx.Tx) (common.Hash, error) + - + // ProcessBlockRange process the L1 events and stores the information in the db
    - 154 + + 62 +
    -   - GetL2TxHashByTxHash(ctx context.Context, hash common.Hash, dbTx pgx.Tx) (*common.Hash, error) + - + func (s *BlockRangeProcess) internalProcessBlockRange(ctx context.Context, blocks []etherman.Block, order map[common.Hash][]etherman.Order, storeBlocks syncinterfaces.ProcessBlockRangeL1BlocksMode, dbTxExt *pgx.Tx) error {
    - 155 + + 63 +
    -   - GetSyncInfoData(ctx context.Context, dbTx pgx.Tx) (SyncInfoDataOnStorage, error) -
    -
    -
    + - + // Check the latest finalized block in L1
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    - 24 + + 64 +
    -   - GetTxsOlderThanNL1BlocksUntilTxHash(ctx context.Context, nL1Blocks uint64, earliestTxHash common.Hash, dbTx pgx.Tx) ([]common.Hash, error) + - + finalizedBlockNumber, err := s.etherMan.GetFinalizedBlockNumber(ctx)
    - 25 + + 65 +
    -   - GetLastBlock(ctx context.Context, dbTx pgx.Tx) (*Block, error) + - + if err != nil {
    - 26 + + 66 +
    -   - GetPreviousBlock(ctx context.Context, offset uint64, dbTx pgx.Tx) (*Block, error) + - + log.Errorf("error getting finalized block number in L1. Error: %v", err)
    - 27 + + 67 +
    - + - GetFirstUncheckedBlock(ctx context.Context, fromBlockNumber uint64, dbTx pgx.Tx) (*Block, error) + - + return err
    - 28 + + 68 +
    - + - UpdateCheckedBlockByNumber(ctx context.Context, blockNumber uint64, newCheckedStatus bool, dbTx pgx.Tx) error + - + }
    - 29 + + 69 +
    -   - AddGlobalExitRoot(ctx context.Context, exitRoot *GlobalExitRoot, dbTx pgx.Tx) error + - + // New info has to be included into the db using the state
    - 30 + + 70 +
    -   - GetLatestGlobalExitRoot(ctx context.Context, maxBlockNumber uint64, dbTx pgx.Tx) (GlobalExitRoot, time.Time, error) + - + for i := range blocks {
    - 31 + + 71 +
    -   - GetNumberOfBlocksSinceLastGERUpdate(ctx context.Context, dbTx pgx.Tx) (uint64, error) + - + // Begin db transaction
    -
     
    -
    - 148 + + 72 +
    -   - GetRawBatchTimestamps(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*time.Time, *time.Time, error) + - + var dbTx pgx.Tx
    - 149 + + 73 +
    -   - GetL1InfoRootLeafByL1InfoRoot(ctx context.Context, l1InfoRoot common.Hash, dbTx pgx.Tx) (L1InfoTreeExitRootStorageEntry, error) + - + var err error
    - 150 + + 74 +
    -   - GetL1InfoRootLeafByIndex(ctx context.Context, l1InfoTreeIndex uint32, dbTx pgx.Tx) (L1InfoTreeExitRootStorageEntry, error) + - + if dbTxExt == nil {
    - 151 + + 75 +
    - + - GetLeavesByL1InfoRoot(ctx context.Context, l1InfoRoot common.Hash, dbTx pgx.Tx) ([]L1InfoTreeExitRootStorageEntry, error) + - + log.Debugf("Starting dbTx for BlockNumber:%d", blocks[i].BlockNumber)
    - 152 + + 76 +
    -   - GetBlockByNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*Block, error) + - + dbTx, err = s.state.BeginStateTransaction(ctx)
    - 153 + + 77 +
    -   - GetVirtualBatchParentHash(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (common.Hash, error) + - + if err != nil {
    - 154 + + 78 +
    -   - GetForcedBatchParentHash(ctx context.Context, forcedBatchNumber uint64, dbTx pgx.Tx) (common.Hash, error) + - + return err
    - 155 + + 79 +
    - + - GetBatchL2DataByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) ([]byte, error) + - + }
    - 156 + + 80 +
    - + - GetBatchL2DataByNumbers(ctx context.Context, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error) + - + } else {
    - 157 + + 81 +
    -   - GetLatestBatchGlobalExitRoot(ctx context.Context, dbTx pgx.Tx) (common.Hash, error) + - + dbTx = *dbTxExt
    - 158 + + 82 +
    -   - GetL2TxHashByTxHash(ctx context.Context, hash common.Hash, dbTx pgx.Tx) (*common.Hash, error) + - + }
    - 159 + + 83 +
    -   - GetSyncInfoData(ctx context.Context, dbTx pgx.Tx) (SyncInfoDataOnStorage, error) -
    -
    -
    + - + // Process event received from l1
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/state/l1infotree.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    @@ -3,7 +3,6 @@
    - 3 + + 84 +
    -   - import ( + - + err = s.processBlock(ctx, blocks, i, dbTx, order, storeBlocks, finalizedBlockNumber)
    - 4 + + 85 +
    -   - "context" + - + if err != nil {
    - 5 + + 86 +
    -   - "errors" + - + if dbTxExt == nil {
    - 6 + 87
    - - "fmt" + // Rollback db transaction
    - 7 + + 88 +
    -   -
    + - + rollbackErr := dbTx.Rollback(ctx)
    - 8 + + 89 +
    -   - "github.com/0xPolygonHermez/zkevm-node/l1infotree" + - + if rollbackErr != nil {
    - 9 + + 90 +
    -   - "github.com/0xPolygonHermez/zkevm-node/log" + - + if !errors.Is(rollbackErr, pgx.ErrTxClosed) {
    -
    @@ -34,20 +33,20 @@
    +
    + 91 + +
    + - + log.Errorf("error rolling back state. RollbackErr: %s, Error : %v", rollbackErr.Error(), err) +
    - 34 + + 92 +
    -   - if s.l1InfoTree != nil { + - + return rollbackErr
    - 35 + + 93 +
    -   - return nil + - + } else {
    - 36 + + 94 +
    -   - } + - + log.Warnf("error rolling back state because is already closed. RollbackErr: %s, Error : %v", rollbackErr.Error(), err)
    - 37 + + 95 +
    - - log.Debugf("Building L1InfoTree cache") + return err
    - 38 + + 96 +
    - - allLeaves, err := s.storage.GetAllL1InfoRootEntries(ctx, dbTx) + }
    - 39 + + 97 +
    -   - if err != nil { + - + }
    - 40 + + 98 +
    - - log.Error("error getting all leaves. Error: ", err) + return err
    - 41 + + 99 +
    - - return fmt.Errorf("error getting all leaves. Error: %w", err) + }
    - 42 + + 100 +
    -   - } + - + return err
    - 43 + + 101 +
    -   - var leaves [][32]byte + - + }
    - 44 + + 102 +
    -   - for _, leaf := range allLeaves { + - + if dbTxExt == nil {
    - 45 + + 103 +
    -   - leaves = append(leaves, leaf.Hash()) + - + // Commit db transaction
    - 46 + + 104 +
    -   - } + - + err = dbTx.Commit(ctx)
    - 47 + + 105 +
    - - mt, err := l1infotree.NewL1InfoTree(uint8(32), leaves) //nolint:gomnd + if err != nil {
    - 48 + + 106 +
    -   - if err != nil { + - + log.Errorf("error committing state. BlockNumber: %d, Error: %v", blocks[i].BlockNumber, err)
    - 49 + + 107 +
    - - log.Error("error creating L1InfoTree. Error: ", err) + }
    - 50 + + 108 +
    - - return fmt.Errorf("error creating L1InfoTree. Error: %w", err) + }
    - 51 + + 109 +
    -   + - }
    - 52 + + 110 +
    -   - s.l1InfoTree = mt + - + return nil
    - 53 + + 111 +
    -   - return nil + - + }
    -
    + + + 112 + + +
    + - +
    -
    -
    - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    - 3 + + 113 +
    -   - import ( + - + func (s *BlockRangeProcess) processBlock(ctx context.Context, blocks []etherman.Block, i int, dbTx pgx.Tx, order map[common.Hash][]etherman.Order, storeBlock syncinterfaces.ProcessBlockRangeL1BlocksMode, finalizedBlockNumber uint64) error {
    - 4 + + 114 +
    -   - "context" + - + var err error
    - 5 + + 115 +
    -   - "errors" + - + if storeBlock == syncinterfaces.StoreL1Blocks {
    - + + 116 -
    -   -
    +
    +
    + - + b := state.Block{
    - 6 + + 117 +
    -   -
    + - + BlockNumber: blocks[i].BlockNumber,
    - 7 + + 118 +
    -   - "github.com/0xPolygonHermez/zkevm-node/l1infotree" + - + BlockHash: blocks[i].BlockHash,
    - 8 + + 119 +
    -   - "github.com/0xPolygonHermez/zkevm-node/log" + - + ParentHash: blocks[i].ParentHash,
    -
     
    +
    + 120 + +
    + - + ReceivedAt: blocks[i].ReceivedAt, +
    - 33 + + 121 +
    -   - if s.l1InfoTree != nil { + - + }
    - 34 + + 122 +
    -   - return nil + - + if blocks[i].BlockNumber <= finalizedBlockNumber {
    - 35 + + 123 +
    -   - } + - + b.Checked = true
    - 36 + + 124 +
    - + - // Reset L1InfoTree siblings and leaves + - + }
    - 37 + + 125 +
    - + - allLeaves, err := s.GetAllL1InfoRootEntries(ctx, dbTx) + - + err = s.state.AddBlock(ctx, &b, dbTx)
    - 38 + + 126 +
    -   - if err != nil { + - + if err != nil {
    - 39 + + 127 +
    - + - log.Error("error getting all leaves to reset l1InfoTree. Error: ", err) + - + log.Errorf("error adding block to db. BlockNumber: %d, error: %v", blocks[i].BlockNumber, err)
    - 40 + + 128 +
    - + - return err + - + return err
    - 41 + + 129 +
    -   - } + - + }
    - 42 + + 130 +
    -   - var leaves [][32]byte + - + } else {
    - 43 + + 131 +
    -   - for _, leaf := range allLeaves { + - + log.Debugf("Skip storing block BlockNumber:%d", blocks[i].BlockNumber)
    - 44 + + 132 +
    -   - leaves = append(leaves, leaf.Hash()) + - + }
    - 45 + + 133 +
    -   - } + - + for _, element := range order[blocks[i].BlockHash] {
    - 46 + + 134 +
    - + - mt, err := s.l1InfoTree.ResetL1InfoTree(leaves) + - + err := s.processElement(ctx, element, blocks, i, dbTx)
    - 47 + + 135 +
    -   - if err != nil { + - + if err != nil {
    - 48 + + 136 +
    - + - log.Error("error resetting l1InfoTree. Error: ", err) + - + return err
    - 49 + + 137 +
    - + - return err + - + }
    - 50 + + 138 +
    -   + - }
    - 51 + + 139 +
    -   - s.l1InfoTree = mt + - + log.Debug("Checking FlushID to commit L1 data to db")
    - 52 + + 140 +
    -   - return nil + - + err = s.flushIdManager.CheckFlushID(dbTx)
    -
    + + + 141 + + +
    + - + if err != nil {
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/block.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +
    -
    @@ -16,10 +16,10 @@
    - 16 + + 142 +
    -   -
    + - + log.Errorf("error checking flushID. BlockNumber: %d, Error: %v", blocks[i].BlockNumber, err)
    - 17 + + 143 +
    -   - // AddBlock adds a new block to the State Store + - + return err
    - 18 + + 144 +
    -   - func (p *PostgresStorage) AddBlock(ctx context.Context, block *state.Block, dbTx pgx.Tx) error { + - + }
    - 19 + + 145 +
    - - const addBlockSQL = "INSERT INTO state.block (block_num, block_hash, parent_hash, received_at) VALUES ($1, $2, $3, $4)" + return nil
    - 20 + + 146 +
    -   + - + } +
    +
    + 147 + +
    + -
    - 21 + + 148 +
    -   - e := p.getExecQuerier(dbTx) + - + func (s *BlockRangeProcess) processElement(ctx context.Context, element etherman.Order, blocks []etherman.Block, i int, dbTx pgx.Tx) error {
    - 22 + + 149 +
    - - _, err := e.Exec(ctx, addBlockSQL, block.BlockNumber, block.BlockHash.String(), block.ParentHash.String(), block.ReceivedAt) + batchSequence := l1event_orders.GetSequenceFromL1EventOrder(element.Name, &blocks[i], element.Pos)
    - 23 + + 150 +
    -   - return err + - + var forkId uint64
    - 24 + + 151 +
    -   - } + - + if batchSequence != nil {
    - 25 + + 152 +
    -   -
    + - + forkId = s.state.GetForkIDByBatchNumber(batchSequence.FromBatchNumber)
    -
    @@ -30,11 +30,11 @@
    -
    - 30 + + 153 +
    -   - parentHash string + - + log.Debug("EventOrder: ", element.Name, ". Batch Sequence: ", batchSequence, "forkId: ", forkId)
    - 31 + + 154 +
    -   - block state.Block + - + } else {
    - 32 + + 155 +
    -   - ) + - + forkId = s.state.GetForkIDByBlockNumber(blocks[i].BlockNumber)
    - 33 + + 156 +
    - - const getLastBlockSQL = "SELECT block_num, block_hash, parent_hash, received_at FROM state.block ORDER BY block_num DESC LIMIT 1" + log.Debug("EventOrder: ", element.Name, ". BlockNumber: ", blocks[i].BlockNumber, "forkId: ", forkId)
    - 34 + + 157 +
    -   -
    + - + }
    - 35 + + 158 +
    -   - q := p.getExecQuerier(dbTx) + - + forkIdTyped := actions.ForkIdType(forkId)
    - 36 + + 159 +
    -   + -
    - 37 + + 160 +
    - - err := q.QueryRow(ctx, getLastBlockSQL).Scan(&block.BlockNumber, &blockHash, &parentHash, &block.ReceivedAt) + err := s.l1EventProcessors.Process(ctx, forkIdTyped, element, &blocks[i], dbTx)
    - 38 + + 161 +
    -   - if errors.Is(err, pgx.ErrNoRows) { + - + if err != nil {
    - 39 + + 162 +
    -   - return nil, state.ErrStateNotSynchronized + - + log.Error("error l1EventProcessors.Process: ", err)
    - 40 + + 163 +
    -   - } + - + return err
    -
    @@ -43,6 +43,26 @@
    -
    - 43 + + 164 +
    -   - return &block, err + - + }
    - 44 + + 165 +
    -   - } + - + return nil
    - 45 + + 166 +
    -   -
    + - + } +
    +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -98592,1340 +291420,984 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0


    - - -
    +
     
    @@ -98188,298 +291211,103 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 46 - -
    -   - // GetPreviousBlock gets the offset previous L1 block respect to latest. -
    -
    - 47 - -
    -   - func (p *PostgresStorage) GetPreviousBlock(ctx context.Context, offset uint64, dbTx pgx.Tx) (*state.Block, error) { -
    -
    - 48 - -
    -   - var ( -
    -
    -
    @@ -50,11 +70,11 @@
    -
    - 50 - -
    -   - parentHash string -
    -
    - 51 - -
    -   - block state.Block -
    -
    - 52 - -
    -   - ) -
    -
    - 53 - -
    - - - const getPreviousBlockSQL = "SELECT block_num, block_hash, parent_hash, received_at FROM state.block ORDER BY block_num DESC LIMIT 1 OFFSET $1" -
    -
    - 54 + + -
    +
    +
     
    - 55 - -
    -   - q := p.getExecQuerier(dbTx) -
    -
    - 56 + + -
    +
    +
     
    - 57 - -
    - - - err := q.QueryRow(ctx, getPreviousBlockSQL, offset).Scan(&block.BlockNumber, &blockHash, &parentHash, &block.ReceivedAt) -
    -
    - 58 - -
    -   - if errors.Is(err, pgx.ErrNoRows) { -
    -
    - 59 - -
    -   - return nil, state.ErrNotFound -
    -
    - 60 - -
    -   - } -
    -
    -
    @@ -70,11 +90,11 @@
    -
    - 70 - -
    -   - parentHash string -
    -
    - 71 - -
    -   - block state.Block -
    -
    - 72 - -
    -   - ) -
    -
    - 73 - -
    - - - const getBlockByNumberSQL = "SELECT block_num, block_hash, parent_hash, received_at FROM state.block WHERE block_num = $1" -
    -
    - 74 + + -
    +
    +
     
    - 75 - -
    -   - q := p.getExecQuerier(dbTx) -
    -
    - 76 + + -
    +
    +
     
    - 77 - -
    - - - err := q.QueryRow(ctx, getBlockByNumberSQL, blockNumber).Scan(&block.BlockNumber, &blockHash, &parentHash, &block.ReceivedAt) -
    -
    - 78 + + -
    +
    +
      - if errors.Is(err, pgx.ErrNoRows) { +
    - 79 + + -
    +
    +
      - return nil, state.ErrNotFound +
    - 80 + + -
    +
    +
      - } +
    -
    @@ -82,3 +102,14 @@
    -
    - 82 + + -
    +
    +
      - block.ParentHash = common.HexToHash(parentHash) +
    - 83 + + -
    +
    +
      - return &block, err +
    - 84 + + -
    +
    +
      - } +
    -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    -
    - 16 + + -
    +
    +
     
    - 17 + + -
    +
    +
      - // AddBlock adds a new block to the State Store +
    - 18 + + -
    +
    +
      - func (p *PostgresStorage) AddBlock(ctx context.Context, block *state.Block, dbTx pgx.Tx) error { -
    -
    - 19 - -
    - + - const addBlockSQL = "INSERT INTO state.block (block_num, block_hash, parent_hash, received_at, checked) VALUES ($1, $2, $3, $4, $5)" +
    - 20 + + -
    +
    +
     
    - 21 + + -
    +
    +
      - e := p.getExecQuerier(dbTx) -
    -
    - 22 - -
    - + - _, err := e.Exec(ctx, addBlockSQL, block.BlockNumber, block.BlockHash.String(), block.ParentHash.String(), block.ReceivedAt, block.Checked) +
    - 23 + + -
    +
    +
      - return err +
    - 24 + + -
    +
    +
      - } +
    - 25 + + -
    +
    +
     
    -
     
    -
    - 30 + + -
    +
    +
      - parentHash string +
    - 31 + + -
    +
    +
      - block state.Block +
    - 32 + + -
    +
    +
      - ) -
    -
    - 33 - -
    - + - const getLastBlockSQL = "SELECT block_num, block_hash, parent_hash, received_at, checked FROM state.block ORDER BY block_num DESC LIMIT 1" +
    - 34 + + -
    +
    +
     
    - 35 + + -
    +
    +
      - q := p.getExecQuerier(dbTx) +
    - 36 + + -
    +
    +
     
    - 37 - -
    - + - err := q.QueryRow(ctx, getLastBlockSQL).Scan(&block.BlockNumber, &blockHash, &parentHash, &block.ReceivedAt, &block.Checked) -
    -
    - 38 + + -
    +
    +
      - if errors.Is(err, pgx.ErrNoRows) { +
    - 39 + + -
    +
    +
      - return nil, state.ErrStateNotSynchronized +
    - 40 + + -
    +
    +
      - } +
    -
     
    -
    - 43 + + -
    +
    +
      - return &block, err +
    - 44 + + -
    +
    +
      - } +
    - 45 + + -
    +
    +
     
    - 46 - -
    - + - // GetFirstUncheckedBlock returns the first L1 block that has not been checked from a given block number. -
    -
    - 47 - -
    - + - func (p *PostgresStorage) GetFirstUncheckedBlock(ctx context.Context, fromBlockNumber uint64, dbTx pgx.Tx) (*state.Block, error) { -
    -
    - 48 - -
    - + - var ( -
    -
    - 49 - -
    - + - blockHash string -
    -
    - 50 - -
    - + - parentHash string -
    -
    - 51 - -
    - + - block state.Block -
    -
    - 52 - -
    - + - ) -
    -
    - 53 - -
    - + - const getLastBlockSQL = "SELECT block_num, block_hash, parent_hash, received_at, checked FROM state.block WHERE block_num>=$1 AND checked=false ORDER BY block_num LIMIT 1" -
    -
    - 54 + + -
    - + +
    +
    +  
    - 55 - -
    - + - q := p.getExecQuerier(dbTx) -
    -
    - 56 + + -
    - + +
    +
    +  
    - 57 - -
    - + - err := q.QueryRow(ctx, getLastBlockSQL, fromBlockNumber).Scan(&block.BlockNumber, &blockHash, &parentHash, &block.ReceivedAt, &block.Checked) -
    -
    - 58 - -
    - + - if errors.Is(err, pgx.ErrNoRows) { -
    -
    - 59 - -
    - + - return nil, state.ErrNotFound -
    -
    - 60 - -
    - + - } -
    -
    - 61 - -
    - + - block.BlockHash = common.HexToHash(blockHash) -
    -
    - 62 - -
    - + - block.ParentHash = common.HexToHash(parentHash) -
    -
    - 63 - -
    - + - return &block, err -
    -
    - 64 - -
    - + - } -
    -
    - 65 + + -
    - + +
    +
    +  
    - 66 + + -
    +
    +
      - // GetPreviousBlock gets the offset previous L1 block respect to latest. +
    - 67 + + -
    +
    +
      - func (p *PostgresStorage) GetPreviousBlock(ctx context.Context, offset uint64, dbTx pgx.Tx) (*state.Block, error) { +
    - 68 + + -
    +
    +
      - var ( +
    -
     
    -
    - 70 + + -
    +
    +
      - parentHash string +
    - 71 + + -
    +
    +
      - block state.Block +
    - 72 + + -
    +
    +
      - ) -
    -
    - 73 - -
    - + - const getPreviousBlockSQL = "SELECT block_num, block_hash, parent_hash, received_at,checked FROM state.block ORDER BY block_num DESC LIMIT 1 OFFSET $1" +
    - 74 + + -
    +
    +
     
    - 75 + + -
    +
    +
      - q := p.getExecQuerier(dbTx) +
    - 76 + + -
    +
    +
     
    - 77 - -
    - + - err := q.QueryRow(ctx, getPreviousBlockSQL, offset).Scan(&block.BlockNumber, &blockHash, &parentHash, &block.ReceivedAt, &block.Checked) -
    -
    - 78 + + -
    +
    +
      - if errors.Is(err, pgx.ErrNoRows) { +
    - 79 + + -
    +
    +
      - return nil, state.ErrNotFound +
    - 80 + + -
    +
    +
      - } +
    -
     
    -
    - 90 + + -
    +
    +
      - parentHash string +
    - 91 + + -
    +
    +
      - block state.Block +
    - 92 + + -
    +
    +
      - ) +
    - 93 + + -
    - + - const getBlockByNumberSQL = "SELECT block_num, block_hash, parent_hash, received_at,checked FROM state.block WHERE block_num = $1" +
    +
    +   +
    - 94 + + -
    +
    +
     
    - 95 + + -
    +
    +
      - q := p.getExecQuerier(dbTx) +
    - 96 + + -
    +
    +
     
    - 97 + + -
    - + - err := q.QueryRow(ctx, getBlockByNumberSQL, blockNumber).Scan(&block.BlockNumber, &blockHash, &parentHash, &block.ReceivedAt, &block.Checked) +
    +
    +   +
    - 98 + + -
    +
    +
      - if errors.Is(err, pgx.ErrNoRows) { +
    - 99 + + -
    +
    +
      - return nil, state.ErrNotFound +
    - 100 + + -
    +
    +
      - } +
    -
     
    -
    - 102 + + -
    +
    +
      - block.ParentHash = common.HexToHash(parentHash) +
    - 103 + + -
    +
    +
      - return &block, err +
    - 104 + + -
    +
    +
      - } +
    - 105 + + -
    - + +
    +
    +  
    - 106 + + -
    - + - // UpdateCheckedBlockByNumber update checked flag for a block +
    +
    +   +
    - 107 + + -
    - + - func (p *PostgresStorage) UpdateCheckedBlockByNumber(ctx context.Context, blockNumber uint64, newCheckedStatus bool, dbTx pgx.Tx) error { +
    +
    +   +
    - 108 + + -
    - + - const query = ` +
    +
    +   +
    - 109 + + -
    - + - UPDATE state.block +
    +
    +   +
    - 110 + + -
    - + - SET checked = $1 WHERE block_num = $2` +
    +
    +   +
    - 111 + + -
    - + +
    +
    +  
    - 112 + + -
    - + - e := p.getExecQuerier(dbTx) +
    +
    +   +
    - 113 + + -
    - + - _, err := e.Exec(ctx, query, newCheckedStatus, blockNumber) +
    +
    +   +
    - 114 + + -
    - + - return err +
    +
    +   +
    - 115 - -
    - + - } -
    +
    +
    -
    + +
    +   +
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/l1infotree.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -
    @@ -112,7 +112,7 @@
    - 112 + + -
    +
    +
      - return entry, nil +
    - 113 + + -
    +
    +
      - } +
    - 114 + + -
    +
    +
     
    - 115 + + -
    - - - func (p *PostgresStorage) GetLeafsByL1InfoRoot(ctx context.Context, l1InfoRoot common.Hash, dbTx pgx.Tx) ([]state.L1InfoTreeExitRootStorageEntry, error) { +
    +
    +   +
    - 116 + + -
    +
    +
      - // TODO: Optimize this query +
    - 117 + + -
    +
    +
      - const getLeafsByL1InfoRootSQL = `SELECT block_num, timestamp, mainnet_exit_root, rollup_exit_root, global_exit_root, prev_block_hash, l1_info_root, l1_info_tree_index +
    - 118 + + -
    +
    +
      - FROM state.exit_root -
    -
    -
    +
    -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -
     
    - 112 + + -
    +
    +
      - return entry, nil +
    - 113 + + -
    +
    +
      - } +
    - 114 + + -
    +
    +
     
    - 115 + + -
    - + - func (p *PostgresStorage) GetLeavesByL1InfoRoot(ctx context.Context, l1InfoRoot common.Hash, dbTx pgx.Tx) ([]state.L1InfoTreeExitRootStorageEntry, error) { +
    +
    +   +
    - 116 + + -
    +
    +
      - // TODO: Optimize this query +
    - 117 + + -
    +
    +
      - const getLeafsByL1InfoRootSQL = `SELECT block_num, timestamp, mainnet_exit_root, rollup_exit_root, global_exit_root, prev_block_hash, l1_info_root, l1_info_tree_index +
    - 118 + + -
    +
    +
      - FROM state.exit_root -
    -
    -
    +
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/pgstatestorage.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -100198,2177 +292670,2562 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0


    + + +
    -
    @@ -119,7 +119,7 @@
    - 119 + + -
    +
    +
      - return common.HexToHash(stateRootStr), nil +
    - 120 + + -
    +
    +
      - } +
    - 121 + + -
    +
    +
     
    - 122 + + -
    - - - // GetLogsByBlockNumber get all the logs from a specific block ordered by log index +
    +
    +   +
    - 123 + + -
    +
    +
      - func (p *PostgresStorage) GetLogsByBlockNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) ([]*types.Log, error) { +
    - 124 + + -
    +
    +
      - const query = ` +
    - 125 + + -
    +
    +
      - SELECT t.l2_block_num, b.block_hash, l.tx_hash, r.tx_index, l.log_index, l.address, l.data, l.topic0, l.topic1, l.topic2, l.topic3 +
    -
    @@ -128,7 +128,7 @@
    -
    - 128 + + -
    +
    +
      - INNER JOIN state.l2block b ON b.block_num = t.l2_block_num +
    - 129 + + -
    +
    +
      - INNER JOIN state.receipt r ON r.tx_hash = t.hash +
    - 130 + + -
    +
    +
      - WHERE b.block_num = $1 +
    - 131 + + -
    - - - ORDER BY l.log_index ASC` +
    +
    +   +
    - 132 + + -
    +
    +
     
    - 133 + + -
    +
    +
      - q := p.getExecQuerier(dbTx) +
    - 134 + + -
    +
    +
      - rows, err := q.Query(ctx, query, blockNumber) +
    -
    @@ -159,7 +159,7 @@
    -
    - 159 + + -
    +
    +
      - const queryFilterByBlockHash = `AND b.block_hash = $7 ` +
    - 160 + + -
    +
    +
      - const queryFilterByBlockNumbers = `AND b.block_num BETWEEN $7 AND $8 ` +
    - 161 + + -
    +
    +
     
    - 162 + + -
    - - - const queryOrder = `ORDER BY b.block_num ASC, l.log_index ASC` +
    +
    +   +
    - 163 + + -
    +
    +
     
    - 164 + + -
    +
    +
      - // count queries +
    - 165 + + -
    +
    +
      - const queryToCountLogsByBlockHash = "" + +
    -
    @@ -355,3 +355,81 @@
    -
    - 355 + + -
    +
    +
      - } +
    - 356 + + -
    +
    +
      - return nativeBlockHashes, nil +
    - 357 + + -
    +
    +
      - } +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/synchronizer.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    +
    @@ -79,8 +79,6 @@
    +
    + 79 + +
    +   + syncTrustedStateExecutor syncinterfaces.SyncTrustedStateExecutor +
    +
    + 80 + +
    +   + halter syncinterfaces.CriticalErrorHandler +
    +
    + 81 + +
    +   + asyncL1BlockChecker syncinterfaces.L1BlockCheckerIntegrator +
    +
    + 82 + +
    + - + blockRangeProcessor syncinterfaces.BlockRangeProcessor +
    +
    + 83 + +
    + - + syncPreRollup syncinterfaces.SyncPreRollupSyncer +
    +
    + 84 + +
    +   + } +
    +
    + 85 + +
    +   +
    +
    +
    + 86 + +
    +   + // NewSynchronizer creates and initializes an instance of Synchronizer +
    +
    +
    @@ -168,9 +166,9 @@
    +
    + 168 + +
    +   +
    +
    +
    + 169 + +
    +   + syncTrustedStateEtrog := l2_shared.NewTrustedBatchesRetrieve(executor, zkEVMClient, res.state, *sync, *l2_shared.NewTrustedStateManager(syncCommon.DefaultTimeProvider{}, timeOfLiveBatchOnCache)) +
    +
    + 170 + +
    +   + res.syncTrustedStateExecutor = l2_shared.NewSyncTrustedStateExecutorSelector(map[uint64]syncinterfaces.SyncTrustedStateExecutor{ +
    +
    + 171 + +
    + - + uint64(state.FORKID_ETROG): syncTrustedStateEtrog, +
    +
    + 172 + +
    + - + uint64(state.FORKID_ELDERBERRY): syncTrustedStateEtrog, +
    +
    + 173 + +
    + - + uint64(state.FORKID_ELDERBERRY_2): syncTrustedStateEtrog, +
    +
    + 174 + +
    +   + }, res.state) +
    +
    + 175 + +
    +   + } +
    +
    + 176 + +
    +   + var l1checkerL2Blocks *actions.CheckL2BlockHash +
    +
    +
    @@ -185,7 +183,7 @@
    +
    + 185 + +
    +   + log.Errorf("error getting last L2Block number from state. Error: %v", err) +
    +
    + 186 + +
    +   + return nil, err +
    +
    + 187 + +
    +   + } +
    +
    + 188 + +
    + - + l1checkerL2Blocks, err = actions.NewCheckL2BlockHash(res.state, res.zkEVMClientEthereumCompatible, initialL2Block, cfg.L1SyncCheckL2BlockNumberModulus) +
    +
    + 189 + +
    +   + if err != nil { +
    +
    + 190 + +
    +   + log.Error("error creating new instance of checkL2BlockHash. Error: ", err) +
    +
    + 191 + +
    +   + return nil, err +
    +
    +
    @@ -196,8 +194,6 @@
    +
    + 196 + +
    +   + } +
    +
    + 197 + +
    +   +
    +
    +
    + 198 + +
    +   + res.l1EventProcessors = defaultsL1EventProcessors(res, l1checkerL2Blocks) +
    +
    + 199 + +
    + - + res.blockRangeProcessor = NewBlockRangeProcessLegacy(st, ethMan, res.l1EventProcessors, res) +
    +
    + 200 + +
    + - + res.syncPreRollup = NewSyncPreRollup(ethMan, st, res.blockRangeProcessor, cfg.SyncChunkSize, genesis.BlockNumber) +
    +
    + 201 + +
    +   + switch cfg.L1SynchronizationMode { +
    +
    + 202 + +
    +   + case ParallelMode: +
    +
    - + + 203 -
    +
    +
      -
    + log.Info("L1SynchronizationMode is parallel")
    - + +
    @@ -232,7 +228,7 @@
    -
    +
    + 232 + +
      -
    + ApplyAfterNumRollupReceived: cfg.L1ParallelSynchronization.PerformanceWarning.ApplyAfterNumRollupReceived,
    - + + 233 -
    +
    +
      -
    + AceptableInacctivityTime: cfg.L1ParallelSynchronization.PerformanceWarning.AceptableInacctivityTime.Duration,
    - + + 234 -
    +
    +
      -
    + }
    - + + 235 -
    -   -
    +
    +
    + - + L1DataProcessor := l1_parallel_sync.NewL1RollupInfoConsumer(cfgConsumer, sync.blockRangeProcessor, chIncommingRollupInfo)
    - + + 236 -
    +
    +
     
    - + + 237 -
    +
    +
      -
    + cfgProducer := l1_parallel_sync.ConfigProducer{
    - + + 238 -
    +
    +
      -
    + SyncChunkSize: cfg.SyncChunkSize,
    - + +
    @@ -279,91 +275,8 @@
    -
    +
    + 279 + +
      -
    + return err
    - + + 280 -
    +
    +
      -
    + }
    - + + 281 -
    +
    +
     
    - + + 282 -
    -   -
    +
    +
    + - + func (s *ClientSynchronizer) isGenesisProcessed(ctx context.Context, dbTx pgx.Tx) (bool, *state.Block, error) {
    - + + 283 -
    -   -
    +
    +
    + - + lastEthBlockSynced, err := s.state.GetLastBlock(ctx, dbTx)
    - + + 284 -
    -   -
    +
    +
    + - + if err != nil && errors.Is(err, state.ErrStateNotSynchronized) {
    - + + 285 -
    -   -
    +
    +
    + - + return false, lastEthBlockSynced, nil
    - + + 286 -
    -   -
    +
    +
    + - + }
    - + + 287 -
    -   +
    +
    + -
    - + + 288 -
    -   -
    +
    +
    + - + if lastEthBlockSynced.BlockNumber >= s.genesis.BlockNumber {
    - + + 289 -
    -   -
    +
    +
    + - + log.Infof("Genesis block processed. Last block synced: %d >= genesis %d", lastEthBlockSynced.BlockNumber, s.genesis.BlockNumber)
    - + + 290 -
    -   -
    +
    +
    + - + return true, lastEthBlockSynced, nil
    - + + 291 -
    -   -
    +
    +
    + - + }
    - + + 292 -
    -   -
    +
    +
    + - + log.Warnf("Genesis block not processed yet. Last block synced: %d < genesis %d", lastEthBlockSynced.BlockNumber, s.genesis.BlockNumber)
    - + + 293 -
    -   -
    +
    +
    + - + return false, lastEthBlockSynced, nil
    - + + 294 -
    -   -
    +
    +
    + - + }
    - + + 295 -
    -   +
    +
    + -
    - + + 296 -
    -   -
    +
    +
    + - + func (s *ClientSynchronizer) processGenesis() (*state.Block, error) {
    - + + 297 -
    -   -
    +
    +
    + - + log.Info("State is empty, verifying genesis block")
    - + + 298 -
    -   -
    +
    +
    + - + valid, err := s.etherMan.VerifyGenBlockNumber(s.ctx, s.genesis.BlockNumber)
    - + + 299 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 300 -
    -   -
    +
    +
    + - + log.Error("error checking genesis block number. Error: ", err)
    - + + 301 -
    -   -
    +
    +
    + - + return nil, err
    - + + 302 -
    -   -
    +
    +
    + - + } else if !valid {
    - + + 303 -
    -   -
    +
    +
    + - + log.Error("genesis Block number configured is not valid. It is required the block number where the PolygonZkEVM smc was deployed")
    - + + 304 -
    -   -
    +
    +
    + - + return nil, fmt.Errorf("genesis Block number configured is not valid. It is required the block number where the PolygonZkEVM smc was deployed")
    - + + 305 -
    -   -
    +
    +
    + - + }
    - + + 306 -
    -   -
    +
    +
    + - + // Sync pre genesis rollup events
    - + + 307 -
    -   -
    +
    +
    + - + s.syncPreRollup.(*SyncPreRollup).GenesisBlockNumber = s.genesis.BlockNumber
    - + + 308 -
    -   -
    +
    +
    + - + err = s.syncPreRollup.SynchronizePreGenesisRollupEvents(s.ctx)
    - + + 309 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 310 -
    -   -
    +
    +
    + - + log.Error("error synchronizing pre genesis rollup events: ", err)
    - + + 311 -
    -   -
    +
    +
    + - + return nil, err
    - + + 312 -
    -   -
    +
    +
    + - + }
    - + + 313 -
    -   -
    +
    +
    + - + log.Info("Setting genesis block")
    - + + 314 -
    -   -
    +
    +
    + - + header, err := s.etherMan.HeaderByNumber(s.ctx, big.NewInt(0).SetUint64(s.genesis.BlockNumber))
    - + + 315 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 316 -
    -   -
    +
    +
    + - + log.Errorf("error getting l1 block header for block %d. Error: %v", s.genesis.BlockNumber, err)
    - + + 317 -
    -   -
    +
    +
    + - + return nil, err
    - + + 318 -
    -   -
    +
    +
    + - + }
    - + + 319 -
    -   -
    +
    +
    + - + lastEthBlockSynced := &state.Block{
    - + + 320 -
    -   -
    +
    +
    + - + BlockNumber: header.Number.Uint64(),
    - + + 321 -
    -   -
    +
    +
    + - + BlockHash: header.Hash(),
    -
    + + + 322 + + +
    + - + ParentHash: header.ParentHash,
    -
    -
    - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    - 119 + + 323 +
    -   - return common.HexToHash(stateRootStr), nil + - + ReceivedAt: time.Unix(int64(header.Time), 0),
    - 120 + + 324 +
    -   - } + - + }
    - 121 + + 325 +
    -   -
    + - + dbTx, err := s.state.BeginStateTransaction(s.ctx)
    - 122 + + 326 +
    - + - // GetLogsByBlockNumber get all the logs from a specific block ordered by tx index and log index + - + if err != nil {
    - 123 + + 327 +
    -   - func (p *PostgresStorage) GetLogsByBlockNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) ([]*types.Log, error) { + - + log.Errorf("error creating db transaction to get latest block. Error: %v", err)
    - 124 + + 328 +
    -   - const query = ` + - + return nil, err
    - 125 + + 329 +
    -   - SELECT t.l2_block_num, b.block_hash, l.tx_hash, r.tx_index, l.log_index, l.address, l.data, l.topic0, l.topic1, l.topic2, l.topic3 + - + }
    -
     
    +
    + 330 + +
    + - + genesisRoot, err := s.state.SetGenesis(s.ctx, *lastEthBlockSynced, s.genesis, stateMetrics.SynchronizerCallerLabel, dbTx) +
    - 128 + + 331 +
    -   - INNER JOIN state.l2block b ON b.block_num = t.l2_block_num + - + if err != nil {
    - 129 + + 332 +
    -   - INNER JOIN state.receipt r ON r.tx_hash = t.hash + - + log.Error("error setting genesis: ", err)
    - 130 + + 333 +
    -   - WHERE b.block_num = $1 + - + return nil, rollback(s.ctx, dbTx, err)
    - 131 + + 334 +
    - + - ORDER BY r.tx_index ASC, l.log_index ASC` + - + }
    - 132 + + 335 +
    -   -
    + - + err = s.RequestAndProcessRollupGenesisBlock(dbTx, lastEthBlockSynced)
    - 133 + + 336 +
    -   - q := p.getExecQuerier(dbTx) + - + if err != nil {
    - 134 + + 337 +
    -   - rows, err := q.Query(ctx, query, blockNumber) + - + log.Error("error processing Rollup genesis block: ", err)
    -
     
    +
    + 338 + +
    + - + return nil, rollback(s.ctx, dbTx, err) +
    - 159 + + 339 +
    -   - const queryFilterByBlockHash = `AND b.block_hash = $7 ` + - + }
    - 160 + + 340 +
    -   - const queryFilterByBlockNumbers = `AND b.block_num BETWEEN $7 AND $8 ` + - +
    - 161 + + 341 +
    -   -
    + - + if genesisRoot != s.genesis.Root {
    - 162 + + 342 +
    - + - const queryOrder = `ORDER BY b.block_num ASC, r.tx_index ASC, l.log_index ASC` + - + log.Errorf("Calculated newRoot should be %s instead of %s", s.genesis.Root.String(), genesisRoot.String())
    - 163 + + 343 +
    -   -
    + - + return nil, rollback(s.ctx, dbTx, err)
    - 164 + + 344 +
    -   - // count queries + - + }
    - 165 + + 345 +
    -   - const queryToCountLogsByBlockHash = "" + + - + // Waiting for the flushID to be stored
    -
     
    +
    + 346 + +
    + - + err = s.checkFlushID(dbTx) +
    - 355 + + 347 +
    -   - } + - + if err != nil {
    - 356 + + 348 +
    -   - return nativeBlockHashes, nil + - + log.Error("error checking genesis flushID: ", err)
    - 357 + + 349 +
    -   - } + - + return nil, rollback(s.ctx, dbTx, err)
    - 358 + + 350 +
    - + -
    + - + }
    - 359 + + 351 +
    - + - // GetBatchL2DataByNumber returns the batch L2 data of the given batch number. + - + if err := dbTx.Commit(s.ctx); err != nil {
    - 360 + + 352 +
    - + - func (p *PostgresStorage) GetBatchL2DataByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) ([]byte, error) { + - + log.Errorf("error genesis committing dbTx, err: %v", err)
    - 361 + + 353 +
    - + - batchData, err := p.GetBatchL2DataByNumbers(ctx, []uint64{batchNumber}, dbTx) + - + return nil, rollback(s.ctx, dbTx, err)
    - 362 + + 354 +
    - + - if err != nil { + - + }
    - 363 + + 355 +
    - + - return nil, err + - + log.Info("Genesis root matches! Stored genesis blocks.")
    - 364 + + 356 +
    - + - } + - + return lastEthBlockSynced, nil
    - 365 + + 357 +
    - + - data, ok := batchData[batchNumber] + - + }
    - 366 + + 358 +
    - + - if !ok { + - +
    - 367 + + 359 +
    - + - return nil, state.ErrNotFound +   + // Sync function will read the last state synced and will continue from that point.
    - 368 + + 360 +
    - + - } +   + // Sync() will read blockchain events to detect rollup updates
    - 369 + + 361 +
    - + - return data, nil + - + // 1. Check if genesisProcess is done
    - 370 + + 362 +
    - + - } + - + // 2. If not, process genesis
    - 371 + + 363 +
    - + -
    + - + // 2.1 -There are blocks previous to the genesis block? -> go on with process of InfoRootTree
    - 372 + + 364 +
    - + - // GetBatchL2DataByNumbers returns the batch L2 data of the given batch numbers. The data is a union of state.batch and state.forced_batch tables. + - + // 2.2 -There are no blocks previous to the genesis block? -> get ETROG Upgrade block and start there to process of InfoRootTree
    - 373 + + 365 +
    - + - func (p *PostgresStorage) GetBatchL2DataByNumbers(ctx context.Context, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error) { + - + // 3. Setup genesis data
    - 374 + + 366 +
    - + - const getBatchL2DataByBatchNumber = ` + - + // 4. Start sync as usual
    - 375 + + 367 +
    - + - SELECT batch_num, raw_txs_data FROM state.batch WHERE batch_num = ANY($1) +   + func (s *ClientSynchronizer) Sync() error {
    - 376 + + 368 +
    - + - UNION +   + startInitialization := time.Now()
    - 377 + + 369 +
    - + - SELECT forced_batch_num, convert_from(decode(raw_txs_data, 'hex'), 'UTF8')::bytea FROM state.forced_batch WHERE forced_batch_num = ANY($2) +   + // If there is no lastEthereumBlock means that sync from the beginning is necessary. If not, it continues from the retrieved ethereum block
    + +
    @@ -378,19 +291,92 @@
    +
    378 +
    - + - ` +   + log.Errorf("error creating db transaction to get latest block. Error: %v", err)
    + 379 +
    - + - q := p.getExecQuerier(dbTx) +   + return err
    + 380 +
    - + - rows, err := q.Query(ctx, getBatchL2DataByBatchNumber, batchNumbers, batchNumbers) +   + }
    + 381 +
    - + - if errors.Is(err, pgx.ErrNoRows) { + - + genesisDone, lastEthBlockSynced, err := s.isGenesisProcessed(s.ctx, dbTx)
    + 382 +
    - + - return p.GetBatchL2DataByNumbersFromBackup(ctx, batchNumbers, dbTx) +   + if err != nil {
    + 383 +
    - + - } else if err != nil { + - + log.Errorf("error checking if genesis is processed. Error: %v", err)
    + 384 +
    - + - return nil, err + - + return err
    + 385 +
    - + - } + - + }
    + 386 +
    - + - defer rows.Close() + - + if !genesisDone {
    + 387 +
    - + -
    + - + lastEthBlockSynced, err = s.processGenesis()
    + 388 +
    - + - batchL2DataMap, err := readBatchDataResults(rows, batchNumbers) + - + if err != nil {
    + 389 +
    - + - if err != nil { + - + log.Errorf("error processing genesis. Error: %v", err)
    - 390 + + -
    - + - return nil, err +
    +
    +   +
    - 391 + + -
    - + - } +
    +
    +   +
    - 392 + + -
    - + +
    +
    +  
    - 393 + + -
    - + - if len(batchL2DataMap) == 0 { +
    +
    +   +
    - 394 + + -
    - + - return p.GetBatchL2DataByNumbersFromBackup(ctx, batchNumbers, dbTx) +
    +
    +   +
    - 395 + + -
    - + - } +
    +
    +   +
    - 396 + + -
    - + +
    +
    +  
    - 397 + + -
    - + - return batchL2DataMap, nil +
    +
    +   +
    - 398 + + -
    - + - } +
    +
    +   +
    - 399 + + -
    - + +
    +
    +  
    - 400 + + -
    - + - // GetBatchL2DataByNumbersFromBackup returns the batch L2 data of the given batch number from the backup table +
    +
    +   +
    - 401 + + -
    - + - func (p *PostgresStorage) GetBatchL2DataByNumbersFromBackup(ctx context.Context, batchNumbers []uint64, dbTx pgx.Tx) (map[uint64][]byte, error) { +
    +
    +   +
    - 402 + + -
    - + - getBatchL2DataByBatchNumber := ` +
    +
    +   +
    - 403 + + -
    - + - SELECT batch_num, data FROM state.batch_data_backup +
    +
    +   +
    - 404 + + -
    - + - WHERE batch_num = ANY($1) +
    +
    +   +
    - 405 + + -
    - + - ORDER BY created_at DESC +
    +
    +   +
    - 406 + + -
    - + - ` +
    +
    +   +
    - 407 + + -
    - + - q := p.getExecQuerier(dbTx) +
    +
    +   +
    - 408 + + -
    - + - rows, err := q.Query(ctx, getBatchL2DataByBatchNumber, batchNumbers) +
    +
    +   +
    - 409 + + -
    - + - if errors.Is(err, pgx.ErrNoRows) { +
    +
    +   +
    - 410 + + -
    - + - return nil, state.ErrNotFound +
    +
    +   +
    - 411 + + -
    - + - } else if err != nil { +
    +
    +   +
    - 412 + + -
    - + - return nil, err +
    +
    +   +
    - 413 + + -
    - + - } +
    +
    +   +
    - 414 + + -
    - + - defer rows.Close() +
    +
    +   +
    - 415 + + -
    - + +
    +
    +  
    - 416 + + -
    - + - return readBatchDataResults(rows, batchNumbers) +
    +
    +   +
    - 417 + + -
    - + - } +
    +
    +   +
    - 418 + + -
    - + +
    +
    +  
    - 419 + + -
    - + - // readBatchDataResults retrieves batch data from the provided result set +
    +
    +   +
    - 420 + + -
    - + - func readBatchDataResults(results pgx.Rows, batchNumbers []uint64) (map[uint64][]byte, error) { +
    +
    +   +
    - 421 + + -
    - + - batchL2DataMap := make(map[uint64][]byte, len(batchNumbers)) +
    +
    +   +
    - 422 + + -
    - + - for results.Next() { +
    +
    +   +
    - 423 + + -
    - + - var ( +
    +
    +   +
    - 424 + + -
    - + - batchNum uint64 +
    +
    +   +
    - 425 + + -
    - + - batchL2Data []byte +
    +
    +   +
    - 426 + + -
    - + - ) +
    +
    +   +
    - 427 + + -
    - + +
    +
    +  
    - 428 + + -
    - + - if err := results.Scan(&batchNum, &batchL2Data); err != nil { +
    +
    +   +
    - 429 + + -
    - + - return nil, err +
    +
    +   +
    - 430 + + -
    - + - } +
    +
    +   +
    - 431 + + -
    - + - batchL2DataMap[batchNum] = batchL2Data +
    +
    +   +
    - 432 + + -
    - + - } +
    +
    +   +
    - 433 + + -
    - + +
    +
    +  
    - 434 + + -
    - + - return batchL2DataMap, nil +
    +
    +   +
    - 435 - -
    - + - } -
    +
    +
    -
    + +
    +   +
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/pgstatestorage_test.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - + + +
    -
    @@ -872,7 +872,7 @@
    - 872 + + -
    +
    +
      - ctx := context.Background() +
    - 873 + + -
    +
    +
     
    - 874 + + -
    +
    +
      - cfg := state.Config{ +
    - 875 + + -
    - - - MaxLogsCount: 8, +
    +
    +   +
    - 876 + + -
    +
    +
      - MaxLogsBlockRange: 10, +
    - 877 + + -
    +
    +
      - ForkIDIntervals: stateCfg.ForkIDIntervals, +
    - 878 + + -
    +
    +
      - } +
    -
    @@ -895,39 +895,69 @@
    +
    + + +
    +   +
    +
    - 895 + + -
    +
    +
      - time := time.Now() +
    - 896 + + -
    +
    +
      - blockNumber := big.NewInt(1) +
    - 897 + + -
    +
    +
     
    - 898 + + -
    - - - for i := 0; i < 3; i++ { +
    +
    +   +
    - 899 + + -
    - - - tx := types.NewTx(&types.LegacyTx{ +
    +
    +   +
    - 900 + + -
    - - - Nonce: uint64(i), +
    +
    +   +
    - 901 + + -
    - - - To: nil, +
    +
    +   +
    - 902 + + -
    - - - Value: new(big.Int), +
    +
    +   +
    - 903 + + -
    - - - Gas: 0, +
    +
    +   +
    - 904 + + -
    - - - GasPrice: big.NewInt(0), +
    +
    +   +
    - 905 + + -
    - - - }) +
    +
    +   +
    - 906 + + -
    - - +
    +
    +  
    - 907 + + -
    - - - logs := []*types.Log{} +
    +
    +   +
    - 908 + + -
    - - - for j := 0; j < 4; j++ { +
    +
    +   +
    - 909 + + -
    - - - logs = append(logs, &types.Log{TxHash: tx.Hash(), Index: uint(j)}) +
    +
    +   +
    - 910 + + -
    - - - } +
    +
    +   +
    - 911 + + -
    - - +
    +
    +  
    - 912 + + -
    - - - receipt := &types.Receipt{ +
    +
    +   +
    - 913 + + -
    - - - Type: tx.Type(), +
    +
    +   +
    - 914 + + -
    - - - PostState: state.ZeroHash.Bytes(), +
    +
    +   +
    - 915 + + 390 +
    - - - CumulativeGasUsed: 0, +   + return err
    - 916 + + 391 +
    - - - EffectiveGasPrice: big.NewInt(0), +   + }
    - 917 + + 392 +
    - - - BlockNumber: blockNumber, +   + }
    - 918 + + 393 +
    - - GasUsed: tx.Gas(), +
    - 919 + + 394 +
    - - - TxHash: tx.Hash(), +   + initBatchNumber, err := s.state.GetLastBatchNumber(s.ctx, dbTx)
    - 920 + + 395 +
    - - - TransactionIndex: 0, +   + if err != nil {
    - 921 + + 396 +
    - - - Status: types.ReceiptStatusSuccessful, +   + log.Error("error getting latest batchNumber synced. Error: ", err)
    - 922 + +
    @@ -622,7 +608,7 @@
    +
    + 622 +
    - - - Logs: logs, +   +
    - + + 623 -
    +
    +
      -
    + for {
    - + + 624 -
    +
    +
      -
    + if toBlock > lastKnownBlock.Uint64() {
    - + + 625 -
    -   -
    +
    +
    + - + log.Debug("Setting toBlock to the lastKnownBlock: ", lastKnownBlock)
    - + + 626 -
    +
    +
      -
    + toBlock = lastKnownBlock.Uint64()
    - + + 627 -
    +
    +
      -
    + }
    - + + 628 -
    +
    +
      -
    + if fromBlock > toBlock {
    - + +
    @@ -690,7 +676,7 @@
    -
    +
    + 690 + +
      -
    + }
    - + + 691 -
    +
    +
     
    - + + 692 -
    +
    +
      -
    + start = time.Now()
    - + + 693 -
    -   -
    +
    +
    + - + err = s.blockRangeProcessor.ProcessBlockRange(s.ctx, blocks, order)
    - + + 694 -
    +
    +
      -
    + metrics.ProcessL1DataTime(time.Since(start))
    - + + 695 -
    +
    +
      -
    + if err != nil {
    - + + 696 -
    +
    +
      -
    + return lastEthBlockSynced, err
    - + +
    @@ -1013,7 +999,7 @@
    -
    +
    + 1013 + +
      -
    + log.Infof("[checkReorg function] reorgedBlockNumber: %d reorgedBlockHash already synced: %s", reorgedBlock.BlockNumber, reorgedBlock.BlockHash.String())
    - + + 1014 -
    +
    +
     
    - + + 1015 -
    +
    +
      -
    + // Compare hashes
    - + + 1016 -
    -   -
    +
    +
    + - + if (block.BlockHash != reorgedBlock.BlockHash || block.ParentHash != reorgedBlock.ParentHash) && reorgedBlock.BlockNumber > s.genesis.BlockNumber {
    - + + 1017 -
    +
    +
      -
    + log.Infof("checkReorg: Bad block %d hashOk %t parentHashOk %t", reorgedBlock.BlockNumber, block.BlockHash == reorgedBlock.BlockHash, block.ParentHash == reorgedBlock.ParentHash)
    - + + 1018 -
    +
    +
      -
    + log.Debug("[checkReorg function] => latestBlockNumber: ", reorgedBlock.BlockNumber)
    - + + 1019 -
    +
    +
      -
    + log.Debug("[checkReorg function] => latestBlockHash: ", reorgedBlock.BlockHash) +
    +
    +
    +
    +
    + + + + + - - - - - - @@ -102392,238 +295249,238 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - + - + + - - - - - - - - - - - - - - + - - - - - - @@ -102648,177 +295505,152 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - + - - - - - - - - @@ -103581,6 +296413,26 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0


    + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -104012,1469 +297429,1522 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - + - - - - - - - - - - - - - - + + +
    +
     
    - + + 79 -
    +
    +
      -
    + syncTrustedStateExecutor syncinterfaces.SyncTrustedStateExecutor
    - + + 80 -
    +
    +
      -
    + halter syncinterfaces.CriticalErrorHandler
    - + + 81 -
    +
    +
      -
    + asyncL1BlockChecker syncinterfaces.L1BlockCheckerIntegrator
    - + + 82 -
    +
    +
      -
    + }
    - + + 83 -
    +
    +
     
    - + + 84 -
    +
    +
      -
    + // NewSynchronizer creates and initializes an instance of Synchronizer
    - + +
     
    -
    +
    + 166 + +
     
    - + + 167 -
    +
    +
      -
    + syncTrustedStateEtrog := l2_shared.NewTrustedBatchesRetrieve(executor, zkEVMClient, res.state, *sync, *l2_shared.NewTrustedStateManager(syncCommon.DefaultTimeProvider{}, timeOfLiveBatchOnCache))
    - + + 168 -
    +
    +
      -
    + res.syncTrustedStateExecutor = l2_shared.NewSyncTrustedStateExecutorSelector(map[uint64]syncinterfaces.SyncTrustedStateExecutor{
    - + + 169 -
    -   -
    +
    +
    + + + uint64(state.FORKID_ETROG): syncTrustedStateEtrog,
    - + + 170 -
    -   -
    +
    +
    + + + uint64(state.FORKID_ELDERBERRY): syncTrustedStateEtrog,
    - + + 171 -
    -   -
    +
    +
    + + + uint64(state.FORKID_9): syncTrustedStateEtrog,
    - 923 + 172
      - } + }, res.state)
    - 924 + 173
      -
    + }
    - 925 + + 174 +
    - - - transactions := []*types.Transaction{tx} +   + var l1checkerL2Blocks *actions.CheckL2BlockHash
    - 926 - -
    - - - receipts := []*types.Receipt{receipt} -
    +
    +
     
    - 927 + + 183 +
    - - - stateRoots := []common.Hash{state.ZeroHash} +   + log.Errorf("error getting last L2Block number from state. Error: %v", err)
    - 928 + + 184 +
    - - -
    +   + return nil, err
    - 929 + 185
      - header := state.NewL2Header(&types.Header{ + }
    - 930 + + 186 +
    - - - Number: big.NewInt(int64(i) + 1), + + + l1checkerL2Blocks, err = actions.NewCheckL2BlockHash(res.state, res.zkEVMClientEthereumCompatible, initialL2Block, cfg.L1SyncCheckL2BlockNumberhModulus)
    - 931 + 187
      - ParentHash: state.ZeroHash, + if err != nil {
    - 932 + 188
      - Coinbase: state.ZeroAddress, + log.Error("error creating new instance of checkL2BlockHash. Error: ", err)
    - 933 + 189
      - Root: state.ZeroHash, + return nil, err
    -
    @@ -954,6 +984,8 @@
    +
     
    - 954 + 194
      - require.NoError(t, err) + }
    - 955 + 195
      - } +
    - 956 + 196
      -
    + res.l1EventProcessors = defaultsL1EventProcessors(res, l1checkerL2Blocks)
    - 957 + 197
      - type testCase struct { + switch cfg.L1SynchronizationMode {
    - 958 + 198
      - name string + case ParallelMode:
    - 959 + 199
      - from uint64 + log.Info("L1SynchronizationMode is parallel")
    -
    @@ -988,20 +1020,227 @@
    +
     
    - 988 + 228
      - name: "logs returned successfully", + ApplyAfterNumRollupReceived: cfg.L1ParallelSynchronization.PerformanceWarning.ApplyAfterNumRollupReceived,
    - 989 + 229
      - from: 1, + AceptableInacctivityTime: cfg.L1ParallelSynchronization.PerformanceWarning.AceptableInacctivityTime.Duration,
    - 990 + 230
      - to: 2, + }
    - 991 + + 231 +
    - - - logCount: 8, + + + L1DataProcessor := l1_parallel_sync.NewL1RollupInfoConsumer(cfgConsumer, sync, chIncommingRollupInfo)
    - 992 + 232
      - expectedError: nil, +
    - 993 + 233
      - }, + cfgProducer := l1_parallel_sync.ConfigProducer{
    - 994 + 234
      - } + SyncChunkSize: cfg.SyncChunkSize,
    - 995 - -
    -   -
    -
    +
    +
     
    - 996 + 275
      - for _, testCase := range testCases { + return err
    - 997 + 276
      - t.Run(testCase.name, func(t *testing.T) { -
    -
    - 998 - -
    - - - logs, err := testState.GetLogs(ctx, testCase.from, testCase.to, []common.Address{}, [][]common.Hash{}, nil, nil, dbTx) -
    -
    - 999 - -
    - - -
    + }
    - 1000 + 277
      - assert.Equal(t, testCase.logCount, len(logs)) +
    - 1001 + + -
    +
    +
      - assert.Equal(t, testCase.expectedError, err) +
    + 278 + +
    +   + // Sync function will read the last state synced and will continue from that point. +
    +
    + 279 + +
    +   + // Sync() will read blockchain events to detect rollup updates +
    +
    @@ -103642,363 +296494,928 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - + + 280 + +
    +   + func (s *ClientSynchronizer) Sync() error { +
    +
    + 281 + +
    +   + startInitialization := time.Now() +
    +
    + 282 + +
    +   + // If there is no lastEthereumBlock means that sync from the beginning is necessary. If not, it continues from the retrieved ethereum block +
    +
    +
     
    +
    + 291 + +
    +   + log.Errorf("error creating db transaction to get latest block. Error: %v", err) +
    +
    + 292 + +
    +   + return err +
    +
    + 293 + +
    +   + } +
    +
    + 294 + +
    + + + lastEthBlockSynced, err := s.state.GetLastBlock(s.ctx, dbTx) +
    +
    + 295 + +
    +   + if err != nil { +
    +
    + 296 + +
    + + + if errors.Is(err, state.ErrStateNotSynchronized) { +
    +
    + 297 + +
    + + + log.Info("State is empty, verifying genesis block") +
    +
    + 298 + +
    + + + valid, err := s.etherMan.VerifyGenBlockNumber(s.ctx, s.genesis.RollupBlockNumber) +
    +
    + 299 + +
    + + + if err != nil { +
    +
    + 300 + +
    + + + log.Error("error checking genesis block number. Error: ", err) +
    +
    + 301 + +
    + + + return rollback(s.ctx, dbTx, err) +
    +
    + 302 + +
    + + + } else if !valid { +
    +
    + 303 + +
    + + + log.Error("genesis Block number configured is not valid. It is required the block number where the PolygonZkEVM smc was deployed") +
    +
    + 304 + +
    + + + return rollback(s.ctx, dbTx, fmt.Errorf("genesis Block number configured is not valid. It is required the block number where the PolygonZkEVM smc was deployed")) +
    +
    + 305 + +
    + + + } +
    +
    + 306 + +
    + + +
    +
    +
    + 307 + +
    + + + // Sync events from RollupManager that happen before rollup creation +
    +
    + 308 + +
    + + + log.Info("synchronizing events from RollupManager that happen before rollup creation") +
    +
    + 309 + +
    + + + for i := s.genesis.RollupManagerBlockNumber; true; i += s.cfg.SyncChunkSize { +
    +
    + 310 + +
    + + + toBlock := min(i+s.cfg.SyncChunkSize-1, s.genesis.RollupBlockNumber-1) +
    +
    + 311 + +
    + + + blocks, order, err := s.etherMan.GetRollupInfoByBlockRange(s.ctx, i, &toBlock) +
    +
    + 312 + +
    + + + if err != nil { +
    +
    + 313 + +
    + + + log.Error("error getting rollupInfoByBlockRange before rollup genesis: ", err) +
    +
    + 314 + +
    + + + rollbackErr := dbTx.Rollback(s.ctx) +
    +
    + 315 + +
    + + + if rollbackErr != nil { +
    +
    + 316 + +
    + + + log.Errorf("error rolling back state. RollbackErr: %v, err: %s", rollbackErr, err.Error()) +
    +
    + 317 + +
    + + + return rollbackErr +
    +
    + 318 + +
    + + + } +
    +
    + 319 + +
    + + + return err +
    +
    + 320 + +
    + + + } +
    +
    + 321 + +
    + + + err = s.ProcessBlockRange(blocks, order) +
    +
    + 322 + +
    + + + if err != nil { +
    +
    + 323 + +
    + + + log.Error("error processing blocks before the genesis: ", err) +
    +
    + 324 + +
    + + + rollbackErr := dbTx.Rollback(s.ctx) +
    +
    + 325 + +
    + + + if rollbackErr != nil { +
    +
    + 326 + +
    + + + log.Errorf("error rolling back state. RollbackErr: %v, err: %s", rollbackErr, err.Error()) +
    +
    + 327 + +
    + + + return rollbackErr +
    +
    + 328 + +
    + + + } +
    +
    + 329 + +
    + + + return err +
    +
    + 330 + +
    + + + } +
    +
    + 331 + +
    + + + if toBlock == s.genesis.RollupBlockNumber-1 { +
    +
    + 332 + +
    + + + break +
    +
    + 333 + +
    + + + } +
    +
    + 334 + +
    + + + } +
    +
    + 335 + +
    + + +
    +
    +
    + 336 + +
    + + + header, err := s.etherMan.HeaderByNumber(s.ctx, big.NewInt(0).SetUint64(s.genesis.RollupBlockNumber)) +
    +
    + 337 + +
    + + + if err != nil { +
    +
    + 338 + +
    + + + log.Errorf("error getting l1 block header for block %d. Error: %v", s.genesis.RollupBlockNumber, err) +
    +
    + 339 + +
    + + + return rollback(s.ctx, dbTx, err) +
    +
    + 340 + +
    + + + } +
    +
    + 341 + +
    + + + log.Info("synchronizing rollup creation block") +
    +
    + 342 + +
    + + + lastEthBlockSynced = &state.Block{ +
    +
    + 343 + +
    + + + BlockNumber: header.Number.Uint64(), +
    +
    + 344 -
    -   -
    +
    +
    + + + BlockHash: header.Hash(),
    - + + 345 -
    -   -
    +
    +
    + + + ParentHash: header.ParentHash,
    - + + 346 -
    -   -
    +
    +
    + + + ReceivedAt: time.Unix(int64(header.Time), 0),
    - + + 347 -
    -   -
    +
    +
    + + + }
    - + + 348 -
    -   -
    +
    +
    + + + genesisRoot, err := s.state.SetGenesis(s.ctx, *lastEthBlockSynced, s.genesis, stateMetrics.SynchronizerCallerLabel, dbTx)
    - + + 349 -
    -   -
    +
    +
    + + + if err != nil {
    - + + 350 -
    -   -
    +
    +
    + + + log.Error("error setting genesis: ", err)
    - + + 351 -
    -   -
    +
    +
    + + + return rollback(s.ctx, dbTx, err)
    - + + 352 -
    -   -
    +
    +
    + + + }
    - + + 353 -
    -   -
    +
    +
    + + + err = s.RequestAndProcessRollupGenesisBlock(dbTx, lastEthBlockSynced)
    - + + 354 -
    -   -
    +
    +
    + + + if err != nil {
    - + + 355 -
    -   -
    +
    +
    + + + log.Error("error processing Rollup genesis block: ", err)
    - + + 356 -
    -   -
    +
    +
    + + + return rollback(s.ctx, dbTx, err)
    - + + 357 -
    -   -
    +
    +
    + + + }
    - + + 358 -
    -   +
    +
    + +
    - + + 359 -
    -   -
    +
    +
    + + + if genesisRoot != s.genesis.Root {
    - + + 360 -
    -   -
    +
    +
    + + + log.Errorf("Calculated newRoot should be %s instead of %s", s.genesis.Root.String(), genesisRoot.String())
    - + + 361 -
    -   -
    +
    +
    + + + return rollback(s.ctx, dbTx, fmt.Errorf("calculated newRoot should be %s instead of %s", s.genesis.Root.String(), genesisRoot.String()))
    - + + 362 -
    -   -
    +
    +
    + + + }
    - + + 363 -
    -   -
    +
    +
    + + + // Waiting for the flushID to be stored
    - + + 364 -
    -   -
    +
    +
    + + + err = s.checkFlushID(dbTx)
    - + + 365 -
    -   -
    +
    +
    + + + if err != nil {
    - + + 366 -
    -   -
    +
    +
    + + + log.Error("error checking genesis flushID: ", err)
    - + + 367 -
    -   -
    +
    +
    + + + return rollback(s.ctx, dbTx, err)
    - + + 368 -
    -   -
    +
    +
    + + + }
    - + + 369 -
    -   -
    +
    +
    + + + log.Debug("Genesis root matches!")
    - + + 370 -
    -   -
    +
    +
    + + + } else {
    - + + 371 -
    -   -
    +
    +
    + + + log.Error("unexpected error getting the latest ethereum block. Error: ", err)
    - + + 372 -
    -   -
    +
    +
    + + + rollbackErr := dbTx.Rollback(s.ctx)
    - + + 373 -
    -   -
    +
    +
    + + + if rollbackErr != nil {
    - + + 374 -
    -   -
    +
    +
    + + + log.Errorf("error rolling back state. RollbackErr: %v, err: %s", rollbackErr, err.Error())
    - + + 375 -
    -   -
    +
    +
    + + + return rollbackErr
    - + + 376 -
    -   -
    +
    +
    + + + }
    - + + 377 -
    +
    +
      -
    + return err
    - + + 378 -
    +
    +
      -
    + }
    - + + 379 -
    +
    +
      -
    + }
    - + + 380 -
    +
    +
      -
    + initBatchNumber, err := s.state.GetLastBatchNumber(s.ctx, dbTx)
    - + + 381 -
    +
    +
      -
    + if err != nil {
    - + + 382 -
    +
    +
      -
    + log.Error("error getting latest batchNumber synced. Error: ", err)
    - + +
     
    -
    +
    + 608 + +
     
    - + + 609 -
    +
    +
      -
    + for {
    - + + 610 -
    +
    +
      -
    + if toBlock > lastKnownBlock.Uint64() {
    - + + 611 -
    -   -
    +
    +
    + + + log.Debug("Setting toBlock to the lastKnownBlock")
    - + + 612 -
    +
    +
      -
    + toBlock = lastKnownBlock.Uint64()
    - + + 613 -
    +
    +
      -
    + }
    - + + 614 -
    +
    +
      -
    + if fromBlock > toBlock {
    - + +
     
    -
    +
    + 676 + +
      -
    + }
    - + + 677 -
    +
    +
     
    - 1002 + 678
      - }) + start = time.Now()
    - + + 679 -
    -   -
    +
    +
    + + + err = s.ProcessBlockRange(blocks, order)
    - + + 680 -
    +
    +
      -
    + metrics.ProcessL1DataTime(time.Since(start))
    - + + 681 -
    +
    +
      -
    + if err != nil {
    - + + 682 -
    +
    +
      -
    + return lastEthBlockSynced, err
    - - -
    -   -
    -
    +
    +
     
    - + + 999 -
    +
    +
      -
    + log.Infof("[checkReorg function] reorgedBlockNumber: %d reorgedBlockHash already synced: %s", reorgedBlock.BlockNumber, reorgedBlock.BlockHash.String())
    - + + 1000 -
    +
    +
     
    - + + 1001 -
    +
    +
      -
    + // Compare hashes
    - + + 1002 -
    -   -
    +
    +
    + + + if (block.BlockHash != reorgedBlock.BlockHash || block.ParentHash != reorgedBlock.ParentHash) && reorgedBlock.BlockNumber > s.genesis.RollupBlockNumber {
    - + + 1003 -
    +
    +
      -
    + log.Infof("checkReorg: Bad block %d hashOk %t parentHashOk %t", reorgedBlock.BlockNumber, block.BlockHash == reorgedBlock.BlockHash, block.ParentHash == reorgedBlock.ParentHash)
    - + + 1004 -
    +
    +
      -
    + log.Debug("[checkReorg function] => latestBlockNumber: ", reorgedBlock.BlockNumber)
    - + + 1005 -
    +
    +
      -
    + log.Debug("[checkReorg function] => latestBlockHash: ", reorgedBlock.BlockHash) +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/synchronizer_pre_rollup.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +
    +
    @@ -1,122 +0,0 @@
    - + + 1 -
    -   -
    +
    +
    + - + package synchronizer
    - + + 2 -
    -   +
    +
    + -
    - + + 3 -
    -   -
    +
    +
    + - + import (
    - + + 4 -
    -   -
    +
    +
    + - + "context"
    - + + 5 -
    -   -
    +
    +
    + - + "errors"
    - 1003 + + 6 +
    -   - } + - + "time"
    - + + 7 -
    -   +
    +
    + -
    - 1004 + + 8 +
    -   - require.NoError(t, dbTx.Commit(ctx)) + - + "github.com/0xPolygonHermez/zkevm-node/etherman"
    - + + 9 -
    -   -
    +
    +
    + - + "github.com/0xPolygonHermez/zkevm-node/log"
    - + + 10 -
    -   -
    +
    +
    + - + "github.com/0xPolygonHermez/zkevm-node/state"
    - + + 11 -
    -   -
    +
    +
    + - + "github.com/0xPolygonHermez/zkevm-node/synchronizer/common/syncinterfaces"
    - + + 12 -
    -   -
    +
    +
    + - + "github.com/jackc/pgx/v4"
    - + + 13 -
    -   -
    +
    +
    + - + )
    - + + 14 -
    -   +
    +
    + -
    - + + 15 -
    -   -
    +
    +
    + - + const (
    - + + 16 -
    -   -
    +
    +
    + - + pregenesisSyncLogPrefix = "sync pregenesis:"
    - + + 17 -
    -   -
    +
    +
    + - + )
    - + + 18 -
    -   +
    +
    + -
    - + + 19 -
    -   -
    +
    +
    + - + // SyncPreRollup is the struct for synchronizing pre genesis rollup events.
    - + + 20 -
    -   -
    +
    +
    + - + // Implements: syncinterfaces.SyncPreRollupSyncer
    - + + 21 -
    -   -
    +
    +
    + - + type SyncPreRollup struct {
    - + + 22 -
    -   -
    +
    +
    + - + etherman syncinterfaces.EthermanPreRollup
    - + + 23 -
    -   -
    +
    +
    + - + state syncinterfaces.StateLastBlockGetter
    - + + 24 -
    -   -
    +
    +
    + - + blockRangeProcessor syncinterfaces.BlockRangeProcessor
    - + + 25 -
    -   -
    +
    +
    + - + SyncChunkSize uint64
    - + + 26 -
    -   -
    +
    +
    + - + GenesisBlockNumber uint64
    - + + 27 -
    -   -
    +
    +
    + - + }
    - + + 28 -
    -   +
    +
    + -
    - + + 29 -
    -   -
    +
    +
    + - + // NewSyncPreRollup creates a new SyncPreRollup
    - + + 30 -
    -   -
    +
    +
    + - + func NewSyncPreRollup(
    - - -
    -   -
    +
    + 31 + +
    + - + etherman syncinterfaces.EthermanPreRollup,
    - + + 32 -
    -   -
    +
    +
    + - + state syncinterfaces.StateLastBlockGetter,
    - + + 33 -
    -   -
    +
    +
    + - + blockRangeProcessor syncinterfaces.BlockRangeProcessor,
    - + + 34 -
    -   -
    +
    +
    + - + syncChunkSize uint64,
    - + + 35 -
    -   -
    +
    +
    + - + genesisBlockNumber uint64,
    - + + 36 -
    -   -
    +
    +
    + - + ) *SyncPreRollup {
    - + + 37 -
    -   -
    +
    +
    + - + return &SyncPreRollup{
    - + + 38 -
    -   -
    +
    +
    + - + etherman: etherman,
    - + + 39 -
    -   -
    +
    +
    + - + state: state,
    - + + 40 -
    -   -
    +
    +
    + - + blockRangeProcessor: blockRangeProcessor,
    - + + 41 -
    -   -
    +
    +
    + - + SyncChunkSize: syncChunkSize,
    - + + 42 -
    -   -
    +
    +
    + - + GenesisBlockNumber: genesisBlockNumber,
    - + + 43 -
    -   -
    +
    +
    + - + }
    - + + 44 -
    -   -
    +
    +
    + - + }
    - + + 45 -
    -   +
    +
    + -
    - + + 46 -
    -   -
    +
    +
    + - + // SynchronizePreGenesisRollupEvents sync pre-rollup events
    - + + 47 -
    -   -
    +
    +
    + - + func (s *SyncPreRollup) SynchronizePreGenesisRollupEvents(ctx context.Context) error {
    - + + 48 -
    -   -
    +
    +
    + - + // Sync events from RollupManager that happen before rollup creation
    - + + 49 -
    -   -
    +
    +
    + - + log.Info(pregenesisSyncLogPrefix + "synchronizing events from RollupManager that happen before rollup creation")
    - + + 50 -
    -   -
    +
    +
    + - + needToUpdate, fromBlock, err := s.getStartingL1Block(ctx, nil)
    - + + 51 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 52 -
    -   -
    +
    +
    + - + log.Errorf(pregenesisSyncLogPrefix+"error getting starting L1 block. Error: %v", err)
    - + + 53 -
    -   -
    +
    +
    + - + return err
    - + + 54 -
    -   -
    +
    +
    + - + }
    - + + 55 -
    -   -
    +
    +
    + - + if needToUpdate {
    - + + 56 -
    -   -
    +
    +
    + - + return s.ProcessL1InfoRootEvents(ctx, fromBlock, s.GenesisBlockNumber-1, s.SyncChunkSize)
    - + + 57 -
    -   -
    +
    +
    + - + } else {
    - + + 58 -
    -   -
    +
    +
    + - + log.Infof(pregenesisSyncLogPrefix+"No need to process blocks before the genesis block %d", s.GenesisBlockNumber)
    - + + 59 -
    -   -
    +
    +
    + - + return nil
    - + + 60 -
    -   -
    +
    +
    + - + }
    - + + 61 -
    -   -
    +
    +
    + - + }
    - + + 62 -
    -   +
    +
    + -
    - + + 63 -
    -   -
    +
    +
    + - + // getStartingL1Block find if need to update and if yes the starting point:
    - + + 64 -
    -   -
    +
    +
    + - + // bool -> need to process blocks
    - + + 65 -
    -   -
    +
    +
    + - + // uint64 -> first block to synchronize
    - + + 66 -
    -   -
    +
    +
    + - + // error -> error
    - + + 67 -
    -   -
    +
    +
    + - + // 1. First try to get last block on DB, if there are could be fully synced or pending blocks
    - 1005 + + 68 +
    -   - } + - + // 2. If DB is empty the LxLy upgrade block as starting point
    - 1006 + + 69 +
    -   -
    + - + func (s *SyncPreRollup) getStartingL1Block(ctx context.Context, dbTx pgx.Tx) (bool, uint64, error) {
    - 1007 + + 70 +
    -   - func TestGetNativeBlockHashesInRange(t *testing.T) { + - + lastBlock, err := s.state.GetLastBlock(ctx, dbTx)
    -
    @@ -1132,6 +1371,111 @@
    +
    + 71 + +
    + - + if err != nil && errors.Is(err, state.ErrStateNotSynchronized) { +
    - 1132 + + 72 +
    -   - require.NoError(t, dbTx.Commit(ctx)) + - + // No block on DB
    - 1133 + + 73 +
    -   - } + - + upgradeLxLyBlockNumber, err := s.etherman.GetL1BlockUpgradeLxLy(ctx, s.GenesisBlockNumber)
    - 1134 + + 74 +
    -   -
    + - + if err != nil && errors.Is(err, etherman.ErrNotFound) {
    - + + 75 -
    -   -
    +
    +
    + - + log.Infof(pregenesisSyncLogPrefix+"LxLy upgrade not detected before genesis block %d, it'll be sync as usual. Nothing to do yet", s.GenesisBlockNumber)
    - + + 76 -
    -   -
    +
    +
    + - + return false, 0, nil
    - + + 77 -
    -   -
    +
    +
    + - + } else if err != nil {
    - + + 78 -
    -   -
    +
    +
    + - + log.Errorf(pregenesisSyncLogPrefix+"error getting LxLy upgrade block. Error: %v", err)
    - + + 79 -
    -   -
    +
    +
    + - + return false, 0, err
    - + + 80 -
    -   -
    +
    +
    + - + }
    - + + 81 -
    -   -
    +
    +
    + - + log.Infof(pregenesisSyncLogPrefix+"No block on DB, starting from LxLy upgrade block %d", upgradeLxLyBlockNumber)
    - + + 82 -
    -   -
    +
    +
    + - + return true, upgradeLxLyBlockNumber, nil
    - + + 83 -
    -   -
    +
    +
    + - + } else if err != nil {
    - + + 84 -
    -   -
    +
    +
    + - + log.Errorf("Error getting last Block on DB err:%v", err)
    - + + 85 -
    -   -
    +
    +
    + - + return false, 0, err
    - + + 86 -
    -   -
    +
    +
    + - + }
    - + + 87 -
    -   -
    +
    +
    + - + if lastBlock.BlockNumber >= s.GenesisBlockNumber-1 {
    - + + 88 -
    -   -
    +
    +
    + - + log.Warnf(pregenesisSyncLogPrefix+"Last block processed is %d, which is greater or equal than the previous genesis block %d", lastBlock, s.GenesisBlockNumber)
    - + + 89 -
    -   -
    +
    +
    + - + return false, 0, nil
    - + + 90 -
    -   -
    +
    +
    + - + }
    - + + 91 -
    -   -
    +
    +
    + - + log.Infof(pregenesisSyncLogPrefix+"Continue processing pre-genesis blocks, last block processed on DB is %d", lastBlock.BlockNumber)
    - + + 92 -
    -   -
    +
    +
    + - + return true, lastBlock.BlockNumber, nil
    - + + 93 -
    -   -
    +
    +
    + - + }
    - + + 94 -
    -   +
    +
    + -
    - + + 95 -
    -   -
    +
    +
    + - + // ProcessL1InfoRootEvents processes the L1InfoRoot events for a range for L1 blocks
    - + + 96 -
    -   -
    +
    +
    + - + func (s *SyncPreRollup) ProcessL1InfoRootEvents(ctx context.Context, fromBlock uint64, toBlock uint64, syncChunkSize uint64) error {
    - + + 97 -
    -   -
    +
    +
    + - + startTime := time.Now()
    - + + 98 -
    -   -
    +
    +
    + - + log.Info(pregenesisSyncLogPrefix + "synchronizing L1InfoRoot events")
    - + + 99 -
    -   -
    +
    +
    + - + log.Infof(pregenesisSyncLogPrefix+"Starting syncing pre genesis LxLy events from block %d to block %d (total %d blocks)",
    - + + 100 -
    -   -
    +
    +
    + - + fromBlock, toBlock, toBlock-fromBlock+1)
    - + + 101 -
    -   -
    +
    +
    + - + for i := fromBlock; true; i += syncChunkSize {
    - + + 102 -
    -   -
    +
    +
    + - + toBlockReq := min(i+syncChunkSize-1, toBlock)
    - + + 103 -
    -   -
    +
    +
    + - + percent := float32(toBlockReq-fromBlock+1) * 100.0 / float32(toBlock-fromBlock+1) // nolint:gomnd
    - + + 104 -
    -   -
    +
    +
    + - + log.Infof(pregenesisSyncLogPrefix+"sync L1InfoTree events from %d to %d percent:%3.1f %% pending_blocks:%d", i, toBlockReq, percent, toBlock-toBlockReq)
    - + + 105 -
    -   -
    +
    +
    + - + blocks, order, err := s.etherman.GetRollupInfoByBlockRangePreviousRollupGenesis(ctx, i, &toBlockReq)
    - + + 106 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 107 -
    -   -
    +
    +
    + - + log.Error(pregenesisSyncLogPrefix+"error getting rollupInfoByBlockRange before rollup genesis: ", err)
    - + + 108 -
    -   -
    +
    +
    + - + return err
    - + + 109 -
    -   -
    +
    +
    + - + }
    - + + 110 -
    -   -
    +
    +
    + - + err = s.blockRangeProcessor.ProcessBlockRange(ctx, blocks, order)
    - + + 111 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 112 -
    -   -
    +
    +
    + - + log.Error(pregenesisSyncLogPrefix+"error processing blocks before the genesis: ", err)
    - + + 113 -
    -   -
    +
    +
    + - + return err
    - + + 114 -
    -   -
    +
    +
    + - + }
    - + + 115 -
    -   -
    +
    +
    + - + if toBlockReq == toBlock {
    - + + 116 -
    -   -
    +
    +
    + - + break
    - + + 117 -
    -   -
    +
    +
    + - + }
    - + + 118 -
    -   -
    +
    +
    + - + }
    - + + 119 -
    -   -
    +
    +
    + - + elapsedTime := time.Since(startTime)
    - + + 120 -
    -   -
    +
    +
    + - + log.Infof(pregenesisSyncLogPrefix+"sync L1InfoTree finish: from %d to %d total_block %d done in %s", fromBlock, toBlock, toBlock-fromBlock+1, &elapsedTime)
    - + + 121 -
    -   -
    +
    +
    + - + return nil
    - + + 122 -
    -   -
    +
    +
    + - + } +
    +
    +
    +
    +
    + + + + + - - - - - - - - + - - - - - - @@ -106152,68 +299627,73 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - + - - - - - - @@ -106227,11 +299707,11 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - -
    +
     
    @@ -106047,68 +299517,73 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 1135 + + -
    +
    +
      - func createL1InfoTreeExitRootStorageEntryForTest(blockNumber uint64, index uint32) *state.L1InfoTreeExitRootStorageEntry { +
    - 1136 + + -
    +
    +
      - exitRoot := state.L1InfoTreeExitRootStorageEntry{ +
    - 1137 + + -
    +
    +
      - L1InfoTreeLeaf: state.L1InfoTreeLeaf{ +
    -
    @@ -1333,6 +1677,10 @@
    +
    + + +
    +   +
    +
    - 1333 + + -
    +
    +
      - require.Equal(t, uint64(2002), fb.BlockNumber) +
    - 1334 + + -
    +
    +
      - require.Equal(t, "0x717e05de47a87a7d1679e183f1c224150675f6302b7da4eaab526b2b91ae0761", fb.GlobalExitRoot.String()) +
    - 1335 + + -
    +
    +
      - require.Equal(t, []byte{0xb}, fb.RawTxsData) +
    - 1336 + + -
    +
    +
      - } +
    - 1337 + + -
    +
    +
     
    - 1338 + + -
    +
    +
      - func TestGetLastGER(t *testing.T) { +
    -
    @@ -1409,5 +1757,41 @@
    +
    + + +
    +   +
    +
    - 1409 + + -
    +
    +
      - ger, err = testState.GetLatestBatchGlobalExitRoot(ctx, dbTx) +
    - 1410 + + -
    +
    +
      - require.NoError(t, err) +
    - 1411 + + -
    +
    +
      - require.Equal(t, common.HexToHash("0x2").String(), ger.String()) +
    - 1412 + + -
    +
    +
     
    @@ -106587,1033 +300067,1037 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 1413 + + -
    +
    +
      - } +
    -
    + + + + + +
    +   +
    -
    -
    - - - - - - - - - - - - - - - - - - - + + + + +
    -
     
    - 872 + + -
    +
    +
      - ctx := context.Background() +
    - 873 + + -
    +
    +
     
    - 874 + + -
    +
    +
      - cfg := state.Config{ +
    - 875 + + -
    - + - MaxLogsCount: 40, +
    +
    +   +
    - 876 + + -
    +
    +
      - MaxLogsBlockRange: 10, +
    - 877 + + -
    +
    +
      - ForkIDIntervals: stateCfg.ForkIDIntervals, +
    - 878 + + -
    +
    +
      - } +
    + + +
    +   +
    +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/synchronizer_pre_rollup_test.go + RENAMED + +
    +
    +
    +
    + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +
    -
     
    -
    - 895 - -
    -   - time := time.Now() -
    +
    @@ -1,89 +0,0 @@
    - 896 + + 1 +
    -   - blockNumber := big.NewInt(1) + - + package synchronizer
    - 897 + + 2 +
    -   + -
    - 898 + + 3 +
    - + - maxBlocks := 3 + - + import (
    - 899 + + 4 +
    - + - txsPerBlock := 4 + - + "context"
    - 900 + + 5 +
    - + - logsPerTx := 5 + - + "testing"
    - 901 + + 6 +
    - + + -
    - 902 + + 7 +
    - + - nonce := uint64(0) + - + "github.com/0xPolygonHermez/zkevm-node/etherman"
    - 903 + + 8 +
    - + -
    + - + "github.com/0xPolygonHermez/zkevm-node/log"
    - 904 + + 9 +
    - + - // number of blocks to be created + - + "github.com/0xPolygonHermez/zkevm-node/state"
    - 905 + + 10 +
    - + - for b := 0; b < maxBlocks; b++ { + - + mock_syncinterfaces "github.com/0xPolygonHermez/zkevm-node/synchronizer/common/syncinterfaces/mocks"
    - 906 + + 11 +
    - + - logIndex := uint(0) + - + "github.com/ethereum/go-ethereum/common"
    - 907 + + 12 +
    - + - transactions := make([]*types.Transaction, 0, txsPerBlock) + - + "github.com/stretchr/testify/mock"
    - 908 + + 13 +
    - + - receipts := make([]*types.Receipt, 0, txsPerBlock) + - + "github.com/stretchr/testify/require"
    - 909 + + 14 +
    - + - stateRoots := make([]common.Hash, 0, txsPerBlock) + - + )
    - 910 + + 15 +
    - + + -
    - 911 + + 16 +
    - + - // number of transactions in a block to be created + - + func TestSyncPreRollupProcessL1InfoRootEventsAskForAllBlocks(t *testing.T) {
    - 912 + + 17 +
    - + - for t := 0; t < txsPerBlock; t++ { + - + mockProcessor := mock_syncinterfaces.NewBlockRangeProcessor(t)
    - 913 + + 18 +
    - + - nonce++ + - + mockEtherman := mock_syncinterfaces.NewEthermanFullInterface(t)
    - 914 + + 19 +
    - + - txIndex := uint(t + 1) + - + sync := &SyncPreRollup{
    - 915 + + 20 +
    - + -
    + - + etherman: mockEtherman,
    - 916 + + 21 +
    - + - tx := types.NewTx(&types.LegacyTx{ + - + blockRangeProcessor: mockProcessor,
    - 917 + + 22 +
    - + - Nonce: nonce, + - + SyncChunkSize: 10,
    - 918 + + 23 +
    - + - To: nil, + - + GenesisBlockNumber: 1234,
    - 919 + + 24 +
    - + - Value: new(big.Int), + - + }
    - 920 + + 25 +
    - + - Gas: 0, + - +
    - 921 + + 26 +
    - + - GasPrice: big.NewInt(0), + - + ctx := context.Background()
    - 922 + + 27 +
    - + - }) + - + fromBlock := uint64(1)
    - 923 + + 28 +
    - + -
    + - + toBlock := uint64(31)
    - 924 + + 29 +
    - + - logs := []*types.Log{} + - + syncChunkSize := uint64(10)
    - 925 + + 30 +
    - + -
    + - + previousBlockNumber := uint64(1)
    - 926 + + 31 +
    - + - // if block is even logIndex follows a sequence related to the block + - + for _, i := range []uint64{10, 20, 30, 31} {
    - 927 + + 32 +
    - + - // for odd blocks logIndex follows a sequence related ot the tx + - + // Mocking the call to GetRollupInfoByBlockRangePreviousRollupGenesis
    - 928 + + 33 +
    - + - // this is needed to simulate a logIndex difference introduced on Etrog + - + v := i
    - 929 + + 34 +
    - + - // and we need to maintain to be able to synchronize these blocks + - + mockEtherman.EXPECT().GetRollupInfoByBlockRangePreviousRollupGenesis(ctx, previousBlockNumber, &v).
    - 930 + + 35 +
    - + - // number of logs in a transaction to be created + - + Return(getRollupTest()).Once()
    - 931 + + 36 +
    - + - for l := 0; l < logsPerTx; l++ { + - + previousBlockNumber = i + 1
    - 932 + + 37 +
    - + - li := logIndex + - + }
    - 933 + + 38 +
    - + - if b%2 != 0 { // even block + - +
    - 934 + + 39 +
    - + - li = uint(l) + - + mockProcessor.EXPECT().ProcessBlockRange(ctx, mock.Anything, mock.Anything).Return(nil).Maybe()
    - 935 + + 40 +
    - + - } + - + err := sync.ProcessL1InfoRootEvents(ctx, fromBlock, toBlock, syncChunkSize)
    - 936 + + 41 +
    - + -
    + - + require.NoError(t, err)
    - 937 + + 42 +
    - + - logs = append(logs, &types.Log{TxHash: tx.Hash(), TxIndex: txIndex, Index: li}) + - + }
    - 938 + + 43 +
    - + - logIndex++ + - +
    - 939 + + 44 +
    - + - } + - + func getRollupTest() ([]etherman.Block, map[common.Hash][]etherman.Order, error) {
    - 940 + + 45 +
    - + -
    + - + return nil, nil, nil
    - 941 + + 46 +
    - + - receipt := &types.Receipt{ + - + }
    - 942 + + 47 +
    - + - Type: tx.Type(), + - +
    - 943 + + 48 +
    - + - PostState: state.ZeroHash.Bytes(), + - + func TestSyncPreRollupGetStartingL1Block(t *testing.T) {
    - 944 + + 49 +
    - + - CumulativeGasUsed: 0, + - + mockState := mock_syncinterfaces.NewStateFullInterface(t)
    - 945 + + 50 +
    - + - EffectiveGasPrice: big.NewInt(0), + - + mockEtherman := mock_syncinterfaces.NewEthermanFullInterface(t)
    - 946 + + 51 +
    - + - BlockNumber: blockNumber, + - + sync := &SyncPreRollup{
    - 947 + + 52 +
    - + - GasUsed: tx.Gas(), + - + state: mockState,
    - 948 + + 53 +
    - + - TxHash: tx.Hash(), + - + etherman: mockEtherman,
    - 949 + + 54 +
    - + - TransactionIndex: txIndex, + - + GenesisBlockNumber: 1234,
    - 950 + + 55 +
    - + - Status: types.ReceiptStatusSuccessful, + - + }
    - 951 + + 56 +
    - + - Logs: logs, + - +
    - 952 + + 57 +
    - + - } + - + ctx := context.Background()
    - 953 + + 58 +
    - + + -
    - 954 + + 59 +
    - + - transactions = append(transactions, tx) + - + for idx, testCase := range []struct {
    - 955 + + 60 +
    - + - receipts = append(receipts, receipt) + - + name string
    - 956 + + 61 +
    - + - stateRoots = append(stateRoots, state.ZeroHash) + - + upgradeLxLyBlockNumber uint64
    - 957 + + 62 +
    -   - } + - + blockNumber uint64
    - 958 + + 63 +
    -   -
    -
    -
    - - -
    -   -
    + - + expectedError bool
    - + + 64 -
    -   -
    +
    +
    + - + expectedNeedToUpdate bool
    - + + 65 -
    -   -
    +
    +
    + - + expectedBlockNumber uint64
    - + + 66 -
    -   -
    +
    +
    + - + }{
    - 959 + + 67 +
    -   - header := state.NewL2Header(&types.Header{ + - + {name: "mid block", upgradeLxLyBlockNumber: 1000, blockNumber: 1001, expectedError: false, expectedNeedToUpdate: true, expectedBlockNumber: 1001},
    - 960 + + 68 +
    - + - Number: big.NewInt(int64(b) + 1), + - + {name: "pre block", upgradeLxLyBlockNumber: 1000, blockNumber: 999, expectedError: false, expectedNeedToUpdate: true, expectedBlockNumber: 999},
    - 961 + + 69 +
    -   - ParentHash: state.ZeroHash, + - + {name: "same genesis", upgradeLxLyBlockNumber: 1000, blockNumber: sync.GenesisBlockNumber, expectedError: false, expectedNeedToUpdate: false},
    - 962 + + 70 +
    -   - Coinbase: state.ZeroAddress, + - + {name: "genesis-1", upgradeLxLyBlockNumber: 1000, blockNumber: 1233, expectedError: false, expectedNeedToUpdate: false},
    - 963 + + 71 +
    -   - Root: state.ZeroHash, + - + } {
    -
     
    -
    - 984 + + 72 +
    -   - require.NoError(t, err) + - + log.Info("Running test case ", idx+1)
    - 985 + + 73 +
    -   - } + - + block := state.Block{
    - 986 + + 74 +
    -   -
    + - + BlockNumber: testCase.blockNumber,
    - 987 + + 75 +
    - + - require.NoError(t, dbTx.Commit(ctx)) + - + }
    - 988 + + 76 +
    - + -
    + - + mockEtherman.EXPECT().GetL1BlockUpgradeLxLy(ctx, sync.GenesisBlockNumber).Return(testCase.upgradeLxLyBlockNumber, nil).Maybe()
    - 989 + + 77 +
    -   - type testCase struct { + - + mockState.EXPECT().GetLastBlock(ctx, mock.Anything).Return(&block, nil).Once()
    - 990 + + 78 +
    -   - name string + - + needToUpdate, blockNumber, err := sync.getStartingL1Block(ctx, nil)
    - 991 + + 79 +
    -   - from uint64 + - + if testCase.expectedError {
    -
     
    -
    - 1020 + + 80 +
    -   - name: "logs returned successfully", + - + require.Error(t, err, testCase.name)
    - 1021 + + 81 +
    -   - from: 1, + - + } else {
    - 1022 + + 82 +
    -   - to: 2, + - + require.NoError(t, err, testCase.name)
    - 1023 + + 83 +
    - + - logCount: 40, + - + require.Equal(t, testCase.expectedNeedToUpdate, needToUpdate, testCase.name)
    - 1024 + + 84 +
    -   - expectedError: nil, + - + if needToUpdate {
    - 1025 + + 85 +
    -   - }, + - + require.Equal(t, testCase.blockNumber, blockNumber, testCase.name)
    - 1026 + + 86 +
    -   - } + - + }
    - 1027 + + 87 +
    -   -
    + - + }
    - 1028 + + 88 +
    -   - for _, testCase := range testCases { + - + }
    - 1029 + + 89 +
    -   - t.Run(testCase.name, func(t *testing.T) { + - + }
    - 1030 - -
    - + - logs, err := testState.GetLogs(ctx, testCase.from, testCase.to, []common.Address{}, [][]common.Hash{}, nil, nil, nil) +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +
    +
     
    @@ -107626,2148 +301110,2196 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 1031 + + -
    +
    +
      - assert.Equal(t, testCase.logCount, len(logs)) +
    - 1032 + + -
    +
    +
      - assert.Equal(t, testCase.expectedError, err) -
    -
    - 1033 - -
    - +
    - 1034 - -
    - + - // check tx index and log index order -
    -
    - 1035 - -
    - + - lastBlockNumber := uint64(0) -
    -
    - 1036 - -
    - + - lastTxIndex := uint(0) -
    -
    - 1037 - -
    - + - lastLogIndex := uint(0) -
    -
    - 1038 + + -
    - + +
    +
    +  
    - 1039 + + -
    - + - for i, l := range logs { +
    +
    +   +
    - 1040 + + -
    - + - // if block has changed and it's not the first log, reset lastTxIndex +
    +
    +   +
    - 1041 + + -
    - + - if uint(l.BlockNumber) != uint(lastBlockNumber) && i != 0 { +
    +
    +   +
    - 1042 + + -
    - + - lastTxIndex = 0 +
    +
    +   +
    - 1043 + + -
    - + - } +
    +
    +   +
    - 1044 + + -
    - + +
    +
    +  
    - 1045 + + -
    - + - if l.TxIndex < lastTxIndex { +
    +
    +   +
    - 1046 + + -
    - + - t.Errorf("invalid tx index, expected greater than or equal to %v, but found %v", lastTxIndex, l.TxIndex) +
    +
    +   +
    - 1047 + + -
    - + - } +
    +
    +   +
    - 1048 + + -
    - + - // add tolerance for log index Etrog issue that was starting log indexes from 0 for each tx within a block +
    +
    +   +
    - 1049 + + -
    - + - // if tx index has changed and the log index starts on zero, than resets the lastLogIndex to zero +
    +
    +   +
    - 1050 + + -
    - + - if l.TxIndex != lastTxIndex && l.Index == 0 { +
    +
    +   +
    - 1051 + + -
    - + - lastLogIndex = 0 +
    +
    +   +
    - 1052 + + -
    - + - } +
    +
    +   +
    - 1053 + + -
    - + +
    +
    +  
    - 1054 + + -
    - + - if l.Index < lastLogIndex { +
    +
    +   +
    - 1055 + + -
    - + - t.Errorf("invalid log index, expected greater than %v, but found %v", lastLogIndex, l.Index) +
    +
    +   +
    - 1056 + + -
    - + - } +
    +
    +   +
    - 1057 + + -
    - + +
    +
    +  
    - 1058 + + -
    - + - lastBlockNumber = l.BlockNumber +
    +
    +   +
    - 1059 + + -
    - + - lastTxIndex = l.TxIndex +
    +
    +   +
    - 1060 + + -
    - + - lastLogIndex = l.Index +
    +
    +   +
    - 1061 + + -
    - + - } +
    +
    +   +
    - 1062 + + -
    - + - }) +
    +
    +   +
    - 1063 + + -
    - + - } +
    +
    +   +
    - 1064 + + -
    - + - } +
    +
    +   +
    - 1065 + + -
    - + +
    +
    +  
    - 1066 + + -
    - + - func TestGetLogsByBlockNumber(t *testing.T) { +
    +
    +   +
    - 1067 + + -
    - + - initOrResetDB() +
    +
    +   +
    - 1068 + + -
    - + +
    +
    +  
    - 1069 + + -
    - + - ctx := context.Background() +
    +
    +   +
    - 1070 + + -
    - + +
    +
    +  
    - 1071 + + -
    - + - cfg := state.Config{ +
    +
    +   +
    - 1072 + + -
    - + - MaxLogsCount: 40, +
    +
    +   +
    - 1073 + + -
    - + - MaxLogsBlockRange: 10, +
    +
    +   +
    - 1074 + + -
    - + - ForkIDIntervals: stateCfg.ForkIDIntervals, +
    +
    +   +
    - 1075 + + -
    - + - } +
    +
    +   +
    - 1076 + + -
    - + +
    +
    +  
    - 1077 + + -
    - + - mt, err := l1infotree.NewL1InfoTree(32, [][32]byte{}) +
    +
    +   +
    - 1078 + + -
    - + - if err != nil { +
    +
    +   +
    - 1079 + + -
    - + - panic(err) +
    +
    +   +
    - 1080 + + -
    - + - } +
    +
    +   +
    - 1081 + + -
    - + - testState = state.NewState(stateCfg, pgstatestorage.NewPostgresStorage(cfg, stateDb), executorClient, stateTree, nil, mt) +
    +
    +   +
    - 1082 + + -
    - + +
    +
    +  
    - 1083 + + -
    - + - dbTx, err := testState.BeginStateTransaction(ctx) +
    +
    +   +
    - 1084 + + -
    - + - require.NoError(t, err) +
    +
    +   +
    - 1085 + + -
    - + - err = testState.AddBlock(ctx, block, dbTx) +
    +
    +   +
    - 1086 + + -
    - + - assert.NoError(t, err) +
    +
    +   +
    - 1087 + + -
    - + +
    +
    +  
    - 1088 + + -
    - + - batchNumber := uint64(1) +
    +
    +   +
    - 1089 + + -
    - + - _, err = testState.Exec(ctx, "INSERT INTO state.batch (batch_num, wip) VALUES ($1, FALSE)", batchNumber) +
    +
    +   +
    - 1090 + + -
    - + - assert.NoError(t, err) +
    +
    +   +
    - 1091 + + -
    - + +
    +
    +  
    - 1092 + + -
    - + - time := time.Now() +
    +
    +   +
    - 1093 + + -
    - + - blockNumber := big.NewInt(1) +
    +
    +   +
    - 1094 + + -
    - + +
    +
    +  
    - 1095 + + -
    - + - maxBlocks := 3 +
    +
    +   +
    - 1096 + + -
    - + - txsPerBlock := 4 +
    +
    +   +
    - 1097 + + -
    - + - logsPerTx := 5 +
    +
    +   +
    - 1098 + + -
    - + +
    +
    +  
    - 1099 + + -
    - + - nonce := uint64(0) +
    +
    +   +
    - 1100 + + -
    - + +
    +
    +  
    - 1101 + + -
    - + - // number of blocks to be created +
    +
    +   +
    - 1102 + + -
    - + - for b := 0; b < maxBlocks; b++ { +
    +
    +   +
    - 1103 + + -
    - + - logIndex := uint(0) +
    +
    +   +
    - 1104 + + -
    - + - transactions := make([]*types.Transaction, 0, txsPerBlock) +
    +
    +   +
    - 1105 + + -
    - + - receipts := make([]*types.Receipt, 0, txsPerBlock) +
    +
    +   +
    - 1106 + + -
    - + - stateRoots := make([]common.Hash, 0, txsPerBlock) +
    +
    +   +
    - 1107 + + -
    - + +
    +
    +  
    - 1108 + + -
    - + - // number of transactions in a block to be created +
    +
    +   +
    - 1109 + + -
    - + - for t := 0; t < txsPerBlock; t++ { +
    +
    +   +
    - 1110 + + -
    - + - nonce++ +
    +
    +   +
    - 1111 + + -
    - + - txIndex := uint(t + 1) +
    +
    +   +
    - 1112 + + -
    - + +
    +
    +  
    - 1113 + + -
    - + - tx := types.NewTx(&types.LegacyTx{ +
    +
    +   +
    - 1114 + + -
    - + - Nonce: nonce, +
    +
    +   +
    - 1115 + + -
    - + - To: nil, +
    +
    +   +
    - 1116 + + -
    - + - Value: new(big.Int), +
    +
    +   +
    - 1117 + + -
    - + - Gas: 0, +
    +
    +   +
    - 1118 + + -
    - + - GasPrice: big.NewInt(0), +
    +
    +   +
    - 1119 + + -
    - + - }) +
    +
    +   +
    - 1120 + + -
    - + +
    +
    +  
    - 1121 + + -
    - + - logs := []*types.Log{} +
    +
    +   +
    - 1122 + + -
    - + +
    +
    +  
    - 1123 + + -
    - + - // if block is even logIndex follows a sequence related to the block +
    +
    +   +
    +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/synchronizer_test.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - + + +
    +
    @@ -31,7 +31,6 @@
    - 1124 + + 31 +
    - + - // for odd blocks logIndex follows a sequence related ot the tx +   + ETROG_MODE_FLAG = true
    - 1125 + + 32 +
    - + - // this is needed to simulate a logIndex difference introduced on Etrog +   + RETRIEVE_BATCH_FROM_DB_FLAG = true
    - 1126 + + 33 +
    - + - // and we need to maintain to be able to synchronize these blocks +   + RETRIEVE_BATCH_FROM_CACHE_FLAG = false
    - 1127 + + 34 +
    - + - // number of logs in a transaction to be created + - + PROCESS_BATCH_SELECTOR_ENABLED = false
    - 1128 + + 35 +
    - + - for l := 0; l < logsPerTx; l++ { +   + )
    - 1129 + + 36 +
    - + - li := logIndex +   +
    - 1130 + + 37 +
    - + - if b%2 != 0 { // even block +   + type mocks struct {
    - 1131 + +
    @@ -123,7 +122,7 @@
    +
    + 123 +
    - + - li = uint(l) +   + // but it used a feature that is not implemented in new one that is asking beyond the last block on L1
    - 1132 + + 124 +
    - + - } +   + func TestForcedBatchEtrog(t *testing.T) {
    - 1133 + + 125 +
    - + -
    +   + genesis := state.Genesis{
    - 1134 + + 126 +
    - + - logs = append(logs, &types.Log{TxHash: tx.Hash(), TxIndex: txIndex, Index: li}) + - + BlockNumber: uint64(0),
    - 1135 + + 127 +
    - + - logIndex++ +   + }
    - 1136 + + 128 +
    - + - } +   + cfg := Config{
    - 1137 + + 129 +
    - + -
    +   + SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
    - 1138 + +
    @@ -170,7 +169,6 @@
    +
    + 170 +
    - + - receipt := &types.Receipt{ +   + On("GetForkIDByBatchNumber", mock.Anything).
    - 1139 + + 171 +
    - + - Type: tx.Type(), +   + Return(uint64(7), nil).
    - 1140 + + 172 +
    - + - PostState: state.ZeroHash.Bytes(), +   + Maybe()
    - 1141 + + 173 +
    - + - CumulativeGasUsed: 0, + - +
    - 1142 + + 174 +
    - + - EffectiveGasPrice: big.NewInt(0), +   + m.State.
    - 1143 + + 175 +
    - + - BlockNumber: blockNumber, +   + On("GetLastBlock", ctx, m.DbTx).
    - 1144 + + 176 +
    - + - GasUsed: tx.Gas(), +   + Return(lastBlock0, nil).
    - 1145 + +
    @@ -226,7 +224,7 @@
    +
    + 226 +
    - + - TxHash: tx.Hash(), +   + Coinbase: common.HexToAddress("0x222"),
    - 1146 + + 227 +
    - + - TransactionIndex: txIndex, +   + SequencerAddr: common.HexToAddress("0x00"),
    - 1147 + + 228 +
    - + - Status: types.ReceiptStatusSuccessful, +   + TxHash: common.HexToHash("0x333"),
    - 1148 + + 229 +
    - + - Logs: logs, + - + PolygonRollupBaseEtrogBatchData: &etrogpolygonzkevm.PolygonRollupBaseEtrogBatchData{
    - 1149 + + 230 +
    - + - } +   + Transactions: []byte{},
    - 1150 + + 231 +
    - + -
    +   + ForcedGlobalExitRoot: [32]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32},
    - 1151 + + 232 +
    - + - transactions = append(transactions, tx) +   + ForcedTimestamp: uint64(t.Unix()),
    - 1152 - -
    - + - receipts = append(receipts, receipt) -
    +
    +
    @@ -397,7 +395,7 @@
    - 1153 + + 397 +
    - + - stateRoots = append(stateRoots, state.ZeroHash) +   + // but it used a feature that is not implemented in new one that is asking beyond the last block on L1
    - 1154 + + 398 +
    - + - } +   + func TestSequenceForcedBatchIncaberry(t *testing.T) {
    - 1155 + + 399 +
    - + -
    +   + genesis := state.Genesis{
    - 1156 + + 400 +
    - + - header := state.NewL2Header(&types.Header{ + - + BlockNumber: uint64(0),
    - 1157 + + 401 +
    - + - Number: big.NewInt(int64(b) + 1), +   + }
    - 1158 + + 402 +
    - + - ParentHash: state.ZeroHash, +   + cfg := Config{
    - 1159 + + 403 +
    - + - Coinbase: state.ZeroAddress, +   + SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
    - 1160 + +
    @@ -490,7 +488,7 @@
    +
    + 490 +
    - + - Root: state.ZeroHash, +   + BatchNumber: uint64(2),
    - 1161 + + 491 +
    - + - GasUsed: 1, +   + Coinbase: common.HexToAddress("0x222"),
    - 1162 + + 492 +
    - + - GasLimit: 10, +   + TxHash: common.HexToHash("0x333"),
    - 1163 + + 493 +
    - + - Time: uint64(time.Unix()), + - + PolygonRollupBaseEtrogBatchData: etrogpolygonzkevm.PolygonRollupBaseEtrogBatchData{
    - 1164 + 494
      - }) + Transactions: []byte{},
    - 1165 + + 495 +
    - + -
    +   + ForcedGlobalExitRoot: [32]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32},
    - 1166 + + 496 +
    - + - st := trie.NewStackTrie(nil) +   + ForcedTimestamp: 1000, //ForcedBatch
    - 1167 + +
    @@ -659,7 +657,7 @@
    +
    + 659 +
    - + - l2Block := state.NewL2Block(header, transactions, []*state.L2Header{}, receipts, st) +   +
    - 1168 + + 660 +
    - + - for _, receipt := range receipts { +   + func setupGenericTest(t *testing.T) (*state.Genesis, *Config, *mocks) {
    - 1169 + + 661 +
    - + - receipt.BlockHash = l2Block.Hash() +   + genesis := state.Genesis{
    - 1170 + + 662 +
    - + - } + - + BlockNumber: uint64(123456),
    - 1171 + + 663 +
    - + -
    +   + }
    - 1172 + + 664 +
    - + - numTxs := len(transactions) +   + cfg := Config{
    - 1173 + + 665 +
    - + - storeTxsEGPData := make([]state.StoreTxEGPData, numTxs) +   + SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
    - 1174 + +
    @@ -761,11 +759,9 @@
    +
    + 761 +
    - + - txsL2Hash := make([]common.Hash, numTxs) +   + transactions := []types.TransactionOrHash{}
    - 1175 + + 762 +
    - + - for i := range transactions { +   + for nBlock := 0; nBlock < howManyBlocks; nBlock++ {
    - 1176 + + 763 +
    - + - storeTxsEGPData[i] = state.StoreTxEGPData{EGPLog: nil, EffectivePercentage: state.MaxEffectivePercentage} +   + block := state.L2BlockRaw{
    - 1177 + + 764 +
    - + - txsL2Hash[i] = common.HexToHash(fmt.Sprintf("0x%d", i)) + - + ChangeL2BlockHeader: state.ChangeL2BlockHeader{
    - 1178 + + 765 +
    - + - } + - + DeltaTimestamp: 123,
    - 1179 + + 766 +
    - + -
    + - + IndexL1InfoTree: 456,
    - 1180 + + 767 +
    - + - err = testState.AddL2Block(ctx, batchNumber, l2Block, receipts, txsL2Hash, storeTxsEGPData, stateRoots, dbTx) + - + },
    - 1181 + + 768 +
    - + - require.NoError(t, err) + - + Transactions: []state.L2TxRaw{},
    - 1182 + 769
      - } + }
    - 1183 + + 770 +
    - + -
    +   + for i := 0; i < howManyTx; i++ {
    - 1184 + 771
      - require.NoError(t, dbTx.Commit(ctx)) + tx := createTransaction(uint64(i + 1))
    - 1185 + +
    @@ -925,7 +921,7 @@
    +
    + 925 +
    - + +  
    - 1186 + + 926 +
    - + - type testCase struct { +   + func TestReorg(t *testing.T) {
    - 1187 + + 927 +
    - + - name string +   + genesis := state.Genesis{
    - 1188 + + 928 +
    - + - blockNumber uint64 + - + BlockNumber: uint64(0),
    - 1189 + + 929 +
    - + - logCount int +   + }
    - 1190 + + 930 +
    - + - expectedError error +   + cfg := Config{
    - 1191 + + 931 +
    - + - } +   + SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
    - 1192 + +
    @@ -1245,7 +1241,7 @@
    +
    + 1245 +
    - + +  
    - 1193 + + 1246 +
    - + - testCases := []testCase{ +   + func TestLatestSyncedBlockEmpty(t *testing.T) {
    - 1194 + + 1247 +
    - + - { +   + genesis := state.Genesis{
    - 1195 + + 1248 +
    - + - name: "logs returned successfully", + - + BlockNumber: uint64(0),
    - 1196 + + 1249 +
    - + - blockNumber: 1, +   + }
    - 1197 + + 1250 +
    - + - logCount: 20, +   + cfg := Config{
    - 1198 + + 1251 +
    - + - expectedError: nil, +   + SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
    - 1199 + +
    @@ -1459,7 +1455,7 @@
    +
    + 1459 +
    - + - }, +   +
    - 1200 + + 1460 +
    - + - { +   + func TestRegularReorg(t *testing.T) {
    - 1201 + + 1461 +
    - + - name: "logs returned successfully", +   + genesis := state.Genesis{
    - 1202 + + 1462 +
    - + - blockNumber: 2, + - + BlockNumber: uint64(0),
    - 1203 + + 1463 +
    - + - logCount: 20, +   + }
    - 1204 + + 1464 +
    - + - expectedError: nil, +   + cfg := Config{
    - 1205 + + 1465 +
    - + - }, +   + SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
    - 1206 + +
    @@ -1741,7 +1737,7 @@
    +
    + 1741 +
    - + - } +   +
    - 1207 + + 1742 +
    - + -
    +   + func TestLatestSyncedBlockEmptyWithExtraReorg(t *testing.T) {
    - 1208 + + 1743 +
    - + - for _, testCase := range testCases { +   + genesis := state.Genesis{
    - 1209 + + 1744 +
    - + - t.Run(testCase.name, func(t *testing.T) { + - + BlockNumber: uint64(0),
    - 1210 + + 1745 +
    - + - logs, err := testState.GetLogsByBlockNumber(ctx, testCase.blockNumber, nil) +   + }
    - 1211 + + 1746 +
    - + - assert.Equal(t, testCase.logCount, len(logs)) +   + cfg := Config{
    - 1212 + + 1747 +
    - + - assert.Equal(t, testCase.expectedError, err) +   + SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
    - 1213 + +
    @@ -2017,13 +2013,16 @@
    +
    + 2017 +
    - + +  
    - 1214 + + 2018 +
    - + - // check tx index and log index order +   + func TestCallFromEmptyBlockAndReorg(t *testing.T) {
    - 1215 + + 2019 +
    - + - lastBlockNumber := uint64(0) +   + genesis := state.Genesis{
    - 1216 + + 2020 +
    - + - lastTxIndex := uint(0) + - + BlockNumber: uint64(0),
    - 1217 + + 2021 +
    - + - lastLogIndex := uint(0) +   + }
    - 1218 + + 2022 +
    - + -
    +   + cfg := Config{
    - 1219 + + 2023 +
    - + - for i, l := range logs { +   + SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
    - 1220 + + 2024 +
    - + - // if block has changed and it's not the first log, reset lastTxIndex +   + SyncChunkSize: 3,
    - 1221 + + 2025 +
    - + - if uint(l.BlockNumber) != uint(lastBlockNumber) && i != 0 { +   + L1SynchronizationMode: SequentialMode,
    - 1222 + + 2026 +
    - + - lastTxIndex = 0 +   + SyncBlockProtection: "latest",
    - 1223 + + -
    - + - } +
    +
    +   +
    - 1224 + + -
    - + +
    +
    +  
    - 1225 + + -
    - + - if l.TxIndex < lastTxIndex { +
    +
    +   +
    - 1226 + + 2027 +
    - + - t.Errorf("invalid tx index, expected greater than or equal to %v, but found %v", lastTxIndex, l.TxIndex) +   + }
    - 1227 + + 2028 +
    - + - } +   +
    - 1228 + + 2029 +
    - + - // add tolerance for log index Etrog issue that was starting log indexes from 0 for each tx within a block +   + m := mocks{
    - 1229 + +
    @@ -2129,6 +2128,11 @@
    +
    + 2129 +
    - + - // if tx index has changed and the log index starts on zero, than resets the lastLogIndex to zero +   + Return(ethHeader2bis, nil).
    - 1230 + + 2130 +
    - + - if l.TxIndex != lastTxIndex && l.Index == 0 { +   + Once()
    - 1231 + + 2131 +
    - + - lastLogIndex = 0 +   +
    - 1232 + + -
    - + - } +
    +
    +   +
    - 1233 + + -
    - + +
    +
    +  
    - 1234 + + -
    - + - if l.Index < lastLogIndex { +
    +
    +   +
    - 1235 + + -
    - + - t.Errorf("invalid log index, expected greater than %v, but found %v", lastLogIndex, l.Index) +
    +
    +   +
    - 1236 + + -
    - + - } +
    +
    +   +
    - 1237 + + 2132 +
    - + -
    +   + ti := time.Date(2024, 1, 1, 1, 0, 0, 0, time.UTC)
    - 1238 + + 2133 +
    - + - lastBlockNumber = l.BlockNumber +   +
    - 1239 + + 2134 +
    - + - lastTxIndex = l.TxIndex +   + ethermanBlock0 := etherman.Block{ +
    +
    +
    +
    +
    + + + + + - - - - - - - - @@ -109792,1077 +303324,1107 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - + + +
    +
     
    - 1240 + + 31 +
    - + - lastLogIndex = l.Index +   + ETROG_MODE_FLAG = true
    - 1241 + + 32 +
    - + - } +   + RETRIEVE_BATCH_FROM_DB_FLAG = true
    - 1242 + + 33 +
    - + - }) +   + RETRIEVE_BATCH_FROM_CACHE_FLAG = false
    - 1243 + + -
    - + - } +
    +
    +   +
    - 1244 + 34
      - } + )
    - 1245 + 35
    @@ -109777,12 +303309,12 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 1246 + 36
      - func TestGetNativeBlockHashesInRange(t *testing.T) { + type mocks struct {
    - 1371 + 122
      - require.NoError(t, dbTx.Commit(ctx)) + // but it used a feature that is not implemented in new one that is asking beyond the last block on L1
    - 1372 + 123
      - } + func TestForcedBatchEtrog(t *testing.T) {
    - 1373 + 124
      -
    -
    -
    - 1374 - -
    - + - func TestGetBatchL2DataByNumber(t *testing.T) { -
    -
    - 1375 - -
    - + - // Init database instance + genesis := state.Genesis{
    - 1376 + + 125 +
    + - initOrResetDB() + RollupBlockNumber: uint64(123456),
    - 1377 + + 126 +
    - + - ctx := context.Background() +   + }
    - 1378 + + 127 +
    - + - tx, err := testState.BeginStateTransaction(ctx) +   + cfg := Config{
    - 1379 + + 128 +
    - + - require.NoError(t, err) +   + SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
    - 1380 - -
    - + - defer func() { require.NoError(t, tx.Commit(ctx)) }() -
    +
    +
     
    - 1381 + + 169 +
    - + -
    +   + On("GetForkIDByBatchNumber", mock.Anything).
    - 1382 + + 170 +
    - + - // empty case +   + Return(uint64(7), nil).
    - 1383 + + 171 +
    - + - var batchNum uint64 = 4 +   + Maybe()
    - 1384 + + -
    - + - const ( +
    +
    +   +
    - 1385 + + 172 +
    - + - openBatchSQL = "INSERT INTO state.batch (batch_num, raw_txs_data, wip) VALUES ($1, $2, false)" +   + m.State.
    - 1386 + + 173 +
    - + - resetBatchesSQL = "DELETE FROM state.batch" +   + On("GetLastBlock", ctx, m.DbTx).
    - 1387 + + 174 +
    - + - ) +   + Return(lastBlock0, nil).
    - 1388 + +
     
    +
    + 224 +
    - + - _, err = tx.Exec(ctx, openBatchSQL, batchNum, nil) +   + Coinbase: common.HexToAddress("0x222"),
    - 1389 + + 225 +
    - + - require.NoError(t, err) +   + SequencerAddr: common.HexToAddress("0x00"),
    - 1390 + + 226 +
    - + - data, err := testState.GetBatchL2DataByNumber(ctx, batchNum, tx) +   + TxHash: common.HexToHash("0x333"),
    - 1391 + + 227 +
    + - require.NoError(t, err) + PolygonRollupBaseEtrogBatchData: &polygonzkevm.PolygonRollupBaseEtrogBatchData{
    - 1392 + + 228 +
    - + - assert.Nil(t, data) +   + Transactions: []byte{},
    - 1393 + + 229 +
    - + -
    +   + ForcedGlobalExitRoot: [32]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32},
    - 1394 + + 230 +
    - + - // not empty case +   + ForcedTimestamp: uint64(t.Unix()),
    - 1395 + +
     
    +
    + 395 +
    - + - expectedData := []byte("foo bar") +   + // but it used a feature that is not implemented in new one that is asking beyond the last block on L1
    - 1396 + + 396 +
    - + - batchNum = 5 +   + func TestSequenceForcedBatchIncaberry(t *testing.T) {
    - 1397 + + 397 +
    - + - _, err = tx.Exec(ctx, openBatchSQL, batchNum, expectedData) +   + genesis := state.Genesis{
    - 1398 + + 398 +
    + - require.NoError(t, err) + RollupBlockNumber: uint64(123456),
    - 1399 + + 399 +
    - + - actualData, err := testState.GetBatchL2DataByNumber(ctx, batchNum, tx) +   + }
    - 1400 + + 400 +
    - + - require.NoError(t, err) +   + cfg := Config{
    - 1401 + + 401 +
    - + - assert.Equal(t, expectedData, actualData) +   + SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
    - 1402 + +
     
    +
    + 488 +
    - + -
    +   + BatchNumber: uint64(2),
    - 1403 + + 489 +
    - + - multiGet := []uint64{uint64(4), uint64(5), uint64(6)} +   + Coinbase: common.HexToAddress("0x222"),
    - 1404 + + 490 +
    - + - allData, err := testState.GetBatchL2DataByNumbers(ctx, multiGet, tx) +   + TxHash: common.HexToHash("0x333"),
    - 1405 + + 491 +
    + - require.NoError(t, err) + PolygonRollupBaseEtrogBatchData: polygonzkevm.PolygonRollupBaseEtrogBatchData{
    - 1406 + + 492 +
    - + - require.Equal(t, expectedData, allData[uint64(5)]) +   + Transactions: []byte{},
    - 1407 + + 493 +
    - + -
    +   + ForcedGlobalExitRoot: [32]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32},
    - 1408 + + 494 +
    - + - // Force backup +   + ForcedTimestamp: 1000, //ForcedBatch
    - 1409 + +
     
    +
    + 657 +
    - + - _, err = tx.Exec(ctx, resetBatchesSQL) +   +
    - 1410 + + 658 +
    - + - require.NoError(t, err) +   + func setupGenericTest(t *testing.T) (*state.Genesis, *Config, *mocks) {
    - 1411 + + 659 +
    - + -
    +   + genesis := state.Genesis{
    - 1412 + + 660 +
    + - // Get batch 4 from backup + RollupBlockNumber: uint64(123456),
    - 1413 + + 661 +
    - + - batchNum = 4 +   + }
    - 1414 + + 662 +
    - + - data, err = testState.GetBatchL2DataByNumber(ctx, batchNum, tx) +   + cfg := Config{
    - 1415 + + 663 +
    - + - require.NoError(t, err) +   + SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
    - 1416 + +
     
    +
    + 759 +
    - + - assert.Nil(t, data) +   + transactions := []types.TransactionOrHash{}
    - 1417 + + 760 +
    - + -
    +   + for nBlock := 0; nBlock < howManyBlocks; nBlock++ {
    - 1418 + + 761 +
    - + - // Get batch 5 from backup +   + block := state.L2BlockRaw{
    - 1419 + + 762 +
    + - batchNum = 5 + DeltaTimestamp: 123,
    - 1420 + + 763 +
    + - actualData, err = testState.GetBatchL2DataByNumber(ctx, batchNum, tx) + IndexL1InfoTree: 456,
    - 1421 + + 764 +
    + - require.NoError(t, err) + Transactions: []state.L2TxRaw{},
    - 1422 + + -
    - + - assert.Equal(t, expectedData, actualData) +
    +
    +   +
    - 1423 + + -
    - + +
    +
    +  
    - 1424 + + 765 +
    - + - // Update batch 5 and get it from backup +   + }
    - 1425 + + 766 +
    - + - expectedData = []byte("new foo bar") +   + for i := 0; i < howManyTx; i++ {
    - 1426 + + 767 +
    - + - _, err = tx.Exec(ctx, openBatchSQL, batchNum, expectedData) +   + tx := createTransaction(uint64(i + 1))
    - 1427 + +
     
    +
    + 921 +
    - + - require.NoError(t, err) +   +
    - 1428 + + 922 +
    - + - _, err = tx.Exec(ctx, resetBatchesSQL) +   + func TestReorg(t *testing.T) {
    - 1429 + + 923 +
    - + - require.NoError(t, err) +   + genesis := state.Genesis{
    - 1430 + + 924 +
    + - actualData, err = testState.GetBatchL2DataByNumber(ctx, batchNum, tx) + RollupBlockNumber: uint64(0),
    - 1431 + + 925 +
    - + - require.NoError(t, err) +   + }
    - 1432 + + 926 +
    - + - assert.Equal(t, expectedData, actualData) +   + cfg := Config{
    - 1433 + + 927 +
    - + - } +   + SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
    - 1434 + +
     
    +
    + 1241 +
    - + +  
    - 1435 + + 1242 +
    - + - func TestGetBatchL2DataByNumbers(t *testing.T) { +   + func TestLatestSyncedBlockEmpty(t *testing.T) {
    - 1436 + + 1243 +
    - + - initOrResetDB() +   + genesis := state.Genesis{
    - 1437 + + 1244 +
    + - ctx := context.Background() + RollupBlockNumber: uint64(0),
    - 1438 + + 1245 +
    - + - tx, err := testState.BeginStateTransaction(ctx) +   + }
    - 1439 + + 1246 +
    - + - require.NoError(t, err) +   + cfg := Config{
    - 1440 + + 1247 +
    - + - defer func() { require.NoError(t, tx.Commit(ctx)) }() +   + SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
    - 1441 + +
     
    +
    + 1455 +
    - + +  
    - 1442 + + 1456 +
    - + - var i1, i2, i3, i4, i5 = uint64(1), uint64(2), uint64(3), uint64(4), uint64(5) +   + func TestRegularReorg(t *testing.T) {
    - 1443 + + 1457 +
    - + - var d1, d2, d4 = []byte("foobar"), []byte("dingbat"), []byte{0xb} +   + genesis := state.Genesis{
    - 1444 + + 1458 +
    + -
    + RollupBlockNumber: uint64(0),
    - 1445 + + 1459 +
    - + - const insertBatch = "INSERT INTO state.batch (batch_num, raw_txs_data) VALUES ($1, $2)" +   + }
    - 1446 + + 1460 +
    - + - _, err = tx.Exec(ctx, insertBatch, i1, d1) +   + cfg := Config{
    - 1447 + + 1461 +
    - + - require.NoError(t, err) +   + SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
    - 1448 + +
     
    +
    + 1737 +
    - + - _, err = tx.Exec(ctx, insertBatch, i2, d2) +   +
    - 1449 + + 1738 +
    - + - require.NoError(t, err) +   + func TestLatestSyncedBlockEmptyWithExtraReorg(t *testing.T) {
    - 1450 + + 1739 +
    - + - _, err = tx.Exec(ctx, insertBatch, i3, nil) +   + genesis := state.Genesis{
    - 1451 + + 1740 +
    + - require.NoError(t, err) + RollupBlockNumber: uint64(0),
    - 1452 + + 1741 +
    - + -
    +   + }
    - 1453 + + 1742 +
    - + - // Add a forced batch too, needs a block +   + cfg := Config{
    - 1454 + + 1743 +
    - + - block1 := *block +   + SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
    - 1455 + +
     
    +
    + 2013 +
    - + - block1.BlockNumber = 1000 +   +
    - 1456 + + 2014 +
    - + - err = testState.AddBlock(ctx, &block1, tx) +   + func TestCallFromEmptyBlockAndReorg(t *testing.T) {
    - 1457 + + 2015 +
    - + - require.NoError(t, err) +   + genesis := state.Genesis{
    - 1458 + + 2016 +
    + - err = tx.Commit(ctx) + RollupBlockNumber: uint64(0),
    - 1459 + + 2017 +
    - + - require.NoError(t, err) +   + }
    - 1460 + + 2018 +
    - + -
    +   + cfg := Config{
    - 1461 + + 2019 +
    - + - tx, err = testState.BeginStateTransaction(ctx) +   + SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
    - 1462 + + 2020 +
    - + - require.NoError(t, err) +   + SyncChunkSize: 3,
    - 1463 + + 2021 +
    - + -
    +   + L1SynchronizationMode: SequentialMode,
    - 1464 + + 2022 +
    - + - const insertForcedBatch = "INSERT INTO state.forced_batch (forced_batch_num, timestamp, raw_txs_data, block_num) VALUES (4, now(),'0b', 1000)" +   + SyncBlockProtection: "latest",
    - 1465 + 2023
    + - _, err = testState.Exec(ctx, insertForcedBatch) + L1BlockCheck: L1BlockCheckConfig{
    - 1466 + 2024
    + - require.NoError(t, err) + Enable: false,
    - 1467 + 2025
    + -
    + },
    - 1468 + + 2026 +
    - + - allData, err := testState.GetBatchL2DataByNumbers(ctx, []uint64{i1, i2, i3, i4, i5}, tx) +   + }
    - 1469 + + 2027 +
    - + - require.NoError(t, err) +   +
    - 1470 + + 2028 +
    - + - assert.Equal(t, d1, allData[i1]) +   + m := mocks{
    - 1471 + +
     
    +
    + 2128 +
    - + - assert.Equal(t, d2, allData[i2]) +   + Return(ethHeader2bis, nil).
    - 1472 + + 2129 +
    - + - assert.Nil(t, allData[i3]) +   + Once()
    - 1473 + + 2130 +
    - + - assert.Equal(t, d4, allData[i4]) +   +
    - 1474 + 2131
    + -
    + // m.Etherman.
    - 1475 + 2132
    + - _, ok := allData[i5] + // On("EthBlockByNumber", ctx, lastBlock1.BlockNumber).
    - 1476 + 2133
    + - assert.False(t, ok) + // Return(ethBlock1, nil).
    - 1477 + 2134
    + - } + // Once()
    - 1478 + 2135
    @@ -110872,437 +304434,450 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 1479 + 2136
      - func createL1InfoTreeExitRootStorageEntryForTest(blockNumber uint64, index uint32) *state.L1InfoTreeExitRootStorageEntry { + ti := time.Date(2024, 1, 1, 1, 0, 0, 0, time.UTC)
    - 1480 + 2137
      - exitRoot := state.L1InfoTreeExitRootStorageEntry{ +
    - 1481 + 2138
      - L1InfoTreeLeaf: state.L1InfoTreeLeaf{ + ethermanBlock0 := etherman.Block{
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/contracts/auto/customModExp.sol + RENAMED + +
    +
    +
    +
    + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +
    -
     
    +
    @@ -0,0 +1,24 @@
    - 1677 + + -
    +
    +
      - require.Equal(t, uint64(2002), fb.BlockNumber) +
    - 1678 + + -
    +
    +
      - require.Equal(t, "0x717e05de47a87a7d1679e183f1c224150675f6302b7da4eaab526b2b91ae0761", fb.GlobalExitRoot.String()) +
    - 1679 + + -
    +
    +
      - require.Equal(t, []byte{0xb}, fb.RawTxsData) -
    -
    - 1680 - -
    - +
    - 1681 + + -
    - + - fbData, err := testState.GetBatchL2DataByNumber(ctx, 1, dbTx) +
    +
    +   +
    - 1682 + + -
    - + - require.NoError(t, err) +
    +
    +   +
    - 1683 + + -
    - + - require.Equal(t, []byte{0xb}, fbData) +
    +
    +   +
    - 1684 + + -
    +
    +
      - } +
    - 1685 + + -
    +
    +
     
    - 1686 + + -
    +
    +
      - func TestGetLastGER(t *testing.T) { +
    -
     
    -
    - 1757 + + -
    +
    +
      - ger, err = testState.GetLatestBatchGlobalExitRoot(ctx, dbTx) +
    - 1758 + + -
    +
    +
      - require.NoError(t, err) +
    - 1759 + + -
    +
    +
      - require.Equal(t, common.HexToHash("0x2").String(), ger.String()) +
    - 1760 + + -
    - + - } +
    +
    +   +
    - 1761 + + -
    +
    +
     
    - 1762 + + -
    - + - func TestGetFirstUncheckedBlock(t *testing.T) { +
    +
    +   +
    - 1763 + + -
    - + - var err error +
    +
    +   +
    - 1764 + + -
    - + - blockNumber := uint64(51001) +
    +
    +   +
    - 1765 + + -
    - + - err = testState.AddBlock(context.Background(), &state.Block{BlockNumber: blockNumber, Checked: true}, nil) +
    +
    +   +
    - 1766 + + -
    - + - require.NoError(t, err) +
    +
    +   +
    - 1767 + + -
    - + - err = testState.AddBlock(context.Background(), &state.Block{BlockNumber: blockNumber + 1, Checked: false}, nil) +
    +
    +   +
    - 1768 + + -
    - + - require.NoError(t, err) +
    +
    +   +
    - 1769 + + -
    - + - err = testState.AddBlock(context.Background(), &state.Block{BlockNumber: blockNumber + 2, Checked: true}, nil) +
    +
    +   +
    - 1770 + + -
    - + - require.NoError(t, err) +
    +
    +   +
    - 1771 + + -
    - + +
    +
    +  
    - 1772 - -
    - + - block, err := testState.GetFirstUncheckedBlock(context.Background(), blockNumber, nil) +
    +
    +
    +
    + + + + + - - - @@ -111427,12 +304992,12 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    +
    {/home/stefan/go/src/Polygon/zkevm-node → .}/state/reset.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/docker-compose.yml RENAMED
    - - - - - - + + + + + + + + + + + + + + + - - - - - + - + + - - - - - - - - -
    +
     
    - 1773 + 1
    + - require.NoError(t, err) + // SPDX-License-Identifier: MIT
    - 1774 + 2
    + - require.Equal(t, uint64(blockNumber+1), block.BlockNumber) + pragma solidity >=0.7.0 <0.9.0;
    - 1775 + 3
    + - } +
    - 1776 + 4
    + -
    + contract customModExp {
    - 1777 + 5
    + - func TestUpdateCheckedBlockByNumber(t *testing.T) { + bytes32 hashResult;
    - 1778 + 6
    + - var err error + address retEcrecover;
    - 1779 + 7
    + - blockNumber := uint64(54001) + bytes dataResult;
    - 1780 + 8
    + - err = testState.AddBlock(context.Background(), &state.Block{BlockNumber: blockNumber, Checked: true}, nil) + uint256 dataRes;
    - 1781 + 9
    + - require.NoError(t, err) +
    - 1782 + 10
    + - err = testState.AddBlock(context.Background(), &state.Block{BlockNumber: blockNumber + 1, Checked: false}, nil) + bytes32[10] arrayStorage;
    - 1783 + 11
    + - require.NoError(t, err) +
    - 1784 + 12
    + - err = testState.AddBlock(context.Background(), &state.Block{BlockNumber: blockNumber + 2, Checked: true}, nil) + function modExpGeneric(bytes memory input) public {
    - 1785 + 13
    + - require.NoError(t, err) + bytes32[10] memory output;
    - 1786 + 14
    @@ -111312,111 +304887,101 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 1787 + 15
    + - b1, err := testState.GetBlockByNumber(context.Background(), uint64(blockNumber), nil) + assembly {
    - 1788 + 16
    + - require.NoError(t, err) + let success := staticcall(gas(), 0x05, add(input, 32), mload(input), output, 0x140)
    - 1789 + 17
    + - require.True(t, b1.Checked) + sstore(0x00, success)
    - 1790 + 18
    + -
    + }
    - 1791 + 19
    + - err = testState.UpdateCheckedBlockByNumber(context.Background(), uint64(blockNumber), false, nil) +
    - 1792 + 20
    + - require.NoError(t, err) + for (uint i = 0; i < 10; i++) {
    - 1793 + 21
    + -
    + arrayStorage[i] = output[i];
    - 1794 + 22
    + - b1, err = testState.GetBlockByNumber(context.Background(), uint64(blockNumber), nil) + }
    - 1795 + 23
    + - require.NoError(t, err) + }
    - 1796 + 24
    + - require.False(t, b1.Checked) -
    -
    - 1797 - -
    -   }
    -
    @@ -13,12 +14,14 @@
    +
    @@ -2,7 +2,7 @@
    - 13 + 2
      - // - VerifiedBatches + networks:
    - 14 + 3
      - // - Entries in exit_root table + default:
    - 15 + 4
      - err := s.ResetToL1BlockNumber(ctx, blockNumber, dbTx) + name: zkevm
    - 16 + 5
    - - if err == nil { +
    - 17 + + 6 +
    - - - // Discard L1InfoTree cache +   + services:
    - 18 + + 7 +
    - - - // We can't rebuild cache, because we are inside a transaction, so we dont known +   + grafana:
    - 19 + + 8 + +
    +   + container_name: grafana +
    +
    +
    @@ -453,9 +453,7 @@
    +
    + 453 + +
    +   +
    +
    +
    + 454 + +
    +   + zkevm-mock-l1-network: +
    +
    + 455 + +
    +   + container_name: zkevm-mock-l1-network +
    +
    + 456 +
    - - // is going to be a commit or a rollback. So is going to be rebuild on the next + # This image contains the contracts upgraded to Feijoa, disabled
    - 20 + 457
    - - // request that needs it. + image: hermeznetwork/geth-zkevm-contracts:elderberry-fork.9-geth1.13.11
    - 21 + 458
    - - s.l1InfoTree = nil + # image: hermeznetwork/geth-zkevm-contracts:v2.1.3-fork.8-geth1.12.0
    - 22 + 459
      - } + ports:
    - 23 + + 460 +
    - - - return err +   + - 8545:8545
    - + + 461 -
    +
    +
      -
    + - 8546:8546
    - + +
    @@ -515,15 +513,14 @@
    -
    +
    + 515 + +
     
    - + + 516 -
    +
    +
      -
    + zkevm-prover:
    - + + 517 -
    +
    +
      -
    + container_name: zkevm-prover
    - + + 518 -
    -   -
    +
    +
    + - + #image: hermeznetwork/zkevm-prover:v7.0.0-RC4
    - 24 + 519
      - } + image: hermeznetwork/zkevm-prover:v6.0.0
    -
    -
    -
    -
    - - - - - - - - - - - - - @@ -111725,191 +305326,177 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - + - + + - - - - - - - - -
    -
     
    -
    - 14 + 520
      - // - VerifiedBatches + ports:
    - 15 + 521
      - // - Entries in exit_root table + - 50061:50061 # MT
    - 16 + 522
      - err := s.ResetToL1BlockNumber(ctx, blockNumber, dbTx) + - 50071:50071 # Executor
    - 17 + + 523 +
    - + - if err != nil { + - + environment:
    - 18 + + 524 +
    - + - log.Error("error resetting L1BlockNumber. Error: ", err) + - + - EXPERIMENTAL_DOCKER_DESKTOP_FORCE_QEMU=1
    - 19 + + 525 +
    - + - return err +   + volumes:
    - + + 526 -
    +
    +
      -
    + - ./config/test.prover.config.json:/usr/src/app/config.json
    - 20 + 527
      - } + command: >
    - 21 + + 528 +
    - + - // Discard L1InfoTree cache +   + zkProver -c /usr/src/app/config.json
    - 22 + + 529 +
    - + - // We can't rebuild cache, because we are inside a transaction, so we dont known +   +
    - 23 + +
    @@ -607,17 +604,16 @@
    +
    + 607 +
    - + - // is going to be a commit or a rollback. So is going to be rebuild on the next +   +
    - 24 + + 608 +
    - + - // request that needs it. +   + zkevm-permissionless-prover:
    - 25 + + 609 +
    - + - s.l1InfoTree = nil +   + container_name: zkevm-permissionless-prover
    - 26 + + 610 +
    - + - return nil + - + #image: hermeznetwork/zkevm-prover:v7.0.0-RC4
    - 27 + 611
      - } + image: hermeznetwork/zkevm-prover:v6.0.0
    -
    + + + 612 + + +
    +   + ports:
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/state/runtime/executor/client.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - @@ -111934,245 +305521,142 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - -
    -
    @@ -10,6 +10,13 @@
    - 10 + 613
      - "google.golang.org/grpc/credentials/insecure" + # - 50058:50058 # Prover
    - 11 + 614
      - ) + - 50059:50052 # Mock prover
    - 12 + 615
      -
    + - 50068:50061 # MT
    - + + 616 -
    +
    +
      -
    + - 50078:50071 # Executor
    - + + 617 -
    -   -
    +
    +
    + - + environment:
    - + + 618 -
    -   -
    +
    +
    + - + - EXPERIMENTAL_DOCKER_DESKTOP_FORCE_QEMU=1
    - + + 619 -
    +
    +
      -
    + volumes:
    - + + 620 -
    +
    +
      -
    + - ./config/test.permissionless.prover.config.json:/usr/src/app/config.json
    - 13 + 621
      - // NewExecutorClient is the executor client constructor. + command: >
    - 14 + 622
      - func NewExecutorClient(ctx context.Context, c Config) (ExecutorServiceClient, *grpc.ClientConn, context.CancelFunc) { + zkProver -c /usr/src/app/config.json
    - 15 + 623
      - opts := []grpc.DialOption{ +
    -
    -
    -
    -
    - - - + - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    +
    @@ -636,7 +632,7 @@
    - 10 + 636
      - "google.golang.org/grpc/credentials/insecure" + zkevm-sh:
    - 11 + 637
      - ) + container_name: zkevm-sh
    - 12 + 638
      -
    -
    -
    - 13 - -
    - + - const ( -
    -
    - 14 - -
    - + - // ExecutionMode0 is the execution mode for the sequencer and RPC, default one -
    -
    - 15 - -
    - + - ExecutionMode0 = uint64(0) -
    -
    - 16 - -
    - + - // ExecutionMode1 is the execution mode for the synchronizer -
    -
    - 17 - -
    - + - ExecutionMode1 = uint64(1) -
    -
    - 18 - -
    - + - ) + image: zkevm-node
    - 19 + + 639 +
    - + -
    + - + stdin_open: true
    - 20 + 640
      - // NewExecutorClient is the executor client constructor. + tty: true
    - 21 + 641
      - func NewExecutorClient(ctx context.Context, c Config) (ExecutorServiceClient, *grpc.ClientConn, context.CancelFunc) { + environment:
    - 22 + 642
      - opts := []grpc.DialOption{ + - ZKEVM_NODE_STATE_DB_HOST=zkevm-state-db
    -
    -
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/state/trace.go - RENAMED - -
    -
    -
    -
    - - - + - - - @@ -112256,371 +305740,123 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - -
    -
    @@ -78,7 +78,15 @@
    +
    @@ -646,3 +642,51 @@
    - 78 + 646
      - var effectivePercentage []uint8 + - ./config/test.genesis.config.json:/app/genesis.json
    - 79 + 647
      - for i := 0; i <= count; i++ { + command:
    - 80 + 648
      - txsToEncode = append(txsToEncode, *l2Block.Transactions()[i]) -
    -
    - 81 - -
    - - - effectivePercentage = append(effectivePercentage, MaxEffectivePercentage) + - "/bin/sh"
    - 82 - -
    -   - log.Debugf("trace will reprocess tx: %v", l2Block.Transactions()[i].Hash().String()) -
    -
    - 83 - -
    -   - } -
    -
    - 84 + + -
    +
    +
     
    -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    -
    - 78 - -
    -   - var effectivePercentage []uint8 -
    -
    - 79 - -
    -   - for i := 0; i <= count; i++ { -
    -
    - 80 - -
    -   - txsToEncode = append(txsToEncode, *l2Block.Transactions()[i]) -
    -
    - 81 - -
    - + - txGasPrice := tx.GasPrice() -
    -
    - 82 - -
    - + - effectiveGasPrice := receipt.EffectiveGasPrice -
    -
    - 83 - -
    - + - egpPercentage, err := CalculateEffectiveGasPricePercentage(txGasPrice, effectiveGasPrice) -
    -
    - 84 - -
    - + - if errors.Is(err, ErrEffectiveGasPriceEmpty) { -
    -
    - 85 - -
    - + - egpPercentage = MaxEffectivePercentage -
    -
    - 86 - -
    - + - } else if err != nil { -
    -
    - 87 - -
    - + - return nil, err -
    -
    - 88 - -
    - + - } -
    -
    - 89 - -
    - + - effectivePercentage = append(effectivePercentage, egpPercentage) -
    -
    - 90 - -
    -   - log.Debugf("trace will reprocess tx: %v", l2Block.Transactions()[i].Hash().String()) -
    -
    - 91 - -
    -   - } -
    -
    - 92 + + -
    +
    +
     
    -
    -
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/state/transaction.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -112634,93 +305870,93 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - @@ -112734,43 +305970,43 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - @@ -112804,68 +306040,63 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - @@ -112879,33 +306110,33 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - @@ -112924,82 +306155,72 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - @@ -113009,7 +306230,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - + + + @@ -113139,52 +306365,42 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - @@ -113209,72 +306425,72 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - @@ -113284,161 +306500,112 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - -
    -
    @@ -509,8 +509,7 @@
    -
    - 509 - -
    -   - } -
    -
    - 510 - -
    -   - nonce := loadedNonce.Uint64() -
    -
    - 511 + + -
    +
    +
     
    - 512 - -
    - - - deltaTimestamp := uint32(uint64(time.Now().Unix()) - l2Block.Time()) -
    -
    - 513 - -
    - - - transactions := s.BuildChangeL2Block(deltaTimestamp, uint32(0)) -
    -
    - 514 + + -
    +
    +
     
    - 515 + + -
    +
    +
      - batchL2Data, err := EncodeUnsignedTransaction(*tx, s.cfg.ChainID, &nonce, forkID) +
    - 516 + + -
    +
    +
      - if err != nil { +
    -
    @@ -535,22 +534,24 @@
    -
    - 535 + + -
    +
    +
     
    - 536 + + -
    +
    +
      - // v2 fields +
    - 537 + + -
    +
    +
      - L1InfoRoot: l2Block.BlockInfoRoot().Bytes(), +
    - 538 + + -
    - - - TimestampLimit: uint64(time.Now().Unix()), +
    +
    +   +
    - 539 + + -
    +
    +
      - SkipFirstChangeL2Block: cFalse, +
    - 540 + + -
    +
    +
      - SkipWriteBlockInfoRoot: cTrue, +
    - 541 + + -
    +
    +
      - } +
    - 542 + + -
    +
    +
      - if noZKEVMCounters { +
    - 543 + + -
    +
    +
      - processBatchRequestV2.NoCounters = cTrue +
    - 544 + + -
    +
    +
      - } +
    - 545 + + -
    +
    +
     
    - 546 + + -
    - - - log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.From]: %v", processBatchRequestV2.From) +
    +
    +   +
    - 547 + + -
    +
    +
      - log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.OldBatchNum]: %v", processBatchRequestV2.OldBatchNum) +
    - 548 + + -
    +
    +
      - log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.OldStateRoot]: %v", hex.EncodeToHex(processBatchRequestV2.OldStateRoot)) +
    - 549 + + -
    +
    +
      - log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.OldAccInputHash]: %v", hex.EncodeToHex(processBatchRequestV2.OldAccInputHash)) +
    - 550 + + -
    +
    +
      - log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.Coinbase]: %v", processBatchRequestV2.Coinbase) +
    - 551 + + -
    - - - log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.ForkId]: %v", processBatchRequestV2.ForkId) +
    +
    +   +
    - 552 + + -
    - - - log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.ChainId]: %v", processBatchRequestV2.ChainId) +
    +
    +   +
    - 553 + + -
    +
    +
      - log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.UpdateMerkleTree]: %v", processBatchRequestV2.UpdateMerkleTree) +
    - 554 + + -
    +
    +
      - log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.ContextId]: %v", processBatchRequestV2.ContextId) +
    - 555 + + -
    +
    +
     
    - 556 + + -
    +
    +
      - log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.L1InfoRoot]: %v", hex.EncodeToHex(processBatchRequestV2.L1InfoRoot)) +
    -
    @@ -1015,6 +1016,7 @@
    -
    - 1015 + + -
    +
    +
      - TimestampLimit: uint64(time.Now().Unix()), +
    - 1016 + + -
    +
    +
      - SkipFirstChangeL2Block: cTrue, +
    - 1017 + + -
    +
    +
      - SkipWriteBlockInfoRoot: cTrue, +
    - 1018 + + -
    +
    +
      - } +
    - 1019 + + -
    +
    +
     
    - 1020 + + -
    +
    +
      - log.Debugf("EstimateGas[processBatchRequestV2.From]: %v", processBatchRequestV2.From) +
    - 509 + 2
      - } + networks:
    - 510 + 3
      - nonce := loadedNonce.Uint64() + default:
    - 511 + 4
      -
    + name: zkevm
    - 512 + 5
    + - transactions := s.BuildChangeL2Block(uint32(0), uint32(0)) -
    -
    - - -
    -  
    - 513 + 6
      -
    + services:
    - 514 + 7
      - batchL2Data, err := EncodeUnsignedTransaction(*tx, s.cfg.ChainID, &nonce, forkID) + grafana:
    - 515 + 8
      - if err != nil { + container_name: grafana
    - 534 + 453
    @@ -113019,112 +306240,117 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 535 + 454
      - // v2 fields + zkevm-mock-l1-network:
    - 536 + 455
      - L1InfoRoot: l2Block.BlockInfoRoot().Bytes(), + container_name: zkevm-mock-l1-network
    - 537 + 456
    + - TimestampLimit: l2Block.Time(), + image: 0xpolygon/cdk-validium-contracts:elderberry-fork.9-geth1.13.11
    - 538 + + -
    +
    +
      - SkipFirstChangeL2Block: cFalse, +
    - 539 + + -
    +
    +
      - SkipWriteBlockInfoRoot: cTrue, +
    - 540 + + 457 +
    - + - ExecutionMode: executor.ExecutionMode0, +   + ports:
    - 541 + 458
      - } + - 8545:8545
    - 542 + 459
      - if noZKEVMCounters { + - 8546:8546
    +
     
    +
    - 543 + 513
      - processBatchRequestV2.NoCounters = cTrue +
    - 544 + 514
      - } + zkevm-prover:
    - 545 + 515
      -
    + container_name: zkevm-prover
    - 546 + 516
      - log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.OldBatchNum]: %v", processBatchRequestV2.OldBatchNum) + image: hermeznetwork/zkevm-prover:v6.0.0
    - 547 + 517
      - log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.OldStateRoot]: %v", hex.EncodeToHex(processBatchRequestV2.OldStateRoot)) + ports:
    - 548 + 518
      - log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.OldAccInputHash]: %v", hex.EncodeToHex(processBatchRequestV2.OldAccInputHash)) -
    -
    - 549 - -
    - + -
    + - 50061:50061 # MT
    - 550 + 519
      - log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.Coinbase]: %v", processBatchRequestV2.Coinbase) + - 50071:50071 # Executor
    - 551 + 520
      - log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.UpdateMerkleTree]: %v", processBatchRequestV2.UpdateMerkleTree) + volumes:
    - 552 + + 521 +
    - + - log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.ChainId]: %v", processBatchRequestV2.ChainId) +   + - ./config/test.prover.config.json:/usr/src/app/config.json
    - 553 + 522
    + - log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.ForkId]: %v", processBatchRequestV2.ForkId) + environment:
    - 554 + 523
    + - log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.From]: %v", processBatchRequestV2.From) + - EXPERIMENTAL_DOCKER_DESKTOP_FORCE_QEMU=1
    - 555 + 524
      - log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.ContextId]: %v", processBatchRequestV2.ContextId) + command: >
    - 556 + 525
      -
    + zkProver -c /usr/src/app/config.json
    - 557 + 526
      - log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.L1InfoRoot]: %v", hex.EncodeToHex(processBatchRequestV2.L1InfoRoot)) +
    - 1016 + 604
      - TimestampLimit: uint64(time.Now().Unix()), +
    - 1017 + 605
      - SkipFirstChangeL2Block: cTrue, + zkevm-permissionless-prover:
    - 1018 + 606
      - SkipWriteBlockInfoRoot: cTrue, -
    -
    - 1019 - -
    - + - ExecutionMode: executor.ExecutionMode0, + container_name: zkevm-permissionless-prover
    - 1020 + + -
    +
    +
      - } +
    - 1021 + 607
      -
    + image: hermeznetwork/zkevm-prover:v6.0.0
    - 1022 + 608
      - log.Debugf("EstimateGas[processBatchRequestV2.From]: %v", processBatchRequestV2.From) -
    -
    -
    + ports:
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/check_l2block.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - @@ -113453,696 +306620,692 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - + - - - - - - - - -
    -
    @@ -6,9 +6,9 @@
    - 6 + 609
      - "fmt" + # - 50058:50058 # Prover
    - 7 + 610
      - "math/big" + - 50059:50052 # Mock prover
    - 8 + 611
      -
    -
    -
    - 9 - -
    - - - "github.com/0xPolygonHermez/zkevm-node/jsonrpc/types" + - 50068:50061 # MT
    - 10 + 612
      - "github.com/0xPolygonHermez/zkevm-node/log" + - 50078:50071 # Executor
    - 11 + + -
    +
    +
      - "github.com/0xPolygonHermez/zkevm-node/state" +
    - 12 + 613
      - "github.com/jackc/pgx/v4" + volumes:
    - 13 + 614
      - ) + - ./config/test.permissionless.prover.config.json:/usr/src/app/config.json
    - 14 + + 615 +
    -   -
    + + + environment:
    -
    @@ -129,11 +129,14 @@
    -
    - 129 + + 616 +
    -   - } + + + - EXPERIMENTAL_DOCKER_DESKTOP_FORCE_QEMU=1
    - 130 + 617
      -
    + command: >
    - 131 + 618
      - func compareL2Blocks(prefixLogs string, localL2Block *state.L2Block, trustedL2Block *types.Block) error { -
    -
    - 132 - -
    - - - if localL2Block == nil || trustedL2Block == nil || trustedL2Block.Hash == nil { + zkProver -c /usr/src/app/config.json
    - 133 + + 619 +
    - - - return fmt.Errorf("%s localL2Block or trustedL2Block or trustedHash are nil", prefixLogs) -
    -
    - - -
     
    - - -
    -   -
    -
    +
    +
     
    - + + 632 -
    +
    +
      -
    + zkevm-sh:
    - 134 + 633
      - } + container_name: zkevm-sh
    - 135 + + 634 +
    - - - if localL2Block.Hash() != *trustedL2Block.Hash { +   + image: zkevm-node
    - 136 + + 635 +
    - - - return fmt.Errorf("%s localL2Block.Hash %s and trustedL2Block.Hash %s are different", prefixLogs, localL2Block.Hash().String(), (*trustedL2Block.Hash).String()) + + + stdin_open: true
    - 137 + 636
      - } + tty: true
    - 138 + 637
      - return nil + environment:
    - 139 + 638
      - } + - ZKEVM_NODE_STATE_DB_HOST=zkevm-state-db
    -
    -
    -
    -
    - - - + - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - -
     
    - 6 + 642
      - "fmt" + - ./config/test.genesis.config.json:/app/genesis.json
    - 7 + 643
      - "math/big" + command:
    - 8 + 644
      -
    + - "/bin/sh"
    - + + 645 -
    -   +
    +
    + +
    - 9 + + 646 +
    -   - "github.com/0xPolygonHermez/zkevm-node/log" + + + zkevm-node-forced-DAC:
    - 10 + + 647 +
    -   - "github.com/0xPolygonHermez/zkevm-node/state" + + + container_name: zkevm-node-forced-DAC
    - 11 + 648
    + - "github.com/ethereum/go-ethereum/core/types" + image: zkevm-node
    - 12 + + 649 +
    -   - "github.com/jackc/pgx/v4" + + + ports:
    - 13 + + 650 +
    -   - ) + + + - 8125:8125
    - 14 + + 651 +
    -   -
    + + + environment:
    -
     
    +
    + 652 + +
    + + + - ZKEVM_NODE_ISTRUSTEDSEQUENCER=false +
    - 129 + + 653 +
    -   - } + + + - ZKEVM_NODE_STATEDB_USER=test_user
    - 130 + + 654 +
    -   -
    + + + - ZKEVM_NODE_STATEDB_PASSWORD=test_password
    - 131 + + 655 +
    -   - func compareL2Blocks(prefixLogs string, localL2Block *state.L2Block, trustedL2Block *types.Block) error { + + + - ZKEVM_NODE_STATEDB_NAME=state_db
    - 132 + + 656 +
    + - if localL2Block == nil || trustedL2Block == nil { + - ZKEVM_NODE_STATEDB_HOST=zkevm-permissionless-db
    - 133 + + 657 +
    + - return fmt.Errorf("%s localL2Block or trustedL2Block are nil", prefixLogs) + - ZKEVM_NODE_POOL_DB_USER=test_user
    - 134 + 658
    + - } + - ZKEVM_NODE_POOL_DB_PASSWORD=test_password
    - 135 + 659
    + - if localL2Block.Hash() != trustedL2Block.Hash() { + - ZKEVM_NODE_POOL_DB_NAME=pool_db
    - 136 + 660
    + - return fmt.Errorf("%s localL2Block.Hash %s and trustedL2Block.Hash %s are different", prefixLogs, localL2Block.Hash().String(), trustedL2Block.Hash().String()) + - ZKEVM_NODE_POOL_DB_HOST=zkevm-permissionless-db
    - 137 + + 661 +
    -   - } + + + - ZKEVM_NODE_RPC_PORT=8125
    - 138 + + 662 +
    + - if localL2Block.ParentHash() != trustedL2Block.ParentHash() { + - ZKEVM_NODE_RPC_SEQUENCERNODEURI=http://zkevm-node-json-rpc:8123
    - 139 + + 663 +
    + - return fmt.Errorf("%s localL2Block.ParentHash %s and trustedL2Block.ParentHash %s are different", prefixLogs, localL2Block.ParentHash().String(), trustedL2Block.ParentHash().String()) + - ZKEVM_NODE_SYNCHRONIZER_TRUSTEDSEQUENCERURL=http://you-cant-touch-this:8123
    - 140 + + 664 +
    -   - } + + + - ZKEVM_NODE_MTCLIENT_URI=zkevm-permissionless-prover:50061
    - 141 + + 665 +
    -   - return nil + + + - ZKEVM_NODE_EXECUTOR_URI=zkevm-permissionless-prover:50071
    - 142 + + 666 +
    -   - } + + + volumes:
    -
    + + + 667 + + +
    + + + - ./config/test.node.config.toml:/app/config.toml
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/check_l2block_test.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - + + +
    -
    @@ -19,7 +18,7 @@
    - 19 + + 668 +
    -   - type CheckL2BlocksTestData struct { + + + - ./config/test.genesis.config.json:/app/genesis.json
    - 20 + + 669 +
    -   - sut *actions.CheckL2BlockHash + + + command:
    - 21 + + 670 +
    -   - mockState *mock_syncinterfaces.StateFullInterface + + + - "/bin/sh"
    - 22 + + 671 +
    - - - zKEVMClient *mock_syncinterfaces.ZKEVMClientInterface + + + - "-c"
    - 23 + + 672 +
    -   - } + + + - "/app/zkevm-node run --network custom --custom-network-file /app/genesis.json --cfg /app/config.toml --components \"rpc,synchronizer\""
    - 24 + + 673 +
    -   + +
    - 25 + + 674 +
    -   - func TestCheckL2BlockHash_GetMinimumL2BlockToCheck(t *testing.T) { + + + zkevm-data-node-db:
    -
    @@ -57,7 +56,7 @@
    +
    + 675 + +
    + + + container_name: zkevm-data-node-db +
    - 57 + + 676 +
    -   - func newCheckL2BlocksTestData(t *testing.T, initialL2Block, modulus uint64) CheckL2BlocksTestData { + + + restart: unless-stopped
    - 58 + + 677 +
    -   - res := CheckL2BlocksTestData{ + + + image: postgres
    - 59 + + 678 +
    -   - mockState: mock_syncinterfaces.NewStateFullInterface(t), + + + healthcheck:
    - 60 + + 679 +
    - - - zKEVMClient: mock_syncinterfaces.NewZKEVMClientInterface(t), + + + test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
    - 61 + + 680 +
    -   - } + + + interval: 10s
    - 62 + + 681 +
    -   - res.sut = actions.NewCheckL2BlockHash(res.mockState, res.zKEVMClient, initialL2Block, modulus) + + + timeout: 5s
    - 63 + + 682 +
    -   - return res + + + retries: 5
    -
    @@ -97,18 +96,23 @@
    +
    + 683 + +
    + + + ports: +
    +
    + 684 + +
    + + + - 5444:5432 +
    - 97 + + 685 +
    -   -
    + + + environment:
    - 98 + + 686 +
    -   - data.mockState.EXPECT().GetLastL2BlockNumber(mock.Anything, mock.Anything).Return(lastL2Block, nil) + + + - POSTGRES_USER=committee_user
    - 99 + + 687 +
    -   - data.mockState.EXPECT().GetL2BlockByNumber(mock.Anything, lastL2Block, mock.Anything).Return(stateBlock, nil) + + + - POSTGRES_PASSWORD=committee_password
    - 100 + + 688 +
    - - - l2blockHash := stateBlock.Hash() + + + - POSTGRES_DB=committee_db
    - 101 + + 689 +
    - - - rpcL2Block := rpctypes.Block{ + + + command:
    - 102 + + 690 +
    - - - Hash: &l2blockHash, + + + - "postgres"
    - 103 + + 691 +
    - - - Number: rpctypes.ArgUint64(lastL2Block), + + + - "-N"
    - 104 + + 692 +
    - - - } + + + - "500" +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/datacommittee_test.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -114390,724 +307548,661 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - -
    +
    @@ -0,0 +1,270 @@
    @@ -114195,188 +307358,183 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 105 + + -
    +
    +
     
    - 106 + + -
    - - - data.zKEVMClient.EXPECT().BlockByNumber(mock.Anything, lastL2BlockBigInt).Return(&rpcL2Block, nil) +
    +
    +   +
    - 107 + + -
    +
    +
      - err := data.sut.CheckL2Block(context.Background(), nil) +
    - 108 + + -
    +
    +
      - require.NoError(t, err) +
    - 109 + + -
    +
    +
      - } +
    - 110 + + -
    +
    +
     
    - 111 + + -
    - - - func TestCheckL2BlockHashMissmatch(t *testing.T) { +
    +
    +   +
    - 112 + + -
    +
    +
      - data := newCheckL2BlocksTestData(t, 1, 10) +
    - 113 + + -
    +
    +
      - lastL2Block := uint64(14) +
    - 114 + + -
    +
    +
      - lastL2BlockBigInt := big.NewInt(int64(lastL2Block)) +
    -
    @@ -119,13 +123,14 @@
    -
    - 119 + + -
    +
    +
     
    - 120 + + -
    +
    +
      - data.mockState.EXPECT().GetLastL2BlockNumber(mock.Anything, mock.Anything).Return(lastL2Block, nil) +
    - 121 + + -
    +
    +
      - data.mockState.EXPECT().GetL2BlockByNumber(mock.Anything, lastL2Block, mock.Anything).Return(stateBlock, nil) +
    - 122 + + -
    - - - l2blockHash := common.HexToHash("0x1234") +
    +
    +   +
    - 123 + + -
    - - - rpcL2Block := rpctypes.Block{ +
    +
    +   +
    - 124 + + -
    - - - Hash: &l2blockHash, +
    +
    +   +
    - 125 + + -
    - - - Number: rpctypes.ArgUint64(lastL2Block), +
    +
    +   +
    - 126 + + -
    - - - } +
    +
    +   +
    - 127 + + -
    +
    +
     
    - 128 + + -
    - - - data.zKEVMClient.EXPECT().BlockByNumber(mock.Anything, lastL2BlockBigInt).Return(&rpcL2Block, nil) +
    +
    +   +
    - 129 + + -
    +
    +
      - err := data.sut.CheckL2Block(context.Background(), nil) +
    - 130 + + -
    +
    +
      - require.Error(t, err) +
    - 131 + + -
    +
    +
      - } -
    -
    -
    +
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    - 18 + + -
    +
    +
      - type CheckL2BlocksTestData struct { +
    - 19 + + -
    +
    +
      - sut *actions.CheckL2BlockHash +
    - 20 + + -
    +
    +
      - mockState *mock_syncinterfaces.StateFullInterface +
    - 21 + + -
    - + - zKEVMClient *mock_syncinterfaces.ZKEVMClientEthereumCompatibleInterface +
    +
    +   +
    - 22 + + -
    +
    +
      - } +
    - 23 + + -
    +
    +
     
    - 24 + + -
    +
    +
      - func TestCheckL2BlockHash_GetMinimumL2BlockToCheck(t *testing.T) { +
    -
     
    -
    - 56 + + -
    +
    +
      - func newCheckL2BlocksTestData(t *testing.T, initialL2Block, modulus uint64) CheckL2BlocksTestData { +
    - 57 + + -
    +
    +
      - res := CheckL2BlocksTestData{ +
    - 58 + + -
    +
    +
      - mockState: mock_syncinterfaces.NewStateFullInterface(t), +
    - 59 + + -
    - + - zKEVMClient: mock_syncinterfaces.NewZKEVMClientEthereumCompatibleInterface(t), +
    +
    +   +
    - 60 + + -
    +
    +
      - } +
    - 61 + + -
    +
    +
      - res.sut = actions.NewCheckL2BlockHash(res.mockState, res.zKEVMClient, initialL2Block, modulus) +
    - 62 + + -
    +
    +
      - return res +
    -
     
    -
    - 96 + + -
    +
    +
     
    - 97 + + -
    +
    +
      - data.mockState.EXPECT().GetLastL2BlockNumber(mock.Anything, mock.Anything).Return(lastL2Block, nil) +
    - 98 + + -
    +
    +
      - data.mockState.EXPECT().GetL2BlockByNumber(mock.Anything, lastL2Block, mock.Anything).Return(stateBlock, nil) +
    - 99 + + -
    - + - //l2blockHash := stateBlock.Hash() +
    +
    +   +
    - 100 + + -
    - + - // rpcL2Block := rpctypes.Block{ +
    +
    +   +
    - 101 + + -
    - + - // Hash: &l2blockHash, +
    +
    +   +
    - 102 + + -
    - + - // Number: rpctypes.ArgUint64(lastL2Block), +
    +
    +   +
    - 103 + + -
    - + - // } +
    +
    +   +
    - 104 + + -
    - + - // create a types.Block object +
    +
    +   +
    - 105 + + -
    - + +
    +
    +  
    - 106 + + -
    - + - rpcL2Block := types.NewBlock(&types.Header{ +
    +
    +   +
    - 107 + + -
    - + - Number: big.NewInt(int64(lastL2Block)), +
    +
    +   +
    - 108 + + -
    - + - }, nil, nil, nil, nil) +
    +
    +   +
    - 109 + + -
    +
    +
     
    - 110 + + -
    - + - data.zKEVMClient.EXPECT().BlockByNumber(mock.Anything, lastL2BlockBigInt).Return(rpcL2Block, nil) +
    +
    +   +
    - 111 + + -
    +
    +
      - err := data.sut.CheckL2Block(context.Background(), nil) +
    - 112 + + -
    +
    +
      - require.NoError(t, err) +
    - 113 + + -
    +
    +
      - } +
    - 114 + + -
    +
    +
     
    - 115 + + -
    - + - func TestCheckL2BlockHashMismatch(t *testing.T) { +
    +
    +   +
    - 116 + + -
    +
    +
      - data := newCheckL2BlocksTestData(t, 1, 10) +
    - 117 + + -
    +
    +
      - lastL2Block := uint64(14) +
    - 118 + + -
    +
    +
      - lastL2BlockBigInt := big.NewInt(int64(lastL2Block)) +
    -
     
    -
    - 123 + + -
    +
    +
     
    - 124 + + -
    +
    +
      - data.mockState.EXPECT().GetLastL2BlockNumber(mock.Anything, mock.Anything).Return(lastL2Block, nil) +
    - 125 + + -
    +
    +
      - data.mockState.EXPECT().GetL2BlockByNumber(mock.Anything, lastL2Block, mock.Anything).Return(stateBlock, nil) +
    - 126 + + -
    - + - //l2blockHash := common.HexToHash("0x1234") +
    +
    +   +
    - 127 + + -
    - + +
    +
    +  
    - 128 + + -
    - + - rpcL2Block := types.NewBlock(&types.Header{ +
    +
    +   +
    - 129 + + -
    - + - Number: big.NewInt(int64(lastL2Block)), +
    +
    +   +
    - 130 + + -
    - + - ParentHash: common.HexToHash("0x1234"), +
    +
    +   +
    - 131 + + -
    - + - }, nil, nil, nil, nil) +
    +
    +   +
    - 132 + + -
    +
    +
     
    - 133 + + -
    - + - data.zKEVMClient.EXPECT().BlockByNumber(mock.Anything, lastL2BlockBigInt).Return(rpcL2Block, nil) +
    +
    +   +
    - 134 + + -
    +
    +
      - err := data.sut.CheckL2Block(context.Background(), nil) +
    - 135 + + -
    +
    +
      - require.Error(t, err) +
    - 136 + + -
    +
    +
      - } -
    -
    -
    +
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/elderberry/processor_l1_sequence_batches.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -115163,567 +308258,553 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    @@ -3,7 +3,6 @@
    - 3 + + -
    +
    +
      - import ( +
    - 4 + + -
    +
    +
      - "context" +
    - 5 + + -
    +
    +
      - "errors" +
    - 6 + + -
    - - - "fmt" +
    +
    +   +
    - 7 + + -
    +
    +
      - "time" +
    - 8 + + -
    +
    +
     
    - 9 + + -
    +
    +
      - "github.com/0xPolygonHermez/zkevm-node/etherman" +
    -
    @@ -60,58 +59,12 @@
    -
    - 60 + + -
    +
    +
     
    - 61 + + -
    +
    +
      - sbatch := l1Block.SequencedBatches[order.Pos][0] +
    - 62 + + -
    +
    +
     
    @@ -115123,33 +308218,33 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 63 + + -
    +
    +
      - if sbatch.SequencedBatchElderberryData == nil { +
    - 64 + + -
    - - - log.Errorf("No elderberry sequenced batch data for batch %d", sbatch.BatchNumber) +
    +
    +   +
    - 65 + + -
    - - - return fmt.Errorf("no elderberry sequenced batch data for batch %d", sbatch.BatchNumber) +
    +
    +   +
    - 66 + + -
    +
    +
      - } +
    - 67 + + -
    - - - // We need to check that the sequence match +
    +
    +   +
    - 68 + + -
    - - - err := g.sanityCheckExpectedSequence(sbatch.SequencedBatchElderberryData.InitSequencedBatchNumber, dbTx) +
    +
    +   +
    - 69 + + -
    - - - if err != nil { +
    +
    +   +
    - 70 + + -
    - - - return err +
    +
    +   +
    - 71 + + -
    - - - } +
    +
    +   +
    - 72 + + -
    - - - // We known that the MaxSequenceTimestamp is the same for all the batches so we can use the first one +
    +
    +   +
    - 73 + + -
    - - - err = g.previousProcessor.ProcessSequenceBatches(ctx, l1Block.SequencedBatches[order.Pos], l1Block.BlockNumber, time.Unix(int64(sbatch.SequencedBatchElderberryData.MaxSequenceTimestamp), 0), dbTx) +
    +
    +   +
    - 74 + + -
    - - - // The last L2block timestamp must match MaxSequenceTimestamp +
    +
    +   +
    - 75 + + -
    - - - if err != nil { +
    +
    +   +
    - 76 + + -
    - - - return err +
    +
    +   +
    - 77 + + -
    - - - } +
    +
    +   +
    - 78 + + -
    - - - // It checks the timestamp of the last L2 block, but it's just log an error instead of refusing the event +
    +
    +   +
    - 79 + + -
    - - - _ = g.sanityCheckTstampLastL2Block(sbatch.SequencedBatchElderberryData.MaxSequenceTimestamp, dbTx) +
    +
    +   +
    - 80 + + -
    - - - return nil +
    +
    +   +
    - 81 + + -
    - - - } +
    +
    +   +
    - 82 + + -
    - - +
    +
    +  
    - 83 + + -
    - - - func (g *ProcessorL1SequenceBatchesElderberry) sanityCheckExpectedSequence(initialBatchNumber uint64, dbTx pgx.Tx) error { +
    +
    +   +
    - 84 + + -
    - - - // We need to check that the sequence match +
    +
    +   +
    - 85 + + -
    - - - lastVirtualBatchNum, err := g.state.GetLastVirtualBatchNum(context.Background(), dbTx) +
    +
    +   +
    - 86 + + -
    - - - if err != nil { +
    +
    +   +
    - 87 + + -
    - - - log.Errorf("Error getting last virtual batch number: %s", err) +
    +
    +   +
    - 88 + + -
    - - - return err +
    +
    +   +
    - 89 + + -
    - - - } +
    +
    +   +
    - 90 + + -
    - - - if lastVirtualBatchNum != initialBatchNumber { +
    +
    +   +
    - 91 + + -
    - - - log.Errorf("The last virtual batch number is not the expected one. Expected: %d (last on DB), got: %d (L1 event)", lastVirtualBatchNum+1, initialBatchNumber) +
    +
    +   +
    - 92 + + -
    - - - return fmt.Errorf("the last virtual batch number is not the expected one. Expected: %d (last on DB), got: %d (L1 event) err:%w", lastVirtualBatchNum+1, initialBatchNumber, ErrInvalidInitialBatchNumber) +
    +
    +   +
    - 93 + + -
    - - - } +
    +
    +   +
    - 94 + + -
    - - - return nil +
    +
    +   +
    - 95 + + -
    - - - } +
    +
    +   +
    - 96 + + -
    +
    +
     
    - 97 + + -
    - - - func (g *ProcessorL1SequenceBatchesElderberry) sanityCheckTstampLastL2Block(timeLimit uint64, dbTx pgx.Tx) error { +
    +
    +   +
    - 98 + + -
    - - - lastVirtualBatchNum, err := g.state.GetLastVirtualBatchNum(context.Background(), dbTx) +
    +
    +   +
    - 99 + + -
    - - - if err != nil { +
    +
    +   +
    - 100 + + -
    - - - log.Errorf("Error getting last virtual batch number: %s", err) +
    +
    +   +
    - 101 + + -
    - - - return err +
    +
    +   +
    - 102 + + -
    - - - } +
    +
    +   +
    - 103 + + -
    - - - lastL2Block, err := g.state.GetLastL2BlockByBatchNumber(context.Background(), lastVirtualBatchNum, dbTx) +
    +
    +   +
    - 104 + + -
    - - - if err != nil { +
    +
    +   +
    - 105 + + -
    - - - log.Errorf("Error getting last virtual batch number: %s", err) +
    +
    +   +
    - 106 + + -
    - - - return err +
    +
    +   +
    - 107 + + -
    - - - } +
    +
    +   +
    - 108 + + -
    - - - if lastL2Block == nil { +
    +
    +   +
    - 109 + + -
    - - - //TODO: find the previous batch until we find a L2 block to check the timestamp +
    +
    +   +
    - 110 + + -
    - - - return nil +
    +
    +   +
    - 111 + + -
    - - - } +
    +
    +   +
    - 112 + + -
    - - - if uint64(lastL2Block.ReceivedAt.Unix()) > timeLimit { +
    +
    +   +
    - 113 + + -
    - - - log.Errorf("The last L2 block timestamp can't be greater than timeLimit. Expected: %d (L1 event), got: %d (last L2Block)", timeLimit, lastL2Block.ReceivedAt.Unix()) +
    +
    +   +
    - 114 + + -
    - - - return fmt.Errorf("wrong timestamp of last L2 block timestamp with L1 event timestamp") +
    +
    +   +
    - 115 + + -
    - - - } +
    +
    +   +
    - 116 + + -
    - - - return nil +
    +
    +   +
    - 117 + + -
    +
    +
      - } -
    -
    -
    +
    -
    -
    - - - - - - - - - - - @@ -115737,128 +308818,123 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -116152,23 +309228,23 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - @@ -116362,255 +309438,203 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - -
    -
     
    - 3 + + -
    +
    +
      - import ( +
    - 4 + + -
    +
    +
      - "context" +
    - 5 + + -
    +
    +
      - "errors" +
    - 6 + + -
    +
    +
      - "time" +
    - 7 + + -
    +
    +
     
    - 8 + + -
    +
    +
      - "github.com/0xPolygonHermez/zkevm-node/etherman" +
    -
     
    -
    - 59 + + -
    +
    +
     
    - 60 + + -
    +
    +
      - sbatch := l1Block.SequencedBatches[order.Pos][0] +
    - 61 + + -
    +
    +
     
    - 62 + + -
    - + - executionTime := l1Block.ReceivedAt +
    +
    +   +
    - 63 + + -
    +
    +
      - if sbatch.SequencedBatchElderberryData == nil { +
    - 64 + + -
    - + - log.Warnf("No elderberry sequenced batch data for batch %d", sbatch.BatchNumber) +
    +
    +   +
    - 65 + + -
    - + - } else { +
    +
    +   +
    - 66 + + -
    - + - executionTime = time.Unix(int64(sbatch.SequencedBatchElderberryData.MaxSequenceTimestamp), 0) +
    +
    +   +
    - 67 + + -
    +
    +
      - } +
    - 68 + + -
    +
    +
     
    - 69 + + -
    - + - return g.previousProcessor.ProcessSequenceBatches(ctx, l1Block.SequencedBatches[order.Pos], l1Block.BlockNumber, executionTime, dbTx) +
    +
    +   +
    - 70 + + -
    +
    +
      - } -
    -
    -
    +
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/etrog/processor_l1_sequence_batches.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -
    @@ -391,7 +391,7 @@
    - 391 + + -
    +
    +
      - reason := reorgReasons.String() +
    - 392 + + -
    +
    +
     
    - 393 + + -
    +
    +
      - if p.sync.IsTrustedSequencer() { +
    - 394 + + -
    - - - log.Errorf("TRUSTED REORG DETECTED! Batch: %d reson:%s", batch.BatchNumber, reason) +
    +
    +   +
    - 395 + + -
    +
    +
      - // Halt function never have to return! it must blocks the process +
    - 396 + + -
    +
    +
      - p.halt(ctx, fmt.Errorf("TRUSTED REORG DETECTED! Batch: %d", batch.BatchNumber)) +
    - 397 + + -
    +
    +
      - log.Errorf("CRITICAL!!!: Never have to execute this code. Halt function never have to return! it must blocks the process") +
    -
    + + + + + +
    +   +
    -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -
     
    - 391 + + -
    +
    +
      - reason := reorgReasons.String() +
    - 392 + + -
    +
    +
     
    - 393 + + -
    +
    +
      - if p.sync.IsTrustedSequencer() { +
    - 394 + + -
    - + - log.Errorf("TRUSTED REORG DETECTED! Batch: %d reason:%s", batch.BatchNumber, reason) +
    +
    +   +
    - 395 + + -
    +
    +
      - // Halt function never have to return! it must blocks the process +
    - 396 + + -
    +
    +
      - p.halt(ctx, fmt.Errorf("TRUSTED REORG DETECTED! Batch: %d", batch.BatchNumber)) +
    - 397 + + -
    +
    +
      - log.Errorf("CRITICAL!!!: Never have to execute this code. Halt function never have to return! it must blocks the process") +
    -
    -
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/common/syncinterfaces/state.go - RENAMED - -
    -
    -
    -
    - - - - - + + - - - - - - @@ -116634,157 +309658,144 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - -
    -
    @@ -29,6 +29,8 @@
    +
    + + +
    +   +
    +
    - 29 + + -
    +
    +
      - AddBlock(ctx context.Context, block *state.Block, dbTx pgx.Tx) error +
    - 30 + + -
    +
    +
      - Reset(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) error +
    - 31 + + -
    +
    +
      - GetPreviousBlock(ctx context.Context, offset uint64, dbTx pgx.Tx) (*state.Block, error) +
    - 32 + + -
    +
    +
      - GetLastBatchNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error) +
    - 33 + + -
    +
    +
      - GetBatchByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.Batch, error) +
    - 34 + + -
    +
    +
      - ResetTrustedState(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error +
    -
    + + + + + +
    +   +
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    - 29 + + -
    +
    +
      - AddBlock(ctx context.Context, block *state.Block, dbTx pgx.Tx) error +
    - 30 + + -
    +
    +
      - Reset(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) error +
    - 31 + + -
    +
    +
      - GetPreviousBlock(ctx context.Context, offset uint64, dbTx pgx.Tx) (*state.Block, error) +
    - 32 + + -
    - + - GetFirstUncheckedBlock(ctx context.Context, fromBlockNumber uint64, dbTx pgx.Tx) (*state.Block, error) +
    +
    +   +
    - 33 + + -
    - + - UpdateCheckedBlockByNumber(ctx context.Context, blockNumber uint64, newCheckedStatus bool, dbTx pgx.Tx) error +
    +
    +   +
    - 34 + + -
    +
    +
      - GetLastBatchNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error) +
    - 35 + + -
    +
    +
      - GetBatchByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.Batch, error) +
    - 36 + + -
    +
    +
      - ResetTrustedState(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error +
    -
    + + + + + +
    +   +
    +
    + + + + + + +
    +   +
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/common/syncinterfaces/zkevm_ethereum_compatible_client.go - RENAMED - -
    -
    -
    -
    - - - - - @@ -117057,7 +310068,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -117067,7 +310078,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -117077,7 +310088,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -117087,7 +310098,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -117097,7 +310108,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -117107,7 +310118,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -117117,7 +310128,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -117127,7 +310138,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -117137,7 +310148,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -117147,7 +310158,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -117157,7 +310168,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -117167,7 +310178,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -117177,7 +310188,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -117187,7 +310198,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -117197,7 +310208,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -117207,7 +310218,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -117217,2973 +310228,2851 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - -
    -
    @@ -0,0 +1,21 @@
    @@ -117017,7 +310028,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    + - package syncinterfaces + package e2e
    + - "math/big" + "crypto/ecdsa"
    + -
    + "encoding/json"
    + - "github.com/ethereum/go-ethereum/core/types" + "fmt"
    + - ) + "math/big"
    + -
    + "os"
    + - // ZKEVMClientEthereumCompatibleInterface contains the methods required to interact with zkEVM-RPC as a ethereum-API compatible + "os/exec"
    + - // + "sort"
    + - // Reason behind: the zkEVMClient have some extensions to ethereum-API that are not compatible with all nodes. So if you need to maximize + "strconv"
    + - // the compatibility the idea is to use a regular ethereum-API compatible client + "strings"
    + - type ZKEVMClientEthereumCompatibleInterface interface { + "testing"
    + - ZKEVMClientEthereumCompatibleL2BlockGetter + "time"
    + - } +
    + -
    + "github.com/0xPolygon/cdk-data-availability/config"
    + - // ZKEVMClientEthereumCompatibleL2BlockGetter contains the methods required to interact with zkEVM-RPC as a ethereum-API compatible for obtain Block information + cTypes "github.com/0xPolygon/cdk-data-availability/config/types"
    + - type ZKEVMClientEthereumCompatibleL2BlockGetter interface { + "github.com/0xPolygon/cdk-data-availability/db"
    + - BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error) + "github.com/0xPolygon/cdk-data-availability/rpc"
    + - } -
    -
    -
    + "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/polygondatacommittee"
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/config.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - -
    -
    @@ -13,6 +13,8 @@
    - 13 + + 22 +
    -   - SyncChunkSize uint64 `mapstructure:"SyncChunkSize"` + + + "github.com/0xPolygonHermez/zkevm-node/log"
    - 14 + + 23 +
    -   - // TrustedSequencerURL is the rpc url to connect and sync the trusted state + + + "github.com/0xPolygonHermez/zkevm-node/test/operations"
    - 15 + + 24 +
    -   - TrustedSequencerURL string `mapstructure:"TrustedSequencerURL"` + + + "github.com/ethereum/go-ethereum"
    - + + 25 -
    -   -
    +
    +
    + + + eTypes "github.com/ethereum/go-ethereum/core/types"
    - + + 26 -
    -   +
    +
    + +
    - 16 + + 27 +
    -   -
    + + + "github.com/ethereum/go-ethereum/accounts/keystore"
    - 17 + + 28 +
    -   - // L1SyncCheckL2BlockHash if is true when a batch is closed is force to check L2Block hash against trustedNode (only apply for permissionless) + + + "github.com/ethereum/go-ethereum/common"
    - 18 + + 29 +
    -   - L1SyncCheckL2BlockHash bool `mapstructure:"L1SyncCheckL2BlockHash"` + + + "github.com/ethereum/go-ethereum/crypto"
    -
    + + + 30 + + +
    + + + "github.com/ethereum/go-ethereum/ethclient"
    -
    -
    - - - - - - - - - - - - - - - - - - - -
    -
     
    - 13 + + 31 +
    -   - SyncChunkSize uint64 `mapstructure:"SyncChunkSize"` + + + "github.com/stretchr/testify/assert"
    - 14 + + 32 +
    -   - // TrustedSequencerURL is the rpc url to connect and sync the trusted state + + + "github.com/stretchr/testify/require"
    - 15 + + 33 +
    -   - TrustedSequencerURL string `mapstructure:"TrustedSequencerURL"` + + + )
    - 16 + 34
    + - // SyncBlockProtection specify the state to sync (lastest, finalized or safe) +
    - 17 + 35
    + - SyncBlockProtection string `mapstructure:"SyncBlockProtection"` + func TestDataCommittee(t *testing.T) {
    - 18 + + 36 +
    -   -
    + + + const (
    - 19 + + 37 +
    -   - // L1SyncCheckL2BlockHash if is true when a batch is closed is force to check L2Block hash against trustedNode (only apply for permissionless) + + + nSignatures = 4
    - 20 + + 38 +
    -   - L1SyncCheckL2BlockHash bool `mapstructure:"L1SyncCheckL2BlockHash"` + + + mMembers = 5
    -
    + + + 39 + + +
    + + + ksFile = "/tmp/pkey"
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l1_parallel_sync/l1_worker_etherman_test.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -
    @@ -31,7 +31,7 @@
    - 31 + + 40 +
    -   - GlobalExitRootManagerAddr: common.HexToAddress("0x8A791620dd6260079BF849Dc5567aDC3F2FdC318"), + + + cfgFile = "/tmp/dacnodeconfigfile.json"
    - 32 + + 41 +
    -   - } + + + ksPass = "pass"
    - 33 + + 42 +
    -   -
    + + + dacNodeContainer = "hermeznetwork/cdk-data-availability:v0.0.4"
    - 34 + + 43 +
    - - - ethermanClient, err := etherman.NewClient(cfg, l1Config) + + + )
    - 35 + + 44 +
    -   - require.NoError(t, err) + + +
    - 36 + + 45 +
    -   - worker := newWorker(ethermanClient) + + + // Setup
    - 37 + + 46 +
    -   - ch := make(chan responseRollupInfoByBlockRange) + + + var err error
    -
    + + + 47 + + +
    + + + if testing.Short() {
    -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -
     
    - 31 + + 48 +
    -   - GlobalExitRootManagerAddr: common.HexToAddress("0x8A791620dd6260079BF849Dc5567aDC3F2FdC318"), + + + t.Skip()
    - 32 + + 49 +
    -   + + }
    - 33 + + 50 +
    -   -
    + + + ctx := context.Background()
    - 34 + + 51 +
    + - ethermanClient, err := etherman.NewClient(cfg, l1Config, nil) + defer func() {
    - 35 + + 52 +
    -   - require.NoError(t, err) + + + require.NoError(t, operations.Teardown())
    - 36 + + 53 +
    -   - worker := newWorker(ethermanClient) + + + }()
    - 37 + + 54 +
    -   - ch := make(chan responseRollupInfoByBlockRange) -
    -
    -
    + + + err = operations.Teardown()
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l2_sync/l2_sync_etrog/executor_trusted_batch_sync.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - -
    -
    @@ -136,13 +137,13 @@
    - 136 + + 55 +
    -   - return nil, err + + + require.NoError(t, err)
    - 137 + + 56 +
    -   - } + + + opsCfg := operations.GetDefaultOperationsConfig()
    - 138 + + 57 +
    -   -
    + + + opsCfg.State.MaxCumulativeGasUsed = 80000000000
    - 139 + + 58 +
    - - - leafs, l1InfoRoot, _, err := b.state.GetL1InfoTreeDataFromBatchL2Data(ctx, data.TrustedBatch.BatchL2Data, dbTx) + + + opsman, err := operations.NewManager(ctx, opsCfg)
    - 140 + + 59 +
    -   - if err != nil { + + + require.NoError(t, err)
    - 141 + + 60 +
    -   - log.Errorf("%s error getting GetL1InfoTreeDataFromBatchL2Data: %v. Error:%w", data.DebugPrefix, l1InfoRoot, err) + + + defer func() {
    - 142 + + 61 +
    -   - return nil, err + + + require.NoError(t, opsman.StopDACDB())
    - 143 + + 62 +
    -   - } + + + }()
    - 144 + + 63 +
    -   - debugStr := data.DebugPrefix + + + err = opsman.Setup()
    - 145 + + 64 +
    - - - processBatchResp, err := b.processAndStoreTxs(ctx, b.getProcessRequest(data, leafs, l1InfoRoot), dbTx, debugStr) + + + require.NoError(t, err)
    - 146 + + 65 +
    -   - if err != nil { + + + require.NoError(t, opsman.StartDACDB())
    - 147 + + 66 +
    -   - log.Error("%s error procesingAndStoringTxs. Error: ", debugStr, err) + + + time.Sleep(5 * time.Second)
    - 148 + + 67 +
    -   - return nil, err + + + authL2, err := operations.GetAuth(operations.DefaultSequencerPrivateKey, operations.DefaultL2ChainID)
    -
    @@ -197,7 +198,7 @@
    -
    - 197 + + 68 +
    -   - return nil, err + + + require.NoError(t, err)
    - 198 + + 69 +
    -   - } + + + authL1, err := operations.GetAuth(operations.DefaultSequencerPrivateKey, operations.DefaultL1ChainID)
    - 199 + + 70 +
    -   -
    + + + require.NoError(t, err)
    - 200 + + 71 +
    - - - leafs, l1InfoRoot, _, err := b.state.GetL1InfoTreeDataFromBatchL2Data(ctx, PartialBatchL2Data, dbTx) + + + clientL2, err := ethclient.Dial(operations.DefaultL2NetworkURL)
    - 201 + + 72 +
    -   - if err != nil { + + + require.NoError(t, err)
    - 202 + + 73 +
    -   - log.Errorf("%s error getting GetL1InfoTreeDataFromBatchL2Data: %v. Error:%w", data.DebugPrefix, l1InfoRoot, err) + + + clientL1, err := ethclient.Dial(operations.DefaultL1NetworkURL)
    - 203 + + 74 +
    -   - // TODO: Need to refine, depending of the response of GetL1InfoTreeDataFromBatchL2Data + + + require.NoError(t, err)
    -
    @@ -205,7 +206,7 @@
    +
    + 75 + +
    + + + dacSC, err := polygondatacommittee.NewPolygondatacommittee( +
    - 205 + + 76 +
    -   - return nil, syncinterfaces.ErrMissingSyncFromL1 + + + common.HexToAddress(operations.DefaultL1DataCommitteeContract),
    - 206 + + 77 +
    -   - } + + + clientL1,
    - 207 + + 78 +
    -   - debugStr := fmt.Sprintf("%s: Batch %d:", data.Mode, uint64(data.TrustedBatch.Number)) + + + )
    - 208 + + 79 +
    - - - processReq := b.getProcessRequest(data, leafs, l1InfoRoot) + + + require.NoError(t, err)
    - 209 + + 80 +
    -   - processReq.Transactions = PartialBatchL2Data + + +
    - 210 + + 81 +
    -   - processBatchResp, err := b.processAndStoreTxs(ctx, processReq, dbTx, debugStr) + + + // Register committee with N / M signatures
    - 211 + + 82 +
    -   - if err != nil { + + + membs := members{}
    -
    @@ -429,6 +430,7 @@
    +
    + 83 + +
    + + + addrsBytes := []byte{} +
    - 429 + + 84 +
    -   - Transactions: data.TrustedBatch.BatchL2Data, + + + urls := []string{}
    - 430 + + 85 +
    -   - ForkID: b.state.GetForkIDByBatchNumber(uint64(data.TrustedBatch.Number)), + + + for i := 0; i < mMembers; i++ {
    - 431 + + 86 +
    -   - SkipVerifyL1InfoRoot_V2: true, + + + pk, err := crypto.GenerateKey()
    - + + 87 -
    -   -
    +
    +
    + + + require.NoError(t, err)
    - 432 + + 88 +
    -   - } + + + membs = append(membs, member{
    - 433 + + 89 +
    -   - return request + + + addr: crypto.PubkeyToAddress(pk.PublicKey),
    - 434 + + 90 +
    -   - } + + + pk: pk,
    -
    + + + 91 + + +
    + + + url: fmt.Sprintf("http://cdk-data-availability-%d:420%d", i, i),
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    - 137 + + 92 +
    -   - return nil, err + + + i: i,
    - 138 + + 93 +
    -   - } + + + })
    - 139 + + 94 +
    -   -
    + + + }
    - 140 + + 95 +
    + - leaves, l1InfoRoot, _, err := b.state.GetL1InfoTreeDataFromBatchL2Data(ctx, data.TrustedBatch.BatchL2Data, dbTx) + sort.Sort(membs)
    - 141 + + 96 +
    -   - if err != nil { + + + for _, m := range membs {
    - 142 + + 97 +
    -   - log.Errorf("%s error getting GetL1InfoTreeDataFromBatchL2Data: %v. Error:%w", data.DebugPrefix, l1InfoRoot, err) + + + addrsBytes = append(addrsBytes, m.addr.Bytes()...)
    - 143 + + 98 +
    -   - return nil, err + + + urls = append(urls, m.url)
    - 144 + + 99 +
    -   + + }
    - 145 + + 100 +
    -   - debugStr := data.DebugPrefix + + + tx, err := dacSC.SetupCommittee(authL1, big.NewInt(nSignatures), urls, addrsBytes)
    - 146 + + 101 +
    + - processBatchResp, err := b.processAndStoreTxs(ctx, b.getProcessRequest(data, leaves, l1InfoRoot), dbTx, debugStr) + for _, m := range membs {
    - 147 + + 102 +
    -   - if err != nil { + + + fmt.Println(m.addr)
    - 148 + + 103 +
    -   - log.Error("%s error procesingAndStoringTxs. Error: ", debugStr, err) + + + }
    - 149 + + 104 +
    -   - return nil, err + + + require.NoError(t, err)
    -
     
    -
    - 198 + + 105 +
    -   - return nil, err + + + err = operations.WaitTxToBeMined(ctx, clientL1, tx, operations.DefaultTimeoutTxToBeMined)
    - 199 + + 106 +
    -   - } + + + require.NoError(t, err)
    - 200 + + 107 +
    -   + +
    - 201 + + 108 +
    + - leaves, l1InfoRoot, _, err := b.state.GetL1InfoTreeDataFromBatchL2Data(ctx, PartialBatchL2Data, dbTx) + // Spin up M DAC nodes
    - 202 + + 109 +
    -   - if err != nil { + + + dacNodeConfig := config.Config{
    - 203 + + 110 +
    -   - log.Errorf("%s error getting GetL1InfoTreeDataFromBatchL2Data: %v. Error:%w", data.DebugPrefix, l1InfoRoot, err) + + + L1: config.L1Config{
    - 204 + + 111 +
    -   - // TODO: Need to refine, depending of the response of GetL1InfoTreeDataFromBatchL2Data + + + RpcURL: "http://zkevm-mock-l1-network:8545",
    -
     
    -
    - 206 + + 112 +
    -   - return nil, syncinterfaces.ErrMissingSyncFromL1 + + + WsURL: "ws://zkevm-mock-l1-network:8546",
    - 207 + + 113 +
    -   - } + + + PolygonValidiumAddress: operations.DefaultL1ZkEVMSmartContract,
    - 208 + + 114 +
    -   - debugStr := fmt.Sprintf("%s: Batch %d:", data.Mode, uint64(data.TrustedBatch.Number)) + + + DataCommitteeAddress: operations.DefaultL1DataCommitteeContract,
    - 209 + + 115 +
    + - processReq := b.getProcessRequest(data, leaves, l1InfoRoot) + Timeout: cTypes.Duration{Duration: time.Second},
    - 210 + + 116 +
    -   - processReq.Transactions = PartialBatchL2Data + + + RetryPeriod: cTypes.Duration{Duration: time.Second},
    - 211 + + 117 +
    -   - processBatchResp, err := b.processAndStoreTxs(ctx, processReq, dbTx, debugStr) + + + },
    - 212 + + 118 +
    -   - if err != nil { + + + PrivateKey: cTypes.KeystoreFileConfig{
    -
     
    -
    - 430 + + 119 +
    -   - Transactions: data.TrustedBatch.BatchL2Data, + + + Path: ksFile,
    - 431 + + 120 +
    -   - ForkID: b.state.GetForkIDByBatchNumber(uint64(data.TrustedBatch.Number)), + + + Password: ksPass,
    - 432 + + 121 +
    -   - SkipVerifyL1InfoRoot_V2: true, + + + },
    - 433 + 122
    + - ExecutionMode: executor.ExecutionMode1, + DB: db.Config{
    - 434 + + 123 +
    -   - } + + + Name: "committee_db",
    - 435 + + 124 +
    -   - return request + + + User: "committee_user",
    - 436 + + 125 +
    -   - } -
    -
    -
    + + + Password: "committee_password",
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l2_sync/l2_sync_incaberry/sync_trusted_state.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -
    @@ -196,6 +196,7 @@
    - 196 + + 126 +
    -   - OldAccInputHash: batches[1].AccInputHash, + + + Host: "zkevm-data-node-db",
    - 197 + + 127 +
    -   - Coinbase: common.HexToAddress(trustedBatch.Coinbase.String()), + + + Port: "5432",
    - 198 + + 128 +
    -   - Timestamp_V1: time.Unix(int64(trustedBatch.Timestamp), 0), + + + EnableLog: false,
    - + + 129 -
    -   -
    +
    +
    + + + MaxConns: 10,
    - 199 + + 130 +
    -   - } + + + },
    - 200 + + 131 +
    -   - // check if batch needs to be synchronized + + + RPC: rpc.Config{
    - 201 + + 132 +
    -   - if batches[0] != nil { -
    -
    -
    + + + Host: "0.0.0.0",
    -
    -
    - - - - - - - - - - - - - - - - - - - -
    -
     
    - 196 + + 133 +
    -   - OldAccInputHash: batches[1].AccInputHash, + + + MaxRequestsPerIPAndSecond: 100,
    - 197 + + 134 +
    -   - Coinbase: common.HexToAddress(trustedBatch.Coinbase.String()), + + + },
    - 198 + + 135 +
    -   - Timestamp_V1: time.Unix(int64(trustedBatch.Timestamp), 0), + + + }
    - 199 + 136
    + - ExecutionMode: executor.ExecutionMode1, + defer func() {
    - 200 + + 137 +
    -   - } + + + // Remove tmp files
    - 201 + + 138 +
    -   - // check if batch needs to be synchronized + + + assert.NoError(t,
    - 202 + + 139 +
    -   - if batches[0] != nil { -
    -
    -
    + + + exec.Command("rm", cfgFile).Run(),
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/synchronizer.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +
    -
    @@ -22,6 +22,7 @@
    - 22 + + 140 +
    -   - "github.com/0xPolygonHermez/zkevm-node/synchronizer/l2_sync/l2_sync_etrog" + + + )
    - 23 + + 141 +
    -   - "github.com/0xPolygonHermez/zkevm-node/synchronizer/metrics" + + + assert.NoError(t,
    - 24 + + 142 +
    -   - "github.com/ethereum/go-ethereum/common" + + + exec.Command("rmdir", ksFile+"_").Run(),
    - + + 143 -
    -   -
    +
    +
    + + + )
    - 25 + + 144 +
    -   - "github.com/jackc/pgx/v4" + + + assert.NoError(t,
    - 26 + + 145 +
    -   - ) + + + exec.Command("rm", ksFile).Run(),
    - 27 + + 146 +
    -   -
    + + + )
    -
    @@ -52,17 +53,19 @@
    -
    - 52 + + 147 +
    -   - etherMan syncinterfaces.EthermanFullInterface + + + // Stop DAC nodes
    - 53 + + 148 +
    -   - latestFlushID uint64 + + + for i := 0; i < mMembers; i++ {
    - 54 + + 149 +
    -   - // If true the lastFlushID is stored in DB and we don't need to check again + + + assert.NoError(t, exec.Command(
    - 55 + + 150 +
    - - - latestFlushIDIsFulfilled bool + + + "docker", "kill", "cdk-data-availability-"+strconv.Itoa(i),
    - 56 + + 151 +
    - - - etherManForL1 []syncinterfaces.EthermanFullInterface + + + ).Run())
    - 57 + + 152 +
    - - - state syncinterfaces.StateFullInterface + + + assert.NoError(t, exec.Command(
    - 58 + + 153 +
    - - - pool syncinterfaces.PoolInterface + + + "docker", "rm", "cdk-data-availability-"+strconv.Itoa(i),
    - 59 + + 154 +
    - - - ethTxManager syncinterfaces.EthTxManager + + + ).Run())
    - 60 + + 155 +
    - - - zkEVMClient syncinterfaces.ZKEVMClientInterface + + + }
    - 61 + + 156 +
    - - - eventLog syncinterfaces.EventLogInterface + + + // Stop permissionless node
    - 62 + + 157 +
    - - - ctx context.Context + + + require.NoError(t, opsman.StopPermissionlessNodeForcedToSYncThroughDAC())
    - 63 + + 158 +
    - - - cancelCtx context.CancelFunc + + + }()
    - 64 + + 159 +
    - - - genesis state.Genesis + + + // Start permissionless node
    - 65 + + 160 +
    - - - cfg Config + + + require.NoError(t, opsman.StartPermissionlessNodeForcedToSYncThroughDAC())
    - + + 161 -
    -   -
    +
    +
    + + + // Star DAC nodes
    - + + 162 -
    -   -
    +
    +
    + + + for _, m := range membs {
    - 66 + + 163 +
    -   - // Id of the 'process' of the executor. Each time that it starts this value changes + + + // Set correct port
    - 67 + + 164 +
    -   - // This value is obtained from the call state.GetStoredFlushID + + + port := 4200 + m.i
    - 68 + + 165 +
    -   - // It starts as an empty string and it is filled in the first call + + + dacNodeConfig.RPC.Port = port
    -
    @@ -85,30 +88,40 @@
    +
    + 166 + +
    + + + // Write config file +
    - 85 + + 167 +
    -   - pool syncinterfaces.PoolInterface, + + + file, err := json.MarshalIndent(dacNodeConfig, "", " ")
    - 86 + + 168 +
    -   - ethTxManager syncinterfaces.EthTxManager, + + + require.NoError(t, err)
    - 87 + + 169 +
    -   - zkEVMClient syncinterfaces.ZKEVMClientInterface, + + + err = os.WriteFile(cfgFile, file, 0644)
    - + + 170 -
    -   -
    +
    +
    + + + require.NoError(t, err)
    - 88 + + 171 +
    -   - eventLog syncinterfaces.EventLogInterface, + + + // Write private key keystore file
    - 89 + + 172 +
    -   - genesis state.Genesis, + + + err = createKeyStore(m.pk, ksFile, ksPass)
    - 90 + + 173 +
    -   - cfg Config, + + + require.NoError(t, err)
    - 91 + + 174 +
    -   - runInDevelopmentMode bool) (Synchronizer, error) { + + + // Run DAC node
    - 92 + + 175 +
    -   - ctx, cancel := context.WithCancel(context.Background()) + + + cmd := exec.Command(
    - 93 + + 176 +
    -   - metrics.Register() + + + "docker", "run", "-d",
    - + + 177 -
    -   -
    +
    +
    + + + "--name", "cdk-data-availability-"+strconv.Itoa(m.i),
    - + + 178 -
    -   -
    +
    +
    + + + "-v", cfgFile+":/app/config.json",
    - + + 179 -
    -   -
    +
    +
    + + + "-v", ksFile+":"+ksFile,
    - + + 180 -
    -   -
    +
    +
    + + + "--network", "zkevm",
    - + + 181 -
    -   -
    +
    +
    + + + dacNodeContainer,
    - + + 182 -
    -   -
    +
    +
    + + + "/bin/sh", "-c",
    - + + 183 -
    -   -
    +
    +
    + + + "/app/cdk-data-availability run --cfg /app/config.json",
    - 94 + + 184 +
    -   - res := &ClientSynchronizer{ + + + )
    - 95 + + 185 +
    - - - isTrustedSequencer: isTrustedSequencer, + + + out, err := cmd.CombinedOutput()
    - 96 + + 186 +
    - - - state: st, + + + require.NoError(t, err, string(out))
    - 97 + + 187 +
    - - - etherMan: ethMan, + + + log.Infof("DAC node %d started", m.i)
    - 98 + + 188 +
    - - - etherManForL1: etherManForL1, + + + time.Sleep(time.Second * 5)
    - 99 + + 189 +
    - - - pool: pool, + + + }
    - 100 + + 190 +
    - - - ctx: ctx, + + +
    - 101 + + 191 +
    - - - cancelCtx: cancel, + + + // Send txs
    - 102 + + 192 +
    - - - ethTxManager: ethTxManager, + + + nTxs := 10
    - 103 + + 193 +
    - - - zkEVMClient: zkEVMClient, + + + amount := big.NewInt(10000)
    - 104 + + 194 +
    - - - eventLog: eventLog, + + + toAddress := common.HexToAddress("0x70997970C51812dc3A010C7d01b50e0d17dc79C8")
    - 105 + + 195 +
    - - - genesis: genesis, + + + _, err = clientL2.BalanceAt(ctx, authL2.From, nil)
    - 106 + + 196 +
    - - - cfg: cfg, + + + require.NoError(t, err)
    - 107 + + 197 +
    - - - proverID: "", + + + _, err = clientL2.PendingNonceAt(ctx, authL2.From)
    - 108 + + 198 +
    - - - previousExecutorFlushID: 0, + + + require.NoError(t, err)
    - 109 + + 199 +
    - - - l1SyncOrchestration: nil, + + +
    - 110 + + 200 +
    - - - l1EventProcessors: nil, + + + gasLimit, err := clientL2.EstimateGas(ctx, ethereum.CallMsg{From: authL2.From, To: &toAddress, Value: amount})
    - 111 + + 201 +
    - - - halter: syncCommon.NewCriticalErrorHalt(eventLog, 5*time.Second), //nolint:gomnd + + + require.NoError(t, err)
    - + + 202 -
    -   +
    +
    + +
    - + + 203 -
    -   -
    +
    +
    + + + gasPrice, err := clientL2.SuggestGasPrice(ctx)
    - 112 + + 204 +
    -   - } + + + require.NoError(t, err)
    - 113 + + 205 +
    -   + +
    - 114 + + 206 +
    -   - if !isTrustedSequencer { + + + nonce, err := clientL2.PendingNonceAt(ctx, authL2.From)
    -
    @@ -143,7 +156,7 @@
    -
    - 143 + + 207 +
    -   - log.Errorf("error getting last L2Block number from state. Error: %v", err) + + + require.NoError(t, err)
    - 144 + + 208 +
    -   - return nil, err + + +
    - 145 + + 209 +
    -   - } + + + txs := make([]*eTypes.Transaction, 0, nTxs)
    - 146 + + 210 +
    - - - l1checkerL2Blocks = actions.NewCheckL2BlockHash(res.state, res.zkEVMClient, initialL2Block, cfg.L1SyncCheckL2BlockNumberhModulus) + + + for i := 0; i < nTxs; i++ {
    - 147 + + 211 +
    -   - } else { + + + tx := eTypes.NewTransaction(nonce+uint64(i), toAddress, amount, gasLimit, gasPrice, nil)
    - 148 + + 212 +
    -   - log.Infof("Trusted Node can't check L2Block hash, ignoring parameter") + + + log.Infof("generating tx %d / %d: %s", i+1, nTxs, tx.Hash().Hex())
    - 149 + + 213 +
    -   - } + + + txs = append(txs, tx)
    -
    @@ -163,6 +176,19 @@
    -
    - 163 + + 214 +
    -   - return res, nil + + + }
    - 164 + + 215 +
    -   - } + + +
    - 165 + + 216 +
    -   -
    + + + // Wait for verification
    - + + 217 -
    -   -
    +
    +
    + + + _, err = operations.ApplyL2Txs(ctx, txs, authL2, clientL2, operations.VerifiedConfirmationLevel)
    - + + 218 -
    -   -
    +
    +
    + + + require.NoError(t, err)
    - + + 219 -
    -   +
    +
    + +
    - + + 220 -
    -   -
    +
    +
    + + + // Assert that he permissionless node is fully synced (through the DAC)
    - + + 221 -
    -   -
    +
    +
    + + + time.Sleep(30 * time.Second) // Give some time for the permissionless node to get synced
    - + + 222 -
    -   -
    +
    +
    + + + clientL2Permissionless, err := ethclient.Dial(operations.PermissionlessL2NetworkURL)
    - + + 223 -
    -   -
    +
    +
    + + + require.NoError(t, err)
    - + + 224 -
    -   -
    +
    +
    + + + expectedBlock, err := clientL2.BlockByNumber(ctx, nil)
    - + + 225 -
    -   -
    +
    +
    + + + require.NoError(t, err)
    - + + 226 -
    -   -
    +
    +
    + + + actualBlock, err := clientL2Permissionless.BlockByNumber(ctx, nil)
    - + + 227 -
    -   -
    +
    +
    + + + require.NoError(t, err)
    - + + 228 -
    -   -
    +
    +
    + + + // je, err := expectedBlock.Header().MarshalJSON()
    - + + 229 -
    -   -
    +
    +
    + + + // require.NoError(t, err)
    - 166 + + 230 +
    -   - var waitDuration = time.Duration(0) + + + // log.Info(string(je))
    - 167 + + 231 +
    -   -
    + + + // ja, err := actualBlock.Header().MarshalJSON()
    - 168 + + 232 +
    -   - func newL1SyncParallel(ctx context.Context, cfg Config, etherManForL1 []syncinterfaces.EthermanFullInterface, sync *ClientSynchronizer, runExternalControl bool) *l1_parallel_sync.L1SyncOrchestration { + + + // require.NoError(t, err)
    -
    @@ -234,7 +260,7 @@
    +
    + 233 + +
    + + + // log.Info(string(ja)) +
    + 234 +
    -   - if err != nil { + + + // require.Equal(t, string(je), string(ja))
    + 235 +
    -   - if errors.Is(err, state.ErrStateNotSynchronized) { + + + require.Equal(t, expectedBlock.Root().Hex(), actualBlock.Root().Hex())
    + 236 +
    -   - log.Info("State is empty, verifying genesis block") + + + }
    + 237 +
    - - - valid, err := s.etherMan.VerifyGenBlockNumber(s.ctx, s.genesis.BlockNumber) + + +
    + 238 +
    -   - if err != nil { + + + type member struct {
    + 239 +
    -   - log.Error("error checking genesis block number. Error: ", err) + + + addr common.Address
    + 240 +
    -   - return rollback(s.ctx, dbTx, err) + + + pk *ecdsa.PrivateKey
    -
    @@ -242,12 +268,42 @@
    +
    + 241 + +
    + + + url string +
    + 242 +
    -   - log.Error("genesis Block number configured is not valid. It is required the block number where the PolygonZkEVM smc was deployed") + + + i int
    + 243 +
    -   - return rollback(s.ctx, dbTx, fmt.Errorf("genesis Block number configured is not valid. It is required the block number where the PolygonZkEVM smc was deployed")) + + + }
    + 244 +
    -   - } + + + type members []member
    + 245 +
    - - - log.Info("Setting genesis block") + + +
    + 246 +
    - - - header, err := s.etherMan.HeaderByNumber(s.ctx, big.NewInt(0).SetUint64(s.genesis.BlockNumber)) + + + func (s members) Len() int { return len(s) }
    - + + 247 -
    -   -
    +
    +
    + + + func (s members) Less(i, j int) bool {
    - + + 248 -
    -   -
    +
    +
    + + + return strings.ToUpper(s[i].addr.Hex()) < strings.ToUpper(s[j].addr.Hex())
    - + + 249 -
    -   -
    +
    +
    + + + }
    - + + 250 -
    -   -
    +
    +
    + + + func (s members) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
    - + + 251 -
    -   +
    +
    + +
    - + + 252 -
    -   -
    +
    +
    + + + func createKeyStore(pk *ecdsa.PrivateKey, outputDir, password string) error {
    - + + 253 -
    -   -
    +
    +
    + + + ks := keystore.NewKeyStore(outputDir+"_", keystore.StandardScryptN, keystore.StandardScryptP)
    - + + 254 -
    -   -
    +
    +
    + + + _, err := ks.ImportECDSA(pk, password)
    - + + 255 -
    -   -
    +
    +
    + + + if err != nil {
    - + + 256 -
    -   -
    +
    +
    + + + return err
    - + + 257 -
    -   -
    +
    +
    + + + }
    - + + 258 -
    -   -
    +
    +
    + + + fileNameB, err := exec.Command("ls", outputDir+"_/").CombinedOutput()
    - + + 259 -
    -   -
    +
    +
    + + + fileName := strings.TrimSuffix(string(fileNameB), "\n")
    - + + 260 -
    -   -
    +
    +
    + + + if err != nil {
    - + + 261 -
    -   -
    +
    +
    + + + fmt.Println(fileName)
    - + + 262 -
    -   -
    +
    +
    + + + return err
    - + + 263 -
    -   -
    +
    +
    + + + }
    - + + 264 -
    -   -
    +
    +
    + + + out, err := exec.Command("mv", outputDir+"_/"+fileName, outputDir).CombinedOutput()
    - + + 265 -
    -   -
    +
    +
    + + + if err != nil {
    - + + 266 -
    -   -
    +
    +
    + + + fmt.Println(string(out))
    - + + 267 -
    -   -
    +
    +
    + + + return err
    - + + 268 -
    -   -
    +
    +
    + + + }
    - + + 269 -
    -   -
    +
    +
    + + + return nil
    - + + 270 -
    -   -
    +
    +
    + + + } +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/forced_batches_test.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - + + + - - - + - + + - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - + - - - - - - - - - + + +
    +
    @@ -36,7 +36,7 @@
    - + + 36 -
    +
    +
      -
    + authSequencer *bind.TransactOpts
    - + + 37 -
    +
    +
      -
    + authForcedBatch *bind.TransactOpts
    - + + 38 -
    +
    +
      -
    + zkEvmAddr common.Address
    - + + 39 -
    +
    +
    + - + zkEvm *etrogpolygonzkevm.Etrogpolygonzkevm +
    +
    + 40 + +
      -
    + }
    - + + 41 -
    +
    +
     
    - 247 + 42
      - if err != nil { + type l2Stuff struct {
    - 248 + +
    @@ -186,7 +186,7 @@
    +
    + 186 +
    - - - log.Errorf("error getting l1 block header for block %d. Error: %v", s.genesis.BlockNumber, err) +   + require.NoError(t, err)
    - 249 + 187
      - return rollback(s.ctx, dbTx, err) +
    - 250 + 188
      - } + zkEvmAddr := common.HexToAddress(operations.DefaultL1ZkEVMSmartContract)
    - + + 189 -
    -   -
    +
    +
    + - + zkEvm, err := etrogpolygonzkevm.NewEtrogpolygonzkevm(zkEvmAddr, ethClient)
    - 251 + 190
      - lastEthBlockSynced = &state.Block{ + require.NoError(t, err)
    - 252 + 191
      - BlockNumber: header.Number.Uint64(), + return &l1Stuff{ethClient: ethClient, authSequencer: authSequencer, authForcedBatch: authForcedBatch, zkEvmAddr: zkEvmAddr, zkEvm: zkEvm}
    - 253 + 192
      - BlockHash: header.Hash(), + }
    -
    @@ -487,6 +543,14 @@
    +
    @@ -196,7 +196,7 @@
    - 487 + 196
      -
    + require.NoError(t, err)
    - 488 + 197
      - // This function syncs the node from a specific block to the latest + genesisConfig, err := config.LoadGenesisFromJSONString(genesisFileAsStr)
    - 489 + 198
      - func (s *ClientSynchronizer) syncBlocksSequential(lastEthBlockSynced *state.Block) (*state.Block, error) { + require.NoError(t, err)
    - + + 199 -
    -   -
    +
    +
    + - + require.NoError(t, opsman.SetForkID(genesisConfig.Genesis.BlockNumber, forkID6))
    - + + 200 -
    +
    +
      -
    + err = opsman.Setup()
    - + + 201 -
    +
    +
      -
    + require.NoError(t, err)
    - + + 202 -
    +
    +
      -
    + time.Sleep(5 * time.Second)
    - + +
    @@ -216,7 +216,7 @@
    -
    +
    + 216 + +
      -
    + log.Info("Number of forceBatches in the smc: ", num)
    - + + 217 -
    +
    +
     
    - + + 218 -
    +
    +
      -
    + rollupManagerAddr := common.HexToAddress(operations.DefaultL1RollupManagerSmartContract)
    - + + 219 -
    -   -
    +
    +
    + - + rollupManager, err := etrogpolygonrollupmanager.NewEtrogpolygonrollupmanager(rollupManagerAddr, l1.ethClient)
    - 490 + 220
      - // This function will read events fromBlockNum to latestEthBlock. Check reorg to be sure that everything is ok. + require.NoError(t, err)
    - 491 + 221
      - block, err := s.checkReorg(lastEthBlockSynced) +
    - 492 + 222
      - if err != nil { + // Get tip
    -
    @@ -502,13 +566,6 @@
    +
    @@ -226,7 +226,7 @@
    - 502 + 226
      - return block, nil + managerAddress, err := l1.zkEvm.GlobalExitRootManager(&bind.CallOpts{Pending: false})
    - 503 + 227
      - } + require.NoError(t, err)
    - 504 + 228
    @@ -120192,1717 +313081,1733 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 505 + + 229 +
    - - // Call the blockchain to retrieve data + manager, err := etrogpolygonzkevmglobalexitroot.NewEtrogpolygonzkevmglobalexitroot(managerAddress, l1.ethClient)
    - 506 + + 230 +
    - - - header, err := s.etherMan.HeaderByNumber(s.ctx, nil) +   + require.NoError(t, err)
    - 507 + + 231 +
    - - - if err != nil { +   +
    - 508 + + 232 +
    - - - return lastEthBlockSynced, err +   + rootInContract, err := manager.GetLastGlobalExitRoot(&bind.CallOpts{Pending: false})
    - 509 - -
    - - - } -
    +
    +
    @@ -299,7 +299,7 @@
    - 510 + + 299 +
    - - - lastKnownBlock := header.Number +   + return forcedBatch, nil
    - 511 + + 300 +
    - - -
    +   + }
    - 512 + 301
      - var fromBlock uint64 +
    - 513 + + 302 +
    -   - if lastEthBlockSynced.BlockNumber > 0 { + - + func findForcedBatchInL1Logs(ctx context.Context, t *testing.T, fromBlock *big.Int, l1 *l1Stuff) (*etrogpolygonzkevm.EtrogpolygonzkevmForceBatch, *types.Log, error) {
    - 514 + 303
      - fromBlock = lastEthBlockSynced.BlockNumber + 1 + query := ethereum.FilterQuery{
    -
    @@ -516,6 +573,9 @@
    -
    - 516 + 304
      -
    + FromBlock: fromBlock,
    - 517 + 305
      - for { + Addresses: []common.Address{l1.zkEvmAddr}, +
    +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - + - + + - - - - - - - - - + +
    +
     
    - 518 + 36
      - toBlock := fromBlock + s.cfg.SyncChunkSize + authSequencer *bind.TransactOpts
    - + + 37 -
    +
    +
      -
    + authForcedBatch *bind.TransactOpts
    - + + 38 -
    +
    +
      -
    + zkEvmAddr common.Address
    - + + 39 -
    -   -
    +
    +
    + + + zkEvm *polygonzkevm.Polygonzkevm
    - 519 + 40
      - log.Infof("Syncing block %d of %d", fromBlock, lastKnownBlock.Uint64()) + }
    - 520 + 41
      - log.Infof("Getting rollup info from block %d to block %d", fromBlock, toBlock) +
    - 521 + 42
      - // This function returns the rollup information contained in the ethereum blocks and an extra param called order. + type l2Stuff struct {
    -
    @@ -529,6 +589,22 @@
    +
     
    - 529 + 186
      - if err != nil { + require.NoError(t, err)
    - 530 + 187
      - return lastEthBlockSynced, err +
    - 531 + 188
      - } + zkEvmAddr := common.HexToAddress(operations.DefaultL1ZkEVMSmartContract)
    - + + 189 -
    -   -
    +
    +
    + + + zkEvm, err := polygonzkevm.NewPolygonzkevm(zkEvmAddr, ethClient)
    - + + 190 -
    +
    +
      -
    + require.NoError(t, err)
    - + + 191 -
    +
    +
      -
    + return &l1Stuff{ethClient: ethClient, authSequencer: authSequencer, authForcedBatch: authForcedBatch, zkEvmAddr: zkEvmAddr, zkEvm: zkEvm}
    - + + 192 -
    +
    +
      -
    + }
    - - -
    -   -
    -
    +
    +
     
    - + + 196 -
    +
    +
      -
    + require.NoError(t, err)
    - + + 197 -
    +
    +
      -
    + genesisConfig, err := config.LoadGenesisFromJSONString(genesisFileAsStr)
    - + + 198 -
    +
    +
      -
    + require.NoError(t, err)
    - + + 199 -
    -   -
    +
    +
    + + + require.NoError(t, opsman.SetForkID(genesisConfig.Genesis.RollupBlockNumber, forkID6))
    - + + 200 -
    +
    +
      -
    + err = opsman.Setup()
    - + + 201 -
    +
    +
      -
    + require.NoError(t, err)
    - + + 202 -
    +
    +
      -
    + time.Sleep(5 * time.Second)
    - + +
     
    -
    +
    + 216 + +
      -
    + log.Info("Number of forceBatches in the smc: ", num)
    - + + 217 -
    +
    +
     
    - + + 218 -
    +
    +
      -
    + rollupManagerAddr := common.HexToAddress(operations.DefaultL1RollupManagerSmartContract)
    - + + 219 -
    -   -
    +
    +
    + + + rollupManager, err := polygonrollupmanager.NewPolygonrollupmanager(rollupManagerAddr, l1.ethClient)
    - 532 + 220
      - start = time.Now() + require.NoError(t, err)
    - 533 + 221
      - err = s.ProcessBlockRange(blocks, order) +
    - 534 + 222
      - metrics.ProcessL1DataTime(time.Since(start)) + // Get tip
    -
    @@ -722,21 +798,24 @@
    +
     
    - 722 + 226
      - func (s *ClientSynchronizer) checkReorg(latestBlock *state.Block) (*state.Block, error) { + managerAddress, err := l1.zkEvm.GlobalExitRootManager(&bind.CallOpts{Pending: false})
    - 723 + 227
      - // This function only needs to worry about reorgs if some of the reorganized blocks contained rollup info. + require.NoError(t, err)
    - 724 + 228
      - latestEthBlockSynced := *latestBlock +
    - + + 229 -
    -   -
    +
    +
    + + + manager, err := polygonzkevmglobalexitroot.NewPolygonzkevmglobalexitroot(managerAddress, l1.ethClient)
    - 725 + 230
      - var depth uint64 + require.NoError(t, err)
    - 726 + 231
      - for { -
    -
    - 727 - -
    - - - block, err := s.etherMan.EthBlockByNumber(s.ctx, latestBlock.BlockNumber) +
    - 728 + 232
      - if err != nil { + rootInContract, err := manager.GetLastGlobalExitRoot(&bind.CallOpts{Pending: false})
    - 729 + +
     
    +
    + 299 +
    - - - log.Errorf("error getting latest block synced from blockchain. Block: %d, error: %v", latestBlock.BlockNumber, err) +   + return forcedBatch, nil
    - 730 + 300
      - return nil, err + }
    - 731 + 301
      - } +
    - 732 + + 302 +
    - - - if block.NumberU64() != latestBlock.BlockNumber { + + + func findForcedBatchInL1Logs(ctx context.Context, t *testing.T, fromBlock *big.Int, l1 *l1Stuff) (*polygonzkevm.PolygonzkevmForceBatch, *types.Log, error) {
    - + + 303 -
    +
    +
      -
    + query := ethereum.FilterQuery{
    - + + 304 -
    +
    +
      -
    + FromBlock: fromBlock,
    - 733 + 305
      - err = fmt.Errorf("wrong ethereum block retrieved from blockchain. Block numbers don't match. BlockNumber stored: %d. BlockNumber retrieved: %d", + Addresses: []common.Address{l1.zkEvmAddr},
    - 734 - -
    - - - latestBlock.BlockNumber, block.NumberU64()) +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/forced_batches_vector_shared.go + RENAMED + +
    +
    +
    +
    + + + + + - - - + + +
    +
    @@ -63,8 +63,8 @@
    - 735 + 63
      - log.Error("error: ", err) + log.Info("# Setting Genesis #")
    - 736 + 64
      - return nil, err + log.Info("###################")
    - 737 + 65
      - } + genesisActions := vectors.GenerateGenesisActions(testCase.Genesis)
    - 738 + + 66 +
    -   - // Compare hashes + - + require.NoError(t, opsman.SetGenesis(genesisConfig.Genesis.BlockNumber, genesisActions))
    - 739 + 67
    - - if (block.Hash() != latestBlock.BlockHash || block.ParentHash() != latestBlock.ParentHash) && latestBlock.BlockNumber > s.genesis.BlockNumber { + require.NoError(t, opsman.SetForkID(genesisConfig.Genesis.BlockNumber, forkID6))
    - 740 + 68
      - log.Infof("checkReorg: Bad block %d hashOk %t parentHashOk %t", latestBlock.BlockNumber, block.Hash() == latestBlock.BlockHash, block.ParentHash() == latestBlock.ParentHash) + actualOldStateRoot, err := opsman.State().GetLastStateRoot(ctx, nil)
    - 741 + 69
      - log.Debug("[checkReorg function] => latestBlockNumber: ", latestBlock.BlockNumber) + require.NoError(t, err)
    - 742 + 70
      - log.Debug("[checkReorg function] => latestBlockHash: ", latestBlock.BlockHash) + require.NoError(t, opsman.Setup())
    +
    +
    +
    +
    + + + - - + + + - + + +
    -
    @@ -752,7 +831,7 @@
    +
     
    - 752 + 63
      - log.Errorf("error creating db transaction to get prevoius blocks") + log.Info("# Setting Genesis #")
    - 753 + 64
      - return nil, err + log.Info("###################")
    - 754 + 65
      - } + genesisActions := vectors.GenerateGenesisActions(testCase.Genesis)
    - 755 + + 66 +
    - - - latestBlock, err = s.state.GetPreviousBlock(s.ctx, depth, dbTx) + + + require.NoError(t, opsman.SetGenesis(genesisConfig.Genesis.RollupBlockNumber, genesisActions)) +
    +
    + 67 + +
    + + + require.NoError(t, opsman.SetForkID(genesisConfig.Genesis.RollupBlockNumber, forkID6))
    - 756 + 68
      - errC := dbTx.Commit(s.ctx) + actualOldStateRoot, err := opsman.State().GetLastStateRoot(ctx, nil)
    - 757 + 69
      - if errC != nil { + require.NoError(t, err)
    - 758 + 70
      - log.Errorf("error committing dbTx, err: %v", errC) + require.NoError(t, opsman.Setup())
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/jsonrpc1_test.go + RENAMED + +
    +
    +
    +
    + + + - - - - - - + - + + - - - - - - + - - -
    -
    @@ -768,16 +847,21 @@
    +
    @@ -71,7 +71,6 @@
    - 768 + 71
      - log.Warn("error checking reorg: previous block not found in db: ", err) + }
    - 769 + 72
      - return &state.Block{}, nil + ctx := context.Background()
    - 770 + 73
      - } else if err != nil { + setup()
    - + + 74 -
    -   +
    +
    + -
    - 771 + 75
      - return nil, err + defer teardown()
    - 772 + 76
      - } -
    -
    - - -
    -   -
    + for _, network := range networks {
    - 773 + 77
      - } else { + // test newBlockFilter creation
    - + +
    @@ -88,9 +87,9 @@
    -
    +
    + 88 + +
     
    - 774 + 89
      - break + // test newFilter creation with block range and block hash
    - 775 + 90
      - } + response, err = client.JSONRPCCall(network.URL, "eth_newFilter", map[string]interface{}{
    - 776 + + 91 +
    -   - } + - + "blockHash": common.HexToHash("0x1"),
    - 777 + 92
    - - if latestEthBlockSynced.BlockHash != latestBlock.BlockHash { + "fromBlock": "0x1",
    - + + 93 -
    -   -
    +
    +
    + - + "toBlock": "0x2",
    - 778 + 94
      - log.Info("Reorg detected in block: ", latestEthBlockSynced.BlockNumber, " last block OK: ", latestBlock.BlockNumber) + })
    - 779 + 95
      - return latestBlock, nil + require.NoError(t, err)
    - 780 + 96
      - } + require.NotNil(t, response.Error)
    - - -
    -   -
    -
    +
    +
    @@ -99,11 +98,11 @@
    - 781 + 99
      - return nil, nil +
    - 782 + 100
      - } + // test newFilter creation with block hash
    - 783 + 101
      -
    + response, err = client.JSONRPCCall(network.URL, "eth_newFilter", map[string]interface{}{
    -
    + + + 102 + + +
    + - + "blockHash": common.HexToHash("0x1"),
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - + +
    -
     
    - 22 + + 103 +
    -   - "github.com/0xPolygonHermez/zkevm-node/synchronizer/l2_sync/l2_sync_etrog" + - + "address": []common.Address{
    - 23 + 104
      - "github.com/0xPolygonHermez/zkevm-node/synchronizer/metrics" + common.HexToAddress("0x2"),
    - 24 + 105
      - "github.com/ethereum/go-ethereum/common" + },
    - 25 + + 106 +
    - + - "github.com/ethereum/go-ethereum/rpc" + - + "topics": [][]common.Hash{
    - 26 + 107
      - "github.com/jackc/pgx/v4" + {common.HexToHash("0x3")},
    - 27 + 108
      - ) + },
    - 28 + 109
      -
    + })
    -
     
    +
    @@ -118,12 +117,12 @@
    - 53 + 118
      - etherMan syncinterfaces.EthermanFullInterface +
    - 54 + 119
      - latestFlushID uint64 + // test newFilter creation with block range
    - 55 + 120
      - // If true the lastFlushID is stored in DB and we don't need to check again + response, err = client.JSONRPCCall(network.URL, "eth_newFilter", map[string]interface{}{
    - 56 + + 121 +
    - + - latestFlushIDIsFulfilled bool + - + "fromBlock": "0x1",
    - 57 + + 122 +
    - + - syncBlockProtection rpc.BlockNumber + - + "toBlock": "0x2",
    - 58 + + 123 +
    - + - etherManForL1 []syncinterfaces.EthermanFullInterface + - + "address": []common.Address{
    - 59 + + 124 +
    - + - state syncinterfaces.StateFullInterface +   + common.HexToAddress("0x2"),
    - 60 + + 125 +
    - + - pool syncinterfaces.PoolInterface +   + },
    - 61 + + 126 +
    - + - ethTxManager syncinterfaces.EthTxManager + - + "topics": [][]common.Hash{
    - 62 + + 127 +
    - + - zkEVMClient syncinterfaces.ZKEVMClientInterface +   + {common.HexToHash("0x3")},
    - 63 + + 128 +
    - + - zkEVMClientEthereumCompatible syncinterfaces.ZKEVMClientEthereumCompatibleInterface +   + },
    - 64 + + 129 +
    - + - eventLog syncinterfaces.EventLogInterface +   + })
    - 65 + +
    @@ -211,7 +210,7 @@
    +
    + 211 +
    - + - ctx context.Context +   + require.NoError(t, err)
    - 66 + + 212 +
    - + - cancelCtx context.CancelFunc +   +
    - 67 + + 213 +
    - + - genesis state.Genesis +   + assert.NotEqual(t, blockBeforeFilterHash.String(), blockFilterChanges[0].String())
    - 68 + + 214 +
    - + - cfg Config + - + assert.Equal(t, blockAfterFilterHash.String(), blockFilterChanges[len(blockFilterChanges)-1].String(), "network: "+network.Name+"blockAfterFilterHash")
    - 69 + 215
      - // Id of the 'process' of the executor. Each time that it starts this value changes +
    - 70 + 216
      - // This value is obtained from the call state.GetStoredFlushID + // test getFilterChanges for a logFilter ID
    - 71 + 217
      - // It starts as an empty string and it is filled in the first call + // create a SC to emit some logs
    -
     
    +
    @@ -221,7 +220,7 @@
    - 88 + 221
      - pool syncinterfaces.PoolInterface, + require.NoError(t, err)
    - 89 + 222
      - ethTxManager syncinterfaces.EthTxManager, +
    - 90 + 223
      - zkEVMClient syncinterfaces.ZKEVMClientInterface, + response, err = client.JSONRPCCall(network.URL, "eth_newFilter", map[string]interface{}{
    - 91 + + 224 +
    - + - zkEVMClientEthereumCompatible syncinterfaces.ZKEVMClientEthereumCompatibleInterface, + - + "address": []common.Address{scAddr},
    - 92 + 225
      - eventLog syncinterfaces.EventLogInterface, + })
    - 93 + 226
      - genesis state.Genesis, + require.NoError(t, err)
    - 94 + 227
      - cfg Config, + require.Nil(t, response.Error)
    +
    @@ -277,7 +276,7 @@
    +
    - 95 + 277
      - runInDevelopmentMode bool) (Synchronizer, error) { + require.NoError(t, err)
    - 96 + 278
      - ctx, cancel := context.WithCancel(context.Background()) +
    - 97 + 279
      - metrics.Register() -
    -
    - 98 - -
    - + - syncBlockProtection, err := decodeSyncBlockProtection(cfg.SyncBlockProtection) -
    -
    - 99 - -
    - + - if err != nil { -
    -
    - 100 - -
    - + - log.Errorf("error decoding syncBlockProtection. Error: %v", err) -
    -
    - 101 - -
    - + - cancel() + assert.Equal(t, 30, len(logs))
    - 102 + + 280 +
    - + - return nil, err + - + assert.Equal(t, 20, len(logFilterChanges), "network: "+network.Name+" logFilterChanges")
    - 103 + + 281 +
    - + +   }
    - 104 - -
    - + - log.Info("syncBlockProtection: ", syncBlockProtection) -
    -
    - 105 + 282
      - res := &ClientSynchronizer{ + }
    - 106 + + 283 +
    - + - isTrustedSequencer: isTrustedSequencer, +   +
    - 107 - -
    - + - state: st, +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - + - - - - - - - - - - - - + + + - - + - - @@ -121912,192 +314817,197 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - + - + + - - - - - - @@ -122107,72 +315017,72 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -122182,432 +315092,493 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - + +
    +
     
    - 108 + + 71 +
    - + - etherMan: ethMan, +   + }
    - 109 + + 72 +
    - + - etherManForL1: etherManForL1, +   + ctx := context.Background()
    - 110 + + 73 +
    - + - pool: pool, +   + setup()
    - 111 + + -
    - + - ctx: ctx, +
    +
    +   +
    - 112 + + 74 +
    - + - cancelCtx: cancel, +   + defer teardown()
    - 113 + + 75 +
    - + - ethTxManager: ethTxManager, +   + for _, network := range networks {
    - 114 + + 76 +
    - + - zkEVMClient: zkEVMClient, +   + // test newBlockFilter creation
    - 115 - -
    - + - zkEVMClientEthereumCompatible: zkEVMClientEthereumCompatible, -
    +
    +
     
    - 116 + + 87 +
    - + - eventLog: eventLog, +   +
    - 117 + + 88 +
    - + - genesis: genesis, +   + // test newFilter creation with block range and block hash
    - 118 + + 89 +
    - + - cfg: cfg, +   + response, err = client.JSONRPCCall(network.URL, "eth_newFilter", map[string]interface{}{
    - 119 + 90
    + - proverID: "", + "BlockHash": common.HexToHash("0x1"),
    - 120 + 91
    + - previousExecutorFlushID: 0, + "FromBlock": "0x1",
    - 121 + 92
    + - l1SyncOrchestration: nil, + "ToBlock": "0x2",
    - 122 + + 93 +
    - + - l1EventProcessors: nil, +   + })
    - 123 + + 94 +
    - + - syncBlockProtection: syncBlockProtection, +   + require.NoError(t, err)
    - 124 + + 95 +
    - + - halter: syncCommon.NewCriticalErrorHalt(eventLog, 5*time.Second), //nolint:gomnd +   + require.NotNil(t, response.Error)
    +
     
    +
    - 125 + 98
      - } +
    - 126 + 99
      -
    + // test newFilter creation with block hash
    - 127 + 100
      - if !isTrustedSequencer { + response, err = client.JSONRPCCall(network.URL, "eth_newFilter", map[string]interface{}{
    -
     
    +
    + 101 + +
    + + + "BlockHash": common.HexToHash("0x1"), +
    - 156 + + 102 +
    -   - log.Errorf("error getting last L2Block number from state. Error: %v", err) + + + "Addresses": []common.Address{
    - 157 + 103
      - return nil, err + common.HexToAddress("0x2"),
    - 158 + 104
      - } + },
    - 159 + 105
    + - l1checkerL2Blocks = actions.NewCheckL2BlockHash(res.state, res.zkEVMClientEthereumCompatible, initialL2Block, cfg.L1SyncCheckL2BlockNumberhModulus) + "Topics": [][]common.Hash{
    - 160 + 106
      - } else { + {common.HexToHash("0x3")},
    - 161 + 107
      - log.Infof("Trusted Node can't check L2Block hash, ignoring parameter") + },
    - 162 + 108
      - } + })
    - 176 + 117
      - return res, nil +
    - 177 + 118
      - } + // test newFilter creation with block range
    - 178 + 119
      -
    + response, err = client.JSONRPCCall(network.URL, "eth_newFilter", map[string]interface{}{
    - 179 + + 120 +
    + - func decodeSyncBlockProtection(sBP string) (rpc.BlockNumber, error) { + "FromBlock": "0x1",
    - 180 + + 121 +
    + - switch sBP { + "ToBlock": "0x2",
    - 181 + + 122 +
    + - case "latest": + "Addresses": []common.Address{
    - 182 + + 123 +
    - + - return rpc.LatestBlockNumber, nil +   + common.HexToAddress("0x2"),
    - 183 + + 124 +
    - + - case "finalized": +   + },
    - 184 + + 125 +
    + - return rpc.FinalizedBlockNumber, nil + "Topics": [][]common.Hash{
    - 185 + + 126 +
    - + - case "safe": +   + {common.HexToHash("0x3")},
    - 186 + + 127 +
    - + - return rpc.SafeBlockNumber, nil +   + },
    - 187 + + 128 +
    - + - default: +   + })
    - 188 + +
     
    +
    + 210 +
    - + - return 0, fmt.Errorf("error decoding SyncBlockProtection. Unknown value") +   + require.NoError(t, err)
    - 189 + + 211 +
    - + - } +   +
    - 190 + + 212 +
    - + - } +   + assert.NotEqual(t, blockBeforeFilterHash.String(), blockFilterChanges[0].String())
    - 191 + + 213 +
    + -
    + assert.Equal(t, blockAfterFilterHash.String(), blockFilterChanges[len(blockFilterChanges)-1].String())
    - 192 + 214
      - var waitDuration = time.Duration(0) +
    - 193 + 215
      -
    + // test getFilterChanges for a logFilter ID
    - 194 + 216
      - func newL1SyncParallel(ctx context.Context, cfg Config, etherManForL1 []syncinterfaces.EthermanFullInterface, sync *ClientSynchronizer, runExternalControl bool) *l1_parallel_sync.L1SyncOrchestration { + // create a SC to emit some logs
    - 260 + 220
      - if err != nil { + require.NoError(t, err)
    - 261 + 221
      - if errors.Is(err, state.ErrStateNotSynchronized) { +
    - 262 + 222
      - log.Info("State is empty, verifying genesis block") + response, err = client.JSONRPCCall(network.URL, "eth_newFilter", map[string]interface{}{
    - 263 + 223
    + - valid, err := s.etherMan.VerifyGenBlockNumber(s.ctx, s.genesis.RollupBlockNumber) + "Addresses": []common.Address{scAddr},
    - 264 + 224
      - if err != nil { + })
    - 265 + 225
      - log.Error("error checking genesis block number. Error: ", err) + require.NoError(t, err)
    - 266 + 226
      - return rollback(s.ctx, dbTx, err) + require.Nil(t, response.Error)
    - 268 + 276
      - log.Error("genesis Block number configured is not valid. It is required the block number where the PolygonZkEVM smc was deployed") + require.NoError(t, err)
    - 269 + 277
      - return rollback(s.ctx, dbTx, fmt.Errorf("genesis Block number configured is not valid. It is required the block number where the PolygonZkEVM smc was deployed")) +
    - 270 + 278
      - } + assert.Equal(t, 30, len(logs))
    - 271 + 279
    + -
    + assert.Equal(t, 20, len(logFilterChanges))
    - 272 + + 280 +
    - + - // Sync events from RollupManager that happen before rollup creation +   + }
    - 273 + + 281 +
    - + - log.Info("synchronizing events from RollupManager that happen before rollup creation") +   + }
    - 274 + + 282 +
    - + - for i := s.genesis.RollupManagerBlockNumber; true; i += s.cfg.SyncChunkSize { +   +
    - 275 - -
    - + - toBlock := min(i+s.cfg.SyncChunkSize-1, s.genesis.RollupBlockNumber-1) +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/shared.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + +
    +
    @@ -141,11 +141,11 @@
    - 276 + + 141 +
    - + - blocks, order, err := s.etherMan.GetRollupInfoByBlockRange(s.ctx, i, &toBlock) +   +
    - 277 + + 142 +
    - + - if err != nil { +   + // Create smc client
    - 278 + + 143 +
    - + - log.Error("error getting rollupInfoByBlockRange before rollup genesis: ", err) +   + zkEvmAddr := common.HexToAddress(operations.DefaultL1ZkEVMSmartContract)
    - 279 + + 144 +
    - + - rollbackErr := dbTx.Rollback(s.ctx) + - + zkEvm, err := etrogpolygonzkevm.NewEtrogpolygonzkevm(zkEvmAddr, ethClient)
    - 280 + + 145 +
    - + - if rollbackErr != nil { +   + require.NoError(t, err)
    - 281 + + 146 +
    - + - log.Errorf("error rolling back state. RollbackErr: %v, err: %s", rollbackErr, err.Error()) +   +
    - 282 + + 147 +
    - + - return rollbackErr +   + rollupManagerAddr := common.HexToAddress(operations.DefaultL1RollupManagerSmartContract)
    - 283 + + 148 +
    - + - } + - + rollupManager, err := etrogpolygonrollupmanager.NewEtrogpolygonrollupmanager(rollupManagerAddr, ethClient)
    - 284 + + 149 +
    - + - return err +   + require.NoError(t, err)
    - 285 + + 150 +
    - + - } +   +
    - 286 + + 151 +
    - + - err = s.ProcessBlockRange(blocks, order) +   + auth, err := operations.GetAuth(operations.DefaultSequencerPrivateKey, operations.DefaultL1ChainID)
    - 287 - -
    - + - if err != nil { +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + +
    +
     
    - 288 + + 141 +
    - + - log.Error("error processing blocks before the genesis: ", err) +   +
    - 289 + + 142 +
    - + - rollbackErr := dbTx.Rollback(s.ctx) +   + // Create smc client
    - 290 + + 143 +
    - + - if rollbackErr != nil { +   + zkEvmAddr := common.HexToAddress(operations.DefaultL1ZkEVMSmartContract)
    - 291 + + 144 +
    + - log.Errorf("error rolling back state. RollbackErr: %v, err: %s", rollbackErr, err.Error()) + zkEvm, err := polygonzkevm.NewPolygonzkevm(zkEvmAddr, ethClient)
    - 292 + + 145 +
    - + - return rollbackErr +   + require.NoError(t, err)
    - 293 + + 146 +
    - + - } +   +
    - 294 + + 147 +
    - + - return err +   + rollupManagerAddr := common.HexToAddress(operations.DefaultL1RollupManagerSmartContract)
    - 295 + + 148 +
    + - } + rollupManager, err := polygonrollupmanager.NewPolygonrollupmanager(rollupManagerAddr, ethClient)
    - 296 + + 149 +
    - + - if toBlock == s.genesis.RollupBlockNumber-1 { +   + require.NoError(t, err)
    - 297 + + 150 +
    - + - break +   +
    - 298 + + 151 +
    - + - } +   + auth, err := operations.GetAuth(operations.DefaultSequencerPrivateKey, operations.DefaultL1ChainID)
    - 299 - -
    - + - } +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/state_test.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - + + +
    +
    @@ -59,7 +59,7 @@
    - 300 + + 59 +
    - + -
    +   + for _, gacc := range testCase.GenesisAccounts {
    - 301 + + 60 +
    - + - header, err := s.etherMan.HeaderByNumber(s.ctx, big.NewInt(0).SetUint64(s.genesis.RollupBlockNumber)) +   + genesisAccounts[gacc.Address] = gacc.Balance.Int
    - 302 + 61
      - if err != nil { + }
    - 303 + + 62 +
    - + - log.Errorf("error getting l1 block header for block %d. Error: %v", s.genesis.RollupBlockNumber, err) + - + require.NoError(t, opsman.SetGenesisAccountsBalance(genesisConfig.Genesis.BlockNumber, genesisAccounts))
    - 304 + 63
      - return rollback(s.ctx, dbTx, err) +
    - 305 + 64
      - } + // Check initial root
    - 306 + + 65 +
    - + - log.Info("synchronizing rollup creation block") +   + require.NoError(t, opsman.CheckVirtualRoot(testCase.ExpectedOldRoot)) +
    +
    +
    +
    +
    + + + + + - - + + + +
    +
     
    - 307 + 59
      - lastEthBlockSynced = &state.Block{ + for _, gacc := range testCase.GenesisAccounts {
    - 308 + 60
      - BlockNumber: header.Number.Uint64(), + genesisAccounts[gacc.Address] = gacc.Balance.Int
    - 309 + 61
      - BlockHash: header.Hash(), + }
    -
     
    +
    + 62 + +
    + + + require.NoError(t, opsman.SetGenesisAccountsBalance(genesisConfig.Genesis.RollupBlockNumber, genesisAccounts)) +
    - 543 + 63
    @@ -122617,167 +315588,201 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 544 + 64
      - // This function syncs the node from a specific block to the latest + // Check initial root
    - 545 + 65
      - func (s *ClientSynchronizer) syncBlocksSequential(lastEthBlockSynced *state.Block) (*state.Block, error) { + require.NoError(t, opsman.CheckVirtualRoot(testCase.ExpectedOldRoot))
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/Makefile + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - + - + + - - - - - - @@ -122791,53 +315796,68 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - + - + + - - + + + @@ -122852,42 +315872,42 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - -
    +
    @@ -1,4 +1,4 @@
    +
    - 546 + + 1 +
    - + - // Call the blockchain to retrieve data + - + DOCKERCOMPOSE := docker compose -f docker-compose.yml
    - 547 + + 2 +
    - + - header, err := s.etherMan.HeaderByNumber(s.ctx, big.NewInt(s.syncBlockProtection.Int64())) +   + DOCKERCOMPOSEAPPSEQ := zkevm-sequencer
    - 548 + + 3 +
    - + - if err != nil { +   + DOCKERCOMPOSEAPPSEQV1TOV2 := zkevm-sequencer-v1tov2
    - 549 + + 4 +
    - + - log.Error("error getting header of the latest block in L1. Error: ", err) +   + DOCKERCOMPOSEAPPSEQSENDER := zkevm-sequence-sender
    - 550 + +
    @@ -26,6 +26,7 @@
    +
    + 26 +
    - + - return lastEthBlockSynced, err +   + DOCKERCOMPOSEZKPROVER := zkevm-prover
    - 551 + + 27 +
    - + - } +   + DOCKERCOMPOSEPERMISSIONLESSDB := zkevm-permissionless-db
    - 552 + + 28 +
    - + - lastKnownBlock := header.Number +   + DOCKERCOMPOSEPERMISSIONLESSNODE := zkevm-permissionless-node
    - 553 + + -
    - + +
    +
    +  
    - 554 + 29
      - // This function will read events fromBlockNum to latestEthBlock. Check reorg to be sure that everything is ok. + DOCKERCOMPOSEPERMISSIONLESSZKPROVER := zkevm-permissionless-prover
    - 555 + 30
      - block, err := s.checkReorg(lastEthBlockSynced) + DOCKERCOMPOSENODEAPPROVE := zkevm-approve
    - 556 + 31
      - if err != nil { + DOCKERCOMPOSENODEAPPROVEV1TOV2 := zkevm-approve-v1tov2
    -
     
    +
    @@ -62,6 +63,7 @@
    - 566 + 62
      - return block, nil +
    - 567 + 63
      - } + RUNPERMISSIONLESSDB := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSDB)
    - 568 + 64
      -
    + RUNPERMISSIONLESSNODE := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSNODE)
    - + + 65 -
    +
    +
      -
    + RUNPERMISSIONLESSZKPROVER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER)
    - + + 66 -
    +
    +
     
    - + + 67 -
    +
    +
      -
    + RUNAPPROVE := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSENODEAPPROVE)
    - + +
    @@ -101,6 +103,7 @@
    -
    +
    + 101 + +
     
    - + + 102 -
    +
    +
      -
    + STOPPERMISSIONLESSDB := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSDB) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSDB) +
    +
    + 103 + +
    +   + STOPPERMISSIONLESSNODE := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSNODE) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSNODE)
    - 569 + 104
      - var fromBlock uint64 + STOPPERMISSIONLESSZKPROVER := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER)
    - 570 + 105
      - if lastEthBlockSynced.BlockNumber > 0 { +
    - 571 + 106
      - fromBlock = lastEthBlockSynced.BlockNumber + 1 + STOPAPPROVE := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSENODEAPPROVE) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSENODEAPPROVE)
    -
     
    +
    @@ -110,6 +113,9 @@
    - 573 + 110
    @@ -122897,1036 +315917,942 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 574 + 111
      - for { + STOP := $(DOCKERCOMPOSE) down --remove-orphans
    - 575 + 112
      - toBlock := fromBlock + s.cfg.SyncChunkSize +
    - 576 + + -
    - + - if toBlock > lastKnownBlock.Uint64() { +
    +
    +   +
    - 577 + + -
    - + - toBlock = lastKnownBlock.Uint64() +
    +
    +   +
    - 578 + + -
    - + - } +
    +
    +   +
    - 579 + 113
      - log.Infof("Syncing block %d of %d", fromBlock, lastKnownBlock.Uint64()) + .PHONY: test-full-non-e2e
    - 580 + 114
      - log.Infof("Getting rollup info from block %d to block %d", fromBlock, toBlock) + test-full-non-e2e: stop ## Runs non-e2e tests checking race conditions
    - 581 + 115
      - // This function returns the rollup information contained in the ethereum blocks and an extra param called order. + $(RUNSTATEDB)
    -
     
    +
    @@ -122,22 +128,7 @@
    - 589 + 122
      - if err != nil { + sleep 15
    - 590 + 123
      - return lastEthBlockSynced, err + docker ps -a
    - 591 + 124
      - } + docker logs $(DOCKERCOMPOSEZKPROVER)
    - 592 +
    + 125 +
    - + -
    + - + trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -short -race -p 1 -covermode=atomic -coverprofile=../coverage.out -coverpkg ./... -timeout 200s ../...
    - 593 + + 126 +
    - + - // Check reorg again to be sure that the chain has not changed between the previous checkReorg and the call GetRollupInfoByBlockRange + - +
    - 594 + + 127 +
    - + - block, err := s.checkReorg(lastEthBlockSynced) + - + .PHONY: test-full-non-e2e-sonar
    - 595 + + 128 +
    - + - if err != nil { + - + test-full-non-e2e-sonar: stop ## Runs non-e2e tests checking race conditions
    - 596 + + 129 +
    - + - log.Errorf("error checking reorgs. Retrying... Err: %v", err) + - + $(RUNSTATEDB)
    - 597 + + 130 +
    - + - return lastEthBlockSynced, fmt.Errorf("error checking reorgs") + - + $(RUNPOOLDB)
    - 598 + + 131 +
    - + - } + - + $(RUNEVENTDB)
    - 599 + + 132 +
    - + - if block != nil { + - + sleep 2
    - 600 + + 133 +
    - + - err = s.resetState(block.BlockNumber) + - + $(RUNZKPROVER)
    - 601 + + 134 +
    - + - if err != nil { + - + sleep 7
    - 602 + + 135 +
    - + - log.Errorf("error resetting the state to a previous block. Retrying... Err: %v", err) + - + $(RUNL1NETWORK)
    - 603 + + 136 +
    - + - return lastEthBlockSynced, fmt.Errorf("error resetting the state to a previous block") + - + sleep 15
    - 604 + + 137 +
    - + - } + - + docker ps -a
    - 605 + + 138 +
    - + - return block, nil + - + docker logs $(DOCKERCOMPOSEZKPROVER)
    - 606 + + 139 +
    - + - } + - + trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -short -race -p 1 -covermode=atomic -coverprofile=../coverage.out -coverpkg ./... -timeout 200s ../... -json > ../report.json
    - 607 + + 140 +
    - + + -
    - 608 + 141
      - start = time.Now() +
    - 609 + 142
      - err = s.ProcessBlockRange(blocks, order) + .PHONY: test-e2e-group-1
    - 610 + 143
      - metrics.ProcessL1DataTime(time.Since(start)) + test-e2e-group-1: stop ## Runs group 1 e2e tests checking race conditions
    -
     
    +
    @@ -263,6 +254,17 @@
    - 798 + 263
      - func (s *ClientSynchronizer) checkReorg(latestBlock *state.Block) (*state.Block, error) { + docker logs $(DOCKERCOMPOSEZKPROVER)
    - 799 + 264
      - // This function only needs to worry about reorgs if some of the reorganized blocks contained rollup info. + trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -failfast -race -v -p 1 -timeout 2000s ../ci/e2e-group11/...
    - 800 + 265
      - latestEthBlockSynced := *latestBlock +
    - 801 + + -
    - + - reorgedBlock := *latestBlock +
    +
    +   +
    - 802 + + -
    +
    +
      - var depth uint64 +
    - 803 + + -
    +
    +
      - for { +
    - 804 + + -
    - + - block, err := s.etherMan.EthBlockByNumber(s.ctx, reorgedBlock.BlockNumber) +
    +
    +   +
    - 805 + + -
    +
    +
      - if err != nil { +
    - 806 + + -
    - + - log.Errorf("error getting latest block synced from blockchain. Block: %d, error: %v", reorgedBlock.BlockNumber, err) +
    +
    +   +
    - 807 + + -
    +
    +
      - return nil, err +
    - 808 + + -
    +
    +
      - } +
    - 809 + + -
    - + - log.Infof("[checkReorg function] BlockNumber: %d BlockHash got from L1 provider: %s", block.Number().Uint64(), block.Hash().String()) +
    +
    +   +
    - 810 + + -
    - + - log.Infof("[checkReorg function] latestBlockNumber: %d latestBlockHash already synced: %s", latestBlock.BlockNumber, latestBlock.BlockHash.String()) +
    +
    +   +
    - 811 + + -
    - + - if block.NumberU64() != reorgedBlock.BlockNumber { +
    +
    +   +
    - 812 + 266
      - err = fmt.Errorf("wrong ethereum block retrieved from blockchain. Block numbers don't match. BlockNumber stored: %d. BlockNumber retrieved: %d", + .PHONY: benchmark-sequencer-eth-transfers
    - 813 + + 267 +
    - + - reorgedBlock.BlockNumber, block.NumberU64()) +   + benchmark-sequencer-eth-transfers: stop
    - 814 + 268
      - log.Error("error: ", err) + $(RUNL1NETWORK)
    +
    @@ -379,7 +381,7 @@
    +
    - 815 + 379
      - return nil, err + $(STOPZKPROVER)
    - 816 + 380
      - } +
    - 817 + 381
      - // Compare hashes + .PHONY: run-l1-explorer
    - 818 + + 382 +
    - + - if (block.Hash() != latestBlock.BlockHash || block.ParentHash() != latestBlock.ParentHash) && latestBlock.BlockNumber > s.genesis.RollupBlockNumber { + - + run-l1-explorer: ## Runs L1 blockscan explorer
    - 819 + 383
      - log.Infof("checkReorg: Bad block %d hashOk %t parentHashOk %t", latestBlock.BlockNumber, block.Hash() == latestBlock.BlockHash, block.ParentHash() == latestBlock.ParentHash) + $(RUNEXPLORERL1DB)
    - 820 + 384
      - log.Debug("[checkReorg function] => latestBlockNumber: ", latestBlock.BlockNumber) + $(RUNEXPLORERL1)
    - 821 + 385
      - log.Debug("[checkReorg function] => latestBlockHash: ", latestBlock.BlockHash) +
    -
     
    +
    @@ -449,7 +451,7 @@
    - 831 + 449
      - log.Errorf("error creating db transaction to get prevoius blocks") + .PHONY: stop-seqsender-v1tov2
    - 832 + 450
      - return nil, err + stop-seqsender-v1tov2: ## stops the sequencer sender
    - 833 + 451
      - } + $(STOPV1TOV2SEQUENCESENDER)
    - 834 + + 452 +
    - + - lb, err := s.state.GetPreviousBlock(s.ctx, depth, dbTx) + - +
    - 835 + 453
      - errC := dbTx.Commit(s.ctx) + .PHONY: run-sync
    - 836 + 454
      - if errC != nil { + run-sync: ## runs the synchronizer
    - 837 + 455
      - log.Errorf("error committing dbTx, err: %v", errC) + $(RUNSYNC)
    -
     
    +
    @@ -513,7 +515,7 @@
    - 847 + 513
      - log.Warn("error checking reorg: previous block not found in db: ", err) + .PHONY: stop-eth-tx-manager-v1tov2
    - 848 + 514
      - return &state.Block{}, nil + stop-eth-tx-manager-v1tov2: ## Stops the eth tx manager service
    - 849 + 515
      - } else if err != nil { + $(STOPV1TOV2ETHTXMANAGER)
    - 850 + + 516 +
    - + - log.Error("error getting previousBlock from db. Error: ", err) + - +
    - 851 + 517
      - return nil, err + .PHONY: run-agg
    - 852 + 518
      - } -
    -
    - 853 - -
    - + - reorgedBlock = *lb + run-agg: ## Runs the aggregator service
    - 854 + 519
      - } else { -
    -
    - 855 - -
    - + - log.Debugf("checkReorg: Block %d hashOk %t parentHashOk %t", reorgedBlock.BlockNumber, block.Hash() == reorgedBlock.BlockHash, block.ParentHash() == reorgedBlock.ParentHash) + $(RUNAGGREGATOR)
    - 856 - -
    -   - break -
    +
    +
    @@ -555,7 +557,7 @@
    - 857 + 555
      - } + $(RUNPERMISSIONLESSDB)
    - 858 + 556
      - } -
    -
    - 859 - -
    - + - if latestEthBlockSynced.BlockHash != reorgedBlock.BlockHash { -
    -
    - 860 - -
    - + - latestBlock = &reorgedBlock + sleep 3
    - 861 + 557
      - log.Info("Reorg detected in block: ", latestEthBlockSynced.BlockNumber, " last block OK: ", latestBlock.BlockNumber) + $(RUNPERMISSIONLESSZKPROVER)
    - 862 + + 558 +
    -   - return latestBlock, nil + - +
    - 863 + 559
      - } -
    -
    - 864 - -
    - + - log.Debugf("No reorg detected in block: %d. BlockHash: %s", latestEthBlockSynced.BlockNumber, latestEthBlockSynced.BlockHash.String()) +
    - 865 + 560
      - return nil, nil + PHONY: stop-permissionless-dependencies
    - 866 + 561
      - } + stop-permissionless-dependencies: ## Stop the permissionless dependencies (db + prover) without the node
    - 867 - -
    -   -
    -
    -
    -
    -
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/synchronizer_test.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - @@ -123941,277 +316867,292 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - + + + + + + + + + @@ -124225,18 +317166,18 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - + + + + + + + + + + + + + + + + - - @@ -124470,51 +317466,131 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    -
    @@ -18,6 +18,7 @@
    +
    @@ -644,7 +646,7 @@
    - 18 + 644
      - syncMocks "github.com/0xPolygonHermez/zkevm-node/synchronizer/mocks" + go run ./scripts/init_network/main.go .
    - 19 + 645
      - "github.com/ethereum/go-ethereum/common" +
    - 20 + 646
      - ethTypes "github.com/ethereum/go-ethereum/core/types" + .PHONY: show-logs
    - + + 647 -
    -   -
    +
    +
    + - + show-logs: ## Show logs for running docker
    - 21 + 648
      - "github.com/jackc/pgx/v4" + $(DOCKERCOMPOSE) logs
    - 22 + 649
      - "github.com/stretchr/testify/assert" +
    - 23 + 650
      - "github.com/stretchr/testify/mock" + .PHONY: deploy-sc
    -
    @@ -32,12 +33,13 @@
    +
    @@ -700,10 +702,12 @@
    - 32 + 700
      - ) + .PHONY: generate-mocks-synchronizer
    - 33 + 701
      -
    + generate-mocks-synchronizer: ## Generates mocks for synchronizer , using mockery tool
    - 34 + 702
      - type mocks struct { -
    -
    - 35 - -
    - - - Etherman *mock_syncinterfaces.EthermanFullInterface + ## mocks for synchronizer
    - 36 + 703
    - - State *mock_syncinterfaces.StateFullInterface + #export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=EthermanInterface --dir=../synchronizer --output=../synchronizer --outpkg=synchronizer --structname=ethermanMock --filename=mock_etherman.go ${COMMON_MOCKERY_PARAMS}
    - 37 + 704
    - - Pool *mock_syncinterfaces.PoolInterface + #export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=stateInterface --dir=../synchronizer --output=../synchronizer --outpkg=synchronizer --structname=StateMock --filename=mock_state.go ${COMMON_MOCKERY_PARAMS}
    - 38 + 705
    - - EthTxManager *mock_syncinterfaces.EthTxManager + #export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=ethTxManager --dir=../synchronizer --output=../synchronizer --outpkg=synchronizer --structname=ethTxManagerMock --filename=mock_ethtxmanager.go ${COMMON_MOCKERY_PARAMS}
    - 39 + 706
    - - DbTx *syncMocks.DbTxMock + #export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=poolInterface --dir=../synchronizer --output=../synchronizer --outpkg=synchronizer --structname=poolMock --filename=mock_pool.go ${COMMON_MOCKERY_PARAMS}
    - 40 + + -
    - - - ZKEVMClient *mock_syncinterfaces.ZKEVMClientInterface +
    +
    +   +
    - 41 + 707
      - //EventLog *eventLogMock + for i in l1RollupProducerInterface l1RollupConsumerInterface worker synchronizerProcessBlockRangeInterface workersInterface L1ParallelEthermanInterface; do \
    - 42 + 708
      - } + camelcase=$$(echo $$i | sed 's/\([a-z0-9]\)\([A-Z]\)/\1_\2/g' | tr '[:upper:]' '[:lower:]') ; \
    - 43 + 709
      -
    + echo $$camelcase ; \
    -
    @@ -47,7 +49,7 @@
    +
    @@ -712,13 +716,13 @@
    - 47 + 712
      - func TestGivenPermissionlessNodeWhenSyncronizeAgainSameBatchThenUseTheOneInMemoryInstaeadOfGettingFromDb(t *testing.T) { +
    - 48 + 713
      - genesis, cfg, m := setupGenericTest(t) + rm -Rf ../synchronizer/l2_sync/l2_sync_etrog/mocks
    - 49 + 714
      - ethermanForL1 := []syncinterfaces.EthermanFullInterface{m.Etherman} + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --all --case snake --dir ../synchronizer/l2_sync/l2_sync_etrog --output ../synchronizer/l2_sync/l2_sync_etrog/mocks --outpkg mock_l2_sync_etrog ${COMMON_MOCKERY_PARAMS}
    - 50 + 715
    - - syncInterface, err := NewSynchronizer(false, m.Etherman, ethermanForL1, m.State, m.Pool, m.EthTxManager, m.ZKEVMClient, nil, *genesis, *cfg, false) +
    - 51 - -
    -   - require.NoError(t, err) -
    -
    - 52 + 716
      - sync, ok := syncInterface.(*ClientSynchronizer) + rm -Rf ../synchronizer/l2_sync/l2_shared/mocks
    - 53 + 717
      - require.EqualValues(t, true, ok, "Can't convert to underlaying struct the interface of syncronizer") + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --all --case snake --dir ../synchronizer/l2_sync/l2_shared --output ../synchronizer/l2_sync/l2_shared/mocks --outpkg mock_l2_shared ${COMMON_MOCKERY_PARAMS}
    -
    @@ -87,7 +89,7 @@
    -
    - 87 + + 718 +
    -   - func TestGivenPermissionlessNodeWhenSyncronizeFirstTimeABatchThenStoreItInALocalVar(t *testing.T) { + - +
    - 88 + 719
      - genesis, cfg, m := setupGenericTest(t) + rm -Rf ../synchronizer/common/syncinterfaces/mocks
    - 89 + 720
      - ethermanForL1 := []syncinterfaces.EthermanFullInterface{m.Etherman} + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --all --case snake --dir ../synchronizer/common/syncinterfaces --output ../synchronizer/common/syncinterfaces/mocks --outpkg mock_syncinterfaces ${COMMON_MOCKERY_PARAMS}
    - 90 + 721
    - - syncInterface, err := NewSynchronizer(false, m.Etherman, ethermanForL1, m.State, m.Pool, m.EthTxManager, m.ZKEVMClient, nil, *genesis, *cfg, false) +
    - 91 + 722
      - require.NoError(t, err) + rm -Rf ../synchronizer/actions/elderberry/mocks
    - 92 + 723
      - sync, ok := syncInterface.(*ClientSynchronizer) + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --all --case snake --dir ../synchronizer/actions/elderberry --output ../synchronizer/actions/elderberry/mocks --outpkg mock_elderberry ${COMMON_MOCKERY_PARAMS}
    - 93 + 724
      - require.EqualValues(t, true, ok, "Can't convert to underlaying struct the interface of syncronizer") +
    -
    @@ -119,12 +121,13 @@
    +
    @@ -728,27 +732,24 @@
    - 119 + 728
      - // but it used a feature that is not implemented in new one that is asking beyond the last block on L1 +
    - 120 + 729
      - func TestForcedBatchEtrog(t *testing.T) { +
    - 121 + 730
      - genesis := state.Genesis{ + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=Tx --srcpkg=github.com/jackc/pgx/v4 --output=../synchronizer/mocks --structname=DbTxMock --filename=mock_dbtx.go ${COMMON_MOCKERY_PARAMS}
    - 122 + 731
    - - BlockNumber: uint64(123456), +
    - 123 + + 732 +
    -   - } + - + .PHONY: generate-mocks-etherman
    - 124 + 733
      - cfg := Config{ + generate-mocks-etherman: ## Generates mocks for etherman , using mockery tool
    - 125 + 734
      - SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second}, + ## mocks for etherman
    - 126 + + 735 +
    -   - SyncChunkSize: 10, + - + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=GasPricer --srcpkg=github.com/ethereum/go-ethereum --output=../etherman --outpkg=etherman --structname=etherscanMock --filename=mock_etherscan.go ${COMMON_MOCKERY_PARAMS} +
    +
    + 736 + +
    + - + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=GasPricer --srcpkg=github.com/ethereum/go-ethereum --output=../etherman --outpkg=etherman --structname=ethGasStationMock --filename=mock_ethgasstation.go ${COMMON_MOCKERY_PARAMS} +
    +
    + 737 + +
    + - +
    +
    +
    + 738 + +
    + - + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=ChainReader --srcpkg=github.com/ethereum/go-ethereum --output=../etherman --outpkg=etherman --structname=ChainReaderMock --filename=mock_chainreader.go ${COMMON_MOCKERY_PARAMS}
    - 127 + 739
      - L1SynchronizationMode: SequentialMode, +
    - 128 + + -
    +
    +
      - } +
    - 129 + 740
    @@ -124245,118 +317186,173 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 130 + + 741 +
    -   - m := mocks{ + - + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=ethermanInterface --dir=../ethtxmanager --output=../ethtxmanager --outpkg=ethtxmanager --structname=ethermanMock --filename=mock_etherman_test.go ${COMMON_MOCKERY_PARAMS}
    -
    @@ -135,7 +138,7 @@
    +
    + 742 + +
    + - + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=stateInterface --dir=../ethtxmanager --output=../ethtxmanager --outpkg=ethtxmanager --structname=stateMock --filename=mock_state_test.go ${COMMON_MOCKERY_PARAMS} +
    - 135 + 743
      - ZKEVMClient: mock_syncinterfaces.NewZKEVMClientInterface(t), +
    +
    +
    + 744 + +
    + - + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=poolInterface --dir=../gasprice --output=../gasprice --outpkg=gasprice --structname=poolMock --filename=mock_pool.go ${COMMON_MOCKERY_PARAMS} +
    +
    + 745 + +
    + - + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=ethermanInterface --dir=../gasprice --output=../gasprice --outpkg=gasprice --structname=ethermanMock --filename=mock_etherman.go ${COMMON_MOCKERY_PARAMS}
    - 136 + 746
      - } +
    +
    +
    + 747 + +
    + - + rm -Rf ../etherman/mockseth +
    +
    + 748 + +
    + - + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --all --case snake --dir ../etherman/ --output ../etherman/mockseth --outpkg mockseth ${COMMON_MOCKERY_PARAMS} +
    +
    + 749 + +
    + - +
    - 137 + 750
      - ethermanForL1 := []syncinterfaces.EthermanFullInterface{m.Etherman} +
    - 138 + 751
    - - sync, err := NewSynchronizer(false, m.Etherman, ethermanForL1, m.State, m.Pool, m.EthTxManager, m.ZKEVMClient, nil, genesis, cfg, false) + .PHONY: generate-mocks-aggregator
    - 139 + 752
      - require.NoError(t, err) + generate-mocks-aggregator: ## Generates mocks for aggregator , using mockery tool
    - 140 + 753
      -
    + ## mocks for the aggregator tests
    - 141 + 754
      - // state preparation + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=stateInterface --dir=../aggregator --output=../aggregator/mocks --outpkg=mocks --structname=StateMock --filename=mock_state.go
    -
    @@ -201,7 +204,7 @@
    +
    @@ -758,7 +759,7 @@
    - 201 + 758
      - Return(ethBlock, nil). + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=aggregatorTxProfitabilityChecker --dir=../aggregator --output=../aggregator/mocks --outpkg=mocks --structname=ProfitabilityCheckerMock --filename=mock_profitabilitychecker.go
    - 202 + 759
      - Once() + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=Tx --srcpkg=github.com/jackc/pgx/v4 --output=../aggregator/mocks --outpkg=mocks --structname=DbTxMock --filename=mock_dbtx.go
    - 203 + 760
    @@ -124366,86 +317362,86 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 204 + 761
    - - var n *big.Int + .PHONY: generate-mocks-state
    - 205 + 762
      - m.Etherman. + generate-mocks-state: ## Generates mocks for state , using mockery tool
    - 206 + 763
      - On("HeaderByNumber", mock.Anything, n). + ## mocks for the aggregator tests
    - 207 + 764
      - Return(ethHeader, nil). + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=storage --dir=../state --output=../state/mocks --outpkg=mocks --structname=StorageMock --filename=mock_storage.go --disable-version-string --with-expecter
    -
    @@ -254,12 +257,19 @@
    +
    @@ -770,6 +771,27 @@
    - 254 + 770
      -
    + run-benchmarks: run-db ## Runs benchmars
    - 255 + 771
      - fromBlock := ethBlock.NumberU64() + 1 + go test -bench=. ./state/tree
    - 256 + 772
      - toBlock := fromBlock + cfg.SyncChunkSize +
    - 257 + + -
    - - +
    +
    +  
    - 258 + + -
    +
    +
      - m.Etherman. +
    - 259 + + -
    +
    +
      - On("GetRollupInfoByBlockRange", mock.Anything, fromBlock, &toBlock). +
    - 260 + + -
    +
    +
      - Return(blocks, order, nil). +
    - 261 + + -
    +
    +
      - Once() +
    - 262 + + -
    +
    +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
     
    @@ -124571,152 +317647,221 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 263 + 773
      - m.ZKEVMClient. + .PHONY: compile-scs
    - 264 + 774
      - On("BatchNumber", ctx). + compile-scs: ## Compiles smart contracts, configuration in test/contracts/index.yaml
    - 265 + 775 + +
    +   + go run ./scripts/cmd... compilesc --input ./contracts +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + - + + + - + + + - - - - - - + + + + + + - - + + + @@ -124950,51 +318125,71 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + - - - - - - - - - + - + + - - - - + + + - - -
    +
     
    +
    + 1 + +
    + + + DOCKERCOMPOSE := docker compose -f docker-compose.yml +
    +
    + 2 + +
    +   + DOCKERCOMPOSEAPPSEQ := zkevm-sequencer +
    +
    + 3 + +
    +   + DOCKERCOMPOSEAPPSEQV1TOV2 := zkevm-sequencer-v1tov2 +
    +
    + 4
      - Return(uint64(1), nil) + DOCKERCOMPOSEAPPSEQSENDER := zkevm-sequence-sender
    -
    @@ -372,12 +382,13 @@
    +
     
    - 372 + 26
      - // but it used a feature that is not implemented in new one that is asking beyond the last block on L1 + DOCKERCOMPOSEZKPROVER := zkevm-prover
    - 373 + 27
      - func TestSequenceForcedBatchIncaberry(t *testing.T) { + DOCKERCOMPOSEPERMISSIONLESSDB := zkevm-permissionless-db
    - 374 + 28
      - genesis := state.Genesis{ + DOCKERCOMPOSEPERMISSIONLESSNODE := zkevm-permissionless-node
    - 375 + + 29 + +
    + + + DOCKERCOMPOSEPERMISSIONLESSNODEDAC := zkevm-node-forced-DAC +
    +
    + 30 +
    - - - BlockNumber: uint64(123456), +   + DOCKERCOMPOSEPERMISSIONLESSZKPROVER := zkevm-permissionless-prover
    - 376 + 31
      - } + DOCKERCOMPOSENODEAPPROVE := zkevm-approve
    - 377 + 32
      - cfg := Config{ + DOCKERCOMPOSENODEAPPROVEV1TOV2 := zkevm-approve-v1tov2
    +
     
    +
    - 378 + 63
      - SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second}, +
    - 379 + 64
      - SyncChunkSize: 10, + RUNPERMISSIONLESSDB := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSDB)
    - 380 + 65
      - L1SynchronizationMode: SequentialMode, + RUNPERMISSIONLESSNODE := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSNODE)
    - + + 66 -
    -   -
    +
    +
    + + + RUNPERMISSIONLESSNODEDAC := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSNODEDAC)
    - 381 + 67
      - } + RUNPERMISSIONLESSZKPROVER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER)
    - 382 + 68
    @@ -124726,72 +317871,72 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 383 + 69
      - m := mocks{ + RUNAPPROVE := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSENODEAPPROVE)
    -
    @@ -388,7 +399,7 @@
    +
     
    - 388 + 103
      - ZKEVMClient: mock_syncinterfaces.NewZKEVMClientInterface(t), +
    - 389 + 104
      - } + STOPPERMISSIONLESSDB := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSDB) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSDB)
    - 390 + 105
      - ethermanForL1 := []syncinterfaces.EthermanFullInterface{m.Etherman} + STOPPERMISSIONLESSNODE := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSNODE) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSNODE)
    - 391 + + 106 +
    - - - sync, err := NewSynchronizer(true, m.Etherman, ethermanForL1, m.State, m.Pool, m.EthTxManager, m.ZKEVMClient, nil, genesis, cfg, false) + + + STOPPERMISSIONLESSNODEDAC := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSNODEDAC) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSNODEDAC)
    - 392 + 107
      - require.NoError(t, err) + STOPPERMISSIONLESSZKPROVER := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER)
    - 393 + 108
    @@ -124801,42 +317946,42 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 394 + 109
      - // state preparation + STOPAPPROVE := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSENODEAPPROVE) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSENODEAPPROVE)
    -
    @@ -455,7 +466,7 @@
    +
     
    - 455 + 113
      - Return(ethBlock, nil). +
    - 456 + 114
      - Once() + STOP := $(DOCKERCOMPOSE) down --remove-orphans
    - 457 + 115
    @@ -124845,87 +317990,117 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 458 + + 116 +
    - - - var n *big.Int + + + RUNDACDB := docker-compose up -d zkevm-data-node-db +
    +
    + 117 + +
    + + + STOPDACDB := docker-compose stop zkevm-data-node-db && docker-compose rm -f zkevm-data-node-db +
    +
    + 118 + +
    + + +
    - 459 + 119
      - m.Etherman. + .PHONY: test-full-non-e2e
    - 460 + 120
      - On("HeaderByNumber", ctx, n). + test-full-non-e2e: stop ## Runs non-e2e tests checking race conditions
    - 461 + 121
      - Return(ethHeader, nil). + $(RUNSTATEDB)
    -
    @@ -503,12 +514,19 @@
    +
     
    - 503 + 128
      -
    + sleep 15
    - 504 + 129
      - fromBlock := ethBlock.NumberU64() + 1 + docker ps -a
    - 505 + 130
      - toBlock := fromBlock + cfg.SyncChunkSize + docker logs $(DOCKERCOMPOSEZKPROVER)
    - 506 + + 131 +
    - - + + + trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -short -race -p 1 -covermode=atomic -coverprofile=../coverage.out -coverpkg ./... -timeout 70s ../... +
    +
    + + +
    +  
    - 507 + + -
    +
    +
      - m.Etherman. +
    - 508 + + -
    +
    +
      - On("GetRollupInfoByBlockRange", ctx, fromBlock, &toBlock). +
    - 509 + + -
    +
    +
      - Return(blocks, order, nil). +
    - 510 + + -
    +
    +
      - Once() +
    - 511 + + -
    +
    +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
     
    @@ -125051,386 +318246,507 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 512 + 132
      - m.State. +
    - 513 + 133
      - On("BeginStateTransaction", ctx). + .PHONY: test-e2e-group-1
    - 514 + 134
      - Return(m.DbTx, nil). + test-e2e-group-1: stop ## Runs group 1 e2e tests checking race conditions
    -
    @@ -611,12 +629,13 @@
    +
     
    - 611 + 254
      -
    + docker logs $(DOCKERCOMPOSEZKPROVER)
    - 612 + 255
      - func setupGenericTest(t *testing.T) (*state.Genesis, *Config, *mocks) { + trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -failfast -race -v -p 1 -timeout 2000s ../ci/e2e-group11/...
    - 613 + 256
      - genesis := state.Genesis{ +
    - 614 + + 257 +
    - - - BlockNumber: uint64(123456), + + + .PHONY: test-e2e-group-cdk-validium-1 +
    +
    + 258 + +
    + + + test-e2e-group-cdk-validium-1: stop ## Runs cdk-validium-1 e2e tests checking race conditions +
    +
    + 259 + +
    + + + $(RUNSTATEDB) +
    +
    + 260 + +
    + + + $(RUNPOOLDB) +
    +
    + 261 + +
    + + + $(RUNEVENTDB) +
    +
    + 262 + +
    + + + sleep 5 +
    +
    + 263 + +
    + + + $(RUNZKPROVER) +
    +
    + 264 + +
    + + + docker ps -a +
    +
    + 265 + +
    + + + docker logs $(DOCKERCOMPOSEZKPROVER) +
    +
    + 266 + +
    + + + trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -race -v -p 1 -timeout 2000s ../ci/e2e-group-cdk-validium-1/... +
    +
    + 267 + +
    + + +
    - 615 + 268
      - } + .PHONY: benchmark-sequencer-eth-transfers
    - 616 + 269
      - cfg := Config{ + benchmark-sequencer-eth-transfers: stop
    - 617 + 270
      - SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second}, + $(RUNL1NETWORK)
    +
     
    +
    - 618 + 381
      - SyncChunkSize: 10, + $(STOPZKPROVER)
    - 619 + 382
      - L1SynchronizationMode: SequentialMode, +
    - + + 383 -
    +
    +
      -
    + .PHONY: run-l1-explorer +
    +
    + 384 + +
    + + + run-l1-explorer: ## Runs L1 blockscan explorer
    - 620 + 385
      - L1ParallelSynchronization: L1ParallelSynchronizationConfig{ + $(RUNEXPLORERL1DB)
    - 621 + 386
      - MaxClients: 2, + $(RUNEXPLORERL1)
    - 622 + 387
      - MaxPendingNoProcessedBlocks: 2, +
    -
    @@ -631,12 +650,13 @@
    +
     
    - 631 + 451
      - } + .PHONY: stop-seqsender-v1tov2
    - 632 + 452
      -
    + stop-seqsender-v1tov2: ## stops the sequencer sender
    - 633 + 453
      - m := mocks{ + $(STOPV1TOV2SEQUENCESENDER)
    - 634 + + 454 +
    - - - Etherman: mock_syncinterfaces.NewEthermanFullInterface(t), + + +
    - 635 + + 455 +
    - - - State: mock_syncinterfaces.NewStateFullInterface(t), +   + .PHONY: run-sync
    - 636 + + 456 +
    - - - Pool: mock_syncinterfaces.NewPoolInterface(t), +   + run-sync: ## runs the synchronizer
    - 637 + + 457 +
    - - - DbTx: syncMocks.NewDbTxMock(t), +   + $(RUNSYNC)
    - 638 + +
     
    +
    + 515 +
    - - - ZKEVMClient: mock_syncinterfaces.NewZKEVMClientInterface(t), +   + .PHONY: stop-eth-tx-manager-v1tov2
    - 639 + + 516 +
    - - - EthTxManager: mock_syncinterfaces.NewEthTxManager(t), +   + stop-eth-tx-manager-v1tov2: ## Stops the eth tx manager service
    - + + 517 -
    +
    +
      + $(STOPV1TOV2ETHTXMANAGER) +
    +
    + 518 + +
    + +
    - 640 + 519
      - //EventLog: newEventLogMock(t), + .PHONY: run-agg
    - 641 + 520
      - } + run-agg: ## Runs the aggregator service
    - 642 + 521
      - return &genesis, &cfg, &m + $(RUNAGGREGATOR)
    -
    -
    -
    -
    - - - + - - @@ -125440,17 +318756,17 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    + + + + + + + + + + + + + + + + + + + + + - - @@ -125575,147 +318956,132 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - @@ -125725,117 +319091,147 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + @@ -125935,27 +319386,27 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -126010,157 +319461,177 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - + + + + + + - - - - - - - - + - - - - - - - + + +
     
    - 18 + 557
      - syncMocks "github.com/0xPolygonHermez/zkevm-node/synchronizer/mocks" + $(RUNPERMISSIONLESSDB)
    - 19 + 558
      - "github.com/ethereum/go-ethereum/common" + sleep 3
    - 20 + 559
      - ethTypes "github.com/ethereum/go-ethereum/core/types" + $(RUNPERMISSIONLESSZKPROVER)
    - 21 + + 560 +
    + - "github.com/ethereum/go-ethereum/rpc" +
    - 22 + 561
      - "github.com/jackc/pgx/v4" +
    - 23 + 562
      - "github.com/stretchr/testify/assert" + PHONY: stop-permissionless-dependencies
    - 24 + 563
      - "github.com/stretchr/testify/mock" + stop-permissionless-dependencies: ## Stop the permissionless dependencies (db + prover) without the node
    - 33 + 646
      - ) + go run ./scripts/init_network/main.go .
    - 34 + 647
    @@ -125460,112 +318776,177 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 35 + 648
      - type mocks struct { + .PHONY: show-logs
    - 36 + 649
    + - Etherman *mock_syncinterfaces.EthermanFullInterface + show-logs: ## Show logs for running docker +
    +
    + 650 + +
    +   + $(DOCKERCOMPOSE) logs +
    +
    + 651 + +
    +   +
    +
    +
    + 652 + +
    +   + .PHONY: deploy-sc +
    +
    +
     
    +
    + 702 + +
    +   + .PHONY: generate-mocks-synchronizer +
    +
    + 703 + +
    +   + generate-mocks-synchronizer: ## Generates mocks for synchronizer , using mockery tool +
    +
    + 704 + +
    +   + ## mocks for synchronizer
    - 37 + 705
    + - State *mock_syncinterfaces.StateFullInterface + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=EthermanFullInterface --dir=../synchronizer/common/syncinterfaces --output=../synchronizer --outpkg=synchronizer --structname=ethermanMock --filename=mock_etherman.go ${COMMON_MOCKERY_PARAMS}
    - 38 + 706
    + - Pool *mock_syncinterfaces.PoolInterface + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=StateFullInterface --dir=../synchronizer/common/syncinterfaces --output=../synchronizer --outpkg=synchronizer --structname=StateMock --filename=mock_state.go ${COMMON_MOCKERY_PARAMS}
    - 39 + 707
    + - EthTxManager *mock_syncinterfaces.EthTxManager + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=EthTxManager --dir=../synchronizer/common/syncinterfaces --output=../synchronizer --outpkg=synchronizer --structname=ethTxManagerMock --filename=mock_ethtxmanager.go ${COMMON_MOCKERY_PARAMS}
    - 40 + 708
    + - DbTx *syncMocks.DbTxMock + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=PoolInterface --dir=../synchronizer/common/syncinterfaces --output=../synchronizer --outpkg=synchronizer --structname=poolMock --filename=mock_pool.go ${COMMON_MOCKERY_PARAMS}
    - 41 + + 709 +
    + - ZKEVMClient *mock_syncinterfaces.ZKEVMClientInterface + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=Factory --srcpkg=github.com/0xPolygon/cdk-data-availability/client --output=../synchronizer --outpkg=synchronizer --structname=dataCommitteeClientFactoryMock --filename=mock_datacommitteeclientfactory.go ${COMMON_MOCKERY_PARAMS}
    - 42 + 710
    + - zkEVMClientEthereumCompatible *mock_syncinterfaces.ZKEVMClientEthereumCompatibleInterface + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=Client --srcpkg=github.com/0xPolygon/cdk-data-availability/client --output=../synchronizer --outpkg=synchronizer --structname=dataCommitteeClientMock --filename=mock_datacommitteeclient.go ${COMMON_MOCKERY_PARAMS}
    - 43 + 711
      - //EventLog *eventLogMock + for i in l1RollupProducerInterface l1RollupConsumerInterface worker synchronizerProcessBlockRangeInterface workersInterface L1ParallelEthermanInterface; do \
    - 44 + 712
      - } + camelcase=$$(echo $$i | sed 's/\([a-z0-9]\)\([A-Z]\)/\1_\2/g' | tr '[:upper:]' '[:lower:]') ; \
    - 45 + 713
      -
    + echo $$camelcase ; \
    - 49 + 716
      - func TestGivenPermissionlessNodeWhenSyncronizeAgainSameBatchThenUseTheOneInMemoryInstaeadOfGettingFromDb(t *testing.T) { +
    - 50 + 717
      - genesis, cfg, m := setupGenericTest(t) + rm -Rf ../synchronizer/l2_sync/l2_sync_etrog/mocks
    - 51 + 718
      - ethermanForL1 := []syncinterfaces.EthermanFullInterface{m.Etherman} + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --all --case snake --dir ../synchronizer/l2_sync/l2_sync_etrog --output ../synchronizer/l2_sync/l2_sync_etrog/mocks --outpkg mock_l2_sync_etrog ${COMMON_MOCKERY_PARAMS}
    - 52 + 719
    + - syncInterface, err := NewSynchronizer(false, m.Etherman, ethermanForL1, m.State, m.Pool, m.EthTxManager, m.ZKEVMClient, m.zkEVMClientEthereumCompatible, nil, *genesis, *cfg, false) -
    -
    - 53 - -
    -   - require.NoError(t, err) +
    - 54 + 720
      - sync, ok := syncInterface.(*ClientSynchronizer) + rm -Rf ../synchronizer/l2_sync/l2_shared/mocks
    - 55 + 721
      - require.EqualValues(t, true, ok, "Can't convert to underlaying struct the interface of syncronizer") + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --all --case snake --dir ../synchronizer/l2_sync/l2_shared --output ../synchronizer/l2_sync/l2_shared/mocks --outpkg mock_l2_shared ${COMMON_MOCKERY_PARAMS}
    -
     
    -
    - 89 + + 722 +
    -   - func TestGivenPermissionlessNodeWhenSyncronizeFirstTimeABatchThenStoreItInALocalVar(t *testing.T) { + + +
    - 90 + 723
      - genesis, cfg, m := setupGenericTest(t) + rm -Rf ../synchronizer/common/syncinterfaces/mocks
    - 91 + 724
      - ethermanForL1 := []syncinterfaces.EthermanFullInterface{m.Etherman} + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --all --case snake --dir ../synchronizer/common/syncinterfaces --output ../synchronizer/common/syncinterfaces/mocks --outpkg mock_syncinterfaces ${COMMON_MOCKERY_PARAMS}
    - 92 + 725
    + - syncInterface, err := NewSynchronizer(false, m.Etherman, ethermanForL1, m.State, m.Pool, m.EthTxManager, m.ZKEVMClient, m.zkEVMClientEthereumCompatible, nil, *genesis, *cfg, false) +
    - 93 + 726
      - require.NoError(t, err) + rm -Rf ../synchronizer/actions/elderberry/mocks
    - 94 + 727
      - sync, ok := syncInterface.(*ClientSynchronizer) + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --all --case snake --dir ../synchronizer/actions/elderberry --output ../synchronizer/actions/elderberry/mocks --outpkg mock_elderberry ${COMMON_MOCKERY_PARAMS}
    - 95 + 728
      - require.EqualValues(t, true, ok, "Can't convert to underlaying struct the interface of syncronizer") +
    - 121 + 732
      - // but it used a feature that is not implemented in new one that is asking beyond the last block on L1 +
    - 122 + 733
      - func TestForcedBatchEtrog(t *testing.T) { +
    - 123 + 734
      - genesis := state.Genesis{ + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=Tx --srcpkg=github.com/jackc/pgx/v4 --output=../synchronizer/mocks --structname=DbTxMock --filename=mock_dbtx.go ${COMMON_MOCKERY_PARAMS}
    - 124 + 735
    + - RollupBlockNumber: uint64(123456), +
    - 125 + + 736 +
    -   - } + + + .PHONY: generate-mocks-etherman
    - 126 + 737
      - cfg := Config{ + generate-mocks-etherman: ## Generates mocks for etherman , using mockery tool
    - 127 + 738
      - SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second}, + ## mocks for etherman
    - 128 + + 739 +
    + + + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=GasPricer --srcpkg=github.com/ethereum/go-ethereum --output=../etherman --outpkg=etherman --structname=etherscanMock --filename=mock_etherscan.go +
    +
    + 740 + +
    + + + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=GasPricer --srcpkg=github.com/ethereum/go-ethereum --output=../etherman --outpkg=etherman --structname=ethGasStationMock --filename=mock_ethgasstation.go +
    +
    + + +
    +   +
    +
    +
    + + +
      - SyncChunkSize: 10, +
    - 129 + 741
      - L1SynchronizationMode: SequentialMode, +
    - 130 + 742
    + - SyncBlockProtection: "latest", + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=ethermanInterface --dir=../ethtxmanager --output=../ethtxmanager --outpkg=ethtxmanager --structname=ethermanMock --filename=mock_etherman_test.go
    - 131 + + 743 +
    -   - } + + + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=stateInterface --dir=../ethtxmanager --output=../ethtxmanager --outpkg=ethtxmanager --structname=stateMock --filename=mock_state_test.go
    - 132 + 744
    @@ -125844,88 +319240,143 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 133 + + 745 +
    -   - m := mocks{ + + + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=poolInterface --dir=../gasprice --output=../gasprice --outpkg=gasprice --structname=poolMock --filename=mock_pool.go
    -
     
    +
    + 746 + +
    + + + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=ethermanInterface --dir=../gasprice --output=../gasprice --outpkg=gasprice --structname=ethermanMock --filename=mock_etherman.go +
    - 138 + 747
      - ZKEVMClient: mock_syncinterfaces.NewZKEVMClientInterface(t), +
    +
    +
    + 748 + +
    + + + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=dataAvailabilityProvider --dir=../etherman --output=../etherman --outpkg=etherman --structname=daMock --filename=mock_da.go +
    +
    + 749 + +
    + + + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=stateProvider --dir=../etherman --output=../etherman --outpkg=etherman --structname=stateMock --filename=mock_state.go
    - 139 + 750
      - } +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    - 140 + 751
      - ethermanForL1 := []syncinterfaces.EthermanFullInterface{m.Etherman} +
    - 141 + 752
    + - sync, err := NewSynchronizer(false, m.Etherman, ethermanForL1, m.State, m.Pool, m.EthTxManager, m.ZKEVMClient, m.zkEVMClientEthereumCompatible, nil, genesis, cfg, false) + .PHONY: generate-mocks-aggregator
    - 142 + 753
      - require.NoError(t, err) + generate-mocks-aggregator: ## Generates mocks for aggregator , using mockery tool
    - 143 + 754
      -
    + ## mocks for the aggregator tests
    - 144 + 755
      - // state preparation + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=stateInterface --dir=../aggregator --output=../aggregator/mocks --outpkg=mocks --structname=StateMock --filename=mock_state.go
    - 204 + 759
      - Return(ethBlock, nil). + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=aggregatorTxProfitabilityChecker --dir=../aggregator --output=../aggregator/mocks --outpkg=mocks --structname=ProfitabilityCheckerMock --filename=mock_profitabilitychecker.go
    - 205 + 760
      - Once() + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=Tx --srcpkg=github.com/jackc/pgx/v4 --output=../aggregator/mocks --outpkg=mocks --structname=DbTxMock --filename=mock_dbtx.go
    - 206 + 761
    @@ -125965,42 +319416,42 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 207 + 762
    + - n := big.NewInt(rpc.LatestBlockNumber.Int64()) + .PHONY: generate-mocks-state
    - 208 + 763
      - m.Etherman. + generate-mocks-state: ## Generates mocks for state , using mockery tool
    - 209 + 764
      - On("HeaderByNumber", mock.Anything, n). + ## mocks for the aggregator tests
    - 210 + 765
      - Return(ethHeader, nil). + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=storage --dir=../state --output=../state/mocks --outpkg=mocks --structname=StorageMock --filename=mock_storage.go --disable-version-string --with-expecter
    - 257 + 771
      -
    + run-benchmarks: run-db ## Runs benchmars
    - 258 + 772
      - fromBlock := ethBlock.NumberU64() + 1 + go test -bench=. ./state/tree
    - 259 + 773
      - toBlock := fromBlock + cfg.SyncChunkSize +
    - 260 + + 774 +
    + - if toBlock > ethHeader.Number.Uint64() { + .PHONY: run-dac-db
    - 261 + 775
    + - toBlock = ethHeader.Number.Uint64() + run-dac-db: ## Suns the DAC DB
    - 262 + 776
    + - } + $(RUNDACDB)
    - 263 + + 777 +
    -   - m.Etherman. + + +
    - 264 + + 778 +
    -   - On("GetRollupInfoByBlockRange", mock.Anything, fromBlock, &toBlock). + + + .PHONY: stop-dac-db
    - 265 + + 779 +
    -   - Return(blocks, order, nil). + + + stop-dac-db: ## Stops the DAC DB
    - 266 + + 780 +
    -   - Once() + + + $(STOPDACDB)
    - 267 + + 781 +
    -   + +
    - 268 + 782
    + - m.Etherman. + .PHONY: run-permissionless-dac
    - 269 + 783
    + - On("EthBlockByNumber", ctx, lastBlock.BlockNumber). + run-permissionless-dac: ## Runs a permissionless node that is forced to sync through DAC
    - 270 + 784
    + - Return(ethBlock, nil). + $(RUNPERMISSIONLESSDB)
    - 271 + 785
    + - Once() + sleep 1
    - 272 + 786 + +
    + + + $(RUNPERMISSIONLESSZKPROVER) +
    +
    + 787 + +
    + + + $(RUNPERMISSIONLESSNODEDAC) +
    +
    + 788
    @@ -126169,648 +319640,701 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 273 + + 789 +
    -   - m.ZKEVMClient. + + + .PHONY: stop-permissionless-dac
    - 274 + + 790 +
    -   - On("BatchNumber", ctx). + + + stop-permissionless-dac: ## Stops the permissionless node that is forced to sync through DAC
    - 275 + + 791 +
    -   - Return(uint64(1), nil) + + + $(STOPPERMISSIONLESSNODEDAC)
    -
     
    +
    + 792 + +
    + + + $(STOPPERMISSIONLESSZKPROVER) +
    - 382 + + 793 +
    -   - // but it used a feature that is not implemented in new one that is asking beyond the last block on L1 + + + $(STOPPERMISSIONLESSDB)
    - 383 + + 794 +
    -   - func TestSequenceForcedBatchIncaberry(t *testing.T) { + + +
    - 384 + 795
      - genesis := state.Genesis{ -
    -
    - 385 - -
    - + - RollupBlockNumber: uint64(123456), + .PHONY: compile-scs
    - 386 + 796
      - } + compile-scs: ## Compiles smart contracts, configuration in test/contracts/index.yaml
    - 387 + 797
      - cfg := Config{ + go run ./scripts/cmd... compilesc --input ./contracts +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/operations/manager.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - + - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - + + + + + +
    +
    @@ -46,6 +46,7 @@
    - 388 + 46
      - SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second}, + DefaultL1ZkEVMSmartContract = "0x8dAF17A20c9DBA35f005b6324F493785D239719d"
    - 389 + 47
      - SyncChunkSize: 10, + DefaultL1RollupManagerSmartContract = "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e"
    - 390 + 48
      - L1SynchronizationMode: SequentialMode, + DefaultL1PolSmartContract = "0x5FbDB2315678afecb367f032d93F642f64180aa3"
    - 391 + + -
    - + - SyncBlockProtection: "latest", +
    +
    +   +
    - 392 + 49
      - } + DefaultL1NetworkURL = "http://localhost:8545"
    - 393 + 50
      -
    + DefaultL1NetworkWebSocketURL = "ws://localhost:8546"
    - 394 + 51
      - m := mocks{ + DefaultL1ChainID uint64 = 1337
    -
     
    +
    @@ -263,7 +264,6 @@
    - 399 + 263
      - ZKEVMClient: mock_syncinterfaces.NewZKEVMClientInterface(t), + if confirmationLevel == PoolConfirmationLevel {
    - 400 + 264
      - } + return nil, nil
    - 401 + 265
      - ethermanForL1 := []syncinterfaces.EthermanFullInterface{m.Etherman} + }
    - 402 + + 266 +
    - + - sync, err := NewSynchronizer(true, m.Etherman, ethermanForL1, m.State, m.Pool, m.EthTxManager, m.ZKEVMClient, m.zkEVMClientEthereumCompatible, nil, genesis, cfg, false) + - +
    - 403 + 267
      - require.NoError(t, err) + l2BlockNumbers := make([]*big.Int, 0, len(sentTxs))
    - 404 + 268
      -
    + for _, tx := range sentTxs {
    - 405 + 269
      - // state preparation + // check transaction nonce against transaction reported L2 block number
    -
     
    +
    @@ -503,11 +503,7 @@
    - 466 + 503
      - Return(ethBlock, nil). + if err != nil {
    - 467 + 504
      - Once() + panic(err)
    - 468 + 505
      -
    + }
    - 469 + + 506 +
    - + - n := big.NewInt(rpc.LatestBlockNumber.Int64()) + - + mtr, err := l1infotree.NewL1InfoTreeRecursive(32)
    - 470 + + 507 +
    -   - m.Etherman. + - + if err != nil {
    - 471 + + 508 +
    -   - On("HeaderByNumber", ctx, n). + - + panic(err)
    - 472 + + 509 +
    -   - Return(ethHeader, nil). + - + }
    -
     
    +
    + 510 + +
    + - + st := state.NewState(stateCfg, stateDb, executorClient, stateTree, eventLog, mt, mtr) +
    - 514 + 511
      -
    + return st, nil
    - 515 + 512
      - fromBlock := ethBlock.NumberU64() + 1 + }
    - 516 + 513
      - toBlock := fromBlock + cfg.SyncChunkSize +
    - 517 - -
    - + - if toBlock > ethHeader.Number.Uint64() { -
    +
    +
    @@ -666,3 +662,23 @@
    - 518 + + 666 +
    - + - toBlock = ethHeader.Number.Uint64() +   + panic(err)
    - 519 + + 667 +
    - + - } +   + }
    - 520 + 668
      - m.Etherman. + }
    - 521 + + -
    +
    +
      - On("GetRollupInfoByBlockRange", ctx, fromBlock, &toBlock). +
    - 522 + + -
    +
    +
      - Return(blocks, order, nil). +
    - 523 + + -
    +
    +
      - Once() +
    - 524 + + -
    +
    +
     
    - 525 + + -
    - + - m.Etherman. +
    +
    +   +
    - 526 + + -
    - + - On("EthBlockByNumber", ctx, lastBlock.BlockNumber). +
    +
    +   +
    - 527 + + -
    - + - Return(ethBlock, nil). +
    +
    +   +
    - 528 + + -
    - + - Once() +
    +
    +   +
    - 529 + + -
    - + +
    +
    +  
    - 530 + + -
    +
    +
      - m.State. +
    - 531 + + -
    +
    +
      - On("BeginStateTransaction", ctx). +
    - 532 + + -
    +
    +
      - Return(m.DbTx, nil). +
    -
     
    +
    + + +
    +   +
    +
    - 629 + + -
    +
    +
     
    - 630 + + -
    +
    +
      - func setupGenericTest(t *testing.T) (*state.Genesis, *Config, *mocks) { +
    - 631 + + -
    +
    +
      - genesis := state.Genesis{ +
    - 632 + + -
    - + - RollupBlockNumber: uint64(123456), +
    +
    +   +
    - 633 + + -
    +
    +
      - } +
    - 634 + + -
    +
    +
      - cfg := Config{ +
    +
    +
    + + +
    +   +
    +
    +
    +
    +
    + + + + + @@ -126820,117 +320344,102 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - + - - - - - - -
    +
     
    +
    - 635 + 46
      - SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second}, + DefaultL1ZkEVMSmartContract = "0x8dAF17A20c9DBA35f005b6324F493785D239719d"
    - 636 + 47
      - SyncChunkSize: 10, + DefaultL1RollupManagerSmartContract = "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e"
    - 637 + 48
      - L1SynchronizationMode: SequentialMode, + DefaultL1PolSmartContract = "0x5FbDB2315678afecb367f032d93F642f64180aa3"
    - 638 + 49
    + - SyncBlockProtection: "latest", + DefaultL1DataCommitteeContract = "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE"
    - 639 + 50
      - L1ParallelSynchronization: L1ParallelSynchronizationConfig{ + DefaultL1NetworkURL = "http://localhost:8545"
    - 640 + 51
      - MaxClients: 2, + DefaultL1NetworkWebSocketURL = "ws://localhost:8546"
    - 641 + 52
      - MaxPendingNoProcessedBlocks: 2, + DefaultL1ChainID uint64 = 1337
    - 650 + 264
      - } + if confirmationLevel == PoolConfirmationLevel {
    - 651 + 265
      -
    + return nil, nil
    - 652 + 266
      - m := mocks{ -
    -
    - 653 - -
    - + - Etherman: mock_syncinterfaces.NewEthermanFullInterface(t), + }
    - 654 + + -
    - + - State: mock_syncinterfaces.NewStateFullInterface(t), +
    +
    +   +
    - 655 + + 267 +
    - + - Pool: mock_syncinterfaces.NewPoolInterface(t), +   + l2BlockNumbers := make([]*big.Int, 0, len(sentTxs))
    - 656 + + 268 +
    - + - DbTx: syncMocks.NewDbTxMock(t), +   + for _, tx := range sentTxs {
    - 657 + + 269 +
    - + - ZKEVMClient: mock_syncinterfaces.NewZKEVMClientInterface(t), +   + // check transaction nonce against transaction reported L2 block number
    - 658 - -
    - + - zkEVMClientEthereumCompatible: mock_syncinterfaces.NewZKEVMClientEthereumCompatibleInterface(t), -
    +
    +
     
    - 659 + + 503 +
    - + - EthTxManager: mock_syncinterfaces.NewEthTxManager(t), +   + if err != nil {
    - 660 + 504
      - //EventLog: newEventLogMock(t), + panic(err)
    - 661 + 505
    @@ -126939,43 +320448,14 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 662 + + 506 +
    -   - return &genesis, &cfg, &m -
    -
    -
    + + + st := state.NewState(stateCfg, stateDb, executorClient, stateTree, eventLog, mt)
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/test/contracts/auto/CounterAndBlock.sol - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - -
    -
    @@ -0,0 +1,15 @@
    @@ -127018,142 +320498,123 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - + + 507 -
    +
    +
      -
    + return st, nil
    - + + 508 -
    +
    +
      -
    + }
    - + + 509 -
    +
    +
     
    - - -
    -   -
    -
    +
    +
     
    - + + 662 -
    +
    +
      -
    + panic(err)
    - + + 663 -
    +
    +
      -
    + }
    - + + 664 -
    +
    +
      -
    + }
    - + + 665 -
    -   +
    +
    + +
    - + + 666 -
    -   -
    +
    +
    + + + // StartDACDB starts the data availability node DB
    - + + 667 -
    -   -
    +
    +
    + + + func (m *Manager) StartDACDB() error {
    - - -
    -   -
    -
    +
    + 668
    -
    + +
    + + + return StartComponent("dac-db", func() (bool, error) { return true, nil })
    -
    -
    - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - + - - - - - - - - - - -
    -
     
    - 1 + 669
    + - // SPDX-License-Identifier: GPL-3.0 + }
    - 2 + 670
    @@ -127163,47 +320624,47 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 3 + 671
    + - pragma solidity >=0.7.0 <0.9.0; + // StopDACDB stops the data availability node DB
    - 4 + 672
    + -
    + func (m *Manager) StopDACDB() error {
    - 5 + 673
    + - contract CounterAndBlock { + return StopComponent("dac-db")
    - 6 + 674
    + - uint public count; + }
    - 7 + 675
    @@ -127213,37 +320674,47 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 8 + 676
    + - function increment() external { + // StartPermissionlessNodeForcedToSYncThroughDAC starts a permissionless node that is froced to sync through the DAC
    - 9 + 677
    + - count += 1; + func (m *Manager) StartPermissionlessNodeForcedToSYncThroughDAC() error {
    - 10 + 678
    + - } + return StartComponent("permissionless-dac", func() (bool, error) { return true, nil })
    - 11 + 679 + +
    + + + } +
    +
    + 680
    @@ -127253,37 +320724,37 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 12 + 681
    + - function getCount() public view returns (uint, uint) { + // StopPermissionlessNodeForcedToSYncThroughDAC stops the permissionless node that is froced to sync through the DAC
    - 13 + 682
    + - return (count, block.timestamp); + func (m *Manager) StopPermissionlessNodeForcedToSYncThroughDAC() error {
    - 14 + 683
    + - } + return StopComponent("permissionless-dac")
    - 15 + 684
    @@ -127298,12 +320769,12 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    +
    {/home/stefan/go/src/Polygon/zkevm-node → .}/test/contracts/auto/customModExp.sol + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/scripts/batchsender/main.go RENAMED
    -
    @@ -0,0 +1,24 @@
    -
    - - -
    -   -
    -
    -
    - - -
    -   -
    -
    -
    - - -
    -   -
    -
    -
    - - -
    -   -
    -
    +
    @@ -111,7 +111,7 @@
    - + + 111 -
    +
    +
      -
    + return err
    - + + 112 -
    +
    +
      -
    + }
    - + + 113 -
    +
    +
     
    - + + 114 -
    -   -
    +
    +
    + - + ethMan, err := etherman.NewClient(cfg.Etherman, cfg.NetworkConfig.L1Config)
    - + + 115 -
    +
    +
      -
    + if err != nil {
    - + + 116 -
    +
    +
      -
    + return err
    - + + 117 -
    +
    +
      -
    + }
    - - -
    -   -
    -
    +
    +
    @@ -183,7 +183,7 @@
    - + + 183 -
    +
    +
      -
    + // send to L1
    - + + 184 -
    +
    +
      -
    + firstSequence := seqs[0]
    - + + 185 -
    +
    +
      -
    + lastSequence := seqs[len(seqs)-1]
    - + + 186 -
    -   -
    +
    +
    + - + to, data, err := ethMan.BuildSequenceBatchesTxData(auth.From, seqs, uint64(lastSequence.LastL2BLockTimestamp), firstSequence.BatchNumber, auth.From)
    - + + 187 -
    +
    +
      -
    + if err != nil {
    - + + 188 -
    +
    +
      -
    + return err
    - + + 189 -
    +
    +
      -
    + }
    - - -
    -   -
    -
    +
    +
    @@ -289,7 +289,7 @@
    - + + 289 -
    +
    +
      -
    + switch vLog.Topics[0] {
    - + + 290 -
    +
    +
      -
    + case etherman.SequencedBatchesSigHash():
    - + + 291 -
    +
    +
      -
    + if vLog.TxHash == tx.Hash() { // ignore other txs happening on L1
    - - -
    -   -
    -
    +
    + 292
    -
    + +
    + - + sb, err := ethMan.EtrogZkEVM.ParseSequenceBatches(vLog)
    -
    -
    - - - - - - - - - - - - + - + + - - - - - - - - - - - - + + +
    -
     
    - 1 + + 293 +
    - + - // SPDX-License-Identifier: MIT +   + if err != nil {
    - 2 + + 294 +
    - + - pragma solidity >=0.7.0 <0.9.0; +   + return err
    - 3 + + 295 +
    - + -
    +   + }
    - 4 + +
    @@ -302,7 +302,7 @@
    +
    + 302 +
    - + - contract customModExp { +   + }
    - 5 + + 303 +
    - + - bytes32 hashResult; +   + }
    - 6 + + 304 +
    - + - address retEcrecover; +   + case etherman.TrustedVerifyBatchesSigHash():
    - 7 + + 305 +
    - + - bytes dataResult; + - + vb, err := ethMan.EtrogZkEVM.ParseVerifyBatches(vLog)
    - 8 + + 306 +
    - + - uint256 dataRes; +   + if err != nil {
    - 9 + + 307 +
    - + -
    +   + return err
    - 10 + + 308 +
    - + - bytes32[10] arrayStorage; +   + } +
    +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - -
    +
     
    - 11 + + 111 +
    - + -
    +   + return err
    - 12 + + 112 +
    - + - function modExpGeneric(bytes memory input) public { +   + }
    - 13 + + 113 +
    - + - bytes32[10] memory output; +   +
    - 14 + + 114 +
    + -
    + ethMan, err := etherman.NewClient(cfg.Etherman, cfg.NetworkConfig.L1Config, nil, nil)
    - 15 + + 115 +
    - + - assembly { +   + if err != nil {
    - 16 + + 116 +
    - + - let success := staticcall(gas(), 0x05, add(input, 32), mload(input), output, 0x140) +   + return err
    - 17 + + 117 +
    - + - sstore(0x00, success) +   + }
    - 18 + +
     
    +
    + 183 +
    - + - } +   + // send to L1
    - 19 + + 184 +
    - + -
    +   + firstSequence := seqs[0]
    - 20 + + 185 +
    - + - for (uint i = 0; i < 10; i++) { +   + lastSequence := seqs[len(seqs)-1]
    - 21 + + 186 +
    + - arrayStorage[i] = output[i]; + to, data, err := ethMan.BuildSequenceBatchesTxData(auth.From, seqs, uint64(lastSequence.LastL2BLockTimestamp), firstSequence.BatchNumber, auth.From, nil)
    - 22 + + 187 +
    - + - } +   + if err != nil {
    - 23 + + 188 +
    - + - } +   + return err
    - 24 + + 189 +
    - + - } +   + }
    -
    -
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/test/contracts/bin/CounterAndBlock/CounterAndBlock.go - RENAMED - -
    -
    -
    -
    - - - + - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - + + +
    -
    @@ -0,0 +1,287 @@
    +
     
    - + + 289 -
    +
    +
      -
    + switch vLog.Topics[0] {
    - + + 290 -
    +
    +
      -
    + case etherman.SequencedBatchesSigHash():
    - + + 291 -
    +
    +
      -
    + if vLog.TxHash == tx.Hash() { // ignore other txs happening on L1
    - + + 292 -
    -   -
    +
    +
    + + + sb, err := ethMan.ZkEVM.ParseSequenceBatches(vLog)
    - + + 293 -
    +
    +
      -
    + if err != nil {
    - + + 294 -
    +
    +
      -
    + return err
    - + + 295 -
    +
    +
      -
    + }
    - - -
    -   -
    -
    +
    +
     
    - + + 302 -
    +
    +
      -
    + }
    - + + 303 -
    +
    +
      -
    + }
    - + + 304 -
    +
    +
      -
    + case etherman.TrustedVerifyBatchesSigHash():
    - + + 305 -
    -   -
    +
    +
    + + + vb, err := ethMan.ZkEVM.ParseVerifyBatches(vLog)
    - + + 306 -
    +
    +
      -
    + if err != nil {
    - + + 307 -
    +
    +
      -
    + return err
    - + + 308 -
    +
    +
      -
    + } +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/scripts/deploy_sc/main.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - @@ -128084,1394 +321515,1451 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - + + +
    +
    @@ -132,6 +132,12 @@
    - + + 132 -
    +
    +
      -
    + log.Debugf("Sending TX to transfer ETH")
    - + + 133 -
    +
    +
      -
    + to := common.HexToAddress(receiverAddr)
    - + + 134 -
    +
    +
      -
    + tx = ethTransfer(ctx, client, auth, to, transferAmount, nil)
    - + + 135 -
    +
    +
      -
    + err = operations.WaitTxToBeMined(ctx, client, tx, txTimeout)
    - + + 136 -
    +
    +
      -
    + chkErr(err)
    - + + 137 -
    +
    +
      -
    + fmt.Println() +
    +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + +
    +
     
    - + + 132 -
    +
    +
      -
    + log.Debugf("Sending TX to transfer ETH")
    - + + 133 -
    +
    +
      -
    + to := common.HexToAddress(receiverAddr)
    - + + 134 -
    +
    +
      -
    + tx = ethTransfer(ctx, client, auth, to, transferAmount, nil)
    - + + 135 -
    -   -
    +
    +
    + + + fmt.Println()
    - + + 136 -
    -   +
    +
    + +
    - + + 137 -
    -   -
    +
    +
    + + + // Invalid ETH Transfer
    - + + 138 -
    -   -
    +
    +
    + + + log.Debugf("Sending Invalid TX to transfer ETH")
    - + + 139 -
    -   -
    +
    +
    + + + nonce := tx.Nonce() + 1
    - + + 140 -
    -   -
    +
    +
    + + + ethTransfer(ctx, client, auth, to, transferAmount, &nonce)
    - + + 141 -
    +
    +
      -
    + err = operations.WaitTxToBeMined(ctx, client, tx, txTimeout)
    - + + 142 -
    +
    +
      -
    + chkErr(err)
    - + + 143 -
    +
    +
      -
    + fmt.Println() +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/scripts/hash_compare/main.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +
    +
    @@ -1,124 +0,0 @@
    - + + 1 -
    -   -
    +
    +
    + - + package main
    - + + 2 -
    -   +
    +
    + -
    - + + 3 -
    -   -
    +
    +
    + - + import (
    - + + 4 -
    -   -
    +
    +
    + - + "context"
    - + + 5 -
    -   -
    +
    +
    + - + "errors"
    - + + 6 -
    -   -
    +
    +
    + - + "fmt"
    - + + 7 -
    -   -
    +
    +
    + - + "math/big"
    - + + 8 -
    -   -
    +
    +
    + - + "sync"
    - + + 9 -
    -   -
    +
    +
    + - + "time"
    - + + 10 -
    -   +
    +
    + -
    - + + 11 -
    -   -
    +
    +
    + - + "github.com/ethereum/go-ethereum"
    - + + 12 -
    -   -
    +
    +
    + - + "github.com/ethereum/go-ethereum/core/types"
    - + + 13 -
    -   -
    +
    +
    + - + "github.com/ethereum/go-ethereum/ethclient"
    - + + 14 -
    -   -
    +
    +
    + - + )
    - + + 15 -
    -   +
    +
    + -
    - + + 16 -
    -   -
    +
    +
    + - + // add here the url of the nodes you want to check
    - + + 17 -
    -   -
    +
    +
    + - + // against the trusted node
    - + + 18 -
    -   -
    +
    +
    + - + var networkURLsToCheck = []string{
    - + + 19 -
    -   -
    +
    +
    + - + // "https://add.your.node.url.here",
    - + + 20 -
    -   -
    +
    +
    + - + // "https://add.your.node.url.here",
    - + + 21 -
    -   -
    +
    +
    + - + // "https://add.your.node.url.here",
    - + + 22 -
    -   -
    +
    +
    + - + }
    - + + 23 -
    -   +
    +
    + -
    - + + 24 -
    -   -
    +
    +
    + - + // set the from and to block numbers you want to verify
    - + + 25 -
    -   -
    +
    +
    + - + const fromBlockNumber uint64 = 10
    - + + 26 -
    -   -
    +
    +
    + - + const toBlockNumber uint64 = 20
    - + + 27 -
    -   +
    +
    + -
    - + + 28 -
    -   -
    +
    +
    + - + // pick the correct trusted Node URL depending on the network you are testing
    - + + 29 -
    -   +
    +
    + -
    - + + 30 -
    -   -
    +
    +
    + - + // mainnet
    - + + 31 -
    -   -
    +
    +
    + - + const trustedNodeURL = "https://zkevm-rpc.com"
    - + + 32 -
    -   +
    +
    + -
    - + + 33 -
    -   -
    +
    +
    + - + // cardona
    - + + 34 -
    -   -
    +
    +
    + - + // const trustedNodeURL = "https://rpc.cardona.zkevm-rpc.com/"
    - + + 35 -
    -   +
    +
    + -
    - + + 36 -
    -   -
    +
    +
    + - + func main() {
    - + + 37 -
    -   -
    +
    +
    + - + fmt.Printf("connecting to network: %v ...", trustedNodeURL)
    - + + 38 -
    -   -
    +
    +
    + - + trustedNodeClient, err := ethclient.Dial(trustedNodeURL)
    - + + 39 -
    -   -
    +
    +
    + - + chkErr(err)
    - + + 40 -
    -   -
    +
    +
    + - + fmt.Print("connected")
    - + + 41 -
    -   -
    +
    +
    + - + fmt.Println()
    - + + 42 -
    -   +
    +
    + -
    - + + 43 -
    -   -
    +
    +
    + - + networkClients := map[string]*ethclient.Client{}
    - + + 44 -
    -   -
    +
    +
    + - + for _, networkURL := range networkURLsToCheck {
    - + + 45 -
    -   -
    +
    +
    + - + fmt.Printf("connecting to network: %v ...", networkURL)
    - + + 46 -
    -   -
    +
    +
    + - + client, err := ethclient.Dial(networkURL)
    - + + 47 -
    -   -
    +
    +
    + - + chkErr(err)
    - + + 48 -
    -   -
    +
    +
    + - + networkClients[networkURL] = client
    - + + 49 -
    -   -
    +
    +
    + - + fmt.Print("connected")
    - + + 50 -
    -   -
    +
    +
    + - + fmt.Println()
    - + + 51 -
    -   -
    +
    +
    + - + }
    - + + 52 -
    -   +
    +
    + -
    - + + 53 -
    -   -
    +
    +
    + - + for blockNumberU64 := fromBlockNumber; blockNumberU64 <= toBlockNumber; blockNumberU64++ {
    - + + 54 -
    -   -
    +
    +
    + - + ctx := context.Background()
    - + + 55 -
    -   -
    +
    +
    + - + blockNumber := big.NewInt(0).SetUint64(blockNumberU64)
    - + + 56 -
    -   -
    +
    +
    + - + fmt.Println()
    - + + 57 -
    -   -
    +
    +
    + - + fmt.Println("block to verify: ", blockNumberU64)
    - + + 58 -
    -   +
    +
    + -
    - + + 59 -
    -   -
    +
    +
    + - + // load blocks from trusted node
    - + + 60 -
    -   -
    +
    +
    + - + trustedNodeBlockHeader, err := trustedNodeClient.HeaderByNumber(ctx, blockNumber)
    - + + 61 -
    -   -
    +
    +
    + - + chkErr(err)
    - + + 62 -
    -   -
    +
    +
    + - + const logPattern = "block: %v hash: %v parentHash: %v network: %v\n"
    - + + 63 -
    -   -
    +
    +
    + - + trustedNodeBlockHash := trustedNodeBlockHeader.Hash().String()
    - + + 64 -
    -   -
    +
    +
    + - + trustedNodeParentBlockHash := trustedNodeBlockHeader.ParentHash.String()
    - + + 65 -
    -   +
    +
    + -
    - + + 66 -
    -   -
    +
    +
    + - + // load blocks from networks to verify
    - + + 67 -
    -   -
    +
    +
    + - + blocks := sync.Map{}
    - + + 68 -
    -   -
    +
    +
    + - + wg := sync.WaitGroup{}
    - + + 69 -
    -   -
    +
    +
    + - + wg.Add(len(networkURLsToCheck))
    - + + 70 -
    -   -
    +
    +
    + - + for _, networkURL := range networkURLsToCheck {
    - + + 71 -
    -   -
    +
    +
    + - + go func(networkURL string) {
    - + + 72 -
    -   -
    +
    +
    + - + defer wg.Done()
    - + + 73 -
    -   -
    +
    +
    + - + c := networkClients[networkURL]
    - + + 74 -
    -   +
    +
    + -
    - + + 75 -
    -   -
    +
    +
    + - + blockHeader, err := c.HeaderByNumber(ctx, blockNumber)
    - + + 76 -
    -   -
    +
    +
    + - + if errors.Is(err, ethereum.NotFound) {
    - + + 77 -
    -   -
    +
    +
    + - + return
    - + + 78 -
    -   -
    +
    +
    + - + } else {
    - + + 79 -
    -   -
    +
    +
    + - + chkErr(err)
    - + + 80 -
    -   -
    +
    +
    + - + }
    - + + 81 -
    -   +
    +
    + -
    - + + 82 -
    -   -
    +
    +
    + - + blocks.Store(networkURL, blockHeader)
    - + + 83 -
    -   -
    +
    +
    + - + }(networkURL)
    - + + 84 -
    -   -
    +
    +
    + - + }
    - + + 85 -
    -   -
    +
    +
    + - + wg.Wait()
    - + + 86 -
    -   +
    +
    + -
    - + + 87 -
    -   -
    +
    +
    + - + failed := false
    - + + 88 -
    -   -
    +
    +
    + - + blocks.Range(func(networkURLValue, blockValue any) bool {
    - + + 89 -
    -   -
    +
    +
    + - + networkURL, block := networkURLValue.(string), blockValue.(*types.Header)
    - + + 90 -
    -   +
    +
    + -
    - + + 91 -
    -   -
    +
    +
    + - + // when block is not found
    - + + 92 -
    -   -
    +
    +
    + - + if block == nil {
    - + + 93 -
    -   -
    +
    +
    + - + fmt.Printf(logPattern, blockNumberU64, "NOT FOUND", "NOT FOUND", networkURL)
    - + + 94 -
    -   -
    +
    +
    + - + return true
    - + + 95 -
    -   -
    +
    +
    + - + }
    - + + 96 -
    -   +
    +
    + -
    - + + 97 -
    -   -
    +
    +
    + - + blockHash := block.Hash().String()
    - + + 98 -
    -   -
    +
    +
    + - + parentBlockHash := block.ParentHash.String()
    - + + 99 -
    -   +
    +
    + -
    - + + 100 -
    -   -
    +
    +
    + - + if trustedNodeBlockHash != blockHash || trustedNodeParentBlockHash != parentBlockHash {
    - + + 101 -
    -   -
    +
    +
    + - + failed = true
    - + + 102 -
    -   -
    +
    +
    + - + fmt.Printf(logPattern, blockNumberU64, trustedNodeBlockHash, trustedNodeParentBlockHash, trustedNodeURL)
    - + + 103 -
    -   -
    +
    +
    + - + fmt.Printf(logPattern, blockNumberU64, blockHash, parentBlockHash, networkURL)
    - + + 104 -
    -   -
    +
    +
    + - + fmt.Printf("ERROR block information mismatch for network: %v\n", networkURL)
    - + + 105 -
    -   -
    +
    +
    + - + } else {
    - + + 106 -
    -   -
    +
    +
    + - + fmt.Printf("%v: OK\n", networkURL)
    - + + 107 -
    -   -
    +
    +
    + - + }
    - + + 108 -
    -   +
    +
    + -
    - + + 109 -
    -   -
    +
    +
    + - + return true
    - + + 110 -
    -   -
    +
    +
    + - + })
    - + + 111 -
    -   -
    +
    +
    + - + if failed {
    - + + 112 -
    -   -
    +
    +
    + - + panic("block information mismatch")
    - + + 113 -
    -   -
    +
    +
    + - + }
    - + + 114 -
    -   +
    +
    + -
    - + + 115 -
    -   -
    +
    +
    + - + // avoid getting blocked by request rate limit
    - + + 116 -
    -   -
    +
    +
    + - + time.Sleep(time.Second)
    - + + 117 -
    -   -
    +
    +
    + - + }
    - + + 118 -
    -   -
    +
    +
    + - + }
    - + + 119 -
    -   +
    +
    + -
    - + + 120 -
    -   -
    +
    +
    + - + func chkErr(err error) {
    - + + 121 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 122 -
    -   -
    +
    +
    + - + panic(err)
    - + + 123 -
    -   -
    +
    +
    + - + }
    - + + 124 -
    -   -
    +
    +
    + - + } +
    +
    +
    +
    +
    + + + + +
    +
     
    @@ -130718,6 +324206,21 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/scripts/hash_gen/main.go + RENAMED + +
    +
    @@ -130725,2906 +324228,3121 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +
    -
     
    +
    @@ -1,188 +0,0 @@
    + 1 +
    - + - // Code generated - DO NOT EDIT. + - + package main
    + 2 +
    - + - // This file is a generated binding and any manual changes will be lost. + - +
    + 3 +
    - + -
    + - + import (
    + 4 +
    - + - package CounterAndBlock + - + "encoding/json"
    + 5 +
    - + -
    + - + "fmt"
    + 6 +
    - + - import ( + - +
    + 7 +
    - + - "errors" + - + "github.com/0xPolygonHermez/zkevm-node/hex"
    + 8 +
    - + - "math/big" + - + "github.com/0xPolygonHermez/zkevm-node/jsonrpc/client"
    + 9 +
    - + - "strings" + - + "github.com/0xPolygonHermez/zkevm-node/jsonrpc/types"
    + 10 +
    - + -
    + - + "github.com/0xPolygonHermez/zkevm-node/log"
    + 11 +
    - + - ethereum "github.com/ethereum/go-ethereum" + - + "github.com/ethereum/go-ethereum/common"
    + 12 +
    - + - "github.com/ethereum/go-ethereum/accounts/abi" + - + ethTypes "github.com/ethereum/go-ethereum/core/types"
    + 13 +
    - + - "github.com/ethereum/go-ethereum/accounts/abi/bind" + - + "github.com/ethereum/go-ethereum/trie"
    + 14 +
    - + - "github.com/ethereum/go-ethereum/common" + - + )
    + 15 +
    - + - "github.com/ethereum/go-ethereum/core/types" + - +
    + 16 +
    - + - "github.com/ethereum/go-ethereum/event" + - + const (
    + 17 +
    - + - ) + - + networkURL = "https://zkevm-rpc.com"
    + 18 +
    - + -
    + - + startBlockNumber uint64 = 10
    + 19 +
    - + - // Reference imports to suppress errors if they are not otherwise used. + - + endBlockNumber uint64 = 20
    + 20 +
    - + - var ( + - + )
    + 21 +
    - + - _ = errors.New + - +
    + 22 +
    - + - _ = big.NewInt + - + func main() {
    + 23 +
    - + - _ = strings.NewReader + - + for blockNumber := startBlockNumber; blockNumber <= endBlockNumber; blockNumber++ {
    + 24 +
    - + - _ = ethereum.NotFound + - + printfLn("getting block: %v", blockNumber)
    + 25 +
    - + - _ = bind.Bind + - + blockResponse, err := client.JSONRPCCall(networkURL, "eth_getBlockByNumber", hex.EncodeUint64(blockNumber), true)
    + 26 +
    - + - _ = common.Big1 + - + chkErr(err)
    + 27 +
    - + - _ = types.BloomLookup + - + chkRespErr(blockResponse.Error)
    + 28 +
    - + - _ = event.NewSubscription + - +
    + 29 +
    - + - _ = abi.ConvertType + - + rawBlock := map[string]interface{}{}
    + 30 +
    - + - ) + - + err = json.Unmarshal(blockResponse.Result, &rawBlock)
    + 31 +
    - + -
    + - + chkErr(err)
    + 32 +
    - + - // CounterAndBlockMetaData contains all meta data concerning the CounterAndBlock contract. + - +
    + 33 +
    - + - var CounterAndBlockMetaData = &bind.MetaData{ + - + // create header
    + 34 +
    - + - ABI: "[{\"inputs\":[],\"name\":\"count\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"increment\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + - + rawBlockHash := rawBlock["hash"].(string)
    + 35 +
    - + - Bin: "0x608060405234801561001057600080fd5b5060eb8061001f6000396000f3fe6080604052348015600f57600080fd5b5060043610603c5760003560e01c806306661abd146041578063a87d942c14605c578063d09de08a146071575b600080fd5b604960005481565b6040519081526020015b60405180910390f35b60005460408051918252426020830152016053565b60776079565b005b6001600080828254608991906090565b9091555050565b6000821982111560b057634e487b7160e01b600052601160045260246000fd5b50019056fea26469706673582212205aa9aebefdfb857d27d7bdc8475c08138617cc37e78c2e6bd98acb9a1484994964736f6c634300080c0033", + - + number := hex.DecodeBig(rawBlock["number"].(string))
    + 36 +
    - + - } + - + parentHash := common.HexToHash(rawBlock["parentHash"].(string))
    + 37 +
    - + -
    + - + coinbase := common.HexToAddress(rawBlock["miner"].(string))
    + 38 +
    - + - // CounterAndBlockABI is the input ABI used to generate the binding from. + - + root := common.HexToHash(rawBlock["stateRoot"].(string))
    + 39 +
    - + - // Deprecated: Use CounterAndBlockMetaData.ABI instead. + - + gasUsed := hex.DecodeUint64(rawBlock["gasUsed"].(string))
    + 40 +
    - + - var CounterAndBlockABI = CounterAndBlockMetaData.ABI + - + gasLimit := hex.DecodeUint64(rawBlock["gasLimit"].(string))
    + 41 +
    - + -
    + - + timeStamp := hex.DecodeUint64(rawBlock["timestamp"].(string))
    + 42 +
    - + - // CounterAndBlockBin is the compiled bytecode used for deploying new contracts. + - +
    + 43 +
    - + - // Deprecated: Use CounterAndBlockMetaData.Bin instead. + - + header := &ethTypes.Header{
    + 44 +
    - + - var CounterAndBlockBin = CounterAndBlockMetaData.Bin + - + Number: number, ParentHash: parentHash, Coinbase: coinbase,
    + 45 +
    - + -
    + - + Root: root, GasUsed: gasUsed, GasLimit: gasLimit, Time: timeStamp,
    + 46 +
    - + - // DeployCounterAndBlock deploys a new Ethereum contract, binding an instance of CounterAndBlock to it. + - + }
    + 47 +
    - + - func DeployCounterAndBlock(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *CounterAndBlock, error) { + - +
    + 48 +
    - + - parsed, err := CounterAndBlockMetaData.GetAbi() + - + // create txs and receipts
    + 49 +
    - + - if err != nil { + - + rawTransactions := rawBlock["transactions"].([]interface{})
    + 50 +
    - + - return common.Address{}, nil, nil, err + - + txs := make([]*ethTypes.Transaction, 0, len(rawTransactions))
    + 51 +
    - + - } + - + receipts := make([]*ethTypes.Receipt, 0, len(rawTransactions))
    + 52 +
    - + - if parsed == nil { + - + for i, rawTransaction := range rawTransactions {
    + 53 +
    - + - return common.Address{}, nil, nil, errors.New("GetABI returned nil") + - + if i == 1 {
    + 54 +
    - + - } + - + continue
    + 55 +
    - + -
    + - + }
    + 56 +
    - + - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(CounterAndBlockBin), backend) + - + rawTransactionMap := rawTransaction.(map[string]interface{})
    + 57 +
    - + - if err != nil { + - +
    + 58 +
    - + - return common.Address{}, nil, nil, err + - + nonce := hex.DecodeUint64(rawTransactionMap["nonce"].(string))
    + 59 +
    - + - } + - + gasPrice := hex.DecodeBig(rawTransactionMap["gasPrice"].(string))
    + 60 +
    - + - return address, tx, &CounterAndBlock{CounterAndBlockCaller: CounterAndBlockCaller{contract: contract}, CounterAndBlockTransactor: CounterAndBlockTransactor{contract: contract}, CounterAndBlockFilterer: CounterAndBlockFilterer{contract: contract}}, nil + - + gas := hex.DecodeUint64(rawTransactionMap["gas"].(string))
    + 61 +
    - + - } + - + var to *common.Address
    + 62 +
    - + -
    + - + if rawTransactionMap["to"] != nil {
    + 63 +
    - + - // CounterAndBlock is an auto generated Go binding around an Ethereum contract. + - + aux := common.HexToAddress(rawTransactionMap["to"].(string))
    + 64 +
    - + - type CounterAndBlock struct { + - + to = &aux
    + 65 +
    - + - CounterAndBlockCaller // Read-only binding to the contract + - + }
    + 66 +
    - + - CounterAndBlockTransactor // Write-only binding to the contract + - + value := hex.DecodeBig(rawTransactionMap["value"].(string))
    + 67 +
    - + - CounterAndBlockFilterer // Log filterer for contract events + - + data, _ := hex.DecodeHex(rawTransactionMap["input"].(string))
    + 68 +
    - + - } + - + v := hex.DecodeBig(rawTransactionMap["v"].(string))
    + 69 +
    - + -
    + - + r := hex.DecodeBig(rawTransactionMap["r"].(string))
    + 70 +
    - + - // CounterAndBlockCaller is an auto generated read-only Go binding around an Ethereum contract. + - + s := hex.DecodeBig(rawTransactionMap["s"].(string))
    + 71 +
    - + - type CounterAndBlockCaller struct { + - +
    + 72 +
    - + - contract *bind.BoundContract // Generic contract wrapper for the low level calls + - + tx := ethTypes.NewTx(&ethTypes.LegacyTx{
    + 73 +
    - + - } + - + Nonce: nonce, GasPrice: gasPrice, Gas: gas, To: to,
    + 74 +
    - + -
    + - + Value: value, Data: data, V: v, R: r, S: s,
    + 75 +
    - + - // CounterAndBlockTransactor is an auto generated write-only Go binding around an Ethereum contract. + - + })
    + 76 +
    - + - type CounterAndBlockTransactor struct { + - + txs = append(txs, tx)
    + 77 +
    - + - contract *bind.BoundContract // Generic contract wrapper for the low level calls + - +
    + 78 +
    - + - } + - + hash := rawTransactionMap["hash"].(string)
    + 79 +
    - + -
    + - + printfLn("getting receipt for tx: %v", hash)
    + 80 +
    - + - // CounterAndBlockFilterer is an auto generated log filtering Go binding around an Ethereum contract events. + - + receiptResponse, err := client.JSONRPCCall(networkURL, "eth_getTransactionReceipt", hash)
    + 81 +
    - + - type CounterAndBlockFilterer struct { + - + chkErr(err)
    + 82 +
    - + - contract *bind.BoundContract // Generic contract wrapper for the low level calls + - + chkRespErr(receiptResponse.Error)
    + 83 +
    - + - } + - +
    + 84 +
    - + -
    + - + rawReceipt := map[string]interface{}{}
    + 85 +
    - + - // CounterAndBlockSession is an auto generated Go binding around an Ethereum contract, + - + err = json.Unmarshal(receiptResponse.Result, &rawReceipt)
    + 86 +
    - + - // with pre-set call and transact options. + - + chkErr(err)
    + 87 +
    - + - type CounterAndBlockSession struct { + - +
    + 88 +
    - + - Contract *CounterAndBlock // Generic contract binding to set the session for + - + receiptType := uint8(hex.DecodeUint64(rawReceipt["type"].(string)))
    + 89 +
    - + - CallOpts bind.CallOpts // Call options to use throughout this session + - + postState := common.HexToHash(rawReceipt["root"].(string)).Bytes()
    + 90 +
    - + - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session + - + status := hex.DecodeUint64(rawReceipt["status"].(string))
    + 91 +
    - + - } + - + cumulativeGasUsed := hex.DecodeUint64(rawReceipt["cumulativeGasUsed"].(string))
    + 92 +
    - + -
    + - + txHash := common.HexToHash(rawReceipt["transactionHash"].(string))
    + 93 +
    - + - // CounterAndBlockCallerSession is an auto generated read-only Go binding around an Ethereum contract, + - + var contractAddress common.Address
    + 94 +
    - + - // with pre-set call options. + - + if rawReceipt["contractAddress"] != nil {
    + 95 +
    - + - type CounterAndBlockCallerSession struct { + - + contractAddress = common.HexToAddress(rawReceipt["contractAddress"].(string))
    + 96 +
    - + - Contract *CounterAndBlockCaller // Generic contract caller binding to set the session for + - + }
    + 97 +
    - + - CallOpts bind.CallOpts // Call options to use throughout this session + - + gasUsed := hex.DecodeUint64(rawReceipt["gasUsed"].(string))
    + 98 +
    - + - } + - + blockHash := common.HexToHash(rawReceipt["blockHash"].(string))
    + 99 +
    - + -
    + - + blockNumber := hex.DecodeBig(rawReceipt["blockNumber"].(string))
    + 100 +
    - + - // CounterAndBlockTransactorSession is an auto generated write-only Go binding around an Ethereum contract, + - + transactionIndex := uint(hex.DecodeUint64(rawReceipt["transactionIndex"].(string)))
    + 101 +
    - + - // with pre-set transact options. + - +
    + 102 +
    - + - type CounterAndBlockTransactorSession struct { + - + receipt := &ethTypes.Receipt{
    + 103 +
    - + - Contract *CounterAndBlockTransactor // Generic contract transactor binding to set the session for + - + Type: receiptType, PostState: postState, Status: status, CumulativeGasUsed: cumulativeGasUsed,
    + 104 +
    - + - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session + - + TxHash: txHash, ContractAddress: contractAddress, GasUsed: gasUsed,
    + 105 +
    - + - } + - + BlockHash: blockHash, BlockNumber: blockNumber, TransactionIndex: transactionIndex,
    + 106 +
    - + -
    + - + }
    + 107 +
    - + - // CounterAndBlockRaw is an auto generated low-level Go binding around an Ethereum contract. + - +
    + 108 +
    - + - type CounterAndBlockRaw struct { + - + rawLogs := rawReceipt["logs"].([]interface{})
    + 109 +
    - + - Contract *CounterAndBlock // Generic contract binding to access the raw methods on + - + logs := make([]*ethTypes.Log, 0, len(rawLogs))
    + 110 +
    - + - } + - + printfLn("logs: %v", len(rawLogs))
    + 111 +
    - + -
    + - + for _, rawLog := range rawLogs {
    + 112 +
    - + - // CounterAndBlockCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. + - + rawLogMap := rawLog.(map[string]interface{})
    + 113 +
    - + - type CounterAndBlockCallerRaw struct { + - +
    + 114 +
    - + - Contract *CounterAndBlockCaller // Generic read-only contract binding to access the raw methods on + - + address := common.HexToAddress(rawLogMap["address"].(string))
    + 115 +
    - + - } + - + data, _ := hex.DecodeHex(rawLogMap["data"].(string))
    + 116 +
    - + -
    + - + blockNumber := hex.DecodeUint64(rawLogMap["blockNumber"].(string))
    + 117 +
    - + - // CounterAndBlockTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. + - + txHash := common.HexToHash(rawLogMap["transactionHash"].(string))
    + 118 +
    - + - type CounterAndBlockTransactorRaw struct { + - + txIndex := uint(hex.DecodeUint64(rawLogMap["transactionIndex"].(string)))
    + 119 +
    - + - Contract *CounterAndBlockTransactor // Generic write-only contract binding to access the raw methods on + - + blockHash := common.HexToHash(rawLogMap["blockHash"].(string))
    + 120 +
    - + - } + - + index := uint(hex.DecodeUint64(rawLogMap["logIndex"].(string)))
    + 121 +
    - + -
    + - + removed := rawLogMap["removed"].(bool)
    + 122 +
    - + - // NewCounterAndBlock creates a new instance of CounterAndBlock, bound to a specific deployed contract. + - +
    + 123 +
    - + - func NewCounterAndBlock(address common.Address, backend bind.ContractBackend) (*CounterAndBlock, error) { + - + log := &ethTypes.Log{
    + 124 +
    - + - contract, err := bindCounterAndBlock(address, backend, backend, backend) + - + Address: address,
    + 125 +
    - + - if err != nil { + - + Data: data,
    + 126 +
    - + - return nil, err + - + BlockNumber: blockNumber,
    + 127 +
    - + - } + - + TxHash: txHash,
    + 128 +
    - + - return &CounterAndBlock{CounterAndBlockCaller: CounterAndBlockCaller{contract: contract}, CounterAndBlockTransactor: CounterAndBlockTransactor{contract: contract}, CounterAndBlockFilterer: CounterAndBlockFilterer{contract: contract}}, nil + - + TxIndex: txIndex,
    + 129 +
    - + - } + - + BlockHash: blockHash,
    + 130 +
    - + -
    + - + Index: index,
    + 131 +
    - + - // NewCounterAndBlockCaller creates a new read-only instance of CounterAndBlock, bound to a specific deployed contract. + - + Removed: removed,
    + 132 +
    - + - func NewCounterAndBlockCaller(address common.Address, caller bind.ContractCaller) (*CounterAndBlockCaller, error) { + - + }
    + 133 +
    - + - contract, err := bindCounterAndBlock(address, caller, nil, nil) + - + logs = append(logs, log)
    + 134 +
    - + - if err != nil { + - +
    + 135 +
    - + - return nil, err + - + rawTopics := rawLogMap["topics"].([]interface{})
    + 136 +
    - + - } + - + topics := make([]common.Hash, 0, len(rawTopics))
    + 137 +
    - + - return &CounterAndBlockCaller{contract: contract}, nil + - + for _, rawTopic := range rawTopics {
    + 138 +
    - + - } + - + topic := common.HexToHash(rawTopic.(string))
    + 139 +
    - + -
    + - + topics = append(topics, topic)
    + 140 +
    - + - // NewCounterAndBlockTransactor creates a new write-only instance of CounterAndBlock, bound to a specific deployed contract. + - + }
    + 141 +
    - + - func NewCounterAndBlockTransactor(address common.Address, transactor bind.ContractTransactor) (*CounterAndBlockTransactor, error) { + - + log.Topics = topics
    + 142 +
    - + - contract, err := bindCounterAndBlock(address, nil, transactor, nil) + - + }
    + 143 +
    - + - if err != nil { + - + receipt.Logs = logs
    + 144 +
    - + - return nil, err + - +
    + 145 +
    - + - } + - + // RPC is not setting the receipt bloom when computing the block hash
    + 146 +
    - + - return &CounterAndBlockTransactor{contract: contract}, nil + - + // receipt.Bloom = ethTypes.CreateBloom([]*ethTypes.Receipt{receipt})
    + 147 +
    - + - } + - +
    + 148 +
    - + -
    + - + receipts = append(receipts, receipt)
    + 149 +
    - + - // NewCounterAndBlockFilterer creates a new log filterer instance of CounterAndBlock, bound to a specific deployed contract. + - + }
    + 150 +
    - + - func NewCounterAndBlockFilterer(address common.Address, filterer bind.ContractFilterer) (*CounterAndBlockFilterer, error) { + - +
    + 151 +
    - + - contract, err := bindCounterAndBlock(address, nil, nil, filterer) + - + uncles := []*ethTypes.Header{}
    + 152 +
    - + - if err != nil { + - +
    + 153 +
    - + - return nil, err + - + builtBlock := ethTypes.NewBlock(header, txs, uncles, receipts, &trie.StackTrie{})
    + 154 +
    - + - } + - +
    + 155 +
    - + - return &CounterAndBlockFilterer{contract: contract}, nil + - + match := rawBlockHash == builtBlock.Hash().String()
    + 156 +
    - + - } + - +
    + 157 +
    - + -
    + - + log.Infof(" RPC block hash: %v", rawBlockHash)
    + 158 +
    - + - // bindCounterAndBlock binds a generic wrapper to an already deployed contract. + - + log.Infof("Computed block hash: %v", builtBlock.Hash().String())
    + 159 +
    - + - func bindCounterAndBlock(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + - + if !match {
    + 160 +
    - + - parsed, err := CounterAndBlockMetaData.GetAbi() + - + log.Errorf(" block hashes DO NOT match")
    + 161 +
    - + - if err != nil { + - + } else {
    + 162 +
    - + - return nil, err + - + log.Infof(" block hashes MATCH")
    + 163 +
    - + - } + - + }
    + 164 +
    - + - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil + - + }
    + 165 +
    - + + - }
    + 166 +
    - + + -
    + 167 +
    - + - // Call invokes the (constant) contract method with params as input values and + - + func chkRespErr(err *types.ErrorObject) {
    + 168 +
    - + - // sets the output to result. The result type might be a single field for simple + - + if err != nil {
    + 169 +
    - + - // returns, a slice of interfaces for anonymous returns and a struct for named + - + errMsg := fmt.Sprintf("%v %v", err.Code, err.Message)
    + 170 +
    - + - // returns. + - + errorfLn(errMsg)
    + 171 +
    - + - func (_CounterAndBlock *CounterAndBlockRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + - + panic(err)
    + 172 +
    - + - return _CounterAndBlock.Contract.CounterAndBlockCaller.contract.Call(opts, result, method, params...) + - + }
    + 173 +
    - + + - }
    + 174 +
    - + + -
    + 175 +
    - + - // Transfer initiates a plain transaction to move funds to the contract, calling + - + func chkErr(err error) {
    + 176 +
    - + - // its default method if one is available. + - + if err != nil {
    + 177 +
    - + - func (_CounterAndBlock *CounterAndBlockRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + - + errorfLn(err.Error())
    + 178 +
    - + - return _CounterAndBlock.Contract.CounterAndBlockTransactor.contract.Transfer(opts) + - + panic(err)
    + 179 +
    - + - } + - + }
    + 180 +
    - + -
    + - + }
    + 181 +
    - + - // Transact invokes the (paid) contract method with params as input values. + - +
    + 182 +
    - + - func (_CounterAndBlock *CounterAndBlockRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + - + func errorfLn(format string, args ...interface{}) {
    + 183 +
    - + - return _CounterAndBlock.Contract.CounterAndBlockTransactor.contract.Transact(opts, method, params...) + - + printfLn("ERROR: "+format, args...)
    + 184 +
    - + + - }
    + 185 +
    - + + -
    + 186 +
    - + - // Call invokes the (constant) contract method with params as input values and + - + func printfLn(format string, args ...interface{}) {
    + 187 +
    - + - // sets the output to result. The result type might be a single field for simple + - + fmt.Printf(format+" \n", args...)
    + 188 +
    - + - // returns, a slice of interfaces for anonymous returns and a struct for named + - + } +
    +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    +
     
    - 189 + + -
    - + - // returns. +
    +
    +   +
    - 190 + + -
    - + - func (_CounterAndBlock *CounterAndBlockCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { +
    +
    +   +
    - 191 + + -
    - + - return _CounterAndBlock.Contract.contract.Call(opts, result, method, params...) +
    +
    +   +
    - 192 + + -
    - + - } +
    +
    +   +
    - 193 + + -
    - + +
    +
    +  
    - 194 + + -
    - + - // Transfer initiates a plain transaction to move funds to the contract, calling +
    +
    +   +
    - 195 + + -
    - + - // its default method if one is available. +
    +
    +   +
    - 196 + + -
    - + - func (_CounterAndBlock *CounterAndBlockTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { +
    +
    +   +
    - 197 + + -
    - + - return _CounterAndBlock.Contract.contract.Transfer(opts) +
    +
    +   +
    - 198 + + -
    - + - } +
    +
    +   +
    - 199 + + -
    - + +
    +
    +  
    - 200 + + -
    - + - // Transact invokes the (paid) contract method with params as input values. +
    +
    +   +
    - 201 + + -
    - + - func (_CounterAndBlock *CounterAndBlockTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { +
    +
    +   +
    - 202 + + -
    - + - return _CounterAndBlock.Contract.contract.Transact(opts, method, params...) +
    +
    +   +
    - 203 + + -
    - + - } +
    +
    +   +
    - 204 + + -
    - + +
    +
    +  
    - 205 + + -
    - + - // Count is a free data retrieval call binding the contract method 0x06661abd. +
    +
    +   +
    - 206 + + -
    - + - // +
    +
    +   +
    - 207 + + -
    - + - // Solidity: function count() view returns(uint256) +
    +
    +   +
    - 208 + + -
    - + - func (_CounterAndBlock *CounterAndBlockCaller) Count(opts *bind.CallOpts) (*big.Int, error) { +
    +
    +   +
    - 209 + + -
    - + - var out []interface{} +
    +
    +   +
    - 210 + + -
    - + - err := _CounterAndBlock.contract.Call(opts, &out, "count") +
    +
    +   +
    - 211 + + -
    - + +
    +
    +  
    - 212 + + -
    - + - if err != nil { +
    +
    +   +
    - 213 + + -
    - + - return *new(*big.Int), err +
    +
    +   +
    - 214 + + -
    - + - } +
    +
    +   +
    - 215 + + -
    - + +
    +
    +  
    - 216 + + -
    - + - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) +
    +
    +   +
    - 217 + + -
    - + +
    +
    +  
    - 218 + + -
    - + - return out0, err +
    +
    +   +
    - 219 + + -
    - + +
    +
    +  
    - 220 + + -
    - + - } +
    +
    +   +
    - 221 + + -
    - + +
    +
    +  
    - 222 + + -
    - + - // Count is a free data retrieval call binding the contract method 0x06661abd. +
    +
    +   +
    - 223 + + -
    - + - // +
    +
    +   +
    - 224 + + -
    - + - // Solidity: function count() view returns(uint256) +
    +
    +   +
    - 225 + + -
    - + - func (_CounterAndBlock *CounterAndBlockSession) Count() (*big.Int, error) { +
    +
    +   +
    - 226 + + -
    - + - return _CounterAndBlock.Contract.Count(&_CounterAndBlock.CallOpts) +
    +
    +   +
    - 227 + + -
    - + - } +
    +
    +   +
    - 228 + + -
    - + +
    +
    +  
    - 229 + + -
    - + - // Count is a free data retrieval call binding the contract method 0x06661abd. +
    +
    +   +
    - 230 + + -
    - + - // +
    +
    +   +
    - 231 + + -
    - + - // Solidity: function count() view returns(uint256) +
    +
    +   +
    - 232 + + -
    - + - func (_CounterAndBlock *CounterAndBlockCallerSession) Count() (*big.Int, error) { +
    +
    +   +
    - 233 + + -
    - + - return _CounterAndBlock.Contract.Count(&_CounterAndBlock.CallOpts) +
    +
    +   +
    - 234 + + -
    - + - } +
    +
    +   +
    - 235 + + -
    - + +
    +
    +  
    - 236 + + -
    - + - // GetCount is a free data retrieval call binding the contract method 0xa87d942c. +
    +
    +   +
    - 237 + + -
    - + - // +
    +
    +   +
    - 238 + + -
    - + - // Solidity: function getCount() view returns(uint256, uint256) +
    +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    - 239 + + -
    - + - func (_CounterAndBlock *CounterAndBlockCaller) GetCount(opts *bind.CallOpts) (*big.Int, *big.Int, error) { +
    +
    +   +
    - 240 + + -
    - + - var out []interface{} +
    +
    +   +
    - 241 + + -
    - + - err := _CounterAndBlock.contract.Call(opts, &out, "getCount") +
    +
    +   +
    - 242 + + -
    - + +
    +
    +  
    - 243 + + -
    - + - if err != nil { +
    +
    +   +
    - 244 + + -
    - + - return *new(*big.Int), *new(*big.Int), err +
    +
    +   +
    - 245 + + -
    - + - } +
    +
    +   +
    - 246 + + -
    - + +
    +
    +  
    - 247 + + -
    - + - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) +
    +
    +   +
    - 248 + + -
    - + - out1 := *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) +
    +
    +   +
    - 249 + + -
    - + +
    +
    +  
    - 250 + + -
    - + - return out0, out1, err +
    +
    +   +
    - 251 + + -
    - + +
    +
    +  
    - 252 + + -
    - + - } +
    +
    +   +
    - 253 + + -
    - + +
    +
    +  
    - 254 + + -
    - + - // GetCount is a free data retrieval call binding the contract method 0xa87d942c. +
    +
    +   +
    - 255 + + -
    - + - // +
    +
    +   +
    - 256 + + -
    - + - // Solidity: function getCount() view returns(uint256, uint256) +
    +
    +   +
    - 257 + + -
    - + - func (_CounterAndBlock *CounterAndBlockSession) GetCount() (*big.Int, *big.Int, error) { +
    +
    +   +
    - 258 + + -
    - + - return _CounterAndBlock.Contract.GetCount(&_CounterAndBlock.CallOpts) +
    +
    +   +
    - 259 + + -
    - + - } +
    +
    +   +
    - 260 + + -
    - + +
    +
    +  
    - 261 + + -
    - + - // GetCount is a free data retrieval call binding the contract method 0xa87d942c. +
    +
    +   +
    - 262 + + -
    - + - // +
    +
    +   +
    - 263 + + -
    - + - // Solidity: function getCount() view returns(uint256, uint256) +
    +
    +   +
    - 264 + + -
    - + - func (_CounterAndBlock *CounterAndBlockCallerSession) GetCount() (*big.Int, *big.Int, error) { +
    +
    +   +
    - 265 + + -
    - + - return _CounterAndBlock.Contract.GetCount(&_CounterAndBlock.CallOpts) +
    +
    +   +
    - 266 + + -
    - + - } +
    +
    +   +
    - 267 + + -
    - + +
    +
    +  
    - 268 + + -
    - + - // Increment is a paid mutator transaction binding the contract method 0xd09de08a. +
    +
    +   +
    - 269 + + -
    - + - // +
    +
    +   +
    - 270 + + -
    - + - // Solidity: function increment() returns() +
    +
    +   +
    - 271 + + -
    - + - func (_CounterAndBlock *CounterAndBlockTransactor) Increment(opts *bind.TransactOpts) (*types.Transaction, error) { +
    +
    +   +
    - 272 + + -
    - + - return _CounterAndBlock.contract.Transact(opts, "increment") +
    +
    +   +
    - 273 + + -
    - + - } +
    +
    +   +
    - 274 + + -
    - + +
    +
    +  
    - 275 + + -
    - + - // Increment is a paid mutator transaction binding the contract method 0xd09de08a. +
    +
    +   +
    - 276 + + -
    - + - // +
    +
    +   +
    - 277 + + -
    - + - // Solidity: function increment() returns() +
    +
    +   +
    - 278 + + -
    - + - func (_CounterAndBlock *CounterAndBlockSession) Increment() (*types.Transaction, error) { +
    +
    +   +
    - 279 + + -
    - + - return _CounterAndBlock.Contract.Increment(&_CounterAndBlock.TransactOpts) +
    +
    +   +
    - 280 + + -
    - + - } +
    +
    +   +
    - 281 + + -
    - + +
    +
    +  
    - 282 + + -
    - + - // Increment is a paid mutator transaction binding the contract method 0xd09de08a. +
    +
    +   +
    - 283 + + -
    - + - // +
    +
    +   +
    - 284 + + -
    - + - // Solidity: function increment() returns() +
    +
    +   +
    - 285 + + -
    - + - func (_CounterAndBlock *CounterAndBlockTransactorSession) Increment() (*types.Transaction, error) { +
    +
    +   +
    - 286 + + -
    - + - return _CounterAndBlock.Contract.Increment(&_CounterAndBlock.TransactOpts) +
    +
    +   +
    - 287 - -
    - + - } -
    +
    +
    -
    + +
    +   +
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/test/contracts/bin/customModExp/customModExp.go - RENAMED - -
    -
    -
    -
    - - - - - + + +
    -
    @@ -0,0 +1,224 @@
    @@ -134286,1165 +328004,1658 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0


    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/scripts/http_ws_sync/main.go + RENAMED + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +
    +
    @@ -1,161 +0,0 @@
    +
    + 1 + +
    + - + package main +
    +
    + 2 + +
    + - +
    +
    +
    + 3 + +
    + - + import ( +
    +
    + 4 + +
    + - + "context" +
    +
    + 5 + +
    + - + "fmt" +
    +
    + 6 + +
    + - + "math/big" +
    +
    + 7 + +
    + - + "os" +
    +
    + 8 + +
    + - + "os/signal" +
    +
    + 9 + +
    + - + "sync" +
    +
    + 10 + +
    + - + "sync/atomic" +
    +
    + 11 + +
    + - + "syscall" +
    +
    + 12 + +
    + - + "time" +
    +
    + 13 + +
    + - +
    +
    +
    + 14 + +
    + - + "github.com/ethereum/go-ethereum" +
    +
    + 15 + +
    + - + "github.com/ethereum/go-ethereum/core/types" +
    +
    + 16 + +
    + - + "github.com/ethereum/go-ethereum/ethclient" +
    +
    + 17 + +
    + - + "github.com/ethereum/go-ethereum/rpc" +
    +
    + 18 + +
    + - + ) +
    +
    + 19 + +
    + - +
    +
    +
    + 20 + +
    + - + func main() { +
    +
    + 21 + +
    + - + const httpUrl = "https://zkevm-rpc.com" +
    +
    + 22 + +
    + - + const wsUrl = "wss://ws.zkevm-rpc.com" +
    +
    + 23 + +
    + - +
    +
    +
    + 24 + +
    + - + const numberOfConnections = 10 +
    +
    + 25 + +
    + - + const intervalToCheckBlockNumber = 2 * time.Second +
    +
    + 26 + +
    + - +
    +
    +
    + 27 + +
    + - + const enableLogSubscription = true +
    +
    + 28 + +
    + - +
    +
    +
    + 29 + +
    + - + wg := sync.WaitGroup{} +
    +
    + 30 + +
    + - + wg.Add(numberOfConnections) +
    +
    + 31 + +
    + - + for connID := 0; connID < numberOfConnections; connID++ { +
    +
    + 32 + +
    + - + go func(connID int) { +
    +
    + 33 + +
    + - + ctx := context.Background() +
    +
    + 34 + +
    + - +
    +
    +
    + 35 + +
    + - + logf(connID, "connecting to: %v\n", httpUrl) +
    +
    + 36 + +
    + - + httpClient, err := ethclient.Dial(httpUrl) +
    +
    + 37 + +
    + - + chkErr(connID, err) +
    +
    + 38 + +
    + - + logf(connID, "connected to: %v\n", httpUrl) +
    +
    + 39 + +
    + - +
    +
    +
    + 40 + +
    + - + latestBlockNumber, err := httpClient.BlockNumber(ctx) +
    +
    + 41 + +
    + - + chkErr(connID, err) +
    +
    + 42 + +
    + - +
    +
    +
    + 43 + +
    + - + logf(connID, "connecting to: %v\n", wsUrl) +
    +
    + 44 + +
    + - + wsClient, err := ethclient.Dial(wsUrl) +
    +
    + 45 + +
    + - + chkErr(connID, err) +
    +
    - + + 46 -
    -   -
    +
    +
    + - + logf(connID, "connected to: %v\n", wsUrl)
    - + + 47 -
    -   +
    +
    + -
    - + + 48 -
    -   -
    +
    +
    + - + signals := make(chan os.Signal, 100)
    - + + 49 -
    -   -
    +
    +
    + - + signal.Notify(signals, os.Interrupt, syscall.SIGTERM)
    - + + 50 -
    -   +
    +
    + -
    - + + 51 -
    -   -
    +
    +
    + - + lastWSBlockNumber := uint64(0)
    - + + 52 -
    -   -
    +
    +
    + - + numberOfLogsReceived := uint64(0)
    - + + 53 -
    -   +
    +
    + -
    - + + 54 -
    -   -
    +
    +
    + - + // concurrently check block synchronization and logs received
    - + + 55 -
    -   -
    +
    +
    + - + go func(connID int, httpClient *ethclient.Client) {
    - + + 56 -
    -   -
    +
    +
    + - + for {
    - + + 57 -
    -   -
    +
    +
    + - + if lastWSBlockNumber != 0 {
    - + + 58 -
    -   -
    +
    +
    + - + httpBlockNumber, err := httpClient.BlockNumber(ctx)
    - + + 59 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 60 -
    -   -
    +
    +
    + - + logf(connID, "%v failed to check block sync, retrying...\n", time.Now().Format(time.RFC3339Nano))
    - + + 61 -
    -   -
    +
    +
    + - + time.Sleep(intervalToCheckBlockNumber)
    - + + 62 -
    -   -
    +
    +
    + - + continue
    - + + 63 -
    -   -
    +
    +
    + - + }
    - + + 64 -
    -   +
    +
    + -
    - + + 65 -
    -   -
    +
    +
    + - + wsBlockNumber := atomic.LoadUint64(&lastWSBlockNumber)
    - + + 66 -
    -   +
    +
    + -
    - + + 67 -
    -   -
    +
    +
    + - + diff := httpBlockNumber - wsBlockNumber
    - + + 68 -
    -   -
    +
    +
    + - + logf(connID, "%v wsBlockNumber: %v httpBlockNumber: %v diff: %v\n", time.Now().Format(time.RFC3339Nano), wsBlockNumber, httpBlockNumber, diff)
    - + + 69 -
    -   -
    +
    +
    + - + }
    - + + 70 -
    -   -
    +
    +
    + - + if numberOfLogsReceived > 0 {
    - + + 71 -
    -   -
    +
    +
    + - + logf(connID, "%v logs received: %v\n", time.Now().Format(time.RFC3339Nano), numberOfLogsReceived)
    - + + 72 -
    -   -
    +
    +
    + - + }
    - + + 73 -
    -   +
    +
    + -
    - + + 74 -
    -   -
    +
    +
    + - + time.Sleep(intervalToCheckBlockNumber)
    - + + 75 -
    -   -
    +
    +
    + - + }
    - + + 76 -
    -   -
    +
    +
    + - + }(connID, httpClient)
    - + + 77 -
    -   +
    +
    + -
    - + + 78 -
    -   -
    +
    +
    + - + newHeaders := make(chan *types.Header)
    - + + 79 -
    -   -
    +
    +
    + - + subHeaders, err := wsClient.SubscribeNewHead(ctx, newHeaders)
    - + + 80 -
    -   -
    +
    +
    + - + chkErr(connID, err)
    - + + 81 -
    -   -
    +
    +
    + - + logf(connID, "subscribed to newHeads\n")
    - + + 82 -
    -   +
    +
    + -
    - + + 83 -
    -   -
    +
    +
    + - + newLogs := make(chan types.Log)
    - + + 84 -
    -   -
    +
    +
    + - + var subLogs ethereum.Subscription = &rpc.ClientSubscription{}
    - + + 85 -
    -   -
    +
    +
    + - + if enableLogSubscription {
    - + + 86 -
    -   -
    +
    +
    + - + subLogs, err = wsClient.SubscribeFilterLogs(ctx, ethereum.FilterQuery{
    - + + 87 -
    -   -
    +
    +
    + - + FromBlock: big.NewInt(0).SetUint64(latestBlockNumber),
    - + + 88 -
    -   -
    +
    +
    + - + ToBlock: big.NewInt(0).SetUint64(latestBlockNumber + 10000),
    - + + 89 -
    -   -
    +
    +
    + - + }, newLogs)
    - + + 90 -
    -   -
    +
    +
    + - + chkErr(connID, err)
    - + + 91 -
    -   -
    +
    +
    + - + logf(connID, "subscribed to filterLogs\n")
    - + + 92 -
    -   -
    +
    +
    + - + }
    - + + 93 -
    -   +
    +
    + -
    - + + 94 -
    -   -
    +
    +
    + - + // concurrently infinite sending messages
    - + + 95 -
    -   -
    +
    +
    + - + go func(connID int, ctx context.Context, wsClient *ethclient.Client) {
    - + + 96 -
    -   -
    +
    +
    + - + for {
    - + + 97 -
    -   -
    +
    +
    + - + //bn, err := wsClient.BlockNumber(ctx)
    - + + 98 -
    -   -
    +
    +
    + - + _, err := wsClient.BlockNumber(ctx)
    - + + 99 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 100 -
    -   -
    +
    +
    + - + errorf(connID, "ERROR: %v\n", err.Error())
    - + + 101 -
    -   -
    +
    +
    + - + }
    - + + 102 -
    -   -
    +
    +
    + - + // logf(connID, "block number retrieved via message: %v\n", bn)
    - + + 103 -
    -   -
    +
    +
    + - + time.Sleep(time.Second)
    - + + 104 -
    -   -
    +
    +
    + - + }
    - + + 105 -
    -   -
    +
    +
    + - + }(connID, ctx, wsClient)
    - + + 106 -
    -   +
    +
    + -
    - + + 107 -
    -   -
    +
    +
    + - + out:
    - + + 108 -
    -   -
    +
    +
    + - + for {
    - + + 109 -
    -   -
    +
    +
    + - + select {
    - + + 110 -
    -   -
    +
    +
    + - + case err := <-subHeaders.Err():
    - + + 111 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 112 -
    -   -
    +
    +
    + - + errorf(connID, "%v\n", err.Error())
    - + + 113 -
    -   -
    +
    +
    + - + wg.Done()
    - + + 114 -
    -   -
    +
    +
    + - + break out
    - + + 115 -
    -   -
    +
    +
    + - + }
    - + + 116 -
    -   -
    +
    +
    + - + case err := <-subLogs.Err():
    - + + 117 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 118 -
    -   -
    +
    +
    + - + errorf(connID, "%v\n", err.Error())
    - + + 119 -
    -   -
    +
    +
    + - + wg.Done()
    - + + 120 -
    -   -
    +
    +
    + - + break out
    - + + 121 -
    -   -
    +
    +
    + - + }
    - + + 122 -
    -   -
    +
    +
    + - + case header := <-newHeaders:
    - + + 123 -
    -   -
    +
    +
    + - + atomic.StoreUint64(&lastWSBlockNumber, header.Number.Uint64())
    - + + 124 -
    -   -
    +
    +
    + - + // logf(connID, "%v L2 Block Received: %v\n", time.Now().Format(time.RFC3339Nano), header.Number.Uint64())
    - + + 125 -
    -   -
    +
    +
    + - + case <-newLogs:
    - + + 126 -
    -   -
    +
    +
    + - + atomic.AddUint64(&numberOfLogsReceived, 1)
    - + + 127 -
    -   -
    +
    +
    + - + // logf(connID, "%v Log Received: %v - %v\n", time.Now().Format(time.RFC3339Nano), log.TxHash.String(), log.Index)
    - + + 128 -
    -   -
    +
    +
    + - + case <-signals:
    - + + 129 -
    -   -
    +
    +
    + - + subHeaders.Unsubscribe()
    - + + 130 -
    -   -
    +
    +
    + - + if enableLogSubscription {
    - + + 131 -
    -   -
    +
    +
    + - + subLogs.Unsubscribe()
    - + + 132 -
    -   -
    +
    +
    + - + }
    - + + 133 -
    -   -
    +
    +
    + - + logf(connID, "unsubscribed\n")
    - + + 134 -
    -   -
    +
    +
    + - + close(newHeaders)
    - + + 135 -
    -   -
    +
    +
    + - + close(newLogs)
    - + + 136 -
    -   -
    +
    +
    + - + wg.Done()
    - + + 137 -
    -   -
    +
    +
    + - + break out
    - + + 138 -
    -   -
    +
    +
    + - + }
    - + + 139 -
    -   -
    +
    +
    + - + }
    - + + 140 -
    -   -
    +
    +
    + - + }(connID)
    - + + 141 -
    -   -
    +
    +
    + - + }
    - + + 142 -
    -   -
    +
    +
    + - + wg.Wait()
    - + + 143 -
    -   -
    +
    +
    + - + }
    - + + 144 -
    -   +
    +
    + -
    - + + 145 -
    -   -
    +
    +
    + - + func chkErr(connID int, err error) {
    - + + 146 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 147 -
    -   -
    +
    +
    + - + errorf(connID, err.Error())
    - + + 148 -
    -   -
    +
    +
    + - + os.Exit(0)
    - + + 149 -
    -   -
    +
    +
    + - + }
    - + + 150 -
    -   -
    +
    +
    + - + }
    - + + 151 -
    -   +
    +
    + -
    - + + 152 -
    -   -
    +
    +
    + - + func logf(connID int, format string, args ...any) {
    - + + 153 -
    -   -
    +
    +
    + - + msg := fmt.Sprintf(format, args...)
    - + + 154 -
    -   -
    +
    +
    + - + fmt.Printf("[connID: %v] %v", connID, msg)
    - + + 155 -
    -   -
    +
    +
    + - + }
    - + + 156 -
    -   +
    +
    + -
    - + + 157 -
    -   -
    +
    +
    + - + func errorf(connID int, format string, args ...any) {
    - + + 158 -
    -   -
    +
    +
    + - + msg := fmt.Sprintf(format, args...)
    - + + 159 -
    -   -
    +
    +
    + - + msg = fmt.Sprintf("*****ERROR: %v", msg)
    - + + 160 -
    -   -
    +
    +
    + - + logf(connID, msg)
    - + + 161 -
    -   -
    +
    +
    + - + } +
    +
    +
    +
    +
    + + + + + - - -
    +
     
    @@ -135863,2261 +330074,1500 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

      -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +
    -
     
    -
    - 1 - -
    - + - // Code generated - DO NOT EDIT. -
    -
    - 2 - -
    - + - // This file is a generated binding and any manual changes will be lost. -
    -
    - 3 - -
    - + -
    -
    -
    - 4 - -
    - + - package customModExp -
    -
    - 5 - -
    - + -
    -
    -
    - 6 - -
    - + - import ( -
    -
    - 7 - -
    - + - "errors" -
    -
    - 8 - -
    - + - "math/big" -
    -
    - 9 - -
    - + - "strings" -
    -
    - 10 - -
    - + -
    -
    -
    - 11 - -
    - + - ethereum "github.com/ethereum/go-ethereum" -
    -
    - 12 - -
    - + - "github.com/ethereum/go-ethereum/accounts/abi" -
    -
    - 13 - -
    - + - "github.com/ethereum/go-ethereum/accounts/abi/bind" -
    -
    - 14 - -
    - + - "github.com/ethereum/go-ethereum/common" -
    -
    - 15 - -
    - + - "github.com/ethereum/go-ethereum/core/types" -
    -
    - 16 - -
    - + - "github.com/ethereum/go-ethereum/event" -
    -
    - 17 - -
    - + - ) -
    -
    - 18 - -
    - + -
    -
    -
    - 19 - -
    - + - // Reference imports to suppress errors if they are not otherwise used. -
    -
    - 20 - -
    - + - var ( -
    -
    - 21 - -
    - + - _ = errors.New -
    -
    - 22 - -
    - + - _ = big.NewInt -
    -
    - 23 - -
    - + - _ = strings.NewReader -
    -
    - 24 - -
    - + - _ = ethereum.NotFound -
    -
    - 25 - -
    - + - _ = bind.Bind -
    -
    - 26 - -
    - + - _ = common.Big1 -
    -
    - 27 - -
    - + - _ = types.BloomLookup -
    -
    - 28 - -
    - + - _ = event.NewSubscription -
    -
    - 29 - -
    - + - _ = abi.ConvertType -
    -
    - 30 - -
    - + - ) -
    -
    - 31 - -
    - + -
    -
    -
    - 32 - -
    - + - // CustomModExpMetaData contains all meta data concerning the CustomModExp contract. -
    -
    - 33 - -
    - + - var CustomModExpMetaData = &bind.MetaData{ -
    -
    - 34 - -
    - + - ABI: "[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"input\",\"type\":\"bytes\"}],\"name\":\"modExpGeneric\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", -
    -
    - 35 - -
    - + - Bin: "0x608060405234801561001057600080fd5b50610208806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063d5665d6f14610030575b600080fd5b61004361003e3660046100e2565b610045565b005b61004d6100ad565b6101408183516020850160055afa60009081555b600a8110156100a8578181600a811061007c5761007c610193565b6020020151600482600a811061009457610094610193565b0155806100a0816101a9565b915050610061565b505050565b604051806101400160405280600a906020820280368337509192915050565b634e487b7160e01b600052604160045260246000fd5b6000602082840312156100f457600080fd5b813567ffffffffffffffff8082111561010c57600080fd5b818401915084601f83011261012057600080fd5b813581811115610132576101326100cc565b604051601f8201601f19908116603f0116810190838211818310171561015a5761015a6100cc565b8160405282815287602084870101111561017357600080fd5b826020860160208301376000928101602001929092525095945050505050565b634e487b7160e01b600052603260045260246000fd5b60006000198214156101cb57634e487b7160e01b600052601160045260246000fd5b506001019056fea26469706673582212206c4940b4c9a7086754420734c8b4921cdb547ec8b31fc3bf8cd884ad9778a5b364736f6c634300080c0033", -
    -
    - 36 - -
    - + - } -
    -
    - 37 - -
    - + -
    -
    -
    - 38 - -
    - + - // CustomModExpABI is the input ABI used to generate the binding from. -
    -
    - 39 - -
    - + - // Deprecated: Use CustomModExpMetaData.ABI instead. -
    -
    - 40 - -
    - + - var CustomModExpABI = CustomModExpMetaData.ABI -
    -
    - 41 - -
    - + -
    -
    -
    - 42 - -
    - + - // CustomModExpBin is the compiled bytecode used for deploying new contracts. -
    -
    - 43 - -
    - + - // Deprecated: Use CustomModExpMetaData.Bin instead. -
    -
    - 44 - -
    - + - var CustomModExpBin = CustomModExpMetaData.Bin -
    -
    - 45 - -
    - + -
    -
    -
    - 46 - -
    - + - // DeployCustomModExp deploys a new Ethereum contract, binding an instance of CustomModExp to it. -
    -
    - 47 - -
    - + - func DeployCustomModExp(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *CustomModExp, error) { -
    -
    - 48 - -
    - + - parsed, err := CustomModExpMetaData.GetAbi() -
    -
    - 49 - -
    - + - if err != nil { -
    -
    - 50 - -
    - + - return common.Address{}, nil, nil, err -
    -
    - 51 - -
    - + - } -
    -
    - 52 - -
    - + - if parsed == nil { -
    -
    - 53 - -
    - + - return common.Address{}, nil, nil, errors.New("GetABI returned nil") -
    -
    - 54 - -
    - + - } -
    -
    - 55 - -
    - + -
    -
    -
    - 56 - -
    - + - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(CustomModExpBin), backend) -
    -
    - 57 - -
    - + - if err != nil { -
    -
    - 58 - -
    - + - return common.Address{}, nil, nil, err -
    -
    - 59 - -
    - + - } -
    -
    - 60 - -
    - + - return address, tx, &CustomModExp{CustomModExpCaller: CustomModExpCaller{contract: contract}, CustomModExpTransactor: CustomModExpTransactor{contract: contract}, CustomModExpFilterer: CustomModExpFilterer{contract: contract}}, nil -
    -
    - 61 - -
    - + - } -
    -
    - 62 - -
    - + -
    -
    -
    - 63 - -
    - + - // CustomModExp is an auto generated Go binding around an Ethereum contract. -
    -
    - 64 - -
    - + - type CustomModExp struct { -
    -
    - 65 - -
    - + - CustomModExpCaller // Read-only binding to the contract -
    -
    - 66 - -
    - + - CustomModExpTransactor // Write-only binding to the contract -
    -
    - 67 - -
    - + - CustomModExpFilterer // Log filterer for contract events -
    -
    - 68 - -
    - + - } -
    -
    - 69 - -
    - + -
    -
    -
    - 70 - -
    - + - // CustomModExpCaller is an auto generated read-only Go binding around an Ethereum contract. -
    -
    - 71 - -
    - + - type CustomModExpCaller struct { -
    -
    - 72 - -
    - + - contract *bind.BoundContract // Generic contract wrapper for the low level calls -
    -
    - 73 - -
    - + - } -
    -
    - 74 - -
    - + -
    -
    -
    - 75 - -
    - + - // CustomModExpTransactor is an auto generated write-only Go binding around an Ethereum contract. -
    -
    - 76 - -
    - + - type CustomModExpTransactor struct { -
    -
    - 77 - -
    - + - contract *bind.BoundContract // Generic contract wrapper for the low level calls -
    -
    - 78 - -
    - + - } +
    - 79 + + -
    - + +
    +
    +  
    - 80 + + -
    - + - // CustomModExpFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +
    +
    +   +
    - 81 + + -
    - + - type CustomModExpFilterer struct { +
    +
    +   +
    - 82 + + -
    - + - contract *bind.BoundContract // Generic contract wrapper for the low level calls +
    +
    +   +
    - 83 + + -
    - + - } +
    +
    +   +
    - 84 + + -
    - + +
    +
    +  
    - 85 + + -
    - + - // CustomModExpSession is an auto generated Go binding around an Ethereum contract, +
    +
    +   +
    - 86 + + -
    - + - // with pre-set call and transact options. +
    +
    +   +
    - 87 + + -
    - + - type CustomModExpSession struct { +
    +
    +   +
    - 88 + + -
    - + - Contract *CustomModExp // Generic contract binding to set the session for +
    +
    +   +
    - 89 + + -
    - + - CallOpts bind.CallOpts // Call options to use throughout this session +
    +
    +   +
    - 90 + + -
    - + - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +
    +
    +   +
    - 91 + + -
    - + - } +
    +
    +   +
    - 92 + + -
    - + +
    +
    +  
    - 93 + + -
    - + - // CustomModExpCallerSession is an auto generated read-only Go binding around an Ethereum contract, +
    +
    +   +
    - 94 + + -
    - + - // with pre-set call options. +
    +
    +   +
    - 95 + + -
    - + - type CustomModExpCallerSession struct { +
    +
    +   +
    - 96 + + -
    - + - Contract *CustomModExpCaller // Generic contract caller binding to set the session for +
    +
    +   +
    - 97 + + -
    - + - CallOpts bind.CallOpts // Call options to use throughout this session +
    +
    +   +
    - 98 + + -
    - + - } +
    +
    +   +
    - 99 + + -
    - + +
    +
    +  
    - 100 + + -
    - + - // CustomModExpTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +
    +
    +   +
    - 101 + + -
    - + - // with pre-set transact options. +
    +
    +   +
    - 102 + + -
    - + - type CustomModExpTransactorSession struct { +
    +
    +   +
    - 103 + + -
    - + - Contract *CustomModExpTransactor // Generic contract transactor binding to set the session for +
    +
    +   +
    - 104 + + -
    - + - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +
    +
    +   +
    - 105 + + -
    - + - } +
    +
    +   +
    - 106 + + -
    - + +
    +
    +  
    - 107 + + -
    - + - // CustomModExpRaw is an auto generated low-level Go binding around an Ethereum contract. +
    +
    +   +
    - 108 + + -
    - + - type CustomModExpRaw struct { +
    +
    +   +
    - 109 + + -
    - + - Contract *CustomModExp // Generic contract binding to access the raw methods on +
    +
    +   +
    - 110 + + -
    - + - } +
    +
    +   +
    - 111 + + -
    - + +
    +
    +  
    - 112 + + -
    - + - // CustomModExpCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +
    +
    +   +
    - 113 + + -
    - + - type CustomModExpCallerRaw struct { +
    +
    +   +
    - 114 + + -
    - + - Contract *CustomModExpCaller // Generic read-only contract binding to access the raw methods on +
    +
    +   +
    - 115 + + -
    - + - } +
    +
    +   +
    - 116 + + -
    - + +
    +
    +  
    - 117 + + -
    - + - // CustomModExpTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +
    +
    +   +
    - 118 + + -
    - + - type CustomModExpTransactorRaw struct { +
    +
    +   +
    - 119 + + -
    - + - Contract *CustomModExpTransactor // Generic write-only contract binding to access the raw methods on +
    +
    +   +
    - 120 + + -
    - + - } +
    +
    +   +
    - 121 + + -
    - + +
    +
    +  
    - 122 + + -
    - + - // NewCustomModExp creates a new instance of CustomModExp, bound to a specific deployed contract. +
    +
    +   +
    - 123 + + -
    - + - func NewCustomModExp(address common.Address, backend bind.ContractBackend) (*CustomModExp, error) { +
    +
    +   +
    - 124 + + -
    - + - contract, err := bindCustomModExp(address, backend, backend, backend) +
    +
    +   +
    - 125 + + -
    - + - if err != nil { +
    +
    +   +
    - 126 + + -
    - + - return nil, err +
    +
    +   +
    - 127 + + -
    - + - } +
    +
    +   +
    - 128 + + -
    - + - return &CustomModExp{CustomModExpCaller: CustomModExpCaller{contract: contract}, CustomModExpTransactor: CustomModExpTransactor{contract: contract}, CustomModExpFilterer: CustomModExpFilterer{contract: contract}}, nil +
    +
    +   +
    - 129 + + -
    - + - } +
    +
    +   +
    - 130 + + -
    - + +
    +
    +  
    - 131 + + -
    - + - // NewCustomModExpCaller creates a new read-only instance of CustomModExp, bound to a specific deployed contract. +
    +
    +   +
    - 132 + + -
    - + - func NewCustomModExpCaller(address common.Address, caller bind.ContractCaller) (*CustomModExpCaller, error) { +
    +
    +   +
    - 133 + + -
    - + - contract, err := bindCustomModExp(address, caller, nil, nil) +
    +
    +   +
    - 134 + + -
    - + - if err != nil { +
    +
    +   +
    - 135 + + -
    - + - return nil, err +
    +
    +   +
    - 136 + + -
    - + - } +
    +
    +   +
    - 137 + + -
    - + - return &CustomModExpCaller{contract: contract}, nil +
    +
    +   +
    - 138 + + -
    - + - } +
    +
    +   +
    - 139 + + -
    - + +
    +
    +  
    - 140 + + -
    - + - // NewCustomModExpTransactor creates a new write-only instance of CustomModExp, bound to a specific deployed contract. +
    +
    +   +
    - 141 + + -
    - + - func NewCustomModExpTransactor(address common.Address, transactor bind.ContractTransactor) (*CustomModExpTransactor, error) { +
    +
    +   +
    - 142 + + -
    - + - contract, err := bindCustomModExp(address, nil, transactor, nil) +
    +
    +   +
    - 143 + + -
    - + - if err != nil { +
    +
    +   +
    - 144 + + -
    - + - return nil, err +
    +
    +   +
    - 145 + + -
    - + - } +
    +
    +   +
    - 146 + + -
    - + - return &CustomModExpTransactor{contract: contract}, nil +
    +
    +   +
    - 147 + + -
    - + - } +
    +
    +   +
    - 148 + + -
    - + +
    +
    +  
    - 149 + + -
    - + - // NewCustomModExpFilterer creates a new log filterer instance of CustomModExp, bound to a specific deployed contract. +
    +
    +   +
    - 150 + + -
    - + - func NewCustomModExpFilterer(address common.Address, filterer bind.ContractFilterer) (*CustomModExpFilterer, error) { +
    +
    +   +
    - 151 + + -
    - + - contract, err := bindCustomModExp(address, nil, nil, filterer) +
    +
    +   +
    - 152 + + -
    - + - if err != nil { +
    +
    +   +
    - 153 + + -
    - + - return nil, err +
    +
    +   +
    - 154 + + -
    - + - } +
    +
    +   +
    - 155 + + -
    - + - return &CustomModExpFilterer{contract: contract}, nil +
    +
    +   +
    - 156 + + -
    - + - } +
    +
    +   +
    - 157 + + -
    - + +
    +
    +  
    - 158 + + -
    - + - // bindCustomModExp binds a generic wrapper to an already deployed contract. +
    +
    +   +
    - 159 + + -
    - + - func bindCustomModExp(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { +
    +
    +   +
    - 160 + + -
    - + - parsed, err := CustomModExpMetaData.GetAbi() +
    +
    +   +
    - 161 + + -
    - + - if err != nil { +
    +
    +   +
    - 162 + + -
    - + - return nil, err +
    +
    +   +
    - 163 + + -
    - + - } +
    +
    +   +
    - 164 + + -
    - + - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +
    +
    +   +
    - 165 + + -
    - + - } +
    +
    +   +
    - 166 + + -
    - + +
    +
    +  
    - 167 + + -
    - + - // Call invokes the (constant) contract method with params as input values and +
    +
    +   +
    - 168 + + -
    - + - // sets the output to result. The result type might be a single field for simple +
    +
    +   +
    - 169 + + -
    - + - // returns, a slice of interfaces for anonymous returns and a struct for named +
    +
    +   +
    - 170 + + -
    - + - // returns. +
    +
    +   +
    - 171 + + -
    - + - func (_CustomModExp *CustomModExpRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { +
    +
    +   +
    - 172 + + -
    - + - return _CustomModExp.Contract.CustomModExpCaller.contract.Call(opts, result, method, params...) +
    +
    +   +
    - 173 + + -
    - + - } +
    +
    +   +
    - 174 + + -
    - + +
    +
    +  
    - 175 + + -
    - + - // Transfer initiates a plain transaction to move funds to the contract, calling +
    +
    +   +
    - 176 + + -
    - + - // its default method if one is available. +
    +
    +   +
    - 177 + + -
    - + - func (_CustomModExp *CustomModExpRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { +
    +
    +   +
    - 178 + + -
    - + - return _CustomModExp.Contract.CustomModExpTransactor.contract.Transfer(opts) +
    +
    +   +
    - 179 + + -
    - + - } +
    +
    +   +
    - 180 + + -
    - + +
    +
    +  
    - 181 + + -
    - + - // Transact invokes the (paid) contract method with params as input values. +
    +
    +   +
    - 182 + + -
    - + - func (_CustomModExp *CustomModExpRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { +
    +
    +   +
    - 183 + + -
    - + - return _CustomModExp.Contract.CustomModExpTransactor.contract.Transact(opts, method, params...) +
    +
    +   +
    - 184 + + -
    - + - } +
    +
    +   +
    - 185 + + -
    - + +
    +
    +  
    - 186 + + -
    - + - // Call invokes the (constant) contract method with params as input values and +
    +
    +   +
    - 187 + + -
    - + - // sets the output to result. The result type might be a single field for simple +
    +
    +   +
    - 188 + + -
    - + - // returns, a slice of interfaces for anonymous returns and a struct for named +
    +
    +   +
    - 189 + + -
    - + - // returns. +
    +
    +   +
    - 190 + + -
    - + - func (_CustomModExp *CustomModExpCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { +
    +
    +   +
    - 191 + + -
    - + - return _CustomModExp.Contract.contract.Call(opts, result, method, params...) +
    +
    +   +
    - 192 + + -
    - + - } +
    +
    +   +
    - 193 + + -
    - + +
    +
    +  
    - 194 + + -
    - + - // Transfer initiates a plain transaction to move funds to the contract, calling +
    +
    +   +
    - 195 + + -
    - + - // its default method if one is available. +
    +
    +   +
    - 196 + + -
    - + - func (_CustomModExp *CustomModExpTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { +
    +
    +   +
    - 197 + + -
    - + - return _CustomModExp.Contract.contract.Transfer(opts) +
    +
    +   +
    - 198 - -
    - + - } +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/scripts/sendForcedBatch/main.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + +
    +
    @@ -125,13 +125,13 @@
    - 199 + + 125 +
    - + -
    +   + }
    - 200 + + 126 +
    - + - // Transact invokes the (paid) contract method with params as input values. +   + // Create smc client
    - 201 + + 127 +
    - + - func (_CustomModExp *CustomModExpTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { +   + zkevmAddr := common.HexToAddress(cliCtx.String(flagZkevmAddrName))
    - 202 + + 128 +
    - + - return _CustomModExp.Contract.contract.Transact(opts, method, params...) + - + zkevm, err := etrogpolygonzkevm.NewEtrogpolygonzkevm(zkevmAddr, ethClient)
    - 203 + + 129 +
    - + - } +   + if err != nil {
    - 204 + + 130 +
    - + -
    +   + return err
    - 205 + + 131 +
    - + - // ModExpGeneric is a paid mutator transaction binding the contract method 0xd5665d6f. +   + }
    - 206 + + 132 +
    - + - // +   +
    - 207 + + 133 +
    - + - // Solidity: function modExpGeneric(bytes input) returns() +   + rollupManagerAddr := common.HexToAddress(cliCtx.String(flagRollupManagerAddrName))
    - 208 + + 134 +
    - + - func (_CustomModExp *CustomModExpTransactor) ModExpGeneric(opts *bind.TransactOpts, input []byte) (*types.Transaction, error) { + - + rollupManager, err := etrogpolygonrollupmanager.NewEtrogpolygonrollupmanager(rollupManagerAddr, ethClient)
    - 209 + + 135 +
    - + - return _CustomModExp.contract.Transact(opts, "modExpGeneric", input) +   + if err != nil {
    - 210 + + 136 +
    - + - } +   + return err
    - 211 + + 137 +
    - + -
    +   + } +
    +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -138127,12 +331577,12 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    +
    {/home/stefan/go/src/Polygon/zkevm-node → .}/test/contracts/bin/triggerErrors/triggerErrors.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/test/scripts/sequenceForcedBatch/main.go RENAMED
    + + + - - -
    +
     
    - 212 + + 125 +
    - + - // ModExpGeneric is a paid mutator transaction binding the contract method 0xd5665d6f. +   + }
    - 213 + + 126 +
    - + - // +   + // Create smc client
    - 214 + + 127 +
    - + - // Solidity: function modExpGeneric(bytes input) returns() +   + zkevmAddr := common.HexToAddress(cliCtx.String(flagZkevmAddrName))
    - 215 + + 128 +
    + - func (_CustomModExp *CustomModExpSession) ModExpGeneric(input []byte) (*types.Transaction, error) { + zkevm, err := polygonzkevm.NewPolygonzkevm(zkevmAddr, ethClient)
    - 216 + + 129 +
    - + - return _CustomModExp.Contract.ModExpGeneric(&_CustomModExp.TransactOpts, input) +   + if err != nil {
    - 217 + + 130 +
    - + - } +   + return err
    - 218 + + 131 +
    - + -
    +   + }
    - 219 + + 132 +
    - + - // ModExpGeneric is a paid mutator transaction binding the contract method 0xd5665d6f. +   +
    - 220 + + 133 +
    - + - // +   + rollupManagerAddr := common.HexToAddress(cliCtx.String(flagRollupManagerAddrName))
    - 221 + + 134 +
    + - // Solidity: function modExpGeneric(bytes input) returns() + rollupManager, err := polygonrollupmanager.NewPolygonrollupmanager(rollupManagerAddr, ethClient)
    - 222 + + 135 +
    - + - func (_CustomModExp *CustomModExpTransactorSession) ModExpGeneric(input []byte) (*types.Transaction, error) { +   + if err != nil {
    - 223 + + 136 +
    - + - return _CustomModExp.Contract.ModExpGeneric(&_CustomModExp.TransactOpts, input) +   + return err
    - 224 + + 137 +
    - + - } +   + }
    -
    @@ -32,7 +32,7 @@
    +
    @@ -98,8 +98,8 @@
    - 32 + 98
      - // TriggerErrorsMetaData contains all meta data concerning the TriggerErrors contract. + return err
    - 33 + 99
      - var TriggerErrorsMetaData = &bind.MetaData{ + }
    - 34 + 100
      - ABI: "[{\"inputs\":[],\"name\":\"count\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"outOfCountersKeccaks\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"test\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"outOfCountersPoseidon\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"outOfCountersSteps\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"outOfGas\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + // Create smc client
    - 35 + 101 + +
    + - + zkevmAddr := common.HexToAddress(cliCtx.String(flagSmcAddrName)) +
    +
    + 102
    - - Bin: "0x60806040526000805534801561001457600080fd5b5061016c806100246000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c806306661abd1461005c5780632621002a1461007757806331fe52e8146100835780638bd7b5381461008d578063cb4e8cd114610095575b600080fd5b61006560005481565b60405190815260200160405180910390f35b620f4240600020610065565b61008b61009d565b005b61008b6100c3565b61008b6100e9565b60005b60648110156100c0578060005580806100b89061010d565b9150506100a0565b50565b60005b620186a08110156100c0576104d2600052806100e18161010d565b9150506100c6565b60005b61c3508110156100c0578060005580806101059061010d565b9150506100ec565b600060001982141561012f57634e487b7160e01b600052601160045260246000fd5b506001019056fea264697066735822122097beacfaa873e4896937143dfea406cc278b929a28023f7e7020b6dea6e9fc7364736f6c634300080c0033", + zkevm, err := etrogpolygonzkevm.NewEtrogpolygonzkevm(zkevmAddr, ethClient)
    - 36 + 103
      - } + if err != nil {
    - 37 + 104
      -
    + return err
    - 38 + 105
      - // TriggerErrorsABI is the input ABI used to generate the binding from. + }
    -
    -
    -
    -
    - - - + - - - - -
    -
     
    +
    @@ -111,7 +111,7 @@
    - 32 + 111
      - // TriggerErrorsMetaData contains all meta data concerning the TriggerErrors contract. +
    - 33 + 112
      - var TriggerErrorsMetaData = &bind.MetaData{ + log.Info("Using address: ", auth.From)
    - 34 + 113
      - ABI: "[{\"inputs\":[],\"name\":\"count\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"outOfCountersKeccaks\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"test\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"outOfCountersPoseidon\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"outOfCountersSteps\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"outOfGas\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", +
    - 35 + + 114 +
    - + - Bin: "0x60806040526000805534801561001457600080fd5b5061016c806100246000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c806306661abd1461005c5780632621002a1461007757806331fe52e8146100835780638bd7b5381461008d578063cb4e8cd114610095575b600080fd5b61006560005481565b60405190815260200160405180910390f35b620f4240600020610065565b61008b61009d565b005b61008b6100c3565b61008b6100e9565b60005b60648110156100c0578060005580806100b89061010d565b9150506100a0565b50565b60005b620186a08110156100c0576104d2600052806100e18161010d565b9150506100c6565b60005b61c3508110156100c0578060005580806101059061010d565b9150506100ec565b600060001982141561012f57634e487b7160e01b600052601160045260246000fd5b506001019056fea26469706673582212208f01c5dc055b1f376f5da5deb33e2c96ee776174bf48874c5ebba0f606de2ac564736f6c634300080c0033", + - + num, err := zkevm.LastForceBatch(&bind.CallOpts{Pending: false})
    - 36 + 115
      - } + if err != nil {
    - 37 + 116
      -
    + log.Error("error getting lastForBatch number. Error : ", err)
    - 38 + 117
      - // TriggerErrorsABI is the input ABI used to generate the binding from. + return err
    -
    -
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/test/docker-compose.yml - RENAMED - -
    -
    -
    -
    - - - + - - - - + + +
    -
    @@ -2,7 +2,7 @@
    +
    @@ -130,14 +130,14 @@
    - 2 + 130
      - networks: + log.Error("error decoding txs. Error: ", err)
    - 3 + 131
      - default: + return err
    - 4 + 132
      - name: zkevm + }
    - 5 + 133
    - - + fbData := []etrogpolygonzkevm.PolygonRollupBaseEtrogBatchData{{
    - 6 + 134
      - services: + Transactions: transactions,
    - 7 + 135
      - grafana: + ForcedGlobalExitRoot: common.HexToHash(cliCtx.String(flagGerName)),
    - 8 + 136
      - container_name: grafana + ForcedTimestamp: cliCtx.Uint64(flagTimestampName),
    -
    @@ -453,7 +453,7 @@
    -
    - 453 + 137
      -
    + }}
    - 454 + 138
      - zkevm-mock-l1-network: + log.Warnf("%v, %+v", cliCtx.String(flagTransactionsName), fbData)
    - 455 + 139
      - container_name: zkevm-mock-l1-network + // Send forceBatch
    - 456 + 140
    - - image: hermeznetwork/geth-zkevm-contracts:v2.1.3-fork.8-geth1.12.0 + tx, err := zkevm.SequenceForceBatches(auth, fbData)
    - 457 + 141
      - ports: + if err != nil {
    - 458 + 142
      - - 8545:8545 + log.Error("error sending forceBatch. Error: ", err)
    - 459 + 143
      - - 8546:8546 + return err
    +
    +
    +
    +
    + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +
    -
    @@ -519,6 +519,8 @@
    +
     
    - 519 + 98
      - - 50071:50071 # Executor + return err
    - 520 + 99
      - volumes: + }
    - 521 + 100
      - - ./config/test.prover.config.json:/usr/src/app/config.json + // Create smc client
    - + + 101 -
    -   -
    +
    +
    + + + poeAddr := common.HexToAddress(cliCtx.String(flagSmcAddrName))
    - + + 102 -
    -   -
    +
    +
    + + + poe, err := polygonzkevm.NewPolygonzkevm(poeAddr, ethClient)
    - 522 + 103
      - command: > + if err != nil {
    - 523 + 104
      - zkProver -c /usr/src/app/config.json + return err
    - 524 + 105
      -
    + }
    -
    @@ -628,7 +630,7 @@
    +
     
    - 628 + 111
      - zkevm-sh: +
    - 629 + 112
      - container_name: zkevm-sh + log.Info("Using address: ", auth.From)
    - 630 + 113
      - image: zkevm-node +
    - 631 + + 114 +
    - - - stdin_open: true + + + num, err := poe.LastForceBatch(&bind.CallOpts{Pending: false})
    - 632 + 115
      - tty: true + if err != nil {
    - 633 + 116
      - environment: + log.Error("error getting lastForBatch number. Error : ", err)
    - 634 + 117
      - - ZKEVM_NODE_STATE_DB_HOST=zkevm-state-db + return err
    -
    @@ -638,3 +640,51 @@
    +
     
    - 638 + 130
      - - ./config/test.genesis.config.json:/app/genesis.json + log.Error("error decoding txs. Error: ", err)
    - 639 + 131
      - command: + return err
    - 640 + 132
      - - "/bin/sh" + }
    - + + 133 -
    -   -
    +
    +
    + + + fbData := []polygonzkevm.PolygonRollupBaseEtrogBatchData{{
    - + + 134 -
    +
    +
      -
    + Transactions: transactions,
    - + + 135 -
    +
    +
      -
    + ForcedGlobalExitRoot: common.HexToHash(cliCtx.String(flagGerName)),
    - + + 136 -
    +
    +
      -
    + ForcedTimestamp: cliCtx.Uint64(flagTimestampName),
    - + + 137 -
    +
    +
      -
    + }}
    - + + 138 -
    +
    +
      -
    + log.Warnf("%v, %+v", cliCtx.String(flagTransactionsName), fbData)
    - + + 139 -
    +
    +
      -
    + // Send forceBatch
    - + + 140 -
    -   -
    +
    +
    + + + tx, err := poe.SequenceForceBatches(auth, fbData)
    - + + 141 -
    +
    +
      -
    + if err != nil {
    - + + 142 -
    +
    +
      -
    + log.Error("error sending forceBatch. Error: ", err)
    - + + 143 -
    +
    +
      -
    + return err +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/tools/datastreamer/main.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - -
    +
    @@ -63,13 +63,6 @@
    - + + 63 -
    +
    +
      -
    + Required: true,
    - + + 64 -
    +
    +
      -
    + }
    - + + 65 -
    +
    +
     
    - + + 66 -
    -   -
    +
    +
    + - + batchFlag = cli.Uint64Flag{
    - + + 67 -
    -   -
    +
    +
    + - + Name: "batch",
    - + + 68 -
    -   -
    +
    +
    + - + Aliases: []string{"bn"},
    - - -
    -   -
    +
    + 69 + +
    + - + Usage: "batch `NUMBER`",
    - + + 70 -
    -   -
    +
    +
    + - + Required: true,
    - + + 71 -
    -   -
    +
    +
    + - + }
    - + + 72 -
    -   +
    +
    + -
    - + + 73 -
    +
    +
      -
    + updateFileFlag = cli.BoolFlag{
    - + + 74 -
    +
    +
      -
    + Name: "update",
    - + + 75 -
    +
    +
      -
    + Aliases: []string{"u"},
    - + +
    @@ -126,16 +119,6 @@
    -
    +
    + 126 + +
      -
    + },
    - + + 127 -
    +
    +
      -
    + },
    - + + 128 -
    +
    +
      -
    + {
    - + + 129 -
    -   -
    +
    +
    + - + Name: "decode-batch-offline",
    - + + 130 -
    -   -
    +
    +
    + - + Aliases: []string{},
    - + + 131 -
    -   -
    +
    +
    + - + Usage: "Decodes a batch offline",
    - + + 132 -
    -   -
    +
    +
    + - + Action: decodeBatchOffline,
    - + + 133 -
    -   -
    +
    +
    + - + Flags: []cli.Flag{
    - + + 134 -
    -   -
    +
    +
    + - + &configFileFlag,
    - + + 135 -
    -   -
    +
    +
    + - + &batchFlag,
    - + + 136 -
    -   -
    +
    +
    + - + },
    - + + 137 -
    -   -
    +
    +
    + - + },
    - + + 138 -
    -   -
    +
    +
    + - + {
    - + + 139 -
    +
    +
      -
    + Name: "decode-entry",
    - + + 140 -
    +
    +
      -
    + Aliases: []string{},
    - + + 141 -
    +
    +
      -
    + Usage: "Decodes an entry",
    - + +
    @@ -156,16 +139,6 @@
    -
    +
    + 156 + +
      -
    + },
    - + + 157 -
    +
    +
      -
    + },
    - + + 158 -
    +
    +
      -
    + {
    - + + 159 -
    -   -
    +
    +
    + - + Name: "decode-batch",
    - + + 160 -
    -   -
    +
    +
    + - + Aliases: []string{},
    - + + 161 -
    -   -
    +
    +
    + - + Usage: "Decodes a batch",
    - + + 162 -
    -   -
    +
    +
    + - + Action: decodeBatch,
    - + + 163 -
    -   -
    +
    +
    + - + Flags: []cli.Flag{
    -
    + + + 164 + + +
    + - + &configFileFlag,
    -
    -
    - - - - - - - - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - -
    -
     
    - 2 + + 165 +
    -   - networks: + - + &batchFlag,
    - 3 + + 166 +
    -   - default: + - + },
    - 4 + + 167 +
    -   - name: zkevm + - + },
    - 5 + + 168 +
    - + -
    + - + {
    - 6 + 169
      - services: + Name: "truncate",
    - 7 + 170
      - grafana: + Aliases: []string{},
    - 8 + 171
      - container_name: grafana + Usage: "Truncates the stream file",
    -
     
    +
    @@ -234,7 +207,7 @@
    - 453 + 234
      -
    + stateTree := merkletree.NewStateTree(mtDBServiceClient)
    - 454 + 235
      - zkevm-mock-l1-network: + log.Debug("Connected to the merkle tree")
    - 455 + 236
      - container_name: zkevm-mock-l1-network +
    - 456 + + 237 +
    - + - image: 0xpolygon/cdk-validium-contracts:forkId8 + - + stateDB := state.NewState(state.Config{}, stateDBStorage, nil, stateTree, nil, nil, nil)
    - 457 + 238
      - ports: +
    - 458 + 239
      - - 8545:8545 + // Calculate intermediate state roots
    - 459 + 240
      - - 8546:8546 + var imStateRoots map[uint64][]byte
    -
     
    +
    @@ -326,11 +299,6 @@
    - 519 + 326
      - - 50071:50071 # Executor + log.Errorf("Error: %v\n", err)
    - 520 + 327
      - volumes: + os.Exit(1)
    - 521 + 328
      - - ./config/test.prover.config.json:/usr/src/app/config.json + }
    - 522 + + 329 +
    - + - environment: + - +
    - 523 + + 330 +
    - + - - EXPERIMENTAL_DOCKER_DESKTOP_FORCE_QEMU=1 + - + if common.BytesToHash(imStateRoot.Bytes()) == state.ZeroHash && x != 0 { +
    +
    + 331 + +
    + - + break +
    +
    + 332 + +
    + - + } +
    +
    + 333 + +
    + - +
    - 524 + 334
      - command: > + imStateRootMux.Lock()
    - 525 + 335
      - zkProver -c /usr/src/app/config.json + (*isStateRoots)[x] = imStateRoot.Bytes()
    - 526 + 336
      -
    + imStateRootMux.Unlock()
    -
     
    +
    @@ -657,71 +625,6 @@
    - 630 + 657
      - zkevm-sh: + return nil
    - 631 + 658
      - container_name: zkevm-sh + }
    - 632 + 659
      - image: zkevm-node +
    - 633 + + 660 +
    - + - stdin_open: true + - + func decodeBatch(cliCtx *cli.Context) error {
    - 634 + + 661 +
    -   - tty: true + - + c, err := config.Load(cliCtx)
    - 635 + + 662 +
    -   - environment: + - + if err != nil {
    - 636 + + 663 +
    -   - - ZKEVM_NODE_STATE_DB_HOST=zkevm-state-db + - + log.Error(err)
    -
     
    +
    + 664 + +
    + - + os.Exit(1) +
    - 640 + + 665 +
    -   - - ./config/test.genesis.config.json:/app/genesis.json + - + }
    - 641 + + 666 +
    -   - command: + - +
    - 642 + + 667 +
    -   - - "/bin/sh" + - + log.Init(c.Log)
    - 643 + + 668 +
    - + + -
    - 644 + + 669 +
    - + - zkevm-node-forced-DAC: + - + client, err := datastreamer.NewClient(c.Online.URI, c.Online.StreamType)
    - 645 + + 670 +
    - + - container_name: zkevm-node-forced-DAC + - + if err != nil {
    - 646 + + 671 +
    - + - image: zkevm-node + - + log.Error(err)
    - 647 + + 672 +
    - + - ports: + - + os.Exit(1)
    - 648 + + 673 +
    - + - - 8125:8125 + - + }
    - 649 + + 674 +
    - + - environment: + - +
    - 650 + + 675 +
    - + - - ZKEVM_NODE_ISTRUSTEDSEQUENCER=false + - + err = client.Start()
    - 651 + + 676 +
    - + - - ZKEVM_NODE_STATEDB_USER=test_user + - + if err != nil {
    - 652 + + 677 +
    - + - - ZKEVM_NODE_STATEDB_PASSWORD=test_password + - + log.Error(err)
    - 653 + + 678 +
    - + - - ZKEVM_NODE_STATEDB_NAME=state_db + - + os.Exit(1)
    - 654 + + 679 +
    - + - - ZKEVM_NODE_STATEDB_HOST=zkevm-permissionless-db + - + }
    - 655 + + 680 +
    - + - - ZKEVM_NODE_POOL_DB_USER=test_user + - +
    - 656 + + 681 +
    - + - - ZKEVM_NODE_POOL_DB_PASSWORD=test_password + - + batchNumber := cliCtx.Uint64("batch")
    - 657 + + 682 +
    - + - - ZKEVM_NODE_POOL_DB_NAME=pool_db + - +
    - 658 + + 683 +
    - + - - ZKEVM_NODE_POOL_DB_HOST=zkevm-permissionless-db + - + bookMark := state.DSBookMark{
    - 659 + + 684 +
    - + - - ZKEVM_NODE_RPC_PORT=8125 + - + Type: state.BookMarkTypeBatch,
    - 660 + + 685 +
    - + - - ZKEVM_NODE_RPC_SEQUENCERNODEURI=http://zkevm-node-json-rpc:8123 + - + Value: batchNumber,
    - 661 + + 686 +
    - + - - ZKEVM_NODE_SYNCHRONIZER_TRUSTEDSEQUENCERURL=http://you-cant-touch-this:8123 + - + }
    - 662 + + 687 +
    - + - - ZKEVM_NODE_MTCLIENT_URI=zkevm-permissionless-prover:50061 + - +
    - 663 + + 688 +
    - + - - ZKEVM_NODE_EXECUTOR_URI=zkevm-permissionless-prover:50071 + - + firstEntry, err := client.ExecCommandGetBookmark(bookMark.Encode())
    - 664 + + 689 +
    - + - volumes: + - + if err != nil {
    - 665 + + 690 +
    - + - - ./config/test.node.config.toml:/app/config.toml + - + log.Error(err)
    - 666 + + 691 +
    - + - - ./config/test.genesis.config.json:/app/genesis.json + - + os.Exit(1)
    - 667 + + 692 +
    - + - command: + - + }
    - 668 + + 693 +
    - + - - "/bin/sh" + - + printEntry(firstEntry)
    - 669 + + 694 +
    - + - - "-c" + - +
    - 670 + + 695 +
    - + - - "/app/zkevm-node run --network custom --custom-network-file /app/genesis.json --cfg /app/config.toml --components \"rpc,synchronizer\"" + - + secondEntry, err := client.ExecCommandGetEntry(firstEntry.Number + 1)
    - 671 + + 696 +
    - + -
    + - + if err != nil {
    - 672 + + 697 +
    - + - zkevm-data-node-db: + - + log.Error(err)
    - 673 + + 698 +
    - + - container_name: zkevm-data-node-db + - + os.Exit(1)
    - 674 + + 699 +
    - + - restart: unless-stopped + - + }
    - 675 + + 700 +
    - + - image: postgres + - + printEntry(secondEntry)
    - 676 + + 701 +
    - + - healthcheck: + - +
    - 677 + + 702 +
    - + - test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"] + - + i := uint64(2) //nolint:gomnd
    - 678 + + 703 +
    - + - interval: 10s + - + for {
    - 679 + + 704 +
    - + - timeout: 5s + - + entry, err := client.ExecCommandGetEntry(firstEntry.Number + i)
    - 680 + + 705 +
    - + - retries: 5 + - + if err != nil {
    - 681 + + 706 +
    - + - ports: + - + log.Error(err)
    - 682 + + 707 +
    - + - - 5444:5432 + - + os.Exit(1)
    - 683 + + 708 +
    - + - environment: + - + }
    - 684 + + 709 +
    - + - - POSTGRES_USER=committee_user + - +
    - 685 + + 710 +
    - + - - POSTGRES_PASSWORD=committee_password + - + if entry.Type == state.EntryTypeBookMark { +
    +
    + 711 + +
    + - + bookMark := state.DSBookMark{}.Decode(entry.Data) +
    +
    + 712 + +
    + - + if bookMark.Type == state.BookMarkTypeBatch { +
    +
    + 713 + +
    + - + break +
    +
    + 714 + +
    + - + }
    - 686 + + 715 +
    - + - - POSTGRES_DB=committee_db + - + }
    - 687 + + 716 +
    - + - command: + - +
    - 688 + + 717 +
    - + - - "postgres" + - + secondEntry = entry
    - 689 + + 718 +
    - + - - "-N" + - + printEntry(secondEntry)
    - 690 + + 719 +
    - + - - "500" -
    -
    -
    + - + i++
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/datacommittee_test.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +
    -
    @@ -0,0 +1,270 @@
    - + + 720 -
    -   -
    +
    +
    + - + }
    - + + 721 -
    -   +
    +
    + -
    - + + 722 -
    -   -
    +
    +
    + - + return nil
    - + + 723 -
    -   -
    +
    +
    + - + }
    - + + 724 -
    -   +
    +
    + -
    - + + 725 -
    +
    +
      -
    + func decodeEntryOffline(cliCtx *cli.Context) error {
    - + + 726 -
    +
    +
      -
    + c, err := config.Load(cliCtx)
    - + + 727 -
    +
    +
      -
    + if err != nil {
    - - -
    -   -
    -
    +
    +
    @@ -794,64 +697,6 @@
    - + + 794 -
    +
    +
      -
    + printEntry(secondEntry)
    - + + 795 -
    +
    +
      -
    + i++
    - + + 796 -
    +
    +
      -
    + }
    - + + 797 -
    -   +
    +
    + -
    - + + 798 -
    -   -
    +
    +
    + - + return nil
    - + + 799 -
    -   -
    +
    +
    + - + }
    - + + 800 -
    -   +
    +
    + -
    - + + 801 -
    -   -
    +
    +
    + - + func decodeBatchOffline(cliCtx *cli.Context) error {
    - + + 802 -
    -   -
    +
    +
    + - + c, err := config.Load(cliCtx)
    - + + 803 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 804 -
    -   -
    +
    +
    + - + log.Error(err)
    - + + 805 -
    -   -
    +
    +
    + - + os.Exit(1)
    - + + 806 -
    -   -
    +
    +
    + - + }
    - + + 807 -
    -   +
    +
    + -
    - + + 808 -
    -   -
    +
    +
    + - + log.Init(c.Log)
    - + + 809 -
    -   +
    +
    + -
    - + + 810 -
    -   -
    +
    +
    + - + streamServer, err := initializeStreamServer(c)
    - + + 811 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 812 -
    -   -
    +
    +
    + - + log.Error(err)
    - + + 813 -
    -   -
    +
    +
    + - + os.Exit(1)
    - + + 814 -
    -   -
    +
    +
    + - + }
    - + + 815 -
    -   +
    +
    + -
    - + + 816 -
    -   -
    +
    +
    + - + batchNumber := cliCtx.Uint64("batch")
    - + + 817 -
    -   +
    +
    + -
    - + + 818 -
    -   -
    +
    +
    + - + bookMark := state.DSBookMark{
    - + + 819 -
    -   -
    +
    +
    + - + Type: state.BookMarkTypeL2Block,
    - + + 820 -
    -   -
    +
    +
    + - + Value: batchNumber,
    - + + 821 -
    -   -
    +
    +
    + - + }
    - + + 822 -
    -   +
    +
    + -
    - + + 823 -
    -   -
    +
    +
    + - + firstEntry, err := streamServer.GetFirstEventAfterBookmark(bookMark.Encode())
    - + + 824 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 825 -
    -   -
    +
    +
    + - + log.Error(err)
    - + + 826 -
    -   -
    +
    +
    + - + os.Exit(1)
    - + + 827 -
    -   -
    +
    +
    + - + }
    - + + 828 -
    -   -
    +
    +
    + - + printEntry(firstEntry)
    - + + 829 -
    -   +
    +
    + -
    - + + 830 -
    -   -
    +
    +
    + - + secondEntry, err := streamServer.GetEntry(firstEntry.Number + 1)
    - + + 831 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 832 -
    -   -
    +
    +
    + - + log.Error(err)
    - + + 833 -
    -   -
    +
    +
    + - + os.Exit(1)
    - + + 834 -
    -   -
    +
    +
    + - + }
    - + + 835 -
    -   +
    +
    + -
    - + + 836 -
    -   -
    +
    +
    + - + i := uint64(2) //nolint:gomnd
    - + + 837 -
    -   -
    +
    +
    + - + printEntry(secondEntry)
    - + + 838 -
    -   -
    +
    +
    + - + for {
    - + + 839 -
    -   -
    +
    +
    + - + secondEntry, err = streamServer.GetEntry(firstEntry.Number + i)
    - + + 840 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 841 -
    -   -
    +
    +
    + - + log.Error(err)
    - + + 842 -
    -   -
    +
    +
    + - + os.Exit(1)
    - + + 843 -
    -   -
    +
    +
    + - + }
    - + + 844 -
    -   +
    +
    + -
    - + + 845 -
    -   -
    +
    +
    + - + if secondEntry.Type == state.EntryTypeBookMark {
    - + + 846 -
    -   -
    +
    +
    + - + bookMark := state.DSBookMark{}.Decode(secondEntry.Data)
    - + + 847 -
    -   -
    +
    +
    + - + if bookMark.Type == state.BookMarkTypeBatch {
    - + + 848 -
    -   -
    +
    +
    + - + break
    - + + 849 -
    -   -
    +
    +
    + - + }
    - + + 850 -
    -   -
    +
    +
    + - + }
    - + + 851 -
    -   +
    +
    + -
    - + + 852 -
    -   -
    +
    +
    + - + printEntry(secondEntry)
    - + + 853 -
    -   -
    +
    +
    + - + i++
    - + + 854 -
    -   -
    +
    +
    + - + }
    - + + 855 -
    +
    +
     
    - + + 856 -
    +
    +
      -
    + return nil
    - + + 857 -
    +
    +
      -
    + } +
    +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - + - + + - - - - @@ -141006,63 +334532,68 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - + - + + - - - - @@ -141166,153 +334697,143 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - + - - - - - - - - - - - - - - - - + - - - - - - @@ -141366,61 +334887,66 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - + - + + - - - - - - - - - - - + - + + - - - - @@ -142715,4193 +336246,4416 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0


    - - -
    +
     
    - + + 63 -
    +
    +
      -
    + Required: true,
    - + + 64 -
    +
    +
      -
    + }
    - + + 65 -
    +
    +
     
    @@ -140846,63 +334367,68 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - + + 66 -
    +
    +
      -
    + updateFileFlag = cli.BoolFlag{
    - + + 67 -
    +
    +
      -
    + Name: "update",
    - + + 68 -
    +
    +
      -
    + Aliases: []string{"u"},
    - + +
     
    -
    +
    + 119 + +
      -
    + },
    - + + 120 -
    +
    +
      -
    + },
    - + + 121 -
    +
    +
      -
    + {
    - + + 122 -
    +
    +
      -
    + Name: "decode-entry",
    - + + 123 -
    +
    +
      -
    + Aliases: []string{},
    - + + 124 -
    +
    +
      -
    + Usage: "Decodes an entry",
    - + +
     
    -
    +
    + 139 + +
      -
    + },
    - + + 140 -
    +
    +
      -
    + },
    - + + 141 -
    +
    +
      -
    + {
    - + + 142 -
    +
    +
      -
    + Name: "truncate",
    - + + 143 -
    +
    +
      -
    + Aliases: []string{},
    - + + 144 -
    +
    +
      -
    + Usage: "Truncates the stream file",
    - - -
    -   -
    -
    +
    +
     
    - + + 207 -
    +
    +
      -
    + stateTree := merkletree.NewStateTree(mtDBServiceClient)
    - + + 208 -
    +
    +
      -
    + log.Debug("Connected to the merkle tree")
    - + + 209 -
    +
    +
     
    - + + 210 -
    -   -
    +
    +
    + + + stateDB := state.NewState(state.Config{}, stateDBStorage, nil, stateTree, nil, nil)
    - + + 211 -
    +
    +
     
    - + + 212 -
    +
    +
      -
    + // Calculate intermediate state roots
    - + + 213 -
    +
    +
      -
    + var imStateRoots map[uint64][]byte
    - - -
    -   -
    -
    +
    +
     
    - + + 299 -
    +
    +
      -
    + log.Errorf("Error: %v\n", err)
    - + + 300 -
    +
    +
      -
    + os.Exit(1)
    - + + 301 -
    +
    +
      -
    + }
    - + + 302 -
    +
    +
      -
    + imStateRootMux.Lock()
    - + + 303 -
    +
    +
      -
    + (*isStateRoots)[x] = imStateRoot.Bytes()
    - + + 304 -
    +
    +
      -
    + imStateRootMux.Unlock()
    - + +
     
    -
    +
    + 625 + +
      -
    + return nil
    - + + 626 -
    +
    +
      -
    + }
    - + + 627 -
    +
    +
     
    @@ -142076,63 +335602,68 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - + + 628 -
    +
    +
      -
    + func decodeEntryOffline(cliCtx *cli.Context) error {
    - + + 629 -
    +
    +
      -
    + c, err := config.Load(cliCtx)
    - + + 630 -
    +
    +
      -
    + if err != nil {
    - + +
     
    -
    +
    + 697 + +
      -
    + printEntry(secondEntry)
    - + + 698 -
    +
    +
      -
    + i++
    - + + 699 -
    +
    +
      -
    + }
    -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +
    -
     
    -
    - 1 - -
    - + - package e2e -
    -
    - 2 + + 700 +
    - + +  
    - 3 - -
    - + - import ( -
    -
    - 4 - -
    - + - "context" -
    -
    - 5 - -
    - + - "crypto/ecdsa" -
    -
    - 6 - -
    - + - "encoding/json" -
    -
    - 7 + + 701 +
    - + - "fmt" +   + return nil
    - 8 + + 702 +
    - + - "math/big" +   + }
    - 9 - -
    - + - "os" +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/tools/datastreamer/Makefile + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - + - - - - - - - - - - - - - + + +
    +
    @@ -27,10 +27,6 @@
    - 10 + + 27 +
    - + - "os/exec" +   + decode-l2block: ## Runs the tool to decode a given L2 block
    - 11 + + 28 +
    - + - "sort" +   + go run main.go decode-l2block -cfg config/tool.config.toml -l2block $(arguments)
    - 12 + + 29 +
    - + - "strconv" +   +
    - 13 + + 30 +
    - + - "strings" + - + .PHONY: decode-batch
    - 14 + + 31 +
    - + - "testing" + - + decode-batch: ## Runs the tool to decode a given batch
    - 15 + + 32 +
    - + - "time" + - + go run main.go decode-batch -cfg config/tool.config.toml -batch $(arguments)
    - 16 + + 33 +
    - + + -
    - 17 - -
    - + - "github.com/0xPolygon/cdk-data-availability/config" -
    -
    - 18 + + 34 +
    - + - cTypes "github.com/0xPolygon/cdk-data-availability/config/types" +   + .PHONY: decode-entry-offline
    - 19 + + 35 +
    - + - "github.com/0xPolygon/cdk-data-availability/db" +   + decode-entry-offline: ## Runs the offline tool to decode a given entry number
    - 20 + + 36 +
    - + - "github.com/0xPolygon/cdk-data-availability/rpc" +   + go run main.go decode-entry-offline -cfg config/tool.config.toml -entry $(arguments)
    - 21 - -
    - + - "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/polygondatacommittee" -
    +
    +
    @@ -39,10 +35,6 @@
    - 22 + + 39 +
    - + - "github.com/0xPolygonHermez/zkevm-node/log" +   + decode-l2block-offline: ## Runs the offline tool to decode a given L2 block
    - 23 + + 40 +
    - + - "github.com/0xPolygonHermez/zkevm-node/test/operations" +   + go run main.go decode-l2block-offline -cfg config/tool.config.toml -l2block $(arguments)
    - 24 + + 41 +
    - + - "github.com/ethereum/go-ethereum" +   +
    - 25 +
    + 42 +
    - + - eTypes "github.com/ethereum/go-ethereum/core/types" + - + .PHONY: decode-batch-offline
    - 26 + + 43 +
    - + -
    + - + decode-batch-offline: ## Runs the offline tool to decode a given batch
    - 27 + + 44 +
    - + - "github.com/ethereum/go-ethereum/accounts/keystore" + - + go run main.go decode-batch-offline -cfg config/tool.config.toml -batch $(arguments)
    - 28 + + 45 +
    - + - "github.com/ethereum/go-ethereum/common" + - +
    - 29 + + 46 +
    - + - "github.com/ethereum/go-ethereum/crypto" +   + .PHONY: truncate
    - 30 + + 47 +
    - + - "github.com/ethereum/go-ethereum/ethclient" +   + truncate: ## Runs the offline tool to truncate the stream file
    - 31 + + 48 +
    - + - "github.com/stretchr/testify/assert" +   + go run main.go truncate -cfg config/tool.config.toml -entry $(arguments) +
    +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - + + +
    +
     
    - 32 + + 27 +
    - + - "github.com/stretchr/testify/require" +   + decode-l2block: ## Runs the tool to decode a given L2 block
    - 33 + + 28 +
    - + - ) +   + go run main.go decode-l2block -cfg config/tool.config.toml -l2block $(arguments)
    - 34 + + 29 +
    - + +  
    - 35 + + -
    - + - func TestDataCommittee(t *testing.T) { +
    +
    +   +
    - 36 + + -
    - + - const ( +
    +
    +   +
    - 37 + + -
    - + - nSignatures = 4 +
    +
    +   +
    - 38 + + -
    - + - mMembers = 5 +
    +
    +   +
    - 39 + + 30 +
    - + - ksFile = "/tmp/pkey" +   + .PHONY: decode-entry-offline
    - 40 + + 31 +
    - + - cfgFile = "/tmp/dacnodeconfigfile.json" +   + decode-entry-offline: ## Runs the offline tool to decode a given entry number
    - 41 + + 32 +
    - + - ksPass = "pass" +   + go run main.go decode-entry-offline -cfg config/tool.config.toml -entry $(arguments)
    - 42 + +
     
    +
    + 35 +
    - + - dacNodeContainer = "hermeznetwork/cdk-data-availability:v0.0.4" +   + decode-l2block-offline: ## Runs the offline tool to decode a given L2 block
    - 43 + + 36 +
    - + - ) +   + go run main.go decode-l2block-offline -cfg config/tool.config.toml -l2block $(arguments)
    - 44 + + 37 +
    - + +  
    - 45 + + -
    - + - // Setup +
    +
    +   +
    - 46 + + -
    - + - var err error +
    +
    +   +
    - 47 + + -
    - + - if testing.Short() { +
    +
    +   +
    - 48 + + -
    - + - t.Skip() +
    +
    +   +
    - 49 + + 38 +
    - + - } +   + .PHONY: truncate
    - 50 + + 39 +
    - + - ctx := context.Background() +   + truncate: ## Runs the offline tool to truncate the stream file
    - 51 + + 40 +
    - + - defer func() { +   + go run main.go truncate -cfg config/tool.config.toml -entry $(arguments) +
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/tools/egp/main.go + RENAMED + +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - -
    +
    @@ -25,45 +25,36 @@
    - 52 + + 25 +
    - + - require.NoError(t, operations.Teardown()) +   + )
    - 53 + + 26 +
    - + - }() +   +
    - 54 + + 27 +
    - + - err = operations.Teardown() +   + var (
    - 55 + + 28 +
    - + - require.NoError(t, err) + - + showErrors bool
    - 56 + + 29 +
    - + - opsCfg := operations.GetDefaultOperationsConfig() + - + showLosses bool
    - 57 + + 30 +
    - + - opsCfg.State.MaxCumulativeGasUsed = 80000000000 + - + showReprocess bool
    - 58 + + 31 +
    - + - opsman, err := operations.NewManager(ctx, opsCfg) + - + showDetail bool
    - 59 + + 32 +
    - + - require.NoError(t, err) + - + showAlways bool
    - 60 + + 33 +
    - + - defer func() { + - + showOnlyCfg bool
    - 61 + + 34 +
    - + - require.NoError(t, opsman.StopDACDB()) + - + useRealL2GasPrice bool
    - 62 + + 35 +
    - + - }() + - + showDiscrepancy uint64
    - 63 + + 36 +
    - + - err = opsman.Setup() + - + showEncoded bool
    - 64 + + 37 +
    - + - require.NoError(t, err) +   + )
    - 65 + + 38 +
    - + - require.NoError(t, opsman.StartDACDB()) +   +
    - 66 + + 39 +
    - + - time.Sleep(5 * time.Second) +   + const (
    - 67 + + 40 +
    - + - authL2, err := operations.GetAuth(operations.DefaultSequencerPrivateKey, operations.DefaultL2ChainID) + - + ethTransferGasValue = 21000
    - 68 + + 41 +
    - + - require.NoError(t, err) + - + signatureBytes = 0
    - 69 + + 42 +
    - + - authL1, err := operations.GetAuth(operations.DefaultSequencerPrivateKey, operations.DefaultL1ChainID) + - + effectivePctBytes = 1
    - 70 + + 43 +
    - + - require.NoError(t, err) + - + fixedBytesTx = signatureBytes + effectivePctBytes
    - 71 + + 44 +
    - + - clientL2, err := ethclient.Dial(operations.DefaultL2NetworkURL) +   + )
    - 72 + + 45 +
    - + - require.NoError(t, err) +   +
    - 73 + + 46 +
    - + - clientL1, err := ethclient.Dial(operations.DefaultL1NetworkURL) +   + type egpConfig struct {
    - 74 + + 47 +
    - + - require.NoError(t, err) + - + ByteGasCost uint64 // gas cost of 1 byte
    - 75 + + 48 +
    - + - dacSC, err := polygondatacommittee.NewPolygondatacommittee( + - + ZeroGasCost uint64 // gas cost of 1 byte zero
    - 76 + + 49 +
    - + - common.HexToAddress(operations.DefaultL1DataCommitteeContract), + - + NetProfitFactor float64 // L2 network profit factor
    - 77 + + 50 +
    - + - clientL1, + - + L1GasPriceFactor float64 // L1 gas price factor
    - 78 + + 51 +
    - + - ) + - + L2GasPriceSugFactor float64 // L2 gas price suggester factor
    - 79 + + 52 +
    - + - require.NoError(t, err) + - + FinalDeviationPct uint64 // max final deviation percentage
    - 80 + + 53 +
    - + -
    + - + L2GasPriceSugFactorPreEGP float64 // L2 gas price suggester factor (pre EGP)
    - 81 + + 54 +
    - + - // Register committe with N / M signatures + - + EthTransferGasPrice uint64 // Gas price value for transfer (gas == 21000)
    - 82 + + 55 +
    - + - membs := members{} + - + EthTransferL1GasPriceFactor float64 // Gas price for transfer (used if EthTransferGasPrice = 0)
    - 83 + + 56 +
    - + - addrsBytes := []byte{} +   + }
    - 84 + + 57 +
    - + - urls := []string{} +   +
    - 85 + + 58 +
    - + - for i := 0; i < mMembers; i++ { +   + type egpLogRecord struct {
    - 86 + + 59 +
    - + - pk, err := crypto.GenerateKey() +   + l2BlockNum uint64
    - 87 + + 60 +
    - + - require.NoError(t, err) +   + l2BlockReceived time.Time
    - 88 + + 61 +
    - + - membs = append(membs, member{ +   + encoded string
    - 89 + + 62 +
    - + - addr: crypto.PubkeyToAddress(pk.PublicKey), + - + hash string
    - 90 + + 63 +
    - + - pk: pk, +   + missingLogInfo bool // Flag if egp_log field is empty
    - 91 + + 64 +
    - + - url: fmt.Sprintf("http://cdk-data-availability-%d:420%d", i, i), + - + realGasPrice float64 // (calculated field) Real price paid by the user (to perform a double check)
    - 92 + + 65 +
    - + - i: i, + - + txZeroCount uint64 // (calculated field) count transaction zero bytes
    - 93 + + 66 +
    - + - }) + - + txNonZeroCount uint64 // (calculated field) count transaction non zero bytes
    - 94 + + 67 +
    - + - } +   + LogError string `json:"Error"`
    - 95 + + 68 +
    - + - sort.Sort(membs) +   + LogEnabled bool `json:"Enabled"`
    - 96 + + 69 +
    - + - for _, m := range membs { +   + LogL1GasPrice float64 `json:"L1GasPrice"` // L1 gas price
    + +
    @@ -97,11 +88,10 @@
    +
    97 +
    - + - addrsBytes = append(addrsBytes, m.addr.Bytes()...) +   + totalLoss float64 // Total loss gas amount
    + 98 +
    - + - urls = append(urls, m.url) +   + sumGasFinal float64 // Accumulated sum of final gas (to get average)
    + 99 +
    - + - } +   + countGasFinal float64 // Count number of accumulated (to get average)
    + 100 +
    - + - tx, err := dacSC.SetupCommittee(authL1, big.NewInt(nSignatures), urls, addrsBytes) + - + sumGasNoEGP float64 // Accumulated sum of gas without EGP
    + 101 +
    - + - for _, m := range membs { + - + countGasNoEGP float64 // Count number of accumulated without EGP (to get average)
    + 102 +
    - + - fmt.Println(m.addr) +   + sumFee float64
    + 103 +
    - + - } + - + sumFeeNoEGP float64
    + 104 +
    - + - require.NoError(t, err) + - + sumRealGas float64
    + 105 +
    - + - err = operations.WaitTxToBeMined(ctx, clientL1, tx, operations.DefaultTimeoutTxToBeMined) +   + }
    + 106 +
    - + - require.NoError(t, err) +   +
    + 107 +
    - + -
    +   + func main() {
    - 108 + +
    @@ -140,20 +130,10 @@
    +
    + 140 +
    - + - // Spin up M DAC nodes +   + Value: false,
    - 109 + + 141 +
    - + - dacNodeConfig := config.Config{ +   + },
    - 110 + + 142 +
    - + - L1: config.L1Config{ +   + &cli.BoolFlag{
    - 111 + + 143 +
    - + - RpcURL: "http://zkevm-mock-l1-network:8545", + - + Name: "showencoded",
    - 112 + + 144 +
    - + - WsURL: "ws://zkevm-mock-l1-network:8546", + - + Usage: "show encoded field when showing detail record",
    - 113 + + 145 +
    - + - PolygonValidiumAddress: operations.DefaultL1ZkEVMSmartContract, + - + Value: false,
    - 114 + + 146 +
    - + - DataCommitteeAddress: operations.DefaultL1DataCommitteeContract, + - + },
    - 115 + + 147 +
    - + - Timeout: cTypes.Duration{Duration: time.Second}, + - + &cli.BoolFlag{
    - 116 + + 148 +
    - + - RetryPeriod: cTypes.Duration{Duration: time.Second}, +   + Name: "showalways",
    - 117 + + 149 +
    - + - }, +   + Usage: "show always full detailed record",
    - 118 + + 150 +
    - + - PrivateKey: cTypes.KeystoreFileConfig{ +   + Value: false,
    - 119 + + 151 +
    - + - Path: ksFile, +   + },
    - 120 + + 152 +
    - + - Password: ksPass, + - + &cli.Uint64Flag{
    - 121 + + 153 +
    - + - }, + - + Name: "showdiscrepancy",
    - 122 + + 154 +
    - + - DB: db.Config{ + - + Usage: "show discrepancies between real and simulated (0:none, 1:reprocess, 2:gasprice, 3:all)",
    - 123 + + 155 +
    - + - Name: "committee_db", + - + Value: ^uint64(0),
    - 124 + + 156 +
    - + - User: "committee_user", + - + },
    - 125 + + 157 +
    - + - Password: "committee_password", +   + &cli.StringFlag{
    - 126 + + 158 +
    - + - Host: "zkevm-data-node-db", +   + Name: "cfg",
    - 127 + + 159 +
    - + - Port: "5432", +   + Aliases: []string{"c"},
    - 128 + +
    @@ -165,11 +145,6 @@
    +
    + 165 +
    - + - EnableLog: false, +   + Usage: "show only simulation results",
    - 129 + + 166 +
    - + - MaxConns: 10, +   + Value: false,
    - 130 + + 167 +
    - + +   },
    - 131 + + 168 +
    - + - RPC: rpc.Config{ + - + &cli.BoolFlag{
    - 132 + + 169 +
    - + - Host: "0.0.0.0", + - + Name: "realgasprice",
    - 133 + + 170 +
    - + - MaxRequestsPerIPAndSecond: 100, + - + Usage: "use real L2 gas price from egp-log instead of the calculated simulated value",
    - 134 + + 171 +
    - + - }, + - + Value: false,
    - 135 + + 172 +
    - + - } + - + },
    - 136 + + 173 +
    - + - defer func() { +   + &cli.StringFlag{
    - 137 + + 174 +
    - + - // Remove tmp files +   + Name: "db",
    - 138 + + 175 +
    - + - assert.NoError(t, +   + Usage: "DB connection string: \"host=xxx port=xxx user=xxx dbname=xxx password=xxx\"",
    - 139 - -
    - + - exec.Command("rm", cfgFile).Run(), -
    +
    +
    @@ -189,15 +164,14 @@
    - 140 + + 189 +
    - + - ) +   + // defaultConfig parses the default configuration values
    - 141 + + 190 +
    - + - assert.NoError(t, +   + func defaultConfig() (*egpConfig, error) {
    - 142 + + 191 +
    - + - exec.Command("rmdir", ksFile+"_").Run(), +   + cfg := egpConfig{
    - 143 + + 192 +
    - + - ) + - + ByteGasCost: 16, // nolint:gomnd
    - 144 + + 193 +
    - + - assert.NoError(t, + - + ZeroGasCost: 4, // nolint:gomnd
    - 145 + + 194 +
    - + - exec.Command("rm", ksFile).Run(), + - + NetProfitFactor: 1.0, // nolint:gomnd
    - 146 + + 195 +
    - + - ) + - + L1GasPriceFactor: 0.25, // nolint:gomnd
    - 147 + + 196 +
    - + - // Stop DAC nodes + - + L2GasPriceSugFactor: 0.5, // nolint:gomnd
    - 148 + + 197 +
    - + - for i := 0; i < mMembers; i++ { + - + FinalDeviationPct: 10, // nolint:gomnd
    - 149 + + 198 +
    - + - assert.NoError(t, exec.Command( + - + L2GasPriceSugFactorPreEGP: 0.1, // nolint:gomnd
    - 150 + + 199 +
    - + - "docker", "kill", "cdk-data-availability-"+strconv.Itoa(i), + - + EthTransferGasPrice: 0, // nolint:gomnd
    - 151 + + 200 +
    - + - ).Run()) + - + EthTransferL1GasPriceFactor: 0.10, // nolint:gomnd
    - 152 + + 201 +
    - + - assert.NoError(t, exec.Command( +   + }
    - 153 + + 202 +
    - + - "docker", "rm", "cdk-data-availability-"+strconv.Itoa(i), +   +
    - 154 + + 203 +
    - + - ).Run()) +   + viper.SetConfigType("toml")
    - 155 + +
    @@ -268,9 +242,6 @@
    +
    + 268 +
    - + - } +   + showDetail = ctx.Bool("showdetail")
    - 156 + + 269 +
    - + - // Stop permissionless node +   + showAlways = ctx.Bool("showalways")
    - 157 + + 270 +
    - + - require.NoError(t, opsman.StopPermissionlessNodeForcedToSYncThroughDAC()) +   + showOnlyCfg = ctx.Bool("onlycfg")
    - 158 + + 271 +
    - + - }() + - + useRealL2GasPrice = ctx.Bool("realgasprice")
    - 159 + + 272 +
    - + - // Start permissionless node + - + showDiscrepancy = ctx.Uint64("showdiscrepancy")
    - 160 + + 273 +
    - + - require.NoError(t, opsman.StartPermissionlessNodeForcedToSYncThroughDAC()) + - + showEncoded = ctx.Bool("showencoded")
    - 161 + + 274 +
    - + - // Star DAC nodes +   +
    - 162 + + 275 +
    - + - for _, m := range membs { +   + // Load simulation config file
    - 163 + + 276 +
    - + - // Set correct port +   + var err error
    - 164 + +
    @@ -299,7 +270,7 @@
    +
    + 299 +
    - + - port := 4200 + m.i +   +
    - 165 + + 300 +
    - + - dacNodeConfig.RPC.Port = port +   + // Query data
    - 166 + + 301 +
    - + - // Write config file +   + query := fmt.Sprintf(`
    - 167 + + 302 +
    - + - file, err := json.MarshalIndent(dacNodeConfig, "", " ") + - + select lb.received_at, t.l2_block_num, coalesce(t.egp_log::varchar,'') as egp_log, t.encoded, t.hash
    - 168 + + 303 +
    - + - require.NoError(t, err) +   + from state.transaction t
    - 169 + + 304 +
    - + - err = os.WriteFile(cfgFile, file, 0644) +   + join state.l2block lb on lb.block_num = t.l2_block_num
    - 170 + + 305 +
    - + - require.NoError(t, err) +   + where t.l2_block_num >= %d and t.l2_block_num <= %d`, fromBlock, toBlock)
    - 171 + +
    @@ -315,14 +286,14 @@
    +
    + 315 +
    - + - // Write private key keystore file +   + logf("Starting from L2 block %d...", fromBlock)
    - 172 + + 316 +
    - + - err = createKeyStore(m.pk, ksFile, ksPass) +   + var blockReceived time.Time
    - 173 + + 317 +
    - + - require.NoError(t, err) +   + var l2Block uint64
    - 174 + + 318 +
    - + - // Run DAC node + - + var egpLog, encoded, hash string
    - 175 + + -
    - + - cmd := exec.Command( +
    +
    +   +
    - 176 + + 319 +
    - + - "docker", "run", "-d", +   + var timeFirst, timeLast time.Time
    - 177 + + 320 +
    - + - "--name", "cdk-data-availability-"+strconv.Itoa(m.i), + - + var realStats, simulateStats egpStats
    - 178 + + 321 +
    - + - "-v", cfgFile+":/app/config.json", +   +
    - 179 + + 322 +
    - + - "-v", ksFile+":"+ksFile, +   + i := uint64(0)
    - 180 + + 323 +
    - + - "--network", "zkevm", +   + for rows.Next() {
    - 181 + + 324 +
    - + - dacNodeContainer, +   + // Fetch row
    - 182 + + 325 +
    - + - "/bin/sh", "-c", + - + err = rows.Scan(&blockReceived, &l2Block, &egpLog, &encoded, &hash)
    - 183 + + 326 +
    - + - "/app/cdk-data-availability run --cfg /app/config.json", +   + if err != nil {
    - 184 + + 327 +
    - + - ) +   + logf("Error fetching row: %v", err)
    - 185 + + 328 +
    - + - out, err := cmd.CombinedOutput() +   + return err
    - 186 + +
    @@ -347,38 +318,31 @@
    +
    + 347 +
    - + - require.NoError(t, err, string(out)) +   + i++
    - 187 + + 348 +
    - + - log.Infof("DAC node %d started", m.i) +   +
    - 188 + + 349 +
    - + - time.Sleep(time.Second * 5) +   + // Transaction info
    - 189 + + 350 +
    - + - } + - + egpRealData := egpLogRecord{
    - 190 + + 351 +
    - + -
    +   + l2BlockReceived: blockReceived,
    - 191 + + 352 +
    - + - // Send txs +   + l2BlockNum: l2Block,
    - 192 + + 353 +
    - + - nTxs := 10 +   + encoded: encoded,
    - 193 + + 354 +
    - + - amount := big.NewInt(10000) + - + hash: hash,
    - 194 + + 355 +
    - + - toAddress := common.HexToAddress("0x70997970C51812dc3A010C7d01b50e0d17dc79C8") +   + missingLogInfo: egpLog == "",
    - 195 + + 356 +
    - + - _, err = clientL2.BalanceAt(ctx, authL2.From, nil) + - + realGasPrice: 0,
    - 196 + + 357 +
    - + - require.NoError(t, err) + - + txZeroCount: 0,
    - 197 + + 358 +
    - + - _, err = clientL2.PendingNonceAt(ctx, authL2.From) + - + txNonZeroCount: 0,
    - 198 + + 359 +
    - + - require.NoError(t, err) +   + }
    - 199 + + 360 +
    - + +  
    - 200 + + 361 +
    - + - gasLimit, err := clientL2.EstimateGas(ctx, ethereum.CallMsg{From: authL2.From, To: &toAddress, Value: amount}) +   + // Check if EGP info is present
    - 201 + + 362 +
    - + - require.NoError(t, err) +   + if egpLog != "" {
    - 202 + + 363 +
    - + -
    +   + // Decode EGP log json
    - 203 + + 364 +
    - + - gasPrice, err := clientL2.SuggestGasPrice(ctx) + - + err = json.Unmarshal([]byte(egpLog), &egpRealData)
    - 204 + + 365 +
    - + - require.NoError(t, err) +   + if err != nil {
    - 205 + + 366 +
    - + -
    +   + logf("Error decoding json from egp_log field: %v", err)
    - 206 + + 367 +
    - + - nonce, err := clientL2.PendingNonceAt(ctx, authL2.From) +   + return err
    - 207 + + 368 +
    - + - require.NoError(t, err) +   + }
    - 208 + + 369 +
    - + + -
    - 209 + + 370 +
    - + - txs := make([]*eTypes.Transaction, 0, nTxs) + - + // Calculated fields
    - 210 + + 371 +
    - + - for i := 0; i < nTxs; i++ { + - + egpRealData.realGasPrice = roundEffectiveGasPrice(egpRealData.LogGasPrice, egpRealData.LogPercentage)
    - 211 + + 372 +
    - + - tx := eTypes.NewTransaction(nonce+uint64(i), toAddress, amount, gasLimit, gasPrice, nil) +   + }
    - 212 + + 373 +
    - + - log.Infof("generating tx %d / %d: %s", i+1, nTxs, tx.Hash().Hex()) +   +
    - 213 + + 374 +
    - + - txs = append(txs, tx) +   + // Calculate stats
    - 214 + + 375 +
    - + - } + - + countStats(i, l2Block, &egpRealData, &realStats, nil, nil)
    - 215 + + 376 +
    - + +  
    - 216 + + 377 +
    - + - // Wait for verification +   + // Simulate using alternative config
    - 217 + + 378 +
    - + - _, err = operations.ApplyL2Txs(ctx, txs, authL2, clientL2, operations.VerifiedConfirmationLevel) +   + if egpCfg != nil {
    - 218 + + 379 +
    - + - require.NoError(t, err) + - + egpSimData := egpRealData
    - 219 + + 380 +
    - + -
    +   + simulateConfig(&egpSimData, egpCfg)
    - 220 + + 381 +
    - + - // Assert that he permissionless node is fully synced (through the DAC) + - + countStats(i, l2Block, &egpSimData, &simulateStats, egpCfg, &egpRealData)
    - 221 + + 382 +
    - + - time.Sleep(30 * time.Second) // Give some time for the permissionless node to get synced +   + }
    - 222 + + 383 +
    - + - clientL2Permissionless, err := ethclient.Dial(operations.PermissionlessL2NetworkURL) +   + }
    - 223 + + 384 +
    - + - require.NoError(t, err) +   +
    - 224 - -
    - + - expectedBlock, err := clientL2.BlockByNumber(ctx, nil) -
    +
    +
    @@ -389,39 +353,25 @@
    - 225 + + 389 +
    - + - require.NoError(t, err) +   + logf("\nPERIOD [%.2f days]: %v ... %v", diff/24, timeFirst, timeLast) // nolint:gomnd
    - 226 + + 390 +
    - + - actualBlock, err := clientL2Permissionless.BlockByNumber(ctx, nil) +   + if !showOnlyCfg {
    - 227 + + 391 +
    - + - require.NoError(t, err) +   + logf("\nEGP REAL STATS:")
    - 228 + + 392 +
    - + - // je, err := expectedBlock.Header().MarshalJSON() + - + printStats(&realStats)
    - 229 + + 393 +
    - + - // require.NoError(t, err) +   + }
    - 230 + + 394 +
    - + - // log.Info(string(je)) +   +
    - 231 + + 395 +
    - + - // ja, err := actualBlock.Header().MarshalJSON() +   + // Print simulation stats results
    - 232 + + 396 +
    - + - // require.NoError(t, err) +   + if egpCfg != nil {
    - 233 + + 397 +
    - + - // log.Info(string(ja)) +   + logf("\nEGP SIMULATION STATS:")
    - 234 + + 398 +
    - + - // require.Equal(t, string(je), string(ja)) +   + printStats(&simulateStats)
    - 235 + + 399 +
    - + - require.Equal(t, expectedBlock.Root().Hex(), actualBlock.Root().Hex()) + - + var strL2SugFactor string
    - 236 + + 400 +
    - + - } + - + if useRealL2GasPrice {
    - 237 + + 401 +
    - + -
    + - + strL2SugFactor = "REAL-GASPRICE-USED"
    - 238 + + 402 +
    - + - type member struct { + - + } else {
    - 239 + + 403 +
    - + - addr common.Address + - + strL2SugFactor = fmt.Sprintf("%.4f", egpCfg.L2GasPriceSugFactor)
    - 240 + + 404 +
    - + - pk *ecdsa.PrivateKey + - + }
    - 241 + + 405 +
    - + - url string + - + logf("PARAMS: byte[%d] zero[%d] netFactor[%.4f] L1factor[%.4f] L2sugFactor[%s] devPct[%d] L2sugPreEGP[%.4f] EthTrsfPrice[%d] EthTrsfL1Fact[%.4f]", egpCfg.ByteGasCost,
    - 242 + + 406 +
    - + - i int + - + egpCfg.ZeroGasCost, egpCfg.NetProfitFactor, egpCfg.L1GasPriceFactor, strL2SugFactor, egpCfg.FinalDeviationPct, egpCfg.L2GasPriceSugFactorPreEGP,
    - 243 + + 407 +
    - + - } + - + egpCfg.EthTransferGasPrice, egpCfg.EthTransferL1GasPriceFactor)
    - 244 + + 408 +
    - + - type members []member +   + }
    - 245 + + 409 +
    - + +  
    - 246 + + 410 +
    - + - func (s members) Len() int { return len(s) } +   + return nil
    - 247 + + 411 +
    - + - func (s members) Less(i, j int) bool { +   + }
    - 248 + + 412 +
    - + - return strings.ToUpper(s[i].addr.Hex()) < strings.ToUpper(s[j].addr.Hex()) +   +
    - 249 + + 413 +
    - + - } +   + // countStats calculates and counts statistics for an EGP record
    - 250 + + 414 +
    - + - func (s members) Swap(i, j int) { s[i], s[j] = s[j], s[i] } + - + func countStats(i uint64, block uint64, egp *egpLogRecord, stats *egpStats, cfg *egpConfig, compareEgp *egpLogRecord) {
    - 251 + + 415 +
    - + -
    + - + var title string
    - 252 + + 416 +
    - + - func createKeyStore(pk *ecdsa.PrivateKey, outputDir, password string) error { + - + if cfg == nil {
    - 253 + + 417 +
    - + - ks := keystore.NewKeyStore(outputDir+"_", keystore.StandardScryptN, keystore.StandardScryptP) + - + title = "REAL EGP-LOG"
    - 254 + + 418 +
    - + - _, err := ks.ImportECDSA(pk, password) + - + } else {
    - 255 + + 419 +
    - + - if err != nil { + - + title = "SIM CONFIG"
    - 256 + + 420 +
    - + - return err + - + }
    - 257 + + 421 +
    - + - } + - +
    - 258 + + 422 +
    - + - fileNameB, err := exec.Command("ls", outputDir+"_/").CombinedOutput() +   + // Show record information
    - 259 + + 423 +
    - + - fileName := strings.TrimSuffix(string(fileNameB), "\n") +   + if showAlways {
    - 260 + + 424 +
    - + - if err != nil { + - + printEgpLogRecord(egp, showEncoded, title, cfg == nil)
    - 261 + + 425 +
    - + - fmt.Println(fileName) +   + }
    - 262 + + 426 +
    - + - return err +   +
    - 263 + + 427 +
    - + - } +   + // Total transactions
    - 264 + +
    @@ -433,7 +383,7 @@
    +
    + 433 +
    - + - out, err := exec.Command("mv", outputDir+"_/"+fileName, outputDir).CombinedOutput() +   + if showErrors {
    - 265 + + 434 +
    - + - if err != nil { +   + fmt.Printf("egp-error:#%d:(L2 block [%d] %v):%s\n", i, block, egp.l2BlockReceived, egp.LogError)
    - 266 + + 435 +
    - + - fmt.Println(string(out)) +   + if showDetail && !showAlways {
    - 267 + + 436 +
    - + - return err + - + printEgpLogRecord(egp, showEncoded, title, cfg == nil)
    - 268 + + 437 +
    - + - } +   + }
    - 269 + + 438 +
    - + - return nil +   + }
    - 270 + + 439 +
    - + - } +   + }
    -
    -
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/forced_batches_test.go - RENAMED - -
    -
    -
    -
    - - - + - - -
    -
    @@ -196,7 +196,7 @@
    +
    @@ -454,7 +404,7 @@
    - 196 + 454
      - require.NoError(t, err) + if showReprocess {
    - 197 + 455
      - genesisConfig, err := config.LoadGenesisFromJSONString(genesisFileAsStr) + fmt.Printf("egp-reprocess:#%d:(L2 block [%d] %v)\n", i, block, egp.l2BlockReceived)
    - 198 + 456
      - require.NoError(t, err) + if showDetail && !showAlways {
    - 199 + 457
    - - require.NoError(t, opsman.SetForkID(genesisConfig.Genesis.BlockNumber, forkID6)) + printEgpLogRecord(egp, showEncoded, title, cfg == nil)
    - 200 + 458
      - err = opsman.Setup() + }
    - 201 + 459
      - require.NoError(t, err) + }
    - 202 + 460
      - time.Sleep(5 * time.Second) + }
    -
    -
    -
    -
    - - - + - - - - -
    -
     
    +
    @@ -480,7 +430,6 @@
    - 196 + 480
      - require.NoError(t, err) + // Gas total and average
    - 197 + 481
      - genesisConfig, err := config.LoadGenesisFromJSONString(genesisFileAsStr) + stats.countGasFinal++
    - 198 + 482
      - require.NoError(t, err) + stats.sumGasFinal += egp.LogValueFinal
    - 199 + + 483 +
    - + - require.NoError(t, opsman.SetForkID(genesisConfig.Genesis.RollupBlockNumber, forkID6)) + - + stats.sumRealGas += egp.realGasPrice
    - 200 + 484
      - err = opsman.Setup() +
    - 201 + 485
      - require.NoError(t, err) + // Gas total and average without EGP
    - 202 + 486
      - time.Sleep(5 * time.Second) + var l2SugPreEGP float64
    -
    -
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/forced_batches_vector_shared.go - RENAMED - -
    -
    -
    -
    - - - + + + + - - -
    -
    @@ -63,8 +63,8 @@
    +
    @@ -490,9 +439,9 @@
    - 63 + 490
      - log.Info("# Setting Genesis #") + l2SugPreEGP = 0.1
    - 64 + 491
      - log.Info("###################") + }
    - 65 + 492
      - genesisActions := vectors.GenerateGenesisActions(testCase.Genesis) +
    - 66 + 493
    - - require.NoError(t, opsman.SetGenesis(genesisConfig.Genesis.BlockNumber, genesisActions)) + stats.countGasNoEGP++
    - 67 + 494
    - - require.NoError(t, opsman.SetForkID(genesisConfig.Genesis.BlockNumber, forkID6)) + stats.sumGasNoEGP += egp.LogL1GasPrice * l2SugPreEGP +
    +
    + 495 + +
    + - + stats.sumFeeNoEGP += egp.LogL1GasPrice * l2SugPreEGP * egp.LogGasUsedSecond
    - 68 + 496
      - actualOldStateRoot, err := opsman.State().GetLastStateRoot(ctx, nil) +
    - 69 + 497
      - require.NoError(t, err) + // Loss
    - 70 + 498
      - require.NoError(t, opsman.Setup()) + if egp.LogValueFinal == egp.LogGasPrice {
    -
    @@ -93,7 +93,7 @@
    +
    @@ -514,27 +463,10 @@
    - 93 + 514
      - } + info := fmt.Sprintf("reprocess=%t, final=%.0f, egp1=%.0f, egp2=%.0f, user=%.0f", egp.LogReprocess, egp.LogValueFinal, egp.LogGasUsedFirst, egp.LogGasUsedSecond, egp.LogGasPrice)
    - 94 + 515
      -
    + fmt.Printf("egp-loss:#%d:(L2 block [%d] %v):loss=%.0f:info:%s\n", i, block, egp.l2BlockReceived, loss, info)
    - 95 + 516
      - log.Info("#######################") + if showDetail && !showAlways {
    - 96 + 517
    - - log.Info("# Verifying new leafs #") + printEgpLogRecord(egp, showEncoded, title, cfg == nil)
    - 97 + 518
      - log.Info("#######################") + }
    - 98 + 519
      - merkleTree := opsman.State().GetTree() + }
    - 99 + 520
      - for _, expectedNewLeaf := range testCase.ExpectedNewLeafs { + }
    -
    + + + 521 + + +
    + - +
    -
    -
    - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + - - + + + + + + + + + + + + - - -
    + 522 + +
    + - + // Show discrepancies +
    +
    + 523 + +
    + - + if showDiscrepancy > 0 && compareEgp != nil { +
    +
    + 524 + +
    + - + var discrepancy bool +
    +
    + 525 + +
    + - + if (showDiscrepancy == 2 || showDiscrepancy == 3) && egp.realGasPrice != compareEgp.realGasPrice { +
    +
    + 526 + +
    + - + discrepancy = true +
    +
    + 527 + +
    + - + fmt.Printf("egp-disc:realgas:#%d:(L2 block [%d] %v):sim=%0.f, real=%0.f\n", i, block, egp.l2BlockReceived, egp.realGasPrice, compareEgp.realGasPrice) +
    +
    + 528 + +
    + - + } +
    +
    + 529 + +
    + - + if (showDiscrepancy == 1 || showDiscrepancy == 3) && egp.LogReprocess != compareEgp.LogReprocess { +
    +
    + 530 + +
    + - + discrepancy = true +
    +
    + 531 + +
    + - + fmt.Printf("egp-disc:reprocess:#%d:(L2 block [%d] %v):sim=%t, real=%t\n", i, block, egp.l2BlockReceived, egp.LogReprocess, compareEgp.LogReprocess) +
    +
    + 532 + +
    + - + } +
    +
    + 533 + +
    + - + if discrepancy && showDetail && !showAlways { +
    +
    + 534 + +
    + - + printEgpLogRecord(compareEgp, showEncoded, "REAL", true) +
    +
    + 535 + +
    + - + printEgpLogRecord(egp, showEncoded, title, cfg == nil) +
    +
    + 536 + +
    + - + } +
    +
    + 537 + +
    + - + } +
    +
    + 538 + +
    +   + } +
    +
    + 539 + +
    +   + } +
    +
    + 540 + +
    +   +
    +
    +
    -
     
    +
    @@ -545,10 +477,9 @@
    - 63 + 545
      - log.Info("# Setting Genesis #") + }
    - 64 + 546
      - log.Info("###################") +
    - 65 + 547
      - genesisActions := vectors.GenerateGenesisActions(testCase.Genesis) + // printEgpLogRecord prints values of egpLogRecord struct
    - 66 + + 548 +
    - + - require.NoError(t, opsman.SetGenesis(genesisConfig.Genesis.RollupBlockNumber, genesisActions)) + - + func printEgpLogRecord(record *egpLogRecord, showTxInfo bool, title string, isReal bool) {
    - 67 + + 549 +
    - + - require.NoError(t, opsman.SetForkID(genesisConfig.Genesis.RollupBlockNumber, forkID6)) + - + fmt.Printf("%s L2BlockNum: [%d]\n", title, record.l2BlockNum)
    - 68 + 550
      - actualOldStateRoot, err := opsman.State().GetLastStateRoot(ctx, nil) + fmt.Printf(" timestamp: [%v]\n", record.l2BlockReceived) +
    +
    + 551 + +
    + - + fmt.Printf(" hash: [%s]\n", record.hash)
    - 69 + 552
      - require.NoError(t, err) + fmt.Printf(" Error: [%s]\n", record.LogError)
    - 70 + 553
      - require.NoError(t, opsman.Setup()) + fmt.Printf(" Enabled: [%t]\n", record.LogEnabled) +
    +
    + 554 + +
    +   + fmt.Printf(" L1GasPrice: [%.0f]\n", record.LogL1GasPrice)
    -
     
    +
    @@ -565,11 +496,6 @@
    - 93 + 565
      - } + fmt.Printf(" Percentage: [%d]\n", record.LogPercentage)
    - 94 + 566
      -
    + fmt.Printf(" MaxDeviation: [%.0f]\n", record.LogMaxDeviation)
    - 95 + 567
      - log.Info("#######################") + fmt.Printf(" FinalDeviation: [%.0f]\n", record.LogFinalDeviation)
    - 96 + + 568 +
    - + - log.Info("# Verifying new leaves #") + - + if !isReal { +
    +
    + 569 + +
    + - + fmt.Printf(" *zeroBytes: [%d]\n", record.txZeroCount) +
    +
    + 570 + +
    + - + fmt.Printf(" *nonZeroBytes: [%d]\n", record.txNonZeroCount) +
    +
    + 571 + +
    + - + } +
    +
    + 572 + +
    + - + fmt.Printf(" *realGasPrice: [%0.f]\n", record.realGasPrice)
    - 97 + 573
      - log.Info("#######################") + if showTxInfo {
    - 98 + 574
      - merkleTree := opsman.State().GetTree() + fmt.Printf(" encoded: [%s]\n", record.encoded)
    - 99 + 575
      - for _, expectedNewLeaf := range testCase.ExpectedNewLeafs { + }
    -
    -
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/sc_test.go - RENAMED - -
    -
    -
    -
    - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -147015,13 +340769,13 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - @@ -147054,1366 +340808,1148 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0


    - - -
    -
    @@ -646,3 +647,106 @@
    +
    @@ -617,33 +543,30 @@
    - 646 + 617
      - require.Equal(t, 0, big.NewInt(2).Cmp(value)) + fmt.Printf(" Tx fee avg...........: [%.0f] (%.3f GWei) (%.9f ETH)\n", stats.sumFee/stats.countGasFinal,
    - 647 + 618
      - } + stats.sumFee/stats.countGasFinal/GWEI_DIV, stats.sumFee/stats.countGasFinal/ETH_DIV)
    - 648 + 619
      - } + }
    - + + 620 -
    -   -
    +
    +
    + - + if stats.countGasNoEGP > 0 {
    - + + 621 -
    -   -
    +
    +
    + - + fmt.Printf(" Gas pri.avg noEGP....: [%.0f] (%.3f GWei) (%.9f ETH)\n", stats.sumGasNoEGP/stats.countGasNoEGP,
    - + + 622 -
    -   -
    +
    +
    + - + stats.sumGasNoEGP/stats.countGasNoEGP/GWEI_DIV, stats.sumGasNoEGP/stats.countGasNoEGP/ETH_DIV)
    - + + 623 -
    -   -
    +
    +
    + - + }
    - + + 624 -
    -   -
    +
    +
    + - + if stats.countGasNoEGP > 0 {
    - + + 625 -
    -   -
    +
    +
    + - + fmt.Printf(" Tx fee avg noEGP.....: [%.0f] (%.3f GWei) (%.9f ETH)\n", stats.sumFeeNoEGP/stats.countGasNoEGP,
    - + + 626 -
    -   -
    +
    +
    + - + stats.sumFeeNoEGP/stats.countGasNoEGP/GWEI_DIV, stats.sumFeeNoEGP/stats.countGasNoEGP/ETH_DIV)
    - + + 627 -
    -   -
    +
    +
    + - + }
    - + + 628 -
    -   -
    +
    +
    + - + fmt.Printf(" Diff fee EGP-noEGP...: [%.0f] (%.3f Gwei) (%.9f ETH)\n", stats.sumFee-stats.sumFeeNoEGP,
    - + + 629 -
    -   -
    +
    +
    + - + (stats.sumFee-stats.sumFeeNoEGP)/GWEI_DIV, (stats.sumFee-stats.sumFeeNoEGP)/ETH_DIV)
    - + + 630 -
    -   -
    +
    +
    + - + fmt.Printf(" Loss count...........: [%.0f] (%.2f%%)\n", stats.totalLossCount, stats.totalLossCount/statsCount*100) // nolint:gomnd
    - + + 631 -
    -   -
    +
    +
    + - + fmt.Printf(" Loss total.......: [%.0f] (%.3f GWei) (%.9f ETH)\n", stats.totalLoss, stats.totalLoss/GWEI_DIV, stats.totalLoss/ETH_DIV)
    - + + 632 -
    +
    +
      -
    + if stats.totalLossCount > 0 {
    - + + 633 -
    +
    +
    + - + fmt.Printf(" Loss average.....: [%.0f] (%.0f GWei) (%.9f ETH)\n", stats.totalLoss/stats.totalLossCount, stats.totalLoss/stats.totalLossCount/GWEI_DIV, +
    +
    + 634 + +
      -
    + stats.totalLoss/stats.totalLossCount/ETH_DIV)
    - + + 635 -
    +
    +
      -
    + }
    - + + 636 -
    +
    +
    + - + fmt.Printf(" Real gas price total.: [%.0f] (%.3f GWei) (%.9f ETH)\n", stats.sumRealGas, stats.sumRealGas/GWEI_DIV, stats.sumRealGas/ETH_DIV) +
    +
    + 637 + +
      -
    + }
    - + + 638 -
    +
    +
      -
    + }
    - + + 639 -
    +
    +
     
    - + + 640 -
    +
    +
      -
    + // simulateConfig simulates scenario using received config
    - + + 641 -
    +
    +
      -
    + func simulateConfig(egp *egpLogRecord, cfg *egpConfig) {
    - + + 642 -
    +
    +
      -
    + // L2 and user gas price
    - + + 643 -
    -   -
    +
    +
    + - + if !useRealL2GasPrice || !egp.LogEnabled {
    - + + 644 -
    -   -
    +
    +
    + - + egp.LogL2GasPrice = egp.LogL1GasPrice * cfg.L2GasPriceSugFactor
    - + + 645 -
    -   -
    +
    +
    + - + egp.LogGasPrice = egp.LogL2GasPrice
    - + + 646 -
    -   -
    +
    +
    + - + }
    - + + 647 -
    +
    +
     
    - + + 648 -
    +
    +
      -
    + // Compute EGP
    - + + 649 -
    +
    +
      -
    + var err error
    - + +
    @@ -679,64 +602,43 @@
    -
    +
    + 679 + +
      -
    + egp.LogValueFinal = egp.LogGasPrice
    - + + 680 -
    +
    +
      -
    + }
    - + + 681 -
    +
    +
      -
    + }
    - + + 682 -
    -   -
    +
    +
    + - + // Gas price effective percentage
    - + + 683 -
    -   -
    +
    +
    + - + egp.LogPercentage = calcEffectivePercentage(egp.LogGasPrice, egp.LogValueFinal)
    - + + 684 -
    +
    +
      -
    + } else {
    - + + 685 -
    +
    +
      -
    + egp.LogValueSecond = 0
    - + + 686 -
    +
    +
     
    - + + 687 -
    +
    +
      -
    + // Final gas: price signed
    - + + 688 -
    +
    +
      -
    + egp.LogValueFinal = egp.LogGasPrice
    - + + 689 -
    -   -
    +
    +
    + - + // Gas price effective percentage
    - + + 690 -
    -   -
    +
    +
    + - + egp.LogPercentage = uint64(state.MaxEffectivePercentage)
    - + + 691 -
    +
    +
      -
    + }
    - + + 692 -
    +
    +
     
    - + + 693 -
    -   -
    +
    +
    + - + // Real price paid by the user (to perform a double check)
    - + + 694 -
    -   -
    +
    +
    + - + egp.realGasPrice = roundEffectiveGasPrice(egp.LogGasPrice, egp.LogPercentage)
    - + + 695 -
    -   -
    +
    +
    + - + }
    - + + 696 -
    -   +
    +
    + -
    - + + 697 -
    -   -
    +
    +
    + - + func calcEffectivePercentage(gasPrice float64, gasEffective float64) uint64 {
    - + + 698 -
    -   -
    +
    +
    + - + if gasPrice > 0 {
    - + + 699 -
    -   -
    +
    +
    + - + return uint64(((gasEffective*256)+gasPrice-1)/gasPrice - 1) // nolint:gomnd
    - + + 700 -
    +
    +
      -
    + } else {
    - + + 701 -
    -   -
    +
    +
    + - + return 0
    - + + 702 -
    +
    +
      -
    + }
    - + + 703 -
    +
    +
      -
    + }
    - + + 704 -
    +
    +
     
    - + + 705 -
    -   -
    +
    +
    + - + func roundEffectiveGasPrice(gasPrice float64, pct uint64) float64 {
    - + + 706 -
    -   -
    +
    +
    + - + return gasPrice / 256 * float64(pct+1) // nolint:gomnd
    - + + 707 -
    -   -
    +
    +
    + - + }
    - + + 708 -
    -   +
    +
    + -
    - + + 709 -
    +
    +
      -
    + // calcEffectiveGasPrice calculates the effective gas price
    - + + 710 -
    +
    +
      -
    + func calcEffectiveGasPrice(gasUsed float64, tx *egpLogRecord, cfg *egpConfig) (float64, error) {
    - + + 711 -
    -   -
    +
    +
    + - + // Decode tx
    - + + 712 -
    -   -
    +
    +
    + - + rawBytes, err := decodeTx(tx)
    - + + 713 -
    -   -
    +
    +
    + - + if err != nil {
    - + + 714 -
    -   -
    +
    +
    + - + return 0, err
    - + + 715 -
    -   -
    +
    +
    + - + }
    - + + 716 -
    -   +
    +
    + -
    - + + 717 -
    -   -
    +
    +
    + - + // Zero and non zero bytes
    - + + 718 -
    -   -
    +
    +
    + - + txZeroBytes := uint64(bytes.Count(rawBytes, []byte{0}))
    - + + 719 -
    -   -
    +
    +
    + - + txNonZeroBytes := uint64(len(rawBytes)) - txZeroBytes
    - + + 720 -
    -   -
    +
    +
    + - + tx.txZeroCount = txZeroBytes
    - + + 721 -
    -   -
    +
    +
    + - + tx.txNonZeroCount = txNonZeroBytes
    - + + 722 -
    -   +
    +
    + -
    - + + 723 -
    +
    +
      -
    + // Calculate break even gas price
    - + + 724 -
    +
    +
      -
    + var breakEvenGasPrice float64
    - + + 725 -
    -   -
    +
    +
    + - + if gasUsed == ethTransferGasValue {
    - + + 726 -
    -   -
    +
    +
    + - + // Transfer
    - + + 727 -
    -   -
    +
    +
    + - + if cfg.EthTransferGasPrice != 0 {
    - + + 728 -
    -   -
    +
    +
    + - + breakEvenGasPrice = float64(cfg.EthTransferGasPrice)
    - + + 729 -
    -   -
    +
    +
    + - + } else if cfg.EthTransferL1GasPriceFactor != 0 {
    - + + 730 -
    -   -
    +
    +
    + - + if tx.LogL1GasPrice == 0 {
    - + + 731 -
    -   -
    +
    +
    + - + breakEvenGasPrice = 1
    - + + 732 -
    -   -
    +
    +
    + - + } else {
    - + + 733 -
    -   -
    +
    +
    + - + breakEvenGasPrice = tx.LogL1GasPrice * cfg.EthTransferL1GasPriceFactor
    - + + 734 -
    -   -
    +
    +
    + - + }
    - + + 735 -
    -   -
    +
    +
    + - + }
    - + + 736 -
    -   -
    +
    +
    + - + } else if gasUsed == 0 {
    - + + 737 -
    +
    +
      -
    + breakEvenGasPrice = tx.LogGasPrice
    - + + 738 -
    +
    +
      -
    + } else {
    - + + 739 -
    +
    +
      -
    + l2MinGasPrice := tx.LogL1GasPrice * cfg.L1GasPriceFactor
    -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - + +
    -
     
    -
    - 647 + 740
      - require.Equal(t, 0, big.NewInt(2).Cmp(value)) + totalTxPrice := gasUsed*l2MinGasPrice + float64((fixedBytesTx+txNonZeroBytes)*cfg.ByteGasCost+txZeroBytes*cfg.ZeroGasCost)*tx.LogL1GasPrice
    - 648 + 741
      - } + breakEvenGasPrice = totalTxPrice / gasUsed * cfg.NetProfitFactor
    - 649 + 742
      - } -
    -
    - 650 - -
    - + -
    -
    -
    - 651 - -
    - + - func TestCounterAndBlock(t *testing.T) { -
    -
    - 652 - -
    - + - if testing.Short() { -
    -
    - 653 - -
    - + - t.Skip() -
    -
    - 654 - -
    - + }
    - 655 - -
    - + -
    -
    -
    - 656 - -
    - + - var err error -
    -
    - 657 - -
    - + - err = operations.Teardown() -
    -
    - 658 - -
    - + - require.NoError(t, err) -
    -
    - 659 - -
    - + -
    -
    -
    - 660 - -
    - + - defer func() { require.NoError(t, operations.Teardown()) }() -
    -
    - 661 - -
    - + -
    -
    -
    - 662 - -
    - + - ctx := context.Background() -
    -
    - 663 - -
    - + - opsCfg := operations.GetDefaultOperationsConfig() -
    -
    - 664 - -
    - + - opsMan, err := operations.NewManager(ctx, opsCfg) -
    -
    - 665 - -
    - + - require.NoError(t, err) -
    -
    - 666 - -
    - + - err = opsMan.Setup() -
    -
    - 667 - -
    - + - require.NoError(t, err) -
    -
    - 668 - -
    - + -
    -
    -
    - 669 - -
    - + - for _, network := range networks { -
    -
    - 670 - -
    - + - log.Debugf(network.Name) -
    +
    +
    @@ -744,7 +646,7 @@
    - 671 + + 744 +
    - + - client := operations.MustGetClient(network.URL) +   + // Calculate effective gas price
    - 672 + + 745 +
    - + - auth := operations.MustGetAuth(network.PrivateKey, network.ChainID) +   + var ratioPriority float64
    - 673 + + 746 +
    - + -
    +   + if tx.LogGasPrice > tx.LogL2GasPrice {
    - 674 + + 747 +
    - + - _, scTx, sc, err := CounterAndBlock.DeployCounterAndBlock(auth, client) + - + ratioPriority = tx.LogGasPrice / tx.LogL2GasPrice
    - 675 + + 748 +
    - + - require.NoError(t, err) +   + } else {
    - 676 + + 749 +
    - + -
    +   + ratioPriority = 1
    - 677 + + 750 +
    - + - logTx(scTx) +   + }
    - 678 - -
    - + - err = operations.WaitTxToBeMined(ctx, client, scTx, operations.DefaultTimeoutTxToBeMined) +
    +
    +
    +
    + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    +
     
    - 679 + + 25 +
    - + - require.NoError(t, err) +   + )
    - 680 + + 26 +
    - + +  
    - 681 + + 27 +
    - + - scReceipt, err := client.TransactionReceipt(ctx, scTx.Hash()) +   + var (
    - 682 + + 28 +
    + - require.NoError(t, err) + showErrors bool
    - 683 + + 29 +
    + -
    + showLosses bool
    - 684 + + 30 +
    + - scBlock, err := client.BlockByNumber(ctx, scReceipt.BlockNumber) + showReprocess bool
    - 685 + + 31 +
    + - require.NoError(t, err) + showDetail bool
    - 686 + + 32 +
    + -
    + showAlways bool
    - 687 + + 33 +
    + - count, ts, err := sc.GetCount(&bind.CallOpts{Pending: false, BlockNumber: scBlock.Number()}) + showOnlyCfg bool
    - 688 + + -
    - + - require.NoError(t, err) +
    +
    +   +
    - 689 + + -
    - + +
    +
    +  
    - 690 + + -
    - + - assert.Equal(t, 0, count.Cmp(big.NewInt(0))) +
    +
    +   +
    - 691 + + 34 +
    - + - assert.Equal(t, ts.Uint64(), scBlock.Time()) +   + )
    - 692 + + 35 +
    - + +  
    - 693 + + 36 +
    - + - const numberOfIncrements = 5 +   + const (
    - 694 + + 37 +
    + - type result struct { + signatureBytes = 65
    - 695 + + 38 +
    + - tx *types.Transaction + effectivePctBytes = 1
    - 696 + + 39 +
    + - receipt *types.Receipt + fixedBytesTx = signatureBytes + effectivePctBytes
    - 697 + + -
    - + - block *types.Block +
    +
    +   +
    - 698 + + 40 +
    - + - expectedCount *big.Int +   + )
    - 699 + + 41 +
    - + - } +   +
    - 700 + + 42 +
    - + -
    +   + type egpConfig struct {
    - 701 + + 43 +
    + - results := make([]result, 0, numberOfIncrements) + ByteGasCost uint64 // gas cost of 1 byte
    - 702 + + 44 +
    + - for i := 0; i < numberOfIncrements; i++ { + ZeroGasCost uint64 // gas cost of 1 byte zero
    - 703 + + 45 +
    + - tx, err := sc.Increment(auth) + NetProfitFactor float64 // L2 network profit factor
    - 704 + + 46 +
    + - require.NoError(t, err) + L1GasPriceFactor float64 // L1 gas price factor
    - 705 + + 47 +
    + -
    + L2GasPriceSugFactor float64 // L2 gas price suggester factor
    - 706 + + 48 +
    + - logTx(tx) + FinalDeviationPct uint64 // max final deviation percentage
    - 707 + + 49 +
    + - err = operations.WaitTxToBeMined(ctx, client, tx, operations.DefaultTimeoutTxToBeMined) + MinGasPriceAllowed uint64 // min gas price allowed
    - 708 + + 50 +
    + - require.NoError(t, err) + L2GasPriceSugFactorPreEGP float64 // L2 gas price suggester factor (pre EGP)
    - 709 + + -
    - + +
    +
    +  
    - 710 + + 51 +
    - + - receipt, err := client.TransactionReceipt(ctx, tx.Hash()) +   + }
    - 711 + + 52 +
    - + - require.NoError(t, err) +   +
    - 712 + + 53 +
    - + -
    +   + type egpLogRecord struct {
    - 713 + + 54 +
    - + - block, err := client.BlockByNumber(ctx, receipt.BlockNumber) +   + l2BlockNum uint64
    - 714 + + 55 +
    - + - require.NoError(t, err) +   + l2BlockReceived time.Time
    - 715 + + 56 +
    - + -
    +   + encoded string
    - 716 + + -
    - + - results = append(results, result{ +
    +
    +   +
    - 717 + + 57 +
    - + - tx: tx, +   + missingLogInfo bool // Flag if egp_log field is empty
    - 718 + + -
    - + - expectedCount: big.NewInt(int64(i) + 1), +
    +
    +   +
    - 719 + + -
    - + - receipt: receipt, +
    +
    +   +
    - 720 + + -
    - + - block: block, +
    +
    +   +
    - 721 + + 58 +
    - + - }) +   + LogError string `json:"Error"`
    - 722 + + 59 +
    - + - } +   + LogEnabled bool `json:"Enabled"`
    - 723 + + 60 +
    - + -
    +   + LogL1GasPrice float64 `json:"L1GasPrice"` // L1 gas price
    - 724 + +
     
    +
    + 88 +
    - + - const numberOfChecks = 2 +   + totalLoss float64 // Total loss gas amount
    - 725 + + 89 +
    - + -
    +   + sumGasFinal float64 // Accumulated sum of final gas (to get average)
    - 726 + + 90 +
    - + - // checks against first increment +   + countGasFinal float64 // Count number of accumulated (to get average)
    - 727 + + 91 +
    + - for _, r := range results { + sumGasPreEGP float64 // Accumulated sum of gas without EGP
    - 728 + + 92 +
    + - for i := 0; i < numberOfChecks; i++ { + countGasPreEGP float64 // Count number of accumulated pre EGP (to get average)
    - 729 + + 93 +
    - + - count, ts, err = sc.GetCount(&bind.CallOpts{Pending: false, BlockNumber: r.block.Number()}) +   + sumFee float64
    - 730 + + 94 +
    + - require.NoError(t, err) + sumFeePreEGP float64
    - 731 + + -
    - + - assert.Equal(t, r.expectedCount.Uint64(), count.Uint64()) +
    +
    +   +
    - 732 + + 95 +
    - + - assert.Equal(t, r.block.Time(), ts.Uint64()) +   + }
    - 733 + + 96 +
    - + +  
    - 734 + + 97 +
    - + - time.Sleep(time.Second) +   + func main() {
    - 735 - -
    - + - } -
    +
    +
     
    - 736 + + 130 +
    - + - } +   + Value: false,
    - 737 + + 131 +
    - + -
    +   + },
    - 738 + + 132 +
    - + - latestIncrement := results[len(results)-1] +   + &cli.BoolFlag{
    - 739 + + -
    - + - // checks against second increment with latest block +
    +
    +   +
    - 740 + + -
    - + - for i := 0; i < numberOfChecks; i++ { +
    +
    +   +
    - 741 + + -
    - + - latestBlock, err := client.BlockByNumber(ctx, nil) +
    +
    +   +
    - 742 + + -
    - + - require.NoError(t, err) +
    +
    +   +
    - 743 + + -
    - + +
    +
    +  
    - 744 + + 133 +
    - + - count, ts, err = sc.GetCount(&bind.CallOpts{Pending: false}) +   + Name: "showalways",
    - 745 + + 134 +
    - + - require.NoError(t, err) +   + Usage: "show always full detailed record",
    - 746 + + 135 +
    - + - assert.Equal(t, latestIncrement.expectedCount.Uint64(), count.Uint64()) +   + Value: false,
    - 747 + + 136 +
    - + - assert.Equal(t, latestBlock.Time(), ts.Uint64()) +   + },
    - 748 + + -
    - + +
    +
    +  
    - 749 + + -
    - + - time.Sleep(time.Second) +
    +
    +   +
    - 750 + + -
    - + - } +
    +
    +   +
    - 751 + + -
    - + - } +
    +
    +   +
    - 752 - -
    - + - } -
    +
    +
    -
    + +
    +   +
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/state_test.go - RENAMED - -
    -
    -
    -
    - - - - - - - + - - + - - - - - - - - - - -
    -
    @@ -59,7 +59,7 @@
    - 59 + 137
      - for _, gacc := range testCase.GenesisAccounts { + &cli.StringFlag{
    - 60 + 138
      - genesisAccounts[gacc.Address] = gacc.Balance.Int + Name: "cfg",
    - 61 + 139
      - } + Aliases: []string{"c"},
    - 62 - -
    - - - require.NoError(t, opsman.SetGenesisAccountsBalance(genesisConfig.Genesis.BlockNumber, genesisAccounts)) -
    +
    +
     
    - 63 + 145
      -
    + Usage: "show only simulation results",
    - 64 + 146
      - // Check initial root + Value: false,
    - 65 + 147
      - require.NoError(t, opsman.CheckVirtualRoot(testCase.ExpectedOldRoot)) + },
    -
    @@ -82,7 +82,7 @@
    +
    + + +
    +   +
    +
    - 82 + + -
    +
    +
     
    - 83 + + -
    +
    +
      - st := opsman.State() +
    - 84 + + -
    +
    +
     
    - 85 + + -
    - - - // Check leafs +
    +
    +   +
    - 86 + 148
      - l2Block, err := st.GetLastL2Block(ctx, nil) + &cli.StringFlag{
    - 87 + 149
      - require.NoError(t, err) + Name: "db",
    - 88 + 150
      - for addrStr, leaf := range testCase.ExpectedNewLeafs { + Usage: "DB connection string: \"host=xxx port=xxx user=xxx dbname=xxx password=xxx\"",
    -
    -
    -
    -
    - - - + - - - - - - - - + - - + + + + + + + + + - - + + + - - -
     
    - 59 + 164
      - for _, gacc := range testCase.GenesisAccounts { + // defaultConfig parses the default configuration values
    - 60 + 165
      - genesisAccounts[gacc.Address] = gacc.Balance.Int + func defaultConfig() (*egpConfig, error) {
    - 61 + 166
      - } + cfg := egpConfig{
    - 62 + 167
    + - require.NoError(t, opsman.SetGenesisAccountsBalance(genesisConfig.Genesis.RollupBlockNumber, genesisAccounts)) + ByteGasCost: 16, // nolint:gomnd
    - 63 + + 168 +
    -   -
    + + + ZeroGasCost: 4, // nolint:gomnd
    - 64 + + 169 +
    -   - // Check initial root + + + NetProfitFactor: 1.0, // nolint:gomnd
    - 65 + + 170 +
    -   - require.NoError(t, opsman.CheckVirtualRoot(testCase.ExpectedOldRoot)) + + + L1GasPriceFactor: 0.25, // nolint:gomnd
    -
     
    +
    + 171 + +
    + + + L2GasPriceSugFactor: 0.5, // nolint:gomnd +
    - 82 + + 172 + +
    + + + FinalDeviationPct: 10, // nolint:gomnd +
    +
    + 173 + +
    + + + MinGasPriceAllowed: 1000000000, // nolint:gomnd +
    +
    + 174 +
    + + + L2GasPriceSugFactorPreEGP: 0.1, // nolint:gomnd +
    +
    + + +
     
    - 83 + 175
      - st := opsman.State() + }
    - 84 + 176
    @@ -148422,222 +341958,248 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 85 + + 177 +
    - + - // Check leaves +   + viper.SetConfigType("toml")
    +
     
    +
    - 86 + 242
      - l2Block, err := st.GetLastL2Block(ctx, nil) + showDetail = ctx.Bool("showdetail")
    - 87 + 243
      - require.NoError(t, err) + showAlways = ctx.Bool("showalways")
    - 88 + 244
      - for addrStr, leaf := range testCase.ExpectedNewLeafs { + showOnlyCfg = ctx.Bool("onlycfg")
    -
    + + + + + +
    +   +
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/test/Makefile - RENAMED - -
    -
    -
    -
    - - - - - - - + + + - - + + + + + + + + + @@ -148652,92 +342214,102 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - + + + - - + + + - - + @@ -148800,6 +342377,16 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0


    + + + - - - - - - - - - - - - - - - - - - - - - - - - @@ -148997,217 +342549,192 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -149351,63 +342873,73 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - + + + @@ -149482,86 +343014,62 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - -
    -
    @@ -1,4 +1,4 @@
    - 1 + + -
    - - - DOCKERCOMPOSE := docker-compose -f docker-compose.yml +
    +
    +   +
    +
    +
    + + +
    +   +
    - 2 + 245
      - DOCKERCOMPOSEAPPSEQ := zkevm-sequencer +
    - 3 + 246
      - DOCKERCOMPOSEAPPSEQV1TOV2 := zkevm-sequencer-v1tov2 + // Load simulation config file
    - 4 + 247
      - DOCKERCOMPOSEAPPSEQSENDER := zkevm-sequence-sender + var err error
    -
    @@ -26,6 +26,7 @@
    +
     
    - 26 + 270
      - DOCKERCOMPOSEZKPROVER := zkevm-prover +
    - 27 + 271
      - DOCKERCOMPOSEPERMISSIONLESSDB := zkevm-permissionless-db + // Query data
    - 28 + 272
      - DOCKERCOMPOSEPERMISSIONLESSNODE := zkevm-permissionless-node + query := fmt.Sprintf(`
    - + + 273 -
    -   -
    +
    +
    + + + select lb.received_at, t.l2_block_num, coalesce(t.egp_log::varchar,'') as egp_log, t.encoded
    - 29 + 274
      - DOCKERCOMPOSEPERMISSIONLESSZKPROVER := zkevm-permissionless-prover + from state.transaction t
    - 30 + 275
      - DOCKERCOMPOSENODEAPPROVE := zkevm-approve + join state.l2block lb on lb.block_num = t.l2_block_num
    - 31 + 276
      - DOCKERCOMPOSENODEAPPROVEV1TOV2 := zkevm-approve-v1tov2 + where t.l2_block_num >= %d and t.l2_block_num <= %d`, fromBlock, toBlock)
    -
    @@ -62,6 +63,7 @@
    +
     
    - 62 + 286
      -
    + logf("Starting from L2 block %d...", fromBlock)
    - 63 + 287 + +
    +   + var blockReceived time.Time +
    +
    + 288
    -   - RUNPERMISSIONLESSDB := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSDB) +   + var l2Block uint64 +
    +
    + 289 + +
    + + + var egpLog, encoded string +
    +
    + 290 + +
    + + + var stats, simulateStats egpStats
    - 64 + 291
      - RUNPERMISSIONLESSNODE := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSNODE) + var timeFirst, timeLast time.Time
    - 65 + 292
      - RUNPERMISSIONLESSZKPROVER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER) +
    - 66 + 293
      -
    + i := uint64(0)
    - 67 + 294
      - RUNAPPROVE := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSENODEAPPROVE) + for rows.Next() {
    -
    @@ -101,6 +103,7 @@
    -
    - 101 + 295
      -
    + // Fetch row +
    +
    + 296 + +
    + + + err = rows.Scan(&blockReceived, &l2Block, &egpLog, &encoded)
    - 102 + 297
      - STOPPERMISSIONLESSDB := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSDB) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSDB) + if err != nil {
    - 103 + 298
      - STOPPERMISSIONLESSNODE := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSNODE) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSNODE) + logf("Error fetching row: %v", err)
    - + + 299 -
    +
    +
      -
    + return err
    +
     
    +
    - 104 + 318
      - STOPPERMISSIONLESSZKPROVER := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER) + i++
    - 105 + 319
    @@ -148747,47 +342319,52 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 106 + 320
      - STOPAPPROVE := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSENODEAPPROVE) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSENODEAPPROVE) + // Transaction info
    -
    @@ -110,6 +113,9 @@
    +
    + 321 + +
    + + + egpData := egpLogRecord{ +
    - 110 + 322
      -
    + l2BlockReceived: blockReceived,
    - 111 + 323
      - STOP := $(DOCKERCOMPOSE) down --remove-orphans + l2BlockNum: l2Block,
    - 112 + 324
      -
    + encoded: encoded,
    + 325 + +
    +   + missingLogInfo: egpLog == "", +
    +
    @@ -148821,148 +342408,113 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 113 + + -
    +
    +
      - .PHONY: test-full-non-e2e +
    - 114 + 326
      - test-full-non-e2e: stop ## Runs non-e2e tests checking race conditions + }
    - 115 + 327
      - $(RUNSTATEDB) +
    -
    @@ -248,6 +254,17 @@
    -
    - 248 + 328
      - docker logs $(DOCKERCOMPOSEZKPROVER) + // Check if EGP info is present
    - 249 + 329
      - trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -failfast -race -v -p 1 -timeout 2000s ../ci/e2e-group11/... + if egpLog != "" {
    - 250 + 330
      -
    -
    -
    - - -
    -   -
    -
    -
    - - -
    -   -
    -
    -
    - - -
    -   -
    + // Decode EGP log json
    - + + 331 -
    -   -
    +
    +
    + + + err = json.Unmarshal([]byte(egpLog), &egpData)
    - + + 332 -
    +
    +
      -
    + if err != nil {
    - + + 333 -
    +
    +
      -
    + logf("Error decoding json from egp_log field: %v", err)
    - + + 334 -
    +
    +
      -
    + return err
    - + + 335 -
    +
    +
      -
    + }
    - 251 + 336
      - .PHONY: benchmark-sequencer-eth-transfers + }
    - 252 + 337
      - benchmark-sequencer-eth-transfers: stop +
    - 253 + 338
      - $(RUNL1NETWORK) + // Calculate stats
    -
    @@ -685,10 +702,12 @@
    -
    - 685 + + 339 +
    -   - .PHONY: generate-mocks-synchronizer + + + countStats(i, l2Block, &egpData, &stats, nil)
    - 686 + 340
      - generate-mocks-synchronizer: ## Generates mocks for synchronizer , using mockery tool +
    - 687 + 341
      - ## mocks for synchronizer -
    -
    - 688 - -
    - - - #export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=EthermanInterface --dir=../synchronizer --output=../synchronizer --outpkg=synchronizer --structname=ethermanMock --filename=mock_etherman.go ${COMMON_MOCKERY_PARAMS} + // Simulate using alternative config
    - 689 + + 342 +
    - - - #export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=stateInterface --dir=../synchronizer --output=../synchronizer --outpkg=synchronizer --structname=StateMock --filename=mock_state.go ${COMMON_MOCKERY_PARAMS} +   + if egpCfg != nil {
    - 690 + + 343 +
    - - - #export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=ethTxManager --dir=../synchronizer --output=../synchronizer --outpkg=synchronizer --structname=ethTxManagerMock --filename=mock_ethtxmanager.go ${COMMON_MOCKERY_PARAMS} + + + egpSimData := egpData
    - 691 + + 344 +
    - - - #export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=poolInterface --dir=../synchronizer --output=../synchronizer --outpkg=synchronizer --structname=poolMock --filename=mock_pool.go ${COMMON_MOCKERY_PARAMS} -
    -
    - - -
      -
    + simulateConfig(&egpSimData, egpCfg)
    - + + 345 -
    -   -
    +
    +
    + + + countStats(i, l2Block, &egpSimData, &simulateStats, egpCfg)
    - 692 + 346
      - for i in l1RollupProducerInterface l1RollupConsumerInterface worker synchronizerProcessBlockRangeInterface workersInterface L1ParallelEthermanInterface; do \ + }
    - 693 + 347
      - camelcase=$$(echo $$i | sed 's/\([a-z0-9]\)\([A-Z]\)/\1_\2/g' | tr '[:upper:]' '[:lower:]') ; \ + }
    - 694 + 348
      - echo $$camelcase ; \ +
    -
    @@ -722,6 +741,8 @@
    +
     
    - 722 + 353
      -
    + logf("\nPERIOD [%.2f days]: %v ... %v", diff/24, timeFirst, timeLast) // nolint:gomnd
    - 723 + 354
      - export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=poolInterface --dir=../gasprice --output=../gasprice --outpkg=gasprice --structname=poolMock --filename=mock_pool.go + if !showOnlyCfg {
    - 724 + 355
      - export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=ethermanInterface --dir=../gasprice --output=../gasprice --outpkg=gasprice --structname=ethermanMock --filename=mock_etherman.go + logf("\nEGP REAL STATS:")
    - + + 356 -
    -   -
    +
    +
    + + + printStats(&stats)
    - + + 357 -
    +
    +
      -
    + }
    - 725 + 358
    @@ -149217,67 +342744,62 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 726 + 359
      - .PHONY: generate-mocks-aggregator + // Print simulation stats results
    - 727 + 360
      - generate-mocks-aggregator: ## Generates mocks for aggregator , using mockery tool + if egpCfg != nil {
    -
    @@ -745,6 +766,27 @@
    -
    - 745 + 361
      - run-benchmarks: run-db ## Runs benchmars + logf("\nEGP SIMULATION STATS:")
    - 746 + 362
      - go test -bench=. ./state/tree + printStats(&simulateStats)
    - 747 + + 363 +
    -   -
    + + + logf("PARAMS: byte[%d] zero[%d] netFactor[%.2f] L1factor[%.2f] L2sugFactor[%.2f] devPct[%d] minGas[%d] L2sugPreEGP[%.2f]", egpCfg.ByteGasCost,
    - + + 364 -
    -   -
    +
    +
    + + + egpCfg.ZeroGasCost, egpCfg.NetProfitFactor, egpCfg.L1GasPriceFactor, egpCfg.L2GasPriceSugFactor, egpCfg.FinalDeviationPct, egpCfg.MinGasPriceAllowed, egpCfg.L2GasPriceSugFactorPreEGP)
    - + + 365 -
    +
    +
      -
    + }
    - + + 366 -
    +
    +
     
    - + + 367 -
    +
    +
      -
    + return nil
    - + + 368 -
    +
    +
      -
    + }
    - + + 369 -
    +
    +
     
    - + + 370 -
    +
    +
      -
    + // countStats calculates and counts statistics for an EGP record +
    +
    + 371 + +
    + + + func countStats(i uint64, block uint64, egp *egpLogRecord, stats *egpStats, cfg *egpConfig) {
    - 748 - -
    -   - .PHONY: compile-scs -
    -
    - 749 + 372
      - compile-scs: ## Compiles smart contracts, configuration in test/contracts/index.yaml + // Show record information
    - 750 + 373
      - go run ./scripts/cmd... compilesc --input ./contracts + if showAlways {
    -
    -
    -
    -
    - - - - - @@ -149571,72 +343079,72 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - @@ -149646,72 +343154,72 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - @@ -149721,72 +343229,72 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - @@ -149796,27 +343304,27 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - @@ -149891,172 +343399,272 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -150066,122 +343674,102 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - @@ -150191,416 +343779,407 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    -
    - 1 + 374
    + - DOCKERCOMPOSE := docker compose -f docker-compose.yml + printEgpLogRecord(egp, false)
    - 2 + 375
      - DOCKERCOMPOSEAPPSEQ := zkevm-sequencer + }
    - 3 + 376
      - DOCKERCOMPOSEAPPSEQV1TOV2 := zkevm-sequencer-v1tov2 +
    - 4 + 377
      - DOCKERCOMPOSEAPPSEQSENDER := zkevm-sequence-sender + // Total transactions
    - 26 + 383
      - DOCKERCOMPOSEZKPROVER := zkevm-prover + if showErrors {
    - 27 + 384
      - DOCKERCOMPOSEPERMISSIONLESSDB := zkevm-permissionless-db + fmt.Printf("egp-error:#%d:(L2 block [%d] %v):%s\n", i, block, egp.l2BlockReceived, egp.LogError)
    - 28 + 385
      - DOCKERCOMPOSEPERMISSIONLESSNODE := zkevm-permissionless-node + if showDetail && !showAlways {
    - 29 + + 386 +
    + - DOCKERCOMPOSEPERMISSIONLESSNODEDAC := zkevm-node-forced-DAC + printEgpLogRecord(egp, false)
    - 30 + 387
      - DOCKERCOMPOSEPERMISSIONLESSZKPROVER := zkevm-permissionless-prover + }
    - 31 + 388
      - DOCKERCOMPOSENODEAPPROVE := zkevm-approve + }
    - 32 + 389
      - DOCKERCOMPOSENODEAPPROVEV1TOV2 := zkevm-approve-v1tov2 + }
    - 63 + 404
      -
    + if showReprocess {
    - 64 + 405
      - RUNPERMISSIONLESSDB := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSDB) + fmt.Printf("egp-reprocess:#%d:(L2 block [%d] %v)\n", i, block, egp.l2BlockReceived)
    - 65 + 406
      - RUNPERMISSIONLESSNODE := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSNODE) + if showDetail && !showAlways {
    - 66 + + 407 +
    + - RUNPERMISSIONLESSNODEDAC := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSNODEDAC) + printEgpLogRecord(egp, false)
    - 67 + 408
      - RUNPERMISSIONLESSZKPROVER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER) + }
    - 68 + 409
      -
    + }
    - 69 + 410
      - RUNAPPROVE := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSENODEAPPROVE) + }
    - 103 + 430
      -
    + // Gas total and average
    - 104 + 431
      - STOPPERMISSIONLESSDB := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSDB) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSDB) + stats.countGasFinal++
    - 105 + 432
      - STOPPERMISSIONLESSNODE := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSNODE) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSNODE) + stats.sumGasFinal += egp.LogValueFinal
    - 106 + + -
    - + - STOPPERMISSIONLESSNODEDAC := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSNODEDAC) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSNODEDAC) +
    +
    +   +
    - 107 + 433
      - STOPPERMISSIONLESSZKPROVER := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER) +
    - 108 + 434
      -
    + // Gas total and average without EGP
    - 109 + 435
      - STOPAPPROVE := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSENODEAPPROVE) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSENODEAPPROVE) + var l2SugPreEGP float64
    - 113 + 439
      -
    + l2SugPreEGP = 0.1
    - 114 + 440
      - STOP := $(DOCKERCOMPOSE) down --remove-orphans + }
    - 115 + 441
    @@ -149825,63 +343333,63 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 116 + + 442 +
    + - RUNDACDB := docker-compose up -d zkevm-data-node-db + stats.countGasPreEGP++
    - 117 + + 443 +
    + - STOPDACDB := docker-compose stop zkevm-data-node-db && docker-compose rm -f zkevm-data-node-db + stats.sumGasPreEGP += egp.LogL1GasPrice * l2SugPreEGP
    - 118 + + 444 +
    + -
    + stats.sumFeePreEGP += egp.LogL1GasPrice * l2SugPreEGP * egp.LogGasUsedSecond
    - 119 + 445
      - .PHONY: test-full-non-e2e +
    - 120 + 446
      - test-full-non-e2e: stop ## Runs non-e2e tests checking race conditions + // Loss
    - 121 + 447
      - $(RUNSTATEDB) + if egp.LogValueFinal == egp.LogGasPrice {
    - 254 + 463
      - docker logs $(DOCKERCOMPOSEZKPROVER) + info := fmt.Sprintf("reprocess=%t, final=%.0f, egp1=%.0f, egp2=%.0f, user=%.0f", egp.LogReprocess, egp.LogValueFinal, egp.LogGasUsedFirst, egp.LogGasUsedSecond, egp.LogGasPrice)
    - 255 + 464
      - trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -failfast -race -v -p 1 -timeout 2000s ../ci/e2e-group11/... + fmt.Printf("egp-loss:#%d:(L2 block [%d] %v):loss=%.0f:info:%s\n", i, block, egp.l2BlockReceived, loss, info)
    - 256 + 465
      -
    + if showDetail && !showAlways {
    - 257 + + 466 +
    + - .PHONY: test-e2e-group-cdk-validium-1 + printEgpLogRecord(egp, false)
    - 258 + + 467 +
    - + - test-e2e-group-cdk-validium-1: stop ## Runs cdk-validium-1 e2e tests checking race conditions +   + }
    - 259 + + 468 +
    - + - $(RUNSTATEDB) +   + }
    - 260 + + 469 +
    - + - $(RUNPOOLDB) +   + }
    - 261 + + -
    - + - $(RUNEVENTDB) +
    +
    +   +
    - 262 + + -
    - + - sleep 5 +
    +
    +   +
    - 263 + + -
    - + - $(RUNZKPROVER) +
    +
    +   +
    - 264 + + -
    - + - docker ps -a +
    +
    +   +
    - 265 + + -
    - + - docker logs $(DOCKERCOMPOSEZKPROVER) +
    +
    +   +
    - 266 + + -
    - + - trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -race -v -p 1 -timeout 2000s ../ci/e2e-group-cdk-validium-1/... +
    +
    +   +
    - 267 + + -
    - + +
    +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +   +
    +
    +
    + + +
    +  
    - 268 + 470
      - .PHONY: benchmark-sequencer-eth-transfers + }
    - 269 + 471
      - benchmark-sequencer-eth-transfers: stop + }
    - 270 + 472
      - $(RUNL1NETWORK) +
    - 702 + 477
      - .PHONY: generate-mocks-synchronizer + }
    - 703 + 478
      - generate-mocks-synchronizer: ## Generates mocks for synchronizer , using mockery tool +
    - 704 + 479
      - ## mocks for synchronizer -
    -
    - 705 - -
    - + - export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=EthermanFullInterface --dir=../synchronizer/common/syncinterfaces --output=../synchronizer --outpkg=synchronizer --structname=ethermanMock --filename=mock_etherman.go ${COMMON_MOCKERY_PARAMS} -
    -
    - 706 - -
    - + - export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=StateFullInterface --dir=../synchronizer/common/syncinterfaces --output=../synchronizer --outpkg=synchronizer --structname=StateMock --filename=mock_state.go ${COMMON_MOCKERY_PARAMS} + // printEgpLogRecord prints values of egpLogRecord struct
    - 707 + 480
    + - export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=EthTxManager --dir=../synchronizer/common/syncinterfaces --output=../synchronizer --outpkg=synchronizer --structname=ethTxManagerMock --filename=mock_ethtxmanager.go ${COMMON_MOCKERY_PARAMS} + func printEgpLogRecord(record *egpLogRecord, showTxInfo bool) {
    - 708 + 481
    + - export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=PoolInterface --dir=../synchronizer/common/syncinterfaces --output=../synchronizer --outpkg=synchronizer --structname=poolMock --filename=mock_pool.go ${COMMON_MOCKERY_PARAMS} + fmt.Printf("L2BlockNum: [%d]\n", record.l2BlockNum)
    - 709 + + 482 +
    - + - export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=Factory --srcpkg=github.com/0xPolygon/cdk-data-availability/client --output=../synchronizer --outpkg=synchronizer --structname=dataCommitteeClientFactoryMock --filename=mock_datacommitteeclientfactory.go ${COMMON_MOCKERY_PARAMS} +   + fmt.Printf(" timestamp: [%v]\n", record.l2BlockReceived)
    - 710 + + -
    - + - export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=Client --srcpkg=github.com/0xPolygon/cdk-data-availability/client --output=../synchronizer --outpkg=synchronizer --structname=dataCommitteeClientMock --filename=mock_datacommitteeclient.go ${COMMON_MOCKERY_PARAMS} +
    +
    +   +
    - 711 + 483
      - for i in l1RollupProducerInterface l1RollupConsumerInterface worker synchronizerProcessBlockRangeInterface workersInterface L1ParallelEthermanInterface; do \ + fmt.Printf(" Error: [%s]\n", record.LogError)
    - 712 + 484
      - camelcase=$$(echo $$i | sed 's/\([a-z0-9]\)\([A-Z]\)/\1_\2/g' | tr '[:upper:]' '[:lower:]') ; \ + fmt.Printf(" Enabled: [%t]\n", record.LogEnabled)
    - 713 + 485
      - echo $$camelcase ; \ + fmt.Printf(" L1GasPrice: [%.0f]\n", record.LogL1GasPrice)
    - 741 + 496
      -
    + fmt.Printf(" Percentage: [%d]\n", record.LogPercentage)
    - 742 + 497
      - export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=poolInterface --dir=../gasprice --output=../gasprice --outpkg=gasprice --structname=poolMock --filename=mock_pool.go + fmt.Printf(" MaxDeviation: [%.0f]\n", record.LogMaxDeviation)
    - 743 + 498
      - export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=ethermanInterface --dir=../gasprice --output=../gasprice --outpkg=gasprice --structname=ethermanMock --filename=mock_etherman.go + fmt.Printf(" FinalDeviation: [%.0f]\n", record.LogFinalDeviation)
    - 744 + + -
    - + - +
    +
    +   +
    - 745 + + -
    - + - export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=dataAvailabilityProvider --dir=../etherman --output=../etherman --outpkg=etherman --structname=daMock --filename=mock_da.go +
    +
    +   +
    - 746 + + -
    +
    +
     
    - 747 + + -
    +
    +
      - .PHONY: generate-mocks-aggregator +
    - 748 + + -
    +
    +
      - generate-mocks-aggregator: ## Generates mocks for aggregator , using mockery tool +
    -
     
    -
    - 766 + 499
      - run-benchmarks: run-db ## Runs benchmars + if showTxInfo {
    - 767 + 500
      - go test -bench=. ./state/tree + fmt.Printf(" encoded: [%s]\n", record.encoded)
    - 768 + 501
      -
    + }
    - 769 - -
    - + - .PHONY: run-dac-db -
    +
    +
     
    - 770 + + 543 +
    - + - run-dac-db: ## Suns the DAC DB +   + fmt.Printf(" Tx fee avg...........: [%.0f] (%.3f GWei) (%.9f ETH)\n", stats.sumFee/stats.countGasFinal,
    - 771 + + 544 +
    - + - $(RUNDACDB) +   + stats.sumFee/stats.countGasFinal/GWEI_DIV, stats.sumFee/stats.countGasFinal/ETH_DIV)
    - 772 + + 545 +
    - + -
    +   + }
    - 773 + + 546 +
    + - .PHONY: stop-dac-db + if stats.countGasPreEGP > 0 {
    - 774 + + 547 +
    + - stop-dac-db: ## Stops the DAC DB + fmt.Printf(" Gas pri.avg preEGP...: [%.0f] (%.3f GWei) (%.9f ETH)\n", stats.sumGasPreEGP/stats.countGasPreEGP,
    - 775 + + 548 +
    + - $(STOPDACDB) + stats.sumGasPreEGP/stats.countGasPreEGP/GWEI_DIV, stats.sumGasPreEGP/stats.countGasPreEGP/ETH_DIV)
    - 776 + + 549 +
    + -
    + }
    - 777 + + 550 +
    + - .PHONY: run-permissionless-dac + if stats.countGasPreEGP > 0 {
    - 778 + + 551 +
    + - run-permissionless-dac: ## Runs a permissionless node that is forced to sync through DAC + fmt.Printf(" Tx fee avg preEGP....: [%.0f] (%.3f GWei) (%.9f ETH)\n", stats.sumFeePreEGP/stats.countGasPreEGP,
    - 779 + + 552 +
    + - $(RUNPERMISSIONLESSDB) + stats.sumFeePreEGP/stats.countGasPreEGP/GWEI_DIV, stats.sumFeePreEGP/stats.countGasPreEGP/ETH_DIV)
    - 780 + + 553 +
    + - sleep 1 + }
    - 781 + + 554 +
    + - $(RUNPERMISSIONLESSZKPROVER) + fmt.Printf(" Diff fee EGP-preEGP..: [%.0f] (%.3f Gwei) (%.9f ETH)\n", stats.sumFee-stats.sumFeePreEGP,
    - 782 + + 555 +
    + - $(RUNPERMISSIONLESSNODEDAC) + (stats.sumFee-stats.sumFeePreEGP)/GWEI_DIV, (stats.sumFee-stats.sumFeePreEGP)/ETH_DIV)
    - 783 + + 556 +
    + -
    + fmt.Printf(" Loss count.......: [%.0f] (%.2f%%)\n", stats.totalLossCount, stats.totalLossCount/statsCount*100) // nolint:gomnd
    - 784 + + 557 +
    + - .PHONY: stop-permissionless-dac + fmt.Printf(" Loss total.......: [%.0f] (%.3f GWei) (%.9f ETH)\n", stats.totalLoss, stats.totalLoss/GWEI_DIV, stats.totalLoss/ETH_DIV)
    - 785 + + 558 +
    - + - stop-permissionless-dac: ## Stops the permissionless node that is forced to sync through DAC +   + if stats.totalLossCount > 0 {
    - 786 + + 559 +
    + - $(STOPPERMISSIONLESSNODEDAC) + fmt.Printf(" Loss average.....: [%.0f] (%.0f GWei) (%.9f ETH)\n", stats.totalLoss/stats.totalLossCount, stats.totalLoss/stats.totalLossCount/GWEI_DIV,
    - 787 + + 560 +
    - + - $(STOPPERMISSIONLESSZKPROVER) +   + stats.totalLoss/stats.totalLossCount/ETH_DIV)
    - 788 + + 561 +
    - + - $(STOPPERMISSIONLESSDB) +   + }
    - 789 + + -
    - + +
    +
    +  
    - 790 + 562
      - .PHONY: compile-scs + }
    - 791 + 563
      - compile-scs: ## Compiles smart contracts, configuration in test/contracts/index.yaml + }
    - 792 + 564
      - go run ./scripts/cmd... compilesc --input ./contracts -
    -
    -
    +
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/test/operations/manager.go - RENAMED - -
    -
    -
    -
    - - - - - + + + + + + + + + @@ -150615,142 +344194,137 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - @@ -150773,6 +344347,56 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0


    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - -
    -
    @@ -46,6 +46,7 @@
    - 46 + 565
      - DefaultL1ZkEVMSmartContract = "0x8dAF17A20c9DBA35f005b6324F493785D239719d" + // simulateConfig simulates scenario using received config
    - 47 + 566
      - DefaultL1RollupManagerSmartContract = "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e" + func simulateConfig(egp *egpLogRecord, cfg *egpConfig) {
    - 48 + 567
      - DefaultL1PolSmartContract = "0x5FbDB2315678afecb367f032d93F642f64180aa3" + // L2 and user gas price +
    +
    + 568 + +
    + + + egp.LogL2GasPrice = egp.LogL1GasPrice * cfg.L2GasPriceSugFactor +
    +
    + 569 + +
    + + + egp.LogGasPrice = egp.LogL2GasPrice +
    +
    + + +
    +   +
    - 49 + 570
      - DefaultL1NetworkURL = "http://localhost:8545" +
    - 50 + 571
      - DefaultL1NetworkWebSocketURL = "ws://localhost:8546" + // Compute EGP
    - 51 + 572
      - DefaultL1ChainID uint64 = 1337 + var err error
    -
    @@ -263,7 +264,6 @@
    +
     
    - 263 + 602
      - if confirmationLevel == PoolConfirmationLevel { + egp.LogValueFinal = egp.LogGasPrice
    - 264 + 603
      - return nil, nil + }
    - 265 + 604
      - } + }
    - 266 + + -
    - - +
    +
    +  
    - 267 + + -
    +
    +
      - l2BlockNumbers := make([]*big.Int, 0, len(sentTxs)) +
    - 268 + 605
      - for _, tx := range sentTxs { + } else {
    - 269 + 606
      - // check transaction nonce against transaction reported L2 block number + egp.LogValueSecond = 0
    -
    @@ -662,3 +662,23 @@
    -
    - 662 + 607
      - panic(err) +
    - 663 + 608
      - } + // Final gas: price signed
    - 664 + 609
      - } + egp.LogValueFinal = egp.LogGasPrice
    + 610 + +
    +   + } +
    +
    + 611 + +
    +   +
    +
    +
    + 612 + +
    + + + // Gas price effective percentage +
    +
    + 613 + +
    + + + if egp.LogGasPrice > 0 { +
    +
    + 614 + +
    + + + egp.LogPercentage = uint64(((egp.LogValueFinal*256)+egp.LogGasPrice-1)/egp.LogGasPrice - 1) // nolint:gomnd +
    +
    @@ -150813,6 +344437,56 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0


    + 615 + +
    +   + } else { +
    +
    + 616 + +
    + + + egp.LogPercentage = 0 +
    +
    + 617 + +
    +   + } +
    +
    + 618 + +
    +   + } +
    +
    + 619 + +
    +   +
    +
    +
    @@ -150853,6 +344527,26 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0


    + 620 + +
    +   + // calcEffectiveGasPrice calculates the effective gas price +
    +
    + 621 + +
    +   + func calcEffectiveGasPrice(gasUsed float64, tx *egpLogRecord, cfg *egpConfig) (float64, error) { +
    +
    @@ -150953,123 +344647,114 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0


    -
    + + + + + +
    +   +
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - @@ -151083,123 +344768,118 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
     
    - 46 + + -
    +
    +
      - DefaultL1ZkEVMSmartContract = "0x8dAF17A20c9DBA35f005b6324F493785D239719d" +
    - 47 + 622
      - DefaultL1RollupManagerSmartContract = "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e" + // Calculate break even gas price
    - 48 + 623
      - DefaultL1PolSmartContract = "0x5FbDB2315678afecb367f032d93F642f64180aa3" + var breakEvenGasPrice float64
    - 49 + + 624 +
    + - DefaultL1DataCommitteeContract = "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE" + if gasUsed == 0 {
    - 50 + + -
    +
    +
      - DefaultL1NetworkURL = "http://localhost:8545" +
    - 51 + + -
    +
    +
      - DefaultL1NetworkWebSocketURL = "ws://localhost:8546" +
    - 52 + + -
    +
    +
      - DefaultL1ChainID uint64 = 1337 +
    -
     
    -
    - 264 + + -
    +
    +
      - if confirmationLevel == PoolConfirmationLevel { +
    - 265 + + -
    +
    +
      - return nil, nil +
    - 266 + + -
    +
    +
      - } +
    - 267 + + -
    +
    +
      - l2BlockNumbers := make([]*big.Int, 0, len(sentTxs)) +
    - 268 + + -
    +
    +
      - for _, tx := range sentTxs { +
    - 269 + + -
    +
    +
      - // check transaction nonce against transaction reported L2 block number +
    -
     
    -
    - 662 + + -
    +
    +
      - panic(err) +
    - 663 + 625
      - } + breakEvenGasPrice = tx.LogGasPrice
    - 664 + 626
      - } + } else {
    - 665 + 627
    + -
    + // Decode tx
    - 666 + 628
    + - // StartDACDB starts the data availability node DB + rawBytes, err := decodeTx(tx)
    - 667 + 629
    + - func (m *Manager) StartDACDB() error { + if err != nil {
    - 668 + 630
    + - return StartComponent("dac-db", func() (bool, error) { return true, nil }) + return 0, err
    - 669 + 631
    + - } + }
    - 670 + 632
    @@ -151209,47 +344889,37 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 671 - -
    - + - // StopDACDB stops the data availability node DB -
    -
    - 672 + 633
    + - func (m *Manager) StopDACDB() error { + // Zero and non zero bytes
    - 673 + 634
    + - return StopComponent("dac-db") + txZeroBytes := uint64(bytes.Count(rawBytes, []byte{0}))
    - 674 + 635
    + - } + txNonZeroBytes := uint64(len(rawBytes)) - txZeroBytes
    - 675 + 636
    @@ -151259,345 +344929,77 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 676 - -
    - + - // StartPermissionlessNodeForcedToSYncThroughDAC starts a permissionless node that is froced to sync through the DAC -
    -
    - 677 - -
    - + - func (m *Manager) StartPermissionlessNodeForcedToSYncThroughDAC() error { -
    -
    - 678 - -
    - + - return StartComponent("permissionless-dac", func() (bool, error) { return true, nil }) -
    -
    - 679 - -
    - + - } -
    -
    - 680 + 637
    + -
    + // Calculates break even gas price
    - 681 + + 638 +
    - + - // StopPermissionlessNodeForcedToSYncThroughDAC stops the permissionless node that is froced to sync through the DAC +   + l2MinGasPrice := tx.LogL1GasPrice * cfg.L1GasPriceFactor
    - 682 + 639
    + - func (m *Manager) StopPermissionlessNodeForcedToSYncThroughDAC() error { + if l2MinGasPrice < float64(cfg.MinGasPriceAllowed) {
    - 683 + 640
    + - return StopComponent("permissionless-dac") + l2MinGasPrice = float64(cfg.MinGasPriceAllowed)
    - 684 + 641
    + - } -
    -
    -
    -
    -
    -
    -
    -
    - - {/home/stefan/go/src/Polygon/zkevm-node → .}/test/scripts/batchsender/main.go - RENAMED - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    @@ -111,7 +111,7 @@
    -
    - 111 - -
    -   - return err -
    -
    - 112 - -
    -   - } -
    -
    - 113 - -
    -   -
    -
    -
    - 114 - -
    - - - ethMan, err := etherman.NewClient(cfg.Etherman, cfg.NetworkConfig.L1Config) -
    -
    - 115 - -
    -   - if err != nil { -
    -
    - 116 - -
    -   - return err -
    -
    - 117 - -
    -   - } -
    -
    -
    @@ -183,7 +183,7 @@
    -
    - 183 - -
    -   - // send to L1 -
    -
    - 184 - -
    -   - firstSequence := seqs[0] -
    -
    - 185 - -
    -   - lastSequence := seqs[len(seqs)-1] -
    -
    - 186 - -
    - - - to, data, err := ethMan.BuildSequenceBatchesTxData(auth.From, seqs, uint64(lastSequence.LastL2BLockTimestamp), firstSequence.BatchNumber, auth.From) -
    -
    - 187 - -
    -   - if err != nil { -
    -
    - 188 - -
    -   - return err -
    -
    - 189 - -
    -   }
    -
    -
    -
    -
    - - - - - - - - - - - - - - - - - @@ -151687,12 +345089,12 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    -
    +
    {/home/stefan/go/src/Polygon/zkevm-node → .}/tools/genesis/genesisparser/genesisparser.go + {/home/stefan/go/src/Polygon/zkevm-node → .}/tools/executor/main.go RENAMED
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -151876,7 +345158,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -151886,7 +345168,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -151896,7 +345178,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -151916,27 +345198,27 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - @@ -151946,7 +345228,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -151956,7 +345238,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -151966,7 +345248,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -151976,7 +345258,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -151986,7 +345268,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -151996,7 +345278,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -152006,7 +345288,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -152016,7 +345298,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    @@ -152026,62 +345308,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - - - - @@ -152100,377 +345327,385 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - - - - - - - - - - - - - - - + + +
    -
     
    -
    - 111 - -
    -   - return err -
    -
    - 112 - -
    -   - } -
    -
    - 113 - -
    -   -
    -
    -
    - 114 - -
    - + - ethMan, err := etherman.NewClient(cfg.Etherman, cfg.NetworkConfig.L1Config, nil) -
    -
    - 115 + 642
      - if err != nil { + totalTxPrice := gasUsed*l2MinGasPrice + float64((fixedBytesTx+txNonZeroBytes)*cfg.ByteGasCost+txZeroBytes*cfg.ZeroGasCost)*tx.LogL1GasPrice
    - 116 + 643
      - return err + breakEvenGasPrice = totalTxPrice / gasUsed * cfg.NetProfitFactor
    - 117 + 644
    @@ -151612,72 +345014,72 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    - 183 + 646
      - // send to L1 + // Calculate effective gas price
    - 184 + 647
      - firstSequence := seqs[0] + var ratioPriority float64
    - 185 + 648
      - lastSequence := seqs[len(seqs)-1] + if tx.LogGasPrice > tx.LogL2GasPrice {
    - 186 + 649
    + - to, data, err := ethMan.BuildSequenceBatchesTxData(auth.From, seqs, uint64(lastSequence.LastL2BLockTimestamp), firstSequence.BatchNumber, auth.From, nil) + ratioPriority = math.Round(tx.LogGasPrice / tx.LogL2GasPrice)
    - 187 + 650
      - if err != nil { + } else {
    - 188 + 651
      - return err + ratioPriority = 1
    - 189 + 652
      - } + }
    -
    @@ -16,32 +16,32 @@
    -
    - 16 - -
    -   -
    -
    -
    - 17 - -
    -   - // GenesisTest2Actions change format from testvector to the used internaly -
    -
    - 18 - -
    -   - func GenesisTest2Actions(accounts []GenesisAccountTest) []*state.GenesisAction { -
    -
    - 19 - -
    - - - leafs := make([]*state.GenesisAction, 0) -
    -
    - 20 - -
    -   -
    -
    -
    - 21 - -
    -   - for _, acc := range accounts { -
    -
    - 22 - -
    -   - if len(acc.Balance) != 0 && acc.Balance != "0" { -
    -
    - 23 - -
    - - - leafs = append(leafs, &state.GenesisAction{ -
    -
    - 24 - -
    -   - Address: acc.Address, -
    -
    - 25 - -
    -   - Type: int(merkletree.LeafTypeBalance), -
    -
    - 26 - -
    -   - Value: acc.Balance, -
    +
    @@ -28,20 +28,20 @@
    - 27 + 28
      - }) + func main() {
    - 28 + 29
      - } + // Start containers
    - 29 + 30
      - if len(acc.Nonce) != 0 && acc.Nonce != "0" { + defer func() {
    - 30 + 31
    - - leafs = append(leafs, &state.GenesisAction{ -
    -
    - 31 - -
    -   - Address: acc.Address, + cmd := exec.Command("docker", "compose", "down", "--remove-orphans")
      - Type: int(merkletree.LeafTypeNonce), + if err := cmd.Run(); err != nil {
      - Value: acc.Nonce, + log.Errorf("Failed stop containers: %v", err)
      - }) + return
      - if len(acc.Bytecode) != 0 { + }()
    + 37 +
    - - - leafs = append(leafs, &state.GenesisAction{ +   + log.Info("Starting DB and prover")
    + 38 +
    -   - Address: acc.Address, + - + cmd := exec.Command("docker", "compose", "up", "-d", "executor-tool-db")
      - Type: int(merkletree.LeafTypeCode), + if out, err := cmd.CombinedOutput(); err != nil {
      - Bytecode: acc.Bytecode, + log.Errorf("Failed to star DB: %w. %v", err, out)
      - }) + return
      - } + }
      - for key, value := range acc.Storage { + time.Sleep(time.Second * waitForDBSeconds)
    - - leafs = append(leafs, &state.GenesisAction{ + cmd = exec.Command("docker", "compose", "up", "-d", "executor-tool-prover")
      - Address: acc.Address, + if out, err := cmd.CombinedOutput(); err != nil {
      - Type: int(merkletree.LeafTypeStorage), + log.Errorf("Failed to star prover: %v. %v", err, out)
      - StoragePosition: key, -
    -
    -
    @@ -49,5 +49,5 @@
    -
    - 49 - -
    -   - }) -
    -
    - 50 - -
    -   - } -
    -
    - 51 - -
    -   - } -
    -
    - 52 - -
    - - - return leafs -
    -
    - 53 - -
    -   - } + return
    - 16 - -
    -   -
    -
    -
    - 17 - -
    -   - // GenesisTest2Actions change format from testvector to the used internaly -
    -
    - 18 - -
    -   - func GenesisTest2Actions(accounts []GenesisAccountTest) []*state.GenesisAction { -
    -
    - 19 - -
    - + - leaves := make([]*state.GenesisAction, 0) -
    -
    - 20 + 28
      -
    + func main() {
    - 21 + 29
      - for _, acc := range accounts { + // Start containers
    - 22 + 30
      - if len(acc.Balance) != 0 && acc.Balance != "0" { + defer func() {
    - 23 + 31
    + - leaves = append(leaves, &state.GenesisAction{ + cmd := exec.Command("docker-compose", "down", "--remove-orphans")
    - 24 + 32
      - Address: acc.Address, + if err := cmd.Run(); err != nil {
    - 25 + 33
      - Type: int(merkletree.LeafTypeBalance), + log.Errorf("Failed stop containers: %v", err)
    - 26 + 34
      - Value: acc.Balance, + return
    - 27 + 35
      - }) + }
    - 28 + 36
      - } + }()
    - 29 + 37
      - if len(acc.Nonce) != 0 && acc.Nonce != "0" { + log.Info("Starting DB and prover")
    - 30 + 38
    + - leaves = append(leaves, &state.GenesisAction{ -
    -
    - 31 - -
    -   - Address: acc.Address, + cmd := exec.Command("docker-compose", "up", "-d", "executor-tool-db")
    - 32 + 39
      - Type: int(merkletree.LeafTypeNonce), + if out, err := cmd.CombinedOutput(); err != nil {
    - 33 + 40
      - Value: acc.Nonce, + log.Errorf("Failed to star DB: %w. %v", err, out)
    - 34 + 41
      - }) + return
    - 35 + 42
      - } + }
    - 36 + 43
      - if len(acc.Bytecode) != 0 { + time.Sleep(time.Second * waitForDBSeconds)
    - 37 + 44
    + - leaves = append(leaves, &state.GenesisAction{ + cmd = exec.Command("docker-compose", "up", "-d", "executor-tool-prover")
    - 38 + 45
      - Address: acc.Address, + if out, err := cmd.CombinedOutput(); err != nil {
    - 39 + 46
      - Type: int(merkletree.LeafTypeCode), + log.Errorf("Failed to star prover: %v. %v", err, out)
    - 40 + 47
      - Bytecode: acc.Bytecode, + return
    +
    +
    +
    +
    +
    +
    + + {/home/stefan/go/src/Polygon/zkevm-node → .}/tools/rlp/main.go + RENAMED + +
    +
    +
    +
    + + + + + - - - + + +
    +
    @@ -238,7 +238,7 @@
    +
    - 41 + 238
      - }) +
    - 42 + 239
      - } + // Extract coded txs.
    - 43 + 240
      - for key, value := range acc.Storage { + // Load contract ABI
    - 44 + + 241 +
    - + - leaves = append(leaves, &state.GenesisAction{ + - + abi, err := abi.JSON(strings.NewReader(etrogpolygonzkevm.EtrogpolygonzkevmABI))
    - 45 + 242
      - Address: acc.Address, + if err != nil {
    - 46 + 243
      - Type: int(merkletree.LeafTypeStorage), + log.Fatal("error reading smart contract abi: ", err)
    - 47 + 244
      - StoragePosition: key, + }
    +
    +
    +
    +
    + + + + + + + + + @@ -152755,6 +345990,81 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    } + + + + + + + + + + + + + + + + + + + + + + + +
     
    - 49 + 238
      - }) +
    - 50 + 239
      - } + // Extract coded txs.
    - 51 + 240
      - } + // Load contract ABI
    - 52 + 241
    + - return leaves + abi, err := abi.JSON(strings.NewReader(polygonzkevm.PolygonzkevmABI))
    - 53 + 242
      - } + if err != nil { +
    +
    + 243 + +
    +   + log.Fatal("error reading smart contract abi: ", err) +
    +
    + 244 + +
    +   + }
    +
    @@ -164,7 +164,7 @@
    +
    + 164 + +
    +   + stateTree = merkletree.NewStateTree(stateDBClient) +
    +
    + 165 + +
    +   + } +
    +
    + 166 + +
    +   +
    +
    +
    + 167 + +
    + - + st := state.NewState(stateCfg, stateDb, executorClient, stateTree, eventLog, nil, nil) +
    +
    + 168 + +
    +   + return st +
    +
    + 169 + +
    +   + } +
    +
    + 170 + +
    +   +
    +
    +
    @@ -152806,7 +346116,7 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    + - etherman, err := etherman.NewClient(c.Etherman, c.NetworkConfig.L1Config, nil) + etherman, err := etherman.NewClient(c.Etherman, c.NetworkConfig.L1Config, nil, nil)
    @@ -152839,6 +346149,81 @@

    zkEVM node vs CDK validium node

    zkevm-node version: v0.6.0

    }
    + + + +
     
    + + + + 164 + + +
    +   + stateTree = merkletree.NewStateTree(stateDBClient) +
    + + + + 165 + + +
    +   + } +
    + + + + 166 + + +
    +   +
    +
    + + + + 167 + + +
    + + + st := state.NewState(stateCfg, stateDb, executorClient, stateTree, eventLog, nil) +
    + + + + 168 + + +
    +   + return st +
    + + + + 169 + + +
    +   + } +
    + + + + 170 + + +
    +   +
    +
    + diff --git a/docs/running_local.md b/docs/running_local.md index 1fd926bea8..49a4eb1a98 100644 --- a/docs/running_local.md +++ b/docs/running_local.md @@ -192,7 +192,7 @@ To configure your Metamask to use your local environment, follow these steps: | Address | Description | |---|---| | 0x8dAF17A20c9DBA35f005b6324F493785D239719d | Polygon ZKEVM | -| 0x40E0576c0A7dff9dc460B29ba73e79aBf73dD2a9 | Polygon Bridge | +| 0xFe12ABaa190Ef0c8638Ee0ba9F828BF41368Ca0E | Polygon Bridge | | 0x5FbDB2315678afecb367f032d93F642f64180aa3 | Pol token | | 0x8A791620dd6260079BF849Dc5567aDC3F2FdC318 | Polygon GlobalExitRootManager | | 0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e | Polygon RollupManager | diff --git a/etherman/etherman.go b/etherman/etherman.go index 75c50e1ddc..0d48318f3d 100644 --- a/etherman/etherman.go +++ b/etherman/etherman.go @@ -282,7 +282,7 @@ func NewClient(cfg Config, l1Config L1Config, da dataavailability.BatchDataProvi rollupID, err := rollupManager.RollupAddressToID(&bind.CallOpts{Pending: false}, l1Config.ZkEVMAddr) if err != nil { log.Debugf("error rollupManager.RollupAddressToID(%s). Error: %w", l1Config.RollupManagerAddr, err) - // TODO return error after the upgrade + return nil, err } log.Debug("rollupID: ", rollupID) @@ -1635,7 +1635,7 @@ func (etherMan *Client) forceSequencedBatchesEvent(ctx context.Context, vLog typ if err != nil { return err } - // TODO completar los datos de forcedBlockHas, forcedGer y forcedTimestamp + // TODO complete data forcedBlockHash, forcedGer y forcedTimestamp // Read the tx for this batch. tx, err := etherMan.EthClient.TransactionInBlock(ctx, vLog.BlockHash, vLog.TxIndex) @@ -1940,6 +1940,17 @@ func (etherMan *Client) EstimateGas(ctx context.Context, from common.Address, to }) } +// DepositCount returns deposits count +func (etherman *Client) DepositCount(ctx context.Context, blockNumber *uint64) (*big.Int, error) { + var opts *bind.CallOpts + if blockNumber != nil { + opts = new(bind.CallOpts) + opts.BlockNumber = new(big.Int).SetUint64(*blockNumber) + } + + return etherman.GlobalExitRootManager.DepositCount(opts) +} + // CheckTxWasMined check if a tx was already mined func (etherMan *Client) CheckTxWasMined(ctx context.Context, txHash common.Hash) (bool, *types.Receipt, error) { receipt, err := etherMan.EthClient.TransactionReceipt(ctx, txHash) diff --git a/go.mod b/go.mod index e3b99a3a5f..aae887f746 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/0xPolygonHermez/zkevm-node go 1.21 require ( - github.com/0xPolygonHermez/zkevm-data-streamer v0.1.18 + github.com/0xPolygonHermez/zkevm-data-streamer v0.2.3-0.20240422135400-0df0d27226b3 github.com/didip/tollbooth/v6 v6.1.2 github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 github.com/ethereum/go-ethereum v1.13.11 @@ -175,7 +175,6 @@ require ( github.com/0xPolygon/agglayer v0.0.1 github.com/0xPolygon/cdk-data-availability v0.0.5 github.com/fatih/color v1.16.0 - github.com/joho/godotenv v1.5.1 github.com/prometheus/client_golang v1.18.0 golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa ) diff --git a/go.sum b/go.sum index aa214a13e8..28077173da 100644 --- a/go.sum +++ b/go.sum @@ -43,8 +43,8 @@ github.com/0xPolygon/agglayer v0.0.1 h1:J6/DUo9rNUncDifquanouRCo2g7g069yvz0aFtu7 github.com/0xPolygon/agglayer v0.0.1/go.mod h1:UYp5O8THULoXVrUfzkRjVBzxHR5DxBdUN/Iq0EgxNxM= github.com/0xPolygon/cdk-data-availability v0.0.5 h1://vg1oR/5tw2XfEIorpP+wIxLfNUmoKrdmX8YZvBKX4= github.com/0xPolygon/cdk-data-availability v0.0.5/go.mod h1:aGwqHiJhL+mJbdepl3s58wsY18EuViDa9vZCpPuIYGw= -github.com/0xPolygonHermez/zkevm-data-streamer v0.1.18 h1:InqeTcHrNbfj1OUfn2aFplFay7ibd7KhYqvmMZYZfn0= -github.com/0xPolygonHermez/zkevm-data-streamer v0.1.18/go.mod h1:0QkAXcFa92mFJrCbN3UPUJGJYes851yEgYHLONnaosE= +github.com/0xPolygonHermez/zkevm-data-streamer v0.2.3-0.20240422135400-0df0d27226b3 h1:g5IMJalQxVRNfnXrzQG7bx2COktaFBf1mNuF4SLuQss= +github.com/0xPolygonHermez/zkevm-data-streamer v0.2.3-0.20240422135400-0df0d27226b3/go.mod h1:0QkAXcFa92mFJrCbN3UPUJGJYes851yEgYHLONnaosE= github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= @@ -492,8 +492,6 @@ github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/jmoiron/sqlx v1.2.0 h1:41Ip0zITnmWNR/vHV+S4m+VoUivnWY5E4OJfLZjCJMA= github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= -github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= -github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= diff --git a/jsonrpc/endpoints_eth.go b/jsonrpc/endpoints_eth.go index aadb844b22..2a3ba32b86 100644 --- a/jsonrpc/endpoints_eth.go +++ b/jsonrpc/endpoints_eth.go @@ -68,8 +68,6 @@ func (e *EthEndpoints) Call(arg *types.TxArgs, blockArg *types.BlockNumberOrHash return e.txMan.NewDbTxScope(e.state, func(ctx context.Context, dbTx pgx.Tx) (interface{}, types.Error) { if arg == nil { return RPCErrorResponse(types.InvalidParamsErrorCode, "missing value for required argument 0", nil, false) - } else if blockArg == nil { - return RPCErrorResponse(types.InvalidParamsErrorCode, "missing value for required argument 1", nil, false) } block, respErr := e.getBlockByArg(ctx, blockArg, dbTx) if respErr != nil { @@ -113,6 +111,9 @@ func (e *EthEndpoints) Call(arg *types.TxArgs, blockArg *types.BlockNumberOrHash if result.Reverted() { data := make([]byte, len(result.ReturnValue)) copy(data, result.ReturnValue) + if len(data) == 0 { + return nil, types.NewRPCError(types.DefaultErrorCode, result.Err.Error()) + } return nil, types.NewRPCErrorWithData(types.RevertedErrorCode, result.Err.Error(), data) } else if result.Failed() { return nil, types.NewRPCError(types.DefaultErrorCode, result.Err.Error()) @@ -191,6 +192,9 @@ func (e *EthEndpoints) EstimateGas(arg *types.TxArgs, blockArg *types.BlockNumbe if errors.Is(err, runtime.ErrExecutionReverted) { data := make([]byte, len(returnValue)) copy(data, returnValue) + if len(data) == 0 { + return nil, types.NewRPCError(types.DefaultErrorCode, err.Error()) + } return nil, types.NewRPCErrorWithData(types.RevertedErrorCode, err.Error(), data) } else if err != nil { return nil, types.NewRPCError(types.DefaultErrorCode, err.Error()) diff --git a/jsonrpc/endpoints_eth_test.go b/jsonrpc/endpoints_eth_test.go index ec50c6ea86..5da1d6a380 100644 --- a/jsonrpc/endpoints_eth_test.go +++ b/jsonrpc/endpoints_eth_test.go @@ -504,7 +504,7 @@ func TestCall(t *testing.T) { latest, }, expectedResult: nil, - expectedError: types.NewRPCError(types.RevertedErrorCode, "execution reverted"), + expectedError: types.NewRPCError(types.DefaultErrorCode, "execution reverted"), setupMocks: func(c Config, m *mocksWrapper, testCase *testCase) { nonce := uint64(7) m.DbTx.On("Rollback", context.Background()).Return(nil).Once() diff --git a/sequencer/addrqueue.go b/sequencer/addrqueue.go index 177521c449..9c0d8d996e 100644 --- a/sequencer/addrqueue.go +++ b/sequencer/addrqueue.go @@ -211,6 +211,10 @@ func (a *addrQueue) updateCurrentNonceBalance(nonce *uint64, balance *big.Int) ( if oldReadyTx != nil && oldReadyTx.Nonce > a.currentNonce { log.Infof("set readyTx %s as notReadyTx from addrQueue %s", oldReadyTx.HashStr, a.fromStr) a.notReadyTxs[oldReadyTx.Nonce] = oldReadyTx + } else if oldReadyTx != nil { // if oldReadyTx doesn't have a valid nonce then we add it to the txsToDelete + reason := runtime.ErrIntrinsicInvalidNonce.Error() + oldReadyTx.FailedReason = &reason + txsToDelete = append(txsToDelete, oldReadyTx) } return a.readyTx, oldReadyTx, txsToDelete diff --git a/sequencer/datastreamer.go b/sequencer/datastreamer.go index 700b8b3e02..bbbfe14496 100644 --- a/sequencer/datastreamer.go +++ b/sequencer/datastreamer.go @@ -1,6 +1,7 @@ package sequencer import ( + "github.com/0xPolygonHermez/zkevm-node/log" "github.com/0xPolygonHermez/zkevm-node/state" ) @@ -42,6 +43,7 @@ func (f *finalizer) DSSendL2Block(batchNumber uint64, blockResponse *state.Proce l2Transactions = append(l2Transactions, l2Transaction) } + log.Infof("sending l2block %d to datastream channel", blockResponse.BlockNumber) f.dataToStream <- state.DSL2FullBlock{ DSL2Block: l2Block, Txs: l2Transactions, diff --git a/sequencer/finalizer.go b/sequencer/finalizer.go index 46a0d7cb53..48ebf80d6f 100644 --- a/sequencer/finalizer.go +++ b/sequencer/finalizer.go @@ -10,6 +10,7 @@ import ( "time" "github.com/0xPolygonHermez/zkevm-data-streamer/datastreamer" + ethermanTypes "github.com/0xPolygonHermez/zkevm-node/etherman" "github.com/0xPolygonHermez/zkevm-node/event" "github.com/0xPolygonHermez/zkevm-node/hex" "github.com/0xPolygonHermez/zkevm-node/log" @@ -38,7 +39,7 @@ type finalizer struct { workerIntf workerInterface poolIntf txPool stateIntf stateInterface - etherman etherman + etherman ethermanInterface wipBatch *Batch wipL2Block *L2Block batchConstraints state.BatchConstraintsCfg @@ -87,7 +88,7 @@ func newFinalizer( workerIntf workerInterface, poolIntf txPool, stateIntf stateInterface, - etherman etherman, + etherman ethermanInterface, sequencerAddr common.Address, isSynced func(ctx context.Context) bool, batchConstraints state.BatchConstraintsCfg, @@ -220,18 +221,95 @@ func (f *finalizer) updateFlushIDs(newPendingFlushID, newStoredFlushID uint64) { f.storedFlushIDCond.L.Unlock() } -func (f *finalizer) checkL1InfoTreeUpdate(ctx context.Context) { - firstL1InfoRootUpdate := true - skipFirstSleep := true +func (f *finalizer) checkValidL1InfoRoot(ctx context.Context, l1InfoRoot state.L1InfoTreeExitRootStorageEntry) (bool, error) { + // Check L1 block hash matches + l1BlockState, err := f.stateIntf.GetBlockByNumber(ctx, l1InfoRoot.BlockNumber, nil) + if err != nil { + return false, fmt.Errorf("error getting L1 block %d from the state, error: %v", l1InfoRoot.BlockNumber, err) + } + + l1BlockEth, err := f.etherman.HeaderByNumber(ctx, new(big.Int).SetUint64(l1InfoRoot.BlockNumber)) + if err != nil { + return false, fmt.Errorf("error getting L1 block %d from ethereum, error: %v", l1InfoRoot.BlockNumber, err) + } + + if l1BlockState.BlockHash != l1BlockEth.Hash() { + warnmsg := fmt.Sprintf("invalid l1InfoRoot %s, index: %d, GER: %s, l1Block: %d. L1 block hash %s doesn't match block hash on ethereum %s (L1 reorg?)", + l1InfoRoot.L1InfoTreeRoot, l1InfoRoot.L1InfoTreeIndex, l1InfoRoot.GlobalExitRoot.GlobalExitRoot, l1InfoRoot.BlockNumber, l1BlockState.BlockHash, l1BlockEth.Hash()) + log.Warnf(warnmsg) + f.LogEvent(ctx, event.Level_Critical, event.EventID_InvalidInfoRoot, warnmsg, nil) + + return false, nil + } + + // Check l1InfoRootIndex and GER matches. We retrieve the info of the last l1InfoTree event in the block, since in the case we have several l1InfoTree events + // in the same block, the function checkL1InfoTreeUpdate retrieves only the last one and skips the others + log.Debugf("getting l1InfoRoot events for L1 block %d, hash: %s", l1InfoRoot.BlockNumber, l1BlockState.BlockHash) + blocks, eventsOrder, err := f.etherman.GetRollupInfoByBlockRange(ctx, l1InfoRoot.BlockNumber, &l1InfoRoot.BlockNumber) + if err != nil { + return false, err + } + + //Get L1InfoTree events of the L1 block where the l1InforRoot we need to check was synced + lastGER := state.ZeroHash + for _, block := range blocks { + blockEventsOrder := eventsOrder[block.BlockHash] + for _, order := range blockEventsOrder { + if order.Name == ethermanTypes.L1InfoTreeOrder { + lastGER = block.L1InfoTree[order.Pos].GlobalExitRoot + log.Debugf("l1InfoTree event, pos: %d, GER: %s", order.Pos, lastGER) + } + } + } - if f.cfg.L1InfoTreeCheckInterval.Duration.Seconds() == 999999 { //nolint:gomnd + // Get the deposit count in the moment when the L1InfoRoot was synced + depositCount, err := f.etherman.DepositCount(ctx, &l1InfoRoot.BlockNumber) + if err != nil { + return false, err + } + // l1InfoTree index starts at 0, therefore we need to subtract 1 to the depositCount to get the last index at that moment + index := uint32(depositCount.Uint64()) + if index > 0 { // we check this as protection, but depositCount should be greater that 0 in this context + index-- + } else { + warnmsg := fmt.Sprintf("invalid l1InfoRoot %s, index: %d, GER: %s, blockNum: %d. DepositCount value returned by the smartcontrat is 0 and that isn't possible in this context", + l1InfoRoot.L1InfoTreeRoot, l1InfoRoot.L1InfoTreeIndex, l1InfoRoot.GlobalExitRoot.GlobalExitRoot, l1InfoRoot.BlockNumber) + log.Warn(warnmsg) + f.LogEvent(ctx, event.Level_Critical, event.EventID_InvalidInfoRoot, warnmsg, nil) + + return false, nil + } + + log.Debugf("checking valid l1InfoRoot, index: %d, GER: %s, l1Block: %d, scIndex: %d, scGER: %s", + l1InfoRoot.BlockNumber, l1InfoRoot.L1InfoTreeIndex, l1InfoRoot.GlobalExitRoot.GlobalExitRoot, index, lastGER) + + if (l1InfoRoot.GlobalExitRoot.GlobalExitRoot != lastGER) || (l1InfoRoot.L1InfoTreeIndex != index) { + warnmsg := fmt.Sprintf("invalid l1InfoRoot %s, index: %d, GER: %s, blockNum: %d. It doesn't match with smartcontract l1InfoRoot, index: %d, GER: %s", + l1InfoRoot.L1InfoTreeRoot, l1InfoRoot.L1InfoTreeIndex, l1InfoRoot.GlobalExitRoot.GlobalExitRoot, l1InfoRoot.BlockNumber, index, lastGER) + log.Warn(warnmsg) + f.LogEvent(ctx, event.Level_Critical, event.EventID_InvalidInfoRoot, warnmsg, nil) + + return false, nil + } + + return true, nil +} + +func (f *finalizer) checkL1InfoTreeUpdate(ctx context.Context) { + broadcastL1InfoTreeValid := func() { if !f.lastL1InfoTreeValid { f.lastL1InfoTreeCond.L.Lock() f.lastL1InfoTreeValid = true f.lastL1InfoTreeCond.Broadcast() f.lastL1InfoTreeCond.L.Unlock() } + } + + firstL1InfoRootUpdate := true + skipFirstSleep := true + if f.cfg.L1InfoTreeCheckInterval.Duration.Seconds() == 0 { //nolint:gomnd + broadcastL1InfoTreeValid() return } @@ -255,7 +333,7 @@ func (f *finalizer) checkL1InfoTreeUpdate(ctx context.Context) { l1InfoRoot, err := f.stateIntf.GetLatestL1InfoRoot(ctx, maxBlockNumber) if err != nil { - log.Errorf("error checking latest L1InfoRoot, error: %v", err) + log.Errorf("error getting latest l1InfoRoot, error: %v", err) continue } @@ -265,27 +343,18 @@ func (f *finalizer) checkL1InfoTreeUpdate(ctx context.Context) { } if firstL1InfoRootUpdate || l1InfoRoot.L1InfoTreeIndex > f.lastL1InfoTree.L1InfoTreeIndex { - log.Infof("received new L1InfoRoot, l1InfoTreeIndex: %d, l1InfoTreeRoot: %s, l1Block: %d", - l1InfoRoot.L1InfoTreeIndex, l1InfoRoot.L1InfoTreeRoot, l1InfoRoot.BlockNumber) + log.Infof("received new l1InfoRoot %s, index: %d, l1Block: %d", l1InfoRoot.L1InfoTreeRoot, l1InfoRoot.L1InfoTreeIndex, l1InfoRoot.BlockNumber) - // Sanity check l1BlockState (l1InfoRoot.BlockNumber) blockhash matches blockhash on ethereum. We skip it if l1InfoRoot.BlockNumber == 0 (empty tree) - if l1InfoRoot.BlockNumber > 0 { - l1BlockState, err := f.stateIntf.GetBlockByNumber(ctx, l1InfoRoot.BlockNumber, nil) + // Check if new l1InfoRoot is valid. We skip it if l1InfoTreeIndex is 0 (it's a special case) + if l1InfoRoot.L1InfoTreeIndex > 0 { + valid, err := f.checkValidL1InfoRoot(ctx, l1InfoRoot) if err != nil { - log.Errorf("error getting L1 block %d from the state, error: %v", l1InfoRoot.BlockNumber, err) + log.Errorf("error validating new l1InfoRoot, index: %d, error: %v", l1InfoRoot.L1InfoTreeIndex, err) continue } - l1BlockEth, err := f.etherman.HeaderByNumber(ctx, new(big.Int).SetUint64(l1InfoRoot.BlockNumber)) - if err != nil { - log.Errorf("error getting L1 block %d from ethereum, error: %v", l1InfoRoot.BlockNumber, err) - continue - } - if l1BlockState.BlockHash != l1BlockEth.Hash() { - warnmsg := fmt.Sprintf("invalid l1InfoTreeIndex %d, L1 block %d blockhash %s doesn't match blockhash on ethereum %s (L1 reorg?). Stopping syncing l1IntroTreeIndex", - l1InfoRoot.L1InfoTreeIndex, l1InfoRoot.BlockNumber, l1BlockState.BlockHash, l1BlockEth.Hash()) - log.Warn(warnmsg) - f.LogEvent(ctx, event.Level_Critical, event.EventID_InvalidInfoRoot, warnmsg, nil) + if !valid { + log.Warnf("invalid l1InfoRoot %s, index: %d, l1Block: %d. Stopping syncing l1InfoTreeIndex", l1InfoRoot.L1InfoTreeRoot, l1InfoRoot.L1InfoTreeIndex, l1InfoRoot.BlockNumber) return } } @@ -296,12 +365,7 @@ func (f *finalizer) checkL1InfoTreeUpdate(ctx context.Context) { f.lastL1InfoTree = l1InfoRoot f.lastL1InfoTreeMux.Unlock() - if !f.lastL1InfoTreeValid { - f.lastL1InfoTreeCond.L.Lock() - f.lastL1InfoTreeValid = true - f.lastL1InfoTreeCond.Broadcast() - f.lastL1InfoTreeCond.L.Unlock() - } + broadcastL1InfoTreeValid() } } } diff --git a/sequencer/interfaces.go b/sequencer/interfaces.go index afe49bceb9..10c58980ac 100644 --- a/sequencer/interfaces.go +++ b/sequencer/interfaces.go @@ -5,6 +5,7 @@ import ( "math/big" "time" + ethermanTypes "github.com/0xPolygonHermez/zkevm-node/etherman" "github.com/0xPolygonHermez/zkevm-node/pool" "github.com/0xPolygonHermez/zkevm-node/state" "github.com/ethereum/go-ethereum/common" @@ -30,12 +31,14 @@ type txPool interface { GetEarliestProcessedTx(ctx context.Context) (common.Hash, error) } -// etherman contains the methods required to interact with ethereum. -type etherman interface { +// ethermanInterface contains the methods required to interact with ethereum. +type ethermanInterface interface { TrustedSequencer() (common.Address, error) GetLatestBatchNumber() (uint64, error) GetLatestBlockNumber(ctx context.Context) (uint64, error) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error) + GetRollupInfoByBlockRange(ctx context.Context, fromBlock uint64, toBlock *uint64) ([]ethermanTypes.Block, map[common.Hash][]ethermanTypes.Order, error) + DepositCount(ctx context.Context, blockNumber *uint64) (*big.Int, error) } // stateInterface gathers the methods required to interact with the state. diff --git a/sequencer/l2block.go b/sequencer/l2block.go index c674bf4a18..3b5f10ca02 100644 --- a/sequencer/l2block.go +++ b/sequencer/l2block.go @@ -413,6 +413,9 @@ func (f *finalizer) storeL2Block(ctx context.Context, l2Block *L2Block) error { return err } + //TODO: remove this log + log.Infof("l2 block %d [%d] stored in statedb", blockResponse.BlockNumber, l2Block.trackingNum) + // Update txs status in the pool for _, txResponse := range blockResponse.TransactionResponses { // Change Tx status to selected @@ -422,6 +425,9 @@ func (f *finalizer) storeL2Block(ctx context.Context, l2Block *L2Block) error { } } + //TODO: remove this log + log.Infof("l2 block %d [%d] transactions updated as selected in the pooldb", blockResponse.BlockNumber, l2Block.trackingNum) + // Send L2 block to data streamer err = f.DSSendL2Block(f.wipBatch.batchNumber, blockResponse, l2Block.getL1InfoTreeIndex()) if err != nil { @@ -429,6 +435,9 @@ func (f *finalizer) storeL2Block(ctx context.Context, l2Block *L2Block) error { log.Errorf("error sending L2 block %d [%d] to data streamer, error: %v", blockResponse.BlockNumber, l2Block.trackingNum, err) } + //TODO: remove this log + log.Infof("l2 block %d [%d] sent to datastream", blockResponse.BlockNumber, l2Block.trackingNum) + for _, tx := range l2Block.transactions { // Delete the tx from the pending list in the worker (addrQueue) f.workerIntf.DeletePendingTxToStore(tx.Hash, tx.From) diff --git a/sequencer/mock_etherman.go b/sequencer/mock_etherman.go index 3169ca6f3f..f51eb11d09 100644 --- a/sequencer/mock_etherman.go +++ b/sequencer/mock_etherman.go @@ -8,16 +8,48 @@ import ( common "github.com/ethereum/go-ethereum/common" + etherman "github.com/0xPolygonHermez/zkevm-node/etherman" + mock "github.com/stretchr/testify/mock" types "github.com/ethereum/go-ethereum/core/types" ) -// EthermanMock is an autogenerated mock type for the etherman type +// EthermanMock is an autogenerated mock type for the ethermanInterface type type EthermanMock struct { mock.Mock } +// DepositCount provides a mock function with given fields: ctx, blockNumber +func (_m *EthermanMock) DepositCount(ctx context.Context, blockNumber *uint64) (*big.Int, error) { + ret := _m.Called(ctx, blockNumber) + + if len(ret) == 0 { + panic("no return value specified for DepositCount") + } + + var r0 *big.Int + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *uint64) (*big.Int, error)); ok { + return rf(ctx, blockNumber) + } + if rf, ok := ret.Get(0).(func(context.Context, *uint64) *big.Int); ok { + r0 = rf(ctx, blockNumber) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*big.Int) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *uint64) error); ok { + r1 = rf(ctx, blockNumber) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // GetLatestBatchNumber provides a mock function with given fields: func (_m *EthermanMock) GetLatestBatchNumber() (uint64, error) { ret := _m.Called() @@ -74,6 +106,45 @@ func (_m *EthermanMock) GetLatestBlockNumber(ctx context.Context) (uint64, error return r0, r1 } +// GetRollupInfoByBlockRange provides a mock function with given fields: ctx, fromBlock, toBlock +func (_m *EthermanMock) GetRollupInfoByBlockRange(ctx context.Context, fromBlock uint64, toBlock *uint64) ([]etherman.Block, map[common.Hash][]etherman.Order, error) { + ret := _m.Called(ctx, fromBlock, toBlock) + + if len(ret) == 0 { + panic("no return value specified for GetRollupInfoByBlockRange") + } + + var r0 []etherman.Block + var r1 map[common.Hash][]etherman.Order + var r2 error + if rf, ok := ret.Get(0).(func(context.Context, uint64, *uint64) ([]etherman.Block, map[common.Hash][]etherman.Order, error)); ok { + return rf(ctx, fromBlock, toBlock) + } + if rf, ok := ret.Get(0).(func(context.Context, uint64, *uint64) []etherman.Block); ok { + r0 = rf(ctx, fromBlock, toBlock) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]etherman.Block) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, uint64, *uint64) map[common.Hash][]etherman.Order); ok { + r1 = rf(ctx, fromBlock, toBlock) + } else { + if ret.Get(1) != nil { + r1 = ret.Get(1).(map[common.Hash][]etherman.Order) + } + } + + if rf, ok := ret.Get(2).(func(context.Context, uint64, *uint64) error); ok { + r2 = rf(ctx, fromBlock, toBlock) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + // HeaderByNumber provides a mock function with given fields: ctx, number func (_m *EthermanMock) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error) { ret := _m.Called(ctx, number) diff --git a/sequencer/sequencer.go b/sequencer/sequencer.go index e98c367fc1..22201776ce 100644 --- a/sequencer/sequencer.go +++ b/sequencer/sequencer.go @@ -27,7 +27,7 @@ type Sequencer struct { pool txPool stateIntf stateInterface eventLog *event.EventLog - etherman etherman + etherman ethermanInterface worker *Worker finalizer *finalizer @@ -42,7 +42,7 @@ type Sequencer struct { } // New init sequencer -func New(cfg Config, batchCfg state.BatchConfig, poolCfg pool.Config, txPool txPool, stateIntf stateInterface, etherman etherman, eventLog *event.EventLog) (*Sequencer, error) { +func New(cfg Config, batchCfg state.BatchConfig, poolCfg pool.Config, txPool txPool, stateIntf stateInterface, etherman ethermanInterface, eventLog *event.EventLog) (*Sequencer, error) { addr, err := etherman.TrustedSequencer() if err != nil { return nil, fmt.Errorf("failed to get trusted sequencer address, error: %v", err) @@ -256,6 +256,8 @@ func (s *Sequencer) sendDataToStreamer(chainID uint64) { case state.DSL2FullBlock: l2Block := data + //TODO: remove this log + log.Infof("start atomic op for l2block %d", l2Block.L2BlockNumber) err = s.streamServer.StartAtomicOp() if err != nil { log.Errorf("failed to start atomic op for l2block %d, error: %v ", l2Block.L2BlockNumber, err) @@ -267,6 +269,8 @@ func (s *Sequencer) sendDataToStreamer(chainID uint64) { Value: l2Block.L2BlockNumber, } + //TODO: remove this log + log.Infof("add stream bookmark for l2block %d", l2Block.L2BlockNumber) _, err = s.streamServer.AddStreamBookmark(bookMark.Encode()) if err != nil { log.Errorf("failed to add stream bookmark for l2block %d, error: %v", l2Block.L2BlockNumber, err) @@ -281,6 +285,8 @@ func (s *Sequencer) sendDataToStreamer(chainID uint64) { Value: l2Block.L2BlockNumber - 1, } + //TODO: remove this log + log.Infof("get previous l2block %d", l2Block.L2BlockNumber-1) previousL2BlockEntry, err := s.streamServer.GetFirstEventAfterBookmark(bookMark.Encode()) if err != nil { log.Errorf("failed to get previous l2block %d, error: %v", l2Block.L2BlockNumber-1, err) @@ -303,12 +309,16 @@ func (s *Sequencer) sendDataToStreamer(chainID uint64) { ChainID: uint32(chainID), } + //TODO: remove this log + log.Infof("add l2blockStart stream entry for l2block %d", l2Block.L2BlockNumber) _, err = s.streamServer.AddStreamEntry(state.EntryTypeL2BlockStart, blockStart.Encode()) if err != nil { log.Errorf("failed to add stream entry for l2block %d, error: %v", l2Block.L2BlockNumber, err) continue } + //TODO: remove this log + log.Infof("adding l2tx stream entries for l2block %d", l2Block.L2BlockNumber) for _, l2Transaction := range l2Block.Txs { _, err = s.streamServer.AddStreamEntry(state.EntryTypeL2Tx, l2Transaction.Encode()) if err != nil { @@ -323,18 +333,25 @@ func (s *Sequencer) sendDataToStreamer(chainID uint64) { StateRoot: l2Block.StateRoot, } + //TODO: remove this log + log.Infof("add l2blockEnd stream entry for l2block %d", l2Block.L2BlockNumber) _, err = s.streamServer.AddStreamEntry(state.EntryTypeL2BlockEnd, blockEnd.Encode()) if err != nil { log.Errorf("failed to add stream entry for l2block %d, error: %v", l2Block.L2BlockNumber, err) continue } + //TODO: remove this log + log.Infof("commit atomic op for l2block %d", l2Block.L2BlockNumber) err = s.streamServer.CommitAtomicOp() if err != nil { log.Errorf("failed to commit atomic op for l2block %d, error: %v ", l2Block.L2BlockNumber, err) continue } + //TODO: remove this log + log.Infof("l2block %d sent to datastream", l2Block.L2BlockNumber) + // Stream a bookmark case state.DSBookMark: bookmark := data diff --git a/sequencer/worker.go b/sequencer/worker.go index a99f956fed..0d0b378872 100644 --- a/sequencer/worker.go +++ b/sequencer/worker.go @@ -23,6 +23,7 @@ type Worker struct { state stateInterface batchConstraints state.BatchConstraintsCfg readyTxsCond *timeoutCond + wipTx *TxTracker } // NewWorker creates an init a worker @@ -60,6 +61,12 @@ func (w *Worker) AddTxTracker(ctx context.Context, tx *TxTracker) (replacedTx *T return nil, pool.ErrOutOfCounters } + if (w.wipTx != nil) && (w.wipTx.FromStr == tx.FromStr) && (w.wipTx.Nonce == tx.Nonce) { + log.Infof("adding tx %s (nonce %d) from address %s that matches current processing tx %s (nonce %d), rejecting it as duplicated nonce", tx.Hash, tx.Nonce, tx.From, w.wipTx.Hash, w.wipTx.Nonce) + w.workerMutex.Unlock() + return nil, ErrDuplicatedNonce + } + addr, found := w.pool[tx.FromStr] if !found { // Unlock the worker to let execute other worker functions while creating the new AddrQueue @@ -174,6 +181,8 @@ func (w *Worker) MoveTxToNotReady(txHash common.Hash, from common.Address, actua defer w.workerMutex.Unlock() log.Debugf("move tx %s to notReady (from: %s, actualNonce: %d, actualBalance: %s)", txHash.String(), from.String(), actualNonce, actualBalance.String()) + w.resetWipTx(txHash) + addrQueue, found := w.pool[from.String()] if found { // Sanity check. The txHash must be the readyTx @@ -195,6 +204,8 @@ func (w *Worker) DeleteTx(txHash common.Hash, addr common.Address) { w.workerMutex.Lock() defer w.workerMutex.Unlock() + w.resetWipTx(txHash) + addrQueue, found := w.pool[addr.String()] if found { deletedReadyTx := addrQueue.deleteTx(txHash) @@ -293,6 +304,8 @@ func (w *Worker) GetBestFittingTx(resources state.BatchResources) (*TxTracker, e w.workerMutex.Lock() defer w.workerMutex.Unlock() + w.wipTx = nil + if w.txSortedList.len() == 0 { return nil, ErrTransactionsListEmpty } @@ -342,6 +355,7 @@ func (w *Worker) GetBestFittingTx(resources state.BatchResources) (*TxTracker, e if foundAt != -1 { log.Debugf("best fitting tx %s found at index %d with gasPrice %d", tx.HashStr, foundAt, tx.GasPrice) + w.wipTx = tx return tx, nil } else { return nil, ErrNoFittingTransaction @@ -382,3 +396,9 @@ func (w *Worker) addTxToSortedList(readyTx *TxTracker) { w.readyTxsCond.L.Unlock() } } + +func (w *Worker) resetWipTx(txHash common.Hash) { + if (w.wipTx != nil) && (w.wipTx.Hash == txHash) { + w.wipTx = nil + } +} diff --git a/state/interfaces.go b/state/interfaces.go index 1524553240..cc3c96d8fd 100644 --- a/state/interfaces.go +++ b/state/interfaces.go @@ -25,6 +25,7 @@ type storage interface { GetLastBlock(ctx context.Context, dbTx pgx.Tx) (*Block, error) GetPreviousBlock(ctx context.Context, offset uint64, dbTx pgx.Tx) (*Block, error) GetFirstUncheckedBlock(ctx context.Context, fromBlockNumber uint64, dbTx pgx.Tx) (*Block, error) + GetUncheckedBlocks(ctx context.Context, fromBlockNumber uint64, toBlockNumber uint64, dbTx pgx.Tx) ([]*Block, error) UpdateCheckedBlockByNumber(ctx context.Context, blockNumber uint64, newCheckedStatus bool, dbTx pgx.Tx) error AddGlobalExitRoot(ctx context.Context, exitRoot *GlobalExitRoot, dbTx pgx.Tx) error GetLatestGlobalExitRoot(ctx context.Context, maxBlockNumber uint64, dbTx pgx.Tx) (GlobalExitRoot, time.Time, error) @@ -164,4 +165,5 @@ type storage interface { UpdateBatchAsChecked(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error GetNotCheckedBatches(ctx context.Context, dbTx pgx.Tx) ([]*Batch, error) GetLastL2BlockByBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*L2Block, error) + GetPreviousBlockToBlockNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*Block, error) } diff --git a/state/l1infotree.go b/state/l1infotree.go index 8cac9ea5d7..8c081f880c 100644 --- a/state/l1infotree.go +++ b/state/l1infotree.go @@ -3,6 +3,7 @@ package state import ( "context" "errors" + "fmt" "github.com/0xPolygonHermez/zkevm-node/l1infotree" "github.com/0xPolygonHermez/zkevm-node/log" @@ -54,6 +55,14 @@ func (s *State) buildL1InfoTreeCacheIfNeed(ctx context.Context, dbTx pgx.Tx) err // AddL1InfoTreeLeaf adds a new leaf to the L1InfoTree and returns the entry and error func (s *State) AddL1InfoTreeLeaf(ctx context.Context, l1InfoTreeLeaf *L1InfoTreeLeaf, dbTx pgx.Tx) (*L1InfoTreeExitRootStorageEntry, error) { + var stateTx *StateTx + if dbTx != nil { + var ok bool + stateTx, ok = dbTx.(*StateTx) + if !ok { + return nil, fmt.Errorf("error casting dbTx to stateTx") + } + } var newIndex uint32 gerIndex, err := s.GetLatestIndex(ctx, dbTx) if err != nil && !errors.Is(err, ErrNotFound) { @@ -73,6 +82,9 @@ func (s *State) AddL1InfoTreeLeaf(ctx context.Context, l1InfoTreeLeaf *L1InfoTre log.Error("error add new leaf to the L1InfoTree. Error: ", err) return nil, err } + if stateTx != nil { + stateTx.SetL1InfoTreeModified() + } entry := L1InfoTreeExitRootStorageEntry{ L1InfoTreeLeaf: *l1InfoTreeLeaf, L1InfoTreeRoot: root, diff --git a/state/mocks/mock_storage.go b/state/mocks/mock_storage.go index 24b5f7abef..696294d465 100644 --- a/state/mocks/mock_storage.go +++ b/state/mocks/mock_storage.go @@ -5729,6 +5729,66 @@ func (_c *StorageMock_GetPreviousBlock_Call) RunAndReturn(run func(context.Conte return _c } +// GetPreviousBlockToBlockNumber provides a mock function with given fields: ctx, blockNumber, dbTx +func (_m *StorageMock) GetPreviousBlockToBlockNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*state.Block, error) { + ret := _m.Called(ctx, blockNumber, dbTx) + + if len(ret) == 0 { + panic("no return value specified for GetPreviousBlockToBlockNumber") + } + + var r0 *state.Block + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, uint64, pgx.Tx) (*state.Block, error)); ok { + return rf(ctx, blockNumber, dbTx) + } + if rf, ok := ret.Get(0).(func(context.Context, uint64, pgx.Tx) *state.Block); ok { + r0 = rf(ctx, blockNumber, dbTx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*state.Block) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, uint64, pgx.Tx) error); ok { + r1 = rf(ctx, blockNumber, dbTx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// StorageMock_GetPreviousBlockToBlockNumber_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPreviousBlockToBlockNumber' +type StorageMock_GetPreviousBlockToBlockNumber_Call struct { + *mock.Call +} + +// GetPreviousBlockToBlockNumber is a helper method to define mock.On call +// - ctx context.Context +// - blockNumber uint64 +// - dbTx pgx.Tx +func (_e *StorageMock_Expecter) GetPreviousBlockToBlockNumber(ctx interface{}, blockNumber interface{}, dbTx interface{}) *StorageMock_GetPreviousBlockToBlockNumber_Call { + return &StorageMock_GetPreviousBlockToBlockNumber_Call{Call: _e.mock.On("GetPreviousBlockToBlockNumber", ctx, blockNumber, dbTx)} +} + +func (_c *StorageMock_GetPreviousBlockToBlockNumber_Call) Run(run func(ctx context.Context, blockNumber uint64, dbTx pgx.Tx)) *StorageMock_GetPreviousBlockToBlockNumber_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint64), args[2].(pgx.Tx)) + }) + return _c +} + +func (_c *StorageMock_GetPreviousBlockToBlockNumber_Call) Return(_a0 *state.Block, _a1 error) *StorageMock_GetPreviousBlockToBlockNumber_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *StorageMock_GetPreviousBlockToBlockNumber_Call) RunAndReturn(run func(context.Context, uint64, pgx.Tx) (*state.Block, error)) *StorageMock_GetPreviousBlockToBlockNumber_Call { + _c.Call.Return(run) + return _c +} + // GetProcessingContext provides a mock function with given fields: ctx, batchNumber, dbTx func (_m *StorageMock) GetProcessingContext(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.ProcessingContext, error) { ret := _m.Called(ctx, batchNumber, dbTx) @@ -7012,6 +7072,67 @@ func (_c *StorageMock_GetTxsOlderThanNL1BlocksUntilTxHash_Call) RunAndReturn(run return _c } +// GetUncheckedBlocks provides a mock function with given fields: ctx, fromBlockNumber, toBlockNumber, dbTx +func (_m *StorageMock) GetUncheckedBlocks(ctx context.Context, fromBlockNumber uint64, toBlockNumber uint64, dbTx pgx.Tx) ([]*state.Block, error) { + ret := _m.Called(ctx, fromBlockNumber, toBlockNumber, dbTx) + + if len(ret) == 0 { + panic("no return value specified for GetUncheckedBlocks") + } + + var r0 []*state.Block + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, uint64, uint64, pgx.Tx) ([]*state.Block, error)); ok { + return rf(ctx, fromBlockNumber, toBlockNumber, dbTx) + } + if rf, ok := ret.Get(0).(func(context.Context, uint64, uint64, pgx.Tx) []*state.Block); ok { + r0 = rf(ctx, fromBlockNumber, toBlockNumber, dbTx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*state.Block) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, uint64, uint64, pgx.Tx) error); ok { + r1 = rf(ctx, fromBlockNumber, toBlockNumber, dbTx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// StorageMock_GetUncheckedBlocks_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUncheckedBlocks' +type StorageMock_GetUncheckedBlocks_Call struct { + *mock.Call +} + +// GetUncheckedBlocks is a helper method to define mock.On call +// - ctx context.Context +// - fromBlockNumber uint64 +// - toBlockNumber uint64 +// - dbTx pgx.Tx +func (_e *StorageMock_Expecter) GetUncheckedBlocks(ctx interface{}, fromBlockNumber interface{}, toBlockNumber interface{}, dbTx interface{}) *StorageMock_GetUncheckedBlocks_Call { + return &StorageMock_GetUncheckedBlocks_Call{Call: _e.mock.On("GetUncheckedBlocks", ctx, fromBlockNumber, toBlockNumber, dbTx)} +} + +func (_c *StorageMock_GetUncheckedBlocks_Call) Run(run func(ctx context.Context, fromBlockNumber uint64, toBlockNumber uint64, dbTx pgx.Tx)) *StorageMock_GetUncheckedBlocks_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint64), args[2].(uint64), args[3].(pgx.Tx)) + }) + return _c +} + +func (_c *StorageMock_GetUncheckedBlocks_Call) Return(_a0 []*state.Block, _a1 error) *StorageMock_GetUncheckedBlocks_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *StorageMock_GetUncheckedBlocks_Call) RunAndReturn(run func(context.Context, uint64, uint64, pgx.Tx) ([]*state.Block, error)) *StorageMock_GetUncheckedBlocks_Call { + _c.Call.Return(run) + return _c +} + // GetVerifiedBatch provides a mock function with given fields: ctx, batchNumber, dbTx func (_m *StorageMock) GetVerifiedBatch(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.VerifiedBatch, error) { ret := _m.Called(ctx, batchNumber, dbTx) diff --git a/state/pgstatestorage/block.go b/state/pgstatestorage/block.go index 768b384df1..7c657a6e3b 100644 --- a/state/pgstatestorage/block.go +++ b/state/pgstatestorage/block.go @@ -63,6 +63,35 @@ func (p *PostgresStorage) GetFirstUncheckedBlock(ctx context.Context, fromBlockN return &block, err } +func (p *PostgresStorage) GetUncheckedBlocks(ctx context.Context, fromBlockNumber uint64, toBlockNumber uint64, dbTx pgx.Tx) ([]*state.Block, error) { + const getUncheckedBlocksSQL = "SELECT block_num, block_hash, parent_hash, received_at, checked FROM state.block WHERE block_num>=$1 AND block_num<=$2 AND checked=false ORDER BY block_num" + + q := p.getExecQuerier(dbTx) + + rows, err := q.Query(ctx, getUncheckedBlocksSQL, fromBlockNumber, toBlockNumber) + if err != nil { + return nil, err + } + defer rows.Close() + + var blocks []*state.Block + for rows.Next() { + var ( + blockHash string + parentHash string + block state.Block + ) + err := rows.Scan(&block.BlockNumber, &blockHash, &parentHash, &block.ReceivedAt, &block.Checked) + if err != nil { + return nil, err + } + block.BlockHash = common.HexToHash(blockHash) + block.ParentHash = common.HexToHash(parentHash) + blocks = append(blocks, &block) + } + return blocks, nil +} + // GetPreviousBlock gets the offset previous L1 block respect to latest. func (p *PostgresStorage) GetPreviousBlock(ctx context.Context, offset uint64, dbTx pgx.Tx) (*state.Block, error) { var ( @@ -83,6 +112,26 @@ func (p *PostgresStorage) GetPreviousBlock(ctx context.Context, offset uint64, d return &block, err } +// GetPreviousBlockToBlockNumber gets the previous L1 block respect blockNumber. +func (p *PostgresStorage) GetPreviousBlockToBlockNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*state.Block, error) { + var ( + blockHash string + parentHash string + block state.Block + ) + const getPreviousBlockSQL = "SELECT block_num, block_hash, parent_hash, received_at,checked FROM state.block WHERE block_num < $1 ORDER BY block_num DESC LIMIT 1 " + + q := p.getExecQuerier(dbTx) + + err := q.QueryRow(ctx, getPreviousBlockSQL, blockNumber).Scan(&block.BlockNumber, &blockHash, &parentHash, &block.ReceivedAt, &block.Checked) + if errors.Is(err, pgx.ErrNoRows) { + return nil, state.ErrNotFound + } + block.BlockHash = common.HexToHash(blockHash) + block.ParentHash = common.HexToHash(parentHash) + return &block, err +} + // GetBlockByNumber returns the L1 block with the given number. func (p *PostgresStorage) GetBlockByNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*state.Block, error) { var ( diff --git a/state/pgstatestorage/l1infotree.go b/state/pgstatestorage/l1infotree.go index ed3fe2dd38..83c869cf5a 100644 --- a/state/pgstatestorage/l1infotree.go +++ b/state/pgstatestorage/l1infotree.go @@ -53,7 +53,7 @@ func (p *PostgresStorage) GetLatestL1InfoRoot(ctx context.Context, maxBlockNumbe const getL1InfoRootSQL = `SELECT block_num, timestamp, mainnet_exit_root, rollup_exit_root, global_exit_root, prev_block_hash, l1_info_root, l1_info_tree_index FROM state.exit_root WHERE l1_info_tree_index IS NOT NULL AND block_num <= $1 - ORDER BY l1_info_tree_index DESC` + ORDER BY l1_info_tree_index DESC LIMIT 1` entry := state.L1InfoTreeExitRootStorageEntry{} diff --git a/state/pgstatestorage/pgstatestorage_test.go b/state/pgstatestorage/pgstatestorage_test.go index 7502dae736..47fdf1c7c7 100644 --- a/state/pgstatestorage/pgstatestorage_test.go +++ b/state/pgstatestorage/pgstatestorage_test.go @@ -1795,3 +1795,24 @@ func TestUpdateCheckedBlockByNumber(t *testing.T) { require.NoError(t, err) require.False(t, b1.Checked) } + +func TestGetUncheckedBlocks(t *testing.T) { + var err error + blockNumber := uint64(61001) + err = testState.AddBlock(context.Background(), &state.Block{BlockNumber: blockNumber, Checked: true}, nil) + require.NoError(t, err) + err = testState.AddBlock(context.Background(), &state.Block{BlockNumber: blockNumber + 1, Checked: false}, nil) + require.NoError(t, err) + err = testState.AddBlock(context.Background(), &state.Block{BlockNumber: blockNumber + 2, Checked: true}, nil) + require.NoError(t, err) + err = testState.AddBlock(context.Background(), &state.Block{BlockNumber: blockNumber + 3, Checked: false}, nil) + require.NoError(t, err) + err = testState.AddBlock(context.Background(), &state.Block{BlockNumber: blockNumber + 4, Checked: false}, nil) + require.NoError(t, err) + + blocks, err := testState.GetUncheckedBlocks(context.Background(), blockNumber, blockNumber+3, nil) + require.NoError(t, err) + require.Equal(t, 2, len(blocks)) + require.Equal(t, uint64(blockNumber+1), blocks[0].BlockNumber) + require.Equal(t, uint64(blockNumber+3), blocks[1].BlockNumber) +} diff --git a/state/reset.go b/state/reset.go index 655f5f3dd1..e1c5a72675 100644 --- a/state/reset.go +++ b/state/reset.go @@ -18,10 +18,15 @@ func (s *State) Reset(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) erro log.Error("error resetting L1BlockNumber. Error: ", err) return err } + s.ResetL1InfoTree() + return nil +} + +// ResetL1InfoTree resets the L1InfoTree +func (s *State) ResetL1InfoTree() { // Discard L1InfoTree cache // We can't rebuild cache, because we are inside a transaction, so we dont known // is going to be a commit or a rollback. So is going to be rebuild on the next // request that needs it. s.l1InfoTree = nil - return nil } diff --git a/state/state.go b/state/state.go index a1a754242f..4c662035f8 100644 --- a/state/state.go +++ b/state/state.go @@ -62,13 +62,37 @@ func NewState(cfg Config, storage storage, executorClient executor.ExecutorServi return state } +// StateTx is the state transaction that extends the database tx +type StateTx struct { + pgx.Tx + stateInstance *State + L1InfoTreeModified bool +} + // BeginStateTransaction starts a state transaction func (s *State) BeginStateTransaction(ctx context.Context) (pgx.Tx, error) { tx, err := s.Begin(ctx) if err != nil { return nil, err } - return tx, nil + res := &StateTx{ + Tx: tx, + stateInstance: s, + } + return res, nil +} + +// Rollback do the dbTx rollback + modifications in cache mechanism +func (tx *StateTx) Rollback(ctx context.Context) error { + if tx.L1InfoTreeModified { + tx.stateInstance.ResetL1InfoTree() + } + return tx.Tx.Rollback(ctx) +} + +// SetL1InfoTreeModified sets the flag to true to save that the L1InfoTree has been modified +func (tx *StateTx) SetL1InfoTreeModified() { + tx.L1InfoTreeModified = true } // GetBalance from a given address diff --git a/state/transaction.go b/state/transaction.go index faa063731d..f3045ebe40 100644 --- a/state/transaction.go +++ b/state/transaction.go @@ -141,7 +141,7 @@ func (s *State) StoreTransactions(ctx context.Context, batchNumber uint64, proce } // firstTxToInsert := len(existingTxs) - + txIndex := 0 for i := 0; i < len(processedTxs); i++ { processedTx := processedTxs[i] // if the transaction has an intrinsic invalid tx error it means @@ -169,7 +169,7 @@ func (s *State) StoreTransactions(ctx context.Context, batchNumber uint64, proce header.BlockInfoRoot = processedBlock.BlockInfoRoot transactions := []*types.Transaction{&processedTx.Tx} - receipt := GenerateReceipt(header.Number, processedTx, uint(i), forkID) + receipt := GenerateReceipt(header.Number, processedTx, uint(txIndex), forkID) if !CheckLogOrder(receipt.Logs) { return fmt.Errorf("error: logs received from executor are not in order") } @@ -193,6 +193,7 @@ func (s *State) StoreTransactions(ctx context.Context, batchNumber uint64, proce if err := s.AddL2Block(ctx, batchNumber, l2Block, receipts, txsL2Hash, storeTxsEGPData, imStateRoots, dbTx); err != nil { return err } + txIndex++ } } return nil diff --git a/synchronizer/actions/check_l2block.go b/synchronizer/actions/check_l2block.go index 14c9e5cb19..4a864e3a2f 100644 --- a/synchronizer/actions/check_l2block.go +++ b/synchronizer/actions/check_l2block.go @@ -36,13 +36,16 @@ type CheckL2BlockHash struct { func NewCheckL2BlockHash(state stateGetL2Block, trustedClient trustedRPCGetL2Block, initialL2BlockNumber uint64, - modulusBlockNumber uint64) *CheckL2BlockHash { + modulusBlockNumber uint64) (*CheckL2BlockHash, error) { + if modulusBlockNumber == 0 { + return nil, fmt.Errorf("error: modulusBlockNumber is zero") + } return &CheckL2BlockHash{ state: state, trustedClient: trustedClient, lastL2BlockChecked: initialL2BlockNumber, modulusL2BlockToCheck: modulusBlockNumber, - } + }, nil } // CheckL2Block checks the L2Block hash between the local and the trusted @@ -74,6 +77,9 @@ func (p *CheckL2BlockHash) GetNextL2BlockToCheck(lastLocalL2BlockNumber, minL2Bl log.Infof("checkL2block: skip check L2block (next to check: %d) currently LastL2BlockNumber: %d", minL2BlockNumberToCheck, lastLocalL2BlockNumber) return false, 0 } + if l2BlockNumber%p.modulusL2BlockToCheck != 0 { + return false, 0 + } return true, l2BlockNumber } @@ -95,7 +101,7 @@ func (p *CheckL2BlockHash) GetL2Blocks(ctx context.Context, blockNumber uint64, trustedL2Block, err := p.trustedClient.BlockByNumber(ctx, big.NewInt(int64(blockNumber))) if err != nil { log.Errorf("checkL2block: Error getting L2Block %d from the Trusted RPC. err:%s", blockNumber, err.Error()) - return nil, nil, err + return nil, nil, nil } return localL2Block, trustedL2Block, nil } diff --git a/synchronizer/actions/check_l2block_test.go b/synchronizer/actions/check_l2block_test.go index 28a8a503b7..cdbf61a981 100644 --- a/synchronizer/actions/check_l2block_test.go +++ b/synchronizer/actions/check_l2block_test.go @@ -32,12 +32,15 @@ func TestCheckL2BlockHash_GetMinimumL2BlockToCheck(t *testing.T) { {1, 10, 10}, {9, 10, 10}, {10, 10, 20}, - {0, 0, 1}, - {1, 0, 2}, + {0, 1, 1}, + {1, 1, 2}, } + _, err := actions.NewCheckL2BlockHash(nil, nil, 1, 0) + require.Error(t, err) for _, data := range values { // Call the GetNextL2BlockToCheck method - checkL2Block := actions.NewCheckL2BlockHash(nil, nil, data.initial, data.modulus) + checkL2Block, err := actions.NewCheckL2BlockHash(nil, nil, data.initial, data.modulus) + require.NoError(t, err) nextL2Block := checkL2Block.GetMinimumL2BlockToCheck() // Assert the expected result @@ -58,7 +61,9 @@ func newCheckL2BlocksTestData(t *testing.T, initialL2Block, modulus uint64) Chec mockState: mock_syncinterfaces.NewStateFullInterface(t), zKEVMClient: mock_syncinterfaces.NewZKEVMClientEthereumCompatibleInterface(t), } - res.sut = actions.NewCheckL2BlockHash(res.mockState, res.zKEVMClient, initialL2Block, modulus) + var err error + res.sut, err = actions.NewCheckL2BlockHash(res.mockState, res.zKEVMClient, initialL2Block, modulus) + require.NoError(t, err) return res } func TestCheckL2BlockHash_GetNextL2BlockToCheck(t *testing.T) { @@ -77,7 +82,8 @@ func TestCheckL2BlockHash_GetNextL2BlockToCheck(t *testing.T) { } for _, data := range values { - checkL2Block := actions.NewCheckL2BlockHash(nil, nil, 0, 0) + checkL2Block, err := actions.NewCheckL2BlockHash(nil, nil, 0, 1) + require.NoError(t, err) shouldCheck, nextL2Block := checkL2Block.GetNextL2BlockToCheck(data.lastLocalL2BlockNumber, data.minL2BlockNumberToCheck) assert.Equal(t, data.expectedShouldCheck, shouldCheck, data) @@ -86,7 +92,7 @@ func TestCheckL2BlockHash_GetNextL2BlockToCheck(t *testing.T) { } func TestCheckL2BlockHashMatch(t *testing.T) { - data := newCheckL2BlocksTestData(t, 1, 10) + data := newCheckL2BlocksTestData(t, 1, 14) lastL2Block := uint64(14) lastL2BlockBigInt := big.NewInt(int64(lastL2Block)) gethHeader := types.Header{ @@ -113,7 +119,7 @@ func TestCheckL2BlockHashMatch(t *testing.T) { } func TestCheckL2BlockHashMismatch(t *testing.T) { - data := newCheckL2BlocksTestData(t, 1, 10) + data := newCheckL2BlocksTestData(t, 1, 14) lastL2Block := uint64(14) lastL2BlockBigInt := big.NewInt(int64(lastL2Block)) gethHeader := types.Header{ diff --git a/synchronizer/common/reorg_error.go b/synchronizer/common/reorg_error.go new file mode 100644 index 0000000000..e60dcfb22c --- /dev/null +++ b/synchronizer/common/reorg_error.go @@ -0,0 +1,44 @@ +package common + +import "fmt" + +// ReorgError is an error that is raised when a reorg is detected +type ReorgError struct { + // BlockNumber is the block number that caused the reorg + BlockNumber uint64 + Err error +} + +// NewReorgError creates a new ReorgError +func NewReorgError(blockNumber uint64, err error) *ReorgError { + return &ReorgError{ + BlockNumber: blockNumber, + Err: err, + } +} + +func (e *ReorgError) Error() string { + return fmt.Sprintf("%s blockNumber: %d", e.Err.Error(), e.BlockNumber) +} + +// IsReorgError checks if an error is a ReorgError +func IsReorgError(err error) bool { + _, ok := err.(*ReorgError) + return ok +} + +// GetReorgErrorBlockNumber returns the block number that caused the reorg +func GetReorgErrorBlockNumber(err error) uint64 { + if reorgErr, ok := err.(*ReorgError); ok { + return reorgErr.BlockNumber + } + return 0 +} + +// GetReorgError returns the error that caused the reorg +func GetReorgError(err error) error { + if reorgErr, ok := err.(*ReorgError); ok { + return reorgErr.Err + } + return nil +} diff --git a/synchronizer/common/syncinterfaces/async_l1_block_checker.go b/synchronizer/common/syncinterfaces/async_l1_block_checker.go new file mode 100644 index 0000000000..b95903901a --- /dev/null +++ b/synchronizer/common/syncinterfaces/async_l1_block_checker.go @@ -0,0 +1,40 @@ +package syncinterfaces + +import ( + "context" + "fmt" + + "github.com/0xPolygonHermez/zkevm-node/state" +) + +type IterationResult struct { + Err error + ReorgDetected bool + BlockNumber uint64 + ReorgMessage string +} + +func (ir *IterationResult) String() string { + if ir.Err == nil { + if ir.ReorgDetected { + return fmt.Sprintf("IterationResult{ReorgDetected: %v, BlockNumber: %d ReorgMessage:%s}", ir.ReorgDetected, ir.BlockNumber, ir.ReorgMessage) + } else { + return "IterationResult{None}" + } + } else { + return fmt.Sprintf("IterationResult{Err: %s, ReorgDetected: %v, BlockNumber: %d ReorgMessage:%s}", ir.Err.Error(), ir.ReorgDetected, ir.BlockNumber, ir.ReorgMessage) + } +} + +type AsyncL1BlockChecker interface { + Run(ctx context.Context, onFinish func()) + RunSynchronous(ctx context.Context) IterationResult + Stop() + GetResult() *IterationResult +} + +type L1BlockCheckerIntegrator interface { + OnStart(ctx context.Context) error + OnResetState(ctx context.Context) + CheckReorgWrapper(ctx context.Context, reorgFirstBlockOk *state.Block, errReportedByReorgFunc error) (*state.Block, error) +} diff --git a/synchronizer/common/syncinterfaces/etherman.go b/synchronizer/common/syncinterfaces/etherman.go index 24e5dbda69..fdbdd669f8 100644 --- a/synchronizer/common/syncinterfaces/etherman.go +++ b/synchronizer/common/syncinterfaces/etherman.go @@ -14,10 +14,12 @@ type EthermanFullInterface interface { HeaderByNumber(ctx context.Context, number *big.Int) (*ethTypes.Header, error) GetRollupInfoByBlockRange(ctx context.Context, fromBlock uint64, toBlock *uint64) ([]etherman.Block, map[common.Hash][]etherman.Order, error) EthBlockByNumber(ctx context.Context, blockNumber uint64) (*ethTypes.Block, error) - GetLatestBatchNumber() (uint64, error) GetTrustedSequencerURL() (string, error) VerifyGenBlockNumber(ctx context.Context, genBlockNumber uint64) (bool, error) GetLatestVerifiedBatchNum() (uint64, error) + + EthermanGetLatestBatchNumber + GetFinalizedBlockNumber(ctx context.Context) (uint64, error) } type EthermanGetLatestBatchNumber interface { diff --git a/synchronizer/common/syncinterfaces/mocks/async_l1_block_checker.go b/synchronizer/common/syncinterfaces/mocks/async_l1_block_checker.go new file mode 100644 index 0000000000..67b38de348 --- /dev/null +++ b/synchronizer/common/syncinterfaces/mocks/async_l1_block_checker.go @@ -0,0 +1,196 @@ +// Code generated by mockery. DO NOT EDIT. + +package mock_syncinterfaces + +import ( + context "context" + + syncinterfaces "github.com/0xPolygonHermez/zkevm-node/synchronizer/common/syncinterfaces" + mock "github.com/stretchr/testify/mock" +) + +// AsyncL1BlockChecker is an autogenerated mock type for the AsyncL1BlockChecker type +type AsyncL1BlockChecker struct { + mock.Mock +} + +type AsyncL1BlockChecker_Expecter struct { + mock *mock.Mock +} + +func (_m *AsyncL1BlockChecker) EXPECT() *AsyncL1BlockChecker_Expecter { + return &AsyncL1BlockChecker_Expecter{mock: &_m.Mock} +} + +// GetResult provides a mock function with given fields: +func (_m *AsyncL1BlockChecker) GetResult() *syncinterfaces.IterationResult { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetResult") + } + + var r0 *syncinterfaces.IterationResult + if rf, ok := ret.Get(0).(func() *syncinterfaces.IterationResult); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*syncinterfaces.IterationResult) + } + } + + return r0 +} + +// AsyncL1BlockChecker_GetResult_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetResult' +type AsyncL1BlockChecker_GetResult_Call struct { + *mock.Call +} + +// GetResult is a helper method to define mock.On call +func (_e *AsyncL1BlockChecker_Expecter) GetResult() *AsyncL1BlockChecker_GetResult_Call { + return &AsyncL1BlockChecker_GetResult_Call{Call: _e.mock.On("GetResult")} +} + +func (_c *AsyncL1BlockChecker_GetResult_Call) Run(run func()) *AsyncL1BlockChecker_GetResult_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *AsyncL1BlockChecker_GetResult_Call) Return(_a0 *syncinterfaces.IterationResult) *AsyncL1BlockChecker_GetResult_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *AsyncL1BlockChecker_GetResult_Call) RunAndReturn(run func() *syncinterfaces.IterationResult) *AsyncL1BlockChecker_GetResult_Call { + _c.Call.Return(run) + return _c +} + +// Run provides a mock function with given fields: ctx, onFinish +func (_m *AsyncL1BlockChecker) Run(ctx context.Context, onFinish func()) { + _m.Called(ctx, onFinish) +} + +// AsyncL1BlockChecker_Run_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Run' +type AsyncL1BlockChecker_Run_Call struct { + *mock.Call +} + +// Run is a helper method to define mock.On call +// - ctx context.Context +// - onFinish func() +func (_e *AsyncL1BlockChecker_Expecter) Run(ctx interface{}, onFinish interface{}) *AsyncL1BlockChecker_Run_Call { + return &AsyncL1BlockChecker_Run_Call{Call: _e.mock.On("Run", ctx, onFinish)} +} + +func (_c *AsyncL1BlockChecker_Run_Call) Run(run func(ctx context.Context, onFinish func())) *AsyncL1BlockChecker_Run_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(func())) + }) + return _c +} + +func (_c *AsyncL1BlockChecker_Run_Call) Return() *AsyncL1BlockChecker_Run_Call { + _c.Call.Return() + return _c +} + +func (_c *AsyncL1BlockChecker_Run_Call) RunAndReturn(run func(context.Context, func())) *AsyncL1BlockChecker_Run_Call { + _c.Call.Return(run) + return _c +} + +// RunSynchronous provides a mock function with given fields: ctx +func (_m *AsyncL1BlockChecker) RunSynchronous(ctx context.Context) syncinterfaces.IterationResult { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for RunSynchronous") + } + + var r0 syncinterfaces.IterationResult + if rf, ok := ret.Get(0).(func(context.Context) syncinterfaces.IterationResult); ok { + r0 = rf(ctx) + } else { + r0 = ret.Get(0).(syncinterfaces.IterationResult) + } + + return r0 +} + +// AsyncL1BlockChecker_RunSynchronous_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RunSynchronous' +type AsyncL1BlockChecker_RunSynchronous_Call struct { + *mock.Call +} + +// RunSynchronous is a helper method to define mock.On call +// - ctx context.Context +func (_e *AsyncL1BlockChecker_Expecter) RunSynchronous(ctx interface{}) *AsyncL1BlockChecker_RunSynchronous_Call { + return &AsyncL1BlockChecker_RunSynchronous_Call{Call: _e.mock.On("RunSynchronous", ctx)} +} + +func (_c *AsyncL1BlockChecker_RunSynchronous_Call) Run(run func(ctx context.Context)) *AsyncL1BlockChecker_RunSynchronous_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *AsyncL1BlockChecker_RunSynchronous_Call) Return(_a0 syncinterfaces.IterationResult) *AsyncL1BlockChecker_RunSynchronous_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *AsyncL1BlockChecker_RunSynchronous_Call) RunAndReturn(run func(context.Context) syncinterfaces.IterationResult) *AsyncL1BlockChecker_RunSynchronous_Call { + _c.Call.Return(run) + return _c +} + +// Stop provides a mock function with given fields: +func (_m *AsyncL1BlockChecker) Stop() { + _m.Called() +} + +// AsyncL1BlockChecker_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop' +type AsyncL1BlockChecker_Stop_Call struct { + *mock.Call +} + +// Stop is a helper method to define mock.On call +func (_e *AsyncL1BlockChecker_Expecter) Stop() *AsyncL1BlockChecker_Stop_Call { + return &AsyncL1BlockChecker_Stop_Call{Call: _e.mock.On("Stop")} +} + +func (_c *AsyncL1BlockChecker_Stop_Call) Run(run func()) *AsyncL1BlockChecker_Stop_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *AsyncL1BlockChecker_Stop_Call) Return() *AsyncL1BlockChecker_Stop_Call { + _c.Call.Return() + return _c +} + +func (_c *AsyncL1BlockChecker_Stop_Call) RunAndReturn(run func()) *AsyncL1BlockChecker_Stop_Call { + _c.Call.Return(run) + return _c +} + +// NewAsyncL1BlockChecker creates a new instance of AsyncL1BlockChecker. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewAsyncL1BlockChecker(t interface { + mock.TestingT + Cleanup(func()) +}) *AsyncL1BlockChecker { + mock := &AsyncL1BlockChecker{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/synchronizer/common/syncinterfaces/mocks/etherman_full_interface.go b/synchronizer/common/syncinterfaces/mocks/etherman_full_interface.go index fe6e6c3df6..a904419575 100644 --- a/synchronizer/common/syncinterfaces/mocks/etherman_full_interface.go +++ b/synchronizer/common/syncinterfaces/mocks/etherman_full_interface.go @@ -87,6 +87,62 @@ func (_c *EthermanFullInterface_EthBlockByNumber_Call) RunAndReturn(run func(con return _c } +// GetFinalizedBlockNumber provides a mock function with given fields: ctx +func (_m *EthermanFullInterface) GetFinalizedBlockNumber(ctx context.Context) (uint64, error) { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for GetFinalizedBlockNumber") + } + + var r0 uint64 + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (uint64, error)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(context.Context) uint64); ok { + r0 = rf(ctx) + } else { + r0 = ret.Get(0).(uint64) + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// EthermanFullInterface_GetFinalizedBlockNumber_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFinalizedBlockNumber' +type EthermanFullInterface_GetFinalizedBlockNumber_Call struct { + *mock.Call +} + +// GetFinalizedBlockNumber is a helper method to define mock.On call +// - ctx context.Context +func (_e *EthermanFullInterface_Expecter) GetFinalizedBlockNumber(ctx interface{}) *EthermanFullInterface_GetFinalizedBlockNumber_Call { + return &EthermanFullInterface_GetFinalizedBlockNumber_Call{Call: _e.mock.On("GetFinalizedBlockNumber", ctx)} +} + +func (_c *EthermanFullInterface_GetFinalizedBlockNumber_Call) Run(run func(ctx context.Context)) *EthermanFullInterface_GetFinalizedBlockNumber_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *EthermanFullInterface_GetFinalizedBlockNumber_Call) Return(_a0 uint64, _a1 error) *EthermanFullInterface_GetFinalizedBlockNumber_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthermanFullInterface_GetFinalizedBlockNumber_Call) RunAndReturn(run func(context.Context) (uint64, error)) *EthermanFullInterface_GetFinalizedBlockNumber_Call { + _c.Call.Return(run) + return _c +} + // GetLatestBatchNumber provides a mock function with given fields: func (_m *EthermanFullInterface) GetLatestBatchNumber() (uint64, error) { ret := _m.Called() diff --git a/synchronizer/common/syncinterfaces/mocks/l1_block_checker_integrator.go b/synchronizer/common/syncinterfaces/mocks/l1_block_checker_integrator.go new file mode 100644 index 0000000000..0248874f26 --- /dev/null +++ b/synchronizer/common/syncinterfaces/mocks/l1_block_checker_integrator.go @@ -0,0 +1,176 @@ +// Code generated by mockery. DO NOT EDIT. + +package mock_syncinterfaces + +import ( + context "context" + + state "github.com/0xPolygonHermez/zkevm-node/state" + mock "github.com/stretchr/testify/mock" +) + +// L1BlockCheckerIntegrator is an autogenerated mock type for the L1BlockCheckerIntegrator type +type L1BlockCheckerIntegrator struct { + mock.Mock +} + +type L1BlockCheckerIntegrator_Expecter struct { + mock *mock.Mock +} + +func (_m *L1BlockCheckerIntegrator) EXPECT() *L1BlockCheckerIntegrator_Expecter { + return &L1BlockCheckerIntegrator_Expecter{mock: &_m.Mock} +} + +// CheckReorgWrapper provides a mock function with given fields: ctx, reorgFirstBlockOk, errReportedByReorgFunc +func (_m *L1BlockCheckerIntegrator) CheckReorgWrapper(ctx context.Context, reorgFirstBlockOk *state.Block, errReportedByReorgFunc error) (*state.Block, error) { + ret := _m.Called(ctx, reorgFirstBlockOk, errReportedByReorgFunc) + + if len(ret) == 0 { + panic("no return value specified for CheckReorgWrapper") + } + + var r0 *state.Block + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *state.Block, error) (*state.Block, error)); ok { + return rf(ctx, reorgFirstBlockOk, errReportedByReorgFunc) + } + if rf, ok := ret.Get(0).(func(context.Context, *state.Block, error) *state.Block); ok { + r0 = rf(ctx, reorgFirstBlockOk, errReportedByReorgFunc) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*state.Block) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *state.Block, error) error); ok { + r1 = rf(ctx, reorgFirstBlockOk, errReportedByReorgFunc) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// L1BlockCheckerIntegrator_CheckReorgWrapper_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckReorgWrapper' +type L1BlockCheckerIntegrator_CheckReorgWrapper_Call struct { + *mock.Call +} + +// CheckReorgWrapper is a helper method to define mock.On call +// - ctx context.Context +// - reorgFirstBlockOk *state.Block +// - errReportedByReorgFunc error +func (_e *L1BlockCheckerIntegrator_Expecter) CheckReorgWrapper(ctx interface{}, reorgFirstBlockOk interface{}, errReportedByReorgFunc interface{}) *L1BlockCheckerIntegrator_CheckReorgWrapper_Call { + return &L1BlockCheckerIntegrator_CheckReorgWrapper_Call{Call: _e.mock.On("CheckReorgWrapper", ctx, reorgFirstBlockOk, errReportedByReorgFunc)} +} + +func (_c *L1BlockCheckerIntegrator_CheckReorgWrapper_Call) Run(run func(ctx context.Context, reorgFirstBlockOk *state.Block, errReportedByReorgFunc error)) *L1BlockCheckerIntegrator_CheckReorgWrapper_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*state.Block), args[2].(error)) + }) + return _c +} + +func (_c *L1BlockCheckerIntegrator_CheckReorgWrapper_Call) Return(_a0 *state.Block, _a1 error) *L1BlockCheckerIntegrator_CheckReorgWrapper_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *L1BlockCheckerIntegrator_CheckReorgWrapper_Call) RunAndReturn(run func(context.Context, *state.Block, error) (*state.Block, error)) *L1BlockCheckerIntegrator_CheckReorgWrapper_Call { + _c.Call.Return(run) + return _c +} + +// OnResetState provides a mock function with given fields: ctx +func (_m *L1BlockCheckerIntegrator) OnResetState(ctx context.Context) { + _m.Called(ctx) +} + +// L1BlockCheckerIntegrator_OnResetState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OnResetState' +type L1BlockCheckerIntegrator_OnResetState_Call struct { + *mock.Call +} + +// OnResetState is a helper method to define mock.On call +// - ctx context.Context +func (_e *L1BlockCheckerIntegrator_Expecter) OnResetState(ctx interface{}) *L1BlockCheckerIntegrator_OnResetState_Call { + return &L1BlockCheckerIntegrator_OnResetState_Call{Call: _e.mock.On("OnResetState", ctx)} +} + +func (_c *L1BlockCheckerIntegrator_OnResetState_Call) Run(run func(ctx context.Context)) *L1BlockCheckerIntegrator_OnResetState_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *L1BlockCheckerIntegrator_OnResetState_Call) Return() *L1BlockCheckerIntegrator_OnResetState_Call { + _c.Call.Return() + return _c +} + +func (_c *L1BlockCheckerIntegrator_OnResetState_Call) RunAndReturn(run func(context.Context)) *L1BlockCheckerIntegrator_OnResetState_Call { + _c.Call.Return(run) + return _c +} + +// OnStart provides a mock function with given fields: ctx +func (_m *L1BlockCheckerIntegrator) OnStart(ctx context.Context) error { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for OnStart") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context) error); ok { + r0 = rf(ctx) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// L1BlockCheckerIntegrator_OnStart_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OnStart' +type L1BlockCheckerIntegrator_OnStart_Call struct { + *mock.Call +} + +// OnStart is a helper method to define mock.On call +// - ctx context.Context +func (_e *L1BlockCheckerIntegrator_Expecter) OnStart(ctx interface{}) *L1BlockCheckerIntegrator_OnStart_Call { + return &L1BlockCheckerIntegrator_OnStart_Call{Call: _e.mock.On("OnStart", ctx)} +} + +func (_c *L1BlockCheckerIntegrator_OnStart_Call) Run(run func(ctx context.Context)) *L1BlockCheckerIntegrator_OnStart_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *L1BlockCheckerIntegrator_OnStart_Call) Return(_a0 error) *L1BlockCheckerIntegrator_OnStart_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *L1BlockCheckerIntegrator_OnStart_Call) RunAndReturn(run func(context.Context) error) *L1BlockCheckerIntegrator_OnStart_Call { + _c.Call.Return(run) + return _c +} + +// NewL1BlockCheckerIntegrator creates a new instance of L1BlockCheckerIntegrator. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewL1BlockCheckerIntegrator(t interface { + mock.TestingT + Cleanup(func()) +}) *L1BlockCheckerIntegrator { + mock := &L1BlockCheckerIntegrator{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/synchronizer/common/syncinterfaces/mocks/state_full_interface.go b/synchronizer/common/syncinterfaces/mocks/state_full_interface.go index f4790bc695..fa570dbe7f 100644 --- a/synchronizer/common/syncinterfaces/mocks/state_full_interface.go +++ b/synchronizer/common/syncinterfaces/mocks/state_full_interface.go @@ -821,6 +821,66 @@ func (_c *StateFullInterface_GetBatchByNumber_Call) RunAndReturn(run func(contex return _c } +// GetBlockByNumber provides a mock function with given fields: ctx, blockNumber, dbTx +func (_m *StateFullInterface) GetBlockByNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*state.Block, error) { + ret := _m.Called(ctx, blockNumber, dbTx) + + if len(ret) == 0 { + panic("no return value specified for GetBlockByNumber") + } + + var r0 *state.Block + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, uint64, pgx.Tx) (*state.Block, error)); ok { + return rf(ctx, blockNumber, dbTx) + } + if rf, ok := ret.Get(0).(func(context.Context, uint64, pgx.Tx) *state.Block); ok { + r0 = rf(ctx, blockNumber, dbTx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*state.Block) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, uint64, pgx.Tx) error); ok { + r1 = rf(ctx, blockNumber, dbTx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// StateFullInterface_GetBlockByNumber_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBlockByNumber' +type StateFullInterface_GetBlockByNumber_Call struct { + *mock.Call +} + +// GetBlockByNumber is a helper method to define mock.On call +// - ctx context.Context +// - blockNumber uint64 +// - dbTx pgx.Tx +func (_e *StateFullInterface_Expecter) GetBlockByNumber(ctx interface{}, blockNumber interface{}, dbTx interface{}) *StateFullInterface_GetBlockByNumber_Call { + return &StateFullInterface_GetBlockByNumber_Call{Call: _e.mock.On("GetBlockByNumber", ctx, blockNumber, dbTx)} +} + +func (_c *StateFullInterface_GetBlockByNumber_Call) Run(run func(ctx context.Context, blockNumber uint64, dbTx pgx.Tx)) *StateFullInterface_GetBlockByNumber_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint64), args[2].(pgx.Tx)) + }) + return _c +} + +func (_c *StateFullInterface_GetBlockByNumber_Call) Return(_a0 *state.Block, _a1 error) *StateFullInterface_GetBlockByNumber_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *StateFullInterface_GetBlockByNumber_Call) RunAndReturn(run func(context.Context, uint64, pgx.Tx) (*state.Block, error)) *StateFullInterface_GetBlockByNumber_Call { + _c.Call.Return(run) + return _c +} + // GetExitRootByGlobalExitRoot provides a mock function with given fields: ctx, ger, dbTx func (_m *StateFullInterface) GetExitRootByGlobalExitRoot(ctx context.Context, ger common.Hash, dbTx pgx.Tx) (*state.GlobalExitRoot, error) { ret := _m.Called(ctx, ger, dbTx) @@ -1805,6 +1865,66 @@ func (_c *StateFullInterface_GetPreviousBlock_Call) RunAndReturn(run func(contex return _c } +// GetPreviousBlockToBlockNumber provides a mock function with given fields: ctx, blockNumber, dbTx +func (_m *StateFullInterface) GetPreviousBlockToBlockNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*state.Block, error) { + ret := _m.Called(ctx, blockNumber, dbTx) + + if len(ret) == 0 { + panic("no return value specified for GetPreviousBlockToBlockNumber") + } + + var r0 *state.Block + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, uint64, pgx.Tx) (*state.Block, error)); ok { + return rf(ctx, blockNumber, dbTx) + } + if rf, ok := ret.Get(0).(func(context.Context, uint64, pgx.Tx) *state.Block); ok { + r0 = rf(ctx, blockNumber, dbTx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*state.Block) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, uint64, pgx.Tx) error); ok { + r1 = rf(ctx, blockNumber, dbTx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// StateFullInterface_GetPreviousBlockToBlockNumber_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPreviousBlockToBlockNumber' +type StateFullInterface_GetPreviousBlockToBlockNumber_Call struct { + *mock.Call +} + +// GetPreviousBlockToBlockNumber is a helper method to define mock.On call +// - ctx context.Context +// - blockNumber uint64 +// - dbTx pgx.Tx +func (_e *StateFullInterface_Expecter) GetPreviousBlockToBlockNumber(ctx interface{}, blockNumber interface{}, dbTx interface{}) *StateFullInterface_GetPreviousBlockToBlockNumber_Call { + return &StateFullInterface_GetPreviousBlockToBlockNumber_Call{Call: _e.mock.On("GetPreviousBlockToBlockNumber", ctx, blockNumber, dbTx)} +} + +func (_c *StateFullInterface_GetPreviousBlockToBlockNumber_Call) Run(run func(ctx context.Context, blockNumber uint64, dbTx pgx.Tx)) *StateFullInterface_GetPreviousBlockToBlockNumber_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint64), args[2].(pgx.Tx)) + }) + return _c +} + +func (_c *StateFullInterface_GetPreviousBlockToBlockNumber_Call) Return(_a0 *state.Block, _a1 error) *StateFullInterface_GetPreviousBlockToBlockNumber_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *StateFullInterface_GetPreviousBlockToBlockNumber_Call) RunAndReturn(run func(context.Context, uint64, pgx.Tx) (*state.Block, error)) *StateFullInterface_GetPreviousBlockToBlockNumber_Call { + _c.Call.Return(run) + return _c +} + // GetReorgedTransactions provides a mock function with given fields: ctx, batchNumber, dbTx func (_m *StateFullInterface) GetReorgedTransactions(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) ([]*types.Transaction, error) { ret := _m.Called(ctx, batchNumber, dbTx) @@ -1988,6 +2108,67 @@ func (_c *StateFullInterface_GetStoredFlushID_Call) RunAndReturn(run func(contex return _c } +// GetUncheckedBlocks provides a mock function with given fields: ctx, fromBlockNumber, toBlockNumber, dbTx +func (_m *StateFullInterface) GetUncheckedBlocks(ctx context.Context, fromBlockNumber uint64, toBlockNumber uint64, dbTx pgx.Tx) ([]*state.Block, error) { + ret := _m.Called(ctx, fromBlockNumber, toBlockNumber, dbTx) + + if len(ret) == 0 { + panic("no return value specified for GetUncheckedBlocks") + } + + var r0 []*state.Block + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, uint64, uint64, pgx.Tx) ([]*state.Block, error)); ok { + return rf(ctx, fromBlockNumber, toBlockNumber, dbTx) + } + if rf, ok := ret.Get(0).(func(context.Context, uint64, uint64, pgx.Tx) []*state.Block); ok { + r0 = rf(ctx, fromBlockNumber, toBlockNumber, dbTx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*state.Block) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, uint64, uint64, pgx.Tx) error); ok { + r1 = rf(ctx, fromBlockNumber, toBlockNumber, dbTx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// StateFullInterface_GetUncheckedBlocks_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUncheckedBlocks' +type StateFullInterface_GetUncheckedBlocks_Call struct { + *mock.Call +} + +// GetUncheckedBlocks is a helper method to define mock.On call +// - ctx context.Context +// - fromBlockNumber uint64 +// - toBlockNumber uint64 +// - dbTx pgx.Tx +func (_e *StateFullInterface_Expecter) GetUncheckedBlocks(ctx interface{}, fromBlockNumber interface{}, toBlockNumber interface{}, dbTx interface{}) *StateFullInterface_GetUncheckedBlocks_Call { + return &StateFullInterface_GetUncheckedBlocks_Call{Call: _e.mock.On("GetUncheckedBlocks", ctx, fromBlockNumber, toBlockNumber, dbTx)} +} + +func (_c *StateFullInterface_GetUncheckedBlocks_Call) Run(run func(ctx context.Context, fromBlockNumber uint64, toBlockNumber uint64, dbTx pgx.Tx)) *StateFullInterface_GetUncheckedBlocks_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint64), args[2].(uint64), args[3].(pgx.Tx)) + }) + return _c +} + +func (_c *StateFullInterface_GetUncheckedBlocks_Call) Return(_a0 []*state.Block, _a1 error) *StateFullInterface_GetUncheckedBlocks_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *StateFullInterface_GetUncheckedBlocks_Call) RunAndReturn(run func(context.Context, uint64, uint64, pgx.Tx) ([]*state.Block, error)) *StateFullInterface_GetUncheckedBlocks_Call { + _c.Call.Return(run) + return _c +} + // OpenBatch provides a mock function with given fields: ctx, processingContext, dbTx func (_m *StateFullInterface) OpenBatch(ctx context.Context, processingContext state.ProcessingContext, dbTx pgx.Tx) error { ret := _m.Called(ctx, processingContext, dbTx) diff --git a/synchronizer/common/syncinterfaces/mocks/zkevm_client_ethereum_compatible_l2_block_getter.go b/synchronizer/common/syncinterfaces/mocks/zkevm_client_ethereum_compatible_l2_block_getter.go new file mode 100644 index 0000000000..58c2af0dff --- /dev/null +++ b/synchronizer/common/syncinterfaces/mocks/zkevm_client_ethereum_compatible_l2_block_getter.go @@ -0,0 +1,98 @@ +// Code generated by mockery. DO NOT EDIT. + +package mock_syncinterfaces + +import ( + context "context" + big "math/big" + + mock "github.com/stretchr/testify/mock" + + types "github.com/ethereum/go-ethereum/core/types" +) + +// ZKEVMClientEthereumCompatibleL2BlockGetter is an autogenerated mock type for the ZKEVMClientEthereumCompatibleL2BlockGetter type +type ZKEVMClientEthereumCompatibleL2BlockGetter struct { + mock.Mock +} + +type ZKEVMClientEthereumCompatibleL2BlockGetter_Expecter struct { + mock *mock.Mock +} + +func (_m *ZKEVMClientEthereumCompatibleL2BlockGetter) EXPECT() *ZKEVMClientEthereumCompatibleL2BlockGetter_Expecter { + return &ZKEVMClientEthereumCompatibleL2BlockGetter_Expecter{mock: &_m.Mock} +} + +// BlockByNumber provides a mock function with given fields: ctx, number +func (_m *ZKEVMClientEthereumCompatibleL2BlockGetter) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error) { + ret := _m.Called(ctx, number) + + if len(ret) == 0 { + panic("no return value specified for BlockByNumber") + } + + var r0 *types.Block + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *big.Int) (*types.Block, error)); ok { + return rf(ctx, number) + } + if rf, ok := ret.Get(0).(func(context.Context, *big.Int) *types.Block); ok { + r0 = rf(ctx, number) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Block) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *big.Int) error); ok { + r1 = rf(ctx, number) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ZKEVMClientEthereumCompatibleL2BlockGetter_BlockByNumber_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BlockByNumber' +type ZKEVMClientEthereumCompatibleL2BlockGetter_BlockByNumber_Call struct { + *mock.Call +} + +// BlockByNumber is a helper method to define mock.On call +// - ctx context.Context +// - number *big.Int +func (_e *ZKEVMClientEthereumCompatibleL2BlockGetter_Expecter) BlockByNumber(ctx interface{}, number interface{}) *ZKEVMClientEthereumCompatibleL2BlockGetter_BlockByNumber_Call { + return &ZKEVMClientEthereumCompatibleL2BlockGetter_BlockByNumber_Call{Call: _e.mock.On("BlockByNumber", ctx, number)} +} + +func (_c *ZKEVMClientEthereumCompatibleL2BlockGetter_BlockByNumber_Call) Run(run func(ctx context.Context, number *big.Int)) *ZKEVMClientEthereumCompatibleL2BlockGetter_BlockByNumber_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*big.Int)) + }) + return _c +} + +func (_c *ZKEVMClientEthereumCompatibleL2BlockGetter_BlockByNumber_Call) Return(_a0 *types.Block, _a1 error) *ZKEVMClientEthereumCompatibleL2BlockGetter_BlockByNumber_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ZKEVMClientEthereumCompatibleL2BlockGetter_BlockByNumber_Call) RunAndReturn(run func(context.Context, *big.Int) (*types.Block, error)) *ZKEVMClientEthereumCompatibleL2BlockGetter_BlockByNumber_Call { + _c.Call.Return(run) + return _c +} + +// NewZKEVMClientEthereumCompatibleL2BlockGetter creates a new instance of ZKEVMClientEthereumCompatibleL2BlockGetter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewZKEVMClientEthereumCompatibleL2BlockGetter(t interface { + mock.TestingT + Cleanup(func()) +}) *ZKEVMClientEthereumCompatibleL2BlockGetter { + mock := &ZKEVMClientEthereumCompatibleL2BlockGetter{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/synchronizer/common/syncinterfaces/state.go b/synchronizer/common/syncinterfaces/state.go index 0aff583319..cafae4104e 100644 --- a/synchronizer/common/syncinterfaces/state.go +++ b/synchronizer/common/syncinterfaces/state.go @@ -28,6 +28,7 @@ type StateFullInterface interface { AddForcedBatch(ctx context.Context, forcedBatch *state.ForcedBatch, dbTx pgx.Tx) error AddBlock(ctx context.Context, block *state.Block, dbTx pgx.Tx) error Reset(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) error + GetBlockByNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*state.Block, error) GetPreviousBlock(ctx context.Context, offset uint64, dbTx pgx.Tx) (*state.Block, error) GetFirstUncheckedBlock(ctx context.Context, fromBlockNumber uint64, dbTx pgx.Tx) (*state.Block, error) UpdateCheckedBlockByNumber(ctx context.Context, blockNumber uint64, newCheckedStatus bool, dbTx pgx.Tx) error @@ -75,4 +76,6 @@ type StateFullInterface interface { UpdateForkIDBlockNumber(ctx context.Context, forkdID uint64, newBlockNumber uint64, updateMemCache bool, dbTx pgx.Tx) error GetLastL2BlockNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error) GetL2BlockByNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*state.L2Block, error) + GetUncheckedBlocks(ctx context.Context, fromBlockNumber uint64, toBlockNumber uint64, dbTx pgx.Tx) ([]*state.Block, error) + GetPreviousBlockToBlockNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*state.Block, error) } diff --git a/synchronizer/config.go b/synchronizer/config.go index 0f7d822a60..ef51d41308 100644 --- a/synchronizer/config.go +++ b/synchronizer/config.go @@ -1,6 +1,8 @@ package synchronizer import ( + "fmt" + "github.com/0xPolygonHermez/zkevm-node/config/types" "github.com/0xPolygonHermez/zkevm-node/synchronizer/l2_sync" ) @@ -22,6 +24,7 @@ type Config struct { // a modules 5, for instance, means check all l2block multiples of 5 (10,15,20,...) L1SyncCheckL2BlockNumberhModulus uint64 `mapstructure:"L1SyncCheckL2BlockNumberhModulus"` + L1BlockCheck L1BlockCheckConfig `mapstructure:"L1BlockCheck"` // L1SynchronizationMode define how to synchronize with L1: // - parallel: Request data to L1 in parallel, and process sequentially. The advantage is that executor is not blocked waiting for L1 data // - sequential: Request data to L1 and execute @@ -32,6 +35,35 @@ type Config struct { L2Synchronization l2_sync.Config `mapstructure:"L2Synchronization"` } +// L1BlockCheckConfig Configuration for L1 Block Checker +type L1BlockCheckConfig struct { + // Enable if is true then the check l1 Block Hash is active + Enable bool `mapstructure:"Enable"` + // L1SafeBlockPoint is the point that a block is considered safe enough to be checked + // it can be: finalized, safe,pending or latest + L1SafeBlockPoint string `mapstructure:"L1SafeBlockPoint" jsonschema:"enum=finalized,enum=safe, enum=pending,enum=latest"` + // L1SafeBlockOffset is the offset to add to L1SafeBlockPoint as a safe point + // it can be positive or negative + // Example: L1SafeBlockPoint= finalized, L1SafeBlockOffset= -10, then the safe block ten blocks before the finalized block + L1SafeBlockOffset int `mapstructure:"L1SafeBlockOffset"` + // ForceCheckBeforeStart if is true then the first time the system is started it will force to check all pending blocks + ForceCheckBeforeStart bool `mapstructure:"ForceCheckBeforeStart"` + + // PreCheckEnable if is true then the pre-check is active, will check blocks between L1SafeBlock and L1PreSafeBlock + PreCheckEnable bool `mapstructure:"PreCheckEnable"` + // L1PreSafeBlockPoint is the point that a block is considered safe enough to be checked + // it can be: finalized, safe,pending or latest + L1PreSafeBlockPoint string `mapstructure:"L1PreSafeBlockPoint" jsonschema:"enum=finalized,enum=safe, enum=pending,enum=latest"` + // L1PreSafeBlockOffset is the offset to add to L1PreSafeBlockPoint as a safe point + // it can be positive or negative + // Example: L1PreSafeBlockPoint= finalized, L1PreSafeBlockOffset= -10, then the safe block ten blocks before the finalized block + L1PreSafeBlockOffset int `mapstructure:"L1PreSafeBlockOffset"` +} + +func (c *L1BlockCheckConfig) String() string { + return fmt.Sprintf("Enable: %v, L1SafeBlockPoint: %s, L1SafeBlockOffset: %d, ForceCheckBeforeStart: %v", c.Enable, c.L1SafeBlockPoint, c.L1SafeBlockOffset, c.ForceCheckBeforeStart) +} + // L1ParallelSynchronizationConfig Configuration for parallel mode (if UL1SynchronizationMode equal to 'parallel') type L1ParallelSynchronizationConfig struct { // MaxClients Number of clients used to synchronize with L1 diff --git a/synchronizer/l1_check_block/async.go b/synchronizer/l1_check_block/async.go new file mode 100644 index 0000000000..4a2a45d924 --- /dev/null +++ b/synchronizer/l1_check_block/async.go @@ -0,0 +1,183 @@ +package l1_check_block + +import ( + "context" + "sync" + "time" + + "github.com/0xPolygonHermez/zkevm-node/log" + "github.com/0xPolygonHermez/zkevm-node/synchronizer/common" + "github.com/0xPolygonHermez/zkevm-node/synchronizer/common/syncinterfaces" +) + +// L1BlockChecker is an interface that defines the method to check L1 blocks +type L1BlockChecker interface { + Step(ctx context.Context) error +} + +const ( + defaultPeriodTime = time.Second +) + +// AsyncCheck is a wrapper for L1BlockChecker to become asynchronous +type AsyncCheck struct { + checker L1BlockChecker + mutex sync.Mutex + lastResult *syncinterfaces.IterationResult + onFinishCall func() + periodTime time.Duration + // Wg is a wait group to wait for the result + Wg sync.WaitGroup + ctx context.Context + cancelCtx context.CancelFunc + isRunning bool +} + +// NewAsyncCheck creates a new AsyncCheck +func NewAsyncCheck(checker L1BlockChecker) *AsyncCheck { + return &AsyncCheck{ + checker: checker, + periodTime: defaultPeriodTime, + } +} + +// SetPeriodTime sets the period time between relaunch checker.Step +func (a *AsyncCheck) SetPeriodTime(periodTime time.Duration) { + a.periodTime = periodTime +} + +// Run is a method that starts the async check +func (a *AsyncCheck) Run(ctx context.Context, onFinish func()) { + a.mutex.Lock() + defer a.mutex.Unlock() + a.onFinishCall = onFinish + if a.isRunning { + log.Infof("%s L1BlockChecker: already running, changing onFinish call", logPrefix) + return + } + a.lastResult = nil + a.ctx, a.cancelCtx = context.WithCancel(ctx) + a.launchChecker(a.ctx) +} + +// Stop is a method that stops the async check +func (a *AsyncCheck) Stop() { + a.cancelCtx() + a.Wg.Wait() +} + +// RunSynchronous is a method that forces the check to be synchronous before starting the async check +func (a *AsyncCheck) RunSynchronous(ctx context.Context) syncinterfaces.IterationResult { + return a.executeIteration(ctx) +} + +// GetResult returns the last result of the check: +// - Nil -> still running +// - Not nil -> finished, and this is the result. You must call again Run to start a new check +func (a *AsyncCheck) GetResult() *syncinterfaces.IterationResult { + a.mutex.Lock() + defer a.mutex.Unlock() + return a.lastResult +} + +// https://stackoverflow.com/questions/32840687/timeout-for-waitgroup-wait +// waitTimeout waits for the waitgroup for the specified max timeout. +// Returns true if waiting timed out. +func waitTimeout(wg *sync.WaitGroup, timeout time.Duration) bool { + c := make(chan struct{}) + go func() { + defer close(c) + wg.Wait() + }() + select { + case <-c: + return false // completed normally + case <-time.After(timeout): + return true // timed out + } +} + +// GetResultBlockingUntilAvailable wait the time specific in timeout, if reach timeout returns current +// result, if not, wait until the result is available. +// if timeout is 0, it waits indefinitely +func (a *AsyncCheck) GetResultBlockingUntilAvailable(timeout time.Duration) *syncinterfaces.IterationResult { + if timeout == 0 { + a.Wg.Wait() + } else { + waitTimeout(&a.Wg, timeout) + } + return a.GetResult() +} + +func (a *AsyncCheck) setResult(result syncinterfaces.IterationResult) { + a.mutex.Lock() + defer a.mutex.Unlock() + a.lastResult = &result +} + +func (a *AsyncCheck) launchChecker(ctx context.Context) { + // add waitGroup to wait for a result + a.Wg.Add(1) + a.isRunning = true + go func() { + log.Infof("%s L1BlockChecker: starting background process", logPrefix) + for { + result := a.step(ctx) + if result != nil { + a.setResult(*result) + // Result is set wg is done + break + } + } + log.Infof("%s L1BlockChecker: finished background process", logPrefix) + a.Wg.Done() + a.mutex.Lock() + onFinishCall := a.onFinishCall + a.isRunning = false + a.mutex.Unlock() + // call onFinish function with no mutex + if onFinishCall != nil { + onFinishCall() + } + }() +} + +// step is a method that executes until executeItertion +// returns an error or a reorg +func (a *AsyncCheck) step(ctx context.Context) *syncinterfaces.IterationResult { + select { + case <-ctx.Done(): + log.Debugf("%s L1BlockChecker: context done", logPrefix) + return &syncinterfaces.IterationResult{Err: ctx.Err()} + default: + result := a.executeIteration(ctx) + if result.ReorgDetected { + return &result + } + log.Debugf("%s L1BlockChecker:returned %s waiting %s to relaunch", logPrefix, result.String(), a.periodTime) + time.Sleep(a.periodTime) + } + return nil +} + +// executeIteration executes a single iteration of the checker +func (a *AsyncCheck) executeIteration(ctx context.Context) syncinterfaces.IterationResult { + res := syncinterfaces.IterationResult{} + log.Debugf("%s calling checker.Step(...)", logPrefix) + res.Err = a.checker.Step(ctx) + log.Debugf("%s returned checker.Step(...) %w", logPrefix, res.Err) + if res.Err != nil { + log.Errorf("%s Fail check L1 Blocks: %w", logPrefix, res.Err) + if common.IsReorgError(res.Err) { + // log error + blockNumber := common.GetReorgErrorBlockNumber(res.Err) + log.Infof("%s Reorg detected at block %d", logPrefix, blockNumber) + // It keeps blocked until the channel is read + res.BlockNumber = blockNumber + res.ReorgDetected = true + res.ReorgMessage = res.Err.Error() + res.Err = nil + } + } + return res +} diff --git a/synchronizer/l1_check_block/async_test.go b/synchronizer/l1_check_block/async_test.go new file mode 100644 index 0000000000..21358b1c8f --- /dev/null +++ b/synchronizer/l1_check_block/async_test.go @@ -0,0 +1,138 @@ +package l1_check_block_test + +import ( + "context" + "fmt" + "sync" + "testing" + "time" + + "github.com/0xPolygonHermez/zkevm-node/synchronizer/common" + "github.com/0xPolygonHermez/zkevm-node/synchronizer/l1_check_block" + "github.com/stretchr/testify/require" +) + +var ( + errGenericToTestAsync = fmt.Errorf("error_async") + errReorgToTestAsync = common.NewReorgError(uint64(1234), fmt.Errorf("fake reorg to test")) + timeoutContextForAsyncTests = time.Second +) + +type mockChecker struct { + Wg *sync.WaitGroup + ErrorsToReturn []error +} + +func (m *mockChecker) Step(ctx context.Context) error { + defer m.Wg.Done() + err := m.ErrorsToReturn[0] + if len(m.ErrorsToReturn) > 0 { + m.ErrorsToReturn = m.ErrorsToReturn[1:] + } + return err +} + +// If checker.step() returns ok, the async object will relaunch the call +func TestAsyncRelaunchCheckerUntilReorgDetected(t *testing.T) { + mockChecker := &mockChecker{ErrorsToReturn: []error{nil, nil, errGenericToTestAsync, errReorgToTestAsync}, Wg: &sync.WaitGroup{}} + sut := l1_check_block.NewAsyncCheck(mockChecker) + sut.SetPeriodTime(0) + ctx, cancel := context.WithTimeout(context.Background(), timeoutContextForAsyncTests) + defer cancel() + mockChecker.Wg.Add(4) + + sut.Run(ctx, nil) + + mockChecker.Wg.Wait() + result := sut.GetResultBlockingUntilAvailable(0) + require.NotNil(t, result) + require.Equal(t, uint64(1234), result.BlockNumber) + require.Equal(t, true, result.ReorgDetected) + require.Equal(t, nil, result.Err) +} + +func TestAsyncGetResultIsNilUntilStops(t *testing.T) { + mockChecker := &mockChecker{ErrorsToReturn: []error{nil, nil, errGenericToTestAsync, errReorgToTestAsync}, Wg: &sync.WaitGroup{}} + sut := l1_check_block.NewAsyncCheck(mockChecker) + sut.SetPeriodTime(0) + ctx, cancel := context.WithTimeout(context.Background(), timeoutContextForAsyncTests) + defer cancel() + mockChecker.Wg.Add(4) + require.Nil(t, sut.GetResult(), "before start result is Nil") + + sut.Run(ctx, nil) + + require.Nil(t, sut.GetResult(), "after start result is Nil") + mockChecker.Wg.Wait() + result := sut.GetResultBlockingUntilAvailable(0) + require.NotNil(t, result) +} + +// RunSynchronous it returns the first result, doesnt mind if a reorg or not +func TestAsyncGRunSynchronousReturnTheFirstResult(t *testing.T) { + mockChecker := &mockChecker{ErrorsToReturn: []error{errGenericToTestAsync}, Wg: &sync.WaitGroup{}} + sut := l1_check_block.NewAsyncCheck(mockChecker) + sut.SetPeriodTime(0) + ctx, cancel := context.WithTimeout(context.Background(), timeoutContextForAsyncTests) + defer cancel() + mockChecker.Wg.Add(1) + + result := sut.RunSynchronous(ctx) + + require.NotNil(t, result) + require.Equal(t, uint64(0), result.BlockNumber) + require.Equal(t, false, result.ReorgDetected) + require.Equal(t, errGenericToTestAsync, result.Err) +} + +func TestAsyncGRunSynchronousDontAffectGetResult(t *testing.T) { + mockChecker := &mockChecker{ErrorsToReturn: []error{errGenericToTestAsync}, Wg: &sync.WaitGroup{}} + sut := l1_check_block.NewAsyncCheck(mockChecker) + sut.SetPeriodTime(0) + ctx, cancel := context.WithTimeout(context.Background(), timeoutContextForAsyncTests) + defer cancel() + mockChecker.Wg.Add(1) + + result := sut.RunSynchronous(ctx) + + require.NotNil(t, result) + require.Nil(t, sut.GetResult()) +} + +func TestAsyncStop(t *testing.T) { + mockChecker := &mockChecker{ErrorsToReturn: []error{nil, nil, errGenericToTestAsync, errReorgToTestAsync}, Wg: &sync.WaitGroup{}} + sut := l1_check_block.NewAsyncCheck(mockChecker) + sut.SetPeriodTime(0) + ctx, cancel := context.WithTimeout(context.Background(), timeoutContextForAsyncTests) + defer cancel() + require.Nil(t, sut.GetResult(), "before start result is Nil") + mockChecker.Wg.Add(4) + sut.Run(ctx, nil) + sut.Stop() + sut.Stop() + + result := sut.GetResultBlockingUntilAvailable(0) + require.NotNil(t, result) + mockChecker.Wg = &sync.WaitGroup{} + mockChecker.Wg.Add(4) + mockChecker.ErrorsToReturn = []error{nil, nil, errGenericToTestAsync, errReorgToTestAsync} + sut.Run(ctx, nil) + mockChecker.Wg.Wait() + result = sut.GetResultBlockingUntilAvailable(0) + require.NotNil(t, result) +} + +func TestAsyncMultipleRun(t *testing.T) { + mockChecker := &mockChecker{ErrorsToReturn: []error{nil, nil, errGenericToTestAsync, errReorgToTestAsync}, Wg: &sync.WaitGroup{}} + sut := l1_check_block.NewAsyncCheck(mockChecker) + sut.SetPeriodTime(0) + ctx, cancel := context.WithTimeout(context.Background(), timeoutContextForAsyncTests) + defer cancel() + require.Nil(t, sut.GetResult(), "before start result is Nil") + mockChecker.Wg.Add(4) + sut.Run(ctx, nil) + sut.Run(ctx, nil) + sut.Run(ctx, nil) + result := sut.GetResultBlockingUntilAvailable(0) + require.NotNil(t, result) +} diff --git a/synchronizer/l1_check_block/check_l1block.go b/synchronizer/l1_check_block/check_l1block.go new file mode 100644 index 0000000000..cd1204c5b3 --- /dev/null +++ b/synchronizer/l1_check_block/check_l1block.go @@ -0,0 +1,146 @@ +package l1_check_block + +import ( + "context" + "errors" + "fmt" + "math/big" + "time" + + "github.com/0xPolygonHermez/zkevm-node/log" + "github.com/0xPolygonHermez/zkevm-node/state" + "github.com/0xPolygonHermez/zkevm-node/synchronizer/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/jackc/pgx/v4" +) + +// This object check old L1block to double-check that the L1block hash is correct +// - Get first not checked block +// - Get last block on L1 (safe/finalized/ or minus -n) + +// L1Requester is an interface for GETH client +type L1Requester interface { + HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error) +} + +// StateInterfacer is an interface for the state +type StateInterfacer interface { + GetFirstUncheckedBlock(ctx context.Context, fromBlockNumber uint64, dbTx pgx.Tx) (*state.Block, error) + UpdateCheckedBlockByNumber(ctx context.Context, blockNumber uint64, newCheckedStatus bool, dbTx pgx.Tx) error +} + +// SafeL1BlockNumberFetcher is an interface for fetching the L1 block number reference point (safe, finalized,...) +type SafeL1BlockNumberFetcher interface { + GetSafeBlockNumber(ctx context.Context, l1Client L1Requester) (uint64, error) + Description() string +} + +// CheckL1BlockHash is a struct that implements a checker of L1Block hash +type CheckL1BlockHash struct { + L1Client L1Requester + State StateInterfacer + SafeBlockNumberFetcher SafeL1BlockNumberFetcher +} + +// NewCheckL1BlockHash creates a new CheckL1BlockHash +func NewCheckL1BlockHash(l1Client L1Requester, state StateInterfacer, safeBlockNumberFetcher SafeL1BlockNumberFetcher) *CheckL1BlockHash { + return &CheckL1BlockHash{ + L1Client: l1Client, + State: state, + SafeBlockNumberFetcher: safeBlockNumberFetcher, + } +} + +// Name is a method that returns the name of the checker +func (p *CheckL1BlockHash) Name() string { + return logPrefix + " main_checker: " +} + +// Step is a method that checks the L1 block hash, run until all blocks are checked and returns +func (p *CheckL1BlockHash) Step(ctx context.Context) error { + stateBlock, err := p.State.GetFirstUncheckedBlock(ctx, uint64(0), nil) + if errors.Is(err, state.ErrNotFound) { + log.Debugf("%s: No unchecked blocks to check", p.Name()) + return nil + } + if err != nil { + return err + } + if stateBlock == nil { + log.Warnf("%s: function CheckL1Block receive a nil pointer", p.Name()) + return nil + } + safeBlockNumber, err := p.SafeBlockNumberFetcher.GetSafeBlockNumber(ctx, p.L1Client) + if err != nil { + return err + } + log.Debugf("%s: checking from block (%s) %d first block to check: %d....", p.Name(), p.SafeBlockNumberFetcher.Description(), safeBlockNumber, stateBlock.BlockNumber) + return p.doAllBlocks(ctx, *stateBlock, safeBlockNumber) +} + +func (p *CheckL1BlockHash) doAllBlocks(ctx context.Context, firstStateBlock state.Block, safeBlockNumber uint64) error { + var err error + startTime := time.Now() + stateBlock := &firstStateBlock + numBlocksChecked := 0 + for { + lastStateBlockNumber := stateBlock.BlockNumber + if stateBlock.BlockNumber > safeBlockNumber { + log.Debugf("%s: block %d to check is not still safe enough (%s) %d ", p.Name(), stateBlock.BlockNumber, p.SafeBlockNumberFetcher.Description(), safeBlockNumber, logPrefix) + return nil + } + err = p.doBlock(ctx, stateBlock) + if err != nil { + return err + } + numBlocksChecked++ + stateBlock, err = p.State.GetFirstUncheckedBlock(ctx, lastStateBlockNumber, nil) + if errors.Is(err, state.ErrNotFound) { + diff := time.Since(startTime) + log.Infof("%s: checked all blocks (%d) (using as safe Block Point(%s): %d) time:%s", p.Name(), numBlocksChecked, p.SafeBlockNumberFetcher.Description(), safeBlockNumber, diff) + return nil + } + } +} + +func (p *CheckL1BlockHash) doBlock(ctx context.Context, stateBlock *state.Block) error { + err := CheckBlockHash(ctx, stateBlock, p.L1Client, p.Name()) + if err != nil { + return err + } + log.Infof("%s: L1Block: %d hash: %s is correct marking as checked", p.Name(), stateBlock.BlockNumber, + stateBlock.BlockHash.String()) + err = p.State.UpdateCheckedBlockByNumber(ctx, stateBlock.BlockNumber, true, nil) + if err != nil { + log.Errorf("%s: Error updating block %d as checked. err: %s", p.Name(), stateBlock.BlockNumber, err.Error()) + return err + } + return nil +} + +// CheckBlockHash is a method that checks the L1 block hash +func CheckBlockHash(ctx context.Context, stateBlock *state.Block, L1Client L1Requester, checkerName string) error { + if stateBlock == nil { + log.Warn("%s function CheckL1Block receive a nil pointer", checkerName) + return nil + } + l1Block, err := L1Client.HeaderByNumber(ctx, big.NewInt(int64(stateBlock.BlockNumber))) + if err != nil { + return err + } + if l1Block == nil { + err = fmt.Errorf("%s request of block: %d to L1 returns a nil", checkerName, stateBlock.BlockNumber) + log.Error(err.Error()) + return err + } + if l1Block.Hash() != stateBlock.BlockHash { + msg := fmt.Sprintf("%s Reorg detected at block %d l1Block.Hash=%s != stateBlock.Hash=%s. ", checkerName, stateBlock.BlockNumber, + l1Block.Hash().String(), stateBlock.BlockHash.String()) + if l1Block.ParentHash != stateBlock.ParentHash { + msg += fmt.Sprintf(" ParentHash are also different. l1Block.ParentHash=%s != stateBlock.ParentHash=%s", l1Block.ParentHash.String(), stateBlock.ParentHash.String()) + } + log.Errorf(msg) + return common.NewReorgError(stateBlock.BlockNumber, fmt.Errorf(msg)) + } + return nil +} diff --git a/synchronizer/l1_check_block/check_l1block_test.go b/synchronizer/l1_check_block/check_l1block_test.go new file mode 100644 index 0000000000..e5090140a3 --- /dev/null +++ b/synchronizer/l1_check_block/check_l1block_test.go @@ -0,0 +1,128 @@ +package l1_check_block_test + +import ( + "context" + "fmt" + "math/big" + "testing" + + "github.com/0xPolygonHermez/zkevm-node/state" + commonsync "github.com/0xPolygonHermez/zkevm-node/synchronizer/common" + "github.com/0xPolygonHermez/zkevm-node/synchronizer/l1_check_block" + mock_l1_check_block "github.com/0xPolygonHermez/zkevm-node/synchronizer/l1_check_block/mocks" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" +) + +type testData struct { + mockL1Client *mock_l1_check_block.L1Requester + mockState *mock_l1_check_block.StateInterfacer + mockBlockNumberFetch *mock_l1_check_block.SafeL1BlockNumberFetcher + sut *l1_check_block.CheckL1BlockHash + ctx context.Context + stateBlock *state.Block +} + +func newTestData(t *testing.T) *testData { + mockL1Client := mock_l1_check_block.NewL1Requester(t) + mockState := mock_l1_check_block.NewStateInterfacer(t) + mockBlockNumberFetch := mock_l1_check_block.NewSafeL1BlockNumberFetcher(t) + mockBlockNumberFetch.EXPECT().Description().Return("mock").Maybe() + sut := l1_check_block.NewCheckL1BlockHash(mockL1Client, mockState, mockBlockNumberFetch) + require.NotNil(t, sut) + ctx := context.Background() + return &testData{ + mockL1Client: mockL1Client, + mockState: mockState, + mockBlockNumberFetch: mockBlockNumberFetch, + sut: sut, + ctx: ctx, + stateBlock: &state.Block{ + BlockNumber: 1234, + BlockHash: common.HexToHash("0xb07e1289b32edefd8f3c702d016fb73c81d5950b2ebc790ad9d2cb8219066b4c"), + }, + } +} + +func TestCheckL1BlockHashNoBlocksOnDB(t *testing.T) { + data := newTestData(t) + data.mockState.EXPECT().GetFirstUncheckedBlock(data.ctx, uint64(0), nil).Return(nil, state.ErrNotFound) + res := data.sut.Step(data.ctx) + require.NoError(t, res) +} + +func TestCheckL1BlockHashErrorGettingFirstUncheckedBlockFromDB(t *testing.T) { + data := newTestData(t) + data.mockState.EXPECT().GetFirstUncheckedBlock(data.ctx, uint64(0), nil).Return(nil, fmt.Errorf("error")) + res := data.sut.Step(data.ctx) + require.Error(t, res) +} + +func TestCheckL1BlockHashErrorGettingGetSafeBlockNumber(t *testing.T) { + data := newTestData(t) + + data.mockState.EXPECT().GetFirstUncheckedBlock(data.ctx, uint64(0), nil).Return(data.stateBlock, nil) + data.mockBlockNumberFetch.EXPECT().GetSafeBlockNumber(data.ctx, data.mockL1Client).Return(uint64(0), fmt.Errorf("error")) + res := data.sut.Step(data.ctx) + require.Error(t, res) +} + +// The first block to check is below the safe point, nothing to do +func TestCheckL1BlockHashSafePointIsInFuture(t *testing.T) { + data := newTestData(t) + + data.mockState.EXPECT().GetFirstUncheckedBlock(data.ctx, uint64(0), nil).Return(data.stateBlock, nil) + data.mockBlockNumberFetch.EXPECT().GetSafeBlockNumber(data.ctx, data.mockL1Client).Return(data.stateBlock.BlockNumber-1, nil) + + res := data.sut.Step(data.ctx) + require.NoError(t, res) +} + +func TestCheckL1BlockHashL1ClientReturnsANil(t *testing.T) { + data := newTestData(t) + + data.mockState.EXPECT().GetFirstUncheckedBlock(data.ctx, uint64(0), nil).Return(data.stateBlock, nil) + data.mockBlockNumberFetch.EXPECT().GetSafeBlockNumber(data.ctx, data.mockL1Client).Return(data.stateBlock.BlockNumber+10, nil) + data.mockL1Client.EXPECT().HeaderByNumber(data.ctx, big.NewInt(int64(data.stateBlock.BlockNumber))).Return(nil, nil) + res := data.sut.Step(data.ctx) + require.Error(t, res) +} + +// Check a block that is OK +func TestCheckL1BlockHashMatchHashUpdateCheckMarkOnDB(t *testing.T) { + data := newTestData(t) + + data.mockState.EXPECT().GetFirstUncheckedBlock(data.ctx, uint64(0), nil).Return(data.stateBlock, nil) + data.mockBlockNumberFetch.EXPECT().Description().Return("mock") + data.mockBlockNumberFetch.EXPECT().GetSafeBlockNumber(data.ctx, data.mockL1Client).Return(data.stateBlock.BlockNumber, nil) + l1Block := &types.Header{ + Number: big.NewInt(100), + } + data.mockL1Client.EXPECT().HeaderByNumber(data.ctx, big.NewInt(int64(data.stateBlock.BlockNumber))).Return(l1Block, nil) + data.mockState.EXPECT().UpdateCheckedBlockByNumber(data.ctx, data.stateBlock.BlockNumber, true, nil).Return(nil) + data.mockState.EXPECT().GetFirstUncheckedBlock(data.ctx, mock.Anything, nil).Return(nil, state.ErrNotFound) + + res := data.sut.Step(data.ctx) + require.NoError(t, res) +} + +// The first block to check is equal to the safe point, must be processed +func TestCheckL1BlockHashMismatch(t *testing.T) { + data := newTestData(t) + + data.mockState.EXPECT().GetFirstUncheckedBlock(data.ctx, uint64(0), nil).Return(data.stateBlock, nil) + data.stateBlock.BlockHash = common.HexToHash("0x1234") // Wrong hash to trigger a mismatch + data.mockBlockNumberFetch.EXPECT().GetSafeBlockNumber(data.ctx, data.mockL1Client).Return(data.stateBlock.BlockNumber, nil) + l1Block := &types.Header{ + Number: big.NewInt(100), + } + data.mockL1Client.EXPECT().HeaderByNumber(data.ctx, big.NewInt(int64(data.stateBlock.BlockNumber))).Return(l1Block, nil) + + res := data.sut.Step(data.ctx) + require.Error(t, res) + resErr, ok := res.(*commonsync.ReorgError) + require.True(t, ok) + require.Equal(t, data.stateBlock.BlockNumber, resErr.BlockNumber) +} diff --git a/synchronizer/l1_check_block/common.go b/synchronizer/l1_check_block/common.go new file mode 100644 index 0000000000..a473c220a3 --- /dev/null +++ b/synchronizer/l1_check_block/common.go @@ -0,0 +1,5 @@ +package l1_check_block + +const ( + logPrefix = "checkL1block:" +) diff --git a/synchronizer/l1_check_block/integration.go b/synchronizer/l1_check_block/integration.go new file mode 100644 index 0000000000..82a962eb3f --- /dev/null +++ b/synchronizer/l1_check_block/integration.go @@ -0,0 +1,205 @@ +package l1_check_block + +import ( + "context" + "time" + + "github.com/0xPolygonHermez/zkevm-node/log" + "github.com/0xPolygonHermez/zkevm-node/state" + "github.com/0xPolygonHermez/zkevm-node/synchronizer/common/syncinterfaces" + "github.com/jackc/pgx/v4" +) + +// StateForL1BlockCheckerIntegration is an interface for the state +type StateForL1BlockCheckerIntegration interface { + GetPreviousBlockToBlockNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*state.Block, error) +} + +// L1BlockCheckerIntegration is a struct that integrates the L1BlockChecker with the synchronizer +type L1BlockCheckerIntegration struct { + forceCheckOnStart bool + checker syncinterfaces.AsyncL1BlockChecker + preChecker syncinterfaces.AsyncL1BlockChecker + state StateForL1BlockCheckerIntegration + sync SyncCheckReorger + timeBetweenRetries time.Duration +} + +// SyncCheckReorger is an interface that defines the methods required from Synchronizer object +type SyncCheckReorger interface { + ExecuteReorgFromMismatchBlock(blockNumber uint64, reason string) error + OnDetectedMismatchL1BlockReorg() +} + +// NewL1BlockCheckerIntegration creates a new L1BlockCheckerIntegration +func NewL1BlockCheckerIntegration(checker syncinterfaces.AsyncL1BlockChecker, preChecker syncinterfaces.AsyncL1BlockChecker, state StateForL1BlockCheckerIntegration, sync SyncCheckReorger, forceCheckOnStart bool, timeBetweenRetries time.Duration) *L1BlockCheckerIntegration { + return &L1BlockCheckerIntegration{ + forceCheckOnStart: forceCheckOnStart, + checker: checker, + preChecker: preChecker, + state: state, + sync: sync, + timeBetweenRetries: timeBetweenRetries, + } +} + +// OnStart is a method that is called before starting the synchronizer +func (v *L1BlockCheckerIntegration) OnStart(ctx context.Context) error { + if v.forceCheckOnStart { + log.Infof("%s Forcing L1BlockChecker check before start", logPrefix) + result := v.runCheckerSync(ctx, v.checker) + if result.ReorgDetected { + v.executeResult(ctx, result) + } else { + log.Infof("%s Forcing L1BlockChecker check:OK ", logPrefix) + if v.preChecker != nil { + log.Infof("%s Forcing L1BlockChecker preCheck before start", logPrefix) + result = v.runCheckerSync(ctx, v.preChecker) + if result.ReorgDetected { + v.executeResult(ctx, result) + } else { + log.Infof("%s Forcing L1BlockChecker preCheck:OK", logPrefix) + } + } + } + } + v.launch(ctx) + return nil +} + +func (v *L1BlockCheckerIntegration) runCheckerSync(ctx context.Context, checker syncinterfaces.AsyncL1BlockChecker) syncinterfaces.IterationResult { + for { + result := checker.RunSynchronous(ctx) + if result.Err == nil { + return result + } else { + time.Sleep(v.timeBetweenRetries) + } + } +} + +// OnStartL1Sync is a method that is called before starting the L1 sync +func (v *L1BlockCheckerIntegration) OnStartL1Sync(ctx context.Context) bool { + return v.checkBackgroundResult(ctx, "before start L1 sync") +} + +// OnStartL2Sync is a method that is called before starting the L2 sync +func (v *L1BlockCheckerIntegration) OnStartL2Sync(ctx context.Context) bool { + return v.checkBackgroundResult(ctx, "before start 2 sync") +} + +// OnResetState is a method that is called after a resetState +func (v *L1BlockCheckerIntegration) OnResetState(ctx context.Context) { + log.Infof("%s L1BlockChecker: after a resetState relaunch background process", logPrefix) + v.launch(ctx) +} + +// CheckReorgWrapper is a wrapper over reorg function of synchronizer. +// it checks the result of the function and the result of background process and decides which return +func (v *L1BlockCheckerIntegration) CheckReorgWrapper(ctx context.Context, reorgFirstBlockOk *state.Block, errReportedByReorgFunc error) (*state.Block, error) { + resultBackground := v.getMergedResults() + if resultBackground != nil && resultBackground.ReorgDetected { + // Background process detected a reorg, decide which return + firstOkBlockBackgroundCheck, err := v.state.GetPreviousBlockToBlockNumber(ctx, resultBackground.BlockNumber, nil) + if err != nil { + log.Warnf("%s Error getting previous block to block number where a reorg have been detected %d: %s. So we reorgFunc values", logPrefix, resultBackground.BlockNumber, err) + return reorgFirstBlockOk, errReportedByReorgFunc + } + if reorgFirstBlockOk == nil || errReportedByReorgFunc != nil { + log.Infof("%s Background checker detects bad block at block %d (first block ok %d) and regular reorg function no. Returning it", logPrefix, + resultBackground.BlockNumber, firstOkBlockBackgroundCheck.BlockNumber) + return firstOkBlockBackgroundCheck, nil + } + if firstOkBlockBackgroundCheck.BlockNumber < reorgFirstBlockOk.BlockNumber { + // Background process detected a reorg at oldest block + log.Warnf("%s Background checker detects bad block at block %d (first block ok %d) and regular reorg function first block ok: %d. Returning from %d", + logPrefix, resultBackground.BlockNumber, firstOkBlockBackgroundCheck.BlockNumber, reorgFirstBlockOk.BlockNumber, firstOkBlockBackgroundCheck.BlockNumber) + return firstOkBlockBackgroundCheck, nil + } else { + // Regular reorg function detected a reorg at oldest block + log.Warnf("%s Background checker detects bad block at block %d (first block ok %d) and regular reorg function first block ok: %d. Executing from %d", + logPrefix, resultBackground.BlockNumber, firstOkBlockBackgroundCheck.BlockNumber, reorgFirstBlockOk.BlockNumber, reorgFirstBlockOk.BlockNumber) + return reorgFirstBlockOk, errReportedByReorgFunc + } + } + if resultBackground != nil && !resultBackground.ReorgDetected { + // Relaunch checker, if there is a reorg, It is going to be relaunched after (OnResetState) + v.launch(ctx) + } + // Background process doesnt have anything to we return the regular reorg function result + return reorgFirstBlockOk, errReportedByReorgFunc +} + +func (v *L1BlockCheckerIntegration) checkBackgroundResult(ctx context.Context, positionMessage string) bool { + log.Debugf("%s Checking L1BlockChecker %s", logPrefix, positionMessage) + result := v.getMergedResults() + if result != nil { + if result.ReorgDetected { + log.Warnf("%s Checking L1BlockChecker %s: reorg detected %s", logPrefix, positionMessage, result.String()) + v.executeResult(ctx, *result) + } + v.launch(ctx) + return result.ReorgDetected + } + return false +} + +func (v *L1BlockCheckerIntegration) getMergedResults() *syncinterfaces.IterationResult { + result := v.checker.GetResult() + var preResult *syncinterfaces.IterationResult + preResult = nil + if v.preChecker != nil { + preResult = v.preChecker.GetResult() + } + if preResult == nil { + return result + } + if result == nil { + return preResult + } + // result and preResult have values + if result.ReorgDetected && preResult.ReorgDetected { + // That is the common case, checker must detect oldest blocks than preChecker + if result.BlockNumber < preResult.BlockNumber { + return result + } + return preResult + } + if preResult.ReorgDetected { + return preResult + } + return result +} + +func (v *L1BlockCheckerIntegration) onFinishChecker() { + log.Infof("%s L1BlockChecker: finished background process, calling to synchronizer", logPrefix) + // Stop both processes + v.checker.Stop() + if v.preChecker != nil { + v.preChecker.Stop() + } + v.sync.OnDetectedMismatchL1BlockReorg() +} + +func (v *L1BlockCheckerIntegration) launch(ctx context.Context) { + log.Infof("%s L1BlockChecker: starting background process...", logPrefix) + v.checker.Run(ctx, v.onFinishChecker) + if v.preChecker != nil { + log.Infof("%s L1BlockChecker: starting background precheck process...", logPrefix) + v.preChecker.Run(ctx, v.onFinishChecker) + } +} + +func (v *L1BlockCheckerIntegration) executeResult(ctx context.Context, result syncinterfaces.IterationResult) bool { + if result.ReorgDetected { + for { + err := v.sync.ExecuteReorgFromMismatchBlock(result.BlockNumber, result.ReorgMessage) + if err == nil { + return true + } + log.Errorf("%s Error executing reorg: %s", logPrefix, err) + time.Sleep(v.timeBetweenRetries) + } + } + return false +} diff --git a/synchronizer/l1_check_block/integration_test.go b/synchronizer/l1_check_block/integration_test.go new file mode 100644 index 0000000000..de79c71351 --- /dev/null +++ b/synchronizer/l1_check_block/integration_test.go @@ -0,0 +1,298 @@ +package l1_check_block_test + +import ( + "context" + "fmt" + "testing" + "time" + + "github.com/0xPolygonHermez/zkevm-node/state" + "github.com/0xPolygonHermez/zkevm-node/synchronizer/common/syncinterfaces" + mock_syncinterfaces "github.com/0xPolygonHermez/zkevm-node/synchronizer/common/syncinterfaces/mocks" + "github.com/0xPolygonHermez/zkevm-node/synchronizer/l1_check_block" + mock_l1_check_block "github.com/0xPolygonHermez/zkevm-node/synchronizer/l1_check_block/mocks" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" +) + +var ( + genericErrorToTest = fmt.Errorf("error") +) + +type testDataIntegration struct { + mockChecker *mock_syncinterfaces.AsyncL1BlockChecker + mockPreChecker *mock_syncinterfaces.AsyncL1BlockChecker + mockState *mock_l1_check_block.StateForL1BlockCheckerIntegration + mockSync *mock_l1_check_block.SyncCheckReorger + sut *l1_check_block.L1BlockCheckerIntegration + ctx context.Context + resultOk syncinterfaces.IterationResult + resultError syncinterfaces.IterationResult + resultReorg syncinterfaces.IterationResult +} + +func newDataIntegration(t *testing.T, forceCheckOnStart bool) *testDataIntegration { + return newDataIntegrationOnlyMainChecker(t, forceCheckOnStart) +} + +func newDataIntegrationWithPreChecker(t *testing.T, forceCheckOnStart bool) *testDataIntegration { + res := newDataIntegrationOnlyMainChecker(t, forceCheckOnStart) + res.mockPreChecker = mock_syncinterfaces.NewAsyncL1BlockChecker(t) + res.sut = l1_check_block.NewL1BlockCheckerIntegration(res.mockChecker, res.mockPreChecker, res.mockState, res.mockSync, forceCheckOnStart, time.Millisecond) + return res +} + +func newDataIntegrationOnlyMainChecker(t *testing.T, forceCheckOnStart bool) *testDataIntegration { + mockChecker := mock_syncinterfaces.NewAsyncL1BlockChecker(t) + mockSync := mock_l1_check_block.NewSyncCheckReorger(t) + mockState := mock_l1_check_block.NewStateForL1BlockCheckerIntegration(t) + sut := l1_check_block.NewL1BlockCheckerIntegration(mockChecker, nil, mockState, mockSync, forceCheckOnStart, time.Millisecond) + return &testDataIntegration{ + mockChecker: mockChecker, + mockPreChecker: nil, + mockSync: mockSync, + mockState: mockState, + sut: sut, + ctx: context.Background(), + resultReorg: syncinterfaces.IterationResult{ + ReorgDetected: true, + BlockNumber: 1234, + }, + resultOk: syncinterfaces.IterationResult{ + ReorgDetected: false, + }, + resultError: syncinterfaces.IterationResult{ + Err: genericErrorToTest, + ReorgDetected: false, + }, + } +} + +func TestIntegrationIfNoForceCheckOnlyLaunchBackgroudChecker(t *testing.T) { + data := newDataIntegration(t, false) + data.mockChecker.EXPECT().Run(data.ctx, mock.Anything).Return() + err := data.sut.OnStart(data.ctx) + require.NoError(t, err) +} + +func TestIntegrationIfForceCheckRunsSynchronousOneTimeAndAfterLaunchBackgroudChecker(t *testing.T) { + data := newDataIntegration(t, true) + data.mockChecker.EXPECT().RunSynchronous(data.ctx).Return(data.resultOk) + data.mockChecker.EXPECT().Run(data.ctx, mock.Anything).Return() + err := data.sut.OnStart(data.ctx) + require.NoError(t, err) +} + +func TestIntegrationIfSyncCheckReturnsReorgExecuteIt(t *testing.T) { + data := newDataIntegration(t, true) + data.mockChecker.EXPECT().RunSynchronous(data.ctx).Return(data.resultReorg) + data.mockSync.EXPECT().ExecuteReorgFromMismatchBlock(uint64(1234), "").Return(nil) + data.mockChecker.EXPECT().Run(data.ctx, mock.Anything).Return() + err := data.sut.OnStart(data.ctx) + require.NoError(t, err) +} + +func TestIntegrationIfSyncCheckReturnErrorRetry(t *testing.T) { + data := newDataIntegration(t, true) + data.mockChecker.EXPECT().RunSynchronous(data.ctx).Return(data.resultError).Once() + data.mockChecker.EXPECT().RunSynchronous(data.ctx).Return(data.resultOk).Once() + data.mockChecker.EXPECT().Run(data.ctx, mock.Anything).Return() + err := data.sut.OnStart(data.ctx) + require.NoError(t, err) +} + +func TestIntegrationIfSyncCheckReturnsReorgExecuteItAndFailsRetry(t *testing.T) { + data := newDataIntegration(t, true) + data.mockChecker.EXPECT().RunSynchronous(data.ctx).Return(data.resultReorg) + data.mockSync.EXPECT().ExecuteReorgFromMismatchBlock(uint64(1234), mock.Anything).Return(genericErrorToTest).Once() + data.mockSync.EXPECT().ExecuteReorgFromMismatchBlock(uint64(1234), mock.Anything).Return(nil).Once() + data.mockChecker.EXPECT().Run(data.ctx, mock.Anything).Return() + err := data.sut.OnStart(data.ctx) + require.NoError(t, err) +} + +// OnStart if check and preCheck execute both, and launch both in background +func TestIntegrationCheckAndPreCheckOnStartForceCheck(t *testing.T) { + data := newDataIntegrationWithPreChecker(t, true) + data.mockChecker.EXPECT().RunSynchronous(data.ctx).Return(data.resultOk) + data.mockPreChecker.EXPECT().RunSynchronous(data.ctx).Return(data.resultOk) + data.mockChecker.EXPECT().Run(data.ctx, mock.Anything).Return() + data.mockPreChecker.EXPECT().Run(data.ctx, mock.Anything).Return() + err := data.sut.OnStart(data.ctx) + require.NoError(t, err) +} + +// OnStart if mainChecker returns reorg doesnt need to run preCheck +func TestIntegrationCheckAndPreCheckOnStartMainCheckerReturnReorg(t *testing.T) { + data := newDataIntegrationWithPreChecker(t, true) + data.mockChecker.EXPECT().RunSynchronous(data.ctx).Return(data.resultReorg) + data.mockSync.EXPECT().ExecuteReorgFromMismatchBlock(uint64(1234), mock.Anything).Return(nil).Once() + data.mockChecker.EXPECT().Run(data.ctx, mock.Anything).Return() + data.mockPreChecker.EXPECT().Run(data.ctx, mock.Anything).Return() + err := data.sut.OnStart(data.ctx) + require.NoError(t, err) +} + +// If mainCheck is OK, but preCheck returns reorg, it should execute reorg +func TestIntegrationCheckAndPreCheckOnStartPreCheckerReturnReorg(t *testing.T) { + data := newDataIntegrationWithPreChecker(t, true) + data.mockChecker.EXPECT().RunSynchronous(data.ctx).Return(data.resultOk) + data.mockPreChecker.EXPECT().RunSynchronous(data.ctx).Return(data.resultReorg) + data.mockSync.EXPECT().ExecuteReorgFromMismatchBlock(uint64(1234), mock.Anything).Return(nil).Once() + data.mockChecker.EXPECT().Run(data.ctx, mock.Anything).Return() + data.mockPreChecker.EXPECT().Run(data.ctx, mock.Anything).Return() + err := data.sut.OnStart(data.ctx) + require.NoError(t, err) +} + +// The process is running on background, no results yet +func TestIntegrationCheckAndPreCheckOnOnCheckReorgRunningOnBackground(t *testing.T) { + data := newDataIntegrationWithPreChecker(t, true) + data.mockChecker.EXPECT().GetResult().Return(nil) + data.mockPreChecker.EXPECT().GetResult().Return(nil) + block, err := data.sut.CheckReorgWrapper(data.ctx, nil, nil) + require.Nil(t, block) + require.NoError(t, err) +} + +func TestIntegrationCheckAndPreCheckOnOnCheckReorgOneProcessHaveResultOK(t *testing.T) { + data := newDataIntegrationWithPreChecker(t, true) + data.mockChecker.EXPECT().GetResult().Return(&data.resultOk) + data.mockPreChecker.EXPECT().GetResult().Return(nil) + // One have been stopped, so must relaunch both + data.mockChecker.EXPECT().Run(data.ctx, mock.Anything).Return() + data.mockPreChecker.EXPECT().Run(data.ctx, mock.Anything).Return() + block, err := data.sut.CheckReorgWrapper(data.ctx, nil, nil) + require.Nil(t, block) + require.NoError(t, err) +} + +func TestIntegrationCheckAndPreCheckOnOnCheckReorgMainCheckerReorg(t *testing.T) { + data := newDataIntegrationWithPreChecker(t, true) + data.mockChecker.EXPECT().GetResult().Return(&data.resultReorg) + data.mockPreChecker.EXPECT().GetResult().Return(nil) + data.mockState.EXPECT().GetPreviousBlockToBlockNumber(data.ctx, uint64(1234), nil).Return(&state.Block{ + BlockNumber: data.resultReorg.BlockNumber - 1, + }, nil) + // One have been stopped,but is going to be launched OnResetState call after the reset + block, err := data.sut.CheckReorgWrapper(data.ctx, nil, nil) + require.NotNil(t, block) + require.Equal(t, data.resultReorg.BlockNumber-1, block.BlockNumber) + require.NoError(t, err) +} + +func TestIntegrationCheckAndPreCheckOnOnCheckReorgPreCheckerReorg(t *testing.T) { + data := newDataIntegrationWithPreChecker(t, true) + data.mockChecker.EXPECT().GetResult().Return(nil) + data.mockPreChecker.EXPECT().GetResult().Return(&data.resultReorg) + data.mockState.EXPECT().GetPreviousBlockToBlockNumber(data.ctx, uint64(1234), nil).Return(&state.Block{ + BlockNumber: data.resultReorg.BlockNumber - 1, + }, nil) + // One have been stopped,but is going to be launched OnResetState call after the reset + + block, err := data.sut.CheckReorgWrapper(data.ctx, nil, nil) + require.NotNil(t, block) + require.Equal(t, data.resultReorg.BlockNumber-1, block.BlockNumber) + require.NoError(t, err) +} + +func TestIntegrationCheckAndPreCheckOnOnCheckReorgBothReorgWinOldest1(t *testing.T) { + data := newDataIntegrationWithPreChecker(t, true) + reorgMain := data.resultReorg + reorgMain.BlockNumber = 1235 + data.mockChecker.EXPECT().GetResult().Return(&reorgMain) + reorgPre := data.resultReorg + reorgPre.BlockNumber = 1236 + data.mockPreChecker.EXPECT().GetResult().Return(&reorgPre) + data.mockState.EXPECT().GetPreviousBlockToBlockNumber(data.ctx, uint64(1235), nil).Return(&state.Block{ + BlockNumber: 1234, + }, nil) + + // Both have been stopped,but is going to be launched OnResetState call after the reset + + block, err := data.sut.CheckReorgWrapper(data.ctx, nil, nil) + require.NotNil(t, block) + require.Equal(t, uint64(1234), block.BlockNumber) + require.NoError(t, err) +} + +func TestIntegrationCheckAndPreCheckOnOnCheckReorgBothReorgWinOldest2(t *testing.T) { + data := newDataIntegrationWithPreChecker(t, true) + reorgMain := data.resultReorg + reorgMain.BlockNumber = 1236 + data.mockChecker.EXPECT().GetResult().Return(&reorgMain) + reorgPre := data.resultReorg + reorgPre.BlockNumber = 1235 + data.mockPreChecker.EXPECT().GetResult().Return(&reorgPre) + data.mockState.EXPECT().GetPreviousBlockToBlockNumber(data.ctx, uint64(1235), nil).Return(&state.Block{ + BlockNumber: 1234, + }, nil) + // Both have been stopped,but is going to be launched OnResetState call after the reset + + block, err := data.sut.CheckReorgWrapper(data.ctx, nil, nil) + require.NotNil(t, block) + require.Equal(t, uint64(1234), block.BlockNumber) + require.NoError(t, err) +} + +func TestIntegrationCheckReorgWrapperBypassReorgFuncIfNoBackgroundData(t *testing.T) { + data := newDataIntegrationWithPreChecker(t, true) + data.mockChecker.EXPECT().GetResult().Return(nil) + data.mockPreChecker.EXPECT().GetResult().Return(nil) + reorgFuncBlock := &state.Block{ + BlockNumber: 1234, + } + reorgFuncErr := fmt.Errorf("error") + block, err := data.sut.CheckReorgWrapper(data.ctx, reorgFuncBlock, reorgFuncErr) + require.Equal(t, reorgFuncBlock, block) + require.Equal(t, reorgFuncErr, err) +} + +func TestIntegrationCheckReorgWrapperChooseOldestReorgFunc(t *testing.T) { + data := newDataIntegrationWithPreChecker(t, true) + data.mockChecker.EXPECT().GetResult().Return(nil) + data.mockPreChecker.EXPECT().GetResult().Return(&data.resultReorg) + data.mockState.EXPECT().GetPreviousBlockToBlockNumber(data.ctx, uint64(1234), nil).Return(&state.Block{ + BlockNumber: 1233, + }, nil) + + reorgFuncBlock := &state.Block{ + BlockNumber: 1230, + } + block, err := data.sut.CheckReorgWrapper(data.ctx, reorgFuncBlock, nil) + require.Equal(t, reorgFuncBlock, block) + require.NoError(t, err) +} + +func TestIntegrationCheckReorgWrapperChooseOldestBackgroundCheck(t *testing.T) { + data := newDataIntegrationWithPreChecker(t, true) + data.mockChecker.EXPECT().GetResult().Return(nil) + data.mockPreChecker.EXPECT().GetResult().Return(&data.resultReorg) + data.mockState.EXPECT().GetPreviousBlockToBlockNumber(data.ctx, uint64(1234), nil).Return(&state.Block{ + BlockNumber: 1233, + }, nil) + + reorgFuncBlock := &state.Block{ + BlockNumber: 1240, + } + block, err := data.sut.CheckReorgWrapper(data.ctx, reorgFuncBlock, nil) + require.Equal(t, uint64(1233), block.BlockNumber) + require.NoError(t, err) +} + +func TestIntegrationCheckReorgWrapperIgnoreReorgFuncIfError(t *testing.T) { + data := newDataIntegrationWithPreChecker(t, true) + data.mockChecker.EXPECT().GetResult().Return(nil) + data.mockPreChecker.EXPECT().GetResult().Return(&data.resultReorg) + data.mockState.EXPECT().GetPreviousBlockToBlockNumber(data.ctx, uint64(1234), nil).Return(&state.Block{ + BlockNumber: 1233, + }, nil) + + reorgFuncBlock := &state.Block{ + BlockNumber: 1230, + } + reorgFuncErr := fmt.Errorf("error") + block, err := data.sut.CheckReorgWrapper(data.ctx, reorgFuncBlock, reorgFuncErr) + require.Equal(t, uint64(1233), block.BlockNumber) + require.NoError(t, err) +} diff --git a/synchronizer/l1_check_block/mocks/l1_block_checker.go b/synchronizer/l1_check_block/mocks/l1_block_checker.go new file mode 100644 index 0000000000..6f0eab9acb --- /dev/null +++ b/synchronizer/l1_check_block/mocks/l1_block_checker.go @@ -0,0 +1,82 @@ +// Code generated by mockery. DO NOT EDIT. + +package mock_l1_check_block + +import ( + context "context" + + mock "github.com/stretchr/testify/mock" +) + +// L1BlockChecker is an autogenerated mock type for the L1BlockChecker type +type L1BlockChecker struct { + mock.Mock +} + +type L1BlockChecker_Expecter struct { + mock *mock.Mock +} + +func (_m *L1BlockChecker) EXPECT() *L1BlockChecker_Expecter { + return &L1BlockChecker_Expecter{mock: &_m.Mock} +} + +// Step provides a mock function with given fields: ctx +func (_m *L1BlockChecker) Step(ctx context.Context) error { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for Step") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context) error); ok { + r0 = rf(ctx) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// L1BlockChecker_Step_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Step' +type L1BlockChecker_Step_Call struct { + *mock.Call +} + +// Step is a helper method to define mock.On call +// - ctx context.Context +func (_e *L1BlockChecker_Expecter) Step(ctx interface{}) *L1BlockChecker_Step_Call { + return &L1BlockChecker_Step_Call{Call: _e.mock.On("Step", ctx)} +} + +func (_c *L1BlockChecker_Step_Call) Run(run func(ctx context.Context)) *L1BlockChecker_Step_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *L1BlockChecker_Step_Call) Return(_a0 error) *L1BlockChecker_Step_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *L1BlockChecker_Step_Call) RunAndReturn(run func(context.Context) error) *L1BlockChecker_Step_Call { + _c.Call.Return(run) + return _c +} + +// NewL1BlockChecker creates a new instance of L1BlockChecker. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewL1BlockChecker(t interface { + mock.TestingT + Cleanup(func()) +}) *L1BlockChecker { + mock := &L1BlockChecker{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/synchronizer/l1_check_block/mocks/l1_requester.go b/synchronizer/l1_check_block/mocks/l1_requester.go new file mode 100644 index 0000000000..713cc4a5ef --- /dev/null +++ b/synchronizer/l1_check_block/mocks/l1_requester.go @@ -0,0 +1,98 @@ +// Code generated by mockery. DO NOT EDIT. + +package mock_l1_check_block + +import ( + context "context" + big "math/big" + + mock "github.com/stretchr/testify/mock" + + types "github.com/ethereum/go-ethereum/core/types" +) + +// L1Requester is an autogenerated mock type for the L1Requester type +type L1Requester struct { + mock.Mock +} + +type L1Requester_Expecter struct { + mock *mock.Mock +} + +func (_m *L1Requester) EXPECT() *L1Requester_Expecter { + return &L1Requester_Expecter{mock: &_m.Mock} +} + +// HeaderByNumber provides a mock function with given fields: ctx, number +func (_m *L1Requester) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error) { + ret := _m.Called(ctx, number) + + if len(ret) == 0 { + panic("no return value specified for HeaderByNumber") + } + + var r0 *types.Header + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *big.Int) (*types.Header, error)); ok { + return rf(ctx, number) + } + if rf, ok := ret.Get(0).(func(context.Context, *big.Int) *types.Header); ok { + r0 = rf(ctx, number) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Header) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *big.Int) error); ok { + r1 = rf(ctx, number) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// L1Requester_HeaderByNumber_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HeaderByNumber' +type L1Requester_HeaderByNumber_Call struct { + *mock.Call +} + +// HeaderByNumber is a helper method to define mock.On call +// - ctx context.Context +// - number *big.Int +func (_e *L1Requester_Expecter) HeaderByNumber(ctx interface{}, number interface{}) *L1Requester_HeaderByNumber_Call { + return &L1Requester_HeaderByNumber_Call{Call: _e.mock.On("HeaderByNumber", ctx, number)} +} + +func (_c *L1Requester_HeaderByNumber_Call) Run(run func(ctx context.Context, number *big.Int)) *L1Requester_HeaderByNumber_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*big.Int)) + }) + return _c +} + +func (_c *L1Requester_HeaderByNumber_Call) Return(_a0 *types.Header, _a1 error) *L1Requester_HeaderByNumber_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *L1Requester_HeaderByNumber_Call) RunAndReturn(run func(context.Context, *big.Int) (*types.Header, error)) *L1Requester_HeaderByNumber_Call { + _c.Call.Return(run) + return _c +} + +// NewL1Requester creates a new instance of L1Requester. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewL1Requester(t interface { + mock.TestingT + Cleanup(func()) +}) *L1Requester { + mock := &L1Requester{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/synchronizer/l1_check_block/mocks/safe_l1_block_number_fetcher.go b/synchronizer/l1_check_block/mocks/safe_l1_block_number_fetcher.go new file mode 100644 index 0000000000..abb043afb4 --- /dev/null +++ b/synchronizer/l1_check_block/mocks/safe_l1_block_number_fetcher.go @@ -0,0 +1,139 @@ +// Code generated by mockery. DO NOT EDIT. + +package mock_l1_check_block + +import ( + context "context" + + l1_check_block "github.com/0xPolygonHermez/zkevm-node/synchronizer/l1_check_block" + mock "github.com/stretchr/testify/mock" +) + +// SafeL1BlockNumberFetcher is an autogenerated mock type for the SafeL1BlockNumberFetcher type +type SafeL1BlockNumberFetcher struct { + mock.Mock +} + +type SafeL1BlockNumberFetcher_Expecter struct { + mock *mock.Mock +} + +func (_m *SafeL1BlockNumberFetcher) EXPECT() *SafeL1BlockNumberFetcher_Expecter { + return &SafeL1BlockNumberFetcher_Expecter{mock: &_m.Mock} +} + +// Description provides a mock function with given fields: +func (_m *SafeL1BlockNumberFetcher) Description() string { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Description") + } + + var r0 string + if rf, ok := ret.Get(0).(func() string); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// SafeL1BlockNumberFetcher_Description_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Description' +type SafeL1BlockNumberFetcher_Description_Call struct { + *mock.Call +} + +// Description is a helper method to define mock.On call +func (_e *SafeL1BlockNumberFetcher_Expecter) Description() *SafeL1BlockNumberFetcher_Description_Call { + return &SafeL1BlockNumberFetcher_Description_Call{Call: _e.mock.On("Description")} +} + +func (_c *SafeL1BlockNumberFetcher_Description_Call) Run(run func()) *SafeL1BlockNumberFetcher_Description_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *SafeL1BlockNumberFetcher_Description_Call) Return(_a0 string) *SafeL1BlockNumberFetcher_Description_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *SafeL1BlockNumberFetcher_Description_Call) RunAndReturn(run func() string) *SafeL1BlockNumberFetcher_Description_Call { + _c.Call.Return(run) + return _c +} + +// GetSafeBlockNumber provides a mock function with given fields: ctx, l1Client +func (_m *SafeL1BlockNumberFetcher) GetSafeBlockNumber(ctx context.Context, l1Client l1_check_block.L1Requester) (uint64, error) { + ret := _m.Called(ctx, l1Client) + + if len(ret) == 0 { + panic("no return value specified for GetSafeBlockNumber") + } + + var r0 uint64 + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, l1_check_block.L1Requester) (uint64, error)); ok { + return rf(ctx, l1Client) + } + if rf, ok := ret.Get(0).(func(context.Context, l1_check_block.L1Requester) uint64); ok { + r0 = rf(ctx, l1Client) + } else { + r0 = ret.Get(0).(uint64) + } + + if rf, ok := ret.Get(1).(func(context.Context, l1_check_block.L1Requester) error); ok { + r1 = rf(ctx, l1Client) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SafeL1BlockNumberFetcher_GetSafeBlockNumber_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSafeBlockNumber' +type SafeL1BlockNumberFetcher_GetSafeBlockNumber_Call struct { + *mock.Call +} + +// GetSafeBlockNumber is a helper method to define mock.On call +// - ctx context.Context +// - l1Client l1_check_block.L1Requester +func (_e *SafeL1BlockNumberFetcher_Expecter) GetSafeBlockNumber(ctx interface{}, l1Client interface{}) *SafeL1BlockNumberFetcher_GetSafeBlockNumber_Call { + return &SafeL1BlockNumberFetcher_GetSafeBlockNumber_Call{Call: _e.mock.On("GetSafeBlockNumber", ctx, l1Client)} +} + +func (_c *SafeL1BlockNumberFetcher_GetSafeBlockNumber_Call) Run(run func(ctx context.Context, l1Client l1_check_block.L1Requester)) *SafeL1BlockNumberFetcher_GetSafeBlockNumber_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(l1_check_block.L1Requester)) + }) + return _c +} + +func (_c *SafeL1BlockNumberFetcher_GetSafeBlockNumber_Call) Return(_a0 uint64, _a1 error) *SafeL1BlockNumberFetcher_GetSafeBlockNumber_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SafeL1BlockNumberFetcher_GetSafeBlockNumber_Call) RunAndReturn(run func(context.Context, l1_check_block.L1Requester) (uint64, error)) *SafeL1BlockNumberFetcher_GetSafeBlockNumber_Call { + _c.Call.Return(run) + return _c +} + +// NewSafeL1BlockNumberFetcher creates a new instance of SafeL1BlockNumberFetcher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewSafeL1BlockNumberFetcher(t interface { + mock.TestingT + Cleanup(func()) +}) *SafeL1BlockNumberFetcher { + mock := &SafeL1BlockNumberFetcher{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/synchronizer/l1_check_block/mocks/state_for_l1_block_checker_integration.go b/synchronizer/l1_check_block/mocks/state_for_l1_block_checker_integration.go new file mode 100644 index 0000000000..32fbb30b86 --- /dev/null +++ b/synchronizer/l1_check_block/mocks/state_for_l1_block_checker_integration.go @@ -0,0 +1,100 @@ +// Code generated by mockery. DO NOT EDIT. + +package mock_l1_check_block + +import ( + context "context" + + mock "github.com/stretchr/testify/mock" + + pgx "github.com/jackc/pgx/v4" + + state "github.com/0xPolygonHermez/zkevm-node/state" +) + +// StateForL1BlockCheckerIntegration is an autogenerated mock type for the StateForL1BlockCheckerIntegration type +type StateForL1BlockCheckerIntegration struct { + mock.Mock +} + +type StateForL1BlockCheckerIntegration_Expecter struct { + mock *mock.Mock +} + +func (_m *StateForL1BlockCheckerIntegration) EXPECT() *StateForL1BlockCheckerIntegration_Expecter { + return &StateForL1BlockCheckerIntegration_Expecter{mock: &_m.Mock} +} + +// GetPreviousBlockToBlockNumber provides a mock function with given fields: ctx, blockNumber, dbTx +func (_m *StateForL1BlockCheckerIntegration) GetPreviousBlockToBlockNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*state.Block, error) { + ret := _m.Called(ctx, blockNumber, dbTx) + + if len(ret) == 0 { + panic("no return value specified for GetPreviousBlockToBlockNumber") + } + + var r0 *state.Block + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, uint64, pgx.Tx) (*state.Block, error)); ok { + return rf(ctx, blockNumber, dbTx) + } + if rf, ok := ret.Get(0).(func(context.Context, uint64, pgx.Tx) *state.Block); ok { + r0 = rf(ctx, blockNumber, dbTx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*state.Block) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, uint64, pgx.Tx) error); ok { + r1 = rf(ctx, blockNumber, dbTx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// StateForL1BlockCheckerIntegration_GetPreviousBlockToBlockNumber_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPreviousBlockToBlockNumber' +type StateForL1BlockCheckerIntegration_GetPreviousBlockToBlockNumber_Call struct { + *mock.Call +} + +// GetPreviousBlockToBlockNumber is a helper method to define mock.On call +// - ctx context.Context +// - blockNumber uint64 +// - dbTx pgx.Tx +func (_e *StateForL1BlockCheckerIntegration_Expecter) GetPreviousBlockToBlockNumber(ctx interface{}, blockNumber interface{}, dbTx interface{}) *StateForL1BlockCheckerIntegration_GetPreviousBlockToBlockNumber_Call { + return &StateForL1BlockCheckerIntegration_GetPreviousBlockToBlockNumber_Call{Call: _e.mock.On("GetPreviousBlockToBlockNumber", ctx, blockNumber, dbTx)} +} + +func (_c *StateForL1BlockCheckerIntegration_GetPreviousBlockToBlockNumber_Call) Run(run func(ctx context.Context, blockNumber uint64, dbTx pgx.Tx)) *StateForL1BlockCheckerIntegration_GetPreviousBlockToBlockNumber_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint64), args[2].(pgx.Tx)) + }) + return _c +} + +func (_c *StateForL1BlockCheckerIntegration_GetPreviousBlockToBlockNumber_Call) Return(_a0 *state.Block, _a1 error) *StateForL1BlockCheckerIntegration_GetPreviousBlockToBlockNumber_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *StateForL1BlockCheckerIntegration_GetPreviousBlockToBlockNumber_Call) RunAndReturn(run func(context.Context, uint64, pgx.Tx) (*state.Block, error)) *StateForL1BlockCheckerIntegration_GetPreviousBlockToBlockNumber_Call { + _c.Call.Return(run) + return _c +} + +// NewStateForL1BlockCheckerIntegration creates a new instance of StateForL1BlockCheckerIntegration. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewStateForL1BlockCheckerIntegration(t interface { + mock.TestingT + Cleanup(func()) +}) *StateForL1BlockCheckerIntegration { + mock := &StateForL1BlockCheckerIntegration{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/synchronizer/l1_check_block/mocks/state_interfacer.go b/synchronizer/l1_check_block/mocks/state_interfacer.go new file mode 100644 index 0000000000..4855ba5eb1 --- /dev/null +++ b/synchronizer/l1_check_block/mocks/state_interfacer.go @@ -0,0 +1,149 @@ +// Code generated by mockery. DO NOT EDIT. + +package mock_l1_check_block + +import ( + context "context" + + mock "github.com/stretchr/testify/mock" + + pgx "github.com/jackc/pgx/v4" + + state "github.com/0xPolygonHermez/zkevm-node/state" +) + +// StateInterfacer is an autogenerated mock type for the StateInterfacer type +type StateInterfacer struct { + mock.Mock +} + +type StateInterfacer_Expecter struct { + mock *mock.Mock +} + +func (_m *StateInterfacer) EXPECT() *StateInterfacer_Expecter { + return &StateInterfacer_Expecter{mock: &_m.Mock} +} + +// GetFirstUncheckedBlock provides a mock function with given fields: ctx, fromBlockNumber, dbTx +func (_m *StateInterfacer) GetFirstUncheckedBlock(ctx context.Context, fromBlockNumber uint64, dbTx pgx.Tx) (*state.Block, error) { + ret := _m.Called(ctx, fromBlockNumber, dbTx) + + if len(ret) == 0 { + panic("no return value specified for GetFirstUncheckedBlock") + } + + var r0 *state.Block + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, uint64, pgx.Tx) (*state.Block, error)); ok { + return rf(ctx, fromBlockNumber, dbTx) + } + if rf, ok := ret.Get(0).(func(context.Context, uint64, pgx.Tx) *state.Block); ok { + r0 = rf(ctx, fromBlockNumber, dbTx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*state.Block) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, uint64, pgx.Tx) error); ok { + r1 = rf(ctx, fromBlockNumber, dbTx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// StateInterfacer_GetFirstUncheckedBlock_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFirstUncheckedBlock' +type StateInterfacer_GetFirstUncheckedBlock_Call struct { + *mock.Call +} + +// GetFirstUncheckedBlock is a helper method to define mock.On call +// - ctx context.Context +// - fromBlockNumber uint64 +// - dbTx pgx.Tx +func (_e *StateInterfacer_Expecter) GetFirstUncheckedBlock(ctx interface{}, fromBlockNumber interface{}, dbTx interface{}) *StateInterfacer_GetFirstUncheckedBlock_Call { + return &StateInterfacer_GetFirstUncheckedBlock_Call{Call: _e.mock.On("GetFirstUncheckedBlock", ctx, fromBlockNumber, dbTx)} +} + +func (_c *StateInterfacer_GetFirstUncheckedBlock_Call) Run(run func(ctx context.Context, fromBlockNumber uint64, dbTx pgx.Tx)) *StateInterfacer_GetFirstUncheckedBlock_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint64), args[2].(pgx.Tx)) + }) + return _c +} + +func (_c *StateInterfacer_GetFirstUncheckedBlock_Call) Return(_a0 *state.Block, _a1 error) *StateInterfacer_GetFirstUncheckedBlock_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *StateInterfacer_GetFirstUncheckedBlock_Call) RunAndReturn(run func(context.Context, uint64, pgx.Tx) (*state.Block, error)) *StateInterfacer_GetFirstUncheckedBlock_Call { + _c.Call.Return(run) + return _c +} + +// UpdateCheckedBlockByNumber provides a mock function with given fields: ctx, blockNumber, newCheckedStatus, dbTx +func (_m *StateInterfacer) UpdateCheckedBlockByNumber(ctx context.Context, blockNumber uint64, newCheckedStatus bool, dbTx pgx.Tx) error { + ret := _m.Called(ctx, blockNumber, newCheckedStatus, dbTx) + + if len(ret) == 0 { + panic("no return value specified for UpdateCheckedBlockByNumber") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, uint64, bool, pgx.Tx) error); ok { + r0 = rf(ctx, blockNumber, newCheckedStatus, dbTx) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// StateInterfacer_UpdateCheckedBlockByNumber_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateCheckedBlockByNumber' +type StateInterfacer_UpdateCheckedBlockByNumber_Call struct { + *mock.Call +} + +// UpdateCheckedBlockByNumber is a helper method to define mock.On call +// - ctx context.Context +// - blockNumber uint64 +// - newCheckedStatus bool +// - dbTx pgx.Tx +func (_e *StateInterfacer_Expecter) UpdateCheckedBlockByNumber(ctx interface{}, blockNumber interface{}, newCheckedStatus interface{}, dbTx interface{}) *StateInterfacer_UpdateCheckedBlockByNumber_Call { + return &StateInterfacer_UpdateCheckedBlockByNumber_Call{Call: _e.mock.On("UpdateCheckedBlockByNumber", ctx, blockNumber, newCheckedStatus, dbTx)} +} + +func (_c *StateInterfacer_UpdateCheckedBlockByNumber_Call) Run(run func(ctx context.Context, blockNumber uint64, newCheckedStatus bool, dbTx pgx.Tx)) *StateInterfacer_UpdateCheckedBlockByNumber_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint64), args[2].(bool), args[3].(pgx.Tx)) + }) + return _c +} + +func (_c *StateInterfacer_UpdateCheckedBlockByNumber_Call) Return(_a0 error) *StateInterfacer_UpdateCheckedBlockByNumber_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *StateInterfacer_UpdateCheckedBlockByNumber_Call) RunAndReturn(run func(context.Context, uint64, bool, pgx.Tx) error) *StateInterfacer_UpdateCheckedBlockByNumber_Call { + _c.Call.Return(run) + return _c +} + +// NewStateInterfacer creates a new instance of StateInterfacer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewStateInterfacer(t interface { + mock.TestingT + Cleanup(func()) +}) *StateInterfacer { + mock := &StateInterfacer{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/synchronizer/l1_check_block/mocks/state_pre_check_interfacer.go b/synchronizer/l1_check_block/mocks/state_pre_check_interfacer.go new file mode 100644 index 0000000000..2bf5522f60 --- /dev/null +++ b/synchronizer/l1_check_block/mocks/state_pre_check_interfacer.go @@ -0,0 +1,101 @@ +// Code generated by mockery. DO NOT EDIT. + +package mock_l1_check_block + +import ( + context "context" + + mock "github.com/stretchr/testify/mock" + + pgx "github.com/jackc/pgx/v4" + + state "github.com/0xPolygonHermez/zkevm-node/state" +) + +// StatePreCheckInterfacer is an autogenerated mock type for the StatePreCheckInterfacer type +type StatePreCheckInterfacer struct { + mock.Mock +} + +type StatePreCheckInterfacer_Expecter struct { + mock *mock.Mock +} + +func (_m *StatePreCheckInterfacer) EXPECT() *StatePreCheckInterfacer_Expecter { + return &StatePreCheckInterfacer_Expecter{mock: &_m.Mock} +} + +// GetUncheckedBlocks provides a mock function with given fields: ctx, fromBlockNumber, toBlockNumber, dbTx +func (_m *StatePreCheckInterfacer) GetUncheckedBlocks(ctx context.Context, fromBlockNumber uint64, toBlockNumber uint64, dbTx pgx.Tx) ([]*state.Block, error) { + ret := _m.Called(ctx, fromBlockNumber, toBlockNumber, dbTx) + + if len(ret) == 0 { + panic("no return value specified for GetUncheckedBlocks") + } + + var r0 []*state.Block + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, uint64, uint64, pgx.Tx) ([]*state.Block, error)); ok { + return rf(ctx, fromBlockNumber, toBlockNumber, dbTx) + } + if rf, ok := ret.Get(0).(func(context.Context, uint64, uint64, pgx.Tx) []*state.Block); ok { + r0 = rf(ctx, fromBlockNumber, toBlockNumber, dbTx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*state.Block) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, uint64, uint64, pgx.Tx) error); ok { + r1 = rf(ctx, fromBlockNumber, toBlockNumber, dbTx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// StatePreCheckInterfacer_GetUncheckedBlocks_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUncheckedBlocks' +type StatePreCheckInterfacer_GetUncheckedBlocks_Call struct { + *mock.Call +} + +// GetUncheckedBlocks is a helper method to define mock.On call +// - ctx context.Context +// - fromBlockNumber uint64 +// - toBlockNumber uint64 +// - dbTx pgx.Tx +func (_e *StatePreCheckInterfacer_Expecter) GetUncheckedBlocks(ctx interface{}, fromBlockNumber interface{}, toBlockNumber interface{}, dbTx interface{}) *StatePreCheckInterfacer_GetUncheckedBlocks_Call { + return &StatePreCheckInterfacer_GetUncheckedBlocks_Call{Call: _e.mock.On("GetUncheckedBlocks", ctx, fromBlockNumber, toBlockNumber, dbTx)} +} + +func (_c *StatePreCheckInterfacer_GetUncheckedBlocks_Call) Run(run func(ctx context.Context, fromBlockNumber uint64, toBlockNumber uint64, dbTx pgx.Tx)) *StatePreCheckInterfacer_GetUncheckedBlocks_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint64), args[2].(uint64), args[3].(pgx.Tx)) + }) + return _c +} + +func (_c *StatePreCheckInterfacer_GetUncheckedBlocks_Call) Return(_a0 []*state.Block, _a1 error) *StatePreCheckInterfacer_GetUncheckedBlocks_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *StatePreCheckInterfacer_GetUncheckedBlocks_Call) RunAndReturn(run func(context.Context, uint64, uint64, pgx.Tx) ([]*state.Block, error)) *StatePreCheckInterfacer_GetUncheckedBlocks_Call { + _c.Call.Return(run) + return _c +} + +// NewStatePreCheckInterfacer creates a new instance of StatePreCheckInterfacer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewStatePreCheckInterfacer(t interface { + mock.TestingT + Cleanup(func()) +}) *StatePreCheckInterfacer { + mock := &StatePreCheckInterfacer{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/synchronizer/l1_check_block/mocks/sync_check_reorger.go b/synchronizer/l1_check_block/mocks/sync_check_reorger.go new file mode 100644 index 0000000000..bffd02cb87 --- /dev/null +++ b/synchronizer/l1_check_block/mocks/sync_check_reorger.go @@ -0,0 +1,111 @@ +// Code generated by mockery. DO NOT EDIT. + +package mock_l1_check_block + +import mock "github.com/stretchr/testify/mock" + +// SyncCheckReorger is an autogenerated mock type for the SyncCheckReorger type +type SyncCheckReorger struct { + mock.Mock +} + +type SyncCheckReorger_Expecter struct { + mock *mock.Mock +} + +func (_m *SyncCheckReorger) EXPECT() *SyncCheckReorger_Expecter { + return &SyncCheckReorger_Expecter{mock: &_m.Mock} +} + +// ExecuteReorgFromMismatchBlock provides a mock function with given fields: blockNumber, reason +func (_m *SyncCheckReorger) ExecuteReorgFromMismatchBlock(blockNumber uint64, reason string) error { + ret := _m.Called(blockNumber, reason) + + if len(ret) == 0 { + panic("no return value specified for ExecuteReorgFromMismatchBlock") + } + + var r0 error + if rf, ok := ret.Get(0).(func(uint64, string) error); ok { + r0 = rf(blockNumber, reason) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SyncCheckReorger_ExecuteReorgFromMismatchBlock_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExecuteReorgFromMismatchBlock' +type SyncCheckReorger_ExecuteReorgFromMismatchBlock_Call struct { + *mock.Call +} + +// ExecuteReorgFromMismatchBlock is a helper method to define mock.On call +// - blockNumber uint64 +// - reason string +func (_e *SyncCheckReorger_Expecter) ExecuteReorgFromMismatchBlock(blockNumber interface{}, reason interface{}) *SyncCheckReorger_ExecuteReorgFromMismatchBlock_Call { + return &SyncCheckReorger_ExecuteReorgFromMismatchBlock_Call{Call: _e.mock.On("ExecuteReorgFromMismatchBlock", blockNumber, reason)} +} + +func (_c *SyncCheckReorger_ExecuteReorgFromMismatchBlock_Call) Run(run func(blockNumber uint64, reason string)) *SyncCheckReorger_ExecuteReorgFromMismatchBlock_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint64), args[1].(string)) + }) + return _c +} + +func (_c *SyncCheckReorger_ExecuteReorgFromMismatchBlock_Call) Return(_a0 error) *SyncCheckReorger_ExecuteReorgFromMismatchBlock_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *SyncCheckReorger_ExecuteReorgFromMismatchBlock_Call) RunAndReturn(run func(uint64, string) error) *SyncCheckReorger_ExecuteReorgFromMismatchBlock_Call { + _c.Call.Return(run) + return _c +} + +// OnDetectedMismatchL1BlockReorg provides a mock function with given fields: +func (_m *SyncCheckReorger) OnDetectedMismatchL1BlockReorg() { + _m.Called() +} + +// SyncCheckReorger_OnDetectedMismatchL1BlockReorg_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OnDetectedMismatchL1BlockReorg' +type SyncCheckReorger_OnDetectedMismatchL1BlockReorg_Call struct { + *mock.Call +} + +// OnDetectedMismatchL1BlockReorg is a helper method to define mock.On call +func (_e *SyncCheckReorger_Expecter) OnDetectedMismatchL1BlockReorg() *SyncCheckReorger_OnDetectedMismatchL1BlockReorg_Call { + return &SyncCheckReorger_OnDetectedMismatchL1BlockReorg_Call{Call: _e.mock.On("OnDetectedMismatchL1BlockReorg")} +} + +func (_c *SyncCheckReorger_OnDetectedMismatchL1BlockReorg_Call) Run(run func()) *SyncCheckReorger_OnDetectedMismatchL1BlockReorg_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *SyncCheckReorger_OnDetectedMismatchL1BlockReorg_Call) Return() *SyncCheckReorger_OnDetectedMismatchL1BlockReorg_Call { + _c.Call.Return() + return _c +} + +func (_c *SyncCheckReorger_OnDetectedMismatchL1BlockReorg_Call) RunAndReturn(run func()) *SyncCheckReorger_OnDetectedMismatchL1BlockReorg_Call { + _c.Call.Return(run) + return _c +} + +// NewSyncCheckReorger creates a new instance of SyncCheckReorger. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewSyncCheckReorger(t interface { + mock.TestingT + Cleanup(func()) +}) *SyncCheckReorger { + mock := &SyncCheckReorger{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/synchronizer/l1_check_block/pre_check_l1block.go b/synchronizer/l1_check_block/pre_check_l1block.go new file mode 100644 index 0000000000..431777f705 --- /dev/null +++ b/synchronizer/l1_check_block/pre_check_l1block.go @@ -0,0 +1,139 @@ +package l1_check_block + +// This make a pre-check of blocks but don't mark them as checked +// It checks blocks between a segment: example: +// real check point SAFE: +// pre check: (SAFE+1) -> (LATEST-32) +// It gets all pending blocks +// - Start cheking + +import ( + "context" + "errors" + "fmt" + "time" + + "github.com/0xPolygonHermez/zkevm-node/log" + "github.com/0xPolygonHermez/zkevm-node/state" + "github.com/0xPolygonHermez/zkevm-node/synchronizer/common" + "github.com/jackc/pgx/v4" +) + +var ( + // ErrDeSync is an error that indicates that from the starting of verification to end something have been changed on state + ErrDeSync = errors.New("DeSync: a block hash is different from the state block hash") +) + +// StatePreCheckInterfacer is an interface for the state +type StatePreCheckInterfacer interface { + GetUncheckedBlocks(ctx context.Context, fromBlockNumber uint64, toBlockNumber uint64, dbTx pgx.Tx) ([]*state.Block, error) +} + +// PreCheckL1BlockHash is a struct that implements a checker of L1Block hash +type PreCheckL1BlockHash struct { + L1Client L1Requester + State StatePreCheckInterfacer + InitialSegmentBlockNumber SafeL1BlockNumberFetcher + EndSegmentBlockNumber SafeL1BlockNumberFetcher +} + +// NewPreCheckL1BlockHash creates a new CheckL1BlockHash +func NewPreCheckL1BlockHash(l1Client L1Requester, state StatePreCheckInterfacer, + initial, end SafeL1BlockNumberFetcher) *PreCheckL1BlockHash { + return &PreCheckL1BlockHash{ + L1Client: l1Client, + State: state, + InitialSegmentBlockNumber: initial, + EndSegmentBlockNumber: end, + } +} + +// Name is a method that returns the name of the checker +func (p *PreCheckL1BlockHash) Name() string { + return logPrefix + ":memory_check: " +} + +// Step is a method that checks the L1 block hash, run until all blocks are checked and returns +func (p *PreCheckL1BlockHash) Step(ctx context.Context) error { + from, err := p.InitialSegmentBlockNumber.GetSafeBlockNumber(ctx, p.L1Client) + if err != nil { + return err + } + to, err := p.EndSegmentBlockNumber.GetSafeBlockNumber(ctx, p.L1Client) + if err != nil { + return err + } + if from > to { + log.Warnf("%s: fromBlockNumber(%s) %d is greater than toBlockNumber(%s) %d, Check configuration", p.Name(), p.InitialSegmentBlockNumber.Description(), from, p.EndSegmentBlockNumber.Description(), to) + return nil + } + + blocksToCheck, err := p.State.GetUncheckedBlocks(ctx, from, to, nil) + if err != nil { + log.Warnf("%s can't get unchecked blocks, so it discard the reorg error", p.Name()) + return err + } + msg := fmt.Sprintf("%s: Checking blocks from (%s) %d to (%s) %d -> len(blocks)=%d", p.Name(), p.InitialSegmentBlockNumber.Description(), from, p.EndSegmentBlockNumber.Description(), to, len(blocksToCheck)) + if len(blocksToCheck) == 0 { + log.Debugf(msg) + return nil + } + log.Infof(msg) + startTime := time.Now() + for _, block := range blocksToCheck { + // check block + err = CheckBlockHash(ctx, block, p.L1Client, p.Name()) + if common.IsReorgError(err) { + // Double-check the state block that still is the same + log.Debugf("%s: Reorg detected at blockNumber: %d, checking that the block on State doesn't have change", p.Name(), block.BlockNumber) + isTheSame, errBlockIsTheSame := p.checkThatStateBlockIsTheSame(ctx, block) + if errBlockIsTheSame != nil { + log.Warnf("%s can't double-check that blockNumber %d haven't changed, so it discard the reorg error", p.Name(), block.BlockNumber) + return err + } + if !isTheSame { + log.Infof("%s: DeSync detected, blockNumber: %d is different now that when we started the check", p.Name(), block.BlockNumber) + return ErrDeSync + } + log.Infof("%s: Reorg detected and verified the state block, blockNumber: %d", p.Name(), block.BlockNumber) + return err + } + if err != nil { + return err + } + } + elapsed := time.Since(startTime) + log.Infof("%s: Checked blocks from (%s) %d to (%s) %d -> len(blocks):%d elapsed: %s", p.Name(), p.InitialSegmentBlockNumber.Description(), from, p.EndSegmentBlockNumber.Description(), to, len(blocksToCheck), elapsed.String()) + + return nil +} + +// CheckBlockHash is a method that checks the L1 block hash +// returns true if is the same +func (p *PreCheckL1BlockHash) checkThatStateBlockIsTheSame(ctx context.Context, block *state.Block) (bool, error) { + blocks, err := p.State.GetUncheckedBlocks(ctx, block.BlockNumber, block.BlockNumber, nil) + if err != nil { + log.Warnf("%s: Fails to get blockNumber %d in state .Err:%s", p.Name(), block.BlockNumber, err.Error()) + return false, err + } + if len(blocks) == 0 { + // The block is checked or deleted, so it is not the same + log.Debugf("%s: The blockNumber %d is no longer in the state (or checked or deleted)", p.Name(), block.BlockNumber) + return false, nil + } + stateBlock := blocks[0] + if stateBlock.BlockNumber != block.BlockNumber { + msg := fmt.Sprintf("%s: The blockNumber returned by state %d is different from the state blockNumber %d", + p.Name(), block.BlockNumber, stateBlock.BlockNumber) + log.Warn(msg) + return false, fmt.Errorf(msg) + } + if stateBlock.BlockHash != block.BlockHash { + msg := fmt.Sprintf("%s: The blockNumber %d differs the hash checked %s from current in state %s", + p.Name(), block.BlockNumber, block.BlockHash.String(), stateBlock.BlockHash.String()) + log.Warn(msg) + return false, nil + } + // The block is the same + return true, nil +} diff --git a/synchronizer/l1_check_block/pre_check_l1block_test.go b/synchronizer/l1_check_block/pre_check_l1block_test.go new file mode 100644 index 0000000000..39c359a513 --- /dev/null +++ b/synchronizer/l1_check_block/pre_check_l1block_test.go @@ -0,0 +1,144 @@ +package l1_check_block_test + +import ( + "context" + "math/big" + "testing" + + "github.com/0xPolygonHermez/zkevm-node/state" + commonsync "github.com/0xPolygonHermez/zkevm-node/synchronizer/common" + "github.com/0xPolygonHermez/zkevm-node/synchronizer/l1_check_block" + mock_l1_check_block "github.com/0xPolygonHermez/zkevm-node/synchronizer/l1_check_block/mocks" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/stretchr/testify/require" +) + +type testPreCheckData struct { + sut *l1_check_block.PreCheckL1BlockHash + mockL1Client *mock_l1_check_block.L1Requester + mockState *mock_l1_check_block.StatePreCheckInterfacer + mockInitialFetch *mock_l1_check_block.SafeL1BlockNumberFetcher + mockEndFetch *mock_l1_check_block.SafeL1BlockNumberFetcher + ctx context.Context + stateBlocks []*state.Block +} + +func newPreCheckData(t *testing.T) *testPreCheckData { + mockL1Client := mock_l1_check_block.NewL1Requester(t) + mockState := mock_l1_check_block.NewStatePreCheckInterfacer(t) + mockInitialFetch := mock_l1_check_block.NewSafeL1BlockNumberFetcher(t) + mockEndFetch := mock_l1_check_block.NewSafeL1BlockNumberFetcher(t) + sut := l1_check_block.NewPreCheckL1BlockHash(mockL1Client, mockState, mockInitialFetch, mockEndFetch) + return &testPreCheckData{ + sut: sut, + mockL1Client: mockL1Client, + mockState: mockState, + mockInitialFetch: mockInitialFetch, + mockEndFetch: mockEndFetch, + ctx: context.Background(), + stateBlocks: []*state.Block{ + { + BlockNumber: 1234, + BlockHash: common.HexToHash("0xd77dd3a9ee6f9202ca5a75024b7d9cbd3d7436b2910d450f88c261c0089c0cd9"), + }, + { + BlockNumber: 1237, + BlockHash: common.HexToHash("0x8faffac37f561c18917c33ff3540262ecfbe11a367b4e1c48181326cd8ba347f"), + }, + }, + } +} + +// If from > to, it ignore because there are no blocks to check +func TestPreCheckL1BlockFromGreaterThanTo(t *testing.T) { + data := newPreCheckData(t) + data.mockInitialFetch.EXPECT().Description().Return("initial") + data.mockEndFetch.EXPECT().Description().Return("end") + data.mockInitialFetch.EXPECT().GetSafeBlockNumber(data.ctx, data.mockL1Client).Return(uint64(1234), nil) + data.mockEndFetch.EXPECT().GetSafeBlockNumber(data.ctx, data.mockL1Client).Return(uint64(1230), nil) + + res := data.sut.Step(data.ctx) + require.NoError(t, res) +} + +// No blocks on state -> nothing to do +func TestPreCheckL1BlockNoBlocksOnState(t *testing.T) { + data := newPreCheckData(t) + data.mockInitialFetch.EXPECT().Description().Return("initial") + data.mockEndFetch.EXPECT().Description().Return("end") + data.mockInitialFetch.EXPECT().GetSafeBlockNumber(data.ctx, data.mockL1Client).Return(uint64(1234), nil) + data.mockEndFetch.EXPECT().GetSafeBlockNumber(data.ctx, data.mockL1Client).Return(uint64(1250), nil) + data.mockState.EXPECT().GetUncheckedBlocks(data.ctx, uint64(1234), uint64(1250), nil).Return(nil, nil) + + res := data.sut.Step(data.ctx) + require.NoError(t, res) +} + +func TestPreCheckL1BlockBlocksMatch(t *testing.T) { + data := newPreCheckData(t) + data.mockInitialFetch.EXPECT().Description().Return("initial") + data.mockEndFetch.EXPECT().Description().Return("end") + data.mockInitialFetch.EXPECT().GetSafeBlockNumber(data.ctx, data.mockL1Client).Return(uint64(1234), nil) + data.mockEndFetch.EXPECT().GetSafeBlockNumber(data.ctx, data.mockL1Client).Return(uint64(1250), nil) + data.mockState.EXPECT().GetUncheckedBlocks(data.ctx, uint64(1234), uint64(1250), nil).Return(data.stateBlocks, nil) + l1Block1 := &types.Header{ + Number: big.NewInt(int64(data.stateBlocks[0].BlockNumber)), + } + data.mockL1Client.EXPECT().HeaderByNumber(data.ctx, big.NewInt(int64(data.stateBlocks[0].BlockNumber))).Return(l1Block1, nil) + l1Block2 := &types.Header{ + Number: big.NewInt(int64(data.stateBlocks[1].BlockNumber)), + } + data.mockL1Client.EXPECT().HeaderByNumber(data.ctx, big.NewInt(int64(data.stateBlocks[1].BlockNumber))).Return(l1Block2, nil) + //data.mockState.EXPECT().GetUncheckedBlocks(data.ctx, uint64(1237), uint64(1237), nil).Return(data.stateBlocks[0:1], nil) + + res := data.sut.Step(data.ctx) + require.NoError(t, res) +} + +func TestPreCheckL1BlockBlocksMismatch(t *testing.T) { + data := newPreCheckData(t) + data.mockInitialFetch.EXPECT().Description().Return("initial") + data.mockEndFetch.EXPECT().Description().Return("end") + data.mockInitialFetch.EXPECT().GetSafeBlockNumber(data.ctx, data.mockL1Client).Return(uint64(1234), nil) + data.mockEndFetch.EXPECT().GetSafeBlockNumber(data.ctx, data.mockL1Client).Return(uint64(1250), nil) + data.stateBlocks[1].BlockHash = common.HexToHash("0x12345678901234567890123456789012345678901234567890") + data.mockState.EXPECT().GetUncheckedBlocks(data.ctx, uint64(1234), uint64(1250), nil).Return(data.stateBlocks, nil) + l1Block1 := &types.Header{ + Number: big.NewInt(int64(data.stateBlocks[0].BlockNumber)), + } + data.mockL1Client.EXPECT().HeaderByNumber(data.ctx, big.NewInt(int64(data.stateBlocks[0].BlockNumber))).Return(l1Block1, nil) + l1Block2 := &types.Header{ + Number: big.NewInt(int64(data.stateBlocks[1].BlockNumber)), + } + data.mockL1Client.EXPECT().HeaderByNumber(data.ctx, big.NewInt(int64(data.stateBlocks[1].BlockNumber))).Return(l1Block2, nil) + data.mockState.EXPECT().GetUncheckedBlocks(data.ctx, uint64(1237), uint64(1237), nil).Return(data.stateBlocks[1:2], nil) + + res := data.sut.Step(data.ctx) + require.Error(t, res) + resErr, ok := res.(*commonsync.ReorgError) + require.True(t, ok, "The error must be ReorgError") + require.Equal(t, uint64(1237), resErr.BlockNumber) +} + +func TestPreCheckL1BlockBlocksMismatchButIsNoLongerInState(t *testing.T) { + data := newPreCheckData(t) + data.mockInitialFetch.EXPECT().Description().Return("initial") + data.mockEndFetch.EXPECT().Description().Return("end") + data.mockInitialFetch.EXPECT().GetSafeBlockNumber(data.ctx, data.mockL1Client).Return(uint64(1234), nil) + data.mockEndFetch.EXPECT().GetSafeBlockNumber(data.ctx, data.mockL1Client).Return(uint64(1250), nil) + data.stateBlocks[1].BlockHash = common.HexToHash("0x12345678901234567890123456789012345678901234567890") + data.mockState.EXPECT().GetUncheckedBlocks(data.ctx, uint64(1234), uint64(1250), nil).Return(data.stateBlocks, nil) + l1Block1 := &types.Header{ + Number: big.NewInt(int64(data.stateBlocks[0].BlockNumber)), + } + data.mockL1Client.EXPECT().HeaderByNumber(data.ctx, big.NewInt(int64(data.stateBlocks[0].BlockNumber))).Return(l1Block1, nil) + l1Block2 := &types.Header{ + Number: big.NewInt(int64(data.stateBlocks[1].BlockNumber)), + } + data.mockL1Client.EXPECT().HeaderByNumber(data.ctx, big.NewInt(int64(data.stateBlocks[1].BlockNumber))).Return(l1Block2, nil) + data.mockState.EXPECT().GetUncheckedBlocks(data.ctx, uint64(1237), uint64(1237), nil).Return(nil, nil) + + res := data.sut.Step(data.ctx) + require.ErrorIs(t, res, l1_check_block.ErrDeSync) +} diff --git a/synchronizer/l1_check_block/safe_l1_block.go b/synchronizer/l1_check_block/safe_l1_block.go new file mode 100644 index 0000000000..7b767b4900 --- /dev/null +++ b/synchronizer/l1_check_block/safe_l1_block.go @@ -0,0 +1,120 @@ +package l1_check_block + +import ( + "context" + "fmt" + "math/big" + + "github.com/0xPolygonHermez/zkevm-node/log" + "github.com/ethereum/go-ethereum/rpc" +) + +// L1BlockPoint is an enum that represents the point of the L1 block +type L1BlockPoint int + +const ( + // FinalizedBlockNumber is the finalized block number + FinalizedBlockNumber L1BlockPoint = 3 + // SafeBlockNumber is the safe block number + SafeBlockNumber L1BlockPoint = 2 + // PendingBlockNumber is the pending block number + PendingBlockNumber L1BlockPoint = 1 + // LastBlockNumber is the last block number + LastBlockNumber L1BlockPoint = 0 +) + +// ToString converts a L1BlockPoint to a string +func (v L1BlockPoint) ToString() string { + switch v { + case FinalizedBlockNumber: + return "finalized" + case SafeBlockNumber: + return "safe" + case PendingBlockNumber: + return "pending" + case LastBlockNumber: + return "latest" + } + return "Unknown" +} + +// StringToL1BlockPoint converts a string to a L1BlockPoint +func StringToL1BlockPoint(s string) L1BlockPoint { + switch s { + case "finalized": + return FinalizedBlockNumber + case "safe": + return SafeBlockNumber + case "pending": + return PendingBlockNumber + case "latest": + return LastBlockNumber + default: + return FinalizedBlockNumber + } +} + +// ToGethRequest converts a L1BlockPoint to a big.Int used for request to GETH +func (v L1BlockPoint) ToGethRequest() *big.Int { + switch v { + case FinalizedBlockNumber: + return big.NewInt(int64(rpc.FinalizedBlockNumber)) + case PendingBlockNumber: + return big.NewInt(int64(rpc.PendingBlockNumber)) + case SafeBlockNumber: + return big.NewInt(int64(rpc.SafeBlockNumber)) + case LastBlockNumber: + return nil + } + return big.NewInt(int64(v)) +} + +// SafeL1BlockNumberFetch is a struct that implements a safe L1 block number fetch +type SafeL1BlockNumberFetch struct { + // SafeBlockPoint is the block number that is reference to l1 Block + SafeBlockPoint L1BlockPoint + // Offset is a vaule add to the L1 block + Offset int +} + +// NewSafeL1BlockNumberFetch creates a new SafeL1BlockNumberFetch +func NewSafeL1BlockNumberFetch(safeBlockPoint L1BlockPoint, offset int) *SafeL1BlockNumberFetch { + return &SafeL1BlockNumberFetch{ + SafeBlockPoint: safeBlockPoint, + Offset: offset, + } +} + +// Description returns a string representation of SafeL1BlockNumberFetch +func (p *SafeL1BlockNumberFetch) Description() string { + return fmt.Sprintf("%s/%d", p.SafeBlockPoint.ToString(), p.Offset) +} + +// GetSafeBlockNumber gets the safe block number from L1 +func (p *SafeL1BlockNumberFetch) GetSafeBlockNumber(ctx context.Context, requester L1Requester) (uint64, error) { + l1SafePointBlock, err := requester.HeaderByNumber(ctx, p.SafeBlockPoint.ToGethRequest()) + if err != nil { + log.Errorf("%s: Error getting L1 block %d. err: %s", logPrefix, p.String(), err.Error()) + return uint64(0), err + } + result := l1SafePointBlock.Number.Uint64() + if p.Offset < 0 { + if result < uint64(-p.Offset) { + result = 0 + } else { + result += uint64(p.Offset) + } + } else { + result = l1SafePointBlock.Number.Uint64() + uint64(p.Offset) + } + if p.SafeBlockPoint == LastBlockNumber { + result = min(result, l1SafePointBlock.Number.Uint64()) + } + + return result, nil +} + +// String returns a string representation of SafeL1BlockNumberFetch +func (p *SafeL1BlockNumberFetch) String() string { + return fmt.Sprintf("SafeBlockPoint: %s, Offset: %d", p.SafeBlockPoint.ToString(), p.Offset) +} diff --git a/synchronizer/l1_check_block/safe_l1_block_test.go b/synchronizer/l1_check_block/safe_l1_block_test.go new file mode 100644 index 0000000000..4d3167adcd --- /dev/null +++ b/synchronizer/l1_check_block/safe_l1_block_test.go @@ -0,0 +1,113 @@ +package l1_check_block_test + +import ( + "context" + "math/big" + "testing" + + "github.com/0xPolygonHermez/zkevm-node/synchronizer/l1_check_block" + mock_l1_check_block "github.com/0xPolygonHermez/zkevm-node/synchronizer/l1_check_block/mocks" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/rpc" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" +) + +func TestGetSafeBlockNumber(t *testing.T) { + ctx := context.Background() + mockRequester := mock_l1_check_block.NewL1Requester(t) + //safeBlockPoint := big.NewInt(50) + offset := 10 + safeL1Block := l1_check_block.NewSafeL1BlockNumberFetch(l1_check_block.StringToL1BlockPoint("safe"), offset) + + mockRequester.EXPECT().HeaderByNumber(ctx, mock.Anything).Return(&types.Header{ + Number: big.NewInt(100), + }, nil) + blockNumber, err := safeL1Block.GetSafeBlockNumber(ctx, mockRequester) + assert.NoError(t, err) + expectedBlockNumber := uint64(100 + offset) + assert.Equal(t, expectedBlockNumber, blockNumber) +} + +func TestGetSafeBlockNumberMutliplesCases(t *testing.T) { + tests := []struct { + name string + blockPoint string + offset int + l1ReturnBlockNumber uint64 + expectedCallToGeth *big.Int + expectedBlockNumber uint64 + }{ + { + name: "SafeBlockNumber+10", + blockPoint: "safe", + offset: 10, + l1ReturnBlockNumber: 100, + expectedCallToGeth: big.NewInt(int64(rpc.SafeBlockNumber)), + expectedBlockNumber: 110, + }, + { + name: "FinalizedBlockNumber+10", + blockPoint: "finalized", + offset: 10, + l1ReturnBlockNumber: 100, + expectedCallToGeth: big.NewInt(int64(rpc.FinalizedBlockNumber)), + expectedBlockNumber: 110, + }, + { + name: "PendingBlockNumber+10", + blockPoint: "pending", + offset: 10, + l1ReturnBlockNumber: 100, + expectedCallToGeth: big.NewInt(int64(rpc.PendingBlockNumber)), + expectedBlockNumber: 110, + }, + { + name: "LastBlockNumber+10, can't add 10 to latest block number. So must return latest block number and ignore positive offset", + blockPoint: "latest", + offset: 10, + l1ReturnBlockNumber: 100, + expectedCallToGeth: nil, + expectedBlockNumber: 100, + }, + { + name: "FinalizedBlockNumber-1000. negative blockNumbers are not welcome. So must return 0", + blockPoint: "finalized", + offset: -1000, + l1ReturnBlockNumber: 100, + expectedCallToGeth: big.NewInt(int64(rpc.FinalizedBlockNumber)), + expectedBlockNumber: 0, + }, + { + name: "FinalizedBlockNumber(1000)-1000. is 0 ", + blockPoint: "finalized", + offset: -1000, + l1ReturnBlockNumber: 1000, + expectedCallToGeth: big.NewInt(int64(rpc.FinalizedBlockNumber)), + expectedBlockNumber: 0, + }, + { + name: "FinalizedBlockNumber(1001)-1000. is 1 ", + blockPoint: "finalized", + offset: -1000, + l1ReturnBlockNumber: 1001, + expectedCallToGeth: big.NewInt(int64(rpc.FinalizedBlockNumber)), + expectedBlockNumber: 1, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + ctx := context.Background() + mockRequester := mock_l1_check_block.NewL1Requester(t) + safeL1Block := l1_check_block.NewSafeL1BlockNumberFetch(l1_check_block.StringToL1BlockPoint(tt.blockPoint), tt.offset) + + mockRequester.EXPECT().HeaderByNumber(ctx, tt.expectedCallToGeth).Return(&types.Header{ + Number: big.NewInt(int64(tt.l1ReturnBlockNumber)), + }, nil) + blockNumber, err := safeL1Block.GetSafeBlockNumber(ctx, mockRequester) + assert.NoError(t, err) + assert.Equal(t, tt.expectedBlockNumber, blockNumber) + }) + } +} diff --git a/synchronizer/l1_parallel_sync/l1_rollup_info_consumer.go b/synchronizer/l1_parallel_sync/l1_rollup_info_consumer.go index 5a457acbf0..4dd78632fd 100644 --- a/synchronizer/l1_parallel_sync/l1_rollup_info_consumer.go +++ b/synchronizer/l1_parallel_sync/l1_rollup_info_consumer.go @@ -3,12 +3,14 @@ package l1_parallel_sync import ( "context" "errors" + "fmt" "sync" "time" "github.com/0xPolygonHermez/zkevm-node/etherman" "github.com/0xPolygonHermez/zkevm-node/log" "github.com/0xPolygonHermez/zkevm-node/state" + syncCommon "github.com/0xPolygonHermez/zkevm-node/synchronizer/common" "github.com/ethereum/go-ethereum/common" types "github.com/ethereum/go-ethereum/core/types" ) @@ -22,7 +24,6 @@ var ( errContextCanceled = errors.New("consumer:context canceled") errConsumerStopped = errors.New("consumer:stopped by request") errConsumerStoppedBecauseIsSynchronized = errors.New("consumer:stopped because is synchronized") - errL1Reorg = errors.New("consumer: L1 reorg detected") errConsumerAndProducerDesynchronized = errors.New("consumer: consumer and producer are desynchronized") ) @@ -155,13 +156,12 @@ func checkPreviousBlocks(rollupInfo rollupInfoByBlockRangeResult, cachedBlock *s } if cachedBlock.BlockNumber == rollupInfo.previousBlockOfRange.NumberU64() { if cachedBlock.BlockHash != rollupInfo.previousBlockOfRange.Hash() { - log.Errorf("consumer: Previous block %d hash is not the same", cachedBlock.BlockNumber) - return errL1Reorg - } - if cachedBlock.ParentHash != rollupInfo.previousBlockOfRange.ParentHash() { - log.Errorf("consumer: Previous block %d parentHash is not the same", cachedBlock.BlockNumber) - return errL1Reorg + err := fmt.Errorf("consumer: Previous block %d hash is not the same. state.Hash:%s != l1.Hash:%s", + cachedBlock.BlockNumber, cachedBlock.BlockHash, rollupInfo.previousBlockOfRange.Hash()) + log.Errorf(err.Error()) + return syncCommon.NewReorgError(cachedBlock.BlockNumber, err) } + log.Infof("consumer: Verified previous block %d not the same: OK", cachedBlock.BlockNumber) } return nil diff --git a/synchronizer/l2_sync/l2_shared/processor_trusted_batch_sync.go b/synchronizer/l2_sync/l2_shared/processor_trusted_batch_sync.go index db4ddd15e0..5463555d94 100644 --- a/synchronizer/l2_sync/l2_shared/processor_trusted_batch_sync.go +++ b/synchronizer/l2_sync/l2_shared/processor_trusted_batch_sync.go @@ -171,6 +171,10 @@ func (s *ProcessorTrustedBatchSync) AddPostChecker(checker PostClosedBatchChecke // ProcessTrustedBatch processes a trusted batch and return the new state func (s *ProcessorTrustedBatchSync) ProcessTrustedBatch(ctx context.Context, trustedBatch *types.Batch, status TrustedState, dbTx pgx.Tx, debugPrefix string) (*TrustedState, error) { + if trustedBatch == nil { + log.Errorf("%s trustedBatch is nil, it never should be nil", debugPrefix) + return nil, fmt.Errorf("%s trustedBatch is nil, it never should be nil", debugPrefix) + } log.Debugf("%s Processing trusted batch: %v", debugPrefix, trustedBatch.Number) stateCurrentBatch, statePreviousBatch := s.GetCurrentAndPreviousBatchFromCache(&status) if s.l1SyncChecker != nil { @@ -374,7 +378,9 @@ func (s *ProcessorTrustedBatchSync) GetModeForProcessBatch(trustedNodeBatch *typ result.OldAccInputHash = statePreviousBatch.AccInputHash result.Now = s.timeProvider.Now() result.DebugPrefix = fmt.Sprintf("%s mode %s:", debugPrefix, result.Mode) - + if result.BatchMustBeClosed { + result.DebugPrefix += " (must_be_closed)" + } if isTrustedBatchEmptyAndClosed(trustedNodeBatch) { if s.Cfg.AcceptEmptyClosedBatches { log.Infof("%s Batch %v: TrustedBatch Empty and closed, accepted due configuration", result.DebugPrefix, trustedNodeBatch.Number) diff --git a/synchronizer/l2_sync/l2_shared/tests/trusted_batches_retrieve_test.go b/synchronizer/l2_sync/l2_shared/tests/trusted_batches_retrieve_test.go new file mode 100644 index 0000000000..f050fa565f --- /dev/null +++ b/synchronizer/l2_sync/l2_shared/tests/trusted_batches_retrieve_test.go @@ -0,0 +1,117 @@ +package test_l2_shared + +import ( + "context" + "math/big" + "testing" + + "github.com/0xPolygonHermez/zkevm-node/jsonrpc/types" + "github.com/0xPolygonHermez/zkevm-node/state" + "github.com/0xPolygonHermez/zkevm-node/synchronizer/common" + mock_syncinterfaces "github.com/0xPolygonHermez/zkevm-node/synchronizer/common/syncinterfaces/mocks" + "github.com/0xPolygonHermez/zkevm-node/synchronizer/l2_sync/l2_shared" + l2sharedmocks "github.com/0xPolygonHermez/zkevm-node/synchronizer/l2_sync/l2_shared/mocks" + syncMocks "github.com/0xPolygonHermez/zkevm-node/synchronizer/mocks" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" +) + +type testDataTrustedBatchRetrieve struct { + mockBatchProcessor *l2sharedmocks.BatchProcessor + mockZkEVMClient *mock_syncinterfaces.ZKEVMClientTrustedBatchesGetter + mockState *l2sharedmocks.StateInterface + mockSync *mock_syncinterfaces.SynchronizerFlushIDManager + mockTimer *common.MockTimerProvider + mockDbTx *syncMocks.DbTxMock + TrustedStateMngr *l2_shared.TrustedStateManager + sut *l2_shared.TrustedBatchesRetrieve + ctx context.Context +} + +func newTestDataTrustedBatchRetrieve(t *testing.T) *testDataTrustedBatchRetrieve { + mockBatchProcessor := l2sharedmocks.NewBatchProcessor(t) + mockZkEVMClient := mock_syncinterfaces.NewZKEVMClientTrustedBatchesGetter(t) + mockState := l2sharedmocks.NewStateInterface(t) + mockSync := mock_syncinterfaces.NewSynchronizerFlushIDManager(t) + mockTimer := &common.MockTimerProvider{} + mockDbTx := syncMocks.NewDbTxMock(t) + TrustedStateMngr := l2_shared.NewTrustedStateManager(mockTimer, 0) + sut := l2_shared.NewTrustedBatchesRetrieve(mockBatchProcessor, mockZkEVMClient, mockState, mockSync, *TrustedStateMngr) + ctx := context.TODO() + return &testDataTrustedBatchRetrieve{ + mockBatchProcessor: mockBatchProcessor, + mockZkEVMClient: mockZkEVMClient, + mockState: mockState, + mockSync: mockSync, + mockTimer: mockTimer, + mockDbTx: mockDbTx, + TrustedStateMngr: TrustedStateMngr, + sut: sut, + ctx: ctx, + } +} + +const ( + closedBatch = true + notClosedBatch = false +) + +// This test must do from 100 to 104. +// But the batch 100 is open on TrustedNode so it stop processing +func TestSyncTrustedBatchesToFromStopAfterFirstWIPBatch(t *testing.T) { + data := newTestDataTrustedBatchRetrieve(t) + data.mockZkEVMClient.EXPECT().BatchNumber(data.ctx).Return(uint64(102), nil) + + expectationsForSyncTrustedStateIteration(t, 100, notClosedBatch, data) + + err := data.sut.SyncTrustedState(data.ctx, 100, 104) + require.NoError(t, err) +} + +// This must process 100 (that is closed) +// and stop processing at 101 because is not yet close this batch +func TestSyncTrustedBatchesToFromStopAfterFirstWIPBatchCase2(t *testing.T) { + data := newTestDataTrustedBatchRetrieve(t) + data.mockZkEVMClient.EXPECT().BatchNumber(data.ctx).Return(uint64(102), nil) + + expectationsForSyncTrustedStateIteration(t, 100, closedBatch, data) + expectationsForSyncTrustedStateIteration(t, 101, notClosedBatch, data) + + err := data.sut.SyncTrustedState(data.ctx, 100, 104) + require.NoError(t, err) +} + +// This test must do from 100 to 102. Is for check manually that the logs +// That is not tested but must not emit the log: +// - Batch 101 is not closed. so we break synchronization from Trusted Node because can only have 1 WIP batch on state +func TestSyncTrustedBatchesToFromStopAfterFirstWIPBatchCase3(t *testing.T) { + data := newTestDataTrustedBatchRetrieve(t) + data.mockZkEVMClient.EXPECT().BatchNumber(data.ctx).Return(uint64(102), nil) + expectationsForSyncTrustedStateIteration(t, 100, closedBatch, data) + expectationsForSyncTrustedStateIteration(t, 101, closedBatch, data) + expectationsForSyncTrustedStateIteration(t, 102, notClosedBatch, data) + + err := data.sut.SyncTrustedState(data.ctx, 100, 102) + require.NoError(t, err) +} + +func expectationsForSyncTrustedStateIteration(t *testing.T, batchNumber uint64, closed bool, data *testDataTrustedBatchRetrieve) { + batch100 := &types.Batch{ + Number: types.ArgUint64(batchNumber), + Closed: closed, + } + data.mockZkEVMClient.EXPECT().BatchByNumber(data.ctx, big.NewInt(0).SetUint64(batchNumber)).Return(batch100, nil) + data.mockState.EXPECT().BeginStateTransaction(data.ctx).Return(data.mockDbTx, nil) + // Get Previous Batch 99 from State + stateBatch99 := &state.Batch{ + BatchNumber: batchNumber - 1, + } + data.mockState.EXPECT().GetBatchByNumber(data.ctx, uint64(batchNumber-1), data.mockDbTx).Return(stateBatch99, nil) + stateBatch100 := &state.Batch{ + BatchNumber: batchNumber, + } + data.mockState.EXPECT().GetBatchByNumber(data.ctx, uint64(batchNumber), data.mockDbTx).Return(stateBatch100, nil) + data.mockBatchProcessor.EXPECT().ProcessTrustedBatch(data.ctx, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil, nil) + data.mockSync.EXPECT().CheckFlushID(mock.Anything).Return(nil) + data.mockDbTx.EXPECT().Commit(data.ctx).Return(nil) +} diff --git a/synchronizer/l2_sync/l2_shared/trusted_batches_retrieve.go b/synchronizer/l2_sync/l2_shared/trusted_batches_retrieve.go index 70311c6966..b4031b4653 100644 --- a/synchronizer/l2_sync/l2_shared/trusted_batches_retrieve.go +++ b/synchronizer/l2_sync/l2_shared/trusted_batches_retrieve.go @@ -109,6 +109,16 @@ func isSyncrhonizedTrustedState(lastTrustedStateBatchNumber uint64, latestSynced return lastTrustedStateBatchNumber < latestSyncedBatch } +func sanityCheckBatchReturnedByTrusted(batch *types.Batch, expectedBatchNumber uint64) error { + if batch == nil { + return fmt.Errorf("batch %d is nil", expectedBatchNumber) + } + if uint64(batch.Number) != expectedBatchNumber { + return fmt.Errorf("batch %d is not the expected batch %d", batch.Number, expectedBatchNumber) + } + return nil +} + func (s *TrustedBatchesRetrieve) syncTrustedBatchesToFrom(ctx context.Context, latestSyncedBatch uint64, lastTrustedStateBatchNumber uint64) error { batchNumberToSync := max(latestSyncedBatch, s.firstBatchNumberToSync) for batchNumberToSync <= lastTrustedStateBatchNumber { @@ -120,6 +130,11 @@ func (s *TrustedBatchesRetrieve) syncTrustedBatchesToFrom(ctx context.Context, l log.Warnf("%s failed to get batch %d from trusted state. Error: %v", debugPrefix, batchNumberToSync, err) return err } + err = sanityCheckBatchReturnedByTrusted(batchToSync, batchNumberToSync) + if err != nil { + log.Warnf("%s sanity check over Batch returned by Trusted-RPC failed: %v", debugPrefix, err) + return err + } dbTx, err := s.state.BeginStateTransaction(ctx) if err != nil { @@ -161,6 +176,10 @@ func (s *TrustedBatchesRetrieve) syncTrustedBatchesToFrom(ctx context.Context, l s.TrustedStateMngr.Clear() } batchNumberToSync++ + if !batchToSync.Closed && batchNumberToSync <= lastTrustedStateBatchNumber { + log.Infof("%s Batch %d is not closed. so we break synchronization from Trusted Node because can only have 1 WIP batch on state", debugPrefix, batchToSync.Number) + return nil + } } log.Infof("syncTrustedState: Trusted state fully synchronized from %d to %d", latestSyncedBatch, lastTrustedStateBatchNumber) diff --git a/synchronizer/synchronizer.go b/synchronizer/synchronizer.go index d0b786e527..f29421aad6 100644 --- a/synchronizer/synchronizer.go +++ b/synchronizer/synchronizer.go @@ -16,6 +16,7 @@ import ( "github.com/0xPolygonHermez/zkevm-node/synchronizer/actions/processor_manager" syncCommon "github.com/0xPolygonHermez/zkevm-node/synchronizer/common" "github.com/0xPolygonHermez/zkevm-node/synchronizer/common/syncinterfaces" + "github.com/0xPolygonHermez/zkevm-node/synchronizer/l1_check_block" "github.com/0xPolygonHermez/zkevm-node/synchronizer/l1_parallel_sync" "github.com/0xPolygonHermez/zkevm-node/synchronizer/l1event_orders" "github.com/0xPolygonHermez/zkevm-node/synchronizer/l2_sync/l2_shared" @@ -77,6 +78,7 @@ type ClientSynchronizer struct { l1EventProcessors *processor_manager.L1EventProcessors syncTrustedStateExecutor syncinterfaces.SyncTrustedStateExecutor halter syncinterfaces.CriticalErrorHandler + asyncL1BlockChecker syncinterfaces.L1BlockCheckerIntegrator } // NewSynchronizer creates and initializes an instance of Synchronizer @@ -123,6 +125,31 @@ func NewSynchronizer( syncBlockProtection: syncBlockProtection, halter: syncCommon.NewCriticalErrorHalt(eventLog, 5*time.Second), //nolint:gomnd } + if cfg.L1BlockCheck.Enable { + log.Infof("L1BlockChecker enabled: %s", cfg.L1BlockCheck.String()) + l1BlockChecker := l1_check_block.NewCheckL1BlockHash(ethMan, res.state, + l1_check_block.NewSafeL1BlockNumberFetch(l1_check_block.StringToL1BlockPoint(cfg.L1BlockCheck.L1SafeBlockPoint), cfg.L1BlockCheck.L1SafeBlockOffset)) + + var preCheckAsync syncinterfaces.AsyncL1BlockChecker + if cfg.L1BlockCheck.PreCheckEnable { + log.Infof("L1BlockChecker enabled precheck from: %s/%d to: %s/%d", + cfg.L1BlockCheck.L1SafeBlockPoint, cfg.L1BlockCheck.L1SafeBlockOffset, + cfg.L1BlockCheck.L1PreSafeBlockPoint, cfg.L1BlockCheck.L1PreSafeBlockOffset) + l1BlockPreChecker := l1_check_block.NewPreCheckL1BlockHash(ethMan, res.state, + l1_check_block.NewSafeL1BlockNumberFetch(l1_check_block.StringToL1BlockPoint(cfg.L1BlockCheck.L1SafeBlockPoint), cfg.L1BlockCheck.L1SafeBlockOffset), + l1_check_block.NewSafeL1BlockNumberFetch(l1_check_block.StringToL1BlockPoint(cfg.L1BlockCheck.L1PreSafeBlockPoint), cfg.L1BlockCheck.L1PreSafeBlockOffset), + ) + preCheckAsync = l1_check_block.NewAsyncCheck(l1BlockPreChecker) + } + + res.asyncL1BlockChecker = l1_check_block.NewL1BlockCheckerIntegration( + l1_check_block.NewAsyncCheck(l1BlockChecker), + preCheckAsync, + res.state, + res, + cfg.L1BlockCheck.ForceCheckBeforeStart, + time.Second) + } if !isTrustedSequencer { log.Info("Permissionless: creating and Initializing L2 synchronization components") @@ -156,7 +183,11 @@ func NewSynchronizer( log.Errorf("error getting last L2Block number from state. Error: %v", err) return nil, err } - l1checkerL2Blocks = actions.NewCheckL2BlockHash(res.state, res.zkEVMClientEthereumCompatible, initialL2Block, cfg.L1SyncCheckL2BlockNumberhModulus) + l1checkerL2Blocks, err = actions.NewCheckL2BlockHash(res.state, res.zkEVMClientEthereumCompatible, initialL2Block, cfg.L1SyncCheckL2BlockNumberhModulus) + if err != nil { + log.Error("error creating new instance of checkL2BlockHash. Error: ", err) + return nil, err + } } else { log.Infof("Trusted Node can't check L2Block hash, ignoring parameter") } @@ -251,6 +282,10 @@ func (s *ClientSynchronizer) Sync() error { // If there is no lastEthereumBlock means that sync from the beginning is necessary. If not, it continues from the retrieved ethereum block // Get the latest synced block. If there is no block on db, use genesis block log.Info("Sync started") + if s.asyncL1BlockChecker != nil { + _ = s.asyncL1BlockChecker.OnStart(s.ctx) + } + dbTx, err := s.state.BeginStateTransaction(s.ctx) if err != nil { log.Errorf("error creating db transaction to get latest block. Error: %v", err) @@ -402,6 +437,7 @@ func (s *ClientSynchronizer) Sync() error { continue } log.Infof("latestSequencedBatchNumber: %d, latestSyncedBatch: %d, lastVerifiedBatchNumber: %d", latestSequencedBatchNumber, latestSyncedBatch, lastVerifiedBatchNumber) + resetDone := false // Sync trusted state // latestSyncedBatch -> Last batch on DB // latestSequencedBatchNumber -> last batch on SMC @@ -409,6 +445,13 @@ func (s *ClientSynchronizer) Sync() error { startTrusted := time.Now() if s.syncTrustedStateExecutor != nil && !s.isTrustedSequencer { log.Info("Syncing trusted state (permissionless)") + //Sync Trusted State + log.Debug("Doing reorg check before L2 sync") + resetDone, lastEthBlockSynced, err = s.checkReorgAndExecuteReset(lastEthBlockSynced) + if resetDone || err != nil { + log.Infof("Reset done before L2 sync") + continue + } err = s.syncTrustedState(latestSyncedBatch) metrics.FullTrustedSyncTime(time.Since(startTrusted)) if err != nil { @@ -417,10 +460,14 @@ func (s *ClientSynchronizer) Sync() error { if errors.Is(err, syncinterfaces.ErrFatalDesyncFromL1) { l1BlockNumber := err.(*l2_shared.DeSyncPermissionlessAndTrustedNodeError).L1BlockNumber log.Error("Trusted and permissionless desync! reseting to last common point: L1Block (%d-1)", l1BlockNumber) - err = s.resetState(l1BlockNumber - 1) - if err != nil { - log.Errorf("error resetting the state to a discrepancy block. Retrying... Err: %v", err) - continue + for { + resetDone, lastEthBlockSynced, err = s.detectedReorgBadBlockExecuteReset(lastEthBlockSynced, syncCommon.GetReorgErrorBlockNumber(err)) + if resetDone { + break + } else { + log.Error("reorg isn't done, retrying...") + time.Sleep(time.Second) + } } } else if errors.Is(err, syncinterfaces.ErrMissingSyncFromL1) { log.Info("Syncing from trusted node need data from L1") @@ -437,6 +484,11 @@ func (s *ClientSynchronizer) Sync() error { waitDuration = s.cfg.SyncInterval.Duration } //Sync L1Blocks + resetDone, lastEthBlockSynced, err = s.checkReorgAndExecuteReset(lastEthBlockSynced) + if resetDone || err != nil { + continue + } + startL1 := time.Now() if s.l1SyncOrchestration != nil && (latestSyncedBatch < latestSequencedBatchNumber || !s.cfg.L1ParallelSynchronization.FallbackToSequentialModeOnSynchronized) { log.Infof("Syncing L1 blocks in parallel lastEthBlockSynced=%d", lastEthBlockSynced.BlockNumber) @@ -451,6 +503,19 @@ func (s *ClientSynchronizer) Sync() error { lastEthBlockSynced, err = s.syncBlocksSequential(lastEthBlockSynced) } metrics.FullL1SyncTime(time.Since(startL1)) + if syncCommon.IsReorgError(err) { + log.Warnf("error syncing blocks: %s", err.Error()) + for { + resetDone, lastEthBlockSynced, err = s.detectedReorgBadBlockExecuteReset(lastEthBlockSynced, syncCommon.GetReorgErrorBlockNumber(err)) + if resetDone { + break + } else { + log.Error("reorg isn't done, retrying...") + time.Sleep(time.Second) + } + } + continue + } if err != nil { log.Warn("error syncing blocks: ", err) s.CleanTrustedState() @@ -521,22 +586,6 @@ func sanityCheckForGenesisBlockRollupInfo(blocks []etherman.Block, order map[com // This function syncs the node from a specific block to the latest // lastEthBlockSynced -> last block synced in the db func (s *ClientSynchronizer) syncBlocksParallel(lastEthBlockSynced *state.Block) (*state.Block, error) { - // This function will read events fromBlockNum to latestEthBlock. Check reorg to be sure that everything is ok. - block, err := s.checkReorg(lastEthBlockSynced) - if err != nil { - log.Errorf("error checking reorgs. Retrying... Err: %v", err) - return lastEthBlockSynced, fmt.Errorf("error checking reorgs") - } - if block != nil { - log.Infof("reorg detected. Resetting the state from block %v to block %v", lastEthBlockSynced.BlockNumber, block.BlockNumber) - err = s.resetState(block.BlockNumber) - if err != nil { - log.Errorf("error resetting the state to a previous block. Retrying... Err: %v", err) - s.l1SyncOrchestration.Reset(lastEthBlockSynced.BlockNumber) - return lastEthBlockSynced, fmt.Errorf("error resetting the state to a previous block") - } - return block, nil - } log.Infof("Starting L1 sync orchestrator in parallel block: %d", lastEthBlockSynced.BlockNumber) return s.l1SyncOrchestration.Start(lastEthBlockSynced) } @@ -551,31 +600,21 @@ func (s *ClientSynchronizer) syncBlocksSequential(lastEthBlockSynced *state.Bloc } lastKnownBlock := header.Number - // This function will read events fromBlockNum to latestEthBlock. Check reorg to be sure that everything is ok. - block, err := s.checkReorg(lastEthBlockSynced) - if err != nil { - log.Errorf("error checking reorgs. Retrying... Err: %v", err) - return lastEthBlockSynced, fmt.Errorf("error checking reorgs") - } - if block != nil { - err = s.resetState(block.BlockNumber) - if err != nil { - log.Errorf("error resetting the state to a previous block. Retrying... Err: %v", err) - return lastEthBlockSynced, fmt.Errorf("error resetting the state to a previous block") - } - return block, nil - } - var fromBlock uint64 if lastEthBlockSynced.BlockNumber > 0 { - fromBlock = lastEthBlockSynced.BlockNumber + 1 + fromBlock = lastEthBlockSynced.BlockNumber } + toBlock := fromBlock + s.cfg.SyncChunkSize for { - toBlock := fromBlock + s.cfg.SyncChunkSize if toBlock > lastKnownBlock.Uint64() { + log.Debug("Setting toBlock to the lastKnownBlock") toBlock = lastKnownBlock.Uint64() } + if fromBlock > toBlock { + log.Debug("FromBlock is higher than toBlock. Skipping...") + return lastEthBlockSynced, nil + } log.Infof("Syncing block %d of %d", fromBlock, lastKnownBlock.Uint64()) log.Infof("Getting rollup info from block %d to block %d", fromBlock, toBlock) // This function returns the rollup information contained in the ethereum blocks and an extra param called order. @@ -590,8 +629,39 @@ func (s *ClientSynchronizer) syncBlocksSequential(lastEthBlockSynced *state.Bloc return lastEthBlockSynced, err } + var initBlockReceived *etherman.Block + if len(blocks) != 0 { + initBlockReceived = &blocks[0] + // First position of the array must be deleted + blocks = removeBlockElement(blocks, 0) + } else { + // Reorg detected + log.Infof("Reorg detected in block %d while querying GetRollupInfoByBlockRange. Rolling back to at least the previous block", fromBlock) + prevBlock, err := s.state.GetPreviousBlock(s.ctx, 1, nil) + if errors.Is(err, state.ErrNotFound) { + log.Warn("error checking reorg: previous block not found in db: ", err) + prevBlock = &state.Block{} + } else if err != nil { + log.Error("error getting previousBlock from db. Error: ", err) + return lastEthBlockSynced, err + } + blockReorged, err := s.checkReorg(prevBlock, nil) + if err != nil { + log.Error("error checking reorgs in previous blocks. Error: ", err) + return lastEthBlockSynced, err + } + if blockReorged == nil { + blockReorged = prevBlock + } + err = s.resetState(blockReorged.BlockNumber) + if err != nil { + log.Errorf("error resetting the state to a previous block. Retrying... Err: %v", err) + return lastEthBlockSynced, fmt.Errorf("error resetting the state to a previous block") + } + return blockReorged, nil + } // Check reorg again to be sure that the chain has not changed between the previous checkReorg and the call GetRollupInfoByBlockRange - block, err := s.checkReorg(lastEthBlockSynced) + block, err := s.checkReorg(lastEthBlockSynced, initBlockReceived) if err != nil { log.Errorf("error checking reorgs. Retrying... Err: %v", err) return lastEthBlockSynced, fmt.Errorf("error checking reorgs") @@ -619,47 +689,36 @@ func (s *ClientSynchronizer) syncBlocksSequential(lastEthBlockSynced *state.Bloc ReceivedAt: blocks[len(blocks)-1].ReceivedAt, } for i := range blocks { - log.Debug("Position: ", i, ". BlockNumber: ", blocks[i].BlockNumber, ". BlockHash: ", blocks[i].BlockHash) + log.Info("Position: ", i, ". New block. BlockNumber: ", blocks[i].BlockNumber, ". BlockHash: ", blocks[i].BlockHash) } } - fromBlock = toBlock + 1 if lastKnownBlock.Cmp(new(big.Int).SetUint64(toBlock)) < 1 { waitDuration = s.cfg.SyncInterval.Duration break } - if len(blocks) == 0 { // If there is no events in the checked blocks range and lastKnownBlock > fromBlock. - // Store the latest block of the block range. Get block info and process the block - fb, err := s.etherMan.EthBlockByNumber(s.ctx, toBlock) - if err != nil { - return lastEthBlockSynced, err - } - b := etherman.Block{ - BlockNumber: fb.NumberU64(), - BlockHash: fb.Hash(), - ParentHash: fb.ParentHash(), - ReceivedAt: time.Unix(int64(fb.Time()), 0), - } - err = s.ProcessBlockRange([]etherman.Block{b}, order) - if err != nil { - return lastEthBlockSynced, err - } - block := state.Block{ - BlockNumber: fb.NumberU64(), - BlockHash: fb.Hash(), - ParentHash: fb.ParentHash(), - ReceivedAt: time.Unix(int64(fb.Time()), 0), - } - lastEthBlockSynced = &block - log.Debug("Storing empty block. BlockNumber: ", b.BlockNumber, ". BlockHash: ", b.BlockHash) - } + + fromBlock = lastEthBlockSynced.BlockNumber + toBlock = toBlock + s.cfg.SyncChunkSize } return lastEthBlockSynced, nil } +func removeBlockElement(slice []etherman.Block, s int) []etherman.Block { + ret := make([]etherman.Block, 0) + ret = append(ret, slice[:s]...) + return append(ret, slice[s+1:]...) +} + // ProcessBlockRange process the L1 events and stores the information in the db func (s *ClientSynchronizer) ProcessBlockRange(blocks []etherman.Block, order map[common.Hash][]etherman.Order) error { + // Check the latest finalized block in L1 + finalizedBlockNumber, err := s.etherMan.GetFinalizedBlockNumber(s.ctx) + if err != nil { + log.Errorf("error getting finalized block number in L1. Error: %v", err) + return err + } // New info has to be included into the db using the state for i := range blocks { // Begin db transaction @@ -674,9 +733,13 @@ func (s *ClientSynchronizer) ProcessBlockRange(blocks []etherman.Block, order ma ParentHash: blocks[i].ParentHash, ReceivedAt: blocks[i].ReceivedAt, } + if blocks[i].BlockNumber <= finalizedBlockNumber { + b.Checked = true + } // Add block information err = s.state.AddBlock(s.ctx, &b, dbTx) if err != nil { + // If any goes wrong we ensure that the state is rollbacked log.Errorf("error storing block. BlockNumber: %d, error: %v", blocks[i].BlockNumber, err) rollbackErr := dbTx.Rollback(s.ctx) if rollbackErr != nil { @@ -694,7 +757,7 @@ func (s *ClientSynchronizer) ProcessBlockRange(blocks []etherman.Block, order ma log.Debug("EventOrder: ", element.Name, ". Batch Sequence: ", batchSequence, "forkId: ", forkId) } else { forkId = s.state.GetForkIDByBlockNumber(blocks[i].BlockNumber) - log.Debug("EventOrder: ", element.Name, ". BlockNumber: ", blocks[i].BlockNumber, "forkId: ", forkId) + log.Debug("EventOrder: ", element.Name, ". BlockNumber: ", blocks[i].BlockNumber, ". forkId: ", forkId) } forkIdTyped := actions.ForkIdType(forkId) // Process event received from l1 @@ -713,6 +776,7 @@ func (s *ClientSynchronizer) ProcessBlockRange(blocks []etherman.Block, order ma log.Debug("Checking FlushID to commit L1 data to db") err = s.checkFlushID(dbTx) if err != nil { + // If any goes wrong we ensure that the state is rollbacked log.Errorf("error checking flushID. Error: %v", err) rollbackErr := dbTx.Rollback(s.ctx) if rollbackErr != nil { @@ -723,6 +787,7 @@ func (s *ClientSynchronizer) ProcessBlockRange(blocks []etherman.Block, order ma } err = dbTx.Commit(s.ctx) if err != nil { + // If any goes wrong we ensure that the state is rollbacked log.Errorf("error committing state to store block. BlockNumber: %d, err: %v", blocks[i].BlockNumber, err) rollbackErr := dbTx.Rollback(s.ctx) if rollbackErr != nil { @@ -781,12 +846,118 @@ func (s *ClientSynchronizer) resetState(blockNumber uint64) error { log.Error("error committing the resetted state. Error: ", err) return err } + if s.asyncL1BlockChecker != nil { + s.asyncL1BlockChecker.OnResetState(s.ctx) + } if s.l1SyncOrchestration != nil { - s.l1SyncOrchestration.Reset(blockNumber) + lastBlock, err := s.state.GetLastBlock(s.ctx, nil) + if err != nil { + log.Errorf("error getting last block synced from db. Error: %v", err) + s.l1SyncOrchestration.Reset(blockNumber) + } else { + s.l1SyncOrchestration.Reset(lastBlock.BlockNumber) + } } return nil } +// OnDetectedMismatchL1BlockReorg function will be called when a reorg is detected (asynchronous call) +func (s *ClientSynchronizer) OnDetectedMismatchL1BlockReorg() { + log.Infof("Detected Reorg in background at block (mismatch)") + if s.l1SyncOrchestration != nil && s.l1SyncOrchestration.IsProducerRunning() { + log.Errorf("Stop synchronizer: because L1 sync parallel aborting background process") + s.l1SyncOrchestration.Abort() + } +} + +// ExecuteReorgFromMismatchBlock function will reset the state to the block before the bad block +func (s *ClientSynchronizer) ExecuteReorgFromMismatchBlock(blockNumber uint64, reason string) error { + log.Info("Detected reorg at block (mismatch): ", blockNumber, " reason: ", reason, " resetting the state to block:", blockNumber-1) + s.CleanTrustedState() + return s.resetState(blockNumber - 1) +} +func (s *ClientSynchronizer) detectedReorgBadBlockExecuteReset(lastEthBlockSynced *state.Block, badBlockNumber uint64) (bool, *state.Block, error) { + firstBlockOK, err := s.checkReorg(lastEthBlockSynced, nil) + if err != nil { + log.Warnf("error checking reorgs. using badBlock detected: %d Err: %v", badBlockNumber, err) + firstBlockOK = nil + } + if firstBlockOK != nil && firstBlockOK.BlockNumber >= badBlockNumber { + log.Warnf("Reorg detected firstBlockOk: %d. But oldest bad block detected: %d", firstBlockOK.BlockNumber, badBlockNumber) + firstBlockOK = nil + } + // We already known a bad block, reset from there + if firstBlockOK == nil { + firstBlockOK, err = s.state.GetPreviousBlockToBlockNumber(s.ctx, badBlockNumber, nil) + if err != nil { + log.Errorf("error getting previous block %d from db. Can't execute REORG. Error: %v", badBlockNumber, err) + return false, lastEthBlockSynced, err + } + } + newFirstBlock, err := s.executeReorgFromFirstValidBlock(lastEthBlockSynced, firstBlockOK) + if err != nil { + log.Errorf("error executing reorg. Retrying... Err: %v", err) + return false, lastEthBlockSynced, fmt.Errorf("error executing reorg. Err: %w", err) + } + return true, newFirstBlock, nil +} + +// checkReorgAndExecuteReset function will check if there is a reorg and execute the reset +// returns true is reset have been done +func (s *ClientSynchronizer) checkReorgAndExecuteReset(lastEthBlockSynced *state.Block) (bool, *state.Block, error) { + var err error + + block, err := s.checkReorg(lastEthBlockSynced, nil) + if err != nil { + log.Errorf("error checking reorgs. Retrying... Err: %v", err) + return false, lastEthBlockSynced, fmt.Errorf("error checking reorgs") + } + if block != nil { + newFirstBlock, err := s.executeReorgFromFirstValidBlock(lastEthBlockSynced, block) + if err != nil { + log.Errorf("error executing reorg. Retrying... Err: %v", err) + return false, lastEthBlockSynced, fmt.Errorf("error executing reorg. Err: %w", err) + } + return true, newFirstBlock, nil + } + + return false, lastEthBlockSynced, nil +} + +func (s *ClientSynchronizer) executeReorgFromFirstValidBlock(lastEthBlockSynced *state.Block, firstValidBlock *state.Block) (*state.Block, error) { + log.Infof("reorg detected. Resetting the state from block %v to block %v", lastEthBlockSynced.BlockNumber, firstValidBlock.BlockNumber) + s.CleanTrustedState() + err := s.resetState(firstValidBlock.BlockNumber) + if err != nil { + log.Errorf("error resetting the state to a previous block. Retrying... Err: %s", err.Error()) + return nil, fmt.Errorf("error resetting the state to a previous block. Err: %w", err) + } + newLastBlock, err := s.state.GetLastBlock(s.ctx, nil) + if err != nil { + log.Warnf("error getting last block synced from db, returning expected block %d. Error: %v", firstValidBlock.BlockNumber, err) + return firstValidBlock, nil + } + if newLastBlock.BlockNumber != firstValidBlock.BlockNumber { + log.Warnf("Doesnt match LastBlock on State and expecting one after a resetState. The block in state is %d and the expected block is %d", newLastBlock.BlockNumber, + firstValidBlock.BlockNumber) + return firstValidBlock, nil + } + return newLastBlock, nil +} + +func (s *ClientSynchronizer) checkReorg(latestBlock *state.Block, syncedBlock *etherman.Block) (*state.Block, error) { + if latestBlock == nil { + err := fmt.Errorf("lastEthBlockSynced is nil calling checkReorgAndExecuteReset") + log.Errorf("%s, it never have to happens", err.Error()) + return nil, err + } + block, errReturnedReorgFunction := s.newCheckReorg(latestBlock, syncedBlock) + if s.asyncL1BlockChecker != nil { + return s.asyncL1BlockChecker.CheckReorgWrapper(s.ctx, block, errReturnedReorgFunction) + } + return block, errReturnedReorgFunction +} + /* This function will check if there is a reorg. As input param needs the last ethereum block synced. Retrieve the block info from the blockchain @@ -795,34 +966,47 @@ If hash or hash parent don't match, reorg detected and the function will return must be reverted. Then, check the previous ethereum block synced, get block info from the blockchain and check hash and has parent. This operation has to be done until a match is found. */ -func (s *ClientSynchronizer) checkReorg(latestBlock *state.Block) (*state.Block, error) { + +func (s *ClientSynchronizer) newCheckReorg(latestStoredBlock *state.Block, syncedBlock *etherman.Block) (*state.Block, error) { // This function only needs to worry about reorgs if some of the reorganized blocks contained rollup info. - latestEthBlockSynced := *latestBlock - reorgedBlock := *latestBlock + latestStoredEthBlock := *latestStoredBlock + reorgedBlock := *latestStoredBlock var depth uint64 + block := syncedBlock for { - block, err := s.etherMan.EthBlockByNumber(s.ctx, reorgedBlock.BlockNumber) - if err != nil { - log.Errorf("error getting latest block synced from blockchain. Block: %d, error: %v", reorgedBlock.BlockNumber, err) - return nil, err - } - log.Infof("[checkReorg function] BlockNumber: %d BlockHash got from L1 provider: %s", block.Number().Uint64(), block.Hash().String()) - log.Infof("[checkReorg function] latestBlockNumber: %d latestBlockHash already synced: %s", latestBlock.BlockNumber, latestBlock.BlockHash.String()) - if block.NumberU64() != reorgedBlock.BlockNumber { - err = fmt.Errorf("wrong ethereum block retrieved from blockchain. Block numbers don't match. BlockNumber stored: %d. BlockNumber retrieved: %d", - reorgedBlock.BlockNumber, block.NumberU64()) - log.Error("error: ", err) - return nil, err + if block == nil { + log.Infof("[checkReorg function] Checking Block %d in L1", reorgedBlock.BlockNumber) + b, err := s.etherMan.EthBlockByNumber(s.ctx, reorgedBlock.BlockNumber) + if err != nil { + log.Errorf("error getting latest block synced from blockchain. Block: %d, error: %v", reorgedBlock.BlockNumber, err) + return nil, err + } + block = ðerman.Block{ + BlockNumber: b.Number().Uint64(), + BlockHash: b.Hash(), + ParentHash: b.ParentHash(), + } + if block.BlockNumber != reorgedBlock.BlockNumber { + err := fmt.Errorf("wrong ethereum block retrieved from blockchain. Block numbers don't match. BlockNumber stored: %d. BlockNumber retrieved: %d", + reorgedBlock.BlockNumber, block.BlockNumber) + log.Error("error: ", err) + return nil, err + } + } else { + log.Infof("[checkReorg function] Using block %d from GetRollupInfoByBlockRange", block.BlockNumber) } + log.Infof("[checkReorg function] BlockNumber: %d BlockHash got from L1 provider: %s", block.BlockNumber, block.BlockHash.String()) + log.Infof("[checkReorg function] reorgedBlockNumber: %d reorgedBlockHash already synced: %s", reorgedBlock.BlockNumber, reorgedBlock.BlockHash.String()) + // Compare hashes - if (block.Hash() != latestBlock.BlockHash || block.ParentHash() != latestBlock.ParentHash) && latestBlock.BlockNumber > s.genesis.RollupBlockNumber { - log.Infof("checkReorg: Bad block %d hashOk %t parentHashOk %t", latestBlock.BlockNumber, block.Hash() == latestBlock.BlockHash, block.ParentHash() == latestBlock.ParentHash) - log.Debug("[checkReorg function] => latestBlockNumber: ", latestBlock.BlockNumber) - log.Debug("[checkReorg function] => latestBlockHash: ", latestBlock.BlockHash) - log.Debug("[checkReorg function] => latestBlockHashParent: ", latestBlock.ParentHash) - log.Debug("[checkReorg function] => BlockNumber: ", latestBlock.BlockNumber, block.NumberU64()) - log.Debug("[checkReorg function] => BlockHash: ", block.Hash()) - log.Debug("[checkReorg function] => BlockHashParent: ", block.ParentHash()) + if (block.BlockHash != reorgedBlock.BlockHash || block.ParentHash != reorgedBlock.ParentHash) && reorgedBlock.BlockNumber > s.genesis.RollupBlockNumber { + log.Infof("checkReorg: Bad block %d hashOk %t parentHashOk %t", reorgedBlock.BlockNumber, block.BlockHash == reorgedBlock.BlockHash, block.ParentHash == reorgedBlock.ParentHash) + log.Debug("[checkReorg function] => latestBlockNumber: ", reorgedBlock.BlockNumber) + log.Debug("[checkReorg function] => latestBlockHash: ", reorgedBlock.BlockHash) + log.Debug("[checkReorg function] => latestBlockHashParent: ", reorgedBlock.ParentHash) + log.Debug("[checkReorg function] => BlockNumber: ", reorgedBlock.BlockNumber, block.BlockNumber) + log.Debug("[checkReorg function] => BlockHash: ", block.BlockHash) + log.Debug("[checkReorg function] => BlockHashParent: ", block.ParentHash) depth++ log.Debug("REORG: Looking for the latest correct ethereum block. Depth: ", depth) // Reorg detected. Getting previous block @@ -844,24 +1028,26 @@ func (s *ClientSynchronizer) checkReorg(latestBlock *state.Block) (*state.Block, return nil, errC } if errors.Is(err, state.ErrNotFound) { - log.Warn("error checking reorg: previous block not found in db: ", err) - return &state.Block{}, nil + log.Warn("error checking reorg: previous block not found in db. Reorg reached the genesis block: %v.Genesis block can't be reorged, using genesis block as starting point. Error: %v", reorgedBlock, err) + return &reorgedBlock, nil } else if err != nil { log.Error("error getting previousBlock from db. Error: ", err) return nil, err } reorgedBlock = *lb } else { - log.Debugf("checkReorg: Block %d hashOk %t parentHashOk %t", reorgedBlock.BlockNumber, block.Hash() == reorgedBlock.BlockHash, block.ParentHash() == reorgedBlock.ParentHash) + log.Debugf("checkReorg: Block %d hashOk %t parentHashOk %t", reorgedBlock.BlockNumber, block.BlockHash == reorgedBlock.BlockHash, block.ParentHash == reorgedBlock.ParentHash) break } + // This forces to get the block from L1 in the next iteration of the loop + block = nil } - if latestEthBlockSynced.BlockHash != reorgedBlock.BlockHash { - latestBlock = &reorgedBlock - log.Info("Reorg detected in block: ", latestEthBlockSynced.BlockNumber, " last block OK: ", latestBlock.BlockNumber) - return latestBlock, nil + if latestStoredEthBlock.BlockHash != reorgedBlock.BlockHash { + latestStoredBlock = &reorgedBlock + log.Info("Reorg detected in block: ", latestStoredEthBlock.BlockNumber, " last block OK: ", latestStoredBlock.BlockNumber) + return latestStoredBlock, nil } - log.Debugf("No reorg detected in block: %d. BlockHash: %s", latestEthBlockSynced.BlockNumber, latestEthBlockSynced.BlockHash.String()) + log.Debugf("No reorg detected in block: %d. BlockHash: %s", latestStoredEthBlock.BlockNumber, latestStoredEthBlock.BlockHash.String()) return nil, nil } diff --git a/synchronizer/synchronizer_test.go b/synchronizer/synchronizer_test.go index 349e509788..3d9768cd07 100644 --- a/synchronizer/synchronizer_test.go +++ b/synchronizer/synchronizer_test.go @@ -2,6 +2,7 @@ package synchronizer import ( context "context" + "math" "math/big" "testing" "time" @@ -128,6 +129,9 @@ func TestForcedBatchEtrog(t *testing.T) { SyncChunkSize: 10, L1SynchronizationMode: SequentialMode, SyncBlockProtection: "latest", + L1BlockCheck: L1BlockCheckConfig{ + Enable: false, + }, } m := mocks{ @@ -154,9 +158,12 @@ func TestForcedBatchEtrog(t *testing.T) { Run(func(args mock.Arguments) { ctx := args[0].(context.Context) parentHash := common.HexToHash("0x111") - ethHeader := ðTypes.Header{Number: big.NewInt(1), ParentHash: parentHash} - ethBlock := ethTypes.NewBlockWithHeader(ethHeader) - lastBlock := &state.Block{BlockHash: ethBlock.Hash(), BlockNumber: ethBlock.Number().Uint64()} + ethHeader0 := ðTypes.Header{Number: big.NewInt(0), ParentHash: parentHash} + ethBlock0 := ethTypes.NewBlockWithHeader(ethHeader0) + ethHeader1 := ðTypes.Header{Number: big.NewInt(1), ParentHash: ethBlock0.Hash()} + ethBlock1 := ethTypes.NewBlockWithHeader(ethHeader1) + lastBlock0 := &state.Block{BlockHash: ethBlock0.Hash(), BlockNumber: ethBlock0.Number().Uint64(), ParentHash: ethBlock0.ParentHash()} + lastBlock1 := &state.Block{BlockHash: ethBlock1.Hash(), BlockNumber: ethBlock1.Number().Uint64(), ParentHash: ethBlock1.ParentHash()} m.State. On("GetForkIDByBatchNumber", mock.Anything). @@ -164,7 +171,7 @@ func TestForcedBatchEtrog(t *testing.T) { Maybe() m.State. On("GetLastBlock", ctx, m.DbTx). - Return(lastBlock, nil). + Return(lastBlock0, nil). Once() m.State. @@ -200,14 +207,14 @@ func TestForcedBatchEtrog(t *testing.T) { Return(nil) m.Etherman. - On("EthBlockByNumber", ctx, lastBlock.BlockNumber). - Return(ethBlock, nil). - Once() + On("EthBlockByNumber", ctx, lastBlock0.BlockNumber). + Return(ethBlock0, nil). + Times(2) n := big.NewInt(rpc.LatestBlockNumber.Int64()) m.Etherman. On("HeaderByNumber", mock.Anything, n). - Return(ethHeader, nil). + Return(ethHeader1, nil). Once() t := time.Date(2024, 1, 1, 1, 0, 0, 0, time.UTC) @@ -226,7 +233,7 @@ func TestForcedBatchEtrog(t *testing.T) { } forceb := []etherman.ForcedBatch{{ - BlockNumber: lastBlock.BlockNumber, + BlockNumber: lastBlock1.BlockNumber, ForcedBatchNumber: 1, Sequencer: sequencedBatch.Coinbase, GlobalExitRoot: sequencedBatch.PolygonRollupBaseEtrogBatchData.ForcedGlobalExitRoot, @@ -234,16 +241,21 @@ func TestForcedBatchEtrog(t *testing.T) { ForcedAt: time.Unix(int64(sequencedBatch.PolygonRollupBaseEtrogBatchData.ForcedTimestamp), 0), }} - ethermanBlock := etherman.Block{ + ethermanBlock0 := etherman.Block{ + BlockNumber: 0, + ReceivedAt: t, + BlockHash: ethBlock0.Hash(), + } + ethermanBlock1 := etherman.Block{ BlockNumber: 1, ReceivedAt: t, - BlockHash: ethBlock.Hash(), + BlockHash: ethBlock1.Hash(), SequencedBatches: [][]etherman.SequencedBatch{{sequencedBatch}}, ForcedBatches: forceb, } - blocks := []etherman.Block{ethermanBlock} + blocks := []etherman.Block{ethermanBlock0, ethermanBlock1} order := map[common.Hash][]etherman.Order{ - ethBlock.Hash(): { + ethBlock1.Hash(): { { Name: etherman.ForcedBatchesOrder, Pos: 0, @@ -255,21 +267,16 @@ func TestForcedBatchEtrog(t *testing.T) { }, } - fromBlock := ethBlock.NumberU64() + 1 + fromBlock := ethBlock0.NumberU64() toBlock := fromBlock + cfg.SyncChunkSize - if toBlock > ethHeader.Number.Uint64() { - toBlock = ethHeader.Number.Uint64() + if toBlock > ethBlock1.NumberU64() { + toBlock = ethBlock1.NumberU64() } m.Etherman. On("GetRollupInfoByBlockRange", mock.Anything, fromBlock, &toBlock). Return(blocks, order, nil). Once() - m.Etherman. - On("EthBlockByNumber", ctx, lastBlock.BlockNumber). - Return(ethBlock, nil). - Once() - m.ZKEVMClient. On("BatchNumber", ctx). Return(uint64(1), nil) @@ -280,10 +287,11 @@ func TestForcedBatchEtrog(t *testing.T) { Once() stateBlock := &state.Block{ - BlockNumber: ethermanBlock.BlockNumber, - BlockHash: ethermanBlock.BlockHash, - ParentHash: ethermanBlock.ParentHash, - ReceivedAt: ethermanBlock.ReceivedAt, + BlockNumber: ethermanBlock1.BlockNumber, + BlockHash: ethermanBlock1.BlockHash, + ParentHash: ethermanBlock1.ParentHash, + ReceivedAt: ethermanBlock1.ReceivedAt, + Checked: true, } executionResponse := executor.ProcessBatchResponseV2{ @@ -295,13 +303,18 @@ func TestForcedBatchEtrog(t *testing.T) { Return(&executionResponse, nil). Times(1) + m.Etherman. + On("GetFinalizedBlockNumber", ctx). + Return(ethBlock1.NumberU64(), nil). + Once() + m.State. On("AddBlock", ctx, stateBlock, m.DbTx). Return(nil). Once() fb := []state.ForcedBatch{{ - BlockNumber: lastBlock.BlockNumber, + BlockNumber: lastBlock1.BlockNumber, ForcedBatchNumber: 1, Sequencer: sequencedBatch.Coinbase, GlobalExitRoot: sequencedBatch.PolygonRollupBaseEtrogBatchData.ForcedGlobalExitRoot, @@ -336,7 +349,7 @@ func TestForcedBatchEtrog(t *testing.T) { BatchNumber: sequencedBatch.BatchNumber, TxHash: sequencedBatch.TxHash, Coinbase: sequencedBatch.Coinbase, - BlockNumber: ethermanBlock.BlockNumber, + BlockNumber: ethermanBlock1.BlockNumber, TimestampBatchEtrog: &t, L1InfoRoot: &forcedGER, } @@ -409,21 +422,20 @@ func TestSequenceForcedBatchIncaberry(t *testing.T) { Run(func(args mock.Arguments) { ctx := args[0].(context.Context) parentHash := common.HexToHash("0x111") - ethHeader := ðTypes.Header{Number: big.NewInt(1), ParentHash: parentHash} - ethBlock := ethTypes.NewBlockWithHeader(ethHeader) - lastBlock := &state.Block{BlockHash: ethBlock.Hash(), BlockNumber: ethBlock.Number().Uint64()} + ethHeader0 := ðTypes.Header{Number: big.NewInt(0), ParentHash: parentHash} + ethBlock0 := ethTypes.NewBlockWithHeader(ethHeader0) + ethHeader1 := ðTypes.Header{Number: big.NewInt(1), ParentHash: ethBlock0.Hash()} + ethBlock1 := ethTypes.NewBlockWithHeader(ethHeader1) + lastBlock0 := &state.Block{BlockHash: ethBlock0.Hash(), BlockNumber: ethBlock0.Number().Uint64(), ParentHash: ethBlock0.ParentHash()} + lastBlock1 := &state.Block{BlockHash: ethBlock1.Hash(), BlockNumber: ethBlock1.Number().Uint64(), ParentHash: ethBlock1.ParentHash()} m.State. On("GetForkIDByBatchNumber", mock.Anything). Return(uint64(1), nil). Maybe() - m.State. - On("GetForkIDByBlockNumber", mock.Anything). - Return(uint64(1), nil). - Maybe() m.State. On("GetLastBlock", ctx, m.DbTx). - Return(lastBlock, nil). + Return(lastBlock0, nil). Once() m.State. @@ -461,15 +473,15 @@ func TestSequenceForcedBatchIncaberry(t *testing.T) { Return(nil). Once() + n := big.NewInt(rpc.LatestBlockNumber.Int64()) m.Etherman. - On("EthBlockByNumber", ctx, lastBlock.BlockNumber). - Return(ethBlock, nil). + On("HeaderByNumber", ctx, n). + Return(ethHeader1, nil). Once() - n := big.NewInt(rpc.LatestBlockNumber.Int64()) m.Etherman. - On("HeaderByNumber", ctx, n). - Return(ethHeader, nil). + On("EthBlockByNumber", ctx, lastBlock0.BlockNumber). + Return(ethBlock0, nil). Once() sequencedForceBatch := etherman.SequencedForceBatch{ @@ -485,7 +497,7 @@ func TestSequenceForcedBatchIncaberry(t *testing.T) { } forceb := []etherman.ForcedBatch{{ - BlockNumber: lastBlock.BlockNumber, + BlockNumber: lastBlock1.BlockNumber, ForcedBatchNumber: 1, Sequencer: sequencedForceBatch.Coinbase, GlobalExitRoot: sequencedForceBatch.PolygonRollupBaseEtrogBatchData.ForcedGlobalExitRoot, @@ -493,14 +505,21 @@ func TestSequenceForcedBatchIncaberry(t *testing.T) { ForcedAt: time.Unix(int64(sequencedForceBatch.PolygonRollupBaseEtrogBatchData.ForcedTimestamp), 0), }} - ethermanBlock := etherman.Block{ - BlockHash: ethBlock.Hash(), + ethermanBlock0 := etherman.Block{ + BlockNumber: ethBlock0.NumberU64(), + BlockHash: ethBlock0.Hash(), + ParentHash: ethBlock0.ParentHash(), + } + ethermanBlock1 := etherman.Block{ + BlockNumber: ethBlock1.NumberU64(), + BlockHash: ethBlock1.Hash(), + ParentHash: ethBlock1.ParentHash(), SequencedForceBatches: [][]etherman.SequencedForceBatch{{sequencedForceBatch}}, ForcedBatches: forceb, } - blocks := []etherman.Block{ethermanBlock} + blocks := []etherman.Block{ethermanBlock0, ethermanBlock1} order := map[common.Hash][]etherman.Order{ - ethBlock.Hash(): { + ethBlock1.Hash(): { { Name: etherman.ForcedBatchesOrder, Pos: 0, @@ -512,10 +531,10 @@ func TestSequenceForcedBatchIncaberry(t *testing.T) { }, } - fromBlock := ethBlock.NumberU64() + 1 + fromBlock := ethBlock0.NumberU64() toBlock := fromBlock + cfg.SyncChunkSize - if toBlock > ethHeader.Number.Uint64() { - toBlock = ethHeader.Number.Uint64() + if toBlock > ethBlock1.NumberU64() { + toBlock = ethBlock1.NumberU64() } m.Etherman. On("GetRollupInfoByBlockRange", ctx, fromBlock, &toBlock). @@ -523,8 +542,8 @@ func TestSequenceForcedBatchIncaberry(t *testing.T) { Once() m.Etherman. - On("EthBlockByNumber", ctx, lastBlock.BlockNumber). - Return(ethBlock, nil). + On("GetFinalizedBlockNumber", ctx). + Return(ethBlock1.NumberU64(), nil). Once() m.State. @@ -533,10 +552,11 @@ func TestSequenceForcedBatchIncaberry(t *testing.T) { Once() stateBlock := &state.Block{ - BlockNumber: ethermanBlock.BlockNumber, - BlockHash: ethermanBlock.BlockHash, - ParentHash: ethermanBlock.ParentHash, - ReceivedAt: ethermanBlock.ReceivedAt, + BlockNumber: ethermanBlock1.BlockNumber, + BlockHash: ethermanBlock1.BlockHash, + ParentHash: ethermanBlock1.ParentHash, + ReceivedAt: ethermanBlock1.ReceivedAt, + Checked: true, } m.State. @@ -544,8 +564,13 @@ func TestSequenceForcedBatchIncaberry(t *testing.T) { Return(nil). Once() + m.State. + On("GetForkIDByBlockNumber", stateBlock.BlockNumber). + Return(uint64(9), nil). + Once() + fb := []state.ForcedBatch{{ - BlockNumber: lastBlock.BlockNumber, + BlockNumber: lastBlock1.BlockNumber, ForcedBatchNumber: 1, Sequencer: sequencedForceBatch.Coinbase, GlobalExitRoot: sequencedForceBatch.PolygonRollupBaseEtrogBatchData.ForcedGlobalExitRoot, @@ -577,7 +602,7 @@ func TestSequenceForcedBatchIncaberry(t *testing.T) { processingContext := state.ProcessingContext{ BatchNumber: sequencedForceBatch.BatchNumber, Coinbase: sequencedForceBatch.Coinbase, - Timestamp: ethBlock.ReceivedAt, + Timestamp: ethBlock1.ReceivedAt, GlobalExitRoot: sequencedForceBatch.PolygonRollupBaseEtrogBatchData.ForcedGlobalExitRoot, ForcedBatchNum: &f, BatchL2Data: &sequencedForceBatch.PolygonRollupBaseEtrogBatchData.Transactions, @@ -592,7 +617,7 @@ func TestSequenceForcedBatchIncaberry(t *testing.T) { TxHash: sequencedForceBatch.TxHash, Coinbase: sequencedForceBatch.Coinbase, SequencerAddr: sequencedForceBatch.Coinbase, - BlockNumber: ethermanBlock.BlockNumber, + BlockNumber: ethermanBlock1.BlockNumber, } m.State. @@ -616,7 +641,10 @@ func TestSequenceForcedBatchIncaberry(t *testing.T) { m.DbTx. On("Commit", ctx). - Run(func(args mock.Arguments) { sync.Stop() }). + Run(func(args mock.Arguments) { + sync.Stop() + ctx.Done() + }). Return(nil). Once() }). @@ -890,3 +918,1365 @@ func expectedCallsForsyncTrustedState(t *testing.T, m *mocks, sync *ClientSynchr Return(nil). Once() } + +func TestReorg(t *testing.T) { + genesis := state.Genesis{ + RollupBlockNumber: uint64(0), + } + cfg := Config{ + SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second}, + SyncChunkSize: 3, + L1SynchronizationMode: SequentialMode, + SyncBlockProtection: "latest", + L1BlockCheck: L1BlockCheckConfig{ + Enable: false, + }, + } + + m := mocks{ + Etherman: mock_syncinterfaces.NewEthermanFullInterface(t), + State: mock_syncinterfaces.NewStateFullInterface(t), + Pool: mock_syncinterfaces.NewPoolInterface(t), + DbTx: syncMocks.NewDbTxMock(t), + ZKEVMClient: mock_syncinterfaces.NewZKEVMClientInterface(t), + EthTxManager: mock_syncinterfaces.NewEthTxManager(t), + } + ethermanForL1 := []syncinterfaces.EthermanFullInterface{m.Etherman} + sync, err := NewSynchronizer(false, m.Etherman, ethermanForL1, m.State, m.Pool, m.EthTxManager, m.ZKEVMClient, m.zkEVMClientEthereumCompatible, nil, genesis, cfg, false) + require.NoError(t, err) + + // state preparation + ctxMatchBy := mock.MatchedBy(func(ctx context.Context) bool { return ctx != nil }) + forkIdInterval := state.ForkIDInterval{ + ForkId: 9, + FromBatchNumber: 0, + ToBatchNumber: math.MaxUint64, + } + m.State.EXPECT().GetForkIDInMemory(uint64(9)).Return(&forkIdInterval) + + m.State. + On("BeginStateTransaction", ctxMatchBy). + Run(func(args mock.Arguments) { + ctx := args[0].(context.Context) + parentHash := common.HexToHash("0x111") + ethHeader0 := ðTypes.Header{Number: big.NewInt(0), ParentHash: parentHash} + ethBlock0 := ethTypes.NewBlockWithHeader(ethHeader0) + ethHeader1bis := ðTypes.Header{Number: big.NewInt(1), ParentHash: ethBlock0.Hash(), Time: 10, GasUsed: 20, Root: common.HexToHash("0x234")} + ethBlock1bis := ethTypes.NewBlockWithHeader(ethHeader1bis) + ethHeader2bis := ðTypes.Header{Number: big.NewInt(2), ParentHash: ethBlock1bis.Hash()} + ethBlock2bis := ethTypes.NewBlockWithHeader(ethHeader2bis) + ethHeader3bis := ðTypes.Header{Number: big.NewInt(3), ParentHash: ethBlock2bis.Hash()} + ethBlock3bis := ethTypes.NewBlockWithHeader(ethHeader3bis) + ethHeader1 := ðTypes.Header{Number: big.NewInt(1), ParentHash: ethBlock0.Hash()} + ethBlock1 := ethTypes.NewBlockWithHeader(ethHeader1) + ethHeader2 := ðTypes.Header{Number: big.NewInt(2), ParentHash: ethBlock1.Hash()} + ethBlock2 := ethTypes.NewBlockWithHeader(ethHeader2) + ethHeader3 := ðTypes.Header{Number: big.NewInt(3), ParentHash: ethBlock2.Hash()} + ethBlock3 := ethTypes.NewBlockWithHeader(ethHeader3) + + lastBlock0 := &state.Block{BlockHash: ethBlock0.Hash(), BlockNumber: ethBlock0.Number().Uint64(), ParentHash: ethBlock0.ParentHash()} + lastBlock1 := &state.Block{BlockHash: ethBlock1.Hash(), BlockNumber: ethBlock1.Number().Uint64(), ParentHash: ethBlock1.ParentHash()} + + m.State. + On("GetForkIDByBatchNumber", mock.Anything). + Return(uint64(9), nil). + Maybe() + m.State. + On("GetLastBlock", ctx, m.DbTx). + Return(lastBlock1, nil). + Once() + + m.State. + On("GetLastBatchNumber", ctx, m.DbTx). + Return(uint64(10), nil). + Once() + + m.State. + On("SetInitSyncBatch", ctx, uint64(10), m.DbTx). + Return(nil). + Once() + + m.DbTx. + On("Commit", ctx). + Return(nil). + Once() + + m.Etherman. + On("GetLatestBatchNumber"). + Return(uint64(10), nil) + + var nilDbTx pgx.Tx + m.State. + On("GetLastBatchNumber", ctx, nilDbTx). + Return(uint64(10), nil) + + m.Etherman. + On("GetLatestVerifiedBatchNum"). + Return(uint64(10), nil) + + m.State. + On("SetLastBatchInfoSeenOnEthereum", ctx, uint64(10), uint64(10), nilDbTx). + Return(nil) + + m.Etherman. + On("EthBlockByNumber", ctx, lastBlock1.BlockNumber). + Return(ethBlock1, nil). + Once() + + m.ZKEVMClient. + On("BatchNumber", ctx). + Return(uint64(1), nil). + Once() + + n := big.NewInt(rpc.LatestBlockNumber.Int64()) + m.Etherman. + On("HeaderByNumber", mock.Anything, n). + Return(ethHeader3bis, nil). + Once() + + m.Etherman. + On("EthBlockByNumber", ctx, lastBlock1.BlockNumber). + Return(ethBlock1, nil). + Once() + + ti := time.Date(2024, 1, 1, 1, 0, 0, 0, time.UTC) + + ethermanBlock1bis := etherman.Block{ + BlockNumber: 1, + ReceivedAt: ti, + BlockHash: ethBlock1bis.Hash(), + ParentHash: ethBlock1bis.ParentHash(), + } + ethermanBlock2bis := etherman.Block{ + BlockNumber: 2, + ReceivedAt: ti, + BlockHash: ethBlock2bis.Hash(), + ParentHash: ethBlock2bis.ParentHash(), + } + blocks := []etherman.Block{ethermanBlock1bis, ethermanBlock2bis} + order := map[common.Hash][]etherman.Order{} + + fromBlock := ethBlock1.NumberU64() + toBlock := fromBlock + cfg.SyncChunkSize + if toBlock > ethBlock3.NumberU64() { + toBlock = ethBlock3.NumberU64() + } + m.Etherman. + On("GetRollupInfoByBlockRange", mock.Anything, fromBlock, &toBlock). + Return(blocks, order, nil). + Once() + + m.State. + On("BeginStateTransaction", ctx). + Return(m.DbTx, nil). + Once() + + var depth uint64 = 1 + stateBlock0 := &state.Block{ + BlockNumber: ethBlock0.NumberU64(), + BlockHash: ethBlock0.Hash(), + ParentHash: ethBlock0.ParentHash(), + ReceivedAt: ti, + } + m.State. + On("GetPreviousBlock", ctx, depth, m.DbTx). + Return(stateBlock0, nil). + Once() + + m.DbTx. + On("Commit", ctx). + Return(nil). + Once() + + m.Etherman. + On("EthBlockByNumber", ctx, lastBlock0.BlockNumber). + Return(ethBlock0, nil). + Once() + + m.State. + On("BeginStateTransaction", ctx). + Return(m.DbTx, nil). + Once() + + m.State. + On("Reset", ctx, ethBlock0.NumberU64(), m.DbTx). + Return(nil). + Once() + + m.EthTxManager. + On("Reorg", ctx, ethBlock0.NumberU64()+1, m.DbTx). + Return(nil). + Once() + + m.DbTx. + On("Commit", ctx). + Return(nil). + Once() + + m.Etherman. + On("EthBlockByNumber", ctx, lastBlock0.BlockNumber). + Return(ethBlock0, nil). + Once() + + m.ZKEVMClient. + On("BatchNumber", ctx). + Return(uint64(1), nil). + Once() + + m.Etherman. + On("HeaderByNumber", mock.Anything, n). + Return(ethHeader3bis, nil). + Once() + + m.Etherman. + On("EthBlockByNumber", ctx, lastBlock0.BlockNumber). + Return(ethBlock0, nil). + Once() + + ethermanBlock0 := etherman.Block{ + BlockNumber: 0, + ReceivedAt: ti, + BlockHash: ethBlock0.Hash(), + ParentHash: ethBlock0.ParentHash(), + } + ethermanBlock3bis := etherman.Block{ + BlockNumber: 3, + ReceivedAt: ti, + BlockHash: ethBlock3bis.Hash(), + ParentHash: ethBlock3bis.ParentHash(), + } + fromBlock = 0 + blocks2 := []etherman.Block{ethermanBlock0, ethermanBlock1bis, ethermanBlock2bis, ethermanBlock3bis} + m.Etherman. + On("GetRollupInfoByBlockRange", mock.Anything, fromBlock, &toBlock). + Return(blocks2, order, nil). + Once() + + m.Etherman. + On("GetFinalizedBlockNumber", ctx). + Return(ethBlock2bis.NumberU64(), nil). + Once() + + m.State. + On("BeginStateTransaction", ctx). + Return(m.DbTx, nil). + Once() + + stateBlock1bis := &state.Block{ + BlockNumber: ethermanBlock1bis.BlockNumber, + BlockHash: ethermanBlock1bis.BlockHash, + ParentHash: ethermanBlock1bis.ParentHash, + ReceivedAt: ethermanBlock1bis.ReceivedAt, + Checked: true, + } + m.State. + On("AddBlock", ctx, stateBlock1bis, m.DbTx). + Return(nil). + Once() + + m.State. + On("GetStoredFlushID", ctx). + Return(uint64(1), cProverIDExecution, nil). + Once() + + m.DbTx. + On("Commit", ctx). + Return(nil). + Once() + + m.State. + On("BeginStateTransaction", ctx). + Return(m.DbTx, nil). + Once() + + stateBlock2bis := &state.Block{ + BlockNumber: ethermanBlock2bis.BlockNumber, + BlockHash: ethermanBlock2bis.BlockHash, + ParentHash: ethermanBlock2bis.ParentHash, + ReceivedAt: ethermanBlock2bis.ReceivedAt, + Checked: true, + } + m.State. + On("AddBlock", ctx, stateBlock2bis, m.DbTx). + Return(nil). + Once() + + m.DbTx. + On("Commit", ctx). + Return(nil). + Once() + + m.State. + On("BeginStateTransaction", ctx). + Return(m.DbTx, nil). + Once() + + stateBlock3bis := &state.Block{ + BlockNumber: ethermanBlock3bis.BlockNumber, + BlockHash: ethermanBlock3bis.BlockHash, + ParentHash: ethermanBlock3bis.ParentHash, + ReceivedAt: ethermanBlock3bis.ReceivedAt, + Checked: false, + } + m.State. + On("AddBlock", ctx, stateBlock3bis, m.DbTx). + Return(nil). + Once() + + m.DbTx. + On("Commit", ctx). + Return(nil). + Run(func(args mock.Arguments) { + sync.Stop() + ctx.Done() + }). + Once() + }). + Return(m.DbTx, nil). + Once() + + err = sync.Sync() + require.NoError(t, err) +} + +func TestLatestSyncedBlockEmpty(t *testing.T) { + genesis := state.Genesis{ + RollupBlockNumber: uint64(0), + } + cfg := Config{ + SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second}, + SyncChunkSize: 3, + L1SynchronizationMode: SequentialMode, + SyncBlockProtection: "latest", + L1BlockCheck: L1BlockCheckConfig{ + Enable: false, + }, + } + + m := mocks{ + Etherman: mock_syncinterfaces.NewEthermanFullInterface(t), + State: mock_syncinterfaces.NewStateFullInterface(t), + Pool: mock_syncinterfaces.NewPoolInterface(t), + DbTx: syncMocks.NewDbTxMock(t), + ZKEVMClient: mock_syncinterfaces.NewZKEVMClientInterface(t), + EthTxManager: mock_syncinterfaces.NewEthTxManager(t), + } + ethermanForL1 := []syncinterfaces.EthermanFullInterface{m.Etherman} + sync, err := NewSynchronizer(false, m.Etherman, ethermanForL1, m.State, m.Pool, m.EthTxManager, m.ZKEVMClient, m.zkEVMClientEthereumCompatible, nil, genesis, cfg, false) + require.NoError(t, err) + + // state preparation + ctxMatchBy := mock.MatchedBy(func(ctx context.Context) bool { return ctx != nil }) + forkIdInterval := state.ForkIDInterval{ + ForkId: 9, + FromBatchNumber: 0, + ToBatchNumber: math.MaxUint64, + } + m.State.EXPECT().GetForkIDInMemory(uint64(9)).Return(&forkIdInterval) + + m.State. + On("BeginStateTransaction", ctxMatchBy). + Run(func(args mock.Arguments) { + ctx := args[0].(context.Context) + parentHash := common.HexToHash("0x111") + ethHeader0 := ðTypes.Header{Number: big.NewInt(0), ParentHash: parentHash} + ethBlock0 := ethTypes.NewBlockWithHeader(ethHeader0) + ethHeader1 := ðTypes.Header{Number: big.NewInt(1), ParentHash: ethBlock0.Hash()} + ethBlock1 := ethTypes.NewBlockWithHeader(ethHeader1) + ethHeader2 := ðTypes.Header{Number: big.NewInt(2), ParentHash: ethBlock1.Hash()} + ethBlock2 := ethTypes.NewBlockWithHeader(ethHeader2) + ethHeader3 := ðTypes.Header{Number: big.NewInt(3), ParentHash: ethBlock2.Hash()} + ethBlock3 := ethTypes.NewBlockWithHeader(ethHeader3) + + lastBlock0 := &state.Block{BlockHash: ethBlock0.Hash(), BlockNumber: ethBlock0.Number().Uint64(), ParentHash: ethBlock0.ParentHash()} + lastBlock1 := &state.Block{BlockHash: ethBlock1.Hash(), BlockNumber: ethBlock1.Number().Uint64(), ParentHash: ethBlock1.ParentHash()} + + m.State. + On("GetForkIDByBatchNumber", mock.Anything). + Return(uint64(9), nil). + Maybe() + m.State. + On("GetLastBlock", ctx, m.DbTx). + Return(lastBlock1, nil). + Once() + + m.State. + On("GetLastBatchNumber", ctx, m.DbTx). + Return(uint64(10), nil). + Once() + + m.State. + On("SetInitSyncBatch", ctx, uint64(10), m.DbTx). + Return(nil). + Once() + + m.DbTx. + On("Commit", ctx). + Return(nil). + Once() + + m.Etherman. + On("GetLatestBatchNumber"). + Return(uint64(10), nil) + + var nilDbTx pgx.Tx + m.State. + On("GetLastBatchNumber", ctx, nilDbTx). + Return(uint64(10), nil) + + m.Etherman. + On("GetLatestVerifiedBatchNum"). + Return(uint64(10), nil) + + m.State. + On("SetLastBatchInfoSeenOnEthereum", ctx, uint64(10), uint64(10), nilDbTx). + Return(nil) + + m.Etherman. + On("EthBlockByNumber", ctx, lastBlock1.BlockNumber). + Return(ethBlock1, nil). + Once() + + m.ZKEVMClient. + On("BatchNumber", ctx). + Return(uint64(1), nil). + Once() + + n := big.NewInt(rpc.LatestBlockNumber.Int64()) + m.Etherman. + On("HeaderByNumber", mock.Anything, n). + Return(ethHeader3, nil). + Once() + + m.Etherman. + On("EthBlockByNumber", ctx, lastBlock1.BlockNumber). + Return(ethBlock1, nil). + Once() + + blocks := []etherman.Block{} + order := map[common.Hash][]etherman.Order{} + + fromBlock := ethBlock1.NumberU64() + toBlock := fromBlock + cfg.SyncChunkSize + if toBlock > ethBlock3.NumberU64() { + toBlock = ethBlock3.NumberU64() + } + m.Etherman. + On("GetRollupInfoByBlockRange", mock.Anything, fromBlock, &toBlock). + Return(blocks, order, nil). + Once() + + ti := time.Date(2024, 1, 1, 1, 0, 0, 0, time.UTC) + var depth uint64 = 1 + stateBlock0 := &state.Block{ + BlockNumber: ethBlock0.NumberU64(), + BlockHash: ethBlock0.Hash(), + ParentHash: ethBlock0.ParentHash(), + ReceivedAt: ti, + } + m.State. + On("GetPreviousBlock", ctx, depth, nil). + Return(stateBlock0, nil). + Once() + + m.Etherman. + On("EthBlockByNumber", ctx, lastBlock0.BlockNumber). + Return(ethBlock0, nil). + Once() + + m.State. + On("BeginStateTransaction", ctx). + Return(m.DbTx, nil). + Once() + + m.State. + On("Reset", ctx, ethBlock0.NumberU64(), m.DbTx). + Return(nil). + Once() + + m.EthTxManager. + On("Reorg", ctx, ethBlock0.NumberU64()+1, m.DbTx). + Return(nil). + Once() + + m.DbTx. + On("Commit", ctx). + Return(nil). + Once() + + m.Etherman. + On("EthBlockByNumber", ctx, lastBlock0.BlockNumber). + Return(ethBlock0, nil). + Once() + + m.ZKEVMClient. + On("BatchNumber", ctx). + Return(uint64(1), nil). + Once() + + m.Etherman. + On("HeaderByNumber", mock.Anything, n). + Return(ethHeader3, nil). + Once() + + m.Etherman. + On("EthBlockByNumber", ctx, lastBlock0.BlockNumber). + Return(ethBlock0, nil). + Once() + + ethermanBlock0 := etherman.Block{ + BlockNumber: 0, + ReceivedAt: ti, + BlockHash: ethBlock0.Hash(), + ParentHash: ethBlock0.ParentHash(), + } + blocks = []etherman.Block{ethermanBlock0} + fromBlock = 0 + m.Etherman. + On("GetRollupInfoByBlockRange", mock.Anything, fromBlock, &toBlock). + Return(blocks, order, nil). + Once() + + m.Etherman. + On("GetFinalizedBlockNumber", ctx). + Return(ethBlock3.NumberU64(), nil). + Run(func(args mock.Arguments) { + sync.Stop() + ctx.Done() + }). + Once() + }). + Return(m.DbTx, nil). + Once() + + err = sync.Sync() + require.NoError(t, err) +} + +func TestRegularReorg(t *testing.T) { + genesis := state.Genesis{ + RollupBlockNumber: uint64(0), + } + cfg := Config{ + SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second}, + SyncChunkSize: 3, + L1SynchronizationMode: SequentialMode, + SyncBlockProtection: "latest", + L1BlockCheck: L1BlockCheckConfig{ + Enable: false, + }, + } + + m := mocks{ + Etherman: mock_syncinterfaces.NewEthermanFullInterface(t), + State: mock_syncinterfaces.NewStateFullInterface(t), + Pool: mock_syncinterfaces.NewPoolInterface(t), + DbTx: syncMocks.NewDbTxMock(t), + ZKEVMClient: mock_syncinterfaces.NewZKEVMClientInterface(t), + EthTxManager: mock_syncinterfaces.NewEthTxManager(t), + } + ethermanForL1 := []syncinterfaces.EthermanFullInterface{m.Etherman} + sync, err := NewSynchronizer(false, m.Etherman, ethermanForL1, m.State, m.Pool, m.EthTxManager, m.ZKEVMClient, m.zkEVMClientEthereumCompatible, nil, genesis, cfg, false) + require.NoError(t, err) + + // state preparation + ctxMatchBy := mock.MatchedBy(func(ctx context.Context) bool { return ctx != nil }) + forkIdInterval := state.ForkIDInterval{ + ForkId: 9, + FromBatchNumber: 0, + ToBatchNumber: math.MaxUint64, + } + m.State.EXPECT().GetForkIDInMemory(uint64(9)).Return(&forkIdInterval) + + m.State. + On("BeginStateTransaction", ctxMatchBy). + Run(func(args mock.Arguments) { + ctx := args[0].(context.Context) + parentHash := common.HexToHash("0x111") + ethHeader0 := ðTypes.Header{Number: big.NewInt(0), ParentHash: parentHash} + ethBlock0 := ethTypes.NewBlockWithHeader(ethHeader0) + ethHeader1bis := ðTypes.Header{Number: big.NewInt(1), ParentHash: ethBlock0.Hash(), Time: 10, GasUsed: 20, Root: common.HexToHash("0x234")} + ethBlock1bis := ethTypes.NewBlockWithHeader(ethHeader1bis) + ethHeader2bis := ðTypes.Header{Number: big.NewInt(2), ParentHash: ethBlock1bis.Hash()} + ethBlock2bis := ethTypes.NewBlockWithHeader(ethHeader2bis) + ethHeader1 := ðTypes.Header{Number: big.NewInt(1), ParentHash: ethBlock0.Hash()} + ethBlock1 := ethTypes.NewBlockWithHeader(ethHeader1) + ethHeader2 := ðTypes.Header{Number: big.NewInt(2), ParentHash: ethBlock1.Hash()} + ethBlock2 := ethTypes.NewBlockWithHeader(ethHeader2) + + lastBlock0 := &state.Block{BlockHash: ethBlock0.Hash(), BlockNumber: ethBlock0.Number().Uint64(), ParentHash: ethBlock0.ParentHash()} + lastBlock1 := &state.Block{BlockHash: ethBlock1.Hash(), BlockNumber: ethBlock1.Number().Uint64(), ParentHash: ethBlock1.ParentHash()} + + m.State. + On("GetForkIDByBatchNumber", mock.Anything). + Return(uint64(9), nil). + Maybe() + m.State. + On("GetLastBlock", ctx, m.DbTx). + Return(lastBlock1, nil). + Once() + + // After a ResetState get lastblock that must be block 0 + m.State. + On("GetLastBlock", ctx, nil). + Return(lastBlock0, nil). + Once() + + m.State. + On("GetLastBatchNumber", ctx, m.DbTx). + Return(uint64(10), nil). + Once() + + m.State. + On("SetInitSyncBatch", ctx, uint64(10), m.DbTx). + Return(nil). + Once() + + m.DbTx. + On("Commit", ctx). + Return(nil). + Once() + + m.Etherman. + On("GetLatestBatchNumber"). + Return(uint64(10), nil) + + var nilDbTx pgx.Tx + m.State. + On("GetLastBatchNumber", ctx, nilDbTx). + Return(uint64(10), nil) + + m.Etherman. + On("GetLatestVerifiedBatchNum"). + Return(uint64(10), nil) + + m.State. + On("SetLastBatchInfoSeenOnEthereum", ctx, uint64(10), uint64(10), nilDbTx). + Return(nil) + + m.Etherman. + On("EthBlockByNumber", ctx, lastBlock1.BlockNumber). + Return(ethBlock1, nil). + Once() + + m.ZKEVMClient. + On("BatchNumber", ctx). + Return(uint64(1), nil). + Once() + + n := big.NewInt(rpc.LatestBlockNumber.Int64()) + + m.Etherman. + On("EthBlockByNumber", ctx, lastBlock1.BlockNumber). + Return(ethBlock1bis, nil). + Once() + + m.State. + On("BeginStateTransaction", ctx). + Return(m.DbTx, nil). + Once() + + ti := time.Date(2024, 1, 1, 1, 0, 0, 0, time.UTC) + var depth uint64 = 1 + stateBlock0 := &state.Block{ + BlockNumber: ethBlock0.NumberU64(), + BlockHash: ethBlock0.Hash(), + ParentHash: ethBlock0.ParentHash(), + ReceivedAt: ti, + } + m.State. + On("GetPreviousBlock", ctx, depth, m.DbTx). + Return(stateBlock0, nil). + Once() + + m.DbTx. + On("Commit", ctx). + Return(nil). + Once() + + m.Etherman. + On("EthBlockByNumber", ctx, lastBlock0.BlockNumber). + Return(ethBlock0, nil). + Once() + + m.State. + On("BeginStateTransaction", ctx). + Return(m.DbTx, nil). + Once() + + m.State. + On("Reset", ctx, ethBlock0.NumberU64(), m.DbTx). + Return(nil). + Once() + + m.EthTxManager. + On("Reorg", ctx, ethBlock0.NumberU64()+1, m.DbTx). + Return(nil). + Once() + + m.DbTx. + On("Commit", ctx). + Return(nil). + Once() + + m.Etherman. + On("EthBlockByNumber", ctx, lastBlock0.BlockNumber). + Return(ethBlock0, nil). + Once() + + m.ZKEVMClient. + On("BatchNumber", ctx). + Return(uint64(1), nil). + Once() + + m.Etherman. + On("HeaderByNumber", mock.Anything, n). + Return(ethHeader2bis, nil). + Once() + + m.Etherman. + On("EthBlockByNumber", ctx, lastBlock0.BlockNumber). + Return(ethBlock0, nil). + Once() + + ethermanBlock0 := etherman.Block{ + BlockNumber: 0, + ReceivedAt: ti, + BlockHash: ethBlock0.Hash(), + ParentHash: ethBlock0.ParentHash(), + } + ethermanBlock1bis := etherman.Block{ + BlockNumber: 1, + ReceivedAt: ti, + BlockHash: ethBlock1bis.Hash(), + ParentHash: ethBlock1bis.ParentHash(), + } + ethermanBlock2bis := etherman.Block{ + BlockNumber: 2, + ReceivedAt: ti, + BlockHash: ethBlock2bis.Hash(), + ParentHash: ethBlock2bis.ParentHash(), + } + blocks := []etherman.Block{ethermanBlock0, ethermanBlock1bis, ethermanBlock2bis} + order := map[common.Hash][]etherman.Order{} + + fromBlock := ethBlock0.NumberU64() + toBlock := fromBlock + cfg.SyncChunkSize + if toBlock > ethBlock2.NumberU64() { + toBlock = ethBlock2.NumberU64() + } + m.Etherman. + On("GetRollupInfoByBlockRange", mock.Anything, fromBlock, &toBlock). + Return(blocks, order, nil). + Once() + + m.Etherman. + On("GetFinalizedBlockNumber", ctx). + Return(ethBlock2bis.NumberU64(), nil). + Once() + + m.State. + On("BeginStateTransaction", ctx). + Return(m.DbTx, nil). + Once() + + stateBlock1bis := &state.Block{ + BlockNumber: ethermanBlock1bis.BlockNumber, + BlockHash: ethermanBlock1bis.BlockHash, + ParentHash: ethermanBlock1bis.ParentHash, + ReceivedAt: ethermanBlock1bis.ReceivedAt, + Checked: true, + } + m.State. + On("AddBlock", ctx, stateBlock1bis, m.DbTx). + Return(nil). + Once() + + m.State. + On("GetStoredFlushID", ctx). + Return(uint64(1), cProverIDExecution, nil). + Once() + + m.DbTx. + On("Commit", ctx). + Return(nil). + Once() + + m.State. + On("BeginStateTransaction", ctx). + Return(m.DbTx, nil). + Once() + + stateBlock2bis := &state.Block{ + BlockNumber: ethermanBlock2bis.BlockNumber, + BlockHash: ethermanBlock2bis.BlockHash, + ParentHash: ethermanBlock2bis.ParentHash, + ReceivedAt: ethermanBlock2bis.ReceivedAt, + Checked: true, + } + m.State. + On("AddBlock", ctx, stateBlock2bis, m.DbTx). + Return(nil). + Once() + + m.DbTx. + On("Commit", ctx). + Run(func(args mock.Arguments) { + sync.Stop() + ctx.Done() + }). + Return(nil). + Once() + }). + Return(m.DbTx, nil). + Once() + + err = sync.Sync() + require.NoError(t, err) +} + +func TestLatestSyncedBlockEmptyWithExtraReorg(t *testing.T) { + genesis := state.Genesis{ + RollupBlockNumber: uint64(0), + } + cfg := Config{ + SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second}, + SyncChunkSize: 3, + L1SynchronizationMode: SequentialMode, + SyncBlockProtection: "latest", + L1BlockCheck: L1BlockCheckConfig{ + Enable: false, + }, + } + + m := mocks{ + Etherman: mock_syncinterfaces.NewEthermanFullInterface(t), + State: mock_syncinterfaces.NewStateFullInterface(t), + Pool: mock_syncinterfaces.NewPoolInterface(t), + DbTx: syncMocks.NewDbTxMock(t), + ZKEVMClient: mock_syncinterfaces.NewZKEVMClientInterface(t), + EthTxManager: mock_syncinterfaces.NewEthTxManager(t), + } + ethermanForL1 := []syncinterfaces.EthermanFullInterface{m.Etherman} + sync, err := NewSynchronizer(false, m.Etherman, ethermanForL1, m.State, m.Pool, m.EthTxManager, m.ZKEVMClient, m.zkEVMClientEthereumCompatible, nil, genesis, cfg, false) + require.NoError(t, err) + + // state preparation + ctxMatchBy := mock.MatchedBy(func(ctx context.Context) bool { return ctx != nil }) + forkIdInterval := state.ForkIDInterval{ + ForkId: 9, + FromBatchNumber: 0, + ToBatchNumber: math.MaxUint64, + } + m.State.EXPECT().GetForkIDInMemory(uint64(9)).Return(&forkIdInterval) + + m.State. + On("BeginStateTransaction", ctxMatchBy). + Run(func(args mock.Arguments) { + ctx := args[0].(context.Context) + parentHash := common.HexToHash("0x111") + ethHeader0 := ðTypes.Header{Number: big.NewInt(0), ParentHash: parentHash} + ethBlock0 := ethTypes.NewBlockWithHeader(ethHeader0) + ethHeader1 := ðTypes.Header{Number: big.NewInt(1), ParentHash: ethBlock0.Hash()} + ethBlock1 := ethTypes.NewBlockWithHeader(ethHeader1) + ethHeader1bis := ðTypes.Header{Number: big.NewInt(1), ParentHash: ethBlock0.Hash(), Time: 0, GasUsed: 10} + ethBlock1bis := ethTypes.NewBlockWithHeader(ethHeader1bis) + ethHeader2 := ðTypes.Header{Number: big.NewInt(2), ParentHash: ethBlock1.Hash()} + ethBlock2 := ethTypes.NewBlockWithHeader(ethHeader2) + ethHeader3 := ðTypes.Header{Number: big.NewInt(3), ParentHash: ethBlock2.Hash()} + ethBlock3 := ethTypes.NewBlockWithHeader(ethHeader3) + + lastBlock0 := &state.Block{BlockHash: ethBlock0.Hash(), BlockNumber: ethBlock0.Number().Uint64(), ParentHash: ethBlock0.ParentHash()} + lastBlock1 := &state.Block{BlockHash: ethBlock1.Hash(), BlockNumber: ethBlock1.Number().Uint64(), ParentHash: ethBlock1.ParentHash()} + lastBlock2 := &state.Block{BlockHash: ethBlock2.Hash(), BlockNumber: ethBlock2.Number().Uint64(), ParentHash: ethBlock2.ParentHash()} + + m.State. + On("GetForkIDByBatchNumber", mock.Anything). + Return(uint64(9), nil). + Maybe() + m.State. + On("GetLastBlock", ctx, m.DbTx). + Return(lastBlock2, nil). + Once() + + m.State. + On("GetLastBatchNumber", ctx, m.DbTx). + Return(uint64(10), nil). + Once() + + m.State. + On("SetInitSyncBatch", ctx, uint64(10), m.DbTx). + Return(nil). + Once() + + m.DbTx. + On("Commit", ctx). + Return(nil). + Once() + + m.Etherman. + On("GetLatestBatchNumber"). + Return(uint64(10), nil) + + var nilDbTx pgx.Tx + m.State. + On("GetLastBatchNumber", ctx, nilDbTx). + Return(uint64(10), nil) + + m.Etherman. + On("GetLatestVerifiedBatchNum"). + Return(uint64(10), nil) + + m.State. + On("SetLastBatchInfoSeenOnEthereum", ctx, uint64(10), uint64(10), nilDbTx). + Return(nil) + + m.Etherman. + On("EthBlockByNumber", ctx, lastBlock2.BlockNumber). + Return(ethBlock2, nil). + Once() + + m.ZKEVMClient. + On("BatchNumber", ctx). + Return(uint64(1), nil). + Once() + + n := big.NewInt(rpc.LatestBlockNumber.Int64()) + m.Etherman. + On("HeaderByNumber", mock.Anything, n). + Return(ethHeader3, nil). + Once() + + m.Etherman. + On("EthBlockByNumber", ctx, lastBlock2.BlockNumber). + Return(ethBlock2, nil). + Once() + + blocks := []etherman.Block{} + order := map[common.Hash][]etherman.Order{} + + fromBlock := ethBlock2.NumberU64() + toBlock := fromBlock + cfg.SyncChunkSize + if toBlock > ethBlock3.NumberU64() { + toBlock = ethBlock3.NumberU64() + } + m.Etherman. + On("GetRollupInfoByBlockRange", mock.Anything, fromBlock, &toBlock). + Return(blocks, order, nil). + Once() + + ti := time.Date(2024, 1, 1, 1, 0, 0, 0, time.UTC) + var depth uint64 = 1 + stateBlock1 := &state.Block{ + BlockNumber: ethBlock1.NumberU64(), + BlockHash: ethBlock1.Hash(), + ParentHash: ethBlock1.ParentHash(), + ReceivedAt: ti, + } + m.State. + On("GetPreviousBlock", ctx, depth, nil). + Return(stateBlock1, nil). + Once() + + m.Etherman. + On("EthBlockByNumber", ctx, lastBlock1.BlockNumber). + Return(ethBlock1bis, nil). + Once() + + m.State. + On("BeginStateTransaction", ctx). + Return(m.DbTx, nil). + Once() + + stateBlock0 := &state.Block{ + BlockNumber: ethBlock0.NumberU64(), + BlockHash: ethBlock0.Hash(), + ParentHash: ethBlock0.ParentHash(), + ReceivedAt: ti, + } + m.State. + On("GetPreviousBlock", ctx, depth, m.DbTx). + Return(stateBlock0, nil). + Once() + + m.DbTx. + On("Commit", ctx). + Return(nil). + Once() + + m.Etherman. + On("EthBlockByNumber", ctx, lastBlock0.BlockNumber). + Return(ethBlock0, nil). + Once() + + m.State. + On("BeginStateTransaction", ctx). + Return(m.DbTx, nil). + Once() + + m.State. + On("Reset", ctx, ethBlock0.NumberU64(), m.DbTx). + Return(nil). + Once() + + m.EthTxManager. + On("Reorg", ctx, ethBlock0.NumberU64()+1, m.DbTx). + Return(nil). + Once() + + m.DbTx. + On("Commit", ctx). + Return(nil). + Once() + + m.Etherman. + On("EthBlockByNumber", ctx, lastBlock0.BlockNumber). + Return(ethBlock0, nil). + Once() + + m.ZKEVMClient. + On("BatchNumber", ctx). + Return(uint64(1), nil). + Once() + + m.Etherman. + On("HeaderByNumber", mock.Anything, n). + Return(ethHeader3, nil). + Once() + + m.Etherman. + On("EthBlockByNumber", ctx, lastBlock0.BlockNumber). + Return(ethBlock0, nil). + Once() + + ethermanBlock0 := etherman.Block{ + BlockNumber: 0, + ReceivedAt: ti, + BlockHash: ethBlock0.Hash(), + ParentHash: ethBlock0.ParentHash(), + } + ethermanBlock1bis := etherman.Block{ + BlockNumber: 1, + ReceivedAt: ti, + BlockHash: ethBlock1.Hash(), + ParentHash: ethBlock1.ParentHash(), + } + blocks = []etherman.Block{ethermanBlock0, ethermanBlock1bis} + fromBlock = 0 + m.Etherman. + On("GetRollupInfoByBlockRange", mock.Anything, fromBlock, &toBlock). + Return(blocks, order, nil). + Once() + + m.Etherman. + On("GetFinalizedBlockNumber", ctx). + Return(ethBlock3.NumberU64(), nil). + Once() + + m.State. + On("BeginStateTransaction", ctx). + Return(m.DbTx, nil). + Once() + + stateBlock1bis := &state.Block{ + BlockNumber: ethermanBlock1bis.BlockNumber, + BlockHash: ethermanBlock1bis.BlockHash, + ParentHash: ethermanBlock1bis.ParentHash, + ReceivedAt: ethermanBlock1bis.ReceivedAt, + Checked: true, + } + m.State. + On("AddBlock", ctx, stateBlock1bis, m.DbTx). + Return(nil). + Once() + + m.State. + On("GetStoredFlushID", ctx). + Return(uint64(1), cProverIDExecution, nil). + Once() + + m.DbTx. + On("Commit", ctx). + Return(nil). + Run(func(args mock.Arguments) { + sync.Stop() + ctx.Done() + }). + Once() + }). + Return(m.DbTx, nil). + Once() + + err = sync.Sync() + require.NoError(t, err) +} + +func TestCallFromEmptyBlockAndReorg(t *testing.T) { + genesis := state.Genesis{ + RollupBlockNumber: uint64(0), + } + cfg := Config{ + SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second}, + SyncChunkSize: 3, + L1SynchronizationMode: SequentialMode, + SyncBlockProtection: "latest", + L1BlockCheck: L1BlockCheckConfig{ + Enable: false, + }, + } + + m := mocks{ + Etherman: mock_syncinterfaces.NewEthermanFullInterface(t), + State: mock_syncinterfaces.NewStateFullInterface(t), + Pool: mock_syncinterfaces.NewPoolInterface(t), + DbTx: syncMocks.NewDbTxMock(t), + ZKEVMClient: mock_syncinterfaces.NewZKEVMClientInterface(t), + EthTxManager: mock_syncinterfaces.NewEthTxManager(t), + } + ethermanForL1 := []syncinterfaces.EthermanFullInterface{m.Etherman} + sync, err := NewSynchronizer(false, m.Etherman, ethermanForL1, m.State, m.Pool, m.EthTxManager, m.ZKEVMClient, m.zkEVMClientEthereumCompatible, nil, genesis, cfg, false) + require.NoError(t, err) + + // state preparation + ctxMatchBy := mock.MatchedBy(func(ctx context.Context) bool { return ctx != nil }) + forkIdInterval := state.ForkIDInterval{ + ForkId: 9, + FromBatchNumber: 0, + ToBatchNumber: math.MaxUint64, + } + m.State.EXPECT().GetForkIDInMemory(uint64(9)).Return(&forkIdInterval) + + m.State. + On("BeginStateTransaction", ctxMatchBy). + Run(func(args mock.Arguments) { + ctx := args[0].(context.Context) + parentHash := common.HexToHash("0x111") + ethHeader0 := ðTypes.Header{Number: big.NewInt(0), ParentHash: parentHash} + ethBlock0 := ethTypes.NewBlockWithHeader(ethHeader0) + ethHeader1bis := ðTypes.Header{Number: big.NewInt(1), ParentHash: ethBlock0.Hash(), Time: 10, GasUsed: 20, Root: common.HexToHash("0x234")} + ethBlock1bis := ethTypes.NewBlockWithHeader(ethHeader1bis) + ethHeader2bis := ðTypes.Header{Number: big.NewInt(2), ParentHash: ethBlock1bis.Hash()} + ethBlock2bis := ethTypes.NewBlockWithHeader(ethHeader2bis) + ethHeader1 := ðTypes.Header{Number: big.NewInt(1), ParentHash: ethBlock0.Hash()} + ethBlock1 := ethTypes.NewBlockWithHeader(ethHeader1) + ethHeader2 := ðTypes.Header{Number: big.NewInt(2), ParentHash: ethBlock1.Hash()} + ethBlock2 := ethTypes.NewBlockWithHeader(ethHeader2) + + lastBlock0 := &state.Block{BlockHash: ethBlock0.Hash(), BlockNumber: ethBlock0.Number().Uint64(), ParentHash: ethBlock0.ParentHash()} + lastBlock1 := &state.Block{BlockHash: ethBlock1.Hash(), BlockNumber: ethBlock1.Number().Uint64(), ParentHash: ethBlock1.ParentHash()} + + m.State. + On("GetForkIDByBatchNumber", mock.Anything). + Return(uint64(9), nil). + Maybe() + m.State. + On("GetLastBlock", ctx, m.DbTx). + Return(lastBlock1, nil). + Once() + + m.State. + On("GetLastBatchNumber", ctx, m.DbTx). + Return(uint64(10), nil). + Once() + + m.State. + On("SetInitSyncBatch", ctx, uint64(10), m.DbTx). + Return(nil). + Once() + + m.DbTx. + On("Commit", ctx). + Return(nil). + Once() + + m.Etherman. + On("GetLatestBatchNumber"). + Return(uint64(10), nil) + + var nilDbTx pgx.Tx + m.State. + On("GetLastBatchNumber", ctx, nilDbTx). + Return(uint64(10), nil) + + m.Etherman. + On("GetLatestVerifiedBatchNum"). + Return(uint64(10), nil) + + m.State. + On("SetLastBatchInfoSeenOnEthereum", ctx, uint64(10), uint64(10), nilDbTx). + Return(nil) + + m.Etherman. + On("EthBlockByNumber", ctx, lastBlock1.BlockNumber). + Return(ethBlock1, nil). + Once() + + m.ZKEVMClient. + On("BatchNumber", ctx). + Return(uint64(1), nil). + Once() + + n := big.NewInt(rpc.LatestBlockNumber.Int64()) + + m.Etherman. + On("EthBlockByNumber", ctx, lastBlock1.BlockNumber). + Return(ethBlock1, nil). + Once() + + m.Etherman. + On("HeaderByNumber", mock.Anything, n). + Return(ethHeader2bis, nil). + Once() + + // m.Etherman. + // On("EthBlockByNumber", ctx, lastBlock1.BlockNumber). + // Return(ethBlock1, nil). + // Once() + + ti := time.Date(2024, 1, 1, 1, 0, 0, 0, time.UTC) + + ethermanBlock0 := etherman.Block{ + BlockNumber: 0, + ReceivedAt: ti, + BlockHash: ethBlock0.Hash(), + ParentHash: ethBlock0.ParentHash(), + } + ethermanBlock2bis := etherman.Block{ + BlockNumber: 2, + ReceivedAt: ti, + BlockHash: ethBlock2bis.Hash(), + ParentHash: ethBlock2bis.ParentHash(), + } + blocks := []etherman.Block{ethermanBlock2bis} + order := map[common.Hash][]etherman.Order{} + + fromBlock := ethBlock1.NumberU64() + toBlock := fromBlock + cfg.SyncChunkSize + if toBlock > ethBlock2.NumberU64() { + toBlock = ethBlock2.NumberU64() + } + m.Etherman. + On("GetRollupInfoByBlockRange", mock.Anything, fromBlock, &toBlock). + Return(blocks, order, nil). + Once() + + m.State. + On("BeginStateTransaction", ctx). + Return(m.DbTx, nil). + Once() + + var depth uint64 = 1 + stateBlock0 := &state.Block{ + BlockNumber: ethBlock0.NumberU64(), + BlockHash: ethBlock0.Hash(), + ParentHash: ethBlock0.ParentHash(), + ReceivedAt: ti, + } + m.State. + On("GetPreviousBlock", ctx, depth, m.DbTx). + Return(stateBlock0, nil). + Once() + + m.DbTx. + On("Commit", ctx). + Return(nil). + Once() + + m.Etherman. + On("EthBlockByNumber", ctx, lastBlock0.BlockNumber). + Return(ethBlock0, nil). + Once() + + m.State. + On("BeginStateTransaction", ctx). + Return(m.DbTx, nil). + Once() + + m.State. + On("Reset", ctx, ethBlock0.NumberU64(), m.DbTx). + Return(nil). + Once() + + m.EthTxManager. + On("Reorg", ctx, ethBlock0.NumberU64()+1, m.DbTx). + Return(nil). + Once() + + m.DbTx. + On("Commit", ctx). + Return(nil). + Once() + + m.Etherman. + On("EthBlockByNumber", ctx, lastBlock0.BlockNumber). + Return(ethBlock0, nil). + Once() + + m.ZKEVMClient. + On("BatchNumber", ctx). + Return(uint64(1), nil). + Once() + + m.Etherman. + On("EthBlockByNumber", ctx, lastBlock0.BlockNumber). + Return(ethBlock0, nil). + Once() + + m.Etherman. + On("HeaderByNumber", mock.Anything, n). + Return(ethHeader2bis, nil). + Once() + + blocks = []etherman.Block{ethermanBlock0, ethermanBlock2bis} + fromBlock = ethBlock0.NumberU64() + toBlock = fromBlock + cfg.SyncChunkSize + if toBlock > ethBlock2.NumberU64() { + toBlock = ethBlock2.NumberU64() + } + m.Etherman. + On("GetRollupInfoByBlockRange", mock.Anything, fromBlock, &toBlock). + Return(blocks, order, nil). + Once() + + m.Etherman. + On("GetFinalizedBlockNumber", ctx). + Return(ethBlock2bis.NumberU64(), nil). + Once() + + m.State. + On("BeginStateTransaction", ctx). + Return(m.DbTx, nil). + Once() + + stateBlock2bis := &state.Block{ + BlockNumber: ethermanBlock2bis.BlockNumber, + BlockHash: ethermanBlock2bis.BlockHash, + ParentHash: ethermanBlock2bis.ParentHash, + ReceivedAt: ethermanBlock2bis.ReceivedAt, + Checked: true, + } + m.State. + On("AddBlock", ctx, stateBlock2bis, m.DbTx). + Return(nil). + Once() + + m.State. + On("GetStoredFlushID", ctx). + Return(uint64(1), cProverIDExecution, nil). + Once() + + m.DbTx. + On("Commit", ctx). + Run(func(args mock.Arguments) { + sync.Stop() + ctx.Done() + }). + Return(nil). + Once() + }). + Return(m.DbTx, nil). + Once() + + err = sync.Sync() + require.NoError(t, err) +} diff --git a/test/Makefile b/test/Makefile index 339301c3d4..35cd659924 100644 --- a/test/Makefile +++ b/test/Makefile @@ -686,7 +686,7 @@ generate-mocks-sequencer: ## Generates mocks for sequencer , using mockery tool export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=stateInterface --dir=../sequencer --output=../sequencer --outpkg=sequencer --inpackage --structname=StateMock --filename=mock_state.go export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=txPool --dir=../sequencer --output=../sequencer --outpkg=sequencer --inpackage --structname=PoolMock --filename=mock_pool.go export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=Tx --srcpkg=github.com/jackc/pgx/v4 --output=../sequencer --outpkg=sequencer --structname=DbTxMock --filename=mock_dbtx.go - export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=etherman --dir=../sequencer --output=../sequencer --outpkg=sequencer --inpackage --structname=EthermanMock --filename=mock_etherman.go + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=ethermanInterface --dir=../sequencer --output=../sequencer --outpkg=sequencer --inpackage --structname=EthermanMock --filename=mock_etherman.go .PHONY: generate-mocks-sequencesender generate-mocks-sequencesender: ## Generates mocks for sequencesender , using mockery tool @@ -725,8 +725,11 @@ generate-mocks-synchronizer: ## Generates mocks for synchronizer , using mockery rm -Rf ../synchronizer/actions/elderberry/mocks export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --all --case snake --dir ../synchronizer/actions/elderberry --output ../synchronizer/actions/elderberry/mocks --outpkg mock_elderberry ${COMMON_MOCKERY_PARAMS} - - + + rm -Rf ../synchronizer/l1_check_block/mocks + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --all --case snake --dir ../synchronizer/l1_check_block --output ../synchronizer/l1_check_block/mocks --outpkg mock_l1_check_block ${COMMON_MOCKERY_PARAMS} + + export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=Tx --srcpkg=github.com/jackc/pgx/v4 --output=../synchronizer/mocks --structname=DbTxMock --filename=mock_dbtx.go ${COMMON_MOCKERY_PARAMS} diff --git a/test/config/test.genesis.config.json b/test/config/test.genesis.config.json index 1f24ff2a62..2646957eb6 100644 --- a/test/config/test.genesis.config.json +++ b/test/config/test.genesis.config.json @@ -6,96 +6,96 @@ "polTokenAddress": "0x5FbDB2315678afecb367f032d93F642f64180aa3", "polygonZkEVMGlobalExitRootAddress": "0x8A791620dd6260079BF849Dc5567aDC3F2FdC318" }, - "rollupCreationBlockNumber": 83, - "rollupManagerCreationBlockNumber": 74, + "rollupCreationBlockNumber": 46, + "rollupManagerCreationBlockNumber": 41, "root": "0xcc9ec17819f4ac7f282949ca8c379c4d3ee1b8b7908c51b9b405b6319af67b32", "genesis": [ - { - "contractName": "PolygonZkEVMDeployer", - "balance": "0", - "nonce": "4", - "address": "0x51dbd54FCCb6b3A07738fd3E156D588e71f79973", - "bytecode": "0x6080604052600436106100705760003560e01c8063715018a61161004e578063715018a6146100e65780638da5cb5b146100fb578063e11ae6cb14610126578063f2fde38b1461013957600080fd5b80632b79805a146100755780634a94d4871461008a5780636d07dbf81461009d575b600080fd5b610088610083366004610927565b610159565b005b6100886100983660046109c7565b6101cb565b3480156100a957600080fd5b506100bd6100b8366004610a1e565b61020d565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b50610088610220565b34801561010757600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100bd565b610088610134366004610a40565b610234565b34801561014557600080fd5b50610088610154366004610a90565b61029b565b610161610357565b600061016e8585856103d8565b905061017a8183610537565b5060405173ffffffffffffffffffffffffffffffffffffffff821681527fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a15050505050565b6101d3610357565b6101de83838361057b565b506040517f25adb19089b6a549831a273acdf7908cff8b7ee5f551f8d1d37996cf01c5df5b90600090a1505050565b600061021983836105a9565b9392505050565b610228610357565b61023260006105b6565b565b61023c610357565b60006102498484846103d8565b60405173ffffffffffffffffffffffffffffffffffffffff821681529091507fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a150505050565b6102a3610357565b73ffffffffffffffffffffffffffffffffffffffff811661034b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610354816105b6565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610232576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610342565b600083471015610444576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e63650000006044820152606401610342565b81516000036104af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f6044820152606401610342565b8282516020840186f5905073ffffffffffffffffffffffffffffffffffffffff8116610219576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f79000000000000006044820152606401610342565b6060610219838360006040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c6564000081525061062b565b60606105a1848484604051806060016040528060298152602001610b3d6029913961062b565b949350505050565b6000610219838330610744565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060824710156106bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610342565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516106e69190610acf565b60006040518083038185875af1925050503d8060008114610723576040519150601f19603f3d011682016040523d82523d6000602084013e610728565b606091505b50915091506107398783838761076e565b979650505050505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b606083156108045782516000036107fd5773ffffffffffffffffffffffffffffffffffffffff85163b6107fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610342565b50816105a1565b6105a183838151156108195781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103429190610aeb565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f83011261088d57600080fd5b813567ffffffffffffffff808211156108a8576108a861084d565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156108ee576108ee61084d565b8160405283815286602085880101111561090757600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000806080858703121561093d57600080fd5b8435935060208501359250604085013567ffffffffffffffff8082111561096357600080fd5b61096f8883890161087c565b9350606087013591508082111561098557600080fd5b506109928782880161087c565b91505092959194509250565b803573ffffffffffffffffffffffffffffffffffffffff811681146109c257600080fd5b919050565b6000806000606084860312156109dc57600080fd5b6109e58461099e565b9250602084013567ffffffffffffffff811115610a0157600080fd5b610a0d8682870161087c565b925050604084013590509250925092565b60008060408385031215610a3157600080fd5b50508035926020909101359150565b600080600060608486031215610a5557600080fd5b8335925060208401359150604084013567ffffffffffffffff811115610a7a57600080fd5b610a868682870161087c565b9150509250925092565b600060208284031215610aa257600080fd5b6102198261099e565b60005b83811015610ac6578181015183820152602001610aae565b50506000910152565b60008251610ae1818460208701610aab565b9190910192915050565b6020815260008251806020840152610b0a816040850160208701610aab565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a2646970667358221220964619cee0e0baf94c6f8763f013be157da5d54c89e5cff4a8caf4266e13f13a64736f6c63430008140033", - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266" - } - }, - { - "contractName": "ProxyAdmin", - "balance": "0", - "nonce": "1", - "address": "0xe34Fe58DDa5b8c6D547E4857E987633aa86a5e90", - "bytecode": "0x60806040526004361061007b5760003560e01c80639623609d1161004e5780639623609d1461012b57806399a88ec41461013e578063f2fde38b1461015e578063f3b7dead1461017e57600080fd5b8063204e1c7a14610080578063715018a6146100c95780637eff275e146100e05780638da5cb5b14610100575b600080fd5b34801561008c57600080fd5b506100a061009b366004610608565b61019e565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100d557600080fd5b506100de610255565b005b3480156100ec57600080fd5b506100de6100fb36600461062c565b610269565b34801561010c57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100a0565b6100de610139366004610694565b6102f7565b34801561014a57600080fd5b506100de61015936600461062c565b61038c565b34801561016a57600080fd5b506100de610179366004610608565b6103e8565b34801561018a57600080fd5b506100a0610199366004610608565b6104a4565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907f5c60da1b00000000000000000000000000000000000000000000000000000000815260040190565b600060405180830381855afa9150503d8060008114610225576040519150601f19603f3d011682016040523d82523d6000602084013e61022a565b606091505b50915091508161023957600080fd5b8080602001905181019061024d9190610788565b949350505050565b61025d6104f0565b6102676000610571565b565b6102716104f0565b6040517f8f28397000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690638f283970906024015b600060405180830381600087803b1580156102db57600080fd5b505af11580156102ef573d6000803e3d6000fd5b505050505050565b6102ff6104f0565b6040517f4f1ef28600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690634f1ef28690349061035590869086906004016107a5565b6000604051808303818588803b15801561036e57600080fd5b505af1158015610382573d6000803e3d6000fd5b5050505050505050565b6103946104f0565b6040517f3659cfe600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690633659cfe6906024016102c1565b6103f06104f0565b73ffffffffffffffffffffffffffffffffffffffff8116610498576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6104a181610571565b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907ff851a44000000000000000000000000000000000000000000000000000000000815260040190565b60005473ffffffffffffffffffffffffffffffffffffffff163314610267576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161048f565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b73ffffffffffffffffffffffffffffffffffffffff811681146104a157600080fd5b60006020828403121561061a57600080fd5b8135610625816105e6565b9392505050565b6000806040838503121561063f57600080fd5b823561064a816105e6565b9150602083013561065a816105e6565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000606084860312156106a957600080fd5b83356106b4816105e6565b925060208401356106c4816105e6565b9150604084013567ffffffffffffffff808211156106e157600080fd5b818601915086601f8301126106f557600080fd5b81358181111561070757610707610665565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561074d5761074d610665565b8160405282815289602084870101111561076657600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b60006020828403121561079a57600080fd5b8151610625816105e6565b73ffffffffffffffffffffffffffffffffffffffff8316815260006020604081840152835180604085015260005b818110156107ef578581018301518582016060015282016107d3565b5060006060828601015260607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010192505050939250505056fea2646970667358221220c9867ffac53151bdb1305d8f5e3e883cd83e5270c7ec09cdc24e837b2e65239064736f6c63430008140033", - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000000165878a594ca255338adfa4d48449f69242eb8f" - } - }, - { - "contractName": "PolygonZkEVMBridge implementation", - "balance": "0", - "nonce": "1", - "address": "0x493732fB136a380920C390a85fc27d79C7b70756", - "bytecode": "0x6080604052600436106101a35760003560e01c806383f24403116100e2578063ccaa2d1111610085578063ccaa2d1114610511578063cd58657914610531578063d02103ca14610544578063dbc169761461056b578063ee25560b14610580578063f5efcd79146105ad578063f811bff7146105cd578063fb570834146105ed57600080fd5b806383f244031461040b5780638ed7e3f21461042b578063aaa13cc21461044b578063b8b284d01461046b578063bab161bf1461048b578063be5831c7146104ad578063c00f14ab146104d1578063cc461632146104f157600080fd5b80633cbc795b1161014a5780633cbc795b146102fd5780633e197043146103365780634b2f336d146103565780635ca1e165146103765780637843298b1461038b57806379e2cf97146103ab57806381b1c174146103c057806383c43a55146103f657600080fd5b806315064c96146101a85780632072f6c5146101d757806322e95f2c146101ee578063240ff3781461021b57806327aef4e81461022e5780632dfdf0b514610250578063318aee3d146102745780633c351e10146102dd575b600080fd5b3480156101b457600080fd5b506068546101c29060ff1681565b60405190151581526020015b60405180910390f35b3480156101e357600080fd5b506101ec61060d565b005b3480156101fa57600080fd5b5061020e610209366004612b65565b610642565b6040516101ce9190612b9c565b6101ec610229366004612c06565b610693565b34801561023a57600080fd5b50610243610703565b6040516101ce9190612ccf565b34801561025c57600080fd5b5061026660535481565b6040519081526020016101ce565b34801561028057600080fd5b506102b961028f366004612ce9565b606b6020526000908152604090205463ffffffff811690600160201b90046001600160a01b031682565b6040805163ffffffff90931683526001600160a01b039091166020830152016101ce565b3480156102e957600080fd5b50606d5461020e906001600160a01b031681565b34801561030957600080fd5b50606d5461032190600160a01b900463ffffffff1681565b60405163ffffffff90911681526020016101ce565b34801561034257600080fd5b50610266610351366004612d15565b610791565b34801561036257600080fd5b50606f5461020e906001600160a01b031681565b34801561038257600080fd5b5061026661081e565b34801561039757600080fd5b5061020e6103a6366004612d94565b6108fb565b3480156103b757600080fd5b506101ec610925565b3480156103cc57600080fd5b5061020e6103db366004612ddd565b606a602052600090815260409020546001600160a01b031681565b34801561040257600080fd5b50610243610946565b34801561041757600080fd5b50610266610426366004612e08565b610965565b34801561043757600080fd5b50606c5461020e906001600160a01b031681565b34801561045757600080fd5b5061020e610466366004612f12565b610a3b565b34801561047757600080fd5b506101ec610486366004612fad565b610b3d565b34801561049757600080fd5b5060685461032190610100900463ffffffff1681565b3480156104b957600080fd5b5060685461032190600160c81b900463ffffffff1681565b3480156104dd57600080fd5b506102436104ec366004612ce9565b610c04565b3480156104fd57600080fd5b506101c261050c36600461302f565b610c49565b34801561051d57600080fd5b506101ec61052c366004613062565b610cd2565b6101ec61053f36600461314d565b6111c7565b34801561055057600080fd5b5060685461020e90600160281b90046001600160a01b031681565b34801561057757600080fd5b506101ec611621565b34801561058c57600080fd5b5061026661059b366004612ddd565b60696020526000908152604090205481565b3480156105b957600080fd5b506101ec6105c8366004613062565b611654565b3480156105d957600080fd5b506101ec6105e83660046131e2565b6118ef565b3480156105f957600080fd5b506101c261060836600461328a565b611b62565b606c546001600160a01b0316331461063857604051631736745960e31b815260040160405180910390fd5b610640611b7a565b565b6000606a6000848460405160200161065b9291906132d2565b60408051601f19818403018152918152815160209283012083529082019290925201600020546001600160a01b031690505b92915050565b60685460ff16156106b757604051630bc011ff60e21b815260040160405180910390fd5b34158015906106d05750606f546001600160a01b031615155b156106ee576040516301bd897160e61b815260040160405180910390fd5b6106fc858534868686611bd6565b5050505050565b606e8054610710906132fc565b80601f016020809104026020016040519081016040528092919081815260200182805461073c906132fc565b80156107895780601f1061075e57610100808354040283529160200191610789565b820191906000526020600020905b81548152906001019060200180831161076c57829003601f168201915b505050505081565b6040516001600160f81b031960f889901b1660208201526001600160e01b031960e088811b821660218401526001600160601b0319606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b605354600090819081805b60208110156108f2578083901c600116600103610886576033816020811061085357610853613336565b015460408051602081019290925281018590526060016040516020818303038152906040528051906020012093506108b3565b60408051602081018690529081018390526060016040516020818303038152906040528051906020012093505b604080516020810184905290810183905260600160405160208183030381529060405280519060200120915080806108ea90613362565b915050610829565b50919392505050565b600061091d848461090b85611ca0565b61091486611d5f565b61046687611e17565b949350505050565b605354606854600160c81b900463ffffffff16101561064057610640611ecf565b60405180611ba00160405280611b668152602001613a7a611b66913981565b600083815b6020811015610a3257600163ffffffff8516821c811690036109d55784816020811061099857610998613336565b6020020135826040516020016109b8929190918252602082015260400190565b604051602081830303815290604052805190602001209150610a20565b818582602081106109e8576109e8613336565b6020020135604051602001610a07929190918252602082015260400190565b6040516020818303038152906040528051906020012091505b80610a2a81613362565b91505061096a565b50949350505050565b6000808686604051602001610a519291906132d2565b604051602081830303815290604052805190602001209050600060ff60f81b308360405180611ba00160405280611b668152602001613a7a611b669139898989604051602001610aa39392919061337b565b60408051601f1981840301815290829052610ac192916020016133b4565b60405160208183030381529060405280519060200120604051602001610b1994939291906001600160f81b031994909416845260609290921b6001600160601b03191660018401526015830152603582015260550190565b60408051808303601f19018152919052805160209091012098975050505050505050565b60685460ff1615610b6157604051630bc011ff60e21b815260040160405180910390fd5b606f546001600160a01b0316610b8a5760405163dde3cda760e01b815260040160405180910390fd5b606f54604051632770a7eb60e21b81526001600160a01b0390911690639dc29fac90610bbc90339088906004016133e3565b600060405180830381600087803b158015610bd657600080fd5b505af1158015610bea573d6000803e3d6000fd5b50505050610bfc868686868686611bd6565b505050505050565b6060610c0f82611ca0565b610c1883611d5f565b610c2184611e17565b604051602001610c339392919061337b565b6040516020818303038152906040529050919050565b6068546000908190610100900463ffffffff16158015610c6f575063ffffffff83166001145b15610c81575063ffffffff8316610ca8565b610c95600160201b63ffffffff85166133fc565b610ca59063ffffffff8616613413565b90505b600881901c600090815260696020526040902054600160ff9092169190911b908116149392505050565b60685460ff1615610cf657604051630bc011ff60e21b815260040160405180910390fd5b60685463ffffffff8681166101009092041614610d26576040516302caf51760e11b815260040160405180910390fd5b610d5a8c8c8c8c8c610d5560008e8e8e8e8e8e8e604051610d48929190613426565b6040518091039020610791565b611f68565b6001600160a01b038616610e9257606f546001600160a01b0316610e295760006001600160a01b03851684825b6040519080825280601f01601f191660200182016040528015610db1576020820181803683370190505b50604051610dbf9190613436565b60006040518083038185875af1925050503d8060008114610dfc576040519150601f19603f3d011682016040523d82523d6000602084013e610e01565b606091505b5050905080610e2357604051630ce8f45160e31b815260040160405180910390fd5b5061117a565b606f546040516340c10f1960e01b81526001600160a01b03909116906340c10f1990610e5b90879087906004016133e3565b600060405180830381600087803b158015610e7557600080fd5b505af1158015610e89573d6000803e3d6000fd5b5050505061117a565b606d546001600160a01b038781169116148015610ec05750606d5463ffffffff888116600160a01b90920416145b15610ed85760006001600160a01b0385168482610d87565b60685463ffffffff610100909104811690881603610f0957610f046001600160a01b03871685856120c7565b61117a565b60008787604051602001610f1e9291906132d2565b60408051601f1981840301815291815281516020928301206000818152606a9093529120549091506001600160a01b031680611116576000610f968386868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061212292505050565b6040516340c10f1960e01b81529091506001600160a01b038216906340c10f1990610fc7908a908a906004016133e3565b600060405180830381600087803b158015610fe157600080fd5b505af1158015610ff5573d6000803e3d6000fd5b5050505080606a600085815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060405180604001604052808b63ffffffff1681526020018a6001600160a01b0316815250606b6000836001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a8154816001600160a01b0302191690836001600160a01b031602179055509050507f490e59a1701b938786ac72570a1efeac994a3dbe96e2e883e19e902ace6e6a398a8a83888860405161110895949392919061347b565b60405180910390a150611177565b6040516340c10f1960e01b81526001600160a01b038216906340c10f199061114490899089906004016133e3565b600060405180830381600087803b15801561115e57600080fd5b505af1158015611172573d6000803e3d6000fd5b505050505b50505b7f1df3f2a973a00d6635911755c260704e95e8a5876997546798770f76396fda4d8a888887876040516111b19594939291906134b4565b60405180910390a1505050505050505050505050565b60685460ff16156111eb57604051630bc011ff60e21b815260040160405180910390fd5b6111f361219e565b60685463ffffffff610100909104811690881603611224576040516302caf51760e11b815260040160405180910390fd5b6000806060876001600160a01b03881661130a578834146112585760405163b89240f560e01b815260040160405180910390fd5b606d54606e80546001600160a01b0383169650600160a01b90920463ffffffff16945090611285906132fc565b80601f01602080910402602001604051908101604052809291908181526020018280546112b1906132fc565b80156112fe5780601f106112d3576101008083540402835291602001916112fe565b820191906000526020600020905b8154815290600101906020018083116112e157829003601f168201915b50505050509150611596565b34156113295760405163798ee6f160e01b815260040160405180910390fd5b606f546001600160a01b03908116908916036113a457604051632770a7eb60e21b81526001600160a01b03891690639dc29fac9061136d9033908d906004016133e3565b600060405180830381600087803b15801561138757600080fd5b505af115801561139b573d6000803e3d6000fd5b50505050611596565b6001600160a01b038089166000908152606b602090815260409182902082518084019093525463ffffffff81168352600160201b9004909216918101829052901561145c57604051632770a7eb60e21b81526001600160a01b038a1690639dc29fac906114179033908e906004016133e3565b600060405180830381600087803b15801561143157600080fd5b505af1158015611445573d6000803e3d6000fd5b505050508060200151945080600001519350611589565b851561146e5761146e898b89896121f7565b6040516370a0823160e01b81526000906001600160a01b038b16906370a082319061149d903090600401612b9c565b602060405180830381865afa1580156114ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114de91906134e6565b90506114f56001600160a01b038b1633308e61253d565b6040516370a0823160e01b81526000906001600160a01b038c16906370a0823190611524903090600401612b9c565b602060405180830381865afa158015611541573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061156591906134e6565b905061157182826134ff565b6068548c9850610100900463ffffffff169650935050505b61159289610c04565b9250505b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b600084868e8e86886053546040516115d6989796959493929190613512565b60405180910390a16115fd6115f8600085878f8f878980519060200120610791565b612575565b861561160b5761160b611ecf565b5050505061161860018055565b50505050505050565b606c546001600160a01b0316331461164c57604051631736745960e31b815260040160405180910390fd5b610640612660565b60685460ff161561167857604051630bc011ff60e21b815260040160405180910390fd5b60685463ffffffff86811661010090920416146116a8576040516302caf51760e11b815260040160405180910390fd5b6116ca8c8c8c8c8c610d5560018e8e8e8e8e8e8e604051610d48929190613426565b606f546000906001600160a01b031661178157846001600160a01b031684888a86866040516024016116ff949392919061357d565b60408051601f198184030181529181526020820180516001600160e01b0316630c035af960e11b179052516117349190613436565b60006040518083038185875af1925050503d8060008114611771576040519150601f19603f3d011682016040523d82523d6000602084013e611776565b606091505b505080915050611883565b606f546040516340c10f1960e01b81526001600160a01b03909116906340c10f19906117b390889088906004016133e3565b600060405180830381600087803b1580156117cd57600080fd5b505af11580156117e1573d6000803e3d6000fd5b50505050846001600160a01b031687898585604051602401611806949392919061357d565b60408051601f198184030181529181526020820180516001600160e01b0316630c035af960e11b1790525161183b9190613436565b6000604051808303816000865af19150503d8060008114611878576040519150601f19603f3d011682016040523d82523d6000602084013e61187d565b606091505b50909150505b806118a1576040516337e391c360e01b815260040160405180910390fd5b7f1df3f2a973a00d6635911755c260704e95e8a5876997546798770f76396fda4d8b898988886040516118d89594939291906134b4565b60405180910390a150505050505050505050505050565b600054610100900460ff161580801561190f5750600054600160ff909116105b806119295750303b158015611929575060005460ff166001145b6119915760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff1916600117905580156119b4576000805461ff0019166101001790555b60688054610100600160c81b03191661010063ffffffff8a160265010000000000600160c81b03191617600160281b6001600160a01b038781169190910291909117909155606c80546001600160a01b0319168583161790558616611a3d5763ffffffff851615611a3857604051630d43a60960e11b815260040160405180910390fd5b611b0c565b606d805463ffffffff8716600160a01b026001600160c01b03199091166001600160a01b03891617179055606e611a7483826135fe565b50611aeb6000801b6012604051602001611ad791906060808252600d908201526c2bb930b83832b21022ba3432b960991b608082015260a060208201819052600490820152630ae8aa8960e31b60c082015260ff91909116604082015260e00190565b604051602081830303815290604052612122565b606f80546001600160a01b0319166001600160a01b03929092169190911790555b611b146126b8565b8015611618576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150505050505050565b600081611b70868686610965565b1495945050505050565b60685460ff1615611b9e57604051630bc011ff60e21b815260040160405180910390fd5b6068805460ff191660011790556040517f2261efe5aef6fedc1fd1550b25facc9181745623049c7901287030b9ad1a549790600090a1565b60685463ffffffff610100909104811690871603611c07576040516302caf51760e11b815260040160405180910390fd5b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b6001606860019054906101000a900463ffffffff16338989898888605354604051611c5b999897969594939291906136bd565b60405180910390a1611c926115f86001606860019054906101000a900463ffffffff16338a8a8a8989604051610d48929190613426565b8215610bfc57610bfc611ecf565b60408051600481526024810182526020810180516001600160e01b03166306fdde0360e01b179052905160609160009182916001600160a01b03861691611ce79190613436565b600060405180830381855afa9150503d8060008114611d22576040519150601f19603f3d011682016040523d82523d6000602084013e611d27565b606091505b509150915081611d5657604051806040016040528060078152602001664e4f5f4e414d4560c81b81525061091d565b61091d816126e7565b60408051600481526024810182526020810180516001600160e01b03166395d89b4160e01b179052905160609160009182916001600160a01b03861691611da69190613436565b600060405180830381855afa9150503d8060008114611de1576040519150601f19603f3d011682016040523d82523d6000602084013e611de6565b606091505b509150915081611d5657604051806040016040528060098152602001681393d7d4d6535093d360ba1b81525061091d565b60408051600481526024810182526020810180516001600160e01b031663313ce56760e01b1790529051600091829182916001600160a01b03861691611e5d9190613436565b600060405180830381855afa9150503d8060008114611e98576040519150601f19603f3d011682016040523d82523d6000602084013e611e9d565b606091505b5091509150818015611eb0575080516020145b611ebb57601261091d565b8080602001905181019061091d919061372a565b6053546068805463ffffffff909216600160c81b0263ffffffff60c81b1990921691909117908190556001600160a01b03600160281b909104166333d6247d611f1661081e565b6040518263ffffffff1660e01b8152600401611f3491815260200190565b600060405180830381600087803b158015611f4e57600080fd5b505af1158015611f62573d6000803e3d6000fd5b50505050565b606854604080516020808201879052818301869052825180830384018152606083019384905280519101206312bd9b1960e11b9092526064810191909152600091600160281b90046001600160a01b03169063257b3632906084016020604051808303816000875af1158015611fe2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061200691906134e6565b90508060000361202857604051622f6fad60e01b815260040160405180910390fd5b600080600160401b87161561206857869150612046848a8489611b62565b612063576040516338105f3b60e21b815260040160405180910390fd5b6120b2565b602087901c612078816001613747565b915087925061209361208b868c86610965565b8a8389611b62565b6120b0576040516338105f3b60e21b815260040160405180910390fd5b505b6120bc8282612875565b505050505050505050565b61211d8363a9059cbb60e01b84846040516024016120e69291906133e3565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261291d565b505050565b60008060405180611ba00160405280611b668152602001613a7a611b669139836040516020016121539291906133b4565b6040516020818303038152906040529050838151602083016000f591506001600160a01b038216612197576040516305f7d84960e51b815260040160405180910390fd5b5092915050565b6002600154036121f05760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611988565b6002600155565b60006122066004828486613764565b61220f9161378e565b9050632afa533160e01b6001600160e01b03198216016123a357600080808080808061223e896004818d613764565b81019061224b91906137be565b9650965096509650965096509650336001600160a01b0316876001600160a01b03161461228b5760405163912ecce760e01b815260040160405180910390fd5b6001600160a01b03861630146122b45760405163750643af60e01b815260040160405180910390fd5b8a85146122d4576040516303fffc4b60e01b815260040160405180910390fd5b604080516001600160a01b0389811660248301528881166044830152606482018890526084820187905260ff861660a483015260c4820185905260e48083018590528351808403909101815261010490920183526020820180516001600160e01b031663d505accf60e01b1790529151918e16916123529190613436565b6000604051808303816000865af19150503d806000811461238f576040519150601f19603f3d011682016040523d82523d6000602084013e612394565b606091505b505050505050505050506106fc565b6001600160e01b031981166323f2ebc360e21b146123d457604051637141605d60e11b815260040160405180910390fd5b6000808080808080806123ea8a6004818e613764565b8101906123f79190613812565b97509750975097509750975097509750336001600160a01b0316886001600160a01b0316146124395760405163912ecce760e01b815260040160405180910390fd5b6001600160a01b03871630146124625760405163750643af60e01b815260040160405180910390fd5b604080516001600160a01b038a811660248301528981166044830152606482018990526084820188905286151560a483015260ff861660c483015260e482018590526101048083018590528351808403909101815261012490920183526020820180516001600160e01b03166323f2ebc360e21b1790529151918f16916124e99190613436565b6000604051808303816000865af19150503d8060008114612526576040519150601f19603f3d011682016040523d82523d6000602084013e61252b565b606091505b50505050505050505050505050505050565b6040516001600160a01b0380851660248301528316604482015260648101829052611f629085906323b872dd60e01b906084016120e6565b80600161258460206002613979565b61258e91906134ff565b605354106125af576040516377ae67b360e11b815260040160405180910390fd5b60006053600081546125c090613362565b9182905550905060005b6020811015612651578082901c6001166001036125fd5782603382602081106125f5576125f5613336565b015550505050565b6033816020811061261057612610613336565b01546040805160208101929092528101849052606001604051602081830303815290604052805190602001209250808061264990613362565b9150506125ca565b5061211d613985565b60018055565b60685460ff1661268357604051635386698160e01b815260040160405180910390fd5b6068805460ff191690556040517f1e5e34eea33501aecf2ebec9fe0e884a40804275ea7fe10b2ba084c8374308b390600090a1565b600054610100900460ff166126df5760405162461bcd60e51b81526004016119889061399b565b6106406129ef565b60606040825110612706578180602001905181019061068d91906139e6565b81516020036128425760005b602081108015612741575082818151811061272f5761272f613336565b01602001516001600160f81b03191615155b15612758578061275081613362565b915050612712565b806000036127905750506040805180820190915260128152714e4f545f56414c49445f454e434f44494e4760701b6020820152919050565b6000816001600160401b038111156127aa576127aa612e47565b6040519080825280601f01601f1916602001820160405280156127d4576020820181803683370190505b50905060005b8281101561283a578481815181106127f4576127f4613336565b602001015160f81c60f81b82828151811061281157612811613336565b60200101906001600160f81b031916908160001a9053508061283281613362565b9150506127da565b509392505050565b50506040805180820190915260128152714e4f545f56414c49445f454e434f44494e4760701b602082015290565b919050565b606854600090610100900463ffffffff16158015612899575063ffffffff82166001145b156128ab575063ffffffff82166128d2565b6128bf600160201b63ffffffff84166133fc565b6128cf9063ffffffff8516613413565b90505b600881901c60008181526069602052604081208054600160ff861690811b9182189283905592909190818316900361161857604051630c8d9eab60e31b815260040160405180910390fd5b6000612972826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612a169092919063ffffffff16565b80519091501561211d57808060200190518101906129909190613a5c565b61211d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401611988565b600054610100900460ff1661265a5760405162461bcd60e51b81526004016119889061399b565b606061091d848460008585600080866001600160a01b03168587604051612a3d9190613436565b60006040518083038185875af1925050503d8060008114612a7a576040519150601f19603f3d011682016040523d82523d6000602084013e612a7f565b606091505b5091509150612a9087838387612a9b565b979650505050505050565b60608315612b0a578251600003612b03576001600160a01b0385163b612b035760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611988565b508161091d565b61091d8383815115612b1f5781518083602001fd5b8060405162461bcd60e51b81526004016119889190612ccf565b803563ffffffff8116811461287057600080fd5b6001600160a01b0381168114612b6257600080fd5b50565b60008060408385031215612b7857600080fd5b612b8183612b39565b91506020830135612b9181612b4d565b809150509250929050565b6001600160a01b0391909116815260200190565b8015158114612b6257600080fd5b60008083601f840112612bd057600080fd5b5081356001600160401b03811115612be757600080fd5b602083019150836020828501011115612bff57600080fd5b9250929050565b600080600080600060808688031215612c1e57600080fd5b612c2786612b39565b94506020860135612c3781612b4d565b93506040860135612c4781612bb0565b925060608601356001600160401b03811115612c6257600080fd5b612c6e88828901612bbe565b969995985093965092949392505050565b60005b83811015612c9a578181015183820152602001612c82565b50506000910152565b60008151808452612cbb816020860160208601612c7f565b601f01601f19169290920160200192915050565b602081526000612ce26020830184612ca3565b9392505050565b600060208284031215612cfb57600080fd5b8135612ce281612b4d565b60ff81168114612b6257600080fd5b600080600080600080600060e0888a031215612d3057600080fd5b8735612d3b81612d06565b9650612d4960208901612b39565b95506040880135612d5981612b4d565b9450612d6760608901612b39565b93506080880135612d7781612b4d565b9699959850939692959460a0840135945060c09093013592915050565b600080600060608486031215612da957600080fd5b612db284612b39565b92506020840135612dc281612b4d565b91506040840135612dd281612b4d565b809150509250925092565b600060208284031215612def57600080fd5b5035919050565b80610400810183101561068d57600080fd5b60008060006104408486031215612e1e57600080fd5b83359250612e2f8560208601612df6565b9150612e3e6104208501612b39565b90509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715612e8557612e85612e47565b604052919050565b60006001600160401b03821115612ea657612ea6612e47565b50601f01601f191660200190565b6000612ec7612ec284612e8d565b612e5d565b9050828152838383011115612edb57600080fd5b828260208301376000602084830101529392505050565b600082601f830112612f0357600080fd5b612ce283833560208501612eb4565b600080600080600060a08688031215612f2a57600080fd5b612f3386612b39565b94506020860135612f4381612b4d565b935060408601356001600160401b0380821115612f5f57600080fd5b612f6b89838a01612ef2565b94506060880135915080821115612f8157600080fd5b50612f8e88828901612ef2565b9250506080860135612f9f81612d06565b809150509295509295909350565b60008060008060008060a08789031215612fc657600080fd5b612fcf87612b39565b95506020870135612fdf81612b4d565b9450604087013593506060870135612ff681612bb0565b925060808701356001600160401b0381111561301157600080fd5b61301d89828a01612bbe565b979a9699509497509295939492505050565b6000806040838503121561304257600080fd5b61304b83612b39565b915061305960208401612b39565b90509250929050565b6000806000806000806000806000806000806109208d8f03121561308557600080fd5b61308f8e8e612df6565b9b5061309f8e6104008f01612df6565b9a506108008d013599506108208d013598506108408d013597506130c66108608e01612b39565b96506130d66108808e0135612b4d565b6108808d013595506130eb6108a08e01612b39565b94506130fb6108c08e0135612b4d565b6108c08d013593506108e08d013592506001600160401b036109008e0135111561312457600080fd5b6131358e6109008f01358f01612bbe565b81935080925050509295989b509295989b509295989b565b600080600080600080600060c0888a03121561316857600080fd5b61317188612b39565b9650602088013561318181612b4d565b955060408801359450606088013561319881612b4d565b935060808801356131a881612bb0565b925060a08801356001600160401b038111156131c357600080fd5b6131cf8a828b01612bbe565b989b979a50959850939692959293505050565b60008060008060008060c087890312156131fb57600080fd5b61320487612b39565b9550602087013561321481612b4d565b945061322260408801612b39565b9350606087013561323281612b4d565b9250608087013561324281612b4d565b915060a08701356001600160401b0381111561325d57600080fd5b8701601f8101891361326e57600080fd5b61327d89823560208401612eb4565b9150509295509295509295565b60008060008061046085870312156132a157600080fd5b843593506132b28660208701612df6565b92506132c16104208601612b39565b939692955092936104400135925050565b60e09290921b6001600160e01b031916825260601b6001600160601b031916600482015260180190565b600181811c9082168061331057607f821691505b60208210810361333057634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016133745761337461334c565b5060010190565b60608152600061338e6060830186612ca3565b82810360208401526133a08186612ca3565b91505060ff83166040830152949350505050565b600083516133c6818460208801612c7f565b8351908301906133da818360208801612c7f565b01949350505050565b6001600160a01b03929092168252602082015260400190565b808202811582820484141761068d5761068d61334c565b8082018082111561068d5761068d61334c565b8183823760009101908152919050565b60008251613448818460208701612c7f565b9190910192915050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b63ffffffff861681526001600160a01b03858116602083015284166040820152608060608201819052600090612a909083018486613452565b94855263ffffffff9390931660208501526001600160a01b039182166040850152166060830152608082015260a00190565b6000602082840312156134f857600080fd5b5051919050565b8181038181111561068d5761068d61334c565b60ff8916815263ffffffff88811660208301526001600160a01b03888116604084015287821660608401528616608083015260a0820185905261010060c0830181905260009161356484830187612ca3565b925080851660e085015250509998505050505050505050565b6001600160a01b038516815263ffffffff841660208201526060604082018190526000906135ae9083018486613452565b9695505050505050565b601f82111561211d57600081815260208120601f850160051c810160208610156135df5750805b601f850160051c820191505b81811015610bfc578281556001016135eb565b81516001600160401b0381111561361757613617612e47565b61362b8161362584546132fc565b846135b8565b602080601f83116001811461366057600084156136485750858301515b600019600386901b1c1916600185901b178555610bfc565b600085815260208120601f198616915b8281101561368f57888601518255948401946001909101908401613670565b50858210156136ad5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60ff8a16815263ffffffff89811660208301526001600160a01b03898116604084015288821660608401528716608083015260a0820186905261010060c083018190526000916137108483018789613452565b925080851660e085015250509a9950505050505050505050565b60006020828403121561373c57600080fd5b8151612ce281612d06565b63ffffffff8181168382160190808211156121975761219761334c565b6000808585111561377457600080fd5b8386111561378157600080fd5b5050820193919092039150565b6001600160e01b031981358181169160048510156137b65780818660040360031b1b83161692505b505092915050565b600080600080600080600060e0888a0312156137d957600080fd5b87356137e481612b4d565b965060208801356137f481612b4d565b955060408801359450606088013593506080880135612d7781612d06565b600080600080600080600080610100898b03121561382f57600080fd5b883561383a81612b4d565b9750602089013561384a81612b4d565b96506040890135955060608901359450608089013561386881612bb0565b935060a089013561387881612d06565b979a969950949793969295929450505060c08201359160e0013590565b600181815b808511156138d05781600019048211156138b6576138b661334c565b808516156138c357918102915b93841c939080029061389a565b509250929050565b6000826138e75750600161068d565b816138f45750600061068d565b816001811461390a576002811461391457613930565b600191505061068d565b60ff8411156139255761392561334c565b50506001821b61068d565b5060208310610133831016604e8410600b8410161715613953575081810a61068d565b61395d8383613895565b80600019048211156139715761397161334c565b029392505050565b6000612ce283836138d8565b634e487b7160e01b600052600160045260246000fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156139f857600080fd5b81516001600160401b03811115613a0e57600080fd5b8201601f81018413613a1f57600080fd5b8051613a2d612ec282612e8d565b818152856020838501011115613a4257600080fd5b613a53826020830160208601612c7f565b95945050505050565b600060208284031215613a6e57600080fd5b8151612ce281612bb056fe6101006040523480156200001257600080fd5b5060405162001b6638038062001b6683398101604081905262000035916200028d565b82826003620000458382620003a1565b506004620000548282620003a1565b50503360c0525060ff811660e052466080819052620000739062000080565b60a052506200046d915050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f620000ad6200012e565b805160209182012060408051808201825260018152603160f81b90840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b6060600380546200013f9062000312565b80601f01602080910402602001604051908101604052809291908181526020018280546200016d9062000312565b8015620001be5780601f106200019257610100808354040283529160200191620001be565b820191906000526020600020905b815481529060010190602001808311620001a057829003601f168201915b5050505050905090565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620001f057600080fd5b81516001600160401b03808211156200020d576200020d620001c8565b604051601f8301601f19908116603f01168101908282118183101715620002385762000238620001c8565b816040528381526020925086838588010111156200025557600080fd5b600091505b838210156200027957858201830151818301840152908201906200025a565b600093810190920192909252949350505050565b600080600060608486031215620002a357600080fd5b83516001600160401b0380821115620002bb57600080fd5b620002c987838801620001de565b94506020860151915080821115620002e057600080fd5b50620002ef86828701620001de565b925050604084015160ff811681146200030757600080fd5b809150509250925092565b600181811c908216806200032757607f821691505b6020821081036200034857634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200039c57600081815260208120601f850160051c81016020861015620003775750805b601f850160051c820191505b81811015620003985782815560010162000383565b5050505b505050565b81516001600160401b03811115620003bd57620003bd620001c8565b620003d581620003ce845462000312565b846200034e565b602080601f8311600181146200040d5760008415620003f45750858301515b600019600386901b1c1916600185901b17855562000398565b600085815260208120601f198616915b828110156200043e578886015182559484019460019091019084016200041d565b50858210156200045d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e0516116aa620004bc6000396000610237015260008181610307015281816105c001526106a70152600061053a015260008181610379015261050401526116aa6000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806370a08231116100d8578063a457c2d71161008c578063d505accf11610066578063d505accf1461039b578063dd62ed3e146103ae578063ffa1ad74146103f457600080fd5b8063a457c2d71461034e578063a9059cbb14610361578063cd0d00961461037457600080fd5b806395d89b41116100bd57806395d89b41146102e75780639dc29fac146102ef578063a3c573eb1461030257600080fd5b806370a08231146102915780637ecebe00146102c757600080fd5b806330adf81f1161012f5780633644e515116101145780633644e51514610261578063395093511461026957806340c10f191461027c57600080fd5b806330adf81f14610209578063313ce5671461023057600080fd5b806318160ddd1161016057806318160ddd146101bd57806320606b70146101cf57806323b872dd146101f657600080fd5b806306fdde031461017c578063095ea7b31461019a575b600080fd5b610184610430565b60405161019191906113e4565b60405180910390f35b6101ad6101a8366004611479565b6104c2565b6040519015158152602001610191565b6002545b604051908152602001610191565b6101c17f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81565b6101ad6102043660046114a3565b6104dc565b6101c17f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152602001610191565b6101c1610500565b6101ad610277366004611479565b61055c565b61028f61028a366004611479565b6105a8565b005b6101c161029f3660046114df565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6101c16102d53660046114df565b60056020526000908152604090205481565b610184610680565b61028f6102fd366004611479565b61068f565b6103297f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610191565b6101ad61035c366004611479565b61075e565b6101ad61036f366004611479565b61082f565b6101c17f000000000000000000000000000000000000000000000000000000000000000081565b61028f6103a9366004611501565b61083d565b6101c16103bc366004611574565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6101846040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525081565b60606003805461043f906115a7565b80601f016020809104026020016040519081016040528092919081815260200182805461046b906115a7565b80156104b85780601f1061048d576101008083540402835291602001916104b8565b820191906000526020600020905b81548152906001019060200180831161049b57829003601f168201915b5050505050905090565b6000336104d0818585610b73565b60019150505b92915050565b6000336104ea858285610d27565b6104f5858585610dfe565b506001949350505050565b60007f00000000000000000000000000000000000000000000000000000000000000004614610537576105324661106d565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091906104d090829086906105a3908790611629565b610b73565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610672576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d4272696467650000000000000000000000000000000060648201526084015b60405180910390fd5b61067c8282611135565b5050565b60606004805461043f906115a7565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610754576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d427269646765000000000000000000000000000000006064820152608401610669565b61067c8282611228565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015610822576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610669565b6104f58286868403610b73565b6000336104d0818585610dfe565b834211156108cc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f546f6b656e577261707065643a3a7065726d69743a204578706972656420706560448201527f726d6974000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8716600090815260056020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918a918a918a9190866109268361163c565b9091555060408051602081019690965273ffffffffffffffffffffffffffffffffffffffff94851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000610991610500565b6040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281019190915260428101839052606201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa158015610a55573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590610ad057508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b610b5c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f546f6b656e577261707065643a3a7065726d69743a20496e76616c696420736960448201527f676e6174757265000000000000000000000000000000000000000000000000006064820152608401610669565b610b678a8a8a610b73565b50505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff8316610c15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610cb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610df85781811015610deb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610669565b610df88484848403610b73565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610ea1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610f44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610ffa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610df8565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f611098610430565b8051602091820120604080518082018252600181527f310000000000000000000000000000000000000000000000000000000000000090840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b73ffffffffffffffffffffffffffffffffffffffff82166111b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610669565b80600260008282546111c49190611629565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff82166112cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205481811015611381576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610d1a565b600060208083528351808285015260005b81811015611411578581018301518582016040015282016113f5565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461147457600080fd5b919050565b6000806040838503121561148c57600080fd5b61149583611450565b946020939093013593505050565b6000806000606084860312156114b857600080fd5b6114c184611450565b92506114cf60208501611450565b9150604084013590509250925092565b6000602082840312156114f157600080fd5b6114fa82611450565b9392505050565b600080600080600080600060e0888a03121561151c57600080fd5b61152588611450565b965061153360208901611450565b95506040880135945060608801359350608088013560ff8116811461155757600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561158757600080fd5b61159083611450565b915061159e60208401611450565b90509250929050565b600181811c908216806115bb57607f821691505b6020821081036115f4577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156104d6576104d66115fa565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361166d5761166d6115fa565b506001019056fea26469706673582212208d88fee561cff7120d381c345cfc534cef8229a272dc5809d4bbb685ad67141164736f6c63430008110033a2646970667358221220914f18d5b241f0d10b2ebc814aadeee338ad60bad704683e414dad415cb2e14d64736f6c63430008140033" - }, - { - "contractName": "PolygonZkEVMBridge proxy", - "balance": "340282366920938463463374607431768211455", - "nonce": "1", - "address": "0xB7098a13a48EcE087d3DA15b2D28eCE0f89819B8", - "bytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461086f565b610135565b61006b6100a336600461088a565b61017f565b3480156100b457600080fd5b506100bd6101f3565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461086f565b610231565b34801561011257600080fd5b506100bd61025e565b61012361028c565b61013361012e610363565b61036d565b565b61013d610391565b73ffffffffffffffffffffffffffffffffffffffff16330361017757610174816040518060200160405280600081525060006103d1565b50565b61017461011b565b610187610391565b73ffffffffffffffffffffffffffffffffffffffff1633036101eb576101e68383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506103d1915050565b505050565b6101e661011b565b60006101fd610391565b73ffffffffffffffffffffffffffffffffffffffff16330361022657610221610363565b905090565b61022e61011b565b90565b610239610391565b73ffffffffffffffffffffffffffffffffffffffff16330361017757610174816103fc565b6000610268610391565b73ffffffffffffffffffffffffffffffffffffffff16330361022657610221610391565b610294610391565b73ffffffffffffffffffffffffffffffffffffffff163303610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b600061022161045d565b3660008037600080366000845af43d6000803e80801561038c573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6103da83610485565b6000825111806103e75750805b156101e6576103f683836104d2565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f610425610391565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a1610174816104fe565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6103b5565b61048e8161060a565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606104f7838360405180606001604052806027815260200161099f602791396106d5565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff81166105a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161035a565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b73ffffffffffffffffffffffffffffffffffffffff81163b6106ae576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161035a565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6105c4565b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516106ff9190610931565b600060405180830381855af49150503d806000811461073a576040519150601f19603f3d011682016040523d82523d6000602084013e61073f565b606091505b50915091506107508683838761075a565b9695505050505050565b606083156107f05782516000036107e95773ffffffffffffffffffffffffffffffffffffffff85163b6107e9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161035a565b50816107fa565b6107fa8383610802565b949350505050565b8151156108125781518083602001fd5b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161035a919061094d565b803573ffffffffffffffffffffffffffffffffffffffff8116811461086a57600080fd5b919050565b60006020828403121561088157600080fd5b6104f782610846565b60008060006040848603121561089f57600080fd5b6108a884610846565b9250602084013567ffffffffffffffff808211156108c557600080fd5b818601915086601f8301126108d957600080fd5b8135818111156108e857600080fd5b8760208285010111156108fa57600080fd5b6020830194508093505050509250925092565b60005b83811015610928578181015183820152602001610910565b50506000910152565b6000825161094381846020870161090d565b9190910192915050565b602081526000825180602084015261096c81604085016020870161090d565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220701a0c26bdd76686e63fc3c65e4f28a20ba3ecc8a60246733c0627e679c9804e64736f6c63430008140033", - "storage": { - "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x000000000000000000000000e34fe58dda5b8c6d547e4857e987633aa86a5e90", - "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x000000000000000000000000493732fb136a380920c390a85fc27d79c7b70756" - } - }, - { - "contractName": "PolygonZkEVMGlobalExitRootL2 implementation", - "balance": "0", - "nonce": "1", - "address": "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9", - "bytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806301fd904414610051578063257b36321461006d57806333d6247d1461008d578063a3c573eb146100a2575b600080fd5b61005a60015481565b6040519081526020015b60405180910390f35b61005a61007b366004610162565b60006020819052908152604090205481565b6100a061009b366004610162565b6100ee565b005b6100c97f000000000000000000000000b7098a13a48ece087d3da15b2d28ece0f89819b881565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610064565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000b7098a13a48ece087d3da15b2d28ece0f89819b8161461015d576040517fb49365dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600155565b60006020828403121561017457600080fd5b503591905056fea2646970667358221220ea2171e2c85c8bff947affc409ef6fc6a8fe82fb8c174ddeda988651e595d66564736f6c63430008140033" - }, - { - "contractName": "PolygonZkEVMGlobalExitRootL2 proxy", - "balance": "0", - "nonce": "1", - "address": "0xa40d5f56745a118d0906a34e69aec8c0db1cb8fa", - "bytecode": "0x60806040523661001357610011610017565b005b6100115b61001f6101b7565b6001600160a01b0316336001600160a01b0316141561016f5760606001600160e01b031960003516631b2ce7f360e11b8114156100655761005e6101ea565b9150610167565b6001600160e01b0319811663278f794360e11b14156100865761005e610241565b6001600160e01b031981166308f2839760e41b14156100a75761005e610287565b6001600160e01b031981166303e1469160e61b14156100c85761005e6102b8565b6001600160e01b03198116635c60da1b60e01b14156100e95761005e6102f8565b60405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b815160208301f35b61017761030c565b565b606061019e83836040518060600160405280602781526020016108576027913961031c565b9392505050565b90565b6001600160a01b03163b151590565b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b60606101f4610394565b600061020336600481846106a2565b81019061021091906106e8565b905061022d8160405180602001604052806000815250600061039f565b505060408051602081019091526000815290565b606060008061025336600481846106a2565b8101906102609190610719565b915091506102708282600161039f565b604051806020016040528060008152509250505090565b6060610291610394565b60006102a036600481846106a2565b8101906102ad91906106e8565b905061022d816103cb565b60606102c2610394565b60006102cc6101b7565b604080516001600160a01b03831660208201529192500160405160208183030381529060405291505090565b6060610302610394565b60006102cc610422565b610177610317610422565b610431565b6060600080856001600160a01b0316856040516103399190610807565b600060405180830381855af49150503d8060008114610374576040519150601f19603f3d011682016040523d82523d6000602084013e610379565b606091505b509150915061038a86838387610455565b9695505050505050565b341561017757600080fd5b6103a8836104d3565b6000825111806103b55750805b156103c6576103c48383610179565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6103f46101b7565b604080516001600160a01b03928316815291841660208301520160405180910390a161041f81610513565b50565b600061042c6105bc565b905090565b3660008037600080366000845af43d6000803e808015610450573d6000f35b3d6000fd5b606083156104c15782516104ba576001600160a01b0385163b6104ba5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161015e565b50816104cb565b6104cb83836105e4565b949350505050565b6104dc8161060e565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6001600160a01b0381166105785760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b606482015260840161015e565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80546001600160a01b0319166001600160a01b039290921691909117905550565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6101db565b8151156105f45781518083602001fd5b8060405162461bcd60e51b815260040161015e9190610823565b6001600160a01b0381163b61067b5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161015e565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc61059b565b600080858511156106b257600080fd5b838611156106bf57600080fd5b5050820193919092039150565b80356001600160a01b03811681146106e357600080fd5b919050565b6000602082840312156106fa57600080fd5b61019e826106cc565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561072c57600080fd5b610735836106cc565b9150602083013567ffffffffffffffff8082111561075257600080fd5b818501915085601f83011261076657600080fd5b81358181111561077857610778610703565b604051601f8201601f19908116603f011681019083821181831017156107a0576107a0610703565b816040528281528860208487010111156107b957600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b838110156107f65781810151838201526020016107de565b838111156103c45750506000910152565b600082516108198184602087016107db565b9190910192915050565b60208152600082518060208401526108428160408501602087016107db565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122012bb4f564f73959a03513dc74fc3c6e40e8386e6f02c16b78d6db00ce0aa16af64736f6c63430008090033", - "storage": { - "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x000000000000000000000000e34fe58dda5b8c6d547e4857e987633aa86a5e90", - "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x000000000000000000000000dc64a140aa3e981100a9beca4e685f962f0cf6c9" - } - }, - { - "contractName": "PolygonZkEVMTimelock", - "balance": "0", - "nonce": "1", - "address": "0x0165878A594ca255338adfa4d48449f69242Eb8F", - "bytecode": "0x6080604052600436106101c65760003560e01c806364d62353116100f7578063b1c5f42711610095578063d547741f11610064578063d547741f14610661578063e38335e514610681578063f23a6e6114610694578063f27a0c92146106d957600080fd5b8063b1c5f427146105af578063bc197c81146105cf578063c4d252f514610614578063d45c44351461063457600080fd5b80638f61f4f5116100d15780638f61f4f5146104e157806391d1485414610515578063a217fddf14610566578063b08e51c01461057b57600080fd5b806364d62353146104815780638065657f146104a15780638f2a0bb0146104c157600080fd5b8063248a9ca31161016457806331d507501161013e57806331d50750146103c857806336568abe146103e85780633a6aae7214610408578063584b153e1461046157600080fd5b8063248a9ca3146103475780632ab0f529146103775780632f2ff15d146103a857600080fd5b80630d3cf6fc116101a05780630d3cf6fc1461026b578063134008d31461029f57806313bc9f20146102b2578063150b7a02146102d257600080fd5b806301d5062a146101d257806301ffc9a7146101f457806307bd02651461022957600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506101f26101ed366004611c52565b6106ee565b005b34801561020057600080fd5b5061021461020f366004611cc7565b610783565b60405190151581526020015b60405180910390f35b34801561023557600080fd5b5061025d7fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e6381565b604051908152602001610220565b34801561027757600080fd5b5061025d7f5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca581565b6101f26102ad366004611d09565b6107df565b3480156102be57600080fd5b506102146102cd366004611d75565b6108d7565b3480156102de57600080fd5b506103166102ed366004611e9a565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610220565b34801561035357600080fd5b5061025d610362366004611d75565b60009081526020819052604090206001015490565b34801561038357600080fd5b50610214610392366004611d75565b6000908152600160208190526040909120541490565b3480156103b457600080fd5b506101f26103c3366004611f02565b6108fd565b3480156103d457600080fd5b506102146103e3366004611d75565b610927565b3480156103f457600080fd5b506101f2610403366004611f02565b610940565b34801561041457600080fd5b5061043c7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610220565b34801561046d57600080fd5b5061021461047c366004611d75565b6109f8565b34801561048d57600080fd5b506101f261049c366004611d75565b610a0e565b3480156104ad57600080fd5b5061025d6104bc366004611d09565b610ade565b3480156104cd57600080fd5b506101f26104dc366004611f73565b610b1d565b3480156104ed57600080fd5b5061025d7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc181565b34801561052157600080fd5b50610214610530366004611f02565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b34801561057257600080fd5b5061025d600081565b34801561058757600080fd5b5061025d7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f78381565b3480156105bb57600080fd5b5061025d6105ca366004612025565b610d4f565b3480156105db57600080fd5b506103166105ea36600461214e565b7fbc197c810000000000000000000000000000000000000000000000000000000095945050505050565b34801561062057600080fd5b506101f261062f366004611d75565b610d94565b34801561064057600080fd5b5061025d61064f366004611d75565b60009081526001602052604090205490565b34801561066d57600080fd5b506101f261067c366004611f02565b610e8f565b6101f261068f366004612025565b610eb4565b3480156106a057600080fd5b506103166106af3660046121f8565b7ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b3480156106e557600080fd5b5061025d611161565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc161071881611244565b6000610728898989898989610ade565b90506107348184611251565b6000817f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8b8b8b8b8b8a604051610770969594939291906122a6565b60405180910390a3505050505050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f4e2312e00000000000000000000000000000000000000000000000000000000014806107d957506107d98261139e565b92915050565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff1661085c5761085c8133611435565b600061086c888888888888610ade565b905061087881856114ed565b6108848888888861162a565b6000817fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588a8a8a8a6040516108bc94939291906122f1565b60405180910390a36108cd8161172e565b5050505050505050565b6000818152600160205260408120546001811180156108f65750428111155b9392505050565b60008281526020819052604090206001015461091881611244565b61092283836117d7565b505050565b60008181526001602052604081205481905b1192915050565b73ffffffffffffffffffffffffffffffffffffffff811633146109ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6109f482826118c7565b5050565b6000818152600160208190526040822054610939565b333014610a9d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f54696d656c6f636b436f6e74726f6c6c65723a2063616c6c6572206d7573742060448201527f62652074696d656c6f636b00000000000000000000000000000000000000000060648201526084016109e1565b60025460408051918252602082018390527f11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d5910160405180910390a1600255565b6000868686868686604051602001610afb969594939291906122a6565b6040516020818303038152906040528051906020012090509695505050505050565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1610b4781611244565b888714610bd6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b888514610c65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b6000610c778b8b8b8b8b8b8b8b610d4f565b9050610c838184611251565b60005b8a811015610d415780827f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8e8e85818110610cc357610cc3612331565b9050602002016020810190610cd89190612360565b8d8d86818110610cea57610cea612331565b905060200201358c8c87818110610d0357610d03612331565b9050602002810190610d15919061237b565b8c8b604051610d29969594939291906122a6565b60405180910390a3610d3a8161240f565b9050610c86565b505050505050505050505050565b60008888888888888888604051602001610d709897969594939291906124f7565b60405160208183030381529060405280519060200120905098975050505050505050565b7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f783610dbe81611244565b610dc7826109f8565b610e53576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20636160448201527f6e6e6f742062652063616e63656c6c656400000000000000000000000000000060648201526084016109e1565b6000828152600160205260408082208290555183917fbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb7091a25050565b600082815260208190526040902060010154610eaa81611244565b61092283836118c7565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff16610f3157610f318133611435565b878614610fc0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b87841461104f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b60006110618a8a8a8a8a8a8a8a610d4f565b905061106d81856114ed565b60005b8981101561114b5760008b8b8381811061108c5761108c612331565b90506020020160208101906110a19190612360565b905060008a8a848181106110b7576110b7612331565b9050602002013590503660008a8a868181106110d5576110d5612331565b90506020028101906110e7919061237b565b915091506110f78484848461162a565b84867fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588686868660405161112e94939291906122f1565b60405180910390a350505050806111449061240f565b9050611070565b506111558161172e565b50505050505050505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff161580159061123257507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166315064c966040518163ffffffff1660e01b8152600401602060405180830381865afa15801561120e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123291906125be565b1561123d5750600090565b5060025490565b61124e8133611435565b50565b61125a82610927565b156112e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20616c60448201527f7265616479207363686564756c6564000000000000000000000000000000000060648201526084016109e1565b6112ef611161565b81101561137e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a20696e73756666696369656e7460448201527f2064656c6179000000000000000000000000000000000000000000000000000060648201526084016109e1565b61138881426125e0565b6000928352600160205260409092209190915550565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806107d957507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146107d9565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f4576114738161197e565b61147e83602061199d565b60405160200161148f929190612617565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526109e191600401612698565b6114f6826108d7565b611582576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b80158061159e5750600081815260016020819052604090912054145b6109f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a206d697373696e67206465706560448201527f6e64656e6379000000000000000000000000000000000000000000000000000060648201526084016109e1565b60008473ffffffffffffffffffffffffffffffffffffffff168484846040516116549291906126e9565b60006040518083038185875af1925050503d8060008114611691576040519150601f19603f3d011682016040523d82523d6000602084013e611696565b606091505b5050905080611727576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f54696d656c6f636b436f6e74726f6c6c65723a20756e6465726c79696e67207460448201527f72616e73616374696f6e2072657665727465640000000000000000000000000060648201526084016109e1565b5050505050565b611737816108d7565b6117c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b600090815260016020819052604090912055565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556118693390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60606107d973ffffffffffffffffffffffffffffffffffffffff831660145b606060006119ac8360026126f9565b6119b79060026125e0565b67ffffffffffffffff8111156119cf576119cf611d8e565b6040519080825280601f01601f1916602001820160405280156119f9576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611a3057611a30612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611a9357611a93612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000611acf8460026126f9565b611ada9060016125e0565b90505b6001811115611b77577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611b1b57611b1b612331565b1a60f81b828281518110611b3157611b31612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611b7081612710565b9050611add565b5083156108f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109e1565b803573ffffffffffffffffffffffffffffffffffffffff81168114611c0457600080fd5b919050565b60008083601f840112611c1b57600080fd5b50813567ffffffffffffffff811115611c3357600080fd5b602083019150836020828501011115611c4b57600080fd5b9250929050565b600080600080600080600060c0888a031215611c6d57600080fd5b611c7688611be0565b965060208801359550604088013567ffffffffffffffff811115611c9957600080fd5b611ca58a828b01611c09565b989b979a50986060810135976080820135975060a09091013595509350505050565b600060208284031215611cd957600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146108f657600080fd5b60008060008060008060a08789031215611d2257600080fd5b611d2b87611be0565b955060208701359450604087013567ffffffffffffffff811115611d4e57600080fd5b611d5a89828a01611c09565b979a9699509760608101359660809091013595509350505050565b600060208284031215611d8757600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611e0457611e04611d8e565b604052919050565b600082601f830112611e1d57600080fd5b813567ffffffffffffffff811115611e3757611e37611d8e565b611e6860207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601611dbd565b818152846020838601011115611e7d57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215611eb057600080fd5b611eb985611be0565b9350611ec760208601611be0565b925060408501359150606085013567ffffffffffffffff811115611eea57600080fd5b611ef687828801611e0c565b91505092959194509250565b60008060408385031215611f1557600080fd5b82359150611f2560208401611be0565b90509250929050565b60008083601f840112611f4057600080fd5b50813567ffffffffffffffff811115611f5857600080fd5b6020830191508360208260051b8501011115611c4b57600080fd5b600080600080600080600080600060c08a8c031215611f9157600080fd5b893567ffffffffffffffff80821115611fa957600080fd5b611fb58d838e01611f2e565b909b50995060208c0135915080821115611fce57600080fd5b611fda8d838e01611f2e565b909950975060408c0135915080821115611ff357600080fd5b506120008c828d01611f2e565b9a9d999c50979a969997986060880135976080810135975060a0013595509350505050565b60008060008060008060008060a0898b03121561204157600080fd5b883567ffffffffffffffff8082111561205957600080fd5b6120658c838d01611f2e565b909a50985060208b013591508082111561207e57600080fd5b61208a8c838d01611f2e565b909850965060408b01359150808211156120a357600080fd5b506120b08b828c01611f2e565b999c989b509699959896976060870135966080013595509350505050565b600082601f8301126120df57600080fd5b8135602067ffffffffffffffff8211156120fb576120fb611d8e565b8160051b61210a828201611dbd565b928352848101820192828101908785111561212457600080fd5b83870192505b848310156121435782358252918301919083019061212a565b979650505050505050565b600080600080600060a0868803121561216657600080fd5b61216f86611be0565b945061217d60208701611be0565b9350604086013567ffffffffffffffff8082111561219a57600080fd5b6121a689838a016120ce565b945060608801359150808211156121bc57600080fd5b6121c889838a016120ce565b935060808801359150808211156121de57600080fd5b506121eb88828901611e0c565b9150509295509295909350565b600080600080600060a0868803121561221057600080fd5b61221986611be0565b945061222760208701611be0565b93506040860135925060608601359150608086013567ffffffffffffffff81111561225157600080fd5b6121eb88828901611e0c565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b73ffffffffffffffffffffffffffffffffffffffff8716815285602082015260a0604082015260006122dc60a08301868861225d565b60608301949094525060800152949350505050565b73ffffffffffffffffffffffffffffffffffffffff8516815283602082015260606040820152600061232760608301848661225d565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561237257600080fd5b6108f682611be0565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126123b057600080fd5b83018035915067ffffffffffffffff8211156123cb57600080fd5b602001915036819003821315611c4b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612440576124406123e0565b5060010190565b81835260006020808501808196508560051b810191508460005b878110156124ea57828403895281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18836030181126124a057600080fd5b8701858101903567ffffffffffffffff8111156124bc57600080fd5b8036038213156124cb57600080fd5b6124d686828461225d565b9a87019a9550505090840190600101612461565b5091979650505050505050565b60a0808252810188905260008960c08301825b8b8110156125455773ffffffffffffffffffffffffffffffffffffffff61253084611be0565b1682526020928301929091019060010161250a565b5083810360208501528881527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff89111561257e57600080fd5b8860051b9150818a602083013701828103602090810160408501526125a69082018789612447565b60608401959095525050608001529695505050505050565b6000602082840312156125d057600080fd5b815180151581146108f657600080fd5b808201808211156107d9576107d96123e0565b60005b8381101561260e5781810151838201526020016125f6565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161264f8160178501602088016125f3565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161268c8160288401602088016125f3565b01602801949350505050565b60208152600082518060208401526126b78160408501602087016125f3565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b8183823760009101908152919050565b80820281158282048414176107d9576107d96123e0565b60008161271f5761271f6123e0565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea2646970667358221220c474c39da3523b28ebfa5fd66c05b42d6ddcc4a57055483bdda32888b366016164736f6c63430008140033", - "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000000000000000000e10", - "0xaedcc9e7897c0d335bdc5d92fe3a8b4f23727fe558cd1c19f332b28716a30559": "0x0000000000000000000000000000000000000000000000000000000000000001", - "0xf5e61edb9c9cc6bfbae4463e9a2b1dd6ac3b44ddef38f18016e56ba0363910d9": "0x0000000000000000000000000000000000000000000000000000000000000001", - "0x64494413541ff93b31aa309254e3fed72a7456e9845988b915b4c7a7ceba8814": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", - "0x60b9d94c75b7b3f721925089391e4644cd890cb5e6466f9596dfbd2c54e0b280": "0x0000000000000000000000000000000000000000000000000000000000000001", - "0x3412d5605ac6cd444957cedb533e5dacad6378b4bc819ebe3652188a665066d6": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", - "0x4b63b79f1e338a49559dcd3193ac9eecc50d0f275d24e97cc8c319e5a31a8bd0": "0x0000000000000000000000000000000000000000000000000000000000000001", - "0xdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d706a": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", - "0x800d5dfe4bba53eedee06cd4546a27da8de00f12db83f56062976d4493fda899": "0x0000000000000000000000000000000000000000000000000000000000000001", - "0xc3ad33e20b0c56a223ad5104fff154aa010f8715b9c981fd38fdc60a4d1a52fc": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5" - } - }, - { - "accountName": "keyless Deployer", - "balance": "0", - "nonce": "1", - "address": "0x28BB4e66addE1f042B77E04cf7D3784C1dcDBbA3" - }, - { - "accountName": "deployer", - "balance": "100000000000000000000000", - "nonce": "8", - "address": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" - } - ] + { + "contractName": "PolygonZkEVMDeployer", + "balance": "0", + "nonce": "4", + "address": "0x51dbd54FCCb6b3A07738fd3E156D588e71f79973", + "bytecode": "0x6080604052600436106100705760003560e01c8063715018a61161004e578063715018a6146100e65780638da5cb5b146100fb578063e11ae6cb14610126578063f2fde38b1461013957600080fd5b80632b79805a146100755780634a94d4871461008a5780636d07dbf81461009d575b600080fd5b610088610083366004610927565b610159565b005b6100886100983660046109c7565b6101cb565b3480156100a957600080fd5b506100bd6100b8366004610a1e565b61020d565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b50610088610220565b34801561010757600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100bd565b610088610134366004610a40565b610234565b34801561014557600080fd5b50610088610154366004610a90565b61029b565b610161610357565b600061016e8585856103d8565b905061017a8183610537565b5060405173ffffffffffffffffffffffffffffffffffffffff821681527fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a15050505050565b6101d3610357565b6101de83838361057b565b506040517f25adb19089b6a549831a273acdf7908cff8b7ee5f551f8d1d37996cf01c5df5b90600090a1505050565b600061021983836105a9565b9392505050565b610228610357565b61023260006105b6565b565b61023c610357565b60006102498484846103d8565b60405173ffffffffffffffffffffffffffffffffffffffff821681529091507fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a150505050565b6102a3610357565b73ffffffffffffffffffffffffffffffffffffffff811661034b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610354816105b6565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610232576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610342565b600083471015610444576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e63650000006044820152606401610342565b81516000036104af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f6044820152606401610342565b8282516020840186f5905073ffffffffffffffffffffffffffffffffffffffff8116610219576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f79000000000000006044820152606401610342565b6060610219838360006040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c6564000081525061062b565b60606105a1848484604051806060016040528060298152602001610b3d6029913961062b565b949350505050565b6000610219838330610744565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060824710156106bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610342565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516106e69190610acf565b60006040518083038185875af1925050503d8060008114610723576040519150601f19603f3d011682016040523d82523d6000602084013e610728565b606091505b50915091506107398783838761076e565b979650505050505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b606083156108045782516000036107fd5773ffffffffffffffffffffffffffffffffffffffff85163b6107fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610342565b50816105a1565b6105a183838151156108195781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103429190610aeb565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f83011261088d57600080fd5b813567ffffffffffffffff808211156108a8576108a861084d565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156108ee576108ee61084d565b8160405283815286602085880101111561090757600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000806080858703121561093d57600080fd5b8435935060208501359250604085013567ffffffffffffffff8082111561096357600080fd5b61096f8883890161087c565b9350606087013591508082111561098557600080fd5b506109928782880161087c565b91505092959194509250565b803573ffffffffffffffffffffffffffffffffffffffff811681146109c257600080fd5b919050565b6000806000606084860312156109dc57600080fd5b6109e58461099e565b9250602084013567ffffffffffffffff811115610a0157600080fd5b610a0d8682870161087c565b925050604084013590509250925092565b60008060408385031215610a3157600080fd5b50508035926020909101359150565b600080600060608486031215610a5557600080fd5b8335925060208401359150604084013567ffffffffffffffff811115610a7a57600080fd5b610a868682870161087c565b9150509250925092565b600060208284031215610aa257600080fd5b6102198261099e565b60005b83811015610ac6578181015183820152602001610aae565b50506000910152565b60008251610ae1818460208701610aab565b9190910192915050565b6020815260008251806020840152610b0a816040850160208701610aab565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a2646970667358221220964619cee0e0baf94c6f8763f013be157da5d54c89e5cff4a8caf4266e13f13a64736f6c63430008140033", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266" + } + }, + { + "contractName": "ProxyAdmin", + "balance": "0", + "nonce": "1", + "address": "0xe34Fe58DDa5b8c6D547E4857E987633aa86a5e90", + "bytecode": "0x60806040526004361061007b5760003560e01c80639623609d1161004e5780639623609d1461012b57806399a88ec41461013e578063f2fde38b1461015e578063f3b7dead1461017e57600080fd5b8063204e1c7a14610080578063715018a6146100c95780637eff275e146100e05780638da5cb5b14610100575b600080fd5b34801561008c57600080fd5b506100a061009b366004610608565b61019e565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100d557600080fd5b506100de610255565b005b3480156100ec57600080fd5b506100de6100fb36600461062c565b610269565b34801561010c57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100a0565b6100de610139366004610694565b6102f7565b34801561014a57600080fd5b506100de61015936600461062c565b61038c565b34801561016a57600080fd5b506100de610179366004610608565b6103e8565b34801561018a57600080fd5b506100a0610199366004610608565b6104a4565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907f5c60da1b00000000000000000000000000000000000000000000000000000000815260040190565b600060405180830381855afa9150503d8060008114610225576040519150601f19603f3d011682016040523d82523d6000602084013e61022a565b606091505b50915091508161023957600080fd5b8080602001905181019061024d9190610788565b949350505050565b61025d6104f0565b6102676000610571565b565b6102716104f0565b6040517f8f28397000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690638f283970906024015b600060405180830381600087803b1580156102db57600080fd5b505af11580156102ef573d6000803e3d6000fd5b505050505050565b6102ff6104f0565b6040517f4f1ef28600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690634f1ef28690349061035590869086906004016107a5565b6000604051808303818588803b15801561036e57600080fd5b505af1158015610382573d6000803e3d6000fd5b5050505050505050565b6103946104f0565b6040517f3659cfe600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690633659cfe6906024016102c1565b6103f06104f0565b73ffffffffffffffffffffffffffffffffffffffff8116610498576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6104a181610571565b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907ff851a44000000000000000000000000000000000000000000000000000000000815260040190565b60005473ffffffffffffffffffffffffffffffffffffffff163314610267576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161048f565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b73ffffffffffffffffffffffffffffffffffffffff811681146104a157600080fd5b60006020828403121561061a57600080fd5b8135610625816105e6565b9392505050565b6000806040838503121561063f57600080fd5b823561064a816105e6565b9150602083013561065a816105e6565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000606084860312156106a957600080fd5b83356106b4816105e6565b925060208401356106c4816105e6565b9150604084013567ffffffffffffffff808211156106e157600080fd5b818601915086601f8301126106f557600080fd5b81358181111561070757610707610665565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561074d5761074d610665565b8160405282815289602084870101111561076657600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b60006020828403121561079a57600080fd5b8151610625816105e6565b73ffffffffffffffffffffffffffffffffffffffff8316815260006020604081840152835180604085015260005b818110156107ef578581018301518582016060015282016107d3565b5060006060828601015260607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010192505050939250505056fea2646970667358221220c9867ffac53151bdb1305d8f5e3e883cd83e5270c7ec09cdc24e837b2e65239064736f6c63430008140033", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000000165878a594ca255338adfa4d48449f69242eb8f" + } + }, + { + "contractName": "PolygonZkEVMBridge implementation", + "balance": "0", + "nonce": "1", + "address": "0x493732fB136a380920C390a85fc27d79C7b70756", + "bytecode": "0x6080604052600436106101a35760003560e01c806383f24403116100e2578063ccaa2d1111610085578063ccaa2d1114610511578063cd58657914610531578063d02103ca14610544578063dbc169761461056b578063ee25560b14610580578063f5efcd79146105ad578063f811bff7146105cd578063fb570834146105ed57600080fd5b806383f244031461040b5780638ed7e3f21461042b578063aaa13cc21461044b578063b8b284d01461046b578063bab161bf1461048b578063be5831c7146104ad578063c00f14ab146104d1578063cc461632146104f157600080fd5b80633cbc795b1161014a5780633cbc795b146102fd5780633e197043146103365780634b2f336d146103565780635ca1e165146103765780637843298b1461038b57806379e2cf97146103ab57806381b1c174146103c057806383c43a55146103f657600080fd5b806315064c96146101a85780632072f6c5146101d757806322e95f2c146101ee578063240ff3781461021b57806327aef4e81461022e5780632dfdf0b514610250578063318aee3d146102745780633c351e10146102dd575b600080fd5b3480156101b457600080fd5b506068546101c29060ff1681565b60405190151581526020015b60405180910390f35b3480156101e357600080fd5b506101ec61060d565b005b3480156101fa57600080fd5b5061020e610209366004612b65565b610642565b6040516101ce9190612b9c565b6101ec610229366004612c06565b610693565b34801561023a57600080fd5b50610243610703565b6040516101ce9190612ccf565b34801561025c57600080fd5b5061026660535481565b6040519081526020016101ce565b34801561028057600080fd5b506102b961028f366004612ce9565b606b6020526000908152604090205463ffffffff811690600160201b90046001600160a01b031682565b6040805163ffffffff90931683526001600160a01b039091166020830152016101ce565b3480156102e957600080fd5b50606d5461020e906001600160a01b031681565b34801561030957600080fd5b50606d5461032190600160a01b900463ffffffff1681565b60405163ffffffff90911681526020016101ce565b34801561034257600080fd5b50610266610351366004612d15565b610791565b34801561036257600080fd5b50606f5461020e906001600160a01b031681565b34801561038257600080fd5b5061026661081e565b34801561039757600080fd5b5061020e6103a6366004612d94565b6108fb565b3480156103b757600080fd5b506101ec610925565b3480156103cc57600080fd5b5061020e6103db366004612ddd565b606a602052600090815260409020546001600160a01b031681565b34801561040257600080fd5b50610243610946565b34801561041757600080fd5b50610266610426366004612e08565b610965565b34801561043757600080fd5b50606c5461020e906001600160a01b031681565b34801561045757600080fd5b5061020e610466366004612f12565b610a3b565b34801561047757600080fd5b506101ec610486366004612fad565b610b3d565b34801561049757600080fd5b5060685461032190610100900463ffffffff1681565b3480156104b957600080fd5b5060685461032190600160c81b900463ffffffff1681565b3480156104dd57600080fd5b506102436104ec366004612ce9565b610c04565b3480156104fd57600080fd5b506101c261050c36600461302f565b610c49565b34801561051d57600080fd5b506101ec61052c366004613062565b610cd2565b6101ec61053f36600461314d565b6111c7565b34801561055057600080fd5b5060685461020e90600160281b90046001600160a01b031681565b34801561057757600080fd5b506101ec611621565b34801561058c57600080fd5b5061026661059b366004612ddd565b60696020526000908152604090205481565b3480156105b957600080fd5b506101ec6105c8366004613062565b611654565b3480156105d957600080fd5b506101ec6105e83660046131e2565b6118ef565b3480156105f957600080fd5b506101c261060836600461328a565b611b62565b606c546001600160a01b0316331461063857604051631736745960e31b815260040160405180910390fd5b610640611b7a565b565b6000606a6000848460405160200161065b9291906132d2565b60408051601f19818403018152918152815160209283012083529082019290925201600020546001600160a01b031690505b92915050565b60685460ff16156106b757604051630bc011ff60e21b815260040160405180910390fd5b34158015906106d05750606f546001600160a01b031615155b156106ee576040516301bd897160e61b815260040160405180910390fd5b6106fc858534868686611bd6565b5050505050565b606e8054610710906132fc565b80601f016020809104026020016040519081016040528092919081815260200182805461073c906132fc565b80156107895780601f1061075e57610100808354040283529160200191610789565b820191906000526020600020905b81548152906001019060200180831161076c57829003601f168201915b505050505081565b6040516001600160f81b031960f889901b1660208201526001600160e01b031960e088811b821660218401526001600160601b0319606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b605354600090819081805b60208110156108f2578083901c600116600103610886576033816020811061085357610853613336565b015460408051602081019290925281018590526060016040516020818303038152906040528051906020012093506108b3565b60408051602081018690529081018390526060016040516020818303038152906040528051906020012093505b604080516020810184905290810183905260600160405160208183030381529060405280519060200120915080806108ea90613362565b915050610829565b50919392505050565b600061091d848461090b85611ca0565b61091486611d5f565b61046687611e17565b949350505050565b605354606854600160c81b900463ffffffff16101561064057610640611ecf565b60405180611ba00160405280611b668152602001613a7a611b66913981565b600083815b6020811015610a3257600163ffffffff8516821c811690036109d55784816020811061099857610998613336565b6020020135826040516020016109b8929190918252602082015260400190565b604051602081830303815290604052805190602001209150610a20565b818582602081106109e8576109e8613336565b6020020135604051602001610a07929190918252602082015260400190565b6040516020818303038152906040528051906020012091505b80610a2a81613362565b91505061096a565b50949350505050565b6000808686604051602001610a519291906132d2565b604051602081830303815290604052805190602001209050600060ff60f81b308360405180611ba00160405280611b668152602001613a7a611b669139898989604051602001610aa39392919061337b565b60408051601f1981840301815290829052610ac192916020016133b4565b60405160208183030381529060405280519060200120604051602001610b1994939291906001600160f81b031994909416845260609290921b6001600160601b03191660018401526015830152603582015260550190565b60408051808303601f19018152919052805160209091012098975050505050505050565b60685460ff1615610b6157604051630bc011ff60e21b815260040160405180910390fd5b606f546001600160a01b0316610b8a5760405163dde3cda760e01b815260040160405180910390fd5b606f54604051632770a7eb60e21b81526001600160a01b0390911690639dc29fac90610bbc90339088906004016133e3565b600060405180830381600087803b158015610bd657600080fd5b505af1158015610bea573d6000803e3d6000fd5b50505050610bfc868686868686611bd6565b505050505050565b6060610c0f82611ca0565b610c1883611d5f565b610c2184611e17565b604051602001610c339392919061337b565b6040516020818303038152906040529050919050565b6068546000908190610100900463ffffffff16158015610c6f575063ffffffff83166001145b15610c81575063ffffffff8316610ca8565b610c95600160201b63ffffffff85166133fc565b610ca59063ffffffff8616613413565b90505b600881901c600090815260696020526040902054600160ff9092169190911b908116149392505050565b60685460ff1615610cf657604051630bc011ff60e21b815260040160405180910390fd5b60685463ffffffff8681166101009092041614610d26576040516302caf51760e11b815260040160405180910390fd5b610d5a8c8c8c8c8c610d5560008e8e8e8e8e8e8e604051610d48929190613426565b6040518091039020610791565b611f68565b6001600160a01b038616610e9257606f546001600160a01b0316610e295760006001600160a01b03851684825b6040519080825280601f01601f191660200182016040528015610db1576020820181803683370190505b50604051610dbf9190613436565b60006040518083038185875af1925050503d8060008114610dfc576040519150601f19603f3d011682016040523d82523d6000602084013e610e01565b606091505b5050905080610e2357604051630ce8f45160e31b815260040160405180910390fd5b5061117a565b606f546040516340c10f1960e01b81526001600160a01b03909116906340c10f1990610e5b90879087906004016133e3565b600060405180830381600087803b158015610e7557600080fd5b505af1158015610e89573d6000803e3d6000fd5b5050505061117a565b606d546001600160a01b038781169116148015610ec05750606d5463ffffffff888116600160a01b90920416145b15610ed85760006001600160a01b0385168482610d87565b60685463ffffffff610100909104811690881603610f0957610f046001600160a01b03871685856120c7565b61117a565b60008787604051602001610f1e9291906132d2565b60408051601f1981840301815291815281516020928301206000818152606a9093529120549091506001600160a01b031680611116576000610f968386868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061212292505050565b6040516340c10f1960e01b81529091506001600160a01b038216906340c10f1990610fc7908a908a906004016133e3565b600060405180830381600087803b158015610fe157600080fd5b505af1158015610ff5573d6000803e3d6000fd5b5050505080606a600085815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060405180604001604052808b63ffffffff1681526020018a6001600160a01b0316815250606b6000836001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a8154816001600160a01b0302191690836001600160a01b031602179055509050507f490e59a1701b938786ac72570a1efeac994a3dbe96e2e883e19e902ace6e6a398a8a83888860405161110895949392919061347b565b60405180910390a150611177565b6040516340c10f1960e01b81526001600160a01b038216906340c10f199061114490899089906004016133e3565b600060405180830381600087803b15801561115e57600080fd5b505af1158015611172573d6000803e3d6000fd5b505050505b50505b7f1df3f2a973a00d6635911755c260704e95e8a5876997546798770f76396fda4d8a888887876040516111b19594939291906134b4565b60405180910390a1505050505050505050505050565b60685460ff16156111eb57604051630bc011ff60e21b815260040160405180910390fd5b6111f361219e565b60685463ffffffff610100909104811690881603611224576040516302caf51760e11b815260040160405180910390fd5b6000806060876001600160a01b03881661130a578834146112585760405163b89240f560e01b815260040160405180910390fd5b606d54606e80546001600160a01b0383169650600160a01b90920463ffffffff16945090611285906132fc565b80601f01602080910402602001604051908101604052809291908181526020018280546112b1906132fc565b80156112fe5780601f106112d3576101008083540402835291602001916112fe565b820191906000526020600020905b8154815290600101906020018083116112e157829003601f168201915b50505050509150611596565b34156113295760405163798ee6f160e01b815260040160405180910390fd5b606f546001600160a01b03908116908916036113a457604051632770a7eb60e21b81526001600160a01b03891690639dc29fac9061136d9033908d906004016133e3565b600060405180830381600087803b15801561138757600080fd5b505af115801561139b573d6000803e3d6000fd5b50505050611596565b6001600160a01b038089166000908152606b602090815260409182902082518084019093525463ffffffff81168352600160201b9004909216918101829052901561145c57604051632770a7eb60e21b81526001600160a01b038a1690639dc29fac906114179033908e906004016133e3565b600060405180830381600087803b15801561143157600080fd5b505af1158015611445573d6000803e3d6000fd5b505050508060200151945080600001519350611589565b851561146e5761146e898b89896121f7565b6040516370a0823160e01b81526000906001600160a01b038b16906370a082319061149d903090600401612b9c565b602060405180830381865afa1580156114ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114de91906134e6565b90506114f56001600160a01b038b1633308e61253d565b6040516370a0823160e01b81526000906001600160a01b038c16906370a0823190611524903090600401612b9c565b602060405180830381865afa158015611541573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061156591906134e6565b905061157182826134ff565b6068548c9850610100900463ffffffff169650935050505b61159289610c04565b9250505b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b600084868e8e86886053546040516115d6989796959493929190613512565b60405180910390a16115fd6115f8600085878f8f878980519060200120610791565b612575565b861561160b5761160b611ecf565b5050505061161860018055565b50505050505050565b606c546001600160a01b0316331461164c57604051631736745960e31b815260040160405180910390fd5b610640612660565b60685460ff161561167857604051630bc011ff60e21b815260040160405180910390fd5b60685463ffffffff86811661010090920416146116a8576040516302caf51760e11b815260040160405180910390fd5b6116ca8c8c8c8c8c610d5560018e8e8e8e8e8e8e604051610d48929190613426565b606f546000906001600160a01b031661178157846001600160a01b031684888a86866040516024016116ff949392919061357d565b60408051601f198184030181529181526020820180516001600160e01b0316630c035af960e11b179052516117349190613436565b60006040518083038185875af1925050503d8060008114611771576040519150601f19603f3d011682016040523d82523d6000602084013e611776565b606091505b505080915050611883565b606f546040516340c10f1960e01b81526001600160a01b03909116906340c10f19906117b390889088906004016133e3565b600060405180830381600087803b1580156117cd57600080fd5b505af11580156117e1573d6000803e3d6000fd5b50505050846001600160a01b031687898585604051602401611806949392919061357d565b60408051601f198184030181529181526020820180516001600160e01b0316630c035af960e11b1790525161183b9190613436565b6000604051808303816000865af19150503d8060008114611878576040519150601f19603f3d011682016040523d82523d6000602084013e61187d565b606091505b50909150505b806118a1576040516337e391c360e01b815260040160405180910390fd5b7f1df3f2a973a00d6635911755c260704e95e8a5876997546798770f76396fda4d8b898988886040516118d89594939291906134b4565b60405180910390a150505050505050505050505050565b600054610100900460ff161580801561190f5750600054600160ff909116105b806119295750303b158015611929575060005460ff166001145b6119915760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff1916600117905580156119b4576000805461ff0019166101001790555b60688054610100600160c81b03191661010063ffffffff8a160265010000000000600160c81b03191617600160281b6001600160a01b038781169190910291909117909155606c80546001600160a01b0319168583161790558616611a3d5763ffffffff851615611a3857604051630d43a60960e11b815260040160405180910390fd5b611b0c565b606d805463ffffffff8716600160a01b026001600160c01b03199091166001600160a01b03891617179055606e611a7483826135fe565b50611aeb6000801b6012604051602001611ad791906060808252600d908201526c2bb930b83832b21022ba3432b960991b608082015260a060208201819052600490820152630ae8aa8960e31b60c082015260ff91909116604082015260e00190565b604051602081830303815290604052612122565b606f80546001600160a01b0319166001600160a01b03929092169190911790555b611b146126b8565b8015611618576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150505050505050565b600081611b70868686610965565b1495945050505050565b60685460ff1615611b9e57604051630bc011ff60e21b815260040160405180910390fd5b6068805460ff191660011790556040517f2261efe5aef6fedc1fd1550b25facc9181745623049c7901287030b9ad1a549790600090a1565b60685463ffffffff610100909104811690871603611c07576040516302caf51760e11b815260040160405180910390fd5b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b6001606860019054906101000a900463ffffffff16338989898888605354604051611c5b999897969594939291906136bd565b60405180910390a1611c926115f86001606860019054906101000a900463ffffffff16338a8a8a8989604051610d48929190613426565b8215610bfc57610bfc611ecf565b60408051600481526024810182526020810180516001600160e01b03166306fdde0360e01b179052905160609160009182916001600160a01b03861691611ce79190613436565b600060405180830381855afa9150503d8060008114611d22576040519150601f19603f3d011682016040523d82523d6000602084013e611d27565b606091505b509150915081611d5657604051806040016040528060078152602001664e4f5f4e414d4560c81b81525061091d565b61091d816126e7565b60408051600481526024810182526020810180516001600160e01b03166395d89b4160e01b179052905160609160009182916001600160a01b03861691611da69190613436565b600060405180830381855afa9150503d8060008114611de1576040519150601f19603f3d011682016040523d82523d6000602084013e611de6565b606091505b509150915081611d5657604051806040016040528060098152602001681393d7d4d6535093d360ba1b81525061091d565b60408051600481526024810182526020810180516001600160e01b031663313ce56760e01b1790529051600091829182916001600160a01b03861691611e5d9190613436565b600060405180830381855afa9150503d8060008114611e98576040519150601f19603f3d011682016040523d82523d6000602084013e611e9d565b606091505b5091509150818015611eb0575080516020145b611ebb57601261091d565b8080602001905181019061091d919061372a565b6053546068805463ffffffff909216600160c81b0263ffffffff60c81b1990921691909117908190556001600160a01b03600160281b909104166333d6247d611f1661081e565b6040518263ffffffff1660e01b8152600401611f3491815260200190565b600060405180830381600087803b158015611f4e57600080fd5b505af1158015611f62573d6000803e3d6000fd5b50505050565b606854604080516020808201879052818301869052825180830384018152606083019384905280519101206312bd9b1960e11b9092526064810191909152600091600160281b90046001600160a01b03169063257b3632906084016020604051808303816000875af1158015611fe2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061200691906134e6565b90508060000361202857604051622f6fad60e01b815260040160405180910390fd5b600080600160401b87161561206857869150612046848a8489611b62565b612063576040516338105f3b60e21b815260040160405180910390fd5b6120b2565b602087901c612078816001613747565b915087925061209361208b868c86610965565b8a8389611b62565b6120b0576040516338105f3b60e21b815260040160405180910390fd5b505b6120bc8282612875565b505050505050505050565b61211d8363a9059cbb60e01b84846040516024016120e69291906133e3565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261291d565b505050565b60008060405180611ba00160405280611b668152602001613a7a611b669139836040516020016121539291906133b4565b6040516020818303038152906040529050838151602083016000f591506001600160a01b038216612197576040516305f7d84960e51b815260040160405180910390fd5b5092915050565b6002600154036121f05760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611988565b6002600155565b60006122066004828486613764565b61220f9161378e565b9050632afa533160e01b6001600160e01b03198216016123a357600080808080808061223e896004818d613764565b81019061224b91906137be565b9650965096509650965096509650336001600160a01b0316876001600160a01b03161461228b5760405163912ecce760e01b815260040160405180910390fd5b6001600160a01b03861630146122b45760405163750643af60e01b815260040160405180910390fd5b8a85146122d4576040516303fffc4b60e01b815260040160405180910390fd5b604080516001600160a01b0389811660248301528881166044830152606482018890526084820187905260ff861660a483015260c4820185905260e48083018590528351808403909101815261010490920183526020820180516001600160e01b031663d505accf60e01b1790529151918e16916123529190613436565b6000604051808303816000865af19150503d806000811461238f576040519150601f19603f3d011682016040523d82523d6000602084013e612394565b606091505b505050505050505050506106fc565b6001600160e01b031981166323f2ebc360e21b146123d457604051637141605d60e11b815260040160405180910390fd5b6000808080808080806123ea8a6004818e613764565b8101906123f79190613812565b97509750975097509750975097509750336001600160a01b0316886001600160a01b0316146124395760405163912ecce760e01b815260040160405180910390fd5b6001600160a01b03871630146124625760405163750643af60e01b815260040160405180910390fd5b604080516001600160a01b038a811660248301528981166044830152606482018990526084820188905286151560a483015260ff861660c483015260e482018590526101048083018590528351808403909101815261012490920183526020820180516001600160e01b03166323f2ebc360e21b1790529151918f16916124e99190613436565b6000604051808303816000865af19150503d8060008114612526576040519150601f19603f3d011682016040523d82523d6000602084013e61252b565b606091505b50505050505050505050505050505050565b6040516001600160a01b0380851660248301528316604482015260648101829052611f629085906323b872dd60e01b906084016120e6565b80600161258460206002613979565b61258e91906134ff565b605354106125af576040516377ae67b360e11b815260040160405180910390fd5b60006053600081546125c090613362565b9182905550905060005b6020811015612651578082901c6001166001036125fd5782603382602081106125f5576125f5613336565b015550505050565b6033816020811061261057612610613336565b01546040805160208101929092528101849052606001604051602081830303815290604052805190602001209250808061264990613362565b9150506125ca565b5061211d613985565b60018055565b60685460ff1661268357604051635386698160e01b815260040160405180910390fd5b6068805460ff191690556040517f1e5e34eea33501aecf2ebec9fe0e884a40804275ea7fe10b2ba084c8374308b390600090a1565b600054610100900460ff166126df5760405162461bcd60e51b81526004016119889061399b565b6106406129ef565b60606040825110612706578180602001905181019061068d91906139e6565b81516020036128425760005b602081108015612741575082818151811061272f5761272f613336565b01602001516001600160f81b03191615155b15612758578061275081613362565b915050612712565b806000036127905750506040805180820190915260128152714e4f545f56414c49445f454e434f44494e4760701b6020820152919050565b6000816001600160401b038111156127aa576127aa612e47565b6040519080825280601f01601f1916602001820160405280156127d4576020820181803683370190505b50905060005b8281101561283a578481815181106127f4576127f4613336565b602001015160f81c60f81b82828151811061281157612811613336565b60200101906001600160f81b031916908160001a9053508061283281613362565b9150506127da565b509392505050565b50506040805180820190915260128152714e4f545f56414c49445f454e434f44494e4760701b602082015290565b919050565b606854600090610100900463ffffffff16158015612899575063ffffffff82166001145b156128ab575063ffffffff82166128d2565b6128bf600160201b63ffffffff84166133fc565b6128cf9063ffffffff8516613413565b90505b600881901c60008181526069602052604081208054600160ff861690811b9182189283905592909190818316900361161857604051630c8d9eab60e31b815260040160405180910390fd5b6000612972826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612a169092919063ffffffff16565b80519091501561211d57808060200190518101906129909190613a5c565b61211d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401611988565b600054610100900460ff1661265a5760405162461bcd60e51b81526004016119889061399b565b606061091d848460008585600080866001600160a01b03168587604051612a3d9190613436565b60006040518083038185875af1925050503d8060008114612a7a576040519150601f19603f3d011682016040523d82523d6000602084013e612a7f565b606091505b5091509150612a9087838387612a9b565b979650505050505050565b60608315612b0a578251600003612b03576001600160a01b0385163b612b035760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611988565b508161091d565b61091d8383815115612b1f5781518083602001fd5b8060405162461bcd60e51b81526004016119889190612ccf565b803563ffffffff8116811461287057600080fd5b6001600160a01b0381168114612b6257600080fd5b50565b60008060408385031215612b7857600080fd5b612b8183612b39565b91506020830135612b9181612b4d565b809150509250929050565b6001600160a01b0391909116815260200190565b8015158114612b6257600080fd5b60008083601f840112612bd057600080fd5b5081356001600160401b03811115612be757600080fd5b602083019150836020828501011115612bff57600080fd5b9250929050565b600080600080600060808688031215612c1e57600080fd5b612c2786612b39565b94506020860135612c3781612b4d565b93506040860135612c4781612bb0565b925060608601356001600160401b03811115612c6257600080fd5b612c6e88828901612bbe565b969995985093965092949392505050565b60005b83811015612c9a578181015183820152602001612c82565b50506000910152565b60008151808452612cbb816020860160208601612c7f565b601f01601f19169290920160200192915050565b602081526000612ce26020830184612ca3565b9392505050565b600060208284031215612cfb57600080fd5b8135612ce281612b4d565b60ff81168114612b6257600080fd5b600080600080600080600060e0888a031215612d3057600080fd5b8735612d3b81612d06565b9650612d4960208901612b39565b95506040880135612d5981612b4d565b9450612d6760608901612b39565b93506080880135612d7781612b4d565b9699959850939692959460a0840135945060c09093013592915050565b600080600060608486031215612da957600080fd5b612db284612b39565b92506020840135612dc281612b4d565b91506040840135612dd281612b4d565b809150509250925092565b600060208284031215612def57600080fd5b5035919050565b80610400810183101561068d57600080fd5b60008060006104408486031215612e1e57600080fd5b83359250612e2f8560208601612df6565b9150612e3e6104208501612b39565b90509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715612e8557612e85612e47565b604052919050565b60006001600160401b03821115612ea657612ea6612e47565b50601f01601f191660200190565b6000612ec7612ec284612e8d565b612e5d565b9050828152838383011115612edb57600080fd5b828260208301376000602084830101529392505050565b600082601f830112612f0357600080fd5b612ce283833560208501612eb4565b600080600080600060a08688031215612f2a57600080fd5b612f3386612b39565b94506020860135612f4381612b4d565b935060408601356001600160401b0380821115612f5f57600080fd5b612f6b89838a01612ef2565b94506060880135915080821115612f8157600080fd5b50612f8e88828901612ef2565b9250506080860135612f9f81612d06565b809150509295509295909350565b60008060008060008060a08789031215612fc657600080fd5b612fcf87612b39565b95506020870135612fdf81612b4d565b9450604087013593506060870135612ff681612bb0565b925060808701356001600160401b0381111561301157600080fd5b61301d89828a01612bbe565b979a9699509497509295939492505050565b6000806040838503121561304257600080fd5b61304b83612b39565b915061305960208401612b39565b90509250929050565b6000806000806000806000806000806000806109208d8f03121561308557600080fd5b61308f8e8e612df6565b9b5061309f8e6104008f01612df6565b9a506108008d013599506108208d013598506108408d013597506130c66108608e01612b39565b96506130d66108808e0135612b4d565b6108808d013595506130eb6108a08e01612b39565b94506130fb6108c08e0135612b4d565b6108c08d013593506108e08d013592506001600160401b036109008e0135111561312457600080fd5b6131358e6109008f01358f01612bbe565b81935080925050509295989b509295989b509295989b565b600080600080600080600060c0888a03121561316857600080fd5b61317188612b39565b9650602088013561318181612b4d565b955060408801359450606088013561319881612b4d565b935060808801356131a881612bb0565b925060a08801356001600160401b038111156131c357600080fd5b6131cf8a828b01612bbe565b989b979a50959850939692959293505050565b60008060008060008060c087890312156131fb57600080fd5b61320487612b39565b9550602087013561321481612b4d565b945061322260408801612b39565b9350606087013561323281612b4d565b9250608087013561324281612b4d565b915060a08701356001600160401b0381111561325d57600080fd5b8701601f8101891361326e57600080fd5b61327d89823560208401612eb4565b9150509295509295509295565b60008060008061046085870312156132a157600080fd5b843593506132b28660208701612df6565b92506132c16104208601612b39565b939692955092936104400135925050565b60e09290921b6001600160e01b031916825260601b6001600160601b031916600482015260180190565b600181811c9082168061331057607f821691505b60208210810361333057634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016133745761337461334c565b5060010190565b60608152600061338e6060830186612ca3565b82810360208401526133a08186612ca3565b91505060ff83166040830152949350505050565b600083516133c6818460208801612c7f565b8351908301906133da818360208801612c7f565b01949350505050565b6001600160a01b03929092168252602082015260400190565b808202811582820484141761068d5761068d61334c565b8082018082111561068d5761068d61334c565b8183823760009101908152919050565b60008251613448818460208701612c7f565b9190910192915050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b63ffffffff861681526001600160a01b03858116602083015284166040820152608060608201819052600090612a909083018486613452565b94855263ffffffff9390931660208501526001600160a01b039182166040850152166060830152608082015260a00190565b6000602082840312156134f857600080fd5b5051919050565b8181038181111561068d5761068d61334c565b60ff8916815263ffffffff88811660208301526001600160a01b03888116604084015287821660608401528616608083015260a0820185905261010060c0830181905260009161356484830187612ca3565b925080851660e085015250509998505050505050505050565b6001600160a01b038516815263ffffffff841660208201526060604082018190526000906135ae9083018486613452565b9695505050505050565b601f82111561211d57600081815260208120601f850160051c810160208610156135df5750805b601f850160051c820191505b81811015610bfc578281556001016135eb565b81516001600160401b0381111561361757613617612e47565b61362b8161362584546132fc565b846135b8565b602080601f83116001811461366057600084156136485750858301515b600019600386901b1c1916600185901b178555610bfc565b600085815260208120601f198616915b8281101561368f57888601518255948401946001909101908401613670565b50858210156136ad5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60ff8a16815263ffffffff89811660208301526001600160a01b03898116604084015288821660608401528716608083015260a0820186905261010060c083018190526000916137108483018789613452565b925080851660e085015250509a9950505050505050505050565b60006020828403121561373c57600080fd5b8151612ce281612d06565b63ffffffff8181168382160190808211156121975761219761334c565b6000808585111561377457600080fd5b8386111561378157600080fd5b5050820193919092039150565b6001600160e01b031981358181169160048510156137b65780818660040360031b1b83161692505b505092915050565b600080600080600080600060e0888a0312156137d957600080fd5b87356137e481612b4d565b965060208801356137f481612b4d565b955060408801359450606088013593506080880135612d7781612d06565b600080600080600080600080610100898b03121561382f57600080fd5b883561383a81612b4d565b9750602089013561384a81612b4d565b96506040890135955060608901359450608089013561386881612bb0565b935060a089013561387881612d06565b979a969950949793969295929450505060c08201359160e0013590565b600181815b808511156138d05781600019048211156138b6576138b661334c565b808516156138c357918102915b93841c939080029061389a565b509250929050565b6000826138e75750600161068d565b816138f45750600061068d565b816001811461390a576002811461391457613930565b600191505061068d565b60ff8411156139255761392561334c565b50506001821b61068d565b5060208310610133831016604e8410600b8410161715613953575081810a61068d565b61395d8383613895565b80600019048211156139715761397161334c565b029392505050565b6000612ce283836138d8565b634e487b7160e01b600052600160045260246000fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156139f857600080fd5b81516001600160401b03811115613a0e57600080fd5b8201601f81018413613a1f57600080fd5b8051613a2d612ec282612e8d565b818152856020838501011115613a4257600080fd5b613a53826020830160208601612c7f565b95945050505050565b600060208284031215613a6e57600080fd5b8151612ce281612bb056fe6101006040523480156200001257600080fd5b5060405162001b6638038062001b6683398101604081905262000035916200028d565b82826003620000458382620003a1565b506004620000548282620003a1565b50503360c0525060ff811660e052466080819052620000739062000080565b60a052506200046d915050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f620000ad6200012e565b805160209182012060408051808201825260018152603160f81b90840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b6060600380546200013f9062000312565b80601f01602080910402602001604051908101604052809291908181526020018280546200016d9062000312565b8015620001be5780601f106200019257610100808354040283529160200191620001be565b820191906000526020600020905b815481529060010190602001808311620001a057829003601f168201915b5050505050905090565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620001f057600080fd5b81516001600160401b03808211156200020d576200020d620001c8565b604051601f8301601f19908116603f01168101908282118183101715620002385762000238620001c8565b816040528381526020925086838588010111156200025557600080fd5b600091505b838210156200027957858201830151818301840152908201906200025a565b600093810190920192909252949350505050565b600080600060608486031215620002a357600080fd5b83516001600160401b0380821115620002bb57600080fd5b620002c987838801620001de565b94506020860151915080821115620002e057600080fd5b50620002ef86828701620001de565b925050604084015160ff811681146200030757600080fd5b809150509250925092565b600181811c908216806200032757607f821691505b6020821081036200034857634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200039c57600081815260208120601f850160051c81016020861015620003775750805b601f850160051c820191505b81811015620003985782815560010162000383565b5050505b505050565b81516001600160401b03811115620003bd57620003bd620001c8565b620003d581620003ce845462000312565b846200034e565b602080601f8311600181146200040d5760008415620003f45750858301515b600019600386901b1c1916600185901b17855562000398565b600085815260208120601f198616915b828110156200043e578886015182559484019460019091019084016200041d565b50858210156200045d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e0516116aa620004bc6000396000610237015260008181610307015281816105c001526106a70152600061053a015260008181610379015261050401526116aa6000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806370a08231116100d8578063a457c2d71161008c578063d505accf11610066578063d505accf1461039b578063dd62ed3e146103ae578063ffa1ad74146103f457600080fd5b8063a457c2d71461034e578063a9059cbb14610361578063cd0d00961461037457600080fd5b806395d89b41116100bd57806395d89b41146102e75780639dc29fac146102ef578063a3c573eb1461030257600080fd5b806370a08231146102915780637ecebe00146102c757600080fd5b806330adf81f1161012f5780633644e515116101145780633644e51514610261578063395093511461026957806340c10f191461027c57600080fd5b806330adf81f14610209578063313ce5671461023057600080fd5b806318160ddd1161016057806318160ddd146101bd57806320606b70146101cf57806323b872dd146101f657600080fd5b806306fdde031461017c578063095ea7b31461019a575b600080fd5b610184610430565b60405161019191906113e4565b60405180910390f35b6101ad6101a8366004611479565b6104c2565b6040519015158152602001610191565b6002545b604051908152602001610191565b6101c17f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81565b6101ad6102043660046114a3565b6104dc565b6101c17f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152602001610191565b6101c1610500565b6101ad610277366004611479565b61055c565b61028f61028a366004611479565b6105a8565b005b6101c161029f3660046114df565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6101c16102d53660046114df565b60056020526000908152604090205481565b610184610680565b61028f6102fd366004611479565b61068f565b6103297f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610191565b6101ad61035c366004611479565b61075e565b6101ad61036f366004611479565b61082f565b6101c17f000000000000000000000000000000000000000000000000000000000000000081565b61028f6103a9366004611501565b61083d565b6101c16103bc366004611574565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6101846040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525081565b60606003805461043f906115a7565b80601f016020809104026020016040519081016040528092919081815260200182805461046b906115a7565b80156104b85780601f1061048d576101008083540402835291602001916104b8565b820191906000526020600020905b81548152906001019060200180831161049b57829003601f168201915b5050505050905090565b6000336104d0818585610b73565b60019150505b92915050565b6000336104ea858285610d27565b6104f5858585610dfe565b506001949350505050565b60007f00000000000000000000000000000000000000000000000000000000000000004614610537576105324661106d565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091906104d090829086906105a3908790611629565b610b73565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610672576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d4272696467650000000000000000000000000000000060648201526084015b60405180910390fd5b61067c8282611135565b5050565b60606004805461043f906115a7565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610754576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d427269646765000000000000000000000000000000006064820152608401610669565b61067c8282611228565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015610822576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610669565b6104f58286868403610b73565b6000336104d0818585610dfe565b834211156108cc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f546f6b656e577261707065643a3a7065726d69743a204578706972656420706560448201527f726d6974000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8716600090815260056020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918a918a918a9190866109268361163c565b9091555060408051602081019690965273ffffffffffffffffffffffffffffffffffffffff94851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000610991610500565b6040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281019190915260428101839052606201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa158015610a55573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590610ad057508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b610b5c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f546f6b656e577261707065643a3a7065726d69743a20496e76616c696420736960448201527f676e6174757265000000000000000000000000000000000000000000000000006064820152608401610669565b610b678a8a8a610b73565b50505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff8316610c15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610cb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610df85781811015610deb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610669565b610df88484848403610b73565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610ea1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610f44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610ffa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610df8565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f611098610430565b8051602091820120604080518082018252600181527f310000000000000000000000000000000000000000000000000000000000000090840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b73ffffffffffffffffffffffffffffffffffffffff82166111b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610669565b80600260008282546111c49190611629565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff82166112cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205481811015611381576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610d1a565b600060208083528351808285015260005b81811015611411578581018301518582016040015282016113f5565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461147457600080fd5b919050565b6000806040838503121561148c57600080fd5b61149583611450565b946020939093013593505050565b6000806000606084860312156114b857600080fd5b6114c184611450565b92506114cf60208501611450565b9150604084013590509250925092565b6000602082840312156114f157600080fd5b6114fa82611450565b9392505050565b600080600080600080600060e0888a03121561151c57600080fd5b61152588611450565b965061153360208901611450565b95506040880135945060608801359350608088013560ff8116811461155757600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561158757600080fd5b61159083611450565b915061159e60208401611450565b90509250929050565b600181811c908216806115bb57607f821691505b6020821081036115f4577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156104d6576104d66115fa565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361166d5761166d6115fa565b506001019056fea26469706673582212208d88fee561cff7120d381c345cfc534cef8229a272dc5809d4bbb685ad67141164736f6c63430008110033a2646970667358221220914f18d5b241f0d10b2ebc814aadeee338ad60bad704683e414dad415cb2e14d64736f6c63430008140033" + }, + { + "contractName": "PolygonZkEVMBridge proxy", + "balance": "340282366920938463463374607431768211455", + "nonce": "1", + "address": "0xB7098a13a48EcE087d3DA15b2D28eCE0f89819B8", + "bytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461086f565b610135565b61006b6100a336600461088a565b61017f565b3480156100b457600080fd5b506100bd6101f3565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461086f565b610231565b34801561011257600080fd5b506100bd61025e565b61012361028c565b61013361012e610363565b61036d565b565b61013d610391565b73ffffffffffffffffffffffffffffffffffffffff16330361017757610174816040518060200160405280600081525060006103d1565b50565b61017461011b565b610187610391565b73ffffffffffffffffffffffffffffffffffffffff1633036101eb576101e68383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506103d1915050565b505050565b6101e661011b565b60006101fd610391565b73ffffffffffffffffffffffffffffffffffffffff16330361022657610221610363565b905090565b61022e61011b565b90565b610239610391565b73ffffffffffffffffffffffffffffffffffffffff16330361017757610174816103fc565b6000610268610391565b73ffffffffffffffffffffffffffffffffffffffff16330361022657610221610391565b610294610391565b73ffffffffffffffffffffffffffffffffffffffff163303610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b600061022161045d565b3660008037600080366000845af43d6000803e80801561038c573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6103da83610485565b6000825111806103e75750805b156101e6576103f683836104d2565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f610425610391565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a1610174816104fe565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6103b5565b61048e8161060a565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606104f7838360405180606001604052806027815260200161099f602791396106d5565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff81166105a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161035a565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b73ffffffffffffffffffffffffffffffffffffffff81163b6106ae576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161035a565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6105c4565b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516106ff9190610931565b600060405180830381855af49150503d806000811461073a576040519150601f19603f3d011682016040523d82523d6000602084013e61073f565b606091505b50915091506107508683838761075a565b9695505050505050565b606083156107f05782516000036107e95773ffffffffffffffffffffffffffffffffffffffff85163b6107e9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161035a565b50816107fa565b6107fa8383610802565b949350505050565b8151156108125781518083602001fd5b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161035a919061094d565b803573ffffffffffffffffffffffffffffffffffffffff8116811461086a57600080fd5b919050565b60006020828403121561088157600080fd5b6104f782610846565b60008060006040848603121561089f57600080fd5b6108a884610846565b9250602084013567ffffffffffffffff808211156108c557600080fd5b818601915086601f8301126108d957600080fd5b8135818111156108e857600080fd5b8760208285010111156108fa57600080fd5b6020830194508093505050509250925092565b60005b83811015610928578181015183820152602001610910565b50506000910152565b6000825161094381846020870161090d565b9190910192915050565b602081526000825180602084015261096c81604085016020870161090d565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220701a0c26bdd76686e63fc3c65e4f28a20ba3ecc8a60246733c0627e679c9804e64736f6c63430008140033", + "storage": { + "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x000000000000000000000000e34fe58dda5b8c6d547e4857e987633aa86a5e90", + "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x000000000000000000000000493732fb136a380920c390a85fc27d79c7b70756" + } + }, + { + "contractName": "PolygonZkEVMGlobalExitRootL2 implementation", + "balance": "0", + "nonce": "1", + "address": "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9", + "bytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806301fd904414610051578063257b36321461006d57806333d6247d1461008d578063a3c573eb146100a2575b600080fd5b61005a60015481565b6040519081526020015b60405180910390f35b61005a61007b366004610162565b60006020819052908152604090205481565b6100a061009b366004610162565b6100ee565b005b6100c97f000000000000000000000000b7098a13a48ece087d3da15b2d28ece0f89819b881565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610064565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000b7098a13a48ece087d3da15b2d28ece0f89819b8161461015d576040517fb49365dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600155565b60006020828403121561017457600080fd5b503591905056fea2646970667358221220ea2171e2c85c8bff947affc409ef6fc6a8fe82fb8c174ddeda988651e595d66564736f6c63430008140033" + }, + { + "contractName": "PolygonZkEVMGlobalExitRootL2 proxy", + "balance": "0", + "nonce": "1", + "address": "0xa40d5f56745a118d0906a34e69aec8c0db1cb8fa", + "bytecode": "0x60806040523661001357610011610017565b005b6100115b61001f6101b7565b6001600160a01b0316336001600160a01b0316141561016f5760606001600160e01b031960003516631b2ce7f360e11b8114156100655761005e6101ea565b9150610167565b6001600160e01b0319811663278f794360e11b14156100865761005e610241565b6001600160e01b031981166308f2839760e41b14156100a75761005e610287565b6001600160e01b031981166303e1469160e61b14156100c85761005e6102b8565b6001600160e01b03198116635c60da1b60e01b14156100e95761005e6102f8565b60405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b815160208301f35b61017761030c565b565b606061019e83836040518060600160405280602781526020016108576027913961031c565b9392505050565b90565b6001600160a01b03163b151590565b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b60606101f4610394565b600061020336600481846106a2565b81019061021091906106e8565b905061022d8160405180602001604052806000815250600061039f565b505060408051602081019091526000815290565b606060008061025336600481846106a2565b8101906102609190610719565b915091506102708282600161039f565b604051806020016040528060008152509250505090565b6060610291610394565b60006102a036600481846106a2565b8101906102ad91906106e8565b905061022d816103cb565b60606102c2610394565b60006102cc6101b7565b604080516001600160a01b03831660208201529192500160405160208183030381529060405291505090565b6060610302610394565b60006102cc610422565b610177610317610422565b610431565b6060600080856001600160a01b0316856040516103399190610807565b600060405180830381855af49150503d8060008114610374576040519150601f19603f3d011682016040523d82523d6000602084013e610379565b606091505b509150915061038a86838387610455565b9695505050505050565b341561017757600080fd5b6103a8836104d3565b6000825111806103b55750805b156103c6576103c48383610179565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6103f46101b7565b604080516001600160a01b03928316815291841660208301520160405180910390a161041f81610513565b50565b600061042c6105bc565b905090565b3660008037600080366000845af43d6000803e808015610450573d6000f35b3d6000fd5b606083156104c15782516104ba576001600160a01b0385163b6104ba5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161015e565b50816104cb565b6104cb83836105e4565b949350505050565b6104dc8161060e565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6001600160a01b0381166105785760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b606482015260840161015e565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80546001600160a01b0319166001600160a01b039290921691909117905550565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6101db565b8151156105f45781518083602001fd5b8060405162461bcd60e51b815260040161015e9190610823565b6001600160a01b0381163b61067b5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161015e565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc61059b565b600080858511156106b257600080fd5b838611156106bf57600080fd5b5050820193919092039150565b80356001600160a01b03811681146106e357600080fd5b919050565b6000602082840312156106fa57600080fd5b61019e826106cc565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561072c57600080fd5b610735836106cc565b9150602083013567ffffffffffffffff8082111561075257600080fd5b818501915085601f83011261076657600080fd5b81358181111561077857610778610703565b604051601f8201601f19908116603f011681019083821181831017156107a0576107a0610703565b816040528281528860208487010111156107b957600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b838110156107f65781810151838201526020016107de565b838111156103c45750506000910152565b600082516108198184602087016107db565b9190910192915050565b60208152600082518060208401526108428160408501602087016107db565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122012bb4f564f73959a03513dc74fc3c6e40e8386e6f02c16b78d6db00ce0aa16af64736f6c63430008090033", + "storage": { + "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x000000000000000000000000e34fe58dda5b8c6d547e4857e987633aa86a5e90", + "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x000000000000000000000000dc64a140aa3e981100a9beca4e685f962f0cf6c9" + } + }, + { + "contractName": "PolygonZkEVMTimelock", + "balance": "0", + "nonce": "1", + "address": "0x0165878A594ca255338adfa4d48449f69242Eb8F", + "bytecode": "0x6080604052600436106101c65760003560e01c806364d62353116100f7578063b1c5f42711610095578063d547741f11610064578063d547741f14610661578063e38335e514610681578063f23a6e6114610694578063f27a0c92146106d957600080fd5b8063b1c5f427146105af578063bc197c81146105cf578063c4d252f514610614578063d45c44351461063457600080fd5b80638f61f4f5116100d15780638f61f4f5146104e157806391d1485414610515578063a217fddf14610566578063b08e51c01461057b57600080fd5b806364d62353146104815780638065657f146104a15780638f2a0bb0146104c157600080fd5b8063248a9ca31161016457806331d507501161013e57806331d50750146103c857806336568abe146103e85780633a6aae7214610408578063584b153e1461046157600080fd5b8063248a9ca3146103475780632ab0f529146103775780632f2ff15d146103a857600080fd5b80630d3cf6fc116101a05780630d3cf6fc1461026b578063134008d31461029f57806313bc9f20146102b2578063150b7a02146102d257600080fd5b806301d5062a146101d257806301ffc9a7146101f457806307bd02651461022957600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506101f26101ed366004611c52565b6106ee565b005b34801561020057600080fd5b5061021461020f366004611cc7565b610783565b60405190151581526020015b60405180910390f35b34801561023557600080fd5b5061025d7fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e6381565b604051908152602001610220565b34801561027757600080fd5b5061025d7f5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca581565b6101f26102ad366004611d09565b6107df565b3480156102be57600080fd5b506102146102cd366004611d75565b6108d7565b3480156102de57600080fd5b506103166102ed366004611e9a565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610220565b34801561035357600080fd5b5061025d610362366004611d75565b60009081526020819052604090206001015490565b34801561038357600080fd5b50610214610392366004611d75565b6000908152600160208190526040909120541490565b3480156103b457600080fd5b506101f26103c3366004611f02565b6108fd565b3480156103d457600080fd5b506102146103e3366004611d75565b610927565b3480156103f457600080fd5b506101f2610403366004611f02565b610940565b34801561041457600080fd5b5061043c7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610220565b34801561046d57600080fd5b5061021461047c366004611d75565b6109f8565b34801561048d57600080fd5b506101f261049c366004611d75565b610a0e565b3480156104ad57600080fd5b5061025d6104bc366004611d09565b610ade565b3480156104cd57600080fd5b506101f26104dc366004611f73565b610b1d565b3480156104ed57600080fd5b5061025d7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc181565b34801561052157600080fd5b50610214610530366004611f02565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b34801561057257600080fd5b5061025d600081565b34801561058757600080fd5b5061025d7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f78381565b3480156105bb57600080fd5b5061025d6105ca366004612025565b610d4f565b3480156105db57600080fd5b506103166105ea36600461214e565b7fbc197c810000000000000000000000000000000000000000000000000000000095945050505050565b34801561062057600080fd5b506101f261062f366004611d75565b610d94565b34801561064057600080fd5b5061025d61064f366004611d75565b60009081526001602052604090205490565b34801561066d57600080fd5b506101f261067c366004611f02565b610e8f565b6101f261068f366004612025565b610eb4565b3480156106a057600080fd5b506103166106af3660046121f8565b7ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b3480156106e557600080fd5b5061025d611161565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc161071881611244565b6000610728898989898989610ade565b90506107348184611251565b6000817f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8b8b8b8b8b8a604051610770969594939291906122a6565b60405180910390a3505050505050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f4e2312e00000000000000000000000000000000000000000000000000000000014806107d957506107d98261139e565b92915050565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff1661085c5761085c8133611435565b600061086c888888888888610ade565b905061087881856114ed565b6108848888888861162a565b6000817fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588a8a8a8a6040516108bc94939291906122f1565b60405180910390a36108cd8161172e565b5050505050505050565b6000818152600160205260408120546001811180156108f65750428111155b9392505050565b60008281526020819052604090206001015461091881611244565b61092283836117d7565b505050565b60008181526001602052604081205481905b1192915050565b73ffffffffffffffffffffffffffffffffffffffff811633146109ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6109f482826118c7565b5050565b6000818152600160208190526040822054610939565b333014610a9d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f54696d656c6f636b436f6e74726f6c6c65723a2063616c6c6572206d7573742060448201527f62652074696d656c6f636b00000000000000000000000000000000000000000060648201526084016109e1565b60025460408051918252602082018390527f11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d5910160405180910390a1600255565b6000868686868686604051602001610afb969594939291906122a6565b6040516020818303038152906040528051906020012090509695505050505050565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1610b4781611244565b888714610bd6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b888514610c65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b6000610c778b8b8b8b8b8b8b8b610d4f565b9050610c838184611251565b60005b8a811015610d415780827f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8e8e85818110610cc357610cc3612331565b9050602002016020810190610cd89190612360565b8d8d86818110610cea57610cea612331565b905060200201358c8c87818110610d0357610d03612331565b9050602002810190610d15919061237b565b8c8b604051610d29969594939291906122a6565b60405180910390a3610d3a8161240f565b9050610c86565b505050505050505050505050565b60008888888888888888604051602001610d709897969594939291906124f7565b60405160208183030381529060405280519060200120905098975050505050505050565b7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f783610dbe81611244565b610dc7826109f8565b610e53576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20636160448201527f6e6e6f742062652063616e63656c6c656400000000000000000000000000000060648201526084016109e1565b6000828152600160205260408082208290555183917fbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb7091a25050565b600082815260208190526040902060010154610eaa81611244565b61092283836118c7565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff16610f3157610f318133611435565b878614610fc0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b87841461104f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b60006110618a8a8a8a8a8a8a8a610d4f565b905061106d81856114ed565b60005b8981101561114b5760008b8b8381811061108c5761108c612331565b90506020020160208101906110a19190612360565b905060008a8a848181106110b7576110b7612331565b9050602002013590503660008a8a868181106110d5576110d5612331565b90506020028101906110e7919061237b565b915091506110f78484848461162a565b84867fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588686868660405161112e94939291906122f1565b60405180910390a350505050806111449061240f565b9050611070565b506111558161172e565b50505050505050505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff161580159061123257507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166315064c966040518163ffffffff1660e01b8152600401602060405180830381865afa15801561120e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123291906125be565b1561123d5750600090565b5060025490565b61124e8133611435565b50565b61125a82610927565b156112e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20616c60448201527f7265616479207363686564756c6564000000000000000000000000000000000060648201526084016109e1565b6112ef611161565b81101561137e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a20696e73756666696369656e7460448201527f2064656c6179000000000000000000000000000000000000000000000000000060648201526084016109e1565b61138881426125e0565b6000928352600160205260409092209190915550565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806107d957507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146107d9565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f4576114738161197e565b61147e83602061199d565b60405160200161148f929190612617565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526109e191600401612698565b6114f6826108d7565b611582576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b80158061159e5750600081815260016020819052604090912054145b6109f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a206d697373696e67206465706560448201527f6e64656e6379000000000000000000000000000000000000000000000000000060648201526084016109e1565b60008473ffffffffffffffffffffffffffffffffffffffff168484846040516116549291906126e9565b60006040518083038185875af1925050503d8060008114611691576040519150601f19603f3d011682016040523d82523d6000602084013e611696565b606091505b5050905080611727576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f54696d656c6f636b436f6e74726f6c6c65723a20756e6465726c79696e67207460448201527f72616e73616374696f6e2072657665727465640000000000000000000000000060648201526084016109e1565b5050505050565b611737816108d7565b6117c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b600090815260016020819052604090912055565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556118693390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60606107d973ffffffffffffffffffffffffffffffffffffffff831660145b606060006119ac8360026126f9565b6119b79060026125e0565b67ffffffffffffffff8111156119cf576119cf611d8e565b6040519080825280601f01601f1916602001820160405280156119f9576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611a3057611a30612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611a9357611a93612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000611acf8460026126f9565b611ada9060016125e0565b90505b6001811115611b77577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611b1b57611b1b612331565b1a60f81b828281518110611b3157611b31612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611b7081612710565b9050611add565b5083156108f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109e1565b803573ffffffffffffffffffffffffffffffffffffffff81168114611c0457600080fd5b919050565b60008083601f840112611c1b57600080fd5b50813567ffffffffffffffff811115611c3357600080fd5b602083019150836020828501011115611c4b57600080fd5b9250929050565b600080600080600080600060c0888a031215611c6d57600080fd5b611c7688611be0565b965060208801359550604088013567ffffffffffffffff811115611c9957600080fd5b611ca58a828b01611c09565b989b979a50986060810135976080820135975060a09091013595509350505050565b600060208284031215611cd957600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146108f657600080fd5b60008060008060008060a08789031215611d2257600080fd5b611d2b87611be0565b955060208701359450604087013567ffffffffffffffff811115611d4e57600080fd5b611d5a89828a01611c09565b979a9699509760608101359660809091013595509350505050565b600060208284031215611d8757600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611e0457611e04611d8e565b604052919050565b600082601f830112611e1d57600080fd5b813567ffffffffffffffff811115611e3757611e37611d8e565b611e6860207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601611dbd565b818152846020838601011115611e7d57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215611eb057600080fd5b611eb985611be0565b9350611ec760208601611be0565b925060408501359150606085013567ffffffffffffffff811115611eea57600080fd5b611ef687828801611e0c565b91505092959194509250565b60008060408385031215611f1557600080fd5b82359150611f2560208401611be0565b90509250929050565b60008083601f840112611f4057600080fd5b50813567ffffffffffffffff811115611f5857600080fd5b6020830191508360208260051b8501011115611c4b57600080fd5b600080600080600080600080600060c08a8c031215611f9157600080fd5b893567ffffffffffffffff80821115611fa957600080fd5b611fb58d838e01611f2e565b909b50995060208c0135915080821115611fce57600080fd5b611fda8d838e01611f2e565b909950975060408c0135915080821115611ff357600080fd5b506120008c828d01611f2e565b9a9d999c50979a969997986060880135976080810135975060a0013595509350505050565b60008060008060008060008060a0898b03121561204157600080fd5b883567ffffffffffffffff8082111561205957600080fd5b6120658c838d01611f2e565b909a50985060208b013591508082111561207e57600080fd5b61208a8c838d01611f2e565b909850965060408b01359150808211156120a357600080fd5b506120b08b828c01611f2e565b999c989b509699959896976060870135966080013595509350505050565b600082601f8301126120df57600080fd5b8135602067ffffffffffffffff8211156120fb576120fb611d8e565b8160051b61210a828201611dbd565b928352848101820192828101908785111561212457600080fd5b83870192505b848310156121435782358252918301919083019061212a565b979650505050505050565b600080600080600060a0868803121561216657600080fd5b61216f86611be0565b945061217d60208701611be0565b9350604086013567ffffffffffffffff8082111561219a57600080fd5b6121a689838a016120ce565b945060608801359150808211156121bc57600080fd5b6121c889838a016120ce565b935060808801359150808211156121de57600080fd5b506121eb88828901611e0c565b9150509295509295909350565b600080600080600060a0868803121561221057600080fd5b61221986611be0565b945061222760208701611be0565b93506040860135925060608601359150608086013567ffffffffffffffff81111561225157600080fd5b6121eb88828901611e0c565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b73ffffffffffffffffffffffffffffffffffffffff8716815285602082015260a0604082015260006122dc60a08301868861225d565b60608301949094525060800152949350505050565b73ffffffffffffffffffffffffffffffffffffffff8516815283602082015260606040820152600061232760608301848661225d565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561237257600080fd5b6108f682611be0565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126123b057600080fd5b83018035915067ffffffffffffffff8211156123cb57600080fd5b602001915036819003821315611c4b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612440576124406123e0565b5060010190565b81835260006020808501808196508560051b810191508460005b878110156124ea57828403895281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18836030181126124a057600080fd5b8701858101903567ffffffffffffffff8111156124bc57600080fd5b8036038213156124cb57600080fd5b6124d686828461225d565b9a87019a9550505090840190600101612461565b5091979650505050505050565b60a0808252810188905260008960c08301825b8b8110156125455773ffffffffffffffffffffffffffffffffffffffff61253084611be0565b1682526020928301929091019060010161250a565b5083810360208501528881527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff89111561257e57600080fd5b8860051b9150818a602083013701828103602090810160408501526125a69082018789612447565b60608401959095525050608001529695505050505050565b6000602082840312156125d057600080fd5b815180151581146108f657600080fd5b808201808211156107d9576107d96123e0565b60005b8381101561260e5781810151838201526020016125f6565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161264f8160178501602088016125f3565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161268c8160288401602088016125f3565b01602801949350505050565b60208152600082518060208401526126b78160408501602087016125f3565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b8183823760009101908152919050565b80820281158282048414176107d9576107d96123e0565b60008161271f5761271f6123e0565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea2646970667358221220c474c39da3523b28ebfa5fd66c05b42d6ddcc4a57055483bdda32888b366016164736f6c63430008140033", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000000000000000000e10", + "0xaedcc9e7897c0d335bdc5d92fe3a8b4f23727fe558cd1c19f332b28716a30559": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0xf5e61edb9c9cc6bfbae4463e9a2b1dd6ac3b44ddef38f18016e56ba0363910d9": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x64494413541ff93b31aa309254e3fed72a7456e9845988b915b4c7a7ceba8814": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", + "0x60b9d94c75b7b3f721925089391e4644cd890cb5e6466f9596dfbd2c54e0b280": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x3412d5605ac6cd444957cedb533e5dacad6378b4bc819ebe3652188a665066d6": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", + "0x4b63b79f1e338a49559dcd3193ac9eecc50d0f275d24e97cc8c319e5a31a8bd0": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0xdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d706a": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", + "0x800d5dfe4bba53eedee06cd4546a27da8de00f12db83f56062976d4493fda899": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0xc3ad33e20b0c56a223ad5104fff154aa010f8715b9c981fd38fdc60a4d1a52fc": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5" + } + }, + { + "accountName": "keyless Deployer", + "balance": "0", + "nonce": "1", + "address": "0x28BB4e66addE1f042B77E04cf7D3784C1dcDBbA3" + }, + { + "accountName": "deployer", + "balance": "100000000000000000000000", + "nonce": "8", + "address": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" + } + ] } diff --git a/test/docker-compose.yml b/test/docker-compose.yml index 4230de2abb..c6c8043844 100644 --- a/test/docker-compose.yml +++ b/test/docker-compose.yml @@ -453,7 +453,7 @@ services: zkevm-mock-l1-network: container_name: zkevm-mock-l1-network - image: 0xpolygon/cdk-validium-contracts:forkId8 + image: 0xpolygon/cdk-validium-contracts:elderberry-fork.9-geth1.13.11 ports: - 8545:8545 - 8546:8546 diff --git a/test/e2e/datacommittee_test.go b/test/e2e/datacommittee_test.go index c33dd6179f..8b743e703c 100644 --- a/test/e2e/datacommittee_test.go +++ b/test/e2e/datacommittee_test.go @@ -78,7 +78,7 @@ func TestDataCommittee(t *testing.T) { ) require.NoError(t, err) - // Register committe with N / M signatures + // Register committee with N / M signatures membs := members{} addrsBytes := []byte{} urls := []string{} diff --git a/test/e2e/jsonrpc2_test.go b/test/e2e/jsonrpc2_test.go index b2a3a2598f..f8a0113814 100644 --- a/test/e2e/jsonrpc2_test.go +++ b/test/e2e/jsonrpc2_test.go @@ -456,22 +456,27 @@ func TestCallMissingParameters(t *testing.T) { expectedError: types.ErrorObject{Code: types.InvalidParamsErrorCode, Message: "missing value for required argument 0"}, }, { - name: "params has only first parameter", - params: []interface{}{map[string]interface{}{"value": "0x1"}}, - expectedError: types.ErrorObject{Code: types.InvalidParamsErrorCode, Message: "missing value for required argument 1"}, + name: "params has only first parameter", + params: []interface{}{map[string]interface{}{"value": "0x1", "from": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", "to": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92267"}}, }, } for _, network := range networks { - log.Infof("Network %s", network.Name) - for _, testCase := range testCases { + t.Logf("Network %s", network.Name) + for tc, testCase := range testCases { + t.Logf("testCase %d", tc) t.Run(network.Name+testCase.name, func(t *testing.T) { response, err := client.JSONRPCCall(network.URL, "eth_call", testCase.params...) require.NoError(t, err) - require.NotNil(t, response.Error) - require.Nil(t, response.Result) - require.Equal(t, testCase.expectedError.Code, response.Error.Code) - require.Equal(t, testCase.expectedError.Message, response.Error.Message) + if (testCase.expectedError != types.ErrorObject{}) { + require.NotNil(t, response.Error) + require.Nil(t, response.Result) + require.Equal(t, testCase.expectedError.Code, response.Error.Code) + require.Equal(t, testCase.expectedError.Message, response.Error.Message) + } else { + require.Nil(t, response.Error) + require.NotNil(t, response.Result) + } }) } } @@ -620,24 +625,39 @@ func TestEstimateGas(t *testing.T) { txToMsg, err := sc.Increment(auth) require.NoError(t, err) - // add funds to address 0x000...001 used in the test - nonce, err := ethereumClient.NonceAt(ctx, auth.From, nil) - require.NoError(t, err) - value := big.NewInt(1000) - require.NoError(t, err) - tx = ethTypes.NewTx(ðTypes.LegacyTx{ - Nonce: nonce, - To: state.Ptr(common.HexToAddress("0x1")), - Value: value, - Gas: 24000, - GasPrice: gasPrice, - }) - signedTx, err := auth.Signer(auth.From, tx) - require.NoError(t, err) - err = ethereumClient.SendTransaction(ctx, signedTx) - require.NoError(t, err) - err = operations.WaitTxToBeMined(ctx, ethereumClient, signedTx, operations.DefaultTimeoutTxToBeMined) - require.NoError(t, err) + // addresses the test needs to have balance + addressesToAddBalance := map[common.Address]*big.Int{ + // add funds to address 0x111...111 which is the default address + // when estimating TXs without specifying the sender + common.HexToAddress("0x1111111111111111111111111111111111111111"): big.NewInt(3000000000000000), + + // add funds to address 0x000...001 + common.HexToAddress("0x1"): big.NewInt(1000), + } + + for addr, value := range addressesToAddBalance { + nonce, err := ethereumClient.NonceAt(ctx, auth.From, nil) + require.NoError(t, err) + value := value + require.NoError(t, err) + tx = ethTypes.NewTx(ðTypes.LegacyTx{ + Nonce: nonce, + To: state.Ptr(addr), + Value: value, + Gas: 24000, + GasPrice: gasPrice, + }) + signedTx, err := auth.Signer(auth.From, tx) + require.NoError(t, err) + err = ethereumClient.SendTransaction(ctx, signedTx) + require.NoError(t, err) + err = operations.WaitTxToBeMined(ctx, ethereumClient, signedTx, operations.DefaultTimeoutTxToBeMined) + require.NoError(t, err) + + balance, err := ethereumClient.BalanceAt(ctx, addr, nil) + require.NoError(t, err) + log.Debugf("%v balance: %v", addr.String(), balance.String()) + } type testCase struct { name string @@ -670,19 +690,15 @@ func TestEstimateGas(t *testing.T) { name: "with gasPrice set and without from address", address: nil, setGasPrice: true, - expectedError: types.NewRPCError(-32000, "gas required exceeds allowance"), + expectedError: nil, + }, + { + name: "with gasPrice and value set and address with enough balance", + address: state.Ptr(auth.From), + value: state.Ptr(int64(1)), + setGasPrice: true, + expectedError: types.NewRPCError(-32000, "execution reverted"), }, - // TODO: This test is failing due to geth bug - // we can uncomment it when updating geth version - // on l1 image, it's returning error code -32000 when - // it should be returning error code 3 due to execution message - // { - // name: "with gasPrice and value set and address with enough balance", - // address: state.Ptr(auth.From), - // value: state.Ptr(int64(1)), - // setGasPrice: true, - // expectedError: types.NewRPCError(3, "execution reverted"), - // }, { name: "with gasPrice and value set and address without enough balance", address: state.Ptr(common.HexToAddress("0x1")), @@ -697,13 +713,21 @@ func TestEstimateGas(t *testing.T) { setGasPrice: true, expectedError: types.NewRPCError(-32000, "insufficient funds for transfer"), }, - { - name: "with gasPrice and value set and without from address", - address: nil, - value: state.Ptr(int64(-1)), - setGasPrice: true, - expectedError: types.NewRPCError(-32000, "insufficient funds for transfer"), - }, + // TODO = Review the test below in future versions of geth. + // + // Geth is returning -32000, "insufficient funds for transfer" + // zkEVM is returning 3, "execution reverted" + // + // Since the tx has value, the method increment is not payable + // and the default account has balance, the tx should revert + // + // { + // name: "with gasPrice and value set and without from address", + // address: nil, + // value: state.Ptr(int64(-1)), + // setGasPrice: true, + // expectedError: types.NewRPCError(-32000, "insufficient funds for transfer"), + // }, { name: "without gasPrice set and address with enough balance", address: state.Ptr(auth.From), @@ -746,7 +770,6 @@ func TestEstimateGas(t *testing.T) { if testCase.value != nil { v := *testCase.value if v == -1 { //set the value as acc balance + 1 to force overflow - msg.Value = common.Big0.Add(balance, common.Big1) } else { msg.Value = big.NewInt(0).SetInt64(v) @@ -757,7 +780,10 @@ func TestEstimateGas(t *testing.T) { msg.GasPrice = gasPrice } - _, err = ethereumClient.EstimateGas(ctx, msg) + gas, err := ethereumClient.EstimateGas(ctx, msg) + t.Log("testCase: ", testCase.name) + t.Log("err: ", err) + t.Log("gas: ", gas) if testCase.expectedError != nil { rpcErr := err.(rpc.Error) errMsg := fmt.Sprintf("[%v] expected: %v %v found: %v %v", network.Name, testCase.expectedError.ErrorCode(), testCase.expectedError.Error(), rpcErr.ErrorCode(), rpcErr.Error()) diff --git a/tools/datastreamer/main.go b/tools/datastreamer/main.go index 41f3611f1f..975e4c7ecd 100644 --- a/tools/datastreamer/main.go +++ b/tools/datastreamer/main.go @@ -558,14 +558,13 @@ func decodeEntry(cliCtx *cli.Context) error { os.Exit(1) } - client.FromEntry = cliCtx.Uint64("entry") - err = client.ExecCommand(datastreamer.CmdEntry) + entry, err := client.ExecCommandGetEntry(cliCtx.Uint64("entry")) if err != nil { log.Error(err) os.Exit(1) } - printEntry(client.Entry) + printEntry(entry) return nil } @@ -597,35 +596,28 @@ func decodeL2Block(cliCtx *cli.Context) error { Value: l2BlockNumber, } - client.FromBookmark = bookMark.Encode() - err = client.ExecCommand(datastreamer.CmdBookmark) + firstEntry, err := client.ExecCommandGetBookmark(bookMark.Encode()) if err != nil { log.Error(err) os.Exit(1) } - - firstEntry := client.Entry printEntry(firstEntry) - client.FromEntry = firstEntry.Number + 1 - err = client.ExecCommand(datastreamer.CmdEntry) + secondEntry, err := client.ExecCommandGetEntry(firstEntry.Number + 1) if err != nil { log.Error(err) os.Exit(1) } - - secondEntry := client.Entry printEntry(secondEntry) i := uint64(2) //nolint:gomnd for secondEntry.Type == state.EntryTypeL2Tx { - client.FromEntry = firstEntry.Number + i - err = client.ExecCommand(datastreamer.CmdEntry) + entry, err := client.ExecCommandGetEntry(firstEntry.Number + i) if err != nil { log.Error(err) os.Exit(1) } - secondEntry = client.Entry + secondEntry = entry printEntry(secondEntry) i++ }