From f8817b2d58a56bd4ccfc610d469fee474bdb494c Mon Sep 17 00:00:00 2001 From: Julian Toledano Date: Tue, 29 Nov 2022 10:56:50 +0100 Subject: [PATCH 1/4] delete: rosetta from server start --- go.mod | 4 --- server/config/config.go | 45 --------------------------------- server/config/toml.go | 36 -------------------------- server/start.go | 56 +---------------------------------------- 4 files changed, 1 insertion(+), 140 deletions(-) diff --git a/go.mod b/go.mod index b38ae98831e6..e587739f4412 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,6 @@ require ( cosmossdk.io/depinject v1.0.0-alpha.3 cosmossdk.io/errors v1.0.0-beta.7 cosmossdk.io/math v1.0.0-beta.4 - cosmossdk.io/tools/rosetta v0.1.0 github.com/99designs/keyring v1.2.1 github.com/armon/go-metrics v0.4.1 github.com/bgentry/speakeasy v0.1.0 @@ -78,7 +77,6 @@ require ( github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect - github.com/coinbase/rosetta-sdk-go v0.8.1 // indirect github.com/cosmos/gorocksdb v1.2.0 // indirect github.com/creachadair/taskgroup v0.3.2 // indirect github.com/danieljoos/wincred v1.1.2 // indirect @@ -166,8 +164,6 @@ require ( replace ( github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 - // Update to rosetta-sdk-go temporarly to have `check:spec` passing. See https://github.com/coinbase/rosetta-sdk-go/issues/449 - github.com/coinbase/rosetta-sdk-go => github.com/coinbase/rosetta-sdk-go v0.8.2-0.20221007214527-e03849ba430a // dgrijalva/jwt-go is deprecated and doesn't receive security updates. // TODO: remove it: https://github.com/cosmos/cosmos-sdk/issues/13134 github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2 diff --git a/server/config/config.go b/server/config/config.go index f28679f8051f..5775acc96c40 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -7,7 +7,6 @@ import ( "github.com/spf13/viper" - clientflags "github.com/cosmos/cosmos-sdk/client/flags" pruningtypes "github.com/cosmos/cosmos-sdk/store/pruning/types" "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" @@ -127,38 +126,6 @@ type APIConfig struct { // Ref: https://github.com/cosmos/cosmos-sdk/issues/6420 } -// RosettaConfig defines the Rosetta API listener configuration. -type RosettaConfig struct { - // Address defines the API server to listen on - Address string `mapstructure:"address"` - - // Blockchain defines the blockchain name - // defaults to DefaultBlockchain - Blockchain string `mapstructure:"blockchain"` - - // Network defines the network name - Network string `mapstructure:"network"` - - // Retries defines the maximum number of retries - // rosetta will do before quitting - Retries int `mapstructure:"retries"` - - // Enable defines if the API server should be enabled. - Enable bool `mapstructure:"enable"` - - // Offline defines if the server must be run in offline mode - Offline bool `mapstructure:"offline"` - - // EnableFeeSuggestion defines if the server should suggest fee by default - EnableFeeSuggestion bool `mapstructure:"enable-fee-suggestion"` - - // GasToSuggest defines gas limit when calculating the fee - GasToSuggest int `mapstructure:"gas-to-suggest"` - - // DenomToSuggest defines the defult denom for fee suggestion - DenomToSuggest string `mapstructure:"denom-to-suggest"` -} - // GRPCConfig defines configuration for the gRPC server. type GRPCConfig struct { // Enable defines if the gRPC server should be enabled. @@ -229,7 +196,6 @@ type Config struct { Telemetry telemetry.Config `mapstructure:"telemetry"` API APIConfig `mapstructure:"api"` GRPC GRPCConfig `mapstructure:"grpc"` - Rosetta RosettaConfig `mapstructure:"rosetta"` GRPCWeb GRPCWebConfig `mapstructure:"grpc-web"` StateSync StateSyncConfig `mapstructure:"state-sync"` Store StoreConfig `mapstructure:"store"` @@ -296,17 +262,6 @@ func DefaultConfig() *Config { MaxRecvMsgSize: DefaultGRPCMaxRecvMsgSize, MaxSendMsgSize: DefaultGRPCMaxSendMsgSize, }, - Rosetta: RosettaConfig{ - Enable: false, - Address: ":8080", - Blockchain: "app", - Network: "network", - Retries: 3, - Offline: false, - EnableFeeSuggestion: false, - GasToSuggest: clientflags.DefaultGasLimit, - DenomToSuggest: "uatom", - }, GRPCWeb: GRPCWebConfig{ Enable: true, Address: DefaultGRPCWebAddress, diff --git a/server/config/toml.go b/server/config/toml.go index 075a5e5d4499..be79dbaeec2f 100644 --- a/server/config/toml.go +++ b/server/config/toml.go @@ -149,42 +149,6 @@ rpc-max-body-bytes = {{ .API.RPCMaxBodyBytes }} # EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk). enabled-unsafe-cors = {{ .API.EnableUnsafeCORS }} -############################################################################### -### Rosetta Configuration ### -############################################################################### - -[rosetta] - -# Enable defines if the Rosetta API server should be enabled. -enable = {{ .Rosetta.Enable }} - -# Address defines the Rosetta API server to listen on. -address = "{{ .Rosetta.Address }}" - -# Network defines the name of the blockchain that will be returned by Rosetta. -blockchain = "{{ .Rosetta.Blockchain }}" - -# Network defines the name of the network that will be returned by Rosetta. -network = "{{ .Rosetta.Network }}" - -# Retries defines the number of retries when connecting to the node before failing. -retries = {{ .Rosetta.Retries }} - -# Offline defines if Rosetta server should run in offline mode. -offline = {{ .Rosetta.Offline }} - -# EnableDefaultSuggestedFee defines if the server should suggest fee by default. -# If 'construction/medata' is called without gas limit and gas price, -# suggested fee based on gas-to-suggest and denom-to-suggest will be given. -enable-fee-suggestion = {{ .Rosetta.EnableFeeSuggestion }} - -# GasToSuggest defines gas limit when calculating the fee -gas-to-suggest = {{ .Rosetta.GasToSuggest }} - -# DenomToSuggest defines the defult denom for fee suggestion. -# Price must be in minimum-gas-prices. -denom-to-suggest = "{{ .Rosetta.DenomToSuggest }}" - ############################################################################### ### gRPC Configuration ### ############################################################################### diff --git a/server/start.go b/server/start.go index 41fdaaaec1fd..b0d81522961d 100644 --- a/server/start.go +++ b/server/start.go @@ -1,7 +1,6 @@ package server import ( - "errors" "fmt" "net" "net/http" @@ -20,8 +19,6 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" - "cosmossdk.io/tools/rosetta" - crgserver "cosmossdk.io/tools/rosetta/lib/server" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/codec" @@ -31,7 +28,6 @@ import ( "github.com/cosmos/cosmos-sdk/server/types" pruningtypes "github.com/cosmos/cosmos-sdk/store/pruning/types" "github.com/cosmos/cosmos-sdk/telemetry" - sdktypes "github.com/cosmos/cosmos-sdk/types" ) const ( @@ -452,62 +448,12 @@ func startInProcess(ctx *Context, clientCtx client.Context, appCreator types.App } // At this point it is safe to block the process if we're in gRPC only mode as - // we do not need to start Rosetta or handle any Tendermint related processes. + // we do not need to handle any Tendermint related processes. if gRPCOnly { // wait for signal capture and gracefully return return WaitForQuitSignals() } - var rosettaSrv crgserver.Server - if config.Rosetta.Enable { - offlineMode := config.Rosetta.Offline - - // If GRPC is not enabled rosetta cannot work in online mode, so we throw an error. - if !config.GRPC.Enable && !offlineMode { - return errors.New("'grpc' must be enable in online mode for Rosetta to work") - } - - minGasPrices, err := sdktypes.ParseDecCoins(config.MinGasPrices) - if err != nil { - ctx.Logger.Error("failed to parse minimum-gas-prices: ", err) - return err - } - - conf := &rosetta.Config{ - Blockchain: config.Rosetta.Blockchain, - Network: config.Rosetta.Network, - TendermintRPC: ctx.Config.RPC.ListenAddress, - GRPCEndpoint: config.GRPC.Address, - Addr: config.Rosetta.Address, - Retries: config.Rosetta.Retries, - Offline: offlineMode, - GasToSuggest: config.Rosetta.GasToSuggest, - EnableFeeSuggestion: config.Rosetta.EnableFeeSuggestion, - GasPrices: minGasPrices.Sort(), - Codec: clientCtx.Codec.(*codec.ProtoCodec), - InterfaceRegistry: clientCtx.InterfaceRegistry, - } - - rosettaSrv, err = rosetta.ServerFromConfig(conf) - if err != nil { - return err - } - - errCh := make(chan error) - go func() { - if err := rosettaSrv.Start(); err != nil { - errCh <- err - } - }() - - select { - case err := <-errCh: - return err - - case <-time.After(types.ServerStartTime): // assume server started successfully - } - } - defer func() { if tmNode != nil && tmNode.IsRunning() { _ = tmNode.Stop() From ed36715ae0c0d7d48715f653e73f3c9d8f9e28c4 Mon Sep 17 00:00:00 2001 From: Julian Toledano Date: Tue, 29 Nov 2022 11:29:31 +0100 Subject: [PATCH 2/4] update: go.sum --- go.sum | 4 ---- 1 file changed, 4 deletions(-) diff --git a/go.sum b/go.sum index c4aee2abcdcc..ff9b376ee4d0 100644 --- a/go.sum +++ b/go.sum @@ -56,8 +56,6 @@ cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w cosmossdk.io/errors v1.0.0-beta.7/go.mod h1:mz6FQMJRku4bY7aqS/Gwfcmr/ue91roMEKAmDUDpBfE= cosmossdk.io/math v1.0.0-beta.4 h1:JtKedVLGzA0vv84xjYmZ75RKG35Kf2WwcFu8IjRkIIw= cosmossdk.io/math v1.0.0-beta.4/go.mod h1:An0MllWJY6PxibUpnwGk8jOm+a/qIxlKmL5Zyp9NnaM= -cosmossdk.io/tools/rosetta v0.1.0 h1:rJ0sp9bTuGzava+C2b0MFaci/zhINdxSOiJE1FC/UJw= -cosmossdk.io/tools/rosetta v0.1.0/go.mod h1:9wDBVqKC7BDJjk+RWvoE4VXs3Ub/i5rLBrieKpoH+Zw= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU= filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= @@ -161,8 +159,6 @@ github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOG github.com/cockroachdb/apd/v3 v3.1.0 h1:MK3Ow7LH0W8zkd5GMKA1PvS9qG3bWFI95WaVNfyZJ/w= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/coinbase/rosetta-sdk-go v0.8.2-0.20221007214527-e03849ba430a h1:tAQukG4KWS+9jBQs/lkFfKfONI01QJ1YoxnjzHAEh88= -github.com/coinbase/rosetta-sdk-go v0.8.2-0.20221007214527-e03849ba430a/go.mod h1:tXPR6AIW9ogsH4tYIaFOKOgfJNanCvcyl7JKLd4DToc= github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4= github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= From cb13a8064e10e408b2f513111018bdd46e949bfb Mon Sep 17 00:00:00 2001 From: Julian Toledano Date: Tue, 29 Nov 2022 11:39:43 +0100 Subject: [PATCH 3/4] CHANGELOG --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d47390899d5..9374d779fc69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -184,7 +184,7 @@ extension interfaces. `module.Manager.Modules` is now of type `map[string]interf * (tx) [#12659](https://github.com/cosmos/cosmos-sdk/pull/12659) Remove broadcast mode `block`. ### Bug Fixes - +* (server) [#14062](https://github.com/cosmos/cosmos-sdk/pull/14062) Remove rosetta from server start. * (x/upgrade) [#13936](https://github.com/cosmos/cosmos-sdk/pull/13936) Make downgrade verification work again * (x/group) [#13742](https://github.com/cosmos/cosmos-sdk/pull/13742) Fix `validate-genesis` when group policy accounts exist. * (x/auth) [#13838](https://github.com/cosmos/cosmos-sdk/pull/13838) Fix calling `String()` when pubkey is set on a `BaseAccount`. From c80e09b851c58a668467f62a3e6c2e442a6bd380 Mon Sep 17 00:00:00 2001 From: Julian Toledano Date: Wed, 30 Nov 2022 09:42:25 +0100 Subject: [PATCH 4/4] update: changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9374d779fc69..8def4826039f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements +* (server) [#14062](https://github.com/cosmos/cosmos-sdk/pull/14062) Remove rosetta from server start. * [13882] (https://github.com/cosmos/cosmos-sdk/pull/13882) Add tx `encode` and `decode` endpoints to amino tx service. > Note: These endpoints encodes and decodes only amino txs. * (config) [#13894](https://github.com/cosmos/cosmos-sdk/pull/13894) Support state streaming configuration in `app.toml` template and default configuration. @@ -184,7 +185,7 @@ extension interfaces. `module.Manager.Modules` is now of type `map[string]interf * (tx) [#12659](https://github.com/cosmos/cosmos-sdk/pull/12659) Remove broadcast mode `block`. ### Bug Fixes -* (server) [#14062](https://github.com/cosmos/cosmos-sdk/pull/14062) Remove rosetta from server start. + * (x/upgrade) [#13936](https://github.com/cosmos/cosmos-sdk/pull/13936) Make downgrade verification work again * (x/group) [#13742](https://github.com/cosmos/cosmos-sdk/pull/13742) Fix `validate-genesis` when group policy accounts exist. * (x/auth) [#13838](https://github.com/cosmos/cosmos-sdk/pull/13838) Fix calling `String()` when pubkey is set on a `BaseAccount`.