@@ -10,14 +10,14 @@ import (
10
10
"testing"
11
11
"time"
12
12
13
- "github.com/attestantio/go-builder-client/api"
14
- apibellatrix "github.com/attestantio/go-builder-client/api/bellatrix"
15
- apicapella "github.com/attestantio/go-builder-client/api/capella"
16
- apiv1 "github.com/attestantio/go-builder-client/api/v1"
17
- "github.com/attestantio/go-builder-client/spec"
18
- consensusspec "github.com/attestantio/go-eth2-client/spec"
19
- "github.com/attestantio/go-eth2-client/spec/bellatrix"
13
+ builderApi "github.com/attestantio/go-builder-client/api"
14
+ builderApiCapella "github.com/attestantio/go-builder-client/api/capella"
15
+ builderApiDeneb "github.com/attestantio/go-builder-client/api/deneb"
16
+ builderApiV1 "github.com/attestantio/go-builder-client/api/v1"
17
+ builderSpec "github.com/attestantio/go-builder-client/spec"
18
+ "github.com/attestantio/go-eth2-client/spec"
20
19
"github.com/attestantio/go-eth2-client/spec/capella"
20
+ "github.com/attestantio/go-eth2-client/spec/deneb"
21
21
"github.com/attestantio/go-eth2-client/spec/phase0"
22
22
"github.com/ethereum/go-ethereum/common/hexutil"
23
23
"github.com/flashbots/go-boost-utils/bls"
@@ -59,8 +59,8 @@ type mockRelay struct {
59
59
handlerOverrideGetPayload func (w http.ResponseWriter , req * http.Request )
60
60
61
61
// Default responses placeholders, used if overrider does not exist
62
- GetHeaderResponse * spec .VersionedSignedBuilderBid
63
- GetPayloadResponse * api. VersionedExecutionPayload
62
+ GetHeaderResponse * builderSpec .VersionedSignedBuilderBid
63
+ GetPayloadResponse * builderApi. VersionedSubmitBlindedBlockResponse
64
64
65
65
// Server section
66
66
Server * httptest.Server
@@ -141,7 +141,7 @@ func (m *mockRelay) handleStatus(w http.ResponseWriter, _ *http.Request) {
141
141
fmt .Fprintf (w , `{}` )
142
142
}
143
143
144
- // By default, handleRegisterValidator returns a default apiv1 .SignedValidatorRegistration
144
+ // By default, handleRegisterValidator returns a default builderApiV1 .SignedValidatorRegistration
145
145
func (m * mockRelay ) handleRegisterValidator (w http.ResponseWriter , req * http.Request ) {
146
146
m .mu .Lock ()
147
147
defer m .mu .Unlock ()
@@ -154,7 +154,7 @@ func (m *mockRelay) handleRegisterValidator(w http.ResponseWriter, req *http.Req
154
154
155
155
// defaultHandleRegisterValidator returns the default handler for handleRegisterValidator
156
156
func (m * mockRelay ) defaultHandleRegisterValidator (w http.ResponseWriter , req * http.Request ) {
157
- payload := []apiv1 .SignedValidatorRegistration {}
157
+ payload := []builderApiV1 .SignedValidatorRegistration {}
158
158
if err := DecodeJSON (req .Body , & payload ); err != nil {
159
159
http .Error (w , err .Error (), http .StatusBadRequest )
160
160
return
@@ -166,14 +166,15 @@ func (m *mockRelay) defaultHandleRegisterValidator(w http.ResponseWriter, req *h
166
166
167
167
// MakeGetHeaderResponse is used to create the default or can be used to create a custom response to the getHeader
168
168
// method
169
- func (m * mockRelay ) MakeGetHeaderResponse (value uint64 , blockHash , parentHash , publicKey string , version consensusspec .DataVersion ) * spec .VersionedSignedBuilderBid {
169
+ func (m * mockRelay ) MakeGetHeaderResponse (value uint64 , blockHash , parentHash , publicKey string , version spec .DataVersion ) * builderSpec .VersionedSignedBuilderBid {
170
170
switch version {
171
- case consensusspec . DataVersionBellatrix :
171
+ case spec . DataVersionCapella :
172
172
// Fill the payload with custom values.
173
- message := & apibellatrix.BuilderBid {
174
- Header : & bellatrix.ExecutionPayloadHeader {
175
- BlockHash : _HexToHash (blockHash ),
176
- ParentHash : _HexToHash (parentHash ),
173
+ message := & builderApiCapella.BuilderBid {
174
+ Header : & capella.ExecutionPayloadHeader {
175
+ BlockHash : _HexToHash (blockHash ),
176
+ ParentHash : _HexToHash (parentHash ),
177
+ WithdrawalsRoot : phase0.Root {},
177
178
},
178
179
Value : uint256 .NewInt (value ),
179
180
Pubkey : _HexToPubkey (publicKey ),
@@ -183,37 +184,38 @@ func (m *mockRelay) MakeGetHeaderResponse(value uint64, blockHash, parentHash, p
183
184
signature , err := ssz .SignMessage (message , ssz .DomainBuilder , m .secretKey )
184
185
require .NoError (m .t , err )
185
186
186
- return & spec .VersionedSignedBuilderBid {
187
- Version : consensusspec .DataVersionCapella ,
188
- Bellatrix : & apibellatrix .SignedBuilderBid {
187
+ return & builderSpec .VersionedSignedBuilderBid {
188
+ Version : spec .DataVersionCapella ,
189
+ Capella : & builderApiCapella .SignedBuilderBid {
189
190
Message : message ,
190
191
Signature : signature ,
191
192
},
192
193
}
193
- case consensusspec .DataVersionCapella :
194
- // Fill the payload with custom values.
195
- message := & apicapella.BuilderBid {
196
- Header : & capella.ExecutionPayloadHeader {
194
+ case spec .DataVersionDeneb :
195
+ message := & builderApiDeneb.BuilderBid {
196
+ Header : & deneb.ExecutionPayloadHeader {
197
197
BlockHash : _HexToHash (blockHash ),
198
198
ParentHash : _HexToHash (parentHash ),
199
199
WithdrawalsRoot : phase0.Root {},
200
+ BaseFeePerGas : uint256 .NewInt (0 ),
200
201
},
201
- Value : uint256 .NewInt (value ),
202
- Pubkey : _HexToPubkey (publicKey ),
202
+ BlobKZGCommitments : make ([]deneb.KZGCommitment , 0 ),
203
+ Value : uint256 .NewInt (value ),
204
+ Pubkey : _HexToPubkey (publicKey ),
203
205
}
204
206
205
207
// Sign the message.
206
208
signature , err := ssz .SignMessage (message , ssz .DomainBuilder , m .secretKey )
207
209
require .NoError (m .t , err )
208
210
209
- return & spec .VersionedSignedBuilderBid {
210
- Version : consensusspec . DataVersionCapella ,
211
- Capella : & apicapella .SignedBuilderBid {
211
+ return & builderSpec .VersionedSignedBuilderBid {
212
+ Version : spec . DataVersionDeneb ,
213
+ Deneb : & builderApiDeneb .SignedBuilderBid {
212
214
Message : message ,
213
215
Signature : signature ,
214
216
},
215
217
}
216
- case consensusspec .DataVersionUnknown , consensusspec .DataVersionPhase0 , consensusspec .DataVersionAltair , consensusspec . DataVersionDeneb :
218
+ case spec .DataVersionUnknown , spec .DataVersionPhase0 , spec .DataVersionAltair , spec . DataVersionBellatrix :
217
219
return nil
218
220
}
219
221
return nil
@@ -243,7 +245,7 @@ func (m *mockRelay) defaultHandleGetHeader(w http.ResponseWriter) {
243
245
"0xe28385e7bd68df656cd0042b74b69c3104b5356ed1f20eb69f1f925df47a3ab7" ,
244
246
"0xe28385e7bd68df656cd0042b74b69c3104b5356ed1f20eb69f1f925df47a3ab7" ,
245
247
"0x8a1d7b8dd64e0aafe7ea7b6c95065c9364cf99d38470c12ee807d55f7de1529ad29ce2c422e0b65e3d5a05c02caca249" ,
246
- consensusspec .DataVersionCapella ,
248
+ spec .DataVersionCapella ,
247
249
)
248
250
if m .GetHeaderResponse != nil {
249
251
response = m .GetHeaderResponse
@@ -257,9 +259,9 @@ func (m *mockRelay) defaultHandleGetHeader(w http.ResponseWriter) {
257
259
258
260
// MakeGetPayloadResponse is used to create the default or can be used to create a custom response to the getPayload
259
261
// method
260
- func (m * mockRelay ) MakeGetPayloadResponse (parentHash , blockHash , feeRecipient string , blockNumber uint64 ) * api. VersionedExecutionPayload {
261
- return & api. VersionedExecutionPayload {
262
- Version : consensusspec . DataVersionCapella ,
262
+ func (m * mockRelay ) MakeGetPayloadResponse (parentHash , blockHash , feeRecipient string , blockNumber uint64 , version spec. DataVersion ) * builderApi. VersionedSubmitBlindedBlockResponse {
263
+ return & builderApi. VersionedSubmitBlindedBlockResponse {
264
+ Version : version ,
263
265
Capella : & capella.ExecutionPayload {
264
266
ParentHash : _HexToHash (parentHash ),
265
267
BlockHash : _HexToHash (blockHash ),
@@ -294,6 +296,7 @@ func (m *mockRelay) defaultHandleGetPayload(w http.ResponseWriter) {
294
296
"0x534809bd2b6832edff8d8ce4cb0e50068804fd1ef432c8362ad708a74fdc0e46" ,
295
297
"0xdb65fEd33dc262Fe09D9a2Ba8F80b329BA25f941" ,
296
298
12345 ,
299
+ spec .DataVersionCapella ,
297
300
)
298
301
299
302
if m .GetPayloadResponse != nil {
0 commit comments