Skip to content
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

fix(ethereum-storage): OldNonce error, wait for 1 confirmation when submitting hashes #1078

Merged
merged 11 commits into from
Mar 8, 2023

Conversation

MantisClone
Copy link
Member

@MantisClone MantisClone commented Feb 27, 2023

Fixes #1074
Fixes #1075
Fixes dw-97

Changes:

  • Wait for 2 block confirmations when submitting hashes on-chain. EVM-like blockchains can experience chain reorgs. Usually they are only 1 block in depth. For example, Gnosis Chain experiences a 1-block reorg every few minutes so it's important to wait for 2 block confirmations before submitting the next transaction.

@MantisClone MantisClone changed the title fix(ethereum-storage): OldNonce error, wait for 1 confirmation when submitting transactions fix(ethereum-storage): OldNonce error, wait for 1 confirmation when submitting hashes Feb 27, 2023
@coveralls
Copy link

coveralls commented Feb 27, 2023

Coverage Status

Coverage: 87.784% (-0.05%) from 87.834% when pulling 1542565 on dw-97/fix-old-nonce into 27aaa1f on master.

@@ -17,6 +17,7 @@ const config = {
retryDelay: 0,
safeGasPriceLimit: '500000000000',
transactionPollingTimeout: 300,
blockConfirmations: 2,
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is ever used

Copy link
Member Author

@MantisClone MantisClone Mar 3, 2023

Choose a reason for hiding this comment

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

Fixed, see comment below. it's used now.

* Retrieve from config the default number of block confirmations to wait before considering a transaction successful
* @returns the number of block confirmations
*/
export function getDefaultEthereumBlockConfirmations(): number {
Copy link
Contributor

Choose a reason for hiding this comment

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

same

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed. I called it as a fallback.

return (
(argv.blockConfirmations && Number(argv.blockConfirmations)) ||
(process.env.BLOCK_CONFIRMATIONS && Number(process.env.BLOCK_CONFIRMATIONS)) ||
defaultValues.ethereumStorage.ethereum.blockConfirmations
Copy link
Contributor

Choose a reason for hiding this comment

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

this is never set, see at the top of this file

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

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.

Fix FeeTooLow error in request-node Fix OldNonce error in request-node
5 participants