Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions emulator/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,13 +610,11 @@ func configureFVM(blockchain *Blockchain, conf config, blocks *blocks) (*fvm.Vir
cadenceLogger := conf.Logger.Hook(CadenceHook{MainLogger: &conf.ServerLogger}).Level(zerolog.DebugLevel)

runtimeConfig := runtime.Config{
Debugger: blockchain.debugger,
LegacyContractUpgradeEnabled: conf.LegacyContractUpgradeEnabled,
CoverageReport: conf.CoverageReport,
StorageFormatV2Enabled: true,
Debugger: blockchain.debugger,
CoverageReport: conf.CoverageReport,
}
coverageReportedRuntime := &CoverageReportedRuntime{
Runtime: runtime.NewInterpreterRuntime(runtimeConfig),
Runtime: runtime.NewRuntime(runtimeConfig),
CoverageReport: conf.CoverageReport,
Environment: runtime.NewBaseInterpreterEnvironment(runtimeConfig),
}
Expand Down
12 changes: 6 additions & 6 deletions emulator/computation_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ type ProcedureReport struct {
ComputationUsed uint64 `json:"computation"`
// To get the computation from the intensities map, see:
// https://github.com/onflow/flow-go/blob/master/fvm/meter/computation_meter.go#L32-L39
Intensities map[string]uint `json:"intensities"`
MemoryEstimate uint64 `json:"memory"`
Code string `json:"source"`
Arguments []string `json:"arguments"`
Intensities map[string]uint64 `json:"intensities"`
MemoryEstimate uint64 `json:"memory"`
Code string `json:"source"`
Arguments []string `json:"arguments"`
}

type ComputationReport struct {
Expand Down Expand Up @@ -82,8 +82,8 @@ func (cr *ComputationReport) ReportTransaction(
// to a human-friendly string value.
func transformIntensities(
intensities meter.MeteredComputationIntensities,
) map[string]uint {
result := make(map[string]uint)
) map[string]uint64 {
result := make(map[string]uint64)

for kind, value := range intensities {
switch kind {
Expand Down
4 changes: 2 additions & 2 deletions emulator/computation_report_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func TestComputationReportingForScript(t *testing.T) {
scriptProfile := computationReport.Scripts[scriptResult.ScriptID.String()]
assert.GreaterOrEqual(t, scriptProfile.ComputationUsed, uint64(2*2+3+5+7+11))

expectedIntensities := map[string]uint{
expectedIntensities := map[string]uint64{
"FunctionInvocation": 2,
"GetAccountContractCode": 1,
"GetCode": 1,
Expand Down Expand Up @@ -151,7 +151,7 @@ func TestComputationReportingForTransaction(t *testing.T) {
txProfile := computationReport.Transactions[txResult.TransactionID.String()]
assert.GreaterOrEqual(t, txProfile.ComputationUsed, uint64(1))

expectedIntensities := map[string]uint{
expectedIntensities := map[string]uint64{
"CreateCompositeValue": 2,
"CreateDictionaryValue": 1,
"EmitEvent": 73,
Expand Down
6 changes: 3 additions & 3 deletions emulator/transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2017,7 +2017,7 @@ func TestSubmitTransactionWithCustomLogger(t *testing.T) {
assert.Greater(t, meter.ComputationUsed, 0)
assert.Greater(t, meter.MemoryEstimate, 0)
assert.Greater(t, len(meter.ComputationIntensities), 0)
assert.Greater(t, len(meter.MemoryIntensities), 0)
assert.Greater(t, len(meter.MemoryAmounts), 0)

}

Expand All @@ -2026,12 +2026,12 @@ type Meter struct {
ComputationUsed int `json:"computationUsed"`
MemoryEstimate int `json:"memoryEstimate"`
ComputationIntensities MeteredComputationIntensities `json:"computationIntensities"`
MemoryIntensities MeteredMemoryIntensities `json:"memoryIntensities"`
MemoryAmounts MemoryAmounts `json:"memoryAmounts"`
}

type MeteredComputationIntensities map[common.ComputationKind]uint

type MeteredMemoryIntensities map[common.MemoryKind]uint
type MemoryAmounts map[common.MemoryKind]uint

func IncrementHelper(
t *testing.T,
Expand Down
93 changes: 49 additions & 44 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/onflow/flow-emulator

go 1.23
go 1.23.7

toolchain go1.23.4
toolchain go1.23.8

require (
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2
Expand All @@ -14,23 +14,23 @@ require (
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/improbable-eng/grpc-web v0.15.0
github.com/logrusorgru/aurora v2.0.3+incompatible
github.com/onflow/cadence v1.3.4
github.com/onflow/crypto v0.25.2
github.com/onflow/flow-core-contracts/lib/go/templates v1.6.0
github.com/onflow/flow-go v0.40.1
github.com/onflow/flow-go-sdk v1.3.3
github.com/onflow/flow-nft/lib/go/contracts v1.2.3
github.com/onflow/cadence v1.6.0
github.com/onflow/crypto v0.25.3
github.com/onflow/flow-core-contracts/lib/go/templates v1.6.1
github.com/onflow/flow-go v0.42.0
github.com/onflow/flow-go-sdk v1.6.0
github.com/onflow/flow-nft/lib/go/contracts v1.2.4
github.com/onflow/flow/protobuf/go/flow v0.4.10
github.com/prometheus/client_golang v1.20.5
github.com/psiemens/graceland v1.0.0
github.com/psiemens/sconfig v0.1.0
github.com/rs/zerolog v1.29.0
github.com/spf13/cobra v1.8.0
github.com/spf13/cobra v1.8.1
github.com/stretchr/testify v1.10.0
go.uber.org/atomic v1.11.0
go.uber.org/mock v0.5.0
golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67
google.golang.org/grpc v1.67.1
google.golang.org/grpc v1.72.0
)

require github.com/SaveTheRbtz/mph v0.1.1-0.20240117162131-4166ec7869bc // indirect
Expand All @@ -41,23 +41,23 @@ require (
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/VictoriaMetrics/fastcache v1.12.2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/bits-and-blooms/bitset v1.17.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cockroachdb/errors v1.11.3 // indirect
github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v1.1.1 // indirect
github.com/cockroachdb/pebble v1.1.2 // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
github.com/consensys/bavard v0.1.22 // indirect
github.com/consensys/gnark-crypto v0.14.0 // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c // indirect
github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a // indirect
github.com/crate-crypto/go-kzg-4844 v1.1.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
github.com/deckarep/golang-set/v2 v2.6.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
Expand All @@ -71,10 +71,9 @@ require (
github.com/ef-ds/deque v1.0.4 // indirect
github.com/ethereum/c-kzg-4844 v1.0.0 // indirect
github.com/ethereum/go-ethereum v1.13.10 // indirect
github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0 // indirect
github.com/ethereum/go-verkle v0.2.2 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/fxamacker/circlehash v0.3.0 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect
github.com/getsentry/sentry-go v0.27.0 // indirect
github.com/go-kit/kit v0.12.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
Expand All @@ -84,7 +83,7 @@ require (
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/gofrs/flock v0.8.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v1.2.2 // indirect
github.com/golang/glog v1.2.4 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/google/uuid v1.6.0 // indirect
Expand All @@ -97,7 +96,7 @@ require (
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
github.com/holiman/uint256 v1.3.0 // indirect
github.com/holiman/uint256 v1.3.2 // indirect
github.com/huandu/go-clone v1.6.0 // indirect
github.com/huandu/go-clone/generic v1.7.2 // indirect
github.com/huin/goupnp v1.3.0 // indirect
Expand Down Expand Up @@ -146,20 +145,25 @@ require (
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/onflow/atree v0.10.0 // indirect
github.com/onflow/bridged-usdc/lib/go/contracts v1.0.0 // indirect
github.com/onflow/flow-core-contracts/lib/go/contracts v1.6.0 // indirect
github.com/onflow/flow-core-contracts/lib/go/contracts v1.6.1 // indirect
github.com/onflow/flow-evm-bridge v0.1.0 // indirect
github.com/onflow/flow-ft/lib/go/contracts v1.0.1 // indirect
github.com/onflow/flow-ft/lib/go/templates v1.0.1 // indirect
github.com/onflow/flow-nft/lib/go/templates v1.2.1 // indirect
github.com/onflow/go-ethereum v1.14.7 // indirect
github.com/onflow/go-ethereum v1.15.10 // indirect
github.com/onflow/nft-storefront/lib/go/contracts v1.0.0 // indirect
github.com/onflow/sdks v0.6.0-preview.1 // indirect
github.com/onflow/wal v1.0.2 // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
github.com/pelletier/go-toml/v2 v2.2.1 // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
github.com/pion/dtls/v2 v2.2.12 // indirect
github.com/pion/logging v0.2.2 // indirect
github.com/pion/stun/v2 v2.0.0 // indirect
github.com/pion/transport/v2 v2.2.10 // indirect
github.com/pion/transport/v3 v3.0.7 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.61.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
Expand All @@ -178,43 +182,42 @@ require (
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.15.0 // indirect
github.com/status-im/keycard-go v0.2.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/supranational/blst v0.3.14 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
github.com/texttheater/golang-levenshtein/levenshtein v0.0.0-20200805054039-cae8b0eaed6c // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/turbolent/prettier v0.0.0-20220320183459-661cc755135d // indirect
github.com/tyler-smith/go-bip39 v1.1.0 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/vmihailenco/msgpack/v4 v4.3.11 // indirect
github.com/vmihailenco/tagparser v0.1.1 // indirect
github.com/wlynxg/anet v0.0.5 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/zeebo/blake3 v0.2.4 // indirect
go.opentelemetry.io/otel v1.31.0 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/otel v1.35.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0 // indirect
go.opentelemetry.io/otel/metric v1.31.0 // indirect
go.opentelemetry.io/otel/sdk v1.31.0 // indirect
go.opentelemetry.io/otel/trace v1.31.0 // indirect
go.opentelemetry.io/otel/metric v1.35.0 // indirect
go.opentelemetry.io/otel/sdk v1.35.0 // indirect
go.opentelemetry.io/otel/trace v1.35.0 // indirect
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/term v0.27.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/crypto v0.37.0 // indirect
golang.org/x/net v0.39.0 // indirect
golang.org/x/sync v0.14.0 // indirect
golang.org/x/sys v0.32.0 // indirect
golang.org/x/term v0.31.0 // indirect
golang.org/x/text v0.24.0 // indirect
golang.org/x/time v0.11.0 // indirect
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
gonum.org/v1/gonum v0.15.0 // indirect
gonum.org/v1/gonum v0.16.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect
google.golang.org/protobuf v1.36.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250414145226-207652e42e2e // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250428153025-10db94c68c34 // indirect
google.golang.org/protobuf v1.36.6 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/blake3 v1.4.0 // indirect
Expand All @@ -225,3 +228,5 @@ require (
nhooyr.io/websocket v1.8.7 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)

replace github.com/hashicorp/golang-lru/v2 => github.com/fxamacker/golang-lru/v2 v2.0.0-20250430153159-6f72f038a30f
Loading
Loading