-
Notifications
You must be signed in to change notification settings - Fork 53
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
Add gas bumping txmgr #284
Add gas bumping txmgr #284
Conversation
7c57f9c
to
ce05793
Compare
bb33f19
to
c8fef0f
Compare
b54c915
to
5616d83
Compare
added gas oracle refactored txmgr module added geometric txmgr make fmt log -> logger in simple txmgr add TODO + rename constructor update geometric txmgr to use sync api gasoracle refactor chore: switch to pointer to gasoracle in geometric txmgr Also added some comments example: add example test for geometric txmgr fix(geometric_example_test): start anvil container refactor(geometric txmgr): delete gasoracle and add its methods to geometric txmgr directly make fmt fix(lint): remove no longer used variable hundred wip moving geometric to its own subdir simplify privatekey_wallet delete old moved files add geometric txmgr metrics interface + noop metrics docs: add default values in geometric txmgr params comment test(geometric txmgr): add first simple test for geometric txmgr test(geometric txmgr): add some basic tx sending tests feat(ecdsa): add KeyAndAddressFromHexKey helper function feat(geometric txmgr): add integration test scaffold with 1 simple tx sending test fix(geometric txmgr): remove unneeded mutex test(geometric txmgr): add parallel mining logic to fakeEthBackend.SendTransaction to test parallel sending of txs feat(geometrix txmgr): refactor queryTicketDuration to be a param instead of a fixed const refactor(txmgr test harness): refactor into a mining goroutine fix(geometric txmgr test): use mutex to get rid of race condition refactor(geometric txmgr params): made all params public fields feat(geometric txmgr test): added congestedBlocks field to test network congestion where txs need to get bumped also made tests run fast by setting txmgr's GetTxReceiptTickerDuration to 100ms instead of the default 3s fix(geometric txmgr): bug in ensureAnyTxBroadcasted ethereum.NotFound errors were not handled properly, causing txs to never get bumped feat(geometric txmgr test): added congested network test
a302e22
to
4c94ecd
Compare
…tead of percentages
…roadcasted for fireblock wallet
|
||
// processTransaction sends the transaction and runs the monitoring loop which will bump the gasPrice until the tx get | ||
// included. | ||
func (t *GeometricTxManager) processTransaction(ctx context.Context, req *txnRequest) (*types.Receipt, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this method thread safe?
Could a transaction with higher nonce end up published before one with lower nonce?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh btw also had to add 3a12fcc#diff-f3751b0e1d13e5e4c58c0ae0d936505427becc99a1c52514628bdaf32df6d370R488 to slow down the gas bumping loop, otherwise txs were getting bumped like crazy if a txs with the wrong (too-high) nonce was sent. Is that normal? Was there a better way to deal with this?
…is goroutine safe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, I'd integrate this with some service (avssync?) and soak test it as there might be more issues when dealing with the real chain in different gas market
chainio/txmgr/geometric/geometric.go
Outdated
// t.logger.Debug("Transaction not yet mined", "nonce", tx.Nonce(), "txID", txID, "txHash", | ||
// tx.Hash().Hex(), "err", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do we want to do here? We can remove this block if nothing is being done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops commented while debugging and committed by mistake. Uncommented in 63832fc
// Remove the transaction from the list of transactions to query. | ||
// go seemingly allows deleting from a map while iterating over it: | ||
// https://groups.google.com/g/golang-nuts/c/rEmaoxi11_A | ||
// although the official spec and faq don't seem to mention this anywhere... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem to mention that deleting items while iterating is safe?
Also in passing Fixes #153 .
What Changed?
Also updated chainio and signer READMEs + some code comments
Reviewer Checklist