Skip to content

Commit

Permalink
fix merge: implement new runtime interface functions
Browse files Browse the repository at this point in the history
  • Loading branch information
turbolent committed Oct 16, 2024
1 parent e6c5f1b commit d3cca43
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions runtime/empty.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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")
}
Expand Down Expand Up @@ -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")
}
1 change: 1 addition & 0 deletions runtime/tests/runtime_utils/testinterface.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit d3cca43

Please sign in to comment.