Skip to content

Conversation

@ali-behjati
Copy link
Collaborator

@ali-behjati ali-behjati commented Mar 9, 2023

This PR changes the EVM pusher to rely on the account nonce to increase reliability and cost-efficiency of the pusher.

On EVM networks nonce is the transaction index of the user transaction. it increments 1 by 1 and you cannot send two transactions with the same nonce; if there are multiple transactions with the same nonce only one gets chosen on-chain.

Sometimes our transactions do not land on chain because the gas is lower than the necessary amount to be included on-chain. By setting nonce manually we can replace the older transaction with a higher gas to increase likelihood of the price landing on-chain without paying any extra cost. The override-gas-price-multiplier option with the default of 1.1 is added to handle this situation. Also we can try updating the prices on a faster frequency or even run multiple pushers with the same sender without adding any extra cost because they will be excluded (without reverting on-chain). Since we get nonce from the RPC, if the tx is landed with the RPC knowledge, then the quick update will get rejected on simulation because the RPC state is up to date. However, in our experiments due to RPCs being behind a load-balancer and not being completely in-sync there were rare occurances of on-chain reverted transaction under extreme conditions (pushing every second). We can reduce the chances of this happening by reducing the pushing frequency.

Because of the above change and better handlings of errors, now it is safe to run multiple instances of the pusher using the same account without additional cost overhead.

In this PR there are some refactorings:

  • The price service connection logger is changed to only log warning/error to reduce the log noise.
  • The cooldown-duration is renamed to pushing-frequency to be more understandable. As this is a breaking change, the version is bumped to 4.0.0

@vercel
Copy link

vercel bot commented Mar 9, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated
example-oracle-amm ⬜️ Ignored (Inspect) Mar 9, 2023 at 1:45PM (UTC)
xc-admin-frontend ⬜️ Ignored (Inspect) Mar 9, 2023 at 1:45PM (UTC)

@ali-behjati ali-behjati requested review from 0xfirefist and jayantk and removed request for 0xfirefist March 9, 2023 13:53
Copy link
Contributor

@0xfirefist 0xfirefist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ali-behjati ali-behjati merged commit 3d8215e into main Mar 9, 2023
@ali-behjati ali-behjati deleted the price-pusher/add-nonce-to-evm branch March 9, 2023 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants