If you were using github.com/streamingfast/firehose-core/firehose/client.NewFirehoseFetchClient
or github.com/streamingfast/firehose-core/firehose/client.NewFirehoseClient
, this will be a minor breaking change, the constructor now returns callOpts
which should be passed to all request you make, see usage in resp, err := firehoseClient.Block(ctx, req, requestInfo.GRPCCallOpts...) and populating requestInfo.GRPCCallOpts
from NewFirehoseFetchClient
function returns can be seen here.
No changes was required.
This includes changes that are needed to upgrade to version v0.2.0.
-
The
nodemanager.GetLogLevelFunc
global override has been removed. If you had a global assignment of the formnodemanager.GetLogLevelFunc = ...
you must removed it now. There is no replacement has the functionality this was used for has been removed. See the version v0.2.0 section of the CHANGELOG for further details about the removal. -
The
firecore.Config#ReaderNodeBootstrapperFactory
has change signature fromfunc(cmd *cobra.Command, nodeDataDir string) (operator.Bootstrapper, error)
toReaderNodeBootstrapperFactory func(ctx context.Context, logger *zap.Logger, cmd *cobra.Command, resolvedNodeArguments []string, resolver ReaderNodeArgumentResolver) (operator.Bootstrapper, error)
. The new signature provides more data than before namely you get acontext.Context
for long running operation, thelogger
instance for this app if you need to log stuff, thecmd
if you need to extract flags, the currently fully resolved arguments viaresolvedNodeArguments
and also aresolver
function so you can perform further replacement on your own custom flags if needed. If you were usingnodeDataDir
value before, it's easy to get it back withnodeDataDir := resolver("{node-data-dir}")
.From:
func newReaderNodeBootstrapper(cmd *cobra.Command, nodeDataDir string) (operator.Bootstrapper, error) { ... }
To
func newReaderNodeBootstrapper(ctx context.Context, logger *zap.Logger, cmd *cobra.Command, resolvedNodeArguments []string, resolver firecore.ReaderNodeArgumentResolver, ) (operator.Bootstrapper, error) { nodeDataDir := resolver("{node-data-dir}") ... }
-
The
firecore.Block
has a new method that you must implement:GetFirehoseBlockVersion() int32
. Implementing like:func (b *Block) GetFirehoseBlockVersion() int32 { return N }
Where
N
is the value your have currently asProtocolVersion
in yourChain
config. You should not try to useChain.ProtocolVersion
directly and you must instead "hard-code" it for now. Those two values were tied together infirecore <= v0.1.z
which was wrong so since they don't represent the same thing (one is used for the low-level file formatdbin
while the other is used inbstream.PayloadVersion
). -
The
firecore.Block
interface methodGetFirehoseBlockLIBNum
has been removed from the core interfacefirecore.Block
and has been moved instead to an optional interfacefirecore.BlockLIBNumDerivable
. This was needed because not all chain convey the LIBNum within theBlock
model itself. This is not a breaking change and requires no change on your part. This was done to accomodate Ethereum and probably others. -
The
firecore.NewGenericBlockEncoder(protocolVersion int32)
has been renamed and changed signature, you should now use simplyfirecore.NewBlockEncoder()
-
The way tools transform flags are registered changed to become more generic. The
firecore.ToolsConfig#TransformFlags
changed it's definition completely. If you hadfirecore.Config#Tools { TransformFlags: ... }
defined, you must change a bit how you define it. You will now manually define the flags and the parser will change to parse all of the flags instead of one flag at a time.
Here the example that was applied to firehose-near
firecore.Chain
config:
From:
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,
},
},
To:
TransformFlags: &firecore.TransformFlags{
Register: func(flags *pflag.FlagSet) {
flags.String("receipt-account-filters", "", "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')")
},
Parse: parseReceiptAccountFilters,
},
Note
Notice the rename from Parser
to Parse
!
And the parseReceiptAccountFilters
needs some update too:
From:
func parseReceiptAccountFilters(in string) (*anypb.Any, error) {
...
return anypb.New(filters)
}
To:
func parseReceiptAccountFilters(cmd *cobra.Command, logger *zap.Logger) ([]*anypb.Any, error) {
in := sflags.MustGetString(cmd, "receipt-filter-accounts")
...
any, err := anypb.New(filters)
// Deal with error
return []*anypb.Any{any}, err
}