Skip to content

Commit 1da7d70

Browse files
committed
chore!(core/types): change method names of JSON header hooks
- MarshalJSON -> EncodeJSON - UnmarshalJSON -> DecodeJSON - Placates the gopls forced linter - Aligns with EncodeRLP and DecodeRLP hook functions
1 parent c74b645 commit 1da7d70

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

core/types/block.libevm.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ import (
2929
// HeaderHooks are required for all types registered with [RegisterExtras] for
3030
// [Header] payloads.
3131
type HeaderHooks interface {
32-
MarshalJSON(*Header) ([]byte, error) //nolint:govet // Type-specific override hook
33-
UnmarshalJSON(*Header, []byte) error //nolint:govet
32+
EncodeJSON(*Header) ([]byte, error) // Type-specific override hook
33+
DecodeJSON(*Header, []byte) error
3434
EncodeRLP(*Header, io.Writer) error
3535
DecodeRLP(*Header, *rlp.Stream) error
3636
PostCopy(dst *Header)
@@ -58,12 +58,12 @@ var _ interface {
5858

5959
// MarshalJSON implements the [json.Marshaler] interface.
6060
func (h *Header) MarshalJSON() ([]byte, error) {
61-
return h.hooks().MarshalJSON(h)
61+
return h.hooks().EncodeJSON(h)
6262
}
6363

6464
// UnmarshalJSON implements the [json.Unmarshaler] interface.
6565
func (h *Header) UnmarshalJSON(b []byte) error {
66-
return h.hooks().UnmarshalJSON(h, b)
66+
return h.hooks().DecodeJSON(h, b)
6767
}
6868

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

9595
var _ HeaderHooks = (*NOOPHeaderHooks)(nil)
9696

97-
func (*NOOPHeaderHooks) MarshalJSON(h *Header) ([]byte, error) { //nolint:govet
97+
func (*NOOPHeaderHooks) EncodeJSON(h *Header) ([]byte, error) {
9898
return h.marshalJSON()
9999
}
100100

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

core/types/block.libevm_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ func fakeHeaderRLP(h *Header, suffix []byte) []byte {
5151
return append(crypto.Keccak256(h.ParentHash[:]), suffix...)
5252
}
5353

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

58-
func (hh *stubHeaderHooks) UnmarshalJSON(h *Header, b []byte) error { //nolint:govet
58+
func (hh *stubHeaderHooks) DecodeJSON(h *Header, b []byte) error {
5959
hh.gotRawJSONToUnmarshal = b
6060
*h = hh.setHeaderToOnUnmarshalOrDecode
6161
return hh.errUnmarshal

0 commit comments

Comments
 (0)