Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to forkid 11 #3732

Open
wants to merge 8 commits into
base: release/v0.7.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions aggregator/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ const (

ethTxManagerOwner = "aggregator"
monitoredIDFormat = "proof-from-%v-to-%v"

forkId9 = uint64(9)
)

type finalProofMsg struct {
Expand Down Expand Up @@ -184,7 +182,7 @@ func (a *Aggregator) Channel(stream prover.AggregatorService_ChannelServer) erro
log.Info("Establishing stream connection with prover")

// Check if prover supports the required Fork ID
if !prover.SupportsForkID(forkId9) {
if !prover.SupportsForkID(a.cfg.ForkId) {
err := errors.New("prover does not support required fork ID")
log.Warn(FirstToUpper(err.Error()))
return err
Expand Down Expand Up @@ -1093,7 +1091,7 @@ func (a *Aggregator) buildInputProver(ctx context.Context, batchToVerify *state.
OldAccInputHash: previousBatch.AccInputHash.Bytes(),
OldBatchNum: previousBatch.BatchNumber,
ChainId: a.cfg.ChainID,
ForkId: forkId9,
ForkId: a.cfg.ForkId,
BatchL2Data: batchToVerify.BatchL2Data,
L1InfoRoot: l1InfoRoot.Bytes(),
TimestampLimit: uint64(batchToVerify.Timestamp.Unix()),
Expand Down
20 changes: 14 additions & 6 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -548,27 +548,35 @@ func Test_Defaults(t *testing.T) {
},
{
path: "State.Batch.Constraints.MaxKeccakHashes",
expectedValue: uint32(2145),
expectedValue: uint32(9268),
},
{
path: "State.Batch.Constraints.MaxPoseidonHashes",
expectedValue: uint32(252357),
expectedValue: uint32(1090693),
},
{
path: "State.Batch.Constraints.MaxPoseidonPaddings",
expectedValue: uint32(135191),
expectedValue: uint32(584300),
},
{
path: "State.Batch.Constraints.MaxMemAligns",
expectedValue: uint32(236585),
expectedValue: uint32(1022525),
},
{
path: "State.Batch.Constraints.MaxArithmetics",
expectedValue: uint32(236585),
expectedValue: uint32(1022525),
},
{
path: "State.Batch.Constraints.MaxBinaries",
expectedValue: uint32(473170),
expectedValue: uint32(2045051),
},
{
path: "State.Batch.Constraints.MaxSteps",
expectedValue: uint32(32720619),
},
{
path: "State.Batch.Constraints.MaxSHA256Hashes",
expectedValue: uint32(7269),
},
}
file, err := os.CreateTemp("", "genesisConfig")
Expand Down
16 changes: 8 additions & 8 deletions config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ Outputs = ["stderr"]
MaxTxsPerBatch = 300
MaxBatchBytesSize = 120000
MaxCumulativeGasUsed = 1125899906842624
MaxKeccakHashes = 2145
MaxPoseidonHashes = 252357
MaxPoseidonPaddings = 135191
MaxMemAligns = 236585
MaxArithmetics = 236585
MaxBinaries = 473170
MaxSteps = 7570538
MaxSHA256Hashes = 1596
MaxKeccakHashes = 9268
MaxPoseidonHashes = 1090693
MaxPoseidonPaddings = 584300
MaxMemAligns = 1022525
MaxArithmetics = 1022525
MaxBinaries = 2045051
MaxSteps = 32720619
MaxSHA256Hashes = 7269

[Pool]
IntervalToRefreshBlockedAddresses = "5m"
Expand Down
176 changes: 88 additions & 88 deletions config/environments/local/local.genesis.config.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions config/environments/local/local.node.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ Outputs = ["stderr"]
MaxTxsPerBatch = 300
MaxBatchBytesSize = 120000
MaxCumulativeGasUsed = 1125899906842624
MaxKeccakHashes = 2145
MaxPoseidonHashes = 252357
MaxPoseidonPaddings = 135191
MaxMemAligns = 236585
MaxArithmetics = 236585
MaxBinaries = 473170
MaxSteps = 7570538
MaxSHA256Hashes = 1596
MaxKeccakHashes = 9268
MaxPoseidonHashes = 1090693
MaxPoseidonPaddings = 584300
MaxMemAligns = 1022525
MaxArithmetics = 1022525
MaxBinaries = 2045051
MaxSteps = 32720619
MaxSHA256Hashes = 7269

[Pool]
IntervalToRefreshBlockedAddresses = "5m"
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ services:
zkevm-prover:
container_name: zkevm-prover
restart: unless-stopped
image: hermeznetwork/zkevm-prover:v6.0.0
image: hermeznetwork/zkevm-prover:v7.0.0-RC14-fork.11
depends_on:
zkevm-state-db:
condition: service_healthy
Expand Down
2 changes: 1 addition & 1 deletion docs/config-file/node-config-doc.html

Large diffs are not rendered by default.

48 changes: 24 additions & 24 deletions docs/config-file/node-config-doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -4291,96 +4291,96 @@ MaxCumulativeGasUsed=1125899906842624

**Type:** : `integer`

**Default:** `2145`
**Default:** `9268`

**Example setting the default value** (2145):
**Example setting the default value** (9268):
```
[State.Batch.Constraints]
MaxKeccakHashes=2145
MaxKeccakHashes=9268
```

##### <a name="State_Batch_Constraints_MaxPoseidonHashes"></a>20.9.1.5. `State.Batch.Constraints.MaxPoseidonHashes`

**Type:** : `integer`

**Default:** `252357`
**Default:** `1090693`

**Example setting the default value** (252357):
**Example setting the default value** (1090693):
```
[State.Batch.Constraints]
MaxPoseidonHashes=252357
MaxPoseidonHashes=1090693
```

##### <a name="State_Batch_Constraints_MaxPoseidonPaddings"></a>20.9.1.6. `State.Batch.Constraints.MaxPoseidonPaddings`

**Type:** : `integer`

**Default:** `135191`
**Default:** `584300`

**Example setting the default value** (135191):
**Example setting the default value** (584300):
```
[State.Batch.Constraints]
MaxPoseidonPaddings=135191
MaxPoseidonPaddings=584300
```

##### <a name="State_Batch_Constraints_MaxMemAligns"></a>20.9.1.7. `State.Batch.Constraints.MaxMemAligns`

**Type:** : `integer`

**Default:** `236585`
**Default:** `1022525`

**Example setting the default value** (236585):
**Example setting the default value** (1022525):
```
[State.Batch.Constraints]
MaxMemAligns=236585
MaxMemAligns=1022525
```

##### <a name="State_Batch_Constraints_MaxArithmetics"></a>20.9.1.8. `State.Batch.Constraints.MaxArithmetics`

**Type:** : `integer`

**Default:** `236585`
**Default:** `1022525`

**Example setting the default value** (236585):
**Example setting the default value** (1022525):
```
[State.Batch.Constraints]
MaxArithmetics=236585
MaxArithmetics=1022525
```

##### <a name="State_Batch_Constraints_MaxBinaries"></a>20.9.1.9. `State.Batch.Constraints.MaxBinaries`

**Type:** : `integer`

**Default:** `473170`
**Default:** `2045051`

**Example setting the default value** (473170):
**Example setting the default value** (2045051):
```
[State.Batch.Constraints]
MaxBinaries=473170
MaxBinaries=2045051
```

##### <a name="State_Batch_Constraints_MaxSteps"></a>20.9.1.10. `State.Batch.Constraints.MaxSteps`

**Type:** : `integer`

**Default:** `7570538`
**Default:** `32720619`

**Example setting the default value** (7570538):
**Example setting the default value** (32720619):
```
[State.Batch.Constraints]
MaxSteps=7570538
MaxSteps=32720619
```

##### <a name="State_Batch_Constraints_MaxSHA256Hashes"></a>20.9.1.11. `State.Batch.Constraints.MaxSHA256Hashes`

**Type:** : `integer`

**Default:** `1596`
**Default:** `7269`

**Example setting the default value** (1596):
**Example setting the default value** (7269):
```
[State.Batch.Constraints]
MaxSHA256Hashes=1596
MaxSHA256Hashes=7269
```

### <a name="State_MaxLogsCount"></a>20.10. `State.MaxLogsCount`
Expand Down
16 changes: 8 additions & 8 deletions docs/config-file/node-config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1696,35 +1696,35 @@
},
"MaxKeccakHashes": {
"type": "integer",
"default": 2145
"default": 9268
},
"MaxPoseidonHashes": {
"type": "integer",
"default": 252357
"default": 1090693
},
"MaxPoseidonPaddings": {
"type": "integer",
"default": 135191
"default": 584300
},
"MaxMemAligns": {
"type": "integer",
"default": 236585
"default": 1022525
},
"MaxArithmetics": {
"type": "integer",
"default": 236585
"default": 1022525
},
"MaxBinaries": {
"type": "integer",
"default": 473170
"default": 2045051
},
"MaxSteps": {
"type": "integer",
"default": 7570538
"default": 32720619
},
"MaxSHA256Hashes": {
"type": "integer",
"default": 1596
"default": 7269
}
},
"additionalProperties": false,
Expand Down
18 changes: 9 additions & 9 deletions pool/pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ var (
bc = state.BatchConstraintsCfg{
MaxTxsPerBatch: 300,
MaxBatchBytesSize: 120000,
MaxCumulativeGasUsed: 30000000,
MaxKeccakHashes: 2145,
MaxPoseidonHashes: 252357,
MaxPoseidonPaddings: 135191,
MaxMemAligns: 236585,
MaxArithmetics: 236585,
MaxBinaries: 473170,
MaxSteps: 7570538,
MaxSHA256Hashes: 1596,
MaxCumulativeGasUsed: 1125899906842624,
MaxKeccakHashes: 9268,
MaxPoseidonHashes: 1090693,
MaxPoseidonPaddings: 584300,
MaxMemAligns: 1022525,
MaxArithmetics: 1022525,
MaxBinaries: 2045051,
MaxSteps: 32720619,
MaxSHA256Hashes: 7269,
}
ip = "101.1.50.20"
)
Expand Down
18 changes: 9 additions & 9 deletions sequencer/finalizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ var (
bc = state.BatchConstraintsCfg{
MaxTxsPerBatch: 300,
MaxBatchBytesSize: 120000,
MaxCumulativeGasUsed: 30000000,
MaxKeccakHashes: 2145,
MaxPoseidonHashes: 252357,
MaxPoseidonPaddings: 135191,
MaxMemAligns: 236585,
MaxArithmetics: 236585,
MaxBinaries: 473170,
MaxSteps: 7570538,
MaxSHA256Hashes: 1596,
MaxCumulativeGasUsed: 1125899906842624,
MaxKeccakHashes: 9268,
MaxPoseidonHashes: 1090693,
MaxPoseidonPaddings: 584300,
MaxMemAligns: 1022525,
MaxArithmetics: 1022525,
MaxBinaries: 2045051,
MaxSteps: 32720619,
MaxSHA256Hashes: 7269,
}
cfg = FinalizerCfg{
ForcedBatchesTimeout: cfgTypes.Duration{
Expand Down
21 changes: 20 additions & 1 deletion state/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,26 @@ func (s *State) GetBatchTimestamp(ctx context.Context, batchNumber uint64, force
return nil, err
}
if forkid >= FORKID_ETROG {
return virtualTimestamp, nil
// If the batch is not virtualized then we will return the timestamp of the last L2 block in the batch
// If the batch doesn't have L2 blocks we will return the timestamp from state.batch (time of batch creation)
if virtualTimestamp == nil {
l2Block, err := s.GetLastL2BlockByBatchNumber(ctx, batchNumber, dbTx)
if err != nil {
if errors.Is(err, pgx.ErrNoRows) {
return batchTimestamp, nil
}

return nil, err
}

if l2Block != nil {
return &l2Block.ReceivedAt, nil
}

return batchTimestamp, nil
} else {
return virtualTimestamp, nil
}
}
return batchTimestamp, nil
}
Expand Down
4 changes: 4 additions & 0 deletions state/forkid.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ const (
FORKID_ELDERBERRY = 8
// FORKID_9 is the fork id 9
FORKID_9 = 9
// FORKID_10 is the fork id 10
FORKID_10 = 10
// FORKID_11 is the fork id 11
FORKID_11 = 11
)

// ForkIDInterval is a fork id interval
Expand Down
6 changes: 5 additions & 1 deletion synchronizer/actions/forksids.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ const (
ForkIDElderberry = ForkIdType(8) //nolint:gomnd
// ForkID9 is the forkId for 9
ForkID9 = ForkIdType(9) //nolint:gomnd
// ForkID10 is the forkId for 10 (support more counters)
ForkID10 = ForkIdType(10) //nolint:gomnd
// ForkID11 is the forkId for 11 (support even more counters)
ForkID11 = ForkIdType(11) //nolint:gomnd
)

var (
Expand All @@ -22,7 +26,7 @@ var (
ForksIdAll = []ForkIdType{WildcardForkId}

// ForksIdOnlyElderberry support only elderberry forkId
ForksIdOnlyElderberry = []ForkIdType{ForkIDElderberry, ForkID9}
ForksIdOnlyElderberry = []ForkIdType{ForkIDElderberry, ForkID9, ForkID10, ForkID11}

// ForksIdOnlyEtrog support only etrog forkId
ForksIdOnlyEtrog = []ForkIdType{ForkIDEtrog}
Expand Down
Loading
Loading