Skip to content

Commit 29388c8

Browse files
authored
feat: enable block api and block api proxy service (standalone) (#4580)
<!-- Please read and fill out this form before submitting your PR. Please make sure you have reviewed our contributors guide before submitting your first PR. --> ## Overview Updates dependencies to enable core block api (in-process) and block api proxy service (standalone).
1 parent 7fb5d0f commit 29388c8

File tree

6 files changed

+22
-34
lines changed

6 files changed

+22
-34
lines changed

go.mod

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ require (
4242
github.com/spf13/cobra v1.9.1
4343
github.com/spf13/pflag v1.0.6
4444
github.com/stretchr/testify v1.10.0
45-
github.com/tendermint/tendermint v0.0.0-00010101000000-000000000000
4645
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394
4746
google.golang.org/genproto/googleapis/api v0.0.0-20250106144421-5f5ef82da422
4847
google.golang.org/grpc v1.71.1
@@ -174,7 +173,6 @@ require (
174173
github.com/grafana/pyroscope-go/godeltaprof v0.1.8 // indirect
175174
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
176175
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
177-
github.com/gtank/merlin v0.1.1 // indirect
178176
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
179177
github.com/hashicorp/go-getter v1.7.6 // indirect
180178
github.com/hashicorp/go-hclog v1.6.3 // indirect
@@ -204,14 +202,12 @@ require (
204202
github.com/kr/pretty v0.3.1 // indirect
205203
github.com/kr/text v0.2.0 // indirect
206204
github.com/lib/pq v1.10.9 // indirect
207-
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
208205
github.com/linxGnu/grocksdb v1.9.8 // indirect
209206
github.com/magiconair/properties v1.8.9 // indirect
210207
github.com/mailru/easyjson v0.7.7 // indirect
211208
github.com/manifoldco/promptui v0.9.0 // indirect
212209
github.com/mattn/go-colorable v0.1.14 // indirect
213210
github.com/mattn/go-isatty v0.0.20 // indirect
214-
github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect
215211
github.com/minio/highwayhash v1.0.3 // indirect
216212
github.com/minio/md5-simd v1.1.2 // indirect
217213
github.com/minio/minio-go/v7 v7.0.74 // indirect
@@ -249,6 +245,7 @@ require (
249245
github.com/subosito/gotenv v1.6.0 // indirect
250246
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
251247
github.com/tendermint/go-amino v0.16.0 // indirect
248+
github.com/tendermint/tendermint v0.0.0-00010101000000-000000000000 // indirect
252249
github.com/tidwall/btree v1.7.0 // indirect
253250
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
254251
github.com/ulikunitz/xz v0.5.12 // indirect
@@ -299,10 +296,10 @@ require (
299296
replace (
300297
// x/upgrade: release/v0.50.x-celestia
301298
cosmossdk.io/x/upgrade => github.com/celestiaorg/cosmos-sdk/x/upgrade v0.0.0-20250407210654-0b63fb36e982
302-
// celestia-core: v1.53.0-tm-v0.38.17-rc1
303-
github.com/cometbft/cometbft => github.com/celestiaorg/celestia-core v1.53.0-tm-v0.38.17-rc1
304-
// cosmos-sdk: v1.29.0-sdk-v0.50.12-rc0
305-
github.com/cosmos/cosmos-sdk => github.com/celestiaorg/cosmos-sdk v1.29.0-sdk-v0.50.12-rc0
299+
// celestia-core: v1.53.0-tm-v0.38.17-rc2
300+
github.com/cometbft/cometbft => github.com/celestiaorg/celestia-core v1.53.0-tm-v0.38.17-rc2
301+
// cosmos-sdk: v1.29.0-sdk-v0.50.12-rc1
302+
github.com/cosmos/cosmos-sdk => github.com/celestiaorg/cosmos-sdk v1.29.0-sdk-v0.50.12-rc1
306303
// goleveldb: cannonical version
307304
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
308305
// celestia-core(v0.34.x): used for multiplexing abci v1 requests

go.sum

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,6 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25
235235
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
236236
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
237237
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
238-
github.com/ChainSafe/go-schnorrkel v1.0.0 h1:3aDA67lAykLaG1y3AOjs88dMxC88PgUuHRrLeDnvGIM=
239-
github.com/ChainSafe/go-schnorrkel v1.0.0/go.mod h1:dpzHYVxLZcp8pjlV+O+UR8K0Hp/z7vcchBSbMBEhCw4=
240238
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
241239
github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q=
242240
github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
@@ -260,8 +258,6 @@ github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWX
260258
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
261259
github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE=
262260
github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g=
263-
github.com/Workiva/go-datastructures v1.0.53 h1:J6Y/52yX10Xc5JjXmGtWoSSxs3mZnGSaq37xZZh7Yig=
264-
github.com/Workiva/go-datastructures v1.0.53/go.mod h1:1yZL+zfsztete+ePzZz/Zb1/t5BnDuE2Ya2MMGhzP6A=
265261
github.com/adlio/schema v1.3.6 h1:k1/zc2jNfeiZBA5aFTRy37jlBIuCkXCm0XmvpzCKI9I=
266262
github.com/adlio/schema v1.3.6/go.mod h1:qkxwLgPBd1FgLRHYVCmQT/rrBr3JH38J9LjmVzWNudg=
267263
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
@@ -354,10 +350,10 @@ github.com/celestiaorg/bittwister v0.0.0-20231213180407-65cdbaf5b8c7 h1:nxplQi8w
354350
github.com/celestiaorg/bittwister v0.0.0-20231213180407-65cdbaf5b8c7/go.mod h1:1EF5MfOxVf0WC51Gb7pJ6bcZxnXKNAf9pqWtjgPBAYc=
355351
github.com/celestiaorg/celestia-core v1.45.0-tm-v0.34.35 h1:T21AhezjcByAlWDHmiVbpg743Uqk/dqBzJkQsAnbQf8=
356352
github.com/celestiaorg/celestia-core v1.45.0-tm-v0.34.35/go.mod h1:fQ46s1hYFTGFBsHsuGsbxDZ720ZPQow5Iyqw+yErZSo=
357-
github.com/celestiaorg/celestia-core v1.53.0-tm-v0.38.17-rc1 h1:vKxy6ehVXUV1i5O6jQF6ndzuoJWJa5PrAadFhpTpSKw=
358-
github.com/celestiaorg/celestia-core v1.53.0-tm-v0.38.17-rc1/go.mod h1:PiU80T/t0z8FPlz7DRZgvrBux0jJiqxFi9lNBFdGUps=
359-
github.com/celestiaorg/cosmos-sdk v1.29.0-sdk-v0.50.12-rc0 h1:F0E4lBZjQtjo84pXSMN0mt5fItGGlQHRHvmVVP7O1ZA=
360-
github.com/celestiaorg/cosmos-sdk v1.29.0-sdk-v0.50.12-rc0/go.mod h1:U6c31kgMMhM+QxQBQNncap2L9/zg8Kiga/up6TAgbCI=
353+
github.com/celestiaorg/celestia-core v1.53.0-tm-v0.38.17-rc2 h1:rz2t2z32Fk9HK2sePxyi0FvLlUTx0UXOc1fRWmQiSeE=
354+
github.com/celestiaorg/celestia-core v1.53.0-tm-v0.38.17-rc2/go.mod h1:PiU80T/t0z8FPlz7DRZgvrBux0jJiqxFi9lNBFdGUps=
355+
github.com/celestiaorg/cosmos-sdk v1.29.0-sdk-v0.50.12-rc1 h1:FQXIV2kLbGsCowr0qjsAvkRfmSM3PWkaEgZvmy5qj9U=
356+
github.com/celestiaorg/cosmos-sdk v1.29.0-sdk-v0.50.12-rc1/go.mod h1:clLEg7hWK0iJfiO1Vp71tcQ0vGbFzVsEcLxxnRobIZM=
361357
github.com/celestiaorg/cosmos-sdk/x/upgrade v0.0.0-20250407210654-0b63fb36e982 h1:Yg1mY+cX9amp24fhzWRp76SO8jFKzPaL55GjFJHskiY=
362358
github.com/celestiaorg/cosmos-sdk/x/upgrade v0.0.0-20250407210654-0b63fb36e982/go.mod h1:75zSwit7YoKRY3UlsCs4y0Jup9ZxJpLER+tssfst/zY=
363359
github.com/celestiaorg/go-square/v2 v2.2.0 h1:zJnUxCYc65S8FgUfVpyG/osDcsnjzo/JSXw/Uwn8zp4=
@@ -767,10 +763,6 @@ github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4
767763
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
768764
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU=
769765
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0=
770-
github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is=
771-
github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s=
772-
github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc=
773-
github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o=
774766
github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE=
775767
github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
776768
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
@@ -900,8 +892,6 @@ github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+
900892
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
901893
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
902894
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
903-
github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8=
904-
github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg=
905895
github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
906896
github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
907897
github.com/linxGnu/grocksdb v1.9.8 h1:vOIKv9/+HKiqJAElJIEYv3ZLcihRxyP7Suu/Mu8Dxjs=
@@ -931,9 +921,6 @@ github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp
931921
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
932922
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
933923
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
934-
github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM=
935-
github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 h1:QRUSJEgZn2Snx0EmT/QLXibWjSUDjKWvXIT19NBVp94=
936-
github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM=
937924
github.com/minio/highwayhash v1.0.3 h1:kbnuUMoHYyVl7szWjSxJnxw11k2U709jqFPPmIUyD6Q=
938925
github.com/minio/highwayhash v1.0.3/go.mod h1:GGYsuwP/fPD6Y9hMiXuapVvlIUEhFhMTh0rxU3ik1LQ=
939926
github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=

test/util/genesis/accounts.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,6 @@ func (v *Validator) GenTx(ecfg encoding.Config, kr keyring.Keyring, chainID stri
104104
return nil, err
105105
}
106106

107-
commission, err := math.LegacyNewDecFromStr("0.5")
108-
if err != nil {
109-
return nil, err
110-
}
111-
112107
pk, err := cryptocodec.FromCmtPubKeyInterface(v.ConsensusKey.PubKey())
113108
if err != nil {
114109
return nil, fmt.Errorf("converting public key for node %s: %w", v.Name, err)
@@ -119,7 +114,7 @@ func (v *Validator) GenTx(ecfg encoding.Config, kr keyring.Keyring, chainID stri
119114
pk,
120115
sdk.NewCoin(params.BondDenom, math.NewInt(v.Stake)),
121116
stakingtypes.NewDescription(v.Name, "", "", "", ""),
122-
stakingtypes.NewCommissionRates(commission, math.LegacyOneDec(), math.LegacyOneDec()),
117+
stakingtypes.NewCommissionRates(math.LegacyNewDecWithPrec(5, 2), math.LegacyNewDecWithPrec(5, 2), math.LegacyNewDec(0)),
123118
math.NewInt(v.Stake/2),
124119
)
125120
if err != nil {

test/util/testnode/config.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ func DefaultTendermintConfig() *tmconfig.Config {
157157
// Set all the ports to random open ones.
158158
tmCfg.RPC.ListenAddress = fmt.Sprintf("tcp://127.0.0.1:%d", mustGetFreePort())
159159
tmCfg.P2P.ListenAddress = fmt.Sprintf("tcp://127.0.0.1:%d", mustGetFreePort())
160-
tmCfg.RPC.GRPCListenAddress = fmt.Sprintf("tcp://127.0.0.1:%d", mustGetFreePort())
161160

162161
return tmCfg
163162
}

test/util/testnode/network.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ func NewNetwork(t testing.TB, config *Config) (cctx Context, rpcAddr, grpcAddr s
3838
cctx, stopNode, err := StartNode(tmNode, cctx)
3939
require.NoError(t, err)
4040

41-
grpcServer, cctx, cleanupGRPC, err := StartGRPCServer(log.NewTestLogger(t), app, config.AppConfig, cctx)
41+
coreEnv, err := tmNode.ConfigureRPC()
42+
require.NoError(t, err)
43+
44+
grpcServer, cctx, cleanupGRPC, err := StartGRPCServer(log.NewTestLogger(t), app, config.AppConfig, cctx, coreEnv)
4245
require.NoError(t, err)
4346

4447
apiServer, err := StartAPIServer(app, *config.AppConfig, cctx, grpcServer)

test/util/testnode/rpc_client.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88
"cosmossdk.io/log"
99
"github.com/cometbft/cometbft/node"
1010
"github.com/cometbft/cometbft/rpc/client/local"
11+
"github.com/cometbft/cometbft/rpc/core"
12+
coregrpc "github.com/cometbft/cometbft/rpc/grpc"
1113
"github.com/cosmos/cosmos-sdk/codec"
1214
"github.com/cosmos/cosmos-sdk/server/api"
1315
srvconfig "github.com/cosmos/cosmos-sdk/server/config"
@@ -49,7 +51,7 @@ func StartNode(cometNode *node.Node, cctx Context) (Context, func() error, error
4951
// StartGRPCServer starts the GRPC server using the provided application and
5052
// config. A GRPC client connection to that server is also added to the client
5153
// context. The returned function should be used to shutdown the server.
52-
func StartGRPCServer(logger log.Logger, app srvtypes.Application, appCfg *srvconfig.Config, cctx Context) (*grpc.Server, Context, func() error, error) {
54+
func StartGRPCServer(logger log.Logger, app srvtypes.Application, appCfg *srvconfig.Config, cctx Context, coreEnv *core.Environment) (*grpc.Server, Context, func() error, error) {
5355
emptycleanup := func() error { return nil }
5456
// Add the tx service in the gRPC router.
5557
app.RegisterTxService(cctx.Context)
@@ -64,6 +66,11 @@ func StartGRPCServer(logger log.Logger, app srvtypes.Application, appCfg *srvcon
6466
return nil, Context{}, emptycleanup, err
6567
}
6668

69+
blockAPI := coregrpc.NewBlockAPI(coreEnv)
70+
coregrpc.RegisterBlockAPIServer(grpcSrv, blockAPI)
71+
72+
go blockAPI.StartNewBlockEventListener(cctx.goContext) //nolint:errcheck
73+
6774
go func() {
6875
// StartGRPCServer is a blocking function, we need to run it in a go routine.
6976
if err := srvgrpc.StartGRPCServer(cctx.goContext, logger, appCfg.GRPC, grpcSrv); err != nil {

0 commit comments

Comments
 (0)