Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix: EIP712Wrapper v1 #276

Merged
merged 3 commits into from
Jan 23, 2025
Merged

Fix: EIP712Wrapper v1 #276

merged 3 commits into from
Jan 23, 2025

Conversation

maxim-inj
Copy link
Collaborator

@maxim-inj maxim-inj commented Jan 22, 2025

Problem

After some recent update injective-core switched the protobuf implementation gogoproto to protobufv2 causing JSON marshaling of messages to behave differently. Changes that made inside injective-core were not reflected in WrapTxToEIP712 in sdk-go.

This makes web3gw service of injective-indexer result in wrong JSON representation for v1 requests here:
https://github.com/InjectiveLabs/injective-indexer/blob/289139bc9a5d0d270761319727bbc265b58b8138/service/web3gw/transactions_api.go#L359

Fixes

  • Implemented Amino-based packaging of gogoproto.Message cosmos messages.
  • Added a unit-test with a fixture to ensure that the output matches the expected output.

Test

$ cd sdk-go/
$ go test -run TestEIP712Wrapper .

Additionally, there is a playground repo to exercise parity in marshaling between Go and TypeScript:
https://github.com/InjectiveLabs/eip712v1

The outputs must match.

Additional features

Updated eip712 wrapper typeddata implementation up to date with injective-core.
Exact file copy of https://github.com/InjectiveLabs/injective-core/blob/dev-v1.14/injective-chain/app/ante/typeddata/typed_data.go

How to use this inside Injective Indexer

Update go.mod:

github.com/InjectiveLabs/sdk-go v1.56.0-rc1.0.20250122230412-8244b7dd8955

Summary by CodeRabbit

🥕

…d output.

- Implemented Amino-based packaging of gogoproto.Message cosmos messages.
- Added a unit-test with a fixture to ensure that the output matches the expected output.
coderabbitai[bot]

This comment was marked as off-topic.

@InjectiveLabs InjectiveLabs deleted a comment from coderabbitai bot Jan 23, 2025
@InjectiveLabs InjectiveLabs deleted a comment from coderabbitai bot Jan 23, 2025
@InjectiveLabs InjectiveLabs deleted a comment from coderabbitai bot Jan 23, 2025
@InjectiveLabs InjectiveLabs deleted a comment from coderabbitai bot Jan 23, 2025
@InjectiveLabs InjectiveLabs deleted a comment from coderabbitai bot Jan 23, 2025
@InjectiveLabs InjectiveLabs deleted a comment from coderabbitai bot Jan 23, 2025
@InjectiveLabs InjectiveLabs deleted a comment from coderabbitai bot Jan 23, 2025
coderabbitai[bot]

This comment was marked as off-topic.

@maxim-inj maxim-inj force-pushed the fix/eip712v1-wrapper branch from cd0a879 to e8625f9 Compare January 23, 2025 02:20
@InjectiveLabs InjectiveLabs deleted a comment from coderabbitai bot Jan 23, 2025
@InjectiveLabs InjectiveLabs deleted a comment from coderabbitai bot Jan 23, 2025
@InjectiveLabs InjectiveLabs deleted a comment from coderabbitai bot Jan 23, 2025
coderabbitai[bot]

This comment was marked as off-topic.

Copy link
Collaborator

@aarmoa aarmoa left a comment

Choose a reason for hiding this comment

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

Changes look good to me

@maxim-inj maxim-inj merged commit 26a0cd8 into dev Jan 23, 2025
4 checks passed
@maxim-inj maxim-inj deleted the fix/eip712v1-wrapper branch January 23, 2025 03:00
@InjectiveLabs InjectiveLabs deleted a comment from coderabbitai bot Jan 23, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants