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

impl NonceTooHigh/ NonceTooLow checks #383

Merged
merged 6 commits into from Feb 22, 2023
Merged

impl NonceTooHigh/ NonceTooLow checks #383

merged 6 commits into from Feb 22, 2023

Conversation

gd-0
Copy link
Contributor

@gd-0 gd-0 commented Feb 21, 2023

Implements missing nonce checks.

Using a feature flag to disable the nonce checks was discussed in telegram but I noticed that the nonce parameter in the TxEnv struct was optional so I've put the check behind that. If this isn't what the Optional nonce was for then I can put it behind a feature flag, just let me know :D.

Matched to Geth: https://github.com/ethereum/go-ethereum/blob/fe01a2f63b8591d8226742726d8d6aaad4cd981e/core/state_transition.go#L240

@rakita
Copy link
Member

rakita commented Feb 22, 2023

Implements missing nonce checks.

Using a feature flag to disable the nonce checks was discussed in telegram but I noticed that the nonce parameter in the TxEnv struct was optional so I've put the check behind that. If this isn't what the Optional nonce was for then I can put it behind a feature flag, just let me know :D.

Matched to Geth: https://github.com/ethereum/go-ethereum/blob/fe01a2f63b8591d8226742726d8d6aaad4cd981e/core/state_transition.go#L240

I forgot that Nonce was optional, this is great!
Just fix the clippy and it will be merged

clippy error:

error: `if` chain can be rewritten with `match`
   --> crates/revm/src/evm_impl.rs:112:13
    |
112 | /             if state_nonce < tx_nonce {
113 | |                 return Err(InvalidTransaction::NonceTooHigh {
114 | |                     tx: tx_nonce,
115 | |                     state: state_nonce,
...   |
123 | |                 .into());
124 | |             }
    | |_____________^
    |
    = help: consider rewriting the `if` chain to use `cmp` and `match`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_chain
    = note: `-D clippy::comparison-chain` implied by `-D warnings`
    ```

@gd-0 gd-0 requested a review from rakita February 22, 2023 11:54
@rakita rakita merged commit 5efd9d1 into bluealloy:main Feb 22, 2023
@gd-0 gd-0 deleted the impl-nonce-checks branch February 22, 2023 12:26
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.

None yet

2 participants