Skip to content

Commit

Permalink
bump firehose-core to v1.2.1 (#122)
Browse files Browse the repository at this point in the history
* bump firehose-core to v1.2.1

* fix sanitizeBlockForCompare, remove block poller

* run go mod tidy
  • Loading branch information
fschoell authored Feb 19, 2024
1 parent 73f25e6 commit 6dbc9f8
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 305 deletions.
123 changes: 0 additions & 123 deletions blockfetcher/rpc.go

This file was deleted.

29 changes: 0 additions & 29 deletions blockfetcher/silkworm.go

This file was deleted.

22 changes: 0 additions & 22 deletions cmd/fireantelope/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,6 @@ func Chain() *firecore.Chain[*pbantelope.Block] {

BlockFactory: func() firecore.Block { return new(pbantelope.Block) },

//BlockIndexerFactories: map[string]firecore.BlockIndexerFactory[*pbantelope.Block]{
// transform.ReceiptAddressIndexShortName: transform.NewNearBlockIndexer,
//},
//
//BlockTransformerFactories: map[protoreflect.FullName]firecore.BlockTransformerFactory{
// transform.HeaderOnlyMessageName: transform.NewHeaderOnlyTransformFactory,
// transform.ReceiptFilterMessageName: transform.BasicReceiptFilterFactory,
//},

ConsoleReaderFactory: codec.NewConsoleReader,

RegisterExtraStartFlags: func(flags *pflag.FlagSet) {
Expand All @@ -51,28 +42,15 @@ func Chain() *firecore.Chain[*pbantelope.Block] {
flags.Bool("reader-node-overwrite-node-files", false, "Force download of node-key and config files even if they already exist on the machine.")
},

// ReaderNodeBootstrapperFactory: newReaderNodeBootstrapper,

Tools: &firecore.ToolsConfig[*pbantelope.Block]{

RegisterExtraCmd: func(chain *firecore.Chain[*pbantelope.Block], parent *cobra.Command, zlog *zap.Logger, tracer logging.Tracer) error {
//toolsCmd.AddCommand(newToolsGenerateNodeKeyCmd(chain))
//toolsCmd.AddCommand(newToolsBackfillCmd(zlog))
parent.AddCommand(newPollerCmd(zlog, tracer))
parent.AddCommand(newSilkwormPollerCmd(zlog, tracer))
parent.AddCommand(newCheckBlocksCmd(zlog))

return nil
},

SanitizeBlockForCompare: sanitizeBlockForCompare,

//TransformFlags: map[string]*firecore.TransformFlag{
// "receipt-account-filters": {
// Description: "Comma-separated accounts to use as filter/index. If it contains a colon (:), it will be interpreted as <prefix>:<suffix> (each of which can be empty, ex: 'hello:' or ':world')",
// Parser: parseReceiptAccountFilters,
// },
//},
},
}

Expand Down
85 changes: 0 additions & 85 deletions cmd/fireantelope/poller.go

This file was deleted.

21 changes: 17 additions & 4 deletions cmd/fireantelope/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package main
import (
"fmt"
pbantelope "github.com/pinax-network/firehose-antelope/types/pb/sf/antelope/type/v1"
pbbstream "github.com/streamingfast/bstream/pb/sf/bstream/v1"
firecore "github.com/streamingfast/firehose-core"
"google.golang.org/protobuf/types/known/timestamppb"
"strconv"
"time"
Expand All @@ -19,7 +21,13 @@ func mustParseUint64(in string) uint64 {
return out
}

func sanitizeBlockForCompare(block *pbantelope.Block) *pbantelope.Block {
func sanitizeBlockForCompare(block *pbbstream.Block) *pbbstream.Block {

var antelopeBlock pbantelope.Block
err := block.Payload.UnmarshalTo(&antelopeBlock)
if err != nil {
panic(fmt.Errorf("unable to unmarshal block payload into Antelope block: %w", err))
}

var sanitizeContext func(logContext *pbantelope.Exception_LogContext)
sanitizeContext = func(logContext *pbantelope.Exception_LogContext) {
Expand Down Expand Up @@ -50,11 +58,11 @@ func sanitizeBlockForCompare(block *pbantelope.Block) *pbantelope.Block {
}
}

for _, rlimitOp := range block.RlimitOps {
for _, rlimitOp := range antelopeBlock.RlimitOps {
sanitizeRLimitOp(rlimitOp)
}

for _, trxTrace := range block.UnfilteredTransactionTraces {
for _, trxTrace := range antelopeBlock.UnfilteredTransactionTraces {
trxTrace.Elapsed = 888
sanitizeException(trxTrace.Exception)

Expand Down Expand Up @@ -87,5 +95,10 @@ func sanitizeBlockForCompare(block *pbantelope.Block) *pbantelope.Block {
}
}

return block
res, err := firecore.EncodeBlock(&antelopeBlock)
if err != nil {
panic(fmt.Errorf("failed to encode Antelope block: %w", err))
}

return res
}
Loading

0 comments on commit 6dbc9f8

Please sign in to comment.