Skip to content

Commit

Permalink
Merge pull request #737 from onflow/petera/making-poc-configurable
Browse files Browse the repository at this point in the history
Make PoC configurable
  • Loading branch information
peterargue authored Jan 28, 2025
2 parents 1f084be + fa39603 commit d68f2ba
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
25 changes: 18 additions & 7 deletions bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,24 @@ func (b *Bootstrap) StartEventIngestion(ctx context.Context) error {
chainID := b.config.FlowNetworkID

// create event subscriber
subscriber := ingestion.NewRPCBlockTrackingSubscriber(
b.logger,
b.client,
chainID,
b.keystore,
latestCadenceHeight,
)
var subscriber ingestion.EventSubscriber
if b.config.ExperimentalSoftFinalityEnabled {
subscriber = ingestion.NewRPCBlockTrackingSubscriber(
b.logger,
b.client,
chainID,
b.keystore,
latestCadenceHeight,
)
} else {
subscriber = ingestion.NewRPCEventSubscriber(
b.logger,
b.client,
chainID,
b.keystore,
latestCadenceHeight,
)
}

callTracerCollector, err := replayer.NewCallTracerCollector(b.logger)
if err != nil {
Expand Down
5 changes: 5 additions & 0 deletions cmd/run/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ func parseConfigFromFlags() error {
return fmt.Errorf("unknown tx state validation: %s", txStateValidation)
}

cfg.ExperimentalSoftFinalityEnabled = experimentalSoftFinalityEnabled

return nil
}

Expand All @@ -246,6 +248,8 @@ var (

initHeight,
forceStartHeight uint64

experimentalSoftFinalityEnabled bool
)

func init() {
Expand Down Expand Up @@ -280,4 +284,5 @@ func init() {
Cmd.Flags().StringVar(&cfg.ProfilerHost, "profiler-host", "localhost", "Host for the Profiler server")
Cmd.Flags().IntVar(&cfg.ProfilerPort, "profiler-port", 6060, "Port for the Profiler server")
Cmd.Flags().StringVar(&txStateValidation, "tx-state-validation", "tx-seal", "Sets the transaction validation mechanism. It can validate using the local state index, or wait for the outer Flow transaction to seal. Available values ('local-index' / 'tx-seal'), defaults to 'tx-seal'.")
Cmd.Flags().BoolVar(&experimentalSoftFinalityEnabled, "experimental-soft-finality-enabled", false, "Sets whether the gateway should use the experimental soft finality feature. WARNING: This may result in incorrect results being returned in certain circumstances. Use only if you know what you are doing.")
}
4 changes: 4 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,8 @@ type Config struct {
// TxStateValidation sets the transaction validation mechanism. It can validate
// using the local state index, or wait for the outer Flow transaction to seal.
TxStateValidation string
// ExperimentalSoftFinalityEnabled enables the experimental soft finality feature which syncs
// EVM block and transaction data from the upstream Access node before the block is sealed.
// CAUTION: This feature is experimental and may return incorrect data in certain circumstances.
ExperimentalSoftFinalityEnabled bool
}

0 comments on commit d68f2ba

Please sign in to comment.