From d3cca437ad46965f86e70e9d04a73e78227041fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20M=C3=BCller?= Date: Wed, 16 Oct 2024 15:23:46 -0700 Subject: [PATCH] fix merge: implement new runtime interface functions --- runtime/empty.go | 9 +++++++++ runtime/tests/runtime_utils/testinterface.go | 1 + 2 files changed, 10 insertions(+) diff --git a/runtime/empty.go b/runtime/empty.go index 86b5b0abce..01e5f01e87 100644 --- a/runtime/empty.go +++ b/runtime/empty.go @@ -29,6 +29,7 @@ import ( "github.com/onflow/cadence/runtime/common" "github.com/onflow/cadence/runtime/interpreter" "github.com/onflow/cadence/runtime/sema" + "github.com/onflow/cadence/runtime/stdlib" ) // EmptyRuntimeInterface is an empty implementation of runtime.Interface. @@ -63,6 +64,10 @@ func (EmptyRuntimeInterface) ComputationUsed() (uint64, error) { panic("unexpected call to ComputationUsed") } +func (i EmptyRuntimeInterface) ComputationRemaining(_ common.ComputationKind) uint { + panic("unexpected call to ComputationRemaining") +} + func (EmptyRuntimeInterface) MemoryUsed() (uint64, error) { panic("unexpected call to MemoryUsed") } @@ -260,3 +265,7 @@ func (EmptyRuntimeInterface) ValidateAccountCapabilitiesPublish( ) (bool, error) { panic("unexpected call to ValidateAccountCapabilitiesPublish") } + +func (EmptyRuntimeInterface) CompileWebAssembly(_ []byte) (stdlib.WebAssemblyModule, error) { + panic("unexpected call to CompileWebAssembly") +} diff --git a/runtime/tests/runtime_utils/testinterface.go b/runtime/tests/runtime_utils/testinterface.go index 34c57a5c6c..6467e396e7 100644 --- a/runtime/tests/runtime_utils/testinterface.go +++ b/runtime/tests/runtime_utils/testinterface.go @@ -121,6 +121,7 @@ type TestRuntimeInterface struct { OnComputationUsed func() (uint64, error) OnMemoryUsed func() (uint64, error) OnInteractionUsed func() (uint64, error) + OnComputationRemaining func(kind common.ComputationKind) uint OnGenerateAccountID func(address common.Address) (uint64, error) OnRecoverProgram func(program *ast.Program, location common.Location) ([]byte, error) OnValidateAccountCapabilitiesGet func(