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

Cadence Account Storage Map Migration #6761

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5c65c32
update to Cadence with account storage map support: feature/combine-d…
turbolent Nov 26, 2024
e7d04a4
inject scheduleAccountV2Migration function into service account Accou…
turbolent Nov 26, 2024
95ca4de
update dependencies in other modules
turbolent Nov 26, 2024
8e6fbbf
export address generator constructor
turbolent Nov 27, 2024
de4b564
add AccountV2Migration contract
turbolent Nov 27, 2024
f611094
temporarily unrestrict availability scheduleAccountV2Migration function
turbolent Nov 27, 2024
c75d4fc
call account migration function from system chunk transaction
turbolent Nov 27, 2024
b31696c
add missing argument for new chain parameter
turbolent Nov 27, 2024
0906f96
update to latest commit of feature branch
turbolent Nov 27, 2024
2a04742
add function to return storage format of an account
turbolent Nov 27, 2024
5794140
fix setup for AccountV2Migration contract
turbolent Dec 3, 2024
b1c86c5
adjust expected state commitments and system chunk transaction hashes
turbolent Dec 3, 2024
06420d1
remove chain ID arguments
turbolent Dec 3, 2024
0a393ef
add new weight for string template expressions
turbolent Dec 3, 2024
2b1ecac
Merge branch 'auto-update-onflow-cadence-v1.3.0' into bastian/account…
turbolent Dec 4, 2024
a1ca332
fix address generation
turbolent Dec 5, 2024
8b597cb
test account v2 format migration of service account
turbolent Dec 5, 2024
f86dd29
remove enabled flag, use batch size
turbolent Dec 6, 2024
814c47a
verify migration event
turbolent Dec 6, 2024
e910cd0
add integration test for account storage format v2 migration using in…
turbolent Dec 6, 2024
a57912f
add a new Migration system account contract, call it in system chunk tx
turbolent Dec 12, 2024
d24f07e
adjust expected hashes
turbolent Dec 12, 2024
9199db6
enable storage format v2 for all but mainnet
janezpodhostnik Jan 9, 2025
0cece3b
Merge pull request #6864 from onflow/janez/account-storage-map-migration
turbolent Jan 9, 2025
c5dc08e
Merge branch 'master' into bastian/account-storage-map-migration
turbolent Jan 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
call account migration function from system chunk transaction
  • Loading branch information
turbolent committed Nov 27, 2024
commit c75d4fc964645e7ca9f17f5793c74e92673b41d4
12 changes: 8 additions & 4 deletions fvm/blueprints/scripts/systemChunkTransactionTemplate.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import FlowEpoch from "FlowEpoch"
import NodeVersionBeacon from "NodeVersionBeacon"
import RandomBeaconHistory from "RandomBeaconHistory"
import EVM from "EVM"
import AccountV2Migration from "AccountV2Migration"

transaction {
prepare(serviceAccount: auth(BorrowValue) &Account) {
Expand All @@ -19,9 +20,12 @@ transaction {
?? panic("Couldn't borrow RandomBeaconHistory.Heartbeat Resource")
randomBeaconHistoryHeartbeat.heartbeat(randomSourceHistory: randomSourceHistory())

let evmHeartbeat = serviceAccount.storage.borrow<&EVM.Heartbeat>(from: /storage/EVMHeartbeat)
if evmHeartbeat != nil { // skip if not available
evmHeartbeat!.heartbeat()
}
let evmHeartbeat = serviceAccount.storage
.borrow<&EVM.Heartbeat>(from: /storage/EVMHeartbeat)
evmHeartbeat?.heartbeat()
Copy link
Contributor

Choose a reason for hiding this comment

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

I spent way to long looking for a ". operator in the cadence language docs only to find out there is something wrong with the fonts:
image

Copy link
Member Author

Choose a reason for hiding this comment

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

Where is this screenshot from? GitHub? VS Code? It"s probably not a problem with the PR though?

Copy link
Contributor

Choose a reason for hiding this comment

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

This is github on firefox. No not an issue in the PR. Just some sort of font issue somewhere.


let accountV2MigrationAdmin = serviceAccount.storage
.borrow<&AccountV2Migration.Admin>(from: AccountV2Migration.adminStoragePath)
accountV2MigrationAdmin?.migrateNextBatch()
}
}
9 changes: 8 additions & 1 deletion fvm/blueprints/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ var systemChunkTransactionTemplate string
// TODO: when the EVM contract is moved to the flow-core-contracts, we can
// just directly use the replace address functionality of the templates package.

var placeholderEVMAddress = "\"EVM\""
const placeholderEVMAddress = "\"EVM\""

const placeholderAccountV2MigrationAddress = "\"AccountV2Migration\""

func prepareSystemContractCode(chainID flow.ChainID) string {
sc := systemcontracts.SystemContractsForChain(chainID)
Expand All @@ -34,6 +36,11 @@ func prepareSystemContractCode(chainID flow.ChainID) string {
placeholderEVMAddress,
sc.EVMContract.Address.HexWithPrefix(),
)
code = strings.ReplaceAll(
code,
placeholderAccountV2MigrationAddress,
sc.AccountV2Migration.Address.HexWithPrefix(),
)
return code
}

Expand Down
Loading