Repository navigation
fix: support dynamic fields in event signatures - #1522
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 539cd703e2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@sbillig This one is ready for human review |
Build canonical Solidity type names for dynamic-array event fields while preserving correct topic and payload encoding. Diagnose unsupported indexed dynamic fields from resolved core types, including aliases, without rejecting shadowed user types. Surface generated TOPIC0 CTFE failures and semantic-constant reification failures instead of panicking, with focused UI and execution regressions.
c1e2c5a to
8673474
Compare
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8673474594
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Recurse through fixed-array elements when detecting indexed dynamic event fields, including nested type aliases. Add diagnostic regressions for dynamic arrays and a static-array counterexample.
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@g-r-a-n-t @sbillig @micahscopes anyone cares to review this? I think we should take this for the upcoming release |
Whether a trait impl constant's body was checked depended on where the impl came from. Raw impls were checked. The `#[event]` and `#[error]` desugarings were checked with their body diagnostics suppressed, since an error in a field's source type would otherwise cascade into the generated body, and only the contextual CTFE diagnostic from #1522 was reported. Generated `msg` impls were skipped entirely. Record the choice on each constant instead. `AssocConstBodyCheckPolicy` defaults to `BodyAnalysis`, the ordinary check of the value against its expected type, and a generated origin alone no longer exempts a body. Message selectors keep their dedicated checker (`MsgSelectorAnalysis`), which reports their body errors before checking uniqueness. The existing event, error and message ABI constants are marked `ExpansionSourceCompatibility`, which keeps today's behavior: the body is checked, its diagnostics are suppressed, and an event or error body that type-checks still gets #1522's contextual CTFE diagnostic. A fieldless event has no field errors to cascade from, so its `TOPIC0` uses ordinary checking. No other diagnostics change.
Whether a trait impl constant's body was checked depended on where the impl came from. Raw impls were checked. The `#[event]` and `#[error]` desugarings were checked with their body diagnostics suppressed, since an error in a field's source type would otherwise cascade into the generated body, and only the contextual CTFE diagnostic from #1522 was reported. Generated `msg` impls were skipped entirely. Record the choice on each constant instead. `AssocConstBodyCheckPolicy` defaults to `BodyAnalysis`, the ordinary check of the value against its expected type, and a generated origin alone no longer exempts a body. Message selectors keep their dedicated checker (`MsgSelectorAnalysis`), which reports their body errors before checking uniqueness. The existing event, error and message ABI constants are marked `ExpansionSourceCompatibility`, which keeps today's behavior: the body is checked, its diagnostics are suppressed, and an event or error body that type-checks still gets #1522's contextual CTFE diagnostic. A fieldless event has no field errors to cascade from, so its `TOPIC0` uses ordinary checking. No other diagnostics change.
Whether a trait impl constant's body was checked depended on where the impl came from. Raw impls were checked. The `#[event]` and `#[error]` desugarings were checked with their body diagnostics suppressed, since an error in a field's source type would otherwise cascade into the generated body, and only the contextual CTFE diagnostic from #1522 was reported. Generated `msg` impls were skipped entirely. Record the choice on each constant instead. `AssocConstBodyCheckPolicy` defaults to `BodyAnalysis`, the ordinary check of the value against its expected type, and a generated origin alone no longer exempts a body. Message selectors keep their dedicated checker (`MsgSelectorAnalysis`), which reports their body errors before checking uniqueness. The existing event, error and message ABI constants are marked `ExpansionSourceCompatibility`, which keeps today's behavior: the body is checked, its diagnostics are suppressed, and an event or error body that type-checks still gets #1522's contextual CTFE diagnostic. A fieldless event has no field errors to cascade from, so its `TOPIC0` uses ordinary checking. No other diagnostics change.
Whether a trait impl constant's body was checked depended on where the impl came from. Raw impls were checked. The `#[event]` and `#[error]` desugarings were checked with their body diagnostics suppressed, since an error in a field's source type would otherwise cascade into the generated body, and only the contextual CTFE diagnostic from #1522 was reported. Generated `msg` impls were skipped entirely. Record the choice on each constant instead. `AssocConstBodyCheckPolicy` defaults to `BodyAnalysis`, the ordinary check of the value against its expected type, and a generated origin alone no longer exempts a body. Message selectors keep their dedicated checker (`MsgSelectorAnalysis`), which reports their body errors before checking uniqueness. The existing event, error and message ABI constants are marked `ExpansionSourceCompatibility`, which keeps today's behavior: the body is checked, its diagnostics are suppressed, and an event or error body that type-checks still gets #1522's contextual CTFE diagnostic. A fieldless event has no field errors to cascade from, so its `TOPIC0` uses ordinary checking. No other diagnostics change.
Whether a trait impl constant's body was checked depended on where the impl came from. Raw impls were checked. The `#[event]` and `#[error]` desugarings were checked with their body diagnostics suppressed, since an error in a field's source type would otherwise cascade into the generated body, and only the contextual CTFE diagnostic from #1522 was reported. Generated `msg` impls were skipped entirely. Record the choice on each constant instead. `AssocConstBodyCheckPolicy` defaults to `BodyAnalysis`, the ordinary check of the value against its expected type, and a generated origin alone no longer exempts a body. Message selectors keep their dedicated checker (`MsgSelectorAnalysis`), which reports their body errors before checking uniqueness. The existing event, error and message ABI constants are marked `ExpansionSourceCompatibility`, which keeps today's behavior: the body is checked, its diagnostics are suppressed, and an event or error body that type-checks still gets #1522's contextual CTFE diagnostic. A fieldless event has no field errors to cascade from, so its `TOPIC0` uses ordinary checking. No other diagnostics change.
Whether a trait impl constant's body was checked depended on where the impl came from. Raw impls were checked. The `#[event]` and `#[error]` desugarings were checked with their body diagnostics suppressed, since an error in a field's source type would otherwise cascade into the generated body, and only the contextual CTFE diagnostic from #1522 was reported. Generated `msg` impls were skipped entirely. Record the choice on each constant instead. `AssocConstBodyCheckPolicy` defaults to `BodyAnalysis`, the ordinary check of the value against its expected type, and a generated origin alone no longer exempts a body. Message selectors keep their dedicated checker (`MsgSelectorAnalysis`), which reports their body errors before checking uniqueness. The existing event, error and message ABI constants are marked `ExpansionSourceCompatibility`, which keeps today's behavior: the body is checked, its diagnostics are suppressed, and an event or error body that type-checks still gets #1522's contextual CTFE diagnostic. A fieldless event has no field errors to cascade from, so its `TOPIC0` uses ordinary checking. No other diagnostics change.
Whether a trait impl constant's body was checked depended on where the impl came from. Raw impls were checked. The `#[event]` and `#[error]` desugarings were checked with their body diagnostics suppressed, since an error in a field's source type would otherwise cascade into the generated body, and only the contextual CTFE diagnostic from #1522 was reported. Generated `msg` impls were skipped entirely. Record the choice on each constant instead. `AssocConstBodyCheckPolicy` defaults to `BodyAnalysis`, the ordinary check of the value against its expected type, and a generated origin alone no longer exempts a body. Message selectors keep their dedicated checker (`MsgSelectorAnalysis`), which reports their body errors before checking uniqueness. The existing event, error and message ABI constants are marked `ExpansionSourceCompatibility`, which keeps today's behavior: the body is checked, its diagnostics are suppressed, and an event or error body that type-checks still gets #1522's contextual CTFE diagnostic. A fieldless event has no field errors to cascade from, so its `TOPIC0` uses ordinary checking. No other diagnostics change.
Motivation
Non-indexed
DynArray<T>event fields cannot produce canonical Solidityevent signatures because the required
SolCompatimplementations are missing.Evaluating the generated
TOPIC0can consequently trigger a compiler panic.For example:
This should produce
ValuesChanged(uint256[]). Imported aliases and nestedtypes such as
DynArray<[u256; 2]>must also resolve to their canonicalSolidity names.
What changed
SolCompatimplementations for dynamic and fixed-size arrays.SolCompatresolution,supporting imported aliases, nested arrays, and user-defined types named
DynArray.TOPIC0evaluation failures and runtime semantic-constantevaluation/reification failures instead of panicking.
Event payload encoding uses the existing implementation on
master, whichalready encodes non-empty event data as a tuple, including singleton fields.
Result
Non-indexed dynamic array event fields produce Solidity-compatible signatures
and payloads. For the example above:
Indexed dynamic fields remain unsupported and receive a targeted diagnostic.
Test coverage
including singleton dynamic fields and fixed-size array elements.
Bytes,DynString,DynArray<u256>, andDynArray<Address>event fields.DynArray.TOPIC0compile-time evaluation failures.Validation passed for the full 237-test type-check diagnostic suite, event HIR
tests, CLI event fixtures, runtime log comparisons, and existing event/ERC20
codegen snapshots.