-
Notifications
You must be signed in to change notification settings - Fork 4k
feat(op-service): Move Tx Creation to the txmgr #5191
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
Merged
Merged
Changes from 14 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
c0ebd1a
stub out txmgr tx creation
refcell 1b797f2
Merge branch 'develop' into refcell/feat/txcreation
refcell 929077b
stash txmgr changes
refcell 6c244bc
upstream sync :recycle:
refcell 6d5857c
use configurable gas estimation
refcell 6dc5251
add the gas estimation to the doc comments :memo:
refcell a225244
ticket op-batcher concurrent transaction handling
refcell 3c6f434
op-batcher driver send tx tests :test_tube:
refcell 3fa4593
fixes and testing :gear:
refcell dee78c6
Merge branch 'develop' into refcell/feat/txcreation
refcell a5387c5
fix missing cli flags in the op-batcher
refcell ca597da
fix for semgrep
refcell ddaf933
change recipient to to :gear:
refcell a3da36f
txmgr fixes
refcell 3922f5f
suggested fixes
refcell 9f795d0
Merge branch 'develop' into refcell/feat/txcreation
refcell e5edaa8
fix josh's nits
refcell 9699dc0
change method name
refcell de98bbf
defer cancels
refcell 4cbc6d1
minor changes to move chain id into txmgr config
refcell eb591ae
fix batcher test
refcell be704d5
Merge branch 'develop' into refcell/feat/txcreation
mergify[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| package batcher | ||
|
|
||
| import ( | ||
| "context" | ||
| "math/big" | ||
| "testing" | ||
|
|
||
| "github.com/ethereum/go-ethereum/common" | ||
| "github.com/ethereum/go-ethereum/core/types" | ||
| "github.com/ethereum/go-ethereum/log" | ||
| "github.com/stretchr/testify/mock" | ||
| "github.com/stretchr/testify/require" | ||
|
|
||
| "github.com/ethereum-optimism/optimism/op-node/rollup" | ||
| "github.com/ethereum-optimism/optimism/op-node/testlog" | ||
| "github.com/ethereum-optimism/optimism/op-service/txmgr" | ||
| "github.com/ethereum-optimism/optimism/op-service/txmgr/mocks" | ||
| ) | ||
|
|
||
| // TestSendTransaction tests that the driver can send a transaction | ||
| // through the txmgr. | ||
| func TestSendTransaction(t *testing.T) { | ||
|
refcell marked this conversation as resolved.
Outdated
refcell marked this conversation as resolved.
Outdated
|
||
| log := testlog.Logger(t, log.LvlCrit) | ||
| txMgr := mocks.TxManager{} | ||
| batcherInboxAddress := common.HexToAddress("0x42000000000000000000000000000000000000ff") | ||
| chainID := big.NewInt(1) | ||
| sender := common.HexToAddress("0xdeadbeef") | ||
| bs := BatchSubmitter{ | ||
| Config: Config{ | ||
| log: log, | ||
| From: sender, | ||
| OfflineGasEstimation: false, | ||
| Rollup: &rollup.Config{ | ||
| L1ChainID: chainID, | ||
| BatchInboxAddress: batcherInboxAddress, | ||
| }, | ||
| }, | ||
| txMgr: &txMgr, | ||
| } | ||
| txData := []byte{0x00, 0x01, 0x02} | ||
|
|
||
| gasTipCap := big.NewInt(136) | ||
| gasFeeCap := big.NewInt(137) | ||
| gas := uint64(1337) | ||
|
|
||
| candidate := txmgr.TxCandidate{ | ||
| To: batcherInboxAddress, | ||
| TxData: txData, | ||
| From: sender, | ||
| GasLimit: uint64(0), | ||
| } | ||
|
|
||
| tx := types.NewTx(&types.DynamicFeeTx{ | ||
| ChainID: chainID, | ||
| Nonce: 0, | ||
| GasTipCap: gasTipCap, | ||
| GasFeeCap: gasFeeCap, | ||
| Gas: gas, | ||
| To: &batcherInboxAddress, | ||
| Data: txData, | ||
| }) | ||
| txHash := tx.Hash() | ||
|
|
||
| expectedReceipt := types.Receipt{ | ||
| Type: 1, | ||
| PostState: []byte{}, | ||
| Status: uint64(1), | ||
| CumulativeGasUsed: gas, | ||
| TxHash: txHash, | ||
| GasUsed: gas, | ||
| } | ||
|
|
||
| txMgr.On("CraftTx", mock.Anything, candidate).Return(tx, nil) | ||
| txMgr.On("Send", mock.Anything, tx).Return(&expectedReceipt, nil) | ||
|
|
||
| receipt, err := bs.SendTransaction(context.Background(), tx.Data()) | ||
| require.NoError(t, err) | ||
| require.Equal(t, receipt, &expectedReceipt) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.