Documentation ¶
Index ¶
- Constants
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- type AttestationHandler
- type Keeper
- func (k Keeper) Attest(ctx sdk.Context, proposal types.BtcProposal, valAddr sdk.ValAddress, ...) (*types.Attestation, error)
- func (k Keeper) CheckOrchestratorValidatorInSet(ctx sdk.Context, orchestrator string) error
- func (k Keeper) ClaimHandlerCommon(ctx sdk.Context, msgAny *codectypes.Any, valAddr sdk.ValAddress, ...) error
- func (k Keeper) DelegateKeysAll(goCtx context.Context, req *types.QueryDelegateKeysAllRequest) (*types.QueryDelegateKeysAllResponse, error)
- func (k Keeper) DelegateKeysByBtcOracleAddress(goCtx context.Context, req *types.QueryDelegateKeysByBtcOracleAddressRequest) (*types.QueryDelegateKeysByBtcOracleAddressResponse, error)
- func (k Keeper) GetAttestation(ctx sdk.Context, height uint64, proposalHash []byte) *types.Attestation
- func (k Keeper) GetAttestationMapping(ctx sdk.Context) (attestationMapping map[uint64][]types.Attestation, orderedKeys []uint64)
- func (k Keeper) GetAttestations(goCtx context.Context, req *types.QueryAttestationsRequest) (*types.QueryAttestationsResponse, error)
- func (k Keeper) GetBtcPublicKeyByValidator(ctx sdk.Context, validator sdk.ValAddress) (btcPublicKey *types.BtcPublicKey, found bool)
- func (k Keeper) GetDelegateKeys(ctx sdk.Context) ([]types.MsgSetDelegateAddresses, error)
- func (k Keeper) GetLastObservedBlockHeight(ctx sdk.Context) uint64
- func (k Keeper) GetOrchestratorValidator(ctx sdk.Context, orch sdk.AccAddress) (validator stakingtypes.Validator, found bool)
- func (k Keeper) GetParams(ctx sdk.Context) types.Params
- func (k Keeper) GetSweepProposalAttestationsForBtcSweepTx(ctx sdk.Context, txHash string) (types.Attestation, error)
- func (k Keeper) IterateAttestations(ctx sdk.Context, reverse bool, cb func([]byte, types.Attestation) bool)
- func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) SetAttestation(ctx sdk.Context, height uint64, proposalHash []byte, att *types.Attestation)
- func (k Keeper) SetBtcPublicKeyForValidator(ctx sdk.Context, validator sdk.ValAddress, btcPk types.BtcPublicKey) ([]byte, error)
- func (k Keeper) SetLastBlockHeightByValidator(ctx sdk.Context, validator sdk.ValAddress, nonce uint64)
- func (k Keeper) SetOrchestratorValidator(ctx sdk.Context, val sdk.ValAddress, orch sdk.AccAddress)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) TryAttestation(ctx sdk.Context, att *types.Attestation)
- func (k Keeper) UnpackAttestationProposal(att *types.Attestation) (types.BtcProposal, error)
- func (k Keeper) ValidateMembers()
Constants ¶
const QUERY_ATTESTATIONS_LIMIT uint64 = 1000
Variables ¶
This section is empty.
Functions ¶
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.
Types ¶
type AttestationHandler ¶
type AttestationHandler struct {
// contains filtered or unexported fields
}
AttestationHandler processes `observed` Attestations
func (AttestationHandler) Handle ¶
func (a AttestationHandler) Handle(ctx sdk.Context, att types.Attestation, proposal types.BtcProposal) error
Handle is the entry point for Attestation processing, only attestations with sufficient validator submissions should be processed through this function, solidifying their effect in chain state
func (AttestationHandler) ValidateMembers ¶
func (a AttestationHandler) ValidateMembers()
Check for nil members
type Keeper ¶
type Keeper struct { // NOTE: If you add anything to this struct, add a nil check to ValidateMembers below! StakingKeeper *stakingkeeper.Keeper VoltKeeper *voltkeeper.Keeper AttestationHandler interface { Handle(sdk.Context, types.Attestation, types.BtcProposal) error } // contains filtered or unexported fields }
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeKey, memKey sdk.StoreKey, ps paramtypes.Subspace, stakingKeeper *stakingkeeper.Keeper, accKeeper *authkeeper.AccountKeeper, bankKeeper *bankkeeper.BaseKeeper, voltKeeper *voltkeeper.Keeper, ) *Keeper
func (Keeper) Attest ¶
func (k Keeper) Attest( ctx sdk.Context, proposal types.BtcProposal, valAddr sdk.ValAddress, anyProposal *codectypes.Any, ) (*types.Attestation, error)
TODO-JT: carefully look at atomicity of this function
func (Keeper) CheckOrchestratorValidatorInSet ¶
checkOrchestratorValidatorInSet checks that the orchestrator refers to a validator that is currently in the set
func (Keeper) ClaimHandlerCommon ¶
func (k Keeper) ClaimHandlerCommon(ctx sdk.Context, msgAny *codectypes.Any, valAddr sdk.ValAddress, msg types.BtcProposal) error
claimHandlerCommon is an internal function that provides common code for processing claims once they are translated from the message to the Ethereum claim interface
func (Keeper) DelegateKeysAll ¶
func (k Keeper) DelegateKeysAll(goCtx context.Context, req *types.QueryDelegateKeysAllRequest) (*types.QueryDelegateKeysAllResponse, error)
func (Keeper) DelegateKeysByBtcOracleAddress ¶
func (k Keeper) DelegateKeysByBtcOracleAddress(goCtx context.Context, req *types.QueryDelegateKeysByBtcOracleAddressRequest) (*types.QueryDelegateKeysByBtcOracleAddressResponse, error)
func (Keeper) GetAttestation ¶
func (k Keeper) GetAttestation(ctx sdk.Context, height uint64, proposalHash []byte) *types.Attestation
GetAttestation return an attestation given a btc block height
func (Keeper) GetAttestationMapping ¶
func (k Keeper) GetAttestationMapping(ctx sdk.Context) (attestationMapping map[uint64][]types.Attestation, orderedKeys []uint64)
GetAttestationMapping returns a mapping of eventnonce -> attestations at that nonce it also returns a pre-sorted array of the keys, this assists callers of this function by providing a deterministic iteration order. You should always iterate over ordered keys if you are iterating this map at all.
func (Keeper) GetAttestations ¶
func (k Keeper) GetAttestations(goCtx context.Context, req *types.QueryAttestationsRequest) (*types.QueryAttestationsResponse, error)
func (Keeper) GetBtcPublicKeyByValidator ¶
func (k Keeper) GetBtcPublicKeyByValidator(ctx sdk.Context, validator sdk.ValAddress) (btcPublicKey *types.BtcPublicKey, found bool)
GetBtcAddressByValidator returns the btc public key for a given validator
func (Keeper) GetDelegateKeys ¶
GetDelegateKeys iterates both the BtcPublicKey and Orchestrator address indexes to produce a vector of MsgSetOrchestratorAddress entires containing all the delgate keys for state export / import. This may seem at first glance to be excessively complicated, why not combine the BtcPublicKey and Orchestrator address indexes and simply iterate one thing? The answer is that even though we set the BTC Public Key and Orchestrator address in the same place we use them differently we always go from Orchestrator address to Validator address and from validator address to BTC Public Key we want to keep looking up the validator address for various reasons, so a direct Orchestrator to BTC Public Key mapping will mean having to keep two of the same data around just to provide lookups.
For the time being this will serve
func (Keeper) GetLastObservedBlockHeight ¶
GetLastObservedBlockHeight returns the latest observed event nonce
func (Keeper) GetOrchestratorValidator ¶
func (k Keeper) GetOrchestratorValidator(ctx sdk.Context, orch sdk.AccAddress) (validator stakingtypes.Validator, found bool)
GetOrchestratorValidator returns the validator key associated with an orchestrator key
func (Keeper) GetSweepProposalAttestationsForBtcSweepTx ¶
func (k Keeper) GetSweepProposalAttestationsForBtcSweepTx(ctx sdk.Context, txHash string) (types.Attestation, error)
GetSweepProposalAttestationsForBtcSweepTx finds all attestations for a given given txHash and txHash found in btcSweepTx
func (Keeper) IterateAttestations ¶
func (k Keeper) IterateAttestations(ctx sdk.Context, reverse bool, cb func([]byte, types.Attestation) bool)
IterateAttestations iterates through all attestations
func (Keeper) Params ¶
func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
func (Keeper) SetAttestation ¶
func (k Keeper) SetAttestation(ctx sdk.Context, height uint64, proposalHash []byte, att *types.Attestation)
SetAttestation sets the attestation in the store
func (Keeper) SetBtcPublicKeyForValidator ¶
func (k Keeper) SetBtcPublicKeyForValidator(ctx sdk.Context, validator sdk.ValAddress, btcPk types.BtcPublicKey) ([]byte, error)
SetBtcPublicKeyForValidator sets the btc public key for a given validator
func (Keeper) SetLastBlockHeightByValidator ¶
func (k Keeper) SetLastBlockHeightByValidator(ctx sdk.Context, validator sdk.ValAddress, nonce uint64)
setLastEventNonceByValidator sets the latest event nonce for a give validator
func (Keeper) SetOrchestratorValidator ¶
func (k Keeper) SetOrchestratorValidator(ctx sdk.Context, val sdk.ValAddress, orch sdk.AccAddress)
SetOrchestratorValidator sets the Orchestrator key for a given validator
func (Keeper) TryAttestation ¶
func (k Keeper) TryAttestation(ctx sdk.Context, att *types.Attestation)
TryAttestation checks if an attestation has enough votes to be applied to the consensus state and has not already been marked Observed, then calls processAttestation to actually apply it to the state, and then marks it Observed and emits an event.
func (Keeper) UnpackAttestationProposal ¶
func (k Keeper) UnpackAttestationProposal(att *types.Attestation) (types.BtcProposal, error)
Source Files ¶
- attestation.go
- attestation_handler.go
- grpc_query.go
- grpc_query_attestations.go
- grpc_query_delegate_keys_all.go
- grpc_query_delegate_keys_by_btc_oracle_address.go
- grpc_query_params.go
- keeper.go
- keeper_delegate_key.go
- msg_server.go
- msg_server_seen_btc_chain_tip.go
- msg_server_set_delegate_addresses.go
- params.go