Skip to content

Builder Codes overview: example dataSuffix has the length byte in the wrong position #2070

Description

@Jagadeeshftw

Page: https://docs.base.org/specifications/builder-codes/overview (section "Which Wallets Currently Support ERC-8021?", the wallet.sendCalls example)

Problem: the example value is
0x07626173656170700080218021802180218021802180218021
which puts the codes-length byte (07) before the code. ERC-8021 schema 0 is parsed from the end: marker (16 bytes), schema id (1 byte), codes length (1 byte), then the codes. So the length byte must come immediately before the schema id, after the code bytes. Parsed from the end, the example yields a codes length of 0x70 (112), which is invalid.

Proof (ox 1.8.5, ox/erc8021):

$ node -e "import('ox/erc8021').then(({Attribution:A})=>{console.log(A.toDataSuffix({codes:['baseapp']}));console.log(JSON.stringify(A.fromData('0x07626173656170700080218021802180218021802180218021')))})"
0x62617365617070070080218021802180218021802180218021
{"codes":["\u0007baseap"],"id":0}

The ERC's own test vector agrees (0xdddddddd62617365617070070080218021802180218021802180218021 → ["baseapp"]), as does every schema-0 suffix we sampled on Base mainnet (5,374 suffixed transactions in 900 blocks).

Suggested fix: replace the value with 0x62617365617070070080218021802180218021802180218021, or better, generate it in the example with Attribution.toDataSuffix({ codes: ['baseapp'] }) so it can't drift.

Related: the app-developer page's "Quick Setup with Wagmi" (createConfig({ dataSuffix })) currently doesn't attach the suffix for connector wallets in @wagmi/core 3.6.5 (wevm/wagmi#5248). A note pointing to per-call dataSuffix until that is fixed would save integrators from unattributed transactions.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions