dex-services
dex-services copied to clipboard
Share soluton submission nonce between run looops
I think ultimately we might even want to share this state across run-loops so that the next batch uses the current batch's nonce +1 even if the cancellation tx is still pending (right now it would still use the same nonce since transaction_count is based on only mined txs).
Originally posted by @fleupold in https://github.com/gnosis/dex-services/pull/1116
I believe this is done?
I don't think this is done. Right now, if a solution submission tx is pending, the next run loop will get the same nonce as the runloop before.
Let's discuss if we really want this, given that the next runloop could also be used to effectively "cancel" the tx of the previous run loop (which is invalid at that point anyways).
The tx that can be pending is only ever be the cancellation tx since it is always created if the solution tx too long and has higher gas price than the solution tx. But we still have the problem that it is possible that the cancellation also stays pending. The problem with using a higher nonce is that the previous cancellation tx could still stay pending and we would not end up completing any newer transactions. For this reason the idea that the next runloop effectively cancels the previous tx makes sense to me but this can only happen if the gas price is sufficiently higher. So what we want to share between runs would be the nonce and the gas price used for cancellation. Then in the next run we compare the gas prices. Still need to think through this more, just first idea.