Skip to content

Commit

Permalink
Merge pull request #3695 from onflow/bastian/account-migration-schedu…
Browse files Browse the repository at this point in the history
…ling-return-value

[Account Storage Maps] Add return value to account migration scheduling functions
  • Loading branch information
turbolent authored Nov 26, 2024
2 parents 5646c24 + c8a6176 commit 8e40b73
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions runtime/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,16 +514,24 @@ func (s *Storage) commit(inter *interpreter.Interpreter, commitContractUpdates b
}
}

func (s *Storage) ScheduleV2Migration(address common.Address) {
func (s *Storage) ScheduleV2Migration(address common.Address) bool {
if !s.Config.StorageFormatV2Enabled {
return false
}
s.scheduledV2Migrations = append(s.scheduledV2Migrations, address)
return true
}

func (s *Storage) ScheduleV2MigrationForModifiedAccounts() {
func (s *Storage) ScheduleV2MigrationForModifiedAccounts() bool {
for address, isV1 := range s.cachedV1Accounts { //nolint:maprange
if isV1 && s.PersistentSlabStorage.HasUnsavedChanges(atree.Address(address)) {
s.ScheduleV2Migration(address)
if !s.ScheduleV2Migration(address) {
return false
}
}
}

return true
}

func (s *Storage) migrateV1AccountsToV2(inter *interpreter.Interpreter) error {
Expand Down

0 comments on commit 8e40b73

Please sign in to comment.