Skip to content

Commit

Permalink
feat: Update builder payload value with boost factor
Browse files Browse the repository at this point in the history
  • Loading branch information
mattevans committed Nov 6, 2024
1 parent 92504b1 commit 3f735fe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
8 changes: 4 additions & 4 deletions pkg/proto/eth/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ func NewEventBlockV2FromVersionSignedBeaconBlock(block *spec.VersionedSignedBeac
case spec.DataVersionPhase0:
data = NewEventBlockFromPhase0(block.Phase0.Message, &block.Phase0.Signature)
case spec.DataVersionAltair:
data = NewEventBlockFromAltair(block.Altair.Message, &block.Phase0.Signature)
data = NewEventBlockFromAltair(block.Altair.Message, &block.Altair.Signature)
case spec.DataVersionBellatrix:
data = NewEventBlockFromBellatrix(block.Bellatrix.Message, &block.Phase0.Signature)
data = NewEventBlockFromBellatrix(block.Bellatrix.Message, &block.Bellatrix.Signature)
case spec.DataVersionCapella:
data = NewEventBlockFromCapella(block.Capella.Message, &block.Phase0.Signature)
data = NewEventBlockFromCapella(block.Capella.Message, &block.Capella.Signature)
case spec.DataVersionDeneb:
data = NewEventBlockFromDeneb(block.Deneb.Message, &block.Phase0.Signature)
data = NewEventBlockFromDeneb(block.Deneb.Message, &block.Deneb.Signature)
default:
return nil, fmt.Errorf("unsupported block version: %v", block.Version)
}
Expand Down
8 changes: 7 additions & 1 deletion pkg/sentry/proposed_validator_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,14 @@ func (s *Sentry) fetchValidatorBlock(ctx context.Context) (*v2.ValidatorBlock, e
return nil, fmt.Errorf("unexpected service client type, expected: eth2client.ProposalProvider, got %T", s.beacon.Node().Service())
}

// Percentage multiplier to apply to the builder's payload value when choosing between a builder payload header
// and payload from the paired execution node.
// See https://ethereum.github.io/beacon-APIs/#/Validator/produceBlockV3
boostFactor := uint64(0)

// RandaoReveal must be set to the point at infinity (0xc0..00) if we're skipping Randao verification.
rsp, err := provider.Proposal(ctx, &api.ProposalOpts{
Slot: phase0.Slot(slot.Number()),
Slot: phase0.Slot(slot.Number() + 1),
RandaoReveal: phase0.BLSSignature{
0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Expand All @@ -87,6 +92,7 @@ func (s *Sentry) fetchValidatorBlock(ctx context.Context) (*v2.ValidatorBlock, e
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
SkipRandaoVerification: true,
BuilderBoostFactor: &boostFactor,
})
if err != nil {
s.log.WithError(err).Error("Failed to get proposal")
Expand Down

0 comments on commit 3f735fe

Please sign in to comment.