Normal behavior:
Merkle trees should be generated using a deterministic encoding of input data, so that the same inputs always yield the same root and proof structure. Typically this involves abi.encodePacked(a, b)
or manual formatting that produces predictable bytes.
Issue:
This script uses abi.encode(data)
where data
is a bytes32[]
array. Solidity prepends array offset and length (64 bytes total), so ltrim64()
is called to remove those bytes. But this fix is fragile, as changes in memory layout, array size, or tooling could still cause inconsistencies.
Likelihood: Medium
This occurs any time abi.encode(data)
is used on a dynamically-sized memory array of bytes32
, which introduces a prefix offset and length due to Solidity ABI encoding rules.
The script tries to “fix” this using ltrim64()
(from Murky), but this is not a robust or formally safe solution for consistent leaf hashing across environments or runtimes.
Impact: Medium
Merkle roots generated by this script may not match the same input set processed elsewhere, breaking airdrop proof verification and causing users to lose access to rewards.
Subtle differences in byte encoding between environments (like Foundry vs JS Merkle tools) result in different roots, undermining trust in the airdrop process.
The PoC shows how abi.encode(data)
produces memory-aligned bytes that are not stable across contexts. Even trimming 64 bytes with ltrim64()
can still result in misaligned roots, breaking reproducibility across tools or between devs and the deployed contract.
Replace the indirect abi.encode(...)
+ ltrim64(...)
+ keccak256
logic with a clean, deterministic abi.encodePacked(...)
of the address and amount. This guarantees consistent leaf encoding across all environments and tools.
abi.encodePacked(a, b)
produces a tightly packed format, ideal for hashing.
Eliminates reliance on Murky’s ltrim64()
hack and memory-offset assumptions.
Fixes reproducibility across Foundry, JavaScript, or Etherscan-based Merkle tools.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.