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

Commit

Permalink
fix json marshalling
Browse files Browse the repository at this point in the history
  • Loading branch information
avalonche committed Jun 26, 2024
1 parent 85ce2f9 commit c7bc868
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions eth/block-validation/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,6 @@ type BuilderBlockValidationRequestV3 struct {
RegisteredGasLimit uint64 `json:"registered_gas_limit,string"`
}

type BuilderBlockValidationResponse struct {
BlockValue *uint256.Int `json:"block_value"`
}

func (r *BuilderBlockValidationRequestV3) UnmarshalJSON(data []byte) error {
params := &struct {
ParentBeaconBlockRoot common.Hash `json:"parent_beacon_block_root"`
Expand All @@ -229,6 +225,19 @@ func (r *BuilderBlockValidationRequestV3) UnmarshalJSON(data []byte) error {
return nil
}

type BuilderBlockValidationResponse struct {
BlockValue *uint256.Int
}

func (r *BuilderBlockValidationResponse) MarshalJSON() ([]byte, error) {
type validationResponseJSON struct {
BlockValue string `json:"block_value"`
}
return json.Marshal(&validationResponseJSON{
BlockValue: fmt.Sprintf("%d", r.BlockValue),
})
}

func (api *BlockValidationAPI) ValidateBuilderSubmissionV3(params *BuilderBlockValidationRequestV3) (*BuilderBlockValidationResponse, error) {
// TODO: fuzztest, make sure the validation is sound
payload := params.ExecutionPayload
Expand Down

0 comments on commit c7bc868

Please sign in to comment.