From c8a61764cba5f2456b738adfd10fad5673b90579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20M=C3=BCller?= Date: Mon, 25 Nov 2024 14:50:33 -0800 Subject: [PATCH] add return value to migration scheduling functions --- runtime/storage.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/runtime/storage.go b/runtime/storage.go index 8198e69fa..d22c1cd62 100644 --- a/runtime/storage.go +++ b/runtime/storage.go @@ -370,16 +370,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 {