diff --git a/Tiltfile b/Tiltfile index ea1a91d45..b0458ecf1 100644 --- a/Tiltfile +++ b/Tiltfile @@ -8,6 +8,13 @@ load("ext://namespace", "namespace_create", "namespace_inject") load("ext://secret", "secret_yaml_generic") +# set the replica value of a StatefulSet +def set_replicas_in_statefulset(config_yaml, statefulset_name, num_replicas): + for obj in config_yaml: + if obj["kind"] == "StatefulSet" and obj["metadata"]["name"] == statefulset_name: + obj["spec"]["replicas"] = num_replicas + return config_yaml + allow_k8s_contexts("ci") # Disable telemetry by default @@ -54,7 +61,6 @@ config.define_bool("guardiand_debug", False, "Enable dlv endpoint for guardiand" config.define_bool("node_metrics", False, "Enable Prometheus & Grafana for Guardian metrics") config.define_bool("guardiand_governor", False, "Enable chain governor in guardiand") config.define_bool("wormchain", False, "Enable a wormchain node") -config.define_bool("secondWormchain", False, "Enable a second wormchain node with different validator keys") config.define_bool("ibc_relayer", False, "Enable IBC relayer between cosmos chains") cfg = config.parse() @@ -79,7 +85,6 @@ ci_tests = cfg.get("ci_tests", ci) guardiand_debug = cfg.get("guardiand_debug", False) node_metrics = cfg.get("node_metrics", False) guardiand_governor = cfg.get("guardiand_governor", False) -secondWormchain = cfg.get("secondWormchain", False) ibc_relayer = cfg.get("ibc_relayer", False) btc = cfg.get("btc", False) @@ -139,9 +144,10 @@ def command_with_dlv(argv): def build_node_yaml(): node_yaml = read_yaml_stream("devnet/node.yaml") - for obj in node_yaml: + node_yaml_with_replicas = set_replicas_in_statefulset(node_yaml, "guardian", num_guardians) + + for obj in node_yaml_with_replicas: if obj["kind"] == "StatefulSet" and obj["metadata"]["name"] == "guardian": - obj["spec"]["replicas"] = num_guardians container = obj["spec"]["template"]["spec"]["containers"][0] if container["name"] != "guardiand": fail("container 0 is not guardiand") @@ -183,7 +189,7 @@ def build_node_yaml(): container["command"] += [ "--suiRPC", "http://sui:9002", -# In testnet and mainnet, you will need to also specify the suiPackage argument. In Devnet, we subscribe to +# In testnet and mainnet, you will need to also specify the suiPackage argument. In Devnet, we subscribe to # event traffic purely based on the account since that is the only thing that is deterministic. # "--suiPackage", # "0x.....", @@ -272,12 +278,12 @@ def build_node_yaml(): if wormchain: container["command"] += [ "--wormchainWS", - "ws://guardian-validator:26657/websocket", + "ws://wormchain:26657/websocket", "--wormchainLCD", - "http://guardian-validator:1317" + "http://wormchain:1317" ] - return encode_yaml_stream(node_yaml) + return encode_yaml_stream(node_yaml_with_replicas) k8s_yaml_with_ns(build_node_yaml()) @@ -297,7 +303,7 @@ if algorand: if aptos: guardian_resource_deps = guardian_resource_deps + ["aptos"] if wormchain: - guardian_resource_deps = guardian_resource_deps + ["guardian-validator"] + guardian_resource_deps = guardian_resource_deps + ["wormchain"] if sui: guardian_resource_deps = guardian_resource_deps + ["sui"] @@ -737,14 +743,52 @@ if wormchain: ref = "wormchaind-image", context = ".", dockerfile = "./wormchain/Dockerfile", + build_args = {"num_guardians": str(num_guardians)}, only = [], ignore = ["./wormchain/testing", "./wormchain/ts-sdk", "./wormchain/design", "./wormchain/vue", "./wormchain/build/wormchaind"], ) - k8s_yaml_with_ns("wormchain/validators/kubernetes/wormchain-guardian-devnet.yaml") + def build_wormchain_yaml(yaml_path, num_instances): + wormchain_yaml = read_yaml_stream(yaml_path) + + # set the number of replicas in the StatefulSet to be num_guardians + wormchain_set = set_replicas_in_statefulset(wormchain_yaml, "wormchain", num_instances) + + # add a Service for each wormchain instance + services = [] + for obj in wormchain_set: + if obj["kind"] == "Service" and obj["metadata"]["name"] == "wormchain-0": + + # make a Service for each replica so we can resolve it by name from other pods. + # copy wormchain-0's Service then set the name and selector for the instance. + for instance_num in list(range(1, num_instances)): + instance_name = 'wormchain-%s' % (instance_num) + + # Copy the Service's properties to a new dict, by value, three levels deep. + # tl;dr - if the value is a dict, use a comprehension to copy it immutably. + service = { k: ({ k2: ({ k3:v3 + for (k3,v3) in v2.items()} if type(v2) == "dict" else v2) + for (k2,v2) in v.items()} if type(v) == "dict" else v) + for (k,v) in obj.items()} + + # add the name we want to be able to resolve via k8s DNS + service["metadata"]["name"] = instance_name + # add the name of the pod the service should connect to + service["spec"]["selector"] = { "statefulset.kubernetes.io/pod-name": instance_name } + + services.append(service) + + return encode_yaml_stream(wormchain_set + services) + + wormchain_path = "devnet/wormchain.yaml" + if num_guardians >= 2: + # update wormchain's k8s config to spin up multiple instances + k8s_yaml_with_ns(build_wormchain_yaml(wormchain_path, num_guardians)) + else: + k8s_yaml_with_ns(wormchain_path) k8s_resource( - "guardian-validator", + "wormchain", port_forwards = [ port_forward(1319, container_port = 1317, name = "REST [:1319]", host = webHost), port_forward(9090, container_port = 9090, name = "GRPC", host = webHost), @@ -755,19 +799,6 @@ if wormchain: trigger_mode = trigger_mode, ) - if secondWormchain: - k8s_yaml_with_ns("wormchain/validators/kubernetes/wormchain-validator2-devnet.yaml") - - k8s_resource( - "second-validator", - port_forwards = [ - port_forward(1320, container_port = 1317, name = "REST [:1320]", host = webHost), - port_forward(26660, container_port = 26657, name = "TENDERMINT [:26660]", host = webHost) - ], - resource_deps = [], - labels = ["wormchain"], - trigger_mode = trigger_mode, - ) if ibc_relayer: docker_build( diff --git a/wormchain/validators/kubernetes/wormchain-guardian-devnet.yaml b/devnet/wormchain.yaml similarity index 51% rename from wormchain/validators/kubernetes/wormchain-guardian-devnet.yaml rename to devnet/wormchain.yaml index 36a38660b..dc0bd1dd3 100644 --- a/wormchain/validators/kubernetes/wormchain-guardian-devnet.yaml +++ b/devnet/wormchain.yaml @@ -1,15 +1,17 @@ +# Service for pods in the StatefulSet, for RPC clients. +# these ports are exposed to the host OS via Tiltfile config. apiVersion: v1 kind: Service metadata: labels: - app: guardian-validator - name: guardian-validator + app: wormchain + name: wormchain spec: ports: - name: rpc port: 26657 protocol: TCP - - name: rpctwo + - name: p2p port: 26656 protocol: TCP - name: rest @@ -19,40 +21,64 @@ spec: port: 9090 protocol: TCP selector: - app: guardian-validator + app: wormchain +--- +# Service for an individual pod, so other pods can resolve it by name for p2p. +apiVersion: v1 +kind: Service +metadata: + labels: + app: wormchain + name: wormchain-0 +spec: + ports: + - name: rpc + port: 26657 + protocol: TCP + - name: p2p + port: 26656 + protocol: TCP + - name: rest + port: 1317 + protocol: TCP + - name: cosmos-rpc + port: 9090 + protocol: TCP + selector: + statefulset.kubernetes.io/pod-name: wormchain-0 --- apiVersion: apps/v1 kind: StatefulSet metadata: labels: - app: guardian-validator - name: guardian-validator + app: wormchain + name: wormchain spec: - replicas: 1 selector: matchLabels: - app: guardian-validator + app: wormchain + serviceName: wormchain + replicas: 1 + updateStrategy: + type: RollingUpdate template: metadata: labels: - app: guardian-validator + app: wormchain spec: containers: - name: wormchaind image: wormchaind-image command: - - /app/build/wormchaind - - start - - --home - - /app/validators/first_validator - - --log_level - - warn + - /bin/bash + - -c + - "/app/devnet/create-config.sh; /app/build/wormchaind start" ports: - containerPort: 26657 name: tendermint protocol: TCP - containerPort: 26656 - name: tenderminttwo + name: p2p protocol: TCP - containerPort: 1317 name: rest @@ -64,6 +90,5 @@ spec: httpGet: port: 26657 path: / - periodSeconds: 1 + periodSeconds: 5 restartPolicy: Always - serviceName: guardian-validator diff --git a/scripts/devnet-consts.json b/scripts/devnet-consts.json index 802649644..eb54218c0 100644 --- a/scripts/devnet-consts.json +++ b/scripts/devnet-consts.json @@ -236,7 +236,7 @@ } }, "3104": { - "rpcUrlTilt": "http://guardian-validator:1317", + "rpcUrlTilt": "http://wormchain:1317", "rpcUrlLocal": "http://localhost:1319", "rpcPort": "1319", "contracts": { diff --git a/wormchain/.gitignore b/wormchain/.gitignore index 8507f5aab..a8381f01c 100644 --- a/wormchain/.gitignore +++ b/wormchain/.gitignore @@ -8,8 +8,10 @@ testing/js/node_modules build/wormhole-chaind build/wormchaind build/data -validators/first_validator/keyring-test -validators/second_validator/keyring-test +devnet/wormchain-*/data +devnet/wormchain-*/config/*.toml +devnet/wormchain-*/config/addrbook.json +devnet/wormchain-*/config/genesis.json ts-sdk/node_modules ts-sdk/lib diff --git a/wormchain/Dockerfile b/wormchain/Dockerfile index 5b92a2dd3..dffa9d768 100644 --- a/wormchain/Dockerfile +++ b/wormchain/Dockerfile @@ -12,20 +12,30 @@ COPY ./wormchain/go.sum . COPY ./sdk /sdk RUN go mod download +# copy over c bindings (libwasmvm.x86_64.so, etc) +RUN cp -r /go/pkg/mod/github.com/!cosm!wasm/wasmvm@v1.0.0/api/* /usr/lib + COPY ./wormchain . EXPOSE 26657 EXPOSE 26656 -EXPOSE 6060 -EXPOSE 9090 +EXPOSE 6060 +EXPOSE 9090 EXPOSE 1317 EXPOSE 4500 RUN unset GOPATH +# create the dir for the default "home" config +RUN mkdir -p /root/.wormchain + +ARG num_guardians +ENV NUM_GUARDIANS=$num_guardians + +RUN /bin/bash /app/devnet/create-genesis.sh + RUN make client RUN chmod +x /app/build/wormchaind -RUN make validators -RUN /app/build/wormchaind collect-gentxs --home /app/build + ENTRYPOINT ["/bin/bash","-c","/app/build/wormchaind start"] diff --git a/wormchain/Makefile b/wormchain/Makefile index fdee1800c..d08351ccd 100644 --- a/wormchain/Makefile +++ b/wormchain/Makefile @@ -15,30 +15,11 @@ ldflags = \ BUILD_FLAGS := -ldflags '$(ldflags)' .PHONY: all -all: client validators +all: client .PHONY: client client: build/wormchaind -.PHONY: validators -validators: - # These files change when the genesis file changes, so we need to make - # sure to copy them over - touch -m $@ - ./build/wormchaind --home build/ tendermint unsafe-reset-all - ./build/wormchaind --home build/ gentx tiltGuardian "0uworm" --chain-id=wormchain --min-self-delegation="0" --keyring-dir=keyring-test - - # Copy config to validators/first_validator - cp build/config/priv_validator_key.json validators/first_validator/config/ - cp build/config/node_key.json validators/first_validator/config/ - mkdir -p validators/first_validator/keyring-test - cp build/keyring-test/* validators/first_validator/keyring-test/ - - # Copy these lines for each new validator - # We grab the validator's address from the gentx memo that it creates. - sed -E "s/(persistent_peers = \")[^@]*/\1$$(grep -lR MsgCreateValidator build/config/gentx | xargs grep -l $(TILT_VALADDRESS) | xargs jq '.body.memo' -r | cut -d@ -f1)/" validators/second_validator/config/config.toml -i - mkdir -p validators/second_validator/keyring-test - cp build/keyring-test/* validators/second_validator/keyring-test/ build/wormchaind: cmd/wormchaind/main.go $(GO_FILES) go build -v $(BUILD_FLAGS) -tags ledger -o $@ $< diff --git a/wormchain/build/data/priv_validator_state.json b/wormchain/build/data/priv_validator_state.json new file mode 100644 index 000000000..8c5a2a9ef --- /dev/null +++ b/wormchain/build/data/priv_validator_state.json @@ -0,0 +1 @@ +{"height":"0","round":0,"step":0} diff --git a/wormchain/devnet/base/config/app.toml b/wormchain/devnet/base/config/app.toml new file mode 100644 index 000000000..09b0c935f --- /dev/null +++ b/wormchain/devnet/base/config/app.toml @@ -0,0 +1,208 @@ +# Cosmos Node config + +############################################################################### +### Base Configuration ### +############################################################################### + +chain-id = "wormchain" + +# The minimum gas prices a validator is willing to accept for processing a +# transaction. A transaction's fees must meet the minimum of any denomination +# specified in this config (e.g. 0.25token1;0.0001token2). +minimum-gas-prices = "0uworm" + +# default: the last 100 states are kept in addition to every 500th state; pruning at 10 block intervals +# nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node) +# everything: all saved states will be deleted, storing only the current and previous state; pruning at 10 block intervals +# custom: allow pruning options to be manually specified through 'pruning-keep-recent', 'pruning-keep-every', and 'pruning-interval' +pruning = "default" + +# These are applied if and only if the pruning strategy is custom. +pruning-keep-recent = "0" +pruning-keep-every = "0" +pruning-interval = "0" + +# HaltHeight contains a non-zero block height at which a node will gracefully +# halt and shutdown that can be used to assist upgrades and testing. +# +# Note: Commitment of state will be attempted on the corresponding block. +halt-height = 0 + +# HaltTime contains a non-zero minimum block time (in Unix seconds) at which +# a node will gracefully halt and shutdown that can be used to assist upgrades +# and testing. +# +# Note: Commitment of state will be attempted on the corresponding block. +halt-time = 0 + +# MinRetainBlocks defines the minimum block height offset from the current +# block being committed, such that all blocks past this offset are pruned +# from Tendermint. It is used as part of the process of determining the +# ResponseCommit.RetainHeight value during ABCI Commit. A value of 0 indicates +# that no blocks should be pruned. +# +# This configuration value is only responsible for pruning Tendermint blocks. +# It has no bearing on application state pruning which is determined by the +# "pruning-*" configurations. +# +# Note: Tendermint block pruning is dependant on this parameter in conunction +# with the unbonding (safety threshold) period, state pruning and state sync +# snapshot parameters to determine the correct minimum value of +# ResponseCommit.RetainHeight. +min-retain-blocks = 0 + +# InterBlockCache enables inter-block caching. +inter-block-cache = true + +# IndexEvents defines the set of events in the form {eventType}.{attributeKey}, +# which informs Tendermint what to index. If empty, all events will be indexed. +# +# Example: +# ["message.sender", "message.recipient"] +index-events = [] + +# IavlCacheSize set the size of the iavl tree cache. +# Default cache size is 50mb. +iavl-cache-size = 781250 + +# IAVLDisableFastNode enables or disables the fast node feature of IAVL. +# Default is true. +iavl-disable-fastnode = true + +############################################################################### +### Telemetry Configuration ### +############################################################################### + +[telemetry] + +# Prefixed with keys to separate services. +service-name = "" + +# Enabled enables the application telemetry functionality. When enabled, +# an in-memory sink is also enabled by default. Operators may also enabled +# other sinks such as Prometheus. +enabled = false + +# Enable prefixing gauge values with hostname. +enable-hostname = false + +# Enable adding hostname to labels. +enable-hostname-label = false + +# Enable adding service to labels. +enable-service-label = false + +# PrometheusRetentionTime, when positive, enables a Prometheus metrics sink. +prometheus-retention-time = 0 + +# GlobalLabels defines a global set of name/value label tuples applied to all +# metrics emitted using the wrapper functions defined in telemetry package. +# +# Example: +# [["chain_id", "cosmoshub-1"]] +global-labels = [ +] + +############################################################################### +### API Configuration ### +############################################################################### + +[api] + +# Enable defines if the API server should be enabled. +enable = true + +# Swagger defines if swagger documentation should automatically be registered. +swagger = false + +# Address defines the API server to listen on. +address = "tcp://0.0.0.0:1317" + +# MaxOpenConnections defines the number of maximum open connections. +max-open-connections = 1000 + +# RPCReadTimeout defines the Tendermint RPC read timeout (in seconds). +rpc-read-timeout = 10 + +# RPCWriteTimeout defines the Tendermint RPC write timeout (in seconds). +rpc-write-timeout = 0 + +# RPCMaxBodyBytes defines the Tendermint maximum response body (in bytes). +rpc-max-body-bytes = 1000000 + +# EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk). +enabled-unsafe-cors = true + +############################################################################### +### Rosetta Configuration ### +############################################################################### + +[rosetta] + +# Enable defines if the Rosetta API server should be enabled. +enable = false + +# Address defines the Rosetta API server to listen on. +address = ":8080" + +# Network defines the name of the blockchain that will be returned by Rosetta. +blockchain = "app" + +# Network defines the name of the network that will be returned by Rosetta. +network = "network" + +# Retries defines the number of retries when connecting to the node before failing. +retries = 3 + +# Offline defines if Rosetta server should run in offline mode. +offline = false + +############################################################################### +### gRPC Configuration ### +############################################################################### + +[grpc] + +# Enable defines if the gRPC server should be enabled. +enable = true + +# Address defines the gRPC server address to bind to. +address = "0.0.0.0:9090" + +############################################################################### +### gRPC Web Configuration ### +############################################################################### + +[grpc-web] + +# GRPCWebEnable defines if the gRPC-web should be enabled. +# NOTE: gRPC must also be enabled, otherwise, this configuration is a no-op. +enable = true + +# Address defines the gRPC-web server address to bind to. +address = "0.0.0.0:9091" + +# EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk). +enable-unsafe-cors = true + +############################################################################### +### State Sync Configuration ### +############################################################################### + +# State sync snapshots allow other nodes to rapidly join the network without replaying historical +# blocks, instead downloading and applying a snapshot of the application state at a given height. +[state-sync] + +# snapshot-interval specifies the block interval at which local state sync snapshots are +# taken (0 to disable). Must be a multiple of pruning-keep-every. +snapshot-interval = 0 + +# snapshot-keep-recent specifies the number of recent snapshots to keep and serve (0 to keep all). +snapshot-keep-recent = 2 + +[wasm] +# This is the maximum sdk gas (wasm and storage) that we allow for any x/wasm "smart" queries +query_gas_limit = 300000 +# This is the number of wasm vm instances we keep cached in memory for speed-up +# Warning: this is currently unstable and may lead to crashes, best to keep for 0 unless testing locally +lru_size = 0 diff --git a/wormchain/devnet/base/config/client.toml b/wormchain/devnet/base/config/client.toml new file mode 100644 index 000000000..b6f7f2f2d --- /dev/null +++ b/wormchain/devnet/base/config/client.toml @@ -0,0 +1,16 @@ +# Tendermint client config + +############################################################################### +### Client Configuration ### +############################################################################### + +# The network chain ID +chain-id = "wormchain" +# The keyring's backend, where the keys are stored (os|file|kwallet|pass|test|memory) +keyring-backend = "test" +# CLI output format (text|json) +output = "text" +# : to Tendermint RPC interface for this chain +node = "tcp://0.0.0.0:26657" +# Transaction broadcasting mode (sync|async|block) +broadcast-mode = "block" diff --git a/wormchain/validators/first_validator/config/config.toml b/wormchain/devnet/base/config/config.toml similarity index 82% rename from wormchain/validators/first_validator/config/config.toml rename to wormchain/devnet/base/config/config.toml index 94aaa7502..162de0603 100644 --- a/wormchain/validators/first_validator/config/config.toml +++ b/wormchain/devnet/base/config/config.toml @@ -15,7 +15,7 @@ proxy_app = "tcp://127.0.0.1:26658" # A custom human readable name for this node -moniker = "guardian_validator" +moniker = "wormchain" # If this node is many blocks behind the tip of the chain, FastSync # allows them to catchup quickly by downloading blocks in parallel @@ -44,24 +44,24 @@ fast_sync = true db_backend = "goleveldb" # Database directory -db_dir = "../../build/data" +db_dir = "data" # Output level for logging, including package level options log_level = "warn" # Output format: 'plain' (colored text) or 'json' -log_format = "plain" +log_format = "json" ##### additional base config options ##### # Path to the JSON file containing the initial validator set and other meta data -genesis_file = "../../build/config/genesis.json" +genesis_file = "config/genesis.json" # Path to the JSON file containing the private key to use as a validator in the consensus protocol priv_validator_key_file = "config/priv_validator_key.json" # Path to the JSON file containing the last sign state of a validator -priv_validator_state_file = "../../build/data/priv_validator_state.json" +priv_validator_state_file = "data/priv_validator_state.json" # TCP or UNIX socket address for Tendermint to listen on for # connections from an external PrivValidator process @@ -93,7 +93,7 @@ laddr = "tcp://0.0.0.0:26657" # A list of origins a cross-domain request can be executed from # Default value '[]' disables cors support # Use '["*"]' to allow any origin -cors_allowed_origins = ["*", ] +cors_allowed_origins = ["*"] # A list of methods the client is allowed to use with cross-domain requests cors_allowed_methods = ["HEAD", "GET", "POST", ] @@ -136,6 +136,33 @@ max_subscription_clients = 100 # the estimated # maximum number of broadcast_tx_commit calls per block. max_subscriptions_per_client = 5 +# Experimental parameter to specify the maximum number of events a node will +# buffer, per subscription, before returning an error and closing the +# subscription. Must be set to at least 100, but higher values will accommodate +# higher event throughput rates (and will use more memory). +experimental_subscription_buffer_size = 200 + +# Experimental parameter to specify the maximum number of RPC responses that +# can be buffered per WebSocket client. If clients cannot read from the +# WebSocket endpoint fast enough, they will be disconnected, so increasing this +# parameter may reduce the chances of them being disconnected (but will cause +# the node to use more memory). +# +# Must be at least the same as "experimental_subscription_buffer_size", +# otherwise connections could be dropped unnecessarily. This value should +# ideally be somewhat higher than "experimental_subscription_buffer_size" to +# accommodate non-subscription-related RPC responses. +experimental_websocket_write_buffer_size = 200 + +# If a WebSocket client cannot read fast enough, at present we may +# silently drop events instead of generating an error or disconnecting the +# client. +# +# Enabling this experimental parameter will cause the WebSocket connection to +# be closed instead if it cannot read fast enough, allowing for greater +# predictability in subscription behaviour. +experimental_close_on_slow_client = false + # How long to wait for a tx to be committed during /broadcast_tx_commit. # WARNING: Using a value larger than 10s will result in increasing the # global HTTP write timeout, which applies to all connections and endpoints. @@ -191,11 +218,11 @@ persistent_peers = "" upnp = false # Path to address book -addr_book_file = "../../build/config/addrbook.json" +addr_book_file = "config/addrbook.json" # Set true for strict address routability rules # Set false for private or local networks -addr_book_strict = true +addr_book_strict = false # Maximum number of inbound peers max_num_inbound_peers = 40 @@ -245,6 +272,11 @@ dial_timeout = "3s" ####################################################### [mempool] +# Mempool version to use: +# 1) "v0" - (default) FIFO mempool. +# 2) "v1" - prioritized mempool. +version = "v0" + recheck = true broadcast = true wal_dir = "" @@ -274,6 +306,22 @@ max_tx_bytes = 1048576 # XXX: Unused due to https://github.com/tendermint/tendermint/issues/5796 max_batch_bytes = 0 +# ttl-duration, if non-zero, defines the maximum amount of time a transaction +# can exist for in the mempool. +# +# Note, if ttl-num-blocks is also defined, a transaction will be removed if it +# has existed in the mempool at least ttl-num-blocks number of blocks or if it's +# insertion time into the mempool is beyond ttl-duration. +ttl-duration = "0s" + +# ttl-num-blocks, if non-zero, defines the maximum number of blocks a transaction +# can exist for in the mempool. +# +# Note, if ttl-duration is also defined, a transaction will be removed if it +# has existed in the mempool at least ttl-num-blocks number of blocks or if +# it's insertion time into the mempool is beyond ttl-duration. +ttl-num-blocks = 0 + ####################################################### ### State Sync Configuration Options ### ####################################################### @@ -326,7 +374,7 @@ version = "v0" ####################################################### [consensus] -wal_file = "../../build/data/cs.wal/wal" +wal_file = "data/cs.wal/wal" # How long we wait for a proposal block before prevoting nil timeout_propose = "1s" @@ -362,6 +410,16 @@ create_empty_blocks_interval = "0s" peer_gossip_sleep_duration = "100ms" peer_query_maj23_sleep_duration = "2s" +####################################################### +### Storage Configuration Options ### +####################################################### + +# Set to true to discard ABCI responses from the state store, which can save a +# considerable amount of disk space. Set to false to ensure ABCI responses are +# persisted. ABCI responses are required for /block_results RPC queries, and to +# reindex events in the command-line tool. +discard_abci_responses = false + ####################################################### ### Transaction Indexer Configuration Options ### ####################################################### @@ -376,8 +434,14 @@ peer_query_maj23_sleep_duration = "2s" # 1) "null" # 2) "kv" (default) - the simplest possible indexer, backed by key-value storage (defaults to levelDB; see DBBackend). # - When "kv" is chosen "tx.height" and "tx.hash" will always be indexed. +# 3) "psql" - the indexer services backed by PostgreSQL. +# When "kv" or "psql" is chosen "tx.height" and "tx.hash" will always be indexed. indexer = "kv" +# The PostgreSQL connection configuration, the connection format: +# postgresql://:@:/? +psql-conn = "" + ####################################################### ### Instrumentation Configuration Options ### ####################################################### diff --git a/wormchain/devnet/base/config/genesis.json b/wormchain/devnet/base/config/genesis.json new file mode 100644 index 000000000..2ddd7da0e --- /dev/null +++ b/wormchain/devnet/base/config/genesis.json @@ -0,0 +1,436 @@ +{ + "genesis_time": "2022-09-27T22:08:43.044644477Z", + "chain_id": "wormchain", + "initial_height": "1", + "consensus_params": { + "block": { + "max_bytes": "22020096", + "max_gas": "-1", + "time_iota_ms": "1000" + }, + "evidence": { + "max_age_num_blocks": "100000", + "max_age_duration": "172800000000000", + "max_bytes": "1048576" + }, + "validator": { + "pub_key_types": [ + "ed25519" + ] + }, + "version": {} + }, + "app_hash": "", + "app_state": { + "auth": { + "params": { + "max_memo_characters": "256", + "tx_sig_limit": "7", + "tx_size_cost_per_byte": "10", + "sig_verify_cost_ed25519": "590", + "sig_verify_cost_secp256k1": "1000" + }, + "accounts": [ + { + "@type": "/cosmos.auth.v1beta1.BaseAccount", + "address": "wormhole1cyyzpxplxdzkeea7kwsydadg87357qna3zg3tq", + "pub_key": null, + "account_number": "0", + "sequence": "0" + }, + { + "@type": "/cosmos.auth.v1beta1.BaseAccount", + "address": "wormhole1wqwywkce50mg6077huy4j9y8lt80943ks5udzr", + "pub_key": null, + "account_number": "0", + "sequence": "0" + } + ] + }, + "bank": { + "params": { + "send_enabled": [], + "default_send_enabled": true + }, + "balances": [ + { + "address": "wormhole1wqwywkce50mg6077huy4j9y8lt80943ks5udzr", + "coins": [ + { + "denom": "utest", + "amount": "100000000" + }, + { + "denom": "uworm", + "amount": "1000000000" + } + ] + }, + { + "address": "wormhole1cyyzpxplxdzkeea7kwsydadg87357qna3zg3tq", + "coins": [ + { + "denom": "utest", + "amount": "100000000000" + }, + { + "denom": "uworm", + "amount": "200000000" + } + ] + } + ], + "supply": [], + "denom_metadata": [ + { + "description": "Wormchain's native test asset", + "denom_units": [ + { + "denom": "utest", + "exponent": 0, + "aliases": [] + }, + { + "denom": "test", + "exponent": 6, + "aliases": [] + } + ], + "base": "utest", + "display": "test", + "name": "Test Coin", + "symbol": "TEST" + }, + { + "description": "Wormchain's native staking asset", + "denom_units": [ + { + "denom": "uworm", + "exponent": 0, + "aliases": [] + }, + { + "denom": "worm", + "exponent": 6, + "aliases": [] + } + ], + "base": "uworm", + "display": "worm", + "name": "Worm Coin", + "symbol": "WORM" + } + ] + }, + "capability": { + "index": "1", + "owners": [] + }, + "crisis": { + "constant_fee": { + "amount": "1000", + "denom": "worm" + } + }, + "distribution": { + "delegator_starting_infos": [], + "delegator_withdraw_infos": [], + "fee_pool": { + "community_pool": [] + }, + "outstanding_rewards": [], + "params": { + "base_proposer_reward": "0.010000000000000000", + "bonus_proposer_reward": "0.040000000000000000", + "community_tax": "0.020000000000000000", + "withdraw_addr_enabled": true + }, + "previous_proposer": "", + "validator_accumulated_commissions": [], + "validator_current_rewards": [], + "validator_historical_rewards": [], + "validator_slash_events": [] + }, + "evidence": { + "evidence": [] + }, + "feegrant": { + "allowances": [] + }, + "genutil": { + "gen_txs": [ + { + "body": { + "messages": [ + { + "@type": "/cosmos.staking.v1beta1.MsgCreateValidator", + "description": { + "moniker": "wormchain-1", + "identity": "", + "website": "", + "security_contact": "", + "details": "" + }, + "commission": { + "rate": "0.100000000000000000", + "max_rate": "0.200000000000000000", + "max_change_rate": "0.010000000000000000" + }, + "min_self_delegation": "0", + "delegator_address": "wormhole1wqwywkce50mg6077huy4j9y8lt80943ks5udzr", + "validator_address": "wormholevaloper1wqwywkce50mg6077huy4j9y8lt80943kxgr79y", + "pubkey": { + "@type": "/cosmos.crypto.ed25519.PubKey", + "key": "Zcujkt1sXRWWLfhgxLAm/Q+ioLn4wFim0OnGPLlCG0I=" + }, + "value": { + "denom": "uworm", + "amount": "0" + } + } + ], + "memo": "80f4cf2666a9b9237f2841914e990bb22bc5bd2a@wormchain-1:26656", + "timeout_height": "0", + "extension_options": [], + "non_critical_extension_options": [] + }, + "auth_info": { + "signer_infos": [ + { + "public_key": { + "@type": "/cosmos.crypto.secp256k1.PubKey", + "key": "ApJi/CY2RGyzA5cQtDwU9c+o7T8OE+SjrgcG5PwLMjTP" + }, + "mode_info": { + "single": { + "mode": "SIGN_MODE_DIRECT" + } + }, + "sequence": "0" + } + ], + "fee": { + "amount": [], + "gas_limit": "200000", + "payer": "", + "granter": "" + } + }, + "signatures": [ + "sxQr6kBBRT144+FH0RoLVC+Si0yNdXn+zfIUdGTvA0AjnF1k93M9L+A+0QDDkXv+BwclKGV3LJRq4lVnYFnwVQ==" + ] + }, + { + "body": { + "messages": [ + { + "@type": "/cosmos.staking.v1beta1.MsgCreateValidator", + "description": { + "moniker": "wormchain-0", + "identity": "", + "website": "", + "security_contact": "", + "details": "" + }, + "commission": { + "rate": "0.100000000000000000", + "max_rate": "0.200000000000000000", + "max_change_rate": "0.010000000000000000" + }, + "min_self_delegation": "0", + "delegator_address": "wormhole1cyyzpxplxdzkeea7kwsydadg87357qna3zg3tq", + "validator_address": "wormholevaloper1cyyzpxplxdzkeea7kwsydadg87357qna87hzv8", + "pubkey": { + "@type": "/cosmos.crypto.ed25519.PubKey", + "key": "fnfoo/C+i+Ng1J8vct6wfvrTS9JeNIG5UeO87ZHKMkY=" + }, + "value": { + "denom": "uworm", + "amount": "0" + } + } + ], + "memo": "90ea40bee73abfda5226a0e8ddb18b0e324d2a29@wormchain-0:26656", + "timeout_height": "0", + "extension_options": [], + "non_critical_extension_options": [] + }, + "auth_info": { + "signer_infos": [ + { + "public_key": { + "@type": "/cosmos.crypto.secp256k1.PubKey", + "key": "AuwYyCUBxQiBGSUWebU46c+OrlApVsyGLHd4qhSDZeiG" + }, + "mode_info": { + "single": { + "mode": "SIGN_MODE_DIRECT" + } + }, + "sequence": "0" + } + ], + "fee": { + "amount": [], + "gas_limit": "200000", + "payer": "", + "granter": "" + } + }, + "signatures": [ + "VOqIY9svWR9qEQsLcONbM1fehnt/Uo5hwYO8UcNyru1XE1/3OIgFI9guEsEb+jErW224KBWrFqO0FjUt+j82rQ==" + ] + } + ] + }, + "gov": { + "deposit_params": { + "max_deposit_period": "172800s", + "min_deposit": [ + { + "amount": "1000000", + "denom": "uworm" + } + ] + }, + "deposits": [], + "proposals": [], + "starting_proposal_id": "1", + "tally_params": { + "quorum": "0.334000000000000000", + "threshold": "0.500000000000000000", + "veto_threshold": "0.334000000000000000" + }, + "votes": [], + "voting_params": { + "voting_period": "50s" + } + }, + "ibc": { + "channel_genesis": { + "ack_sequences": [], + "acknowledgements": [], + "channels": [], + "commitments": [], + "next_channel_sequence": "0", + "receipts": [], + "recv_sequences": [], + "send_sequences": [] + }, + "client_genesis": { + "clients": [], + "clients_consensus": [], + "clients_metadata": [], + "create_localhost": false, + "next_client_sequence": "0", + "params": { + "allowed_clients": [ + "06-solomachine", + "07-tendermint" + ] + } + }, + "connection_genesis": { + "client_connection_paths": [], + "connections": [], + "next_connection_sequence": "0", + "params": { + "max_expected_time_per_block": "30000000000" + } + } + }, + "mint": { + "minter": { + "annual_provisions": "0.0", + "inflation": "0.0" + }, + "params": { + "blocks_per_year": "6311520", + "goal_bonded": "0.67", + "inflation_max": "0.0", + "inflation_min": "0.0", + "inflation_rate_change": "0.0", + "mint_denom": "uworm" + } + }, + "params": null, + "slashing": { + "missed_blocks": [], + "params": { + "downtime_jail_duration": "600s", + "min_signed_per_window": "0.500000000000000000", + "signed_blocks_window": "100", + "slash_fraction_double_sign": "0.050000000000000000", + "slash_fraction_downtime": "0.010000000000000000" + }, + "signing_infos": [] + }, + "staking": { + "delegations": [], + "exported": false, + "last_total_power": "0", + "last_validator_powers": [], + "params": { + "bond_denom": "uworm", + "historical_entries": 10000, + "max_entries": 7, + "max_validators": 1000, + "unbonding_time": "1814400s" + }, + "redelegations": [], + "unbonding_delegations": [], + "validators": [] + }, + "transfer": { + "denom_traces": [], + "params": { + "receive_enabled": true, + "send_enabled": true + }, + "port_id": "transfer" + }, + "upgrade": {}, + "vesting": {}, + "wasm": { + "params": { + "code_upload_access": { + "permission": "Everybody", + "address": "" + }, + "instantiate_default_permission": "Everybody" + }, + "codes": [], + "contracts": [], + "sequences": [], + "gen_msgs": [] + }, + "wormhole": { + "config": { + "chain_id": 3104, + "governance_chain": 1, + "governance_emitter": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQ=", + "guardian_set_expiration": 86400 + }, + "consensusGuardianSetIndex": { + "index": 0 + }, + "guardianSetList": [ + { + "expirationTime": 0, + "index": 0, + "keys": [ + "vvpCnVfNGLf4pNkaLamrSvBdD74=" + ] + } + ], + "guardianValidatorList": [ + { + "guardianKey": "vvpCnVfNGLf4pNkaLamrSvBdD74=", + "validatorAddr": "wQggmD8zRWznvrOgRvWoP6NPAn0=" + } + ], + "replayProtectionList": [], + "sequenceCounterList": [] + } + } +} diff --git a/wormchain/devnet/base/data/priv_validator_state.json b/wormchain/devnet/base/data/priv_validator_state.json new file mode 100644 index 000000000..8c5a2a9ef --- /dev/null +++ b/wormchain/devnet/base/data/priv_validator_state.json @@ -0,0 +1 @@ +{"height":"0","round":0,"step":0} diff --git a/wormchain/devnet/client/README.md b/wormchain/devnet/client/README.md new file mode 100644 index 000000000..2afc6507f --- /dev/null +++ b/wormchain/devnet/client/README.md @@ -0,0 +1,9 @@ +# devnet wormchain client config + +This folder contains config for running `wormchaind` against the devnet (Tilt) wormchain instance. + +### examples + +transfer `utest` from the account used by `wormchain-0` to the account used by `wormchain-1`, to smoke-test wormchain - make sure we can connect to the RPC port, the accounts exist, and wormchain is producing blocks. + + ./build/wormchaind --home build tx bank send wormhole1cyyzpxplxdzkeea7kwsydadg87357qna3zg3tq wormhole1wqwywkce50mg6077huy4j9y8lt80943ks5udzr 1utest --from wormchain-0 --yes --broadcast-mode block --keyring-backend test diff --git a/wormchain/devnet/client/config/app.toml b/wormchain/devnet/client/config/app.toml new file mode 100644 index 000000000..09b0c935f --- /dev/null +++ b/wormchain/devnet/client/config/app.toml @@ -0,0 +1,208 @@ +# Cosmos Node config + +############################################################################### +### Base Configuration ### +############################################################################### + +chain-id = "wormchain" + +# The minimum gas prices a validator is willing to accept for processing a +# transaction. A transaction's fees must meet the minimum of any denomination +# specified in this config (e.g. 0.25token1;0.0001token2). +minimum-gas-prices = "0uworm" + +# default: the last 100 states are kept in addition to every 500th state; pruning at 10 block intervals +# nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node) +# everything: all saved states will be deleted, storing only the current and previous state; pruning at 10 block intervals +# custom: allow pruning options to be manually specified through 'pruning-keep-recent', 'pruning-keep-every', and 'pruning-interval' +pruning = "default" + +# These are applied if and only if the pruning strategy is custom. +pruning-keep-recent = "0" +pruning-keep-every = "0" +pruning-interval = "0" + +# HaltHeight contains a non-zero block height at which a node will gracefully +# halt and shutdown that can be used to assist upgrades and testing. +# +# Note: Commitment of state will be attempted on the corresponding block. +halt-height = 0 + +# HaltTime contains a non-zero minimum block time (in Unix seconds) at which +# a node will gracefully halt and shutdown that can be used to assist upgrades +# and testing. +# +# Note: Commitment of state will be attempted on the corresponding block. +halt-time = 0 + +# MinRetainBlocks defines the minimum block height offset from the current +# block being committed, such that all blocks past this offset are pruned +# from Tendermint. It is used as part of the process of determining the +# ResponseCommit.RetainHeight value during ABCI Commit. A value of 0 indicates +# that no blocks should be pruned. +# +# This configuration value is only responsible for pruning Tendermint blocks. +# It has no bearing on application state pruning which is determined by the +# "pruning-*" configurations. +# +# Note: Tendermint block pruning is dependant on this parameter in conunction +# with the unbonding (safety threshold) period, state pruning and state sync +# snapshot parameters to determine the correct minimum value of +# ResponseCommit.RetainHeight. +min-retain-blocks = 0 + +# InterBlockCache enables inter-block caching. +inter-block-cache = true + +# IndexEvents defines the set of events in the form {eventType}.{attributeKey}, +# which informs Tendermint what to index. If empty, all events will be indexed. +# +# Example: +# ["message.sender", "message.recipient"] +index-events = [] + +# IavlCacheSize set the size of the iavl tree cache. +# Default cache size is 50mb. +iavl-cache-size = 781250 + +# IAVLDisableFastNode enables or disables the fast node feature of IAVL. +# Default is true. +iavl-disable-fastnode = true + +############################################################################### +### Telemetry Configuration ### +############################################################################### + +[telemetry] + +# Prefixed with keys to separate services. +service-name = "" + +# Enabled enables the application telemetry functionality. When enabled, +# an in-memory sink is also enabled by default. Operators may also enabled +# other sinks such as Prometheus. +enabled = false + +# Enable prefixing gauge values with hostname. +enable-hostname = false + +# Enable adding hostname to labels. +enable-hostname-label = false + +# Enable adding service to labels. +enable-service-label = false + +# PrometheusRetentionTime, when positive, enables a Prometheus metrics sink. +prometheus-retention-time = 0 + +# GlobalLabels defines a global set of name/value label tuples applied to all +# metrics emitted using the wrapper functions defined in telemetry package. +# +# Example: +# [["chain_id", "cosmoshub-1"]] +global-labels = [ +] + +############################################################################### +### API Configuration ### +############################################################################### + +[api] + +# Enable defines if the API server should be enabled. +enable = true + +# Swagger defines if swagger documentation should automatically be registered. +swagger = false + +# Address defines the API server to listen on. +address = "tcp://0.0.0.0:1317" + +# MaxOpenConnections defines the number of maximum open connections. +max-open-connections = 1000 + +# RPCReadTimeout defines the Tendermint RPC read timeout (in seconds). +rpc-read-timeout = 10 + +# RPCWriteTimeout defines the Tendermint RPC write timeout (in seconds). +rpc-write-timeout = 0 + +# RPCMaxBodyBytes defines the Tendermint maximum response body (in bytes). +rpc-max-body-bytes = 1000000 + +# EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk). +enabled-unsafe-cors = true + +############################################################################### +### Rosetta Configuration ### +############################################################################### + +[rosetta] + +# Enable defines if the Rosetta API server should be enabled. +enable = false + +# Address defines the Rosetta API server to listen on. +address = ":8080" + +# Network defines the name of the blockchain that will be returned by Rosetta. +blockchain = "app" + +# Network defines the name of the network that will be returned by Rosetta. +network = "network" + +# Retries defines the number of retries when connecting to the node before failing. +retries = 3 + +# Offline defines if Rosetta server should run in offline mode. +offline = false + +############################################################################### +### gRPC Configuration ### +############################################################################### + +[grpc] + +# Enable defines if the gRPC server should be enabled. +enable = true + +# Address defines the gRPC server address to bind to. +address = "0.0.0.0:9090" + +############################################################################### +### gRPC Web Configuration ### +############################################################################### + +[grpc-web] + +# GRPCWebEnable defines if the gRPC-web should be enabled. +# NOTE: gRPC must also be enabled, otherwise, this configuration is a no-op. +enable = true + +# Address defines the gRPC-web server address to bind to. +address = "0.0.0.0:9091" + +# EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk). +enable-unsafe-cors = true + +############################################################################### +### State Sync Configuration ### +############################################################################### + +# State sync snapshots allow other nodes to rapidly join the network without replaying historical +# blocks, instead downloading and applying a snapshot of the application state at a given height. +[state-sync] + +# snapshot-interval specifies the block interval at which local state sync snapshots are +# taken (0 to disable). Must be a multiple of pruning-keep-every. +snapshot-interval = 0 + +# snapshot-keep-recent specifies the number of recent snapshots to keep and serve (0 to keep all). +snapshot-keep-recent = 2 + +[wasm] +# This is the maximum sdk gas (wasm and storage) that we allow for any x/wasm "smart" queries +query_gas_limit = 300000 +# This is the number of wasm vm instances we keep cached in memory for speed-up +# Warning: this is currently unstable and may lead to crashes, best to keep for 0 unless testing locally +lru_size = 0 diff --git a/wormchain/devnet/client/config/client.toml b/wormchain/devnet/client/config/client.toml new file mode 100644 index 000000000..0c3b11cd9 --- /dev/null +++ b/wormchain/devnet/client/config/client.toml @@ -0,0 +1,16 @@ +# Tendermint client config + +############################################################################### +### Client Configuration ### +############################################################################### + +# The network chain ID +chain-id = "wormchain" +# The keyring's backend, where the keys are stored (os|file|kwallet|pass|test|memory) +keyring-backend = "test" +# CLI output format (text|json) +output = "text" +# : to Tendermint RPC interface for this chain +node = "tcp://localhost:26659" +# Transaction broadcasting mode (sync|async|block) +broadcast-mode = "block" diff --git a/wormchain/validators/second_validator/config/config.toml b/wormchain/devnet/client/config/config.toml similarity index 82% rename from wormchain/validators/second_validator/config/config.toml rename to wormchain/devnet/client/config/config.toml index 6b7620e19..6635a2bc3 100644 --- a/wormchain/validators/second_validator/config/config.toml +++ b/wormchain/devnet/client/config/config.toml @@ -15,7 +15,7 @@ proxy_app = "tcp://127.0.0.1:26658" # A custom human readable name for this node -moniker = "second_validator" +moniker = "wormchain-0" # If this node is many blocks behind the tip of the chain, FastSync # allows them to catchup quickly by downloading blocks in parallel @@ -44,10 +44,10 @@ fast_sync = true db_backend = "goleveldb" # Database directory -db_dir = "../../build/data" +db_dir = "data" # Output level for logging, including package level options -log_level = "warn" +log_level = "debug" # Output format: 'plain' (colored text) or 'json' log_format = "plain" @@ -55,13 +55,13 @@ log_format = "plain" ##### additional base config options ##### # Path to the JSON file containing the initial validator set and other meta data -genesis_file = "../../build/config/genesis.json" +genesis_file = "config/genesis.json" # Path to the JSON file containing the private key to use as a validator in the consensus protocol priv_validator_key_file = "config/priv_validator_key.json" # Path to the JSON file containing the last sign state of a validator -priv_validator_state_file = "../../build/data/priv_validator_state.json" +priv_validator_state_file = "data/priv_validator_state.json" # TCP or UNIX socket address for Tendermint to listen on for # connections from an external PrivValidator process @@ -93,7 +93,7 @@ laddr = "tcp://0.0.0.0:26657" # A list of origins a cross-domain request can be executed from # Default value '[]' disables cors support # Use '["*"]' to allow any origin -cors_allowed_origins = ["*", ] +cors_allowed_origins = ["*"] # A list of methods the client is allowed to use with cross-domain requests cors_allowed_methods = ["HEAD", "GET", "POST", ] @@ -136,6 +136,33 @@ max_subscription_clients = 100 # the estimated # maximum number of broadcast_tx_commit calls per block. max_subscriptions_per_client = 5 +# Experimental parameter to specify the maximum number of events a node will +# buffer, per subscription, before returning an error and closing the +# subscription. Must be set to at least 100, but higher values will accommodate +# higher event throughput rates (and will use more memory). +experimental_subscription_buffer_size = 200 + +# Experimental parameter to specify the maximum number of RPC responses that +# can be buffered per WebSocket client. If clients cannot read from the +# WebSocket endpoint fast enough, they will be disconnected, so increasing this +# parameter may reduce the chances of them being disconnected (but will cause +# the node to use more memory). +# +# Must be at least the same as "experimental_subscription_buffer_size", +# otherwise connections could be dropped unnecessarily. This value should +# ideally be somewhat higher than "experimental_subscription_buffer_size" to +# accommodate non-subscription-related RPC responses. +experimental_websocket_write_buffer_size = 200 + +# If a WebSocket client cannot read fast enough, at present we may +# silently drop events instead of generating an error or disconnecting the +# client. +# +# Enabling this experimental parameter will cause the WebSocket connection to +# be closed instead if it cannot read fast enough, allowing for greater +# predictability in subscription behaviour. +experimental_close_on_slow_client = false + # How long to wait for a tx to be committed during /broadcast_tx_commit. # WARNING: Using a value larger than 10s will result in increasing the # global HTTP write timeout, which applies to all connections and endpoints. @@ -185,17 +212,17 @@ external_address = "" seeds = "" # Comma separated list of nodes to keep persistent connections to -persistent_peers = "c3f474217c930af3a4e998c4e52a57cee188ff43@guardian-validator:26656" +persistent_peers = "" # UPNP port forwarding upnp = false # Path to address book -addr_book_file = "../../build/config/addrbook.json" +addr_book_file = "config/addrbook.json" # Set true for strict address routability rules # Set false for private or local networks -addr_book_strict = true +addr_book_strict = false # Maximum number of inbound peers max_num_inbound_peers = 40 @@ -245,6 +272,11 @@ dial_timeout = "3s" ####################################################### [mempool] +# Mempool version to use: +# 1) "v0" - (default) FIFO mempool. +# 2) "v1" - prioritized mempool. +version = "v0" + recheck = true broadcast = true wal_dir = "" @@ -274,6 +306,22 @@ max_tx_bytes = 1048576 # XXX: Unused due to https://github.com/tendermint/tendermint/issues/5796 max_batch_bytes = 0 +# ttl-duration, if non-zero, defines the maximum amount of time a transaction +# can exist for in the mempool. +# +# Note, if ttl-num-blocks is also defined, a transaction will be removed if it +# has existed in the mempool at least ttl-num-blocks number of blocks or if it's +# insertion time into the mempool is beyond ttl-duration. +ttl-duration = "0s" + +# ttl-num-blocks, if non-zero, defines the maximum number of blocks a transaction +# can exist for in the mempool. +# +# Note, if ttl-duration is also defined, a transaction will be removed if it +# has existed in the mempool at least ttl-num-blocks number of blocks or if +# it's insertion time into the mempool is beyond ttl-duration. +ttl-num-blocks = 0 + ####################################################### ### State Sync Configuration Options ### ####################################################### @@ -326,7 +374,7 @@ version = "v0" ####################################################### [consensus] -wal_file = "../../build/data/cs.wal/wal" +wal_file = "data/cs.wal/wal" # How long we wait for a proposal block before prevoting nil timeout_propose = "1s" @@ -362,6 +410,16 @@ create_empty_blocks_interval = "0s" peer_gossip_sleep_duration = "100ms" peer_query_maj23_sleep_duration = "2s" +####################################################### +### Storage Configuration Options ### +####################################################### + +# Set to true to discard ABCI responses from the state store, which can save a +# considerable amount of disk space. Set to false to ensure ABCI responses are +# persisted. ABCI responses are required for /block_results RPC queries, and to +# reindex events in the command-line tool. +discard_abci_responses = false + ####################################################### ### Transaction Indexer Configuration Options ### ####################################################### @@ -376,8 +434,14 @@ peer_query_maj23_sleep_duration = "2s" # 1) "null" # 2) "kv" (default) - the simplest possible indexer, backed by key-value storage (defaults to levelDB; see DBBackend). # - When "kv" is chosen "tx.height" and "tx.hash" will always be indexed. +# 3) "psql" - the indexer services backed by PostgreSQL. +# When "kv" or "psql" is chosen "tx.height" and "tx.hash" will always be indexed. indexer = "kv" +# The PostgreSQL connection configuration, the connection format: +# postgresql://:@:/? +psql-conn = "" + ####################################################### ### Instrumentation Configuration Options ### ####################################################### diff --git a/wormchain/devnet/client/keyring-test/c10820983f33456ce7beb3a046f5a83fa34f027d.address b/wormchain/devnet/client/keyring-test/c10820983f33456ce7beb3a046f5a83fa34f027d.address new file mode 100644 index 000000000..e15761633 --- /dev/null +++ b/wormchain/devnet/client/keyring-test/c10820983f33456ce7beb3a046f5a83fa34f027d.address @@ -0,0 +1 @@ +eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMi0wNS0zMSAxNzowNToyNy40ODgzODY2MTIgLTA1MDAgQ0RUIG09KzM3LjIyMjU5MTA4MCIsImVuYyI6IkEyNTZHQ00iLCJwMmMiOjgxOTIsInAycyI6Ik10d3dTMFR3N0NSM1FrLXgifQ.GO-ec6b-MW2eyfbyJS-bn8NRAQL190eRG17v4Dv2FYkKndmCVcydjA.bj6j7-hDIRppqn-L.3t7SVJY1U2RIAtLieEHP3DiVD7cD4mgaFIdGVQqmMthAID4-Ne07Iy_4IFxuas5oHVf_9yCqOALS1FTGUU1gcCSbrXdUufzflyexInWpb4l1jqGvYzZUcr7tD7WJDSWQbhxO8Ggcb_vF_jTRx8GU6pJeizLxMdD_0sA8C0pWn47oO2cC_N7jrx-g62K_t9JkbjvygCBuP2DIWvjLX6Ig59_lG_jB4BFUruhXo-drjQV5J7anLraqRsAn3nqSXQ.dfw5pq-rAcC9xFCkX8mD_g \ No newline at end of file diff --git a/wormchain/devnet/client/keyring-test/tiltGuardian.info b/wormchain/devnet/client/keyring-test/tiltGuardian.info new file mode 100644 index 000000000..627d01864 --- /dev/null +++ b/wormchain/devnet/client/keyring-test/tiltGuardian.info @@ -0,0 +1 @@ +eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMi0wNS0zMSAxNzowNToyNy40ODA1MzY2NTggLTA1MDAgQ0RUIG09KzM3LjIxNDc0MTE5MCIsImVuYyI6IkEyNTZHQ00iLCJwMmMiOjgxOTIsInAycyI6Im45Vl9EakdZZ1N0RXU1bnkifQ.BpH3FNLHuQW-ywr_XvufMJyyeaVlKEHGpsm7nPKOqnv2eBFXz09iGQ.mxA8P-a7Yhy68mjo.Gx6JJWO1kxGwB_oUZk5TcTB7VuG9W9iNFkZp07CgucjCVndd3iyFtjEbfuY8AJreBFachD9fFHbFscQyXrY1tbBwDSaYjqSti8Fz0GSa4y9uOKTsct_-UDD5LnEH88-qARA3tBTmKecliZnF1clHEYWq31SUgEJIgYFzqij7F-43qmjCtgSKqEovkW-q6LK-b_V0MGNDeOg-dcNERLwW8M3gIlyUirnktpVHk-qWXi0asB9bY0RbCyl_hhw5y32kmRwHYRzO-XVirzbV--b5f2UgQLWfELDbHkFiDQfO0wMFWpSqw4op5SBcPDxtsi4cx1U2948hg-CCw05rOtzXN-AqDbWqH-fO9DF16jXPg0xRyuHr75_gt-Qnag.ZtKP7Ql7fVYJXS18DCD4bQ \ No newline at end of file diff --git a/wormchain/devnet/create-config.sh b/wormchain/devnet/create-config.sh new file mode 100755 index 000000000..dc65ff9d7 --- /dev/null +++ b/wormchain/devnet/create-config.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash +set -euo pipefail + +if [ -z "${NUM_GUARDIANS}" ]; then + echo "Error: NUM_GUARDIANS is unset, cannot create wormchain config." + exit 1 +fi + +# Get the hostname +hostname=$(hostname) + +# # for local development/debugging, set the hostname as it would be in a devnet container +# if [ ! -z "${INST}" ]; then +# hostname="wormchain-$INST" +# echo "set hostname with INST value: $hostname" +# fi + +# Check if the hostname starts with "wormchain-" +if [[ ! $hostname =~ ^wormchain- ]]; then + # If the hostname does not start with "wormchain-", print an error message and exit + echo "Error: hostname does not start with 'wormchain-'" + exit 1 +fi + +# Split the hostname on "-" +instance=$(echo $hostname | cut -d'-' -f2) + +# get the context of this script call, so it can be prepended to file paths, +# so this script will work in the tilt docker container, and when run locally. +pwd=$(pwd) + +# config dir path for the instance, which is passed to wormchaind via --home +home_path="$pwd/devnet/$hostname" + +# copy config from devnet/base +cp -r $pwd/devnet/base/* ${home_path}/ + +# update the moniker +sed -i "s/moniker = \"wormchain\"/moniker = \"$hostname\"/g" ${home_path}/config/config.toml + +# set the external address so wormchain peers can resolve each other +sed -i "s/external_address = \"\"/external_address = \"${hostname}:26656\"/g" ${home_path}/config/config.toml + +if [ $instance -eq 0 ] && [ $NUM_GUARDIANS -ge 2 ]; then + echo "$hostname: enabling seed mode in config.toml." + sed -i "s/seed_mode = false/seed_mode = true/g" ${home_path}/config/config.toml +elif [ $instance -ge 1 ]; then + echo "$hostname: adding seed address to config.toml." + sed -i "s/seeds = \"\"/seeds = \"90ea40bee73abfda5226a0e8ddb18b0e324d2a29@wormchain-0:26656\"/g" ${home_path}/config/config.toml + sed -i "s/persistent_peers = \"\"/persistent_peers = \"90ea40bee73abfda5226a0e8ddb18b0e324d2a29@wormchain-0:26656\"/g" ${home_path}/config/config.toml +fi + +# copy the config to tendermint's default location, ~/.{chain-id} +mkdir -p /root/.wormchain && cp -r ${home_path}/* /root/.wormchain/ + +echo "$hostname: done with create-config.sh, exiting success." diff --git a/wormchain/devnet/create-genesis.sh b/wormchain/devnet/create-genesis.sh new file mode 100755 index 000000000..873c69b34 --- /dev/null +++ b/wormchain/devnet/create-genesis.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +set -euo pipefail + +if [ -z "${NUM_GUARDIANS}" ]; then + echo "Error: NUM_GUARDIANS is unset, cannot create wormchain genesis." + exit 1 +fi + +pwd=$(pwd) +genesis="$pwd/devnet/base/config/genesis.json" + +# TODO +# create a sequence of the wormchain instances to include +# loop through the sequence, reading the data from the instance's dir +# add the genesis account to: +# app_state.auth.accounts +# app_state.bank.balances +# add the gentx +# add the guardian pubkey base64 to wormhole.guardianSetList[0].keys +# add the validator obj to wormhole.guardianValidatorList + + +# TEMP manually add the second validator info to genesis.json +if [ $NUM_GUARDIANS -ge 2 ]; then + echo "number of guardians is >= 2, adding second validator to genesis.json." + # the validator info for wormchain-1 + guardianKey="iNfYsyqRBdIoEA5y3/4vrgcF0xw=" + validatorAddr="cBxHWxmj9o0/3r8JWRSH+s7y1jY=" + + # add the validatorAddr to guardianSetList.keys. + # use jq to add the object to the list in genesis.json. use cat and a sub-shell to send the output of jq to the json file. + cat <<< $(jq --arg new "$guardianKey" '.app_state.wormhole.guardianSetList[0].keys += [$new]' ${genesis}) > ${genesis} + + # create a guardianValidator config object and add it to the guardianValidatorList. + validatorConfig="{\"guardianKey\": \"$guardianKey\", \"validatorAddr\": \"$validatorAddr\"}" + cat <<< $(jq --argjson new "$validatorConfig" '.app_state.wormhole.guardianValidatorList += [$new]' ${genesis}) > ${genesis} +fi + + + +echo "done with genesis, exiting." diff --git a/wormchain/devnet/wormchain-0/config/node_key.json b/wormchain/devnet/wormchain-0/config/node_key.json new file mode 100644 index 000000000..2fc2a085a --- /dev/null +++ b/wormchain/devnet/wormchain-0/config/node_key.json @@ -0,0 +1,6 @@ +{ + "priv_key": { + "type": "tendermint/PrivKeyEd25519", + "value": "DONGe0wxovG1ZuCQ1iMbyBCW/hG5UeKz6ZFfhdZYznRSC48Lc1nwhUwXzHtXfwAOY0mO3mhTy4CMwPeYFvBZ1A==" + } +} diff --git a/wormchain/validators/first_validator/config/priv_validator_key.json b/wormchain/devnet/wormchain-0/config/priv_validator_key.json similarity index 100% rename from wormchain/validators/first_validator/config/priv_validator_key.json rename to wormchain/devnet/wormchain-0/config/priv_validator_key.json diff --git a/wormchain/validators/second_validator/config/node_key.json b/wormchain/devnet/wormchain-1/config/node_key.json similarity index 100% rename from wormchain/validators/second_validator/config/node_key.json rename to wormchain/devnet/wormchain-1/config/node_key.json diff --git a/wormchain/validators/second_validator/config/priv_validator_key.json b/wormchain/devnet/wormchain-1/config/priv_validator_key.json similarity index 99% rename from wormchain/validators/second_validator/config/priv_validator_key.json rename to wormchain/devnet/wormchain-1/config/priv_validator_key.json index edf6513dc..edfe1eb84 100644 --- a/wormchain/validators/second_validator/config/priv_validator_key.json +++ b/wormchain/devnet/wormchain-1/config/priv_validator_key.json @@ -8,4 +8,4 @@ "type": "tendermint/PrivKeyEd25519", "value": "SGWIYI3BgC/dxNOk1gYx6LpChAKqWGtAfZSx0SDFWuhly6OS3WxdFZYt+GDEsCb9D6KgufjAWKbQ6cY8uUIbQg==" } -} +} \ No newline at end of file diff --git a/wormchain/validators/first_validator/config/app.toml b/wormchain/validators/first_validator/config/app.toml deleted file mode 100644 index 34fb9ce77..000000000 --- a/wormchain/validators/first_validator/config/app.toml +++ /dev/null @@ -1,57 +0,0 @@ -halt-height = 0 -halt-time = 0 -index-events = [] -inter-block-cache = true -min-retain-blocks = 0 -minimum-gas-prices = "0stake" -pruning = "default" -pruning-interval = "0" -pruning-keep-every = "0" -pruning-keep-recent = "0" - -[api] - address = "tcp://0.0.0.0:1317" - enable = true - enabled-unsafe-cors = true - max-open-connections = 1000 - rpc-max-body-bytes = 1000000 - rpc-read-timeout = 10 - rpc-write-timeout = 0 - swagger = false - -[grpc] - address = "0.0.0.0:9090" - enable = true - -[grpc-web] - address = "0.0.0.0:9091" - enable = true - enable-unsafe-cors = false - -[rosetta] - address = ":8080" - blockchain = "app" - enable = false - network = "network" - offline = false - retries = 3 - -[rpc] - cors_allowed_origins = ["*"] - -[state-sync] - snapshot-interval = 0 - snapshot-keep-recent = 2 - -[telemetry] - enable-hostname = false - enable-hostname-label = false - enable-service-label = false - enabled = false - global-labels = [] - prometheus-retention-time = 0 - service-name = "" - -[wasm] - lru_size = 0 - query_gas_limit = 300000 diff --git a/wormchain/validators/first_validator/config/client.toml b/wormchain/validators/first_validator/config/client.toml deleted file mode 100644 index 88e99728e..000000000 --- a/wormchain/validators/first_validator/config/client.toml +++ /dev/null @@ -1,5 +0,0 @@ -broadcast-mode = "block" -chain-id = "wormchain" -keyring-backend = "test" -node = "tcp://localhost:26657" -output = "text" diff --git a/wormchain/validators/first_validator/config/node_key.json b/wormchain/validators/first_validator/config/node_key.json deleted file mode 100644 index 72b591f84..000000000 --- a/wormchain/validators/first_validator/config/node_key.json +++ /dev/null @@ -1 +0,0 @@ -{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"DTmqnA3oDbIvGv8ovgsXdtyKEow5/ryWBzr0RKi4uv4btEaX/5hbQOm2PYRKuZYG4u8ESjNCxMPut9CLVM2AEA=="}} \ No newline at end of file diff --git a/wormchain/validators/kubernetes/wormchain-validator2-devnet.yaml b/wormchain/validators/kubernetes/wormchain-validator2-devnet.yaml deleted file mode 100644 index f579bc5b4..000000000 --- a/wormchain/validators/kubernetes/wormchain-validator2-devnet.yaml +++ /dev/null @@ -1,63 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - labels: - app: second-validator - name: second-validator -spec: - ports: - - name: rpc - port: 26657 - protocol: TCP - - name: rpctwo - port: 26656 - protocol: TCP - - name: rest - port: 1317 - protocol: TCP - selector: - app: second-validator ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - labels: - app: second-validator - name: second-validator -spec: - replicas: 1 - selector: - matchLabels: - app: second-validator - template: - metadata: - labels: - app: second-validator - spec: - containers: - - name: wormchaind - image: wormchaind-image - command: - - /app/build/wormchaind - - start - - --home - - /app/validators/second_validator - - --log_level - - warn - ports: - - containerPort: 26657 - name: tendermint - protocol: TCP - - containerPort: 26656 - name: tenderminttwo - protocol: TCP - - containerPort: 1317 - name: rest - protocol: TCP - readinessProbe: - httpGet: - port: 26657 - path: / - periodSeconds: 1 - restartPolicy: Always - serviceName: second-validator diff --git a/wormchain/validators/readme.md b/wormchain/validators/readme.md deleted file mode 100644 index 1257b8679..000000000 --- a/wormchain/validators/readme.md +++ /dev/null @@ -1,42 +0,0 @@ -# Wormhole Chain Tilt Validator Environment - -The intent of this validators directory is to make a network of realish validators which will run in tiltnet, and are useable for testing purposes. - -## How the Tilt environment works: - -The Dockerfile in the root directory builds into the directory `/guardian_validator`. The ignite build is perfectly useable in a single validator environment, but has the downside of using different tendermint keys each time as part of the ignite process. This makes it tricky to write repeatable tests which deal with validator registration or bonding. - -In order for our tests to run determininistically, we want to use the exact same node address, tendermint keys, operator addresses, and guardian keys every single time the tilt environment stands up. However, we also want to capture code changes to the `config.yml`, ignite modules, and `cosmos-sdk` fork, so we cannot easily abandon using ignite to build and initialize the chain. - -To accomplish this, we first start a single validator with a fixed Tendermint address, which is specified in the `genesis.json` as both a validator and a Guardian Validator. This first validator can bootstrap the network, and allow all subsequent validators to come online and register. - -Thus, `first_validator` (represented in tilt as `guardian-validator`) is a special node. Ignite outputs a newly generated validator public key as the only validator in its `genesis.json`. However, the Dockerfile then explicitly runs a `collect-gentxs` command afterwards, which moves the JSON at `/first_validator/genesis/gentx.json` into the genesis file at `/guardian_validator/genesis.json`. The genesis file in the `/guardian_validator` directory is used by all the validators. Thus, after the genesis block, the `first_validator` is the only validator. All later validators come on initially with 0 voting power. The `genesis.json` (specifically, the gentxs it got from `first_validator/genesis/gentxs`) maps the `first_validator`'s tendermint key to the tiltGuardian operator address, and then the `config.yml` file maps the tiltGuardian operator address to the Tilt Guardian Public key by putting it into the genesis init of the Wormhole module. - -## How to add new Validators to Tilt - -1. Generate private keys for the validator. The easiest way to do this is to add a new account to the config.yml (with a mnemonic), and then run the following command. This will generate all the private keys and config files for the node. - - make - -2. Create a new directory in the validators folder. Copy the content of the `/keyring-test` and `/config` directories inside `/build` into this newly created folder - -3. Change the `validators` target in the `Makefile` to include the new directory. - -5. Add a new kubernetes configuration for this validator into the `/kubernetes` directory. - -6. Add 87FDA636405386BF686341442ACC9FDECF9A2396@guardian-validator:26656 (the `first_validator`) to the list of `persistent_peers` in the config.toml file of the new validator. This will allow the new node to discover the other validators when it comes online. - -7. Add the new kubernetes object to the `Tiltfile` - -At this point you should have a container which comes online as a non-validating node, and no additional action is needed if that is sufficient. A couple other things you may want to make note of are: - -- The Tendermint ID & pubkey of the node. The IDs of the first two nodes are posted below. The easiest way to get this is to simply grab it from the logs when the validator starts up. -- Adding your validator to the genesis block. When you run `make`, it should put out a gentx file. This gentx payload needs to make its way into the `genesis.json` in order for the validator to be registered in the genesis block. The easiest way to do this would be to run the `./build/wormchaind gentx` command (with the required arguments), then running `make` again. - -## Validator Information - -first validator: -addr=87FDA636405386BF686341442ACC9FDECF9A2396 pubKey=m9OwPF6HSFZ2sI3lUU8myhsHY2CfueG99l2IMAGgQ5g= - -second validator: -addr=3C7020B8D1889869974F2A1353203D611B824525 pubKey=Zcujkt1sXRWWLfhgxLAm/Q+ioLn4wFim0OnGPLlCG0I= diff --git a/wormchain/validators/second_validator/config/app.toml b/wormchain/validators/second_validator/config/app.toml deleted file mode 100644 index 34fb9ce77..000000000 --- a/wormchain/validators/second_validator/config/app.toml +++ /dev/null @@ -1,57 +0,0 @@ -halt-height = 0 -halt-time = 0 -index-events = [] -inter-block-cache = true -min-retain-blocks = 0 -minimum-gas-prices = "0stake" -pruning = "default" -pruning-interval = "0" -pruning-keep-every = "0" -pruning-keep-recent = "0" - -[api] - address = "tcp://0.0.0.0:1317" - enable = true - enabled-unsafe-cors = true - max-open-connections = 1000 - rpc-max-body-bytes = 1000000 - rpc-read-timeout = 10 - rpc-write-timeout = 0 - swagger = false - -[grpc] - address = "0.0.0.0:9090" - enable = true - -[grpc-web] - address = "0.0.0.0:9091" - enable = true - enable-unsafe-cors = false - -[rosetta] - address = ":8080" - blockchain = "app" - enable = false - network = "network" - offline = false - retries = 3 - -[rpc] - cors_allowed_origins = ["*"] - -[state-sync] - snapshot-interval = 0 - snapshot-keep-recent = 2 - -[telemetry] - enable-hostname = false - enable-hostname-label = false - enable-service-label = false - enabled = false - global-labels = [] - prometheus-retention-time = 0 - service-name = "" - -[wasm] - lru_size = 0 - query_gas_limit = 300000 diff --git a/wormchain/validators/second_validator/config/client.toml b/wormchain/validators/second_validator/config/client.toml deleted file mode 100644 index 88e99728e..000000000 --- a/wormchain/validators/second_validator/config/client.toml +++ /dev/null @@ -1,5 +0,0 @@ -broadcast-mode = "block" -chain-id = "wormchain" -keyring-backend = "test" -node = "tcp://localhost:26657" -output = "text"