Skip to content

Commit

Permalink
update fireinjective
Browse files Browse the repository at this point in the history
  • Loading branch information
Eduard-Voiculescu committed Aug 14, 2024
1 parent 71d899a commit 91c7f2d
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 991 deletions.
6 changes: 3 additions & 3 deletions injective/cmd/extract-from-chain-storage/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
txindexkv "github.com/cometbft/cometbft/state/txindex/kv"
"github.com/cometbft/cometbft/store"
"github.com/streamingfast/dstore"
"github.com/streamingfast/firehose-cosmos/injective"
v03810 "github.com/streamingfast/firehose-cosmos/cometbft/03810"
"github.com/streamingfast/logging"
"go.uber.org/zap"
)
Expand Down Expand Up @@ -67,8 +67,8 @@ func Main() error {
}
txIndexStore := txindexkv.NewTxIndex(txIndexDB)

loader := injective.NewLoader(blockStore, stateStore, txIndexStore, logger)
merger := injective.NewSimpleMerger(loader, logger)
loader := v03810.NewLoader(blockStore, stateStore, txIndexStore, logger)
merger := v03810.NewSimpleMerger(loader, logger)

err = merger.GenerateMergeBlock(int64(startBlock), int64(endBlock), destStore)
if err != nil {
Expand Down
89 changes: 0 additions & 89 deletions injective/cmd/fireinjective/fetcher.go

This file was deleted.

20 changes: 6 additions & 14 deletions injective/cmd/fireinjective/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@ import (
"os"

"github.com/spf13/cobra"
v03810 "github.com/streamingfast/firehose-cosmos/cometbft/03810"
"github.com/streamingfast/logging"
"go.uber.org/zap"
)

var logger, tracer = logging.PackageLogger("firecosmos", "github.com/streamingfast/firehose-cosmos")
var rootCmd = &cobra.Command{
Use: "firecosmos",
Short: "firecosmos fetching and tooling",
Use: "fireinjective",
Short: "Fireinjective block fetching and tooling",
Args: cobra.ExactArgs(1),
}

func init() {
logging.InstantiateLoggers(logging.WithDefaultLevel(zap.InfoLevel))

rootCmd.AddCommand(newInjectiveCmd(logger, tracer))
rootCmd.AddCommand(newFetchCmd(logger, tracer))
rootCmd.AddCommand(NewToolsFixUnknownTypeBlocks(logger, tracer))
}

Expand All @@ -30,21 +31,12 @@ func main() {
}
}

func newInjectiveCmd(logger *zap.Logger, tracer logging.Tracer) *cobra.Command {
cmd := &cobra.Command{
Use: "injective",
Short: "firecosmos for injective chain",
}
cmd.AddCommand(newFetchCmd(logger, tracer, "injective"))
return cmd
}

func newFetchCmd(logger *zap.Logger, tracer logging.Tracer, cosmosChain string) *cobra.Command {
func newFetchCmd(logger *zap.Logger, tracer logging.Tracer) *cobra.Command {
cmd := &cobra.Command{
Use: "fetch",
Short: "fetch blocks from different sources",
Args: cobra.ExactArgs(2),
}
cmd.AddCommand(NewFetchCmd(logger, tracer, cosmosChain))
cmd.AddCommand(v03810.NewFetchCmd(logger, tracer))
return cmd
}
8 changes: 4 additions & 4 deletions injective/cmd/fireinjective/tools_fix_unknown_type_blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"github.com/streamingfast/cli"
"github.com/streamingfast/dstore"
firecore "github.com/streamingfast/firehose-core"
v03810 "github.com/streamingfast/firehose-cosmos/cometbft/03810"
pbcosmos "github.com/streamingfast/firehose-cosmos/cosmos/pb/sf/cosmos/type/v2"
"github.com/streamingfast/firehose-cosmos/injective"
"github.com/streamingfast/logging"
"go.uber.org/zap"
"google.golang.org/protobuf/types/known/anypb"
Expand All @@ -24,9 +24,9 @@ import (
func NewToolsFixUnknownTypeBlocks(logger *zap.Logger, tracer logging.Tracer) *cobra.Command {
cmd := &cobra.Command{
Use: "fix-unknown-type-blocks <first-streamable-block> <stop-block> <src-blocks-store> <dst-blocks-store>",
Short: "injective firecosmos tool to fix unknown type blocks",
Short: "firecosmos tool to fix unknown type blocks",
Long: cli.Dedent(`
Injective firecosmos tool to fix unknown type blocks. This tool will read blocks from a source
Firecosmos tool to fix unknown type blocks. This tool will read blocks from a source
and write the fixed block to a destination.
`),
Args: cobra.ExactArgs(4),
Expand Down Expand Up @@ -105,7 +105,7 @@ func fixUnknownTypeBlocksRunE(zlog *zap.Logger, tracer logging.Tracer) firecore.
blockCount++

injectiveBlock := &pbcosmos.Block{}
err = injective.UnmarshallerDiscardUnknown.Unmarshal(currentBlock.Payload.Value, injectiveBlock)
err = v03810.UnmarshallerDiscardUnknown.Unmarshal(currentBlock.Payload.Value, injectiveBlock)
if err != nil {
return fmt.Errorf("unmarshaling block: %w", err)
}
Expand Down
57 changes: 0 additions & 57 deletions injective/conversion.go

This file was deleted.

Loading

0 comments on commit 91c7f2d

Please sign in to comment.