@@ -87,7 +87,8 @@ var REQUIRES_LIST = map[string]misctypes.Requires{
8787 "clear-raw-bigtable" : {
8888 RawBigtable : true ,
8989 },
90- "app-bundle" : (& commands.AppBundleCommand {}).Requires (),
90+ "app-bundle" : (& commands.AppBundleCommand {}).Requires (),
91+ "migrate-legacy-balances" : (& commands.MigrateLegacyBalancesCommand {}).Requires (),
9192 "update-highest-active-validatorindex" : {
9293 Bigtable : true ,
9394 ClNode : true ,
@@ -105,8 +106,12 @@ func Run() {
105106 FlagSet : fs ,
106107 }
107108
109+ migrateLegacyBalancesCommand := commands.MigrateLegacyBalancesCommand {
110+ FlagSet : fs ,
111+ }
112+
108113 configPath := fs .String ("config" , "config/default.config.yml" , "Path to the config file" )
109- fs .StringVar (& opts .Command , "command" , "" , "command to run, available: updateAPIKey, applyDbSchema, initBigtableSchema, epoch-export, debug-rewards, debug-blocks, clear-bigtable, clear-raw-bigtable, index-old-eth1-blocks, update-aggregation-bits, historic-prices-export, index-missing-blocks, export-epoch-missed-slots, migrate-last-attestation-slot-bigtable, export-genesis-validators, update-block-finalization-sequentially, nameValidatorsByRanges, export-stats-totals, export-sync-committee-periods, export-sync-committee-validator-stats, partition-validator-stats, migrate-app-purchases, collect-notifications, collect-user-db-notifications, verify-fcm-tokens, app-bundle, update-highest-active-validatorindex" )
114+ fs .StringVar (& opts .Command , "command" , "" , "command to run, available: updateAPIKey, applyDbSchema, initBigtableSchema, epoch-export, debug-rewards, debug-blocks, clear-bigtable, clear-raw-bigtable, index-old-eth1-blocks, update-aggregation-bits, historic-prices-export, index-missing-blocks, export-epoch-missed-slots, migrate-last-attestation-slot-bigtable, export-genesis-validators, update-block-finalization-sequentially, nameValidatorsByRanges, export-stats-totals, export-sync-committee-periods, export-sync-committee-validator-stats, partition-validator-stats, migrate-app-purchases, collect-notifications, collect-user-db-notifications, verify-fcm-tokens, app-bundle, update-highest-active-validatorindex, migrate-legacy-balances " )
110115 fs .Uint64Var (& opts .StartEpoch , "start-epoch" , 0 , "start epoch" )
111116 fs .Uint64Var (& opts .EndEpoch , "end-epoch" , 0 , "end epoch" )
112117 fs .Uint64Var (& opts .User , "user" , 0 , "user id" )
@@ -133,6 +138,8 @@ func Run() {
133138
134139 statsPartitionCommand .ParseCommandOptions ()
135140 appBundleCommand .ParseCommandOptions ()
141+ migrateLegacyBalancesCommand .ParseCommandOptions ()
142+
136143 _ = fs .Parse (os .Args [2 :])
137144
138145 if * versionFlag {
@@ -221,6 +228,9 @@ func Run() {
221228 db .ClickHouseWriter , db .ClickHouseReader = db .MustInitDB (& cfg .ClickHouse .WriterDatabase , & cfg .ClickHouse .ReaderDatabase , "clickhouse" , "clickhouse" )
222229 defer db .ClickHouseReader .Close ()
223230 defer db .ClickHouseWriter .Close ()
231+
232+ db .ClickHouseNativeWriter = db .MustInitClickhouseNative (& cfg .ClickHouse .WriterDatabase )
233+ defer db .ClickHouseNativeWriter .Close ()
224234 }
225235
226236 // Initialize the persistent redis client
@@ -487,6 +497,8 @@ func Run() {
487497 case "app-bundle" :
488498 appBundleCommand .Config .DryRun = opts .DryRun
489499 err = appBundleCommand .Run ()
500+ case "migrate-legacy-balances" :
501+ err = migrateLegacyBalancesCommand .Run (rpcClient )
490502 case "fix-ens" :
491503 err = fixEns (erigonClient )
492504 case "fix-ens-addresses" :
0 commit comments