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

Common tests for ABI encoding #691

Open
ayrat555 opened this issue May 23, 2020 · 16 comments
Open

Common tests for ABI encoding #691

ayrat555 opened this issue May 23, 2020 · 16 comments

Comments

@ayrat555
Copy link
Contributor

ayrat555 commented May 23, 2020

RLP tests are very useful for developing RLP implementations. Why doesn't this repo have common tests for Contract ABI aside from three basic tests?

@winsvega
Copy link
Collaborator

looks like more of a solidity field.
here some tests: https://github.com/ethereum/solidity/blob/develop/test/libsolidity/ABIEncoderTests.cpp

@winsvega winsvega closed this as completed Jun 5, 2020
@ayrat555
Copy link
Contributor Author

ayrat555 commented Jun 5, 2020

I don't think this issue should be closed. Solidity is a part of Ethereum. People are writing the implementation of ABI in different languages so they should have a test set to test against

@ayrat555
Copy link
Contributor Author

ayrat555 commented Jun 5, 2020

We had bugs in Elixir implementation for a couple of years

@winsvega
Copy link
Collaborator

winsvega commented Jun 5, 2020

@chriseth

@winsvega winsvega reopened this Jun 5, 2020
@chriseth
Copy link

chriseth commented Jun 9, 2020

@ayrat555 which format are you proposing that could be language-independent?

@ayrat555
Copy link
Contributor Author

ayrat555 commented Jun 9, 2020

@chriseth I think any representation will work. If people won't like it, they can just convert to any format they want. the problem is in absence of tests, not its representation.

About test structure. I think something like RLP tests will work:

  • type of params
  • params
  • output

@chriseth
Copy link

chriseth commented Jun 9, 2020

We could start with some tests for an existing ABI encoder implementation.

@ayrat555
Copy link
Contributor Author

ayrat555 commented Jun 9, 2020

It would be great. The same tests can be used for decoder tests

encode(types, params) == output
decode(types, output) == params

@axic
Copy link
Member

axic commented Jun 9, 2020

Have a look at the earlier discussion (#118) too. I also think there was a relevant issue on the Solidity repository from 2-3-4 years ago.

@ayrat555
Copy link
Contributor Author

ayrat555 commented Jun 9, 2020

It seems it didn't get far

@winsvega
Copy link
Collaborator

winsvega commented Jun 9, 2020

ok. had an overview of existing tests. we actually have a lot of structure tests here. for rlp,difficulty,transactions,genesis whatever which are not being run on the actual client.

I push the idea of having a test framework/ test suite. preferably rpc protocol through which I can manage and execute all this tests. (currently it is only the state test generation that is done that way)

But it seems that people prefere to have their own parser for this smaller tests. It is fine to have it this test repository. However we really lack of contributors to develop those tests.

@ayrat555 if you have a project and need ABI tests feel free to contribute json tests to this repo.

@ayrat555
Copy link
Contributor Author

ayrat555 commented Jun 9, 2020

Recently I've been fixing bugs for Elixir implementation (https://github.com/poanetwork/ex_abi) so I have a lot of test cases. Which format do you want for them?

@winsvega
Copy link
Collaborator

winsvega commented Sep 5, 2020

@ayrat555
Copy link
Contributor Author

ayrat555 commented Sep 7, 2020

I knew about these tests. I think they are not complete

@winsvega
Copy link
Collaborator

winsvega commented Sep 7, 2020

Yes. I mean this is the format. If you have more tests please share.

@q9f
Copy link

q9f commented Dec 21, 2021

This is kind of a chicken and egg problem, if you want to write an ABI encoder/decoder it is ofter very useful to look at spec tests. The given tests are barely scratching the complexity of ABI. So, for more complex cases, such as nested, dynamically sized arrays, I can just hope that my encoder works, because there is little to test against.

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

No branches or pull requests

5 participants