rpc: fix balance overflow (#219)

Closes #218
This commit is contained in:
yihuang 2021-07-02 17:29:47 +08:00 committed by GitHub
parent f7d975ada2
commit 6e983a9da1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 408 additions and 187 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -390,7 +390,7 @@ QueryAccountResponse is the response type for the Query/Account RPC method.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `balance` | [int64](#int64) | | balance is the balance of the EVM denomination. |
| `balance` | [string](#string) | | balance is the balance of the EVM denomination. |
| `code_hash` | [string](#string) | | code hash is the hex-formatted code bytes from the EOA. |
| `nonce` | [uint64](#uint64) | | nonce is the account's sequence number. |
@ -422,7 +422,7 @@ QueryBalanceResponse is the response type for the Query/Balance RPC method.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `balance` | [int64](#int64) | | balance is the balance of the EVM denomination. |
| `balance` | [string](#string) | | balance is the balance of the EVM denomination. |

View File

@ -215,7 +215,12 @@ func (e *PublicAPI) GetBalance(address common.Address, blockNum rpctypes.BlockNu
return nil, err
}
return (*hexutil.Big)(big.NewInt(res.Balance)), nil
val, ok := sdk.NewIntFromString(res.Balance)
if !ok {
return nil, errors.New("invalid balance")
}
return (*hexutil.Big)(val.BigInt()), nil
}
// GetStorageAt returns the contract storage at the given address, block number, and key.
@ -992,10 +997,15 @@ func (e *PublicAPI) GetProof(address common.Address, storageKeys []string, block
accProofStr = proof.String()
}
balance, ok := sdk.NewIntFromString(res.Balance)
if !ok {
return nil, errors.New("invalid balance")
}
return &rpctypes.AccountResult{
Address: address,
AccountProof: []string{accProofStr},
Balance: (*hexutil.Big)(big.NewInt(res.Balance)),
Balance: (*hexutil.Big)(balance.BigInt()),
CodeHash: common.HexToHash(res.CodeHash),
Nonce: hexutil.Uint64(res.Nonce),
StorageHash: common.Hash{}, // NOTE: Ethermint doesn't have a storage hash. TODO: implement?

View File

@ -79,7 +79,7 @@ message QueryAccountRequest {
// QueryAccountResponse is the response type for the Query/Account RPC method.
message QueryAccountResponse {
// balance is the balance of the EVM denomination.
int64 balance = 1;
string balance = 1;
// code hash is the hex-formatted code bytes from the EOA.
string code_hash = 2;
// nonce is the account's sequence number.
@ -136,7 +136,7 @@ message QueryBalanceRequest {
// QueryBalanceResponse is the response type for the Query/Balance RPC method.
message QueryBalanceResponse {
// balance is the balance of the EVM denomination.
int64 balance = 1;
string balance = 1;
}
// QueryStorageRequest is the request type for the Query/Storage RPC method.

View File

@ -36,7 +36,7 @@ func (k Keeper) Account(c context.Context, req *types.QueryAccountRequest) (*typ
k.WithContext(ctx)
return &types.QueryAccountResponse{
Balance: k.GetBalance(addr).Int64(),
Balance: k.GetBalance(addr).String(),
CodeHash: k.GetCodeHash(addr).Hex(),
Nonce: k.GetNonce(addr),
}, nil
@ -127,7 +127,7 @@ func (k Keeper) Balance(c context.Context, req *types.QueryBalanceRequest) (*typ
balanceInt := k.GetBalance(ethcmn.HexToAddress(req.Address))
return &types.QueryBalanceResponse{
Balance: balanceInt.Int64(),
Balance: balanceInt.String(),
}, nil
}

View File

@ -36,7 +36,7 @@ func (suite *KeeperTestSuite) TestQueryAccount() {
"invalid address",
func() {
expAccount = &types.QueryAccountResponse{
Balance: 0,
Balance: "0",
CodeHash: common.BytesToHash(ethcrypto.Keccak256(nil)).Hex(),
Nonce: 0,
}
@ -56,7 +56,7 @@ func (suite *KeeperTestSuite) TestQueryAccount() {
suite.Require().NoError(err)
expAccount = &types.QueryAccountResponse{
Balance: 100,
Balance: "100",
CodeHash: common.BytesToHash(ethcrypto.Keccak256(nil)).Hex(),
Nonce: 0,
}
@ -168,7 +168,7 @@ func (suite *KeeperTestSuite) TestQueryCosmosAccount() {
func (suite *KeeperTestSuite) TestQueryBalance() {
var (
req *types.QueryBalanceRequest
expBalance int64
expBalance string
)
testCases := []struct {
@ -178,7 +178,7 @@ func (suite *KeeperTestSuite) TestQueryBalance() {
}{
{"invalid address",
func() {
expBalance = 0
expBalance = "0"
req = &types.QueryBalanceRequest{
Address: invalidAddress,
}
@ -194,7 +194,7 @@ func (suite *KeeperTestSuite) TestQueryBalance() {
err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, types.ModuleName, suite.address.Bytes(), amt)
suite.Require().NoError(err)
expBalance = 100
expBalance = "100"
req = &types.QueryBalanceRequest{
Address: suite.address.String(),
}

View File

@ -72,7 +72,7 @@ var xxx_messageInfo_QueryAccountRequest proto.InternalMessageInfo
// QueryAccountResponse is the response type for the Query/Account RPC method.
type QueryAccountResponse struct {
// balance is the balance of the EVM denomination.
Balance int64 `protobuf:"varint,1,opt,name=balance,proto3" json:"balance,omitempty"`
Balance string `protobuf:"bytes,1,opt,name=balance,proto3" json:"balance,omitempty"`
// code hash is the hex-formatted code bytes from the EOA.
CodeHash string `protobuf:"bytes,2,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty"`
// nonce is the account's sequence number.
@ -112,11 +112,11 @@ func (m *QueryAccountResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_QueryAccountResponse proto.InternalMessageInfo
func (m *QueryAccountResponse) GetBalance() int64 {
func (m *QueryAccountResponse) GetBalance() string {
if m != nil {
return m.Balance
}
return 0
return ""
}
func (m *QueryAccountResponse) GetCodeHash() string {
@ -381,7 +381,7 @@ var xxx_messageInfo_QueryBalanceRequest proto.InternalMessageInfo
// QueryBalanceResponse is the response type for the Query/Balance RPC method.
type QueryBalanceResponse struct {
// balance is the balance of the EVM denomination.
Balance int64 `protobuf:"varint,1,opt,name=balance,proto3" json:"balance,omitempty"`
Balance string `protobuf:"bytes,1,opt,name=balance,proto3" json:"balance,omitempty"`
}
func (m *QueryBalanceResponse) Reset() { *m = QueryBalanceResponse{} }
@ -417,11 +417,11 @@ func (m *QueryBalanceResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_QueryBalanceResponse proto.InternalMessageInfo
func (m *QueryBalanceResponse) GetBalance() int64 {
func (m *QueryBalanceResponse) GetBalance() string {
if m != nil {
return m.Balance
}
return 0
return ""
}
// QueryStorageRequest is the request type for the Query/Storage RPC method.
@ -1077,77 +1077,77 @@ func init() {
}
var fileDescriptor_8bbc79ec2b6c5cb2 = []byte{
// 1119 bytes of a gzipped FileDescriptorProto
// 1117 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x97, 0x4d, 0x6f, 0x1b, 0x45,
0x18, 0xc7, 0xbd, 0x8d, 0x13, 0x27, 0x4f, 0x12, 0x08, 0x83, 0x29, 0x61, 0x5b, 0x9c, 0xb0, 0xa8,
0xb1, 0xf3, 0xd2, 0xdd, 0xda, 0xbc, 0x95, 0x0a, 0x09, 0xe2, 0x4a, 0xa1, 0x52, 0x2b, 0x54, 0x9c,
0x8a, 0x03, 0x17, 0x6b, 0xbc, 0x1e, 0xad, 0xad, 0xac, 0x77, 0xdc, 0x9d, 0xb5, 0x95, 0x28, 0xca,
0xb1, 0xf3, 0xd2, 0x9d, 0xda, 0xbc, 0x95, 0x0a, 0x09, 0xe2, 0x4a, 0xa1, 0x52, 0x2b, 0x54, 0x9c,
0x8a, 0x03, 0x17, 0x6b, 0xbc, 0x5e, 0xad, 0xad, 0xac, 0x77, 0xdc, 0x9d, 0xb5, 0x95, 0x28, 0xca,
0x85, 0x03, 0x02, 0xc1, 0x01, 0xc4, 0x01, 0x84, 0x84, 0xd4, 0x2b, 0x37, 0xbe, 0x02, 0xb7, 0x1e,
0x2b, 0x71, 0xe1, 0x80, 0x10, 0x4a, 0x38, 0xf0, 0x31, 0xd0, 0xbc, 0xac, 0xbd, 0x6b, 0x7b, 0xbd,
0x0e, 0xe2, 0x36, 0x33, 0x7e, 0x5e, 0x7e, 0xcf, 0x33, 0xcf, 0xce, 0x5f, 0x06, 0x83, 0x04, 0x2d,
0xe2, 0x77, 0xda, 0x5e, 0x60, 0x91, 0x7e, 0xc7, 0xea, 0x97, 0xb1, 0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a0, 0x4a, 0x5c, 0x58, 0xa4, 0xbd, 0x3f, 0x69, 0x90,
0x53, 0xb2, 0x90, 0x82, 0x16, 0x57, 0xa2, 0x14, 0xb4, 0x11, 0xa5, 0x31, 0xde, 0x11, 0x68, 0x65,
0x64, 0x25, 0xa1, 0x31, 0xe9, 0x30, 0x24, 0xb3, 0x4e, 0x8f, 0xc8, 0xc9, 0x19, 0xfa, 0x5a, 0x83,
0x2c, 0x17, 0x14, 0x54, 0x4a, 0x99, 0xba, 0x81, 0x56, 0xe9, 0xdb, 0x33, 0x58, 0x2a, 0x2c, 0x4b,
0x60, 0x6d, 0xa3, 0x62, 0xf2, 0x58, 0x36, 0x63, 0xed, 0xfa, 0x56, 0x83, 0x05, 0x29, 0x41, 0x68,
0x67, 0x6a, 0x9a, 0x98, 0xb6, 0xe9, 0xbb, 0x33, 0xd9, 0x2a, 0x28, 0x53, 0x40, 0x95, 0xd0, 0x56,
0x12, 0x94, 0x92, 0x09, 0xeb, 0x94, 0x8b, 0x94, 0xb8, 0xc2, 0xa5, 0x81, 0x9c, 0xa0, 0x9b, 0xd3,
0x47, 0x66, 0x44, 0xf6, 0x74, 0x73, 0x56, 0xf3, 0x59, 0x1f, 0x9d, 0x06, 0x77, 0x89, 0xf1, 0xfd,
0xa8, 0x01, 0x0c, 0x95, 0x02, 0xcd, 0x90, 0x31, 0x2a, 0x36, 0xba, 0x35, 0xb3, 0xbd, 0x42, 0xdc,
0x15, 0x88, 0x37, 0xd0, 0xeb, 0xd3, 0x11, 0x85, 0x32, 0xa1, 0x2f, 0x35, 0x58, 0x90, 0x3a, 0x92,
0x72, 0xa1, 0x31, 0xe9, 0x4a, 0xb9, 0xd0, 0xb8, 0xa0, 0x19, 0x5b, 0x02, 0x68, 0x13, 0x15, 0x92,
0x80, 0xa4, 0x74, 0x89, 0x46, 0x0d, 0xc5, 0x26, 0xa5, 0x51, 0x63, 0xfa, 0x96, 0xd2, 0xa8, 0x71,
0x15, 0x4b, 0x6f, 0x14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0x95, 0x04, 0xa5,
0x64, 0x02, 0x9f, 0x72, 0x91, 0x12, 0x57, 0xb8, 0x34, 0x90, 0x13, 0x74, 0x73, 0xfa, 0xc8, 0x8c,
0xc8, 0x9e, 0x6e, 0xce, 0x6a, 0x3e, 0xeb, 0xa3, 0xd3, 0xe0, 0x2e, 0x31, 0xbe, 0x1f, 0x35, 0x80,
0xa1, 0x52, 0xa0, 0x19, 0x32, 0x46, 0xc5, 0x46, 0xc7, 0x33, 0xdb, 0x2b, 0xc4, 0x5d, 0x81, 0x78,
0x03, 0xbd, 0x3e, 0x1d, 0x51, 0x28, 0x13, 0xfa, 0x52, 0x83, 0x05, 0xa9, 0x23, 0x29, 0x17, 0x1a,
0x93, 0xae, 0x94, 0x0b, 0x8d, 0x0b, 0x9a, 0xb1, 0x25, 0x80, 0x36, 0x51, 0x21, 0x09, 0x48, 0x4a,
0x97, 0x68, 0xd4, 0x50, 0x6c, 0x52, 0x1a, 0x35, 0xa6, 0x6f, 0x29, 0x8d, 0x1a, 0x57, 0xb1, 0xf4,
0x46, 0x31, 0xe1, 0x53, 0xb7, 0x88, 0xeb, 0x56, 0xab, 0x4f, 0xcf, 0x0b, 0xda, 0xb3, 0xf3, 0x82,
0xf6, 0xd7, 0x79, 0x41, 0xfb, 0xe6, 0xa2, 0x90, 0x79, 0x76, 0x51, 0xc8, 0xfc, 0x7e, 0x51, 0xc8,
0x7c, 0x5a, 0x72, 0xda, 0x41, 0xab, 0xd7, 0x30, 0x2d, 0xda, 0xc1, 0x41, 0x8b, 0xf8, 0xac, 0xcd,
0x22, 0x01, 0x8f, 0x45, 0xc8, 0xe0, 0xa4, 0x6b, 0xb3, 0xc6, 0x82, 0xf8, 0x37, 0xf6, 0xc6, 0xbf,
0x01, 0x00, 0x00, 0xff, 0xff, 0x4e, 0x4f, 0xb9, 0xc4, 0x4d, 0x0e, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -1676,10 +1676,12 @@ func (m *QueryAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i--
dAtA[i] = 0x12
}
if m.Balance != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.Balance))
if len(m.Balance) > 0 {
i -= len(m.Balance)
copy(dAtA[i:], m.Balance)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Balance)))
i--
dAtA[i] = 0x8
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
@ -1874,10 +1876,12 @@ func (m *QueryBalanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if m.Balance != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.Balance))
if len(m.Balance) > 0 {
i -= len(m.Balance)
copy(dAtA[i:], m.Balance)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Balance)))
i--
dAtA[i] = 0x8
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
@ -2373,8 +2377,9 @@ func (m *QueryAccountResponse) Size() (n int) {
}
var l int
_ = l
if m.Balance != 0 {
n += 1 + sovQuery(uint64(m.Balance))
l = len(m.Balance)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.CodeHash)
if l > 0 {
@ -2469,8 +2474,9 @@ func (m *QueryBalanceResponse) Size() (n int) {
}
var l int
_ = l
if m.Balance != 0 {
n += 1 + sovQuery(uint64(m.Balance))
l = len(m.Balance)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
@ -2788,10 +2794,10 @@ func (m *QueryAccountResponse) Unmarshal(dAtA []byte) error {
}
switch fieldNum {
case 1:
if wireType != 0 {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType)
}
m.Balance = 0
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
@ -2801,11 +2807,24 @@ func (m *QueryAccountResponse) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.Balance |= int64(b&0x7F) << shift
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Balance = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CodeHash", wireType)
@ -3412,10 +3431,10 @@ func (m *QueryBalanceResponse) Unmarshal(dAtA []byte) error {
}
switch fieldNum {
case 1:
if wireType != 0 {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType)
}
m.Balance = 0
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
@ -3425,11 +3444,24 @@ func (m *QueryBalanceResponse) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.Balance |= int64(b&0x7F) << shift
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Balance = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])