Skip to content

Commit

Permalink
upgrade to firehose-core v1.0.0 (#107)
Browse files Browse the repository at this point in the history
* start work upgrading to firehose-core v1

* fix testing types

* remove tools

* fix test build

* cleanup

* cleanup

* cleanup
  • Loading branch information
fschoell authored Dec 14, 2023
1 parent e5800f8 commit 1647451
Show file tree
Hide file tree
Showing 38 changed files with 203 additions and 3,391 deletions.
31 changes: 15 additions & 16 deletions cmd/fireantelope/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,29 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/pflag"
firecore "github.com/streamingfast/firehose-core"
fhCmd "github.com/streamingfast/firehose-core/cmd"
"github.com/streamingfast/logging"
"github.com/streamingfast/node-manager/mindreader"
pbbstream "github.com/streamingfast/pbgo/sf/bstream/v1"
"go.uber.org/zap"
)

func init() {
firecore.UnsafePayloadKind = pbbstream.Protocol_EOS
func main() {
fhCmd.Main(Chain())
}

func main() {
firecore.Main(&firecore.Chain[*pbantelope.Block]{
var chain *firecore.Chain[*pbantelope.Block]

func Chain() *firecore.Chain[*pbantelope.Block] {
if chain != nil {
return chain
}

chain = &firecore.Chain[*pbantelope.Block]{
ShortName: "antelope",
LongName: "Antelope",
ExecutableName: "nodeos",
FullyQualifiedModule: "github.com/pinax-network/firehose-antelope",
Version: version,

Protocol: "EOS",
ProtocolVersion: 1,
FirstStreamableBlock: 2,

BlockFactory: func() firecore.Block { return new(pbantelope.Block) },
Expand All @@ -39,9 +42,7 @@ func main() {
// transform.ReceiptFilterMessageName: transform.BasicReceiptFilterFactory,
//},

ConsoleReaderFactory: func(lines chan string, blockEncoder firecore.BlockEncoder, logger *zap.Logger, tracer logging.Tracer) (mindreader.ConsolerReader, error) {
return codec.NewConsoleReader(lines, blockEncoder, logger, tracer)
},
ConsoleReaderFactory: codec.NewConsoleReader,

RegisterExtraStartFlags: func(flags *pflag.FlagSet) {
flags.String("reader-node-config-file", "", "Node configuration file, the file is copied inside the {data-dir}/reader/data folder Use {hostname} label to use short hostname in path")
Expand All @@ -53,7 +54,6 @@ func main() {
// ReaderNodeBootstrapperFactory: newReaderNodeBootstrapper,

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

RegisterExtraCmd: func(chain *firecore.Chain[*pbantelope.Block], toolsCmd *cobra.Command, zlog *zap.Logger, tracer logging.Tracer) error {
//toolsCmd.AddCommand(newToolsGenerateNodeKeyCmd(chain))
Expand All @@ -69,11 +69,10 @@ func main() {
// },
//},
},
})
}

return chain
}

// Version value, injected via go build `ldflags` at build time
var version = "dev"

// Commit sha1 value, injected via go build `ldflags` at build time
var commit = ""
38 changes: 0 additions & 38 deletions cmd/fireantelope/tools.go

This file was deleted.

4 changes: 2 additions & 2 deletions codec/abi_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package codec
import (
"encoding/json"
"errors"
"io/ioutil"
"os"
"path"
"testing"

Expand Down Expand Up @@ -265,7 +265,7 @@ func TestABICache_Truncate(t *testing.T) {

func readABI(t *testing.T, abiFile string) (out *eos.ABI) {
path := path.Join("testdata", "abi", abiFile)
abiJSON, err := ioutil.ReadFile(path)
abiJSON, err := os.ReadFile(path)
require.NoError(t, err)

out = new(eos.ABI)
Expand Down
10 changes: 5 additions & 5 deletions codec/abi_decoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,10 +385,10 @@ func TestABIDecoder(t *testing.T) {
//return out
}

hexRegex := regexp.MustCompile("^[0-9a-fA-F]+$")
actionTraceRegex := regexp.MustCompile("^block (\\d+)/trace (\\d+)/action (\\d+)$")
dtrxOpRegex := regexp.MustCompile("^block (\\d+)/trace (\\d+)/dtrxOp (\\d+)/(action|cfaAction) (\\d+)$")
trxOpRegex := regexp.MustCompile("^block (\\d+)/trxOp (\\d+)/(action|cfaAction) (\\d+)$")
hexRegex := regexp.MustCompile(`^[0-9a-fA-F]+$`)
actionTraceRegex := regexp.MustCompile(`^block (\d+)/trace (\d+)/action (\d+)$`)
dtrxOpRegex := regexp.MustCompile(`^block (\d+)/trace (\d+)/dtrxOp (\d+)/(action|cfaAction) (\d+)$`)
trxOpRegex := regexp.MustCompile(`^block (\d+)/trxOp (\d+)/(action|cfaAction) (\d+)$`)

toInt := func(in string) int {
out, err := strconv.ParseInt(in, 10, 32)
Expand Down Expand Up @@ -422,7 +422,7 @@ func TestABIDecoder(t *testing.T) {
abiBinary, err := eos.MarshalBinary(abi)
require.NoError(t, err)

decoder.addInitialABI(contract, base64.RawStdEncoding.EncodeToString(abiBinary))
_ = decoder.addInitialABI(contract, base64.RawStdEncoding.EncodeToString(abiBinary))
}

for _, block := range test.blocks {
Expand Down
15 changes: 0 additions & 15 deletions codec/antelope/eos_to_proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,21 +431,6 @@ func AuthorizationToDEOS(authorization []eos.PermissionLevel) (out []*pbantelope
return
}

func AccountRAMDeltasToDEOS(deltas []*eos.AccountRAMDelta) (out []*pbantelope.AccountRAMDelta) {
if len(deltas) <= 0 {
return nil
}

out = make([]*pbantelope.AccountRAMDelta, len(deltas))
for i, delta := range deltas {
out[i] = &pbantelope.AccountRAMDelta{
Account: string(delta.Account),
Delta: int64(delta.Delta),
}
}
return
}

func ExceptionToDEOS(in *eos.Except) *pbantelope.Exception {
if in == nil {
return nil
Expand Down
9 changes: 0 additions & 9 deletions codec/antelope/v3.1/init_test.go

This file was deleted.

45 changes: 0 additions & 45 deletions codec/block_test.go

This file was deleted.

Loading

0 comments on commit 1647451

Please sign in to comment.