Skip to content

op-supervisor: head pointers, refactor block processor#12031

Merged
axelKingsley merged 2 commits intodevelopfrom
supervisor-head-pointers
Sep 25, 2024
Merged

op-supervisor: head pointers, refactor block processor#12031
axelKingsley merged 2 commits intodevelopfrom
supervisor-head-pointers

Conversation

@protolambda
Copy link
Copy Markdown
Contributor

Description

Experimental draft of head block pointers instead of raw indices, and fixes of the x-head maintainer to use said block pointers.

Also includes an updated block-processor (the receipts fetcher), to be more asynchronous. I might split that out into a separate PR, TBD.

Tests

Work in progress.

@semgrep-app
Copy link
Copy Markdown
Contributor

semgrep-app bot commented Sep 20, 2024

Semgrep found 1 err-todo finding:

  • op-supervisor/supervisor/backend/db/safety_checkers.go

TODO in error handling code

Ignore this finding from err-todo.

Copy link
Copy Markdown
Contributor

@axelKingsley axelKingsley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of changes as I understand them:

Head Pointers

Rather than use EntryIdx to represent the pointer into the database, there's now an application specific structure which captures the Block Number and Index (called "Logs Since")

Downstream Effects

  • UpdateCrossHeadsForChain now tracks the x-head position using this pointer notion. The pointer can initialize itself in position without searching around.

Safety Checkers Return Err

Rather than return bool for the safety check, they now return an error related to which kind of issue is encountered (validity or inclusion). Safety Checkers also needed to be updated to use the new storage mechanisms

Head Storage hides Update Functions

Now the storage has explicit functions to update the named safety levels, per chain. it handles making the update operation

Chain processors Refactor

Seems like Chain Processors are now using a channel based trigger instead of the previous OnNewHead. I'm not sure if these changes are very connected to the rest of the PR. I think it's so that it doesn't block?
Additionally, the headpointer_processors that I wrote yesterday are gone, in favor of using the explicit heads update functions, wrapped into satisfying the HeadProcessor interface.

Base automatically changed from per-block-checkpoints to develop September 20, 2024 23:40
@semgrep-app
Copy link
Copy Markdown
Contributor

semgrep-app bot commented Sep 20, 2024

Semgrep found 1 golang_fmt_errorf_no_params finding:

  • op-supervisor/supervisor/backend/db/db_test.go

No fmt.Errorf invocations without fmt arguments allowed

Ignore this finding from golang_fmt_errorf_no_params.

@protolambda protolambda force-pushed the supervisor-head-pointers branch 3 times, most recently from ac27f13 to a8e18e9 Compare September 21, 2024 01:31
@semgrep-app
Copy link
Copy Markdown
Contributor

semgrep-app bot commented Sep 21, 2024

Semgrep found 7 golang_fmt_errorf_no_params findings:

  • op-chain-ops/deployer/state/intent.go
  • op-chain-ops/deployer/pipeline/superchain.go
  • op-chain-ops/deployer/pipeline/opchain.go
  • op-chain-ops/deployer/pipeline/l2genesis.go
  • op-chain-ops/deployer/pipeline/implementations.go
  • op-chain-ops/deployer/inspect/rollup.go
  • op-chain-ops/deployer/inspect/flags.go

No fmt.Errorf invocations without fmt arguments allowed

Ignore this finding from golang_fmt_errorf_no_params.

change entry indices to head pointers, refactor block processor, backend fixes

Co-authored-by: Axel Kingsley <axel.kingsley@gmail.com>
@protolambda protolambda force-pushed the supervisor-head-pointers branch from 630603c to d8212d7 Compare September 25, 2024 18:57
@protolambda
Copy link
Copy Markdown
Contributor Author

Ok, dropped the non-supervisor changes, rebased on develop, cleaned up the truncated-hash -> common-hash type change conflicts, and fixed some linting issues.
Tests are still in a very rough spot due to refactor and changed assumptions, we're going to leave them commented, and address in the follow-up PR here: #12058

@protolambda protolambda marked this pull request as ready for review September 25, 2024 19:01
@protolambda protolambda requested review from a team as code owners September 25, 2024 19:01
@axelKingsley axelKingsley added this pull request to the merge queue Sep 25, 2024
Merged via the queue into develop with commit c19d51b Sep 25, 2024
@axelKingsley axelKingsley deleted the supervisor-head-pointers branch September 25, 2024 21:19
samlaf pushed a commit to samlaf/optimism that referenced this pull request Nov 10, 2024
…mism#12031)

* op-supervisor: supervisor-head-pointers squashed

change entry indices to head pointers, refactor block processor, backend fixes

Co-authored-by: Axel Kingsley <axel.kingsley@gmail.com>

* use ticker instead of time.After

---------

Co-authored-by: Axel Kingsley <axel.kingsley@gmail.com>
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.

2 participants