diff --git a/consensus/bor/contract/client.go b/consensus/bor/contract/client.go index fa8ad215f2..246939f1ac 100644 --- a/consensus/bor/contract/client.go +++ b/consensus/bor/contract/client.go @@ -88,10 +88,13 @@ func (gc *GenesisContractsClient) CommitState( } msg := statefull.GetSystemMessage(common.HexToAddress(gc.StateReceiverContract), data) + + log.Info("→ committing new state", "eventRecord", event.ID) + gasUsed, err := statefull.ApplyMessage(context.Background(), msg, state, header, gc.chainConfig, chCtx) // Logging event log with time and individual gasUsed - log.Info("→ committing new state", "eventRecord", event.String(gasUsed)) + log.Info("→ committed new state", "eventRecord", event.String(gasUsed)) if err != nil { return 0, err diff --git a/consensus/bor/statefull/processor.go b/consensus/bor/statefull/processor.go index a78359a309..039f3daae0 100644 --- a/consensus/bor/statefull/processor.go +++ b/consensus/bor/statefull/processor.go @@ -12,6 +12,7 @@ import ( "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/vm" + "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" ) @@ -76,8 +77,9 @@ func ApplyMessage( // about the transaction and calling mechanisms. vmenv := vm.NewEVM(blockContext, vm.TxContext{}, state, chainConfig, vm.Config{}) + // nolint : contextcheck // Apply the transaction to the current state (included in the env) - _, gasLeft, err := vmenv.Call( + ret, gasLeft, err := vmenv.Call( vm.AccountRef(msg.From()), *msg.To(), msg.Data(), @@ -85,6 +87,13 @@ func ApplyMessage( msg.Value(), nil, ) + + success := big.NewInt(5).SetBytes(ret) + + if success.Cmp(big.NewInt(0)) == 0 { + log.Error("message execution failed on contract", "msgData", msg.Data) + } + // Update the state with pending changes if err != nil { state.Finalise(true)