upgrade to ethermint v0.21.0 #99

Closed
0xmuralik wants to merge 384 commits from murali/update-fork into main
5 changed files with 52 additions and 9 deletions
Showing only changes of commit f4c7be2efc - Show all commits

View File

@ -92,6 +92,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (proto) [#1466](https://github.com/evmos/ethermint/pull/1466) Fix proto scripts and upgrade them to mirror current cosmos-sdk scripts
* (rpc) [#1405](https://github.com/evmos/ethermint/pull/1405) Fix uninitialized chain ID field in gRPC requests.
* (analytics) [#1434](https://github.com/evmos/ethermint/pull/1434) Remove unbound labels from custom tendermint metrics.
* (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.
## [v0.19.3] - 2022-10-14

View File

@ -97,8 +97,8 @@ schema = 3
version = "v1.0.0-alpha8"
hash = "sha256-iXzXoS5Kfh5DBy+PhdFWraDWXda/3M4j7j4VECjv4CA="
[mod."github.com/cosmos/cosmos-sdk"]
version = "v0.46.5-0.20221114064055-2114ec42dfa1"
hash = "sha256-swqznmZfl2dlj/8ReJJs0zagFN2xpzF2ehsfVvPbohc="
version = "v0.46.6"
hash = "sha256-H1VZxZUWXhpXiY3A9smLp09MEGpXmh+XvX6YUiXPcpQ="
[mod."github.com/cosmos/go-bip39"]
version = "v1.0.0"
hash = "sha256-Qm2aC2vaS8tjtMUbHmlBSagOSqbduEEDwc51qvQaBmA="
@ -362,8 +362,8 @@ schema = 3
version = "v0.0.5"
hash = "sha256-/5i70IkH/qSW5KjGzv8aQNKh9tHoz98tqtL0K2DMFn4="
[mod."github.com/onsi/ginkgo/v2"]
version = "v2.5.0"
hash = "sha256-mu8Ry88hLAVv9bcvENfP08dBP/yN1DYZrFf6ejxp8co="
version = "v2.5.1"
hash = "sha256-VB29+H9k7l6il63oXJvsjamSUhsw/e99iI/BeTCderA="
[mod."github.com/onsi/gomega"]
version = "v1.24.1"
hash = "sha256-REfxQTDRcO23GnmJfOW8/MmPJf9oE2grVvvGiC1eSbo="
@ -527,8 +527,8 @@ schema = 3
version = "v0.0.0-20221116193143-41c2ba794472"
hash = "sha256-uQuxuOvWRsdMii5M5QresisVd1E+Ss8s2WfR2n7QSXk="
[mod."google.golang.org/grpc"]
version = "v1.50.1"
hash = "sha256-38nk4qIme+fE57SsCqNxtCZnc8fyzzi4Sb60uDTT2KE="
version = "v1.51.0"
hash = "sha256-RzH5DU13D/ulxxOouIKpdNt8eHdff7mrEnB+JUupbLU="
[mod."google.golang.org/protobuf"]
version = "v1.28.2-0.20220831092852-f930b1dc76e8"
hash = "sha256-li5hXlXwTJ5LIZ8bVki1AZ6UFI2gXHl33JwdX1dOrtM="

View File

@ -10,6 +10,8 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
@ -46,8 +48,15 @@ func (s sortGasAndReward) Less(i, j int) bool {
// Todo: include the ability to specify a blockNumber
func (b *Backend) getAccountNonce(accAddr common.Address, pending bool, height int64, logger log.Logger) (uint64, error) {
queryClient := authtypes.NewQueryClient(b.clientCtx)
res, err := queryClient.Account(types.ContextWithHeight(height), &authtypes.QueryAccountRequest{Address: sdk.AccAddress(accAddr.Bytes()).String()})
adr := sdk.AccAddress(accAddr.Bytes()).String()
ctx := types.ContextWithHeight(height)
res, err := queryClient.Account(ctx, &authtypes.QueryAccountRequest{Address: adr})
if err != nil {
st, ok := status.FromError(err)
// treat as account doesn't exist yet
if ok && st.Code() == codes.NotFound {
return 0, nil
}
return 0, err
}
var acc authtypes.AccountI

View File

@ -0,0 +1,32 @@
import os
from eth_account import Account
from .utils import ADDRS, w3_wait_for_new_blocks
def test_get_transaction_count(ethermint_rpc_ws, geth):
for p in [ethermint_rpc_ws, geth]:
w3 = p.w3
blk = hex(w3.eth.block_number)
sender = ADDRS["validator"]
# derive a new address
account_path = "m/44'/60'/0'/0/1"
mnemonic = os.getenv("COMMUNITY_MNEMONIC")
receiver = (Account.from_mnemonic(mnemonic, account_path=account_path)).address
n0 = w3.eth.get_transaction_count(receiver, blk)
# ensure transaction send in new block
w3_wait_for_new_blocks(w3, 1, sleep=0.1)
txhash = w3.eth.send_transaction(
{
"from": sender,
"to": receiver,
"value": 1000,
}
)
receipt = w3.eth.wait_for_transaction_receipt(txhash)
assert receipt.status == 1
[n1, n2] = [w3.eth.get_transaction_count(receiver, b) for b in [blk, "latest"]]
assert n0 == n1
assert n0 == n2

View File

@ -63,10 +63,10 @@ def wait_for_port(port, host="127.0.0.1", timeout=40.0):
) from ex
def w3_wait_for_new_blocks(w3, n):
def w3_wait_for_new_blocks(w3, n, sleep=0.5):
begin_height = w3.eth.block_number
while True:
time.sleep(0.5)
time.sleep(sleep)
cur_height = w3.eth.block_number
if cur_height - begin_height >= n:
break