diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 3dd480f892..3f36c7462a 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -40,7 +40,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/jsonschema.yml b/.github/workflows/jsonschema.yml index ddc25c65fe..003263e725 100644 --- a/.github/workflows/jsonschema.yml +++ b/.github/workflows/jsonschema.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 #v3 # /~https://github.com/actions/checkout#Checkout-pull-request-HEAD-commit-instead-of-merge-commit # Checkout pull request HEAD commit instead of merge commit with: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3b3807666d..b722b6b05a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,7 +17,7 @@ jobs: with: go-version: 1.21.x - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 - name: Lint run: | make install-linter diff --git a/.github/workflows/push-docker-develop.yml b/.github/workflows/push-docker-develop.yml deleted file mode 100644 index 1441d0a5a1..0000000000 --- a/.github/workflows/push-docker-develop.yml +++ /dev/null @@ -1,32 +0,0 @@ -on: - push: - branches: - - develop - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push - id: docker_build - uses: docker/build-push-action@v2 - with: - platforms: linux/amd64,linux/arm64 - push: true - tags: | - hermeznetwork/cdk-validium-node:develop diff --git a/.github/workflows/push-docker-tagged.yml b/.github/workflows/push-docker-tagged.yml deleted file mode 100644 index 4178d3a15d..0000000000 --- a/.github/workflows/push-docker-tagged.yml +++ /dev/null @@ -1,33 +0,0 @@ -on: - push: - tags: - - 'v[0-9]+.[0-9]+.[0-9]+*' # this action will only run on tags that follow semver - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push - id: docker_build - uses: docker/build-push-action@v2 - with: - context: . - platforms: linux/amd64,linux/arm64 - push: true - tags: | - hermeznetwork/cdk-validium-node:${{ github.ref_name }} diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 6ea34936d8..0b580d20ab 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -10,7 +10,7 @@ jobs: sonarqube: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 #v3 with: # Disabling shallow clone is recommended for improving relevancy of reporting. fetch-depth: 0 diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml index b27373e208..211bc61a98 100644 --- a/.github/workflows/test-e2e.yml +++ b/.github/workflows/test-e2e.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 - name: Install Go uses: actions/setup-go@v3 diff --git a/.github/workflows/test-from-prover.yml b/.github/workflows/test-from-prover.yml deleted file mode 100644 index 90ccbf13fa..0000000000 --- a/.github/workflows/test-from-prover.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Test from zkevm-prover call -on: - workflow_call: - inputs: - prover_image: - required: true - type: string - secrets: - DOCKERHUB_USERNAME: - required: true - DOCKERHUB_TOKEN: - required: true - -jobs: - test-from-prover: - runs-on: [self-hosted, linux, X64, hc] - - strategy: - matrix: - go-version: [ 1.21.x ] - goarch: [ "amd64" ] - e2e-group: [ 2 ] - - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - repository: 0xPolygonHermez/zkevm-node - - - name: Install Go - uses: actions/setup-go@v3 - with: - go-version: ${{ matrix.go-version }} - env: - GOARCH: ${{ matrix.goarch }} - - - name: Login to DockerHub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build Docker - run: make build-docker - - - name: Compile SCs - run: make compile-scs - working-directory: test - - - name: Test - run: make test-full-non-e2e - working-directory: test diff --git a/.github/workflows/test-full-non-e2e.yml b/.github/workflows/test-full-non-e2e.yml index 1be90483bb..237b03c749 100644 --- a/.github/workflows/test-full-non-e2e.yml +++ b/.github/workflows/test-full-non-e2e.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 - name: Install Go uses: actions/setup-go@v3 diff --git a/.github/workflows/updatedeps.yml b/.github/workflows/updatedeps.yml index e4a0b69884..1f7d4eb18e 100644 --- a/.github/workflows/updatedeps.yml +++ b/.github/workflows/updatedeps.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 - name: Install Go uses: actions/setup-go@v3 diff --git a/.golangci.yml b/.golangci.yml index 7014abcc33..6a4761124e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -30,3 +30,6 @@ issues: include: - EXC0012 # EXC0012 revive: Annoying issue about not having a comment. The rare codebase has such comments - EXC0014 # EXC0014 revive: Annoying issue about not having a comment. The rare codebase has such comments + exclude-rules: + - path: cmd/policy.go + text: "unused" \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3393d643e4..c59610aebf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -33,7 +33,7 @@ Note that non of this is a hard rule, but suggestions / guidelines. Although eve - Offer clarification, explain the decisions you made to reach a solution in question. - Try to respond to every comment. - If there is growing confusion or debate, ask yourself if the written word is still the best form of communication. Talk (virtually) face-to-face, then mutually consider posting a follow-up to summarize any offline discussion (useful for others who be following along, now or later). -- If concensus is still not reached, involve someone else in the discussion. As a last resource the lead of the project could take the decision +- If consensus is still not reached, involve someone else in the discussion. As a last resource the lead of the project could take the decision ## Links and credits diff --git a/Makefile b/Makefile index 729ef770c9..83d4fed5fe 100644 --- a/Makefile +++ b/Makefile @@ -118,7 +118,7 @@ venv: $(VENV_PYTHON) .PHONY: install-config-doc-gen $(GENERATE_SCHEMA_DOC): $(VENV_PYTHON) $(PYTHON) -m pip install --upgrade pip - $(PYTHON) -m pip install json-schema-for-humans + $(PYTHON) -m pip install json-schema-for-humans==0.47 .PHONY: config-doc-gen config-doc-gen: config-doc-node config-doc-custom_network ## Generate config file's json-schema for node and custom_network and documentation diff --git a/aggregator/aggregator.go b/aggregator/aggregator.go index 9eb3442530..b30cd005ff 100644 --- a/aggregator/aggregator.go +++ b/aggregator/aggregator.go @@ -980,8 +980,7 @@ func (a *Aggregator) buildInputProver(ctx context.Context, batchToVerify *state. isForcedBatch := false batchRawData := &state.BatchRawV2{} - - if batchToVerify.BatchNumber == 1 || batchToVerify.ForcedBatchNum != nil { + if batchToVerify.BatchNumber == 1 || batchToVerify.ForcedBatchNum != nil || batchToVerify.BatchNumber == a.cfg.UpgradeEtrogBatchNumber { isForcedBatch = true } else { batchRawData, err = state.DecodeBatchV2(batchToVerify.BatchL2Data) @@ -992,7 +991,12 @@ func (a *Aggregator) buildInputProver(ctx context.Context, batchToVerify *state. } l1InfoTreeData := map[uint32]*prover.L1Data{} - l1InfoRoot := common.Hash{} + vb, err := a.State.GetVirtualBatch(ctx, batchToVerify.BatchNumber, nil) + if err != nil { + log.Errorf("Failed getting virtualBatch %d, err: %v", batchToVerify.BatchNumber, err) + return nil, err + } + l1InfoRoot := vb.L1InfoRoot forcedBlockhashL1 := common.Hash{} if !isForcedBatch { @@ -1004,51 +1008,49 @@ func (a *Aggregator) buildInputProver(ctx context.Context, batchToVerify *state. for _, l2blockRaw := range batchRawData.Blocks { _, contained := l1InfoTreeData[l2blockRaw.IndexL1InfoTree] if !contained && l2blockRaw.IndexL1InfoTree != 0 { - if l2blockRaw.IndexL1InfoTree != 0 { - l1InfoTreeExitRootStorageEntry, err := a.State.GetL1InfoRootLeafByIndex(ctx, l2blockRaw.IndexL1InfoTree, nil) - if err != nil { - return nil, err - } - - leaves, err := a.State.GetLeafsByL1InfoRoot(ctx, l1InfoTreeExitRootStorageEntry.L1InfoTreeRoot, nil) - if err != nil { - return nil, err - } - - aLeaves := make([][32]byte, len(leaves)) - for i, leaf := range leaves { - aLeaves[i] = l1infotree.HashLeafData(leaf.GlobalExitRoot.GlobalExitRoot, leaf.PreviousBlockHash, uint64(leaf.Timestamp.Unix())) - } - - // Calculate smt proof - smtProof, _, err := tree.ComputeMerkleProof(l2blockRaw.IndexL1InfoTree, aLeaves) - if err != nil { - return nil, err - } - - protoProof := make([][]byte, len(smtProof)) - for i, proof := range smtProof { - protoProof[i] = proof[:] - } - - l1InfoTreeData[l2blockRaw.IndexL1InfoTree] = &prover.L1Data{ - GlobalExitRoot: l1InfoTreeExitRootStorageEntry.L1InfoTreeLeaf.GlobalExitRoot.GlobalExitRoot.Bytes(), - BlockhashL1: l1InfoTreeExitRootStorageEntry.L1InfoTreeLeaf.PreviousBlockHash.Bytes(), - MinTimestamp: uint32(l1InfoTreeExitRootStorageEntry.L1InfoTreeLeaf.GlobalExitRoot.Timestamp.Unix()), - SmtProof: protoProof, - } + l1InfoTreeExitRootStorageEntry, err := a.State.GetL1InfoRootLeafByIndex(ctx, l2blockRaw.IndexL1InfoTree, nil) + if err != nil { + return nil, err + } + + leaves, err := a.State.GetLeafsByL1InfoRoot(ctx, l1InfoTreeExitRootStorageEntry.L1InfoTreeRoot, nil) + if err != nil { + return nil, err + } + + aLeaves := make([][32]byte, len(leaves)) + for i, leaf := range leaves { + aLeaves[i] = l1infotree.HashLeafData(leaf.GlobalExitRoot.GlobalExitRoot, leaf.PreviousBlockHash, uint64(leaf.Timestamp.Unix())) + } + + // Calculate smt proof + smtProof, _, err := tree.ComputeMerkleProof(l2blockRaw.IndexL1InfoTree, aLeaves) + if err != nil { + return nil, err + } + + protoProof := make([][]byte, len(smtProof)) + for i, proof := range smtProof { + tmpProof := proof + protoProof[i] = tmpProof[:] + } + + l1InfoTreeData[l2blockRaw.IndexL1InfoTree] = &prover.L1Data{ + GlobalExitRoot: l1InfoTreeExitRootStorageEntry.L1InfoTreeLeaf.GlobalExitRoot.GlobalExitRoot.Bytes(), + BlockhashL1: l1InfoTreeExitRootStorageEntry.L1InfoTreeLeaf.PreviousBlockHash.Bytes(), + MinTimestamp: uint32(l1InfoTreeExitRootStorageEntry.L1InfoTreeLeaf.GlobalExitRoot.Timestamp.Unix()), + SmtProof: protoProof, } } } } else { // Initial batch must be handled differently - if batchToVerify.BatchNumber == 1 { + if batchToVerify.BatchNumber == 1 || batchToVerify.BatchNumber == a.cfg.UpgradeEtrogBatchNumber { forcedBlockhashL1, err = a.State.GetVirtualBatchParentHash(ctx, batchToVerify.BatchNumber, nil) if err != nil { return nil, err } } else { - l1InfoRoot = batchToVerify.GlobalExitRoot forcedBlockhashL1, err = a.State.GetForcedBatchParentHash(ctx, *batchToVerify.ForcedBatchNum, nil) if err != nil { return nil, err @@ -1075,9 +1077,26 @@ func (a *Aggregator) buildInputProver(ctx context.Context, batchToVerify *state. ContractsBytecode: map[string]string{}, } + printInputProver(inputProver) + return inputProver, nil } +func printInputProver(inputProver *prover.InputProver) { + log.Debugf("OldStateRoot: %v", common.BytesToHash(inputProver.PublicInputs.OldStateRoot)) + log.Debugf("OldAccInputHash: %v", common.BytesToHash(inputProver.PublicInputs.OldAccInputHash)) + log.Debugf("OldBatchNum: %v", inputProver.PublicInputs.OldBatchNum) + log.Debugf("ChainId: %v", inputProver.PublicInputs.ChainId) + log.Debugf("ForkId: %v", inputProver.PublicInputs.ForkId) + log.Debugf("BatchL2Data: %v", common.Bytes2Hex(inputProver.PublicInputs.BatchL2Data)) + log.Debugf("L1InfoRoot: %v", common.BytesToHash(inputProver.PublicInputs.L1InfoRoot)) + log.Debugf("TimestampLimit: %v", inputProver.PublicInputs.TimestampLimit) + log.Debugf("SequencerAddr: %v", inputProver.PublicInputs.SequencerAddr) + log.Debugf("AggregatorAddr: %v", inputProver.PublicInputs.AggregatorAddr) + log.Debugf("L1InfoTreeData: %+v", inputProver.PublicInputs.L1InfoTreeData) + log.Debugf("ForcedBlockhashL1: %v", common.Bytes2Hex(inputProver.PublicInputs.ForcedBlockhashL1)) +} + // healthChecker will provide an implementation of the HealthCheck interface. type healthChecker struct{} diff --git a/aggregator/aggregator_test.go b/aggregator/aggregator_test.go index 700b95bd80..1dc49448ce 100644 --- a/aggregator/aggregator_test.go +++ b/aggregator/aggregator_test.go @@ -787,6 +787,18 @@ func TestTryGenerateBatchProof(t *testing.T) { }, ).Return(nil).Once() m.stateMock.On("GetBatchByNumber", mock.Anything, lastVerifiedBatchNum, nil).Return(&latestBatch, nil).Twice() + t := time.Now() + l1InfoRoot := common.HexToHash("0x27ae5ba08d7291c96c8cbddcc148bf48a6d68c7974b94356f53754ef6171d757") + vb := state.VirtualBatch{ + BatchNumber: lastVerifiedBatchNum + 1, + TxHash: common.Hash{}, + Coinbase: common.Address{}, + SequencerAddr: common.Address{}, + BlockNumber: 0, + L1InfoRoot: &l1InfoRoot, + TimestampBatchEtrog: &t, + } + m.stateMock.On("GetVirtualBatch", mock.Anything, lastVerifiedBatchNum+1, nil).Return(&vb, nil).Twice() expectedInputProver, err := a.buildInputProver(context.Background(), &batchToProve) require.NoError(err) m.proverMock.On("BatchProof", expectedInputProver).Return(nil, errBanana).Once() @@ -816,6 +828,18 @@ func TestTryGenerateBatchProof(t *testing.T) { }, ).Return(nil).Once() m.stateMock.On("GetBatchByNumber", mock.Anything, lastVerifiedBatchNum, nil).Return(&latestBatch, nil).Twice() + t := time.Now() + l1InfoRoot := common.HexToHash("0x27ae5ba08d7291c96c8cbddcc148bf48a6d68c7974b94356f53754ef6171d757") + vb := state.VirtualBatch{ + BatchNumber: lastVerifiedBatchNum + 1, + TxHash: common.Hash{}, + Coinbase: common.Address{}, + SequencerAddr: common.Address{}, + BlockNumber: 0, + L1InfoRoot: &l1InfoRoot, + TimestampBatchEtrog: &t, + } + m.stateMock.On("GetVirtualBatch", mock.Anything, lastVerifiedBatchNum+1, nil).Return(&vb, nil).Twice() expectedInputProver, err := a.buildInputProver(context.Background(), &batchToProve) require.NoError(err) m.proverMock.On("BatchProof", expectedInputProver).Return(&proofID, nil).Once() @@ -846,6 +870,18 @@ func TestTryGenerateBatchProof(t *testing.T) { }, ).Return(nil).Once() m.stateMock.On("GetBatchByNumber", mock.Anything, lastVerifiedBatchNum, nil).Return(&latestBatch, nil).Twice() + t := time.Now() + l1InfoRoot := common.HexToHash("0x27ae5ba08d7291c96c8cbddcc148bf48a6d68c7974b94356f53754ef6171d757") + vb := state.VirtualBatch{ + BatchNumber: lastVerifiedBatchNum + 1, + TxHash: common.Hash{}, + Coinbase: common.Address{}, + SequencerAddr: common.Address{}, + BlockNumber: 0, + L1InfoRoot: &l1InfoRoot, + TimestampBatchEtrog: &t, + } + m.stateMock.On("GetVirtualBatch", mock.Anything, lastVerifiedBatchNum+1, nil).Return(&vb, nil).Twice() expectedInputProver, err := a.buildInputProver(context.Background(), &batchToProve) require.NoError(err) m.proverMock.On("BatchProof", expectedInputProver).Return(&proofID, nil).Once() @@ -876,6 +912,18 @@ func TestTryGenerateBatchProof(t *testing.T) { }, ).Return(nil).Once() m.stateMock.On("GetBatchByNumber", mock.Anything, lastVerifiedBatchNum, nil).Return(&latestBatch, nil).Twice() + t := time.Now() + l1InfoRoot := common.HexToHash("0x27ae5ba08d7291c96c8cbddcc148bf48a6d68c7974b94356f53754ef6171d757") + vb := state.VirtualBatch{ + BatchNumber: lastVerifiedBatchNum + 1, + TxHash: common.Hash{}, + Coinbase: common.Address{}, + SequencerAddr: common.Address{}, + BlockNumber: 0, + L1InfoRoot: &l1InfoRoot, + TimestampBatchEtrog: &t, + } + m.stateMock.On("GetVirtualBatch", mock.Anything, lastVerifiedBatchNum+1, nil).Return(&vb, nil).Twice() expectedInputProver, err := a.buildInputProver(context.Background(), &batchToProve) require.NoError(err) m.proverMock.On("BatchProof", expectedInputProver).Return(&proofID, nil).Once() @@ -920,6 +968,18 @@ func TestTryGenerateBatchProof(t *testing.T) { }, ).Return(nil).Once() m.stateMock.On("GetBatchByNumber", mock.Anything, lastVerifiedBatchNum, nil).Return(&latestBatch, nil).Twice() + t := time.Now() + l1InfoRoot := common.HexToHash("0x27ae5ba08d7291c96c8cbddcc148bf48a6d68c7974b94356f53754ef6171d757") + vb := state.VirtualBatch{ + BatchNumber: lastVerifiedBatchNum + 1, + TxHash: common.Hash{}, + Coinbase: common.Address{}, + SequencerAddr: common.Address{}, + BlockNumber: 0, + L1InfoRoot: &l1InfoRoot, + TimestampBatchEtrog: &t, + } + m.stateMock.On("GetVirtualBatch", mock.Anything, lastVerifiedBatchNum+1, nil).Return(&vb, nil).Twice() expectedInputProver, err := a.buildInputProver(context.Background(), &batchToProve) require.NoError(err) m.proverMock.On("BatchProof", expectedInputProver).Return(&proofID, nil).Once() diff --git a/aggregator/config.go b/aggregator/config.go index fd966f2223..9099df1931 100644 --- a/aggregator/config.go +++ b/aggregator/config.go @@ -85,4 +85,7 @@ type Config struct { // gas offset: 100 // final gas: 1100 GasOffset uint64 `mapstructure:"GasOffset"` + + // UpgradeEtrogBatchNumber is the number of the first batch after upgrading to etrog + UpgradeEtrogBatchNumber uint64 `mapstructure:"UpgradeEtrogBatchNumber"` } diff --git a/aggregator/interfaces.go b/aggregator/interfaces.go index 314a5d054e..3bc9c2fe8a 100644 --- a/aggregator/interfaces.go +++ b/aggregator/interfaces.go @@ -66,4 +66,5 @@ type stateInterface interface { GetLeafsByL1InfoRoot(ctx context.Context, l1InfoRoot common.Hash, dbTx pgx.Tx) ([]state.L1InfoTreeExitRootStorageEntry, error) GetVirtualBatchParentHash(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (common.Hash, error) GetForcedBatchParentHash(ctx context.Context, forcedBatchNumber uint64, dbTx pgx.Tx) (common.Hash, error) + GetVirtualBatch(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.VirtualBatch, error) } diff --git a/aggregator/mocks/mock_state.go b/aggregator/mocks/mock_state.go index c63c779927..24b2ffd61e 100644 --- a/aggregator/mocks/mock_state.go +++ b/aggregator/mocks/mock_state.go @@ -394,6 +394,36 @@ func (_m *StateMock) GetProofsToAggregate(ctx context.Context, dbTx pgx.Tx) (*st return r0, r1, r2 } +// GetVirtualBatch provides a mock function with given fields: ctx, batchNumber, dbTx +func (_m *StateMock) GetVirtualBatch(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.VirtualBatch, error) { + ret := _m.Called(ctx, batchNumber, dbTx) + + if len(ret) == 0 { + panic("no return value specified for GetVirtualBatch") + } + + var r0 *state.VirtualBatch + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, uint64, pgx.Tx) (*state.VirtualBatch, error)); ok { + return rf(ctx, batchNumber, dbTx) + } + if rf, ok := ret.Get(0).(func(context.Context, uint64, pgx.Tx) *state.VirtualBatch); ok { + r0 = rf(ctx, batchNumber, dbTx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*state.VirtualBatch) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, uint64, pgx.Tx) error); ok { + r1 = rf(ctx, batchNumber, dbTx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // GetVirtualBatchParentHash provides a mock function with given fields: ctx, batchNumber, dbTx func (_m *StateMock) GetVirtualBatchParentHash(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (common.Hash, error) { ret := _m.Called(ctx, batchNumber, dbTx) diff --git a/cmd/run.go b/cmd/run.go index 6a11fd7a69..97bcfb17bf 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -41,6 +41,7 @@ import ( "github.com/0xPolygonHermez/zkevm-node/state/pgstatestorage" "github.com/0xPolygonHermez/zkevm-node/state/runtime/executor" "github.com/0xPolygonHermez/zkevm-node/synchronizer" + "github.com/0xPolygonHermez/zkevm-node/synchronizer/common/syncinterfaces" "github.com/jackc/pgx/v4/pgxpool" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/urfave/cli/v2" @@ -69,6 +70,7 @@ func start(cliCtx *cli.Context) error { if !cliCtx.Bool(config.FlagMigrations) { for _, comp := range components { if comp == SYNCHRONIZER { + log.Infof("Running DB migrations host: %s:%s db:%s user:%s", c.State.DB.Host, c.State.DB.Port, c.State.DB.Name, c.State.DB.User) runStateMigrations(c.State.DB) } } @@ -135,6 +137,7 @@ func start(cliCtx *cli.Context) error { currentForkID := forkIDIntervals[len(forkIDIntervals)-1].ForkId log.Infof("Fork ID read from POE SC = %v", forkIDIntervals[len(forkIDIntervals)-1].ForkId) c.Aggregator.ChainID = l2ChainID + c.Sequencer.StreamServer.ChainID = l2ChainID log.Infof("Chain ID read from POE SC = %v", l2ChainID) // If the aggregator is restarted before the end of the sync process, this currentForkID could be wrong c.Aggregator.ForkId = currentForkID @@ -380,7 +383,7 @@ func runSynchronizer(cfg config.Config, etherman *etherman.Client, ethTxManagerS } zkEVMClient := client.NewClient(trustedSequencerURL) - etherManForL1 := []synchronizer.EthermanInterface{} + etherManForL1 := []syncinterfaces.EthermanFullInterface{} // If synchronizer are using sequential mode, we only need one etherman client if cfg.Synchronizer.L1SynchronizationMode == synchronizer.ParallelMode { for i := 0; i < int(cfg.Synchronizer.L1ParallelSynchronization.MaxClients+1); i++ { diff --git a/config/config_test.go b/config/config_test.go index dc442ba930..9f75bd503c 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -124,6 +124,10 @@ func Test_Defaults(t *testing.T) { path: "Sequencer.StreamServer.Filename", expectedValue: "", }, + { + path: "Sequencer.StreamServer.Version", + expectedValue: uint8(0), + }, { path: "Sequencer.StreamServer.Enabled", expectedValue: false, @@ -136,6 +140,10 @@ func Test_Defaults(t *testing.T) { path: "SequenceSender.LastBatchVirtualizationTimeMaxWaitPeriod", expectedValue: types.NewDuration(5 * time.Second), }, + { + path: "SequenceSender.L1BlockTimestampMargin", + expectedValue: types.NewDuration(30 * time.Second), + }, { path: "SequenceSender.MaxTxSizeForL1", expectedValue: uint64(131072), @@ -297,6 +305,14 @@ func Test_Defaults(t *testing.T) { path: "Pool.EffectiveGasPrice.FinalDeviationPct", expectedValue: uint64(10), }, + { + path: "Pool.EffectiveGasPrice.EthTransferGasPrice", + expectedValue: uint64(0), + }, + { + path: "Pool.EffectiveGasPrice.EthTransferL1GasPriceFactor", + expectedValue: float64(0), + }, { path: "Pool.DB.User", expectedValue: "pool_user", @@ -461,6 +477,10 @@ func Test_Defaults(t *testing.T) { path: "Aggregator.GasOffset", expectedValue: uint64(0), }, + { + path: "Aggregator.UpgradeEtrogBatchNumber", + expectedValue: uint64(0), + }, { path: "State.Batch.Constraints.MaxTxsPerBatch", expectedValue: uint64(300), diff --git a/config/default.go b/config/default.go index 4eaf0d98ad..87f2fa59eb 100644 --- a/config/default.go +++ b/config/default.go @@ -52,6 +52,8 @@ GlobalQueue = 1024 NetProfit = 1 BreakEvenFactor = 1.1 FinalDeviationPct = 10 + EthTransferGasPrice = 0 + EthTransferL1GasPriceFactor = 0 L2GasPriceSuggesterFactor = 0.5 [Pool.DB] User = "pool_user" @@ -134,14 +136,17 @@ StateConsistencyCheckInterval = "5s" ResourceExhaustedMarginPct = 10 HaltOnBatchNumber = 0 SequentialBatchSanityCheck = false + SequentialProcessL2Block = true [Sequencer.StreamServer] Port = 0 Filename = "" + Version = 0 Enabled = false [SequenceSender] WaitPeriodSendSequence = "5s" LastBatchVirtualizationTimeMaxWaitPeriod = "5s" +L1BlockTimestampMargin = "30s" MaxTxSizeForL1 = 131072 L2Coinbase = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266" PrivateKey = {Path = "/pk/sequencer.keystore", Password = "testonly"} @@ -159,6 +164,7 @@ ProofStatePollingInterval = "5s" CleanupLockedProofsInterval = "2m" GeneratingProofCleanupThreshold = "10m" GasOffset = 0 +UpgradeEtrogBatchNumber = 0 [L2GasPriceSuggester] Type = "follower" diff --git a/config/environments/local/local.node.config.toml b/config/environments/local/local.node.config.toml index e6a5f83367..721df47b63 100644 --- a/config/environments/local/local.node.config.toml +++ b/config/environments/local/local.node.config.toml @@ -47,6 +47,8 @@ GlobalQueue = 1024 NetProfit = 1 BreakEvenFactor = 1.1 FinalDeviationPct = 10 + EthTransferGasPrice = 0 + EthTransferL1GasPriceFactor = 0 L2GasPriceSuggesterFactor = 0.5 [Pool.DB] User = "pool_user" @@ -100,6 +102,7 @@ StateConsistencyCheckInterval = "5s" ResourceExhaustedMarginPct = 10 HaltOnBatchNumber = 0 SequentialBatchSanityCheck = false + SequentialProcessL2Block = true [Sequencer.StreamServer] Port = 0 Filename = "" @@ -108,6 +111,7 @@ StateConsistencyCheckInterval = "5s" [SequenceSender] WaitPeriodSendSequence = "5s" LastBatchVirtualizationTimeMaxWaitPeriod = "5s" +L1BlockTimestampMargin = "30s" MaxTxSizeForL1 = 131072 L2Coinbase = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266" PrivateKey = {Path = "/pk/sequencer.keystore", Password = "testonly"} @@ -123,6 +127,7 @@ ProofStatePollingInterval = "5s" SenderAddress = "0x70997970c51812dc3a010c7d01b50e0d17dc79c8" CleanupLockedProofsInterval = "2m" GeneratingProofCleanupThreshold = "10m" +UpgradeEtrogBatchNumber = 0 [EthTxManager] ForcedGas = 0 diff --git a/dataavailability/dataavailability.go b/dataavailability/dataavailability.go index 27a59ca381..1ca09a39ef 100644 --- a/dataavailability/dataavailability.go +++ b/dataavailability/dataavailability.go @@ -8,7 +8,6 @@ import ( "github.com/0xPolygonHermez/zkevm-node/etherman/types" "github.com/0xPolygonHermez/zkevm-node/log" "github.com/0xPolygonHermez/zkevm-node/state" - "github.com/0xPolygonHermez/zkevm-node/synchronizer/common/syncinterfaces" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" ) @@ -20,7 +19,7 @@ type DataAvailability struct { isTrustedSequencer bool state stateInterface - zkEVMClient syncinterfaces.ZKEVMClientInterface + zkEVMClient ZKEVMClientTrustedBatchesGetter backend DABackender ctx context.Context @@ -31,7 +30,7 @@ func New( isTrustedSequencer bool, backend DABackender, state stateInterface, - zkEVMClient syncinterfaces.ZKEVMClientInterface, + zkEVMClient ZKEVMClientTrustedBatchesGetter, ) (*DataAvailability, error) { da := &DataAvailability{ isTrustedSequencer: isTrustedSequencer, @@ -81,7 +80,7 @@ func (d *DataAvailability) GetBatchL2Data(batchNum uint64, expectedTransactionsH log.Info("trying to get data from trusted sequencer") data, err := d.getDataFromTrustedSequencer(batchNum, expectedTransactionsHash) if err != nil { - log.Error("failed to get data from trusted sequencer: %w", err) + log.Warn("failed to get data from trusted sequencer: %w", err) } else { return data, nil } diff --git a/dataavailability/interfaces.go b/dataavailability/interfaces.go index be5be102dc..441829fafb 100644 --- a/dataavailability/interfaces.go +++ b/dataavailability/interfaces.go @@ -2,7 +2,9 @@ package dataavailability import ( "context" + "math/big" + "github.com/0xPolygonHermez/zkevm-node/jsonrpc/types" "github.com/0xPolygonHermez/zkevm-node/state" "github.com/ethereum/go-ethereum/common" "github.com/jackc/pgx/v4" @@ -25,9 +27,17 @@ type SequenceSender interface { // as expected by the contract PostSequence(ctx context.Context, batchesData [][]byte) ([]byte, error) } + +// DABackender is the interface needed to implement in order to +// integrate a DA service type DABackender interface { BatchDataProvider SequenceSender // Init initializes the DABackend Init() error } + +// ZKEVMClientTrustedBatchesGetter contains the methods required to interact with zkEVM-RPC +type ZKEVMClientTrustedBatchesGetter interface { + BatchByNumber(ctx context.Context, number *big.Int) (*types.Batch, error) +} diff --git a/db/migrations/state/0013.sql b/db/migrations/state/0013.sql index 4bb1c52f1d..cd18a7b14a 100644 --- a/db/migrations/state/0013.sql +++ b/db/migrations/state/0013.sql @@ -1,30 +1,31 @@ -- +migrate Up ALTER TABLE state.exit_root - ADD COLUMN prev_block_hash BYTEA DEFAULT NULL, - ADD COLUMN l1_info_root BYTEA DEFAULT NULL, - ADD COLUMN l1_info_tree_index BIGINT DEFAULT NULL UNIQUE; + ADD COLUMN IF NOT EXISTS prev_block_hash BYTEA DEFAULT NULL, + ADD COLUMN IF NOT EXISTS l1_info_root BYTEA DEFAULT NULL, + ADD COLUMN IF NOT EXISTS l1_info_tree_index BIGINT DEFAULT NULL UNIQUE; CREATE INDEX IF NOT EXISTS idx_exit_root_l1_info_tree_index ON state.exit_root (l1_info_tree_index); ALTER TABLE state.transaction - ADD COLUMN l2_hash VARCHAR UNIQUE; + ADD COLUMN IF NOT EXISTS l2_hash VARCHAR UNIQUE; CREATE INDEX IF NOT EXISTS idx_transaction_l2_hash ON state.transaction (l2_hash); ALTER TABLE state.batch - ADD COLUMN wip BOOLEAN NOT NULL; + ADD COLUMN IF NOT EXISTS wip BOOLEAN NOT NULL; ALTER TABLE state.virtual_batch - ADD COLUMN timestamp_batch_etrog TIMESTAMP WITH TIME ZONE NULL; + ADD COLUMN IF NOT EXISTS timestamp_batch_etrog TIMESTAMP WITH TIME ZONE NULL, + ADD COLUMN IF NOT EXISTS l1_info_root VARCHAR; -- +migrate Down ALTER TABLE state.exit_root - DROP COLUMN prev_block_hash, - DROP COLUMN l1_info_root, - DROP COLUMN l1_info_tree_index; + DROP COLUMN IF EXISTS prev_block_hash, + DROP COLUMN IF EXISTS l1_info_root, + DROP COLUMN IF EXISTS l1_info_tree_index; DROP INDEX IF EXISTS state.idx_exit_root_l1_info_tree_index; ALTER TABLE state.transaction - DROP COLUMN l2_hash; + DROP COLUMN IF EXISTS l2_hash; DROP INDEX IF EXISTS state.idx_transaction_l2_hash; @@ -32,5 +33,6 @@ ALTER TABLE state.batch DROP COLUMN IF EXISTS wip; ALTER TABLE state.virtual_batch - DROP COLUMN IF EXISTS timestamp_batch_etrog; + DROP COLUMN IF EXISTS timestamp_batch_etrog, + DROP COLUMN IF EXISTS l1_info_root; diff --git a/db/migrations/state/0013_test.go b/db/migrations/state/0013_test.go index 5a1a652a4e..2f597718aa 100644 --- a/db/migrations/state/0013_test.go +++ b/db/migrations/state/0013_test.go @@ -149,6 +149,12 @@ func (m migrationTest0013) RunAssertsAfterMigrationUp(t *testing.T, db *sql.DB) // Try to insert data into the transactions table err = m.InsertDataIntoTransactionsTable(db) assert.NoError(t, err) + + insertVirtualBatch := `INSERT INTO state.virtual_batch + (batch_num, tx_hash, coinbase, block_num, sequencer_addr, timestamp_batch_etrog) + VALUES(0, '0x23970ef3f8184daa93385faf802df142a521b479e8e59fbeafa11b8927eb77b1', '0x0000000000000000000000000000000000000000', 1, '0x6645F64d1cE0513bbf5E6713b7e4D0A957AC853c', '2023-12-22 16:53:00.000');` + _, err = db.Exec(insertVirtualBatch) + assert.NoError(t, err) } func (m migrationTest0013) RunAssertsAfterMigrationDown(t *testing.T, db *sql.DB) { @@ -170,6 +176,12 @@ func (m migrationTest0013) RunAssertsAfterMigrationDown(t *testing.T, db *sql.DB row = db.QueryRow(getWIPColumn) assert.NoError(t, row.Scan(&result)) assert.Equal(t, 0, result) + + insertVirtualBatch := `INSERT INTO state.virtual_batch + (batch_num, tx_hash, coinbase, block_num, sequencer_addr, timestamp_batch_etrog) + VALUES(0, '0x23970ef3f8184daa93385faf802df142a521b479e8e59fbeafa11b8927eb77b1', '0x0000000000000000000000000000000000000000', 1, '0x6645F64d1cE0513bbf5E6713b7e4D0A957AC853c', '2023-12-22 16:53:00.000');` + _, err = db.Exec(insertVirtualBatch) + assert.Error(t, err) } func TestMigration0013(t *testing.T) { diff --git a/db/migrations/state/0014.sql b/db/migrations/state/0014.sql new file mode 100644 index 0000000000..2ad572fce9 --- /dev/null +++ b/db/migrations/state/0014.sql @@ -0,0 +1,6 @@ +-- +migrate Up +CREATE INDEX IF NOT EXISTS idx_batch_global_exit_root ON state.batch (global_exit_root); + +-- +migrate Down +DROP INDEX IF EXISTS state.idx_batch_global_exit_root; + diff --git a/db/migrations/state/0014_test.go b/db/migrations/state/0014_test.go new file mode 100644 index 0000000000..0e3344d1c6 --- /dev/null +++ b/db/migrations/state/0014_test.go @@ -0,0 +1,49 @@ +package migrations_test + +import ( + "database/sql" + "testing" + + "github.com/stretchr/testify/assert" +) + +// this migration changes length of the token name +type migrationTest0014 struct{} + +func (m migrationTest0014) InsertData(db *sql.DB) error { + return nil +} + +func (m migrationTest0014) RunAssertsAfterMigrationUp(t *testing.T, db *sql.DB) { + indexes := []string{ + "idx_batch_global_exit_root", + } + // Check indexes adding + for _, idx := range indexes { + // getIndex + const getIndex = `SELECT count(*) FROM pg_indexes WHERE indexname = $1;` + row := db.QueryRow(getIndex, idx) + var result int + assert.NoError(t, row.Scan(&result)) + assert.Equal(t, 1, result) + } +} + +func (m migrationTest0014) RunAssertsAfterMigrationDown(t *testing.T, db *sql.DB) { + indexes := []string{ + "idx_batch_global_exit_root", + } + // Check indexes removing + for _, idx := range indexes { + // getIndex + const getIndex = `SELECT count(*) FROM pg_indexes WHERE indexname = $1;` + row := db.QueryRow(getIndex, idx) + var result int + assert.NoError(t, row.Scan(&result)) + assert.Equal(t, 0, result) + } +} + +func TestMigration0014(t *testing.T) { + runMigrationTest(t, 14, migrationTest0014{}) +} diff --git a/docker-compose.yml b/docker-compose.yml index 3e85ab2053..6b5508ba33 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -107,7 +107,7 @@ services: zkevm-prover: container_name: zkevm-prover restart: unless-stopped - image: hermeznetwork/zkevm-prover:v4.0.0-RC19 + image: hermeznetwork/zkevm-prover:v4.0.0-RC29 depends_on: zkevm-state-db: condition: service_healthy diff --git a/docs/config-file/node-config-doc.html b/docs/config-file/node-config-doc.html index eba40e9519..f9402bf63a 100644 --- a/docs/config-file/node-config-doc.html +++ b/docs/config-file/node-config-doc.html @@ -10,7 +10,7 @@
"300ms"
PollMinAllowedGasPriceInterval is the interval to poll the suggested min gas price for a tx
"1m"
"300ms"
-
AccountQueue represents the maximum number of non-executable transaction slots permitted per account
GlobalQueue represents the maximum number of non-executable transaction slots for all accounts
Enabled is a flag to enable/disable the effective gas price
L1GasPriceFactor is the percentage of the L1 gas price that will be used as the L2 min gas price
ByteGasCost is the gas cost per byte that is not 0
ZeroByteGasCost is the gas cost per byte that is 0
NetProfit is the profit margin to apply to the calculated breakEvenGasPrice
BreakEvenFactor is the factor to apply to the calculated breakevenGasPrice when comparing it with the gasPriceSigned of a tx
FinalDeviationPct is the max allowed deviation percentage BreakEvenGasPrice on re-calculation
L2GasPriceSuggesterFactor is the factor to apply to L1 gas price to get the suggested L2 gas price used in the
calculations when the effective gas price is disabled (testing/metrics purposes)
ForkID is the current fork ID of the chain
Host defines the network adapter that will be used to serve the HTTP requests
Port defines the port to serve the endpoints via HTTP
ReadTimeout is the HTTP server read timeout
check net/http.server.ReadTimeout and net/http.server.ReadHeaderTimeout
"1m"
+
AccountQueue represents the maximum number of non-executable transaction slots permitted per account
GlobalQueue represents the maximum number of non-executable transaction slots for all accounts
Enabled is a flag to enable/disable the effective gas price
L1GasPriceFactor is the percentage of the L1 gas price that will be used as the L2 min gas price
ByteGasCost is the gas cost per byte that is not 0
ZeroByteGasCost is the gas cost per byte that is 0
NetProfit is the profit margin to apply to the calculated breakEvenGasPrice
BreakEvenFactor is the factor to apply to the calculated breakevenGasPrice when comparing it with the gasPriceSigned of a tx
FinalDeviationPct is the max allowed deviation percentage BreakEvenGasPrice on re-calculation
EthTransferGasPrice is the fixed gas price returned as effective gas price for txs tha are ETH transfers (0 means disabled)
Only one of EthTransferGasPrice or EthTransferL1GasPriceFactor params can be different than 0. If both params are set to 0, the sequencer will halt and log an error
EthTransferL1GasPriceFactor is the percentage of L1 gas price returned as effective gas price for txs tha are ETH transfers (0 means disabled)
Only one of EthTransferGasPrice or EthTransferL1GasPriceFactor params can be different than 0. If both params are set to 0, the sequencer will halt and log an error
L2GasPriceSuggesterFactor is the factor to apply to L1 gas price to get the suggested L2 gas price used in the
calculations when the effective gas price is disabled (testing/metrics purposes)
ForkID is the current fork ID of the chain
Host defines the network adapter that will be used to serve the HTTP requests
Port defines the port to serve the endpoints via HTTP
ReadTimeout is the HTTP server read timeout
check net/http.server.ReadTimeout and net/http.server.ReadHeaderTimeout
"1m"
"300ms"
WriteTimeout is the HTTP server write timeout
check net/http.server.WriteTimeout
"1m"
"300ms"
@@ -50,11 +50,13 @@
"300ms"
L2BlockMaxDeltaTimestamp is the resolution of the timestamp used to close a L2 block
"1m"
"300ms"
-
HaltOnBatchNumber specifies the batch number where the Sequencer will stop to process more transactions and generate new batches. The Sequencer will halt after it closes the batch equal to this number
SequentialBatchSanityCheck indicates if the reprocess of a closed batch (sanity check) must be done in a
sequential way (instead than in parallel)
Port to listen on
Filename of the binary data file
Enabled is a flag to enable/disable the data streamer
WaitPeriodSendSequence is the time the sequencer waits until
trying to send a sequence to L1
"1m"
+
HaltOnBatchNumber specifies the batch number where the Sequencer will stop to process more transactions and generate new batches.
The Sequencer will halt after it closes the batch equal to this number
SequentialBatchSanityCheck indicates if the reprocess of a closed batch (sanity check) must be done in a
sequential way (instead than in parallel)
SequentialProcessL2Block indicates if the processing of a L2 Block must be done in the same finalizer go func instead
in the processPendingL2Blocks go func
Port to listen on
Filename of the binary data file
Version of the binary data file
ChainID is the chain ID
Enabled is a flag to enable/disable the data streamer
WaitPeriodSendSequence is the time the sequencer waits until
trying to send a sequence to L1
"1m"
"300ms"
LastBatchVirtualizationTimeMaxWaitPeriod is time since sequences should be sent
"1m"
"300ms"
-
MaxTxSizeForL1 is the maximum size a single transaction can have. This field has
non-trivial consequences: larger transactions than 128KB are significantly harder and
more expensive to propagate; larger transactions also take more resources
to validate whether they fit into the pool or not.
SenderAddress defines which private key the eth tx manager needs to use
to sign the L1 txs
Must contain a minimum of 20
items
Must contain a maximum of 20
items
L2Coinbase defines which address is going to receive the fees
Must contain a minimum of 20
items
Must contain a maximum of 20
items
Path is the file path for the key store file
Password is the password to decrypt the key store file
Batch number where there is a forkid change (fork upgrade)
GasOffset is the amount of gas to be added to the gas estimation in order
to provide an amount that is higher than the estimated one. This is used
to avoid the TX getting reverted in case something has changed in the network
state after the estimation which can cause the TX to require more gas to be
executed.
ex:
gas estimation: 1000
gas offset: 100
final gas: 1100
MaxBatchesForL1 is the maximum amount of batches to be sequenced in a single L1 tx
Host for the grpc server
Port for the grpc server
RetryTime is the time the aggregator main loop sleeps if there are no proofs to aggregate
or batches to generate proofs. It is also used in the isSynced loop
"1m"
+
L1BlockTimestampMargin is the time difference (margin) that must exists between last L1 block and last L2 block in the sequence before
to send the sequence to L1. If the difference is lower than this value then sequencesender will wait until the difference is equal or greater
"1m"
+
"300ms"
+
MaxTxSizeForL1 is the maximum size a single transaction can have. This field has
non-trivial consequences: larger transactions than 128KB are significantly harder and
more expensive to propagate; larger transactions also take more resources
to validate whether they fit into the pool or not.
SenderAddress defines which private key the eth tx manager needs to use
to sign the L1 txs
Must contain a minimum of 20
items
Must contain a maximum of 20
items
L2Coinbase defines which address is going to receive the fees
Must contain a minimum of 20
items
Must contain a maximum of 20
items
Path is the file path for the key store file
Password is the password to decrypt the key store file
Batch number where there is a forkid change (fork upgrade)
GasOffset is the amount of gas to be added to the gas estimation in order
to provide an amount that is higher than the estimated one. This is used
to avoid the TX getting reverted in case something has changed in the network
state after the estimation which can cause the TX to require more gas to be
executed.
ex:
gas estimation: 1000
gas offset: 100
final gas: 1100
MaxBatchesForL1 is the maximum amount of batches to be sequenced in a single L1 tx
Datastream server to connect
Environment defining the log format ("production" or "development").
In development mode enables development mode (which makes DPanicLevel logs panic), uses a console encoder, writes to standard error, and disables sampling. Stacktraces are automatically included on logs of WarnLevel and above.
Check here
Level of log. As lower value more logs are going to be generated
Outputs
Host for the grpc server
Port for the grpc server
RetryTime is the time the aggregator main loop sleeps if there are no proofs to aggregate
or batches to generate proofs. It is also used in the isSynced loop
"1m"
"300ms"
VerifyProofInterval is the interval of time to verify/send an proof in L1
"1m"
"300ms"
@@ -64,7 +66,7 @@
"300ms"
ChainID is the L2 ChainID provided by the Network Config
ForkID is the L2 ForkID provided by the Network Config
SenderAddress defines which private key the eth tx manager needs to use
to sign the L1 txs
CleanupLockedProofsInterval is the interval of time to clean up locked proofs.
"1m"
"300ms"
-
GeneratingProofCleanupThreshold represents the time interval after
which a proof in generating state is considered to be stuck and
allowed to be cleared.
GasOffset is the amount of gas to be added to the gas estimation in order
to provide an amount that is higher than the estimated one. This is used
to avoid the TX getting reverted in case something has changed in the network
state after the estimation which can cause the TX to require more gas to be
executed.
ex:
gas estimation: 1000
gas offset: 100
final gas: 1100
Chain ID of the L1 network
ZkEVMAddr Address of the L1 contract polygonZkEVMAddress
Must contain a minimum of 20
items
Must contain a maximum of 20
items
RollupManagerAddr Address of the L1 contract
Must contain a minimum of 20
items
Must contain a maximum of 20
items
PolAddr Address of the L1 Pol token Contract
Must contain a minimum of 20
items
Must contain a maximum of 20
items
GlobalExitRootManagerAddr Address of the L1 GlobalExitRootManager contract
Must contain a minimum of 20
items
Must contain a maximum of 20
items
BlockNumber is the block number where the polygonZKEVM smc was deployed on L1
Root hash of the genesis block
Must contain a minimum of 32
items
Must contain a maximum of 32
items
Actions is the data to populate into the state trie
DefaultGasPriceWei is used to set the gas price to be used by the default gas pricer or as minimim gas price by the follower gas pricer.
MaxGasPriceWei is used to limit the gas price returned by the follower gas pricer to a maximum value. It is ignored if 0.
"1m"
+
GeneratingProofCleanupThreshold represents the time interval after
which a proof in generating state is considered to be stuck and
allowed to be cleared.
GasOffset is the amount of gas to be added to the gas estimation in order
to provide an amount that is higher than the estimated one. This is used
to avoid the TX getting reverted in case something has changed in the network
state after the estimation which can cause the TX to require more gas to be
executed.
ex:
gas estimation: 1000
gas offset: 100
final gas: 1100
UpgradeEtrogBatchNumber is the number of the first batch after upgrading to etrog
Chain ID of the L1 network
ZkEVMAddr Address of the L1 contract polygonZkEVMAddress
Must contain a minimum of 20
items
Must contain a maximum of 20
items
RollupManagerAddr Address of the L1 contract
Must contain a minimum of 20
items
Must contain a maximum of 20
items
PolAddr Address of the L1 Pol token Contract
Must contain a minimum of 20
items
Must contain a maximum of 20
items
GlobalExitRootManagerAddr Address of the L1 GlobalExitRootManager contract
Must contain a minimum of 20
items
Must contain a maximum of 20
items
BlockNumber is the block number where the polygonZKEVM smc was deployed on L1
Root hash of the genesis block
Must contain a minimum of 32
items
Must contain a maximum of 32
items
Actions is the data to populate into the state trie
DefaultGasPriceWei is used to set the gas price to be used by the default gas pricer or as minimim gas price by the follower gas pricer.
MaxGasPriceWei is used to limit the gas price returned by the follower gas pricer to a maximum value. It is ignored if 0.
"1m"
"300ms"
"1m"
"300ms"
diff --git a/docs/config-file/node-config-doc.md b/docs/config-file/node-config-doc.md
index b334368c7c..c094c7ebf6 100644
--- a/docs/config-file/node-config-doc.md
+++ b/docs/config-file/node-config-doc.md
@@ -720,16 +720,18 @@ GlobalQueue=1024
**Type:** : `object`
**Description:** EffectiveGasPrice is the config for the effective gas price calculation
-| Property | Pattern | Type | Deprecated | Definition | Title/Description |
-| --------------------------------------------------------------------------------- | ------- | ------- | ---------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| - [Enabled](#Pool_EffectiveGasPrice_Enabled ) | No | boolean | No | - | Enabled is a flag to enable/disable the effective gas price |
-| - [L1GasPriceFactor](#Pool_EffectiveGasPrice_L1GasPriceFactor ) | No | number | No | - | L1GasPriceFactor is the percentage of the L1 gas price that will be used as the L2 min gas price |
-| - [ByteGasCost](#Pool_EffectiveGasPrice_ByteGasCost ) | No | integer | No | - | ByteGasCost is the gas cost per byte that is not 0 |
-| - [ZeroByteGasCost](#Pool_EffectiveGasPrice_ZeroByteGasCost ) | No | integer | No | - | ZeroByteGasCost is the gas cost per byte that is 0 |
-| - [NetProfit](#Pool_EffectiveGasPrice_NetProfit ) | No | number | No | - | NetProfit is the profit margin to apply to the calculated breakEvenGasPrice |
-| - [BreakEvenFactor](#Pool_EffectiveGasPrice_BreakEvenFactor ) | No | number | No | - | BreakEvenFactor is the factor to apply to the calculated breakevenGasPrice when comparing it with the gasPriceSigned of a tx |
-| - [FinalDeviationPct](#Pool_EffectiveGasPrice_FinalDeviationPct ) | No | integer | No | - | FinalDeviationPct is the max allowed deviation percentage BreakEvenGasPrice on re-calculation |
-| - [L2GasPriceSuggesterFactor](#Pool_EffectiveGasPrice_L2GasPriceSuggesterFactor ) | No | number | No | - | L2GasPriceSuggesterFactor is the factor to apply to L1 gas price to get the suggested L2 gas price used in the
calculations when the effective gas price is disabled (testing/metrics purposes) |
+| Property | Pattern | Type | Deprecated | Definition | Title/Description |
+| ------------------------------------------------------------------------------------- | ------- | ------- | ---------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| - [Enabled](#Pool_EffectiveGasPrice_Enabled ) | No | boolean | No | - | Enabled is a flag to enable/disable the effective gas price |
+| - [L1GasPriceFactor](#Pool_EffectiveGasPrice_L1GasPriceFactor ) | No | number | No | - | L1GasPriceFactor is the percentage of the L1 gas price that will be used as the L2 min gas price |
+| - [ByteGasCost](#Pool_EffectiveGasPrice_ByteGasCost ) | No | integer | No | - | ByteGasCost is the gas cost per byte that is not 0 |
+| - [ZeroByteGasCost](#Pool_EffectiveGasPrice_ZeroByteGasCost ) | No | integer | No | - | ZeroByteGasCost is the gas cost per byte that is 0 |
+| - [NetProfit](#Pool_EffectiveGasPrice_NetProfit ) | No | number | No | - | NetProfit is the profit margin to apply to the calculated breakEvenGasPrice |
+| - [BreakEvenFactor](#Pool_EffectiveGasPrice_BreakEvenFactor ) | No | number | No | - | BreakEvenFactor is the factor to apply to the calculated breakevenGasPrice when comparing it with the gasPriceSigned of a tx |
+| - [FinalDeviationPct](#Pool_EffectiveGasPrice_FinalDeviationPct ) | No | integer | No | - | FinalDeviationPct is the max allowed deviation percentage BreakEvenGasPrice on re-calculation |
+| - [EthTransferGasPrice](#Pool_EffectiveGasPrice_EthTransferGasPrice ) | No | integer | No | - | EthTransferGasPrice is the fixed gas price returned as effective gas price for txs tha are ETH transfers (0 means disabled)
Only one of EthTransferGasPrice or EthTransferL1GasPriceFactor params can be different than 0. If both params are set to 0, the sequencer will halt and log an error |
+| - [EthTransferL1GasPriceFactor](#Pool_EffectiveGasPrice_EthTransferL1GasPriceFactor ) | No | number | No | - | EthTransferL1GasPriceFactor is the percentage of L1 gas price returned as effective gas price for txs tha are ETH transfers (0 means disabled)
Only one of EthTransferGasPrice or EthTransferL1GasPriceFactor params can be different than 0. If both params are set to 0, the sequencer will halt and log an error |
+| - [L2GasPriceSuggesterFactor](#Pool_EffectiveGasPrice_L2GasPriceSuggesterFactor ) | No | number | No | - | L2GasPriceSuggesterFactor is the factor to apply to L1 gas price to get the suggested L2 gas price used in the
calculations when the effective gas price is disabled (testing/metrics purposes) |
#### 7.11.1. `Pool.EffectiveGasPrice.Enabled`
@@ -829,7 +831,37 @@ BreakEvenFactor=1.1
FinalDeviationPct=10
```
-#### 7.11.8. `Pool.EffectiveGasPrice.L2GasPriceSuggesterFactor`
+#### 7.11.8. `Pool.EffectiveGasPrice.EthTransferGasPrice`
+
+**Type:** : `integer`
+
+**Default:** `0`
+
+**Description:** EthTransferGasPrice is the fixed gas price returned as effective gas price for txs tha are ETH transfers (0 means disabled)
+Only one of EthTransferGasPrice or EthTransferL1GasPriceFactor params can be different than 0. If both params are set to 0, the sequencer will halt and log an error
+
+**Example setting the default value** (0):
+```
+[Pool.EffectiveGasPrice]
+EthTransferGasPrice=0
+```
+
+#### 7.11.9. `Pool.EffectiveGasPrice.EthTransferL1GasPriceFactor`
+
+**Type:** : `number`
+
+**Default:** `0`
+
+**Description:** EthTransferL1GasPriceFactor is the percentage of L1 gas price returned as effective gas price for txs tha are ETH transfers (0 means disabled)
+Only one of EthTransferGasPrice or EthTransferL1GasPriceFactor params can be different than 0. If both params are set to 0, the sequencer will halt and log an error
+
+**Example setting the default value** (0):
+```
+[Pool.EffectiveGasPrice]
+EthTransferL1GasPriceFactor=0
+```
+
+#### 7.11.10. `Pool.EffectiveGasPrice.L2GasPriceSuggesterFactor`
**Type:** : `number`
@@ -1697,19 +1729,20 @@ StateConsistencyCheckInterval="5s"
**Type:** : `object`
**Description:** Finalizer's specific config properties
-| Property | Pattern | Type | Deprecated | Definition | Title/Description |
-| ---------------------------------------------------------------------------------------------- | ------- | ------- | ---------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| - [ForcedBatchesTimeout](#Sequencer_Finalizer_ForcedBatchesTimeout ) | No | string | No | - | Duration |
-| - [NewTxsWaitInterval](#Sequencer_Finalizer_NewTxsWaitInterval ) | No | string | No | - | Duration |
-| - [ResourceExhaustedMarginPct](#Sequencer_Finalizer_ResourceExhaustedMarginPct ) | No | integer | No | - | ResourceExhaustedMarginPct is the percentage window of the resource left out for the batch to be closed |
-| - [ForcedBatchesL1BlockConfirmations](#Sequencer_Finalizer_ForcedBatchesL1BlockConfirmations ) | No | integer | No | - | ForcedBatchesL1BlockConfirmations is number of blocks to consider GER final |
-| - [L1InfoTreeL1BlockConfirmations](#Sequencer_Finalizer_L1InfoTreeL1BlockConfirmations ) | No | integer | No | - | L1InfoTreeL1BlockConfirmations is number of blocks to consider L1InfoRoot final |
-| - [ForcedBatchesCheckInterval](#Sequencer_Finalizer_ForcedBatchesCheckInterval ) | No | string | No | - | Duration |
-| - [L1InfoTreeCheckInterval](#Sequencer_Finalizer_L1InfoTreeCheckInterval ) | No | string | No | - | Duration |
-| - [BatchMaxDeltaTimestamp](#Sequencer_Finalizer_BatchMaxDeltaTimestamp ) | No | string | No | - | Duration |
-| - [L2BlockMaxDeltaTimestamp](#Sequencer_Finalizer_L2BlockMaxDeltaTimestamp ) | No | string | No | - | Duration |
-| - [HaltOnBatchNumber](#Sequencer_Finalizer_HaltOnBatchNumber ) | No | integer | No | - | HaltOnBatchNumber specifies the batch number where the Sequencer will stop to process more transactions and generate new batches. The Sequencer will halt after it closes the batch equal to this number |
-| - [SequentialBatchSanityCheck](#Sequencer_Finalizer_SequentialBatchSanityCheck ) | No | boolean | No | - | SequentialBatchSanityCheck indicates if the reprocess of a closed batch (sanity check) must be done in a
sequential way (instead than in parallel) |
+| Property | Pattern | Type | Deprecated | Definition | Title/Description |
+| ---------------------------------------------------------------------------------------------- | ------- | ------- | ---------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| - [ForcedBatchesTimeout](#Sequencer_Finalizer_ForcedBatchesTimeout ) | No | string | No | - | Duration |
+| - [NewTxsWaitInterval](#Sequencer_Finalizer_NewTxsWaitInterval ) | No | string | No | - | Duration |
+| - [ResourceExhaustedMarginPct](#Sequencer_Finalizer_ResourceExhaustedMarginPct ) | No | integer | No | - | ResourceExhaustedMarginPct is the percentage window of the resource left out for the batch to be closed |
+| - [ForcedBatchesL1BlockConfirmations](#Sequencer_Finalizer_ForcedBatchesL1BlockConfirmations ) | No | integer | No | - | ForcedBatchesL1BlockConfirmations is number of blocks to consider GER final |
+| - [L1InfoTreeL1BlockConfirmations](#Sequencer_Finalizer_L1InfoTreeL1BlockConfirmations ) | No | integer | No | - | L1InfoTreeL1BlockConfirmations is number of blocks to consider L1InfoRoot final |
+| - [ForcedBatchesCheckInterval](#Sequencer_Finalizer_ForcedBatchesCheckInterval ) | No | string | No | - | Duration |
+| - [L1InfoTreeCheckInterval](#Sequencer_Finalizer_L1InfoTreeCheckInterval ) | No | string | No | - | Duration |
+| - [BatchMaxDeltaTimestamp](#Sequencer_Finalizer_BatchMaxDeltaTimestamp ) | No | string | No | - | Duration |
+| - [L2BlockMaxDeltaTimestamp](#Sequencer_Finalizer_L2BlockMaxDeltaTimestamp ) | No | string | No | - | Duration |
+| - [HaltOnBatchNumber](#Sequencer_Finalizer_HaltOnBatchNumber ) | No | integer | No | - | HaltOnBatchNumber specifies the batch number where the Sequencer will stop to process more transactions and generate new batches.
The Sequencer will halt after it closes the batch equal to this number |
+| - [SequentialBatchSanityCheck](#Sequencer_Finalizer_SequentialBatchSanityCheck ) | No | boolean | No | - | SequentialBatchSanityCheck indicates if the reprocess of a closed batch (sanity check) must be done in a
sequential way (instead than in parallel) |
+| - [SequentialProcessL2Block](#Sequencer_Finalizer_SequentialProcessL2Block ) | No | boolean | No | - | SequentialProcessL2Block indicates if the processing of a L2 Block must be done in the same finalizer go func instead
in the processPendingL2Blocks go func |
#### 10.7.1. `Sequencer.Finalizer.ForcedBatchesTimeout`
@@ -1915,7 +1948,8 @@ L2BlockMaxDeltaTimestamp="3s"
**Default:** `0`
-**Description:** HaltOnBatchNumber specifies the batch number where the Sequencer will stop to process more transactions and generate new batches. The Sequencer will halt after it closes the batch equal to this number
+**Description:** HaltOnBatchNumber specifies the batch number where the Sequencer will stop to process more transactions and generate new batches.
+The Sequencer will halt after it closes the batch equal to this number
**Example setting the default value** (0):
```
@@ -1938,6 +1972,21 @@ sequential way (instead than in parallel)
SequentialBatchSanityCheck=false
```
+#### 10.7.12. `Sequencer.Finalizer.SequentialProcessL2Block`
+
+**Type:** : `boolean`
+
+**Default:** `true`
+
+**Description:** SequentialProcessL2Block indicates if the processing of a L2 Block must be done in the same finalizer go func instead
+in the processPendingL2Blocks go func
+
+**Example setting the default value** (true):
+```
+[Sequencer.Finalizer]
+SequentialProcessL2Block=true
+```
+
### 10.8. `[Sequencer.StreamServer]`
**Type:** : `object`
@@ -1947,6 +1996,8 @@ SequentialBatchSanityCheck=false
| ----------------------------------------------- | ------- | ------- | ---------- | ---------- | ----------------------------------------------------- |
| - [Port](#Sequencer_StreamServer_Port ) | No | integer | No | - | Port to listen on |
| - [Filename](#Sequencer_StreamServer_Filename ) | No | string | No | - | Filename of the binary data file |
+| - [Version](#Sequencer_StreamServer_Version ) | No | integer | No | - | Version of the binary data file |
+| - [ChainID](#Sequencer_StreamServer_ChainID ) | No | integer | No | - | ChainID is the chain ID |
| - [Enabled](#Sequencer_StreamServer_Enabled ) | No | boolean | No | - | Enabled is a flag to enable/disable the data streamer |
| - [Log](#Sequencer_StreamServer_Log ) | No | object | No | - | Log is the log configuration |
@@ -1978,7 +2029,35 @@ Port=0
Filename=""
```
-#### 10.8.3. `Sequencer.StreamServer.Enabled`
+#### 10.8.3. `Sequencer.StreamServer.Version`
+
+**Type:** : `integer`
+
+**Default:** `0`
+
+**Description:** Version of the binary data file
+
+**Example setting the default value** (0):
+```
+[Sequencer.StreamServer]
+Version=0
+```
+
+#### 10.8.4. `Sequencer.StreamServer.ChainID`
+
+**Type:** : `integer`
+
+**Default:** `0`
+
+**Description:** ChainID is the chain ID
+
+**Example setting the default value** (0):
+```
+[Sequencer.StreamServer]
+ChainID=0
+```
+
+#### 10.8.5. `Sequencer.StreamServer.Enabled`
**Type:** : `boolean`
@@ -1992,7 +2071,7 @@ Filename=""
Enabled=false
```
-#### 10.8.4. `[Sequencer.StreamServer.Log]`
+#### 10.8.6. `[Sequencer.StreamServer.Log]`
**Type:** : `object`
**Description:** Log is the log configuration
@@ -2003,7 +2082,7 @@ Enabled=false
| - [Level](#Sequencer_StreamServer_Log_Level ) | No | enum (of string) | No | - | - |
| - [Outputs](#Sequencer_StreamServer_Log_Outputs ) | No | array of string | No | - | - |
-##### 10.8.4.1. `Sequencer.StreamServer.Log.Environment`
+##### 10.8.6.1. `Sequencer.StreamServer.Log.Environment`
**Type:** : `enum (of string)`
@@ -2019,7 +2098,7 @@ Must be one of:
* "production"
* "development"
-##### 10.8.4.2. `Sequencer.StreamServer.Log.Level`
+##### 10.8.6.2. `Sequencer.StreamServer.Log.Level`
**Type:** : `enum (of string)`
@@ -2040,7 +2119,7 @@ Must be one of:
* "panic"
* "fatal"
-##### 10.8.4.3. `Sequencer.StreamServer.Log.Outputs`
+##### 10.8.6.3. `Sequencer.StreamServer.Log.Outputs`
**Type:** : `array of string`
@@ -2053,6 +2132,7 @@ Must be one of:
| ------------------------------------------------------------------------------------------------------- | ------- | ---------------- | ---------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| - [WaitPeriodSendSequence](#SequenceSender_WaitPeriodSendSequence ) | No | string | No | - | Duration |
| - [LastBatchVirtualizationTimeMaxWaitPeriod](#SequenceSender_LastBatchVirtualizationTimeMaxWaitPeriod ) | No | string | No | - | Duration |
+| - [L1BlockTimestampMargin](#SequenceSender_L1BlockTimestampMargin ) | No | string | No | - | Duration |
| - [MaxTxSizeForL1](#SequenceSender_MaxTxSizeForL1 ) | No | integer | No | - | MaxTxSizeForL1 is the maximum size a single transaction can have. This field has
non-trivial consequences: larger transactions than 128KB are significantly harder and
more expensive to propagate; larger transactions also take more resources
to validate whether they fit into the pool or not. |
| - [SenderAddress](#SequenceSender_SenderAddress ) | No | array of integer | No | - | SenderAddress defines which private key the eth tx manager needs to use
to sign the L1 txs |
| - [L2Coinbase](#SequenceSender_L2Coinbase ) | No | array of integer | No | - | L2Coinbase defines which address is going to receive the fees |
@@ -2060,6 +2140,7 @@ Must be one of:
| - [ForkUpgradeBatchNumber](#SequenceSender_ForkUpgradeBatchNumber ) | No | integer | No | - | Batch number where there is a forkid change (fork upgrade) |
| - [GasOffset](#SequenceSender_GasOffset ) | No | integer | No | - | GasOffset is the amount of gas to be added to the gas estimation in order
to provide an amount that is higher than the estimated one. This is used
to avoid the TX getting reverted in case something has changed in the network
state after the estimation which can cause the TX to require more gas to be
executed.
ex:
gas estimation: 1000
gas offset: 100
final gas: 1100 |
| - [MaxBatchesForL1](#SequenceSender_MaxBatchesForL1 ) | No | integer | No | - | MaxBatchesForL1 is the maximum amount of batches to be sequenced in a single L1 tx |
+| - [StreamClient](#SequenceSender_StreamClient ) | No | object | No | - | StreamClientCfg is the config for the stream client |
### 11.1. `SequenceSender.WaitPeriodSendSequence`
@@ -2114,7 +2195,34 @@ WaitPeriodSendSequence="5s"
LastBatchVirtualizationTimeMaxWaitPeriod="5s"
```
-### 11.3. `SequenceSender.MaxTxSizeForL1`
+### 11.3. `SequenceSender.L1BlockTimestampMargin`
+
+**Title:** Duration
+
+**Type:** : `string`
+
+**Default:** `"30s"`
+
+**Description:** L1BlockTimestampMargin is the time difference (margin) that must exists between last L1 block and last L2 block in the sequence before
+to send the sequence to L1. If the difference is lower than this value then sequencesender will wait until the difference is equal or greater
+
+**Examples:**
+
+```json
+"1m"
+```
+
+```json
+"300ms"
+```
+
+**Example setting the default value** ("30s"):
+```
+[SequenceSender]
+L1BlockTimestampMargin="30s"
+```
+
+### 11.4. `SequenceSender.MaxTxSizeForL1`
**Type:** : `integer`
@@ -2131,13 +2239,13 @@ to validate whether they fit into the pool or not.
MaxTxSizeForL1=131072
```
-### 11.4. `SequenceSender.SenderAddress`
+### 11.5. `SequenceSender.SenderAddress`
**Type:** : `array of integer`
**Description:** SenderAddress defines which private key the eth tx manager needs to use
to sign the L1 txs
-### 11.5. `SequenceSender.L2Coinbase`
+### 11.6. `SequenceSender.L2Coinbase`
**Type:** : `array of integer`
@@ -2151,7 +2259,7 @@ to sign the L1 txs
L2Coinbase="0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266"
```
-### 11.6. `[SequenceSender.PrivateKey]`
+### 11.7. `[SequenceSender.PrivateKey]`
**Type:** : `object`
**Description:** PrivateKey defines all the key store files that are going
@@ -2162,7 +2270,7 @@ to be read in order to provide the private keys to sign the L1 txs
| - [Path](#SequenceSender_PrivateKey_Path ) | No | string | No | - | Path is the file path for the key store file |
| - [Password](#SequenceSender_PrivateKey_Password ) | No | string | No | - | Password is the password to decrypt the key store file |
-#### 11.6.1. `SequenceSender.PrivateKey.Path`
+#### 11.7.1. `SequenceSender.PrivateKey.Path`
**Type:** : `string`
@@ -2176,7 +2284,7 @@ to be read in order to provide the private keys to sign the L1 txs
Path="/pk/sequencer.keystore"
```
-#### 11.6.2. `SequenceSender.PrivateKey.Password`
+#### 11.7.2. `SequenceSender.PrivateKey.Password`
**Type:** : `string`
@@ -2190,7 +2298,7 @@ Path="/pk/sequencer.keystore"
Password="testonly"
```
-### 11.7. `SequenceSender.ForkUpgradeBatchNumber`
+### 11.8. `SequenceSender.ForkUpgradeBatchNumber`
**Type:** : `integer`
@@ -2204,7 +2312,7 @@ Password="testonly"
ForkUpgradeBatchNumber=0
```
-### 11.8. `SequenceSender.GasOffset`
+### 11.9. `SequenceSender.GasOffset`
**Type:** : `integer`
@@ -2227,7 +2335,7 @@ final gas: 1100
GasOffset=80000
```
-### 11.9. `SequenceSender.MaxBatchesForL1`
+### 11.10. `SequenceSender.MaxBatchesForL1`
**Type:** : `integer`
@@ -2241,6 +2349,89 @@ GasOffset=80000
MaxBatchesForL1=300
```
+### 11.11. `[SequenceSender.StreamClient]`
+
+**Type:** : `object`
+**Description:** StreamClientCfg is the config for the stream client
+
+| Property | Pattern | Type | Deprecated | Definition | Title/Description |
+| ------------------------------------------------ | ------- | ------ | ---------- | ---------- | ---------------------------- |
+| - [Server](#SequenceSender_StreamClient_Server ) | No | string | No | - | Datastream server to connect |
+| - [Log](#SequenceSender_StreamClient_Log ) | No | object | No | - | Log is the log configuration |
+
+#### 11.11.1. `SequenceSender.StreamClient.Server`
+
+**Type:** : `string`
+
+**Default:** `""`
+
+**Description:** Datastream server to connect
+
+**Example setting the default value** (""):
+```
+[SequenceSender.StreamClient]
+Server=""
+```
+
+#### 11.11.2. `[SequenceSender.StreamClient.Log]`
+
+**Type:** : `object`
+**Description:** Log is the log configuration
+
+| Property | Pattern | Type | Deprecated | Definition | Title/Description |
+| -------------------------------------------------------------- | ------- | ---------------- | ---------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| - [Environment](#SequenceSender_StreamClient_Log_Environment ) | No | enum (of string) | No | - | Environment defining the log format ("production" or "development").
In development mode enables development mode (which makes DPanicLevel logs panic), uses a console encoder, writes to standard error, and disables sampling. Stacktraces are automatically included on logs of WarnLevel and above.
Check [here](https://pkg.go.dev/go.uber.org/zap@v1.24.0#NewDevelopmentConfig) |
+| - [Level](#SequenceSender_StreamClient_Log_Level ) | No | enum (of string) | No | - | Level of log. As lower value more logs are going to be generated |
+| - [Outputs](#SequenceSender_StreamClient_Log_Outputs ) | No | array of string | No | - | Outputs |
+
+##### 11.11.2.1. `SequenceSender.StreamClient.Log.Environment`
+
+**Type:** : `enum (of string)`
+
+**Default:** `""`
+
+**Description:** Environment defining the log format ("production" or "development").
+In development mode enables development mode (which makes DPanicLevel logs panic), uses a console encoder, writes to standard error, and disables sampling. Stacktraces are automatically included on logs of WarnLevel and above.
+Check [here](https://pkg.go.dev/go.uber.org/zap@v1.24.0#NewDevelopmentConfig)
+
+**Example setting the default value** (""):
+```
+[SequenceSender.StreamClient.Log]
+Environment=""
+```
+
+Must be one of:
+* "production"
+* "development"
+
+##### 11.11.2.2. `SequenceSender.StreamClient.Log.Level`
+
+**Type:** : `enum (of string)`
+
+**Default:** `""`
+
+**Description:** Level of log. As lower value more logs are going to be generated
+
+**Example setting the default value** (""):
+```
+[SequenceSender.StreamClient.Log]
+Level=""
+```
+
+Must be one of:
+* "debug"
+* "info"
+* "warn"
+* "error"
+* "dpanic"
+* "panic"
+* "fatal"
+
+##### 11.11.2.3. `SequenceSender.StreamClient.Log.Outputs`
+
+**Type:** : `array of string`
+**Description:** Outputs
+
## 12. `[Aggregator]`
**Type:** : `object`
@@ -2262,6 +2453,7 @@ MaxBatchesForL1=300
| - [CleanupLockedProofsInterval](#Aggregator_CleanupLockedProofsInterval ) | No | string | No | - | Duration |
| - [GeneratingProofCleanupThreshold](#Aggregator_GeneratingProofCleanupThreshold ) | No | string | No | - | GeneratingProofCleanupThreshold represents the time interval after
which a proof in generating state is considered to be stuck and
allowed to be cleared. |
| - [GasOffset](#Aggregator_GasOffset ) | No | integer | No | - | GasOffset is the amount of gas to be added to the gas estimation in order
to provide an amount that is higher than the estimated one. This is used
to avoid the TX getting reverted in case something has changed in the network
state after the estimation which can cause the TX to require more gas to be
executed.
ex:
gas estimation: 1000
gas offset: 100
final gas: 1100 |
+| - [UpgradeEtrogBatchNumber](#Aggregator_UpgradeEtrogBatchNumber ) | No | integer | No | - | UpgradeEtrogBatchNumber is the number of the first batch after upgrading to etrog |
### 12.1. `Aggregator.Host`
@@ -2525,6 +2717,20 @@ final gas: 1100
GasOffset=0
```
+### 12.15. `Aggregator.UpgradeEtrogBatchNumber`
+
+**Type:** : `integer`
+
+**Default:** `0`
+
+**Description:** UpgradeEtrogBatchNumber is the number of the first batch after upgrading to etrog
+
+**Example setting the default value** (0):
+```
+[Aggregator]
+UpgradeEtrogBatchNumber=0
+```
+
## 13. `[NetworkConfig]`
**Type:** : `object`
diff --git a/docs/config-file/node-config-schema.json b/docs/config-file/node-config-schema.json
index 15ccfebe96..1e61f94238 100644
--- a/docs/config-file/node-config-schema.json
+++ b/docs/config-file/node-config-schema.json
@@ -303,6 +303,16 @@
"description": "FinalDeviationPct is the max allowed deviation percentage BreakEvenGasPrice on re-calculation",
"default": 10
},
+ "EthTransferGasPrice": {
+ "type": "integer",
+ "description": "EthTransferGasPrice is the fixed gas price returned as effective gas price for txs tha are ETH transfers (0 means disabled)\nOnly one of EthTransferGasPrice or EthTransferL1GasPriceFactor params can be different than 0. If both params are set to 0, the sequencer will halt and log an error",
+ "default": 0
+ },
+ "EthTransferL1GasPriceFactor": {
+ "type": "number",
+ "description": "EthTransferL1GasPriceFactor is the percentage of L1 gas price returned as effective gas price for txs tha are ETH transfers (0 means disabled)\nOnly one of EthTransferGasPrice or EthTransferL1GasPriceFactor params can be different than 0. If both params are set to 0, the sequencer will halt and log an error",
+ "default": 0
+ },
"L2GasPriceSuggesterFactor": {
"type": "number",
"description": "L2GasPriceSuggesterFactor is the factor to apply to L1 gas price to get the suggested L2 gas price used in the\ncalculations when the effective gas price is disabled (testing/metrics purposes)",
@@ -717,13 +727,18 @@
},
"HaltOnBatchNumber": {
"type": "integer",
- "description": "HaltOnBatchNumber specifies the batch number where the Sequencer will stop to process more transactions and generate new batches. The Sequencer will halt after it closes the batch equal to this number",
+ "description": "HaltOnBatchNumber specifies the batch number where the Sequencer will stop to process more transactions and generate new batches.\nThe Sequencer will halt after it closes the batch equal to this number",
"default": 0
},
"SequentialBatchSanityCheck": {
"type": "boolean",
"description": "SequentialBatchSanityCheck indicates if the reprocess of a closed batch (sanity check) must be done in a\nsequential way (instead than in parallel)",
"default": false
+ },
+ "SequentialProcessL2Block": {
+ "type": "boolean",
+ "description": "SequentialProcessL2Block indicates if the processing of a L2 Block must be done in the same finalizer go func instead\nin the processPendingL2Blocks go func",
+ "default": true
}
},
"additionalProperties": false,
@@ -742,6 +757,16 @@
"description": "Filename of the binary data file",
"default": ""
},
+ "Version": {
+ "type": "integer",
+ "description": "Version of the binary data file",
+ "default": 0
+ },
+ "ChainID": {
+ "type": "integer",
+ "description": "ChainID is the chain ID",
+ "default": 0
+ },
"Enabled": {
"type": "boolean",
"description": "Enabled is a flag to enable/disable the data streamer",
@@ -813,6 +838,16 @@
"300ms"
]
},
+ "L1BlockTimestampMargin": {
+ "type": "string",
+ "title": "Duration",
+ "description": "L1BlockTimestampMargin is the time difference (margin) that must exists between last L1 block and last L2 block in the sequence before\nto send the sequence to L1. If the difference is lower than this value then sequencesender will wait until the difference is equal or greater",
+ "default": "30s",
+ "examples": [
+ "1m",
+ "300ms"
+ ]
+ },
"MaxTxSizeForL1": {
"type": "integer",
"description": "MaxTxSizeForL1 is the maximum size a single transaction can have. This field has\nnon-trivial consequences: larger transactions than 128KB are significantly harder and\nmore expensive to propagate; larger transactions also take more resources\nto validate whether they fit into the pool or not.",
@@ -868,6 +903,55 @@
"type": "integer",
"description": "MaxBatchesForL1 is the maximum amount of batches to be sequenced in a single L1 tx",
"default": 300
+ },
+ "StreamClient": {
+ "properties": {
+ "Server": {
+ "type": "string",
+ "description": "Datastream server to connect",
+ "default": ""
+ },
+ "Log": {
+ "properties": {
+ "Environment": {
+ "type": "string",
+ "enum": [
+ "production",
+ "development"
+ ],
+ "description": "Environment defining the log format (\"production\" or \"development\").\nIn development mode enables development mode (which makes DPanicLevel logs panic), uses a console encoder, writes to standard error, and disables sampling. Stacktraces are automatically included on logs of WarnLevel and above.\nCheck [here](https://pkg.go.dev/go.uber.org/zap@v1.24.0#NewDevelopmentConfig)",
+ "default": ""
+ },
+ "Level": {
+ "type": "string",
+ "enum": [
+ "debug",
+ "info",
+ "warn",
+ "error",
+ "dpanic",
+ "panic",
+ "fatal"
+ ],
+ "description": "Level of log. As lower value more logs are going to be generated",
+ "default": ""
+ },
+ "Outputs": {
+ "items": {
+ "type": "string"
+ },
+ "type": "array",
+ "description": "Outputs"
+ }
+ },
+ "additionalProperties": false,
+ "type": "object",
+ "description": "Log is the log configuration"
+ }
+ },
+ "additionalProperties": false,
+ "type": "object",
+ "description": "StreamClientCfg is the config for the stream client"
}
},
"additionalProperties": false,
@@ -971,6 +1055,11 @@
"type": "integer",
"description": "GasOffset is the amount of gas to be added to the gas estimation in order\nto provide an amount that is higher than the estimated one. This is used\nto avoid the TX getting reverted in case something has changed in the network\nstate after the estimation which can cause the TX to require more gas to be\nexecuted.\n\nex:\ngas estimation: 1000\ngas offset: 100\nfinal gas: 1100",
"default": 0
+ },
+ "UpgradeEtrogBatchNumber": {
+ "type": "integer",
+ "description": "UpgradeEtrogBatchNumber is the number of the first batch after upgrading to etrog",
+ "default": 0
}
},
"additionalProperties": false,
diff --git a/docs/diff/diff.html b/docs/diff/diff.html
index 82763a318d..ec3b3cb9da 100644
--- a/docs/diff/diff.html
+++ b/docs/diff/diff.html
@@ -2,7 +2,7 @@
- zkEVM node vs CDK validium nodezkevm-node version: v0.5.0-RC4
+ zkEVM node vs CDK validium nodezkevm-node version: v0.5.0-RC23