Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

feat: support multi gRPC query clients serve with old binary #1603

Closed
wants to merge 33 commits into from

Conversation

mmsqe
Copy link
Contributor

@mmsqe mmsqe commented Jan 13, 2023

Closes: #1601

Description


For contributor use:

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

For admin use:

  • Added appropriate labels to PR (ex. WIP, R4R, docs, etc)
  • Reviewers assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

testutil/network/util.go Fixed Show fixed Hide fixed
rpc/backend/tracing.go Fixed Show fixed Hide fixed
Comment on lines +193 to +199
for key, conn := range backupGRPCClientConns {
backend.backupQueryClients[key] = &rpctypes.QueryClient{
ServiceClient: tx.NewServiceClient(conn),
QueryClient: evmtypes.NewQueryClient(conn),
FeeMarket: feemarkettypes.NewQueryClient(conn),
}
}

Check failure

Code scanning / gosec

the value in the range statement should be _ unless copying a map: want: for key := range m

the value in the range statement should be _ unless copying a map: want: for key := range m
Comment on lines +492 to +509
for k, address := range grpcBlockAddresses {
grpcAddr, err := parseGrpcAddress(address)
if err != nil {
return err
}
c, err := grpc.Dial(
grpcAddr,
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithDefaultCallOptions(
grpc.ForceCodec(codec.NewProtoCodec(clientCtx.InterfaceRegistry).GRPCCodec()),
grpc.MaxCallRecvMsgSize(maxRecvMsgSize),
grpc.MaxCallSendMsgSize(maxSendMsgSize),
),
)
if err != nil {
return err
}
backupGRPCClientConns[k] = c
}

Check failure

Code scanning / gosec

the value in the range statement should be _ unless copying a map: want: for key := range m

expected exactly 1 statement (either append, delete, or copying to another map) in a range with a map, got 5
rpc/backend/tracing.go Fixed Show fixed Hide fixed
rpc/backend/tracing.go Fixed Show fixed Hide fixed
Comment on lines +193 to +199
for key, conn := range backupGRPCClientConns {
backend.backupQueryClients[key] = &rpctypes.QueryClient{
ServiceClient: tx.NewServiceClient(conn),
QueryClient: evmtypes.NewQueryClient(conn),
FeeMarket: feemarkettypes.NewQueryClient(conn),
}
}

Check warning

Code scanning / CodeQL

Iteration over map

Iteration over map may be a possible source of non-determinism
rpc/backend/tracing.go Fixed Show fixed Hide fixed
Comment on lines +492 to +509
for k, address := range grpcBlockAddresses {
grpcAddr, err := parseGrpcAddress(address)
if err != nil {
return err
}
c, err := grpc.Dial(
grpcAddr,
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithDefaultCallOptions(
grpc.ForceCodec(codec.NewProtoCodec(clientCtx.InterfaceRegistry).GRPCCodec()),
grpc.MaxCallRecvMsgSize(maxRecvMsgSize),
grpc.MaxCallSendMsgSize(maxSendMsgSize),
),
)
if err != nil {
return err
}
backupGRPCClientConns[k] = c
}

Check warning

Code scanning / CodeQL

Iteration over map

Iteration over map may be a possible source of non-determinism
rpc/backend/tracing.go Fixed Show fixed Hide fixed
rpc/backend/backend.go Fixed Show fixed Hide fixed
rpc/backend/backend.go Fixed Show fixed Hide fixed
rpc/backend/tracing.go Fixed Show fixed Hide fixed
Comment on lines +343 to +345
for k, v := range data {
backupGRPCBlockAddressBlockRange[v] = k
}

Check failure

Code scanning / gosec

the value in the range statement should be _ unless copying a map: want: for key := range m

the value in the range statement should be _ unless copying a map: want: for key := range m
Comment on lines +31 to +37
for blocks, client := range b.backupQueryClients {
// b1-b2 -> g1
// b3-b4 -> g2
if int64(blocks[0]) <= height && int64(blocks[1]) >= height {
return client
}
}

Check failure

Code scanning / gosec

the value in the range statement should be _ unless copying a map: want: for key := range m

the value in the range statement should be _ unless copying a map: want: for key := range m
@codecov
Copy link

codecov bot commented Jan 17, 2023

Codecov Report

Merging #1603 (ea15608) into main (f594627) will decrease coverage by 0.13%.
The diff coverage is 55.31%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1603      +/-   ##
==========================================
- Coverage   68.15%   68.03%   -0.13%     
==========================================
  Files         112      112              
  Lines       10175    10215      +40     
==========================================
+ Hits         6935     6950      +15     
- Misses       2832     2855      +23     
- Partials      408      410       +2     
Impacted Files Coverage Δ
rpc/backend/sign_tx.go 59.80% <ø> (ø)
rpc/backend/backend.go 57.69% <30.00%> (-18.78%) ⬇️
server/config/config.go 21.80% <39.58%> (-1.05%) ⬇️
rpc/backend/tracing.go 58.69% <50.00%> (-1.77%) ⬇️
rpc/backend/account_info.go 82.89% <100.00%> (+0.22%) ⬆️
rpc/backend/blocks.go 87.84% <100.00%> (+0.03%) ⬆️
rpc/backend/call_tx.go 61.18% <100.00%> (+0.12%) ⬆️
rpc/backend/chain_info.go 83.13% <100.00%> (+0.40%) ⬆️
rpc/backend/node_info.go 46.75% <100.00%> (+0.24%) ⬆️

Comment on lines +31 to +37
for blocks, client := range b.backupQueryClients {
// b1-b2 -> g1
// b3-b4 -> g2
if int64(blocks[0]) <= height && int64(blocks[1]) >= height {
return client
}
}

Check warning

Code scanning / CodeQL

Iteration over map

Iteration over map may be a possible source of non-determinism
Comment on lines +343 to +345
for k, v := range data {
backupGRPCBlockAddressBlockRange[v] = k
}

Check warning

Code scanning / CodeQL

Iteration over map

Iteration over map may be a possible source of non-determinism
rpc/backend/tracing.go Fixed Show fixed Hide fixed
rpc/backend/tracing.go Fixed Show fixed Hide fixed
f"{str(path)}/{plan_name}/bin/ethermintd",
"start",
"--json-rpc.backup-grpc-address-block-range",
f'{{"0.0.0.0:{grpc_port1}": [0, {target_height}]}}',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yihuang any better way to avoid this monstrosity, need support config like

'backup-grpc-address-block-range': {
  '0.0.0.0:26113': [0, 20],
  '0.0.0.0:26114': [20, 30],
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

either a custom format string or json looks good to me

@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days-before-close if no further activity occurs.

@github-actions
Copy link

github-actions bot commented May 9, 2023

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days-before-close if no further activity occurs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow multi gRPC query clients serve with old binary
2 participants