From 89cddfdd22564049a9a12de2b61292bcf6a98aaf Mon Sep 17 00:00:00 2001 From: Supun Setunga Date: Wed, 21 Aug 2024 12:25:47 -0700 Subject: [PATCH] Update tests --- .../cadence_values_migration_test.go | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/cmd/util/ledger/migrations/cadence_values_migration_test.go b/cmd/util/ledger/migrations/cadence_values_migration_test.go index 97f0bffa2a7..4d30d26eb39 100644 --- a/cmd/util/ledger/migrations/cadence_values_migration_test.go +++ b/cmd/util/ledger/migrations/cadence_values_migration_test.go @@ -2390,7 +2390,7 @@ func TestStoragePathCapabilityMigration(t *testing.T) { interpreter.UnauthorizedAccess, interpreter.PrimitiveStaticTypeString, ), - CapabilityID: 3, + CapabilityID: 4, }, cadenceValueMigrationEntry{ StorageKey: interpreter.StorageKey{ @@ -2407,7 +2407,7 @@ func TestStoragePathCapabilityMigration(t *testing.T) { Path: interpreter.NewUnmeteredPathValue(common.PathDomainStorage, "d"), }, BorrowType: dBorrowType, - CapabilityID: 4, + CapabilityID: 5, }, cadenceValueMigrationEntry{ StorageKey: interpreter.StorageKey{ @@ -2424,7 +2424,7 @@ func TestStoragePathCapabilityMigration(t *testing.T) { Path: interpreter.NewUnmeteredPathValue(common.PathDomainStorage, "a"), }, BorrowType: borrowType, - CapabilityID: 5, + CapabilityID: 3, }, cadenceValueMigrationEntry{ StorageKey: interpreter.StorageKey{ @@ -2451,6 +2451,25 @@ func TestStoragePathCapabilityMigration(t *testing.T) { require.Equal( t, []any{ + storageCapConIssuedEntry{ + AccountAddress: addressB, + AddressPath: interpreter.AddressPath{ + Address: addressB, + Path: interpreter.NewUnmeteredPathValue(common.PathDomainStorage, "a"), + }, + BorrowType: borrowType, + CapabilityID: 3, + }, + storageCapConsMissingBorrowTypeEntry{ + TargetPath: interpreter.AddressPath{ + Address: addressB, + Path: interpreter.NewUnmeteredPathValue(common.PathDomainStorage, "b"), + }, + StoredPath: interpreter.AddressPath{ + Address: addressB, + Path: interpreter.NewUnmeteredPathValue(common.PathDomainStorage, "bCap"), + }, + }, storageCapConsMissingBorrowTypeEntry{ TargetPath: interpreter.AddressPath{ Address: addressB, @@ -2479,7 +2498,7 @@ func TestStoragePathCapabilityMigration(t *testing.T) { Path: interpreter.NewUnmeteredPathValue(common.PathDomainStorage, "c"), }, BorrowType: inferredBorrowType, - CapabilityID: 3, + CapabilityID: 4, }, storageCapConIssuedEntry{ AccountAddress: addressB, @@ -2488,27 +2507,8 @@ func TestStoragePathCapabilityMigration(t *testing.T) { Path: interpreter.NewUnmeteredPathValue(common.PathDomainStorage, "d"), }, BorrowType: dBorrowType, - CapabilityID: 4, - }, - storageCapConIssuedEntry{ - AccountAddress: addressB, - AddressPath: interpreter.AddressPath{ - Address: addressB, - Path: interpreter.NewUnmeteredPathValue(common.PathDomainStorage, "a"), - }, - BorrowType: borrowType, CapabilityID: 5, }, - storageCapConsMissingBorrowTypeEntry{ - TargetPath: interpreter.AddressPath{ - Address: addressB, - Path: interpreter.NewUnmeteredPathValue(common.PathDomainStorage, "b"), - }, - StoredPath: interpreter.AddressPath{ - Address: addressB, - Path: interpreter.NewUnmeteredPathValue(common.PathDomainStorage, "bCap"), - }, - }, }, issueStorageCapConReporter.entries, ) @@ -2527,9 +2527,9 @@ func TestStoragePathCapabilityMigration(t *testing.T) { let aCap = storage.copy(from: /storage/aCap)! let bCap = storage.copy(from: /storage/bCap)! let cCap = storage.copy(from: /storage/cCap)! - assert(aCap.id == 5) + assert(aCap.id == 3) assert(bCap.id == 0) - assert(cCap.id == 3) + assert(cCap.id == 4) } `, addressA.HexWithPrefix(), @@ -2570,7 +2570,7 @@ func TestStoragePathCapabilityMigration(t *testing.T) { let capabilities = getAuthAccount(%s).capabilities.storage let aCapCons = capabilities.getControllers(forPath: /storage/a) assert(aCapCons.length == 1) - assert(aCapCons[0].capabilityID == 5) + assert(aCapCons[0].capabilityID == 3) } `, addressB.HexWithPrefix(),