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

Update core contracts to latest stable cadence #382

Merged
merged 23 commits into from
Nov 21, 2023

Conversation

SupunS
Copy link
Member

@SupunS SupunS commented Sep 13, 2023

No description provided.

@SupunS SupunS self-assigned this Sep 13, 2023
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.

Thank you for making all these changes! I really appreciate it. I just had a few comments and questions

contracts/FlowIDTableStaking.cdc Show resolved Hide resolved
contracts/FlowIDTableStaking.cdc Show resolved Hide resolved
transactions/epoch/admin/update_clusters.cdc Outdated Show resolved Hide resolved
transactions/epoch/admin/update_dkg_phase_views.cdc Outdated Show resolved Hide resolved
transactions/epoch/admin/update_staking_views.cdc Outdated Show resolved Hide resolved
transactions/epoch/admin/update_reward.cdc Outdated Show resolved Hide resolved
transactions/epoch/admin/update_epoch_views.cdc Outdated Show resolved Hide resolved
transactions/epoch/admin/update_epoch_config.cdc 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.

Great work! That was a lot of code to update, well done! 👏

Looks good in general 👍

Only really one suggestion throughout: Account.capabilities.borrow can be used instead of get + borrow

contracts/FlowServiceAccount.cdc Outdated Show resolved Hide resolved
contracts/FlowServiceAccount.cdc Outdated Show resolved Hide resolved
contracts/FlowStakingCollection.cdc Show resolved Hide resolved
contracts/FlowStakingCollection.cdc Outdated Show resolved Hide resolved
contracts/FlowStakingCollection.cdc Outdated Show resolved Hide resolved
contracts/FlowStakingCollection.cdc Outdated Show resolved Hide resolved
@SupunS SupunS force-pushed the supun/stable-cadence branch from 06c9217 to f6aaf58 Compare September 14, 2023 20:27
@SupunS SupunS force-pushed the supun/stable-cadence branch from f6aaf58 to ebc1726 Compare September 14, 2023 20:32
@SupunS SupunS force-pushed the supun/stable-cadence branch from 39bde78 to cd2e762 Compare September 15, 2023 22:38
@SupunS SupunS force-pushed the supun/stable-cadence branch from cd2e762 to fa9343b Compare September 15, 2023 22:45
@SupunS SupunS force-pushed the supun/stable-cadence branch from 25eca83 to 2daea3d Compare September 18, 2023 23:06
@SupunS SupunS marked this pull request as ready for review September 19, 2023 15:00
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! 👏 So many files! 😮‍💨😰

Maybe run the parse tool on all the transactions to at least check they're syntactically are OK: https://github.com/onflow/cadence/tree/master/runtime/cmd/parse.

Maybe also the check tool can be run on the transactions?

contracts/FlowIDTableStaking.cdc Show resolved Hide resolved
contracts/FlowStakingCollection.cdc Outdated Show resolved Hide resolved
transactions/flowToken/create_forwarder.cdc Outdated Show resolved Hide resolved
transactions/idTableStaking/node/node_add_capability.cdc Outdated Show resolved Hide resolved
@SupunS
Copy link
Member Author

SupunS commented Sep 21, 2023

I think the existing tests should already cover parsing/checking/interpreting all transactions/contracts. But unfortunately, not all tests are passing at the moment because not everything is migrated completely. (i.e. the base branch stable-cadence tests are also failing). I tested the contracts used by flow-go, emulator, and CLI, and made sure they were all correct. But as for the rest, their correctness would only be guaranteed once the tests are passing

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.

Tried to fix and improve some more things in 196c87a.
@SupunS Could you please have a look and check these manual/untested changes work and do not break anything?

There are a couple more things I noticed:

  • Some transactions still use restricted types:

    • transactions/flowToken/scripts/get_balance.cdc
    • transactions/flowToken/setup_account.cdc
  • TESTFlowStakingCollection replaces access(self) with pub. Should be access(all) now

In general, the use of the invalid import 0xFOO syntax in Cadence programs prevents them from being parsed and checked by tools, and I also think not editable using IDEs / with the Language Server.

The imports should be changed to the supported, and standardized syntax (FLIP). Probably best in a separate, follow-up PR to not increase the scope of this PR.

transactions/lockedTokens/user/get_total_balance.cdc Outdated Show resolved Hide resolved
transactions/lockedTokens/user/get_total_balance.cdc Outdated Show resolved Hide resolved
@SupunS SupunS force-pushed the supun/stable-cadence branch from 67ea336 to fdc1be6 Compare September 26, 2023 16:35
@SupunS
Copy link
Member Author

SupunS commented Sep 26, 2023

@turbolent I re-generated the assets and tested with flow-go. Needed just one minor adjustment, and everything looks good: https://github.com/onflow/flow-go/actions/runs/6315719064/job/17148896286?pr=4762

@SupunS
Copy link
Member Author

SupunS commented Sep 26, 2023

I guess we can merge this PR at the current state, and do the remaining migrations in follow-up PRs.

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.

Yep, looks good!

From what I can see in the test logs, only the state commitments are (expectedly) off

@SupunS
Copy link
Member Author

SupunS commented Sep 27, 2023

From what I can see in the test logs, only the state commitments are (expectedly) off

Yes, correct.

@joshuahannan joshuahannan merged commit 2ba8ec1 into stable-cadence Nov 21, 2023
@joshuahannan joshuahannan deleted the supun/stable-cadence branch November 21, 2023 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants