fix handler csdb usage, fixes consensus error again (#516)

This commit is contained in:
noot 2020-09-16 20:29:22 -04:00 committed by GitHub
parent 244d836669
commit 73d6c41b72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 17 deletions

View File

@ -758,7 +758,7 @@ func TestEth_EstimateGas(t *testing.T) {
err := json.Unmarshal(rpcRes.Result, &gas) err := json.Unmarshal(rpcRes.Result, &gas)
require.NoError(t, err, string(rpcRes.Result)) require.NoError(t, err, string(rpcRes.Result))
require.Equal(t, "0xf76c", gas) require.Equal(t, "0xef7e", gas)
} }
func TestEth_EstimateGas_ContractDeployment(t *testing.T) { func TestEth_EstimateGas_ContractDeployment(t *testing.T) {
@ -777,7 +777,7 @@ func TestEth_EstimateGas_ContractDeployment(t *testing.T) {
err := json.Unmarshal(rpcRes.Result, &gas) err := json.Unmarshal(rpcRes.Result, &gas)
require.NoError(t, err, string(rpcRes.Result)) require.NoError(t, err, string(rpcRes.Result))
require.Equal(t, "0x1cab2", gas.String()) require.Equal(t, "0x1c2c4", gas.String())
} }
func TestEth_ExportAccount(t *testing.T) { func TestEth_ExportAccount(t *testing.T) {

View File

@ -62,8 +62,10 @@ func handleMsgEthereumTx(ctx sdk.Context, k Keeper, msg types.MsgEthereumTx) (*s
// Prepare db for logs // Prepare db for logs
// TODO: block hash // TODO: block hash
if !st.Simulate {
k.CommitStateDB.Prepare(ethHash, common.Hash{}, k.TxCount) k.CommitStateDB.Prepare(ethHash, common.Hash{}, k.TxCount)
k.TxCount++ k.TxCount++
}
config, found := k.GetChainConfig(ctx) config, found := k.GetChainConfig(ctx)
if !found { if !found {
@ -75,6 +77,7 @@ func handleMsgEthereumTx(ctx sdk.Context, k Keeper, msg types.MsgEthereumTx) (*s
return nil, err return nil, err
} }
if !st.Simulate {
// update block bloom filter // update block bloom filter
k.Bloom.Or(k.Bloom, executionResult.Bloom) k.Bloom.Or(k.Bloom, executionResult.Bloom)
@ -83,6 +86,7 @@ func handleMsgEthereumTx(ctx sdk.Context, k Keeper, msg types.MsgEthereumTx) (*s
if err != nil { if err != nil {
panic(err) panic(err)
} }
}
// log successful execution // log successful execution
k.Logger(ctx).Info(executionResult.Result.Log) k.Logger(ctx).Info(executionResult.Result.Log)
@ -143,8 +147,10 @@ func handleMsgEthermint(ctx sdk.Context, k Keeper, msg types.MsgEthermint) (*sdk
} }
// Prepare db for logs // Prepare db for logs
if !st.Simulate {
k.CommitStateDB.Prepare(ethHash, common.Hash{}, k.TxCount) k.CommitStateDB.Prepare(ethHash, common.Hash{}, k.TxCount)
k.TxCount++ k.TxCount++
}
config, found := k.GetChainConfig(ctx) config, found := k.GetChainConfig(ctx)
if !found { if !found {
@ -157,6 +163,7 @@ func handleMsgEthermint(ctx sdk.Context, k Keeper, msg types.MsgEthermint) (*sdk
} }
// update block bloom filter // update block bloom filter
if !st.Simulate {
k.Bloom.Or(k.Bloom, executionResult.Bloom) k.Bloom.Or(k.Bloom, executionResult.Bloom)
// update transaction logs in KVStore // update transaction logs in KVStore
@ -164,6 +171,7 @@ func handleMsgEthermint(ctx sdk.Context, k Keeper, msg types.MsgEthermint) (*sdk
if err != nil { if err != nil {
panic(err) panic(err)
} }
}
// log successful execution // log successful execution
k.Logger(ctx).Info(executionResult.Result.Log) k.Logger(ctx).Info(executionResult.Result.Log)