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

Support arbitrary contract calls #223

Conversation

cryptoriver
Copy link
Contributor

@cryptoriver cryptoriver commented Sep 21, 2023

What

This pr enables arbitrary contract call support in avalanche rosetta implementation by introducing a utility function constructContractCallDataGeneric for encoding data field for any contract call method and its arguments.

Other than that, we updated the handlers of these endpoints to enable producing/carrying contract call data.

  • /construction/preprocess
  • /construction/metadata
  • /construction/payloads
  • /construction/parse

Note: If argument list contains tuple, the client side must provide the encoded ABI data as the only argument in the argument list because encoding tuple type in this rosetta implementation is not yet supported.

Test

  • Unit tests
  • End to end tests for making generic contract call. (explorer)
  • For rosetta-cli test, the node sync will take too much time (more than 1 day) so decide to skip this (should be fine as the relevant use cases are covered in below end to end regression test).

regression test

@cryptoriver cryptoriver changed the title Support generic contract calls Support arbitrary contract calls Sep 22, 2023
Dockerfile.arm64 Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
docker/entrypoint.sh Outdated Show resolved Hide resolved
service/types.go Show resolved Hide resolved
service/contract_call_data.go Show resolved Hide resolved
service/contract_call_data.go Outdated Show resolved Hide resolved
@cryptoriver cryptoriver force-pushed the contract_call_support branch from dd7b706 to 3fa3b4a Compare October 9, 2023 05:52
@cryptoriver cryptoriver requested a review from ceyonur October 9, 2023 06:11
service/contract_call_data.go Show resolved Hide resolved
service/service_construction.go Show resolved Hide resolved
service/service_construction.go Outdated Show resolved Hide resolved
service/service_construction_test.go Outdated Show resolved Hide resolved
Dockerfile.arm64 Outdated Show resolved Hide resolved
service/types.go Outdated Show resolved Hide resolved
service/types.go Outdated Show resolved Hide resolved
@patrick-ogrady patrick-ogrady changed the base branch from master to arbitrary-contract-calls October 23, 2023 03:50
@patrick-ogrady patrick-ogrady merged commit 9b3519c into ava-labs:arbitrary-contract-calls Oct 23, 2023
2 of 3 checks passed
patrick-ogrady added a commit that referenced this pull request Oct 23, 2023
* Support arbitrary contract calls (#223)

* support generic contract calls

* support test on arm64

* address pr comments

* address pr comments

* panic if type conversion fails

* address pr comments

* fix

* fix checking generic contract call method

* fix docker build

* define consts at top of file

* cleanup construction checks

* add link to type source

* fix linting errors

* add comment explaining how generic check works

* add more comments

---------

Co-authored-by: cryptoriver <114266151+cryptoriver@users.noreply.github.com>
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.

4 participants