Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FVM] Recover NFT contract #6388

Merged
merged 7 commits into from
Aug 23, 2024
Merged

[FVM] Recover NFT contract #6388

merged 7 commits into from
Aug 23, 2024

Conversation

turbolent
Copy link
Member

@turbolent turbolent commented Aug 22, 2024

Work towards onflow/cadence#3480

Add support for recovering contracts conforming to the pre-Cadence 1.0 NFT standard.

@turbolent turbolent requested review from joshuahannan and a team August 22, 2024 18:42
@turbolent turbolent self-assigned this Aug 22, 2024
@codecov-commenter
Copy link

codecov-commenter commented Aug 22, 2024

Codecov Report

Attention: Patch coverage is 15.96639% with 100 lines in your changes missing coverage. Please review.

Project coverage is 41.49%. Comparing base (4df1bf3) to head (ab9e300).

Files Patch % Lines
fvm/environment/program_recovery.go 6.18% 91 Missing ⚠️
cmd/util/ledger/migrations/migrator_runtime.go 71.42% 2 Missing and 2 partials ⚠️
...til/ledger/migrations/account_storage_migration.go 0.00% 2 Missing ⚠️
cmd/util/ledger/migrations/cadence.go 50.00% 1 Missing ⚠️
...util/ledger/migrations/cadence_values_migration.go 50.00% 1 Missing ⚠️
...til/ledger/migrations/fix_broken_data_migration.go 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6388      +/-   ##
==========================================
- Coverage   41.51%   41.49%   -0.03%     
==========================================
  Files        2013     2013              
  Lines      143518   143577      +59     
==========================================
- Hits        59577    59572       -5     
- Misses      77761    77830      +69     
+ Partials     6180     6175       -5     
Flag Coverage Δ
unittests 41.49% <15.96%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

fvm/environment/program_recovery.go Outdated Show resolved Hide resolved
Copy link
Member

@joshuahannan joshuahannan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "Recovered Contract" the best name for it? I worry that developers who are unaware of this will be confused by the error messages. Maybe we just need to update the error messages to have more detail, like, "{Contract Name} is no longer functional. A version of the contract has been recovered to allow access to a small subset of functionality. isAvailableToWithdraw is not available in recovered program."

@turbolent
Copy link
Member Author

@joshuahannan Great idea! I tried to improve the error messages in 2844c97

@SupunS PTAL: I realized there was a bug when printing the errors from the panics and opened onflow/cadence#3548. I also refactored the "finalize and merge" of the changes in the migration in 2844c97 (introduces the Commit function) and 1c21cd1 (uses it in more migrations)

@turbolent turbolent changed the base branch from master to auto-update-onflow-cadence-v1.0.0-preview.50 August 23, 2024 00:26
Copy link
Member

@SupunS SupunS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Base automatically changed from auto-update-onflow-cadence-v1.0.0-preview.50 to master August 23, 2024 10:24
@bluesign
Copy link
Contributor

I haven't check too much, but collection seems missing, I think adding also collection is important (with ownedNFTs)

@turbolent
Copy link
Member Author

@bluesign right, that's planned to be added next

@turbolent turbolent enabled auto-merge August 23, 2024 14:57
@turbolent turbolent added this pull request to the merge queue Aug 23, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 23, 2024
@turbolent turbolent added this pull request to the merge queue Aug 23, 2024
Merged via the queue into master with commit 400bcd0 Aug 23, 2024
55 checks passed
@turbolent turbolent deleted the bastian/recover-nft branch August 23, 2024 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants