onflow / cadence

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

Prevent leaving unreferenced slabs in storage while updating dictionary with enum key (port internal fix) #3508

Closed fxamacker closed 3 weeks ago

fxamacker commented 3 months ago

A bugfix is available to resolve cadence-internal issue:

Please review and consider merging to:

The bugfix PR (as of July 29, 2024) is about:

The fix avoids the drawbacks I described for two alternative approaches considered.

Caveats

The condition to trigger the bugfix code can be narrow (original PR) to reduce risk of introducing bugs.

However, as Supun mentioned in PR review feedback, a wider condition (updated PR) can help avoid having to update the condition later if new (relevant) types are added after Cadence 1.0 is deployed.

Both approaches are reasonable and require testing before deployment.

fxamacker commented 2 months ago

@SupunS Many thanks for review, feedback, and approving https://github.com/dapperlabs/cadence-internal/pull/242 earlier this week! :pray:

@turbolent Good to have you back! PTAL at PR https://github.com/dapperlabs/cadence-internal/pull/242 :pray: (when you have time).

fxamacker commented 3 weeks ago

Closed by #3602.