Skip to content

Commit 9a395f2

Browse files
committed
Deprecate --init-cadence-height CLI flag
1 parent e8f88e4 commit 9a395f2

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

cmd/run/cmd.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,23 +170,18 @@ func parseConfigFromFlags() error {
170170
case "flow-testnet":
171171
cfg.FlowNetworkID = flowGo.Testnet
172172
cfg.EVMNetworkID = types.FlowEVMTestNetChainID
173-
cfg.InitCadenceHeight = config.LiveNetworkInitCadenceHeight
173+
cfg.InitCadenceHeight = config.TestnetInitCadenceHeight
174174
case "flow-mainnet":
175175
cfg.FlowNetworkID = flowGo.Mainnet
176176
cfg.EVMNetworkID = types.FlowEVMMainNetChainID
177-
cfg.InitCadenceHeight = config.LiveNetworkInitCadenceHeight
177+
cfg.InitCadenceHeight = config.MainnetInitCadenceHeight
178178
default:
179179
return fmt.Errorf(
180180
"flow network ID: %s not supported, valid values are ('flow-emulator', 'flow-previewnet', 'flow-testnet', 'flow-mainnet')",
181181
flowNetwork,
182182
)
183183
}
184184

185-
// if a specific value was provided use it
186-
if initHeight != 0 {
187-
cfg.InitCadenceHeight = initHeight
188-
}
189-
190185
// configure logging
191186
level, err := zerolog.ParseLevel(logLevel)
192187
if err != nil {
@@ -296,4 +291,9 @@ func init() {
296291
Cmd.Flags().BoolVar(&cfg.TxBatchMode, "tx-batch-mode", false, "Enable batch transaction submission, to avoid nonce mismatch issues for high-volume EOAs.")
297292
Cmd.Flags().DurationVar(&cfg.TxBatchInterval, "tx-batch-interval", time.Millisecond*1200, "Time interval upon which to submit the transaction batches to the Flow network.")
298293
Cmd.Flags().DurationVar(&cfg.EOAActivityCacheTTL, "eoa-activity-cache-ttl", time.Second*10, "Time interval used to track EOA activity. Tx send more frequently than this interval will be batched. Useful only when batch transaction submission is enabled.")
294+
295+
err := Cmd.Flags().MarkDeprecated("init-cadence-height", "This flag is no longer necessary and will be removed in future version. The initial Cadence height is known for testnet/mainnet and this was only required for fresh deployments of EVM Gateway. Once the DB has been initialized, the latest index Cadence height will be used upon start-up.")
296+
if err != nil {
297+
panic(err)
298+
}
299299
}

config/config.go

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,24 @@ import (
1414
"github.com/rs/zerolog"
1515
)
1616

17-
// Default InitCadenceHeight for initializing the database on a local emulator.
18-
// TODO: temporary fix until https://github.com/onflow/flow-go/issues/5481 is
19-
// fixed upstream and released.
20-
const EmulatorInitCadenceHeight = uint64(0)
17+
const (
18+
// Default InitCadenceHeight for initializing the database on a local emulator.
19+
// TODO: temporary fix until https://github.com/onflow/flow-go/issues/5481 is
20+
// fixed upstream and released.
21+
EmulatorInitCadenceHeight = uint64(0)
22+
23+
// Default InitCadenceHeight for initializing the database on a live network.
24+
// We don't use 0 as it has a special meaning to represent latest block in the AN API context.
25+
LiveNetworkInitCadenceHeight = uint64(1)
2126

22-
// Default InitCadenceHeight for initializing the database on a live network.
23-
// We don't use 0 as it has a special meaning to represent latest block in the AN API context.
24-
const LiveNetworkInitCadenceHeight = uint64(1)
27+
// Testnet height at which the `EVM` system contract was first deployed.
28+
// This is the first height at which the EVM state starts.
29+
TestnetInitCadenceHeight = uint64(211176670)
30+
31+
// Mainnet height at which the `EVM` system contract was first deployed.
32+
// This is the first height at which the EVM state starts.
33+
MainnetInitCadenceHeight = uint64(85981134)
34+
)
2535

2636
type TxStateValidation string
2737

0 commit comments

Comments
 (0)