Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade to firehose-core v1.0.0 #107

Merged
merged 7 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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