Documentation ¶
Index ¶
- Constants
- Variables
- func GetHeightFromIterationKey(iterKey []byte) exported.Height
- func GetIterationKey(clientStore sdk.KVStore, height exported.Height) []byte
- func GetProcessedHeight(clientStore sdk.KVStore, height exported.Height) (exported.Height, bool)
- func GetProcessedTime(clientStore sdk.KVStore, height exported.Height) (uint64, bool)
- func IterateConsensusMetadata(store sdk.KVStore, cb func(key, val []byte) bool)
- func IterateConsensusStateAscending(clientStore sdk.KVStore, cb func(height exported.Height) (stop bool))
- func IterationKey(height exported.Height) []byte
- func ProcessedHeightKey(height exported.Height) []byte
- func ProcessedTimeKey(height exported.Height) []byte
- func RegisterInterfaces(registry codectypes.InterfaceRegistry)
- func SetIterationKey(clientStore sdk.KVStore, height exported.Height)
- func SetProcessedHeight(clientStore sdk.KVStore, consHeight, processedHeight exported.Height)
- func SetProcessedTime(clientStore sdk.KVStore, height exported.Height, timeNs uint64)
- type AppModuleBasic
- func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage
- func (AppModuleBasic) GetQueryCmd() *cobra.Command
- func (AppModuleBasic) GetTxCmd() *cobra.Command
- func (AppModuleBasic) Name() string
- func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux)
- func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry)
- func (AppModuleBasic) RegisterLegacyAminoCodec(*codec.LegacyAmino)
- func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error
- type ClientState
- func (cs ClientState) CheckForMisbehaviour(ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, ...) bool
- func (cs ClientState) CheckSubstituteAndUpdateState(ctx sdk.Context, cdc codec.BinaryCodec, ...) error
- func (cs ClientState) ClientType() string
- func (*ClientState) Descriptor() ([]byte, []int)
- func (cs ClientState) ExportMetadata(store sdk.KVStore) []exported.GenesisMetadata
- func (cs ClientState) GetLatestHeight() exported.Height
- func (cs ClientState) GetTimestampAtHeight(ctx sdk.Context, clientStore sdk.KVStore, cdc codec.BinaryCodec, ...) (uint64, error)
- func (cs ClientState) Initialize(ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, ...) error
- func (*ClientState) ProtoMessage()
- func (m *ClientState) Reset()
- func (cs ClientState) Status(ctx sdk.Context, clientStore sdk.KVStore, cdc codec.BinaryCodec) exported.Status
- func (m *ClientState) String() string
- func (cs ClientState) UpdateState(ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, ...) []exported.Height
- func (cs ClientState) UpdateStateOnMisbehaviour(ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, ...)
- func (cs ClientState) Validate() error
- func (cs *ClientState) VerifyClientMessage(ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, ...) error
- func (cs ClientState) VerifyMembership(ctx sdk.Context, clientStore sdk.KVStore, cdc codec.BinaryCodec, ...) error
- func (cs ClientState) VerifyNonMembership(ctx sdk.Context, clientStore sdk.KVStore, cdc codec.BinaryCodec, ...) error
- func (cs ClientState) VerifyUpgradeAndUpdateState(ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, ...) error
- func (m *ClientState) XXX_DiscardUnknown()
- func (m *ClientState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ClientState) XXX_Merge(src proto.Message)
- func (m *ClientState) XXX_Size() int
- func (m *ClientState) XXX_Unmarshal(b []byte) error
- func (cs ClientState) ZeroCustomFields() exported.ClientState
- type ConsensusState
- func GetConsensusState(store sdk.KVStore, cdc codec.BinaryCodec, height exported.Height) (*ConsensusState, bool)
- func GetNextConsensusState(clientStore sdk.KVStore, cdc codec.BinaryCodec, height exported.Height) (*ConsensusState, bool)
- func GetPreviousConsensusState(clientStore sdk.KVStore, cdc codec.BinaryCodec, height exported.Height) (*ConsensusState, bool)
- func (cs ConsensusState) ClientType() string
- func (*ConsensusState) Descriptor() ([]byte, []int)
- func (cs ConsensusState) GetTimestamp() uint64
- func (*ConsensusState) ProtoMessage()
- func (m *ConsensusState) Reset()
- func (m *ConsensusState) String() string
- func (cs ConsensusState) ValidateBasic() error
- func (m *ConsensusState) XXX_DiscardUnknown()
- func (m *ConsensusState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ConsensusState) XXX_Merge(src proto.Message)
- func (m *ConsensusState) XXX_Size() int
- func (m *ConsensusState) XXX_Unmarshal(b []byte) error
- type Header
- func (h Header) ClientType() string
- func (h Header) ConsensusState() *ConsensusState
- func (*Header) Descriptor() ([]byte, []int)
- func (h Header) GetHeight() exported.Height
- func (h Header) GetTime() time.Time
- func (*Header) ProtoMessage()
- func (m *Header) Reset()
- func (m *Header) String() string
- func (h Header) ValidateBasic() error
- func (m *Header) XXX_DiscardUnknown()
- func (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Header) XXX_Merge(src proto.Message)
- func (m *Header) XXX_Size() int
- func (m *Header) XXX_Unmarshal(b []byte) error
- type Misbehaviour
- func (m Misbehaviour) ClientType() string
- func (*Misbehaviour) Descriptor() ([]byte, []int)
- func (m Misbehaviour) GetTime() time.Time
- func (*Misbehaviour) ProtoMessage()
- func (m *Misbehaviour) Reset()
- func (m *Misbehaviour) String() string
- func (m Misbehaviour) ValidateBasic() error
- func (m *Misbehaviour) XXX_DiscardUnknown()
- func (m *Misbehaviour) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Misbehaviour) XXX_Merge(src proto.Message)
- func (m *Misbehaviour) XXX_Size() int
- func (m *Misbehaviour) XXX_Unmarshal(b []byte) error
- type PairKey
- func (*PairKey) Descriptor() ([]byte, []int)
- func (*PairKey) ProtoMessage()
- func (m *PairKey) Reset()
- func (m *PairKey) String() string
- func (m *PairKey) XXX_DiscardUnknown()
- func (m *PairKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PairKey) XXX_Merge(src proto.Message)
- func (m *PairKey) XXX_Size() int
- func (m *PairKey) XXX_Unmarshal(b []byte) error
- type SignedHeader
- func (*SignedHeader) Descriptor() ([]byte, []int)
- func (*SignedHeader) ProtoMessage()
- func (m *SignedHeader) Reset()
- func (m *SignedHeader) String() string
- func (m *SignedHeader) XXX_DiscardUnknown()
- func (m *SignedHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *SignedHeader) XXX_Merge(src proto.Message)
- func (m *SignedHeader) XXX_Size() int
- func (m *SignedHeader) XXX_Unmarshal(b []byte) error
- type ValidatorSet
- func (*ValidatorSet) Descriptor() ([]byte, []int)
- func (*ValidatorSet) ProtoMessage()
- func (m *ValidatorSet) Reset()
- func (m *ValidatorSet) String() string
- func (m *ValidatorSet) XXX_DiscardUnknown()
- func (m *ValidatorSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ValidatorSet) XXX_Merge(src proto.Message)
- func (m *ValidatorSet) XXX_Size() int
- func (m *ValidatorSet) XXX_Unmarshal(b []byte) error
Constants ¶
const ( EpochSize = 50000 BN256Fork = 2350001 IstanbulExtraVanity = 32 // Fixed number of extra-data bytes reserved for validator vanity IstanbulExtraBlsSignature = 64 // Fixed number of extra-data bytes reserved for validator seal on the current block IstanbulExtraSeal = 65 // Fixed number of extra-data bytes reserved for validator seal PublicKeyBytes = 128 )
const KeyIterateConsensusStatePrefix = "iterateConsensusStates"
const (
MAPO string = "61-mapo"
)
const (
ModuleName = "61-mapo"
)
Variables ¶
var ( // todo code replace ErrInvalidClientIdentifier = sdkerrors.Register(ModuleName, 1, "invalid client identifier") ErrInvalidLatestEpoch = sdkerrors.Register(ModuleName, 2, "invalid latest epoch") ErrInvalidEpochSize = sdkerrors.Register(ModuleName, 3, "invalid epoch size") ErrInvalidLatestHeight = sdkerrors.Register(ModuleName, 4, "invalid latest height") ErrInvalidReceipt = sdkerrors.Register(ModuleName, 5, "invalid receipt") ErrNotLastHeaderOfEpoch = sdkerrors.Register(ModuleName, 6, "not the last header of epoch") ErrInvalidHeader = sdkerrors.Register(ModuleName, 7, "invalid header") ErrInvalidIstanbulHeaderExtra = sdkerrors.Register(ModuleName, 8, "invalid istanbul header extra-data") ErrEmptyAggregatedSeal = sdkerrors.Register(ModuleName, 9, "empty aggregated seal") ErrInvalidAggregatedSeal = sdkerrors.Register(ModuleName, 10, "invalid aggregated seal") ErrInsufficientSeals = sdkerrors.Register(ModuleName, 11, "not enough seals to reach quorum") ErrInvalidSignature = sdkerrors.Register(ModuleName, 12, "invalid signature") )
IBC MAPO client sentinel errors
var ( // KeyProcessedTime is appended to consensus state key to store the processed time KeyProcessedTime = []byte("/processedTime") // KeyProcessedHeight is appended to consensus state key to store the processed height KeyProcessedHeight = []byte("/processedHeight") // KeyIteration stores the key mapping to consensus state key for efficient iteration KeyIteration = []byte("/iterationKey") )
Functions ¶
func GetHeightFromIterationKey ¶
GetHeightFromIterationKey takes an iteration key and returns the height that it references
func GetIterationKey ¶
GetIterationKey returns the consensus state key stored under the efficient iteration key. NOTE: This function is currently only used for testing purposes
func GetProcessedHeight ¶
GetProcessedHeight gets the height at which this chain received and processed a MAPO header. This is used to validate that a received packet has passed the block delay period.
func GetProcessedTime ¶
GetProcessedTime gets the time (in nanoseconds) at which this chain received and processed a MAPO header. This is used to validate that a received packet has passed the time delay period.
func IterateConsensusMetadata ¶
IterateConsensusMetadata iterates through the prefix store and applies the callback. If the cb returns true, then iterator will close and stop.
func IterateConsensusStateAscending ¶
func IterateConsensusStateAscending(clientStore sdk.KVStore, cb func(height exported.Height) (stop bool))
IterateConsensusStateAscending iterates through the consensus states in ascending order. It calls the provided callback on each height, until stop=true is returned.
func IterationKey ¶
IterationKey returns the key under which the consensus state key will be stored. The iteration key is a BigEndian representation of the consensus state key to support efficient iteration.
func ProcessedHeightKey ¶
ProcessedHeightKey returns the key under which the processed height will be stored in the client store.
func ProcessedTimeKey ¶
ProcessedTimeKey returns the key under which the processed time will be stored in the client store.
func RegisterInterfaces ¶
func RegisterInterfaces(registry codectypes.InterfaceRegistry)
RegisterInterfaces registers the mapo concrete client-related implementations and interfaces.
func SetIterationKey ¶
SetIterationKey stores the consensus state key under a key that is more efficient for ordered iteration
func SetProcessedHeight ¶
SetProcessedHeight stores the height at which a header was processed and the corresponding consensus state was created. This is useful when validating whether a packet has reached the specified block delay period in the MAPO client's verification functions
func SetProcessedTime ¶
SetProcessedTime stores the time at which a header was processed and the corresponding consensus state was created. This is useful when validating whether a packet has reached the time specified delay period in the MAPO client's verification functions
Types ¶
type AppModuleBasic ¶
type AppModuleBasic struct{}
AppModuleBasic defines the basic application module used by the mapo light client. Only the RegisterInterfaces function needs to be implemented. All other function perform a no-op.
func (AppModuleBasic) DefaultGenesis ¶
func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage
DefaultGenesis performs a no-op. Genesis is not supported for the mapo light client.
func (AppModuleBasic) GetQueryCmd ¶
func (AppModuleBasic) GetQueryCmd() *cobra.Command
GetQueryCmd performs a no-op. Please see the 02-client cli commands.
func (AppModuleBasic) GetTxCmd ¶
func (AppModuleBasic) GetTxCmd() *cobra.Command
GetTxCmd performs a no-op. Please see the 02-client cli commands.
func (AppModuleBasic) RegisterGRPCGatewayRoutes ¶
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux)
RegisterGRPCGatewayRoutes performs a no-op.
func (AppModuleBasic) RegisterInterfaces ¶
func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry)
RegisterInterfaces registers module concrete types into protobuf Any. This allows core IBC to unmarshal mapo light client types.
func (AppModuleBasic) RegisterLegacyAminoCodec ¶
func (AppModuleBasic) RegisterLegacyAminoCodec(*codec.LegacyAmino)
RegisterLegacyAminoCodec performs a no-op. The mapo client does not support amino.
func (AppModuleBasic) ValidateGenesis ¶
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error
ValidateGenesis performs a no-op. Genesis is not supported for the mapo light cilent.
type ClientState ¶
type ClientState struct { Frozen bool `protobuf:"varint,1,opt,name=frozen,proto3" json:"frozen,omitempty"` LatestEpoch uint64 `protobuf:"varint,2,opt,name=latestEpoch,proto3" json:"latestEpoch,omitempty"` EpochSize uint64 `protobuf:"varint,3,opt,name=epochSize,proto3" json:"epochSize,omitempty"` LatestHeight uint64 `protobuf:"varint,4,opt,name=latestHeight,proto3" json:"latestHeight,omitempty"` ClientIdentifier string `protobuf:"bytes,5,opt,name=ClientIdentifier,proto3" json:"ClientIdentifier,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (ClientState) CheckForMisbehaviour ¶
func (cs ClientState) CheckForMisbehaviour(ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, msg exported.ClientMessage) bool
CheckForMisbehaviour detects duplicate height misbehaviour and IBFT time violation misbehaviour in a submitted Header message and verifies the correctness of a submitted Misbehaviour ClientMessage
func (ClientState) CheckSubstituteAndUpdateState ¶
func (cs ClientState) CheckSubstituteAndUpdateState( ctx sdk.Context, cdc codec.BinaryCodec, subjectClientStore, substituteClientStore sdk.KVStore, substituteClient exported.ClientState, ) error
CheckSubstituteAndUpdateState will try to update the client with the state of the substitute.
AllowUpdateAfterMisbehaviour and AllowUpdateAfterExpiry have been deprecated. Please see ADR 026 for more information.
The following must always be true:
- The substitute client is the same type as the subject client
- The subject and substitute client states match in all parameters (expect frozen height, latest height, and chain-id)
In case 1) before updating the client, the client will be unfrozen by resetting the FrozenHeight to the zero Height.
func (*ClientState) Descriptor ¶
func (*ClientState) Descriptor() ([]byte, []int)
func (ClientState) ExportMetadata ¶
func (cs ClientState) ExportMetadata(store sdk.KVStore) []exported.GenesisMetadata
ExportMetadata exports all the consensus metadata in the client store so they can be included in clients genesis and imported by a ClientKeeper
func (ClientState) GetLatestHeight ¶
func (cs ClientState) GetLatestHeight() exported.Height
GetLatestHeight returns latest block height.
func (ClientState) GetTimestampAtHeight ¶
func (cs ClientState) GetTimestampAtHeight( ctx sdk.Context, clientStore sdk.KVStore, cdc codec.BinaryCodec, height exported.Height, ) (uint64, error)
GetTimestampAtHeight returns the timestamp in nanoseconds of the consensus state at the given height.
func (ClientState) Initialize ¶
func (cs ClientState) Initialize(ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, consState exported.ConsensusState) error
Initialize checks that the initial consensus state is an 61-mapo consensus state and sets the client state, consensus state and associated metadata in the provided client store.
func (*ClientState) ProtoMessage ¶
func (*ClientState) ProtoMessage()
func (*ClientState) Reset ¶
func (m *ClientState) Reset()
func (ClientState) Status ¶
func (cs ClientState) Status( ctx sdk.Context, clientStore sdk.KVStore, cdc codec.BinaryCodec, ) exported.Status
Status returns the status of the mapo client. The client may be: - Active: FrozenHeight is zero and client is not expired - Frozen: Frozen Height is not zero - Expired: the latest consensus state timestamp + trusting period <= current time
A frozen client will become expired, so the Frozen status has higher precedence.
func (*ClientState) String ¶
func (m *ClientState) String() string
func (ClientState) UpdateState ¶
func (cs ClientState) UpdateState(ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, clientMsg exported.ClientMessage) []exported.Height
UpdateState may be used to either create a consensus state for: - a future height greater than the latest client state height - a past height that was skipped during bisection If we are updating to a past height, a consensus state is created for that height to be persisted in client store If we are updating to a future height, the consensus state is created and the client state is updated to reflect the new latest height A list containing the updated consensus height is returned. UpdateState must only be used to update within a single revision, thus header revision number and trusted height's revision number must be the same. To update to a new revision, use a separate upgrade path UpdateState will prune the oldest consensus state if it is expired.
func (ClientState) UpdateStateOnMisbehaviour ¶
func (cs ClientState) UpdateStateOnMisbehaviour(ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, _ exported.ClientMessage)
UpdateStateOnMisbehaviour updates state upon misbehaviour, freezing the ClientState. This method should only be called when misbehaviour is detected as it does not perform any misbehaviour checks.
func (ClientState) Validate ¶
func (cs ClientState) Validate() error
Validate performs a basic validation of the client state fields.
func (*ClientState) VerifyClientMessage ¶
func (cs *ClientState) VerifyClientMessage( ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, clientMsg exported.ClientMessage, ) error
VerifyClientMessage checks if the clientMessage is of type Header or Misbehaviour and verifies the message
func (ClientState) VerifyMembership ¶
func (cs ClientState) VerifyMembership( ctx sdk.Context, clientStore sdk.KVStore, cdc codec.BinaryCodec, height exported.Height, delayTimePeriod uint64, delayBlockPeriod uint64, proof []byte, path exported.Path, value []byte, ) error
VerifyMembership is a generic proof verification method which verifies a proof of the existence of a value at a given CommitmentPath at the specified height. The caller is expected to construct the full CommitmentPath from a CommitmentPrefix and a standardized path (as defined in ICS 24). If a zero proof height is passed in, it will fail to retrieve the associated consensus state.
func (ClientState) VerifyNonMembership ¶
func (cs ClientState) VerifyNonMembership( ctx sdk.Context, clientStore sdk.KVStore, cdc codec.BinaryCodec, height exported.Height, delayTimePeriod uint64, delayBlockPeriod uint64, proof []byte, path exported.Path, ) error
VerifyNonMembership is a generic proof verification method which verifies the absence of a given CommitmentPath at a specified height. The caller is expected to construct the full CommitmentPath from a CommitmentPrefix and a standardized path (as defined in ICS 24). If a zero proof height is passed in, it will fail to retrieve the associated consensus state.
func (ClientState) VerifyUpgradeAndUpdateState ¶
func (cs ClientState) VerifyUpgradeAndUpdateState( ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, upgradedClient exported.ClientState, upgradedConsState exported.ConsensusState, proofUpgradeClient, proofUpgradeConsState []byte, ) error
VerifyUpgradeAndUpdateState checks if the upgraded client has been committed by the current client It will zero out all client-specific fields (e.g. TrustingPeriod) and verify all data in client state that must be the same across all valid Tendermint clients for the new chain. VerifyUpgrade will return an error if: - the upgradedClient is not a Tendermint ClientState - the latest height of the client state does not have the same revision number or has a greater height than the committed client.
- the height of upgraded client is not greater than that of current client
- the latest height of the new client does not match or is greater than the height in committed client
- any Tendermint chain specified parameter in upgraded client such as ChainID, UnbondingPeriod, and ProofSpecs do not match parameters set by committed client
func (*ClientState) XXX_DiscardUnknown ¶
func (m *ClientState) XXX_DiscardUnknown()
func (*ClientState) XXX_Marshal ¶
func (m *ClientState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ClientState) XXX_Merge ¶
func (m *ClientState) XXX_Merge(src proto.Message)
func (*ClientState) XXX_Size ¶
func (m *ClientState) XXX_Size() int
func (*ClientState) XXX_Unmarshal ¶
func (m *ClientState) XXX_Unmarshal(b []byte) error
func (ClientState) ZeroCustomFields ¶
func (cs ClientState) ZeroCustomFields() exported.ClientState
ZeroCustomFields returns a ClientState that is a copy of the current ClientState with all client customizable fields zeroed out
type ConsensusState ¶
type ConsensusState struct { Epoch uint64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` Validators *ValidatorSet `protobuf:"bytes,2,opt,name=validators,proto3" json:"validators,omitempty"` CommitmentRoot []byte `protobuf:"bytes,3,opt,name=commitmentRoot,proto3" json:"commitmentRoot,omitempty"` Timestamp time.Time `protobuf:"bytes,4,opt,name=timestamp,proto3,stdtime" json:"timestamp"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func GetConsensusState ¶
func GetConsensusState(store sdk.KVStore, cdc codec.BinaryCodec, height exported.Height) (*ConsensusState, bool)
GetConsensusState retrieves the consensus state from the client prefixed store. If the ConsensusState does not exist in state for the provided height a nil value and false boolean flag is returned
func GetNextConsensusState ¶
func GetNextConsensusState(clientStore sdk.KVStore, cdc codec.BinaryCodec, height exported.Height) (*ConsensusState, bool)
GetNextConsensusState returns the lowest consensus state that is larger than the given height. The Iterator returns a storetypes.Iterator which iterates from start (inclusive) to end (exclusive). If the starting height exists in store, we need to call iterator.Next() to get the next consenus state. Otherwise, the iterator is already at the next consensus state so we can call iterator.Value() immediately.
func GetPreviousConsensusState ¶
func GetPreviousConsensusState(clientStore sdk.KVStore, cdc codec.BinaryCodec, height exported.Height) (*ConsensusState, bool)
GetPreviousConsensusState returns the highest consensus state that is lower than the given height. The Iterator returns a storetypes.Iterator which iterates from the end (exclusive) to start (inclusive). Thus to get previous consensus state we call iterator.Value() immediately.
func (ConsensusState) ClientType ¶
func (cs ConsensusState) ClientType() string
ClientType returns MAPO
func (*ConsensusState) Descriptor ¶
func (*ConsensusState) Descriptor() ([]byte, []int)
func (ConsensusState) GetTimestamp ¶
func (cs ConsensusState) GetTimestamp() uint64
GetTimestamp returns block time in nanoseconds of the header that created consensus state
func (*ConsensusState) ProtoMessage ¶
func (*ConsensusState) ProtoMessage()
func (*ConsensusState) Reset ¶
func (m *ConsensusState) Reset()
func (*ConsensusState) String ¶
func (m *ConsensusState) String() string
func (ConsensusState) ValidateBasic ¶
func (cs ConsensusState) ValidateBasic() error
ValidateBasic defines a basic validation for the IBFT consensus state.
func (*ConsensusState) XXX_DiscardUnknown ¶
func (m *ConsensusState) XXX_DiscardUnknown()
func (*ConsensusState) XXX_Marshal ¶
func (m *ConsensusState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ConsensusState) XXX_Merge ¶
func (m *ConsensusState) XXX_Merge(src proto.Message)
func (*ConsensusState) XXX_Size ¶
func (m *ConsensusState) XXX_Size() int
func (*ConsensusState) XXX_Unmarshal ¶
func (m *ConsensusState) XXX_Unmarshal(b []byte) error
type Header ¶
type Header struct { *SignedHeader `protobuf:"bytes,1,opt,name=signedHeader,proto3,embedded=signedHeader" json:"signedHeader,omitempty"` CommitmentRoot []byte `protobuf:"bytes,2,opt,name=commitmentRoot,proto3" json:"commitmentRoot,omitempty"` Identifier string `protobuf:"bytes,3,opt,name=identifier,proto3" json:"identifier,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (Header) ClientType ¶
ClientType defines that the Header is a MAPO consensus algorithm
func (Header) ConsensusState ¶
func (h Header) ConsensusState() *ConsensusState
ConsensusState returns the updated consensus state associated with the header
func (*Header) Descriptor ¶
func (Header) GetHeight ¶
GetHeight returns the current height. It returns 0 if the MAPO header is nil. NOTE: the header.Header is checked to be non nil in ValidateBasic.
func (Header) GetTime ¶
GetTime returns the current block timestamp. It returns a zero time if the MAPO header is nil. NOTE: the header.Header is checked to be non nil in ValidateBasic.
func (*Header) ProtoMessage ¶
func (*Header) ProtoMessage()
func (*Header) XXX_DiscardUnknown ¶
func (m *Header) XXX_DiscardUnknown()
func (*Header) XXX_Marshal ¶
func (*Header) XXX_Unmarshal ¶
type Misbehaviour ¶
type Misbehaviour struct { Header1 *Header `protobuf:"bytes,1,opt,name=header1,proto3" json:"header1,omitempty"` Header2 *Header `protobuf:"bytes,2,opt,name=header2,proto3" json:"header2,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (Misbehaviour) ClientType ¶
func (m Misbehaviour) ClientType() string
ClientType is Tendermint light client
func (*Misbehaviour) Descriptor ¶
func (*Misbehaviour) Descriptor() ([]byte, []int)
func (Misbehaviour) GetTime ¶
func (m Misbehaviour) GetTime() time.Time
GetTime returns the timestamp at which misbehaviour occurred. It uses the maximum value from both headers to prevent producing an invalid header outside of the misbehaviour age range.
func (*Misbehaviour) ProtoMessage ¶
func (*Misbehaviour) ProtoMessage()
func (*Misbehaviour) Reset ¶
func (m *Misbehaviour) Reset()
func (*Misbehaviour) String ¶
func (m *Misbehaviour) String() string
func (Misbehaviour) ValidateBasic ¶
func (m Misbehaviour) ValidateBasic() error
ValidateBasic implements Misbehaviour interface
func (*Misbehaviour) XXX_DiscardUnknown ¶
func (m *Misbehaviour) XXX_DiscardUnknown()
func (*Misbehaviour) XXX_Marshal ¶
func (m *Misbehaviour) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*Misbehaviour) XXX_Merge ¶
func (m *Misbehaviour) XXX_Merge(src proto.Message)
func (*Misbehaviour) XXX_Size ¶
func (m *Misbehaviour) XXX_Size() int
func (*Misbehaviour) XXX_Unmarshal ¶
func (m *Misbehaviour) XXX_Unmarshal(b []byte) error
type PairKey ¶
type PairKey struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` G2PubKey []byte `protobuf:"bytes,2,opt,name=G2PubKey,proto3" json:"G2PubKey,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*PairKey) Descriptor ¶
func (*PairKey) ProtoMessage ¶
func (*PairKey) ProtoMessage()
func (*PairKey) XXX_DiscardUnknown ¶
func (m *PairKey) XXX_DiscardUnknown()
func (*PairKey) XXX_Marshal ¶
func (*PairKey) XXX_Unmarshal ¶
type SignedHeader ¶
type SignedHeader struct { ParentHash []byte `protobuf:"bytes,1,opt,name=parentHash,proto3" json:"parentHash,omitempty"` Root []byte `protobuf:"bytes,2,opt,name=root,proto3" json:"root,omitempty"` TxRoot []byte `protobuf:"bytes,3,opt,name=txRoot,proto3" json:"txRoot,omitempty"` ReceiptRoot []byte `protobuf:"bytes,4,opt,name=receiptRoot,proto3" json:"receiptRoot,omitempty"` Timestamp uint64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"` GasLimit uint64 `protobuf:"varint,6,opt,name=gasLimit,proto3" json:"gasLimit,omitempty"` GasUsed uint64 `protobuf:"varint,7,opt,name=gasUsed,proto3" json:"gasUsed,omitempty"` Nonce uint64 `protobuf:"varint,8,opt,name=nonce,proto3" json:"nonce,omitempty"` Bloom []byte `protobuf:"bytes,9,opt,name=bloom,proto3" json:"bloom,omitempty"` ExtraData []byte `protobuf:"bytes,10,opt,name=extraData,proto3" json:"extraData,omitempty"` MixDigest []byte `protobuf:"bytes,11,opt,name=mixDigest,proto3" json:"mixDigest,omitempty"` BaseFee uint64 `protobuf:"varint,12,opt,name=baseFee,proto3" json:"baseFee,omitempty"` Number uint64 `protobuf:"varint,13,opt,name=number,proto3" json:"number,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*SignedHeader) Descriptor ¶
func (*SignedHeader) Descriptor() ([]byte, []int)
func (*SignedHeader) ProtoMessage ¶
func (*SignedHeader) ProtoMessage()
func (*SignedHeader) Reset ¶
func (m *SignedHeader) Reset()
func (*SignedHeader) String ¶
func (m *SignedHeader) String() string
func (*SignedHeader) XXX_DiscardUnknown ¶
func (m *SignedHeader) XXX_DiscardUnknown()
func (*SignedHeader) XXX_Marshal ¶
func (m *SignedHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*SignedHeader) XXX_Merge ¶
func (m *SignedHeader) XXX_Merge(src proto.Message)
func (*SignedHeader) XXX_Size ¶
func (m *SignedHeader) XXX_Size() int
func (*SignedHeader) XXX_Unmarshal ¶
func (m *SignedHeader) XXX_Unmarshal(b []byte) error
type ValidatorSet ¶
type ValidatorSet struct { PairKeys []*PairKey `protobuf:"bytes,1,rep,name=pairKeys,proto3" json:"pairKeys,omitempty"` Weights []uint64 `protobuf:"varint,2,rep,packed,name=weights,proto3" json:"weights,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*ValidatorSet) Descriptor ¶
func (*ValidatorSet) Descriptor() ([]byte, []int)
func (*ValidatorSet) ProtoMessage ¶
func (*ValidatorSet) ProtoMessage()
func (*ValidatorSet) Reset ¶
func (m *ValidatorSet) Reset()
func (*ValidatorSet) String ¶
func (m *ValidatorSet) String() string
func (*ValidatorSet) XXX_DiscardUnknown ¶
func (m *ValidatorSet) XXX_DiscardUnknown()
func (*ValidatorSet) XXX_Marshal ¶
func (m *ValidatorSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ValidatorSet) XXX_Merge ¶
func (m *ValidatorSet) XXX_Merge(src proto.Message)
func (*ValidatorSet) XXX_Size ¶
func (m *ValidatorSet) XXX_Size() int
func (*ValidatorSet) XXX_Unmarshal ¶
func (m *ValidatorSet) XXX_Unmarshal(b []byte) error