A form becomes expandable when even one field contains an attachment.
SEE IT FOR YOURSELF
Follow a dynamic string from head to tailStep 1 / 4
This example encodes one string parameter with value hello. A dynamic argument uses an offset in its head, even when it is the only argument.
This example encodes one string parameter with value hello. A dynamic argument uses an offset in its head, even when it is the only argument.At argument byte 32, the string tail begins with length five. This counts the UTF-8 payload bytes and excludes all padding.At argument byte 64, read 68 65 6c 6c 6f for hello. Twenty-seven following zero bytes fill the final content word.The encoding uses ninety-six argument bytes: one offset word, one length word and one padded content word. A normal function call adds a four-byte selector before these bytes.
Animated local teaching model. No wallet, RPC or live blockchain data. Some labels and hashes are abbreviated for readability.
Inspect each component
The tuple (uint256,string) contains one static integer and one dynamic string. The containing tuple is dynamic, even when the supplied string happens to be short.
Follow the outer offset
As one top-level parameter, this tuple starts behind an outer offset. Inside its body, the integer appears directly and the string is represented by another offset.
Use the tuple-local pointer
The inner string pointer is 64 for this two-word tuple head. Add it to the tuple body base, not to argument byte zero, to find the string length word.
Distinguish nesting from flat parameters
Two top-level parameters uint256,string share their head at argument byte zero. A single tuple parameter adds an outer pointer layer because that parameter itself is dynamic.
Trace a local example
types: (uint256,string)
values: [["7","hi"]]
no function selector prefix
word 0 · argument offset 0 bytes
0x0000000000000000000000000000000000000000000000000000000000000020
word 1 · argument offset 32 bytes
0x0000000000000000000000000000000000000000000000000000000000000007
word 2 · argument offset 64 bytes
0x0000000000000000000000000000000000000000000000000000000000000040
word 3 · argument offset 96 bytes
0x0000000000000000000000000000000000000000000000000000000000000002
word 4 · argument offset 128 bytes
0x6869000000000000000000000000000000000000000000000000000000000000
An outer offset points to a tuple whose string has a local offset.