onflow / cadence

Cadence, the resource-oriented smart contract programming language 🏃‍♂️
https://cadence-lang.org
Apache License 2.0
534 stars 138 forks source link

View checking incorrectly assumes code type-checks #3529

Closed j1010001 closed 3 months ago

j1010001 commented 3 months ago

TN migration for ac391223d88c98e4.PuffPalz runs into runtime error: invalid memory address or nil pointer dereference.

Investigate the root cause and evaluate if it is feasible to fix this for Mainnet migration.

Slack: https://flow-foundation.slack.com/archives/C074F78ECNL/p1723592715418549

turbolent commented 3 months ago

This occurs in the view checking, seemingly because it assumes the code successfully type checks.

Minimal reproducer:

view fun f() { a[b] = 1 }

Here, the indexing expression of the assignment is invalid, because neither a or b are defined.