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

Fetch upstream v0.6.4 #108

Merged
merged 59 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
0171536
check unsupported precompiles (#3264)
ToniRamirezM Feb 14, 2024
eb3ae9b
fix RPC closebatch executor error (#3272)
ToniRamirezM Feb 14, 2024
2d76f12
fix executor error closebatch (#3276)
joanestebanr Feb 14, 2024
20fa91f
add oog2 checks for all the oog cheks (#3277)
tclemos Feb 14, 2024
f968d8b
fix oog2 in internal gas estimation (#3280)
ToniRamirezM Feb 16, 2024
ca5a2c2
execution mode (#3285)
ToniRamirezM Feb 16, 2024
0a58f28
update prover image (#3286)
ToniRamirezM Feb 16, 2024
857be17
fix log when error on batch sanity check (#3287)
agnusmor Feb 16, 2024
5a1782f
update prover image to v4.0.13 (#3289)
agnusmor Feb 16, 2024
a7c9c71
update prover image (#3290)
ToniRamirezM Feb 17, 2024
3b25971
fix deltaTimestamp when debug tx (#3291)
tclemos Feb 17, 2024
bfe0166
fix checkStateInconsistency when starting sequencer (#3294)
agnusmor Feb 17, 2024
8cb1842
disable delete addrQueue if empty as a workaround (#3295)
agnusmor Feb 18, 2024
03a9291
add aggregator.BatchProofL1BlockConfirmations config parameter (#3302…
agnusmor Feb 20, 2024
e13c7ad
Feature remove executor errors (#3317)
ToniRamirezM Feb 20, 2024
5a5a642
support to elderberry fork (#3301)
joanestebanr Feb 20, 2024
fabe7ee
update prover image (#3322)
ToniRamirezM Feb 21, 2024
f0093b0
Get last l2 block in a batch by batch number (#3335)
ToniRamirezM Feb 21, 2024
c091cfb
add selector for trusted sync to prevent from executing from an old t…
joanestebanr Feb 21, 2024
a86d444
synchronizer adopt GetLastL2BlockByBatchNumber to check elderberry ts…
joanestebanr Feb 21, 2024
5c2fcff
reserved zk counters (#3343)
ToniRamirezM Feb 22, 2024
a039a0a
Add reserved zk counters to pool transactions (#3346)
ToniRamirezM Feb 22, 2024
d218fe2
Merge v0.5.13 into v0.6.0 (#3350)
tclemos Feb 22, 2024
b3a1b04
Update reserved counters with used in pool db during migration (#3352)
ToniRamirezM Feb 22, 2024
1bd33f5
fix initial sequenced batch event (#3347)
joanestebanr Feb 22, 2024
19c6694
Add executor reserved ZK counters (#3348)
agnusmor Feb 23, 2024
6aacee4
fix return on node OOC. Fix logs (#3359)
agnusmor Feb 23, 2024
54b7fcd
to decode ETROG processBatches use ETROG contract (#3360)
joanestebanr Feb 23, 2024
f08d413
Synchronized inform field state.batch.closing_reason from DB
joanestebanr Feb 26, 2024
92f191d
remove unnecessary eventlog call when processing unsigned txs (#3365)
tclemos Feb 26, 2024
3ab6d44
Fix batch 0 timestamp (#3364)
tclemos Feb 27, 2024
2b70cce
ignore forkid events from another rollup (#3383)
joanestebanr Feb 27, 2024
cd4c30c
Add l2block/interval metrics. Use timeoutCond when waiting for worker…
agnusmor Feb 27, 2024
fe1dacc
Feature/cherry pick 3370 3374 synchronizer, fix bugs, ReprocessFullBa…
joanestebanr Feb 27, 2024
4769da0
fix metrics cleanUp (#3385)
agnusmor Feb 27, 2024
f7f1809
fix check poseidonHashes exhausted (#3393)
agnusmor Feb 28, 2024
e0cd81e
remove execution mode (#3395)
ToniRamirezM Feb 28, 2024
4bd2089
fix metrics estimatedTxsPerSec (#3396)
agnusmor Feb 28, 2024
858edac
Fix metrics estimatedTxsPerSec division (#3398)
agnusmor Feb 29, 2024
f4f44b5
Get IM State root from receipt for data stream. (#3400)
ToniRamirezM Feb 29, 2024
f4dd705
Add gas per second estimation in metrics (#3401)
agnusmor Feb 29, 2024
2d93d42
Feature/cherry pick 3375 sync add check l2block hash (#3406)
joanestebanr Mar 1, 2024
fe9b257
update prover image to v5.0.3 (#3407)
agnusmor Mar 1, 2024
1365a55
keep empty RPC.SequencerNodeURI config parameter to get node URI from…
agnusmor Mar 7, 2024
2261ccc
add log0 debug trace e2e tests (#3422)
tclemos Mar 8, 2024
21491a8
Elderberry blockhash adjustments (#3424)
tclemos Mar 8, 2024
76cf00f
update prover to v5.0.6 (#3437)
ToniRamirezM Mar 8, 2024
b184e2b
use empty byte array instead of all zeros for receipt poststate (#3449)
tclemos Mar 11, 2024
393d47f
L1 Synchronization process check some L2Blocks from TrustedNode (#3445)
joanestebanr Mar 12, 2024
5361315
l1sync: if local batch is WIP need to be reprocess (#3443)
joanestebanr Mar 12, 2024
8ffd1dc
Synchronizer accept forkids that are the same as in database (#3452)
joanestebanr Mar 13, 2024
b65af69
remove unnecessary eventlog call when estimating tx gas (#3457)
tclemos Mar 15, 2024
6c76bf4
fix debug trace for injected tx (#3469) (#3473)
tclemos Mar 21, 2024
968568f
Add sanity-check on checkL1InfoTreeUpdate to check state L1 blockhash…
agnusmor Mar 25, 2024
bfaa130
support forkid 9 (#3496)
joanestebanr Mar 25, 2024
df539db
fix aggregator l1 info tree (#3490) (#3491) (#3484) (#3495)
ToniRamirezM Mar 25, 2024
c51440f
Merge tag 'v0.6.4' into feat/fetch-upstream-v0.6.4
Stefan-Ethernal Mar 25, 2024
d3a3930
Update the diff file
Stefan-Ethernal Mar 25, 2024
25fbb76
Align trace.go with the upstream
Stefan-Ethernal Mar 26, 2024
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
16 changes: 11 additions & 5 deletions aggregator/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ const (

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

forkId9 = uint64(9)
)

type finalProofMsg struct {
Expand Down Expand Up @@ -194,7 +196,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(a.cfg.ForkId) {
if !prover.SupportsForkID(forkId9) {
err := errors.New("prover does not support required fork ID")
log.Warn(FirstToUpper(err.Error()))
return err
Expand Down Expand Up @@ -1149,9 +1151,13 @@ func (a *Aggregator) buildInputProver(ctx context.Context, batchToVerify *state.
for _, l2blockRaw := range batchRawData.Blocks {
_, contained := l1InfoTreeData[l2blockRaw.IndexL1InfoTree]
if !contained && l2blockRaw.IndexL1InfoTree != 0 {
l1InfoTreeExitRootStorageEntry, err := a.State.GetL1InfoRootLeafByIndex(ctx, l2blockRaw.IndexL1InfoTree, nil)
if err != nil {
return nil, err
l1InfoTreeExitRootStorageEntry := state.L1InfoTreeExitRootStorageEntry{}
l1InfoTreeExitRootStorageEntry.Timestamp = time.Unix(0, 0)
if l2blockRaw.IndexL1InfoTree <= leaves[len(leaves)-1].L1InfoTreeIndex {
l1InfoTreeExitRootStorageEntry, err = a.State.GetL1InfoRootLeafByIndex(ctx, l2blockRaw.IndexL1InfoTree, nil)
if err != nil {
return nil, err
}
}

// Calculate smt proof
Expand Down Expand Up @@ -1204,7 +1210,7 @@ func (a *Aggregator) buildInputProver(ctx context.Context, batchToVerify *state.
OldAccInputHash: previousBatch.AccInputHash.Bytes(),
OldBatchNum: previousBatch.BatchNumber,
ChainId: a.cfg.ChainID,
ForkId: a.cfg.ForkId,
ForkId: forkId9,
BatchL2Data: batchToVerify.BatchL2Data,
L1InfoRoot: l1InfoRoot.Bytes(),
TimestampLimit: uint64(batchToVerify.Timestamp.Unix()),
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:v5.0.6
image: hermeznetwork/zkevm-prover:v6.0.0
depends_on:
zkevm-state-db:
condition: service_healthy
Expand Down
52,547 changes: 8,601 additions & 43,946 deletions docs/diff/diff.html

Large diffs are not rendered by default.

17 changes: 7 additions & 10 deletions l1infotree/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,13 @@ func (mt *L1InfoTree) ComputeMerkleProof(gerIndex uint32, leaves [][32]byte) ([]
if len(leaves)%2 == 1 {
leaves = append(leaves, mt.zeroHashes[h])
}
if index%2 == 1 { //If it is odd
siblings = append(siblings, leaves[index-1])
} else { // It is even
if len(leaves) > 1 {
if index >= uint32(len(leaves)) {
// siblings = append(siblings, mt.zeroHashes[h])
siblings = append(siblings, leaves[index-1])
} else {
siblings = append(siblings, leaves[index+1])
}
if index >= uint32(len(leaves)) {
siblings = append(siblings, mt.zeroHashes[h])
} else {
if index%2 == 1 { //If it is odd
siblings = append(siblings, leaves[index-1])
} else { // It is even
siblings = append(siblings, leaves[index+1])
}
}
var (
Expand Down
35 changes: 31 additions & 4 deletions sequencer/finalizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,19 @@ func (f *finalizer) updateFlushIDs(newPendingFlushID, newStoredFlushID uint64) {

func (f *finalizer) checkL1InfoTreeUpdate(ctx context.Context) {
firstL1InfoRootUpdate := true
skipFirstSleep := true

for {
if skipFirstSleep {
skipFirstSleep = false
} else {
time.Sleep(f.cfg.L1InfoTreeCheckInterval.Duration)
}

lastL1BlockNumber, err := f.etherman.GetLatestBlockNumber(ctx)
if err != nil {
log.Errorf("error getting latest L1 block number, error: %v", err)
continue
}

maxBlockNumber := uint64(0)
Expand All @@ -246,9 +254,30 @@ func (f *finalizer) checkL1InfoTreeUpdate(ctx context.Context) {
}

if firstL1InfoRootUpdate || l1InfoRoot.L1InfoTreeIndex > f.lastL1InfoTree.L1InfoTreeIndex {
firstL1InfoRootUpdate = false
log.Infof("received new L1InfoRoot, l1InfoTreeIndex: %d, l1InfoTreeRoot: %s, l1Block: %d",
l1InfoRoot.L1InfoTreeIndex, l1InfoRoot.L1InfoTreeRoot, l1InfoRoot.BlockNumber)

log.Debugf("received new L1InfoRoot. L1InfoTreeIndex: %d", l1InfoRoot.L1InfoTreeIndex)
// Sanity check l1BlockState (l1InfoRoot.BlockNumber) blockhash matches blockhash on ethereum. We skip it if l1InfoRoot.BlockNumber == 0 (empty tree)
if l1InfoRoot.BlockNumber > 0 {
l1BlockState, err := f.stateIntf.GetBlockByNumber(ctx, l1InfoRoot.BlockNumber, nil)
if err != nil {
log.Errorf("error getting L1 block %d from the state, error: %v", l1InfoRoot.BlockNumber, err)
continue
}

l1BlockEth, err := f.etherman.HeaderByNumber(ctx, new(big.Int).SetUint64(l1InfoRoot.BlockNumber))
if err != nil {
log.Errorf("error getting L1 block %d from ethereum, error: %v", l1InfoRoot.BlockNumber, err)
continue
}
if l1BlockState.BlockHash != l1BlockEth.Hash() {
log.Warnf("skipping use of l1InfoTreeIndex %d, L1 block %d blockhash %s doesn't match blockhash on ethereum %s (L1 reorg?)",
l1InfoRoot.L1InfoTreeIndex, l1InfoRoot.BlockNumber, l1BlockState.BlockHash, l1BlockEth.Hash())
continue
}
}

firstL1InfoRootUpdate = false

f.lastL1InfoTreeMux.Lock()
f.lastL1InfoTree = l1InfoRoot
Expand All @@ -261,8 +290,6 @@ func (f *finalizer) checkL1InfoTreeUpdate(ctx context.Context) {
f.lastL1InfoTreeCond.L.Unlock()
}
}

time.Sleep(f.cfg.L1InfoTreeCheckInterval.Duration)
}
}

Expand Down
1 change: 1 addition & 0 deletions sequencer/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type etherman interface {
TrustedSequencer() (common.Address, error)
GetLatestBatchNumber() (uint64, error)
GetLatestBlockNumber(ctx context.Context) (uint64, error)
HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
}

// stateInterface gathers the methods required to interact with the state.
Expand Down
33 changes: 33 additions & 0 deletions sequencer/mock_etherman.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions state/batchV2.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ func (s *State) sendBatchRequestToExecutorV2(ctx context.Context, batchRequest *
log.Warn(batchResponseToString)
s.eventLog.LogExecutorErrorV2(ctx, batchResponse.Error, batchRequest)
} else if batchResponse.ErrorRom != executor.RomError_ROM_ERROR_NO_ERROR && executor.IsROMOutOfCountersError(batchResponse.ErrorRom) {
err = executor.RomErr(batchResponse.ErrorRom)
log.Warnf("executor batch %d response, ROM OOC, error: %v", newBatchNum, err)
log.Warn(batchResponseToString)
} else if batchResponse.ErrorRom != executor.RomError_ROM_ERROR_NO_ERROR {
Expand Down
2 changes: 2 additions & 0 deletions state/forkid.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const (
FORKID_ETROG = 7
// FORKID_ELDERBERRY is the fork id 8
FORKID_ELDERBERRY = 8
// FORKID_9 is the fork id 9
FORKID_9 = 9
)

// ForkIDInterval is a fork id interval
Expand Down
Loading
Loading