@@ -97,7 +97,7 @@ func (b *Builder) Stop() error {
9797 return nil
9898}
9999
100- func (b * Builder ) onSealedBlock (block * types.Block , bundles []types.SimulatedBundle , proposerPubkey boostTypes.PublicKey , proposerFeeRecipient boostTypes.Address , attrs * BuilderPayloadAttributes ) error {
100+ func (b * Builder ) onSealedBlock (block * types.Block , ordersClosedAt time. Time , sealedAt time. Time , commitedBundles []types. SimulatedBundle , allBundles []types.SimulatedBundle , proposerPubkey boostTypes.PublicKey , proposerFeeRecipient boostTypes.Address , attrs * BuilderPayloadAttributes ) error {
101101 executableData := beacon .BlockToExecutableData (block )
102102 payload , err := executableDataToExecutionPayload (executableData )
103103 if err != nil {
@@ -142,15 +142,15 @@ func (b *Builder) onSealedBlock(block *types.Block, bundles []types.SimulatedBun
142142 log .Error ("could not validate block" , "err" , err )
143143 }
144144 } else {
145- go b .ds .ConsumeBuiltBlock (block , bundles , & blockBidMsg )
145+ go b .ds .ConsumeBuiltBlock (block , ordersClosedAt , sealedAt , commitedBundles , allBundles , & blockBidMsg )
146146 err = b .relay .SubmitBlock (& blockSubmitReq )
147147 if err != nil {
148- log .Error ("could not submit block" , "err" , err , "bundles " , len (bundles ))
148+ log .Error ("could not submit block" , "err" , err , "#commitedBundles " , len (commitedBundles ))
149149 return err
150150 }
151151 }
152152
153- log .Info ("submitted block" , "slot" , blockBidMsg .Slot , "value" , blockBidMsg .Value .String (), "parent" , blockBidMsg .ParentHash , "hash" , block .Hash (), "bundles " , len (bundles ))
153+ log .Info ("submitted block" , "slot" , blockBidMsg .Slot , "value" , blockBidMsg .Value .String (), "parent" , blockBidMsg .ParentHash , "hash" , block .Hash (), "#commitedBundles " , len (commitedBundles ))
154154
155155 return nil
156156}
@@ -212,6 +212,14 @@ func (b *Builder) OnPayloadAttribute(attrs *BuilderPayloadAttributes) error {
212212 return nil
213213}
214214
215+ type blockQueueEntry struct {
216+ block * types.Block
217+ ordersCloseTime time.Time
218+ sealedAt time.Time
219+ commitedBundles []types.SimulatedBundle
220+ allBundles []types.SimulatedBundle
221+ }
222+
215223func (b * Builder ) runBuildingJob (slotCtx context.Context , proposerPubkey boostTypes.PublicKey , feeRecipient boostTypes.Address , attrs * BuilderPayloadAttributes ) {
216224 ctx , cancel := context .WithTimeout (slotCtx , 12 * time .Second )
217225 defer cancel ()
@@ -229,16 +237,16 @@ func (b *Builder) runBuildingJob(slotCtx context.Context, proposerPubkey boostTy
229237 queueMu sync.Mutex
230238 queueLastSubmittedProfit = new (big.Int )
231239 queueBestProfit = new (big.Int )
232- queueBestBlock * types.Block
233- queueBestBundles []types.SimulatedBundle
240+ queueBestEntry blockQueueEntry
234241 )
235242
236243 log .Debug ("runBuildingJob" , "slot" , attrs .Slot , "parent" , attrs .HeadHash )
237244
238245 submitBestBlock := func () {
239246 queueMu .Lock ()
240247 if queueLastSubmittedProfit .Cmp (queueBestProfit ) < 0 {
241- err := b .onSealedBlock (queueBestBlock , queueBestBundles , proposerPubkey , feeRecipient , attrs )
248+ err := b .onSealedBlock (queueBestEntry .block , queueBestEntry .ordersCloseTime , queueBestEntry .sealedAt , queueBestEntry .commitedBundles , queueBestEntry .allBundles , proposerPubkey , feeRecipient , attrs )
249+
242250 if err != nil {
243251 log .Error ("could not run sealed block hook" , "err" , err )
244252 } else {
@@ -252,16 +260,23 @@ func (b *Builder) runBuildingJob(slotCtx context.Context, proposerPubkey boostTy
252260 go runResubmitLoop (ctx , b .limiter , queueSignal , submitBestBlock )
253261
254262 // Populates queue with submissions that increase block profit
255- blockHook := func (block * types.Block , bundles []types.SimulatedBundle ) {
263+ blockHook := func (block * types.Block , ordersCloseTime time. Time , commitedBundles []types. SimulatedBundle , allBundles []types.SimulatedBundle ) {
256264 if ctx .Err () != nil {
257265 return
258266 }
259267
268+ sealedAt := time .Now ()
269+
260270 queueMu .Lock ()
261271 defer queueMu .Unlock ()
262272 if block .Profit .Cmp (queueBestProfit ) > 0 {
263- queueBestBlock = block
264- queueBestBundles = bundles
273+ queueBestEntry = blockQueueEntry {
274+ block : block ,
275+ ordersCloseTime : ordersCloseTime ,
276+ sealedAt : sealedAt ,
277+ commitedBundles : commitedBundles ,
278+ allBundles : allBundles ,
279+ }
265280 queueBestProfit .Set (block .Profit )
266281
267282 select {
0 commit comments