Skip to content

Support ABI hashing for static dynamic arrays#1863

Merged
Th0rgal merged 1 commit into
mainfrom
codex/unlink-context-hash-abi
May 14, 2026
Merged

Support ABI hashing for static dynamic arrays#1863
Th0rgal merged 1 commit into
mainfrom
codex/unlink-context-hash-abi

Conversation

@Th0rgal
Copy link
Copy Markdown
Member

@Th0rgal Th0rgal commented May 14, 2026

Summary

  • add a Hashing ECM for keccak256(abi.encode(array)) where the dynamic-array elements have fixed static word width
  • cover ABI head/length/payload layout, argument validation, and trust-report assumptions in CompilationModelFeatureTest
  • remove a latent duplicate externals field in a feature-test spec that was exposed by rebuilding the file

Verification

  • lake build Compiler.Modules.Hashing Compiler.CompilationModelFeatureTest
  • lake build PrintAxioms
  • python3 scripts/generate_print_axioms.py --check
  • python3 scripts/check_axioms.py
  • git diff --check

Note

Medium Risk
Adds a new hashing/codegen module that manipulates calldata and free memory, so incorrect layout/length calculations could silently change contract hashes. Scope is contained and covered by new compilation/Yul layout assertions and validation error tests.

Overview
Adds Compiler.Modules.Hashing.abiEncodeStaticArrayModule (and abiEncodeStaticArray) to compute keccak256(abi.encode(array)) for dynamic-array parameters with static-sized elements, using {param}_length/{param}_data_offset, copying the contiguous payload into free memory, and hashing the ABI head+length+data.

Extends CompilationModelFeatureTest with a smoke spec that asserts key Yul layout properties, plus negative specs for bad ECM arity and zero-width elements; also asserts the trust report includes the new ABI-layout and keccak assumptions. Removes an accidentally duplicated externals block from an unrelated ADT alias payload test spec.

Reviewed by Cursor Bugbot for commit 38e2d0d. Bugbot is set up for automated code reviews on this repo. Configure here.

@Th0rgal Th0rgal merged commit 014f65a into main May 14, 2026
4 checks passed
@Th0rgal Th0rgal deleted the codex/unlink-context-hash-abi branch May 14, 2026 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant