Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/zkevm' into zkevm-2.60
Browse files Browse the repository at this point in the history
  • Loading branch information
cffls committed Aug 9, 2024
2 parents 7ae2c6d + 20b0712 commit e89c7e8
Show file tree
Hide file tree
Showing 56 changed files with 1,966 additions and 1,891 deletions.
21 changes: 9 additions & 12 deletions .github/workflows/ci_zkevm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: 0xPolygon/kurtosis-cdk
ref: main
ref: v0.2.4
path: kurtosis-cdk

- name: Install Kurtosis CDK tools
Expand All @@ -97,27 +97,23 @@ jobs:
working-directory: ./kurtosis-cdk
run: |
sed -i '/zkevm.sequencer-batch-seal-time:/d' templates/cdk-erigon/config.yml
sed -i '/zkevm.sequencer-non-empty-batch-seal-time:/d' templates/cdk-erigon/config.yml
- name: Configure Kurtosis CDK
working-directory: ./kurtosis-cdk
run: |
/usr/local/bin/yq -i '.args.data_availability_mode = "rollup"' cdk-erigon-sequencer-params.yml
/usr/local/bin/yq -i '.args.cdk_erigon_node_image = "cdk-erigon:local"' cdk-erigon-sequencer-params.yml
/usr/local/bin/yq -i '.args.zkevm_bridge_service_image = "hermeznetwork/zkevm-bridge-service:v0.5.0-RC8"' cdk-erigon-sequencer-params.yml
/usr/local/bin/yq -i '.args.data_availability_mode = "rollup"' params.yml
/usr/local/bin/yq -i '.args.cdk_erigon_node_image = "cdk-erigon:local"' params.yml
/usr/local/bin/yq -i '.args.zkevm_bridge_service_image = "hermeznetwork/zkevm-bridge-service:v0.5.0-RC8"' params.yml
- name: Deploy Kurtosis CDK package
working-directory: ./kurtosis-cdk
run: kurtosis run --enclave cdk-v1 --args-file cdk-erigon-sequencer-params.yml --image-download always .

- name: Override gas limit for test transactions
working-directory: ./kurtosis-cdk
run: |
sed -i 's/--gas-limit [0-9]*/--gas-limit 100000/gi' .github/actions/monitor-cdk-verified-batches/batch_verification_monitor.sh
run: kurtosis run --enclave cdk-v1 --args-file params.yml --image-download always .

- name: Monitor verified batches
working-directory: ./kurtosis-cdk
shell: bash
run: .github/actions/monitor-cdk-verified-batches/batch_verification_monitor.sh 20 900 cdk-erigon-node-001
run: timeout 900s .github/actions/monitor-cdk-verified-batches/batch_verification_monitor.sh 20 900 cdk-erigon-node-001

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
Expand Down Expand Up @@ -175,7 +171,8 @@ jobs:
kurtosis service logs cdk-v1 cdk-erigon-sequencer-001 --all > cdk-erigon-sequencer-001.log
kurtosis service logs cdk-v1 zkevm-agglayer-001 --all > zkevm-agglayer-001.log
kurtosis service logs cdk-v1 zkevm-prover-001 --all > zkevm-prover-001.log
kurtosis service logs cdk-v1 zkevm-executor-pless-001 --all > zkevm-executor-pless-001.log
kurtosis service logs cdk-v1 cdk-node-001 --all > cdk-node-001.log
kurtosis service logs cdk-v1 zkevm-bridge-service-001 --all > zkevm-bridge-service-001.log
- name: Upload logs
if: failure()
Expand Down
8 changes: 4 additions & 4 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,10 +521,10 @@ var (
Usage: "Batch seal time. Defaults to 12s",
Value: "12s",
}
SequencerNonEmptyBatchSealTime = cli.StringFlag{
Name: "zkevm.sequencer-non-empty-batch-seal-time",
Usage: "Batch seal time. Defaults to 3s",
Value: "3s",
SequencerBatchVerificationTimeout = cli.StringFlag{
Name: "zkevm.sequencer-batch-verification-timeout",
Usage: "This is a maximum time that a batch verification could take. Including retries. This could be interpreted as maximum that that the sequencer can run without executor. Setting it to 0s will mean infinite timeout. Defaults to 30min",
Value: "30m",
}
SequencerHaltOnBatchNumber = cli.Uint64Flag{
Name: "zkevm.sequencer-halt-on-batch-number",
Expand Down
31 changes: 0 additions & 31 deletions core/blockchain_zkevm.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,37 +298,6 @@ func PrepareBlockTxExecution(
return &blockContextImpl, excessDataGas, &blockGer, &blockL1BlockHash, nil
}

func FinalizeBlockExecutionWithHistoryWrite(
engine consensus.Engine, stateReader state.StateReader,
header *types.Header, txs types.Transactions, uncles []*types.Header,
stateWriter state.WriterWithChangeSets, cc *chain.Config,
ibs *state.IntraBlockState, receipts types.Receipts,
withdrawals []*types.Withdrawal, chainReader consensus.ChainReader,
isMining bool, excessBlobGas *uint64,
) (newBlock *types.Block, newTxs types.Transactions, newReceipt types.Receipts, err error) {
newBlock, newTxs, newReceipt, err = FinalizeBlockExecution(
engine,
stateReader,
header,
txs,
uncles,
stateWriter,
cc,
ibs,
receipts,
withdrawals,
chainReader,
isMining,
log.New(),
)

if err := stateWriter.WriteHistory(); err != nil {
return nil, nil, nil, fmt.Errorf("writing history for block %d failed: %w", header.Number.Uint64(), err)
}

return newBlock, newTxs, newReceipt, nil
}

func CreateReceiptForBlockInfoTree(receipt *types.Receipt, chainConfig *chain.Config, blockNum uint64, execResult *ExecutionResult) *types.Receipt {
// [hack]TODO: remove this after bug is fixed
localReceipt := receipt.Clone()
Expand Down
2 changes: 1 addition & 1 deletion core/vm/zk_batch_counters.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func (bcc *BatchCounterCollector) CombineCollectors(verifyMerkleProof bool) (Cou
// rlp level counters and execution level counters
// this one returns the counters as they are so far, without adding processBatchLevelData, processChangeL2Block and decodeChangeL2BlockTx
// used to save batch counter progress without adding the said counters twice
func (bcc *BatchCounterCollector) CombineCollectorsNoChanges(verifyMerkleProof bool) Counters {
func (bcc *BatchCounterCollector) CombineCollectorsNoChanges() Counters {
// combine all the counters we have so far

// if we have external coutners use them, otherwise create new
Expand Down
32 changes: 23 additions & 9 deletions erigon-lib/chain/chain_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ import (
// this needs to always be in descending order
// add new forkIds at the beginning of the array
var ForkIdsOrdered = []ForkId{
ForkID12Banana,
ForkID11,
ForkID10,
ForkID9Elderberry2,
ForkID8Elderberry,
ForkID7Etrog,
Expand Down Expand Up @@ -109,6 +112,8 @@ type Config struct {
ForkID7EtrogBlock *big.Int `json:"forkID7EtrogBlock,omitempty"`
ForkID88ElderberryBlock *big.Int `json:"forkID88ElderberryBlock,omitempty"`
ForkID9Elderberry2Block *big.Int `json:"forkID9FeijoaBlock,omitempty"`
ForkID10 *big.Int `json:"forkID10,omitempty"`
ForkID11 *big.Int `json:"forkID11,omitempty"`
ForkID12BananaBlock *big.Int `json:"forkID12BananaBlock,omitempty"`
NormalcyBlock *big.Int `json:"normalcyBlock,omitempty"`

Expand Down Expand Up @@ -358,6 +363,12 @@ func (c *Config) IsForkID8Elderberry(num uint64) bool {
func (c *Config) IsForkId9Elderberry2(num uint64) bool {
return isForked(c.ForkID9Elderberry2Block, num)
}
func (c *Config) IsForkID10(num uint64) bool {
return isForked(c.ForkID10, num)
}
func (c *Config) IsForkID11(num uint64) bool {
return isForked(c.ForkID11, num)
}

func (c *Config) IsForkID12Banana(num uint64) bool {
return isForked(c.ForkID12BananaBlock, num)
Expand Down Expand Up @@ -600,15 +611,15 @@ func borKeyValueConfigHelper[T uint64 | common.Address](field map[string]T, numb
// Rules is a one time interface meaning that it shouldn't be used in between transition
// phases.
type Rules struct {
ChainID *big.Int
IsHomestead, IsTangerineWhistle, IsSpuriousDragon bool
IsByzantium, IsConstantinople, IsPetersburg bool
IsIstanbul, IsBerlin, IsLondon, IsShanghai bool
IsCancun, IsNapoli bool
IsPrague, isOsaka bool
IsAura bool
IsNormalcy bool
IsForkID4, IsForkID5Dragonfruit, IsForkID6IncaBerry, IsForkID7Etrog, IsForkID8Elderberry bool
ChainID *big.Int
IsHomestead, IsTangerineWhistle, IsSpuriousDragon bool
IsByzantium, IsConstantinople, IsPetersburg bool
IsIstanbul, IsBerlin, IsLondon, IsShanghai bool
IsCancun, IsNapoli bool
IsPrague, isOsaka bool
IsAura bool
IsNormalcy bool
IsForkID4, IsForkID5Dragonfruit, IsForkID6IncaBerry, IsForkID7Etrog, IsForkID8Elderberry, IsForkId10, IsForkId11, IsForkID12Banana bool
}

// Rules ensures c's ChainID is not nil and returns a new Rules instance
Expand Down Expand Up @@ -641,6 +652,9 @@ func (c *Config) Rules(num uint64, time uint64) *Rules {
IsForkID6IncaBerry: c.IsForkID6IncaBerry(num),
IsForkID7Etrog: c.IsForkID7Etrog(num),
IsForkID8Elderberry: c.IsForkID8Elderberry(num),
IsForkId10: c.IsForkID10(num),
IsForkId11: c.IsForkID11(num),
IsForkID12Banana: c.IsForkID12Banana(num),
}
}

Expand Down
19 changes: 10 additions & 9 deletions erigon-lib/chain/zk_constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package chain
type ForkId uint64

const (
ForkID4 ForkId = 4
ForkID5Dragonfruit ForkId = 5
ForkID6IncaBerry ForkId = 6
ForkID7Etrog ForkId = 7
ForkID8Elderberry ForkId = 8
ForkID9Elderberry2 ForkId = 9
ForkID10 ForkId = 10
ForkID11 ForkId = 11
ForkID12Banana ForkId = 12
_ = iota
ForkID4 ForkId = iota + 3
ForkID5Dragonfruit
ForkID6IncaBerry
ForkID7Etrog
ForkID8Elderberry
ForkID9Elderberry2
ForkID10
ForkID11
ForkID12Banana
)
Loading

0 comments on commit e89c7e8

Please sign in to comment.