Skip to content

Commit

Permalink
Added error logging for lost/invalid coinbases
Browse files Browse the repository at this point in the history
  • Loading branch information
jdowning100 committed Feb 3, 2025
1 parent 11ee300 commit 1e3ee2d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/state_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,7 @@ func (p *StateProcessor) Process(block *types.WorkObject, batch ethdb.Batch) (ty
}
if tx.To().IsInQiLedgerScope() { // Qi coinbase
if block.PrimeTerminusNumber().Uint64() < params.ControllerKickInBlock { // parent must be controller kick in block
p.logger.Errorf("Qi coinbase tx %x is not allowed before controller kick in block %d", tx.Hash(), params.ControllerKickInBlock)
receipt = &types.Receipt{Type: tx.Type(), Status: types.ReceiptStatusFailed, GasUsed: gasUsedForCoinbase, TxHash: tx.Hash()}
receipts = append(receipts, receipt)
allLogs = append(allLogs, receipt.Logs...)
Expand Down Expand Up @@ -598,6 +599,7 @@ func (p *StateProcessor) Process(block *types.WorkObject, batch ethdb.Batch) (ty
// No code at contract address
// Coinbase reward is lost
// Justification: We should not store a coinbase lockup that can never be claimed
p.logger.Errorf("Coinbase tx %x has no code at contract address %x", tx.Hash(), contractAddr)
receipt = &types.Receipt{Type: tx.Type(), Status: types.ReceiptStatusFailed, GasUsed: gasUsedForCoinbase, TxHash: tx.Hash()}
} else {
var delegate common.Address
Expand All @@ -623,6 +625,7 @@ func (p *StateProcessor) Process(block *types.WorkObject, batch ethdb.Batch) (ty
} else {
// Coinbase data is either too long or too small
// Coinbase reward is lost
p.logger.Errorf("Coinbase tx %x has invalid data length %d", tx.Hash(), len(tx.Data()))
receipt = &types.Receipt{Type: tx.Type(), Status: types.ReceiptStatusFailed, GasUsed: gasUsedForCoinbase, TxHash: tx.Hash()}
}
receipts = append(receipts, receipt)
Expand Down Expand Up @@ -652,6 +655,7 @@ func (p *StateProcessor) Process(block *types.WorkObject, batch ethdb.Batch) (ty
// No code at contract address
// Coinbase reward is lost
// Justification: We should not store a coinbase lockup that can never be claimed
p.logger.Errorf("Coinbase tx %x has no code at contract address %x", tx.Hash(), contractAddr)
receipt = &types.Receipt{Type: tx.Type(), Status: types.ReceiptStatusFailed, GasUsed: gasUsedForCoinbase, TxHash: tx.Hash()}
} else {
var delegate common.Address
Expand Down Expand Up @@ -684,6 +688,7 @@ func (p *StateProcessor) Process(block *types.WorkObject, batch ethdb.Batch) (ty
} else {
// Coinbase data is either too long or too small
// Coinbase reward is lost
p.logger.Errorf("Coinbase tx %x has invalid data length %d", tx.Hash(), len(tx.Data()))
receipt = &types.Receipt{Type: tx.Type(), Status: types.ReceiptStatusFailed, GasUsed: gasUsedForCoinbase, TxHash: tx.Hash()}
}
receipts = append(receipts, receipt)
Expand Down

0 comments on commit 1e3ee2d

Please sign in to comment.