Skip to content

Commit d07347f

Browse files
authored
Fix not triggered event (#231)
1 parent 92edeeb commit d07347f

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

oracle/block.go

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/attestantio/go-eth2-client/spec/phase0"
1313
"github.com/dappnode/mev-sp-oracle/contract"
1414
"github.com/dappnode/mev-sp-oracle/utils"
15+
"github.com/ethereum/go-ethereum/common"
1516
"github.com/ethereum/go-ethereum/core/types"
1617
"github.com/pkg/errors"
1718
log "github.com/sirupsen/logrus"
@@ -279,6 +280,28 @@ func (b *FullBlock) SetEvents(events *Events) {
279280
}
280281

281282
b.Events = events
283+
284+
// Special case. Temporal fix. We artificially add the mev reward for this block.
285+
// See: https://github.com/dappnode/mev-sp-oracle/pull/230
286+
// See: https://beaconcha.in/slot/10400574
287+
if b.ChainId == MainnetChainId && b.GetSlotUint64() == ExceptionSlotMainnet1 {
288+
log.Warn("Special case: MEV reward hardcoded. See MevRewardInWei for more info")
289+
b.Events.EtherReceived = append(b.Events.EtherReceived, &contract.ContractEtherReceived{
290+
Sender: common.Address{},
291+
DonationAmount: big.NewInt(177043568463114308),
292+
Raw: types.Log{
293+
Address: common.Address{},
294+
Topics: []common.Hash{},
295+
Data: []byte{},
296+
BlockNumber: 0,
297+
TxHash: common.Hash{},
298+
TxIndex: 0,
299+
BlockHash: common.Hash{},
300+
Index: 0,
301+
Removed: false,
302+
},
303+
})
304+
}
282305
}
283306

284307
// Returns if there was an mev reward and its amount and fee recipient if any
@@ -556,13 +579,6 @@ func (b *FullBlock) GetDonations(poolAddress string) []*contract.ContractEtherRe
556579
filteredEvents = append(filteredEvents, etherRxEvent)
557580
}
558581

559-
// Special case. To be fixed. See MevRewardInWei for more info.
560-
// In this case the EtherReceived event was not triggered due to a self destruct
561-
// So we hardcode it. Temporal fix.
562-
if b.ChainId == MainnetChainId && b.GetSlotUint64() == ExceptionSlotMainnet1 {
563-
foundMev = true
564-
}
565-
566582
// Sanity check
567583
if !foundMev {
568584
log.Fatal("An mev reward was expected but could not find it. "+

0 commit comments

Comments
 (0)