Skip to content

Commit

Permalink
Update executor with forkID 4 support (#1916)
Browse files Browse the repository at this point in the history
Update executor and smart contracts for testing


---------

Co-authored-by: Alonso <ARR551@protonmail.com>
Co-authored-by: tclemos <thiago@iden3.com>
  • Loading branch information
3 people authored Apr 3, 2023
1 parent 39e5ce8 commit e585b7c
Show file tree
Hide file tree
Showing 21 changed files with 78 additions and 71 deletions.
4 changes: 2 additions & 2 deletions config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ EnableL2SuggestedGasPricePolling = true
[Synchronizer]
SyncInterval = "0s"
SyncChunkSize = 100
GenBlockNumber = 67
trustedSequencerURL = ""
GenBlockNumber = 74
TrustedSequencerURL = ""
[Sequencer]
WaitPeriodPoolIsEmpty = "1s"
Expand Down
24 changes: 12 additions & 12 deletions config/environments/local/local.genesis.config.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions config/environments/local/local.node.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ EnableL2SuggestedGasPricePolling = true
[Synchronizer]
SyncInterval = "1s"
SyncChunkSize = 100
GenBlockNumber = 79
trustedSequencerURL = ""
GenBlockNumber = 74
TrustedSequencerURL = ""

[Sequencer]
WaitPeriodPoolIsEmpty = "1s"
Expand Down
2 changes: 1 addition & 1 deletion config/environments/mainnet/public.node.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ EnableL2SuggestedGasPricePolling = false
SyncInterval = "2s"
SyncChunkSize = 100
GenBlockNumber = 16896721
trustedSequencerURL = ""
TrustedSequencerURL = ""

[MTClient]
URI = "zkevm-prover:50061"
Expand Down
20 changes: 13 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ services:
zkevm-sync:
condition: service_started
image: zkevm-node
deploy:
resources:
limits:
memory: 1G
reservations:
memory: 512M
ports:
- 8545:8545
- 9091:9091 # needed if metrics enabled
Expand All @@ -34,6 +40,12 @@ services:
zkevm-state-db:
condition: service_healthy
image: zkevm-node
deploy:
resources:
limits:
memory: 1G
reservations:
memory: 512M
environment:
- ZKEVM_NODE_ETHERMAN_URL=${ZKEVM_NODE_ETHERMAN_URL}
volumes:
Expand Down Expand Up @@ -79,12 +91,6 @@ services:
interval: 10s
timeout: 5s
retries: 5
deploy:
resources:
limits:
memory: 2G
reservations:
memory: 1G
ports:
- 5433:5432
volumes:
Expand All @@ -101,7 +107,7 @@ services:
zkevm-prover:
container_name: zkevm-prover
restart: unless-stopped
image: hermeznetwork/zkevm-prover:3476ef0
image: hermeznetwork/zkevm-prover:9e70a64
depends_on:
zkevm-state-db:
condition: service_healthy
Expand Down
2 changes: 1 addition & 1 deletion docs/production-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Note that sequencing and proving functionalities are not covered in this documen
## Requirements

- A machine to run the zkEVM node with the following requirements:
- Hardware: 32G RAM, 4 cores, 20G Disk (as the network is super young the current disk requirements are quite low, but they will increase overtime). Currently ARM-based CPUs are not supported
- Hardware: 32G RAM, 4 cores, 128G Disk with high IOPS (as the network is super young the current disk requirements are quite low, but they will increase overtime. Also note that this requirement is true if the DBs run on the same machine, but it's recommended to run Postgres on dedicated infra). Currently ARM-based CPUs are not supported
- Software: Ubuntu 22.04, Docker
- A L1 node: we recommend using geth, but what it's actually needed is access to a JSON RPC interface for the L1 network (Goerli for zkEVM testnet, Ethereum mainnet for zkEVM mainnet)

Expand Down
6 changes: 3 additions & 3 deletions docs/running_local.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,10 @@ To configure your Metamask to use your local environment, follow these steps:

| Address | Description |
|---|---|
| 0xa513E6E4b8f2a923D98304ec87F64353C4D5C853 | Proof of Efficiency |
| 0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9 | Bridge |
| 0x610178dA211FEF7D417bC0e6FeD39F05609AD788 | Proof of Efficiency |
| 0xff0EE8ea08cEf5cb4322777F5CC3E8A584B8A4A0 | Bridge |
| 0x5FbDB2315678afecb367f032d93F642f64180aa3 | Matic token |
| 0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0 | GlobalExitRootManager |
| 0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6 | GlobalExitRootManager |

## Deployer Account

Expand Down
2 changes: 1 addition & 1 deletion etherman/etherman.go
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ func (etherMan *Client) BuildTrustedVerifyBatchesTxData(lastVerifiedBatch, newVe

// GetSendSequenceFee get super/trusted sequencer fee
func (etherMan *Client) GetSendSequenceFee(numBatches uint64) (*big.Int, error) {
f, err := etherMan.PoE.GetCurrentBatchFee(&bind.CallOpts{Pending: false})
f, err := etherMan.PoE.BatchFee(&bind.CallOpts{Pending: false})
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions etherman/etherman_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func TestForcedBatchEvent(t *testing.T) {
initBlock, err := etherman.EthClient.BlockByNumber(ctx, nil)
require.NoError(t, err)

amount, err := etherman.PoE.GetCurrentBatchFee(&bind.CallOpts{Pending: false})
amount, err := etherman.PoE.GetForcedBatchFee(&bind.CallOpts{Pending: false})
require.NoError(t, err)
rawTxs := "f84901843b9aca00827b0c945fbdb2315678afecb367f032d93f642f64180aa380a46057361d00000000000000000000000000000000000000000000000000000000000000048203e9808073efe1fa2d3e27f26f32208550ea9b0274d49050b816cadab05a771f4275d0242fd5d92b3fb89575c070e6c930587c520ee65a3aa8cfe382fcad20421bf51d621c"
data, err := hex.DecodeString(rawTxs)
Expand Down Expand Up @@ -137,7 +137,7 @@ func TestSequencedBatchesEvent(t *testing.T) {
ger, err := etherman.GlobalExitRootManager.GetLastGlobalExitRoot(nil)
require.NoError(t, err)

amount, err := etherman.PoE.GetCurrentBatchFee(&bind.CallOpts{Pending: false})
amount, err := etherman.PoE.GetForcedBatchFee(&bind.CallOpts{Pending: false})
require.NoError(t, err)
rawTxs := "f84901843b9aca00827b0c945fbdb2315678afecb367f032d93f642f64180aa380a46057361d00000000000000000000000000000000000000000000000000000000000000048203e9808073efe1fa2d3e27f26f32208550ea9b0274d49050b816cadab05a771f4275d0242fd5d92b3fb89575c070e6c930587c520ee65a3aa8cfe382fcad20421bf51d621c"
data, err := hex.DecodeString(rawTxs)
Expand Down Expand Up @@ -246,7 +246,7 @@ func TestSequenceForceBatchesEvent(t *testing.T) {
initBlock, err := etherman.EthClient.BlockByNumber(ctx, nil)
require.NoError(t, err)

amount, err := etherman.PoE.GetCurrentBatchFee(&bind.CallOpts{Pending: false})
amount, err := etherman.PoE.GetForcedBatchFee(&bind.CallOpts{Pending: false})
require.NoError(t, err)
rawTxs := "f84901843b9aca00827b0c945fbdb2315678afecb367f032d93f642f64180aa380a46057361d00000000000000000000000000000000000000000000000000000000000000048203e9808073efe1fa2d3e27f26f32208550ea9b0274d49050b816cadab05a771f4275d0242fd5d92b3fb89575c070e6c930587c520ee65a3aa8cfe382fcad20421bf51d621c"
data, err := hex.DecodeString(rawTxs)
Expand Down
2 changes: 1 addition & 1 deletion etherman/smartcontracts/abi/polygonzkevm.abi
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@
},
{
"inputs": [],
"name": "getCurrentBatchFee",
"name": "getForcedBatchFee",
"outputs": [
{
"internalType": "uint256",
Expand Down
2 changes: 1 addition & 1 deletion etherman/smartcontracts/bin/polygonzkevm.bin

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions etherman/smartcontracts/polygonzkevm/polygonzkevm.go

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions test/config/debug.node.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ EnableL2SuggestedGasPricePolling = true
[Synchronizer]
SyncInterval = "5s"
SyncChunkSize = 100
GenBlockNumber = 79
trustedSequencerURL = ""
GenBlockNumber = 74
TrustedSequencerURL = ""

[Sequencer]
WaitPeriodPoolIsEmpty = "1s"
Expand Down
24 changes: 12 additions & 12 deletions test/config/test.genesis.config.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions test/config/test.node.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ EnableL2SuggestedGasPricePolling = true
[Synchronizer]
SyncInterval = "1s"
SyncChunkSize = 100
GenBlockNumber = 79
trustedSequencerURL = ""
GenBlockNumber = 74
TrustedSequencerURL = ""

[Sequencer]
WaitPeriodPoolIsEmpty = "1s"
Expand Down
1 change: 1 addition & 0 deletions test/config/test.prover.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"dbFlushInParallel": false,
"dbMTCacheSize": 1024,
"dbProgramCacheSize": 1024,
"dbNumberOfPoolConnections": 30,
"cleanerPollingPeriod": 600,
"requestsPersistence": 3600,
"maxExecutorThreads": 20,
Expand Down
6 changes: 3 additions & 3 deletions test/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ services:

zkevm-mock-l1-network:
container_name: zkevm-mock-l1-network
image: hermeznetwork/geth-zkevm-contracts:v1.0.0-fork.3
image: hermeznetwork/geth-zkevm-contracts:v1.1.0-fork.4
ports:
- 8545:8545
- 8546:8546
Expand Down Expand Up @@ -315,7 +315,7 @@ services:

zkevm-prover:
container_name: zkevm-prover
image: hermeznetwork/zkevm-prover:5ad1821
image: hermeznetwork/zkevm-prover:9e70a64
ports:
# - 50051:50051 # Prover
- 50052:50052 # Mock prover
Expand Down Expand Up @@ -401,7 +401,7 @@ services:

zkevm-permissionless-prover:
container_name: zkevm-permissionless-prover
image: hermeznetwork/zkevm-prover:221bafe
image: hermeznetwork/zkevm-prover:9e70a64
ports:
# - 50058:50058 # Prover
- 50059:50052 # Mock prover
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/forcedbatches_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func sendForcedBatch(t *testing.T, opsman *operations.Manager) (*state.Batch, er
log.Debug("currentBlock.Time(): ", currentBlock.Time())

// Get tip
tip, err := zkEvm.GetCurrentBatchFee(&bind.CallOpts{Pending: false})
tip, err := zkEvm.BatchFee(&bind.CallOpts{Pending: false})
require.NoError(t, err)

managerAddress, err := zkEvm.GlobalExitRootManager(&bind.CallOpts{Pending: false})
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func Test_FreeClaimRejectedWhenReverted(t *testing.T) {
client := operations.MustGetClient(operations.DefaultL2NetworkURL)
auth := operations.MustGetAuth(operations.DefaultSequencerPrivateKey, operations.DefaultL2ChainID)

bridgeAddr := common.HexToAddress("0xDD96FbBe673848c0b2f2B4B8f6e5b9a0665166ca")
bridgeAddr := common.HexToAddress("0xff0EE8ea08cEf5cb4322777F5CC3E8A584B8A4A0")
bridgeSC, err := bridge.NewPolygonzkevmbridge(bridgeAddr, client)
require.NoError(t, err)

Expand Down
2 changes: 1 addition & 1 deletion test/scripts/sendForcedBatch/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func sendForcedBatches(cliCtx *cli.Context) error {
log.Debug("currentBlock.Time(): ", currentBlock.Time())

// Get tip
tip, err := poe.GetCurrentBatchFee(&bind.CallOpts{Pending: false})
tip, err := poe.BatchFee(&bind.CallOpts{Pending: false})
if err != nil {
log.Error("error getting tip. Error: ", err)
return err
Expand Down
2 changes: 1 addition & 1 deletion test/scripts/sequenceForcedBatch/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

Command:
```
go run ./scripts/sequenceForcedBatch/main.go send --url http://localhost:8545 --smc 0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6 --ger 0xad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5 -tx 0x -t 1674730229
go run ./scripts/sequenceForcedBatch/main.go send --url http://localhost:8545 --smc 0x610178dA211FEF7D417bC0e6FeD39F05609AD788 --ger 0xad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5 -tx 0x -t 1674730229
```

0 comments on commit e585b7c

Please sign in to comment.