You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.
System info: [Include Ethermint commit, operating system name, and other relevant details]
in branch development
Steps to reproduce:
[First Step]
execute evm tx in blockHeight 100.
account message will be written to Store and CommitStateDB
[Second Step]
execute transafer tx in blockHeight 100
account message will be written to Store,but account message in CommitStateDB is not equal to account message in Store.
[and so on...]
execute crisis tx in blockHeight 100 to do invariants check, it may be failed, because evm invariants check will require the data in the Store to be consistent with the data in CommitStateDB
Additional info: [Include gist of relevant config, logs, etc.]
// BalanceInvariant checks that all auth module's EthAccounts in the application have the same balance// as the EVM one.func (kKeeper) BalanceInvariant() sdk.Invariant {
returnfunc(ctx sdk.Context) (string, bool) {
var (
msgstringcountint
)
k.accountKeeper.IterateAccounts(ctx, func(account authexported.Account) bool {
ethAccount, ok:=account.(*ethermint.EthAccount)
if!ok {
// ignore non EthAccountsreturnfalse
}
evmDenom:=k.GetParams(ctx).EvmDenomaccountBalance:=ethAccount.GetCoins().AmountOf(evmDenom)
evmBalance:=k.GetBalance(ctx, ethAccount.EthAddress())
ifevmBalance.Cmp(accountBalance.BigInt()) !=0 {
count++msg+=fmt.Sprintf(
"\tbalance mismatch for address %s: account balance %s, evm balance %s\n",
account.GetAddress(), accountBalance.String(), evmBalance.String(),
)
}
returnfalse
})
broken:=count!=0returnsdk.FormatInvariant(
types.ModuleName, balanceInvariant,
fmt.Sprintf("account balances mismatches found %d\n%s", count, msg),
), broken
}
}
// NonceInvariant checks that all auth module's EthAccounts in the application have the same nonce// sequence as the EVM.func (kKeeper) NonceInvariant() sdk.Invariant {
returnfunc(ctx sdk.Context) (string, bool) {
var (
msgstringcountint
)
k.accountKeeper.IterateAccounts(ctx, func(account authexported.Account) bool {
ethAccount, ok:=account.(*ethermint.EthAccount)
if!ok {
// ignore non EthAccountsreturnfalse
}
evmNonce:=k.GetNonce(ctx, ethAccount.EthAddress())
ifevmNonce!=ethAccount.Sequence {
count++msg+=fmt.Sprintf(
"\nonce mismatch for address %s: account nonce %d, evm nonce %d\n",
account.GetAddress(), ethAccount.Sequence, evmNonce,
)
}
returnfalse
})
broken:=count!=0returnsdk.FormatInvariant(
types.ModuleName, nonceInvariant,
fmt.Sprintf("account nonces mismatches found %d\n%s", count, msg),
), broken
}
}
The text was updated successfully, but these errors were encountered:
System info: [Include Ethermint commit, operating system name, and other relevant details]
Steps to reproduce:
Additional info: [Include gist of relevant config, logs, etc.]
The text was updated successfully, but these errors were encountered: