Skip to content

Simulation: Add nonce to call parameter#8139

Merged
Gabriel-Trintinalia merged 6 commits intobesu-eth:mainfrom
Gabriel-Trintinalia:transaction-call-parameter-add-nonce
Jan 20, 2025
Merged

Simulation: Add nonce to call parameter#8139
Gabriel-Trintinalia merged 6 commits intobesu-eth:mainfrom
Gabriel-Trintinalia:transaction-call-parameter-add-nonce

Conversation

@Gabriel-Trintinalia
Copy link
Copy Markdown
Contributor

PR Description:

This pull request introduces the nonce parameter to the transaction call parameters. If a nonce is specified, the simulation will use the value provided. If not, it will default to the sender's nonce.

// TransactionSimulator 

final long nonce =
    callParams
        .getNonce()
        .orElse(
            Optional.ofNullable(updater.get(senderAddress)).map(Account::getNonce).orElse(0L));

Additionally, this PR addresses and fixes the specification tests by either:

  • Passing the correct nonce, or
  • Removing the nonce from the request

This update ensures compatibility with Geth's transaction call object specifications: Geth Documentation.

Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
…ce and encoding a new transaction with right nonce

Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
@Gabriel-Trintinalia Gabriel-Trintinalia added doc-change-required Indicates an issue or PR that requires doc to be updated RPC labels Jan 20, 2025
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
@Gabriel-Trintinalia Gabriel-Trintinalia marked this pull request as ready for review January 20, 2025 03:04
Copy link
Copy Markdown
Contributor

@usmansaleem usmansaleem left a comment

Choose a reason for hiding this comment

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

LGTM - most changes are in the .json files.

Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
@Gabriel-Trintinalia Gabriel-Trintinalia merged commit 702ce74 into besu-eth:main Jan 20, 2025
final long nonce =
callParams
.getNonce()
.orElse(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For efficiency, should not be orElseGet to only compute it is the nonce is not present in the call params?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For efficiency, should not be orElseGet to only compute it is the nonce is not present in the call params?

@fab-10 #8145

@bgravenorst bgravenorst removed the doc-change-required Indicates an issue or PR that requires doc to be updated label Feb 4, 2025
pullurib pushed a commit to pullurib/besu that referenced this pull request Feb 6, 2025
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Bhanu Pulluri <bhanu.pulluri@kaleido.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants