Skip to content

Commit

Permalink
feat: set unrevertible tx hashes when sendBid
Browse files Browse the repository at this point in the history
  • Loading branch information
irrun committed Jun 11, 2024
1 parent 5a7b493 commit 8fe3f00
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
11 changes: 6 additions & 5 deletions miner/bidder.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,12 @@ func (b *Bidder) bid(work *environment) {
}

bid := types.RawBid{
BlockNumber: parent.Number.Uint64() + 1,
ParentHash: parent.Hash(),
GasUsed: work.header.GasUsed,
GasFee: work.state.GetBalance(consensus.SystemAddress).ToBig(),
Txs: txs,
BlockNumber: parent.Number.Uint64() + 1,
ParentHash: parent.Hash(),
GasUsed: work.header.GasUsed,
GasFee: work.state.GetBalance(consensus.SystemAddress).ToBig(),
Txs: txs,
UnRevertible: work.UnRevertible,
// TODO: decide builderFee according to realtime traffic and validator commission
}

Expand Down
3 changes: 2 additions & 1 deletion miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ type environment struct {
sidecars types.BlobSidecars
blobs int

profit *big.Int // block gas fee + BNBSentToSystem
profit *big.Int // block gas fee + BNBSentToSystem
UnRevertible []common.Hash
}

// copy creates a deep copy of environment.
Expand Down
6 changes: 6 additions & 0 deletions miner/worker_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,12 @@ func (w *worker) mergeBundles(

mergedBundle.BundleGasFees.Add(mergedBundle.BundleGasFees, simulatedBundle.BundleGasFees)
mergedBundle.BundleGasUsed += simulatedBundle.BundleGasUsed

for _, tx := range includedTxs {
if !containsHash(bundle.OriginalBundle.RevertingTxHashes, tx.Hash()) {
env.UnRevertible = append(env.UnRevertible, tx.Hash())
}
}
}

if len(includedTxs) == 0 {
Expand Down

0 comments on commit 8fe3f00

Please sign in to comment.