Documentation ¶
Index ¶
- Constants
- Variables
- func EventIDsToHex(ids hash.Events) []hexutil.Bytes
- func FilterSkippedTxs(txs types.Transactions, skippedTxs []uint32) types.Transactions
- func HexToEventIDs(bb []interface{}) hash.Events
- func RPCMarshalEvent(e EventI) map[string]interface{}
- func RPCMarshalEventPayload(event EventPayloadI, inclTx bool, fullTx bool) (map[string]interface{}, error)
- func TransactionMarshalCSER(w *cser.Writer, tx *types.Transaction) error
- func TransactionUnmarshalCSER(r *cser.Reader) (*types.Transaction, error)
- type Block
- type Event
- func (e *Event) CreationTime() Timestamp
- func (e *Event) Extra() []byte
- func (e *Event) GasPowerLeft() GasPowerLeft
- func (e *Event) GasPowerUsed() uint64
- func (e *Event) HashToSign() hash.Hash
- func (e *Event) MarshalBinary() ([]byte, error)
- func (e *Event) MarshalCSER(w *cser.Writer) error
- func (e *Event) MedianTime() Timestamp
- func (e *Event) NoTxs() bool
- func (e *Event) PrevEpochHash() *hash.Hash
- func (e *Event) TxHash() hash.Hash
- type EventI
- type EventIs
- type EventPayload
- func (e *EventPayload) CreationTime() Timestamp
- func (e *EventPayload) DecodeRLP(src *rlp.Stream) error
- func (e *EventPayload) EncodeRLP(w io.Writer) error
- func (e *EventPayload) Extra() []byte
- func (e *EventPayload) GasPowerLeft() GasPowerLeft
- func (e *EventPayload) GasPowerUsed() uint64
- func (e *EventPayload) MarshalBinary() ([]byte, error)
- func (e *EventPayload) MarshalCSER(w *cser.Writer) error
- func (e *EventPayload) MedianTime() Timestamp
- func (e *EventPayload) NoTxs() bool
- func (e *EventPayload) PrevEpochHash() *hash.Hash
- func (e *EventPayload) Sig() Signature
- func (e *EventPayload) Size() int
- func (e *EventPayload) TxHash() hash.Hash
- func (e *EventPayload) Txs() types.Transactions
- func (e *EventPayload) UnmarshalBinary(raw []byte) (err error)
- type EventPayloadI
- type EventPayloads
- type Events
- type GasPowerLeft
- type MutableEventPayload
- func (e *MutableEventPayload) Build() *EventPayload
- func (e *MutableEventPayload) CreationTime() Timestamp
- func (e *MutableEventPayload) DecodeRLP(src *rlp.Stream) error
- func (e *MutableEventPayload) Extra() []byte
- func (e *MutableEventPayload) GasPowerLeft() GasPowerLeft
- func (e *MutableEventPayload) GasPowerUsed() uint64
- func (e *MutableEventPayload) HashToSign() hash.Hash
- func (e *MutableEventPayload) MedianTime() Timestamp
- func (e *MutableEventPayload) NoTxs() bool
- func (e *MutableEventPayload) PrevEpochHash() *hash.Hash
- func (e *MutableEventPayload) SetCreationTime(v Timestamp)
- func (e *MutableEventPayload) SetExtra(v []byte)
- func (e *MutableEventPayload) SetGasPowerLeft(v GasPowerLeft)
- func (e *MutableEventPayload) SetGasPowerUsed(v uint64)
- func (e *MutableEventPayload) SetMedianTime(v Timestamp)
- func (e *MutableEventPayload) SetPrevEpochHash(v *hash.Hash)
- func (e *MutableEventPayload) SetSig(v Signature)
- func (e *MutableEventPayload) SetTxHash(v hash.Hash)
- func (e *MutableEventPayload) SetTxs(v types.Transactions)
- func (e *MutableEventPayload) Sig() Signature
- func (e *MutableEventPayload) Size() int
- func (e *MutableEventPayload) TxHash() hash.Hash
- func (e *MutableEventPayload) Txs() types.Transactions
- func (e *MutableEventPayload) UnmarshalBinary(raw []byte) (err error)
- func (e *MutableEventPayload) UnmarshalCSER(r *cser.Reader) error
- type Signature
- type SignedEvent
- func (e *SignedEvent) CreationTime() Timestamp
- func (e *SignedEvent) Extra() []byte
- func (e *SignedEvent) GasPowerLeft() GasPowerLeft
- func (e *SignedEvent) GasPowerUsed() uint64
- func (e *SignedEvent) MedianTime() Timestamp
- func (e *SignedEvent) NoTxs() bool
- func (e *SignedEvent) PrevEpochHash() *hash.Hash
- func (e *SignedEvent) Sig() Signature
- func (e *SignedEvent) TxHash() hash.Hash
- type Timestamp
Constants ¶
const ( ShortTermGas = 0 LongTermGas = 1 GasPowerConfigs = 2 )
const SigSize = 64
Variables ¶
var ( // EmptyTxHash is hash of empty transactions list. Used to check that event doesn't have transactions not having full event. EmptyTxHash = hash.Hash(types.DeriveSha(types.Transactions{}, new(trie.Trie))) )
var (
ErrSerMalformedEvent = errors.New("serialization of malformed event")
)
var ErrUnknownTxType = errors.New("unknown tx type")
Functions ¶
func FilterSkippedTxs ¶
func FilterSkippedTxs(txs types.Transactions, skippedTxs []uint32) types.Transactions
func HexToEventIDs ¶
func RPCMarshalEvent ¶
RPCMarshalEvent converts the given event to the RPC output .
func RPCMarshalEventPayload ¶
func RPCMarshalEventPayload(event EventPayloadI, inclTx bool, fullTx bool) (map[string]interface{}, error)
RPCMarshalEventPayload converts the given event to the RPC output which depends on fullTx. If inclTx is true transactions are returned. When fullTx is true the returned block contains full transaction details, otherwise it will only contain transaction hashes.
func TransactionMarshalCSER ¶
func TransactionMarshalCSER(w *cser.Writer, tx *types.Transaction) error
func TransactionUnmarshalCSER ¶
func TransactionUnmarshalCSER(r *cser.Reader) (*types.Transaction, error)
Types ¶
type Block ¶
type Block struct { Time Timestamp Atropos hash.Event Events hash.Events Txs []common.Hash // non events txs (genesis) InternalTxs []common.Hash SkippedTxs []uint32 // indexes of skipped txs, starting from first tx of first event, ending with last tx of last event GasUsed uint64 Root hash.Hash }
func (*Block) EstimateSize ¶
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
func (*Event) CreationTime ¶
func (e *Event) CreationTime() Timestamp
func (*Event) GasPowerLeft ¶
func (e *Event) GasPowerLeft() GasPowerLeft
func (*Event) GasPowerUsed ¶
func (e *Event) GasPowerUsed() uint64
func (*Event) HashToSign ¶
func (*Event) MarshalBinary ¶
MarshalBinary implements encoding.BinaryMarshaller interface.
func (*Event) MedianTime ¶
func (e *Event) MedianTime() Timestamp
func (*Event) PrevEpochHash ¶
type EventI ¶
type EventI interface { dag.Event CreationTime() Timestamp MedianTime() Timestamp PrevEpochHash() *hash.Hash Extra() []byte TxHash() hash.Hash NoTxs() bool GasPowerLeft() GasPowerLeft GasPowerUsed() uint64 HashToSign() hash.Hash }
func RPCUnmarshalEvent ¶
RPCUnmarshalEvent converts the RPC output to the header.
type EventIs ¶
type EventIs []EventI
EventIs is a ordered slice of events.
type EventPayload ¶
type EventPayload struct { SignedEvent // contains filtered or unexported fields }
func (*EventPayload) CreationTime ¶
func (e *EventPayload) CreationTime() Timestamp
func (*EventPayload) DecodeRLP ¶
func (e *EventPayload) DecodeRLP(src *rlp.Stream) error
DecodeRLP implements rlp.Decoder interface.
func (*EventPayload) EncodeRLP ¶
func (e *EventPayload) EncodeRLP(w io.Writer) error
EncodeRLP implements rlp.Encoder interface.
func (*EventPayload) GasPowerLeft ¶
func (e *EventPayload) GasPowerLeft() GasPowerLeft
func (*EventPayload) GasPowerUsed ¶
func (e *EventPayload) GasPowerUsed() uint64
func (*EventPayload) MarshalBinary ¶
func (e *EventPayload) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaller interface.
func (*EventPayload) MarshalCSER ¶
func (e *EventPayload) MarshalCSER(w *cser.Writer) error
func (*EventPayload) MedianTime ¶
func (e *EventPayload) MedianTime() Timestamp
func (*EventPayload) PrevEpochHash ¶
func (*EventPayload) Size ¶
func (e *EventPayload) Size() int
func (*EventPayload) Txs ¶
func (e *EventPayload) Txs() types.Transactions
func (*EventPayload) UnmarshalBinary ¶
func (e *EventPayload) UnmarshalBinary(raw []byte) (err error)
UnmarshalBinary implements encoding.BinaryUnmarshaller interface.
type EventPayloadI ¶
type EventPayloadI interface { EventI Sig() Signature Txs() types.Transactions }
type EventPayloads ¶
type EventPayloads []*EventPayload
EventPayloads is a ordered slice of EventPayload.
func (*EventPayloads) Add ¶
func (ee *EventPayloads) Add(e ...*EventPayload)
Add appends hash to the slice.
func (EventPayloads) Bases ¶
func (ee EventPayloads) Bases() dag.Events
func (EventPayloads) IDs ¶
func (ee EventPayloads) IDs() hash.Events
func (EventPayloads) Len ¶
func (hh EventPayloads) Len() int
func (EventPayloads) Less ¶
func (hh EventPayloads) Less(i, j int) bool
func (EventPayloads) String ¶
func (ee EventPayloads) String() string
String returns human readable representation.
func (EventPayloads) Swap ¶
func (hh EventPayloads) Swap(i, j int)
type Events ¶
type Events []*Event
Events is a ordered slice of events.
func (Events) Interfaces ¶
type GasPowerLeft ¶
type GasPowerLeft struct {
Gas [GasPowerConfigs]uint64
}
GasPowerLeft is long-term gas power left and short-term gas power left
func (GasPowerLeft) Max ¶
func (g GasPowerLeft) Max() uint64
Max returns maximum within long-term gas power left and short-term gas power left
func (GasPowerLeft) Min ¶
func (g GasPowerLeft) Min() uint64
Min returns minimum within long-term gas power left and short-term gas power left
func (GasPowerLeft) String ¶
func (g GasPowerLeft) String() string
String returns string representation.
func (GasPowerLeft) Sub ¶
func (g GasPowerLeft) Sub(diff uint64) GasPowerLeft
Sub subtracts from all gas power lefts
type MutableEventPayload ¶
type MutableEventPayload struct {
// contains filtered or unexported fields
}
func (*MutableEventPayload) Build ¶
func (e *MutableEventPayload) Build() *EventPayload
func (*MutableEventPayload) CreationTime ¶
func (e *MutableEventPayload) CreationTime() Timestamp
func (*MutableEventPayload) DecodeRLP ¶
func (e *MutableEventPayload) DecodeRLP(src *rlp.Stream) error
DecodeRLP implements rlp.Decoder interface.
func (*MutableEventPayload) GasPowerLeft ¶
func (e *MutableEventPayload) GasPowerLeft() GasPowerLeft
func (*MutableEventPayload) GasPowerUsed ¶
func (e *MutableEventPayload) GasPowerUsed() uint64
func (*MutableEventPayload) HashToSign ¶
func (e *MutableEventPayload) HashToSign() hash.Hash
func (*MutableEventPayload) MedianTime ¶
func (e *MutableEventPayload) MedianTime() Timestamp
func (*MutableEventPayload) PrevEpochHash ¶
func (*MutableEventPayload) SetCreationTime ¶
func (e *MutableEventPayload) SetCreationTime(v Timestamp)
func (*MutableEventPayload) SetExtra ¶
func (e *MutableEventPayload) SetExtra(v []byte)
func (*MutableEventPayload) SetGasPowerLeft ¶
func (e *MutableEventPayload) SetGasPowerLeft(v GasPowerLeft)
func (*MutableEventPayload) SetGasPowerUsed ¶
func (e *MutableEventPayload) SetGasPowerUsed(v uint64)
func (*MutableEventPayload) SetMedianTime ¶
func (e *MutableEventPayload) SetMedianTime(v Timestamp)
func (*MutableEventPayload) SetPrevEpochHash ¶
func (e *MutableEventPayload) SetPrevEpochHash(v *hash.Hash)
func (*MutableEventPayload) SetSig ¶
func (e *MutableEventPayload) SetSig(v Signature)
func (*MutableEventPayload) SetTxHash ¶
func (e *MutableEventPayload) SetTxHash(v hash.Hash)
func (*MutableEventPayload) SetTxs ¶
func (e *MutableEventPayload) SetTxs(v types.Transactions)
func (*MutableEventPayload) Size ¶
func (e *MutableEventPayload) Size() int
func (*MutableEventPayload) Txs ¶
func (e *MutableEventPayload) Txs() types.Transactions
func (*MutableEventPayload) UnmarshalBinary ¶
func (e *MutableEventPayload) UnmarshalBinary(raw []byte) (err error)
UnmarshalBinary implements encoding.BinaryUnmarshaller interface.
func (*MutableEventPayload) UnmarshalCSER ¶
func (e *MutableEventPayload) UnmarshalCSER(r *cser.Reader) error
type SignedEvent ¶
type SignedEvent struct { Event // contains filtered or unexported fields }
func (*SignedEvent) CreationTime ¶
func (e *SignedEvent) CreationTime() Timestamp
func (*SignedEvent) GasPowerLeft ¶
func (e *SignedEvent) GasPowerLeft() GasPowerLeft
func (*SignedEvent) GasPowerUsed ¶
func (e *SignedEvent) GasPowerUsed() uint64
func (*SignedEvent) MedianTime ¶
func (e *SignedEvent) MedianTime() Timestamp