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

Handling and externalisation improvements for account nonce updates #844

Merged
merged 8 commits into from
Jan 12, 2024

Conversation

stoqnkpL
Copy link
Contributor

Description:

Introduce rules for when to update an Ethereum transaction signer's nonce and a new field for externalising the nonce update in the record stream. This will help resolve issues where the Consensus nodes and the Mirror nodes are out of sync in regards to what the current value of an account's nonce is.

Related issue(s):

Fixes #

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

Signed-off-by: Stoyan Panayotov <[email protected]>
Copy link

netlify bot commented Dec 12, 2023

Deploy Preview for hedera-hips ready!

Name Link
🔨 Latest commit d798a29
🔍 Latest deploy log https://app.netlify.com/sites/hedera-hips/deploys/65a14d7d3733040009f0ede6
😎 Deploy Preview https://deploy-preview-844--hedera-hips.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Signed-off-by: Stoyan Panayotov <[email protected]>
@stoqnkpL stoqnkpL changed the title Add account nonce HIP Handling and externalisation improvements for account nonce updates Dec 12, 2023
HIP/hip-844.md Outdated Show resolved Hide resolved
HIP/hip-844.md Show resolved Hide resolved
HIP/hip-844.md Show resolved Hide resolved
steven-sheehy
steven-sheehy previously approved these changes Jan 3, 2024
Copy link
Member

@steven-sheehy steven-sheehy left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@Nana-EC Nana-EC left a comment

Choose a reason for hiding this comment

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

Looking good, some suggestions.


When importing legacy transactions that don't have this field, the Mirror node should consider whether the transaction result is SUCCESS or CONTRACT_REVERT_EXECUTED and increment the signer nonce in these cases. Some statuses such as INSUFFICIENT_GAS can be returned both before and after entering the EVM, there is no way for the Mirror node to know whether the signer nonce should be updated. This was the root cause of multiple issues and the reason for the new protobuf field.

The Mirror node will continue to serve outdated nonce information for some accounts and will provide accurate nonces for accounts that have signed valid EthereumTransactions post this HIP implementation.
Copy link
Contributor

Choose a reason for hiding this comment

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

You can add a note to show users how to unblock themselves to submit a transaction when they have a wrong nonce.
HAPI account call or the error message from the relay on a submitted transaction.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added.


### Services update

1. Move the signer nonce update to be right before this code block that starts the transaction execution in the EVM:
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of requiring a single line prior to this that could be refactored accidentally should we extract it to a single method that increments and initiates process e.g. nonceIncrementAndEvmProcess()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds like a good idea. But actually, I haven't analysed the modularised codebase implementation of the transaction processor and can't provide exact steps for the implementation fix. Should we leave this for the design doc/work package definition?


## Motivation

Unclear rules for when the nonce of an EthereumTransaction signer account should be updated result in discrepancies between the Consensus nodes' and Mirror nodes' states. This leads to users experiencing issues when reading the account nonce from the Mirror node and trying to use it in a transaction sent to the Consensus node.
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: Should we consider listing the error case from the HAPI side and relay that are symptomatic of the problem.
In this way some users might link the issue back to the resolution from this HIP.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the error in the Backward Compatibility section.

Signed-off-by: Stoyan Panayotov <[email protected]>
Copy link
Collaborator

@mgarbs mgarbs left a comment

Choose a reason for hiding this comment

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

LGTM

@mgarbs mgarbs merged commit 3a8c421 into hashgraph:main Jan 12, 2024
6 checks passed
@mgarbs mgarbs deleted the account-nonce-hip branch January 12, 2024 14:33
kimbor pushed a commit to kimbor/hedera-improvement-proposal that referenced this pull request Jun 24, 2024
…ashgraph#844)

Signed-off-by: Stoyan Panayotov <[email protected]>
Co-authored-by: Michael Garber <[email protected]>
Signed-off-by: Kim Rader <[email protected]>
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