Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Wrong encoding and decoding tests for two-dimensional variadic arrays #1570

Closed
@abdulowork

Description

@abdulowork

Encoding of two-dimensional variadic arrays in these tests is wrong:

https://github.com/ethereum/web3.js/blob/f15caf13c91682cccd7b7762b80feadb9fb969dc/test/coder.encodeParam.js#L43-L64

I took these tests for my own implementation of ABI encoding and found out that contracts would not deploy when I wrote some integration tests. These tests are built on the premise that offset of dynamic elements in a dynamic collection should be counted from the beginning of the whole encoding. The correct encoding is that offset is counted from the beginning of the dynamic collection regardless of the position of the dynamic collection in the whole encoding.

Here is a deployed contract using a correct encoding in the ctor: https://kovan.etherscan.io/address/0x812b72fa1fb3b842cb193d743a44ec8439c9a060#readContract

Here is my corrected version of the tests zeriontech/Web3Swift@8ab1f12
I would be very grateful if you star my project if that information was of any help : )

Metadata

Metadata

Assignees

Labels

BugAddressing a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions