From ba2325d30fb8c508204178d905835fa686e324a1 Mon Sep 17 00:00:00 2001 From: Shivam Sharma Date: Wed, 25 Oct 2023 14:14:17 +0530 Subject: [PATCH] add : check for commit span in apply bor message --- consensus/bor/statefull/processor.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/consensus/bor/statefull/processor.go b/consensus/bor/statefull/processor.go index 039f3daae0..7f6d535989 100644 --- a/consensus/bor/statefull/processor.go +++ b/consensus/bor/statefull/processor.go @@ -1,6 +1,7 @@ package statefull import ( + "bytes" "context" "math" "math/big" @@ -90,7 +91,11 @@ func ApplyMessage( success := big.NewInt(5).SetBytes(ret) - if success.Cmp(big.NewInt(0)) == 0 { + validatorContract := common.HexToAddress(chainConfig.Bor.ValidatorContract) + + // if success == 0 and msg.To() != validatorContractAddress, log Error + // if msg.To() == validatorContractAddress, its committing a span and we don't get any return value + if success.Cmp(big.NewInt(0)) == 0 && !bytes.Equal(msg.To().Bytes(), validatorContract.Bytes()) { log.Error("message execution failed on contract", "msgData", msg.Data) }