Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

test: add underscore test #505

Merged
merged 2 commits into from
Oct 22, 2021
Merged

Conversation

mattsse
Copy link
Collaborator

@mattsse mattsse commented Oct 14, 2021

Motivation

Add a test to ensure contracts with underscore work.
The issue comes from Inflector::to_snake_case which removes the trailing leading and trailing _, this does not impact the method selector though, only the rust function name, which could be a problem if a contract looks like

    abigen!(
        MyContract,
        r#"[
        _hashPuzzle() (uint256)
        _hashPuzzle_() (uint256)
    ]"#
    );

because after Inflector::to_snake_case both functions are name hash_puzzle,
to_snake_case is used in a bunch of places and could be a bit tedious to fix

Solution

PR Checklist

  • Added Tests
  • Added Documentation
  • Updated the changelog

"ethers-contract/tests/solidity-contracts/simplestorage_abi.json",
);

let (provider, _) = Provider::mocked();
Copy link
Owner

Choose a reason for hiding this comment

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

I think we need to use an actual client here, to ensure that the contract calldata is well formed. So let's do Ganache::new().spawn() and convert _hashPuzzle to a view function which returns e.g. 1, to make sure we get the right return data too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sgtm. will add this

@gakonst gakonst merged commit dbd3929 into gakonst:master Oct 22, 2021
@gakonst
Copy link
Owner

gakonst commented Oct 22, 2021

Merging - the fail is unrelated.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants