Skip to content

Commit

Permalink
refactor(server/v2/grpc): simplify node service (backport #22728) (#2…
Browse files Browse the repository at this point in the history
…2735)

Co-authored-by: Julien Robert <[email protected]>
  • Loading branch information
mergify[bot] and julienrbrt authored Dec 3, 2024
1 parent 7911d73 commit 43af640
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 36 deletions.
22 changes: 0 additions & 22 deletions proto/cosmos/base/node/v2/query.proto

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/build/protobuf.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
protoVer=0.15.1
protoVer=0.15.2
protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer)
protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName)

Expand Down
11 changes: 9 additions & 2 deletions server/v2/cometbft/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cometbft

import (
"context"
"fmt"

abci "github.com/cometbft/cometbft/abci/types"
abciproto "github.com/cometbft/cometbft/api/cometbft/abci/v1"
Expand All @@ -15,6 +16,7 @@ import (
"cosmossdk.io/core/server"
corestore "cosmossdk.io/core/store"
"cosmossdk.io/core/transaction"
storeserver "cosmossdk.io/server/v2/store"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/grpc/cmtservice"
Expand Down Expand Up @@ -208,10 +210,15 @@ func (s nodeServer[T]) Config(ctx context.Context, _ *nodeservice.ConfigRequest)
minGasPricesStr = minGasPrices.(string)
}

storeCfg, err := storeserver.UnmarshalConfig(s.cfg)
if err != nil {
return nil, err
}

return &nodeservice.ConfigResponse{
MinimumGasPrice: minGasPricesStr,
PruningKeepRecent: "ambiguous in v2",
PruningInterval: "ambiguous in v2",
PruningKeepRecent: fmt.Sprintf("%d", storeCfg.Options.SCPruningOption.KeepRecent),
PruningInterval: fmt.Sprintf("%d", storeCfg.Options.SCPruningOption.Interval),
HaltHeight: s.cometBFTAppConfig.HaltHeight,
}, nil
}
Expand Down
15 changes: 6 additions & 9 deletions tools/confix/data/v2-app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ max-recv-msg-size = 10485760
# The default value is math.MaxInt32.
max-send-msg-size = 2147483647

[grpc-gateway]
# Enable defines if the gRPC-gateway should be enabled.
enable = true
# Address defines the address the gRPC-gateway server binds to.
address = 'localhost:1317'

[rest]
# Enable defines if the REST server should be enabled.
enable = true
Expand All @@ -56,18 +62,9 @@ minimum-gas-prices = '0stake'
app-db-backend = 'goleveldb'

[store.options]
# State storage database type. Currently we support: "pebble" and "rocksdb"
ss-type = 'pebble'
# State commitment database type. Currently we support: "iavl" and "iavl-v2"
sc-type = 'iavl'

# Pruning options for state storage
[store.options.ss-pruning-option]
# Number of recent heights to keep on disk.
keep-recent = 2
# Height interval at which pruned heights are removed from disk.
interval = 100

# Pruning options for state commitment
[store.options.sc-pruning-option]
# Number of recent heights to keep on disk.
Expand Down
2 changes: 0 additions & 2 deletions tools/confix/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,9 @@ var v2KeyChanges = v2KeyChangesMap{
"halt-time": []string{"comet.halt-time"},
"app-db-backend": []string{"store.app-db-backend"},
"pruning-keep-recent": []string{
"store.options.ss-pruning-option.keep-recent",
"store.options.sc-pruning-option.keep-recent",
},
"pruning-interval": []string{
"store.options.ss-pruning-option.interval",
"store.options.sc-pruning-option.interval",
},
"iavl-cache-size": []string{"store.options.iavl-config.cache-size"},
Expand Down

0 comments on commit 43af640

Please sign in to comment.