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

Collect staged contracts from the storage itself #5659

Merged
merged 11 commits into from
Apr 12, 2024

Conversation

SupunS
Copy link
Member

@SupunS SupunS commented Apr 11, 2024

Work for onflow/cadence#3050

Assuming the state/storage that is currently being migrated also contains the staged contracts captured by the MigrationContractStaging, this change will read and collect those staged contracts from the storage itself, so they don't needs to be provided externally as a CSV file, etc.

The old way of providing the staged contracts externally/as an argument (as a CSV file) is still supported. The new approach comes into effect only if they are not externally provided.

@SupunS SupunS self-assigned this Apr 11, 2024
@SupunS SupunS marked this pull request as ready for review April 11, 2024 20:09
Co-authored-by: Giovanni Sanchez <108043524+sisyphusSmiling@users.noreply.github.com>
Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

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

Great work!

cmd/util/ledger/migrations/staged_contracts_migration.go Outdated Show resolved Hide resolved
cmd/util/ledger/migrations/staged_contracts_migration.go Outdated Show resolved Hide resolved
cmd/util/ledger/migrations/staged_contracts_migration.go Outdated Show resolved Hide resolved
cmd/util/ledger/migrations/staged_contracts_migration.go Outdated Show resolved Hide resolved
Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

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

Nice!

@codecov-commenter
Copy link

codecov-commenter commented Apr 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.79%. Comparing base (39f59b1) to head (22c51a5).
Report is 544 commits behind head on feature/stable-cadence.

Additional details and impacted files
@@                    Coverage Diff                     @@
##           feature/stable-cadence    #5659      +/-   ##
==========================================================
+ Coverage                   55.78%   59.79%   +4.01%     
==========================================================
  Files                         997      574     -423     
  Lines                       98760    55629   -43131     
==========================================================
- Hits                        55094    33265   -21829     
+ Misses                      39400    19927   -19473     
+ Partials                     4266     2437    -1829     
Flag Coverage Δ
unittests 59.79% <ø> (+4.01%) ⬆️

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.

@SupunS SupunS requested a review from a team April 12, 2024 01:44

// Filter-in only the payloads belong to the staging account.
stagingAccountPayloads := make([]*ledger.Payload, 0)
for _, payload := range allPayloads {
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be worth checking if allPayloads area already sorted at this point, that would speed up filtering the payloads.

Copy link
Member Author

@SupunS SupunS Apr 12, 2024

Choose a reason for hiding this comment

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

how can I check that?

@SupunS SupunS force-pushed the supun/staged-contracts branch 2 times, most recently from 045d6bc to 3e4988f Compare April 12, 2024 16:19
@SupunS
Copy link
Member Author

SupunS commented Apr 12, 2024

@turbolent @janezpodhostnik can you maybe have a one last look, particularly the (last) commits:

Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

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

👍

@turbolent turbolent merged commit a3493b9 into feature/stable-cadence Apr 12, 2024
55 checks passed
@turbolent turbolent deleted the supun/staged-contracts branch April 12, 2024 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants