diff --git a/fvm/environment/facade_env.go b/fvm/environment/facade_env.go index 8103ddb1f04..c6c22719768 100644 --- a/fvm/environment/facade_env.go +++ b/fvm/environment/facade_env.go @@ -6,7 +6,6 @@ import ( "github.com/onflow/cadence/ast" "github.com/onflow/cadence/common" "github.com/onflow/cadence/interpreter" - "github.com/onflow/cadence/sema" "github.com/onflow/flow-go/fvm/storage" "github.com/onflow/flow-go/fvm/storage/snapshot" @@ -351,10 +350,10 @@ func (env *facadeEnvironment) ValidateAccountCapabilitiesGet( _ interpreter.AccountCapabilityGetValidationContext, _ interpreter.AddressValue, _ interpreter.PathValue, - wantedBorrowType *sema.ReferenceType, - _ *sema.ReferenceType, + wantedBorrowType *interpreter.ReferenceStaticType, + _ *interpreter.ReferenceStaticType, ) (bool, error) { - _, hasEntitlements := wantedBorrowType.Authorization.(sema.EntitlementSetAccess) + _, hasEntitlements := wantedBorrowType.Authorization.(interpreter.EntitlementSetAuthorization) if hasEntitlements { // TODO: maybe abort //return false, &interpreter.GetCapabilityError{} diff --git a/fvm/environment/mock/environment.go b/fvm/environment/mock/environment.go index 2c7809dc48f..38cd7a765d8 100644 --- a/fvm/environment/mock/environment.go +++ b/fvm/environment/mock/environment.go @@ -28,8 +28,6 @@ import ( runtime "github.com/onflow/cadence/runtime" - sema "github.com/onflow/cadence/sema" - time "time" trace "github.com/onflow/flow-go/module/trace" @@ -1723,7 +1721,7 @@ func (_m *Environment) UpdateAccountContractCode(location common.AddressLocation } // ValidateAccountCapabilitiesGet provides a mock function with given fields: context, address, path, wantedBorrowType, capabilityBorrowType -func (_m *Environment) ValidateAccountCapabilitiesGet(context interpreter.AccountCapabilityGetValidationContext, address interpreter.AddressValue, path interpreter.PathValue, wantedBorrowType *sema.ReferenceType, capabilityBorrowType *sema.ReferenceType) (bool, error) { +func (_m *Environment) ValidateAccountCapabilitiesGet(context interpreter.AccountCapabilityGetValidationContext, address interpreter.AddressValue, path interpreter.PathValue, wantedBorrowType *interpreter.ReferenceStaticType, capabilityBorrowType *interpreter.ReferenceStaticType) (bool, error) { ret := _m.Called(context, address, path, wantedBorrowType, capabilityBorrowType) if len(ret) == 0 { @@ -1732,16 +1730,16 @@ func (_m *Environment) ValidateAccountCapabilitiesGet(context interpreter.Accoun var r0 bool var r1 error - if rf, ok := ret.Get(0).(func(interpreter.AccountCapabilityGetValidationContext, interpreter.AddressValue, interpreter.PathValue, *sema.ReferenceType, *sema.ReferenceType) (bool, error)); ok { + if rf, ok := ret.Get(0).(func(interpreter.AccountCapabilityGetValidationContext, interpreter.AddressValue, interpreter.PathValue, *interpreter.ReferenceStaticType, *interpreter.ReferenceStaticType) (bool, error)); ok { return rf(context, address, path, wantedBorrowType, capabilityBorrowType) } - if rf, ok := ret.Get(0).(func(interpreter.AccountCapabilityGetValidationContext, interpreter.AddressValue, interpreter.PathValue, *sema.ReferenceType, *sema.ReferenceType) bool); ok { + if rf, ok := ret.Get(0).(func(interpreter.AccountCapabilityGetValidationContext, interpreter.AddressValue, interpreter.PathValue, *interpreter.ReferenceStaticType, *interpreter.ReferenceStaticType) bool); ok { r0 = rf(context, address, path, wantedBorrowType, capabilityBorrowType) } else { r0 = ret.Get(0).(bool) } - if rf, ok := ret.Get(1).(func(interpreter.AccountCapabilityGetValidationContext, interpreter.AddressValue, interpreter.PathValue, *sema.ReferenceType, *sema.ReferenceType) error); ok { + if rf, ok := ret.Get(1).(func(interpreter.AccountCapabilityGetValidationContext, interpreter.AddressValue, interpreter.PathValue, *interpreter.ReferenceStaticType, *interpreter.ReferenceStaticType) error); ok { r1 = rf(context, address, path, wantedBorrowType, capabilityBorrowType) } else { r1 = ret.Error(1) diff --git a/fvm/fvm_test.go b/fvm/fvm_test.go index dfcff872fed..0a413182e9e 100644 --- a/fvm/fvm_test.go +++ b/fvm/fvm_test.go @@ -3976,15 +3976,19 @@ func TestAccountCapabilitiesGetEntitledRejection(t *testing.T) { nil, interpreter.AddressValue(common.ZeroAddress), interpreter.NewUnmeteredPathValue(common.PathDomainPublic, "dummy_value"), - sema.NewReferenceType( + interpreter.NewReferenceStaticType( nil, - sema.NewEntitlementSetAccess( - []*sema.EntitlementType{ - sema.MutateType, + interpreter.NewEntitlementSetAuthorization( + nil, + func() []common.TypeID { + return []common.TypeID{ + sema.MutateType.ID(), + } }, + 1, sema.Conjunction, ), - sema.IntType, + interpreter.PrimitiveStaticTypeInt, ), nil, ) @@ -4005,10 +4009,10 @@ func TestAccountCapabilitiesGetEntitledRejection(t *testing.T) { nil, interpreter.AddressValue(common.ZeroAddress), interpreter.NewUnmeteredPathValue(common.PathDomainPublic, "dummy_value"), - sema.NewReferenceType( + interpreter.NewReferenceStaticType( nil, - sema.UnauthorizedAccess, - sema.IntType, + interpreter.UnauthorizedAccess, + interpreter.PrimitiveStaticTypeInt, ), nil, ) diff --git a/go.mod b/go.mod index 91b6edfc20a..15b8f925132 100644 --- a/go.mod +++ b/go.mod @@ -47,7 +47,7 @@ require ( github.com/multiformats/go-multiaddr-dns v0.4.1 github.com/multiformats/go-multihash v0.2.3 github.com/onflow/atree v0.12.0 - github.com/onflow/cadence v1.9.1 + github.com/onflow/cadence v1.9.2-0.20251205230900-d0c5cc82b279 github.com/onflow/crypto v0.25.3 github.com/onflow/flow v0.4.15 github.com/onflow/flow-core-contracts/lib/go/contracts v1.9.2 diff --git a/go.sum b/go.sum index e5a512cae99..a739a1678a7 100644 --- a/go.sum +++ b/go.sum @@ -940,8 +940,8 @@ github.com/onflow/atree v0.12.0 h1:X7/UEPyCaaEQ1gCg11KDvfyEtEeQLhtRtxMHjAiH/Co= github.com/onflow/atree v0.12.0/go.mod h1:qdZcfLQwPirHcNpLiK+2t3KAo+SAb9Si6TqurE6pykE= github.com/onflow/boxo v0.0.0-20240201202436-f2477b92f483 h1:LpiQhTAfM9CAmNVEs0n//cBBgCg+vJSiIxTHYUklZ84= github.com/onflow/boxo v0.0.0-20240201202436-f2477b92f483/go.mod h1:pIZgTWdm3k3pLF9Uq6MB8JEcW07UDwNJjlXW1HELW80= -github.com/onflow/cadence v1.9.1 h1:z78U90Vt+5aBb4MlFk3mQWNi/5fYcUYtXSB/NBNfMKo= -github.com/onflow/cadence v1.9.1/go.mod h1:MlJsCwhCZwdnAUd24XHzcsizZfG7a2leab1PztabUsE= +github.com/onflow/cadence v1.9.2-0.20251205230900-d0c5cc82b279 h1:ASEFfO49ht2Z6+OU6pornOM+ypzo9PfP+CFboWmfbgw= +github.com/onflow/cadence v1.9.2-0.20251205230900-d0c5cc82b279/go.mod h1:MlJsCwhCZwdnAUd24XHzcsizZfG7a2leab1PztabUsE= github.com/onflow/crypto v0.25.3 h1:XQ3HtLsw8h1+pBN+NQ1JYM9mS2mVXTyg55OldaAIF7U= github.com/onflow/crypto v0.25.3/go.mod h1:+1igaXiK6Tjm9wQOBD1EGwW7bYWMUGKtwKJ/2QL/OWs= github.com/onflow/fixed-point v0.1.1 h1:j0jYZVO8VGyk1476alGudEg7XqCkeTVxb5ElRJRKS90= diff --git a/insecure/go.mod b/insecure/go.mod index c38cc464c91..6cd3ca260ac 100644 --- a/insecure/go.mod +++ b/insecure/go.mod @@ -215,7 +215,7 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/onflow/atree v0.12.0 // indirect - github.com/onflow/cadence v1.9.1 // indirect + github.com/onflow/cadence v1.9.2-0.20251205230900-d0c5cc82b279 // indirect github.com/onflow/fixed-point v0.1.1 // indirect github.com/onflow/flow-core-contracts/lib/go/contracts v1.9.2 // indirect github.com/onflow/flow-core-contracts/lib/go/templates v1.9.2 // indirect diff --git a/insecure/go.sum b/insecure/go.sum index b2a5ed17c89..0be61663965 100644 --- a/insecure/go.sum +++ b/insecure/go.sum @@ -890,8 +890,8 @@ github.com/onflow/atree v0.12.0 h1:X7/UEPyCaaEQ1gCg11KDvfyEtEeQLhtRtxMHjAiH/Co= github.com/onflow/atree v0.12.0/go.mod h1:qdZcfLQwPirHcNpLiK+2t3KAo+SAb9Si6TqurE6pykE= github.com/onflow/boxo v0.0.0-20240201202436-f2477b92f483 h1:LpiQhTAfM9CAmNVEs0n//cBBgCg+vJSiIxTHYUklZ84= github.com/onflow/boxo v0.0.0-20240201202436-f2477b92f483/go.mod h1:pIZgTWdm3k3pLF9Uq6MB8JEcW07UDwNJjlXW1HELW80= -github.com/onflow/cadence v1.9.1 h1:z78U90Vt+5aBb4MlFk3mQWNi/5fYcUYtXSB/NBNfMKo= -github.com/onflow/cadence v1.9.1/go.mod h1:MlJsCwhCZwdnAUd24XHzcsizZfG7a2leab1PztabUsE= +github.com/onflow/cadence v1.9.2-0.20251205230900-d0c5cc82b279 h1:ASEFfO49ht2Z6+OU6pornOM+ypzo9PfP+CFboWmfbgw= +github.com/onflow/cadence v1.9.2-0.20251205230900-d0c5cc82b279/go.mod h1:MlJsCwhCZwdnAUd24XHzcsizZfG7a2leab1PztabUsE= github.com/onflow/crypto v0.25.3 h1:XQ3HtLsw8h1+pBN+NQ1JYM9mS2mVXTyg55OldaAIF7U= github.com/onflow/crypto v0.25.3/go.mod h1:+1igaXiK6Tjm9wQOBD1EGwW7bYWMUGKtwKJ/2QL/OWs= github.com/onflow/fixed-point v0.1.1 h1:j0jYZVO8VGyk1476alGudEg7XqCkeTVxb5ElRJRKS90= diff --git a/integration/go.mod b/integration/go.mod index e9367549420..87bbcd7e458 100644 --- a/integration/go.mod +++ b/integration/go.mod @@ -21,7 +21,7 @@ require ( github.com/ipfs/go-datastore v0.8.2 github.com/ipfs/go-ds-pebble v0.5.0 github.com/libp2p/go-libp2p v0.38.2 - github.com/onflow/cadence v1.9.1 + github.com/onflow/cadence v1.9.2-0.20251205230900-d0c5cc82b279 github.com/onflow/crypto v0.25.3 github.com/onflow/flow v0.4.15 github.com/onflow/flow-core-contracts/lib/go/contracts v1.9.2 diff --git a/integration/go.sum b/integration/go.sum index 25f3155d14b..17a26055851 100644 --- a/integration/go.sum +++ b/integration/go.sum @@ -764,8 +764,8 @@ github.com/onflow/atree v0.12.0 h1:X7/UEPyCaaEQ1gCg11KDvfyEtEeQLhtRtxMHjAiH/Co= github.com/onflow/atree v0.12.0/go.mod h1:qdZcfLQwPirHcNpLiK+2t3KAo+SAb9Si6TqurE6pykE= github.com/onflow/boxo v0.0.0-20240201202436-f2477b92f483 h1:LpiQhTAfM9CAmNVEs0n//cBBgCg+vJSiIxTHYUklZ84= github.com/onflow/boxo v0.0.0-20240201202436-f2477b92f483/go.mod h1:pIZgTWdm3k3pLF9Uq6MB8JEcW07UDwNJjlXW1HELW80= -github.com/onflow/cadence v1.9.1 h1:z78U90Vt+5aBb4MlFk3mQWNi/5fYcUYtXSB/NBNfMKo= -github.com/onflow/cadence v1.9.1/go.mod h1:MlJsCwhCZwdnAUd24XHzcsizZfG7a2leab1PztabUsE= +github.com/onflow/cadence v1.9.2-0.20251205230900-d0c5cc82b279 h1:ASEFfO49ht2Z6+OU6pornOM+ypzo9PfP+CFboWmfbgw= +github.com/onflow/cadence v1.9.2-0.20251205230900-d0c5cc82b279/go.mod h1:MlJsCwhCZwdnAUd24XHzcsizZfG7a2leab1PztabUsE= github.com/onflow/crypto v0.25.3 h1:XQ3HtLsw8h1+pBN+NQ1JYM9mS2mVXTyg55OldaAIF7U= github.com/onflow/crypto v0.25.3/go.mod h1:+1igaXiK6Tjm9wQOBD1EGwW7bYWMUGKtwKJ/2QL/OWs= github.com/onflow/fixed-point v0.1.1 h1:j0jYZVO8VGyk1476alGudEg7XqCkeTVxb5ElRJRKS90=