feat: raw transaction batch submitter#527
Conversation
🦋 Changeset detectedLatest commit: 2a17bcb The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Fix tests Add chainset
f146a12 to
8c825d4
Compare
| @@ -202,9 +202,10 @@ export class StateBatchSubmitter extends BatchSubmitter { | |||
| [...Array(blockRange).keys()], | |||
There was a problem hiding this comment.
If blockRange is negative, an error will be thrown
There was a problem hiding this comment.
that should never happen since we do this check in _getBatchStartAndEnd:
packages/batch-submitter/src/batch-submitter/state-batch-submitter.ts
Outdated
Show resolved
Hide resolved
packages/batch-submitter/src/batch-submitter/state-batch-submitter.ts
Outdated
Show resolved
Hide resolved
packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts
Outdated
Show resolved
Hide resolved
packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts
Outdated
Show resolved
Hide resolved
packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts
Outdated
Show resolved
Hide resolved
annieke
left a comment
There was a problem hiding this comment.
reviewed this with the original PR, everything else looks good!
| @@ -202,9 +202,10 @@ export class StateBatchSubmitter extends BatchSubmitter { | |||
| [...Array(blockRange).keys()], | |||
There was a problem hiding this comment.
that should never happen since we do this check in _getBatchStartAndEnd:
packages/batch-submitter/src/batch-submitter/state-batch-submitter.ts
Outdated
Show resolved
Hide resolved
packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts
Outdated
Show resolved
Hide resolved
packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts
Outdated
Show resolved
Hide resolved
packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts
Outdated
Show resolved
Hide resolved
| case 'eth_getBlockByNumber': | ||
| if (params.length === 0) { | ||
| throw new Error(`Invalid params for ${endpoint}`) | ||
| } | ||
| const blockNumber = BigNumber.from((params as any)[0]).toNumber() | ||
| return this.mockBlocks[blockNumber] |
There was a problem hiding this comment.
we might be able to remove this if injectL2Context lets us call getBlockWithTransactions
There was a problem hiding this comment.
Mockchain provider refactor is going to be a beast -- thinking that we should just lump that into the big testing overhaul
…r.ts Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
|
Who owns pushing this over the finishline? @karlfloersch @annieke |
@tynes I'll own it |
ecd05f8 to
f43dd4f
Compare
| /* Internal Imports */ | ||
| import { EIP155TxData, TxType } from '@eth-optimism/core-utils' | ||
|
|
||
| export enum QueueOrigin { |
There was a problem hiding this comment.
Potentially out of scope of this PR but this enum should be moved to core-utils
There was a problem hiding this comment.
I notice there is another change to core-utils as part of this PR
packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts
Outdated
Show resolved
Hide resolved
| QueueOrigin, | ||
| queueOriginPlainText, | ||
| } from '..' | ||
| import { L2Block, BatchElement, Batch, QueueOrigin } from '..' |
There was a problem hiding this comment.
These types could all go in core-utils, not opinionated on if its as part of this PR or not
There was a problem hiding this comment.
Agree they should definitely go into core-utils. That said there's a bunch of type & utility cleanup that we could do and so I'd lean against doing a potentially big refactor in the same PR that we're adding this new feature.
There was a problem hiding this comment.
^happy to help with the utility cleanup!
| @@ -1,20 +1,13 @@ | |||
| /* External Imports */ | |||
| import { Promise as bPromise } from 'bluebird' | |||
There was a problem hiding this comment.
What do you think of removing bluebird as a dependency in the future? Concurrent async calls are easy with Promise.all
There was a problem hiding this comment.
I had the same thought when I read that code before, here's a post providing good reasoning on "why bluebird" https://blog.kuzzle.io/bluebird-native-async_await-javascript-promises-performances-2020
tynes
left a comment
There was a problem hiding this comment.
The big one is adding the changeset for core-utils
edeaf80 to
5f68d9a
Compare
5f68d9a to
fc22647
Compare
gakonst
left a comment
There was a problem hiding this comment.
Code changes LGTM - assuming they are not breaking Kovan or Mainnet.
| "@eth-optimism/core-utils": patch | ||
| --- | ||
|
|
||
| - Use raw transaction in batch submitter -- incompatible with L2Geth v0.1.2.1 |
There was a problem hiding this comment.
What is geth 0.1.2.1? Is it deployed / being used anywhere right now?
There was a problem hiding this comment.
Ah it is the version of Geth that we were running before our last regenesis ~2/3 weeks ago. This should not be breaking Kovan or Mainnet now that we've got rawTransaction in mainnet
annieke
left a comment
There was a problem hiding this comment.
looks good! yay for deleted code, only concern is whether isSequencerTx is set correctly
| QueueOrigin, | ||
| queueOriginPlainText, | ||
| } from '..' | ||
| import { L2Block, BatchElement, Batch, QueueOrigin } from '..' |
There was a problem hiding this comment.
^happy to help with the utility cleanup!
packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts
Outdated
Show resolved
Hide resolved
| case 'eth_getBlockByNumber': | ||
| if (params.length === 0) { | ||
| throw new Error(`Invalid params for ${endpoint}`) | ||
| } | ||
| const blockNumber = BigNumber.from((params as any)[0]).toNumber() | ||
| return this.mockBlocks[blockNumber] |
…r.ts Co-authored-by: Annie Ke <annieke8@gmail.com>
* feat: use raw transaction Fix tests Add chainset * Update packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts Co-authored-by: Georgios Konstantopoulos <me@gakonst.com> * Remove raw eth_getBlock, delete dead code, & lint * Remove txTypePlaintext and queueOriginPlaintext * style: return promise; no await * Update changeset & fix lint error * Remove stray newline * Update packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts Co-authored-by: Annie Ke <annieke8@gmail.com> Co-authored-by: Annie Ke <annie@address.com> Co-authored-by: Georgios Konstantopoulos <me@gakonst.com> Co-authored-by: Annie Ke <annieke8@gmail.com>
these will allow us to offload this impl entirely https://github.com/paradigmxyz/reth/blob/4df1425fcf860572331c682cf868d0a94129536f/crates/optimism/rpc/src/eth/transaction.rs#L93-L97 ref paradigmxyz/reth#16451
Description
Re-introduce raw tx based batch submitter first implemented here: ethereum-optimism/batch-submitter#56
Additional context
This contributes to #496