Skip to content

feat: add batch-submitter/txmgr for tx publication and gas bumping#1645

Merged
tynes merged 3 commits intoethereum-optimism:developfrom
cfromknecht:bss-txmgr
Oct 28, 2021
Merged

feat: add batch-submitter/txmgr for tx publication and gas bumping#1645
tynes merged 3 commits intoethereum-optimism:developfrom
cfromknecht:bss-txmgr

Conversation

@cfromknecht
Copy link
Copy Markdown
Contributor

Description
This commit adds a SimpleTxManager for tracking and bumping fees on txs
the batch submitter needs to publish. The bulk of the logic is adapated
from the existing tx manager (YNATM) used in the typescript version to
minimize any new classes of bugs that are not already considered.

The manager is configured via a min and max gas price, as well as an
additive gas price step that is applied after each resubmission interval
elapses, before signing and broadcasting a new transaction. This
corresponds to the LINEAR fee policy available in YNATM.

Txs generated from the same call to Send are treated as equivalent, thus
the method blocks until the first tx confirms. Care is taken to
throughly unit test the interactions and edge cases, as subtle bugs in
tx publication can lead to big headaches in prod. To this end, we
achieve 100% test coverage in the txmgr package:

coverage: 100.0% of statements
ok  	github.com/ethereum-optimism/go/batch-submitter/txmgr	10.311s

Additional context
This PR also:

Metadata

  • Fixes ENG-1481

The constants are actually defined in the reverse order of their
severity. The prior behavior would log everything _but_ log.LvlCrit.
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Oct 28, 2021

⚠️ No Changeset found

Latest commit: 5097797

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-commenter
Copy link
Copy Markdown

codecov-commenter commented Oct 28, 2021

Codecov Report

Merging #1645 (829e653) into develop (e87f2b3) will decrease coverage by 0.19%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1645      +/-   ##
===========================================
- Coverage    76.71%   76.52%   -0.20%     
===========================================
  Files           82       82              
  Lines         3032     3041       +9     
  Branches       463      466       +3     
===========================================
+ Hits          2326     2327       +1     
- Misses         706      714       +8     
Flag Coverage Δ
batch-submitter 61.74% <ø> (ø)
contracts 86.05% <ø> (ø)
core-utils 63.27% <ø> (-1.77%) ⬇️
data-transport-layer 37.86% <ø> (ø)
message-relayer 83.48% <ø> (ø)

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

Impacted Files Coverage Δ
packages/core-utils/src/l2context.ts 7.31% <0.00%> (+1.06%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e87f2b3...829e653. Read the comment docs.

@cfromknecht cfromknecht requested a review from tynes October 28, 2021 04:23
This commit adds a SimpleTxManager for tracking and bumping fees on txs
the batch submitter needs to publish. The bulk of the logic is adapated
from the existing tx manager (YNATM) used in the typescript version to
minimize any new classes of bugs that are not already considered.

The manager is configured via a min and max gas price, as well as an
additive gas price step that is applied after each resubmission interval
elapses, before signing and broadcasting a new transaction. This
corresponds to the LINEAR fee policy available in YNATM.

Txs generated from the same call to Send are treated as equivalent, thus
the method blocks until the first tx confirms. Care is taken to
throughly unit test the interactions and edge cases, as subtle bugs in
tx publication can lead to big headaches in prod. To this end, we
achieve 100% test coverage in the txmgr package:

```
coverage: 100.0% of statements
ok  	github.com/ethereum-optimism/go/batch-submitter/txmgr	10.311s
```
Copy link
Copy Markdown
Contributor

@tynes tynes left a comment

Choose a reason for hiding this comment

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

Looks good to me, well commented and tested 💯

@tynes tynes merged commit 2a7d347 into ethereum-optimism:develop Oct 28, 2021
@cfromknecht cfromknecht deleted the bss-txmgr branch October 28, 2021 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-op-batcher Area: op-batcher

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants