Skip to content

Add ComputationUsed to TransactionResult in test framework#4455

Draft
holyfuchs wants to merge 2 commits intomasterfrom
holyfuchs/test-computation-metering
Draft

Add ComputationUsed to TransactionResult in test framework#4455
holyfuchs wants to merge 2 commits intomasterfrom
holyfuchs/test-computation-metering

Conversation

@holyfuchs
Copy link
Copy Markdown
Member

Adds computationUsed field to TransactionResult as part of computation metering support in the Cadence test framework (onflow/cadence-tools#563).
Updates the Go struct, the Cadence contract struct in test.cdc, and the newTransactionResult constructor invocation in test.go to pass the new value. No existing behavior is changed.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 24, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Snapshot Warnings

⚠️: No snapshots were found for the head SHA 0ec44e2.
Ensure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice.

Scanned Files

None

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 24, 2026

Benchstat comparison

  • Base branch: onflow:master
  • Base commit: 628a7c5
Results

old.txtnew.txt
time/opdelta
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
ByteArrayTransfer-41.30µs ± 0%1.33µs ± 0%~(p=1.000 n=1+1)
ByteArrayValueToByteSlice-475.4ns ± 0%74.5ns ± 0%~(p=1.000 n=1+1)
ByteSliceToByteArrayValue-41.07µs ± 0%1.06µs ± 0%~(p=1.000 n=1+1)
pkg:github.com/onflow/cadence/runtime goos:linux goarch:amd64
ContractFunctionInvocation-4379µs ± 0%378µs ± 0%~(p=1.000 n=1+1)
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
EMVAddressTransfer-43.58µs ± 0%3.75µs ± 0%~(p=1.000 n=1+1)
Emit-44.70ms ± 0%4.70ms ± 0%~(p=1.000 n=1+1)
EnumTransfer-41.52µs ± 0%1.44µs ± 0%~(p=1.000 n=1+1)
pkg:github.com/onflow/cadence/runtime goos:linux goarch:amd64
ExportType/composite_type-4310ns ± 0%311ns ± 0%~(p=1.000 n=1+1)
ExportType/simple_type-466.2ns ± 0%66.4ns ± 0%~(p=1.000 n=1+1)
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
ImperativeFib-424.1µs ± 0%24.4µs ± 0%~(p=1.000 n=1+1)
InterpretRecursionFib-42.29ms ± 0%2.26ms ± 0%~(p=1.000 n=1+1)
NewInterpreter/new_interpreter-4871ns ± 0%896ns ± 0%~(p=1.000 n=1+1)
NewInterpreter/new_sub-interpreter-4330ns ± 0%337ns ± 0%~(p=1.000 n=1+1)
pkg:github.com/onflow/cadence/runtime goos:linux goarch:amd64
RuntimeFungibleTokenTransferInterpreter-4639µs ± 0%643µs ± 0%~(p=1.000 n=1+1)
RuntimeFungibleTokenTransferVM-4701µs ± 0%696µs ± 0%~(p=1.000 n=1+1)
RuntimeResourceDictionaryValues-42.81ms ± 0%2.83ms ± 0%~(p=1.000 n=1+1)
RuntimeResourceTracking-410.0ms ± 0%10.0ms ± 0%~(p=1.000 n=1+1)
RuntimeScriptNoop-414.8µs ± 0%15.1µs ± 0%~(p=1.000 n=1+1)
RuntimeVMInvokeContractImperativeFib-438.6µs ± 0%38.2µs ± 0%~(p=1.000 n=1+1)
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
ValueIsSubtypeOfSemaType-458.6ns ± 0%60.6ns ± 0%~(p=1.000 n=1+1)
 
alloc/opdelta
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
ByteArrayTransfer-41.05kB ± 0%1.01kB ± 0%~(p=1.000 n=1+1)
ByteArrayValueToByteSlice-432.0B ± 0%32.0B ± 0%~(all equal)
ByteSliceToByteArrayValue-4855B ± 0%855B ± 0%~(all equal)
pkg:github.com/onflow/cadence/runtime goos:linux goarch:amd64
ContractFunctionInvocation-4146kB ± 0%146kB ± 0%~(p=1.000 n=1+1)
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
EMVAddressTransfer-42.45kB ± 0%2.46kB ± 0%~(p=1.000 n=1+1)
Emit-41.50MB ± 0%1.51MB ± 0%~(p=1.000 n=1+1)
EnumTransfer-4848B ± 0%834B ± 0%~(p=1.000 n=1+1)
pkg:github.com/onflow/cadence/runtime goos:linux goarch:amd64
ExportType/composite_type-4120B ± 0%120B ± 0%~(all equal)
ExportType/simple_type-40.00B 0.00B ~(all equal)
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
ImperativeFib-48.30kB ± 0%8.30kB ± 0%~(all equal)
InterpretRecursionFib-41.19MB ± 0%1.19MB ± 0%~(p=1.000 n=1+1)
NewInterpreter/new_interpreter-4976B ± 0%976B ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-4232B ± 0%232B ± 0%~(all equal)
pkg:github.com/onflow/cadence/runtime goos:linux goarch:amd64
RuntimeFungibleTokenTransferInterpreter-4170kB ± 0%170kB ± 0%~(p=1.000 n=1+1)
RuntimeFungibleTokenTransferVM-4193kB ± 0%193kB ± 0%~(p=1.000 n=1+1)
RuntimeResourceDictionaryValues-41.77MB ± 0%1.77MB ± 0%~(p=1.000 n=1+1)
RuntimeResourceTracking-46.99MB ± 0%6.98MB ± 0%~(p=1.000 n=1+1)
RuntimeScriptNoop-48.05kB ± 0%8.05kB ± 0%~(p=1.000 n=1+1)
RuntimeVMInvokeContractImperativeFib-413.3kB ± 0%13.3kB ± 0%~(all equal)
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
ValueIsSubtypeOfSemaType-432.0B ± 0%32.0B ± 0%~(all equal)
 
allocs/opdelta
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
ByteArrayTransfer-47.00 ± 0%7.00 ± 0%~(all equal)
ByteArrayValueToByteSlice-41.00 ± 0%1.00 ± 0%~(all equal)
ByteSliceToByteArrayValue-45.00 ± 0%5.00 ± 0%~(all equal)
pkg:github.com/onflow/cadence/runtime goos:linux goarch:amd64
ContractFunctionInvocation-42.42k ± 0%2.42k ± 0%~(all equal)
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
EMVAddressTransfer-429.0 ± 0%29.0 ± 0%~(all equal)
Emit-440.0k ± 0%40.0k ± 0%~(p=1.000 n=1+1)
EnumTransfer-413.0 ± 0%13.0 ± 0%~(all equal)
pkg:github.com/onflow/cadence/runtime goos:linux goarch:amd64
ExportType/composite_type-43.00 ± 0%3.00 ± 0%~(all equal)
ExportType/simple_type-40.00 0.00 ~(all equal)
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
ImperativeFib-4176 ± 0%176 ± 0%~(all equal)
InterpretRecursionFib-417.7k ± 0%17.7k ± 0%~(all equal)
NewInterpreter/new_interpreter-415.0 ± 0%15.0 ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-44.00 ± 0%4.00 ± 0%~(all equal)
pkg:github.com/onflow/cadence/runtime goos:linux goarch:amd64
RuntimeFungibleTokenTransferInterpreter-43.27k ± 0%3.27k ± 0%~(all equal)
RuntimeFungibleTokenTransferVM-43.73k ± 0%3.73k ± 0%~(all equal)
RuntimeResourceDictionaryValues-436.8k ± 0%36.8k ± 0%~(all equal)
RuntimeResourceTracking-4129k ± 0%129k ± 0%~(all equal)
RuntimeScriptNoop-4114 ± 0%114 ± 0%~(all equal)
RuntimeVMInvokeContractImperativeFib-4424 ± 0%424 ± 0%~(all equal)
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
ValueIsSubtypeOfSemaType-41.00 ± 0%1.00 ± 0%~(all equal)
 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant