rlp, trie, contracts, compression, consensus: improve comments (#14580)
This commit is contained in:
committed by
Felix Lange
parent
e3dfd55820
commit
061889d4ea
@@ -55,7 +55,7 @@ type Decoder interface {
|
||||
// To decode into a pointer, Decode will decode into the value pointed
|
||||
// to. If the pointer is nil, a new value of the pointer's element
|
||||
// type is allocated. If the pointer is non-nil, the existing value
|
||||
// will reused.
|
||||
// will be reused.
|
||||
//
|
||||
// To decode into a struct, Decode expects the input to be an RLP
|
||||
// list. The decoded elements of the list are assigned to each public
|
||||
@@ -290,7 +290,7 @@ func makeListDecoder(typ reflect.Type, tag tags) (decoder, error) {
|
||||
}
|
||||
case tag.tail:
|
||||
// A slice with "tail" tag can occur as the last field
|
||||
// of a struct and is upposed to swallow all remaining
|
||||
// of a struct and is supposed to swallow all remaining
|
||||
// list elements. The struct decoder already called s.List,
|
||||
// proceed directly to decoding the elements.
|
||||
dec = func(s *Stream, val reflect.Value) error {
|
||||
@@ -741,7 +741,7 @@ func (s *Stream) uint(maxbits int) (uint64, error) {
|
||||
}
|
||||
|
||||
// Bool reads an RLP string of up to 1 byte and returns its contents
|
||||
// as an boolean. If the input does not contain an RLP string, the
|
||||
// as a boolean. If the input does not contain an RLP string, the
|
||||
// returned error will be ErrExpectedString.
|
||||
func (s *Stream) Bool() (bool, error) {
|
||||
num, err := s.uint(8)
|
||||
|
@@ -17,13 +17,13 @@
|
||||
/*
|
||||
Package rlp implements the RLP serialization format.
|
||||
|
||||
The purpose of RLP (Recursive Linear Prefix) qis to encode arbitrarily
|
||||
The purpose of RLP (Recursive Linear Prefix) is to encode arbitrarily
|
||||
nested arrays of binary data, and RLP is the main encoding method used
|
||||
to serialize objects in Ethereum. The only purpose of RLP is to encode
|
||||
structure; encoding specific atomic data types (eg. strings, ints,
|
||||
floats) is left up to higher-order protocols; in Ethereum integers
|
||||
must be represented in big endian binary form with no leading zeroes
|
||||
(thus making the integer value zero be equivalent to the empty byte
|
||||
(thus making the integer value zero equivalent to the empty byte
|
||||
array).
|
||||
|
||||
RLP values are distinguished by a type tag. The type tag precedes the
|
||||
|
@@ -478,7 +478,7 @@ func writeEncoder(val reflect.Value, w *encbuf) error {
|
||||
// with a pointer receiver.
|
||||
func writeEncoderNoPtr(val reflect.Value, w *encbuf) error {
|
||||
if !val.CanAddr() {
|
||||
// We can't get the address. It would be possible make the
|
||||
// We can't get the address. It would be possible to make the
|
||||
// value addressable by creating a shallow copy, but this
|
||||
// creates other problems so we're not doing it (yet).
|
||||
//
|
||||
@@ -583,7 +583,7 @@ func makePtrWriter(typ reflect.Type) (writer, error) {
|
||||
return writer, err
|
||||
}
|
||||
|
||||
// putint writes i to the beginning of b in with big endian byte
|
||||
// putint writes i to the beginning of b in big endian byte
|
||||
// order, using the least number of bytes needed to represent i.
|
||||
func putint(b []byte, i uint64) (size int) {
|
||||
switch {
|
||||
|
@@ -22,7 +22,7 @@ import (
|
||||
)
|
||||
|
||||
// RawValue represents an encoded RLP value and can be used to delay
|
||||
// RLP decoding or precompute an encoding. Note that the decoder does
|
||||
// RLP decoding or to precompute an encoding. Note that the decoder does
|
||||
// not verify whether the content of RawValues is valid RLP.
|
||||
type RawValue []byte
|
||||
|
||||
|
Reference in New Issue
Block a user