Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit c7bc868

Browse files
committed
fix json marshalling
1 parent 85ce2f9 commit c7bc868

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

eth/block-validation/api.go

+13-4
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,6 @@ type BuilderBlockValidationRequestV3 struct {
204204
RegisteredGasLimit uint64 `json:"registered_gas_limit,string"`
205205
}
206206

207-
type BuilderBlockValidationResponse struct {
208-
BlockValue *uint256.Int `json:"block_value"`
209-
}
210-
211207
func (r *BuilderBlockValidationRequestV3) UnmarshalJSON(data []byte) error {
212208
params := &struct {
213209
ParentBeaconBlockRoot common.Hash `json:"parent_beacon_block_root"`
@@ -229,6 +225,19 @@ func (r *BuilderBlockValidationRequestV3) UnmarshalJSON(data []byte) error {
229225
return nil
230226
}
231227

228+
type BuilderBlockValidationResponse struct {
229+
BlockValue *uint256.Int
230+
}
231+
232+
func (r *BuilderBlockValidationResponse) MarshalJSON() ([]byte, error) {
233+
type validationResponseJSON struct {
234+
BlockValue string `json:"block_value"`
235+
}
236+
return json.Marshal(&validationResponseJSON{
237+
BlockValue: fmt.Sprintf("%d", r.BlockValue),
238+
})
239+
}
240+
232241
func (api *BlockValidationAPI) ValidateBuilderSubmissionV3(params *BuilderBlockValidationRequestV3) (*BuilderBlockValidationResponse, error) {
233242
// TODO: fuzztest, make sure the validation is sound
234243
payload := params.ExecutionPayload

0 commit comments

Comments
 (0)