diff --git a/pkg/agave/validator.go b/pkg/agave/validator.go index ea4e234..cf23855 100644 --- a/pkg/agave/validator.go +++ b/pkg/agave/validator.go @@ -228,27 +228,124 @@ func (agave *Agave) Install() runner.Command { } type Flags struct { - EntryPoint *[]string `pulumi:"entryPoint,optional"` - KnownValidator *[]string `pulumi:"knownValidator,optional"` - UseSnapshotArchivesAtStartup string `pulumi:"useSnapshotArchivesAtStartup"` - RpcPort int `pulumi:"rpcPort"` - PrivateRPC bool `pulumi:"privateRPC"` - OnlyKnownRPC bool `pulumi:"onlyKnownRPC"` - DynamicPortRange string `pulumi:"dynamicPortRange"` - GossipHost *string `pulumi:"gossipHost,optional"` - GossipPort int `pulumi:"gossipPort"` - RpcBindAddress string `pulumi:"rpcBindAddress"` - WalRecoveryMode string `pulumi:"walRecoveryMode"` - LimitLedgerSize int `pulumi:"limitLedgerSize"` - BlockProductionMethod string `pulumi:"blockProductionMethod"` - TvuReceiveThreads *int `pulumi:"tvuReceiveThreads,optional"` - NoWaitForVoteToStartLeader bool `pulumi:"noWaitForVoteToStartLeader"` - FullSnapshotIntervalSlots int `pulumi:"fullSnapshotIntervalSlots"` - ExpectedGenesisHash *string `pulumi:"expectedGenesisHash,optional"` - FullRpcAPI *bool `pulumi:"fullRpcAPI,optional"` - NoVoting *bool `pulumi:"noVoting,optional"` - AllowPrivateAddr *bool `pulumi:"allowPrivateAddr,optional"` - ExtraFlags *[]string `pulumi:"extraFlags,optional"` + AccountIndex *[]string `pulumi:"accountIndex,optional"` + AccountIndexExcludeKey *[]string `pulumi:"accountIndexExcludeKey,optional"` + AccountIndexIncludeKey *[]string `pulumi:"accountIndexIncludeKey,optional"` + AccountShrinkPath *[]string `pulumi:"accountShrinkPath,optional"` + AccountsDbCacheLimitMb *int `pulumi:"accountsDbCacheLimitMb,optional"` + AccountsDbTestHashCalculation *bool `pulumi:"accountsDbTestHashCalculation,optional"` + AccountsHashCachePath *string `pulumi:"accountsHashCachePath,optional"` + AccountsIndexBins *int `pulumi:"accountsIndexBins,optional"` + AccountsIndexPath *[]string `pulumi:"accountsIndexPath,optional"` + AccountsIndexScanResultsLimitMb *int `pulumi:"accountsIndexScanResultsLimitMb,optional"` + AccountsShrinkOptimizeTotalSpace *bool `pulumi:"accountsShrinkOptimizeTotalSpace,optional"` + AccountsShrinkRatio *string `pulumi:"accountsShrinkRatio,optional"` + AllowPrivateAddr *bool `pulumi:"allowPrivateAddr,optional"` + AuthorizedVoter *[]string `pulumi:"authorizedVoter,optional"` + BindAddress *string `pulumi:"bindAddress,optional"` + BlockProductionMethod *string `pulumi:"blockProductionMethod,optional"` + BlockVerificationMethod *string `pulumi:"blockVerificationMethod,optional"` + CheckVoteAccount *string `pulumi:"checkVoteAccount,optional"` + ContactDebugInterval *int `pulumi:"contactDebugInterval,optional"` + Cuda *bool `pulumi:"cuda,optional"` + DebugKey *[]string `pulumi:"debugKey,optional"` + DevHaltAtSlot *int `pulumi:"devHaltAtSlot,optional"` + DisableBankingTrace *bool `pulumi:"disableBankingTrace,optional"` + DynamicPortRange *string `pulumi:"dynamicPortRange,optional"` + EnableBankingTrace *int `pulumi:"enableBankingTrace,optional"` + EnableBigtableLedgerUpload *bool `pulumi:"enableBigtableLedgerUpload,optional"` + EnableExtendedTxMetadataStorage *bool `pulumi:"enableExtendedTxMetadataStorage,optional"` + EnableRpcBigtableLedgerStorage *bool `pulumi:"enableRpcBigtableLedgerStorage,optional"` + EnableRpcTransactionHistory *bool `pulumi:"enableRpcTransactionHistory,optional"` + EntryPoint *[]string `pulumi:"entryPoint,optional"` + EtcdCacertFile *string `pulumi:"etcdCacertFile,optional"` + EtcdCertFile *string `pulumi:"etcdCertFile,optional"` + EtcdDomainName *string `pulumi:"etcdDomainName,optional"` + EtcdEndpoint *[]string `pulumi:"etcdEndpoint,optional"` + EtcdKeyFile *string `pulumi:"etcdKeyFile,optional"` + ExpectedBankHash *string `pulumi:"expectedBankHash,optional"` + ExpectedGenesisHash *string `pulumi:"expectedGenesisHash,optional"` + ExpectedShredVersion *int `pulumi:"expectedShredVersion,optional"` + ExtraFlags *[]string `pulumi:"extraFlags,optional"` + FullRpcAPI *bool `pulumi:"fullRpcAPI,optional"` + FullSnapshotArchivePath *string `pulumi:"fullSnapshotArchivePath,optional"` + FullSnapshotIntervalSlots *int `pulumi:"fullSnapshotIntervalSlots,optional"` + GeyserPluginAlwaysEnabled *bool `pulumi:"geyserPluginAlwaysEnabled,optional"` + GeyserPluginConfig *[]string `pulumi:"geyserPluginConfig,optional"` + GossipHost *string `pulumi:"gossipHost,optional"` + GossipPort *int `pulumi:"gossipPort,optional"` + GossipValidator *[]string `pulumi:"gossipValidator,optional"` + HardFork *[]int `pulumi:"hardFork,optional"` + HealthCheckSlotDistance *int `pulumi:"healthCheckSlotDistance,optional"` + IncrementalSnapshotArchivePath *string `pulumi:"incrementalSnapshotArchivePath,optional"` + InitCompleteFile *string `pulumi:"initCompleteFile,optional"` + KnownValidator *[]string `pulumi:"knownValidator,optional"` + LimitLedgerSize *int `pulumi:"limitLedgerSize,optional"` + LogMessagesBytesLimit *int `pulumi:"logMessagesBytesLimit,optional"` + MaxGenesisArchiveUnpackedSize *int `pulumi:"maxGenesisArchiveUnpackedSize,optional"` + MaximumFullSnapshotsToRetain *int `pulumi:"maximumFullSnapshotsToRetain,optional"` + MaximumIncrementalSnapshotsToRetain *int `pulumi:"maximumIncrementalSnapshotsToRetain,optional"` + MaximumLocalSnapshotAge *int `pulumi:"maximumLocalSnapshotAge,optional"` + MaximumSnapshotDownloadAbort *int `pulumi:"maximumSnapshotDownloadAbort,optional"` + MinimalSnapshotDownloadSpeed *int `pulumi:"minimalSnapshotDownloadSpeed,optional"` + NoGenesisFetch *bool `pulumi:"noGenesisFetch,optional"` + NoIncrementalSnapshots *bool `pulumi:"noIncrementalSnapshots,optional"` + NoSnapshotFetch *bool `pulumi:"noSnapshotFetch,optional"` + NoVoting *bool `pulumi:"noVoting,optional"` + NoWaitForVoteToStartLeader bool `pulumi:"noWaitForVoteToStartLeader"` + OnlyKnownRPC *bool `pulumi:"onlyKnownRPC,optional"` + PrivateRPC *bool `pulumi:"privateRPC,optional"` + PublicRpcAddress *string `pulumi:"publicRpcAddress,optional"` + PublicTpuAddress *string `pulumi:"publicTpuAddress,optional"` + PublicTpuForwardsAddress *string `pulumi:"publicTpuForwardsAddress,optional"` + RepairValidator *[]string `pulumi:"repairValidator,optional"` + RequireTower *bool `pulumi:"requireTower,optional"` + RestrictedRepairOnlyMode *bool `pulumi:"restrictedRepairOnlyMode,optional"` + RocksdbFifoShredStorageSize *int `pulumi:"rocksdbFifoShredStorageSize,optional"` + RocksdbShredCompaction *string `pulumi:"rocksdbShredCompaction,optional"` + RpcBigtableAppProfileId *string `pulumi:"rpcBigtableAppProfileId,optional"` + RpcBigtableInstanceName *string `pulumi:"rpcBigtableInstanceName,optional"` + RpcBigtableMaxMessageSize *int `pulumi:"rpcBigtableMaxMessageSize,optional"` + RpcBigtableTimeout *int `pulumi:"rpcBigtableTimeout,optional"` + RpcBindAddress string `pulumi:"rpcBindAddress"` + RpcFaucetAddress *string `pulumi:"rpcFaucetAddress,optional"` + RpcMaxMultipleAccounts *int `pulumi:"rpcMaxMultipleAccounts,optional"` + RpcMaxRequestBodySize *int `pulumi:"rpcMaxRequestBodySize,optional"` + RpcNicenessAdjustment *int `pulumi:"rpcNicenessAdjustment,optional"` + RpcPort int `pulumi:"rpcPort"` + RpcPubsubEnableBlockSubscription *bool `pulumi:"rpcPubsubEnableBlockSubscription,optional"` + RpcPubsubEnableVoteSubscription *bool `pulumi:"rpcPubsubEnableVoteSubscription,optional"` + RpcPubsubMaxActiveSubscriptions *int `pulumi:"rpcPubsubMaxActiveSubscriptions,optional"` + RpcPubsubNotificationThreads *int `pulumi:"rpcPubsubNotificationThreads,optional"` + RpcPubsubQueueCapacityBytes *int `pulumi:"rpcPubsubQueueCapacityBytes,optional"` + RpcPubsubQueueCapacityItems *int `pulumi:"rpcPubsubQueueCapacityItems,optional"` + RpcPubsubWorkerThreads *int `pulumi:"rpcPubsubWorkerThreads,optional"` + RpcScanAndFixRoots *bool `pulumi:"rpcScanAndFixRoots,optional"` + RpcSendLeaderCount *int `pulumi:"rpcSendLeaderCount,optional"` + RpcSendRetryMs *int `pulumi:"rpcSendRetryMs,optional"` + RpcSendServiceMaxRetries *int `pulumi:"rpcSendServiceMaxRetries,optional"` + RpcSendTransactionAlsoLeader *bool `pulumi:"rpcSendTransactionAlsoLeader,optional"` + RpcSendTransactionRetryPoolMaxSize *int `pulumi:"rpcSendTransactionRetryPoolMaxSize,optional"` + RpcSendTransactionTpuPeer *[]string `pulumi:"rpcSendTransactionTpuPeer,optional"` + RpcThreads *int `pulumi:"rpcThreads,optional"` + SkipPreflightHealthCheck *bool `pulumi:"skipPreflightHealthCheck,optional"` + SkipSeedPhraseValidation *bool `pulumi:"skipSeedPhraseValidation,optional"` + SkipStartupLedgerVerification *bool `pulumi:"skipStartupLedgerVerification,optional"` + SnapshotArchiveFormat *string `pulumi:"snapshotArchiveFormat,optional"` + SnapshotIntervalSlots *int `pulumi:"snapshotIntervalSlots,optional"` + SnapshotPackagerNicenessAdjustment *int `pulumi:"snapshotPackagerNicenessAdjustment,optional"` + SnapshotVersion *string `pulumi:"snapshotVersion,optional"` + StakedNodesOverrides *string `pulumi:"stakedNodesOverrides,optional"` + TowerStorage *string `pulumi:"towerStorage,optional"` + TpuCoalesceMs *int `pulumi:"tpuCoalesceMs,optional"` + TpuConnectionPoolSize *int `pulumi:"tpuConnectionPoolSize,optional"` + TpuDisableQuic *bool `pulumi:"tpuDisableQuic,optional"` + TpuEnableUdp *bool `pulumi:"tpuEnableUdp,optional"` + TvuReceiveThreads *int `pulumi:"tvuReceiveThreads,optional"` + UnifiedSchedulerHandlerThreads *int `pulumi:"unifiedSchedulerHandlerThreads,optional"` + UseSnapshotArchivesAtStartup *string `pulumi:"useSnapshotArchivesAtStartup,optional"` + WaitForSupermajority *int `pulumi:"waitForSupermajority,optional"` + WalRecoveryMode string `pulumi:"walRecoveryMode"` } func (f Flags) ToArgs() []string { @@ -257,6 +354,78 @@ func (f Flags) ToArgs() []string { // Note: These locations are hard coded inside asset-builder. b.Append("--identity", identityKeyPairPath) b.Append("--vote-account", voteAccountKeyPairPath) + b.Append("--log", logPath) + b.Append("--accounts", accountsPath) + b.Append("--ledger", ledgerPath) + + if f.AccountIndex != nil { + for _, index := range *f.AccountIndex { + b.AppendP("account-index", &index) + } + } + + if f.AccountIndexExcludeKey != nil { + for _, key := range *f.AccountIndexExcludeKey { + b.AppendP("account-index-exclude-key", &key) + } + } + + if f.AccountIndexIncludeKey != nil { + for _, key := range *f.AccountIndexIncludeKey { + b.AppendP("account-index-include-key", &key) + } + } + + if f.AccountShrinkPath != nil { + for _, path := range *f.AccountShrinkPath { + b.AppendP("account-shrink-path", &path) + } + } + + b.AppendIntP("accounts-db-cache-limit-mb", f.AccountsDbCacheLimitMb) + b.AppendBoolP("accounts-db-test-hash-calculation", f.AccountsDbTestHashCalculation) + b.AppendP("accounts-hash-cache-path", f.AccountsHashCachePath) + b.AppendIntP("accounts-index-bins", f.AccountsIndexBins) + + if f.AccountsIndexPath != nil { + for _, path := range *f.AccountsIndexPath { + b.AppendP("accounts-index-path", &path) + } + } + + b.AppendIntP("accounts-index-scan-results-limit-mb", f.AccountsIndexScanResultsLimitMb) + b.AppendBoolP("accounts-shrink-optimize-total-space", f.AccountsShrinkOptimizeTotalSpace) + b.AppendP("accounts-shrink-ratio", f.AccountsShrinkRatio) + + b.AppendBoolP("allow-private-addr", f.AllowPrivateAddr) + + if f.AuthorizedVoter != nil { + for _, voter := range *f.AuthorizedVoter { + b.AppendP("authorized-voter", &voter) + } + } + + b.AppendP("bind-address", f.BindAddress) + b.AppendP("block-production-method", f.BlockProductionMethod) + b.AppendP("block-verification-method", f.BlockVerificationMethod) + b.AppendP("check-vote-account", f.CheckVoteAccount) + b.AppendIntP("contact-debug-interval", f.ContactDebugInterval) + b.AppendBoolP("cuda", f.Cuda) + + if f.DebugKey != nil { + for _, key := range *f.DebugKey { + b.AppendP("debug-key", &key) + } + } + + b.AppendIntP("dev-halt-at-slot", f.DevHaltAtSlot) + b.AppendBoolP("disable-banking-trace", f.DisableBankingTrace) + b.AppendP("dynamic-port-range", f.DynamicPortRange) + b.AppendIntP("enable-banking-trace", f.EnableBankingTrace) + b.AppendBoolP("enable-bigtable-ledger-upload", f.EnableBigtableLedgerUpload) + b.AppendBoolP("enable-extended-tx-metadata-storage", f.EnableExtendedTxMetadataStorage) + b.AppendBoolP("enable-rpc-bigtable-ledger-storage", f.EnableRpcBigtableLedgerStorage) + b.AppendBoolP("enable-rpc-transaction-history", f.EnableRpcTransactionHistory) if f.EntryPoint != nil { for _, entrypoint := range *f.EntryPoint { @@ -264,44 +433,143 @@ func (f Flags) ToArgs() []string { } } - if f.KnownValidator != nil { - for _, knownValidator := range *f.KnownValidator { - b.AppendP("known-validator", &knownValidator) + b.AppendP("etcd-cacert-file", f.EtcdCacertFile) + b.AppendP("etcd-cert-file", f.EtcdCertFile) + b.AppendP("etcd-domain-name", f.EtcdDomainName) + + if f.EtcdEndpoint != nil { + for _, endpoint := range *f.EtcdEndpoint { + b.AppendP("etcd-endpoint", &endpoint) } } + b.AppendP("etcd-key-file", f.EtcdKeyFile) + b.AppendP("expected-bank-hash", f.ExpectedBankHash) b.AppendP("expected-genesis-hash", f.ExpectedGenesisHash) + b.AppendIntP("expected-shred-version", f.ExpectedShredVersion) - b.AppendP("use-snapshot-archives-at-startup", &f.UseSnapshotArchivesAtStartup) - b.AppendIntP("rpc-port", &f.RpcPort) - b.AppendP("dynamic-port-range", &f.DynamicPortRange) + if f.ExtraFlags != nil { + b.Append(*f.ExtraFlags...) + } + + b.AppendBoolP("full-rpc-api", f.FullRpcAPI) + b.AppendP("full-snapshot-archive-path", f.FullSnapshotArchivePath) + b.AppendIntP("full-snapshot-interval-slots", f.FullSnapshotIntervalSlots) + b.AppendBoolP("geyser-plugin-always-enabled", f.GeyserPluginAlwaysEnabled) + + if f.GeyserPluginConfig != nil { + for _, config := range *f.GeyserPluginConfig { + b.AppendP("geyser-plugin-config", &config) + } + } b.AppendP("gossip-host", f.GossipHost) + b.AppendIntP("gossip-port", f.GossipPort) - b.AppendIntP("gossip-port", &f.GossipPort) - b.AppendP("rpc-bind-address", &f.RpcBindAddress) - b.AppendP("wal-recovery-mode", &f.WalRecoveryMode) - b.Append("--log", logPath) - b.Append("--accounts", accountsPath) - b.Append("--ledger", ledgerPath) - b.AppendIntP("limit-ledger-size", &f.LimitLedgerSize) - b.AppendP("block-production-method", &f.BlockProductionMethod) + if f.GossipValidator != nil { + for _, validator := range *f.GossipValidator { + b.AppendP("gossip-validator", &validator) + } + } - b.AppendIntP("tvu-receive-threads", f.TvuReceiveThreads) + if f.HardFork != nil { + for _, slot := range *f.HardFork { + b.AppendIntP("hard-fork", &slot) + } + } - b.AppendIntP("full-snapshot-interval-slots", &f.FullSnapshotIntervalSlots) - b.AppendBoolP("no-wait-for-vote-to-start-leader", &f.NoWaitForVoteToStartLeader) - b.AppendBoolP("only-known-rpc", &f.OnlyKnownRPC) - b.AppendBoolP("private-rpc", &f.PrivateRPC) + b.AppendIntP("health-check-slot-distance", f.HealthCheckSlotDistance) + b.AppendP("incremental-snapshot-archive-path", f.IncrementalSnapshotArchivePath) + b.AppendP("init-complete-file", f.InitCompleteFile) - b.AppendBoolP("full-rpc-api", f.FullRpcAPI) + if f.KnownValidator != nil { + for _, knownValidator := range *f.KnownValidator { + b.AppendP("known-validator", &knownValidator) + } + } + b.AppendIntP("limit-ledger-size", f.LimitLedgerSize) + b.AppendIntP("log-messages-bytes-limit", f.LogMessagesBytesLimit) + b.AppendIntP("max-genesis-archive-unpacked-size", f.MaxGenesisArchiveUnpackedSize) + b.AppendIntP("maximum-full-snapshots-to-retain", f.MaximumFullSnapshotsToRetain) + b.AppendIntP("maximum-incremental-snapshots-to-retain", f.MaximumIncrementalSnapshotsToRetain) + b.AppendIntP("maximum-local-snapshot-age", f.MaximumLocalSnapshotAge) + b.AppendIntP("maximum-snapshot-download-abort", f.MaximumSnapshotDownloadAbort) + b.AppendIntP("minimal-snapshot-download-speed", f.MinimalSnapshotDownloadSpeed) + b.AppendBoolP("no-genesis-fetch", f.NoGenesisFetch) + b.AppendBoolP("no-incremental-snapshots", f.NoIncrementalSnapshots) + b.AppendBoolP("no-snapshot-fetch", f.NoSnapshotFetch) b.AppendBoolP("no-voting", f.NoVoting) - b.AppendBoolP("allow-private-addr", f.AllowPrivateAddr) - if f.ExtraFlags != nil { - b.Append(*f.ExtraFlags...) + // Note: This flag is not documented in the Agave validator documentation, but it is + // present in the source code. + b.AppendBoolP("no-wait-for-vote-to-start-leader", &f.NoWaitForVoteToStartLeader) + + b.AppendBoolP("only-known-rpc", f.OnlyKnownRPC) + b.AppendBoolP("private-rpc", f.PrivateRPC) + b.AppendP("public-rpc-address", f.PublicRpcAddress) + b.AppendP("public-tpu-address", f.PublicTpuAddress) + b.AppendP("public-tpu-forwards-address", f.PublicTpuForwardsAddress) + + if f.RepairValidator != nil { + for _, validator := range *f.RepairValidator { + b.AppendP("repair-validator", &validator) + } } + b.AppendBoolP("require-tower", f.RequireTower) + b.AppendBoolP("restricted-repair-only-mode", f.RestrictedRepairOnlyMode) + b.AppendIntP("rocksdb-fifo-shred-storage-size", f.RocksdbFifoShredStorageSize) + b.AppendP("rocksdb-shred-compaction", f.RocksdbShredCompaction) + b.AppendP("rpc-bigtable-app-profile-id", f.RpcBigtableAppProfileId) + b.AppendP("rpc-bigtable-instance-name", f.RpcBigtableInstanceName) + b.AppendIntP("rpc-bigtable-max-message-size", f.RpcBigtableMaxMessageSize) + b.AppendIntP("rpc-bigtable-timeout", f.RpcBigtableTimeout) + b.AppendP("rpc-bind-address", &f.RpcBindAddress) + b.AppendP("rpc-faucet-address", f.RpcFaucetAddress) + b.AppendIntP("rpc-max-multiple-accounts", f.RpcMaxMultipleAccounts) + b.AppendIntP("rpc-max-request-body-size", f.RpcMaxRequestBodySize) + b.AppendIntP("rpc-niceness-adjustment", f.RpcNicenessAdjustment) + b.AppendIntP("rpc-port", &f.RpcPort) + b.AppendBoolP("rpc-pubsub-enable-block-subscription", f.RpcPubsubEnableBlockSubscription) + b.AppendBoolP("rpc-pubsub-enable-vote-subscription", f.RpcPubsubEnableVoteSubscription) + b.AppendIntP("rpc-pubsub-max-active-subscriptions", f.RpcPubsubMaxActiveSubscriptions) + b.AppendIntP("rpc-pubsub-notification-threads", f.RpcPubsubNotificationThreads) + b.AppendIntP("rpc-pubsub-queue-capacity-bytes", f.RpcPubsubQueueCapacityBytes) + b.AppendIntP("rpc-pubsub-queue-capacity-items", f.RpcPubsubQueueCapacityItems) + b.AppendIntP("rpc-pubsub-worker-threads", f.RpcPubsubWorkerThreads) + b.AppendBoolP("rpc-scan-and-fix-roots", f.RpcScanAndFixRoots) + b.AppendIntP("rpc-send-leader-count", f.RpcSendLeaderCount) + b.AppendIntP("rpc-send-retry-ms", f.RpcSendRetryMs) + b.AppendIntP("rpc-send-service-max-retries", f.RpcSendServiceMaxRetries) + b.AppendBoolP("rpc-send-transaction-also-leader", f.RpcSendTransactionAlsoLeader) + b.AppendIntP("rpc-send-transaction-retry-pool-max-size", f.RpcSendTransactionRetryPoolMaxSize) + + if f.RpcSendTransactionTpuPeer != nil { + for _, peer := range *f.RpcSendTransactionTpuPeer { + b.AppendP("rpc-send-transaction-tpu-peer", &peer) + } + } + + b.AppendIntP("rpc-threads", f.RpcThreads) + b.AppendBoolP("skip-preflight-health-check", f.SkipPreflightHealthCheck) + b.AppendBoolP("skip-seed-phrase-validation", f.SkipSeedPhraseValidation) + b.AppendBoolP("skip-startup-ledger-verification", f.SkipStartupLedgerVerification) + b.AppendP("snapshot-archive-format", f.SnapshotArchiveFormat) + b.AppendIntP("snapshot-interval-slots", f.SnapshotIntervalSlots) + b.AppendIntP("snapshot-packager-niceness-adjustment", f.SnapshotPackagerNicenessAdjustment) + b.AppendP("snapshot-version", f.SnapshotVersion) + b.AppendP("staked-nodes-overrides", f.StakedNodesOverrides) + b.AppendP("tower-storage", f.TowerStorage) + b.AppendIntP("tpu-coalesce-ms", f.TpuCoalesceMs) + b.AppendIntP("tpu-connection-pool-size", f.TpuConnectionPoolSize) + b.AppendBoolP("tpu-disable-quic", f.TpuDisableQuic) + b.AppendBoolP("tpu-enable-udp", f.TpuEnableUdp) + b.AppendIntP("tvu-receive-threads", f.TvuReceiveThreads) + b.AppendIntP("unified-scheduler-handler-threads", f.UnifiedSchedulerHandlerThreads) + b.AppendP("use-snapshot-archives-at-startup", f.UseSnapshotArchivesAtStartup) + b.AppendIntP("wait-for-supermajority", f.WaitForSupermajority) + b.AppendP("wal-recovery-mode", &f.WalRecoveryMode) + return b.ToArgs() } diff --git a/pkg/agave/validator_test.go b/pkg/agave/validator_test.go index c18fbbd..0f12438 100644 --- a/pkg/agave/validator_test.go +++ b/pkg/agave/validator_test.go @@ -20,62 +20,389 @@ func TestValidatorEnv(t *testing.T) { } func TestValidatorFlags(t *testing.T) { - gossipHost := "somehost" - tvuReceiveThreads := 88 + + accountIndex := []string{"program-id", "spl-token-owner"} + accountIndexExcludeKey := []string{"excludeKey1", "excludeKey2"} + accountIndexIncludeKey := []string{"includeKey1", "includeKey2"} + accountShrinkPath := []string{"/path/to/shrink1", "/path/to/shrink2"} + accountsDbCacheLimitMb := 1024 + accountsDbTestHashCalculation := true + accountsHashCachePath := "/path/to/accounts_hash_cache" + accountsIndexBins := 64 + accountsIndexPath := []string{"/path/to/accounts_index1", "/path/to/accounts_index2"} + accountsIndexScanResultsLimitMb := 512 + accountsShrinkOptimizeTotalSpace := true + accountsShrinkRatio := "0.8" + allowPrivateAddr := true + authorizedVoter := []string{"voterPubkey1", "voterPubkey2"} + bindAddress := "0.0.0.0" + blockProductionMethod := "whatever" + blockVerificationMethod := "unified-scheduler" + checkVoteAccount := "http://localhost:8899" + contactDebugInterval := 120000 + cuda := true + debugKey := []string{"debugKey1", "debugKey2"} + devHaltAtSlot := 1000000 + disableBankingTrace := true + dynamicPortRange := "8002-8003" + enableBankingTrace := 15032385536 + enableBigtableLedgerUpload := true + enableExtendedTxMetadataStorage := true + enableRpcBigtableLedgerStorage := true + enableRpcTransactionHistory := true + entryPoint := []string{"hostA", "hostB"} + etcdCacertFile := "/path/to/ca.crt" + etcdCertFile := "/path/to/client.crt" + etcdDomainName := "example.com" + etcdEndpoint := []string{"etcd1.example.com:2379", "etcd2.example.com:2379"} + etcdKeyFile := "/path/to/client.key" + expectedBankHash := "expectedBankHashValue" expectedGenesisHash := "asdkjasldjadk" - fullRPCAPI := false + expectedShredVersion := 1234 + extraFlags := []string{"--extra", "--flag"} + fullRpcAPI := true + fullSnapshotArchivePath := "/path/to/full_snapshot" + fullSnapshotIntervalSlots := 1000 + geyserPluginAlwaysEnabled := true + geyserPluginConfig := []string{"/path/to/geyser_plugin1.yaml", "/path/to/geyser_plugin2.yaml"} + gossipHost := "somehost" + gossipPort := 62 + gossipValidator := []string{"validatorPubkey1", "validatorPubkey2"} + hardFork := []int{500000, 1000000} + healthCheckSlotDistance := 128 + incrementalSnapshotArchivePath := "/path/to/incremental_snapshot" + initCompleteFile := "/path/to/init_complete" + knownValidator := []string{"validatorA", "validatorB"} + limitLedgerSize := 62 + logMessagesBytesLimit := 1048576 + maxGenesisArchiveUnpackedSize := 10485760 + maximumFullSnapshotsToRetain := 2 + maximumIncrementalSnapshotsToRetain := 4 + maximumLocalSnapshotAge := 2500 + maximumSnapshotDownloadAbort := 5 + minimalSnapshotDownloadSpeed := 10485760 + noGenesisFetch := true + noIncrementalSnapshots := true + noSnapshotFetch := true noVoting := true - allowPrivateAddr := true + noWaitForVoteToStartLeader := true + onlyKnownRPC := true + privateRPC := true + publicRpcAddress := "0.0.0.0:8899" + publicTpuAddress := "0.0.0.0:8001" + publicTpuForwardsAddress := "0.0.0.0:8002" + repairValidator := []string{"repairValidator1", "repairValidator2"} + requireTower := true + restrictedRepairOnlyMode := true + rocksdbFifoShredStorageSize := 104857600 + rocksdbShredCompaction := "fifo" + rpcBigtableAppProfileId := "default" + rpcBigtableInstanceName := "solana-ledger" + rpcBigtableMaxMessageSize := 67108864 + rpcBigtableTimeout := 30 + rpcBindAddress := "1.2.3.4" + rpcFaucetAddress := "127.0.0.1:9900" + rpcMaxMultipleAccounts := 100 + rpcMaxRequestBodySize := 51200 + rpcNicenessAdjustment := 0 + rpcPort := 38 + rpcPubsubEnableBlockSubscription := true + rpcPubsubEnableVoteSubscription := true + rpcPubsubMaxActiveSubscriptions := 1000000 + rpcPubsubNotificationThreads := 4 + rpcPubsubQueueCapacityBytes := 268435456 + rpcPubsubQueueCapacityItems := 10000000 + rpcPubsubWorkerThreads := 4 + rpcScanAndFixRoots := true + rpcSendLeaderCount := 2 + rpcSendRetryMs := 2000 + rpcSendServiceMaxRetries := 5 + rpcSendTransactionAlsoLeader := true + rpcSendTransactionRetryPoolMaxSize := 10000 + rpcSendTransactionTpuPeer := []string{"peer1:8000", "peer2:8000"} + rpcThreads := 10 + skipPreflightHealthCheck := true + skipSeedPhraseValidation := true + skipStartupLedgerVerification := true + snapshotArchiveFormat := "zstd" + snapshotIntervalSlots := 100 + snapshotPackagerNicenessAdjustment := 0 + snapshotVersion := "1.2.0" + stakedNodesOverrides := "/path/to/staked_nodes_overrides.yaml" + towerStorage := "file" + tpuCoalesceMs := 5 + tpuConnectionPoolSize := 10 + tpuDisableQuic := true + tpuEnableUdp := true + tvuReceiveThreads := 88 + unifiedSchedulerHandlerThreads := 2 + useSnapshotArchivesAtStartup := "whatever" + waitForSupermajority := 1000 + walRecoveryMode := "someaddress" f := Flags{ - EntryPoint: &[]string{"hostA", "hostB"}, - KnownValidator: &[]string{"validatorA", "validatorB"}, - UseSnapshotArchivesAtStartup: "whatever", - RpcPort: 38, - PrivateRPC: false, - OnlyKnownRPC: true, - DynamicPortRange: "8002-8003", - GossipHost: &gossipHost, - GossipPort: 62, - RpcBindAddress: "1.2.3.4", - WalRecoveryMode: "someaddress", - LimitLedgerSize: 62, - BlockProductionMethod: "whatever", - TvuReceiveThreads: &tvuReceiveThreads, - NoWaitForVoteToStartLeader: false, - FullSnapshotIntervalSlots: 1000, - ExpectedGenesisHash: &expectedGenesisHash, - FullRpcAPI: &fullRPCAPI, - NoVoting: &noVoting, - AllowPrivateAddr: &allowPrivateAddr, - ExtraFlags: &[]string{"--extra", "--flag"}, + AccountIndex: &accountIndex, + AccountIndexExcludeKey: &accountIndexExcludeKey, + AccountIndexIncludeKey: &accountIndexIncludeKey, + AccountShrinkPath: &accountShrinkPath, + AccountsDbCacheLimitMb: &accountsDbCacheLimitMb, + AccountsDbTestHashCalculation: &accountsDbTestHashCalculation, + AccountsHashCachePath: &accountsHashCachePath, + AccountsIndexBins: &accountsIndexBins, + AccountsIndexPath: &accountsIndexPath, + AccountsIndexScanResultsLimitMb: &accountsIndexScanResultsLimitMb, + AccountsShrinkOptimizeTotalSpace: &accountsShrinkOptimizeTotalSpace, + AccountsShrinkRatio: &accountsShrinkRatio, + AllowPrivateAddr: &allowPrivateAddr, + AuthorizedVoter: &authorizedVoter, + BindAddress: &bindAddress, + BlockProductionMethod: &blockProductionMethod, + BlockVerificationMethod: &blockVerificationMethod, + CheckVoteAccount: &checkVoteAccount, + ContactDebugInterval: &contactDebugInterval, + Cuda: &cuda, + DebugKey: &debugKey, + DevHaltAtSlot: &devHaltAtSlot, + DisableBankingTrace: &disableBankingTrace, + DynamicPortRange: &dynamicPortRange, + EnableBankingTrace: &enableBankingTrace, + EnableBigtableLedgerUpload: &enableBigtableLedgerUpload, + EnableExtendedTxMetadataStorage: &enableExtendedTxMetadataStorage, + EnableRpcBigtableLedgerStorage: &enableRpcBigtableLedgerStorage, + EnableRpcTransactionHistory: &enableRpcTransactionHistory, + EntryPoint: &entryPoint, + EtcdCacertFile: &etcdCacertFile, + EtcdCertFile: &etcdCertFile, + EtcdDomainName: &etcdDomainName, + EtcdEndpoint: &etcdEndpoint, + EtcdKeyFile: &etcdKeyFile, + ExpectedBankHash: &expectedBankHash, + ExpectedGenesisHash: &expectedGenesisHash, + ExpectedShredVersion: &expectedShredVersion, + ExtraFlags: &extraFlags, + FullRpcAPI: &fullRpcAPI, + FullSnapshotArchivePath: &fullSnapshotArchivePath, + FullSnapshotIntervalSlots: &fullSnapshotIntervalSlots, + GeyserPluginAlwaysEnabled: &geyserPluginAlwaysEnabled, + GeyserPluginConfig: &geyserPluginConfig, + GossipHost: &gossipHost, + GossipPort: &gossipPort, + GossipValidator: &gossipValidator, + HardFork: &hardFork, + HealthCheckSlotDistance: &healthCheckSlotDistance, + IncrementalSnapshotArchivePath: &incrementalSnapshotArchivePath, + InitCompleteFile: &initCompleteFile, + KnownValidator: &knownValidator, + LimitLedgerSize: &limitLedgerSize, + LogMessagesBytesLimit: &logMessagesBytesLimit, + MaxGenesisArchiveUnpackedSize: &maxGenesisArchiveUnpackedSize, + MaximumFullSnapshotsToRetain: &maximumFullSnapshotsToRetain, + MaximumIncrementalSnapshotsToRetain: &maximumIncrementalSnapshotsToRetain, + MaximumLocalSnapshotAge: &maximumLocalSnapshotAge, + MaximumSnapshotDownloadAbort: &maximumSnapshotDownloadAbort, + MinimalSnapshotDownloadSpeed: &minimalSnapshotDownloadSpeed, + NoGenesisFetch: &noGenesisFetch, + NoIncrementalSnapshots: &noIncrementalSnapshots, + NoSnapshotFetch: &noSnapshotFetch, + NoVoting: &noVoting, + NoWaitForVoteToStartLeader: noWaitForVoteToStartLeader, + OnlyKnownRPC: &onlyKnownRPC, + PrivateRPC: &privateRPC, + PublicRpcAddress: &publicRpcAddress, + PublicTpuAddress: &publicTpuAddress, + PublicTpuForwardsAddress: &publicTpuForwardsAddress, + RepairValidator: &repairValidator, + RequireTower: &requireTower, + RestrictedRepairOnlyMode: &restrictedRepairOnlyMode, + RocksdbFifoShredStorageSize: &rocksdbFifoShredStorageSize, + RocksdbShredCompaction: &rocksdbShredCompaction, + RpcBigtableAppProfileId: &rpcBigtableAppProfileId, + RpcBigtableInstanceName: &rpcBigtableInstanceName, + RpcBigtableMaxMessageSize: &rpcBigtableMaxMessageSize, + RpcBigtableTimeout: &rpcBigtableTimeout, + RpcBindAddress: rpcBindAddress, + RpcFaucetAddress: &rpcFaucetAddress, + RpcMaxMultipleAccounts: &rpcMaxMultipleAccounts, + RpcMaxRequestBodySize: &rpcMaxRequestBodySize, + RpcNicenessAdjustment: &rpcNicenessAdjustment, + RpcPort: rpcPort, + RpcPubsubEnableBlockSubscription: &rpcPubsubEnableBlockSubscription, + RpcPubsubEnableVoteSubscription: &rpcPubsubEnableVoteSubscription, + RpcPubsubMaxActiveSubscriptions: &rpcPubsubMaxActiveSubscriptions, + RpcPubsubNotificationThreads: &rpcPubsubNotificationThreads, + RpcPubsubQueueCapacityBytes: &rpcPubsubQueueCapacityBytes, + RpcPubsubQueueCapacityItems: &rpcPubsubQueueCapacityItems, + RpcPubsubWorkerThreads: &rpcPubsubWorkerThreads, + RpcScanAndFixRoots: &rpcScanAndFixRoots, + RpcSendLeaderCount: &rpcSendLeaderCount, + RpcSendRetryMs: &rpcSendRetryMs, + RpcSendServiceMaxRetries: &rpcSendServiceMaxRetries, + RpcSendTransactionAlsoLeader: &rpcSendTransactionAlsoLeader, + RpcSendTransactionRetryPoolMaxSize: &rpcSendTransactionRetryPoolMaxSize, + RpcSendTransactionTpuPeer: &rpcSendTransactionTpuPeer, + RpcThreads: &rpcThreads, + SkipPreflightHealthCheck: &skipPreflightHealthCheck, + SkipSeedPhraseValidation: &skipSeedPhraseValidation, + SkipStartupLedgerVerification: &skipStartupLedgerVerification, + SnapshotArchiveFormat: &snapshotArchiveFormat, + SnapshotIntervalSlots: &snapshotIntervalSlots, + SnapshotPackagerNicenessAdjustment: &snapshotPackagerNicenessAdjustment, + SnapshotVersion: &snapshotVersion, + StakedNodesOverrides: &stakedNodesOverrides, + TowerStorage: &towerStorage, + TpuCoalesceMs: &tpuCoalesceMs, + TpuConnectionPoolSize: &tpuConnectionPoolSize, + TpuDisableQuic: &tpuDisableQuic, + TpuEnableUdp: &tpuEnableUdp, + TvuReceiveThreads: &tvuReceiveThreads, + UnifiedSchedulerHandlerThreads: &unifiedSchedulerHandlerThreads, + UseSnapshotArchivesAtStartup: &useSnapshotArchivesAtStartup, + WaitForSupermajority: &waitForSupermajority, + WalRecoveryMode: walRecoveryMode, } - assert.Equal(t, f.ToArgs(), []string{ + expectedArgs := []string{ "--identity", "/home/sol/validator-keypair.json", "--vote-account", "/home/sol/vote-account-keypair.json", + "--log", "/home/sol/log", + "--accounts", "/home/sol/accounts", + "--ledger", "/home/sol/ledger", + "--account-index", "program-id", + "--account-index", "spl-token-owner", + "--account-index-exclude-key", "excludeKey1", + "--account-index-exclude-key", "excludeKey2", + "--account-index-include-key", "includeKey1", + "--account-index-include-key", "includeKey2", + "--account-shrink-path", "/path/to/shrink1", + "--account-shrink-path", "/path/to/shrink2", + "--accounts-db-cache-limit-mb", "1024", + "--accounts-db-test-hash-calculation", + "--accounts-hash-cache-path", "/path/to/accounts_hash_cache", + "--accounts-index-bins", "64", + "--accounts-index-path", "/path/to/accounts_index1", + "--accounts-index-path", "/path/to/accounts_index2", + "--accounts-index-scan-results-limit-mb", "512", + "--accounts-shrink-optimize-total-space", + "--accounts-shrink-ratio", "0.8", + "--allow-private-addr", + "--authorized-voter", "voterPubkey1", + "--authorized-voter", "voterPubkey2", + "--bind-address", "0.0.0.0", + "--block-production-method", "whatever", + "--block-verification-method", "unified-scheduler", + "--check-vote-account", "http://localhost:8899", + "--contact-debug-interval", "120000", + "--cuda", + "--debug-key", "debugKey1", + "--debug-key", "debugKey2", + "--dev-halt-at-slot", "1000000", + "--disable-banking-trace", + "--dynamic-port-range", "8002-8003", + "--enable-banking-trace", "15032385536", + "--enable-bigtable-ledger-upload", + "--enable-extended-tx-metadata-storage", + "--enable-rpc-bigtable-ledger-storage", + "--enable-rpc-transaction-history", "--entrypoint", "hostA", "--entrypoint", "hostB", - "--known-validator", "validatorA", - "--known-validator", "validatorB", + "--etcd-cacert-file", "/path/to/ca.crt", + "--etcd-cert-file", "/path/to/client.crt", + "--etcd-domain-name", "example.com", + "--etcd-endpoint", "etcd1.example.com:2379", + "--etcd-endpoint", "etcd2.example.com:2379", + "--etcd-key-file", "/path/to/client.key", + "--expected-bank-hash", "expectedBankHashValue", "--expected-genesis-hash", "asdkjasldjadk", - "--use-snapshot-archives-at-startup", "whatever", - "--rpc-port", "38", - "--dynamic-port-range", "8002-8003", + "--expected-shred-version", "1234", + "--extra", "--flag", + "--full-rpc-api", + "--full-snapshot-archive-path", "/path/to/full_snapshot", + "--full-snapshot-interval-slots", "1000", + "--geyser-plugin-always-enabled", + "--geyser-plugin-config", "/path/to/geyser_plugin1.yaml", + "--geyser-plugin-config", "/path/to/geyser_plugin2.yaml", "--gossip-host", "somehost", "--gossip-port", "62", - "--rpc-bind-address", "1.2.3.4", - "--wal-recovery-mode", "someaddress", - "--log", "/home/sol/log", - "--accounts", "/home/sol/accounts", - "--ledger", "/home/sol/ledger", + "--gossip-validator", "validatorPubkey1", + "--gossip-validator", "validatorPubkey2", + "--hard-fork", "500000", + "--hard-fork", "1000000", + "--health-check-slot-distance", "128", + "--incremental-snapshot-archive-path", "/path/to/incremental_snapshot", + "--init-complete-file", "/path/to/init_complete", + "--known-validator", "validatorA", + "--known-validator", "validatorB", "--limit-ledger-size", "62", - "--block-production-method", "whatever", - "--tvu-receive-threads", "88", - "--full-snapshot-interval-slots", "1000", - "--only-known-rpc", + "--log-messages-bytes-limit", "1048576", + "--max-genesis-archive-unpacked-size", "10485760", + "--maximum-full-snapshots-to-retain", "2", + "--maximum-incremental-snapshots-to-retain", "4", + "--maximum-local-snapshot-age", "2500", + "--maximum-snapshot-download-abort", "5", + "--minimal-snapshot-download-speed", "10485760", + "--no-genesis-fetch", + "--no-incremental-snapshots", + "--no-snapshot-fetch", "--no-voting", - "--allow-private-addr", - "--extra", - "--flag"}) + "--no-wait-for-vote-to-start-leader", + "--only-known-rpc", + "--private-rpc", + "--public-rpc-address", "0.0.0.0:8899", + "--public-tpu-address", "0.0.0.0:8001", + "--public-tpu-forwards-address", "0.0.0.0:8002", + "--repair-validator", "repairValidator1", + "--repair-validator", "repairValidator2", + "--require-tower", + "--restricted-repair-only-mode", + "--rocksdb-fifo-shred-storage-size", "104857600", + "--rocksdb-shred-compaction", "fifo", + "--rpc-bigtable-app-profile-id", "default", + "--rpc-bigtable-instance-name", "solana-ledger", + "--rpc-bigtable-max-message-size", "67108864", + "--rpc-bigtable-timeout", "30", + "--rpc-bind-address", "1.2.3.4", + "--rpc-faucet-address", "127.0.0.1:9900", + "--rpc-max-multiple-accounts", "100", + "--rpc-max-request-body-size", "51200", + "--rpc-niceness-adjustment", "0", + "--rpc-port", "38", + "--rpc-pubsub-enable-block-subscription", + "--rpc-pubsub-enable-vote-subscription", + "--rpc-pubsub-max-active-subscriptions", "1000000", + "--rpc-pubsub-notification-threads", "4", + "--rpc-pubsub-queue-capacity-bytes", "268435456", + "--rpc-pubsub-queue-capacity-items", "10000000", + "--rpc-pubsub-worker-threads", "4", + "--rpc-scan-and-fix-roots", + "--rpc-send-leader-count", "2", + "--rpc-send-retry-ms", "2000", + "--rpc-send-service-max-retries", "5", + "--rpc-send-transaction-also-leader", + "--rpc-send-transaction-retry-pool-max-size", "10000", + "--rpc-send-transaction-tpu-peer", "peer1:8000", + "--rpc-send-transaction-tpu-peer", "peer2:8000", + "--rpc-threads", "10", + "--skip-preflight-health-check", + "--skip-seed-phrase-validation", + "--skip-startup-ledger-verification", + "--snapshot-archive-format", "zstd", + "--snapshot-interval-slots", "100", + "--snapshot-packager-niceness-adjustment", "0", + "--snapshot-version", "1.2.0", + "--staked-nodes-overrides", "/path/to/staked_nodes_overrides.yaml", + "--tower-storage", "file", + "--tpu-coalesce-ms", "5", + "--tpu-connection-pool-size", "10", + "--tpu-disable-quic", + "--tpu-enable-udp", + "--tvu-receive-threads", "88", + "--unified-scheduler-handler-threads", "2", + "--use-snapshot-archives-at-startup", "whatever", + "--wait-for-supermajority", "1000", + "--wal-recovery-mode", "someaddress", + } + + actualArgs := f.ToArgs() + + assert.Equal(t, expectedArgs, actualArgs) }