diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index b94d76dd3d6..75ca8f06fb9 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -46,12 +46,18 @@ jobs: make tool-bootstrap tool-transit mkdir boot-tools mv bootstrap transit boot-tools/ + sha256sum boot-tools/bootstrap > boot-tools/bootstrap.sha256sum + cat boot-tools/bootstrap.sha256sum + sha256sum boot-tools/transit > boot-tools/transit.sha256sum + cat boot-tools/transit.sha256sum tar -czf boot-tools.tar ./boot-tools/ gsutil cp boot-tools.tar gs://flow-genesis-bootstrap/tools/${{ inputs.tag }}/boot-tools.tar - name: Build and upload util run: | make tool-util - tar -czf util.tar util + sha256sum util > util.sha256sum + cat util.sha256sum + tar -czf util.tar util util.sha256sum gsutil cp util.tar gs://flow-genesis-bootstrap/tools/${{ inputs.tag }}/util.tar - name: Promote boot-tools run: | diff --git a/cmd/bootstrap/cmd/pull.go b/cmd/bootstrap/cmd/pull.go index fa595d15bd5..d2fd9abff26 100644 --- a/cmd/bootstrap/cmd/pull.go +++ b/cmd/bootstrap/cmd/pull.go @@ -1,21 +1,26 @@ package cmd import ( + "bytes" "context" "fmt" "path/filepath" "strings" + "sync" "time" "github.com/spf13/cobra" + "golang.org/x/sync/semaphore" "github.com/onflow/flow-go/cmd" "github.com/onflow/flow-go/cmd/bootstrap/gcs" + "github.com/onflow/flow-go/cmd/bootstrap/utils" ) var ( - flagNetwork string - flagBucketName string + flagNetwork string + flagBucketName string + flagConcurrency int64 ) // pullCmd represents a command to pull parnter node details from the google @@ -37,6 +42,7 @@ func addPullCmdFlags() { cmd.MarkFlagRequired(pullCmd, "network") pullCmd.Flags().StringVar(&flagBucketName, "bucket", "flow-genesis-bootstrap", "google bucket name") + pullCmd.Flags().Int64Var(&flagConcurrency, "concurrency", 2, "concurrency limit") } // pull partner node info from google bucket @@ -62,15 +68,35 @@ func pull(cmd *cobra.Command, args []string) { } log.Info().Msgf("found %d files in google bucket", len(files)) + sem := semaphore.NewWeighted(flagConcurrency) + wait := sync.WaitGroup{} for _, file := range files { - if strings.Contains(file, "node-info.pub") { - fullOutpath := filepath.Join(flagOutdir, file) - log.Printf("downloading %s", file) - - err = bucket.DownloadFile(ctx, client, fullOutpath, file) - if err != nil { - log.Error().Msgf("error trying download google bucket file: %v", err) + wait.Add(1) + go func(file gcs.GCSFile) { + _ = sem.Acquire(ctx, 1) + defer func() { + sem.Release(1) + wait.Done() + }() + + if strings.Contains(file.Name, "node-info.pub") { + fullOutpath := filepath.Join(flagOutdir, file.Name) + + fmd5 := utils.CalcMd5(fullOutpath) + // only skip files that have an MD5 hash + if file.MD5 != nil && bytes.Equal(fmd5, file.MD5) { + log.Printf("skipping %s", file) + return + } + + log.Printf("downloading %s", file) + err = bucket.DownloadFile(ctx, client, fullOutpath, file.Name) + if err != nil { + log.Error().Msgf("error trying download google bucket file: %v", err) + } } - } + }(file) } + + wait.Wait() } diff --git a/cmd/bootstrap/gcs/gcs.go b/cmd/bootstrap/gcs/gcs.go index f14952f13df..2b00a8c277c 100644 --- a/cmd/bootstrap/gcs/gcs.go +++ b/cmd/bootstrap/gcs/gcs.go @@ -33,14 +33,19 @@ func (g *googleBucket) NewClient(ctx context.Context) (*storage.Client, error) { return client, nil } +type GCSFile struct { + Name string + MD5 []byte +} + // GetFiles returns a list of file names within the Google bucket -func (g *googleBucket) GetFiles(ctx context.Context, client *storage.Client, prefix, delimiter string) ([]string, error) { +func (g *googleBucket) GetFiles(ctx context.Context, client *storage.Client, prefix, delimiter string) ([]GCSFile, error) { it := client.Bucket(g.Name).Objects(ctx, &storage.Query{ Prefix: prefix, Delimiter: delimiter, }) - var files []string + var files []GCSFile for { attrs, err := it.Next() if err == iterator.Done { @@ -50,7 +55,10 @@ func (g *googleBucket) GetFiles(ctx context.Context, client *storage.Client, pre return nil, err } - files = append(files, attrs.Name) + files = append(files, GCSFile{ + Name: attrs.Name, + MD5: attrs.MD5, + }) } return files, nil diff --git a/cmd/bootstrap/transit/cmd/flags.go b/cmd/bootstrap/transit/cmd/flags.go index c3733f63ea9..6c1c2f19978 100644 --- a/cmd/bootstrap/transit/cmd/flags.go +++ b/cmd/bootstrap/transit/cmd/flags.go @@ -9,6 +9,7 @@ var ( flagAccessAddress string flagNodeRole string flagTimeout time.Duration + flagConcurrency int64 flagWrapID string // wrap ID flagVoteFile string diff --git a/cmd/bootstrap/transit/cmd/pull.go b/cmd/bootstrap/transit/cmd/pull.go index 9a2517803f4..a3a0c35eae7 100644 --- a/cmd/bootstrap/transit/cmd/pull.go +++ b/cmd/bootstrap/transit/cmd/pull.go @@ -1,16 +1,20 @@ package cmd import ( + "bytes" "context" "fmt" "io/fs" "path/filepath" "strings" + "sync" "time" "github.com/spf13/cobra" + "golang.org/x/sync/semaphore" "github.com/onflow/flow-go/cmd/bootstrap/gcs" + "github.com/onflow/flow-go/cmd/bootstrap/utils" model "github.com/onflow/flow-go/model/bootstrap" "github.com/onflow/flow-go/model/flow" ) @@ -32,6 +36,7 @@ func addPullCmdFlags() { pullCmd.Flags().StringVarP(&flagToken, "token", "t", "", "token provided by the Flow team to access the Transit server") pullCmd.Flags().StringVarP(&flagNodeRole, "role", "r", "", `node role (can be "collection", "consensus", "execution", "verification" or "access")`) pullCmd.Flags().DurationVar(&flagTimeout, "timeout", time.Second*300, `timeout for pull`) + pullCmd.Flags().Int64Var(&flagConcurrency, "concurrency", 2, `concurrency limit for pull`) _ = pullCmd.MarkFlagRequired("token") _ = pullCmd.MarkFlagRequired("role") @@ -78,17 +83,34 @@ func pull(cmd *cobra.Command, args []string) { } log.Info().Msgf("found %d files in Google Bucket", len(files)) - // download found files + sem := semaphore.NewWeighted(flagConcurrency) + wait := sync.WaitGroup{} for _, file := range files { - fullOutpath := filepath.Join(flagBootDir, "public-root-information", filepath.Base(file)) - - log.Info().Str("source", file).Str("dest", fullOutpath).Msgf("downloading file from transit servers") - err = bucket.DownloadFile(ctx, client, fullOutpath, file) - if err != nil { - log.Fatal().Err(err).Msgf("could not download google bucket file") - } + wait.Add(1) + go func(file gcs.GCSFile) { + _ = sem.Acquire(ctx, 1) + defer func() { + sem.Release(1) + wait.Done() + }() + + fullOutpath := filepath.Join(flagBootDir, "public-root-information", filepath.Base(file.Name)) + fmd5 := utils.CalcMd5(fullOutpath) + // only skip files that have an MD5 hash + if file.MD5 != nil && bytes.Equal(fmd5, file.MD5) { + log.Info().Str("source", file.Name).Str("dest", fullOutpath).Msgf("skipping existing file from transit servers") + return + } + log.Info().Str("source", file.Name).Str("dest", fullOutpath).Msgf("downloading file from transit servers") + err = bucket.DownloadFile(ctx, client, fullOutpath, file.Name) + if err != nil { + log.Fatal().Err(err).Msgf("could not download google bucket file") + } + }(file) } + wait.Wait() + // download any extra files specific to node role extraFiles := getAdditionalFilesToDownload(role, nodeID) for _, file := range extraFiles { diff --git a/cmd/bootstrap/utils/md5.go b/cmd/bootstrap/utils/md5.go new file mode 100644 index 00000000000..3abe9c42948 --- /dev/null +++ b/cmd/bootstrap/utils/md5.go @@ -0,0 +1,25 @@ +package utils + +// The google storage API only provides md5 and crc32 hence overriding the linter flag for md5 +// #nosec +import ( + "crypto/md5" + "io" + "os" +) + +func CalcMd5(outpath string) []byte { + f, err := os.Open(outpath) + if err != nil { + return nil + } + defer f.Close() + + // #nosec + h := md5.New() + if _, err := io.Copy(h, f); err != nil { + return nil + } + + return h.Sum(nil) +} diff --git a/cmd/util/cmd/check-storage/cmd.go b/cmd/util/cmd/check-storage/cmd.go index 19cadb85694..5727d7a51d5 100644 --- a/cmd/util/cmd/check-storage/cmd.go +++ b/cmd/util/cmd/check-storage/cmd.go @@ -11,7 +11,6 @@ import ( "github.com/onflow/cadence/runtime" "github.com/onflow/cadence/runtime/common" - "github.com/onflow/flow-go/cmd/util/ledger/migrations" "github.com/onflow/flow-go/cmd/util/ledger/reporters" "github.com/onflow/flow-go/cmd/util/ledger/util" "github.com/onflow/flow-go/cmd/util/ledger/util/registers" @@ -282,6 +281,9 @@ func checkStorageHealth( err = registersByAccount.ForEachAccount( func(accountRegisters *registers.AccountRegisters) error { + if slices.Contains(acctsToSkip, accountRegisters.Owner()) { + return nil + } jobs <- job{accountRegisters: accountRegisters} return nil }) @@ -323,7 +325,7 @@ func checkAccountStorageHealth(accountRegisters *registers.AccountRegisters, nWo ledger := ®isters.ReadOnlyLedger{Registers: accountRegisters} storage := runtime.NewStorage(ledger, nil) - err = util.CheckStorageHealth(address, storage, accountRegisters, migrations.AllStorageMapDomains, nWorkers) + err = util.CheckStorageHealth(address, storage, accountRegisters, util.StorageMapDomains, nWorkers) if err != nil { issues = append( issues, diff --git a/cmd/util/cmd/debug-tx/cmd.go b/cmd/util/cmd/debug-tx/cmd.go new file mode 100644 index 00000000000..a7f955549e5 --- /dev/null +++ b/cmd/util/cmd/debug-tx/cmd.go @@ -0,0 +1,147 @@ +package debug_tx + +import ( + "context" + + "github.com/rs/zerolog/log" + "github.com/spf13/cobra" + + sdk "github.com/onflow/flow-go-sdk" + + "github.com/onflow/flow-go/model/flow" + "github.com/onflow/flow-go/module/grpcclient" + "github.com/onflow/flow-go/utils/debug" +) + +// use the following command to forward port 9000 from the EN to localhost:9001 +// `gcloud compute ssh '--ssh-flag=-A' --no-user-output-enabled --tunnel-through-iap migrationmainnet1-execution-001 --project flow-multi-region -- -NL 9001:localhost:9000` + +var ( + flagAccessAddress string + flagExecutionAddress string + flagChain string + flagTx string + flagComputeLimit uint64 + flagAtLatestBlock bool + flagProposalKeySeq uint64 +) + +var Cmd = &cobra.Command{ + Use: "debug-tx", + Short: "debug a transaction", + Run: run, +} + +func init() { + + Cmd.Flags().StringVar( + &flagChain, + "chain", + "", + "Chain name", + ) + _ = Cmd.MarkFlagRequired("chain") + + Cmd.Flags().StringVar(&flagAccessAddress, "access-address", "", "address of the access node") + _ = Cmd.MarkFlagRequired("access-address") + + Cmd.Flags().StringVar(&flagExecutionAddress, "execution-address", "", "address of the execution node") + _ = Cmd.MarkFlagRequired("execution-address") + + Cmd.Flags().StringVar(&flagTx, "tx", "", "transaction ID") + _ = Cmd.MarkFlagRequired("tx") + + Cmd.Flags().Uint64Var(&flagComputeLimit, "compute-limit", 9999, "transaction compute limit") + + Cmd.Flags().BoolVar(&flagAtLatestBlock, "at-latest-block", false, "run at latest block") + + Cmd.Flags().Uint64Var(&flagProposalKeySeq, "proposal-key-seq", 0, "proposal key sequence number") +} + +func run(*cobra.Command, []string) { + + chainID := flow.ChainID(flagChain) + chain := chainID.Chain() + + txID, err := flow.HexStringToIdentifier(flagTx) + if err != nil { + log.Fatal().Err(err).Msg("failed to parse transaction ID") + } + + config, err := grpcclient.NewFlowClientConfig(flagAccessAddress, "", flow.ZeroID, true) + if err != nil { + log.Fatal().Err(err).Msg("failed to create flow client config") + } + + flowClient, err := grpcclient.FlowClient(config) + if err != nil { + log.Fatal().Err(err).Msg("failed to create flow client") + } + + log.Info().Msg("Fetching transaction ...") + + tx, err := flowClient.GetTransaction(context.Background(), sdk.Identifier(txID)) + if err != nil { + log.Fatal().Err(err).Msg("failed to fetch transaction") + } + + log.Info().Msgf("Fetched transaction: %s", tx.ID()) + + log.Info().Msg("Fetching transaction result ...") + + txResult, err := flowClient.GetTransactionResult(context.Background(), sdk.Identifier(txID)) + if err != nil { + log.Fatal().Err(err).Msg("failed to fetch transaction result") + } + + log.Info().Msgf("Fetched transaction result: %s at block %s", txResult.Status, txResult.BlockID) + + log.Info().Msg("Debugging transaction ...") + + debugger := debug.NewRemoteDebugger( + flagExecutionAddress, + chain, + log.Logger, + ) + + txBody := flow.NewTransactionBody(). + SetScript(tx.Script). + SetComputeLimit(flagComputeLimit). + SetPayer(flow.Address(tx.Payer)) + + for _, argument := range tx.Arguments { + txBody.AddArgument(argument) + } + + for _, authorizer := range tx.Authorizers { + txBody.AddAuthorizer(flow.Address(authorizer)) + } + + proposalKeySequenceNumber := tx.ProposalKey.SequenceNumber + if flagProposalKeySeq != 0 { + proposalKeySequenceNumber = flagProposalKeySeq + } + + txBody.SetProposalKey( + flow.Address(tx.ProposalKey.Address), + tx.ProposalKey.KeyIndex, + proposalKeySequenceNumber, + ) + + var txErr, processErr error + if flagAtLatestBlock { + txErr, processErr = debugger.RunTransaction(txBody) + } else { + txErr, processErr = debugger.RunTransactionAtBlockID( + txBody, + flow.Identifier(txResult.BlockID), + "", + ) + } + if txErr != nil { + log.Fatal().Err(txErr).Msg("transaction error") + } + if processErr != nil { + log.Fatal().Err(processErr).Msg("process error") + } +} diff --git a/cmd/util/cmd/diff-states/cmd.go b/cmd/util/cmd/diff-states/cmd.go index 893ee5782f0..78160bab8f0 100644 --- a/cmd/util/cmd/diff-states/cmd.go +++ b/cmd/util/cmd/diff-states/cmd.go @@ -7,6 +7,7 @@ import ( "encoding/json" "errors" "fmt" + "slices" "github.com/dustin/go-humanize/english" "github.com/onflow/cadence/runtime/common" @@ -18,6 +19,7 @@ import ( "github.com/onflow/flow-go/cmd/util/ledger/reporters" "github.com/onflow/flow-go/cmd/util/ledger/util" "github.com/onflow/flow-go/cmd/util/ledger/util/registers" + "github.com/onflow/flow-go/fvm/systemcontracts" "github.com/onflow/flow-go/ledger" "github.com/onflow/flow-go/model/flow" moduleUtil "github.com/onflow/flow-go/module/util" @@ -189,6 +191,18 @@ func run(*cobra.Command, []string) { ) } + var acctsToSkipForCadenceValueDiff []string + + // Skip EVM storage account when diffing Cadence values. + if mode == modeValues { + systemContracts := systemcontracts.SystemContractsForChain(chainID) + + acctsToSkipForCadenceValueDiff = append( + acctsToSkipForCadenceValueDiff, + flow.AddressToRegisterOwner(systemContracts.EVMStorage.Address), + ) + } + rw := reporters.NewReportFileWriterFactoryWithFormat(flagOutputDirectory, log.Logger, reporters.ReportFormatJSONL). ReportWriter(ReporterName) defer rw.Close() @@ -222,7 +236,7 @@ func run(*cobra.Command, []string) { } } - err := diff(registers1, registers2, chainID, rw, flagNWorker, mode) + err := diff(registers1, registers2, chainID, rw, flagNWorker, mode, acctsToSkipForCadenceValueDiff) if err != nil { log.Warn().Err(err).Msgf("failed to diff registers") } @@ -321,6 +335,7 @@ func diffAccount( chainID flow.ChainID, rw reporters.ReportWriter, mode mode, + acctsToSkip []string, ) (err error) { if accountRegisters1.Count() != accountRegisters2.Count() { @@ -375,7 +390,7 @@ func diffAccount( } } - if diffValues { + if diffValues && !slices.Contains(acctsToSkip, owner) { address, err := common.BytesToAddress([]byte(owner)) if err != nil { return err @@ -390,7 +405,7 @@ func diffAccount( ).DiffStates( accountRegisters1, accountRegisters2, - migrations.AllStorageMapDomains, + util.StorageMapDomains, ) } @@ -404,6 +419,7 @@ func diff( rw reporters.ReportWriter, nWorkers int, mode mode, + acctsToSkip []string, ) error { log.Info().Msgf("Diffing %d accounts", registers1.AccountCount()) @@ -445,6 +461,7 @@ func diff( chainID, rw, mode, + acctsToSkip, ) if err != nil { log.Warn().Err(err).Msgf("failed to diff account %x", []byte(owner)) @@ -499,6 +516,7 @@ func diff( chainID, rw, mode, + acctsToSkip, ) select { diff --git a/cmd/util/cmd/root.go b/cmd/util/cmd/root.go index 12e50909d2c..c4464fba648 100644 --- a/cmd/util/cmd/root.go +++ b/cmd/util/cmd/root.go @@ -17,6 +17,7 @@ import ( checkpoint_collect_stats "github.com/onflow/flow-go/cmd/util/cmd/checkpoint-collect-stats" checkpoint_list_tries "github.com/onflow/flow-go/cmd/util/cmd/checkpoint-list-tries" checkpoint_trie_stats "github.com/onflow/flow-go/cmd/util/cmd/checkpoint-trie-stats" + debug_tx "github.com/onflow/flow-go/cmd/util/cmd/debug-tx" diff_states "github.com/onflow/flow-go/cmd/util/cmd/diff-states" epochs "github.com/onflow/flow-go/cmd/util/cmd/epochs/cmd" export "github.com/onflow/flow-go/cmd/util/cmd/exec-data-json-export" @@ -118,6 +119,7 @@ func addCommands() { rootCmd.AddCommand(run_script.Cmd) rootCmd.AddCommand(system_addresses.Cmd) rootCmd.AddCommand(check_storage.Cmd) + rootCmd.AddCommand(debug_tx.Cmd) } func initConfig() { diff --git a/cmd/util/ledger/util/util.go b/cmd/util/ledger/util/util.go index a3d2073d597..148aae93432 100644 --- a/cmd/util/ledger/util/util.go +++ b/cmd/util/ledger/util/util.go @@ -9,7 +9,9 @@ import ( "strings" "github.com/onflow/atree" + "github.com/onflow/cadence/runtime" "github.com/onflow/cadence/runtime/common" + "github.com/onflow/cadence/runtime/stdlib" "github.com/onflow/flow-go/fvm/environment" "github.com/onflow/flow-go/ledger" @@ -245,3 +247,15 @@ func (p *PayloadsLedger) AllocateSlabIndex(owner []byte) (atree.SlabIndex, error panic("AllocateSlabIndex not expected to be called") } + +var StorageMapDomains = []string{ + common.PathDomainStorage.Identifier(), + common.PathDomainPrivate.Identifier(), + common.PathDomainPublic.Identifier(), + runtime.StorageDomainContract, + stdlib.InboxStorageDomain, + stdlib.CapabilityControllerStorageDomain, + stdlib.CapabilityControllerTagStorageDomain, + stdlib.PathCapabilityStorageDomain, + stdlib.AccountCapabilityStorageDomain, +} diff --git a/go.mod b/go.mod index a8cd063a984..54c7f970c47 100644 --- a/go.mod +++ b/go.mod @@ -34,7 +34,7 @@ require ( github.com/ipfs/go-cid v0.4.1 github.com/ipfs/go-datastore v0.6.0 github.com/ipfs/go-ds-badger2 v0.1.3 - github.com/ipfs/go-ds-pebble v0.3.1 + github.com/ipfs/go-ds-pebble v0.3.1-0.20240828032824-d745b9d3200b github.com/ipfs/go-ipld-format v0.6.0 github.com/ipfs/go-log v1.0.5 github.com/ipfs/go-log/v2 v2.5.1 @@ -331,6 +331,3 @@ require ( // Using custom fork until https://github.com/onflow/flow-go/issues/5338 is resolved replace github.com/ipfs/boxo => github.com/onflow/boxo v0.0.0-20240201202436-f2477b92f483 - -// TODO: remove it when https://github.com/ipfs/go-ds-pebble/pull/36 merged -replace github.com/ipfs/go-ds-pebble v0.3.1 => github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c diff --git a/go.sum b/go.sum index 066bd2b82f3..1463899bfe0 100644 --- a/go.sum +++ b/go.sum @@ -1810,6 +1810,8 @@ github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= github.com/ipfs/go-ds-badger2 v0.1.3 h1:Zo9JicXJ1DmXTN4KOw7oPXkspZ0AWHcAFCP1tQKnegg= github.com/ipfs/go-ds-badger2 v0.1.3/go.mod h1:TPhhljfrgewjbtuL/tczP8dNrBYwwk+SdPYbms/NO9w= +github.com/ipfs/go-ds-pebble v0.3.1-0.20240828032824-d745b9d3200b h1:lby3w+96HfyjiFP4ODbcfr4j7pNza7g3XQywnNu+9Mc= +github.com/ipfs/go-ds-pebble v0.3.1-0.20240828032824-d745b9d3200b/go.mod h1:q8icEwk8lSpbPAsa7l9SPm6yt9Z+c4QePFyfKHYmdJw= github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ= github.com/ipfs/go-ipfs-blocksutil v0.0.1/go.mod h1:Yq4M86uIOmxmGPUHv/uI7uKqZNtLb449gwKqXjIsnRk= github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= @@ -2193,8 +2195,6 @@ github.com/onflow/flow-nft/lib/go/templates v1.2.0/go.mod h1:p+2hRvtjLUR3MW1NsoJ github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231121210617-52ee94b830c2/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/onflow/flow/protobuf/go/flow v0.4.5 h1:6o+pgYGqwXdEhqSJxu2BdnDXkOQVOkfGAb6IiXB+NPM= github.com/onflow/flow/protobuf/go/flow v0.4.5/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= -github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c h1:T0jDCm7k7uqDo26JiiujQ5oryl30itPnlmZQywTu9ng= -github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c/go.mod h1:XYnWtulwJvHVOr2B0WVA/UC3dvRgFevjp8Pn9a3E1xo= github.com/onflow/go-ethereum v1.14.7 h1:gg3awYqI02e3AypRdpJKEvNTJ6kz/OhAqRti0h54Wlc= github.com/onflow/go-ethereum v1.14.7/go.mod h1:zV14QLrXyYu5ucvcwHUA0r6UaqveqbXaehAVQJlSW+I= github.com/onflow/nft-storefront/lib/go/contracts v1.0.0 h1:sxyWLqGm/p4EKT6DUlQESDG1ZNMN9GjPCm1gTq7NGfc= diff --git a/insecure/go.mod b/insecure/go.mod index 88a650aa346..cb75a3ad34e 100644 --- a/insecure/go.mod +++ b/insecure/go.mod @@ -140,7 +140,7 @@ require ( github.com/ipfs/go-cid v0.4.1 // indirect github.com/ipfs/go-cidutil v0.1.0 // indirect github.com/ipfs/go-ds-badger2 v0.1.3 // indirect - github.com/ipfs/go-ds-pebble v0.3.1 // indirect + github.com/ipfs/go-ds-pebble v0.3.1-0.20240828032824-d745b9d3200b // indirect github.com/ipfs/go-ipfs-delay v0.0.1 // indirect github.com/ipfs/go-ipfs-pq v0.0.3 // indirect github.com/ipfs/go-ipfs-util v0.0.3 // indirect @@ -309,6 +309,3 @@ require ( ) replace github.com/onflow/flow-go => ../ - -// TODO: remove it when https://github.com/ipfs/go-ds-pebble/pull/36 merged -replace github.com/ipfs/go-ds-pebble v0.3.1 => github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c diff --git a/insecure/go.sum b/insecure/go.sum index 16ed598441d..067f5159e23 100644 --- a/insecure/go.sum +++ b/insecure/go.sum @@ -1805,6 +1805,8 @@ github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= github.com/ipfs/go-ds-badger2 v0.1.3 h1:Zo9JicXJ1DmXTN4KOw7oPXkspZ0AWHcAFCP1tQKnegg= github.com/ipfs/go-ds-badger2 v0.1.3/go.mod h1:TPhhljfrgewjbtuL/tczP8dNrBYwwk+SdPYbms/NO9w= +github.com/ipfs/go-ds-pebble v0.3.1-0.20240828032824-d745b9d3200b h1:lby3w+96HfyjiFP4ODbcfr4j7pNza7g3XQywnNu+9Mc= +github.com/ipfs/go-ds-pebble v0.3.1-0.20240828032824-d745b9d3200b/go.mod h1:q8icEwk8lSpbPAsa7l9SPm6yt9Z+c4QePFyfKHYmdJw= github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ= github.com/ipfs/go-ipfs-blocksutil v0.0.1/go.mod h1:Yq4M86uIOmxmGPUHv/uI7uKqZNtLb449gwKqXjIsnRk= github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= @@ -2181,8 +2183,6 @@ github.com/onflow/flow-nft/lib/go/templates v1.2.0/go.mod h1:p+2hRvtjLUR3MW1NsoJ github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231121210617-52ee94b830c2/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/onflow/flow/protobuf/go/flow v0.4.5 h1:6o+pgYGqwXdEhqSJxu2BdnDXkOQVOkfGAb6IiXB+NPM= github.com/onflow/flow/protobuf/go/flow v0.4.5/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= -github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c h1:T0jDCm7k7uqDo26JiiujQ5oryl30itPnlmZQywTu9ng= -github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c/go.mod h1:XYnWtulwJvHVOr2B0WVA/UC3dvRgFevjp8Pn9a3E1xo= github.com/onflow/go-ethereum v1.14.7 h1:gg3awYqI02e3AypRdpJKEvNTJ6kz/OhAqRti0h54Wlc= github.com/onflow/go-ethereum v1.14.7/go.mod h1:zV14QLrXyYu5ucvcwHUA0r6UaqveqbXaehAVQJlSW+I= github.com/onflow/sdks v0.5.1-0.20230912225508-b35402f12bba/go.mod h1:F0dj0EyHC55kknLkeD10js4mo14yTdMotnWMslPirrU= diff --git a/integration/go.mod b/integration/go.mod index b9f0c568099..aa6adb32673 100644 --- a/integration/go.mod +++ b/integration/go.mod @@ -18,7 +18,7 @@ require ( github.com/ipfs/go-cid v0.4.1 github.com/ipfs/go-datastore v0.6.0 github.com/ipfs/go-ds-badger2 v0.1.3 - github.com/ipfs/go-ds-pebble v0.3.1 + github.com/ipfs/go-ds-pebble v0.3.1-0.20240828032824-d745b9d3200b github.com/libp2p/go-libp2p v0.32.2 github.com/onflow/cadence v1.0.0-preview.50 github.com/onflow/crypto v0.25.2 @@ -362,6 +362,3 @@ replace github.com/onflow/flow-go/insecure => ../insecure // TODO: remove it when https://github.com/onflow/flow-emulator/pull/724 merged replace github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f => github.com/AndriiDiachuk/flow-emulator v0.0.0-20240827100955-2a6194eee077 - -// TODO: remove it when https://github.com/ipfs/go-ds-pebble/pull/36 merged -replace github.com/ipfs/go-ds-pebble v0.3.1 => github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c diff --git a/integration/go.sum b/integration/go.sum index 32a39899030..00b02accdbf 100644 --- a/integration/go.sum +++ b/integration/go.sum @@ -1797,6 +1797,8 @@ github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= github.com/ipfs/go-ds-badger2 v0.1.3 h1:Zo9JicXJ1DmXTN4KOw7oPXkspZ0AWHcAFCP1tQKnegg= github.com/ipfs/go-ds-badger2 v0.1.3/go.mod h1:TPhhljfrgewjbtuL/tczP8dNrBYwwk+SdPYbms/NO9w= +github.com/ipfs/go-ds-pebble v0.3.1-0.20240828032824-d745b9d3200b h1:lby3w+96HfyjiFP4ODbcfr4j7pNza7g3XQywnNu+9Mc= +github.com/ipfs/go-ds-pebble v0.3.1-0.20240828032824-d745b9d3200b/go.mod h1:q8icEwk8lSpbPAsa7l9SPm6yt9Z+c4QePFyfKHYmdJw= github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ= github.com/ipfs/go-ipfs-blocksutil v0.0.1/go.mod h1:Yq4M86uIOmxmGPUHv/uI7uKqZNtLb449gwKqXjIsnRk= github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= @@ -2167,8 +2169,6 @@ github.com/onflow/flow-nft/lib/go/templates v1.2.0/go.mod h1:p+2hRvtjLUR3MW1NsoJ github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231121210617-52ee94b830c2/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/onflow/flow/protobuf/go/flow v0.4.5 h1:6o+pgYGqwXdEhqSJxu2BdnDXkOQVOkfGAb6IiXB+NPM= github.com/onflow/flow/protobuf/go/flow v0.4.5/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= -github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c h1:T0jDCm7k7uqDo26JiiujQ5oryl30itPnlmZQywTu9ng= -github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c/go.mod h1:XYnWtulwJvHVOr2B0WVA/UC3dvRgFevjp8Pn9a3E1xo= github.com/onflow/go-ethereum v1.14.7 h1:gg3awYqI02e3AypRdpJKEvNTJ6kz/OhAqRti0h54Wlc= github.com/onflow/go-ethereum v1.14.7/go.mod h1:zV14QLrXyYu5ucvcwHUA0r6UaqveqbXaehAVQJlSW+I= github.com/onflow/sdks v0.5.1-0.20230912225508-b35402f12bba/go.mod h1:F0dj0EyHC55kknLkeD10js4mo14yTdMotnWMslPirrU= diff --git a/utils/debug/remoteDebugger.go b/utils/debug/remoteDebugger.go index 86c8292588a..bb088d3b2fd 100644 --- a/utils/debug/remoteDebugger.go +++ b/utils/debug/remoteDebugger.go @@ -16,9 +16,12 @@ type RemoteDebugger struct { // Warning : make sure you use the proper flow-go version, same version as the network you are collecting registers // from, otherwise the execution might differ from the way runs on the network -func NewRemoteDebugger(grpcAddress string, +func NewRemoteDebugger( + grpcAddress string, chain flow.Chain, - logger zerolog.Logger) *RemoteDebugger { + logger zerolog.Logger, +) *RemoteDebugger { + vm := fvm.NewVirtualMachine() // no signature processor here @@ -57,7 +60,7 @@ func (d *RemoteDebugger) RunTransaction( return output.Err, nil } -// RunTransaction runs the transaction and tries to collect the registers at +// RunTransactionAtBlockID runs the transaction and tries to collect the registers at // the given blockID note that it would be very likely that block is far in the // past and you can't find the trie to read the registers from. // if regCachePath is empty, the register values won't be cached