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

synchronizer: fix bug closing a batch when sync from L1 #3443

Merged
merged 1 commit into from
Mar 12, 2024

Conversation

joanestebanr
Copy link
Contributor

Closes #3441

What does this PR do?

If a batch is open in local DB it's reprocessed

Reviewers

Main reviewers:

Codeowner reviewers:

  • @-Alice
  • @-Bob

@joanestebanr joanestebanr changed the base branch from develop to release/v0.6.2 March 11, 2024 12:06
@joanestebanr joanestebanr added this to the v0.6.3 milestone Mar 12, 2024
@joanestebanr joanestebanr changed the base branch from release/v0.6.2 to release/v0.6.3 March 12, 2024 12:18
@joanestebanr joanestebanr merged commit 5361315 into release/v0.6.3 Mar 12, 2024
2 checks passed
@joanestebanr joanestebanr deleted the 3441-sync-l1_sync_close_batch branch March 12, 2024 12:56
joanestebanr added a commit that referenced this pull request Mar 19, 2024
@joanestebanr joanestebanr added the cherry-picked Content has been cherry-picked into a higher version branch label Mar 19, 2024
joanestebanr added a commit that referenced this pull request Mar 19, 2024
Stefan-Ethernal added a commit to 0xPolygon/cdk-validium-node that referenced this pull request Mar 25, 2024
* check unsupported precompiles  (0xPolygonHermez#3264)

* check unsupported precompiles

* downgrade prover

* restore solc version

* update SC

* new errors

* fix as workaround to close batch on tx oog (0xPolygonHermez#3271)

Co-authored-by: agnusmor <agnusmor@gmail.com>

* handle executor close batch

* added sanity check closing an empty batch

* change log

---------

Co-authored-by: agnusmor <agnusmor@gmail.com>

* fix RPC closebatch executor error (0xPolygonHermez#3272)

* fix RPC closebatch executor error

* fix close batch

* fix close batch

* fix close batch

* fix close batch

* fix close batch

---------

Co-authored-by: agnusmor <agnusmor@gmail.com>

* fix executor error closebatch (0xPolygonHermez#3276)

* fix executor error closebatch

* fix linter

---------

Co-authored-by: agnusmor <agnusmor@gmail.com>

* add oog2 checks for all the oog cheks (0xPolygonHermez#3277)

* fix oog2 in internal gas estimation (0xPolygonHermez#3280)

* fix oog2

* fix oog2 for estimateGas

---------

Co-authored-by: tclemos <thiago@polygon.technology>

* execution mode (0xPolygonHermez#3285)

* execution mode

* execution mode

* execution mode

* update prover image (0xPolygonHermez#3286)

* fix log when error on batch sanity check (0xPolygonHermez#3287)

* update prover image to v4.0.13 (0xPolygonHermez#3289)

* update prover image (0xPolygonHermez#3290)

* fix deltaTimestamp when debug tx (0xPolygonHermez#3291)

* fix deltaTimestamp when debug tx

* fix deltaTimeStamp for unsigned txs execution for specific block

* fix deltaTimeStamp for unsigned txs execution for specific block

* Revert "fix deltaTimeStamp for unsigned txs execution for specific block"

This reverts commit eb77e04.

* Revert "fix deltaTimeStamp for unsigned txs execution for specific block"

This reverts commit d2cfa78.

* fix debug trace l1 info tree index and add l1 info tree data

* move MockL1InfoRoot from sequencer to state to allow multiple components to use the same value

---------

Co-authored-by: agnusmor <agnusmor@gmail.com>

* fix checkStateInconsistency when starting sequencer (0xPolygonHermez#3294)

* disable delete addrQueue if empty as a workaround (0xPolygonHermez#3295)

* add aggregator.BatchProofL1BlockConfirmations config parameter (0xPolygonHermez#3302) (0xPolygonHermez#3313)

* Feature remove executor errors (0xPolygonHermez#3317)

* remove executor errors

* readd check

* support to elderberry fork (0xPolygonHermez#3301)

* add new sequenceBatches parameters
* update SMC Elderberry, contract dockers and genesis
* elderberry seq-sender (0xPolygonHermez#3312)
* elderberry seq-sender
* updated prover  image to v5.0.0-RC4
* increase timeout  to e2e-group7

---------

Co-authored-by: Toni Ramírez <58293609+ToniRamirezM@users.noreply.github.com>
Co-authored-by: dPunisher <dpunish3r@users.noreply.github.com>

* update prover image (0xPolygonHermez#3322)

* update prover image

* udpate prover docker memory limits

* downgrade prover

* upgrade prover

* Get last l2 block in a batch by batch number (0xPolygonHermez#3335)

* last l2 block by batch number

* optimization

* change returned err in query

* add selector for trusted sync to prevent from executing from an old trusted node  (0xPolygonHermez#3336)

* add selector for trusted sync to check that batches  correspond to the supported forkids

* synchronizer adopt GetLastL2BlockByBatchNumber to check elderberry tstamp baches (0xPolygonHermez#3340)

* synchronizer adopt GetLastL2BlockByBatchNumber to check elderberry bacthes tstamp

* reserved zk counters (0xPolygonHermez#3343)

* reserved zk counters

* new prover image

* udpate counters names

* udpate counters names

* add gas used to reserved zkCounters

* add ReservedZKCounters to pool trasactions

* Add reserved zk counters to pool transactions (0xPolygonHermez#3346)

* add reserved zk counters to pool transaction

* add reserved zk counters to pool transaction

* correct migration test

* Merge v0.5.13 into v0.6.0 (0xPolygonHermez#3350)

* Update reserved counters with used in pool db during migration (0xPolygonHermez#3352)

* return used if reserved counters are 0

* refactor

* refactor

* fix initial sequenced batch event (0xPolygonHermez#3347)

* fix initial sequenced batch event

* Add executor reserved ZK counters (0xPolygonHermez#3348)

* add executor reserved ZK counters

* update prover image to v5.0.0-RC6

* fix typos

* add check reserved counters when executing L2 block

* remove closeBatch

* update prover image v5.0.0-RC7

* fixes and logs improvements

* update prover image v5.0.0-RC8

* fix return on node OOC. Fix logs (0xPolygonHermez#3359)

* to decode ETROG processBatches use ETROG contract (0xPolygonHermez#3360)

* decode old ETROG processBatches use ETROG contract
* fix sanity genesis

* Synchronized inform field state.batch.closing_reason from DB

* Add reasons to the field `state.batch.closing_reason` (issue 0xPolygonHermez#3243)

* remove unnecessary eventlog call when processing unsigned txs (0xPolygonHermez#3365)

* Fix batch 0 timestamp (0xPolygonHermez#3364)

* ignore forkid events from another rollup (0xPolygonHermez#3383)

* Add l2block/interval metrics. Use timeoutCond when waiting for worker readyTxs (0xPolygonHermez#3380)

* Feature/cherry pick 3370 3374 synchronizer, fix bugs, ReprocessFullBatchOnClose and AcceptEmptyClosedBatches (0xPolygonHermez#3384)

* synchronizer accepts empty closed batches from trusted depending on config (0xPolygonHermez#3370)

* accept empty closed batches depending on config
* if trusted synchronization dont create L2 sync classes

* sync reprocess full batch on close, check GER, and fix minor bugs (0xPolygonHermez#3374)

* sync reprocess full batch on close
* reduce the of live of batch cache from 1hour to 5min
* fix reprocess, check virtualBatch before reseting state
* 0xPolygonHermez#3376 - check GlobalExitRoot before working on a batch
* update same data as updateWIPBatch do in the cache of batches

* set Synchronizer.L2Synchronization.ReprocessFullBatchOnClose to false

* update documentation

* fix metrics cleanUp (0xPolygonHermez#3385)

* fix check poseidonHashes exhausted (0xPolygonHermez#3393)

* remove execution mode (0xPolygonHermez#3395)

* fix metrics estimatedTxsPerSec (0xPolygonHermez#3396)

* Fix metrics estimatedTxsPerSec division (0xPolygonHermez#3398)

* fix metrics estimatedTxsPerSec div

* remove unneeded cast

* Get IM State root from receipt for data stream. (0xPolygonHermez#3400)

* get im state root from receipt

* get im state root from receipt

* get im state root from receipt

* Add gas per second estimation in metrics (0xPolygonHermez#3401)

* add gas estimation in metrics

* fix linter

* Feature/cherry pick 3375 sync add check l2block hash (0xPolygonHermez#3406)

* check L2Block hash on closed batch during sync from TrustedNode (0xPolygonHermez#3390)

* update prover image to v5.0.3 (0xPolygonHermez#3407)

* keep empty RPC.SequencerNodeURI config parameter to get node URI from the SC (0xPolygonHermez#3430)

* add log0 debug trace e2e tests (0xPolygonHermez#3422)

* add log0 debug trace e2e tests

* add log0 debug trace e2e tests

* Elderberry blockhash adjustments (0xPolygonHermez#3424)

* remove intermediate state root from receipts after Etrog

* use receipt state returned by executor instead of checking the RomError

* use receipt status from executor only after Etrog

* fix gasLimit and cumulativeGasUsed for Elderberry txs (0xPolygonHermez#3428)

* keep im state root in db (0xPolygonHermez#3427)

* generate receipt refactor (0xPolygonHermez#3436)

* generate receipt refactor

* update prover image

* downgrade prover image

---------

Co-authored-by: agnusmor <100322135+agnusmor@users.noreply.github.com>
Co-authored-by: Toni Ramírez <58293609+ToniRamirezM@users.noreply.github.com>

* update prover to v5.0.6 (0xPolygonHermez#3437)

* remove intermediate state root from receipts after Etrog

* use receipt state returned by executor instead of checking the RomError

* use receipt status from executor only after Etrog

* fix gasLimit and cumulativeGasUsed for Elderberry txs (0xPolygonHermez#3428)

* keep im state root in db (0xPolygonHermez#3427)

* generate receipt refactor (0xPolygonHermez#3436)

* generate receipt refactor

* update prover image

* downgrade prover image

* update prover

* adapt test

* undo adapt test

* upgrade prover

---------

Co-authored-by: tclemos <thiago@polygon.technology>
Co-authored-by: agnusmor <100322135+agnusmor@users.noreply.github.com>

* use empty byte array instead of all zeros for receipt poststate (0xPolygonHermez#3449)

* L1 Synchronization process check some L2Blocks from TrustedNode (0xPolygonHermez#3445)

* L1 Synchronization process check some L2Blocks from TrustedNode

* l1sync: if local batch is WIP need to be reprocess (0xPolygonHermez#3443)

* Synchronizer accept forkids that are the same as in database (0xPolygonHermez#3452)

* 0xPolygonHermez#3451 accept same forkid from L1
* if same forkid recived and is the last one and same FromBatchNumber update blockNumber

* remove unnecessary eventlog call when estimating tx gas (0xPolygonHermez#3457)

* Update diff

---------

Co-authored-by: Toni Ramírez <58293609+ToniRamirezM@users.noreply.github.com>
Co-authored-by: agnusmor <agnusmor@gmail.com>
Co-authored-by: Joan Esteban <129153821+joanestebanr@users.noreply.github.com>
Co-authored-by: Thiago Coimbra Lemos <tclemos@users.noreply.github.com>
Co-authored-by: tclemos <thiago@polygon.technology>
Co-authored-by: agnusmor <100322135+agnusmor@users.noreply.github.com>
Co-authored-by: dPunisher <dpunish3r@users.noreply.github.com>
Stefan-Ethernal added a commit to 0xPolygon/cdk-validium-node that referenced this pull request Mar 26, 2024
* check unsupported precompiles  (0xPolygonHermez#3264)

* check unsupported precompiles

* downgrade prover

* restore solc version

* update SC

* new errors

* fix as workaround to close batch on tx oog (0xPolygonHermez#3271)

Co-authored-by: agnusmor <agnusmor@gmail.com>

* handle executor close batch

* added sanity check closing an empty batch

* change log

---------

Co-authored-by: agnusmor <agnusmor@gmail.com>

* fix RPC closebatch executor error (0xPolygonHermez#3272)

* fix RPC closebatch executor error

* fix close batch

* fix close batch

* fix close batch

* fix close batch

* fix close batch

---------

Co-authored-by: agnusmor <agnusmor@gmail.com>

* fix executor error closebatch (0xPolygonHermez#3276)

* fix executor error closebatch

* fix linter

---------

Co-authored-by: agnusmor <agnusmor@gmail.com>

* add oog2 checks for all the oog cheks (0xPolygonHermez#3277)

* fix oog2 in internal gas estimation (0xPolygonHermez#3280)

* fix oog2

* fix oog2 for estimateGas

---------

Co-authored-by: tclemos <thiago@polygon.technology>

* execution mode (0xPolygonHermez#3285)

* execution mode

* execution mode

* execution mode

* update prover image (0xPolygonHermez#3286)

* fix log when error on batch sanity check (0xPolygonHermez#3287)

* update prover image to v4.0.13 (0xPolygonHermez#3289)

* update prover image (0xPolygonHermez#3290)

* fix deltaTimestamp when debug tx (0xPolygonHermez#3291)

* fix deltaTimestamp when debug tx

* fix deltaTimeStamp for unsigned txs execution for specific block

* fix deltaTimeStamp for unsigned txs execution for specific block

* Revert "fix deltaTimeStamp for unsigned txs execution for specific block"

This reverts commit eb77e04.

* Revert "fix deltaTimeStamp for unsigned txs execution for specific block"

This reverts commit d2cfa78.

* fix debug trace l1 info tree index and add l1 info tree data

* move MockL1InfoRoot from sequencer to state to allow multiple components to use the same value

---------

Co-authored-by: agnusmor <agnusmor@gmail.com>

* fix checkStateInconsistency when starting sequencer (0xPolygonHermez#3294)

* disable delete addrQueue if empty as a workaround (0xPolygonHermez#3295)

* add aggregator.BatchProofL1BlockConfirmations config parameter (0xPolygonHermez#3302) (0xPolygonHermez#3313)

* Feature remove executor errors (0xPolygonHermez#3317)

* remove executor errors

* readd check

* support to elderberry fork (0xPolygonHermez#3301)

* add new sequenceBatches parameters
* update SMC Elderberry, contract dockers and genesis
* elderberry seq-sender (0xPolygonHermez#3312)
* elderberry seq-sender
* updated prover  image to v5.0.0-RC4
* increase timeout  to e2e-group7

---------

Co-authored-by: Toni Ramírez <58293609+ToniRamirezM@users.noreply.github.com>
Co-authored-by: dPunisher <dpunish3r@users.noreply.github.com>

* update prover image (0xPolygonHermez#3322)

* update prover image

* udpate prover docker memory limits

* downgrade prover

* upgrade prover

* Get last l2 block in a batch by batch number (0xPolygonHermez#3335)

* last l2 block by batch number

* optimization

* change returned err in query

* add selector for trusted sync to prevent from executing from an old trusted node  (0xPolygonHermez#3336)

* add selector for trusted sync to check that batches  correspond to the supported forkids

* synchronizer adopt GetLastL2BlockByBatchNumber to check elderberry tstamp baches (0xPolygonHermez#3340)

* synchronizer adopt GetLastL2BlockByBatchNumber to check elderberry bacthes tstamp

* reserved zk counters (0xPolygonHermez#3343)

* reserved zk counters

* new prover image

* udpate counters names

* udpate counters names

* add gas used to reserved zkCounters

* add ReservedZKCounters to pool trasactions

* Add reserved zk counters to pool transactions (0xPolygonHermez#3346)

* add reserved zk counters to pool transaction

* add reserved zk counters to pool transaction

* correct migration test

* Merge v0.5.13 into v0.6.0 (0xPolygonHermez#3350)

* Update reserved counters with used in pool db during migration (0xPolygonHermez#3352)

* return used if reserved counters are 0

* refactor

* refactor

* fix initial sequenced batch event (0xPolygonHermez#3347)

* fix initial sequenced batch event

* Add executor reserved ZK counters (0xPolygonHermez#3348)

* add executor reserved ZK counters

* update prover image to v5.0.0-RC6

* fix typos

* add check reserved counters when executing L2 block

* remove closeBatch

* update prover image v5.0.0-RC7

* fixes and logs improvements

* update prover image v5.0.0-RC8

* fix return on node OOC. Fix logs (0xPolygonHermez#3359)

* to decode ETROG processBatches use ETROG contract (0xPolygonHermez#3360)

* decode old ETROG processBatches use ETROG contract
* fix sanity genesis

* Synchronized inform field state.batch.closing_reason from DB

* Add reasons to the field `state.batch.closing_reason` (issue 0xPolygonHermez#3243)

* remove unnecessary eventlog call when processing unsigned txs (0xPolygonHermez#3365)

* Fix batch 0 timestamp (0xPolygonHermez#3364)

* ignore forkid events from another rollup (0xPolygonHermez#3383)

* Add l2block/interval metrics. Use timeoutCond when waiting for worker readyTxs (0xPolygonHermez#3380)

* Feature/cherry pick 3370 3374 synchronizer, fix bugs, ReprocessFullBatchOnClose and AcceptEmptyClosedBatches (0xPolygonHermez#3384)

* synchronizer accepts empty closed batches from trusted depending on config (0xPolygonHermez#3370)

* accept empty closed batches depending on config
* if trusted synchronization dont create L2 sync classes

* sync reprocess full batch on close, check GER, and fix minor bugs (0xPolygonHermez#3374)

* sync reprocess full batch on close
* reduce the of live of batch cache from 1hour to 5min
* fix reprocess, check virtualBatch before reseting state
* 0xPolygonHermez#3376 - check GlobalExitRoot before working on a batch
* update same data as updateWIPBatch do in the cache of batches

* set Synchronizer.L2Synchronization.ReprocessFullBatchOnClose to false

* update documentation

* fix metrics cleanUp (0xPolygonHermez#3385)

* fix check poseidonHashes exhausted (0xPolygonHermez#3393)

* remove execution mode (0xPolygonHermez#3395)

* fix metrics estimatedTxsPerSec (0xPolygonHermez#3396)

* Fix metrics estimatedTxsPerSec division (0xPolygonHermez#3398)

* fix metrics estimatedTxsPerSec div

* remove unneeded cast

* Get IM State root from receipt for data stream. (0xPolygonHermez#3400)

* get im state root from receipt

* get im state root from receipt

* get im state root from receipt

* Add gas per second estimation in metrics (0xPolygonHermez#3401)

* add gas estimation in metrics

* fix linter

* Feature/cherry pick 3375 sync add check l2block hash (0xPolygonHermez#3406)

* check L2Block hash on closed batch during sync from TrustedNode (0xPolygonHermez#3390)

* update prover image to v5.0.3 (0xPolygonHermez#3407)

* keep empty RPC.SequencerNodeURI config parameter to get node URI from the SC (0xPolygonHermez#3430)

* add log0 debug trace e2e tests (0xPolygonHermez#3422)

* add log0 debug trace e2e tests

* add log0 debug trace e2e tests

* Elderberry blockhash adjustments (0xPolygonHermez#3424)

* remove intermediate state root from receipts after Etrog

* use receipt state returned by executor instead of checking the RomError

* use receipt status from executor only after Etrog

* fix gasLimit and cumulativeGasUsed for Elderberry txs (0xPolygonHermez#3428)

* keep im state root in db (0xPolygonHermez#3427)

* generate receipt refactor (0xPolygonHermez#3436)

* generate receipt refactor

* update prover image

* downgrade prover image

---------

Co-authored-by: agnusmor <100322135+agnusmor@users.noreply.github.com>
Co-authored-by: Toni Ramírez <58293609+ToniRamirezM@users.noreply.github.com>

* update prover to v5.0.6 (0xPolygonHermez#3437)

* remove intermediate state root from receipts after Etrog

* use receipt state returned by executor instead of checking the RomError

* use receipt status from executor only after Etrog

* fix gasLimit and cumulativeGasUsed for Elderberry txs (0xPolygonHermez#3428)

* keep im state root in db (0xPolygonHermez#3427)

* generate receipt refactor (0xPolygonHermez#3436)

* generate receipt refactor

* update prover image

* downgrade prover image

* update prover

* adapt test

* undo adapt test

* upgrade prover

---------

Co-authored-by: tclemos <thiago@polygon.technology>
Co-authored-by: agnusmor <100322135+agnusmor@users.noreply.github.com>

* use empty byte array instead of all zeros for receipt poststate (0xPolygonHermez#3449)

* L1 Synchronization process check some L2Blocks from TrustedNode (0xPolygonHermez#3445)

* L1 Synchronization process check some L2Blocks from TrustedNode

* l1sync: if local batch is WIP need to be reprocess (0xPolygonHermez#3443)

* Synchronizer accept forkids that are the same as in database (0xPolygonHermez#3452)

* 0xPolygonHermez#3451 accept same forkid from L1
* if same forkid recived and is the last one and same FromBatchNumber update blockNumber

* remove unnecessary eventlog call when estimating tx gas (0xPolygonHermez#3457)

* fix debug trace for injected tx (0xPolygonHermez#3469) (0xPolygonHermez#3473)

* Add sanity-check on checkL1InfoTreeUpdate to check state L1 blockhash matches ethereum blockhash (L1 reorg check) (0xPolygonHermez#3480)

* Add sanity check on checkL1InfoTreeUpdate to check state L1 blockhash matches ethereum blockhash (L1 reorg check)

* fix L1 block is 0 (empty l1infotree)

* Update Prover image to v5.0.9

* support forkid 9 (0xPolygonHermez#3496)

* fix aggregator l1 info tree (0xPolygonHermez#3490) (0xPolygonHermez#3491) (0xPolygonHermez#3484)  (0xPolygonHermez#3495)

* fix aggregator l1 info tree (0xPolygonHermez#3491)

* fix aggregator l1 info tree

* Fix case you want to proof a 0 (0xPolygonHermez#3492)

* Fix case you want to proof a 0

* init timestamp

---------

Co-authored-by: Toni Ramírez <toni@polygon.technology>

* force forkid 9

* update prover

---------

Co-authored-by: Jordi Baylina <jordi@baylina.cat>
Co-authored-by: agnusmor <agnusmor@gmail.com>

* fix debug trace receipt index (0xPolygonHermez#3490)

* conflicts

* fix ooc

* fix tx index calculation on receipt (0xPolygonHermez#3488)

* remove 3495

---------

Co-authored-by: Jordi Baylina <jordi@baylina.cat>
Co-authored-by: agnusmor <agnusmor@gmail.com>

* Update the diff file

* Align trace.go with the upstream

---------

Co-authored-by: Toni Ramírez <58293609+ToniRamirezM@users.noreply.github.com>
Co-authored-by: agnusmor <agnusmor@gmail.com>
Co-authored-by: Joan Esteban <129153821+joanestebanr@users.noreply.github.com>
Co-authored-by: Thiago Coimbra Lemos <tclemos@users.noreply.github.com>
Co-authored-by: tclemos <thiago@polygon.technology>
Co-authored-by: agnusmor <100322135+agnusmor@users.noreply.github.com>
Co-authored-by: dPunisher <dpunish3r@users.noreply.github.com>
Co-authored-by: Jordi Baylina <jordi@baylina.cat>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cherry-picked Content has been cherry-picked into a higher version branch cla-signed synchronizer zkevm-bridge-sync-rpc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

synchronizer: L1 synchronization fails to close a batch that only differ in that
2 participants