From 001ef1ac38b003cfb2fd39a1c5be9e6b2e339ec3 Mon Sep 17 00:00:00 2001 From: Runchao Han Date: Fri, 19 Jan 2024 10:45:51 +1100 Subject: [PATCH] doc: doc for `x/finality` module (#190) --- client/docs/swagger-ui/swagger.yaml | 80 +++++ proto/babylon/finality/v1/finality.proto | 4 +- proto/babylon/finality/v1/params.proto | 2 +- proto/babylon/finality/v1/tx.proto | 6 +- x/btcstaking/README.md | 30 +- x/finality/README.md | 378 +++++++++++++++++++++++ x/finality/keeper/msg_server.go | 2 +- x/finality/types/finality.pb.go | 4 +- x/finality/types/params.pb.go | 2 +- x/finality/types/tx.pb.go | 4 +- 10 files changed, 486 insertions(+), 26 deletions(-) create mode 100644 x/finality/README.md diff --git a/client/docs/swagger-ui/swagger.yaml b/client/docs/swagger-ui/swagger.yaml index e05ecb9c3..62e8356b9 100644 --- a/client/docs/swagger-ui/swagger.yaml +++ b/client/docs/swagger-ui/swagger.yaml @@ -1148,6 +1148,56 @@ paths: type: boolean tags: - Query + /babylon/btclightclient/v1/params: + get: + summary: Params queries the parameters of the module. + operationId: BtcLightClientParams + responses: + '200': + description: A successful response. + schema: + type: object + properties: + params: + description: params holds all the parameters of this module. + type: object + properties: + insert_headers_allow_list: + type: array + items: + type: string + title: >- + List of addresses which are allowed to insert headers to + btc light client + + if the list is empty, any address can insert headers + description: >- + QueryParamsResponse is the response type for the Query/Params RPC + method. + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + tags: + - Query /babylon/btclightclient/v1/tip: get: summary: Tip return best header on canonical chain @@ -10561,6 +10611,19 @@ definitions: - Total work spent on the header. This is the sum of the work corresponding to the header Bits field and the total work of the header. + babylon.btclightclient.v1.Params: + type: object + properties: + insert_headers_allow_list: + type: array + items: + type: string + title: >- + List of addresses which are allowed to insert headers to btc light + client + + if the list is empty, any address can insert headers + description: Params defines the parameters for the module. babylon.btclightclient.v1.QueryBaseHeaderResponse: type: object properties: @@ -10715,6 +10778,23 @@ definitions: description: >- QueryMainChainResponse is response type for the Query/MainChain RPC method. + babylon.btclightclient.v1.QueryParamsResponse: + type: object + properties: + params: + description: params holds all the parameters of this module. + type: object + properties: + insert_headers_allow_list: + type: array + items: + type: string + title: >- + List of addresses which are allowed to insert headers to btc light + client + + if the list is empty, any address can insert headers + description: QueryParamsResponse is the response type for the Query/Params RPC method. babylon.btclightclient.v1.QueryTipResponse: type: object properties: diff --git a/proto/babylon/finality/v1/finality.proto b/proto/babylon/finality/v1/finality.proto index f0901c24b..5f2a3d159 100644 --- a/proto/babylon/finality/v1/finality.proto +++ b/proto/babylon/finality/v1/finality.proto @@ -5,7 +5,7 @@ option go_package = "github.com/babylonchain/babylon/x/finality/types"; import "gogoproto/gogo.proto"; -// IndexedBlock is the block with some indexed info +// IndexedBlock is the necessary metadata and finalization status of a block message IndexedBlock { // height is the height of the block uint64 height = 1; @@ -19,7 +19,7 @@ message IndexedBlock { // Evidence is the evidence that a finality provider has signed finality // signatures with correct public randomness on two conflicting Babylon headers message Evidence { - // fp_btc_pk is the BTC Pk of the finality provider that casts this vote + // fp_btc_pk is the BTC PK of the finality provider that casts this vote bytes fp_btc_pk = 1 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BIP340PubKey" ]; // block_height is the height of the conflicting blocks uint64 block_height = 2; diff --git a/proto/babylon/finality/v1/params.proto b/proto/babylon/finality/v1/params.proto index 137e8cd51..c5dce2cc9 100644 --- a/proto/babylon/finality/v1/params.proto +++ b/proto/babylon/finality/v1/params.proto @@ -9,7 +9,7 @@ option go_package = "github.com/babylonchain/babylon/x/finality/types"; message Params { option (gogoproto.goproto_stringer) = false; - // min_pub_rand is the minimum number of public randomoness each + // min_pub_rand is the minimum number of public randomness each // message should commit uint64 min_pub_rand = 1; } diff --git a/proto/babylon/finality/v1/tx.proto b/proto/babylon/finality/v1/tx.proto index d683f872c..11a55fe31 100644 --- a/proto/babylon/finality/v1/tx.proto +++ b/proto/babylon/finality/v1/tx.proto @@ -21,12 +21,12 @@ service Msg { rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } -// MsgAddFinalitySig defines a message for adding a vote +// MsgAddFinalitySig defines a message for adding a finality vote message MsgAddFinalitySig { option (cosmos.msg.v1.signer) = "signer"; string signer = 1; - // fp_btc_pk is the BTC Pk of the finality provider that casts this vote + // fp_btc_pk is the BTC PK of the finality provider that casts this vote bytes fp_btc_pk = 2 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BIP340PubKey" ]; // block_height is the height of the voted block uint64 block_height = 3; @@ -46,7 +46,7 @@ message MsgCommitPubRandList { option (cosmos.msg.v1.signer) = "signer"; string signer = 1; - // fp_btc_pk is the BTC Pk of the finality provider that commits the public randomness + // fp_btc_pk is the BTC PK of the finality provider that commits the public randomness bytes fp_btc_pk = 2 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BIP340PubKey" ]; // start_height is the start block height of the list of public randomness uint64 start_height = 3; diff --git a/x/btcstaking/README.md b/x/btcstaking/README.md index 070aa1edd..32afa65cb 100644 --- a/x/btcstaking/README.md +++ b/x/btcstaking/README.md @@ -30,6 +30,8 @@ providers and BTC delegations under them. This includes: - [Events](#events) - [Queries](#queries) + + ## Concepts Babylon's Bitcoin Staking protocol allows bitcoin holders to *trustlessly* stake @@ -130,14 +132,14 @@ message FinalityProvider { ### BTC delegations -The BTC delegation storage at `x/btcstaking/keeper/btc_delegations.go` maintains -all BTC delegations. The key is the staking transaction hash corresponding to -the BTC delegation, and the value is a `BTCDelegation` object. The -`BTCDelegation` [structure](../../proto/babylon/btcstaking/v1/btcstaking.proto) -includes information of a BTC delegation and a structure `BTCUndelegation` that -includes information of its early unbonding path. The staking transaction's hash -uniquely identifies a `BTCDelegation` as creating a BTC delegation requires the -staker to submit a staking transaction to Bitcoin. +The [BTC delegation storage](./keeper/btc_delegations.go) maintains all BTC +delegations. The key is the staking transaction hash corresponding to the BTC +delegation, and the value is a `BTCDelegation` object. The `BTCDelegation` +[structure](../../proto/babylon/btcstaking/v1/btcstaking.proto) includes +information of a BTC delegation and a structure `BTCUndelegation` that includes +information of its early unbonding path. The staking transaction's hash uniquely +identifies a `BTCDelegation` as creating a BTC delegation requires the staker to +submit a staking transaction to Bitcoin. ```protobuf @@ -223,9 +225,9 @@ message BTCUndelegation { The [BTC delegation index storage](./keeper/btc_delegators.go) maintains an index between the BTC delegator and its BTC delegations. The key is the BTC delegator's Bitcoin secp256k1 public key in BIP-340 format, and the value is a -`BTCDelegatorDelegationIndex` object containing staking transaction hashes of -the delegator's BTC delegations. The `BTCDelegatorDelegationIndex` is defined at -`proto/babylon/btcstaking/v1/btcstaking.proto`. +`BTCDelegatorDelegationIndex` +[object](../../proto/babylon/btcstaking/v1/btcstaking.proto) that contains +staking transaction hashes of the delegator's BTC delegations. ```protobuf // BTCDelegatorDelegationIndex is a list of staking tx hashes of BTC delegations from the same delegator. @@ -610,7 +612,7 @@ message SelectiveSlashingEvidence { ## Queries -The BTC staking module provides a set of queries about the status of -checkpointed consumer chains, listed at -[docs.babylonchain.io](https://docs.babylonchain.io/docs/developer-guides/grpcrestapi#tag/ZoneConcierge). +The BTC staking module provides a set of queries about the status of finality +providers and BTC delegations, listed at +[docs.babylonchain.io](https://docs.babylonchain.io/docs/developer-guides/grpcrestapi#tag/BTCStaking). diff --git a/x/finality/README.md b/x/finality/README.md new file mode 100644 index 000000000..4e1231781 --- /dev/null +++ b/x/finality/README.md @@ -0,0 +1,378 @@ +# Finality + +Babylon's BTC Staking protocol introduces an additional consensus round on +blocks produced by CometBFT, called the finality round. The participants of this +round are referred as finality providers and their voting power stems from +staked bitcoins delegated to them. + +The Finality module is responsible for handling finality votes, maintaining the +finalization status of blocks, and identifying equivocating finality providers +in the finalization rounds. This includes: + +- handling requests for committing EOTS public randomness from finality + providers; +- handling requests for submitting finality votes from finality providers; +- maintaining the finalization status of blocks; and +- maintaining equivocation evidences of culpable finality providers. + +## Table of contents + +- [Table of contents](#table-of-contents) +- [Concepts](#concepts) +- [States](#states) + - [Parameters](#parameters) + - [Public randomness](#public-randomness) + - [Finality votes](#finality-votes) + - [Indexed blocks with finalization status](#indexed-blocks-with-finalization-status) + - [Equivocation evidences](#equivocation-evidences) +- [Messages](#messages) + - [MsgCommitPubRandList](#msgcommitpubrandlist) + - [MsgAddFinalitySig](#msgaddfinalitysig) + - [MsgUpdateParams](#msgupdateparams) +- [EndBlocker](#endblocker) +- [Events](#events) +- [Queries](#queries) + +## Concepts + + +**Babylon Bitcoin Staking.** Babylon's Bitcoin Staking protocol allows bitcoin +holders to *trustlessly* stake their bitcoins, in order to provide economic +security to the Babylon chain and other Proof-of-Stake (PoS) blockchains. The +protocol composes a PoS blockchain with an off-the-shelf *finality voting round* +run by a set of [finality +providers](https://github.com/babylonchain/finality-provider) who receive *BTC +delegations* from [BTC stakers](https://github.com/babylonchain/btc-staker). The +finality providers and BTC delegations are maintained by Babylon's [BTC Staking +module](../btcstaking/README.md), and the Finality module is responsible for +maintaining the finality voting round. + + +**Finality voting round.** In the finality voting round, a block committed in +the CometBFT ledger receives *finality votes* from a set of finality providers. +A finality vote is a signature under the [*Extractable One-Time Signature +(EOTS)* +primitive](https://docs.babylonchain.io/assets/files/btc_staking_litepaper-32bfea0c243773f0bfac63e148387aef.pdf). +A block is considered finalized if it receives a quorum, i.e., votes from +finality providers with more than 2/3 voting power at its height. + + +**Slashable safety guarantee.** The finality voting round ensures the *slashable +safety* property of finalized blocks: upon a safety violation where a +conflicting block also receives a valid quorum, adversarial finality providers +with more than 1/3 total voting power will be provably identified by the +protocol and be slashed. The formal definition of slashable safety can be found +at [the S&P'23 paper](https://arxiv.org/pdf/2207.08392.pdf) and [the CCS'23 +paper](https://arxiv.org/pdf/2305.07830.pdf). In Babylon's Bitcoin Staking +protocol, if a finality provider is slashed, then + +- the secret key of the finality provider is revealed to the public, +- a parameterized amount of bitcoins of all BTC delegations under it will be + burned *on the Bitcoin network*, and +- the finality provider's voting power will be zeroized. + +In addition to the standard safety guarantee of CometBFT consensus, the +slashable safety guarantee disincentivizes safety offences launched by +adversarial finality providers. + + +**Interaction between finality providers and the Finality module.** In order to +participate in the finality voting round, an active finality provider with BTC +delegations (as specified in the [BTC Staking module](../btcstaking/README.md)) +needs to interact with the Finality module as follows: + +- **Committing EOTS public randomness.** The finality provider proactively + commits a list of *EOTS public randomness* for future heights to the Finality + module. EOTS ensures that given an EOTS public randomness, a signer can only + sign a single message. Otherwise, anyone can extract the signer's secret key + by using two EOTS signatures on different messages, the corresponding EOTS + public randomness, and the signer's public key. +- **Submitting EOTS signatures.** Upon a new block, if the finality provider has + committed an EOTS public randomness at this height, then it submits an EOTS + signature w.r.t. the committed EOTS public randomness to the Finality module. + The Finality module will verify the EOTS signature, and check if there are + known EOTS signatures on conflicting blocks from this finality provider. If + yes, then this constitutes an equivocation, and the Finality module will save + the equivocation evidence, such that anyone can extract the finality + provider's secret key and slash it. + +Babylon has implemented a [BTC staking +tracker](https://github.com/babylonchain/vigilante) daemon program that +subscribes to equivocation evidences in the Finality module, and slashes BTC +delegations under equivocating finality providers by sending their slashing +transactions to the Bitcoin network. + +## States + +The Finality module maintains the following KV stores. + +### Parameters + +The [parameter storage](./keeper/params.go) maintains the Finality module's +parameters. The Finality module's parameters are represented as a `Params` +[object](../../proto/babylon/finality/v1/params.proto) defined as follows: + +```protobuf +// Params defines the parameters for the module. +message Params { + option (gogoproto.goproto_stringer) = false; + + // min_pub_rand is the minimum number of public randomness each + // message should commit + uint64 min_pub_rand = 1; +} +``` + +### Public randomness + +The [public randomness storage](./keeper/public_randomness.go) maintains the +list of EOTS public randomness that each finality provider commits to Babylon. +The key is the finality provider's Bitcoin secp256k1 public key concatenated +with the block height, and the value is a `SchnorrPubRand` +[object](../../types/btc_schnorr_pub_rand.go) representing the EOTS public +randomness that this finality provider commits at this height. The +`SchnorrPubRand` is a point on the secp256k1 curve, and is defined as a 32-byte +array in the implementation. + +```go +type SchnorrPubRand []byte +const SchnorrPubRandLen = 32 +``` + +### Finality votes + +The [finality vote storage](./keeper/votes.go) maintains the finality votes of +finality providers on blocks. The key is the block height concatenated with the +finality provider's Bitcoin secp256k1 public key, and the value is a +`SchnorrEOTSSig` [object](../../types/btc_schnorr_eots.go) representing an EOTS +signature. Here, the EOTS signature is signed over a block's height and +`AppHash` by the finality provider, using the private randomness corresponding +to the EOTS public randomness it commits to at the block's height. The EOTS +signature serves as a finality vote on this block from this finality provider. +It is a 32-byte scalar and is defined as a 32-byte array in the implementation. + +```go +type SchnorrEOTSSig []byte +const SchnorrEOTSSigLen = 32 +``` + +### Indexed blocks with finalization status + +The [indexed block storage](./keeper/indexed_blocks.go) maintains the necessary +metadata and finalization status of blocks. The key is the block height and the +value is an `IndexedBlock` object +[defined](../../proto/babylon/finality/v1/finality.proto) as follows. + +```protobuf +// IndexedBlock is the necessary metadata and finalization status of a block +message IndexedBlock { + // height is the height of the block + uint64 height = 1; + // app_hash is the AppHash of the block + bytes app_hash = 2; + // finalized indicates whether the IndexedBlock is finalised by 2/3 + // finality providers or not + bool finalized = 3; +} +``` + +### Equivocation evidences + +The [equivocation evidence storage](./keeper/evidence.go) maintains evidences of +equivocation offences committed by finality providers. The key is a finality +provider's Bitcoin secp256k1 public key concatenated with the block height, and +the value is an `Evidence` +[object](../../proto/babylon/finality/v1/finality.proto) representing the +evidence that this finality provider has equivocated at this height. Anyone +observing the `Evidence` object can extract the finality provider's Bitcoin +secp256k1 secret key, as per EOTS's extractability property. + +```protobuf +// Evidence is the evidence that a finality provider has signed finality +// signatures with correct public randomness on two conflicting Babylon headers +message Evidence { + // fp_btc_pk is the BTC Pk of the finality provider that casts this vote + bytes fp_btc_pk = 1 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BIP340PubKey" ]; + // block_height is the height of the conflicting blocks + uint64 block_height = 2; + // pub_rand is the public randomness the finality provider has committed to + bytes pub_rand = 3 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.SchnorrPubRand" ]; + // canonical_app_hash is the AppHash of the canonical block + bytes canonical_app_hash = 4; + // fork_app_hash is the AppHash of the fork block + bytes fork_app_hash = 5; + // canonical_finality_sig is the finality signature to the canonical block + // where finality signature is an EOTS signature, i.e., + // the `s` in a Schnorr signature `(r, s)` + // `r` is the public randomness that is already committed by the finality provider + bytes canonical_finality_sig = 6 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.SchnorrEOTSSig" ]; + // fork_finality_sig is the finality signature to the fork block + // where finality signature is an EOTS signature + bytes fork_finality_sig = 7 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.SchnorrEOTSSig" ]; +} +``` + +## Messages + +The Finality module handles the following messages from finality providers. The +message formats are defined at +[proto/babylon/finality/v1/tx.proto](../../proto/babylon/finality/v1/tx.proto). +The message handlers are defined at +[x/finality/keeper/msg_server.go](./keeper/msg_server.go). + +### MsgCommitPubRandList + +The `MsgCommitPubRandList` message is used for committing a list of EOTS public +randomness that will be used by a finality provider in the future. It is +typically submitted by a finality provider via the [finality +provider](https://github.com/babylonchain/finality-provider) program. + +```protobuf +// MsgCommitPubRandList defines a message for committing a list of public randomness for EOTS +message MsgCommitPubRandList { + option (cosmos.msg.v1.signer) = "signer"; + + string signer = 1; + // fp_btc_pk is the BTC PK of the finality provider that commits the public randomness + bytes fp_btc_pk = 2 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BIP340PubKey" ]; + // start_height is the start block height of the list of public randomness + uint64 start_height = 3; + // pub_rand_list is the list of public randomness + repeated bytes pub_rand_list = 4 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.SchnorrPubRand" ]; + // sig is the signature on (start_height || pub_rand_list) signed by + // SK corresponding to fp_btc_pk. This prevents others to commit public + // randomness on behalf of fp_btc_pk + // TODO: another option is to restrict signer to correspond to fp_btc_pk. This restricts + // the tx submitter to be the holder of fp_btc_pk. Decide this later + bytes sig = 5 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BIP340Signature" ]; +} +``` + +Upon `MsgCommitPubRandList`, a Babylon node will execute as follows: + +1. Ensure the message contains at least `MinPubRand` number of EOTS public + randomness, where `MinPubRand` is defined in the module parameters. +2. Ensure the finality provider has been registered in Babylon. +3. Ensure the list of EOTS public randomness does not overlap with existing EOTS + public randomness that this finality provider previously committed before. +4. Verify the Schnorr signature over the list of public randomness signed by the + finality provider. +5. Store the list of EOTS public randomness to the public randomness storage. + +### MsgAddFinalitySig + +The `MsgAddFinalitySig` message is used for submitting a finality vote, i.e., an +EOTS signature over a block signed by a finality provider. It is typically +submitted by a finality provider via the [finality +provider](https://github.com/babylonchain/finality-provider) program. + +```protobuf +// MsgAddFinalitySig defines a message for adding a finality vote +message MsgAddFinalitySig { + option (cosmos.msg.v1.signer) = "signer"; + + string signer = 1; + // fp_btc_pk is the BTC PK of the finality provider that casts this vote + bytes fp_btc_pk = 2 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BIP340PubKey" ]; + // block_height is the height of the voted block + uint64 block_height = 3; + // block_app_hash is the AppHash of the voted block + bytes block_app_hash = 4; + // finality_sig is the finality signature to this block + // where finality signature is an EOTS signature, i.e., + // the `s` in a Schnorr signature `(r, s)` + // `r` is the public randomness that is already committed by the finality provider + bytes finality_sig = 5 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.SchnorrEOTSSig" ]; +} +``` + +Upon `MsgAddFinalitySig`, a Babylon node will execute as follows: + +1. Ensure the finality provider has been registered in Babylon and is not + slashed. +2. Ensure the finality provider has voting power at this height. +3. Ensure the finality provider has not previously casted the same vote. +4. Ensure the finality provider has a committed EOTS public randomness at this + height. +5. Verify the EOTS signature w.r.t. the committed EOTS public randomness. +6. If the voted block's `AppHash` is different from the canonical block at the + same height known by the Babylon node, then this means the finality provider + has voted for a fork. Babylon node buffers this finality vote to the evidence + storage. If the finality provider has also voted for the block at the same + height, then this finality provider is slashed, i.e., its voting power is + removed, equivocation evidence is recorded, and a slashing event is emitted. +7. If the voted block's `AppHash` is same as that of the canonical block at the + same height, then this means the finality provider has voted for the + canonical block, and the Babylon node will store this finality vote to the + finality vote storage. If the finality provider has also voted for a fork + block at the same height, then this finality provider will be slashed. + +### MsgUpdateParams + +The `MsgUpdateParams` message is used for updating the module parameters for the +Finality module. It can only be executed via a govenance proposal. + +```protobuf +// MsgUpdateParams defines a message for updating finality module parameters. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address of the governance account. + // just FYI: cosmos.AddressString marks that this field should use type alias + // for AddressString instead of string, but the functionality is not yet implemented + // in cosmos-proto + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // params defines the finality parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false]; +} +``` + +## EndBlocker + +Upon `EndBlocker`, the Finality module of each Babylon node will execute the +following *if the BTC staking protocol is activated (i.e., there has been >=1 +active BTC delegations)*: + +1. Index the current block, i.e., extract its height and `AppHash`, construct an + `IndexedBlock` object, and save it to the indexed block storage. +2. Tally all non-finalized blocks as follows: + 1. Find the starting height that the Babylon node should start to finalize. + This is the earliest height that is not finalize yet since the activation + of BTC staking. + 2. For each `IndexedBlock` between the starting height and the current + height, tally this block as follows: + 1. Find the set of active finality providers at this height. + 2. If the finality provider set is empty, then this block is not + finalizable and the Babylon node will skip this block. + 3. If the finality provider set is not empty, then find all finality votes + on this `IndexedBlock`, and check whether this `IndexedBlock` has + received votes of more than 2/3 voting power from the active finality + provider set. If yes, then finalize this block, i.e., set this + `IndexedBlock` to be finalized in the indexed block storage and + distribute rewards to the voted finality providers and their BTC + delegations. Otherwise, none of the subsequent blocks shall be + finalized and the loop breaks here. + +## Events + +The Finality module defines the `EventSlashedFinalityProvider` event. It is +emitted when a finality provider is slashed due to equivocation. + +```protobuf +// EventSlashedFinalityProvider is the event emitted when a finality provider is slashed +// due to signing two conflicting blocks +message EventSlashedFinalityProvider { + // evidence is the evidence that the finality provider double signs + Evidence evidence = 1; +} +``` + +## Queries + +The Finality module provides a set of queries about finality signatures on each +block, listed at +[docs.babylonchain.io](https://docs.babylonchain.io/docs/developer-guides/grpcrestapi#tag/Finality). + diff --git a/x/finality/keeper/msg_server.go b/x/finality/keeper/msg_server.go index 991b244bc..779d57acb 100644 --- a/x/finality/keeper/msg_server.go +++ b/x/finality/keeper/msg_server.go @@ -73,7 +73,7 @@ func (ms msgServer) AddFinalitySig(goCtx context.Context, req *types.MsgAddFinal return nil, bstypes.ErrFpAlreadySlashed } - // ensure the finality providerhas voting power at this height + // ensure the finality provider has voting power at this height if req.FpBtcPk == nil { return nil, types.ErrInvalidFinalitySig.Wrap("empty finality provider BTC PK") } diff --git a/x/finality/types/finality.pb.go b/x/finality/types/finality.pb.go index e03aeb453..7f1ebb971 100644 --- a/x/finality/types/finality.pb.go +++ b/x/finality/types/finality.pb.go @@ -24,7 +24,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// IndexedBlock is the block with some indexed info +// IndexedBlock is the necessary metadata and finalization status of a block type IndexedBlock struct { // height is the height of the block Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` @@ -92,7 +92,7 @@ func (m *IndexedBlock) GetFinalized() bool { // Evidence is the evidence that a finality provider has signed finality // signatures with correct public randomness on two conflicting Babylon headers type Evidence struct { - // fp_btc_pk is the BTC Pk of the finality provider that casts this vote + // fp_btc_pk is the BTC PK of the finality provider that casts this vote FpBtcPk *github_com_babylonchain_babylon_types.BIP340PubKey `protobuf:"bytes,1,opt,name=fp_btc_pk,json=fpBtcPk,proto3,customtype=github.com/babylonchain/babylon/types.BIP340PubKey" json:"fp_btc_pk,omitempty"` // block_height is the height of the conflicting blocks BlockHeight uint64 `protobuf:"varint,2,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` diff --git a/x/finality/types/params.pb.go b/x/finality/types/params.pb.go index 1a26e045b..fe81592df 100644 --- a/x/finality/types/params.pb.go +++ b/x/finality/types/params.pb.go @@ -25,7 +25,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { - // min_pub_rand is the minimum number of public randomoness each + // min_pub_rand is the minimum number of public randomness each // message should commit MinPubRand uint64 `protobuf:"varint,1,opt,name=min_pub_rand,json=minPubRand,proto3" json:"min_pub_rand,omitempty"` } diff --git a/x/finality/types/tx.pb.go b/x/finality/types/tx.pb.go index d717445b1..776a327da 100644 --- a/x/finality/types/tx.pb.go +++ b/x/finality/types/tx.pb.go @@ -31,10 +31,10 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// MsgAddFinalitySig defines a message for adding a vote +// MsgAddFinalitySig defines a message for adding a finality vote type MsgAddFinalitySig struct { Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` - // fp_btc_pk is the BTC Pk of the finality provider that casts this vote + // fp_btc_pk is the BTC PK of the finality provider that casts this vote FpBtcPk *github_com_babylonchain_babylon_types.BIP340PubKey `protobuf:"bytes,2,opt,name=fp_btc_pk,json=fpBtcPk,proto3,customtype=github.com/babylonchain/babylon/types.BIP340PubKey" json:"fp_btc_pk,omitempty"` // block_height is the height of the voted block BlockHeight uint64 `protobuf:"varint,3,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"`