Skip to content

refactor(sc): split contract CommitBatch and UpdateState calls#640

Merged
x-mass merged 1 commit into
mainfrom
split-rollup-contract-methods
Apr 1, 2025
Merged

refactor(sc): split contract CommitBatch and UpdateState calls#640
x-mass merged 1 commit into
mainfrom
split-rollup-contract-methods

Conversation

@x-mass
Copy link
Copy Markdown
Contributor

@x-mass x-mass commented Mar 24, 2025

  • Refactored CommitBatch and UpdateState methods:

    • CommitBatch now called in the aggregator service just before creating proof tasks. Transaction creation is skipped if a batch with the same ID has already been submitted.
    • UpdateState is still called in the proposer service after it mentions there is a new state to be proposed.
    • UpdateState now retrieves the CommitBatch transaction for the specified batch ID from L1 and extracts blob data.
    • Instead of returning etherium transaction methods wait for transaction for being included into block.
  • Improved error handling and configuration:

    • Proposer now handles ErrBatchAlreadyFinalized by refreshing the last proved state root from L1 if local tasks state is out of sync.
    • Introduced a dummy structure mode for the EthClient when the DisableL1 config option is set, which logs calls without returning errors.
  • Optimized contract and client interactions:

    • Shared the contract wrapper between Aggregator and Proposer to streamline interactions.
    • Encapsulated retry logic within the EthClient, which now acts as a wrapper around go-ethereum/ethclient.
  • Extended testing and utilities:

    • Migrated contract mocker to the testaide package for broader reuse in tests.
    • Added new tests for both the proposer and the wrapper to ensure robustness.

Comment thread nil/services/synccommittee/internal/testaide/contract.go Outdated
Comment thread nil/services/synccommittee/core/service.go
Comment thread nil/services/synccommittee/internal/rollupcontract/eth_client.go
Comment thread nil/services/synccommittee/internal/rollupcontract/wrapper.go Outdated
@akokoshn akokoshn requested a review from zadykian March 26, 2025 07:21
Comment thread nil/services/synccommittee/core/proposer.go
Comment thread nil/services/synccommittee/internal/rollupcontract/update_state.go Outdated
Comment thread nil/services/synccommittee/core/proposer.go Outdated
Comment thread nil/services/synccommittee/core/proposer.go Outdated
Comment thread nil/services/synccommittee/core/proposer.go Outdated
Comment thread nil/services/synccommittee/internal/rollupcontract/wrapper.go Outdated
- Refactored CommitBatch and UpdateState methods:
  - CommitBatch now called in the aggregator service just before creating proof tasks. Transaction creation is skipped if a batch with the same ID has already been submitted.
  - UpdateState is still called in the proposer service after it mentions there is a new state to be proposed.
  - UpdateState now retrieves the CommitBatch transaction for the specified batch ID from L1 and extracts blob data.
  - Instead of returning etherium transaction methods wait for transaction for being included into block.
  - Transactions field of BlockBatch is replaced with DataProofs to be used during UpdateState call.

- Improved error handling and configuration:
  - Proposer now handles `ErrBatchAlreadyFinalized` by refreshing the last proved state root from L1 if local tasks state is out of sync.
  - Introduced a dummy structure mode for the EthClient when the DisableL1 config option is set, which logs calls without returning errors.

- Optimized contract and client interactions:
  - Shared the contract wrapper between Aggregator and Proposer to streamline interactions.
  - Encapsulated retry logic within the EthClient, which now acts as a wrapper around go-ethereum/ethclient.

- Extended testing and utilities:
  - Migrated contract mocker to the testaide package for broader reuse in tests.
  - Added new tests for both the proposer and the wrapper to ensure robustness.
@x-mass x-mass force-pushed the split-rollup-contract-methods branch from 377fd5f to 00c0fb1 Compare April 1, 2025 14:37
@x-mass x-mass added this pull request to the merge queue Apr 1, 2025
Merged via the queue into main with commit 124f216 Apr 1, 2025
@x-mass x-mass deleted the split-rollup-contract-methods branch April 1, 2025 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants