argotorg / argotorg/solidity

Specification of ABI decoding (especially padding in bytes)

Open
#6,978 8 comments 0 reactions 0 assignees View on GitHub
documentation :book: medium effort medium impact must have eventually
Dominant language
C++
Stars
25.7k
Forks
6.2k
Avg merge
2d 19h
Merged PRs (30d)
29

Description

According to the doc:
```
bytes, of length k (which is assumed to be of type uint256):

enc(X) = enc(k) pad_right(X), i.e. the number of bytes is encoded as a uint256 followed by the actual value of X as a byte sequence, followed by the minimum number of zero-bytes such that len(enc(X)) is a multiple of 32.
```

But currently some semantic tests do not pad zeros, ex.
https://github.com/ethereum/solidity/blob/91a2a9a9c3cc46b7ef199c2691f06bfcbcda5203/test/libsolidity/semanticTests/abiEncoderV2/calldata_array_dynamic_index_access.sol#L33

I wonder if both ways of encoding are acceptable?

Contributor guide

Open the contributing guide

Research direction

Read the ABI encoding passage quoted in the issue and the referenced test/libsolidity/semanticTests/abiEncoderV2/calldata_array_dynamic_index_access.sol around line 33. Compare the dynamic-bytes calldata encoding with the stated padding rule, then determine whether the specification or semantic test is inconsistent and bring the documented behavior and test expectations into agreement.

Written by the indexing model from the issue text.

Assessment

Tech stack
blockchain, cpp
Domain
blockchain, compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.