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

Getting a struct inside a map of a mock does not always return the proper structure #188

Open
jeremyjams opened this issue Sep 1, 2023 · 0 comments · May be fixed by #189
Open

Getting a struct inside a map of a mock does not always return the proper structure #188

jeremyjams opened this issue Sep 1, 2023 · 0 comments · May be fixed by #189

Comments

@jeremyjams
Copy link

jeremyjams commented Sep 1, 2023

Describe the bug
Getting a struct inside a map of a mock does not always return the proper structure.

3 new tests reading a struct in a map have been added to the readable-storage-logic.spec.ts test suite.

  • mapping(bytes32 => SimpleStruct) ✔️
  • mapping(bytes32 => PackedStruct) ✔️
  • mapping(bytes32 => OtherPackedStruct) 🔴

Reproduction steps

  1. Checkout code to the attached PR (#189)
  2. npm i
  3. npx hardhat typechain
  4. yarn run mocha test/unit/mock/readable-storage-logic.spec.ts

image

Expected behavior

  • Expected output:
{
  packedA: ADDRESS_EXAMPLE,
  packedB: '0x000000000000000000000001',
}
  • Actual output:
should be able to get values in a bytes32 => OtherPackedStruct mapping:

      + expected - actual

       {
         "packedA": "0x558ba9b8d78713fbf768c1f8a584485B4003f43F"
      -  "packedB": "0x3f"
      +  "packedB": "0x000000000000000000000001"
       }

System Specs:

  • OS: Linux/Ubuntu
@jeremyjams jeremyjams linked a pull request Sep 1, 2023 that will close this issue
2 tasks
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 a pull request may close this issue.

1 participant