Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions core/types/block.libevm.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import (
// HeaderHooks are required for all types registered with [RegisterExtras] for
// [Header] payloads.
type HeaderHooks interface {
MarshalJSON(*Header) ([]byte, error) //nolint:govet // Type-specific override hook
UnmarshalJSON(*Header, []byte) error //nolint:govet
EncodeJSON(*Header) ([]byte, error)
DecodeJSON(*Header, []byte) error
EncodeRLP(*Header, io.Writer) error
DecodeRLP(*Header, *rlp.Stream) error
PostCopy(dst *Header)
Expand Down Expand Up @@ -58,12 +58,12 @@ var _ interface {

// MarshalJSON implements the [json.Marshaler] interface.
func (h *Header) MarshalJSON() ([]byte, error) {
return h.hooks().MarshalJSON(h)
return h.hooks().EncodeJSON(h)
}

// UnmarshalJSON implements the [json.Unmarshaler] interface.
func (h *Header) UnmarshalJSON(b []byte) error {
return h.hooks().UnmarshalJSON(h, b)
return h.hooks().DecodeJSON(h, b)
}

// EncodeRLP implements the [rlp.Encoder] interface.
Expand Down Expand Up @@ -94,11 +94,11 @@ type NOOPHeaderHooks struct{}

var _ HeaderHooks = (*NOOPHeaderHooks)(nil)

func (*NOOPHeaderHooks) MarshalJSON(h *Header) ([]byte, error) { //nolint:govet
func (*NOOPHeaderHooks) EncodeJSON(h *Header) ([]byte, error) {
return h.marshalJSON()
}

func (*NOOPHeaderHooks) UnmarshalJSON(h *Header, b []byte) error { //nolint:govet
func (*NOOPHeaderHooks) DecodeJSON(h *Header, b []byte) error {
return h.unmarshalJSON(b)
}

Expand Down
4 changes: 2 additions & 2 deletions core/types/block.libevm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ func fakeHeaderRLP(h *Header, suffix []byte) []byte {
return append(crypto.Keccak256(h.ParentHash[:]), suffix...)
}

func (hh *stubHeaderHooks) MarshalJSON(h *Header) ([]byte, error) { //nolint:govet
func (hh *stubHeaderHooks) EncodeJSON(h *Header) ([]byte, error) {
return fakeHeaderJSON(h, hh.suffix), hh.errMarshal
}

func (hh *stubHeaderHooks) UnmarshalJSON(h *Header, b []byte) error { //nolint:govet
func (hh *stubHeaderHooks) DecodeJSON(h *Header, b []byte) error {
hh.gotRawJSONToUnmarshal = b
*h = hh.setHeaderToOnUnmarshalOrDecode
return hh.errUnmarshal
Expand Down