diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e71f98a..6b7672f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,18 +13,18 @@ for instructions to keep up to date. > 2. New Poller: firesol no longer gets blocks from a Bigtable instance: it fetches the blocks using RPC calls > - Run `firecore start reader` with `--reader-node-path=/path/to/firesol` and `--reader-node-arguments=fetch rpc ` > 3. New Block Format requires either fetching all the merged blocks again or converting them -> - Convert old blocks by running: `ACCEPT_SOLANA_LEGACY_BLOCK_FORMAT=true firesol block upgrade-merged-blocks ` +> - Convert old blocks by running: `ACCEPT_SOLANA_LEGACY_BLOCK_FORMAT=true firesol upgrade-merged-blocks ` > 4. Upgrading your deployment will require a "stop the world" upgrade, where you start the new binaries, pointing to the new blocks, without any contact with the previous blocks or components. ## Removed * All the `firesol start ...` commands have been removed. Use [firecore binary](https://github.com/streamingfast/firehose-core) to run the reader, merger, relayer, firehose and substreams services -* Most of the `firesol tools` commands +* All the existing `firesol tools` commands ## Added * Added `fetch rpc ` command fetches and prints the blocks in protobuf format, to be used by the `firecore start reader` command. -* Added `block upgrade-merged-blocks` command to perform the upgrade on previous solana merged-blocks. +* Added `upgrade-merged-blocks` command to perform the upgrade on previous solana merged-blocks. * Bumped firecore version to v1.2.0 ## Fixed diff --git a/cmd/bt/main.go b/cmd/bt/main.go deleted file mode 100644 index 949119b0..00000000 --- a/cmd/bt/main.go +++ /dev/null @@ -1,98 +0,0 @@ -package main - -import ( - "bytes" - "context" - "fmt" - "log" - - "cloud.google.com/go/bigtable" - googleBigtable "cloud.google.com/go/bigtable" - "github.com/mr-tron/base58" - "github.com/streamingfast/firehose-solana/block/fetcher" - "github.com/streamingfast/logging" - "go.uber.org/zap" -) - -func main() { - ctx := context.Background() - client, err := googleBigtable.NewClient(ctx, "mainnet-beta", "solana-ledger") - if err != nil { - panic(err) - } - - var logger, tracer = logging.PackageLogger("foo", "main") - logging.InstantiateLoggers(logging.WithDefaultLevel(zap.DebugLevel)) - - blockReader := fetcher.NewBigtableReader(client, 10, logger, tracer) - - table := client.Open("blocks") - btRange := bigtable.NewRange(fmt.Sprintf("%016x", 140_000_000), "") - - err = table.ReadRows(ctx, btRange, func(row bigtable.Row) bool { - block, _, err := blockReader.ProcessRow(row) - if err != nil { - panic(err) - } - - //4xiPVLxJgpct8RKpVCV91x9aLYkfTwBayBw2JMFqw166a5atZgjSzYaSKqHVGpzGDLSgYYGdxdXeXFJkQCz6V7f5 - signatureBytes, err := base58.Decode("4sKtga1XVH6Q1g9JEXYwoTD8h9QU4DswKqsxu8JvPH2aMQT9ipKi6WCyYatH9DYRgMf6RCi8ZDPAmg1w1ZT1hJEs") - if err != nil { - fmt.Errorf("base58.Decode: %w", err) - } - - for _, transaction := range block.Transactions { - if bytes.Equal(transaction.Transaction.Signatures[0], signatureBytes) { - fmt.Println("found") - for _, balance := range transaction.Meta.PostTokenBalances { - fmt.Println("Balance data :", balance) - } - } - } - - return false - }) - - if err != nil { - log.Fatalf("Could not read rows: %v", err) - } - - //var logger, tracer = logging.PackageLogger("foo", "main") - //logging.InstantiateLoggers(logging.WithDefaultLevel(zap.DebugLevel)) - // - //blockReader := fetcher.NewBigtableReader(client, 10, logger, tracer) - // - //table := client.Open("blocks") - //btRange := bigtable.NewRange(fmt.Sprintf("%016x", 11690699), "") - // - //err = table.ReadRows(ctx, btRange, func(row bigtable.Row) bool { - // block, _, err := blockReader.ProcessRow(row) - // if err != nil { - // panic(err) - // } - // - // //4xiPVLxJgpct8RKpVCV91x9aLYkfTwBayBw2JMFqw166a5atZgjSzYaSKqHVGpzGDLSgYYGdxdXeXFJkQCz6V7f5 - // trxSign := "4xiPVLxJgpct8RKpVCV91x9aLYkfTwBayBw2JMFqw166a5atZgjSzYaSKqHVGpzGDLSgYYGdxdXeXFJkQCz6V7f5" - // signatureBytes, err := base58.Decode(trxSign) - // if err != nil { - // fmt.Errorf("base58.Decode: %w", err) - // } - // - // for _, transaction := range block.Transactions { - // if bytes.Equal(transaction.Transaction.Signatures[0], signatureBytes) { - // fmt.Println("found:", trxSign) - // } - // if transaction.Meta.Err != nil { - // err := transaction.Meta.Err - // sign := base58.Encode(transaction.Transaction.Signatures[0]) - // fmt.Println("err: ", sign, err.Err) - // } - // } - // - // return false - //}) - // - //if err != nil { - // panic(err) - //} -} diff --git a/cmd/firesol/main.go b/cmd/firesol/main.go index 84360658..e4a6b872 100644 --- a/cmd/firesol/main.go +++ b/cmd/firesol/main.go @@ -6,12 +6,8 @@ import ( "time" "github.com/spf13/cobra" - firecore "github.com/streamingfast/firehose-core" "github.com/streamingfast/firehose-core/cmd/tools" - "github.com/streamingfast/firehose-core/cmd/tools/compare" - "github.com/streamingfast/firehose-solana/cmd/firesol/block" "github.com/streamingfast/firehose-solana/cmd/firesol/rpc" - pbsol "github.com/streamingfast/firehose-solana/pb/sf/solana/type/v1" "github.com/streamingfast/logging" "go.uber.org/zap" ) @@ -25,13 +21,9 @@ var rootCmd = &cobra.Command{ func init() { logging.InstantiateLoggers(logging.WithDefaultLevel(zap.InfoLevel)) rootCmd.AddCommand(newFetchCmd(logger, tracer)) - chain := &firecore.Chain[*pbsol.Block]{ - BlockFactory: func() firecore.Block { return new(pbsol.Block) }, - } rootCmd.AddCommand(tools.ToolsCmd) - rootCmd.AddCommand(block.NewBlockCmd(logger, tracer)) - tools.ToolsCmd.AddCommand(compare.NewToolsCompareBlocksCmd(chain)) + tools.ToolsCmd.AddCommand(NewUpgradeCmd(logger, tracer)) } func main() { diff --git a/cmd/firesol/block/upgrader.go b/cmd/firesol/upgrader.go similarity index 86% rename from cmd/firesol/block/upgrader.go rename to cmd/firesol/upgrader.go index 0158656d..913dadd9 100644 --- a/cmd/firesol/block/upgrader.go +++ b/cmd/firesol/upgrader.go @@ -1,4 +1,4 @@ -package block +package main import ( "context" @@ -18,18 +18,7 @@ import ( "golang.org/x/exp/slices" ) -func NewBlockCmd(logger *zap.Logger, tracer logging.Tracer) *cobra.Command { - cmd := &cobra.Command{ - Use: "block ", - Short: "upgrade-merged-blocks from legacy to new format using anypb.Any as payload", - } - - cmd.AddCommand(NewFetchCmd(logger, tracer)) - - return cmd -} - -func NewFetchCmd(logger *zap.Logger, tracer logging.Tracer) *cobra.Command { +func NewUpgradeCmd(logger *zap.Logger, tracer logging.Tracer) *cobra.Command { cmd := &cobra.Command{ Use: "upgrade-merged-blocks ", Short: "upgrade-merged-blocks from legacy to new format using anypb.Any as payload",