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

Commit 25d39b3

Browse files
authored
Merge branch 'main' into fedekunze/refactor-antehandler
2 parents b9752ca + f4c7be2 commit 25d39b3

File tree

5 files changed

+52
-9
lines changed

5 files changed

+52
-9
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
9292
* (proto) [#1466](https://github.com/evmos/ethermint/pull/1466) Fix proto scripts and upgrade them to mirror current cosmos-sdk scripts
9393
* (rpc) [#1405](https://github.com/evmos/ethermint/pull/1405) Fix uninitialized chain ID field in gRPC requests.
9494
* (analytics) [#1434](https://github.com/evmos/ethermint/pull/1434) Remove unbound labels from custom tendermint metrics.
95+
* (rpc) [#1484](https://github.com/evmos/ethermint/pull/1484) Align empty account result for old blocks as ethereum instead of return account not found error.
96+
9597

9698
## [v0.19.3] - 2022-10-14
9799

gomod2nix.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ schema = 3
9797
version = "v1.0.0-alpha8"
9898
hash = "sha256-iXzXoS5Kfh5DBy+PhdFWraDWXda/3M4j7j4VECjv4CA="
9999
[mod."github.com/cosmos/cosmos-sdk"]
100-
version = "v0.46.5-0.20221114064055-2114ec42dfa1"
101-
hash = "sha256-swqznmZfl2dlj/8ReJJs0zagFN2xpzF2ehsfVvPbohc="
100+
version = "v0.46.6"
101+
hash = "sha256-H1VZxZUWXhpXiY3A9smLp09MEGpXmh+XvX6YUiXPcpQ="
102102
[mod."github.com/cosmos/go-bip39"]
103103
version = "v1.0.0"
104104
hash = "sha256-Qm2aC2vaS8tjtMUbHmlBSagOSqbduEEDwc51qvQaBmA="
@@ -362,8 +362,8 @@ schema = 3
362362
version = "v0.0.5"
363363
hash = "sha256-/5i70IkH/qSW5KjGzv8aQNKh9tHoz98tqtL0K2DMFn4="
364364
[mod."github.com/onsi/ginkgo/v2"]
365-
version = "v2.5.0"
366-
hash = "sha256-mu8Ry88hLAVv9bcvENfP08dBP/yN1DYZrFf6ejxp8co="
365+
version = "v2.5.1"
366+
hash = "sha256-VB29+H9k7l6il63oXJvsjamSUhsw/e99iI/BeTCderA="
367367
[mod."github.com/onsi/gomega"]
368368
version = "v1.24.1"
369369
hash = "sha256-REfxQTDRcO23GnmJfOW8/MmPJf9oE2grVvvGiC1eSbo="
@@ -527,8 +527,8 @@ schema = 3
527527
version = "v0.0.0-20221116193143-41c2ba794472"
528528
hash = "sha256-uQuxuOvWRsdMii5M5QresisVd1E+Ss8s2WfR2n7QSXk="
529529
[mod."google.golang.org/grpc"]
530-
version = "v1.50.1"
531-
hash = "sha256-38nk4qIme+fE57SsCqNxtCZnc8fyzzi4Sb60uDTT2KE="
530+
version = "v1.51.0"
531+
hash = "sha256-RzH5DU13D/ulxxOouIKpdNt8eHdff7mrEnB+JUupbLU="
532532
[mod."google.golang.org/protobuf"]
533533
version = "v1.28.2-0.20220831092852-f930b1dc76e8"
534534
hash = "sha256-li5hXlXwTJ5LIZ8bVki1AZ6UFI2gXHl33JwdX1dOrtM="

rpc/backend/utils.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import (
1010

1111
sdk "github.com/cosmos/cosmos-sdk/types"
1212
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
13+
"google.golang.org/grpc/codes"
14+
"google.golang.org/grpc/status"
1315

1416
"github.com/ethereum/go-ethereum/common"
1517
"github.com/ethereum/go-ethereum/common/hexutil"
@@ -46,8 +48,15 @@ func (s sortGasAndReward) Less(i, j int) bool {
4648
// Todo: include the ability to specify a blockNumber
4749
func (b *Backend) getAccountNonce(accAddr common.Address, pending bool, height int64, logger log.Logger) (uint64, error) {
4850
queryClient := authtypes.NewQueryClient(b.clientCtx)
49-
res, err := queryClient.Account(types.ContextWithHeight(height), &authtypes.QueryAccountRequest{Address: sdk.AccAddress(accAddr.Bytes()).String()})
51+
adr := sdk.AccAddress(accAddr.Bytes()).String()
52+
ctx := types.ContextWithHeight(height)
53+
res, err := queryClient.Account(ctx, &authtypes.QueryAccountRequest{Address: adr})
5054
if err != nil {
55+
st, ok := status.FromError(err)
56+
// treat as account doesn't exist yet
57+
if ok && st.Code() == codes.NotFound {
58+
return 0, nil
59+
}
5160
return 0, err
5261
}
5362
var acc authtypes.AccountI
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import os
2+
3+
from eth_account import Account
4+
5+
from .utils import ADDRS, w3_wait_for_new_blocks
6+
7+
8+
def test_get_transaction_count(ethermint_rpc_ws, geth):
9+
for p in [ethermint_rpc_ws, geth]:
10+
w3 = p.w3
11+
blk = hex(w3.eth.block_number)
12+
sender = ADDRS["validator"]
13+
14+
# derive a new address
15+
account_path = "m/44'/60'/0'/0/1"
16+
mnemonic = os.getenv("COMMUNITY_MNEMONIC")
17+
receiver = (Account.from_mnemonic(mnemonic, account_path=account_path)).address
18+
n0 = w3.eth.get_transaction_count(receiver, blk)
19+
# ensure transaction send in new block
20+
w3_wait_for_new_blocks(w3, 1, sleep=0.1)
21+
txhash = w3.eth.send_transaction(
22+
{
23+
"from": sender,
24+
"to": receiver,
25+
"value": 1000,
26+
}
27+
)
28+
receipt = w3.eth.wait_for_transaction_receipt(txhash)
29+
assert receipt.status == 1
30+
[n1, n2] = [w3.eth.get_transaction_count(receiver, b) for b in [blk, "latest"]]
31+
assert n0 == n1
32+
assert n0 == n2

tests/integration_tests/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ def wait_for_port(port, host="127.0.0.1", timeout=40.0):
6363
) from ex
6464

6565

66-
def w3_wait_for_new_blocks(w3, n):
66+
def w3_wait_for_new_blocks(w3, n, sleep=0.5):
6767
begin_height = w3.eth.block_number
6868
while True:
69-
time.sleep(0.5)
69+
time.sleep(sleep)
7070
cur_height = w3.eth.block_number
7171
if cur_height - begin_height >= n:
7272
break

0 commit comments

Comments
 (0)