-
Notifications
You must be signed in to change notification settings - Fork 561
feat: support multi gRPC query clients serve with old binary #1603
Conversation
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
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
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
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
This reverts commit 864a001.
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
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
Codecov Report
Additional details and impacted files@@ 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
|
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
for k, v := range data { | ||
backupGRPCBlockAddressBlockRange[v] = k | ||
} |
Check warning
Code scanning / CodeQL
Iteration over map
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}]}}', |
There was a problem hiding this comment.
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],
}
There was a problem hiding this comment.
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
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. |
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. |
Closes: #1601
Description
For contributor use:
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerFor admin use:
WIP
,R4R
,docs
, etc)