-
Notifications
You must be signed in to change notification settings - Fork 696
Implement SendExpressLaneTransactionSync #4074
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
base: master
Are you sure you want to change the base?
Conversation
a03c3cf to
8bd3328
Compare
❌ 4 Tests Failed:
View the top 3 failed tests by shortest run time
📣 Thoughts on this report? Let Codecov know! | Powered by Codecov |
ganeshvanahalli
left a comment
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!
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.
Nice 🙂
System tests should be created covering the following scenarios:
- SendExpressLaneTransactionSync call is made to the active sequencer.
- SendExpressLaneTransactionSync call is made to a non active sequencer.
- SendExpressLaneTransactionSync receives a tx that should succeed
- SendExpressLaneTransactionSync receives a tx that should fail
| return nil, err | ||
| } | ||
| chainEvent := make(chan core.ChainEvent, 128) | ||
| sub := a.backend.BlockChain().SubscribeChainEvent(chainEvent) |
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 are some failures while sequencing transactions that will not be detected through this approach.
An example is when the transaction is too large, this is detected by the sequencer here.
This happens out of the PublishExpressLaneTransaction call, and without geth's Blockchain object being aware of that.
Current PublishTransaction API is synchronous and doesn't have this issue.
It uses resultChan for waiting the transaction to be processed.
@diegoximenes what is nice? |
@diegoximenes ready for another look I added 2 tests
One for each of these which by essense is 2 tests for
I didn't make a test for this ^. Because the "bug" mentioned #4074 (comment) I don't believe is related to this PR, or the implementation, but is instead a side affect from a missing check in I was testing locally, added the size check to I believe this resolves your concerns #4074 (comment) . That being said that problem mentioned isn't related to this PR or the current issue at hand, and was present before my PR, and can be replicated if users called |
73b3b82 to
3f0a604
Compare
diegoximenes
left a comment
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.
Thank you for opening the ticket to check MaxTxSize timeboost_sendExpressLaneTransaction call life cycle, this will provide a better UX for users 🙂.
The MaxTxSize error was just an example though.
There can be other errors that can occur during sequencing, out of the PublishExpressLaneTransaction call path, in which BlockChain().SubscribeChainEvent will not detect.
One is this, which depends on the last block while sequencing the tx.
We likely don't want to detect this error during timeboost_sendExpressLaneTransaction call cycle, but we can, and should, detect in the timeboost_sendExpressLaneTransactionSync call cycle.
It is not unlikely that the list of possible errors like that will grow in the future.
This PR should do something like this:
- Abstract that select into a waitTxToBeSequenced func.
- Create a resultChan in SendExpressLaneTransactionSync, and pass it to the appropriate func calls until it reaches publishTransactionToQueue func.
- After SendExpressLaneTransactionSync calls PublishExpressLaneTransaction, it will call waitTxToBeSequenced, and after that it will call GetTransactionReceipt. a.backend.BlockChain().SubscribeChainEvent will be redundant and can be removed then.
This is the strategy used by PublishTransaction, in which eth_sendRawTransaction* APIs rely on.
With this approach timeboost_sendExpressLaneTransactionSync will detect all those errors that can occur during sequencing, out of the PublishExpressLaneTransaction call path, and return to the user.
Ideally this PR should also have a test covering SendExpressLaneTransactionSync failing, it can be a MaxTxSize failure, but not necessarily.
This test can likely guide you on improving error handling on this PR, guaranteeing that this sync API is able to catch errors generated out of the PublishExpressLaneTransaction call path.
|
|
||
| timeout := defaultTimeout | ||
| if timeoutMs != nil && *timeoutMs > 0 { | ||
| timeoutMs := int64(math.Min(float64(*timeoutMs), math.MaxInt64)) |
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.
Why this line is needed?
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.
I was getting a lint 115 warning, so I was trying to get around it, maybe instead I should do
timeoutMs := int64(math.Min(*timeoutMs, uint64(math.MaxInt64))
What do you think?
| package gethexec | ||
|
|
||
| import "github.com/ethereum/go-ethereum/common" | ||
|
|
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.
How about adding a comment describing that those constructs were copied from an internal geth package?
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.
Sure I will apply this change when we finish discussing what to do and I make the bigger changes 👍
What you are describing for The current So if you want that behavior that is fine, but I think we would need to add a new endpoint to achieve that
What do you think of this? @diegoximenes |
|
@diegoximenes wrote:
@KolbyML wrote:
I think there's been a misunderstanding, we definitely want to return the receipt with I think what Diego is proposing is to pass resultChan all the way through to I agree that we need to surface sequencing errors in some way as many Timeboost users have been asking for this. But there is an added complication relating to the background of #3010. The added complicationThe reordering queue (
The problem with waiting on The original context of We have some logic inside Maybe a way to use this concept is to set an arrival time on the tx in I think the way you could do this is actually by passing the top-level context down to the Then when publishing from reordering queue: What do you think of this? It's a bit of a rework, sorry! As a possibly-relevant aside, I really dislike the Timeboost sequence number feature for exactly the reason of all of the complication it adds. The idea was originally for it to be used by bundlers, but I don't know if it's really getting any use. UserOps style bundlers might actually make more sense with Timeboost than bundlers relying on the sequence number feature (which can add considerable delay if txs get out of sequence). I will discuss this with the product team. |
|
It makes sense to attach the context to the msgBySequenceNumber entries 🙂. |
|
@Tristan-Wilson asked if I can hold on working on this PR, well some questions are answered regarding timeboost internally So I will see what happens, and potentially start working on this PR again in 1 to 2 days |
Resolves NIT-4118
Pulls in OffchainLabs/go-ethereum#588
Goal of this PR
Questions I have
I have some concerns regarding code duplication
github.com/ethereum/go-ethereum/internal/ethapian internal crateSendExpressLaneTransactionSyncis duplicated frometh_sendTransactionSync, normally I would refactor the internal code then just pass in different backends, but I am assuming we don't want to changeeth_sendTransactionSync, or it would make it harder to maintain? I am not sure if it is ok to refactor, so if someone could let me know.I also have some questions about on my geth PR, the whole
internal packageandgo-ethereum submodule, is a little confusing as I don't know the best practices yet, and don't feel I have the seniority on the team to choose what we doMaybe what I have in this PR is good? Maybe it isn't? Let me know 👍