Documentation ¶
Index ¶
- Constants
- Variables
- func Decode(b []byte, objptr msgp.Unmarshaler) error
- func DecodeJSON(b []byte, objptr interface{}) error
- func DecodeMsgp(b []byte, objptr msgp.Unmarshaler) (err error)
- func DecodeReflect(b []byte, objptr interface{}) error
- func DecodeStream(r io.Reader, objptr interface{}) error
- func Encode(obj msgp.Marshaler) []byte
- func EncodeJSON(obj interface{}) []byte
- func EncodeJSONStrict(obj interface{}) []byte
- func EncodeMsgp(obj msgp.Marshaler) []byte
- func EncodeReflect(obj interface{}) []byte
- func EncodeStream(w io.Writer, obj interface{})
- func EncodingTest(template msgpMarshalUnmarshal) error
- func GetEncodingBuf() []byte
- func NewEncoder(w io.Writer) *codec.Encoder
- func NewJSONEncoder(w io.Writer) *codec.Encoder
- func PutEncodingBuf(s []byte)
- func RandomizeObject(template interface{}) (interface{}, error)
- func RunEncodingTest(t *testing.T, template msgpMarshalUnmarshal)
- type CompactCertType
- func (_ CompactCertType) CanMarshalMsg(z interface{}) bool
- func (_ *CompactCertType) CanUnmarshalMsg(z interface{}) bool
- func (z CompactCertType) MarshalMsg(b []byte) (o []byte)
- func (z CompactCertType) MsgIsZero() bool
- func (z CompactCertType) Msgsize() (s int)
- func (z *CompactCertType) UnmarshalMsg(bts []byte) (o []byte, err error)
- type ConsensusVersion
- func (_ ConsensusVersion) CanMarshalMsg(z interface{}) bool
- func (_ *ConsensusVersion) CanUnmarshalMsg(z interface{}) bool
- func (z ConsensusVersion) MarshalMsg(b []byte) (o []byte)
- func (z ConsensusVersion) MsgIsZero() bool
- func (z ConsensusVersion) Msgsize() (s int)
- func (z *ConsensusVersion) UnmarshalMsg(bts []byte) (o []byte, err error)
- type Decoder
- type Error
- func (_ Error) CanMarshalMsg(z interface{}) bool
- func (_ *Error) CanUnmarshalMsg(z interface{}) bool
- func (err Error) Error() string
- func (z Error) MarshalMsg(b []byte) (o []byte)
- func (z Error) MsgIsZero() bool
- func (z Error) Msgsize() (s int)
- func (z *Error) UnmarshalMsg(bts []byte) (o []byte, err error)
- type HashID
- type NetworkID
- type SortCompactCertType
- type Tag
- type TxType
Constants ¶
const ( // CompactCertBasic is our initial compact cert setup, using Ed25519 // ephemeral-key signatures and SHA512/256 hashes. CompactCertBasic CompactCertType = 0 // NumCompactCertTypes is the max number of types of compact certs // that we support. This is used as an allocation bound for a map // containing different compact cert types in msgpack encoding. NumCompactCertTypes int = 1 )
const ConsensusCurrentVersion = ConsensusV27
ConsensusCurrentVersion is the latest version and should be used when a specific version is not provided.
const ConsensusFuture = ConsensusVersion(
"future",
)
ConsensusFuture is a protocol that should not appear in any production network, but is used to test features before they are released.
const ConsensusV10 = ConsensusVersion("v10")
ConsensusV10 introduces fast partition recovery.
const ConsensusV11 = ConsensusVersion("v11")
ConsensusV11 introduces efficient encoding of SignedTxn using SignedTxnInBlock.
const ConsensusV12 = ConsensusVersion("v12")
ConsensusV12 increases the maximum length of a version string.
const ConsensusV13 = ConsensusVersion(
"https://github.com/algorand/spec/tree/0c8a9dc44d7368cc266d5407b79fb3311f4fc795",
)
ConsensusV13 makes the consensus version a meaningful string.
const ConsensusV14 = ConsensusVersion(
"https://github.com/algorand/spec/tree/2526b6ae062b4fe5e163e06e41e1d9b9219135a9",
)
ConsensusV14 adds tracking of closing amounts in ApplyData, and enables genesis hash in transactions.
const ConsensusV15 = ConsensusVersion(
"https://github.com/algorand/spec/tree/a26ed78ed8f834e2b9ccb6eb7d3ee9f629a6e622",
)
ConsensusV15 adds tracking of reward distributions in ApplyData.
const ConsensusV16 = ConsensusVersion(
"https://github.com/algorand/spec/tree/22726c9dcd12d9cddce4a8bd7e8ccaa707f74101",
)
ConsensusV16 fixes domain separation in Credentials and requires GenesisHash.
const ConsensusV17 = ConsensusVersion(
"https://github.com/algorandfoundation/specs/tree/5615adc36bad610c7f165fa2967f4ecfa75125f0",
)
ConsensusV17 points to 'final' spec commit for 2019 june release
const ConsensusV18 = ConsensusVersion(
"https://github.com/algorandfoundation/specs/tree/6c6bd668be0ab14098e51b37e806c509f7b7e31f",
)
ConsensusV18 points to reward calculation spec commit
const ConsensusV19 = ConsensusVersion(
"https://github.com/algorandfoundation/specs/tree/0e196e82bfd6e327994bec373c4cc81bc878ef5c",
)
ConsensusV19 points to 'final' spec commit for 2019 nov release
const ConsensusV20 = ConsensusVersion(
"https://github.com/algorandfoundation/specs/tree/4a9db6a25595c6fd097cf9cc137cc83027787eaa",
)
ConsensusV20 points to adding the decimals field to assets
const ConsensusV21 = ConsensusVersion(
"https://github.com/algorandfoundation/specs/tree/8096e2df2da75c3339986317f9abe69d4fa86b4b",
)
ConsensusV21 fixes a bug in credential.lowestOutput
const ConsensusV22 = ConsensusVersion(
"https://github.com/algorandfoundation/specs/tree/57016b942f6d97e6d4c0688b373bb0a2fc85a1a2",
)
ConsensusV22 allows tuning the upgrade delay.
const ConsensusV23 = ConsensusVersion(
"https://github.com/algorandfoundation/specs/tree/e5f565421d720c6f75cdd186f7098495caf9101f",
)
ConsensusV23 fixes lease behavior.
const ConsensusV24 = ConsensusVersion(
"https://github.com/algorandfoundation/specs/tree/3a83c4c743f8b17adfd73944b4319c25722a6782",
)
ConsensusV24 include the applications, rekeying and teal v2
const ConsensusV25 = ConsensusVersion(
"https://github.com/algorandfoundation/specs/tree/bea19289bf41217d2c0af30522fa222ef1366466",
)
ConsensusV25 adds support for AssetCloseAmount in the ApplyData
const ConsensusV26 = ConsensusVersion(
"https://github.com/algorandfoundation/specs/tree/ac2255d586c4474d4ebcf3809acccb59b7ef34ff",
)
ConsensusV26 adds support for TEAL 3, initial rewards calculation and merkle tree hash commitments
const ConsensusV27 = ConsensusVersion(
"https://github.com/algorandfoundation/specs/tree/d050b3cade6d5c664df8bd729bf219f179812595",
)
ConsensusV27 updates ApplyDelta.EvalDelta.LocalDeltas format
const ConsensusV7 = ConsensusVersion("v7")
ConsensusV7 increases MaxBalLookback to 320 in preparation for the twin seeds change.
const ConsensusV8 = ConsensusVersion("v8")
ConsensusV8 uses the new parameters and seed derivation policy from the agreement protocol's security analysis.
const ConsensusV9 = ConsensusVersion("v9")
ConsensusV9 increases min balance to 100,000 microAlgos.
const DEPRECATEDConsensusV0 = ConsensusVersion("v0")
DEPRECATEDConsensusV0 is a baseline version of the Algorand consensus protocol. at the time versioning was introduced. It is now deprecated.
const DEPRECATEDConsensusV1 = ConsensusVersion("v1")
DEPRECATEDConsensusV1 adds support for Genesis ID in transactions, but does not require it (transactions missing a GenesisID value are still allowed). It is now deprecated.
const DEPRECATEDConsensusV2 = ConsensusVersion("v2")
DEPRECATEDConsensusV2 fixes a bug in the agreement protocol where proposalValues fail to commit to the original period and sender of a block.
const DEPRECATEDConsensusV3 = ConsensusVersion("v3")
DEPRECATEDConsensusV3 adds support for fine-grained ephemeral keys.
const DEPRECATEDConsensusV4 = ConsensusVersion("v4")
DEPRECATEDConsensusV4 adds support for a min balance and a transaction that closes out an account.
const DEPRECATEDConsensusV5 = ConsensusVersion("v5")
DEPRECATEDConsensusV5 sets MinTxnFee to 1000 and fixes a blance lookback bug
const DEPRECATEDConsensusV6 = ConsensusVersion("v6")
DEPRECATEDConsensusV6 adds support for explicit ephemeral-key parameters
Variables ¶
var CodecHandle *codec.MsgpackHandle
CodecHandle is used to instantiate msgpack encoders and decoders with our settings (canonical, paranoid about decoding errors)
var JSONHandle *codec.JsonHandle
JSONHandle is used to instantiate JSON encoders and decoders with our settings (canonical, paranoid about decoding errors)
var JSONStrictHandle *codec.JsonHandle
JSONStrictHandle is the same as JSONHandle but with MapKeyAsString=true for correct maps[int]interface{} encoding
Functions ¶
func Decode ¶
func Decode(b []byte, objptr msgp.Unmarshaler) error
Decode attempts to decode a msgpack-encoded byte buffer into an object instance pointed to by objptr.
func DecodeJSON ¶
DecodeJSON attempts to decode a JSON-encoded byte buffer into an object instance pointed to by objptr
func DecodeMsgp ¶
func DecodeMsgp(b []byte, objptr msgp.Unmarshaler) (err error)
DecodeMsgp attempts to decode a msgpack-encoded byte buffer into an object instance pointed to by objptr, requiring that we pre- generated the code for doing so using msgp.
func DecodeReflect ¶
DecodeReflect attempts to decode a msgpack-encoded byte buffer into an object instance pointed to by objptr, using reflection.
func DecodeStream ¶
DecodeStream is like Decode but reads from an io.Reader instead.
func EncodeJSON ¶
func EncodeJSON(obj interface{}) []byte
EncodeJSON returns a JSON-encoded byte buffer for a given object
func EncodeJSONStrict ¶
func EncodeJSONStrict(obj interface{}) []byte
EncodeJSONStrict returns a JSON-encoded byte buffer for a given object It is the same EncodeJSON but encodes map's int keys as strings
func EncodeMsgp ¶
EncodeMsgp returns a msgpack-encoded byte buffer, requiring that we pre-generated the code for doing so using msgp.
func EncodeReflect ¶
func EncodeReflect(obj interface{}) []byte
EncodeReflect returns a msgpack-encoded byte buffer for a given object, using reflection.
func EncodeStream ¶
EncodeStream is like Encode but writes to an io.Writer instead.
func EncodingTest ¶
func EncodingTest(template msgpMarshalUnmarshal) error
EncodingTest tests that our two msgpack codecs (msgp and go-codec) agree on encodings and decodings of random values of the type of template, returning an error if there is a mismatch.
func GetEncodingBuf ¶
func GetEncodingBuf() []byte
GetEncodingBuf returns a byte slice that can be used for encoding a temporary message. The byte slice has zero length but potentially non-zero capacity. The caller gets full ownership of the byte slice, but is encouraged to return it using PutEncodingBuf().
func NewEncoder ¶
NewEncoder returns an encoder object writing bytes into [w].
func NewJSONEncoder ¶
NewJSONEncoder returns an encoder object writing bytes into [w].
func PutEncodingBuf ¶
func PutEncodingBuf(s []byte)
PutEncodingBuf places a byte slice into the pool of temporary buffers for encoding. The caller gives up ownership of the byte slice when passing it to PutEncodingBuf().
func RandomizeObject ¶
func RandomizeObject(template interface{}) (interface{}, error)
RandomizeObject returns a random object of the same type as template
func RunEncodingTest ¶
RunEncodingTest runs several iterations of encoding/decoding consistency testing of object type specified by template.
Types ¶
type CompactCertType ¶
type CompactCertType uint64
CompactCertType identifies a particular configuration of compact certs.
func (CompactCertType) CanMarshalMsg ¶
func (_ CompactCertType) CanMarshalMsg(z interface{}) bool
func (*CompactCertType) CanUnmarshalMsg ¶
func (_ *CompactCertType) CanUnmarshalMsg(z interface{}) bool
func (CompactCertType) MarshalMsg ¶
func (z CompactCertType) MarshalMsg(b []byte) (o []byte)
MarshalMsg implements msgp.Marshaler
func (CompactCertType) MsgIsZero ¶
func (z CompactCertType) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (CompactCertType) Msgsize ¶
func (z CompactCertType) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*CompactCertType) UnmarshalMsg ¶
func (z *CompactCertType) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type ConsensusVersion ¶
type ConsensusVersion string
ConsensusVersion is a string that identifies a version of the consensus protocol.
func (ConsensusVersion) CanMarshalMsg ¶
func (_ ConsensusVersion) CanMarshalMsg(z interface{}) bool
func (*ConsensusVersion) CanUnmarshalMsg ¶
func (_ *ConsensusVersion) CanUnmarshalMsg(z interface{}) bool
func (ConsensusVersion) MarshalMsg ¶
func (z ConsensusVersion) MarshalMsg(b []byte) (o []byte)
MarshalMsg implements msgp.Marshaler
func (ConsensusVersion) MsgIsZero ¶
func (z ConsensusVersion) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (ConsensusVersion) Msgsize ¶
func (z ConsensusVersion) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*ConsensusVersion) UnmarshalMsg ¶
func (z *ConsensusVersion) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type Decoder ¶
type Decoder interface {
Decode(objptr interface{}) error
}
Decoder is our interface for a thing that can decode objects.
func NewDecoder ¶
NewDecoder returns a decoder object reading bytes from [r].
func NewDecoderBytes ¶
NewDecoderBytes returns a decoder object reading bytes from [b].
func NewJSONDecoder ¶
NewJSONDecoder returns a json decoder object reading bytes from [r].
type Error ¶
type Error ConsensusVersion
Error is used to indicate that an unsupported protocol has been detected.
func (Error) CanMarshalMsg ¶
func (*Error) CanUnmarshalMsg ¶
func (Error) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type HashID ¶
type HashID string
HashID is a domain separation prefix for an object type that might be hashed This ensures, for example, the hash of a transaction will never collide with the hash of a vote
const ( AuctionBid HashID = "aB" AuctionDeposit HashID = "aD" AuctionOutcomes HashID = "aO" AuctionParams HashID = "aP" AuctionSettlement HashID = "aS" CompactCertCoin HashID = "ccc" CompactCertPart HashID = "ccp" CompactCertSig HashID = "ccs" AgreementSelector HashID = "AS" BlockHeader HashID = "BH" BalanceRecord HashID = "BR" Credential HashID = "CR" Genesis HashID = "GE" MerkleArrayNode HashID = "MA" Message HashID = "MX" NetPrioResponse HashID = "NPR" OneTimeSigKey1 HashID = "OT1" OneTimeSigKey2 HashID = "OT2" PaysetFlat HashID = "PF" Payload HashID = "PL" Program HashID = "Program" ProgramData HashID = "ProgData" ProposerSeed HashID = "PS" Seed HashID = "SD" SpecialAddr HashID = "SpecialAddr" SignedTxnInBlock HashID = "STIB" TestHashable HashID = "TE" TxGroup HashID = "TG" TxnMerkleLeaf HashID = "TL" Transaction HashID = "TX" Vote HashID = "VO" )
Hash IDs for specific object types, in lexicographic order to avoid dups.
func (HashID) CanMarshalMsg ¶
func (*HashID) CanUnmarshalMsg ¶
func (HashID) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type NetworkID ¶
type NetworkID string
The NetworkID type is used for strings that identify distinct named networks
func (NetworkID) CanMarshalMsg ¶
func (*NetworkID) CanUnmarshalMsg ¶
func (NetworkID) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type SortCompactCertType ¶
type SortCompactCertType []CompactCertType
SortCompactCertType implements sorting by CompactCertType keys for canonical encoding of maps in msgpack format.
func (SortCompactCertType) Len ¶
func (a SortCompactCertType) Len() int
func (SortCompactCertType) Less ¶
func (a SortCompactCertType) Less(i, j int) bool
func (SortCompactCertType) Swap ¶
func (a SortCompactCertType) Swap(i, j int)
type Tag ¶
type Tag string
Tag represents a message type identifier. Messages have a Tag field. Handlers can register to a given Tag. e.g., the agreement service can register to handle agreements with the Agreement tag.
const ( UnknownMsgTag Tag = "??" AgreementVoteTag Tag = "AV" CompactCertSigTag Tag = "CS" MsgOfInterestTag Tag = "MI" MsgDigestSkipTag Tag = "MS" NetPrioResponseTag Tag = "NP" PingTag Tag = "pi" PingReplyTag Tag = "pj" ProposalPayloadTag Tag = "PP" TopicMsgRespTag Tag = "TS" TxnTag Tag = "TX" UniCatchupReqTag Tag = "UC" //Replaced by UniEnsBlockReqTag. Only for backward compatibility. UniEnsBlockReqTag Tag = "UE" //UniEnsBlockResTag Tag = "US" was used for wsfetcherservice //UniCatchupResTag Tag = "UT" was used for wsfetcherservice VoteBundleTag Tag = "VB" )
Tags, in lexicographic sort order of tag values to avoid duplicates. These tags must not contain a comma character because lists of tags are encoded using a comma separator (see network/msgOfInterest.go).
func (Tag) CanMarshalMsg ¶
func (*Tag) CanUnmarshalMsg ¶
func (Tag) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type TxType ¶
type TxType string
TxType is the type of the transaction written to the ledger
const ( // PaymentTx indicates a payment transaction PaymentTx TxType = "pay" // KeyRegistrationTx indicates a transaction that registers participation keys KeyRegistrationTx TxType = "keyreg" // AssetConfigTx creates, re-configures, or destroys an asset AssetConfigTx TxType = "acfg" // AssetTransferTx transfers assets between accounts (optionally closing) AssetTransferTx TxType = "axfer" // AssetFreezeTx changes the freeze status of an asset AssetFreezeTx TxType = "afrz" // ApplicationCallTx allows creating, deleting, and interacting with an application ApplicationCallTx TxType = "appl" // CompactCertTx records a compact certificate CompactCertTx TxType = "cert" // UnknownTx signals an error UnknownTx TxType = "unknown" )
func (TxType) CanMarshalMsg ¶
func (*TxType) CanUnmarshalMsg ¶
func (TxType) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler