Skip to content

Commit

Permalink
Rebase via merge upstream/ethereal-wombat < origin/leanpocketv0
Browse files Browse the repository at this point in the history
  • Loading branch information
poktblade committed Jul 28, 2022
1 parent 601c135 commit 4bfd9d0
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 68 deletions.
17 changes: 2 additions & 15 deletions app/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"io/ioutil"
log2 "log"
"os"
"path"
fp "path/filepath"
"strings"
"sync"
Expand Down Expand Up @@ -48,16 +49,6 @@ import (
"github.com/tendermint/tendermint/rpc/client/local"
dbm "github.com/tendermint/tm-db"
"golang.org/x/crypto/ssh/terminal"
"io"
"io/ioutil"
log2 "log"
"os"
"path"
fp "path/filepath"
"strings"
"sync"
"syscall"
"time"
)

var (
Expand Down Expand Up @@ -88,10 +79,8 @@ func InitApp(datadir, tmNode, persistentPeers, seeds, remoteCLIURL string, keyba
// init config
InitConfig(datadir, tmNode, persistentPeers, seeds, remoteCLIURL)
GlobalConfig.PocketConfig.Cache = useCache

// init AuthToken
InitAuthToken()

InitAuthToken(GlobalConfig.PocketConfig.GenerateTokenOnStart)
// get hosted blockchains
chains := NewHostedChains(false)
if GlobalConfig.PocketConfig.ChainsHotReload {
Expand Down Expand Up @@ -126,13 +115,11 @@ func InitApp(datadir, tmNode, persistentPeers, seeds, remoteCLIURL string, keyba

// init configs & evidence/session caches
InitPocketCoreConfig(chains, logger)

// init genesis
InitGenesis(genesisType, logger)
// log the config and chains
logger.Debug(fmt.Sprintf("Pocket Config: \n%v", GlobalConfig))
// init the tendermint node

return InitTendermint(keybase, chains, logger)
}

Expand Down
110 changes: 57 additions & 53 deletions types/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/tendermint/tendermint/config"
db "github.com/tendermint/tm-db"
"path"

"sync"
"time"
)
Expand All @@ -18,33 +19,34 @@ type SDKConfig struct {
}

type PocketConfig struct {
DataDir string `json:"data_dir"`
GenesisName string `json:"genesis_file"`
ChainsName string `json:"chains_name"`
EvidenceDBName string `json:"evidence_db_name"`
TendermintURI string `json:"tendermint_uri"`
KeybaseName string `json:"keybase_name"`
RPCPort string `json:"rpc_port"`
ClientBlockSyncAllowance int `json:"client_block_sync_allowance"`
MaxEvidenceCacheEntires int `json:"max_evidence_cache_entries"`
MaxSessionCacheEntries int `json:"max_session_cache_entries"`
JSONSortRelayResponses bool `json:"json_sort_relay_responses"`
RemoteCLIURL string `json:"remote_cli_url"`
UserAgent string `json:"user_agent"`
ValidatorCacheSize int64 `json:"validator_cache_size"`
ApplicationCacheSize int64 `json:"application_cache_size"`
RPCTimeout int64 `json:"rpc_timeout"`
PrometheusAddr string `json:"pocket_prometheus_port"`
PrometheusMaxOpenfiles int `json:"prometheus_max_open_files"`
MaxClaimAgeForProofRetry int `json:"max_claim_age_for_proof_retry"`
ProofPrevalidation bool `json:"proof_prevalidation"`
CtxCacheSize int `json:"ctx_cache_size"`
ABCILogging bool `json:"abci_logging"`
RelayErrors bool `json:"show_relay_errors"`
DisableTxEvents bool `json:"disable_tx_events"`
Cache bool `json:"-"`
IavlCacheSize int64 `json:"iavl_cache_size"`
ChainsHotReload bool `json:"chains_hot_reload"`
DataDir string `json:"data_dir"`
GenesisName string `json:"genesis_file"`
ChainsName string `json:"chains_name"`
EvidenceDBName string `json:"evidence_db_name"`
TendermintURI string `json:"tendermint_uri"`
KeybaseName string `json:"keybase_name"`
RPCPort string `json:"rpc_port"`
ClientBlockSyncAllowance int `json:"client_block_sync_allowance"`
MaxEvidenceCacheEntires int `json:"max_evidence_cache_entries"`
MaxSessionCacheEntries int `json:"max_session_cache_entries"`
JSONSortRelayResponses bool `json:"json_sort_relay_responses"`
RemoteCLIURL string `json:"remote_cli_url"`
UserAgent string `json:"user_agent"`
ValidatorCacheSize int64 `json:"validator_cache_size"`
ApplicationCacheSize int64 `json:"application_cache_size"`
RPCTimeout int64 `json:"rpc_timeout"`
PrometheusAddr string `json:"pocket_prometheus_port"`
PrometheusMaxOpenfiles int `json:"prometheus_max_open_files"`
MaxClaimAgeForProofRetry int `json:"max_claim_age_for_proof_retry"`
ProofPrevalidation bool `json:"proof_prevalidation"`
CtxCacheSize int `json:"ctx_cache_size"`
ABCILogging bool `json:"abci_logging"`
RelayErrors bool `json:"show_relay_errors"`
DisableTxEvents bool `json:"disable_tx_events"`
Cache bool `json:"-"`
IavlCacheSize int64 `json:"iavl_cache_size"`
ChainsHotReload bool `json:"chains_hot_reload"`
GenerateTokenOnStart bool `json:"generate_token_on_start"`
LeanPocket bool `json:"lean_pocket"`
LeanPocketUserKeyFileName string `json:"lean_pocket_user_key_file"`
}
Expand Down Expand Up @@ -107,6 +109,7 @@ const (
AuthFileName = "auth.json"
DefaultIavlCacheSize = 5000000
DefaultChainHotReload = false
DefaultGenerateTokenOnStart = true
DefaultLeanPocket = false
DefaultLeanPocketUserKeyFileName = "lean_nodes_keys.json"
)
Expand All @@ -115,32 +118,33 @@ func DefaultConfig(dataDir string) Config {
c := Config{
TendermintConfig: *config.DefaultConfig(),
PocketConfig: PocketConfig{
DataDir: dataDir,
GenesisName: DefaultGenesisName,
ChainsName: DefaultChainsName,
EvidenceDBName: DefaultEvidenceDBName,
TendermintURI: DefaultTMURI,
KeybaseName: DefaultKeybaseName,
RPCPort: DefaultRPCPort,
ClientBlockSyncAllowance: DefaultClientBlockSyncAllowance,
MaxEvidenceCacheEntires: DefaultMaxEvidenceCacheEntries,
MaxSessionCacheEntries: DefaultMaxSessionCacheEntries,
JSONSortRelayResponses: DefaultJSONSortRelayResponses,
RemoteCLIURL: DefaultRemoteCLIURL,
UserAgent: DefaultUserAgent,
ValidatorCacheSize: DefaultValidatorCacheSize,
ApplicationCacheSize: DefaultApplicationCacheSize,
RPCTimeout: DefaultRPCTimeout,
PrometheusAddr: DefaultPocketPrometheusListenAddr,
PrometheusMaxOpenfiles: DefaultPrometheusMaxOpenFile,
MaxClaimAgeForProofRetry: DefaultMaxClaimProofRetryAge,
ProofPrevalidation: DefaultProofPrevalidation,
CtxCacheSize: DefaultCtxCacheSize,
ABCILogging: DefaultABCILogging,
RelayErrors: DefaultRelayErrors,
DisableTxEvents: DefaultRPCDisableTransactionEvents,
IavlCacheSize: DefaultIavlCacheSize,
ChainsHotReload: DefaultChainHotReload,
DataDir: dataDir,
GenesisName: DefaultGenesisName,
ChainsName: DefaultChainsName,
EvidenceDBName: DefaultEvidenceDBName,
TendermintURI: DefaultTMURI,
KeybaseName: DefaultKeybaseName,
RPCPort: DefaultRPCPort,
ClientBlockSyncAllowance: DefaultClientBlockSyncAllowance,
MaxEvidenceCacheEntires: DefaultMaxEvidenceCacheEntries,
MaxSessionCacheEntries: DefaultMaxSessionCacheEntries,
JSONSortRelayResponses: DefaultJSONSortRelayResponses,
RemoteCLIURL: DefaultRemoteCLIURL,
UserAgent: DefaultUserAgent,
ValidatorCacheSize: DefaultValidatorCacheSize,
ApplicationCacheSize: DefaultApplicationCacheSize,
RPCTimeout: DefaultRPCTimeout,
PrometheusAddr: DefaultPocketPrometheusListenAddr,
PrometheusMaxOpenfiles: DefaultPrometheusMaxOpenFile,
MaxClaimAgeForProofRetry: DefaultMaxClaimProofRetryAge,
ProofPrevalidation: DefaultProofPrevalidation,
CtxCacheSize: DefaultCtxCacheSize,
ABCILogging: DefaultABCILogging,
RelayErrors: DefaultRelayErrors,
DisableTxEvents: DefaultRPCDisableTransactionEvents,
IavlCacheSize: DefaultIavlCacheSize,
ChainsHotReload: DefaultChainHotReload,
GenerateTokenOnStart: DefaultGenerateTokenOnStart,
LeanPocket: DefaultLeanPocket,
LeanPocketUserKeyFileName: DefaultLeanPocketUserKeyFileName,
},
Expand Down

0 comments on commit 4bfd9d0

Please sign in to comment.