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(anvil): Return transaction hash in ots_getTransactionBySenderAndNonce #7741

Merged

Conversation

sealer3
Copy link
Contributor

@sealer3 sealer3 commented Apr 20, 2024

Motivation

Anvil currently returns a transaction object from ots_getTransactionBySenderAndNonce, but both the Otterscan execution specs (https://otterscan.github.io/execution-apis/api-documentation/) and the Foundry Book itself (https://book.getfoundry.sh/reference/anvil/) say it should return the transaction hash. Users can't navigate by sender nonce in Anvil-backed Otterscan instances because if this mistake.

Solution

Simply return the transaction hash rather than the complete transaction object.

Fixes #7740

First-time contributing feedback

I wasn't aware of some extra requirements to run the tests, namely:

Setup:

  • Install gcc
  • Install make
  • Install solc
  • Install libopenssl-dev

And for formatting:

rustup toolchain install nightly

It would be helpful if these instructions were added to or linked from the contributing guidelines.

Also, there were some git commit related tests that always failed when running: cmd::clone::tests::test_clone_single_file_contract failed with called Result::unwrap()on anErr value: Project init error: failed to commit (code=Some(128), stdout="", stderr="Author identity unknown\n\n*** Please tell me who you are.\n\nRun\n\n git config --global user.email \"[email protected]\"\n git config --global user.name \"Your Name\"\n\nto set your account's default identity.\nOmit --global to set the identity only in this repository.\n\nfatal: unable to auto-detect email address (got 'username@rustup.(none)')")

@DaniPopes
Copy link
Member

@mattsse

Copy link
Member

@onbjerg onbjerg left a comment

Choose a reason for hiding this comment

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

LGTM when tests pass

Regarding the first time contributor feedback, you should have the formatter installed already by installing Rust via rustup.rs.

You should not need solc; Forge should automatically download that for you. You should not need make, we don't use it, so it shouldn't be required

@onbjerg onbjerg added T-bug Type: bug C-anvil Command: anvil labels Apr 22, 2024
@mattsse mattsse merged commit e971af1 into foundry-rs:master Apr 22, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-anvil Command: anvil T-bug Type: bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Anvil: Otterscan ots_getTransactionBySenderAndNonce returns transaction object instead of transaction hash
4 participants