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

Commit 22d5be0

Browse files
committed
Add comments on exported symbols
1 parent 00e7aa1 commit 22d5be0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

core/types/header_ext.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ import (
1313
"github.com/ava-labs/libevm/rlp"
1414
)
1515

16+
// GetHeaderExtra returns the [HeaderExtra] from the given [Header].
1617
func GetHeaderExtra(h *Header) *HeaderExtra {
1718
return extras.Header.Get(h)
1819
}
1920

21+
// WithHeaderExtra sets the given [HeaderExtra] on the [Header],
22+
// and returns the header `h`. Note `h` is modified in place.
2023
func WithHeaderExtra(h *Header, extra *HeaderExtra) *Header {
2124
extras.Header.Set(h, extra)
2225
return h
@@ -32,6 +35,8 @@ type HeaderExtra struct {
3235
BlockGasCost *big.Int
3336
}
3437

38+
// EncodeRLP RLP encodes the given [ethtypes.Header] and [HeaderExtra] together
39+
// to the `writer`. It does merge both structs into a single [HeaderSerializable].
3540
func (h *HeaderExtra) EncodeRLP(eth *ethtypes.Header, writer io.Writer) error {
3641
temp := new(HeaderSerializable)
3742

@@ -41,6 +46,8 @@ func (h *HeaderExtra) EncodeRLP(eth *ethtypes.Header, writer io.Writer) error {
4146
return rlp.Encode(writer, temp)
4247
}
4348

49+
// DecodeRLP RLP decodes from the [*rlp.Stream] and writes the output to both the
50+
// [ethtypes.Header] passed as argument and to the receiver [HeaderExtra].
4451
func (h *HeaderExtra) DecodeRLP(eth *ethtypes.Header, stream *rlp.Stream) error {
4552
temp := new(HeaderSerializable)
4653
if err := stream.Decode(temp); err != nil {
@@ -53,6 +60,8 @@ func (h *HeaderExtra) DecodeRLP(eth *ethtypes.Header, stream *rlp.Stream) error
5360
return nil
5461
}
5562

63+
// EncodeJSON JSON encodes the given [ethtypes.Header] and [HeaderExtra] together
64+
// to the `writer`. It does merge both structs into a single [HeaderSerializable].
5665
func (h *HeaderExtra) EncodeJSON(eth *ethtypes.Header) ([]byte, error) {
5766
temp := new(HeaderSerializable)
5867

@@ -62,6 +71,8 @@ func (h *HeaderExtra) EncodeJSON(eth *ethtypes.Header) ([]byte, error) {
6271
return temp.EncodeJSON()
6372
}
6473

74+
// DecodeJSON JSON decodes from the `input` bytes and writes the output to both the
75+
// [ethtypes.Header] passed as argument and to the receiver [HeaderExtra].
6576
func (h *HeaderExtra) DecodeJSON(eth *ethtypes.Header, input []byte) error {
6677
temp := new(HeaderSerializable)
6778
if err := temp.DecodeJSON(input); err != nil {

0 commit comments

Comments
 (0)