Skip to content

feat(proxyd): track consensus for {safe,finalized} blocks and rewrite tags#5794

Merged
OptimismBot merged 14 commits intodevelopfrom
felipe/consensus-finalized-safe
May 27, 2023
Merged

feat(proxyd): track consensus for {safe,finalized} blocks and rewrite tags#5794
OptimismBot merged 14 commits intodevelopfrom
felipe/consensus-finalized-safe

Conversation

@felipe-op
Copy link
Contributor

@felipe-op felipe-op commented May 26, 2023

Description

This change adds the ability to track finalized and safe block tags within a backend group. It uses the same consensus poller mechanism, and converge to the lowest block.

Those tags are not used to form a consensus, only to maintain a consistent view from client perspective.

It shallowly check the values for sanity, i.e. tag values should never decrease, and finalized <= safe <= latest. In case of an unexpected scenario, we ban the backend and try to re-establish the consensus. If all backends are observing the same reorg, all of them will be banned and we'll stop serving traffic temporarily.

Note this is a very rare event and we are trying to prevent overreacting to a bad node.

Re-establishing the consensus may result in safe or finalized to drop in the same way a backend would do if such reorg would be observed.

Tests

Added tests to cover new cases

Invariants

  • bumped go to 1.20
  • refactored tests
  • refactored poller
  • adjusted the max block lag to saner default of 8

Additional context

This is part of the project Consensus Aware RPC Proxy: https://www.notion.so/oplabs/Consensus-Aware-RPC-Proxy-0138e029af814e4cbca2740c7888e02d

Metadata

https://linear.app/optimism/issue/INF-246/add-safe-and-finalized-blocks-to-consensus-proxyd

TODOs

@changeset-bot
Copy link

changeset-bot bot commented May 26, 2023

⚠️ No Changeset found

Latest commit: d3cb982

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@netlify
Copy link

netlify bot commented May 26, 2023

Deploy Preview for opstack-docs canceled.

Name Link
🔨 Latest commit d3cb982
🔍 Latest deploy log https://app.netlify.com/sites/opstack-docs/deploys/647216a95ddbcd0008b19538

@felipe-op felipe-op changed the title Felipe/consensus finalized safe feat(proxyd): track consensus for {safe,finalized} blocks and rewrite tags May 26, 2023
@felipe-op felipe-op force-pushed the felipe/consensus-finalized-safe branch from aabdb03 to 5975683 Compare May 26, 2023 05:11
@mergify
Copy link
Contributor

mergify bot commented May 26, 2023

Hey @felipe-op! This PR has merge conflicts. Please fix them before continuing review.

@mergify mergify bot added the conflict label May 26, 2023
@felipe-op felipe-op force-pushed the felipe/consensus-finalized-safe branch from 5975683 to 750edbf Compare May 26, 2023 05:12
@felipe-op felipe-op requested a review from mslipper May 26, 2023 05:12
@mergify mergify bot removed the conflict label May 26, 2023
@codecov
Copy link

codecov bot commented May 26, 2023

Codecov Report

Merging #5794 (dad7aee) into develop (a680097) will decrease coverage by 2.57%.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #5794      +/-   ##
===========================================
- Coverage    42.27%   39.70%   -2.57%     
===========================================
  Files          464      306     -158     
  Lines        30078    25417    -4661     
  Branches       876        0     -876     
===========================================
- Hits         12714    10091    -2623     
+ Misses       16362    14372    -1990     
+ Partials      1002      954      -48     
Flag Coverage Δ
bedrock-go-tests 39.70% <ø> (+<0.01%) ⬆️
common-ts-tests ?
contracts-bedrock-tests ?
contracts-tests ?
core-utils-tests ?
dtl-tests ?
fault-detector-tests ?
sdk-tests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

see 159 files with indirect coverage changes

@felipe-op felipe-op force-pushed the felipe/consensus-finalized-safe branch from b03e193 to 6aa40d4 Compare May 27, 2023 02:38
@felipe-op felipe-op marked this pull request as ready for review May 27, 2023 14:40
@felipe-op felipe-op requested a review from a team as a code owner May 27, 2023 14:40
@mergify
Copy link
Contributor

mergify bot commented May 27, 2023

This PR has been added to the merge queue, and will be merged soon.

@mergify
Copy link
Contributor

mergify bot commented May 27, 2023

This PR is next in line to be merged, and will be merged as soon as checks pass.

1 similar comment
@mergify
Copy link
Contributor

mergify bot commented May 27, 2023

This PR is next in line to be merged, and will be merged as soon as checks pass.

@OptimismBot OptimismBot merged commit 3a4c7dd into develop May 27, 2023
@OptimismBot OptimismBot deleted the felipe/consensus-finalized-safe branch May 27, 2023 14:57
@mergify mergify bot removed the on-merge-train label May 27, 2023
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.

3 participants