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

Structures without members are not encoded properly #1967

Closed
Supertuba12 opened this issue Sep 26, 2023 · 2 comments
Closed

Structures without members are not encoded properly #1967

Supertuba12 opened this issue Sep 26, 2023 · 2 comments
Labels
bug A bug in behaviour or functionality

Comments

@Supertuba12
Copy link
Contributor

Structures without members are not encoded properly

The JSON RPC API specification for 'eth_signTypedData_v4' does not
explicitly state that the required struct 'EIP712Domain' has to define
any members [1]. The current implementation cannot correctly encode
such a structure, as it assumes that at least one member has been
parsed and added to the struct's string representation.

[1] https://eips.ethereum.org/EIPS/eip-712#specification-of-the-eth_signtypeddata-json-rpc

Steps To Reproduce

Pass a valid structured data object where a type structure lacks a member:

{
  "types": {
    "EIP712Domain": []
  },
  "primaryType": "EIP712Domain",
  "domain": {},
  "message": {}
}

Expected behavior

The internal function encodeStruct should return "EIP712Domain()" when encoding EIP712Domain.

Actual behavior

The internal function returns "EIP712Domain)"

Environment

  • Web3j version: First found using the latest android release 4.8.8-android. Reproduced on master ac0618c4d38ca780a7781d58255ff8b38626d7fc
@Supertuba12 Supertuba12 added the bug A bug in behaviour or functionality label Sep 26, 2023
@NickSneo
Copy link
Contributor

NickSneo commented Oct 4, 2023

Thanks for reporting and contributing.

@NickSneo
Copy link
Contributor

NickSneo commented Oct 4, 2023

PR merged

@NickSneo NickSneo closed this as completed Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug in behaviour or functionality
Projects
None yet
Development

No branches or pull requests

2 participants