From 5d40cd13b3e29c40d2ae202864f3b1034754f02b Mon Sep 17 00:00:00 2001 From: Supun Setunga Date: Wed, 2 Aug 2023 11:37:04 -0700 Subject: [PATCH] Rename mutability entitlements --- runtime/account_test.go | 4 +- runtime/capabilitycontrollers_test.go | 18 ++--- runtime/convertValues_test.go | 4 +- runtime/resource_duplicate_test.go | 24 +++---- runtime/runtime_test.go | 12 ++-- runtime/sema/check_assignment.go | 4 +- runtime/sema/entitlements.cdc | 6 +- runtime/sema/entitlements.gen.go | 24 +++---- runtime/sema/type.go | 10 +-- .../tests/checker/arrays_dictionaries_test.go | 66 +++++++++---------- runtime/tests/checker/attachments_test.go | 4 +- runtime/tests/checker/entitlements_test.go | 48 +++++++------- runtime/tests/checker/reference_test.go | 8 +-- runtime/tests/interpreter/array_test.go | 6 +- .../interpreter/container_mutation_test.go | 4 +- runtime/tests/interpreter/dictionary_test.go | 6 +- .../tests/interpreter/entitlements_test.go | 32 ++++----- runtime/tests/interpreter/member_test.go | 2 +- runtime/tests/interpreter/reference_test.go | 38 +++++------ runtime/tests/interpreter/resources_test.go | 4 +- runtime/tests/interpreter/string_test.go | 2 +- 21 files changed, 163 insertions(+), 163 deletions(-) diff --git a/runtime/account_test.go b/runtime/account_test.go index aa88143305..67d139375c 100644 --- a/runtime/account_test.go +++ b/runtime/account_test.go @@ -1480,7 +1480,7 @@ func TestRuntimePublicKey(t *testing.T) { signatureAlgorithm: SignatureAlgorithm.ECDSA_P256 ) - var publickeyRef = &publicKey.publicKey as auth(Mutable) &[UInt8] + var publickeyRef = &publicKey.publicKey as auth(Mutate) &[UInt8] publickeyRef[0] = 3 return publicKey @@ -1909,7 +1909,7 @@ func TestAuthAccountContracts(t *testing.T) { script := []byte(` transaction { prepare(signer: AuthAccount) { - var namesRef = &signer.contracts.names as auth(Mutable) &[String] + var namesRef = &signer.contracts.names as auth(Mutate) &[String] namesRef[0] = "baz" assert(signer.contracts.names[0] == "foo") diff --git a/runtime/capabilitycontrollers_test.go b/runtime/capabilitycontrollers_test.go index 23a6e021de..dbd1e8ec04 100644 --- a/runtime/capabilitycontrollers_test.go +++ b/runtime/capabilitycontrollers_test.go @@ -85,7 +85,7 @@ func TestRuntimeCapabilityControllers(t *testing.T) { /// > Our version of quicksort is not the fastest possible, /// > but it's one of the simplest. /// - access(all) fun quickSort(_ items: auth(Mutable) &[AnyStruct], isLess: fun(Int, Int): Bool) { + access(all) fun quickSort(_ items: auth(Mutate) &[AnyStruct], isLess: fun(Int, Int): Bool) { fun quickSortPart(leftIndex: Int, rightIndex: Int) { @@ -1803,7 +1803,7 @@ func TestRuntimeCapabilityControllers(t *testing.T) { assert(controllers1.length == 3) Test.quickSort( - &controllers1 as auth(Mutable) &[AnyStruct], + &controllers1 as auth(Mutate) &[AnyStruct], isLess: fun(i: Int, j: Int): Bool { let a = controllers1[i] let b = controllers1[j] @@ -1901,7 +1901,7 @@ func TestRuntimeCapabilityControllers(t *testing.T) { assert(controllers1.length == 3) Test.quickSort( - &controllers1 as auth(Mutable) &[AnyStruct], + &controllers1 as auth(Mutate) &[AnyStruct], isLess: fun(i: Int, j: Int): Bool { let a = controllers1[i] let b = controllers1[j] @@ -2252,7 +2252,7 @@ func TestRuntimeCapabilityControllers(t *testing.T) { assert(controllers.length == 3) Test.quickSort( - &controllers as auth(Mutable) &[AnyStruct], + &controllers as auth(Mutate) &[AnyStruct], isLess: fun(i: Int, j: Int): Bool { let a = controllers[i] let b = controllers[j] @@ -2330,7 +2330,7 @@ func TestRuntimeCapabilityControllers(t *testing.T) { assert(controllers.length == 3) Test.quickSort( - &controllers as auth(Mutable) &[AnyStruct], + &controllers as auth(Mutate) &[AnyStruct], isLess: fun(i: Int, j: Int): Bool { let a = controllers[i] let b = controllers[j] @@ -2585,7 +2585,7 @@ func TestRuntimeCapabilityControllers(t *testing.T) { let controllers1Before = signer.capabilities.storage.getControllers(forPath: storagePath1) Test.quickSort( - &controllers1Before as auth(Mutable) &[AnyStruct], + &controllers1Before as auth(Mutate) &[AnyStruct], isLess: fun(i: Int, j: Int): Bool { let a = controllers1Before[i] let b = controllers1Before[j] @@ -2599,7 +2599,7 @@ func TestRuntimeCapabilityControllers(t *testing.T) { let controllers2Before = signer.capabilities.storage.getControllers(forPath: storagePath2) Test.quickSort( - &controllers2Before as auth(Mutable) &[AnyStruct], + &controllers2Before as auth(Mutate) &[AnyStruct], isLess: fun(i: Int, j: Int): Bool { let a = controllers2Before[i] let b = controllers2Before[j] @@ -2623,7 +2623,7 @@ func TestRuntimeCapabilityControllers(t *testing.T) { let controllers1After = signer.capabilities.storage.getControllers(forPath: storagePath1) Test.quickSort( - &controllers1After as auth(Mutable) &[AnyStruct], + &controllers1After as auth(Mutate) &[AnyStruct], isLess: fun(i: Int, j: Int): Bool { let a = controllers1After[i] let b = controllers1After[j] @@ -2636,7 +2636,7 @@ func TestRuntimeCapabilityControllers(t *testing.T) { let controllers2After = signer.capabilities.storage.getControllers(forPath: storagePath2) Test.quickSort( - &controllers2After as auth(Mutable) &[AnyStruct], + &controllers2After as auth(Mutate) &[AnyStruct], isLess: fun(i: Int, j: Int): Bool { let a = controllers2After[i] let b = controllers2After[j] diff --git a/runtime/convertValues_test.go b/runtime/convertValues_test.go index 3b275777e4..0ce68a6cc3 100644 --- a/runtime/convertValues_test.go +++ b/runtime/convertValues_test.go @@ -1949,7 +1949,7 @@ func TestExportReferenceValue(t *testing.T) { var v:[AnyStruct] = [] acct.save(v, to: /storage/x) - var ref = acct.borrow(from: /storage/x)! + var ref = acct.borrow(from: /storage/x)! ref.append(ref) return ref } @@ -1984,7 +1984,7 @@ func TestExportReferenceValue(t *testing.T) { var v:[AnyStruct] = [] acct.save(v, to: /storage/x) - var ref1 = acct.borrow(from: /storage/x)! + var ref1 = acct.borrow(from: /storage/x)! var ref2 = acct.borrow<&[AnyStruct]>(from: /storage/x)! ref1.append(ref2) diff --git a/runtime/resource_duplicate_test.go b/runtime/resource_duplicate_test.go index 14868f382d..69047f1237 100644 --- a/runtime/resource_duplicate_test.go +++ b/runtime/resource_duplicate_test.go @@ -67,10 +67,10 @@ func TestRuntimeResourceDuplicationUsingDestructorIteration(t *testing.T) { // --- this code actually makes use of the vuln --- access(all) resource DummyResource { - access(all) var dictRef: auth(Mutable) &{Bool: AnyResource}; - access(all) var arrRef: auth(Mutable) &[Vault]; + access(all) var dictRef: auth(Mutate) &{Bool: AnyResource}; + access(all) var arrRef: auth(Mutate) &[Vault]; access(all) var victim: @Vault; - init(dictRef: auth(Mutable) &{Bool: AnyResource}, arrRef: auth(Mutable) &[Vault], victim: @Vault) { + init(dictRef: auth(Mutate) &{Bool: AnyResource}, arrRef: auth(Mutate) &[Vault], victim: @Vault) { self.dictRef = dictRef; self.arrRef = arrRef; self.victim <- victim; @@ -85,8 +85,8 @@ func TestRuntimeResourceDuplicationUsingDestructorIteration(t *testing.T) { access(all) fun duplicateResource(victim1: @Vault, victim2: @Vault): @[Vault]{ let arr : @[Vault] <- []; let dict: @{Bool: DummyResource} <- { } - let ref = &dict as auth(Mutable) &{Bool: AnyResource}; - let arrRef = &arr as auth(Mutable) &[Vault]; + let ref = &dict as auth(Mutate) &{Bool: AnyResource}; + let arrRef = &arr as auth(Mutate) &[Vault]; var v1: @DummyResource? <- create DummyResource(dictRef: ref, arrRef: arrRef, victim: <- victim1); dict[false] <-> v1; @@ -183,9 +183,9 @@ func TestRuntimeResourceDuplicationUsingDestructorIteration(t *testing.T) { script := ` access(all) resource Vault { access(all) var balance: UFix64 - access(all) var dictRef: auth(Mutable) &{Bool: Vault}; + access(all) var dictRef: auth(Mutate) &{Bool: Vault}; - init(balance: UFix64, _ dictRef: auth(Mutable) &{Bool: Vault}) { + init(balance: UFix64, _ dictRef: auth(Mutate) &{Bool: Vault}) { self.balance = balance self.dictRef = dictRef; } @@ -208,7 +208,7 @@ func TestRuntimeResourceDuplicationUsingDestructorIteration(t *testing.T) { access(all) fun main(): UFix64 { let dict: @{Bool: Vault} <- { } - let dictRef = &dict as auth(Mutable) &{Bool: Vault}; + let dictRef = &dict as auth(Mutate) &{Bool: Vault}; var v1 <- create Vault(balance: 1000.0, dictRef); // This will be duplicated var v2 <- create Vault(balance: 1.0, dictRef); // This will be lost @@ -305,7 +305,7 @@ func TestRuntimeResourceDuplicationUsingDestructorIteration(t *testing.T) { let acc = getAuthAccount(0x1) acc.save(<-dict, to: /storage/foo) - let ref = acc.borrow(from: /storage/foo)! + let ref = acc.borrow(from: /storage/foo)! ref.forEachKey(fun(i: Int): Bool { var r4: @R? <- create R() @@ -372,9 +372,9 @@ func TestRuntimeResourceDuplicationUsingDestructorIteration(t *testing.T) { script := ` access(all) resource Vault { access(all) var balance: UFix64 - access(all) var arrRef: auth(Mutable) &[Vault] + access(all) var arrRef: auth(Mutate) &[Vault] - init(balance: UFix64, _ arrRef: auth(Mutable) &[Vault]) { + init(balance: UFix64, _ arrRef: auth(Mutate) &[Vault]) { self.balance = balance self.arrRef = arrRef; } @@ -397,7 +397,7 @@ func TestRuntimeResourceDuplicationUsingDestructorIteration(t *testing.T) { access(all) fun main(): UFix64 { let arr: @[Vault] <- [] - let arrRef = &arr as auth(Mutable) &[Vault]; + let arrRef = &arr as auth(Mutate) &[Vault]; var v1 <- create Vault(balance: 1000.0, arrRef); // This will be duplicated var v2 <- create Vault(balance: 1.0, arrRef); // This will be lost diff --git a/runtime/runtime_test.go b/runtime/runtime_test.go index 3eebd0ff9f..5809e91019 100644 --- a/runtime/runtime_test.go +++ b/runtime/runtime_test.go @@ -2005,7 +2005,7 @@ func TestRuntimeStorageMultipleTransactionsResourceWithArray(t *testing.T) { prepare(signer: AuthAccount) { signer.save(<-createContainer(), to: /storage/container) - signer.link(/public/container, target: /storage/container) + signer.link(/public/container, target: /storage/container) } } `) @@ -2017,7 +2017,7 @@ func TestRuntimeStorageMultipleTransactionsResourceWithArray(t *testing.T) { prepare(signer: AuthAccount) { let publicAccount = getAccount(signer.address) let ref = publicAccount.getCapability(/public/container) - .borrow()! + .borrow()! let length = ref.values.length ref.appendValue(1) @@ -2034,7 +2034,7 @@ func TestRuntimeStorageMultipleTransactionsResourceWithArray(t *testing.T) { let publicAccount = getAccount(signer.address) let ref = publicAccount .getCapability(/public/container) - .borrow()! + .borrow()! let length = ref.values.length ref.appendValue(2) @@ -7019,7 +7019,7 @@ func TestRuntimeGetCapability(t *testing.T) { script := []byte(` access(all) fun main(): Capability { let dict: {Int: AuthAccount} = {} - let ref = &dict as auth(Mutable) &{Int: AnyStruct} + let ref = &dict as auth(Mutate) &{Int: AnyStruct} ref[0] = getAccount(0x01) as AnyStruct return dict.values[0].getCapability(/private/xxx) } @@ -7054,7 +7054,7 @@ func TestRuntimeGetCapability(t *testing.T) { script := []byte(` access(all) fun main(): Capability { let dict: {Int: AuthAccount} = {} - let ref = &dict as auth(Mutable) &{Int: AnyStruct} + let ref = &dict as auth(Mutate) &{Int: AnyStruct} ref[0] = getAccount(0x01) as AnyStruct return dict.values[0].getCapability(/public/xxx) } @@ -7089,7 +7089,7 @@ func TestRuntimeGetCapability(t *testing.T) { script := []byte(` access(all) fun main(): Capability { let dict: {Int: PublicAccount} = {} - let ref = &dict as auth(Mutable) &{Int: AnyStruct} + let ref = &dict as auth(Mutate) &{Int: AnyStruct} ref[0] = getAccount(0x01) as AnyStruct return dict.values[0].getCapability(/public/xxx) } diff --git a/runtime/sema/check_assignment.go b/runtime/sema/check_assignment.go index 81d4275d96..daaa23613d 100644 --- a/runtime/sema/check_assignment.go +++ b/runtime/sema/check_assignment.go @@ -313,12 +313,12 @@ func (checker *Checker) visitIdentifierExpressionAssignment( } var mutableEntitledAccess = NewEntitlementSetAccess( - []*EntitlementType{MutableEntitlement}, + []*EntitlementType{MutateEntitlement}, Disjunction, ) var insertableAndRemovableEntitledAccess = NewEntitlementSetAccess( - []*EntitlementType{InsertableEntitlement, RemovableEntitlement}, + []*EntitlementType{InsertEntitlement, RemoveEntitlement}, Conjunction, ) diff --git a/runtime/sema/entitlements.cdc b/runtime/sema/entitlements.cdc index 5634181a0c..07c447eac7 100644 --- a/runtime/sema/entitlements.cdc +++ b/runtime/sema/entitlements.cdc @@ -1,6 +1,6 @@ -entitlement Mutable +entitlement Mutate -entitlement Insertable +entitlement Insert -entitlement Removable +entitlement Remove diff --git a/runtime/sema/entitlements.gen.go b/runtime/sema/entitlements.gen.go index 9dda997fb6..55e7316f51 100644 --- a/runtime/sema/entitlements.gen.go +++ b/runtime/sema/entitlements.gen.go @@ -19,23 +19,23 @@ package sema -var MutableEntitlement = &EntitlementType{ - Identifier: "Mutable", +var MutateEntitlement = &EntitlementType{ + Identifier: "Mutate", } -var InsertableEntitlement = &EntitlementType{ - Identifier: "Insertable", +var InsertEntitlement = &EntitlementType{ + Identifier: "Insert", } -var RemovableEntitlement = &EntitlementType{ - Identifier: "Removable", +var RemoveEntitlement = &EntitlementType{ + Identifier: "Remove", } func init() { - BuiltinEntitlements[MutableEntitlement.Identifier] = MutableEntitlement - addToBaseActivation(MutableEntitlement) - BuiltinEntitlements[InsertableEntitlement.Identifier] = InsertableEntitlement - addToBaseActivation(InsertableEntitlement) - BuiltinEntitlements[RemovableEntitlement.Identifier] = RemovableEntitlement - addToBaseActivation(RemovableEntitlement) + BuiltinEntitlements[MutateEntitlement.Identifier] = MutateEntitlement + addToBaseActivation(MutateEntitlement) + BuiltinEntitlements[InsertEntitlement.Identifier] = InsertEntitlement + addToBaseActivation(InsertEntitlement) + BuiltinEntitlements[RemoveEntitlement.Identifier] = RemoveEntitlement + addToBaseActivation(RemoveEntitlement) } diff --git a/runtime/sema/type.go b/runtime/sema/type.go index 2f3fac6be4..f492c6c50c 100644 --- a/runtime/sema/type.go +++ b/runtime/sema/type.go @@ -1945,12 +1945,12 @@ If either of the parameters are out of the bounds of the array, or the indices a ` var insertableEntitledAccess = NewEntitlementSetAccess( - []*EntitlementType{InsertableEntitlement, MutableEntitlement}, + []*EntitlementType{InsertEntitlement, MutateEntitlement}, Disjunction, ) var removableEntitledAccess = NewEntitlementSetAccess( - []*EntitlementType{RemovableEntitlement, MutableEntitlement}, + []*EntitlementType{RemoveEntitlement, MutateEntitlement}, Disjunction, ) @@ -2516,9 +2516,9 @@ func (t *VariableSizedType) SupportedEntitlements() *EntitlementOrderedSet { var arrayDictionaryEntitlements = func() *EntitlementOrderedSet { set := orderedmap.New[EntitlementOrderedSet](3) - set.Set(MutableEntitlement, struct{}{}) - set.Set(InsertableEntitlement, struct{}{}) - set.Set(RemovableEntitlement, struct{}{}) + set.Set(MutateEntitlement, struct{}{}) + set.Set(InsertEntitlement, struct{}{}) + set.Set(RemoveEntitlement, struct{}{}) return set }() diff --git a/runtime/tests/checker/arrays_dictionaries_test.go b/runtime/tests/checker/arrays_dictionaries_test.go index 75deaab115..0c563f0468 100644 --- a/runtime/tests/checker/arrays_dictionaries_test.go +++ b/runtime/tests/checker/arrays_dictionaries_test.go @@ -1498,7 +1498,7 @@ func TestCheckArrayFunctionEntitlements(t *testing.T) { let array: [String] = ["foo", "bar"] fun test() { - var arrayRef = &array as auth(Mutable) &[String] + var arrayRef = &array as auth(Mutate) &[String] arrayRef.append("baz") arrayRef.appendAll(["baz"]) arrayRef.insert(at:0, "baz") @@ -1537,7 +1537,7 @@ func TestCheckArrayFunctionEntitlements(t *testing.T) { let array: [String] = ["foo", "bar"] fun test() { - var arrayRef = &array as auth(Insertable) &[String] + var arrayRef = &array as auth(Insert) &[String] arrayRef.append("baz") arrayRef.appendAll(["baz"]) arrayRef.insert(at:0, "baz") @@ -1554,7 +1554,7 @@ func TestCheckArrayFunctionEntitlements(t *testing.T) { let array: [String] = ["foo", "bar"] fun test() { - var arrayRef = &array as auth(Removable) &[String] + var arrayRef = &array as auth(Remove) &[String] arrayRef.append("baz") arrayRef.appendAll(["baz"]) arrayRef.insert(at:0, "baz") @@ -1580,7 +1580,7 @@ func TestCheckArrayFunctionEntitlements(t *testing.T) { let array: [String] = ["foo", "bar"] fun test() { - var arrayRef = &array as auth(Mutable) &[String] + var arrayRef = &array as auth(Mutate) &[String] arrayRef.remove(at: 1) arrayRef.removeFirst() arrayRef.removeLast() @@ -1619,7 +1619,7 @@ func TestCheckArrayFunctionEntitlements(t *testing.T) { let array: [String] = ["foo", "bar"] fun test() { - var arrayRef = &array as auth(Insertable) &[String] + var arrayRef = &array as auth(Insert) &[String] arrayRef.remove(at: 1) arrayRef.removeFirst() arrayRef.removeLast() @@ -1641,7 +1641,7 @@ func TestCheckArrayFunctionEntitlements(t *testing.T) { let array: [String] = ["foo", "bar"] fun test() { - var arrayRef = &array as auth(Removable) &[String] + var arrayRef = &array as auth(Remove) &[String] arrayRef.remove(at: 1) arrayRef.removeFirst() arrayRef.removeLast() @@ -1662,7 +1662,7 @@ func TestCheckArrayFunctionEntitlements(t *testing.T) { let array: [String] = ["foo", "bar"] fun test() { - var arrayRef = &array as auth(Mutable) &[String] + var arrayRef = &array as auth(Mutate) &[String] arrayRef.contains("hello") arrayRef.firstIndex(of: "hello") arrayRef.slice(from: 2, upTo: 4) @@ -1698,7 +1698,7 @@ func TestCheckArrayFunctionEntitlements(t *testing.T) { let array: [String] = ["foo", "bar"] fun test() { - var arrayRef = &array as auth(Insertable) &[String] + var arrayRef = &array as auth(Insert) &[String] arrayRef.contains("hello") arrayRef.firstIndex(of: "hello") arrayRef.slice(from: 2, upTo: 4) @@ -1716,7 +1716,7 @@ func TestCheckArrayFunctionEntitlements(t *testing.T) { let array: [String] = ["foo", "bar"] fun test() { - var arrayRef = &array as auth(Removable) &[String] + var arrayRef = &array as auth(Remove) &[String] arrayRef.contains("hello") arrayRef.firstIndex(of: "hello") arrayRef.slice(from: 2, upTo: 4) @@ -1738,7 +1738,7 @@ func TestCheckArrayFunctionEntitlements(t *testing.T) { let array: [String] = ["foo", "bar"] fun test() { - var arrayRef = &array as auth(Mutable) &[String] + var arrayRef = &array as auth(Mutate) &[String] arrayRef[0] = "baz" } `) @@ -1766,7 +1766,7 @@ func TestCheckArrayFunctionEntitlements(t *testing.T) { assert.Contains( t, errors[0].Error(), - "can only assign to a reference with (Mutable) or (Insertable, Removable) access, but found a non-auth reference", + "can only assign to a reference with (Mutate) or (Insert, Remove) access, but found a non-auth reference", ) }) @@ -1777,7 +1777,7 @@ func TestCheckArrayFunctionEntitlements(t *testing.T) { let array: [String] = ["foo", "bar"] fun test() { - var arrayRef = &array as auth(Insertable) &[String] + var arrayRef = &array as auth(Insert) &[String] arrayRef[0] = "baz" } `) @@ -1790,7 +1790,7 @@ func TestCheckArrayFunctionEntitlements(t *testing.T) { assert.Contains( t, errors[0].Error(), - "can only assign to a reference with (Mutable) or (Insertable, Removable) access, but found a (Insertable) reference", + "can only assign to a reference with (Mutate) or (Insert, Remove) access, but found a (Insert) reference", ) }) @@ -1801,7 +1801,7 @@ func TestCheckArrayFunctionEntitlements(t *testing.T) { let array: [String] = ["foo", "bar"] fun test() { - var arrayRef = &array as auth(Removable) &[String] + var arrayRef = &array as auth(Remove) &[String] arrayRef[0] = "baz" } `) @@ -1814,7 +1814,7 @@ func TestCheckArrayFunctionEntitlements(t *testing.T) { assert.Contains( t, errors[0].Error(), - "can only assign to a reference with (Mutable) or (Insertable, Removable) access, but found a (Removable) reference", + "can only assign to a reference with (Mutate) or (Insert, Remove) access, but found a (Remove) reference", ) }) @@ -1825,7 +1825,7 @@ func TestCheckArrayFunctionEntitlements(t *testing.T) { let array: [String] = ["foo", "bar"] fun test() { - var arrayRef = &array as auth(Insertable, Removable) &[String] + var arrayRef = &array as auth(Insert, Remove) &[String] arrayRef[0] = "baz" } `) @@ -1844,7 +1844,7 @@ func TestCheckArrayFunctionEntitlements(t *testing.T) { let array: [String] = ["foo", "bar"] fun test() { - var arrayRef = &array as auth(Mutable) &[String] + var arrayRef = &array as auth(Mutate) &[String] arrayRef[0] <-> arrayRef[1] } `) @@ -1886,7 +1886,7 @@ func TestCheckDictionaryFunctionEntitlements(t *testing.T) { let dictionary: {String: String} = {"one" : "foo", "two" : "bar"} fun test() { - var dictionaryRef = &dictionary as auth(Mutable) &{String: String} + var dictionaryRef = &dictionary as auth(Mutate) &{String: String} dictionaryRef.insert(key: "three", "baz") } `) @@ -1919,7 +1919,7 @@ func TestCheckDictionaryFunctionEntitlements(t *testing.T) { let dictionary: {String: String} = {"one" : "foo", "two" : "bar"} fun test() { - var dictionaryRef = &dictionary as auth(Insertable) &{String: String} + var dictionaryRef = &dictionary as auth(Insert) &{String: String} dictionaryRef.insert(key: "three", "baz") } `) @@ -1956,7 +1956,7 @@ func TestCheckDictionaryFunctionEntitlements(t *testing.T) { let dictionary: {String: String} = {"one" : "foo", "two" : "bar"} fun test() { - var dictionaryRef = &dictionary as auth(Mutable) &{String: String} + var dictionaryRef = &dictionary as auth(Mutate) &{String: String} dictionaryRef.remove(key: "foo") } `) @@ -1989,7 +1989,7 @@ func TestCheckDictionaryFunctionEntitlements(t *testing.T) { let dictionary: {String: String} = {"one" : "foo", "two" : "bar"} fun test() { - var dictionaryRef = &dictionary as auth(Insertable) &{String: String} + var dictionaryRef = &dictionary as auth(Insert) &{String: String} dictionaryRef.remove(key: "foo") } `) @@ -2007,7 +2007,7 @@ func TestCheckDictionaryFunctionEntitlements(t *testing.T) { let dictionary: {String: String} = {"one" : "foo", "two" : "bar"} fun test() { - var dictionaryRef = &dictionary as auth(Removable) &{String: String} + var dictionaryRef = &dictionary as auth(Remove) &{String: String} dictionaryRef.remove(key: "foo") } `) @@ -2026,7 +2026,7 @@ func TestCheckDictionaryFunctionEntitlements(t *testing.T) { let dictionary: {String: String} = {"one" : "foo", "two" : "bar"} fun test() { - var dictionaryRef = &dictionary as auth(Mutable) &{String: String} + var dictionaryRef = &dictionary as auth(Mutate) &{String: String} dictionaryRef.containsKey("foo") dictionaryRef.forEachKey(fun(key: String): Bool {return true} ) } @@ -2058,7 +2058,7 @@ func TestCheckDictionaryFunctionEntitlements(t *testing.T) { let dictionary: {String: String} = {"one" : "foo", "two" : "bar"} fun test() { - var dictionaryRef = &dictionary as auth(Insertable) &{String: String} + var dictionaryRef = &dictionary as auth(Insert) &{String: String} dictionaryRef.containsKey("foo") dictionaryRef.forEachKey(fun(key: String): Bool {return true} ) } @@ -2074,7 +2074,7 @@ func TestCheckDictionaryFunctionEntitlements(t *testing.T) { let dictionary: {String: String} = {"one" : "foo", "two" : "bar"} fun test() { - var dictionaryRef = &dictionary as auth(Removable) &{String: String} + var dictionaryRef = &dictionary as auth(Remove) &{String: String} dictionaryRef.containsKey("foo") dictionaryRef.forEachKey(fun(key: String): Bool {return true} ) } @@ -2094,7 +2094,7 @@ func TestCheckDictionaryFunctionEntitlements(t *testing.T) { let dictionary: {String: String} = {"one" : "foo", "two" : "bar"} fun test() { - var dictionaryRef = &dictionary as auth(Mutable) &{String: String} + var dictionaryRef = &dictionary as auth(Mutate) &{String: String} dictionaryRef["three"] = "baz" } `) @@ -2122,7 +2122,7 @@ func TestCheckDictionaryFunctionEntitlements(t *testing.T) { assert.Contains( t, errors[0].Error(), - "can only assign to a reference with (Mutable) or (Insertable, Removable) access, but found a non-auth reference", + "can only assign to a reference with (Mutate) or (Insert, Remove) access, but found a non-auth reference", ) }) @@ -2133,7 +2133,7 @@ func TestCheckDictionaryFunctionEntitlements(t *testing.T) { let dictionary: {String: String} = {"one" : "foo", "two" : "bar"} fun test() { - var dictionaryRef = &dictionary as auth(Removable) &{String: String} + var dictionaryRef = &dictionary as auth(Remove) &{String: String} dictionaryRef["three"] = "baz" } `) @@ -2146,7 +2146,7 @@ func TestCheckDictionaryFunctionEntitlements(t *testing.T) { assert.Contains( t, errors[0].Error(), - "can only assign to a reference with (Mutable) or (Insertable, Removable) access, but found a (Removable) reference", + "can only assign to a reference with (Mutate) or (Insert, Remove) access, but found a (Remove) reference", ) }) @@ -2157,7 +2157,7 @@ func TestCheckDictionaryFunctionEntitlements(t *testing.T) { let dictionary: {String: String} = {"one" : "foo", "two" : "bar"} fun test() { - var dictionaryRef = &dictionary as auth(Insertable) &{String: String} + var dictionaryRef = &dictionary as auth(Insert) &{String: String} dictionaryRef["three"] = "baz" } `) @@ -2170,7 +2170,7 @@ func TestCheckDictionaryFunctionEntitlements(t *testing.T) { assert.Contains( t, errors[0].Error(), - "can only assign to a reference with (Mutable) or (Insertable, Removable) access, but found a (Insertable) reference", + "can only assign to a reference with (Mutate) or (Insert, Remove) access, but found a (Insert) reference", ) }) @@ -2181,7 +2181,7 @@ func TestCheckDictionaryFunctionEntitlements(t *testing.T) { let dictionary: {String: String} = {"one" : "foo", "two" : "bar"} fun test() { - var dictionaryRef = &dictionary as auth(Insertable, Removable) &{String: String} + var dictionaryRef = &dictionary as auth(Insert, Remove) &{String: String} dictionaryRef["three"] = "baz" } `) @@ -2200,7 +2200,7 @@ func TestCheckDictionaryFunctionEntitlements(t *testing.T) { let dictionary: {String: AnyStruct} = {"one" : "foo", "two" : "bar"} fun test() { - var dictionaryRef = &dictionary as auth(Mutable) &{String: AnyStruct} + var dictionaryRef = &dictionary as auth(Mutate) &{String: AnyStruct} dictionaryRef["one"] <-> dictionaryRef["two"] } `) diff --git a/runtime/tests/checker/attachments_test.go b/runtime/tests/checker/attachments_test.go index 57c41470c9..236041a7ef 100644 --- a/runtime/tests/checker/attachments_test.go +++ b/runtime/tests/checker/attachments_test.go @@ -4178,7 +4178,7 @@ func TestCheckAttachmentsExternalMutation(t *testing.T) { access(all) resource R {} entitlement mapping M { - Mutable -> Insertable + Mutate -> Insert } access(M) attachment A for R { @@ -4231,7 +4231,7 @@ func TestCheckAttachmentsExternalMutation(t *testing.T) { _, err := ParseAndCheck(t, ` entitlement mapping M { - Mutable -> Insertable + Mutate -> Insert } access(all) resource R { diff --git a/runtime/tests/checker/entitlements_test.go b/runtime/tests/checker/entitlements_test.go index bbf3e270c4..d73722f8f3 100644 --- a/runtime/tests/checker/entitlements_test.go +++ b/runtime/tests/checker/entitlements_test.go @@ -4824,7 +4824,7 @@ func TestCheckEntitlementConditions(t *testing.T) { } // 'result' variable should have all the entitlements available for arrays. - view fun bar(_ r: auth(Mutable, Insertable, Removable) &[R]): Bool { + view fun bar(_ r: auth(Mutate, Insert, Remove) &[R]): Bool { return true } `) @@ -4846,7 +4846,7 @@ func TestCheckEntitlementConditions(t *testing.T) { } // 'result' variable should have all the entitlements available for arrays. - view fun bar(_ r: auth(Mutable, Insertable, Removable) &[R; 5]): Bool { + view fun bar(_ r: auth(Mutate, Insert, Remove) &[R; 5]): Bool { return true } `) @@ -4868,7 +4868,7 @@ func TestCheckEntitlementConditions(t *testing.T) { } // 'result' variable should have all the entitlements available for dictionaries. - view fun bar(_ r: auth(Mutable, Insertable, Removable) &{String:R}): Bool { + view fun bar(_ r: auth(Mutate, Insert, Remove) &{String:R}): Bool { return true } `) @@ -5367,16 +5367,16 @@ func TestCheckBuiltinEntitlements(t *testing.T) { _, err := ParseAndCheck(t, ` struct S { - access(Mutable) fun foo() {} - access(Insertable) fun bar() {} - access(Removable) fun baz() {} + access(Mutate) fun foo() {} + access(Insert) fun bar() {} + access(Remove) fun baz() {} } fun main() { let s = S() - let mutableRef = &s as auth(Mutable) &S - let insertableRef = &s as auth(Insertable) &S - let removableRef = &s as auth(Removable) &S + let mutableRef = &s as auth(Mutate) &S + let insertableRef = &s as auth(Insert) &S + let removableRef = &s as auth(Remove) &S } `) @@ -5387,9 +5387,9 @@ func TestCheckBuiltinEntitlements(t *testing.T) { t.Parallel() _, err := ParseAndCheck(t, ` - entitlement Mutable - entitlement Insertable - entitlement Removable + entitlement Mutate + entitlement Insert + entitlement Remove `) errs := RequireCheckerErrors(t, err, 3) @@ -5423,7 +5423,7 @@ func TestCheckIdentityMapping(t *testing.T) { let resultRef1: &AnyStruct = s.foo() // Error: Must return an unauthorized ref - let resultRef2: auth(Mutable) &AnyStruct = s.foo() + let resultRef2: auth(Mutate) &AnyStruct = s.foo() } `) @@ -5460,7 +5460,7 @@ func TestCheckIdentityMapping(t *testing.T) { let resultRef1: &AnyStruct = ref.foo() // Error: Must return an unauthorized ref - let resultRef2: auth(Mutable) &AnyStruct = ref.foo() + let resultRef2: auth(Mutate) &AnyStruct = ref.foo() } `) @@ -5483,14 +5483,14 @@ func TestCheckIdentityMapping(t *testing.T) { fun main() { let s = S() - let mutableRef = &s as auth(Mutable) &S - let ref1: auth(Mutable) &AnyStruct = mutableRef.foo() + let mutableRef = &s as auth(Mutate) &S + let ref1: auth(Mutate) &AnyStruct = mutableRef.foo() - let insertableRef = &s as auth(Insertable) &S - let ref2: auth(Insertable) &AnyStruct = insertableRef.foo() + let insertableRef = &s as auth(Insert) &S + let ref2: auth(Insert) &AnyStruct = insertableRef.foo() - let removableRef = &s as auth(Removable) &S - let ref3: auth(Removable) &AnyStruct = removableRef.foo() + let removableRef = &s as auth(Remove) &S + let ref3: auth(Remove) &AnyStruct = removableRef.foo() } `) @@ -5511,11 +5511,11 @@ func TestCheckIdentityMapping(t *testing.T) { fun main() { let s = S() - let ref1 = &s as auth(Insertable | Removable) &S - let resultRef1: auth(Insertable | Removable) &AnyStruct = ref1.foo() + let ref1 = &s as auth(Insert | Remove) &S + let resultRef1: auth(Insert | Remove) &AnyStruct = ref1.foo() - let ref2 = &s as auth(Insertable, Removable) &S - let resultRef2: auth(Insertable, Removable) &AnyStruct = ref2.foo() + let ref2 = &s as auth(Insert, Remove) &S + let resultRef2: auth(Insert, Remove) &AnyStruct = ref2.foo() } `) diff --git a/runtime/tests/checker/reference_test.go b/runtime/tests/checker/reference_test.go index 6d8cf7f380..e8ba880093 100644 --- a/runtime/tests/checker/reference_test.go +++ b/runtime/tests/checker/reference_test.go @@ -2691,7 +2691,7 @@ func TestCheckReferenceUseAfterCopy(t *testing.T) { fun test() { let rs <- [<-create R()] - let ref = &rs as auth(Mutable) &[R] + let ref = &rs as auth(Mutate) &[R] let container <- [<-rs] ref.insert(at: 1, <-create R()) destroy container @@ -2712,7 +2712,7 @@ func TestCheckReferenceUseAfterCopy(t *testing.T) { fun test() { let rs <- [<-create R()] - let ref = &rs as auth(Mutable) &[R] + let ref = &rs as auth(Mutate) &[R] let container <- [<-rs] ref.append(<-create R()) destroy container @@ -2766,7 +2766,7 @@ func TestCheckReferenceUseAfterCopy(t *testing.T) { fun test() { let rs <- [<-create R()] - let ref = &rs as auth(Mutable) &[R] + let ref = &rs as auth(Mutate) &[R] let container <- [<-rs] let r <- ref.remove(at: 0) destroy container @@ -2812,7 +2812,7 @@ func TestCheckReferenceUseAfterCopy(t *testing.T) { fun test() { let rs <- {0: <-create R()} - let ref = &rs as auth(Removable) &{Int: R} + let ref = &rs as auth(Remove) &{Int: R} let container <- [<-rs] let r <- ref.remove(key: 0) destroy container diff --git a/runtime/tests/interpreter/array_test.go b/runtime/tests/interpreter/array_test.go index 202891134a..000f7ea7e8 100644 --- a/runtime/tests/interpreter/array_test.go +++ b/runtime/tests/interpreter/array_test.go @@ -101,7 +101,7 @@ func TestInterpretArrayFunctionEntitlements(t *testing.T) { let array: [String] = ["foo", "bar"] fun test() { - var arrayRef = &array as auth(Mutable) &[String] + var arrayRef = &array as auth(Mutate) &[String] // Public functions arrayRef.contains("hello") @@ -153,7 +153,7 @@ func TestInterpretArrayFunctionEntitlements(t *testing.T) { let array: [String] = ["foo", "bar"] fun test() { - var arrayRef = &array as auth(Insertable) &[String] + var arrayRef = &array as auth(Insert) &[String] // Public functions arrayRef.contains("hello") @@ -179,7 +179,7 @@ func TestInterpretArrayFunctionEntitlements(t *testing.T) { let array: [String] = ["foo", "bar", "baz"] fun test() { - var arrayRef = &array as auth(Removable) &[String] + var arrayRef = &array as auth(Remove) &[String] // Public functions arrayRef.contains("hello") diff --git a/runtime/tests/interpreter/container_mutation_test.go b/runtime/tests/interpreter/container_mutation_test.go index 3e94d98b01..e39dc4a578 100644 --- a/runtime/tests/interpreter/container_mutation_test.go +++ b/runtime/tests/interpreter/container_mutation_test.go @@ -288,7 +288,7 @@ func TestArrayMutation(t *testing.T) { inter := parseCheckAndInterpret(t, ` fun test() { let names: [AnyStruct] = ["foo", "bar"] as [String] - let namesRef = &names as auth(Mutable) &[AnyStruct] + let namesRef = &names as auth(Mutate) &[AnyStruct] namesRef[0] = 5 } `) @@ -667,7 +667,7 @@ func TestDictionaryMutation(t *testing.T) { inter := parseCheckAndInterpret(t, ` fun test() { let names: {String: AnyStruct} = {"foo": "bar"} as {String: String} - let namesRef = &names as auth(Mutable) &{String: AnyStruct} + let namesRef = &names as auth(Mutate) &{String: AnyStruct} namesRef["foo"] = 5 } `) diff --git a/runtime/tests/interpreter/dictionary_test.go b/runtime/tests/interpreter/dictionary_test.go index ad828e4d23..dd07b40234 100644 --- a/runtime/tests/interpreter/dictionary_test.go +++ b/runtime/tests/interpreter/dictionary_test.go @@ -35,7 +35,7 @@ func TestInterpretDictionaryFunctionEntitlements(t *testing.T) { let dictionary: {String: String} = {"one" : "foo", "two" : "bar"} fun test() { - var dictionaryRef = &dictionary as auth(Mutable) &{String: String} + var dictionaryRef = &dictionary as auth(Mutate) &{String: String} // Public functions dictionaryRef.containsKey("foo") @@ -79,7 +79,7 @@ func TestInterpretDictionaryFunctionEntitlements(t *testing.T) { let dictionary: {String: String} = {"one" : "foo", "two" : "bar"} fun test() { - var dictionaryRef = &dictionary as auth(Mutable) &{String: String} + var dictionaryRef = &dictionary as auth(Mutate) &{String: String} // Public functions dictionaryRef.containsKey("foo") @@ -101,7 +101,7 @@ func TestInterpretDictionaryFunctionEntitlements(t *testing.T) { let dictionary: {String: String} = {"one" : "foo", "two" : "bar"} fun test() { - var dictionaryRef = &dictionary as auth(Mutable) &{String: String} + var dictionaryRef = &dictionary as auth(Mutate) &{String: String} // Public functions dictionaryRef.containsKey("foo") diff --git a/runtime/tests/interpreter/entitlements_test.go b/runtime/tests/interpreter/entitlements_test.go index 7d7313a6ad..9c85a19cb2 100644 --- a/runtime/tests/interpreter/entitlements_test.go +++ b/runtime/tests/interpreter/entitlements_test.go @@ -2956,16 +2956,16 @@ func TestInterpretBuiltinEntitlements(t *testing.T) { inter := parseCheckAndInterpret(t, ` struct S { - access(Mutable) fun foo() {} - access(Insertable) fun bar() {} - access(Removable) fun baz() {} + access(Mutate) fun foo() {} + access(Insert) fun bar() {} + access(Remove) fun baz() {} } fun main() { let s = S() - let mutableRef = &s as auth(Mutable) &S - let insertableRef = &s as auth(Insertable) &S - let removableRef = &s as auth(Removable) &S + let mutableRef = &s as auth(Mutate) &S + let insertableRef = &s as auth(Insert) &S + let removableRef = &s as auth(Remove) &S } `) @@ -3039,14 +3039,14 @@ func TestInterpretIdentityMapping(t *testing.T) { fun main() { let s = S() - let mutableRef = &s as auth(Mutable) &S - let ref1: auth(Mutable) &AnyStruct = mutableRef.foo() + let mutableRef = &s as auth(Mutate) &S + let ref1: auth(Mutate) &AnyStruct = mutableRef.foo() - let insertableRef = &s as auth(Insertable) &S - let ref2: auth(Insertable) &AnyStruct = insertableRef.foo() + let insertableRef = &s as auth(Insert) &S + let ref2: auth(Insert) &AnyStruct = insertableRef.foo() - let removableRef = &s as auth(Removable) &S - let ref3: auth(Removable) &AnyStruct = removableRef.foo() + let removableRef = &s as auth(Remove) &S + let ref3: auth(Remove) &AnyStruct = removableRef.foo() } `) @@ -3068,11 +3068,11 @@ func TestInterpretIdentityMapping(t *testing.T) { fun main() { let s = S() - let ref1 = &s as auth(Insertable | Removable) &S - let resultRef1: auth(Insertable | Removable) &AnyStruct = ref1.foo() + let ref1 = &s as auth(Insert | Remove) &S + let resultRef1: auth(Insert | Remove) &AnyStruct = ref1.foo() - let ref2 = &s as auth(Insertable, Removable) &S - let resultRef2: auth(Insertable, Removable) &AnyStruct = ref2.foo() + let ref2 = &s as auth(Insert, Remove) &S + let resultRef2: auth(Insert, Remove) &AnyStruct = ref2.foo() } `) diff --git a/runtime/tests/interpreter/member_test.go b/runtime/tests/interpreter/member_test.go index 58751535ba..f74a6dab88 100644 --- a/runtime/tests/interpreter/member_test.go +++ b/runtime/tests/interpreter/member_test.go @@ -1054,7 +1054,7 @@ func TestInterpretMemberAccess(t *testing.T) { fun test() { let dict: {String: AnyStruct} = {"foo": Foo(), "bar": Foo()} - let dictRef = &dict as auth(Mutable) &{String: AnyStruct} + let dictRef = &dict as auth(Mutate) &{String: AnyStruct} dictRef["foo"] <-> dictRef["bar"] } diff --git a/runtime/tests/interpreter/reference_test.go b/runtime/tests/interpreter/reference_test.go index db39a157dc..eceec3a82e 100644 --- a/runtime/tests/interpreter/reference_test.go +++ b/runtime/tests/interpreter/reference_test.go @@ -113,7 +113,7 @@ func TestInterpretContainerVariance(t *testing.T) { fun test(): Int { let dict: {Int: &S1} = {} - let dictRef = &dict as auth(Mutable) &{Int: &AnyStruct} + let dictRef = &dict as auth(Mutate) &{Int: &AnyStruct} let s2 = S2() dictRef[0] = &s2 as &AnyStruct @@ -148,7 +148,7 @@ func TestInterpretContainerVariance(t *testing.T) { fun test(): Int { let dict: {Int: S1} = {} - let dictRef = &dict as auth(Mutable) &{Int: AnyStruct} + let dictRef = &dict as auth(Mutate) &{Int: AnyStruct} dictRef[0] = S2() @@ -186,7 +186,7 @@ func TestInterpretContainerVariance(t *testing.T) { fun test(): Int { let dict: {Int: &S1} = {} - let dictRef = &dict as auth(Mutable) &{Int: &AnyStruct} + let dictRef = &dict as auth(Mutate) &{Int: &AnyStruct} let s2 = S2() dictRef[0] = &s2 as &AnyStruct @@ -225,7 +225,7 @@ func TestInterpretContainerVariance(t *testing.T) { fun test(): Int { let dict: {Int: S1} = {} - let dictRef = &dict as auth(Mutable) &{Int: AnyStruct} + let dictRef = &dict as auth(Mutate) &{Int: AnyStruct} dictRef[0] = S2() @@ -267,7 +267,7 @@ func TestInterpretContainerVariance(t *testing.T) { let s2 = S2() - let dictRef = &dict as auth(Mutable) &{Int: &AnyStruct} + let dictRef = &dict as auth(Mutate) &{Int: &AnyStruct} dictRef[0] = &s2 as &AnyStruct dict.values[0].value = 1 @@ -308,7 +308,7 @@ func TestInterpretContainerVariance(t *testing.T) { fun test() { let dict: {Int: S1} = {} - let dictRef = &dict as auth(Mutable) &{Int: AnyStruct} + let dictRef = &dict as auth(Mutate) &{Int: AnyStruct} dictRef[0] = S2() @@ -340,7 +340,7 @@ func TestInterpretContainerVariance(t *testing.T) { let s2 = S2() - let dictRef = &dict as auth(Mutable) &{Int: AnyStruct} + let dictRef = &dict as auth(Mutate) &{Int: AnyStruct} dictRef[0] = s2 let x = dict.values[0] @@ -369,7 +369,7 @@ func TestInterpretContainerVariance(t *testing.T) { fun test(): Int { let dict: {Int: fun(): Int} = {} - let dictRef = &dict as auth(Mutable) &{Int: AnyStruct} + let dictRef = &dict as auth(Mutate) &{Int: AnyStruct} dictRef[0] = f2 @@ -393,7 +393,7 @@ func TestInterpretContainerVariance(t *testing.T) { fun test() { let dict: {Int: [UInt8]} = {} - let dictRef = &dict as auth(Mutable) &{Int: AnyStruct} + let dictRef = &dict as auth(Mutate) &{Int: AnyStruct} dictRef[0] = "not an [UInt8] array, but a String" @@ -417,7 +417,7 @@ func TestInterpretContainerVariance(t *testing.T) { fun test() { let dict: {Int: [UInt8]} = {} - let dictRef = &dict as auth(Mutable) &{Int: AnyStruct} + let dictRef = &dict as auth(Mutate) &{Int: AnyStruct} dictRef[0] = "not an [UInt8] array, but a String" @@ -649,7 +649,7 @@ func TestInterpretResourceReferenceInvalidationOnMove(t *testing.T) { } } - fun test(target: auth(Mutable) &[R]) { + fun test(target: auth(Mutate) &[R]) { target.append(<- create R()) // Take reference while in the account @@ -681,7 +681,7 @@ func TestInterpretResourceReferenceInvalidationOnMove(t *testing.T) { arrayRef := interpreter.NewUnmeteredEphemeralReferenceValue( interpreter.NewEntitlementSetAuthorization( nil, - []common.TypeID{"Mutable"}, + []common.TypeID{"Mutate"}, sema.Conjunction, ), array, @@ -755,7 +755,7 @@ func TestInterpretResourceReferenceInvalidationOnMove(t *testing.T) { } } - fun test(target1: auth(Mutable) &[R], target2: auth(Mutable) &[R]) { + fun test(target1: auth(Mutate) &[R], target2: auth(Mutate) &[R]) { target1.append(<- create R()) // Take reference while in the account_1 @@ -785,7 +785,7 @@ func TestInterpretResourceReferenceInvalidationOnMove(t *testing.T) { arrayRef1 := interpreter.NewUnmeteredEphemeralReferenceValue( interpreter.NewEntitlementSetAuthorization( nil, - []common.TypeID{"Mutable"}, + []common.TypeID{"Mutate"}, sema.Conjunction, ), array1, @@ -808,7 +808,7 @@ func TestInterpretResourceReferenceInvalidationOnMove(t *testing.T) { arrayRef2 := interpreter.NewUnmeteredEphemeralReferenceValue( interpreter.NewEntitlementSetAuthorization( nil, - []common.TypeID{"Mutable"}, + []common.TypeID{"Mutate"}, sema.Conjunction, ), array2, @@ -839,7 +839,7 @@ func TestInterpretResourceReferenceInvalidationOnMove(t *testing.T) { } } - fun test(target: auth(Mutable) &[R]): Int { + fun test(target: auth(Mutate) &[R]): Int { target.append(<- create R()) // Take reference while in the account @@ -878,7 +878,7 @@ func TestInterpretResourceReferenceInvalidationOnMove(t *testing.T) { arrayRef := interpreter.NewUnmeteredEphemeralReferenceValue( interpreter.NewEntitlementSetAuthorization( nil, - []common.TypeID{"Mutable"}, + []common.TypeID{"Mutate"}, sema.Conjunction, ), array, @@ -951,7 +951,7 @@ func TestInterpretResourceReferenceInvalidationOnMove(t *testing.T) { var ref2: &R? = nil var ref3: &R? = nil - fun setup(collection: auth(Mutable) &[R]) { + fun setup(collection: auth(Mutate) &[R]) { collection.append(<- create R()) // Take reference while in the account @@ -1007,7 +1007,7 @@ func TestInterpretResourceReferenceInvalidationOnMove(t *testing.T) { arrayRef := interpreter.NewUnmeteredEphemeralReferenceValue( interpreter.NewEntitlementSetAuthorization( nil, - []common.TypeID{"Mutable"}, + []common.TypeID{"Mutate"}, sema.Conjunction, ), array, diff --git a/runtime/tests/interpreter/resources_test.go b/runtime/tests/interpreter/resources_test.go index 4ff15734c5..f66bf3f7da 100644 --- a/runtime/tests/interpreter/resources_test.go +++ b/runtime/tests/interpreter/resources_test.go @@ -2063,7 +2063,7 @@ func TestInterpretOptionalResourceReference(t *testing.T) { fun test() { account.save(<-{0 : <-create R()}, to: /storage/x) - let collection = account.borrow(from: /storage/x)! + let collection = account.borrow(from: /storage/x)! let resourceRef = collection[0]! let token <- collection.remove(key: 0) @@ -2101,7 +2101,7 @@ func TestInterpretArrayOptionalResourceReference(t *testing.T) { fun test() { account.save(<-[<-create R()], to: /storage/x) - let collection = account.borrow(from: /storage/x)! + let collection = account.borrow(from: /storage/x)! let resourceRef = collection[0]! let token <- collection.remove(at: 0) diff --git a/runtime/tests/interpreter/string_test.go b/runtime/tests/interpreter/string_test.go index 1057649306..89ddce3e86 100644 --- a/runtime/tests/interpreter/string_test.go +++ b/runtime/tests/interpreter/string_test.go @@ -36,7 +36,7 @@ func TestInterpretRecursiveValueString(t *testing.T) { inter := parseCheckAndInterpret(t, ` fun test(): AnyStruct { let map: {String: AnyStruct} = {} - let mapRef = &map as auth(Mutable) &{String: AnyStruct} + let mapRef = &map as auth(Mutate) &{String: AnyStruct} mapRef["mapRef"] = mapRef return map }