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

Compare nonce instead of message id of inputs to catch duplicates #900

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

AurelienFT
Copy link
Contributor

@AurelienFT AurelienFT commented Jan 20, 2025

Comparing the nonce of two messages inputs if enough to decide if they are duplicated or not. Previously we were computing the message_id now we avoid this computation and only compare the nonce.

It requires us to change the error variant to include nonce instead of message_id. Because the type of the content has change it's already breaking and so we can change the name also to match this type.

Breaking

Before

enum ValidityError {
  DuplicateMessageInputId {
        message_id: MessageId,
  },
  ...
}

After

enum ValidityError {
  DuplicateInputNonce {
        nonce: Nonce,
  },
  ...
}

Checklist

  • Breaking changes are clearly marked as such in the PR description and changelog
  • New behavior is reflected in tests
  • If performance characteristic of an instruction change, update gas costs as well or make a follow-up PR for that
  • The specification matches the implemented behavior (link update PR if changes are needed)

Before requesting review

  • I have reviewed the code myself
  • I have created follow-up issues caused by this PR and linked them here

After merging, notify other teams

[Add or remove entries as needed]

@AurelienFT AurelienFT changed the title Change message id to nonce in error Compare nonce instead of message id of inputs to catch duplicates Jan 21, 2025
@AurelienFT AurelienFT marked this pull request as ready for review January 21, 2025 09:34
@AurelienFT AurelienFT added the breaking A breaking api change label Jan 21, 2025
@AurelienFT AurelienFT requested a review from a team January 21, 2025 09:35
xgreenx
xgreenx previously approved these changes Jan 21, 2025
Copy link
Contributor

@rafal-ch rafal-ch left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@rafal-ch
Copy link
Contributor

Out of curiosity, do you know what's the purpose of MessageId?

@AurelienFT
Copy link
Contributor Author

Out of curiosity, do you know what's the purpose of MessageId?

I think it's use to distinguish each message and have a unique id for all of them across the network such as txid or coin id. Detailed spec if needed : https://github.com/FuelLabs/fuel-specs/blob/cca2e8cd2e475263c909cb902620b5ff143713ec/src/identifiers/utxo-id.md#message-id

@AurelienFT AurelienFT self-assigned this Jan 22, 2025
@AurelienFT AurelienFT enabled auto-merge January 22, 2025 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking A breaking api change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants