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

fix(op-node): Increase gossip seenMessagesTTL #4873

Merged
merged 3 commits into from
Feb 14, 2023

Conversation

ajsutton
Copy link
Contributor

@ajsutton ajsutton commented Feb 14, 2023

Description

Increases the libp2p gossip seenMessagesTTL value so that it prevents a valid block from being replayed before it is invalid according to the application layer validation rules.

Specifically, a block first becomes valid when its timestamp is 5 seconds in the future, and remains valid until its timestamp is 60 seconds in the past. Thus there's a 65 second period where blocks are valid. By setting seenMessagesTTL to cover this period, all forms of replaying gossip are prevented as either the libp2p layer will discard the message as a duplicate or it will be rejected based on its timestamp.

While it's possible to ignore these duplicates with application layer validation it's more efficient to discard them at the libp2p layer to avoid the need for any validation to occur (which currently would include signature verification). Using seenMessagesTTL is also simpler as it's cache size is based on time so guarantees to cover all messages, whereas adjusting the size of the blockHeightLRU in the application layer validation requires establishing an upper maximum on the number of valid blocks which could be received in the time window.

Metadata

@changeset-bot
Copy link

changeset-bot bot commented Feb 14, 2023

⚠️ No Changeset found

Latest commit: 6c44145

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

@codecov
Copy link

codecov bot commented Feb 14, 2023

Codecov Report

Merging #4873 (6c44145) into develop (a858ae1) will decrease coverage by 4.56%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #4873      +/-   ##
===========================================
- Coverage    39.78%   35.23%   -4.56%     
===========================================
  Files          271      181      -90     
  Lines        18589    15264    -3325     
  Branches       601        0     -601     
===========================================
- Hits          7396     5378    -2018     
+ Misses       10648     9339    -1309     
- Partials       545      547       +2     
Flag Coverage Δ
bedrock-go-tests 35.23% <100.00%> (-0.01%) ⬇️
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.

Impacted Files Coverage Δ
op-node/p2p/gossip.go 38.87% <100.00%> (ø)
op-node/heartbeat/service.go 55.26% <0.00%> (-2.64%) ⬇️
...ontracts/contracts/libraries/rlp/Lib_RLPWriter.sol
.../contracts/L2/predeploys/OVM_SequencerFeeVault.sol
packages/core-utils/src/optimism/rollup-types.ts
packages/core-utils/src/external/ethers/index.ts
...tracts/contracts/L1/deployment/AddressDictator.sol
...ontracts/libraries/resolver/Lib_AddressManager.sol
packages/sdk/src/utils/contracts.ts
...ntracts/contracts/standards/AddressAliasHelper.sol
... and 82 more

@tynes tynes requested review from protolambda and trianglesphere and removed request for tynes and smartcontracts February 14, 2023 17:23
@tynes
Copy link
Contributor

tynes commented Feb 14, 2023

Adding @protolambda and @trianglesphere for review to this one

Copy link
Contributor

@protolambda protolambda left a comment

Choose a reason for hiding this comment

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

LGTM. And this is a non-breaking change in practice (since we don't rely on duplicate block propagation), should be fine to roll out whenever.

@mergify
Copy link
Contributor

mergify bot commented Feb 14, 2023

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

@mergify
Copy link
Contributor

mergify bot commented Feb 14, 2023

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

@mergify mergify bot merged commit e468b66 into develop Feb 14, 2023
@mergify mergify bot deleted the ajsutton/increase-seen-gossip branch February 14, 2023 19:26
@mergify mergify bot removed the on-merge-train label Feb 14, 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.

4 participants