From 7ea6e35431ea8ebe3314ac0ef23b9a61e5d05eeb Mon Sep 17 00:00:00 2001 From: egonspace Date: Thu, 8 Jul 2021 10:36:09 +0900 Subject: [PATCH] chore: rename tendermint to ostracon --- .github/ISSUE_TEMPLATE/feature-request.md | 2 +- .github/auto-comment.yml | 2 +- .github/workflows/lint.yaml | 2 +- .github/workflows/proto-docker.yml | 2 +- DOCKER/Dockerfile | 8 ++-- DOCKER/docker-entrypoint.sh | 8 ++-- abci/cmd/abci-cli/abci-cli.go | 6 +-- abci/tests/test_app/app.go | 2 +- abci/types/application.go | 2 +- cmd/ostracon/commands/debug/debug.go | 2 +- cmd/ostracon/commands/light.go | 2 +- cmd/ostracon/commands/root.go | 4 +- cmd/ostracon/commands/root_test.go | 16 +++---- cmd/ostracon/main.go | 2 +- cmd/priv_val_server/main.go | 2 +- config/config.go | 34 +++++++-------- config/toml.go | 16 +++---- consensus/reactor.go | 18 ++++---- consensus/replay.go | 12 +++--- consensus/replay_test.go | 10 ++--- consensus/state.go | 2 +- consensus/wal.go | 6 +-- crypto/doc.go | 4 +- crypto/ed25519/ed25519.go | 2 +- crypto/example_test.go | 2 +- crypto/merkle/proof_value.go | 2 +- libs/cli/flags/log_level.go | 2 +- libs/cli/flags/log_level_test.go | 2 +- libs/cli/setup.go | 4 +- libs/log/filter_test.go | 6 +-- libs/log/logger.go | 2 +- libs/log/testing_logger.go | 4 +- libs/log/tm_json_logger.go | 8 ++-- libs/log/tm_logger.go | 10 ++--- libs/log/tm_logger_test.go | 12 +++--- libs/log/tmfmt_logger.go | 4 +- libs/log/tracing_logger_test.go | 2 +- light/detector_test.go | 4 +- light/doc.go | 10 ++--- light/example_test.go | 8 ++-- light/provider/http/http_test.go | 4 +- mempool/errors.go | 2 +- networks/local/localnode/wrapper.sh | 6 +-- node/node.go | 10 ++--- p2p/netaddress.go | 2 +- p2p/node_info.go | 2 +- p2p/upnp/probe.go | 2 +- proto/ostracon/crypto/keys.pb.go | 2 +- proto/ostracon/crypto/keys.proto | 2 +- proto/ostracon/types/types.pb.go | 2 +- proto/ostracon/types/types.proto | 2 +- proxy/multi_app_conn.go | 10 ++--- proxy/version.go | 2 +- rpc/client/examples_test.go | 8 ++-- rpc/client/helpers.go | 4 +- rpc/client/http/http.go | 14 +++---- rpc/client/interface.go | 2 +- rpc/client/local/local.go | 6 +-- rpc/client/main_test.go | 4 +- rpc/core/events.go | 4 +- rpc/core/mempool.go | 4 +- rpc/core/status.go | 2 +- rpc/core/types/responses.go | 2 +- rpc/grpc/grpc_test.go | 4 +- rpc/jsonrpc/client/integration_test.go | 2 +- rpc/jsonrpc/doc.go | 2 +- rpc/jsonrpc/jsonrpc_test.go | 2 +- rpc/jsonrpc/server/http_json_handler_test.go | 2 +- rpc/jsonrpc/server/ws_handler.go | 2 +- rpc/jsonrpc/test/main.go | 2 +- rpc/openapi/openapi.yaml | 2 +- rpc/test/helpers.go | 22 +++++----- scripts/json2wal/main.go | 2 +- state/execution.go | 4 +- state/execution_test.go | 2 +- state/mocks/store.go | 40 +++++++++--------- state/state.go | 4 +- state/state_test.go | 36 ++++++++-------- state/store.go | 2 +- statesync/syncer_test.go | 2 +- store/store_test.go | 10 ++--- test/app/test.sh | 12 +++--- test/e2e/README.md | 2 +- test/e2e/app/app.go | 2 +- test/e2e/app/main.go | 18 ++++---- test/e2e/docker/Dockerfile | 2 +- test/e2e/generator/main.go | 2 +- test/e2e/pkg/manifest.go | 4 +- test/e2e/pkg/testnet.go | 2 +- test/e2e/runner/cleanup.go | 2 +- test/e2e/runner/main.go | 2 +- test/e2e/runner/setup.go | 8 ++-- test/fuzz/README.md | 2 +- .../p2p/secret_connection/init-corpus/main.go | 2 +- test/fuzz/rpc/jsonrpc/server/handler.go | 2 +- test/maverick/README.md | 4 +- test/maverick/consensus/reactor.go | 18 ++++---- test/maverick/consensus/replay.go | 12 +++--- test/maverick/consensus/state.go | 2 +- test/maverick/consensus/wal.go | 6 +-- test/maverick/main.go | 14 +++---- test/maverick/node/node.go | 10 ++--- tools/README.md | 2 +- tools/mintnet-kubernetes/README.rst | 6 +-- tools/mintnet-kubernetes/app.template.yaml | 2 +- .../examples/counter/app.yaml | 2 +- .../examples/dummy/app.yaml | 2 +- .../internal/test_harness.go | 6 +-- tools/tm-signer-harness/main.go | 42 +++++++++---------- types/block.go | 4 +- types/event_bus.go | 2 +- types/events.go | 24 +++++------ types/evidence.go | 4 +- types/priv_validator.go | 2 +- types/protobuf.go | 6 +-- types/protobuf_test.go | 4 +- types/tx.go | 2 +- version/version.go | 8 ++-- 118 files changed, 367 insertions(+), 367 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md index 62c3e4f3a..7f9d6f651 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.md +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -19,7 +19,7 @@ v without deliberation ## Proposal diff --git a/.github/auto-comment.yml b/.github/auto-comment.yml index 604c2f878..97b9a6adf 100644 --- a/.github/auto-comment.yml +++ b/.github/auto-comment.yml @@ -13,4 +13,4 @@ pullRequestOpened: | - [ ] Applied Appropriate Labels - Thank you for your contribution to Tendermint! :rocket: \ No newline at end of file + Thank you for your contribution to Ostracon! :rocket: \ No newline at end of file diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index b12d9a693..55e42cfd9 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -1,5 +1,5 @@ name: Lint -# Lint runs golangci-lint over the entire Tendermint repository +# Lint runs golangci-lint over the entire Ostracon repository # This workflow is run on every pull request and push to master # The `golangci` job will pass without running if no *.{go, mod, sum} files have been modified. on: diff --git a/.github/workflows/proto-docker.yml b/.github/workflows/proto-docker.yml index 72b4e671b..8f9c4e7eb 100644 --- a/.github/workflows/proto-docker.yml +++ b/.github/workflows/proto-docker.yml @@ -1,4 +1,4 @@ -name: Build & Push TM Proto Builder +name: Build & Push OC Proto Builder on: pull_request: paths: diff --git a/DOCKER/Dockerfile b/DOCKER/Dockerfile index f2e39afbc..8e9b2065f 100644 --- a/DOCKER/Dockerfile +++ b/DOCKER/Dockerfile @@ -16,7 +16,7 @@ LABEL maintainer="hello@blockchain.line.me" # private validator file into /ostracon/config. # # The /ostracon/data dir is used by ostracon to store state. -ENV TMHOME /ostracon +ENV OCHOME /ostracon # OS environment setup # Set user right away for determinism, create directory for persistence and give our user ownership @@ -27,12 +27,12 @@ RUN apk update && \ apk upgrade && \ apk add --no-cache git make gcc libc-dev build-base curl jq bash file gmp-dev clang && \ addgroup ostracon && \ - adduser -S -G ostracon ostracon -h "$TMHOME" + adduser -S -G ostracon ostracon -h "$OCHOME" # Run the container with ostracon by default. (UID=100, GID=1000) USER ostracon -WORKDIR $TMHOME +WORKDIR $OCHOME # p2p, rpc and prometheus port EXPOSE 26656 26657 26660 @@ -52,5 +52,5 @@ ENTRYPOINT ["docker-entrypoint.sh"] CMD ["node"] # Expose the data directory as a volume since there's mutable state in there -VOLUME [ "$TMHOME" ] +VOLUME [ "$OCHOME" ] diff --git a/DOCKER/docker-entrypoint.sh b/DOCKER/docker-entrypoint.sh index 0d705475c..3b0cfa3e8 100755 --- a/DOCKER/docker-entrypoint.sh +++ b/DOCKER/docker-entrypoint.sh @@ -1,7 +1,7 @@ #!/bin/bash set -e -if [ ! -d "$TMHOME/config" ]; then +if [ ! -d "$OCHOME/config" ]; then echo "Running ostracon init to create (default) configuration for docker run." ostracon init @@ -13,11 +13,11 @@ if [ ! -d "$TMHOME/config" ]; then -e 's/^index_all_tags\s*=.*/index_all_tags = true/' \ -e 's,^laddr = "tcp://127.0.0.1:26657",laddr = "tcp://0.0.0.0:26657",' \ -e 's/^prometheus\s*=.*/prometheus = true/' \ - "$TMHOME/config/config.toml" + "$OCHOME/config/config.toml" jq ".chain_id = \"$CHAIN_ID\" | .consensus_params.block.time_iota_ms = \"500\"" \ - "$TMHOME/config/genesis.json" > "$TMHOME/config/genesis.json.new" - mv "$TMHOME/config/genesis.json.new" "$TMHOME/config/genesis.json" + "$OCHOME/config/genesis.json" > "$OCHOME/config/genesis.json.new" + mv "$OCHOME/config/genesis.json.new" "$OCHOME/config/genesis.json" fi exec ostracon "$@" diff --git a/abci/cmd/abci-cli/abci-cli.go b/abci/cmd/abci-cli/abci-cli.go index fbad683e7..d00b82995 100644 --- a/abci/cmd/abci-cli/abci-cli.go +++ b/abci/cmd/abci-cli/abci-cli.go @@ -69,7 +69,7 @@ var RootCmd = &cobra.Command{ if err != nil { return err } - logger = log.NewFilter(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), allowLevel) + logger = log.NewFilter(log.NewOCLogger(log.NewSyncWriter(os.Stdout)), allowLevel) } if client == nil { var err error @@ -627,7 +627,7 @@ func cmdQuery(cmd *cobra.Command, args []string) error { func cmdCounter(cmd *cobra.Command, args []string) error { app := counter.NewApplication(flagSerial) - logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout)) + logger := log.NewOCLogger(log.NewSyncWriter(os.Stdout)) // Start the listener srv, err := server.NewServer(flagAddress, flagAbci, app) @@ -652,7 +652,7 @@ func cmdCounter(cmd *cobra.Command, args []string) error { } func cmdKVStore(cmd *cobra.Command, args []string) error { - logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout)) + logger := log.NewOCLogger(log.NewSyncWriter(os.Stdout)) // Create the application - in memory or persisted to disk var app types.Application diff --git a/abci/tests/test_app/app.go b/abci/tests/test_app/app.go index 27931c830..946096f0e 100644 --- a/abci/tests/test_app/app.go +++ b/abci/tests/test_app/app.go @@ -16,7 +16,7 @@ func startClient(abciType string) abcicli.Client { if err != nil { panic(err.Error()) } - logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout)) + logger := log.NewOCLogger(log.NewSyncWriter(os.Stdout)) client.SetLogger(logger.With("module", "abcicli")) if err := client.Start(); err != nil { panicf("connecting to abci_app: %v", err.Error()) diff --git a/abci/types/application.go b/abci/types/application.go index 9d93f8e2a..a0a17ee61 100644 --- a/abci/types/application.go +++ b/abci/types/application.go @@ -20,7 +20,7 @@ type Application interface { EndRecheckTx(RequestEndRecheckTx) ResponseEndRecheckTx // Signals the end of rechecking // Consensus Connection - InitChain(RequestInitChain) ResponseInitChain // Initialize blockchain w validators/other info from TendermintCore + InitChain(RequestInitChain) ResponseInitChain // Initialize blockchain w validators/other info from OstraconCore BeginBlock(RequestBeginBlock) ResponseBeginBlock // Signals the beginning of a block DeliverTx(RequestDeliverTx) ResponseDeliverTx // Deliver a tx for full processing EndBlock(RequestEndBlock) ResponseEndBlock // Signals the end of a block, returns changes to the validator set diff --git a/cmd/ostracon/commands/debug/debug.go b/cmd/ostracon/commands/debug/debug.go index 187b2a600..d421438ad 100644 --- a/cmd/ostracon/commands/debug/debug.go +++ b/cmd/ostracon/commands/debug/debug.go @@ -17,7 +17,7 @@ var ( flagProfAddr = "pprof-laddr" flagFrequency = "frequency" - logger = log.NewTMLogger(log.NewSyncWriter(os.Stdout)) + logger = log.NewOCLogger(log.NewSyncWriter(os.Stdout)) ) // DebugCmd defines the root command containing subcommands that assist in diff --git a/cmd/ostracon/commands/light.go b/cmd/ostracon/commands/light.go index a65869dda..14cf6fd71 100644 --- a/cmd/ostracon/commands/light.go +++ b/cmd/ostracon/commands/light.go @@ -106,7 +106,7 @@ func init() { func runProxy(cmd *cobra.Command, args []string) error { // Initialise logger. - logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout)) + logger := log.NewOCLogger(log.NewSyncWriter(os.Stdout)) var option log.Option if verbose { option, _ = log.AllowLevel("debug") diff --git a/cmd/ostracon/commands/root.go b/cmd/ostracon/commands/root.go index 7b08e273a..c585e6891 100644 --- a/cmd/ostracon/commands/root.go +++ b/cmd/ostracon/commands/root.go @@ -16,7 +16,7 @@ import ( var ( config = cfg.DefaultConfig() - logger = log.NewTMLogger(log.NewSyncWriter(os.Stdout)) + logger = log.NewOCLogger(log.NewSyncWriter(os.Stdout)) ) func init() { @@ -58,7 +58,7 @@ var RootCmd = &cobra.Command{ } if config.LogFormat == cfg.LogFormatJSON { - logger = log.NewTMJSONLogger(log.NewSyncWriter(os.Stdout)) + logger = log.NewOCJSONLogger(log.NewSyncWriter(os.Stdout)) } logger, err = tmflags.ParseLogLevel(config.LogLevel, logger, cfg.DefaultLogLevel) diff --git a/cmd/ostracon/commands/root_test.go b/cmd/ostracon/commands/root_test.go index b040d4924..a91540b39 100644 --- a/cmd/ostracon/commands/root_test.go +++ b/cmd/ostracon/commands/root_test.go @@ -24,10 +24,10 @@ var ( // clearConfig clears env vars, the given root dir, and resets viper. func clearConfig(dir string) { - if err := os.Unsetenv("TMHOME"); err != nil { + if err := os.Unsetenv("OCHOME"); err != nil { panic(err) } - if err := os.Unsetenv("TM_HOME"); err != nil { + if err := os.Unsetenv("OC_HOME"); err != nil { panic(err) } @@ -55,7 +55,7 @@ func testSetup(rootDir string, args []string, env map[string]string) error { clearConfig(defaultRoot) rootCmd := testRootCmd() - cmd := cli.PrepareBaseCmd(rootCmd, "TM", defaultRoot) + cmd := cli.PrepareBaseCmd(rootCmd, "OC", defaultRoot) // run with the args and env args = append([]string{rootCmd.Use}, args...) @@ -71,7 +71,7 @@ func TestRootHome(t *testing.T) { }{ {nil, nil, defaultRoot}, {[]string{"--home", newRoot}, nil, newRoot}, - {nil, map[string]string{"TMHOME": newRoot}, newRoot}, + {nil, map[string]string{"OCHOME": newRoot}, newRoot}, } for i, tc := range cases { @@ -100,9 +100,9 @@ func TestRootFlagsEnv(t *testing.T) { }{ {[]string{"--log", "debug"}, nil, defaultLogLvl}, // wrong flag {[]string{"--log_level", "debug"}, nil, "debug"}, // right flag - {nil, map[string]string{"TM_LOW": "debug"}, defaultLogLvl}, // wrong env flag + {nil, map[string]string{"OC_LOW": "debug"}, defaultLogLvl}, // wrong env flag {nil, map[string]string{"MT_LOG_LEVEL": "debug"}, defaultLogLvl}, // wrong env prefix - {nil, map[string]string{"TM_LOG_LEVEL": "debug"}, "debug"}, // right env + {nil, map[string]string{"OC_LOG_LEVEL": "debug"}, "debug"}, // right env } for i, tc := range cases { @@ -131,7 +131,7 @@ func TestRootConfig(t *testing.T) { }{ {nil, nil, nonDefaultLogLvl}, // should load config {[]string{"--log_level=abc:info"}, nil, "abc:info"}, // flag over rides - {nil, map[string]string{"TM_LOG_LEVEL": "abc:info"}, "abc:info"}, // env over rides + {nil, map[string]string{"OC_LOG_LEVEL": "abc:info"}, "abc:info"}, // env over rides } for i, tc := range cases { @@ -149,7 +149,7 @@ func TestRootConfig(t *testing.T) { require.Nil(t, err) rootCmd := testRootCmd() - cmd := cli.PrepareBaseCmd(rootCmd, "TM", defaultRoot) + cmd := cli.PrepareBaseCmd(rootCmd, "OC", defaultRoot) // run with the args and env tc.args = append([]string{rootCmd.Use}, tc.args...) diff --git a/cmd/ostracon/main.go b/cmd/ostracon/main.go index d1ed360ae..17736aaf6 100644 --- a/cmd/ostracon/main.go +++ b/cmd/ostracon/main.go @@ -44,7 +44,7 @@ func main() { rootCmd.AddCommand(cmd.NewInitCmd()) rootCmd.AddCommand(cmd.NewRunNodeCmd(nodeFunc)) - cmd := cli.PrepareBaseCmd(rootCmd, "TM", os.ExpandEnv(filepath.Join("$HOME", cfg.DefaultOstraconDir))) + cmd := cli.PrepareBaseCmd(rootCmd, "OC", os.ExpandEnv(filepath.Join("$HOME", cfg.DefaultOstraconDir))) if err := cmd.Execute(); err != nil { panic(err) } diff --git a/cmd/priv_val_server/main.go b/cmd/priv_val_server/main.go index ad48b28f9..3aa99e52a 100644 --- a/cmd/priv_val_server/main.go +++ b/cmd/priv_val_server/main.go @@ -20,7 +20,7 @@ func main() { privValKeyPath = flag.String("priv-key", "", "priv val key file path") privValStatePath = flag.String("priv-state", "", "priv val state file path") - logger = log.NewTMLogger( + logger = log.NewOCLogger( log.NewSyncWriter(os.Stdout), ).With("module", "priv_val") ) diff --git a/config/config.go b/config/config.go index 82fef6795..ad1a84adb 100644 --- a/config/config.go +++ b/config/config.go @@ -59,7 +59,7 @@ var ( defaultAddrBookPath = filepath.Join(defaultConfigDir, defaultAddrBookName) ) -// Config defines the top level configuration for a Tendermint node +// Config defines the top level configuration for a Ostracon node type Config struct { // Top level options use an anonymous struct BaseConfig `mapstructure:",squash"` @@ -75,7 +75,7 @@ type Config struct { Instrumentation *InstrumentationConfig `mapstructure:"instrumentation"` } -// DefaultConfig returns a default configuration for a Tendermint node +// DefaultConfig returns a default configuration for a Ostracon node func DefaultConfig() *Config { return &Config{ BaseConfig: DefaultBaseConfig(), @@ -148,7 +148,7 @@ func (cfg *Config) ValidateBasic() error { //----------------------------------------------------------------------------- // BaseConfig -// BaseConfig defines the base configuration for a Tendermint node +// BaseConfig defines the base configuration for a Ostracon node type BaseConfig struct { //nolint: maligned // chainID is unexposed and immutable but here for convenience chainID string @@ -158,7 +158,7 @@ type BaseConfig struct { //nolint: maligned RootDir string `mapstructure:"home"` // TCP or UNIX socket address of the ABCI application, - // or the name of an ABCI application compiled in with the Tendermint binary + // or the name of an ABCI application compiled in with the Ostracon binary ProxyApp string `mapstructure:"proxy_app"` // A custom human readable name for this node @@ -208,7 +208,7 @@ type BaseConfig struct { //nolint: maligned // Path to the JSON file containing the last sign state of a validator PrivValidatorState string `mapstructure:"priv_validator_state_file"` - // TCP or UNIX socket address for Tendermint to listen on for + // TCP or UNIX socket address for Ostracon to listen on for // connections from an external PrivValidator process PrivValidatorListenAddr string `mapstructure:"priv_validator_laddr"` @@ -311,7 +311,7 @@ func (cfg BaseConfig) ValidateBasic() error { //----------------------------------------------------------------------------- // RPCConfig -// RPCConfig defines the configuration options for the Tendermint RPC server +// RPCConfig defines the configuration options for the Ostracon RPC server type RPCConfig struct { RootDir string `mapstructure:"home"` @@ -400,20 +400,20 @@ type RPCConfig struct { MaxHeaderBytes int `mapstructure:"max_header_bytes"` // The path to a file containing certificate that is used to create the HTTPS server. - // Might be either absolute path or path related to Tendermint's config directory. + // Might be either absolute path or path related to Ostracon's config directory. // // If the certificate is signed by a certificate authority, // the certFile should be the concatenation of the server's certificate, any intermediates, // and the CA's certificate. // - // NOTE: both tls_cert_file and tls_key_file must be present for Tendermint to create HTTPS server. + // NOTE: both tls_cert_file and tls_key_file must be present for Ostracon to create HTTPS server. // Otherwise, HTTP server is run. TLSCertFile string `mapstructure:"tls_cert_file"` // The path to a file containing matching private key that is used to create the HTTPS server. - // Might be either absolute path or path related to tendermint's config directory. + // Might be either absolute path or path related to ostracon's config directory. // - // NOTE: both tls_cert_file and tls_key_file must be present for Tendermint to create HTTPS server. + // NOTE: both tls_cert_file and tls_key_file must be present for Ostracon to create HTTPS server. // Otherwise, HTTP server is run. TLSKeyFile string `mapstructure:"tls_key_file"` @@ -522,7 +522,7 @@ func (cfg RPCConfig) IsTLSEnabled() bool { //----------------------------------------------------------------------------- // P2PConfig -// P2PConfig defines the configuration options for the Tendermint peer-to-peer networking layer +// P2PConfig defines the configuration options for the Ostracon peer-to-peer networking layer type P2PConfig struct { //nolint: maligned RootDir string `mapstructure:"home"` @@ -707,7 +707,7 @@ func DefaultFuzzConnConfig() *FuzzConnConfig { //----------------------------------------------------------------------------- // MempoolConfig -// MempoolConfig defines the configuration options for the Tendermint mempool +// MempoolConfig defines the configuration options for the Ostracon mempool type MempoolConfig struct { RootDir string `mapstructure:"home"` Recheck bool `mapstructure:"recheck"` @@ -734,7 +734,7 @@ type MempoolConfig struct { MaxBatchBytes int `mapstructure:"max_batch_bytes"` } -// DefaultMempoolConfig returns a default configuration for the Tendermint mempool +// DefaultMempoolConfig returns a default configuration for the Ostracon mempool func DefaultMempoolConfig() *MempoolConfig { return &MempoolConfig{ Recheck: true, @@ -749,7 +749,7 @@ func DefaultMempoolConfig() *MempoolConfig { } } -// TestMempoolConfig returns a configuration for testing the Tendermint mempool +// TestMempoolConfig returns a configuration for testing the Ostracon mempool func TestMempoolConfig() *MempoolConfig { cfg := DefaultMempoolConfig() cfg.CacheSize = 1000 @@ -787,7 +787,7 @@ func (cfg *MempoolConfig) ValidateBasic() error { //----------------------------------------------------------------------------- // StateSyncConfig -// StateSyncConfig defines the configuration for the Tendermint state sync service +// StateSyncConfig defines the configuration for the Ostracon state sync service type StateSyncConfig struct { Enable bool `mapstructure:"enable"` TempDir string `mapstructure:"temp_dir"` @@ -854,7 +854,7 @@ func (cfg *StateSyncConfig) ValidateBasic() error { //----------------------------------------------------------------------------- // FastSyncConfig -// FastSyncConfig defines the configuration for the Tendermint fast sync service +// FastSyncConfig defines the configuration for the Ostracon fast sync service type FastSyncConfig struct { Version string `mapstructure:"version"` } @@ -888,7 +888,7 @@ func (cfg *FastSyncConfig) ValidateBasic() error { //----------------------------------------------------------------------------- // ConsensusConfig -// ConsensusConfig defines the configuration for the Tendermint consensus service, +// ConsensusConfig defines the configuration for the Ostracon consensus service, // including timeouts and details about the WAL and the block structure. type ConsensusConfig struct { RootDir string `mapstructure:"home"` diff --git a/config/toml.go b/config/toml.go index efdf004f2..fc59b041e 100644 --- a/config/toml.go +++ b/config/toml.go @@ -49,7 +49,7 @@ func EnsureRoot(rootDir string) { } } -// XXX: this func should probably be called by cmd/tendermint/commands/init.go +// XXX: this func should probably be called by cmd/ostracon/commands/init.go // alongside the writing of the genesis.json and priv_validator.json func writeDefaultConfigFile(configFilePath string) { WriteConfigFile(configFilePath, DefaultConfig()) @@ -73,7 +73,7 @@ const defaultConfigTemplate = `# This is a TOML config file. # NOTE: Any path below can be absolute (e.g. "/var/myawesomeapp/data") or # relative to the home directory (e.g. "data"). The home directory is -# "$HOME/.ostracon" by default, but could be changed via $TMHOME env variable +# "$HOME/.ostracon" by default, but could be changed via $OCHOME env variable # or --home cmd flag. ####################################################################### @@ -81,7 +81,7 @@ const defaultConfigTemplate = `# This is a TOML config file. ####################################################################### # TCP or UNIX socket address of the ABCI application, -# or the name of an ABCI application compiled in with the Tendermint binary +# or the name of an ABCI application compiled in with the Ostracon binary proxy_app = "{{ .BaseConfig.ProxyApp }}" # A custom human readable name for this node @@ -133,7 +133,7 @@ priv_validator_key_file = "{{ js .BaseConfig.PrivValidatorKey }}" # Path to the JSON file containing the last sign state of a validator priv_validator_state_file = "{{ js .BaseConfig.PrivValidatorState }}" -# TCP or UNIX socket address for Tendermint to listen on for +# TCP or UNIX socket address for Ostracon to listen on for # connections from an external PrivValidator process priv_validator_laddr = "{{ .BaseConfig.PrivValidatorListenAddr }}" @@ -242,17 +242,17 @@ max_body_bytes = {{ .RPC.MaxBodyBytes }} max_header_bytes = {{ .RPC.MaxHeaderBytes }} # The path to a file containing certificate that is used to create the HTTPS server. -# Might be either absolute path or path related to Tendermint's config directory. +# Might be either absolute path or path related to Ostracon's config directory. # If the certificate is signed by a certificate authority, # the certFile should be the concatenation of the server's certificate, any intermediates, # and the CA's certificate. -# NOTE: both tls_cert_file and tls_key_file must be present for Tendermint to create HTTPS server. +# NOTE: both tls_cert_file and tls_key_file must be present for Ostracon to create HTTPS server. # Otherwise, HTTP server is run. tls_cert_file = "{{ .RPC.TLSCertFile }}" # The path to a file containing matching private key that is used to create the HTTPS server. -# Might be either absolute path or path related to Tendermint's config directory. -# NOTE: both tls-cert-file and tls-key-file must be present for Tendermint to create HTTPS server. +# Might be either absolute path or path related to Ostracon's config directory. +# NOTE: both tls-cert-file and tls-key-file must be present for Ostracon to create HTTPS server. # Otherwise, HTTP server is run. tls_key_file = "{{ .RPC.TLSKeyFile }}" diff --git a/consensus/reactor.go b/consensus/reactor.go index ebeba635d..6cfc62e9b 100644 --- a/consensus/reactor.go +++ b/consensus/reactor.go @@ -1414,15 +1414,15 @@ type Message interface { } func init() { - tmjson.RegisterType(&NewRoundStepMessage{}, "tendermint/NewRoundStepMessage") - tmjson.RegisterType(&NewValidBlockMessage{}, "tendermint/NewValidBlockMessage") - tmjson.RegisterType(&ProposalMessage{}, "tendermint/Proposal") - tmjson.RegisterType(&ProposalPOLMessage{}, "tendermint/ProposalPOL") - tmjson.RegisterType(&BlockPartMessage{}, "tendermint/BlockPart") - tmjson.RegisterType(&VoteMessage{}, "tendermint/Vote") - tmjson.RegisterType(&HasVoteMessage{}, "tendermint/HasVote") - tmjson.RegisterType(&VoteSetMaj23Message{}, "tendermint/VoteSetMaj23") - tmjson.RegisterType(&VoteSetBitsMessage{}, "tendermint/VoteSetBits") + tmjson.RegisterType(&NewRoundStepMessage{}, "ostracon/NewRoundStepMessage") + tmjson.RegisterType(&NewValidBlockMessage{}, "ostracon/NewValidBlockMessage") + tmjson.RegisterType(&ProposalMessage{}, "ostracon/Proposal") + tmjson.RegisterType(&ProposalPOLMessage{}, "ostracon/ProposalPOL") + tmjson.RegisterType(&BlockPartMessage{}, "ostracon/BlockPart") + tmjson.RegisterType(&VoteMessage{}, "ostracon/Vote") + tmjson.RegisterType(&HasVoteMessage{}, "ostracon/HasVote") + tmjson.RegisterType(&VoteSetMaj23Message{}, "ostracon/VoteSetMaj23") + tmjson.RegisterType(&VoteSetBitsMessage{}, "ostracon/VoteSetBits") } func decodeMsg(bz []byte) (msg Message, err error) { diff --git a/consensus/replay.go b/consensus/replay.go index dba6023cb..4e6271abf 100644 --- a/consensus/replay.go +++ b/consensus/replay.go @@ -270,7 +270,7 @@ func (h *Handshaker) Handshake(proxyApp proxy.AppConns) error { return fmt.Errorf("error on replay: %v", err) } - h.logger.Info("Completed ABCI Handshake - Tendermint and App are synced", + h.logger.Info("Completed ABCI Handshake - Ostracon and App are synced", "appHeight", blockHeight, "appHash", appHash) // TODO: (on restart) replay mempool @@ -332,7 +332,7 @@ func (h *Handshaker) ReplayBlocks( } // If the app returned validators or consensus params, update the state. if len(res.Validators) > 0 { - vals, err := types.PB2TM.ValidatorUpdates(res.Validators) + vals, err := types.PB2OC.ValidatorUpdates(res.Validators) if err != nil { return nil, err } @@ -376,11 +376,11 @@ func (h *Handshaker) ReplayBlocks( return appHash, sm.ErrAppBlockHeightTooHigh{CoreHeight: storeBlockHeight, AppHeight: appBlockHeight} case storeBlockHeight < stateBlockHeight: - // the state should never be ahead of the store (this is under tendermint's control) + // the state should never be ahead of the store (this is under ostracon's control) panic(fmt.Sprintf("StateBlockHeight (%d) > StoreBlockHeight (%d)", stateBlockHeight, storeBlockHeight)) case storeBlockHeight > stateBlockHeight+1: - // store should be at most one ahead of the state (this is under tendermint's control) + // store should be at most one ahead of the state (this is under ostracon's control) panic(fmt.Sprintf("StoreBlockHeight (%d) > StateBlockHeight + 1 (%d)", storeBlockHeight, stateBlockHeight+1)) } @@ -388,7 +388,7 @@ func (h *Handshaker) ReplayBlocks( // Now either store is equal to state, or one ahead. // For each, consider all cases of where the app could be, given app <= store if storeBlockHeight == stateBlockHeight { - // Tendermint ran Commit and saved the state. + // Ostracon ran Commit and saved the state. // Either the app is asking for replay, or we're all synced up. if appBlockHeight < storeBlockHeight { // the app is behind, so replay blocks, but no need to go through WAL (state is already synced to store) @@ -529,7 +529,7 @@ func assertAppHashEqualsOneFromState(appHash []byte, state sm.State) { State: %v -Did you reset Tendermint without resetting your application's data?`, +Did you reset Ostracon without resetting your application's data?`, appHash, state.AppHash, state)) } } diff --git a/consensus/replay_test.go b/consensus/replay_test.go index 0c77ec8a1..6191776a4 100644 --- a/consensus/replay_test.go +++ b/consensus/replay_test.go @@ -126,7 +126,7 @@ func sendTxs(ctx context.Context, cs *State) { func TestWALCrash(t *testing.T) { // TODO The execution result of this test case often fail for indeterminate reasons. // The reason for the fail is a timeout with an "Timed out waiting for new block" or "WAL did not panic for - // XX seconds" message, but the behavior that causes it is not reproducible. This issue also occurs in Tendermint, + // XX seconds" message, but the behavior that causes it is not reproducible. This issue also occurs in Ostracon, // but seems to be somewhat more pronounced with some changes in Ostracon. // See also: https://github.com/tendermint/tendermint/issues/1040 testCases := []struct { @@ -729,7 +729,7 @@ func testHandshakeReplay(t *testing.T, config *cfg.Config, nBlocks int, mode uin state := genesisState.Copy() // run the chain through state.ApplyBlock to build up the ostracon state - state = buildTMStateFromChain(config, stateStore, state, chain, nBlocks, mode) + state = buildOCStateFromChain(config, stateStore, state, chain, nBlocks, mode) latestAppHash := state.AppHash // make a new client creator @@ -858,7 +858,7 @@ func buildAppStateFromChain(proxyApp proxy.AppConns, stateStore sm.Store, } -func buildTMStateFromChain( +func buildOCStateFromChain( config *cfg.Config, stateStore sm.Store, state sm.State, @@ -928,7 +928,7 @@ func TestHandshakePanicsIfAppReturnsWrongAppHash(t *testing.T) { blocks := makeBlocks(3, &state, privVal) store.chain = blocks - // 2. Tendermint must panic if app returns wrong hash for the first block + // 2. Ostracon must panic if app returns wrong hash for the first block // - RANDOM HASH // - 0x02 // - 0x03 @@ -952,7 +952,7 @@ func TestHandshakePanicsIfAppReturnsWrongAppHash(t *testing.T) { }) } - // 3. Tendermint must panic if app returns wrong hash for the last block + // 3. Ostracon must panic if app returns wrong hash for the last block // - 0x01 // - 0x02 // - RANDOM HASH diff --git a/consensus/state.go b/consensus/state.go index 5e24378ed..f2d961f86 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -676,7 +676,7 @@ func (cs *State) updateToState(state sm.State) { cs.LastCommit = cs.Votes.Precommits(cs.CommitRound) case cs.LastCommit == nil: - // NOTE: when Tendermint starts, it has no votes. reconstructLastCommit + // NOTE: when Ostracon starts, it has no votes. reconstructLastCommit // must be called to reconstruct LastCommit from SeenCommit. panic(fmt.Sprintf( "last commit cannot be empty after initial block (H:%d)", diff --git a/consensus/wal.go b/consensus/wal.go index f11c3296a..7280e2df6 100644 --- a/consensus/wal.go +++ b/consensus/wal.go @@ -46,9 +46,9 @@ type EndHeightMessage struct { type WALMessage interface{} func init() { - tmjson.RegisterType(msgInfo{}, "tendermint/wal/MsgInfo") - tmjson.RegisterType(timeoutInfo{}, "tendermint/wal/TimeoutInfo") - tmjson.RegisterType(EndHeightMessage{}, "tendermint/wal/EndHeightMessage") + tmjson.RegisterType(msgInfo{}, "ostracon/wal/MsgInfo") + tmjson.RegisterType(timeoutInfo{}, "ostracon/wal/TimeoutInfo") + tmjson.RegisterType(EndHeightMessage{}, "ostracon/wal/EndHeightMessage") } //-------------------------------------------------------- diff --git a/crypto/doc.go b/crypto/doc.go index 95ae0af18..4b929973e 100644 --- a/crypto/doc.go +++ b/crypto/doc.go @@ -1,5 +1,5 @@ // crypto is a customized/convenience cryptography package for supporting -// Tendermint. +// Ostracon. // It wraps select functionality of equivalent functions in the // Go standard library, for easy usage with our libraries. @@ -34,7 +34,7 @@ // We also provide hashing wrappers around algorithms: // Sha256 -// sum := crypto.Sha256([]byte("This is Tendermint")) +// sum := crypto.Sha256([]byte("This is Ostracon")) // fmt.Printf("%x\n", sum) package crypto diff --git a/crypto/ed25519/ed25519.go b/crypto/ed25519/ed25519.go index ba9312250..5ce48e7da 100644 --- a/crypto/ed25519/ed25519.go +++ b/crypto/ed25519/ed25519.go @@ -108,7 +108,7 @@ func (privKey PrivKey) Type() string { // GenPrivKey generates a new ed25519 private key. // It uses OS randomness in conjunction with the current global random seed -// in tendermint/libs/common to generate the private key. +// in ostracon/libs/common to generate the private key. func GenPrivKey() PrivKey { return genPrivKey(crypto.CReader()) } diff --git a/crypto/example_test.go b/crypto/example_test.go index f057cb1bb..d90c66339 100644 --- a/crypto/example_test.go +++ b/crypto/example_test.go @@ -21,7 +21,7 @@ import ( ) func ExampleSha256() { - sum := crypto.Sha256([]byte("This is Tendermint")) + sum := crypto.Sha256([]byte("This is Ostracon")) fmt.Printf("%x\n", sum) // Output: // f91afb642f3d1c87c17eb01aae5cb65c242dfdbe7cf1066cc260f4ce5d33b94e diff --git a/crypto/merkle/proof_value.go b/crypto/merkle/proof_value.go index 7e0b228f3..428f29943 100644 --- a/crypto/merkle/proof_value.go +++ b/crypto/merkle/proof_value.go @@ -13,7 +13,7 @@ const ProofOpValue = "simple:v" // ValueOp takes a key and a single value as argument and // produces the root hash. The corresponding tree structure is // the SimpleMap tree. SimpleMap takes a Hasher, and currently -// Tendermint uses tmhash. SimpleValueOp should support +// Ostracon uses tmhash. SimpleValueOp should support // the hash function as used in tmhash. TODO support // additional hash functions here as options/args to this // operator. diff --git a/libs/cli/flags/log_level.go b/libs/cli/flags/log_level.go index 2a2df8005..6deb77fdf 100644 --- a/libs/cli/flags/log_level.go +++ b/libs/cli/flags/log_level.go @@ -17,7 +17,7 @@ const ( // all other modules). // // Example: -// ParseLogLevel("consensus:debug,mempool:debug,*:error", log.NewTMLogger(os.Stdout), "info") +// ParseLogLevel("consensus:debug,mempool:debug,*:error", log.NewOCLogger(os.Stdout), "info") func ParseLogLevel(lvl string, logger log.Logger, defaultLogLevelValue string) (log.Logger, error) { if lvl == "" { return nil, errors.New("empty log level") diff --git a/libs/cli/flags/log_level_test.go b/libs/cli/flags/log_level_test.go index 88f0d6568..25a34d3b1 100644 --- a/libs/cli/flags/log_level_test.go +++ b/libs/cli/flags/log_level_test.go @@ -15,7 +15,7 @@ const ( func TestParseLogLevel(t *testing.T) { var buf bytes.Buffer - jsonLogger := log.NewTMJSONLoggerNoTS(&buf) + jsonLogger := log.NewOCJSONLoggerNoTS(&buf) correctLogLevels := []struct { lvl string diff --git a/libs/cli/setup.go b/libs/cli/setup.go index c28d759b2..ba3a73f65 100644 --- a/libs/cli/setup.go +++ b/libs/cli/setup.go @@ -48,13 +48,13 @@ func PrepareMainCmd(cmd *cobra.Command, envPrefix, defaultHome string) Executor func initEnv(prefix string) { copyEnvVars(prefix) - // env variables with TM prefix (eg. TM_ROOT) + // env variables with OC prefix (eg. OC_ROOT) viper.SetEnvPrefix(prefix) viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_", "-", "_")) viper.AutomaticEnv() } -// This copies all variables like TMROOT to TM_ROOT, +// This copies all variables like OCROOT to OC_ROOT, // so we can support both formats for the user func copyEnvVars(prefix string) { prefix = strings.ToUpper(prefix) diff --git a/libs/log/filter_test.go b/libs/log/filter_test.go index f40bdfdb5..ba4543d7d 100644 --- a/libs/log/filter_test.go +++ b/libs/log/filter_test.go @@ -58,7 +58,7 @@ func TestVariousLevels(t *testing.T) { tc := tc t.Run(tc.name, func(t *testing.T) { var buf bytes.Buffer - logger := log.NewFilter(log.NewTMJSONLoggerNoTS(&buf), tc.allowed) + logger := log.NewFilter(log.NewOCJSONLoggerNoTS(&buf), tc.allowed) logger.Debug("here", "this is", "debug log") logger.Info("here", "this is", "info log") @@ -74,7 +74,7 @@ func TestVariousLevels(t *testing.T) { func TestLevelContext(t *testing.T) { var buf bytes.Buffer - logger := log.NewTMJSONLoggerNoTS(&buf) + logger := log.NewOCJSONLoggerNoTS(&buf) logger = log.NewFilter(logger, log.AllowError()) logger = logger.With("context", "value") @@ -96,7 +96,7 @@ func TestLevelContext(t *testing.T) { func TestVariousAllowWith(t *testing.T) { var buf bytes.Buffer - logger := log.NewTMJSONLoggerNoTS(&buf) + logger := log.NewOCJSONLoggerNoTS(&buf) logger1 := log.NewFilter(logger, log.AllowError(), log.AllowInfoWith("context", "value")) logger1.With("context", "value").Info("foo", "bar", "baz") diff --git a/libs/log/logger.go b/libs/log/logger.go index ddb187bc7..f4b84c466 100644 --- a/libs/log/logger.go +++ b/libs/log/logger.go @@ -6,7 +6,7 @@ import ( kitlog "github.com/go-kit/kit/log" ) -// Logger is what any Tendermint library should take. +// Logger is what any Ostracon library should take. type Logger interface { Debug(msg string, keyvals ...interface{}) Info(msg string, keyvals ...interface{}) diff --git a/libs/log/testing_logger.go b/libs/log/testing_logger.go index 8914bd81f..ff97934bd 100644 --- a/libs/log/testing_logger.go +++ b/libs/log/testing_logger.go @@ -35,7 +35,7 @@ func TestingLoggerWithOutput(w io.Writer) Logger { } if testing.Verbose() { - _testingLogger = NewTMLogger(NewSyncWriter(w)) + _testingLogger = NewOCLogger(NewSyncWriter(w)) } else { _testingLogger = NewNopLogger() } @@ -51,7 +51,7 @@ func TestingLoggerWithColorFn(colorFn func(keyvals ...interface{}) term.FgBgColo } if testing.Verbose() { - _testingLogger = NewTMLoggerWithColorFn(NewSyncWriter(os.Stdout), colorFn) + _testingLogger = NewOCLoggerWithColorFn(NewSyncWriter(os.Stdout), colorFn) } else { _testingLogger = NewNopLogger() } diff --git a/libs/log/tm_json_logger.go b/libs/log/tm_json_logger.go index 3ebeddaa3..d521e5a73 100644 --- a/libs/log/tm_json_logger.go +++ b/libs/log/tm_json_logger.go @@ -6,19 +6,19 @@ import ( kitlog "github.com/go-kit/kit/log" ) -// NewTMJSONLogger returns a Logger that encodes keyvals to the Writer as a +// NewOCJSONLogger returns a Logger that encodes keyvals to the Writer as a // single JSON object. Each log event produces no more than one call to // w.Write. The passed Writer must be safe for concurrent use by multiple // goroutines if the returned Logger will be used concurrently. -func NewTMJSONLogger(w io.Writer) Logger { +func NewOCJSONLogger(w io.Writer) Logger { logger := kitlog.NewJSONLogger(w) logger = kitlog.With(logger, "ts", kitlog.DefaultTimestampUTC) return &tmLogger{logger} } -// NewTMJSONLoggerNoTS is the same as NewTMJSONLogger, but without the +// NewOCJSONLoggerNoTS is the same as NewOCJSONLogger, but without the // timestamp. -func NewTMJSONLoggerNoTS(w io.Writer) Logger { +func NewOCJSONLoggerNoTS(w io.Writer) Logger { logger := kitlog.NewJSONLogger(w) return &tmLogger{logger} } diff --git a/libs/log/tm_logger.go b/libs/log/tm_logger.go index 7c106336c..e28c5b2c1 100644 --- a/libs/log/tm_logger.go +++ b/libs/log/tm_logger.go @@ -21,10 +21,10 @@ type tmLogger struct { // Interface assertions var _ Logger = (*tmLogger)(nil) -// NewTMLogger returns a logger that encodes msg and keyvals to the Writer +// NewOCLogger returns a logger that encodes msg and keyvals to the Writer // using go-kit's log as an underlying logger and our custom formatter. Note // that underlying logger could be swapped with something else. -func NewTMLogger(w io.Writer) Logger { +func NewOCLogger(w io.Writer) Logger { // Color by level value colorFn := func(keyvals ...interface{}) term.FgBgColor { if keyvals[0] != kitlevel.Key() { @@ -43,9 +43,9 @@ func NewTMLogger(w io.Writer) Logger { return &tmLogger{term.NewLogger(w, NewTMFmtLogger, colorFn)} } -// NewTMLoggerWithColorFn allows you to provide your own color function. See -// NewTMLogger for documentation. -func NewTMLoggerWithColorFn(w io.Writer, colorFn func(keyvals ...interface{}) term.FgBgColor) Logger { +// NewOCLoggerWithColorFn allows you to provide your own color function. See +// NewOCLogger for documentation. +func NewOCLoggerWithColorFn(w io.Writer, colorFn func(keyvals ...interface{}) term.FgBgColor) Logger { return &tmLogger{term.NewLogger(w, NewTMFmtLogger, colorFn)} } diff --git a/libs/log/tm_logger_test.go b/libs/log/tm_logger_test.go index a4a215807..0498b9bd5 100644 --- a/libs/log/tm_logger_test.go +++ b/libs/log/tm_logger_test.go @@ -12,7 +12,7 @@ import ( func TestLoggerLogsItsErrors(t *testing.T) { var buf bytes.Buffer - logger := log.NewTMLogger(&buf) + logger := log.NewOCLogger(&buf) logger.Info("foo", "baz baz", "bar") msg := strings.TrimSpace(buf.String()) if !strings.Contains(msg, "foo") { @@ -23,7 +23,7 @@ func TestLoggerLogsItsErrors(t *testing.T) { func TestInfo(t *testing.T) { var bufInfo bytes.Buffer - l := log.NewTMLogger(&bufInfo) + l := log.NewOCLogger(&bufInfo) l.Info("Client initialized with old header (trusted is more recent)", "old", 42, "trustedHeight", "forty two", @@ -46,7 +46,7 @@ func TestInfo(t *testing.T) { func TestDebug(t *testing.T) { var bufDebug bytes.Buffer - ld := log.NewTMLogger(&bufDebug) + ld := log.NewOCLogger(&bufDebug) ld.Debug("Client initialized with old header (trusted is more recent)", "old", 42, "trustedHeight", "forty two", @@ -69,7 +69,7 @@ func TestDebug(t *testing.T) { func TestError(t *testing.T) { var bufErr bytes.Buffer - le := log.NewTMLogger(&bufErr) + le := log.NewOCLogger(&bufErr) le.Error("Client initialized with old header (trusted is more recent)", "old", 42, "trustedHeight", "forty two", @@ -90,11 +90,11 @@ func TestError(t *testing.T) { } func BenchmarkTMLoggerSimple(b *testing.B) { - benchmarkRunner(b, log.NewTMLogger(ioutil.Discard), baseInfoMessage) + benchmarkRunner(b, log.NewOCLogger(ioutil.Discard), baseInfoMessage) } func BenchmarkTMLoggerContextual(b *testing.B) { - benchmarkRunner(b, log.NewTMLogger(ioutil.Discard), withInfoMessage) + benchmarkRunner(b, log.NewOCLogger(ioutil.Discard), withInfoMessage) } func benchmarkRunner(b *testing.B, logger log.Logger, f func(log.Logger)) { diff --git a/libs/log/tmfmt_logger.go b/libs/log/tmfmt_logger.go index c6004cc62..3723c20b5 100644 --- a/libs/log/tmfmt_logger.go +++ b/libs/log/tmfmt_logger.go @@ -37,7 +37,7 @@ type tmfmtLogger struct { } // NewTMFmtLogger returns a logger that encodes keyvals to the Writer in -// Tendermint custom format. Note complex types (structs, maps, slices) +// Ostracon custom format. Note complex types (structs, maps, slices) // formatted as "%+v". // // Each log event produces no more than one call to w.Write. @@ -89,7 +89,7 @@ func (l tmfmtLogger) Log(keyvals ...interface{}) error { } } - // Form a custom Tendermint line + // Form a custom Ostracon line // // Example: // D[2016-05-02|11:06:44.322] Stopping AddrBook (ignoring: already stopped) diff --git a/libs/log/tracing_logger_test.go b/libs/log/tracing_logger_test.go index e95c5f2de..e41684782 100644 --- a/libs/log/tracing_logger_test.go +++ b/libs/log/tracing_logger_test.go @@ -15,7 +15,7 @@ import ( func TestTracingLogger(t *testing.T) { var buf bytes.Buffer - logger := log.NewTMJSONLoggerNoTS(&buf) + logger := log.NewOCJSONLoggerNoTS(&buf) logger1 := log.NewTracingLogger(logger) err1 := errors.New("courage is grace under pressure") diff --git a/light/detector_test.go b/light/detector_test.go index dc8b5bdff..d31d72c3c 100644 --- a/light/detector_test.go +++ b/light/detector_test.go @@ -17,7 +17,7 @@ import ( ) func TestLightClientAttackEvidence_Lunatic(t *testing.T) { - t.Skip("Voter selection in Ostracon only supports sequential verification mode, but Tendermint has a few test case for skipping mode.") + t.Skip("Voter selection in Ostracon only supports sequential verification mode, but Ostracon has a few test case for skipping mode.") // primary performs a lunatic attack var ( latestHeight = int64(10) @@ -98,7 +98,7 @@ func TestLightClientAttackEvidence_Lunatic(t *testing.T) { } func TestLightClientAttackEvidence_Equivocation(t *testing.T) { - t.Skip("Voter selection in Ostracon only supports sequential verification mode, but Tendermint has a few test case for skipping mode.") + t.Skip("Voter selection in Ostracon only supports sequential verification mode, but Ostracon has a few test case for skipping mode.") verificationOptions := map[string]light.Option{ "sequential": light.SequentialVerification(), "skipping": light.SkippingVerification(light.DefaultTrustLevel), diff --git a/light/doc.go b/light/doc.go index 700bbeb6c..d6647d0db 100644 --- a/light/doc.go +++ b/light/doc.go @@ -5,11 +5,11 @@ The concept of light clients was introduced in the Bitcoin white paper. It describes a watcher of distributed consensus process that only validates the consensus algorithm and not the state machine transactions within. -Tendermint light clients allow bandwidth & compute-constrained devices, such as +Ostracon light clients allow bandwidth & compute-constrained devices, such as smartphones, low-power embedded chips, or other blockchains to efficiently -verify the consensus of a Tendermint blockchain. This forms the basis of safe +verify the consensus of a Ostracon blockchain. This forms the basis of safe and efficient state synchronization for new network nodes and inter-blockchain -communication (where a light client of one Tendermint instance runs in another +communication (where a light client of one Ostracon instance runs in another chain's state machine). In a network that is expected to reliably punish validators for misbehavior by @@ -28,7 +28,7 @@ fork the network at some point in its prior history. See Vitalik's post at [Proof of Stake: How I Learned to Love Weak Subjectivity](https://blog.ethereum.org/2014/11/25/proof-stake-learned-love-weak-subjectivity/). -NOTE: Tendermint provides a somewhat different (stronger) light client model +NOTE: Ostracon provides a somewhat different (stronger) light client model than Bitcoin under eclipse, since the eclipsing node(s) can only fool the light client if they have two-thirds of the private keys from the last root-of-trust. @@ -111,7 +111,7 @@ refer to docs/imgs/light_client_bisection_alg.png ## 3. Secure RPC proxy -Tendermint RPC exposes a lot of info, but a malicious node could return any +Ostracon RPC exposes a lot of info, but a malicious node could return any data it wants to queries, or even to block headers, even making up fake signatures from non-existent validators to justify it. Secure RPC proxy serves as a wrapper, which verifies all the headers, using a light client connected to diff --git a/light/example_test.go b/light/example_test.go index b0ef159bd..eee1d4d8a 100644 --- a/light/example_test.go +++ b/light/example_test.go @@ -23,7 +23,7 @@ import ( // Automatically getting new headers and verifying them. func ExampleClient_Update() { - // give Tendermint time to generate some blocks + // give Ostracon time to generate some blocks time.Sleep(5 * time.Second) dbDir, err := ioutil.TempDir("", "light-client-example") @@ -92,7 +92,7 @@ func ExampleClient_Update() { // Manually getting light blocks and verifying them. func ExampleClient_VerifyLightBlockAtHeight() { - // give Tendermint time to generate some blocks + // give Ostracon time to generate some blocks time.Sleep(5 * time.Second) dbDir, err := ioutil.TempDir("", "light-client-example") @@ -161,11 +161,11 @@ func ExampleClient_VerifyLightBlockAtHeight() { func TestMain(m *testing.M) { // start an ostracon node (and kvstore) in the background to test against app := kvstore.NewApplication() - node := rpctest.StartTendermint(app, rpctest.SuppressStdout) + node := rpctest.StartOstracon(app, rpctest.SuppressStdout) code := m.Run() // and shut down proper at the end - rpctest.StopTendermint(node) + rpctest.StopOstracon(node) os.Exit(code) } diff --git a/light/provider/http/http_test.go b/light/provider/http/http_test.go index 8dd9a0134..21cf177a3 100644 --- a/light/provider/http/http_test.go +++ b/light/provider/http/http_test.go @@ -35,11 +35,11 @@ func TestNewProvider(t *testing.T) { func TestMain(m *testing.M) { app := kvstore.NewApplication() app.RetainBlocks = 9 - node := rpctest.StartTendermint(app) + node := rpctest.StartOstracon(app) code := m.Run() - rpctest.StopTendermint(node) + rpctest.StopOstracon(node) os.Exit(code) } diff --git a/mempool/errors.go b/mempool/errors.go index e33e14ca3..00f288ac8 100644 --- a/mempool/errors.go +++ b/mempool/errors.go @@ -20,7 +20,7 @@ func (e ErrTxTooLarge) Error() string { return fmt.Sprintf("Tx too large. Max size is %d, but got %d", e.max, e.actual) } -// ErrMempoolIsFull means Tendermint & an application can't handle that much load +// ErrMempoolIsFull means Ostracon & an application can't handle that much load type ErrMempoolIsFull struct { numTxs int maxTxs int diff --git a/networks/local/localnode/wrapper.sh b/networks/local/localnode/wrapper.sh index f6d56e126..010170760 100755 --- a/networks/local/localnode/wrapper.sh +++ b/networks/local/localnode/wrapper.sh @@ -26,10 +26,10 @@ fi ## ## Run binary with all parameters ## -export TMHOME="/ostracon/node${ID}" +export OCHOME="/ostracon/node${ID}" -if [ -d "`dirname ${TMHOME}/${LOG}`" ]; then - "$BINARY" "$@" | tee "${TMHOME}/${LOG}" +if [ -d "`dirname ${OCHOME}/${LOG}`" ]; then + "$BINARY" "$@" | tee "${OCHOME}/${LOG}" else "$BINARY" "$@" fi diff --git a/node/node.go b/node/node.go index e8288d1cf..7c152fd70 100644 --- a/node/node.go +++ b/node/node.go @@ -84,7 +84,7 @@ func DefaultGenesisDocProviderFunc(config *cfg.Config) GenesisDocProvider { // Provider takes a config and a logger and returns a ready to go Node. type Provider func(*cfg.Config, log.Logger) (*Node, error) -// DefaultNewNode returns a Tendermint node with default settings for the +// DefaultNewNode returns a Ostracon node with default settings for the // PrivValidator, ClientCreator, GenesisDoc, and DBProvider. // It implements NodeProvider. func DefaultNewNode(config *cfg.Config, logger log.Logger) (*Node, error) { @@ -174,7 +174,7 @@ func StateProvider(stateProvider statesync.StateProvider) Option { //------------------------------------------------------------------------------ -// Node is the highest level interface to a full Tendermint node. +// Node is the highest level interface to a full Ostracon node. // It includes all configuration information and running services. type Node struct { service.BaseService @@ -292,7 +292,7 @@ func doHandshake( func logNodeStartupInfo(state sm.State, pubKey crypto.PubKey, logger, consensusLogger log.Logger) { // Log the version info. logger.Info("Version info", - "software", version.TMCoreSemVer, + "software", version.OCCoreSemVer, "block", version.BlockProtocol, "p2p", version.P2PProtocol, ) @@ -626,7 +626,7 @@ func startStateSync(ssR *statesync.Reactor, bcR fastSyncReactor, conR *cs.Reacto return nil } -// NewNode returns a new, ready to go, Tendermint Node. +// NewNode returns a new, ready to go, Ostracon Node. func NewNode(config *cfg.Config, privValidator types.PrivValidator, nodeKey *p2p.NodeKey, @@ -1266,7 +1266,7 @@ func makeNodeInfo( ), DefaultNodeID: nodeKey.ID(), Network: genDoc.ChainID, - Version: version.TMCoreSemVer, + Version: version.OCCoreSemVer, Channels: []byte{ bcChannel, cs.StateChannel, cs.DataChannel, cs.VoteChannel, cs.VoteSetBitsChannel, diff --git a/p2p/netaddress.go b/p2p/netaddress.go index 2261a7012..cbb67eb9d 100644 --- a/p2p/netaddress.go +++ b/p2p/netaddress.go @@ -1,4 +1,4 @@ -// Modified for Tendermint +// Modified for Tendermint, Ostracon // Originally Copyright (c) 2013-2014 Conformal Systems LLC. // https://github.com/conformal/btcd/blob/master/LICENSE diff --git a/p2p/node_info.go b/p2p/node_info.go index d356784ca..3ea41fcaf 100644 --- a/p2p/node_info.go +++ b/p2p/node_info.go @@ -74,7 +74,7 @@ func NewProtocolVersion(p2p, block, app uint64) ProtocolVersion { var _ NodeInfo = DefaultNodeInfo{} // DefaultNodeInfo is the basic node information exchanged -// between two peers during the Tendermint P2P handshake. +// between two peers during the Ostracon P2P handshake. type DefaultNodeInfo struct { ProtocolVersion ProtocolVersion `json:"protocol_version"` diff --git a/p2p/upnp/probe.go b/p2p/upnp/probe.go index f1448972c..78fbb09f7 100644 --- a/p2p/upnp/probe.go +++ b/p2p/upnp/probe.go @@ -26,7 +26,7 @@ func makeUPNPListener(intPort int, extPort int, logger log.Logger) (NAT, net.Lis } logger.Info(fmt.Sprintf("External address: %v", ext)) - port, err := nat.AddPortMapping("tcp", extPort, intPort, "Tendermint UPnP Probe", 0) + port, err := nat.AddPortMapping("tcp", extPort, intPort, "Ostracon UPnP Probe", 0) if err != nil { return nat, nil, ext, fmt.Errorf("port mapping error: %v", err) } diff --git a/proto/ostracon/crypto/keys.pb.go b/proto/ostracon/crypto/keys.pb.go index 2ebc0b007..3d42cc643 100644 --- a/proto/ostracon/crypto/keys.pb.go +++ b/proto/ostracon/crypto/keys.pb.go @@ -77,7 +77,7 @@ func (m *CompositePublicKey) GetVrfKey() *PublicKey { return nil } -// PublicKey defines the keys available for use with Tendermint Validators +// PublicKey defines the keys available for use with Ostracon Validators type PublicKey struct { // Types that are valid to be assigned to Sum: // *PublicKey_Ed25519 diff --git a/proto/ostracon/crypto/keys.proto b/proto/ostracon/crypto/keys.proto index eabeb0679..c32cfcbec 100644 --- a/proto/ostracon/crypto/keys.proto +++ b/proto/ostracon/crypto/keys.proto @@ -14,7 +14,7 @@ message CompositePublicKey { PublicKey vrf_key = 2; } -// PublicKey defines the keys available for use with Tendermint Validators +// PublicKey defines the keys available for use with Ostracon Validators message PublicKey { option (gogoproto.compare) = true; option (gogoproto.equal) = true; diff --git a/proto/ostracon/types/types.pb.go b/proto/ostracon/types/types.pb.go index e35b7e29f..4cc45ba3b 100644 --- a/proto/ostracon/types/types.pb.go +++ b/proto/ostracon/types/types.pb.go @@ -261,7 +261,7 @@ func (m *BlockID) GetPartSetHeader() PartSetHeader { return PartSetHeader{} } -// Header defines the structure of a Tendermint block header. +// Header defines the structure of a Ostracon block header. type Header struct { // basic block info Version version.Consensus `protobuf:"bytes,1,opt,name=version,proto3" json:"version"` diff --git a/proto/ostracon/types/types.proto b/proto/ostracon/types/types.proto index dd4cffb89..e883949ca 100644 --- a/proto/ostracon/types/types.proto +++ b/proto/ostracon/types/types.proto @@ -55,7 +55,7 @@ message BlockID { // -------------------------------- -// Header defines the structure of a Tendermint block header. +// Header defines the structure of a Ostracon block header. message Header { // basic block info ostracon.version.Consensus version = 1 [(gogoproto.nullable) = false]; diff --git a/proxy/multi_app_conn.go b/proxy/multi_app_conn.go index 653fac3e4..33f095d6d 100644 --- a/proxy/multi_app_conn.go +++ b/proxy/multi_app_conn.go @@ -16,7 +16,7 @@ const ( connSnapshot = "snapshot" ) -// AppConns is the Tendermint's interface to the application that consists of +// AppConns is the Ostracon's interface to the application that consists of // multiple connections. type AppConns interface { service.Service @@ -114,8 +114,8 @@ func (app *multiAppConn) OnStart() error { app.consensusConnClient = c app.consensusConn = NewAppConnConsensus(c) - // Kill Tendermint if the ABCI application crashes. - go app.killTMOnClientError() + // Kill Ostracon if the ABCI application crashes. + go app.killOCOnClientError() return nil } @@ -124,10 +124,10 @@ func (app *multiAppConn) OnStop() { app.stopAllClients() } -func (app *multiAppConn) killTMOnClientError() { +func (app *multiAppConn) killOCOnClientError() { killFn := func(conn string, err error, logger tmlog.Logger) { logger.Error( - fmt.Sprintf("%s connection terminated. Did the application crash? Please restart tendermint", conn), + fmt.Sprintf("%s connection terminated. Did the application crash? Please restart ostracon", conn), "err", err) killErr := tmos.Kill() if killErr != nil { diff --git a/proxy/version.go b/proxy/version.go index 96b75bd9d..c2b65d3fc 100644 --- a/proxy/version.go +++ b/proxy/version.go @@ -9,7 +9,7 @@ import ( // the abci.RequestInfo message during handshake with the app. // It contains only compile-time version information. var RequestInfo = abci.RequestInfo{ - Version: version.TMCoreSemVer, + Version: version.OCCoreSemVer, BlockVersion: version.BlockProtocol, P2PVersion: version.P2PProtocol, } diff --git a/rpc/client/examples_test.go b/rpc/client/examples_test.go index 2c109b4fb..76b61d2fa 100644 --- a/rpc/client/examples_test.go +++ b/rpc/client/examples_test.go @@ -15,8 +15,8 @@ import ( func ExampleHTTP_simple() { // Start an ostracon node (and kvstore) in the background to test against app := kvstore.NewApplication() - node := rpctest.StartTendermint(app, rpctest.SuppressStdout, rpctest.RecreateConfig) - defer rpctest.StopTendermint(node) + node := rpctest.StartOstracon(app, rpctest.SuppressStdout, rpctest.RecreateConfig) + defer rpctest.StopOstracon(node) // Create our RPC client rpcAddr := rpctest.GetConfig().RPC.ListenAddress @@ -68,7 +68,7 @@ func ExampleHTTP_simple() { func ExampleHTTP_batching() { // Start an ostracon node (and kvstore) in the background to test against app := kvstore.NewApplication() - node := rpctest.StartTendermint(app, rpctest.SuppressStdout, rpctest.RecreateConfig) + node := rpctest.StartOstracon(app, rpctest.SuppressStdout, rpctest.RecreateConfig) // Create our RPC client rpcAddr := rpctest.GetConfig().RPC.ListenAddress @@ -77,7 +77,7 @@ func ExampleHTTP_batching() { log.Fatal(err) } - defer rpctest.StopTendermint(node) + defer rpctest.StopOstracon(node) // Create our two transactions k1 := []byte("firstName") diff --git a/rpc/client/helpers.go b/rpc/client/helpers.go index a1d218342..4eec8e279 100644 --- a/rpc/client/helpers.go +++ b/rpc/client/helpers.go @@ -57,7 +57,7 @@ func WaitForHeight(c StatusClient, h int64, waiter Waiter) error { // when the timeout duration has expired. // // This handles subscribing and unsubscribing under the hood -func WaitForOneEvent(c EventsClient, evtTyp string, timeout time.Duration) (types.TMEventData, error) { +func WaitForOneEvent(c EventsClient, evtTyp string, timeout time.Duration) (types.OCEventData, error) { const subscriber = "helpers" ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -76,7 +76,7 @@ func WaitForOneEvent(c EventsClient, evtTyp string, timeout time.Duration) (type select { case event := <-eventCh: - return event.Data.(types.TMEventData), nil + return event.Data.(types.OCEventData), nil case <-ctx.Done(): return nil, errors.New("timed out waiting for event") } diff --git a/rpc/client/http/http.go b/rpc/client/http/http.go index d8e2c36a4..fa1165f06 100644 --- a/rpc/client/http/http.go +++ b/rpc/client/http/http.go @@ -20,16 +20,16 @@ import ( ) /* -HTTP is a Client implementation that communicates with a Tendermint node over +HTTP is a Client implementation that communicates with a Ostracon node over JSON RPC and WebSockets. This is the main implementation you probably want to use in production code. -There are other implementations when calling the Tendermint node in-process +There are other implementations when calling the Ostracon node in-process (Local), or when you want to mock out the server for test code (mock). -You can subscribe for any event published by Tendermint using Subscribe method. +You can subscribe for any event published by Ostracon using Subscribe method. Note delivery is best-effort. If you don't read events fast enough or network is -slow, Tendermint might cancel the subscription. The client will attempt to +slow, Ostracon might cancel the subscription. The client will attempt to resubscribe (you don't need to do anything). It will keep trying every second indefinitely until successful. @@ -629,7 +629,7 @@ func (w *WSEvents) Subscribe(ctx context.Context, subscriber, query string, outc := make(chan ctypes.ResultEvent, outCap) w.mtx.Lock() - // subscriber param is ignored because Tendermint will override it with + // subscriber param is ignored because Ostracon will override it with // remote IP anyway. w.subscriptions[query] = outc w.mtx.Unlock() @@ -710,11 +710,11 @@ func (w *WSEvents) eventListener() { if resp.Error != nil { w.Logger.Error("WS error", "err", resp.Error.Error()) // Error can be ErrAlreadySubscribed or max client (subscriptions per - // client) reached or Tendermint exited. + // client) reached or Ostracon exited. // We can ignore ErrAlreadySubscribed, but need to retry in other // cases. if !isErrAlreadySubscribed(resp.Error) { - // Resubscribe after 1 second to give Tendermint time to restart (if + // Resubscribe after 1 second to give Ostracon time to restart (if // crashed). w.redoSubscriptionsAfter(1 * time.Second) } diff --git a/rpc/client/interface.go b/rpc/client/interface.go index eb5958e92..de4a56173 100644 --- a/rpc/client/interface.go +++ b/rpc/client/interface.go @@ -98,7 +98,7 @@ type NetworkClient interface { } // EventsClient is reactive, you can subscribe to any message, given the proper -// string. see tendermint/types/events.go +// string. see ostracon/types/events.go type EventsClient interface { // Subscribe subscribes given subscriber to query. Returns a channel with // cap=1 onto which events are published. An error is returned if it fails to diff --git a/rpc/client/local/local.go b/rpc/client/local/local.go index b51f72de8..6e2b66ac5 100644 --- a/rpc/client/local/local.go +++ b/rpc/client/local/local.go @@ -25,14 +25,14 @@ This implementation is useful for: * Running tests against a node in-process without the overhead of going through an http server -* Communication between an ABCI app and Tendermint core when they +* Communication between an ABCI app and Ostracon core when they are compiled in process. For real clients, you probably want to use client.HTTP. For more powerful control during testing, you probably want the "client/mock" package. -You can subscribe for any event published by Tendermint using Subscribe method. -Note delivery is best-effort. If you don't read events fast enough, Tendermint +You can subscribe for any event published by Ostracon using Subscribe method. +Note delivery is best-effort. If you don't read events fast enough, Ostracon might cancel the subscription. The client will attempt to resubscribe (you don't need to do anything). It will keep trying indefinitely with exponential backoff (10ms -> 20ms -> 40ms) until successful. diff --git a/rpc/client/main_test.go b/rpc/client/main_test.go index a445e66da..79734afcd 100644 --- a/rpc/client/main_test.go +++ b/rpc/client/main_test.go @@ -20,12 +20,12 @@ func TestMain(m *testing.M) { } app := kvstore.NewPersistentKVStoreApplication(dir) - node = rpctest.StartTendermint(app) + node = rpctest.StartOstracon(app) code := m.Run() // and shut down proper at the end - rpctest.StopTendermint(node) + rpctest.StopOstracon(node) _ = os.RemoveAll(dir) os.Exit(code) } diff --git a/rpc/core/events.go b/rpc/core/events.go index 11457b2ed..07568fd63 100644 --- a/rpc/core/events.go +++ b/rpc/core/events.go @@ -12,7 +12,7 @@ import ( ) const ( - // Buffer on the Tendermint (server) side to allow some slowness in clients. + // Buffer on the Ostracon (server) side to allow some slowness in clients. subBufferSize = 100 ) @@ -62,7 +62,7 @@ func Subscribe(ctx *rpctypes.Context, query string) (*ctypes.ResultSubscribe, er if sub.Err() != tmpubsub.ErrUnsubscribed { var reason string if sub.Err() == nil { - reason = "Tendermint exited" + reason = "Ostracon exited" } else { reason = sub.Err().Error() } diff --git a/rpc/core/mempool.go b/rpc/core/mempool.go index 930a1c347..760caa0b7 100644 --- a/rpc/core/mempool.go +++ b/rpc/core/mempool.go @@ -14,7 +14,7 @@ import ( ) //----------------------------------------------------------------------------- -// NOTE: tx should be signed, but this is only checked at the app level (not by Tendermint!) +// NOTE: tx should be signed, but this is only checked at the app level (not by Ostracon!) // BroadcastTxAsync returns right away, with no response. Does not wait for // CheckTx nor DeliverTx results. @@ -109,7 +109,7 @@ func BroadcastTxCommit(ctx *rpctypes.Context, tx types.Tx) (*ctypes.ResultBroadc case <-deliverTxSub.Cancelled(): var reason string if deliverTxSub.Err() == nil { - reason = "Tendermint exited" + reason = "Ostracon exited" } else { reason = deliverTxSub.Err().Error() } diff --git a/rpc/core/status.go b/rpc/core/status.go index e00d34ed5..78e141901 100644 --- a/rpc/core/status.go +++ b/rpc/core/status.go @@ -10,7 +10,7 @@ import ( "github.com/line/ostracon/types" ) -// Status returns Tendermint status including node info, pubkey, latest block +// Status returns Ostracon status including node info, pubkey, latest block // hash, app hash, block height and time. // More: https://docs.tendermint.com/master/rpc/#/Info/status func Status(ctx *rpctypes.Context) (*ctypes.ResultStatus, error) { diff --git a/rpc/core/types/responses.go b/rpc/core/types/responses.go index 7b2c1dc4c..c69a087ec 100644 --- a/rpc/core/types/responses.go +++ b/rpc/core/types/responses.go @@ -241,6 +241,6 @@ type ( // Event data from a subscription type ResultEvent struct { Query string `json:"query"` - Data types.TMEventData `json:"data"` + Data types.OCEventData `json:"data"` Events map[string][]string `json:"events"` } diff --git a/rpc/grpc/grpc_test.go b/rpc/grpc/grpc_test.go index 17e342301..929d22224 100644 --- a/rpc/grpc/grpc_test.go +++ b/rpc/grpc/grpc_test.go @@ -15,12 +15,12 @@ import ( func TestMain(m *testing.M) { // start an ostracon node in the background to test against app := kvstore.NewApplication() - node := rpctest.StartTendermint(app) + node := rpctest.StartOstracon(app) code := m.Run() // and shut down proper at the end - rpctest.StopTendermint(node) + rpctest.StopOstracon(node) os.Exit(code) } diff --git a/rpc/jsonrpc/client/integration_test.go b/rpc/jsonrpc/client/integration_test.go index f828ef4de..df2f02891 100644 --- a/rpc/jsonrpc/client/integration_test.go +++ b/rpc/jsonrpc/client/integration_test.go @@ -27,7 +27,7 @@ func TestWSClientReconnectWithJitter(t *testing.T) { var errNotConnected = errors.New("not connected") clientMap := make(map[int]*WSClient) buf := new(bytes.Buffer) - logger := log.NewTMLogger(buf) + logger := log.NewOCLogger(buf) for i := 0; i < n; i++ { c, err := NewWS("tcp://foo", "/websocket") require.Nil(t, err) diff --git a/rpc/jsonrpc/doc.go b/rpc/jsonrpc/doc.go index 2ceb72098..d71af01ff 100644 --- a/rpc/jsonrpc/doc.go +++ b/rpc/jsonrpc/doc.go @@ -70,7 +70,7 @@ // rpcserver.RegisterRPCFuncs(mux, Routes) // wm := rpcserver.NewWebsocketManager(Routes) // mux.HandleFunc("/websocket", wm.WebsocketHandler) -// logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout)) +// logger := log.NewOCLogger(log.NewSyncWriter(os.Stdout)) // listener, err := rpc.Listen("0.0.0.0:8080", rpcserver.Config{}) // if err != nil { panic(err) } // go rpcserver.Serve(listener, mux, logger) diff --git a/rpc/jsonrpc/jsonrpc_test.go b/rpc/jsonrpc/jsonrpc_test.go index 79b7aad9c..4d394d8e1 100644 --- a/rpc/jsonrpc/jsonrpc_test.go +++ b/rpc/jsonrpc/jsonrpc_test.go @@ -107,7 +107,7 @@ var colorFn = func(keyvals ...interface{}) term.FgBgColor { // launch unix and tcp servers func setup() { - logger := log.NewTMLoggerWithColorFn(log.NewSyncWriter(os.Stdout), colorFn) + logger := log.NewOCLoggerWithColorFn(log.NewSyncWriter(os.Stdout), colorFn) cmd := exec.Command("rm", "-f", unixSocket) err := cmd.Start() diff --git a/rpc/jsonrpc/server/http_json_handler_test.go b/rpc/jsonrpc/server/http_json_handler_test.go index 450f0959e..8928ee6a7 100644 --- a/rpc/jsonrpc/server/http_json_handler_test.go +++ b/rpc/jsonrpc/server/http_json_handler_test.go @@ -22,7 +22,7 @@ func testMux() *http.ServeMux { } mux := http.NewServeMux() buf := new(bytes.Buffer) - logger := log.NewTMLogger(buf) + logger := log.NewOCLogger(buf) RegisterRPCFuncs(mux, funcMap, logger) return mux diff --git a/rpc/jsonrpc/server/ws_handler.go b/rpc/jsonrpc/server/ws_handler.go index 4ff53b9d6..c43dbaa79 100644 --- a/rpc/jsonrpc/server/ws_handler.go +++ b/rpc/jsonrpc/server/ws_handler.go @@ -52,7 +52,7 @@ func NewWebsocketManager( // The default behaviour would be relevant to browser-based clients, // afaik. I suppose having a pass-through is a workaround for allowing // for more complex security schemes, shifting the burden of - // AuthN/AuthZ outside the Tendermint RPC. + // AuthN/AuthZ outside the Ostracon RPC. // I can't think of other uses right now that would warrant a TODO // though. The real backstory of this TODO shall remain shrouded in // mystery diff --git a/rpc/jsonrpc/test/main.go b/rpc/jsonrpc/test/main.go index f3c231a61..cc4d4ee23 100644 --- a/rpc/jsonrpc/test/main.go +++ b/rpc/jsonrpc/test/main.go @@ -26,7 +26,7 @@ type Result struct { func main() { var ( mux = http.NewServeMux() - logger = log.NewTMLogger(log.NewSyncWriter(os.Stdout)) + logger = log.NewOCLogger(log.NewSyncWriter(os.Stdout)) ) // Stop upon receiving SIGTERM or CTRL-C. diff --git a/rpc/openapi/openapi.yaml b/rpc/openapi/openapi.yaml index ceb5ee8bc..dbc5d3069 100644 --- a/rpc/openapi/openapi.yaml +++ b/rpc/openapi/openapi.yaml @@ -14,7 +14,7 @@ info: ## Configuration RPC can be configured by tuning parameters under `[rpc]` table in the - `$TMHOME/config/config.toml` file or by using the `--rpc.X` command-line + `$OCHOME/config/config.toml` file or by using the `--rpc.X` command-line flags. Default rpc listen address is `tcp://0.0.0.0:26657`. diff --git a/rpc/test/helpers.go b/rpc/test/helpers.go index c8d91ed2d..cebb1a1d0 100644 --- a/rpc/test/helpers.go +++ b/rpc/test/helpers.go @@ -97,7 +97,7 @@ func createConfig() *cfg.Config { tm, rpc, grpc := makeAddrs() c.P2P.ListenAddress = tm c.RPC.ListenAddress = rpc - c.RPC.CORSAllowedOrigins = []string{"https://tendermint.com/"} + c.RPC.CORSAllowedOrigins = []string{"https://ostracon.com/"} c.RPC.GRPCListenAddress = grpc return c } @@ -115,13 +115,13 @@ func GetGRPCClient() core_grpc.BroadcastAPIClient { return core_grpc.StartGRPCClient(grpcAddr) } -// StartTendermint starts a test ostracon server in a go routine and returns when it is initialized -func StartTendermint(app abci.Application, opts ...func(*Options)) *nm.Node { +// StartOstracon starts a test ostracon server in a go routine and returns when it is initialized +func StartOstracon(app abci.Application, opts ...func(*Options)) *nm.Node { nodeOpts := defaultOptions for _, opt := range opts { opt(&nodeOpts) } - node := NewTendermint(app, &nodeOpts) + node := NewOstracon(app, &nodeOpts) err := node.Start() if err != nil { panic(err) @@ -132,15 +132,15 @@ func StartTendermint(app abci.Application, opts ...func(*Options)) *nm.Node { waitForGRPC() if !nodeOpts.suppressStdout { - fmt.Println("Tendermint running!") + fmt.Println("Ostracon running!") } return node } -// StopTendermint stops a test ostracon server, waits until it's stopped and +// StopOstracon stops a test ostracon server, waits until it's stopped and // cleans up test/config files. -func StopTendermint(node *nm.Node) { +func StopOstracon(node *nm.Node) { if err := node.Stop(); err != nil { node.Logger.Error("Error when tryint to stop node", "err", err) } @@ -148,15 +148,15 @@ func StopTendermint(node *nm.Node) { os.RemoveAll(node.Config().RootDir) } -// NewTendermint creates a new ostracon server and sleeps forever -func NewTendermint(app abci.Application, opts *Options) *nm.Node { +// NewOstracon creates a new ostracon server and sleeps forever +func NewOstracon(app abci.Application, opts *Options) *nm.Node { // Create & start node config := GetConfig(opts.recreateConfig) var logger log.Logger if opts.suppressStdout { logger = log.NewNopLogger() } else { - logger = log.NewTMLogger(log.NewSyncWriter(os.Stdout)) + logger = log.NewOCLogger(log.NewSyncWriter(os.Stdout)) logger = log.NewFilter(logger, log.AllowError()) } pvKeyFile := config.PrivValidatorKeyFile() @@ -179,7 +179,7 @@ func NewTendermint(app abci.Application, opts *Options) *nm.Node { return node } -// SuppressStdout is an option that tries to make sure the RPC test Tendermint +// SuppressStdout is an option that tries to make sure the RPC test Ostracon // node doesn't log anything to stdout. func SuppressStdout(o *Options) { o.suppressStdout = true diff --git a/scripts/json2wal/main.go b/scripts/json2wal/main.go index ba594afd2..cb5b8baf8 100644 --- a/scripts/json2wal/main.go +++ b/scripts/json2wal/main.go @@ -37,7 +37,7 @@ func main() { } defer walFile.Close() - // the length of tendermint/wal/MsgInfo in the wal.json may exceed the defaultBufSize(4096) of bufio + // the length of ostracon/wal/MsgInfo in the wal.json may exceed the defaultBufSize(4096) of bufio // because of the byte array in BlockPart // leading to unmarshal error: unexpected end of JSON input br := bufio.NewReaderSize(f, int(2*types.BlockPartSizeBytes)) diff --git a/state/execution.go b/state/execution.go index 9ebe60146..949d4bf2b 100644 --- a/state/execution.go +++ b/state/execution.go @@ -169,7 +169,7 @@ func (blockExec *BlockExecutor) ApplyBlock( return state, 0, fmt.Errorf("error in validator updates: %v", err) } - validatorUpdates, err := types.PB2TM.ValidatorUpdates(abciValUpdates) + validatorUpdates, err := types.PB2OC.ValidatorUpdates(abciValUpdates) if err != nil { return state, 0, err } @@ -509,7 +509,7 @@ func updateState( // Fire NewBlock, NewBlockHeader. // Fire TxEvent for every tx. -// NOTE: if Tendermint crashes before commit, some or all of these events may be published again. +// NOTE: if Ostracon crashes before commit, some or all of these events may be published again. func fireEvents( logger log.Logger, eventBus types.BlockEventPublisher, diff --git a/state/execution_test.go b/state/execution_test.go index 2a6fc11d9..6591e34d3 100644 --- a/state/execution_test.go +++ b/state/execution_test.go @@ -391,7 +391,7 @@ func TestUpdateValidators(t *testing.T) { for _, tc := range testCases { tc := tc t.Run(tc.name, func(t *testing.T) { - updates, err := types.PB2TM.ValidatorUpdates(tc.abciUpdates) + updates, err := types.PB2OC.ValidatorUpdates(tc.abciUpdates) assert.NoError(t, err) err = tc.currentSet.UpdateWithChangeSet(updates) if tc.shouldErr { diff --git a/state/mocks/store.go b/state/mocks/store.go index a44186ff0..d9fba676d 100644 --- a/state/mocks/store.go +++ b/state/mocks/store.go @@ -6,9 +6,9 @@ import ( mock "github.com/stretchr/testify/mock" state "github.com/line/ostracon/state" - tendermintstate "github.com/line/ostracon/proto/ostracon/state" + ostraconstate "github.com/line/ostracon/proto/ostracon/state" - tenderminttypes "github.com/line/ostracon/types" + ostracontypes "github.com/line/ostracon/types" types "github.com/line/ostracon/proto/ostracon/types" ) @@ -54,15 +54,15 @@ func (_m *Store) Load() (state.State, error) { } // LoadABCIResponses provides a mock function with given fields: _a0 -func (_m *Store) LoadABCIResponses(_a0 int64) (*tendermintstate.ABCIResponses, error) { +func (_m *Store) LoadABCIResponses(_a0 int64) (*ostraconstate.ABCIResponses, error) { ret := _m.Called(_a0) - var r0 *tendermintstate.ABCIResponses - if rf, ok := ret.Get(0).(func(int64) *tendermintstate.ABCIResponses); ok { + var r0 *ostraconstate.ABCIResponses + if rf, ok := ret.Get(0).(func(int64) *ostraconstate.ABCIResponses); ok { r0 = rf(_a0) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*tendermintstate.ABCIResponses) + r0 = ret.Get(0).(*ostraconstate.ABCIResponses) } } @@ -98,18 +98,18 @@ func (_m *Store) LoadConsensusParams(_a0 int64) (types.ConsensusParams, error) { } // LoadFromDBOrGenesisDoc provides a mock function with given fields: _a0 -func (_m *Store) LoadFromDBOrGenesisDoc(_a0 *tenderminttypes.GenesisDoc) (state.State, error) { +func (_m *Store) LoadFromDBOrGenesisDoc(_a0 *ostracontypes.GenesisDoc) (state.State, error) { ret := _m.Called(_a0) var r0 state.State - if rf, ok := ret.Get(0).(func(*tenderminttypes.GenesisDoc) state.State); ok { + if rf, ok := ret.Get(0).(func(*ostracontypes.GenesisDoc) state.State); ok { r0 = rf(_a0) } else { r0 = ret.Get(0).(state.State) } var r1 error - if rf, ok := ret.Get(1).(func(*tenderminttypes.GenesisDoc) error); ok { + if rf, ok := ret.Get(1).(func(*ostracontypes.GenesisDoc) error); ok { r1 = rf(_a0) } else { r1 = ret.Error(1) @@ -140,15 +140,15 @@ func (_m *Store) LoadFromDBOrGenesisFile(_a0 string) (state.State, error) { } // LoadValidators provides a mock function with given fields: _a0 -func (_m *Store) LoadValidators(_a0 int64) (*tenderminttypes.ValidatorSet, error) { +func (_m *Store) LoadValidators(_a0 int64) (*ostracontypes.ValidatorSet, error) { ret := _m.Called(_a0) - var r0 *tenderminttypes.ValidatorSet - if rf, ok := ret.Get(0).(func(int64) *tenderminttypes.ValidatorSet); ok { + var r0 *ostracontypes.ValidatorSet + if rf, ok := ret.Get(0).(func(int64) *ostracontypes.ValidatorSet); ok { r0 = rf(_a0) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*tenderminttypes.ValidatorSet) + r0 = ret.Get(0).(*ostracontypes.ValidatorSet) } } @@ -163,20 +163,20 @@ func (_m *Store) LoadValidators(_a0 int64) (*tenderminttypes.ValidatorSet, error } // LoadVoters provides a mock function with given fields: _a0, _a1 -func (_m *Store) LoadVoters(_a0 int64, _a1 *tenderminttypes.VoterParams) (*tenderminttypes.VoterSet, error) { +func (_m *Store) LoadVoters(_a0 int64, _a1 *ostracontypes.VoterParams) (*ostracontypes.VoterSet, error) { ret := _m.Called(_a0, _a1) - var r0 *tenderminttypes.VoterSet - if rf, ok := ret.Get(0).(func(int64, *tenderminttypes.VoterParams) *tenderminttypes.VoterSet); ok { + var r0 *ostracontypes.VoterSet + if rf, ok := ret.Get(0).(func(int64, *ostracontypes.VoterParams) *ostracontypes.VoterSet); ok { r0 = rf(_a0, _a1) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*tenderminttypes.VoterSet) + r0 = ret.Get(0).(*ostracontypes.VoterSet) } } var r1 error - if rf, ok := ret.Get(1).(func(int64, *tenderminttypes.VoterParams) error); ok { + if rf, ok := ret.Get(1).(func(int64, *ostracontypes.VoterParams) error); ok { r1 = rf(_a0, _a1) } else { r1 = ret.Error(1) @@ -214,11 +214,11 @@ func (_m *Store) Save(_a0 state.State) error { } // SaveABCIResponses provides a mock function with given fields: _a0, _a1 -func (_m *Store) SaveABCIResponses(_a0 int64, _a1 *tendermintstate.ABCIResponses) error { +func (_m *Store) SaveABCIResponses(_a0 int64, _a1 *ostraconstate.ABCIResponses) error { ret := _m.Called(_a0, _a1) var r0 error - if rf, ok := ret.Get(0).(func(int64, *tendermintstate.ABCIResponses) error); ok { + if rf, ok := ret.Get(0).(func(int64, *ostraconstate.ABCIResponses) error); ok { r0 = rf(_a0, _a1) } else { r0 = ret.Error(0) diff --git a/state/state.go b/state/state.go index 2c9aa9b83..494852734 100644 --- a/state/state.go +++ b/state/state.go @@ -33,12 +33,12 @@ var InitStateVersion = tmstate.Version{ Block: version.BlockProtocol, App: 0, }, - Software: version.TMCoreSemVer, + Software: version.OCCoreSemVer, } //----------------------------------------------------------------------------- -// State is a short description of the latest committed block of the Tendermint consensus. +// State is a short description of the latest committed block of the Ostracon consensus. // It keeps all information necessary to validate new blocks, // including the last validator set and the consensus params. // All fields are exposed so the struct can be easily serialized, diff --git a/state/state_test.go b/state/state_test.go index c634ecd03..e22917711 100644 --- a/state/state_test.go +++ b/state/state_test.go @@ -276,7 +276,7 @@ func TestOneValidatorChangesSaveLoad(t *testing.T) { power++ } header, blockID, responses := makeHeaderPartsResponsesValPowerChange(state, power) - validatorUpdates, err = types.PB2TM.ValidatorUpdates(responses.EndBlock.ValidatorUpdates) + validatorUpdates, err = types.PB2OC.ValidatorUpdates(responses.EndBlock.ValidatorUpdates) require.NoError(t, err) state, err = sm.UpdateState(state, blockID, &header, responses, validatorUpdates) require.NoError(t, err) @@ -535,7 +535,7 @@ func TestProposerPriorityDoesNotGetResetToZero(t *testing.T) { BeginBlock: &abci.ResponseBeginBlock{}, EndBlock: &abci.ResponseEndBlock{ValidatorUpdates: nil}, } - validatorUpdates, err := types.PB2TM.ValidatorUpdates(abciResponses.EndBlock.ValidatorUpdates) + validatorUpdates, err := types.PB2OC.ValidatorUpdates(abciResponses.EndBlock.ValidatorUpdates) require.NoError(t, err) updatedState, err := sm.UpdateState(state, blockID, &block.Header, abciResponses, validatorUpdates) assert.NoError(t, err) @@ -550,7 +550,7 @@ func TestProposerPriorityDoesNotGetResetToZero(t *testing.T) { require.NoError(t, err) updateAddVal := abci.ValidatorUpdate{PubKey: fvp, Power: val2StakingPower} - validatorUpdates, err = types.PB2TM.ValidatorUpdates([]abci.ValidatorUpdate{updateAddVal}) + validatorUpdates, err = types.PB2OC.ValidatorUpdates([]abci.ValidatorUpdate{updateAddVal}) assert.NoError(t, err) updatedState2, err := sm.UpdateState(updatedState, blockID, &block.Header, abciResponses, validatorUpdates) assert.NoError(t, err) @@ -586,7 +586,7 @@ func TestProposerPriorityDoesNotGetResetToZero(t *testing.T) { // 1. Add - Val2 StakingPower change to 1 => updatedVotingPowVal2 := int64(1) updateVal := abci.ValidatorUpdate{PubKey: fvp, Power: updatedVotingPowVal2} - validatorUpdates, err = types.PB2TM.ValidatorUpdates([]abci.ValidatorUpdate{updateVal}) + validatorUpdates, err = types.PB2OC.ValidatorUpdates([]abci.ValidatorUpdate{updateVal}) assert.NoError(t, err) // this will cause the diff of priorities (77) @@ -652,7 +652,7 @@ func TestProposerPriorityProposerAlternates(t *testing.T) { BeginBlock: &abci.ResponseBeginBlock{}, EndBlock: &abci.ResponseEndBlock{ValidatorUpdates: nil}, } - validatorUpdates, err := types.PB2TM.ValidatorUpdates(abciResponses.EndBlock.ValidatorUpdates) + validatorUpdates, err := types.PB2OC.ValidatorUpdates(abciResponses.EndBlock.ValidatorUpdates) require.NoError(t, err) updatedState, err := sm.UpdateState(state, blockID, &block.Header, abciResponses, validatorUpdates) @@ -669,7 +669,7 @@ func TestProposerPriorityProposerAlternates(t *testing.T) { fvp, err := cryptoenc.PubKeyToProto(val2PubKey) require.NoError(t, err) updateAddVal := abci.ValidatorUpdate{PubKey: fvp, Power: val1StakingPower} - validatorUpdates, err = types.PB2TM.ValidatorUpdates([]abci.ValidatorUpdate{updateAddVal}) + validatorUpdates, err = types.PB2OC.ValidatorUpdates([]abci.ValidatorUpdate{updateAddVal}) assert.NoError(t, err) updatedState2, err := sm.UpdateState(updatedState, blockID, &block.Header, abciResponses, validatorUpdates) @@ -712,7 +712,7 @@ func TestProposerPriorityProposerAlternates(t *testing.T) { updatedVal2, ) - validatorUpdates, err = types.PB2TM.ValidatorUpdates(abciResponses.EndBlock.ValidatorUpdates) + validatorUpdates, err = types.PB2OC.ValidatorUpdates(abciResponses.EndBlock.ValidatorUpdates) require.NoError(t, err) updatedState3, err := sm.UpdateState(updatedState2, blockID, &block.Header, abciResponses, validatorUpdates) @@ -755,7 +755,7 @@ func TestProposerPriorityProposerAlternates(t *testing.T) { BeginBlock: &abci.ResponseBeginBlock{}, EndBlock: &abci.ResponseEndBlock{ValidatorUpdates: nil}, } - validatorUpdates, err = types.PB2TM.ValidatorUpdates(abciResponses.EndBlock.ValidatorUpdates) + validatorUpdates, err = types.PB2OC.ValidatorUpdates(abciResponses.EndBlock.ValidatorUpdates) require.NoError(t, err) oldState, err = sm.UpdateState(oldState, blockID, &block.Header, abciResponses, validatorUpdates) @@ -771,7 +771,7 @@ func TestProposerPriorityProposerAlternates(t *testing.T) { BeginBlock: &abci.ResponseBeginBlock{}, EndBlock: &abci.ResponseEndBlock{ValidatorUpdates: nil}, } - validatorUpdates, err = types.PB2TM.ValidatorUpdates(abciResponses.EndBlock.ValidatorUpdates) + validatorUpdates, err = types.PB2OC.ValidatorUpdates(abciResponses.EndBlock.ValidatorUpdates) require.NoError(t, err) updatedState, err := sm.UpdateState(oldState, blockID, &block.Header, abciResponses, validatorUpdates) @@ -830,7 +830,7 @@ func TestLargeGenesisValidator(t *testing.T) { BeginBlock: &abci.ResponseBeginBlock{}, EndBlock: &abci.ResponseEndBlock{ValidatorUpdates: nil}, } - validatorUpdates, err := types.PB2TM.ValidatorUpdates(abciResponses.EndBlock.ValidatorUpdates) + validatorUpdates, err := types.PB2OC.ValidatorUpdates(abciResponses.EndBlock.ValidatorUpdates) require.NoError(t, err) block := makeBlock(oldState, oldState.LastBlockHeight+1) @@ -857,7 +857,7 @@ func TestLargeGenesisValidator(t *testing.T) { fvp, err := cryptoenc.PubKeyToProto(firstAddedValPubKey) require.NoError(t, err) firstAddedVal := abci.ValidatorUpdate{PubKey: fvp, Power: firstAddedValStakingPower} - validatorUpdates, err := types.PB2TM.ValidatorUpdates([]abci.ValidatorUpdate{firstAddedVal}) + validatorUpdates, err := types.PB2OC.ValidatorUpdates([]abci.ValidatorUpdate{firstAddedVal}) assert.NoError(t, err) abciResponses := &tmstate.ABCIResponses{ BeginBlock: &abci.ResponseBeginBlock{}, @@ -875,7 +875,7 @@ func TestLargeGenesisValidator(t *testing.T) { BeginBlock: &abci.ResponseBeginBlock{}, EndBlock: &abci.ResponseEndBlock{ValidatorUpdates: nil}, } - validatorUpdates, err := types.PB2TM.ValidatorUpdates(abciResponses.EndBlock.ValidatorUpdates) + validatorUpdates, err := types.PB2OC.ValidatorUpdates(abciResponses.EndBlock.ValidatorUpdates) require.NoError(t, err) block := makeBlock(lastState, lastState.LastBlockHeight+1) @@ -904,7 +904,7 @@ func TestLargeGenesisValidator(t *testing.T) { ap, err := cryptoenc.PubKeyToProto(addedPubKey) require.NoError(t, err) addedVal := abci.ValidatorUpdate{PubKey: ap, Power: firstAddedValStakingPower} - validatorUpdates, err := types.PB2TM.ValidatorUpdates([]abci.ValidatorUpdate{addedVal}) + validatorUpdates, err := types.PB2OC.ValidatorUpdates([]abci.ValidatorUpdate{addedVal}) assert.NoError(t, err) abciResponses := &tmstate.ABCIResponses{ @@ -928,7 +928,7 @@ func TestLargeGenesisValidator(t *testing.T) { } block = makeBlock(oldState, oldState.LastBlockHeight+1) blockID = types.BlockID{Hash: block.Hash(), PartSetHeader: block.MakePartSet(testPartSize).Header()} - validatorUpdates, err = types.PB2TM.ValidatorUpdates(abciResponses.EndBlock.ValidatorUpdates) + validatorUpdates, err = types.PB2OC.ValidatorUpdates(abciResponses.EndBlock.ValidatorUpdates) require.NoError(t, err) updatedState, err = sm.UpdateState(state, blockID, &block.Header, abciResponses, validatorUpdates) require.NoError(t, err) @@ -945,7 +945,7 @@ func TestLargeGenesisValidator(t *testing.T) { BeginBlock: &abci.ResponseBeginBlock{}, EndBlock: &abci.ResponseEndBlock{ValidatorUpdates: nil}, } - validatorUpdates, err = types.PB2TM.ValidatorUpdates(abciResponses.EndBlock.ValidatorUpdates) + validatorUpdates, err = types.PB2OC.ValidatorUpdates(abciResponses.EndBlock.ValidatorUpdates) require.NoError(t, err) block = makeBlock(curState, curState.LastBlockHeight+1) blockID = types.BlockID{Hash: block.Hash(), PartSetHeader: block.MakePartSet(testPartSize).Header()} @@ -970,7 +970,7 @@ func TestLargeGenesisValidator(t *testing.T) { BeginBlock: &abci.ResponseBeginBlock{}, EndBlock: &abci.ResponseEndBlock{ValidatorUpdates: nil}, } - validatorUpdates, err := types.PB2TM.ValidatorUpdates(abciResponses.EndBlock.ValidatorUpdates) + validatorUpdates, err := types.PB2OC.ValidatorUpdates(abciResponses.EndBlock.ValidatorUpdates) require.NoError(t, err) block := makeBlock(updatedState, updatedState.LastBlockHeight+1) @@ -1041,7 +1041,7 @@ func TestManyValidatorChangesSaveLoad(t *testing.T) { // Save state etc. var validatorUpdates []*types.Validator - validatorUpdates, err = types.PB2TM.ValidatorUpdates(responses.EndBlock.ValidatorUpdates) + validatorUpdates, err = types.PB2OC.ValidatorUpdates(responses.EndBlock.ValidatorUpdates) require.NoError(t, err) state, err = sm.UpdateState(state, blockID, &header, responses, validatorUpdates) require.Nil(t, err) @@ -1123,7 +1123,7 @@ func TestConsensusParamsChangesSaveLoad(t *testing.T) { cp = params[changeIndex] } header, blockID, responses := makeHeaderPartsResponsesParams(state, cp) - validatorUpdates, err = types.PB2TM.ValidatorUpdates(responses.EndBlock.ValidatorUpdates) + validatorUpdates, err = types.PB2OC.ValidatorUpdates(responses.EndBlock.ValidatorUpdates) require.NoError(t, err) state, err = sm.UpdateState(state, blockID, &header, responses, validatorUpdates) diff --git a/state/store.go b/state/store.go index 013a2d7ab..5afd236fe 100644 --- a/state/store.go +++ b/state/store.go @@ -167,7 +167,7 @@ func (store dbStore) save(state State, key []byte) error { // If first block, save validators for the block. if nextHeight == 1 { nextHeight = state.InitialHeight - // This extra logic due to Tendermint validator set changes being delayed 1 block. + // This extra logic due to Ostracon validator set changes being delayed 1 block. // It may get overwritten due to InitChain validator updates. if err := store.saveValidatorsInfo(nextHeight, nextHeight, state.Validators); err != nil { return err diff --git a/statesync/syncer_test.go b/statesync/syncer_test.go index 620a49323..d47161882 100644 --- a/statesync/syncer_test.go +++ b/statesync/syncer_test.go @@ -51,7 +51,7 @@ func TestSyncer_SyncAny(t *testing.T) { App: 0, }, - Software: version.TMCoreSemVer, + Software: version.OCCoreSemVer, }, LastBlockHeight: 1, diff --git a/store/store_test.go b/store/store_test.go index afe31268f..66e841a91 100644 --- a/store/store_test.go +++ b/store/store_test.go @@ -146,7 +146,7 @@ var ( func TestMain(m *testing.M) { var cleanup cleanupFunc - state, _, cleanup = makeStateAndBlockStore(log.NewTMLogger(new(bytes.Buffer))) + state, _, cleanup = makeStateAndBlockStore(log.NewOCLogger(new(bytes.Buffer))) block = makeBlock(1, state, new(types.Commit)) partSet = block.MakePartSet(2) part1 = partSet.GetPart(0) @@ -160,7 +160,7 @@ func TestMain(m *testing.M) { // TODO: This test should be simplified ... func TestBlockStoreSaveLoadBlock(t *testing.T) { - state, bs, cleanup := makeStateAndBlockStore(log.NewTMLogger(new(bytes.Buffer))) + state, bs, cleanup := makeStateAndBlockStore(log.NewOCLogger(new(bytes.Buffer))) defer cleanup() require.Equal(t, bs.Base(), int64(0), "initially the base should be zero") require.Equal(t, bs.Height(), int64(0), "initially the height should be zero") @@ -406,7 +406,7 @@ func TestLoadBlockPart(t *testing.T) { require.Nil(t, res, "a non-existent block part should return nil") // 2. Next save a corrupted block then try to load it - err := db.Set(calcBlockPartKey(height, index), []byte("Tendermint")) + err := db.Set(calcBlockPartKey(height, index), []byte("Ostracon")) require.NoError(t, err) res, _, panicErr = doFn(loadPart) require.NotNil(t, panicErr, "expecting a non-nil panic") @@ -526,7 +526,7 @@ func TestLoadBlockMeta(t *testing.T) { require.Nil(t, res, "a non-existent blockMeta should return nil") // 2. Next save a corrupted blockMeta then try to load it - err := db.Set(calcBlockMetaKey(height), []byte("Tendermint-Meta")) + err := db.Set(calcBlockMetaKey(height), []byte("Ostracon-Meta")) require.NoError(t, err) res, _, panicErr = doFn(loadMeta) require.NotNil(t, panicErr, "expecting a non-nil panic") @@ -551,7 +551,7 @@ func TestLoadBlockMeta(t *testing.T) { } func TestBlockFetchAtHeight(t *testing.T) { - state, bs, cleanup := makeStateAndBlockStore(log.NewTMLogger(new(bytes.Buffer))) + state, bs, cleanup := makeStateAndBlockStore(log.NewOCLogger(new(bytes.Buffer))) defer cleanup() require.Equal(t, bs.Height(), int64(0), "initially the height should be zero") block := makeBlock(bs.Height()+1, state, new(types.Commit)) diff --git a/test/app/test.sh b/test/app/test.sh index c4a06b539..5b569e8f8 100755 --- a/test/app/test.sh +++ b/test/app/test.sh @@ -9,10 +9,10 @@ set -ex # TODO: install everything export PATH="$GOBIN:$PATH" -export TMHOME=$HOME/.ostracon_app +export OCHOME=$HOME/.ostracon_app function kvstore_over_socket(){ - rm -rf $TMHOME + rm -rf $OCHOME ostracon init echo "Starting kvstore_over_socket" abci-cli kvstore > /dev/null & @@ -29,7 +29,7 @@ function kvstore_over_socket(){ # start ostracon first function kvstore_over_socket_reorder(){ - rm -rf $TMHOME + rm -rf $OCHOME ostracon init echo "Starting kvstore_over_socket_reorder (ie. start ostracon first)" ostracon node > ostracon.log & @@ -47,7 +47,7 @@ function kvstore_over_socket_reorder(){ function counter_over_socket() { - rm -rf $TMHOME + rm -rf $OCHOME ostracon init echo "Starting counter_over_socket" abci-cli counter --serial > /dev/null & @@ -63,7 +63,7 @@ function counter_over_socket() { } function counter_over_grpc() { - rm -rf $TMHOME + rm -rf $OCHOME ostracon init echo "Starting counter_over_grpc" abci-cli counter --serial --abci grpc > /dev/null & @@ -79,7 +79,7 @@ function counter_over_grpc() { } function counter_over_grpc_grpc() { - rm -rf $TMHOME + rm -rf $OCHOME ostracon init echo "Starting counter_over_grpc_grpc (ie. with grpc broadcast_tx)" abci-cli counter --serial --abci grpc > /dev/null & diff --git a/test/e2e/README.md b/test/e2e/README.md index 33b3a2656..600c59148 100644 --- a/test/e2e/README.md +++ b/test/e2e/README.md @@ -1,6 +1,6 @@ # End-to-End Tests -Spins up and tests Tendermint networks in Docker Compose based on a testnet manifest. To run the CI testnet: +Spins up and tests Ostracon networks in Docker Compose based on a testnet manifest. To run the CI testnet: ```sh make diff --git a/test/e2e/app/app.go b/test/e2e/app/app.go index f532e6918..de728f38b 100644 --- a/test/e2e/app/app.go +++ b/test/e2e/app/app.go @@ -41,7 +41,7 @@ func NewApplication(cfg *Config) (*Application, error) { return nil, err } return &Application{ - logger: log.NewTMLogger(log.NewSyncWriter(os.Stdout)), + logger: log.NewOCLogger(log.NewSyncWriter(os.Stdout)), state: state, snapshots: snapshots, cfg: cfg, diff --git a/test/e2e/app/main.go b/test/e2e/app/main.go index 10d237053..7eb6a3af5 100644 --- a/test/e2e/app/main.go +++ b/test/e2e/app/main.go @@ -24,7 +24,7 @@ import ( maverick "github.com/line/ostracon/test/maverick/node" ) -var logger = log.NewTMLogger(log.NewSyncWriter(os.Stdout)) +var logger = log.NewOCLogger(log.NewSyncWriter(os.Stdout)) // main is the binary entrypoint. func main() { @@ -83,7 +83,7 @@ func run(configFile string) error { } } -// startApp starts the application server, listening for connections from Tendermint. +// startApp starts the application server, listening for connections from Ostracon. func startApp(cfg *Config) error { app, err := NewApplication(cfg) if err != nil { @@ -101,8 +101,8 @@ func startApp(cfg *Config) error { return nil } -// startNode starts a Tendermint node running the application directly. It assumes the Tendermint -// configuration is in $TMHOME/config/ostracon.toml. +// startNode starts a Ostracon node running the application directly. It assumes the Ostracon +// configuration is in $OCHOME/config/ostracon.toml. // // FIXME There is no way to simply load the configuration from a file, so we need to pull in Viper. func startNode(cfg *Config) error { @@ -135,8 +135,8 @@ func startNode(cfg *Config) error { return n.Start() } -// startMaverick starts a Maverick node that runs the application directly. It assumes the Tendermint -// configuration is in $TMHOME/config/ostracon.toml. +// startMaverick starts a Maverick node that runs the application directly. It assumes the Ostracon +// configuration is in $OCHOME/config/ostracon.toml. func startMaverick(cfg *Config) error { app, err := NewApplication(cfg) if err != nil { @@ -200,9 +200,9 @@ func startSigner(cfg *Config) error { func setupNode() (*config.Config, log.Logger, *p2p.NodeKey, error) { var tmcfg *config.Config - home := os.Getenv("TMHOME") + home := os.Getenv("OCHOME") if home == "" { - return nil, nil, nil, errors.New("TMHOME not set") + return nil, nil, nil, errors.New("OCHOME not set") } viper.AddConfigPath(filepath.Join(home, "config")) @@ -225,7 +225,7 @@ func setupNode() (*config.Config, log.Logger, *p2p.NodeKey, error) { } if tmcfg.LogFormat == config.LogFormatJSON { - logger = log.NewTMJSONLogger(log.NewSyncWriter(os.Stdout)) + logger = log.NewOCJSONLogger(log.NewSyncWriter(os.Stdout)) } nodeLogger, err := tmflags.ParseLogLevel(tmcfg.LogLevel, logger, config.DefaultLogLevel) diff --git a/test/e2e/docker/Dockerfile b/test/e2e/docker/Dockerfile index a17e9658c..c296cc2bb 100644 --- a/test/e2e/docker/Dockerfile +++ b/test/e2e/docker/Dockerfile @@ -25,7 +25,7 @@ RUN cd test/e2e && make app && cp build/app /usr/bin/app # e.g. leveldb and rocksdb which are already installed in the build image. WORKDIR /ostracon VOLUME /ostracon -ENV TMHOME=/ostracon +ENV OCHOME=/ostracon EXPOSE 26656 26657 26660 6060 ENTRYPOINT ["/usr/bin/entrypoint"] diff --git a/test/e2e/generator/main.go b/test/e2e/generator/main.go index 96c573ac9..a538d0992 100644 --- a/test/e2e/generator/main.go +++ b/test/e2e/generator/main.go @@ -17,7 +17,7 @@ const ( randomSeed int64 = 4827085738 ) -var logger = log.NewTMLogger(log.NewSyncWriter(os.Stdout)) +var logger = log.NewOCLogger(log.NewSyncWriter(os.Stdout)) func main() { NewCLI().Run() diff --git a/test/e2e/pkg/manifest.go b/test/e2e/pkg/manifest.go index 3fbf14558..3d919a449 100644 --- a/test/e2e/pkg/manifest.go +++ b/test/e2e/pkg/manifest.go @@ -73,8 +73,8 @@ type ManifestNode struct { // ABCIProtocol specifies the protocol used to communicate with the ABCI // application: "unix", "tcp", "grpc", or "builtin". Defaults to unix. - // builtin will build a complete Tendermint node into the application and - // launch it instead of launching a separate Tendermint process. + // builtin will build a complete Ostracon node into the application and + // launch it instead of launching a separate Ostracon process. ABCIProtocol string `toml:"abci_protocol"` // PrivvalProtocol specifies the protocol used to sign consensus messages: diff --git a/test/e2e/pkg/testnet.go b/test/e2e/pkg/testnet.go index ee7078bec..ef808a24f 100644 --- a/test/e2e/pkg/testnet.go +++ b/test/e2e/pkg/testnet.go @@ -61,7 +61,7 @@ type Testnet struct { KeyType string } -// Node represents a Tendermint node in a testnet. +// Node represents a Ostracon node in a testnet. type Node struct { Name string Testnet *Testnet diff --git a/test/e2e/runner/cleanup.go b/test/e2e/runner/cleanup.go index 5071d8040..82060aa3f 100644 --- a/test/e2e/runner/cleanup.go +++ b/test/e2e/runner/cleanup.go @@ -61,7 +61,7 @@ func cleanupDir(dir string) error { logger.Info(fmt.Sprintf("Removing testnet directory %q", dir)) - // On Linux, some local files in the volume will be owned by root since Tendermint + // On Linux, some local files in the volume will be owned by root since Ostracon // runs as root inside the container, so we need to clean them up from within a // container running as root too. absDir, err := filepath.Abs(dir) diff --git a/test/e2e/runner/main.go b/test/e2e/runner/main.go index 5cac654c2..d701a5712 100644 --- a/test/e2e/runner/main.go +++ b/test/e2e/runner/main.go @@ -12,7 +12,7 @@ import ( ) var ( - logger = log.NewTMLogger(log.NewSyncWriter(os.Stdout)) + logger = log.NewOCLogger(log.NewSyncWriter(os.Stdout)) ) func main() { diff --git a/test/e2e/runner/setup.go b/test/e2e/runner/setup.go index ddcbba03d..0990536d9 100644 --- a/test/e2e/runner/setup.go +++ b/test/e2e/runner/setup.go @@ -106,7 +106,7 @@ func Setup(testnet *e2e.Testnet) error { filepath.Join(nodeDir, PrivvalStateFile), )).Save() - // Set up a dummy validator. Tendermint requires a file PV even when not used, so we + // Set up a dummy validator. Ostracon requires a file PV even when not used, so we // give it a dummy such that it will fail if it actually tries to use it. (privval.NewFilePV(ed25519.GenPrivKey(), filepath.Join(nodeDir, PrivvalDummyKeyFile), @@ -200,7 +200,7 @@ func MakeGenesis(testnet *e2e.Testnet) (types.GenesisDoc, error) { Power: power, }) } - // The validator set will be sorted internally by Tendermint ranked by power, + // The validator set will be sorted internally by Ostracon ranked by power, // but we sort it here as well so that all genesis files are identical. sort.Slice(genesis.Validators, func(i, j int) bool { return strings.Compare(genesis.Validators[i].Name, genesis.Validators[j].Name) == -1 @@ -215,7 +215,7 @@ func MakeGenesis(testnet *e2e.Testnet) (types.GenesisDoc, error) { return genesis, genesis.ValidateAndComplete() } -// MakeConfig generates a Tendermint config for a node. +// MakeConfig generates a Ostracon config for a node. func MakeConfig(node *e2e.Node) (*config.Config, error) { cfg := config.DefaultConfig() cfg.Moniker = node.Name @@ -242,7 +242,7 @@ func MakeConfig(node *e2e.Node) (*config.Config, error) { return nil, fmt.Errorf("unexpected ABCI protocol setting %q", node.ABCIProtocol) } - // Tendermint errors if it does not have a privval key set up, regardless of whether + // Ostracon errors if it does not have a privval key set up, regardless of whether // it's actually needed (e.g. for remote KMS or non-validators). We set up a dummy // key here by default, and use the real key for actual validators that should use // the file privval. diff --git a/test/fuzz/README.md b/test/fuzz/README.md index 707217afd..64822a237 100644 --- a/test/fuzz/README.md +++ b/test/fuzz/README.md @@ -1,6 +1,6 @@ # fuzz -Fuzzing for various packages in Tendermint using [go-fuzz](https://github.com/dvyukov/go-fuzz) library. +Fuzzing for various packages in Ostracon using [go-fuzz](https://github.com/dvyukov/go-fuzz) library. Inputs: diff --git a/test/fuzz/p2p/secret_connection/init-corpus/main.go b/test/fuzz/p2p/secret_connection/init-corpus/main.go index 635f2d99f..cb5c85d2c 100644 --- a/test/fuzz/p2p/secret_connection/init-corpus/main.go +++ b/test/fuzz/p2p/secret_connection/init-corpus/main.go @@ -33,7 +33,7 @@ func initCorpus(baseDir string) { `{"a": 12, "tsp": 999, k: "blue"}`, `9999.999`, `""`, - `Tendermint fuzzing`, + `Ostracon fuzzing`, } for i, datum := range data { diff --git a/test/fuzz/rpc/jsonrpc/server/handler.go b/test/fuzz/rpc/jsonrpc/server/handler.go index 993a81608..d5ef9d372 100644 --- a/test/fuzz/rpc/jsonrpc/server/handler.go +++ b/test/fuzz/rpc/jsonrpc/server/handler.go @@ -20,7 +20,7 @@ var mux *http.ServeMux func init() { mux := http.NewServeMux() buf := new(bytes.Buffer) - lgr := log.NewTMLogger(buf) + lgr := log.NewOCLogger(buf) rs.RegisterRPCFuncs(mux, rpcFuncMap, lgr) } diff --git a/test/maverick/README.md b/test/maverick/README.md index cbdf7b798..393e19418 100644 --- a/test/maverick/README.md +++ b/test/maverick/README.md @@ -1,6 +1,6 @@ # Maverick -A byzantine node used to test Tendermint consensus against a plethora of different faulty misbehaviors. Designed to easily create new faulty misbehaviors to examine how a Tendermint network reacts to the misbehavior. Can also be used for fuzzy testing with different network arrangements. +A byzantine node used to test Ostracon consensus against a plethora of different faulty misbehaviors. Designed to easily create new faulty misbehaviors to examine how a Ostracon network reacts to the misbehavior. Can also be used for fuzzy testing with different network arrangements. ## Misbehaviors @@ -34,7 +34,7 @@ var MisbehaviorList = map[string]Misbehavior{ ## Setup -The maverick node takes most of the functionality from the existing Tendermint CLI. To install this, in the directory of this readme, run: +The maverick node takes most of the functionality from the existing Ostracon CLI. To install this, in the directory of this readme, run: ```bash go build diff --git a/test/maverick/consensus/reactor.go b/test/maverick/consensus/reactor.go index 98cb841a2..53ad513a1 100644 --- a/test/maverick/consensus/reactor.go +++ b/test/maverick/consensus/reactor.go @@ -1398,15 +1398,15 @@ func (ps *PeerState) StringIndented(indent string) string { //----------------------------------------------------------------------------- // func init() { -// tmjson.RegisterType(&NewRoundStepMessage{}, "tendermint/NewRoundStepMessage") -// tmjson.RegisterType(&NewValidBlockMessage{}, "tendermint/NewValidBlockMessage") -// tmjson.RegisterType(&ProposalMessage{}, "tendermint/Proposal") -// tmjson.RegisterType(&ProposalPOLMessage{}, "tendermint/ProposalPOL") -// tmjson.RegisterType(&BlockPartMessage{}, "tendermint/BlockPart") -// tmjson.RegisterType(&VoteMessage{}, "tendermint/Vote") -// tmjson.RegisterType(&HasVoteMessage{}, "tendermint/HasVote") -// tmjson.RegisterType(&VoteSetMaj23Message{}, "tendermint/VoteSetMaj23") -// tmjson.RegisterType(&VoteSetBitsMessage{}, "tendermint/VoteSetBits") +// tmjson.RegisterType(&NewRoundStepMessage{}, "ostracon/NewRoundStepMessage") +// tmjson.RegisterType(&NewValidBlockMessage{}, "ostracon/NewValidBlockMessage") +// tmjson.RegisterType(&ProposalMessage{}, "ostracon/Proposal") +// tmjson.RegisterType(&ProposalPOLMessage{}, "ostracon/ProposalPOL") +// tmjson.RegisterType(&BlockPartMessage{}, "ostracon/BlockPart") +// tmjson.RegisterType(&VoteMessage{}, "ostracon/Vote") +// tmjson.RegisterType(&HasVoteMessage{}, "ostracon/HasVote") +// tmjson.RegisterType(&VoteSetMaj23Message{}, "ostracon/VoteSetMaj23") +// tmjson.RegisterType(&VoteSetBitsMessage{}, "ostracon/VoteSetBits") // } func decodeMsg(bz []byte) (msg tmcon.Message, err error) { diff --git a/test/maverick/consensus/replay.go b/test/maverick/consensus/replay.go index 1d90fec7c..6b2b03bbb 100644 --- a/test/maverick/consensus/replay.go +++ b/test/maverick/consensus/replay.go @@ -271,7 +271,7 @@ func (h *Handshaker) Handshake(proxyApp proxy.AppConns) error { return fmt.Errorf("error on replay: %v", err) } - h.logger.Info("Completed ABCI Handshake - Tendermint and App are synced", + h.logger.Info("Completed ABCI Handshake - Ostracon and App are synced", "appHeight", blockHeight, "appHash", appHash) // TODO: (on restart) replay mempool @@ -333,7 +333,7 @@ func (h *Handshaker) ReplayBlocks( } // If the app returned validators or consensus params, update the state. if len(res.Validators) > 0 { - vals, err := types.PB2TM.ValidatorUpdates(res.Validators) + vals, err := types.PB2OC.ValidatorUpdates(res.Validators) if err != nil { return nil, err } @@ -375,11 +375,11 @@ func (h *Handshaker) ReplayBlocks( return appHash, sm.ErrAppBlockHeightTooHigh{CoreHeight: storeBlockHeight, AppHeight: appBlockHeight} case storeBlockHeight < stateBlockHeight: - // the state should never be ahead of the store (this is under tendermint's control) + // the state should never be ahead of the store (this is under ostracon's control) panic(fmt.Sprintf("StateBlockHeight (%d) > StoreBlockHeight (%d)", stateBlockHeight, storeBlockHeight)) case storeBlockHeight > stateBlockHeight+1: - // store should be at most one ahead of the state (this is under tendermint's control) + // store should be at most one ahead of the state (this is under ostracon's control) panic(fmt.Sprintf("StoreBlockHeight (%d) > StateBlockHeight + 1 (%d)", storeBlockHeight, stateBlockHeight+1)) } @@ -387,7 +387,7 @@ func (h *Handshaker) ReplayBlocks( // Now either store is equal to state, or one ahead. // For each, consider all cases of where the app could be, given app <= store if storeBlockHeight == stateBlockHeight { - // Tendermint ran Commit and saved the state. + // Ostracon ran Commit and saved the state. // Either the app is asking for replay, or we're all synced up. if appBlockHeight < storeBlockHeight { // the app is behind, so replay blocks, but no need to go through WAL (state is already synced to store) @@ -528,7 +528,7 @@ func assertAppHashEqualsOneFromState(appHash []byte, state sm.State) { State: %v -Did you reset Tendermint without resetting your application's data?`, +Did you reset Ostracon without resetting your application's data?`, appHash, state.AppHash, state)) } } diff --git a/test/maverick/consensus/state.go b/test/maverick/consensus/state.go index 20faa04e3..0cf69efba 100644 --- a/test/maverick/consensus/state.go +++ b/test/maverick/consensus/state.go @@ -872,7 +872,7 @@ func (cs *State) updateToState(state sm.State) { } cs.LastCommit = cs.Votes.Precommits(cs.CommitRound) case cs.LastCommit == nil: - // NOTE: when Tendermint starts, it has no votes. reconstructLastCommit + // NOTE: when Ostracon starts, it has no votes. reconstructLastCommit // must be called to reconstruct LastCommit from SeenCommit. panic(fmt.Sprintf("LastCommit cannot be empty after initial block (H:%d)", state.LastBlockHeight+1, diff --git a/test/maverick/consensus/wal.go b/test/maverick/consensus/wal.go index d95d5e417..3640651ca 100644 --- a/test/maverick/consensus/wal.go +++ b/test/maverick/consensus/wal.go @@ -32,9 +32,9 @@ const ( //-------------------------------------------------------- // types and functions for savings consensus messages // func init() { -// tmjson.RegisterType(msgInfo{}, "tendermint/wal/MsgInfo") -// tmjson.RegisterType(timeoutInfo{}, "tendermint/wal/TimeoutInfo") -// tmjson.RegisterType(tmcon.EndHeightMessage {}, "tendermint/wal/EndHeightMessage ") +// tmjson.RegisterType(msgInfo{}, "ostracon/wal/MsgInfo") +// tmjson.RegisterType(timeoutInfo{}, "ostracon/wal/TimeoutInfo") +// tmjson.RegisterType(tmcon.EndHeightMessage {}, "ostracon/wal/EndHeightMessage ") // } // Write ahead logger writes msgs to disk before they are processed. diff --git a/test/maverick/main.go b/test/maverick/main.go index eb1521d7f..bcfe41a9a 100644 --- a/test/maverick/main.go +++ b/test/maverick/main.go @@ -25,7 +25,7 @@ import ( var ( config = cfg.DefaultConfig() - logger = log.NewTMLogger(log.NewSyncWriter(os.Stdout)) + logger = log.NewOCLogger(log.NewSyncWriter(os.Stdout)) misbehaviorFlag = "" ) @@ -51,11 +51,11 @@ func ParseConfig() (*cfg.Config, error) { return conf, err } -// RootCmd is the root command for Tendermint core. +// RootCmd is the root command for Ostracon core. var RootCmd = &cobra.Command{ Use: "maverick", - Short: "Tendermint Maverick Node", - Long: "Tendermint Maverick Node for testing with faulty consensus misbehaviors in a testnet. Contains " + + Short: "Ostracon Maverick Node", + Long: "Ostracon Maverick Node for testing with faulty consensus misbehaviors in a testnet. Contains " + "all the functionality of a normal node but custom misbehaviors can be injected when running the node " + "through a flag. See maverick node --help for how the misbehavior flag is constructured", PersistentPreRunE: func(cmd *cobra.Command, args []string) (err error) { @@ -67,7 +67,7 @@ var RootCmd = &cobra.Command{ } if config.LogFormat == cfg.LogFormatJSON { - logger = log.NewTMJSONLogger(log.NewSyncWriter(os.Stdout)) + logger = log.NewOCJSONLogger(log.NewSyncWriter(os.Stdout)) } logger, err = tmflags.ParseLogLevel(config.LogLevel, logger, cfg.DefaultLogLevel) @@ -125,7 +125,7 @@ func main() { "e.g. --misbehaviors double-prevote,3\n"+ "You can also have multiple misbehaviors: e.g. double-prevote,3,no-vote,5") - cmd := cli.PrepareBaseCmd(rootCmd, "TM", os.ExpandEnv(filepath.Join("$HOME", cfg.DefaultOstraconDir))) + cmd := cli.PrepareBaseCmd(rootCmd, "OC", os.ExpandEnv(filepath.Join("$HOME", cfg.DefaultOstraconDir))) if err := cmd.Execute(); err != nil { panic(err) } @@ -163,7 +163,7 @@ func startNode(config *cfg.Config, logger log.Logger, misbehaviorFlag string) er var InitFilesCmd = &cobra.Command{ Use: "init", - Short: "Initialize Tendermint", + Short: "Initialize Ostracon", RunE: initFiles, } diff --git a/test/maverick/node/node.go b/test/maverick/node/node.go index fdb7f6b92..d5bf92cde 100644 --- a/test/maverick/node/node.go +++ b/test/maverick/node/node.go @@ -116,7 +116,7 @@ func DefaultGenesisDocProviderFunc(config *cfg.Config) GenesisDocProvider { // Provider takes a config and a logger and returns a ready to go Node. type Provider func(*cfg.Config, log.Logger) (*Node, error) -// DefaultNewNode returns a Tendermint node with default settings for the +// DefaultNewNode returns a Ostracon node with default settings for the // PrivValidator, ClientCreator, GenesisDoc, and DBProvider. // It implements NodeProvider. func DefaultNewNode(config *cfg.Config, logger log.Logger, misbehaviors map[int64]cs.Misbehavior) (*Node, error) { @@ -213,7 +213,7 @@ func StateProvider(stateProvider statesync.StateProvider) Option { //------------------------------------------------------------------------------ -// Node is the highest level interface to a full Tendermint node. +// Node is the highest level interface to a full Ostracon node. // It includes all configuration information and running services. type Node struct { service.BaseService @@ -331,7 +331,7 @@ func doHandshake( func logNodeStartupInfo(state sm.State, pubKey crypto.PubKey, logger, consensusLogger log.Logger) { // Log the version info. logger.Info("Version info", - "software", version.TMCoreSemVer, + "software", version.OCCoreSemVer, "block", version.BlockProtocol, "p2p", version.P2PProtocol, ) @@ -662,7 +662,7 @@ func startStateSync(ssR *statesync.Reactor, bcR fastSyncReactor, conR *cs.Reacto return nil } -// NewNode returns a new, ready to go, Tendermint Node. +// NewNode returns a new, ready to go, Ostracon Node. func NewNode(config *cfg.Config, privValidator types.PrivValidator, nodeKey *p2p.NodeKey, @@ -1297,7 +1297,7 @@ func makeNodeInfo( ), DefaultNodeID: nodeKey.ID(), Network: genDoc.ChainID, - Version: version.TMCoreSemVer, + Version: version.OCCoreSemVer, Channels: []byte{ bcChannel, cs.StateChannel, cs.DataChannel, cs.VoteChannel, cs.VoteSetBitsChannel, diff --git a/tools/README.md b/tools/README.md index 44bd0691d..59a9cc061 100644 --- a/tools/README.md +++ b/tools/README.md @@ -1,5 +1,5 @@ # tools -Tools for working with Tendermint and associated technologies. Documentation for +Tools for working with Ostracon and associated technologies. Documentation for these tools can be found online in the [Tendermint tools documentation](https://docs.tendermint.com/master/tools/). diff --git a/tools/mintnet-kubernetes/README.rst b/tools/mintnet-kubernetes/README.rst index b402993a0..93d755e68 100644 --- a/tools/mintnet-kubernetes/README.rst +++ b/tools/mintnet-kubernetes/README.rst @@ -207,7 +207,7 @@ First pod details: kubectl describe pod tm-0 -Tendermint app logs from the first pod: +Ostracon app logs from the first pod: :: @@ -219,7 +219,7 @@ App logs from the first pod: kubectl logs tm-0 -c app -f -Status of the second pod's Tendermint app: +Status of the second pod's Ostracon app: :: @@ -287,4 +287,4 @@ Init containers (``tm-gen-validator``) are run before all other containers, creating public-private key pair for each pod. Every ``tm`` container then asks other pods for their public keys, which are served with nginx (``pub-key`` container). When ``tm`` container have all the -keys, it forms a genesis file and starts the Tendermint process. +keys, it forms a genesis file and starts the Ostracon process. diff --git a/tools/mintnet-kubernetes/app.template.yaml b/tools/mintnet-kubernetes/app.template.yaml index e463e20b3..777a0c5c3 100644 --- a/tools/mintnet-kubernetes/app.template.yaml +++ b/tools/mintnet-kubernetes/app.template.yaml @@ -111,7 +111,7 @@ spec: configMapKeyRef: name: tm-config key: validators - - name: TMHOME + - name: OCHOME value: /ostracon command: - bash diff --git a/tools/mintnet-kubernetes/examples/counter/app.yaml b/tools/mintnet-kubernetes/examples/counter/app.yaml index 56aaabe19..59070913f 100644 --- a/tools/mintnet-kubernetes/examples/counter/app.yaml +++ b/tools/mintnet-kubernetes/examples/counter/app.yaml @@ -103,7 +103,7 @@ spec: configMapKeyRef: name: tm-config key: validators - - name: TMHOME + - name: OCHOME value: /ostracon command: - bash diff --git a/tools/mintnet-kubernetes/examples/dummy/app.yaml b/tools/mintnet-kubernetes/examples/dummy/app.yaml index 0a1ef3afb..d029a0bc5 100644 --- a/tools/mintnet-kubernetes/examples/dummy/app.yaml +++ b/tools/mintnet-kubernetes/examples/dummy/app.yaml @@ -103,7 +103,7 @@ spec: configMapKeyRef: name: tm-config key: validators - - name: TMHOME + - name: OCHOME value: /ostracon command: - bash diff --git a/tools/tm-signer-harness/internal/test_harness.go b/tools/tm-signer-harness/internal/test_harness.go index b4e227b9b..521fecbdb 100644 --- a/tools/tm-signer-harness/internal/test_harness.go +++ b/tools/tm-signer-harness/internal/test_harness.go @@ -49,7 +49,7 @@ type TestHarnessError struct { var _ error = (*TestHarnessError)(nil) // TestHarness allows for testing of a remote signer to ensure compatibility -// with this version of Tendermint. +// with this version of Ostracon. type TestHarness struct { addr string signerClient *privval.SignerClient @@ -85,7 +85,7 @@ type timeoutError interface { Timeout() bool } -// NewTestHarness will load Tendermint data from the given files (including +// NewTestHarness will load Ostracon data from the given files (including // validator public/private keypairs and chain details) and create a new // harness. func NewTestHarness(logger log.Logger, cfg TestHarnessConfig) (*TestHarness, error) { @@ -189,7 +189,7 @@ func (th *TestHarness) Run() { // TestPublicKey just validates that we can (1) fetch the public key from the // remote signer, and (2) it matches the public key we've configured for our -// local Tendermint version. +// local Ostracon version. func (th *TestHarness) TestPublicKey() error { th.logger.Info("TEST: Public key of remote signer") fpvk, err := th.fpv.GetPubKey() diff --git a/tools/tm-signer-harness/main.go b/tools/tm-signer-harness/main.go index 450d4dc53..63557364e 100644 --- a/tools/tm-signer-harness/main.go +++ b/tools/tm-signer-harness/main.go @@ -18,19 +18,19 @@ import ( const ( defaultAcceptRetries = 100 defaultBindAddr = "tcp://127.0.0.1:0" - defaultTMHome = "~/.ostracon" + defaultOCHome = "~/.ostracon" defaultAcceptDeadline = 1 defaultConnDeadline = 3 defaultExtractKeyOutput = "./signing.key" ) -var logger = log.NewTMLogger(log.NewSyncWriter(os.Stdout)) +var logger = log.NewOCLogger(log.NewSyncWriter(os.Stdout)) // Command line flags var ( flagAcceptRetries int flagBindAddr string - flagTMHome string + flagOCHome string flagKeyOutputPath string ) @@ -45,13 +45,13 @@ var ( func init() { rootCmd = flag.NewFlagSet("root", flag.ExitOnError) rootCmd.Usage = func() { - fmt.Println(`Remote signer test harness for Tendermint. + fmt.Println(`Remote signer test harness for Ostracon. Usage: tm-signer-harness [flags] Available Commands: - extract_key Extracts a signing key from a local Tendermint instance + extract_key Extracts a signing key from a local Ostracon instance help Help on the available commands run Runs the test harness version Display version information and exit @@ -66,9 +66,9 @@ Use "tm-signer-harness help " for more information about that command.` defaultAcceptRetries, "The number of attempts to listen for incoming connections") runCmd.StringVar(&flagBindAddr, "addr", defaultBindAddr, "Bind to this address for the testing") - runCmd.StringVar(&flagTMHome, "tmhome", defaultTMHome, "Path to the Tendermint home directory") + runCmd.StringVar(&flagOCHome, "ochome", defaultOCHome, "Path to the Ostracon home directory") runCmd.Usage = func() { - fmt.Println(`Runs the remote signer test harness for Tendermint. + fmt.Println(`Runs the remote signer test harness for Ostracon. Usage: tm-signer-harness run [flags] @@ -83,9 +83,9 @@ Flags:`) "output", defaultExtractKeyOutput, "Path to which signing key should be written") - extractKeyCmd.StringVar(&flagTMHome, "tmhome", defaultTMHome, "Path to the Tendermint home directory") + extractKeyCmd.StringVar(&flagOCHome, "ochome", defaultOCHome, "Path to the Ostracon home directory") extractKeyCmd.Usage = func() { - fmt.Println(`Extracts a signing key from a local Tendermint instance for use in the remote + fmt.Println(`Extracts a signing key from a local Ostracon instance for use in the remote signer under test. Usage: @@ -99,7 +99,7 @@ Flags:`) versionCmd = flag.NewFlagSet("version", flag.ExitOnError) versionCmd.Usage = func() { fmt.Println(` -Prints the Tendermint version for which this remote signer harness was built. +Prints the Ostracon version for which this remote signer harness was built. Usage: tm-signer-harness version`) @@ -107,13 +107,13 @@ Usage: } } -func runTestHarness(acceptRetries int, bindAddr, tmhome string) { - tmhome = internal.ExpandPath(tmhome) +func runTestHarness(acceptRetries int, bindAddr, ochome string) { + ochome = internal.ExpandPath(ochome) cfg := internal.TestHarnessConfig{ BindAddr: bindAddr, - KeyFile: filepath.Join(tmhome, "config", "priv_validator_key.json"), - StateFile: filepath.Join(tmhome, "data", "priv_validator_state.json"), - GenesisFile: filepath.Join(tmhome, "config", "genesis.json"), + KeyFile: filepath.Join(ochome, "config", "priv_validator_key.json"), + StateFile: filepath.Join(ochome, "data", "priv_validator_state.json"), + GenesisFile: filepath.Join(ochome, "config", "genesis.json"), AcceptDeadline: time.Duration(defaultAcceptDeadline) * time.Second, AcceptRetries: acceptRetries, ConnDeadline: time.Duration(defaultConnDeadline) * time.Second, @@ -131,9 +131,9 @@ func runTestHarness(acceptRetries int, bindAddr, tmhome string) { harness.Run() } -func extractKey(tmhome, outputPath string) { - keyFile := filepath.Join(internal.ExpandPath(tmhome), "config", "priv_validator_key.json") - stateFile := filepath.Join(internal.ExpandPath(tmhome), "data", "priv_validator_state.json") +func extractKey(ochome, outputPath string) { + keyFile := filepath.Join(internal.ExpandPath(ochome), "config", "priv_validator_key.json") + stateFile := filepath.Join(internal.ExpandPath(ochome), "data", "priv_validator_state.json") fpv := privval.LoadFilePV(keyFile, stateFile) pkb := []byte(fpv.Key.PrivKey.(ed25519.PrivKey)) if err := ioutil.WriteFile(internal.ExpandPath(outputPath), pkb[:32], 0600); err != nil { @@ -173,15 +173,15 @@ func main() { fmt.Printf("Error parsing flags: %v\n", err) os.Exit(1) } - runTestHarness(flagAcceptRetries, flagBindAddr, flagTMHome) + runTestHarness(flagAcceptRetries, flagBindAddr, flagOCHome) case "extract_key": if err := extractKeyCmd.Parse(os.Args[2:]); err != nil { fmt.Printf("Error parsing flags: %v\n", err) os.Exit(1) } - extractKey(flagTMHome, flagKeyOutputPath) + extractKey(flagOCHome, flagKeyOutputPath) case "version": - fmt.Println(version.TMCoreSemVer) + fmt.Println(version.OCCoreSemVer) default: fmt.Printf("Unrecognized command: %s\n", flag.Arg(0)) os.Exit(1) diff --git a/types/block.go b/types/block.go index 841cbde6b..88a7a17ee 100644 --- a/types/block.go +++ b/types/block.go @@ -43,7 +43,7 @@ const ( MaxOverheadForBlock int64 = 11 ) -// Block defines the atomic unit of a Tendermint blockchain. +// Block defines the atomic unit of a Ostracon blockchain. type Block struct { mtx tmsync.Mutex @@ -329,7 +329,7 @@ func MaxDataBytesNoEvidence(maxBytes int64, valsCount int) int64 { //----------------------------------------------------------------------------- -// Header defines the structure of a Tendermint block header. +// Header defines the structure of a Ostracon block header. // NOTE: changes to the Header should be duplicated in: // - header.Hash() // - abci.Header diff --git a/types/event_bus.go b/types/event_bus.go index a998f0563..d32226219 100644 --- a/types/event_bus.go +++ b/types/event_bus.go @@ -99,7 +99,7 @@ func (b *EventBus) UnsubscribeAll(ctx context.Context, subscriber string) error return b.pubsub.UnsubscribeAll(ctx, subscriber) } -func (b *EventBus) Publish(eventType string, eventData TMEventData) error { +func (b *EventBus) Publish(eventType string, eventData OCEventData) error { // no explicit deadline for publishing events ctx := context.Background() return b.pubsub.PublishWithEvents(ctx, eventData, map[string][]string{EventTypeKey: {eventType}}) diff --git a/types/events.go b/types/events.go index 5256c33f6..db5b809e1 100644 --- a/types/events.go +++ b/types/events.go @@ -40,22 +40,22 @@ const ( // ENCODING / DECODING -// TMEventData implements events.EventData. -type TMEventData interface { +// OCEventData implements events.EventData. +type OCEventData interface { // empty interface } func init() { - tmjson.RegisterType(EventDataNewBlock{}, "tendermint/event/NewBlock") - tmjson.RegisterType(EventDataNewBlockHeader{}, "tendermint/event/NewBlockHeader") - tmjson.RegisterType(EventDataNewEvidence{}, "tendermint/event/NewEvidence") - tmjson.RegisterType(EventDataTx{}, "tendermint/event/Tx") - tmjson.RegisterType(EventDataRoundState{}, "tendermint/event/RoundState") - tmjson.RegisterType(EventDataNewRound{}, "tendermint/event/NewRound") - tmjson.RegisterType(EventDataCompleteProposal{}, "tendermint/event/CompleteProposal") - tmjson.RegisterType(EventDataVote{}, "tendermint/event/Vote") - tmjson.RegisterType(EventDataValidatorSetUpdates{}, "tendermint/event/ValidatorSetUpdates") - tmjson.RegisterType(EventDataString(""), "tendermint/event/ProposalString") + tmjson.RegisterType(EventDataNewBlock{}, "ostracon/event/NewBlock") + tmjson.RegisterType(EventDataNewBlockHeader{}, "ostracon/event/NewBlockHeader") + tmjson.RegisterType(EventDataNewEvidence{}, "ostracon/event/NewEvidence") + tmjson.RegisterType(EventDataTx{}, "ostracon/event/Tx") + tmjson.RegisterType(EventDataRoundState{}, "ostracon/event/RoundState") + tmjson.RegisterType(EventDataNewRound{}, "ostracon/event/NewRound") + tmjson.RegisterType(EventDataCompleteProposal{}, "ostracon/event/CompleteProposal") + tmjson.RegisterType(EventDataVote{}, "ostracon/event/Vote") + tmjson.RegisterType(EventDataValidatorSetUpdates{}, "ostracon/event/ValidatorSetUpdates") + tmjson.RegisterType(EventDataString(""), "ostracon/event/ProposalString") } // Most event messages are basic types (a block, a transaction) diff --git a/types/evidence.go b/types/evidence.go index c0c28c1a9..4d97b625b 100644 --- a/types/evidence.go +++ b/types/evidence.go @@ -515,8 +515,8 @@ func EvidenceFromProto(evidence *tmproto.Evidence) (Evidence, error) { } func init() { - tmjson.RegisterType(&DuplicateVoteEvidence{}, "tendermint/DuplicateVoteEvidence") - tmjson.RegisterType(&LightClientAttackEvidence{}, "tendermint/LightClientAttackEvidence") + tmjson.RegisterType(&DuplicateVoteEvidence{}, "ostracon/DuplicateVoteEvidence") + tmjson.RegisterType(&LightClientAttackEvidence{}, "ostracon/LightClientAttackEvidence") } //-------------------------------------------- ERRORS -------------------------------------- diff --git a/types/priv_validator.go b/types/priv_validator.go index adae730dd..c083e3449 100644 --- a/types/priv_validator.go +++ b/types/priv_validator.go @@ -14,7 +14,7 @@ import ( tmproto "github.com/line/ostracon/proto/ostracon/types" ) -// PrivValidator defines the functionality of a local Tendermint validator +// PrivValidator defines the functionality of a local Ostracon validator // that signs votes and proposals, and never double signs. type PrivValidator interface { GetPubKey() (crypto.PubKey, error) diff --git a/types/protobuf.go b/types/protobuf.go index b2d220df4..c534eb655 100644 --- a/types/protobuf.go +++ b/types/protobuf.go @@ -32,7 +32,7 @@ var ABCIPubKeyTypesToNames = map[string]string{ //------------------------------------------------------- -// OC2PB is used for converting Tendermint ABCI to protobuf ABCI. +// OC2PB is used for converting Ostracon ABCI to protobuf ABCI. // UNSTABLE var OC2PB = oc2pb{} @@ -128,9 +128,9 @@ func (oc2pb) NewValidatorUpdate(pubkey crypto.PubKey, power int64) abci.Validato //---------------------------------------------------------------------------- -// PB2TM is used for converting protobuf ABCI to Tendermint ABCI. +// PB2OC is used for converting protobuf ABCI to Ostracon ABCI. // UNSTABLE -var PB2TM = pb2tm{} +var PB2OC = pb2tm{} type pb2tm struct{} diff --git a/types/protobuf_test.go b/types/protobuf_test.go index 4a4fa7a2b..566631384 100644 --- a/types/protobuf_test.go +++ b/types/protobuf_test.go @@ -54,7 +54,7 @@ func TestABCIValidators(t *testing.T) { tmVal := NewValidator(pkEd, 10) abciVal := OC2PB.ValidatorUpdate(tmVal) - tmVals, err := PB2TM.ValidatorUpdates([]abci.ValidatorUpdate{abciVal}) + tmVals, err := PB2OC.ValidatorUpdates([]abci.ValidatorUpdate{abciVal}) assert.Nil(t, err) assert.Equal(t, tmValExpected, tmVals[0]) @@ -65,7 +65,7 @@ func TestABCIValidators(t *testing.T) { tmVal.Address = pkEd.Address() abciVal = OC2PB.ValidatorUpdate(tmVal) - tmVals, err = PB2TM.ValidatorUpdates([]abci.ValidatorUpdate{abciVal}) + tmVals, err = PB2OC.ValidatorUpdates([]abci.ValidatorUpdate{abciVal}) assert.Nil(t, err) assert.Equal(t, tmValExpected, tmVals[0]) } diff --git a/types/tx.go b/types/tx.go index 6a506c6d3..41f3120e6 100644 --- a/types/tx.go +++ b/types/tx.go @@ -16,7 +16,7 @@ import ( // Might we want types here ? type Tx []byte -// Hash computes the TMHASH hash of the wire encoded transaction. +// Hash computes the OCHASH hash of the wire encoded transaction. func (tx Tx) Hash() []byte { return tmhash.Sum(tx) } diff --git a/version/version.go b/version/version.go index 4050db234..51ba5a873 100644 --- a/version/version.go +++ b/version/version.go @@ -1,15 +1,15 @@ package version var ( - // TMCoreSemVer is the current version of Tendermint Core. + // OCCoreSemVer is the current version of Ostracon Core. // It's the Semantic Version of the software. - TMCoreSemVer string + OCCoreSemVer string // GitCommit is the current HEAD set using ldflags. GitCommit string // Version is the built softwares version. - Version = TMCoreSemVer + "-" + LINECoreSemVer + Version = OCCoreSemVer + "-" + LINECoreSemVer ) func init() { @@ -19,7 +19,7 @@ func init() { } const ( - // LINECoreSemVer is the current version of LINE Tendermint Core. + // LINECoreSemVer is the current version of LINE Ostracon Core. LINECoreSemVer = "0.3" // ABCISemVer is the semantic version of the ABCI library