optimism icon indicating copy to clipboard operation
optimism copied to clipboard

op-supervisor: Wire in head tracking

Open ajsutton opened this issue 1 year ago • 1 comments

Description

Implements a HeadTracker that can store and atomically update the chain heads across all tracked chains. A basic JSON serialisation is currently used with atomic file writes. Heads are tracked with log database entries - in a follow up we will need to add the ability to detect when the log entry it points to was removed and replaced so we can safely rollback at startup, but ignoring that for now to get something working and prove it all hangs together.

The log database code has moved from db package to db/logs and a ChainsDB introduce that can manage updates across chains. Since head updates need to be atomic across chains, ChainsDB can hold the single HeadTracker instance and all the log DBs and delegate as appropriate.

Currently the head tracker is wired in but no actual updates are sent to it.

Tests

Unit tests for new head tracker.

Metadata

  • https://github.com/ethereum-optimism/optimism/issues/11028

ajsutton avatar Jul 12 '24 03:07 ajsutton

Semgrep found 2 golang_fmt_errorf_no_params findings:

No fmt.Errorf invocations without fmt arguments allowed

Ignore this finding from golang_fmt_errorf_no_params.

Semgrep found 1 math-random-used finding:

  • op-node/rollup/driver/sequencer_test.go

Do not use math/rand. Use crypto/rand instead.

Ignore this finding from math-random-used.

Semgrep found 1 todos_require_linear finding:

Please create a GitHub ticket for this TODO.

Ignore this finding from todos_require_linear.

semgrep-app[bot] avatar Jul 12 '24 03:07 semgrep-app[bot]