Skip to content

compilation: normalize user-defined ABI types in crytic exports#800

Open
nisedo wants to merge 1 commit into
masterfrom
dev/abi-type-normalization
Open

compilation: normalize user-defined ABI types in crytic exports#800
nisedo wants to merge 1 commit into
masterfrom
dev/abi-type-normalization

Conversation

@nisedo

@nisedo nisedo commented Feb 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix ABI parsing failures from crytic-compile exports where ABI entries use user-defined names in type (for example enum/contract/interface aliases) instead of canonical ABI types.
  • Add a fallback in ParseABIFromInterface to normalize ABI type fields using internalType (enum -> uint8, contract/interface -> address, struct -> tuple) while preserving array suffixes, then retry parsing.
  • Add a regression test that reproduces the alias-based parse failure and validates successful parsing after normalization for nested tuple and array cases.

Why

Running medusa fuzz against a harness can fail before the fuzzing starts with unable to parse ABI for contract 'CollateralFloorMath'. The exported ABI contained alias-like type values (e.g. NftKind, IPositionManager) that the ABI parser rejects. This change makes Medusa resilient to that export shape without changing behavior for already-canonical ABIs.

Test plan

  • go test -v ./compilation/types -run TestParseABIFromInterface_NormalizesUserDefinedTypes
  • go fmt ./...
  • python3 scripts/check_docs.py
  • golangci-lint run --timeout 5m0s
  • actionlint

Retry ABI parsing after canonicalizing enum/contract/interface aliases to ABI-compatible types, and add a regression test covering nested tuple and array cases.

Co-authored-by: Cursor <[email protected]>
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