Enforce per-builder bid limits from the block request - #17374
Conversation
71936ec to
db8cd9e
Compare
589bfe2 to
25af1f9
Compare
| var bestBid *ethpb.SignedExecutionPayloadBid | ||
| bestValue := primitives.WeiToGwei(local.Bid) | ||
| var bestEffective primitives.Gwei | ||
| bestBoosted := primitives.WeiToGwei(local.Bid) |
There was a problem hiding this comment.
I don't think this is spec compliant for small bids under 100 gwei.
t.Run("max boost prefers a sub-100-gwei bid over local", func(t *testing.T) {
// builder_boost_factor=2**64-1 MUST mean "prefer this builder unless
// unviable" for any nonzero bid, including one below 100 Gwei.
win := &winningBuilderBid{
bid: newBid(99, 0, builderIdx),
entry: ðpb.BuilderEntry{MaxExecutionPayment: 0, BuilderBoostFactor: math.MaxUint64},
}
got, src, _ := bestBid(nil, localWithGwei(1), nil, win, nil)
require.NotNil(t, got)
require.Equal(t, bidSourceBuilderAPI, src)
})
t.Run("boost applies the full value below 100 gwei granularity", func(t *testing.T) {
// 199 boosted by 50% is 199*50/100 = 99, which beats local 75.
win := &winningBuilderBid{
bid: newBid(199, 0, builderIdx),
entry: ðpb.BuilderEntry{MaxExecutionPayment: 0, BuilderBoostFactor: 50},
}
got, src, _ := bestBid(nil, localWithGwei(75), nil, win, nil)
require.NotNil(t, got)
require.Equal(t, bidSourceBuilderAPI, src)
})
these tests fail ( let me know if you think this is wrong)
019d039 to
d742dfe
Compare
| } | ||
| bool is_blinded = 100; | ||
| string payload_value = 101; | ||
| string builder_url = 102; |
There was a problem hiding this comment.
that's unfortunate we needed to add this here, will be annoying to change down the road but ok with it for now i suppose
| func (vs *Server) setExecutionPayloadBid( | ||
| ctx context.Context, | ||
| sBlk interfaces.SignedBeaconBlock, | ||
| head state.BeaconState, |
There was a problem hiding this comment.
do we need to pass the head state around like this or just extract what we need? i see head state introduced in several areas here. more of a nit than anything
There was a problem hiding this comment.
I think head state is better than passing a pubkey lookup closure
| @@ -51,9 +55,10 @@ func (s bidSource) String() string { | |||
| func (vs *Server) setExecutionPayloadBid( | |||
There was a problem hiding this comment.
This has a ton of parameters, wondering if it's better to have some wrapper object now or not
There was a problem hiding this comment.
I think is fine, it's an internal function with exactly one caller
| } | ||
| } | ||
|
|
||
| genericSignedBlock.BuilderUrl = b.BuilderUrl |
There was a problem hiding this comment.
because of this there's a potential to nil pointer I believe...
we need to do something like
default:
log.Errorf("Unsupported block version %s", version.String(blk.Version()))
if v.emitAccountMetrics {
ValidatorProposeFailVec.WithLabelValues(fmtKey).Inc()
}
return
}
otherwise log will fall through and cause a nil pointer here, you could also set it since it's trying to set it for be fore gloas?
you could also have a nil check gate
james-prysm
left a comment
There was a problem hiding this comment.
LGTM, will have a follow up pr for submit builder preferences timing
b4100ee to
6235511
Compare
maxExecutionPaymentsmap, the preferences push now sends each builder its own capLast of the stack replacing #17124, on top of #17373.