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

feat: add solidity ABI support in ICS20Transfer ics20-1 #7592

Merged
merged 14 commits into from
Dec 3, 2024

Conversation

gjermundgaraba
Copy link
Contributor

Description

closes: #7591


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against the correct branch (see CONTRIBUTING.md).
  • Linked to GitHub issue with discussion and accepted design, OR link to spec that describes this work.
  • Code follows the module structure standards and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/).
  • Added relevant godoc comments.
  • Provide a conventional commit message to follow the repository standards.
  • Include a descriptive changelog entry when appropriate. This may be left to the discretion of the PR reviewers. (e.g. chores should be omitted from changelog)
  • Re-reviewed Files changed in the GitHub PR explorer.
  • Review SonarCloud Report in the comment section below once CI passes.

- name: Install compiler for arm64.
if: matrix.go-arch == 'arm64'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu build-essential
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some changes in dependencies has made this necessary

@@ -40,6 +40,9 @@ issues:
- linters:
- staticcheck
text: "SA1019:" # silence errors on usage of deprecated funcs
- text: "G115: integer overflow conversion"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not strictly necessary currently, but we will need it as soon as we update to a newer version of golangci-lint. We use a newer one in the solidity repo (and 1.57 seems broken on my Mac, so I am running the same from the solidity repo), which turns on G115 by default. We need convert integers constantly, and there is no way to appease the linter (according to issues I found on gh). So if we just add it now, we'll save ourselves some pain when we upgrade golangci-lint.

@@ -26,6 +27,7 @@ var (
const (
EncodingJSON = "application/json"
EncodingProtobuf = "application/x-protobuf"
EncodingABI = "application/x-solidity-abi"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was not able to find an actual "standard" or widely accepted MIME type for solidity ABI encoded data. So I made this one... Let me know if you have a better suggestion.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I'm not sure what the expectation is here for mime types that don't really exist.
This would be my hesitation for using mime format rather than just defining our own enum, although, much of a muchness really.. only negative is if at some point a standard mime type is added for abi solidity

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that is true :/ In that case we might just have to support both for a while. Well, this is feedback that @AdityaSripal can think about :)

Copy link
Contributor

@bznein bznein Nov 26, 2024

Choose a reason for hiding this comment

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

Yeah, I'm not sure what the expectation is here for mime types that don't really exist.

FWIW, applications/x-protobuf is not standard either, some use application/protobuf but there isn't an agreed upon standard. We set on this one with @AdityaSripal but I get your hesitation

Copy link
Member

Choose a reason for hiding this comment

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

when was this file added? is this something needed for eureka? I don't think we have it on main

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was added recently in #7559. It is currently needed for the Union 08-wasm Ethereum light client. I hope to remove this dependency as we move the light client 🙏

@@ -26,6 +27,7 @@ var (
const (
EncodingJSON = "application/json"
EncodingProtobuf = "application/x-protobuf"
EncodingABI = "application/x-solidity-abi"
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I'm not sure what the expectation is here for mime types that don't really exist.
This would be my hesitation for using mime format rather than just defining our own enum, although, much of a muchness really.. only negative is if at some point a standard mime type is added for abi solidity

@@ -19,12 +19,13 @@ require (
github.com/cosmos/cosmos-sdk v0.50.10
github.com/cosmos/gogoproto v1.7.0
github.com/cosmos/ics23/go v0.11.0
github.com/cosmos/solidity-ibc-eureka/abigen v0.0.0-20241124101149-3e2c74b736f4
Copy link
Member

Choose a reason for hiding this comment

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

this is a separate go module, right?

maybe in future could be nice to have all encoding and protobuf stuff in the ibc repo, but that's probably quite far off right now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is generated code from the ABI definitions of the solidity EVM contracts (Solidity -> ABI -> go).

Copy link
Member

Choose a reason for hiding this comment

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

I actually think that we should have the encoding/decoding logic here (or ibc repo I guess). I'd even rather use manually written code to abi encode/decode the packet data than to use autogenerated code from another repo. But for now, this is probably ok...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a bigger discussion to be had on centralizing types and encoding. For now, this is at least relatively convenient and gives a direct link to where the correct definitions are.

Copy link

sonarcloud bot commented Nov 27, 2024

Copy link
Contributor

@bznein bznein left a comment

Choose a reason for hiding this comment

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

LGTM

{
"failure: invalid type for protobuf",
func() {
packetDataBz = []byte("invalid")
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit] maybe we can extract it somewhere since we use it in at least three places

@gjermundgaraba gjermundgaraba merged commit b9000c3 into feat/ibc-eureka Dec 3, 2024
66 of 67 checks passed
@gjermundgaraba gjermundgaraba deleted the gjermund/7591-ics20-abi-encoding branch December 3, 2024 10:05
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