diff --git a/go.mod b/go.mod index 63d5dbaef..62bbabfd8 100644 --- a/go.mod +++ b/go.mod @@ -26,6 +26,7 @@ require ( cosmossdk.io/api v0.7.2 cosmossdk.io/client/v2 v2.0.0-beta.1 cosmossdk.io/core v0.11.0 + cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 cosmossdk.io/log v1.2.1 cosmossdk.io/math v1.2.0 @@ -134,7 +135,6 @@ require ( cloud.google.com/go/iam v1.1.3 // indirect cloud.google.com/go/storage v1.30.1 // indirect cosmossdk.io/collections v0.4.0 // indirect - cosmossdk.io/depinject v1.0.0-alpha.4 // indirect cosmossdk.io/x/nft v0.1.0 // indirect github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect github.com/DataDog/zstd v1.5.5 // indirect diff --git a/proto/babylon/btcstaking/v1/btcstaking.proto b/proto/babylon/btcstaking/v1/btcstaking.proto index 7853a808b..6759352e7 100644 --- a/proto/babylon/btcstaking/v1/btcstaking.proto +++ b/proto/babylon/btcstaking/v1/btcstaking.proto @@ -93,6 +93,7 @@ message BTCDelegation { // by the covenant (i.e., SK corresponding to covenant_pk in params) // It will be a part of the witness for the staking tx output. // TODO: change to a set of (covenant PK, covenant adaptor signature) tuples + // over each restaked BTC validator (i.e., a matrix of tuples) bytes covenant_sig = 12 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BIP340Signature" ]; // if this object is present it menans that staker requested undelegation, and whole @@ -121,14 +122,12 @@ message BTCUndelegation { // covenant_slashing_sig is the signature on the slashing tx // by the covenant (i.e., SK corresponding to covenant_pk in params) // It must be provided after processing undelagate message by Babylon - // TODO: change to a set of (covenant PK, covenant adaptor signature) tuples + // TODO: change to a matrix of (covenant PK, covenant adaptor signature) tuples bytes covenant_slashing_sig = 5 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BIP340Signature" ]; - // covenant_unbonding_sig is the signature on the unbonding tx - // by the covenant (i.e., SK corresponding to covenant_pk in params) - // It must be provided after processing undelagate message by Babylon and after - // validator sig will be provided by validator - // TODO: change to a set of (covenant PK, covenant Schnorr signature) tuples - bytes covenant_unbonding_sig = 6 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BIP340Signature" ]; + // covenant_unbonding_sig_list is the list of signatures on the unbonding tx + // by covenant members + // It must be provided after processing undelagate message by Babylon + repeated SignatureInfo covenant_unbonding_sig_list = 6; } @@ -139,11 +138,11 @@ message BTCUndelegationInfo { // than staking output. bytes unbonding_tx = 1; - // covenant_unbonding_sig is the signature on the unbonding tx - // by the covenant (i.e., SK corresponding to covenant_pk in params) - // it will be nil if covenant didn't sign it yet - // TODO: change to a set of (covenant PK, covenant Schnorr signature) tuples - bytes covenant_unbonding_sig = 2 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BIP340Signature" ]; + // covenant_unbonding_sig_list is the list of signatures on the unbonding tx + // by covenant members + // It must be provided after processing undelagate message by Babylon and after + // validator sig will be provided by validator + repeated SignatureInfo covenant_unbonding_sig_list = 2; } // BTCDelegatorDelegations is a collection of BTC delegations from the same delegator. diff --git a/proto/babylon/btcstaking/v1/tx.proto b/proto/babylon/btcstaking/v1/tx.proto index 66a028e2f..3f0d96634 100644 --- a/proto/babylon/btcstaking/v1/tx.proto +++ b/proto/babylon/btcstaking/v1/tx.proto @@ -65,8 +65,8 @@ message MsgCreateBTCDelegation { cosmos.crypto.secp256k1.PubKey babylon_pk = 2; // pop is the proof of possession of babylon_pk and btc_pk ProofOfPossession pop = 3; - // staker_btc_pk is the Bitcoin secp256k1 PK of the BTC staker - bytes staker_btc_pk = 4 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BIP340PubKey" ]; + // btc_pk is the Bitcoin secp256k1 PK of the BTC delegator + bytes btc_pk = 4 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BIP340PubKey" ]; // val_btc_pk_list is the list of Bitcoin secp256k1 PKs of the BTC validators, if there is more than one // validator pk it means that delegation is re-staked repeated bytes val_btc_pk_list = 5 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BIP340PubKey" ]; @@ -116,18 +116,15 @@ message MsgAddCovenantSig { option (cosmos.msg.v1.signer) = "signer"; string signer = 1; - // val_pk is the Bitcoin secp256k1 PK of the BTC validator - // the PK follows encoding in BIP-340 spec - bytes val_pk = 2 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BIP340PubKey" ]; - // del_pk is the Bitcoin secp256k1 PK of the BTC delegation - // the PK follows encoding in BIP-340 spec - bytes del_pk = 3 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BIP340PubKey" ]; + // pk is the BTC public key of the covenant member + bytes pk = 2 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BIP340PubKey" ]; // staking_tx_hash is the hash of the staking tx. - // (val_pk, del_pk, staking_tx_hash) uniquely identifies a BTC delegation - string staking_tx_hash = 4; + // It uniquely identifies a BTC delegation + string staking_tx_hash = 3; // sig is the signature of the covenant // the signature follows encoding in BIP-340 spec - bytes sig = 5 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BIP340Signature" ]; + // TODO: change to adaptor signature + bytes sig = 4 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BIP340Signature" ]; } // MsgAddCovenantSigResponse is the response for MsgAddCovenantSig message MsgAddCovenantSigResponse {} @@ -156,22 +153,18 @@ message MsgAddCovenantUnbondingSigs { option (cosmos.msg.v1.signer) = "signer"; string signer = 1; - // val_pk is the Bitcoin secp256k1 PK of the BTC validator - // the PK follows encoding in BIP-340 spec - bytes val_pk = 2 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BIP340PubKey" ]; - // del_pk is the Bitcoin secp256k1 PK of the BTC delegation - // the PK follows encoding in BIP-340 spec - bytes del_pk = 3 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BIP340PubKey" ]; + // pk is the BTC public key of the covenant member + bytes pk = 2 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BIP340PubKey" ]; // staking_tx_hash is the hash of the staking tx. // (val_pk, del_pk, staking_tx_hash) uniquely identifies a BTC delegation - string staking_tx_hash = 4; + string staking_tx_hash = 3; // unbonding_tx_sig is the signature of the covenant on the unbonding tx submitted to babylon // the signature follows encoding in BIP-340 spec - bytes unbonding_tx_sig = 5 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BIP340Signature" ]; + bytes unbonding_tx_sig = 4 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BIP340Signature" ]; // slashing_unbonding_tx_sig is the signature of the covenant on slashing tx corresponding to unbodning tx submitted to babylon // the signature follows encoding in BIP-340 spec - bytes slashing_unbonding_tx_sig = 6 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BIP340Signature" ]; - + // TODO: change to adaptor signature + bytes slashing_unbonding_tx_sig = 5 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BIP340Signature" ]; } // MsgAddCovenantSigResponse is the response for MsgAddCovenantSig message MsgAddCovenantUnbondingSigsResponse {} diff --git a/proto/babylon/checkpointing/v1/checkpoint.proto b/proto/babylon/checkpointing/v1/checkpoint.proto index 019904a88..200487498 100644 --- a/proto/babylon/checkpointing/v1/checkpoint.proto +++ b/proto/babylon/checkpointing/v1/checkpoint.proto @@ -80,7 +80,7 @@ message BlsSig { // epoch_num defines the epoch number that the BLS sig is signed on uint64 epoch_num = 1; - // last_commit_hash defines the 'AppHash' that the BLS sig is signed on + // app_hash defines the 'AppHash' that the BLS sig is signed on bytes app_hash = 2 [ (gogoproto.customtype) = "AppHash" ]; bytes bls_sig = 3 [ (gogoproto.customtype) = diff --git a/proto/babylon/epoching/v1/epoching.proto b/proto/babylon/epoching/v1/epoching.proto index 9b56c0bca..66c7faf51 100644 --- a/proto/babylon/epoching/v1/epoching.proto +++ b/proto/babylon/epoching/v1/epoching.proto @@ -23,7 +23,7 @@ message Epoch { // It will be used for proving a block is in an epoch bytes app_hash_root = 5; // sealer_header is the 2nd header of the next epoch - // This validator set has generated a BLS multisig on `last_commit_hash` of + // This validator set has generated a BLS multisig on `app_hash` of // the sealer header tendermint.types.Header sealer_header = 6; } diff --git a/proto/babylon/finality/v1/finality.proto b/proto/babylon/finality/v1/finality.proto index 2886f04a9..e03a89ba9 100644 --- a/proto/babylon/finality/v1/finality.proto +++ b/proto/babylon/finality/v1/finality.proto @@ -9,8 +9,8 @@ import "gogoproto/gogo.proto"; message IndexedBlock { // height is the height of the block uint64 height = 1; - // last_commit_hash is the last_commit_hash of the block - bytes last_commit_hash = 2; + // app_hash is the AppHash of the block + bytes app_hash = 2; // finalized indicates whether the IndexedBlock is finalised by 2/3 // BTC validators or not bool finalized = 3; @@ -25,10 +25,10 @@ message Evidence { uint64 block_height = 2; // pub_rand is the public randomness the BTC validator has committed to bytes pub_rand = 3 [ (gogoproto.customtype) = "github.com/babylonchain/babylon/types.SchnorrPubRand" ]; - // canonical_last_commit_hash is the last_commit_hash of the canonical block - bytes canonical_last_commit_hash = 4; - // fork_last_commit_hash is the last_commit_hash of the fork block - bytes fork_last_commit_hash = 5; + // 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)` diff --git a/proto/babylon/finality/v1/tx.proto b/proto/babylon/finality/v1/tx.proto index d81e7ed45..c3f714c87 100644 --- a/proto/babylon/finality/v1/tx.proto +++ b/proto/babylon/finality/v1/tx.proto @@ -30,8 +30,8 @@ message MsgAddFinalitySig { bytes val_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_last_commit_hash is the last_commit_hash of the voted block - bytes block_last_commit_hash = 4; + // 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)` diff --git a/proto/babylon/zoneconcierge/v1/zoneconcierge.proto b/proto/babylon/zoneconcierge/v1/zoneconcierge.proto index 0c24a491b..ae05c3490 100644 --- a/proto/babylon/zoneconcierge/v1/zoneconcierge.proto +++ b/proto/babylon/zoneconcierge/v1/zoneconcierge.proto @@ -94,14 +94,14 @@ message FinalizedChainInfo { // - Metadata of this epoch, which includes the sealer header // - Raw checkpoint of this epoch // The verifier can perform the following verification rules: -// - The raw checkpoint's `last_commit_hash` is same as in the sealer header +// - The raw checkpoint's `app_hash` is same as in the sealer header // - More than 1/3 (in voting power) validators in the validator set of this -// epoch have signed `last_commit_hash` of the sealer header +// epoch have signed `app_hash` of the sealer header // - The epoch medatata is committed to the `app_hash` of the sealer header // - The validator set is committed to the `app_hash` of the sealer header message ProofEpochSealed { // validator_set is the validator set of the sealed epoch - // This validator set has generated a BLS multisig on `last_commit_hash` of + // This validator set has generated a BLS multisig on `app_hash` of // the sealer header repeated babylon.checkpointing.v1.ValidatorWithBlsKey validator_set = 1; // proof_epoch_info is the Merkle proof that the epoch's metadata is committed diff --git a/test/e2e/btc_staking_e2e_test.go b/test/e2e/btc_staking_e2e_test.go index 9e21df8dc..2730ab1f2 100644 --- a/test/e2e/btc_staking_e2e_test.go +++ b/test/e2e/btc_staking_e2e_test.go @@ -238,7 +238,7 @@ func (s *BTCStakingTestSuite) Test2SubmitCovenantSignature() { net, ) s.NoError(err) - nonValidatorNode.AddCovenantSig(btcVal.BtcPk, bbn.NewBIP340PubKeyFromBTCPK(delBTCPK), stakingTxHash, covenantSig) + nonValidatorNode.AddCovenantSig(¶ms.CovenantPks[0], stakingTxHash, covenantSig) // wait for a block so that above txs take effect nonValidatorNode.WaitForNextBlock() @@ -264,8 +264,8 @@ func (s *BTCStakingTestSuite) Test2SubmitCovenantSignature() { s.NoError(err) activeBTCVals := nonValidatorNode.QueryActiveBTCValidatorsAtHeight(activatedHeight) s.Len(activeBTCVals, 1) - s.Equal(activeBTCVals[0].VotingPower, activeDels.VotingPower(currentBtcTip.Height, initialization.BabylonBtcFinalizationPeriod)) - s.Equal(activeBTCVals[0].VotingPower, activeDel.VotingPower(currentBtcTip.Height, initialization.BabylonBtcFinalizationPeriod)) + s.Equal(activeBTCVals[0].VotingPower, activeDels.VotingPower(currentBtcTip.Height, initialization.BabylonBtcFinalizationPeriod, params.CovenantQuorum)) + s.Equal(activeBTCVals[0].VotingPower, activeDel.VotingPower(currentBtcTip.Height, initialization.BabylonBtcFinalizationPeriod, params.CovenantQuorum)) } // Test2CommitPublicRandomnessAndSubmitFinalitySignature is an end-to-end @@ -519,7 +519,7 @@ func (s *BTCStakingTestSuite) Test6SubmitUnbondingSignatures() { delegation := delegatorDelegations.Dels[0] s.NotNil(delegation.BtcUndelegation) - s.Nil(delegation.BtcUndelegation.CovenantUnbondingSig) + s.Empty(delegation.BtcUndelegation.CovenantUnbondingSigList) s.Nil(delegation.BtcUndelegation.CovenantSlashingSig) // params for covenantPk and slashing address @@ -593,8 +593,7 @@ func (s *BTCStakingTestSuite) Test6SubmitUnbondingSignatures() { ) s.NoError(err) nonValidatorNode.AddCovenantUnbondingSigs( - btcVal.BtcPk, - bbn.NewBIP340PubKeyFromBTCPK(delBTCPK), stakingTxHash, &covenantUnbondingSig, covenantSlashingSig) + ¶ms.CovenantPks[0], stakingTxHash, &covenantUnbondingSig, covenantSlashingSig) nonValidatorNode.WaitForNextBlock() nonValidatorNode.WaitForNextBlock() @@ -603,12 +602,12 @@ func (s *BTCStakingTestSuite) Test6SubmitUnbondingSignatures() { s.Len(allDelegationsWithSigs, 1) delegationWithSigs := allDelegationsWithSigs[0].Dels[0] s.NotNil(delegationWithSigs.BtcUndelegation) - s.NotNil(delegationWithSigs.BtcUndelegation.CovenantUnbondingSig) + s.NotEmpty(delegationWithSigs.BtcUndelegation.CovenantUnbondingSigList) s.NotNil(delegationWithSigs.BtcUndelegation.CovenantSlashingSig) btcTip, err := nonValidatorNode.QueryTip() s.NoError(err) s.Equal( bstypes.BTCDelegationStatus_UNBONDED, - delegationWithSigs.GetStatus(btcTip.Height, initialization.BabylonBtcFinalizationPeriod), + delegationWithSigs.GetStatus(btcTip.Height, initialization.BabylonBtcFinalizationPeriod, params.CovenantQuorum), ) } diff --git a/test/e2e/configurer/chain/commands_btcstaking.go b/test/e2e/configurer/chain/commands_btcstaking.go index 68ebbc441..1f112ed6d 100644 --- a/test/e2e/configurer/chain/commands_btcstaking.go +++ b/test/e2e/configurer/chain/commands_btcstaking.go @@ -2,9 +2,10 @@ package chain import ( "encoding/hex" + "strconv" + "github.com/btcsuite/btcd/btcutil" "github.com/btcsuite/btcd/wire" - "strconv" "cosmossdk.io/math" sdkmath "cosmossdk.io/math" @@ -80,14 +81,13 @@ func (n *NodeConfig) CreateBTCDelegation( n.LogActionF("successfully created BTC delegation") } -func (n *NodeConfig) AddCovenantSig(valPK *bbn.BIP340PubKey, delPK *bbn.BIP340PubKey, stakingTxHash string, sig *bbn.BIP340Signature) { +func (n *NodeConfig) AddCovenantSig(covPK *bbn.BIP340PubKey, stakingTxHash string, sig *bbn.BIP340Signature) { n.LogActionF("adding covenant signature") - valPKHex := valPK.MarshalHex() - delPKHex := delPK.MarshalHex() + covPKHex := covPK.MarshalHex() sigHex := sig.ToHexStr() - cmd := []string{"babylond", "tx", "btcstaking", "add-covenant-sig", valPKHex, delPKHex, stakingTxHash, sigHex, "--from=val"} + cmd := []string{"babylond", "tx", "btcstaking", "add-covenant-sig", covPKHex, stakingTxHash, sigHex, "--from=val"} _, _, err := n.containerManager.ExecTxCmd(n.t, n.chainId, n.Name, cmd) require.NoError(n.t, err) n.LogActionF("successfully added covenant sig") @@ -181,19 +181,17 @@ func (n *NodeConfig) AddValidatorUnbondingSig(valPK *bbn.BIP340PubKey, delPK *bb } func (n *NodeConfig) AddCovenantUnbondingSigs( - valPK *bbn.BIP340PubKey, - delPK *bbn.BIP340PubKey, + covPK *bbn.BIP340PubKey, stakingTxHash string, unbondingTxSig *bbn.BIP340Signature, slashUnbondingTxSig *bbn.BIP340Signature) { n.LogActionF("adding validator signature") - valPKHex := valPK.MarshalHex() - delPKHex := delPK.MarshalHex() + covPKHex := covPK.MarshalHex() unbondingTxSigHex := unbondingTxSig.ToHexStr() slashUnbondingTxSigHex := slashUnbondingTxSig.ToHexStr() - cmd := []string{"babylond", "tx", "btcstaking", "add-covenant-unbonding-sigs", valPKHex, delPKHex, stakingTxHash, unbondingTxSigHex, slashUnbondingTxSigHex, "--from=val"} + cmd := []string{"babylond", "tx", "btcstaking", "add-covenant-unbonding-sigs", covPKHex, stakingTxHash, unbondingTxSigHex, slashUnbondingTxSigHex, "--from=val"} _, _, err := n.containerManager.ExecTxCmd(n.t, n.chainId, n.Name, cmd) require.NoError(n.t, err) n.LogActionF("successfully added covenant unbonding sigs") diff --git a/x/btcstaking/client/cli/tx.go b/x/btcstaking/client/cli/tx.go index 6dedadee8..24518d4bb 100644 --- a/x/btcstaking/client/cli/tx.go +++ b/x/btcstaking/client/cli/tx.go @@ -251,7 +251,7 @@ func NewCreateBTCDelegationCmd() *cobra.Command { msg := types.MsgCreateBTCDelegation{ Signer: clientCtx.FromAddress.String(), BabylonPk: &babylonPK, - StakerBtcPk: btcPK, + BtcPk: btcPK, ValBtcPkList: []bbn.BIP340PubKey{*valPK}, Pop: pop, StakingTime: uint32(stakingTime), @@ -272,8 +272,8 @@ func NewCreateBTCDelegationCmd() *cobra.Command { func NewAddCovenantSigCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "add-covenant-sig [val_pk] [del_pk] [staking_tx_hash] [sig]", - Args: cobra.ExactArgs(4), + Use: "add-covenant-sig [covenant_pk] [staking_tx_hash] [sig]", + Args: cobra.ExactArgs(3), Short: "Add a covenant signature", Long: strings.TrimSpace( `Add a covenant signature.`, // TODO: example @@ -284,31 +284,23 @@ func NewAddCovenantSigCmd() *cobra.Command { return err } - // get validator PK - valPK, err := bbn.NewBIP340PubKeyFromHex(args[0]) - if err != nil { - return err - } - - // get delegator PK - delPK, err := bbn.NewBIP340PubKeyFromHex(args[1]) + covPK, err := bbn.NewBIP340PubKeyFromHex(args[0]) if err != nil { return err } // get staking tx hash - stakingTxHash := args[2] + stakingTxHash := args[1] // get covenant sigature - sig, err := bbn.NewBIP340SignatureFromHex(args[3]) + sig, err := bbn.NewBIP340SignatureFromHex(args[2]) if err != nil { return err } msg := types.MsgAddCovenantSig{ Signer: clientCtx.FromAddress.String(), - ValPk: valPK, - DelPk: delPK, + Pk: covPK, StakingTxHash: stakingTxHash, Sig: sig, } @@ -387,8 +379,8 @@ func NewCreateBTCUndelegationCmd() *cobra.Command { func NewAddCovenantUnbondingSigsCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "add-covenant-unbonding-sigs [val_pk] [del_pk] [staking_tx_hash] [unbonding_tx_sg] [slashing_unbonding_tx_sig]", - Args: cobra.ExactArgs(5), + Use: "add-covenant-unbonding-sigs [covenant_pk] [staking_tx_hash] [unbonding_tx_sg] [slashing_unbonding_tx_sig]", + Args: cobra.ExactArgs(4), Short: "Add covenant signatures for unbonding tx and slash unbonding tx", RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) @@ -396,37 +388,30 @@ func NewAddCovenantUnbondingSigsCmd() *cobra.Command { return err } - // get validator PK - valPK, err := bbn.NewBIP340PubKeyFromHex(args[0]) - if err != nil { - return err - } - - // get delegator PK - delPK, err := bbn.NewBIP340PubKeyFromHex(args[1]) + // get covenant PK + covPK, err := bbn.NewBIP340PubKeyFromHex(args[0]) if err != nil { return err } // get staking tx hash - stakingTxHash := args[2] + stakingTxHash := args[1] // get covenant sigature for unbonding tx - unbondingSig, err := bbn.NewBIP340SignatureFromHex(args[3]) + unbondingSig, err := bbn.NewBIP340SignatureFromHex(args[2]) if err != nil { return err } // get covenant sigature for slash unbonding tx - slashUnbondingSig, err := bbn.NewBIP340SignatureFromHex(args[4]) + slashUnbondingSig, err := bbn.NewBIP340SignatureFromHex(args[3]) if err != nil { return err } msg := types.MsgAddCovenantUnbondingSigs{ Signer: clientCtx.FromAddress.String(), - ValPk: valPK, - DelPk: delPK, + Pk: covPK, StakingTxHash: stakingTxHash, UnbondingTxSig: unbondingSig, SlashingUnbondingTxSig: slashUnbondingSig, diff --git a/x/btcstaking/keeper/btc_delegators.go b/x/btcstaking/keeper/btc_delegators.go index f3db189c9..e6a62b6d2 100644 --- a/x/btcstaking/keeper/btc_delegators.go +++ b/x/btcstaking/keeper/btc_delegators.go @@ -3,6 +3,7 @@ package keeper import ( "context" "fmt" + "github.com/cosmos/cosmos-sdk/runtime" "cosmossdk.io/store/prefix" @@ -78,7 +79,11 @@ func (k Keeper) updateBTCDelegation( // AddCovenantSigToBTCDelegation adds a given covenant sig to a BTC delegation // with the given (val PK, del PK, staking tx hash) tuple -func (k Keeper) AddCovenantSigToBTCDelegation(ctx context.Context, valBTCPK *bbn.BIP340PubKey, delBTCPK *bbn.BIP340PubKey, stakingTxHash string, covenantSig *bbn.BIP340Signature) error { +func (k Keeper) AddCovenantSigToBTCDelegation( + ctx context.Context, + stakingTxHash string, + covenantSig *bbn.BIP340Signature, +) error { addCovenantSig := func(btcDel *types.BTCDelegation) error { if btcDel.CovenantSig != nil { return fmt.Errorf("the BTC delegation with staking tx hash %s already has a covenant signature", stakingTxHash) @@ -109,7 +114,7 @@ func (k Keeper) AddUndelegationToBTCDelegation( func (k Keeper) AddCovenantSigsToUndelegation( ctx context.Context, stakingTxHash string, - unbondingTxSig *bbn.BIP340Signature, + unbondingTxSigInfo *types.SignatureInfo, slashUnbondingTxSig *bbn.BIP340Signature, ) error { addCovenantSigs := func(btcDel *types.BTCDelegation) error { @@ -117,11 +122,12 @@ func (k Keeper) AddCovenantSigsToUndelegation( return fmt.Errorf("the BTC delegation with staking tx hash %s did not receive undelegation request yet", stakingTxHash) } - if btcDel.BtcUndelegation.CovenantUnbondingSig != nil || btcDel.BtcUndelegation.CovenantSlashingSig != nil { + // TODO: ensure the given CovenantUnbondingSig does not exist in the BTC undelegation yet + if btcDel.BtcUndelegation.CovenantUnbondingSigList != nil || btcDel.BtcUndelegation.CovenantSlashingSig != nil { return fmt.Errorf("the BTC undelegation for staking tx hash %s already has valid covenant signatures", stakingTxHash) } - btcDel.BtcUndelegation.CovenantUnbondingSig = unbondingTxSig + btcDel.BtcUndelegation.CovenantUnbondingSigList = append(btcDel.BtcUndelegation.CovenantUnbondingSigList, unbondingTxSigInfo) btcDel.BtcUndelegation.CovenantSlashingSig = slashUnbondingTxSig return nil } diff --git a/x/btcstaking/keeper/grpc_query.go b/x/btcstaking/keeper/grpc_query.go index e56466594..578f73218 100644 --- a/x/btcstaking/keeper/grpc_query.go +++ b/x/btcstaking/keeper/grpc_query.go @@ -74,6 +74,7 @@ func (k Keeper) BTCDelegations(ctx context.Context, req *types.QueryBTCDelegatio } sdkCtx := sdk.UnwrapSDKContext(ctx) + covenantQuorum := k.GetParams(ctx).CovenantQuorum // get current BTC height btcTipHeight, err := k.GetCurrentBTCHeight(sdkCtx) @@ -90,7 +91,7 @@ func (k Keeper) BTCDelegations(ctx context.Context, req *types.QueryBTCDelegatio k.cdc.MustUnmarshal(value, &btcDel) // hit if the queried status is ANY or matches the BTC delegation status - if req.Status == types.BTCDelegationStatus_ANY || btcDel.GetStatus(btcTipHeight, wValue) == req.Status { + if req.Status == types.BTCDelegationStatus_ANY || btcDel.GetStatus(btcTipHeight, wValue, covenantQuorum) == req.Status { if accumulate { btcDels = append(btcDels, &btcDel) } @@ -276,14 +277,15 @@ func (k Keeper) BTCDelegation(ctx context.Context, req *types.QueryBTCDelegation isActive := btcDel.GetStatus( currentTip.Height, currentWValue, + k.GetParams(ctx).CovenantQuorum, ) == types.BTCDelegationStatus_ACTIVE // get its undelegation info var undelegationInfo *types.BTCUndelegationInfo if btcDel.BtcUndelegation != nil { undelegationInfo = &types.BTCUndelegationInfo{ - UnbondingTx: btcDel.BtcUndelegation.UnbondingTx, - CovenantUnbondingSig: btcDel.BtcUndelegation.CovenantUnbondingSig, + UnbondingTx: btcDel.BtcUndelegation.UnbondingTx, + CovenantUnbondingSigList: btcDel.BtcUndelegation.CovenantUnbondingSigList, } } diff --git a/x/btcstaking/keeper/grpc_query_test.go b/x/btcstaking/keeper/grpc_query_test.go index 5bef99a2a..36cb33223 100644 --- a/x/btcstaking/keeper/grpc_query_test.go +++ b/x/btcstaking/keeper/grpc_query_test.go @@ -1,11 +1,12 @@ package keeper_test import ( - sdkmath "cosmossdk.io/math" "errors" "math/rand" "testing" + sdkmath "cosmossdk.io/math" + "github.com/babylonchain/babylon/testutil/datagen" testkeeper "github.com/babylonchain/babylon/testutil/keeper" bbn "github.com/babylonchain/babylon/types" @@ -281,7 +282,8 @@ func FuzzUnbondingBTCDelegations(f *testing.F) { keeper, ctx := testkeeper.BTCStakingKeeper(t, btclcKeeper, btccKeeper) // covenant and slashing addr - covenantSK, _, err := datagen.GenRandomBTCKeyPair(r) + covenantSK, covenantPK, err := datagen.GenRandomBTCKeyPair(r) + covBTCPK := bbn.NewBIP340PubKeyFromBTCPK(covenantPK) require.NoError(t, err) slashingAddress, err := datagen.GenRandomBTCAddress(r, &chaincfg.SimNetParams) require.NoError(t, err) @@ -332,7 +334,8 @@ func FuzzUnbondingBTCDelegations(f *testing.F) { if datagen.RandomInt(r, 2) == 1 { // these BTC delegations are unbonded - btcDel.BtcUndelegation.CovenantUnbondingSig = btcDel.CovenantSig + unbondingSigInfo := types.NewSignatureInfo(covBTCPK, btcDel.CovenantSig) + btcDel.BtcUndelegation.CovenantUnbondingSigList = append(btcDel.BtcUndelegation.CovenantUnbondingSigList, unbondingSigInfo) btcDel.BtcUndelegation.CovenantSlashingSig = btcDel.CovenantSig } else { // these BTC delegations are unbonding diff --git a/x/btcstaking/keeper/incentive.go b/x/btcstaking/keeper/incentive.go index e69a55a3c..af8408a0f 100644 --- a/x/btcstaking/keeper/incentive.go +++ b/x/btcstaking/keeper/incentive.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "cosmossdk.io/store/prefix" bbn "github.com/babylonchain/babylon/types" "github.com/babylonchain/babylon/x/btcstaking/types" @@ -11,6 +12,7 @@ import ( ) func (k Keeper) RecordRewardDistCache(ctx context.Context) { + covenantQuorum := k.GetParams(ctx).CovenantQuorum // get BTC tip height and w, which are necessary for determining a BTC // delegation's voting power btcTipHeight, err := k.GetCurrentBTCHeight(ctx) @@ -57,7 +59,7 @@ func (k Keeper) RecordRewardDistCache(ctx context.Context) { panic(err) // only programming error is possible } btcDel := k.getBTCDelegation(ctx, *stakingTxHash) - btcValDistInfo.AddBTCDel(btcDel, btcTipHeight, wValue) + btcValDistInfo.AddBTCDel(btcDel, btcTipHeight, wValue, covenantQuorum) } } btcDelIter.Close() diff --git a/x/btcstaking/keeper/msg_server.go b/x/btcstaking/keeper/msg_server.go index d5e436f7d..1ee135520 100644 --- a/x/btcstaking/keeper/msg_server.go +++ b/x/btcstaking/keeper/msg_server.go @@ -187,7 +187,7 @@ func (ms msgServer) CreateBTCDelegation(goCtx context.Context, req *types.MsgCre kValue, wValue := btccParams.BtcConfirmationDepth, btccParams.CheckpointFinalizationTimeout // 1. verify proof of possession - if err := req.Pop.Verify(req.BabylonPk, req.StakerBtcPk, ms.btcNet); err != nil { + if err := req.Pop.Verify(req.BabylonPk, req.BtcPk, ms.btcNet); err != nil { return nil, types.ErrInvalidProofOfPossession.Wrapf("error while validating proof of posession: %v", err) } @@ -241,7 +241,7 @@ func (ms msgServer) CreateBTCDelegation(goCtx context.Context, req *types.MsgCre } si, err := btcstaking.BuildStakingInfo( - req.StakerBtcPk.MustToBTCPK(), + req.BtcPk.MustToBTCPK(), validatorKeys, covenantKeys, params.CovenantQuorum, @@ -324,7 +324,7 @@ func (ms msgServer) CreateBTCDelegation(goCtx context.Context, req *types.MsgCre stakingOutput.PkScript, stakingOutput.Value, slashingPathInfo.RevealedLeaf.Script, - req.StakerBtcPk.MustToBTCPK(), + req.BtcPk.MustToBTCPK(), req.DelegatorSig, ) @@ -338,7 +338,7 @@ func (ms msgServer) CreateBTCDelegation(goCtx context.Context, req *types.MsgCre // and 2) it receives a covenant signature newBTCDel := &types.BTCDelegation{ BabylonPk: req.BabylonPk, - BtcPk: req.StakerBtcPk, + BtcPk: req.BtcPk, Pop: req.Pop, ValBtcPkList: req.ValBtcPkList, StartHeight: startHeight, @@ -411,7 +411,7 @@ func (ms msgServer) BTCUndelegate(goCtx context.Context, req *types.MsgBTCUndele // 6. Check delegation state. Only active delegations can be unbonded. btcTip := ms.btclcKeeper.GetTipInfo(ctx) - status := del.GetStatus(btcTip.Height, wValue) + status := del.GetStatus(btcTip.Height, wValue, params.CovenantQuorum) if status != types.BTCDelegationStatus_ACTIVE { return nil, types.ErrInvalidDelegationState.Wrapf("current status: %v, want: %s", status.String(), types.BTCDelegationStatus_ACTIVE.String()) @@ -515,8 +515,8 @@ func (ms msgServer) BTCUndelegate(goCtx context.Context, req *types.MsgBTCUndele // Jurry needs to provide two sigs: // - one for unbonding tx // - one for slashing tx of unbonding tx - CovenantSlashingSig: nil, - CovenantUnbondingSig: nil, + CovenantSlashingSig: nil, + CovenantUnbondingSigList: nil, } if err := ms.AddUndelegationToBTCDelegation( @@ -543,36 +543,37 @@ func (ms msgServer) BTCUndelegate(goCtx context.Context, req *types.MsgBTCUndele // AddCovenantSig adds a signature from covenant to a BTC delegation func (ms msgServer) AddCovenantSig(goCtx context.Context, req *types.MsgAddCovenantSig) (*types.MsgAddCovenantSigResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) + covenantQuorum := ms.GetParams(ctx).CovenantQuorum // ensure BTC delegation exists btcDel, err := ms.GetBTCDelegation(ctx, req.StakingTxHash) - if err != nil { return nil, err } - if btcDel.HasCovenantSig() { - return nil, types.ErrDuplicatedCovenantSig - } stakingTx, stakingOutputIdx := mustGetStakingTxInfo(btcDel, ms.btcNet) stakingOutput := stakingTx.TxOut[stakingOutputIdx] - // TODO: covenant PK will be a field in the message. Then the verification will be - // that the given covenant PK has to be one of the covenant PKs in the parameter - covenantPK, err := ms.GetParams(ctx).CovenantPks[0].ToBTCPK() - if err != nil { - // failing to cast a verified covenant PK a programming error - panic(fmt.Errorf("failed to cast a verified covenant public key")) + // ensure that the given covenant PK is in the parameter + if !ms.GetParams(ctx).HasCovenantPK(req.Pk) { + return nil, types.ErrInvalidCovenantPK } - spendInfo, err := ms.stakingInfoFromDelegation(ctx, btcDel) + // ensure the BTC delegation hasn't reached a quorum yet + if btcDel.HasCovenantQuorum(covenantQuorum) { + return nil, types.ErrCovenantQuorumAlreadyReached + } + // ensure that this covenant member has not signed the delegation yet + if btcDel.IsSignedByCovMember(req.Pk) { + return nil, types.ErrDuplicatedCovenantSig + } + spendInfo, err := ms.stakingInfoFromDelegation(ctx, btcDel) if err != nil { panic(fmt.Errorf("failed to get staking info from a verified delegation: %w", err)) } slashingPathInfo, err := spendInfo.SlashingPathSpendInfo() - if err != nil { // our staking info was constructed by using BuildStakingInfo constructor, so if // this fails, it is a programming error @@ -584,7 +585,7 @@ func (ms msgServer) AddCovenantSig(goCtx context.Context, req *types.MsgAddCoven stakingOutput.PkScript, stakingOutput.Value, slashingPathInfo.RevealedLeaf.Script, - covenantPK, + req.Pk.MustToBTCPK(), req.Sig, ) @@ -593,7 +594,7 @@ func (ms msgServer) AddCovenantSig(goCtx context.Context, req *types.MsgAddCoven } // all good, add signature to BTC delegation and set it back to KVStore - if err := ms.AddCovenantSigToBTCDelegation(ctx, req.ValPk, req.DelPk, req.StakingTxHash, req.Sig); err != nil { + if err := ms.AddCovenantSigToBTCDelegation(ctx, req.StakingTxHash, req.Sig); err != nil { panic("failed to set BTC delegation that has passed verification") } @@ -607,9 +608,11 @@ func (ms msgServer) AddCovenantSig(goCtx context.Context, req *types.MsgAddCoven func (ms msgServer) AddCovenantUnbondingSigs( goCtx context.Context, - req *types.MsgAddCovenantUnbondingSigs) (*types.MsgAddCovenantUnbondingSigsResponse, error) { + req *types.MsgAddCovenantUnbondingSigs, +) (*types.MsgAddCovenantUnbondingSigsResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) wValue := ms.btccKeeper.GetParams(ctx).CheckpointFinalizationTimeout + covenantQuorum := ms.GetParams(ctx).CovenantQuorum // 1. Check that delegation even exists for provided params btcDel, err := ms.GetBTCDelegation(ctx, req.StakingTxHash) @@ -618,15 +621,19 @@ func (ms msgServer) AddCovenantUnbondingSigs( } btcTip := ms.btclcKeeper.GetTipInfo(ctx) - status := btcDel.GetStatus(btcTip.Height, wValue) + status := btcDel.GetStatus(btcTip.Height, wValue, covenantQuorum) // 2. Check that we are in proper status if status != types.BTCDelegationStatus_UNBONDING { return nil, types.ErrInvalidDelegationState.Wrapf("Expected status: %s, actual: %s", types.BTCDelegationStatus_UNBONDING.String(), status.String()) } - // 3. Check that we did not recevie covenant signature yet - if btcDel.BtcUndelegation.HasCovenantSigs() { + // 3. Check that we did not receive a quorum number of covenant signatures yet + if btcDel.BtcUndelegation.HasCovenantQuorum(covenantQuorum) { + return nil, types.ErrCovenantQuorumAlreadyReached + } + // ensure that this covenant member hasn't signed yet + if btcDel.BtcUndelegation.IsSignedByCovMember(req.Pk) { return nil, types.ErrDuplicatedCovenantSig } @@ -634,12 +641,9 @@ func (ms msgServer) AddCovenantUnbondingSigs( stakingTx, stakingOutputIdx := mustGetStakingTxInfo(btcDel, ms.btcNet) stakingOutput := stakingTx.TxOut[stakingOutputIdx] - // TODO: covenant PK will be a field in the message. Then the verification will be - // that the given covenant PK has to be one of the covenant PKs in the parameter - covenantPK, err := ms.GetParams(ctx).CovenantPks[0].ToBTCPK() - if err != nil { - // failing to cast a verified covenant PK is a programming error - panic(fmt.Errorf("failed to cast a verified covenant public key")) + // ensure that the given covenant PK is in the parameter + if !ms.GetParams(ctx).HasCovenantPK(req.Pk) { + return nil, types.ErrInvalidCovenantPK } unbondingTxMsg, err := types.ParseBtcTx(btcDel.BtcUndelegation.UnbondingTx) @@ -665,7 +669,7 @@ func (ms msgServer) AddCovenantUnbondingSigs( stakingOutput.PkScript, stakingOutput.Value, unbondingPathInfo.RevealedLeaf.Script, - covenantPK, + req.Pk.MustToBTCPK(), *req.UnbondingTxSig, ); err != nil { return nil, types.ErrInvalidCovenantSig.Wrap(err.Error()) @@ -693,7 +697,7 @@ func (ms msgServer) AddCovenantUnbondingSigs( unbondingOutput.PkScript, unbondingOutput.Value, slashingPathInfo.RevealedLeaf.Script, - covenantPK, + req.Pk.MustToBTCPK(), req.SlashingUnbondingTxSig, ) if err != nil { @@ -701,10 +705,11 @@ func (ms msgServer) AddCovenantUnbondingSigs( } // all good, add signature to BTC undelegation and set it back to KVStore + unbondingSigInfo := types.NewSignatureInfo(req.Pk, req.UnbondingTxSig) if err := ms.AddCovenantSigsToUndelegation( ctx, req.StakingTxHash, - req.UnbondingTxSig, + unbondingSigInfo, req.SlashingUnbondingTxSig); err != nil { panic("failed to set BTC delegation that has passed verification") } diff --git a/x/btcstaking/keeper/msg_server_test.go b/x/btcstaking/keeper/msg_server_test.go index 6655283b2..d4c38ca9a 100644 --- a/x/btcstaking/keeper/msg_server_test.go +++ b/x/btcstaking/keeper/msg_server_test.go @@ -2,12 +2,13 @@ package keeper_test import ( "context" - sdkmath "cosmossdk.io/math" "errors" "math/rand" "testing" "time" + sdkmath "cosmossdk.io/math" + "github.com/babylonchain/babylon/btcstaking" "github.com/babylonchain/babylon/testutil/datagen" keepertest "github.com/babylonchain/babylon/testutil/keeper" @@ -212,7 +213,7 @@ func createDelegation( msgCreateBTCDel := &types.MsgCreateBTCDelegation{ Signer: signer, BabylonPk: delBabylonPK.(*secp256k1.PubKey), - StakerBtcPk: stPk, + BtcPk: stPk, ValBtcPkList: []bbn.BIP340PubKey{*bbn.NewBIP340PubKeyFromBTCPK(validatorPK)}, Pop: pop, StakingTime: uint32(stakingTimeBlocks), @@ -269,10 +270,8 @@ func createCovenantSig( ) require.NoError(t, err) msgAddCovenantSig := &types.MsgAddCovenantSig{ - Signer: msgCreateBTCDel.Signer, - // TODO: this will be removed after all - ValPk: &delegation.ValBtcPkList[0], - DelPk: delegation.BtcPk, + Signer: msgCreateBTCDel.Signer, + Pk: bbn.NewBIP340PubKeyFromBTCPK(cPk), StakingTxHash: stakingTxHash, Sig: covenantSig, } @@ -285,7 +284,7 @@ func createCovenantSig( actualDelWithCovenantSig, err := bsKeeper.GetBTCDelegation(sdkCtx, stakingTxHash) require.NoError(t, err) require.Equal(t, actualDelWithCovenantSig.CovenantSig.MustMarshal(), covenantSig.MustMarshal()) - require.True(t, actualDelWithCovenantSig.HasCovenantSig()) + require.True(t, actualDelWithCovenantSig.HasCovenantQuorum(bsKeeper.GetParams(sdkCtx).CovenantQuorum)) } func getDelegationAndCheckValues( @@ -309,7 +308,7 @@ func getDelegationAndCheckValues( err = actualDel.ValidateBasic() require.NoError(t, err) // delegation is not activated by covenant yet - require.False(t, actualDel.HasCovenantSig()) + require.False(t, actualDel.HasCovenantQuorum(bsKeeper.GetParams(sdkCtx).CovenantQuorum)) return actualDel } @@ -537,7 +536,7 @@ func TestDoNotAllowDelegationWithoutValidator(t *testing.T) { Signer: signer, BabylonPk: delBabylonPK.(*secp256k1.PubKey), ValBtcPkList: []bbn.BIP340PubKey{*bbn.NewBIP340PubKeyFromBTCPK(validatorPK)}, - StakerBtcPk: bbn.NewBIP340PubKeyFromBTCPK(delSK.PubKey()), + BtcPk: bbn.NewBIP340PubKeyFromBTCPK(delSK.PubKey()), Pop: pop, StakingTime: uint32(stakingTimeBlocks), StakingValue: stakingValue, @@ -610,7 +609,7 @@ func FuzzCreateBTCDelegationAndUndelegation(f *testing.F) { require.Equal(t, actualDelegationWithUnbonding.BtcUndelegation.SlashingTx, undelegateMsg.SlashingTx) require.Equal(t, actualDelegationWithUnbonding.BtcUndelegation.DelegatorSlashingSig, undelegateMsg.DelegatorSlashingSig) require.Nil(t, actualDelegationWithUnbonding.BtcUndelegation.CovenantSlashingSig) - require.Nil(t, actualDelegationWithUnbonding.BtcUndelegation.CovenantUnbondingSig) + require.Nil(t, actualDelegationWithUnbonding.BtcUndelegation.CovenantUnbondingSigList) }) } @@ -730,8 +729,7 @@ func FuzzAddCovenantSigToUnbonding(f *testing.F) { covenantSigsMsg := types.MsgAddCovenantUnbondingSigs{ Signer: datagen.GenRandomAccount().Address, - ValPk: &del.ValBtcPkList[0], - DelPk: del.BtcPk, + Pk: bbn.NewBIP340PubKeyFromBTCPK(covenantPK), StakingTxHash: stakingTxHash, UnbondingTxSig: &covenantUnbondingSig, SlashingUnbondingTxSig: slashUnbondingTxSignatureCovenant, @@ -745,6 +743,6 @@ func FuzzAddCovenantSigToUnbonding(f *testing.F) { require.NoError(t, err) require.NotNil(t, delWithUnbondingSigs.BtcUndelegation) require.NotNil(t, delWithUnbondingSigs.BtcUndelegation.CovenantSlashingSig) - require.NotNil(t, delWithUnbondingSigs.BtcUndelegation.CovenantUnbondingSig) + require.NotNil(t, delWithUnbondingSigs.BtcUndelegation.CovenantUnbondingSigList) }) } diff --git a/x/btcstaking/keeper/voting_power_table.go b/x/btcstaking/keeper/voting_power_table.go index 9eaf340f2..a9b326b24 100644 --- a/x/btcstaking/keeper/voting_power_table.go +++ b/x/btcstaking/keeper/voting_power_table.go @@ -3,6 +3,7 @@ package keeper import ( "context" "fmt" + "github.com/cosmos/cosmos-sdk/runtime" "cosmossdk.io/store/prefix" @@ -15,6 +16,7 @@ import ( // and saves the power table to KVStore // triggered upon each EndBlock func (k Keeper) RecordVotingPowerTable(ctx context.Context) { + covenantQuorum := k.GetParams(ctx).CovenantQuorum // tip of Babylon and Bitcoin babylonTipHeight := uint64(sdk.UnwrapSDKContext(ctx).BlockHeight()) btcTipHeight, err := k.GetCurrentBTCHeight(ctx) @@ -58,7 +60,7 @@ func (k Keeper) RecordVotingPowerTable(ctx context.Context) { if err != nil { panic(err) // only programming error is possible } - valPower += btcDels.VotingPower(btcTipHeight, wValue) + valPower += btcDels.VotingPower(btcTipHeight, wValue, covenantQuorum) } btcDelIter.Close() diff --git a/x/btcstaking/types/btc_delegations.go b/x/btcstaking/types/btc_delegations.go index 3f5e20136..0fe8b3f3f 100644 --- a/x/btcstaking/types/btc_delegations.go +++ b/x/btcstaking/types/btc_delegations.go @@ -36,10 +36,10 @@ func (i *BTCDelegatorDelegationIndex) Add(stakingTxHash chainhash.Hash) error { } // VotingPower calculates the total voting power of all BTC delegations -func (dels *BTCDelegatorDelegations) VotingPower(btcHeight uint64, w uint64) uint64 { +func (dels *BTCDelegatorDelegations) VotingPower(btcHeight uint64, w uint64, covenantQuorum uint32) uint64 { power := uint64(0) for _, del := range dels.Dels { - power += del.VotingPower(btcHeight, w) + power += del.VotingPower(btcHeight, w, covenantQuorum) } return power } diff --git a/x/btcstaking/types/btcstaking.go b/x/btcstaking/types/btcstaking.go index 5b2fc5380..207cbcda1 100644 --- a/x/btcstaking/types/btcstaking.go +++ b/x/btcstaking/types/btcstaking.go @@ -88,16 +88,35 @@ func (d *BTCDelegation) ValidateBasic() error { } // HasCovenantSig returns whether a BTC delegation has a covenant signature -func (d *BTCDelegation) HasCovenantSig() bool { +func (d *BTCDelegation) HasCovenantQuorum(quorum uint32) bool { + // TODO: accomodate covenant committee for CovenantSig return d.CovenantSig != nil } -func (ud *BTCUndelegation) HasCovenantSigs() bool { - return ud.CovenantSlashingSig != nil && ud.CovenantUnbondingSig != nil +// IsSignedByCovMember checks whether the given covenant PK has signed the delegation +func (d *BTCDelegation) IsSignedByCovMember(covPK *bbn.BIP340PubKey) bool { + // TODO: accomodate covenant committee for CovenantSig + return d.CovenantSig != nil +} + +func (ud *BTCUndelegation) HasCovenantQuorum(quorum uint32) bool { + // TODO: accomodate covenant committee for CovenantSlashingSig + return ud.CovenantSlashingSig != nil && len(ud.CovenantUnbondingSigList) >= int(quorum) +} + +// IsSignedByCovMember checks whether the given covenant PK has signed the undelegation +func (ud *BTCUndelegation) IsSignedByCovMember(covPK *bbn.BIP340PubKey) bool { + // TODO: accomodate covenant committee for CovenantSlashingSig + for _, sigInfo := range ud.CovenantUnbondingSigList { + if sigInfo.Pk.Equals(covPK) { + return true + } + } + return false } -func (ud *BTCUndelegation) HasAllSignatures() bool { - return ud.HasCovenantSigs() +func (ud *BTCUndelegation) HasAllSignatures(covenantQuorum uint32) bool { + return ud.HasCovenantQuorum(covenantQuorum) } // GetStatus returns the status of the BTC Delegation based on a BTC height and a w value @@ -108,9 +127,9 @@ func (ud *BTCUndelegation) HasAllSignatures() bool { // Active: the BTC height is in the range of d's [startHeight, endHeight-w] and the delegation has a covenant sig // Pending: the BTC height is in the range of d's [startHeight, endHeight-w] and the delegation does not have a covenant sig // Expired: Delegation timelock -func (d *BTCDelegation) GetStatus(btcHeight uint64, w uint64) BTCDelegationStatus { +func (d *BTCDelegation) GetStatus(btcHeight uint64, w uint64, covenantQuorum uint32) BTCDelegationStatus { if d.BtcUndelegation != nil { - if d.BtcUndelegation.HasAllSignatures() { + if d.BtcUndelegation.HasAllSignatures(covenantQuorum) { return BTCDelegationStatus_UNBONDED } // If we received an undelegation but is still does not have all required signature, @@ -124,7 +143,7 @@ func (d *BTCDelegation) GetStatus(btcHeight uint64, w uint64) BTCDelegationStatu } if d.StartHeight <= btcHeight && btcHeight+w <= d.EndHeight { - if d.HasCovenantSig() { + if d.HasCovenantQuorum(covenantQuorum) { return BTCDelegationStatus_ACTIVE } else { return BTCDelegationStatus_PENDING @@ -136,8 +155,8 @@ func (d *BTCDelegation) GetStatus(btcHeight uint64, w uint64) BTCDelegationStatu // VotingPower returns the voting power of the BTC delegation at a given BTC height // and a given w value. // The BTC delegation d has voting power iff it is active. -func (d *BTCDelegation) VotingPower(btcHeight uint64, w uint64) uint64 { - if d.GetStatus(btcHeight, w) != BTCDelegationStatus_ACTIVE { +func (d *BTCDelegation) VotingPower(btcHeight uint64, w uint64, covenantQuorum uint32) uint64 { + if d.GetStatus(btcHeight, w, covenantQuorum) != BTCDelegationStatus_ACTIVE { return 0 } return d.GetTotalSat() @@ -195,3 +214,10 @@ func ExistsDup(btcPKs []bbn.BIP340PubKey) bool { return false } + +func NewSignatureInfo(pk *bbn.BIP340PubKey, sig *bbn.BIP340Signature) *SignatureInfo { + return &SignatureInfo{ + Pk: pk, + Sig: sig, + } +} diff --git a/x/btcstaking/types/btcstaking.pb.go b/x/btcstaking/types/btcstaking.pb.go index c3ab1dae6..d5b82866f 100644 --- a/x/btcstaking/types/btcstaking.pb.go +++ b/x/btcstaking/types/btcstaking.pb.go @@ -288,6 +288,7 @@ type BTCDelegation struct { // by the covenant (i.e., SK corresponding to covenant_pk in params) // It will be a part of the witness for the staking tx output. // TODO: change to a set of (covenant PK, covenant adaptor signature) tuples + // over each restaked BTC validator (i.e., a matrix of tuples) CovenantSig *github_com_babylonchain_babylon_types.BIP340Signature `protobuf:"bytes,12,opt,name=covenant_sig,json=covenantSig,proto3,customtype=github.com/babylonchain/babylon/types.BIP340Signature" json:"covenant_sig,omitempty"` // if this object is present it menans that staker requested undelegation, and whole // delegation is being undelegated. @@ -404,14 +405,12 @@ type BTCUndelegation struct { // covenant_slashing_sig is the signature on the slashing tx // by the covenant (i.e., SK corresponding to covenant_pk in params) // It must be provided after processing undelagate message by Babylon - // TODO: change to a set of (covenant PK, covenant adaptor signature) tuples + // TODO: change to a matrix of (covenant PK, covenant adaptor signature) tuples CovenantSlashingSig *github_com_babylonchain_babylon_types.BIP340Signature `protobuf:"bytes,5,opt,name=covenant_slashing_sig,json=covenantSlashingSig,proto3,customtype=github.com/babylonchain/babylon/types.BIP340Signature" json:"covenant_slashing_sig,omitempty"` - // covenant_unbonding_sig is the signature on the unbonding tx - // by the covenant (i.e., SK corresponding to covenant_pk in params) - // It must be provided after processing undelagate message by Babylon and after - // validator sig will be provided by validator - // TODO: change to a set of (covenant PK, covenant Schnorr signature) tuples - CovenantUnbondingSig *github_com_babylonchain_babylon_types.BIP340Signature `protobuf:"bytes,6,opt,name=covenant_unbonding_sig,json=covenantUnbondingSig,proto3,customtype=github.com/babylonchain/babylon/types.BIP340Signature" json:"covenant_unbonding_sig,omitempty"` + // covenant_unbonding_sig_list is the list of signatures on the unbonding tx + // by covenant members + // It must be provided after processing undelagate message by Babylon + CovenantUnbondingSigList []*SignatureInfo `protobuf:"bytes,6,rep,name=covenant_unbonding_sig_list,json=covenantUnbondingSigList,proto3" json:"covenant_unbonding_sig_list,omitempty"` } func (m *BTCUndelegation) Reset() { *m = BTCUndelegation{} } @@ -461,17 +460,24 @@ func (m *BTCUndelegation) GetUnbondingTime() uint32 { return 0 } +func (m *BTCUndelegation) GetCovenantUnbondingSigList() []*SignatureInfo { + if m != nil { + return m.CovenantUnbondingSigList + } + return nil +} + // BTCUndelegationInfo provides all necessary info about the undeleagation type BTCUndelegationInfo struct { // unbonding_tx is the transaction which will transfer the funds from staking // output to unbonding output. Unbonding output will usually have lower timelock // than staking output. UnbondingTx []byte `protobuf:"bytes,1,opt,name=unbonding_tx,json=unbondingTx,proto3" json:"unbonding_tx,omitempty"` - // covenant_unbonding_sig is the signature on the unbonding tx - // by the covenant (i.e., SK corresponding to covenant_pk in params) - // it will be nil if covenant didn't sign it yet - // TODO: change to a set of (covenant PK, covenant Schnorr signature) tuples - CovenantUnbondingSig *github_com_babylonchain_babylon_types.BIP340Signature `protobuf:"bytes,2,opt,name=covenant_unbonding_sig,json=covenantUnbondingSig,proto3,customtype=github.com/babylonchain/babylon/types.BIP340Signature" json:"covenant_unbonding_sig,omitempty"` + // covenant_unbonding_sig_list is the list of signatures on the unbonding tx + // by covenant members + // It must be provided after processing undelagate message by Babylon and after + // validator sig will be provided by validator + CovenantUnbondingSigList []*SignatureInfo `protobuf:"bytes,2,rep,name=covenant_unbonding_sig_list,json=covenantUnbondingSigList,proto3" json:"covenant_unbonding_sig_list,omitempty"` } func (m *BTCUndelegationInfo) Reset() { *m = BTCUndelegationInfo{} } @@ -514,6 +520,13 @@ func (m *BTCUndelegationInfo) GetUnbondingTx() []byte { return nil } +func (m *BTCUndelegationInfo) GetCovenantUnbondingSigList() []*SignatureInfo { + if m != nil { + return m.CovenantUnbondingSigList + } + return nil +} + // BTCDelegatorDelegations is a collection of BTC delegations from the same delegator. type BTCDelegatorDelegations struct { Dels []*BTCDelegation `protobuf:"bytes,1,rep,name=dels,proto3" json:"dels,omitempty"` @@ -660,73 +673,74 @@ func init() { } var fileDescriptor_3851ae95ccfaf7db = []byte{ - // 1046 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xdd, 0x6e, 0x1b, 0x45, - 0x14, 0xce, 0xda, 0x8e, 0x5b, 0x1f, 0xdb, 0xc4, 0x9d, 0xa6, 0xc1, 0x24, 0xc2, 0x36, 0xa6, 0x54, - 0x16, 0xa2, 0x6b, 0x92, 0xfe, 0x08, 0xb8, 0x40, 0xaa, 0xe3, 0x40, 0xad, 0xe6, 0xc7, 0xac, 0x9d, - 0x22, 0x10, 0xb0, 0x9a, 0xdd, 0x9d, 0xac, 0x57, 0xb6, 0x77, 0x56, 0x9e, 0xb1, 0xb1, 0xef, 0x79, - 0x00, 0x1e, 0x82, 0x1b, 0xb8, 0xe6, 0x21, 0xb8, 0xac, 0xe0, 0x06, 0xe5, 0x22, 0xaa, 0x92, 0x17, - 0x41, 0x3b, 0x3b, 0xeb, 0xdd, 0x84, 0x04, 0x5a, 0x1c, 0xee, 0x3c, 0x73, 0xce, 0xf9, 0xce, 0x77, - 0xbe, 0xef, 0x64, 0xb2, 0x70, 0xcf, 0xc0, 0xc6, 0x6c, 0x40, 0xdd, 0xba, 0xc1, 0x4d, 0xc6, 0x71, - 0xdf, 0x71, 0xed, 0xfa, 0x64, 0x33, 0x76, 0x52, 0xbd, 0x11, 0xe5, 0x14, 0xdd, 0x91, 0x79, 0x6a, - 0x2c, 0x32, 0xd9, 0x5c, 0x5f, 0xb5, 0xa9, 0x4d, 0x45, 0x46, 0xdd, 0xff, 0x15, 0x24, 0xaf, 0xbf, - 0x65, 0x52, 0x36, 0xa4, 0x4c, 0x0f, 0x02, 0xc1, 0x41, 0x86, 0xaa, 0xc1, 0xa9, 0x6e, 0x8e, 0x66, - 0x1e, 0xa7, 0x75, 0x46, 0x4c, 0x6f, 0xeb, 0xd1, 0xe3, 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0x4e, 0xbb, 0x35, 0x7f, 0x9e, 0x9e, 0x62, 0xd6, 0xf3, 0x1f, 0xc9, 0xea, 0x4f, 0x0a, - 0xe4, 0xe7, 0x83, 0x08, 0x29, 0x3f, 0x83, 0xc4, 0xc2, 0xff, 0x5c, 0x13, 0x5e, 0x1f, 0x3d, 0x83, - 0xe4, 0xb5, 0x88, 0xeb, 0xa3, 0xbc, 0xdf, 0x15, 0xb6, 0x47, 0xd3, 0x76, 0x38, 0xe6, 0x63, 0x86, - 0xb2, 0x70, 0xa3, 0xbd, 0xb3, 0xdf, 0x6c, 0xed, 0x7f, 0x5e, 0x58, 0x42, 0x00, 0xe9, 0x27, 0xdb, - 0xdd, 0xd6, 0xf3, 0x9d, 0x82, 0x82, 0xf2, 0x90, 0x39, 0xdc, 0x6f, 0x1c, 0x04, 0xa1, 0x04, 0xca, - 0xc1, 0xcd, 0xe0, 0xb8, 0xd3, 0x2c, 0x24, 0xd1, 0x0d, 0x48, 0x3e, 0xd9, 0xff, 0xaa, 0x90, 0x6a, - 0xec, 0xfe, 0x76, 0x5a, 0x52, 0x5e, 0x9c, 0x96, 0x94, 0x97, 0xa7, 0x25, 0xe5, 0xc7, 0xb3, 0xd2, - 0xd2, 0x8b, 0xb3, 0xd2, 0xd2, 0x9f, 0x67, 0xa5, 0xa5, 0xaf, 0xff, 0x75, 0xe8, 0x69, 0xfc, 0x7b, - 0x54, 0x10, 0x37, 0xd2, 0xe2, 0x7b, 0xf4, 0xc1, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf9, 0x12, - 0x09, 0xab, 0x6c, 0x0b, 0x00, 0x00, + // 1060 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x5d, 0x6f, 0xe3, 0x44, + 0x17, 0xae, 0x93, 0x34, 0xbb, 0x39, 0x49, 0xde, 0x66, 0x67, 0xbb, 0x7d, 0x43, 0x2b, 0x92, 0x10, + 0x96, 0x55, 0x84, 0x58, 0x87, 0x76, 0x3f, 0x04, 0x5c, 0x20, 0x6d, 0x9a, 0xc2, 0x46, 0xdb, 0x8f, + 0xe0, 0xa4, 0x8b, 0x40, 0x80, 0x35, 0xb6, 0xa7, 0x8e, 0x95, 0xc4, 0x63, 0x65, 0x26, 0x21, 0xb9, + 0xe7, 0x07, 0xf0, 0x07, 0xb8, 0xe3, 0x8a, 0x6b, 0x7e, 0x04, 0x97, 0x2b, 0xe0, 0x02, 0xf5, 0xa2, + 0x42, 0xed, 0x1f, 0x41, 0x1e, 0x8f, 0x63, 0xb7, 0xb4, 0xfb, 0x41, 0x7a, 0xd7, 0x99, 0x73, 0xce, + 0x73, 0x9e, 0xf3, 0x3c, 0xc7, 0xd3, 0xc0, 0x3d, 0x03, 0x1b, 0xb3, 0x01, 0x75, 0xeb, 0x06, 0x37, + 0x19, 0xc7, 0x7d, 0xc7, 0xb5, 0xeb, 0x93, 0xcd, 0xd8, 0x49, 0xf5, 0x46, 0x94, 0x53, 0x74, 0x47, + 0xe6, 0xa9, 0xb1, 0xc8, 0x64, 0x73, 0x7d, 0xd5, 0xa6, 0x36, 0x15, 0x19, 0x75, 0xff, 0xaf, 0x20, + 0x79, 0xfd, 0x2d, 0x93, 0xb2, 0x21, 0x65, 0x7a, 0x10, 0x08, 0x0e, 0x32, 0x54, 0x0d, 0x4e, 0x75, + 0x73, 0x34, 0xf3, 0x38, 0xad, 0x33, 0x62, 0x7a, 0x5b, 0x8f, 0x1e, 0xf7, 0x37, 0xeb, 0x7d, 0x32, + 0x0b, 0x73, 0xee, 0xca, 0x9c, 0x88, 0x8f, 0x41, 0x38, 0xde, 0xac, 0x9f, 0x63, 0xb4, 0x5e, 0xbe, + 0x9c, 0xb9, 0x47, 0xbd, 0x20, 0xa1, 0xfa, 0x47, 0x12, 0x72, 0x8d, 0xee, 0xf6, 0x73, 0x3c, 0x70, + 0x2c, 0xcc, 0xe9, 0x08, 0xed, 0x40,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1, 0xf9, 0x45, 0xe8, 0x21, 0xac, + 0xb1, 0x01, 0x66, 0x3d, 0x62, 0xe9, 0xe1, 0x48, 0x3d, 0xe2, 0xd8, 0x3d, 0x5e, 0x4c, 0x57, 0x94, + 0x5a, 0x4a, 0x5b, 0x95, 0xd1, 0x46, 0x10, 0x7c, 0x2a, 0x62, 0xe8, 0x03, 0x40, 0xf3, 0x2a, 0x6e, + 0x86, 0x15, 0x37, 0x44, 0x45, 0x21, 0xac, 0xe0, 0x66, 0x90, 0x5d, 0xfd, 0x21, 0x01, 0xab, 0x71, + 0x57, 0xbf, 0x74, 0x78, 0x6f, 0x8f, 0x70, 0x1c, 0xd3, 0x41, 0xb9, 0x0e, 0x1d, 0xd6, 0x20, 0x2d, + 0x99, 0x24, 0x04, 0x13, 0x79, 0x42, 0xef, 0x40, 0x6e, 0x42, 0xb9, 0xe3, 0xda, 0xba, 0x47, 0xbf, + 0x27, 0x23, 0x61, 0x58, 0x4a, 0xcb, 0x06, 0x77, 0x6d, 0xff, 0xea, 0x25, 0x32, 0xa4, 0xde, 0x58, + 0x86, 0xe5, 0x2b, 0x64, 0xf8, 0x25, 0x0d, 0xf9, 0x46, 0x77, 0xbb, 0x49, 0x06, 0xc4, 0xc6, 0xfc, + 0xdf, 0x7b, 0xa4, 0x2c, 0xb0, 0x47, 0x89, 0x6b, 0xdc, 0xa3, 0xe4, 0x7f, 0xd9, 0xa3, 0x6f, 0x61, + 0x65, 0x82, 0x07, 0x7a, 0x40, 0x47, 0x1f, 0x38, 0xcc, 0x57, 0x2e, 0xb9, 0x00, 0xa7, 0xdc, 0x04, + 0x0f, 0x1a, 0x3e, 0xad, 0x5d, 0x87, 0x09, 0x0b, 0x19, 0xc7, 0x23, 0x7e, 0x5e, 0xe3, 0xac, 0xb8, + 0x93, 0x66, 0xbc, 0x0d, 0x40, 0x5c, 0xeb, 0xfc, 0xf6, 0x66, 0x88, 0x6b, 0xc9, 0xf0, 0x06, 0x64, + 0x38, 0xe5, 0x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, 0x62, 0xd1, + 0x05, 0xf3, 0x51, 0xde, 0xef, 0x0a, 0xab, 0xa3, 0x69, 0x3b, 0x1c, 0xf3, 0x31, 0x43, 0x59, 0xb8, + 0xd1, 0xde, 0xd9, 0x6f, 0xb6, 0xf6, 0x3f, 0x2f, 0x2c, 0x21, 0x80, 0xf4, 0x93, 0xed, 0x6e, 0xeb, + 0xf9, 0x4e, 0x41, 0x41, 0x79, 0xc8, 0x1c, 0xee, 0x37, 0x0e, 0x82, 0x50, 0x02, 0xe5, 0xe0, 0x66, + 0x70, 0xdc, 0x69, 0x16, 0x92, 0xe8, 0x06, 0x24, 0x9f, 0xec, 0x7f, 0x55, 0x48, 0x35, 0x76, 0x7f, + 0x3b, 0x2d, 0x29, 0x2f, 0x4e, 0x4b, 0xca, 0xdf, 0xa7, 0x25, 0xe5, 0xc7, 0xb3, 0xd2, 0xd2, 0x8b, + 0xb3, 0xd2, 0xd2, 0x5f, 0x67, 0xa5, 0xa5, 0xaf, 0x5f, 0x39, 0xf4, 0x34, 0xfe, 0xbb, 0x53, 0x10, + 0x37, 0xd2, 0xe2, 0x77, 0xe7, 0x83, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x0c, 0x99, 0xd6, 0x9d, + 0x54, 0x0b, 0x00, 0x00, } func (m *BTCValidator) Marshal() (dAtA []byte, err error) { @@ -1045,17 +1059,19 @@ func (m *BTCUndelegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.CovenantUnbondingSig != nil { - { - size := m.CovenantUnbondingSig.Size() - i -= size - if _, err := m.CovenantUnbondingSig.MarshalTo(dAtA[i:]); err != nil { - return 0, err + if len(m.CovenantUnbondingSigList) > 0 { + for iNdEx := len(m.CovenantUnbondingSigList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.CovenantUnbondingSigList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBtcstaking(dAtA, i, uint64(size)) } - i = encodeVarintBtcstaking(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x32 } - i-- - dAtA[i] = 0x32 } if m.CovenantSlashingSig != nil { { @@ -1128,17 +1144,19 @@ func (m *BTCUndelegationInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.CovenantUnbondingSig != nil { - { - size := m.CovenantUnbondingSig.Size() - i -= size - if _, err := m.CovenantUnbondingSig.MarshalTo(dAtA[i:]); err != nil { - return 0, err + if len(m.CovenantUnbondingSigList) > 0 { + for iNdEx := len(m.CovenantUnbondingSigList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.CovenantUnbondingSigList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBtcstaking(dAtA, i, uint64(size)) } - i = encodeVarintBtcstaking(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 } - i-- - dAtA[i] = 0x12 } if len(m.UnbondingTx) > 0 { i -= len(m.UnbondingTx) @@ -1421,9 +1439,11 @@ func (m *BTCUndelegation) Size() (n int) { l = m.CovenantSlashingSig.Size() n += 1 + l + sovBtcstaking(uint64(l)) } - if m.CovenantUnbondingSig != nil { - l = m.CovenantUnbondingSig.Size() - n += 1 + l + sovBtcstaking(uint64(l)) + if len(m.CovenantUnbondingSigList) > 0 { + for _, e := range m.CovenantUnbondingSigList { + l = e.Size() + n += 1 + l + sovBtcstaking(uint64(l)) + } } return n } @@ -1438,9 +1458,11 @@ func (m *BTCUndelegationInfo) Size() (n int) { if l > 0 { n += 1 + l + sovBtcstaking(uint64(l)) } - if m.CovenantUnbondingSig != nil { - l = m.CovenantUnbondingSig.Size() - n += 1 + l + sovBtcstaking(uint64(l)) + if len(m.CovenantUnbondingSigList) > 0 { + for _, e := range m.CovenantUnbondingSigList { + l = e.Size() + n += 1 + l + sovBtcstaking(uint64(l)) + } } return n } @@ -2558,9 +2580,9 @@ func (m *BTCUndelegation) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CovenantUnbondingSig", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CovenantUnbondingSigList", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowBtcstaking @@ -2570,24 +2592,23 @@ func (m *BTCUndelegation) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthBtcstaking } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthBtcstaking } if postIndex > l { return io.ErrUnexpectedEOF } - var v github_com_babylonchain_babylon_types.BIP340Signature - m.CovenantUnbondingSig = &v - if err := m.CovenantUnbondingSig.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.CovenantUnbondingSigList = append(m.CovenantUnbondingSigList, &SignatureInfo{}) + if err := m.CovenantUnbondingSigList[len(m.CovenantUnbondingSigList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2677,9 +2698,9 @@ func (m *BTCUndelegationInfo) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CovenantUnbondingSig", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CovenantUnbondingSigList", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowBtcstaking @@ -2689,24 +2710,23 @@ func (m *BTCUndelegationInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthBtcstaking } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthBtcstaking } if postIndex > l { return io.ErrUnexpectedEOF } - var v github_com_babylonchain_babylon_types.BIP340Signature - m.CovenantUnbondingSig = &v - if err := m.CovenantUnbondingSig.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.CovenantUnbondingSigList = append(m.CovenantUnbondingSigList, &SignatureInfo{}) + if err := m.CovenantUnbondingSigList[len(m.CovenantUnbondingSigList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/btcstaking/types/btcstaking_test.go b/x/btcstaking/types/btcstaking_test.go index cfc2a0ba0..785c79ad8 100644 --- a/x/btcstaking/types/btcstaking_test.go +++ b/x/btcstaking/types/btcstaking_test.go @@ -1,10 +1,11 @@ package types_test import ( - sdkmath "cosmossdk.io/math" "math/rand" "testing" + sdkmath "cosmossdk.io/math" + "github.com/babylonchain/babylon/testutil/datagen" bbn "github.com/babylonchain/babylon/types" "github.com/babylonchain/babylon/x/btcstaking/types" @@ -84,7 +85,7 @@ func FuzzBTCDelegation(f *testing.F) { // test expected voting power hasVotingPower := hasCovenantSig && btcDel.StartHeight <= btcHeight && btcHeight+w <= btcDel.EndHeight - actualVotingPower := btcDel.VotingPower(btcHeight, w) + actualVotingPower := btcDel.VotingPower(btcHeight, w, 1) if hasVotingPower { require.Equal(t, btcDel.TotalSat, actualVotingPower) } else { diff --git a/x/btcstaking/types/errors.go b/x/btcstaking/types/errors.go index 3a1f641fa..bc8287ddc 100644 --- a/x/btcstaking/types/errors.go +++ b/x/btcstaking/types/errors.go @@ -17,16 +17,17 @@ var ( ErrInvalidCovenantPK = errorsmod.Register(ModuleName, 1108, "the BTC staking tx specifies a wrong covenant PK") ErrInvalidStakingTx = errorsmod.Register(ModuleName, 1109, "the BTC staking tx is not valid") ErrInvalidSlashingTx = errorsmod.Register(ModuleName, 1110, "the BTC slashing tx is not valid") - ErrDuplicatedCovenantSig = errorsmod.Register(ModuleName, 1111, "the BTC delegation has already received covenant signature") - ErrInvalidCovenantSig = errorsmod.Register(ModuleName, 1112, "the covenant signature is not valid") - ErrCommissionLTMinRate = errorsmod.Register(ModuleName, 1113, "commission cannot be less than min rate") - ErrInvalidDelegationState = errorsmod.Register(ModuleName, 1114, "Unexpected delegation state") - ErrInvalidUnbodningTx = errorsmod.Register(ModuleName, 1115, "the BTC unbonding tx is not valid") - ErrUnbondingDuplicatedValidatorSig = errorsmod.Register(ModuleName, 1116, "the BTC undelegation has already received validator signature") - ErrUnbodningInvalidValidatorSig = errorsmod.Register(ModuleName, 1117, "the validator signature is not valid") - ErrUnbondingUnexpectedValidatorSig = errorsmod.Register(ModuleName, 1118, "the BTC undelegation did not receive validator signature yet") - ErrRewardDistCacheNotFound = errorsmod.Register(ModuleName, 1119, "the reward distribution cache is not found") - ErrEmptyValidatorList = errorsmod.Register(ModuleName, 1120, "the validator list is empty") - ErrInvalidProofOfPossession = errorsmod.Register(ModuleName, 1121, "the proof of possession is not valid") - ErrDuplicatedValidator = errorsmod.Register(ModuleName, 1122, "the staking request contains duplicated validator public key") + ErrDuplicatedCovenantSig = errorsmod.Register(ModuleName, 1111, "the BTC delegation has already received this covenant signature") + ErrCovenantQuorumAlreadyReached = errorsmod.Register(ModuleName, 1112, "the BTC delegation has already received a quorum number of covenant signatures") + ErrInvalidCovenantSig = errorsmod.Register(ModuleName, 1113, "the covenant signature is not valid") + ErrCommissionLTMinRate = errorsmod.Register(ModuleName, 1114, "commission cannot be less than min rate") + ErrInvalidDelegationState = errorsmod.Register(ModuleName, 1115, "Unexpected delegation state") + ErrInvalidUnbodningTx = errorsmod.Register(ModuleName, 1116, "the BTC unbonding tx is not valid") + ErrUnbondingDuplicatedValidatorSig = errorsmod.Register(ModuleName, 1117, "the BTC undelegation has already received validator signature") + ErrUnbodningInvalidValidatorSig = errorsmod.Register(ModuleName, 1118, "the validator signature is not valid") + ErrUnbondingUnexpectedValidatorSig = errorsmod.Register(ModuleName, 1119, "the BTC undelegation did not receive validator signature yet") + ErrRewardDistCacheNotFound = errorsmod.Register(ModuleName, 1120, "the reward distribution cache is not found") + ErrEmptyValidatorList = errorsmod.Register(ModuleName, 1121, "the validator list is empty") + ErrInvalidProofOfPossession = errorsmod.Register(ModuleName, 1122, "the proof of possession is not valid") + ErrDuplicatedValidator = errorsmod.Register(ModuleName, 1123, "the staking request contains duplicated validator public key") ) diff --git a/x/btcstaking/types/incentive.go b/x/btcstaking/types/incentive.go index f6787e7a3..92a4df6f7 100644 --- a/x/btcstaking/types/incentive.go +++ b/x/btcstaking/types/incentive.go @@ -54,10 +54,10 @@ func (v *BTCValDistInfo) GetAddress() sdk.AccAddress { return sdk.AccAddress(v.BabylonPk.Address()) } -func (v *BTCValDistInfo) AddBTCDel(btcDel *BTCDelegation, btcHeight uint64, wValue uint64) { +func (v *BTCValDistInfo) AddBTCDel(btcDel *BTCDelegation, btcHeight uint64, wValue uint64, covenantQuorum uint32) { btcDelDistInfo := &BTCDelDistInfo{ BabylonPk: btcDel.BabylonPk, - VotingPower: btcDel.VotingPower(btcHeight, wValue), + VotingPower: btcDel.VotingPower(btcHeight, wValue, covenantQuorum), } if btcDelDistInfo.VotingPower > 0 { diff --git a/x/btcstaking/types/msg.go b/x/btcstaking/types/msg.go index 217a9c559..6104f6dcf 100644 --- a/x/btcstaking/types/msg.go +++ b/x/btcstaking/types/msg.go @@ -91,8 +91,8 @@ func (m *MsgCreateBTCDelegation) ValidateBasic() error { if m.Pop == nil { return fmt.Errorf("empty proof of possession") } - if m.StakerBtcPk == nil { - return fmt.Errorf("empty staker BTC public key") + if m.BtcPk == nil { + return fmt.Errorf("empty delegator BTC public key") } if m.StakingTx == nil { return fmt.Errorf("empty staking tx info") @@ -127,11 +127,8 @@ func (m *MsgAddCovenantSig) GetSigners() []sdk.AccAddress { } func (m *MsgAddCovenantSig) ValidateBasic() error { - if m.ValPk == nil { - return fmt.Errorf("empty BTC validator public key") - } - if m.DelPk == nil { - return fmt.Errorf("empty BTC delegation public key") + if m.Pk == nil { + return fmt.Errorf("empty BTC covenant public key") } if m.Sig == nil { return fmt.Errorf("empty covenant signature") @@ -187,11 +184,8 @@ func (m *MsgAddCovenantUnbondingSigs) GetSigners() []sdk.AccAddress { } func (m *MsgAddCovenantUnbondingSigs) ValidateBasic() error { - if m.ValPk == nil { - return fmt.Errorf("empty BTC validator public key") - } - if m.DelPk == nil { - return fmt.Errorf("empty BTC delegation public key") + if m.Pk == nil { + return fmt.Errorf("empty BTC covenant public key") } if m.UnbondingTxSig == nil { return fmt.Errorf("empty covenant signature") diff --git a/x/btcstaking/types/params.go b/x/btcstaking/types/params.go index 6b36c964c..604838fc7 100644 --- a/x/btcstaking/types/params.go +++ b/x/btcstaking/types/params.go @@ -125,3 +125,12 @@ func (p Params) String() string { out, _ := yaml.Marshal(p) return string(out) } + +func (p Params) HasCovenantPK(pk *bbn.BIP340PubKey) bool { + for _, pk2 := range p.CovenantPks { + if pk2.Equals(pk) { + return true + } + } + return false +} diff --git a/x/btcstaking/types/tx.pb.go b/x/btcstaking/types/tx.pb.go index a5555ac5b..cb9709897 100644 --- a/x/btcstaking/types/tx.pb.go +++ b/x/btcstaking/types/tx.pb.go @@ -156,8 +156,8 @@ type MsgCreateBTCDelegation struct { BabylonPk *secp256k1.PubKey `protobuf:"bytes,2,opt,name=babylon_pk,json=babylonPk,proto3" json:"babylon_pk,omitempty"` // pop is the proof of possession of babylon_pk and btc_pk Pop *ProofOfPossession `protobuf:"bytes,3,opt,name=pop,proto3" json:"pop,omitempty"` - // staker_btc_pk is the Bitcoin secp256k1 PK of the BTC staker - StakerBtcPk *github_com_babylonchain_babylon_types.BIP340PubKey `protobuf:"bytes,4,opt,name=staker_btc_pk,json=stakerBtcPk,proto3,customtype=github.com/babylonchain/babylon/types.BIP340PubKey" json:"staker_btc_pk,omitempty"` + // btc_pk is the Bitcoin secp256k1 PK of the BTC delegator + BtcPk *github_com_babylonchain_babylon_types.BIP340PubKey `protobuf:"bytes,4,opt,name=btc_pk,json=btcPk,proto3,customtype=github.com/babylonchain/babylon/types.BIP340PubKey" json:"btc_pk,omitempty"` // val_btc_pk_list is the list of Bitcoin secp256k1 PKs of the BTC validators, if there is more than one // validator pk it means that delegation is re-staked ValBtcPkList []github_com_babylonchain_babylon_types.BIP340PubKey `protobuf:"bytes,5,rep,name=val_btc_pk_list,json=valBtcPkList,proto3,customtype=github.com/babylonchain/babylon/types.BIP340PubKey" json:"val_btc_pk_list,omitempty"` @@ -408,18 +408,15 @@ var xxx_messageInfo_MsgBTCUndelegateResponse proto.InternalMessageInfo // MsgAddCovenantSig is the message for handling a signature from covenant type MsgAddCovenantSig struct { Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` - // val_pk is the Bitcoin secp256k1 PK of the BTC validator - // the PK follows encoding in BIP-340 spec - ValPk *github_com_babylonchain_babylon_types.BIP340PubKey `protobuf:"bytes,2,opt,name=val_pk,json=valPk,proto3,customtype=github.com/babylonchain/babylon/types.BIP340PubKey" json:"val_pk,omitempty"` - // del_pk is the Bitcoin secp256k1 PK of the BTC delegation - // the PK follows encoding in BIP-340 spec - DelPk *github_com_babylonchain_babylon_types.BIP340PubKey `protobuf:"bytes,3,opt,name=del_pk,json=delPk,proto3,customtype=github.com/babylonchain/babylon/types.BIP340PubKey" json:"del_pk,omitempty"` + // pk is the BTC public key of the covenant member + Pk *github_com_babylonchain_babylon_types.BIP340PubKey `protobuf:"bytes,2,opt,name=pk,proto3,customtype=github.com/babylonchain/babylon/types.BIP340PubKey" json:"pk,omitempty"` // staking_tx_hash is the hash of the staking tx. - // (val_pk, del_pk, staking_tx_hash) uniquely identifies a BTC delegation - StakingTxHash string `protobuf:"bytes,4,opt,name=staking_tx_hash,json=stakingTxHash,proto3" json:"staking_tx_hash,omitempty"` + // It uniquely identifies a BTC delegation + StakingTxHash string `protobuf:"bytes,3,opt,name=staking_tx_hash,json=stakingTxHash,proto3" json:"staking_tx_hash,omitempty"` // sig is the signature of the covenant // the signature follows encoding in BIP-340 spec - Sig *github_com_babylonchain_babylon_types.BIP340Signature `protobuf:"bytes,5,opt,name=sig,proto3,customtype=github.com/babylonchain/babylon/types.BIP340Signature" json:"sig,omitempty"` + // TODO: change to adaptor signature + Sig *github_com_babylonchain_babylon_types.BIP340Signature `protobuf:"bytes,4,opt,name=sig,proto3,customtype=github.com/babylonchain/babylon/types.BIP340Signature" json:"sig,omitempty"` } func (m *MsgAddCovenantSig) Reset() { *m = MsgAddCovenantSig{} } @@ -606,21 +603,18 @@ var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo // MsgAddCovenantUnbondingSigs is the message for handling a signature from covenant type MsgAddCovenantUnbondingSigs struct { Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` - // val_pk is the Bitcoin secp256k1 PK of the BTC validator - // the PK follows encoding in BIP-340 spec - ValPk *github_com_babylonchain_babylon_types.BIP340PubKey `protobuf:"bytes,2,opt,name=val_pk,json=valPk,proto3,customtype=github.com/babylonchain/babylon/types.BIP340PubKey" json:"val_pk,omitempty"` - // del_pk is the Bitcoin secp256k1 PK of the BTC delegation - // the PK follows encoding in BIP-340 spec - DelPk *github_com_babylonchain_babylon_types.BIP340PubKey `protobuf:"bytes,3,opt,name=del_pk,json=delPk,proto3,customtype=github.com/babylonchain/babylon/types.BIP340PubKey" json:"del_pk,omitempty"` + // pk is the BTC public key of the covenant member + Pk *github_com_babylonchain_babylon_types.BIP340PubKey `protobuf:"bytes,2,opt,name=pk,proto3,customtype=github.com/babylonchain/babylon/types.BIP340PubKey" json:"pk,omitempty"` // staking_tx_hash is the hash of the staking tx. // (val_pk, del_pk, staking_tx_hash) uniquely identifies a BTC delegation - StakingTxHash string `protobuf:"bytes,4,opt,name=staking_tx_hash,json=stakingTxHash,proto3" json:"staking_tx_hash,omitempty"` + StakingTxHash string `protobuf:"bytes,3,opt,name=staking_tx_hash,json=stakingTxHash,proto3" json:"staking_tx_hash,omitempty"` // unbonding_tx_sig is the signature of the covenant on the unbonding tx submitted to babylon // the signature follows encoding in BIP-340 spec - UnbondingTxSig *github_com_babylonchain_babylon_types.BIP340Signature `protobuf:"bytes,5,opt,name=unbonding_tx_sig,json=unbondingTxSig,proto3,customtype=github.com/babylonchain/babylon/types.BIP340Signature" json:"unbonding_tx_sig,omitempty"` + UnbondingTxSig *github_com_babylonchain_babylon_types.BIP340Signature `protobuf:"bytes,4,opt,name=unbonding_tx_sig,json=unbondingTxSig,proto3,customtype=github.com/babylonchain/babylon/types.BIP340Signature" json:"unbonding_tx_sig,omitempty"` // slashing_unbonding_tx_sig is the signature of the covenant on slashing tx corresponding to unbodning tx submitted to babylon // the signature follows encoding in BIP-340 spec - SlashingUnbondingTxSig *github_com_babylonchain_babylon_types.BIP340Signature `protobuf:"bytes,6,opt,name=slashing_unbonding_tx_sig,json=slashingUnbondingTxSig,proto3,customtype=github.com/babylonchain/babylon/types.BIP340Signature" json:"slashing_unbonding_tx_sig,omitempty"` + // TODO: change to adaptor signature + SlashingUnbondingTxSig *github_com_babylonchain_babylon_types.BIP340Signature `protobuf:"bytes,5,opt,name=slashing_unbonding_tx_sig,json=slashingUnbondingTxSig,proto3,customtype=github.com/babylonchain/babylon/types.BIP340Signature" json:"slashing_unbonding_tx_sig,omitempty"` } func (m *MsgAddCovenantUnbondingSigs) Reset() { *m = MsgAddCovenantUnbondingSigs{} } @@ -725,81 +719,79 @@ func init() { func init() { proto.RegisterFile("babylon/btcstaking/v1/tx.proto", fileDescriptor_4baddb53e97f38f2) } var fileDescriptor_4baddb53e97f38f2 = []byte{ - // 1169 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x57, 0x4f, 0x6f, 0x1a, 0x47, - 0x14, 0x37, 0xc6, 0xd0, 0xf2, 0x00, 0x3b, 0xd9, 0x3a, 0x0e, 0xc6, 0x0a, 0x10, 0xdc, 0x24, 0x34, - 0x8a, 0x97, 0x98, 0xc4, 0x96, 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0, 0xf6, 0x3c, 0xb7, 0xf0, 0xe7, - 0x79, 0x6e, 0xe1, 0xe5, 0xbf, 0xee, 0x97, 0x51, 0xf0, 0x13, 0xca, 0x9e, 0xbe, 0x76, 0xdc, 0xfe, - 0x84, 0x7a, 0xf4, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0b, 0x1a, 0xb9, 0xe0, 0x82, 0x0e, 0x00, - 0x00, + // 1145 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0x4f, 0x6f, 0x1a, 0xc7, + 0x1b, 0xf6, 0x1a, 0xc3, 0xef, 0xe7, 0x17, 0xb0, 0x93, 0xad, 0xe3, 0x60, 0xac, 0x00, 0xc1, 0x4d, + 0x42, 0xa3, 0x78, 0x37, 0x26, 0xb1, 0xa5, 0xba, 0x52, 0xa5, 0x60, 0xb7, 0x4a, 0x14, 0xa3, 0xa2, + 0x05, 0xe7, 0x50, 0xa9, 0x45, 0xc3, 0x32, 0x5e, 0x56, 0xc0, 0xce, 0x6a, 0x67, 0x40, 0xa0, 0x5e, + 0xaa, 0x1e, 0x2b, 0x55, 0xea, 0xa9, 0xb7, 0x7e, 0x87, 0x1c, 0xf2, 0x21, 0x72, 0x6b, 0x9a, 0x53, + 0xe5, 0x83, 0x55, 0xd9, 0x87, 0x7c, 0x82, 0xde, 0xab, 0xdd, 0x9d, 0xfd, 0x67, 0x43, 0x8b, 0xe3, + 0x1c, 0x7a, 0x63, 0x76, 0x9e, 0xf7, 0x79, 0xdf, 0x79, 0x9e, 0x77, 0xde, 0x65, 0x21, 0xd7, 0x42, + 0xad, 0x71, 0x8f, 0x18, 0x72, 0x8b, 0xa9, 0x94, 0xa1, 0xae, 0x6e, 0x68, 0xf2, 0x70, 0x4b, 0x66, + 0x23, 0xc9, 0xb4, 0x08, 0x23, 0xe2, 0x0d, 0xbe, 0x2f, 0x05, 0xfb, 0xd2, 0x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 0x05, 0xc8, 0x4c, 0xbd, 0x8b, 0xe5, + 0x99, 0xe8, 0x22, 0x31, 0xd9, 0xdd, 0xcb, 0xc7, 0xf8, 0xc5, 0x1c, 0x41, 0x2a, 0x32, 0xcb, 0xee, + 0x4e, 0xe7, 0x0a, 0xe3, 0xb2, 0xd2, 0x6c, 0x38, 0x2f, 0x4f, 0x36, 0xfe, 0xfd, 0xbb, 0x97, 0xf7, + 0x85, 0xca, 0xc1, 0xeb, 0xd3, 0x9c, 0xf0, 0xe6, 0x34, 0x27, 0xfc, 0x79, 0x9a, 0x13, 0x7e, 0x3e, + 0xcb, 0xcd, 0xbd, 0x39, 0xcb, 0xcd, 0xfd, 0x71, 0x96, 0x9b, 0xfb, 0xfa, 0x5f, 0x87, 0xcb, 0x28, + 0xfc, 0x25, 0xe2, 0xdc, 0xbe, 0x56, 0xc2, 0xf9, 0x12, 0x79, 0xf4, 0x77, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x05, 0x25, 0x56, 0xb9, 0xc9, 0x0d, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1271,11 +1263,11 @@ func (m *MsgCreateBTCDelegation) MarshalToSizedBuffer(dAtA []byte) (int, error) dAtA[i] = 0x2a } } - if m.StakerBtcPk != nil { + if m.BtcPk != nil { { - size := m.StakerBtcPk.Size() + size := m.BtcPk.Size() i -= size - if _, err := m.StakerBtcPk.MarshalTo(dAtA[i:]); err != nil { + if _, err := m.BtcPk.MarshalTo(dAtA[i:]); err != nil { return 0, err } i = encodeVarintTx(dAtA, i, uint64(size)) @@ -1464,32 +1456,20 @@ func (m *MsgAddCovenantSig) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x2a + dAtA[i] = 0x22 } if len(m.StakingTxHash) > 0 { i -= len(m.StakingTxHash) copy(dAtA[i:], m.StakingTxHash) i = encodeVarintTx(dAtA, i, uint64(len(m.StakingTxHash))) i-- - dAtA[i] = 0x22 - } - if m.DelPk != nil { - { - size := m.DelPk.Size() - i -= size - if _, err := m.DelPk.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- dAtA[i] = 0x1a } - if m.ValPk != nil { + if m.Pk != nil { { - size := m.ValPk.Size() + size := m.Pk.Size() i -= size - if _, err := m.ValPk.MarshalTo(dAtA[i:]); err != nil { + if _, err := m.Pk.MarshalTo(dAtA[i:]); err != nil { return 0, err } i = encodeVarintTx(dAtA, i, uint64(size)) @@ -1623,7 +1603,7 @@ func (m *MsgAddCovenantUnbondingSigs) MarshalToSizedBuffer(dAtA []byte) (int, er i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x32 + dAtA[i] = 0x2a } if m.UnbondingTxSig != nil { { @@ -1635,32 +1615,20 @@ func (m *MsgAddCovenantUnbondingSigs) MarshalToSizedBuffer(dAtA []byte) (int, er i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x2a + dAtA[i] = 0x22 } if len(m.StakingTxHash) > 0 { i -= len(m.StakingTxHash) copy(dAtA[i:], m.StakingTxHash) i = encodeVarintTx(dAtA, i, uint64(len(m.StakingTxHash))) i-- - dAtA[i] = 0x22 - } - if m.DelPk != nil { - { - size := m.DelPk.Size() - i -= size - if _, err := m.DelPk.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- dAtA[i] = 0x1a } - if m.ValPk != nil { + if m.Pk != nil { { - size := m.ValPk.Size() + size := m.Pk.Size() i -= size - if _, err := m.ValPk.MarshalTo(dAtA[i:]); err != nil { + if _, err := m.Pk.MarshalTo(dAtA[i:]); err != nil { return 0, err } i = encodeVarintTx(dAtA, i, uint64(size)) @@ -1772,8 +1740,8 @@ func (m *MsgCreateBTCDelegation) Size() (n int) { l = m.Pop.Size() n += 1 + l + sovTx(uint64(l)) } - if m.StakerBtcPk != nil { - l = m.StakerBtcPk.Size() + if m.BtcPk != nil { + l = m.BtcPk.Size() n += 1 + l + sovTx(uint64(l)) } if len(m.ValBtcPkList) > 0 { @@ -1862,12 +1830,8 @@ func (m *MsgAddCovenantSig) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.ValPk != nil { - l = m.ValPk.Size() - n += 1 + l + sovTx(uint64(l)) - } - if m.DelPk != nil { - l = m.DelPk.Size() + if m.Pk != nil { + l = m.Pk.Size() n += 1 + l + sovTx(uint64(l)) } l = len(m.StakingTxHash) @@ -1924,12 +1888,8 @@ func (m *MsgAddCovenantUnbondingSigs) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.ValPk != nil { - l = m.ValPk.Size() - n += 1 + l + sovTx(uint64(l)) - } - if m.DelPk != nil { - l = m.DelPk.Size() + if m.Pk != nil { + l = m.Pk.Size() n += 1 + l + sovTx(uint64(l)) } l = len(m.StakingTxHash) @@ -2408,7 +2368,7 @@ func (m *MsgCreateBTCDelegation) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StakerBtcPk", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BtcPk", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -2436,8 +2396,8 @@ func (m *MsgCreateBTCDelegation) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } var v github_com_babylonchain_babylon_types.BIP340PubKey - m.StakerBtcPk = &v - if err := m.StakerBtcPk.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.BtcPk = &v + if err := m.BtcPk.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3028,7 +2988,7 @@ func (m *MsgAddCovenantSig) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValPk", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pk", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -3056,47 +3016,12 @@ func (m *MsgAddCovenantSig) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } var v github_com_babylonchain_babylon_types.BIP340PubKey - m.ValPk = &v - if err := m.ValPk.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Pk = &v + if err := m.Pk.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelPk", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v github_com_babylonchain_babylon_types.BIP340PubKey - m.DelPk = &v - if err := m.DelPk.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StakingTxHash", wireType) } @@ -3128,7 +3053,7 @@ func (m *MsgAddCovenantSig) Unmarshal(dAtA []byte) error { } m.StakingTxHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sig", wireType) } @@ -3462,7 +3387,7 @@ func (m *MsgAddCovenantUnbondingSigs) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValPk", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pk", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -3490,47 +3415,12 @@ func (m *MsgAddCovenantUnbondingSigs) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } var v github_com_babylonchain_babylon_types.BIP340PubKey - m.ValPk = &v - if err := m.ValPk.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Pk = &v + if err := m.Pk.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelPk", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v github_com_babylonchain_babylon_types.BIP340PubKey - m.DelPk = &v - if err := m.DelPk.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StakingTxHash", wireType) } @@ -3562,7 +3452,7 @@ func (m *MsgAddCovenantUnbondingSigs) Unmarshal(dAtA []byte) error { } m.StakingTxHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field UnbondingTxSig", wireType) } @@ -3597,7 +3487,7 @@ func (m *MsgAddCovenantUnbondingSigs) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 6: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field SlashingUnbondingTxSig", wireType) } diff --git a/x/checkpointing/client/cli/tx.go b/x/checkpointing/client/cli/tx.go index 7dc4aba4f..bfcdd7eff 100644 --- a/x/checkpointing/client/cli/tx.go +++ b/x/checkpointing/client/cli/tx.go @@ -1,15 +1,16 @@ package cli import ( - "cosmossdk.io/core/address" "fmt" - appparams "github.com/babylonchain/babylon/app/params" - authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" "os" "path/filepath" "strconv" "strings" + "cosmossdk.io/core/address" + appparams "github.com/babylonchain/babylon/app/params" + authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" + "github.com/babylonchain/babylon/crypto/bls12381" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" @@ -40,7 +41,7 @@ func GetTxCmd() *cobra.Command { func CmdTxAddBlsSig() *cobra.Command { cmd := &cobra.Command{ - Use: "submit [epoch_number] [last_commit_hash] [bls_sig] [signer address]", + Use: "submit [epoch_number] [app_hash] [bls_sig] [signer address]", Short: "submit a BLS signature", Args: cobra.ExactArgs(4), RunE: func(cmd *cobra.Command, args []string) error { diff --git a/x/checkpointing/keeper/msg_server_test.go b/x/checkpointing/keeper/msg_server_test.go index 58041b52e..e75423a4e 100644 --- a/x/checkpointing/keeper/msg_server_test.go +++ b/x/checkpointing/keeper/msg_server_test.go @@ -336,7 +336,7 @@ func FuzzAddBlsSig_CkptNotExist(f *testing.F) { } // FuzzAddBlsSig_WrongAppHash tests adding BLS signatures via MsgAddBlsSig -// in a scenario where the signature is signed over wrong last_commit_hash +// in a scenario where the signature is signed over wrong app_hash // 4. a BLS signature is rejected if the signature is invalid func FuzzAddBlsSig_WrongAppHash(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 4) diff --git a/x/checkpointing/types/checkpoint.pb.go b/x/checkpointing/types/checkpoint.pb.go index 3ba6609ef..ee8a7af89 100644 --- a/x/checkpointing/types/checkpoint.pb.go +++ b/x/checkpointing/types/checkpoint.pb.go @@ -276,7 +276,7 @@ func (m *CheckpointStateUpdate) GetBlockTime() *time.Time { type BlsSig struct { // epoch_num defines the epoch number that the BLS sig is signed on EpochNum uint64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` - // last_commit_hash defines the 'AppHash' that the BLS sig is signed on + // app_hash defines the 'AppHash' that the BLS sig is signed on AppHash *AppHash `protobuf:"bytes,2,opt,name=app_hash,json=appHash,proto3,customtype=AppHash" json:"app_hash,omitempty"` BlsSig *github_com_babylonchain_babylon_crypto_bls12381.Signature `protobuf:"bytes,3,opt,name=bls_sig,json=blsSig,proto3,customtype=github.com/babylonchain/babylon/crypto/bls12381.Signature" json:"bls_sig,omitempty"` // can't find cosmos_proto.scalar when compiling due to cosmos v0.45.4 does diff --git a/x/checkpointing/types/utils.go b/x/checkpointing/types/utils.go index d1a6c80b3..a7594b96b 100644 --- a/x/checkpointing/types/utils.go +++ b/x/checkpointing/types/utils.go @@ -36,7 +36,7 @@ func (m RawCheckpoint) HashStr() string { } // SignedMsg is the message corresponding to the BLS sig in this raw checkpoint -// Its value should be (epoch_number || last_commit_hash) +// Its value should be (epoch_number || app_hash) func (m RawCheckpoint) SignedMsg() []byte { return append(sdk.Uint64ToBigEndian(m.EpochNum), *m.AppHash...) } diff --git a/x/epoching/keeper/epochs.go b/x/epoching/keeper/epochs.go index 567ad1909..89dae1049 100644 --- a/x/epoching/keeper/epochs.go +++ b/x/epoching/keeper/epochs.go @@ -2,6 +2,7 @@ package keeper import ( "context" + errorsmod "cosmossdk.io/errors" "cosmossdk.io/store/prefix" "github.com/babylonchain/babylon/x/epoching/types" @@ -105,7 +106,7 @@ func (k Keeper) RecordLastHeaderAndAppHashRoot(ctx context.Context) error { // RecordSealerHeaderForPrevEpoch records the sealer header for the previous epoch, // where the sealer header of an epoch is the 2nd header of the next epoch -// This validator set of the epoch has generated a BLS multisig on `last_commit_hash` of the sealer header +// This validator set of the epoch has generated a BLS multisig on `app_hash` of the sealer header func (k Keeper) RecordSealerHeaderForPrevEpoch(ctx context.Context) *types.Epoch { // get the sealer header epoch := k.GetEpoch(ctx) diff --git a/x/epoching/types/epoching.pb.go b/x/epoching/types/epoching.pb.go index ffa316a79..a09931f41 100644 --- a/x/epoching/types/epoching.pb.go +++ b/x/epoching/types/epoching.pb.go @@ -84,7 +84,7 @@ type Epoch struct { // It will be used for proving a block is in an epoch AppHashRoot []byte `protobuf:"bytes,5,opt,name=app_hash_root,json=appHashRoot,proto3" json:"app_hash_root,omitempty"` // sealer_header is the 2nd header of the next epoch - // This validator set has generated a BLS multisig on `last_commit_hash` of + // This validator set has generated a BLS multisig on `app_hash` of // the sealer header SealerHeader *types.Header `protobuf:"bytes,6,opt,name=sealer_header,json=sealerHeader,proto3" json:"sealer_header,omitempty"` } diff --git a/x/finality/client/cli/tx.go b/x/finality/client/cli/tx.go index b7c4d8aca..7419d0fa8 100644 --- a/x/finality/client/cli/tx.go +++ b/x/finality/client/cli/tx.go @@ -94,7 +94,7 @@ func NewCommitPubRandListCmd() *cobra.Command { func NewAddFinalitySigCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "add-finality-sig [val_btc_pk] [block_height] [block_last_commit_hash] [finality_sig]", + Use: "add-finality-sig [val_btc_pk] [block_height] [block_app_hash] [finality_sig]", Args: cobra.ExactArgs(4), Short: "Add a finality signature", Long: strings.TrimSpace( @@ -131,11 +131,11 @@ func NewAddFinalitySigCmd() *cobra.Command { } msg := types.MsgAddFinalitySig{ - Signer: clientCtx.FromAddress.String(), - ValBtcPk: valBTCPK, - BlockHeight: blockHeight, + Signer: clientCtx.FromAddress.String(), + ValBtcPk: valBTCPK, + BlockHeight: blockHeight, BlockAppHash: blockLch, - FinalitySig: finalitySig, + FinalitySig: finalitySig, } return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) diff --git a/x/finality/types/finality.pb.go b/x/finality/types/finality.pb.go index 7fc2fbd68..c510d0d8d 100644 --- a/x/finality/types/finality.pb.go +++ b/x/finality/types/finality.pb.go @@ -28,8 +28,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type IndexedBlock struct { // height is the height of the block Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` - // last_commit_hash is the last_commit_hash of the block - AppHash []byte `protobuf:"bytes,2,opt,name=last_commit_hash,json=appHash,proto3" json:"last_commit_hash,omitempty"` + // app_hash is the AppHash of the block + AppHash []byte `protobuf:"bytes,2,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` // finalized indicates whether the IndexedBlock is finalised by 2/3 // BTC validators or not Finalized bool `protobuf:"varint,3,opt,name=finalized,proto3" json:"finalized,omitempty"` @@ -98,10 +98,10 @@ type Evidence struct { BlockHeight uint64 `protobuf:"varint,2,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` // pub_rand is the public randomness the BTC validator has committed to PubRand *github_com_babylonchain_babylon_types.SchnorrPubRand `protobuf:"bytes,3,opt,name=pub_rand,json=pubRand,proto3,customtype=github.com/babylonchain/babylon/types.SchnorrPubRand" json:"pub_rand,omitempty"` - // canonical_last_commit_hash is the last_commit_hash of the canonical block - CanonicalAppHash []byte `protobuf:"bytes,4,opt,name=canonical_last_commit_hash,json=canonicalAppHash,proto3" json:"canonical_last_commit_hash,omitempty"` - // fork_last_commit_hash is the last_commit_hash of the fork block - ForkAppHash []byte `protobuf:"bytes,5,opt,name=fork_last_commit_hash,json=forkAppHash,proto3" json:"fork_last_commit_hash,omitempty"` + // canonical_app_hash is the AppHash of the canonical block + CanonicalAppHash []byte `protobuf:"bytes,4,opt,name=canonical_app_hash,json=canonicalAppHash,proto3" json:"canonical_app_hash,omitempty"` + // fork_app_hash is the AppHash of the fork block + ForkAppHash []byte `protobuf:"bytes,5,opt,name=fork_app_hash,json=forkAppHash,proto3" json:"fork_app_hash,omitempty"` // 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)` @@ -176,35 +176,34 @@ func init() { } var fileDescriptor_ca5b87e52e3e6d02 = []byte{ - // 440 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x93, 0xcf, 0x6f, 0xd3, 0x30, - 0x14, 0xc7, 0x9b, 0x51, 0x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xab, 0x96, 0xbf, 0x51, 0xbc, 0xf7, 0xdf, 0x97, 0x8e, 0x75, 0xbe, 0x74, 0xac, 0x9f, 0x4b, - 0xc7, 0xfa, 0xba, 0x72, 0x3a, 0xe7, 0x2b, 0xa7, 0xf3, 0x63, 0xe5, 0x74, 0x3e, 0xef, 0xfd, 0x0d, - 0x70, 0xb6, 0x7e, 0x13, 0x86, 0x45, 0x7a, 0xe6, 0x1f, 0xdf, 0xff, 0x15, 0x00, 0x00, 0xff, 0xff, - 0x5e, 0x45, 0x73, 0x06, 0x34, 0x03, 0x00, 0x00, + // 425 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x92, 0x4f, 0x6f, 0xd3, 0x30, + 0x18, 0x87, 0x9b, 0x51, 0xda, 0xe0, 0x05, 0x01, 0x66, 0x9a, 0x0a, 0x42, 0x59, 0xe9, 0xa9, 0x07, + 0xd4, 0x6c, 0x6c, 0x42, 0x5c, 0x89, 0x34, 0xb4, 0xc1, 0x81, 0x2a, 0xd9, 0x89, 0x8b, 0x65, 0x3b, + 0x5e, 0x6c, 0x35, 0xd8, 0x56, 0xfe, 0x69, 0xe1, 0xc4, 0x47, 0xe0, 0x63, 0x71, 0xdc, 0x11, 0xed, + 0x30, 0xa1, 0xf6, 0x8b, 0xa0, 0x38, 0x69, 0x02, 0x27, 0x10, 0xdc, 0x5e, 0xbf, 0xfe, 0xe9, 0x7d, + 0x1e, 0xbd, 0x36, 0x98, 0x11, 0x4c, 0xaa, 0x44, 0x49, 0xef, 0x52, 0x48, 0x9c, 0x88, 0xbc, 0xf2, + 0xca, 0xa3, 0xae, 0x5e, 0xe8, 0x54, 0xe5, 0x0a, 0x3e, 0x6e, 0x33, 0x8b, 0xae, 0x5f, 0x1e, 0x3d, + 0xdd, 0x8b, 0x55, 0xac, 0xcc, 0xbd, 0x57, 0x57, 0x4d, 0x74, 0x86, 0x80, 0x73, 0x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 0x9d, 0x87, 0xdd, 0xcd, 0x9b, 0x76, 0x4d, 0x33, 0x70, 0xff, 0x52, + 0xa5, 0xab, 0x3e, 0x78, 0xd7, 0x04, 0x77, 0xeb, 0xe6, 0x36, 0x23, 0xc1, 0x7e, 0x3f, 0x71, 0xfb, + 0x78, 0x28, 0x13, 0xf1, 0x64, 0xf4, 0x8f, 0xd2, 0xa7, 0x1f, 0x2e, 0xc2, 0x50, 0xc4, 0xc1, 0x5e, + 0x37, 0xf7, 0x6d, 0x3b, 0x36, 0x14, 0x31, 0x8c, 0xc0, 0x23, 0xe3, 0xf4, 0x1b, 0x6a, 0xfc, 0x9f, + 0xa8, 0x07, 0xf5, 0xc8, 0x5f, 0x28, 0xfe, 0xbb, 0x6f, 0x6b, 0xd7, 0xba, 0x5e, 0xbb, 0xd6, 0x8f, + 0xb5, 0x6b, 0x7d, 0xdd, 0xb8, 0x83, 0xeb, 0x8d, 0x3b, 0xf8, 0xbe, 0x71, 0x07, 0x1f, 0x0f, 0xff, + 0x04, 0xb8, 0xea, 0xbf, 0xb9, 0x61, 0x91, 0x91, 0xf9, 0xb6, 0xc7, 0x3f, 0x03, 0x00, 0x00, 0xff, + 0xff, 0x34, 0x61, 0xea, 0x06, 0x07, 0x03, 0x00, 0x00, } func (m *IndexedBlock) Marshal() (dAtA []byte, err error) { diff --git a/x/finality/types/tx.pb.go b/x/finality/types/tx.pb.go index 1b1e87ff5..259739472 100644 --- a/x/finality/types/tx.pb.go +++ b/x/finality/types/tx.pb.go @@ -38,8 +38,8 @@ type MsgAddFinalitySig struct { ValBtcPk *github_com_babylonchain_babylon_types.BIP340PubKey `protobuf:"bytes,2,opt,name=val_btc_pk,json=valBtcPk,proto3,customtype=github.com/babylonchain/babylon/types.BIP340PubKey" json:"val_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"` - // block_last_commit_hash is the last_commit_hash of the voted block - BlockAppHash []byte `protobuf:"bytes,4,opt,name=block_last_commit_hash,json=blockAppHash,proto3" json:"block_last_commit_hash,omitempty"` + // block_app_hash is the AppHash of the voted block + BlockAppHash []byte `protobuf:"bytes,4,opt,name=block_app_hash,json=blockAppHash,proto3" json:"block_app_hash,omitempty"` // 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)` @@ -348,48 +348,48 @@ func init() { func init() { proto.RegisterFile("babylon/finality/v1/tx.proto", fileDescriptor_2dd6da066b6baf1d) } var fileDescriptor_2dd6da066b6baf1d = []byte{ - // 653 bytes of a gzipped FileDescriptorProto + // 644 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0x4f, 0x4f, 0x13, 0x41, - 0x14, 0xef, 0xb6, 0x85, 0xc8, 0xb4, 0x62, 0x58, 0x08, 0x2c, 0x85, 0x6c, 0x6b, 0x63, 0x0c, 0x12, - 0xdd, 0xe5, 0x9f, 0x44, 0xb8, 0x51, 0xa3, 0x41, 0xa1, 0xb1, 0xd9, 0xe2, 0x45, 0x4d, 0x36, 0xb3, - 0x7f, 0x98, 0x9d, 0xb0, 0xbb, 0xb3, 0xee, 0x4c, 0x1b, 0x7a, 0x33, 0x7e, 0x02, 0x0f, 0x7e, 0x10, - 0x0e, 0x7e, 0x03, 0x2f, 0x5c, 0x4c, 0x88, 0x27, 0xc3, 0xa1, 0x1a, 0x38, 0xf0, 0x35, 0x4c, 0x77, - 0x67, 0x29, 0xb4, 0x25, 0x56, 0x0f, 0xde, 0x76, 0xe6, 0xf7, 0xdb, 0xf7, 0x7e, 0xef, 0xf7, 0xde, - 0x1b, 0x30, 0x6f, 0x40, 0xa3, 0xe5, 0x12, 0x5f, 0xdd, 0xc7, 0x3e, 0x74, 0x31, 0x6b, 0xa9, 0xcd, - 0x65, 0x95, 0x1d, 0x2a, 0x41, 0x48, 0x18, 0x11, 0x27, 0x39, 0xaa, 0x24, 0xa8, 0xd2, 0x5c, 0x2e, - 0x4c, 0x21, 0x82, 0x48, 0x84, 0xab, 0x9d, 0xaf, 0x98, 0x5a, 0x98, 0x35, 0x09, 0xf5, 0x08, 0xd5, - 0x63, 0x20, 0x3e, 0x70, 0x68, 0x26, 0x3e, 0xa9, 0x1e, 0x45, 0x9d, 0xe8, 0x1e, 0x45, 0x1c, 0x28, - 0x0d, 0x4a, 0x1e, 0xc0, 0x10, 0x7a, 0xfc, 0xd7, 0xf2, 0xd7, 0x34, 0x98, 0xa8, 0x52, 0xb4, 0x65, - 0x59, 0xcf, 0x39, 0xa5, 0x8e, 0x91, 0x38, 0x0d, 0x46, 0x29, 0x46, 0xbe, 0x1d, 0x4a, 0x42, 0x49, - 0x58, 0x18, 0xd3, 0xf8, 0x49, 0xdc, 0x03, 0xa0, 0x09, 0x5d, 0xdd, 0x60, 0xa6, 0x1e, 0x1c, 0x48, - 0xe9, 0x92, 0xb0, 0x90, 0xaf, 0xac, 0x9f, 0xb6, 0x8b, 0x2b, 0x08, 0x33, 0xa7, 0x61, 0x28, 0x26, - 0xf1, 0x54, 0x9e, 0xd2, 0x74, 0x20, 0xf6, 0x93, 0x83, 0xca, 0x5a, 0x81, 0x4d, 0x95, 0xca, 0x8b, - 0xda, 0xea, 0xda, 0x52, 0xad, 0x61, 0xec, 0xd8, 0x2d, 0xed, 0x56, 0x13, 0xba, 0x15, 0x66, 0xd6, - 0x0e, 0xc4, 0xbb, 0x20, 0x6f, 0xb8, 0xc4, 0x3c, 0xd0, 0x1d, 0x1b, 0x23, 0x87, 0x49, 0x99, 0x92, - 0xb0, 0x90, 0xd5, 0x72, 0xd1, 0xdd, 0x76, 0x74, 0x25, 0xae, 0x82, 0xe9, 0x98, 0xe2, 0x42, 0xca, - 0x74, 0x93, 0x78, 0x1e, 0x66, 0xba, 0x03, 0xa9, 0x23, 0x65, 0x3b, 0x22, 0xb4, 0xc9, 0x08, 0xdd, - 0x85, 0x94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0x1a, 0x06, 0x95, 0x70, 0x14, 0x46, 0x3e, 0x9d, 0x1f, 0x2c, 0x48, 0x95, 0x57, + 0x47, 0xa7, 0xaa, 0x74, 0x7c, 0xaa, 0x4a, 0xbf, 0x4e, 0x55, 0xe9, 0xcb, 0x99, 0x9a, 0x3a, 0x3e, + 0x53, 0x53, 0x3f, 0xce, 0xd4, 0xd4, 0xbb, 0xc5, 0x3f, 0x2d, 0xe1, 0x7e, 0xef, 0x6f, 0x19, 0xed, + 0xa3, 0x35, 0x1a, 0xfd, 0x2a, 0x57, 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff, 0xd2, 0x72, 0x38, 0x11, + 0xcb, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/incentive/types/params.pb.go b/x/incentive/types/params.pb.go index 4b9fff8b7..fac26d98a 100644 --- a/x/incentive/types/params.pb.go +++ b/x/incentive/types/params.pb.go @@ -27,7 +27,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module, including portions of rewards // distributed to each type of stakeholder. Note that sum of the portions should -// be strictly less than 1 so that the rest will go to Tendermint validators/delegations +// be strictly less than 1 so that the rest will go to Comet validators/delegations // adapted from https://github.com/cosmos/cosmos-sdk/blob/release/v0.47.x/proto/cosmos/distribution/v1beta1/distribution.proto type Params struct { // submitter_portion is the portion of rewards that goes to submitter diff --git a/x/zoneconcierge/keeper/proof_epoch_sealed.go b/x/zoneconcierge/keeper/proof_epoch_sealed.go index f1a35fc3d..33baa22c4 100644 --- a/x/zoneconcierge/keeper/proof_epoch_sealed.go +++ b/x/zoneconcierge/keeper/proof_epoch_sealed.go @@ -46,8 +46,8 @@ func (k Keeper) ProveValSet(epoch *epochingtypes.Epoch) (*tmcrypto.ProofOps, err // ProveEpochSealed proves an epoch has been sealed, i.e., // - the epoch's validator set has a valid multisig over the sealer header -// - the epoch's validator set is committed to the sealer header's last_commit_hash -// - the epoch's metadata is committed to the sealer header's last_commit_hash +// - the epoch's validator set is committed to the sealer header's app_hash +// - the epoch's metadata is committed to the sealer header's app_hash func (k Keeper) ProveEpochSealed(ctx context.Context, epochNumber uint64) (*types.ProofEpochSealed, error) { var ( proof = &types.ProofEpochSealed{} @@ -84,8 +84,8 @@ func (k Keeper) ProveEpochSealed(ctx context.Context, epochNumber uint64) (*type // VerifyEpochSealed verifies that the given `epoch` is sealed by the `rawCkpt` by using the given `proof` // The verification rules include: // - basic sanity checks -// - The raw checkpoint's last_commit_hash is same as in the header of the sealer epoch -// - More than 1/3 (in voting power) validators in the validator set of this epoch have signed last_commit_hash of the sealer epoch +// - The raw checkpoint's app_hash is same as in the header of the sealer epoch +// - More than 1/3 (in voting power) validators in the validator set of this epoch have signed app_hash of the sealer epoch // - The epoch medatata is committed to the app_hash of the sealer epoch // - The validator set is committed to the app_hash of the sealer epoch func VerifyEpochSealed(epoch *epochingtypes.Epoch, rawCkpt *checkpointingtypes.RawCheckpoint, proof *types.ProofEpochSealed) error { @@ -112,7 +112,7 @@ func VerifyEpochSealed(epoch *epochingtypes.Epoch, rawCkpt *checkpointingtypes.R return fmt.Errorf("epoch.EpochNumber (%d) is not equal to rawCkpt.EpochNum (%d)", epoch.EpochNumber, rawCkpt.EpochNum) } - // ensure the raw checkpoint's last_commit_hash is same as in the header of the sealer header + // ensure the raw checkpoint's app_hash is same as in the header of the sealer header // NOTE: since this proof is assembled by a Babylon node who has verified the checkpoint, // the two appHash values should always be the same, otherwise this Babylon node is malicious. // This is different from the checkpoint verification rules in checkpointing, @@ -124,7 +124,7 @@ func VerifyEpochSealed(epoch *epochingtypes.Epoch, rawCkpt *checkpointingtypes.R } /* - Ensure more than 1/3 (in voting power) validators of this epoch have signed (epoch_num || last_commit_hash) in the raw checkpoint + Ensure more than 1/3 (in voting power) validators of this epoch have signed (epoch_num || app_hash) in the raw checkpoint */ valSet := checkpointingtypes.ValidatorWithBlsKeySet{ValSet: proof.ValidatorSet} // filter validator set that contributes to the signature diff --git a/x/zoneconcierge/keeper/proof_epoch_sealed_test.go b/x/zoneconcierge/keeper/proof_epoch_sealed_test.go index c0acbcc57..1d838f5c0 100644 --- a/x/zoneconcierge/keeper/proof_epoch_sealed_test.go +++ b/x/zoneconcierge/keeper/proof_epoch_sealed_test.go @@ -68,7 +68,7 @@ func FuzzProofEpochSealed_BLSSig(f *testing.F) { BlsMultiSig: nil, } - // let the subset generate a BLS multisig over sealer header's last_commit_hash + // let the subset generate a BLS multisig over sealer header's app_hash multiSig, err := signBLSWithBitmap(blsSKs, bm, rawCkpt.SignedMsg()) require.NoError(t, err) // assign multiSig to rawCkpt diff --git a/x/zoneconcierge/types/zoneconcierge.pb.go b/x/zoneconcierge/types/zoneconcierge.pb.go index 59f6f8009..e4270f746 100644 --- a/x/zoneconcierge/types/zoneconcierge.pb.go +++ b/x/zoneconcierge/types/zoneconcierge.pb.go @@ -372,14 +372,14 @@ func (m *FinalizedChainInfo) GetProof() *ProofFinalizedChainInfo { // - Metadata of this epoch, which includes the sealer header // - Raw checkpoint of this epoch // The verifier can perform the following verification rules: -// - The raw checkpoint's `last_commit_hash` is same as in the sealer header +// - The raw checkpoint's `app_hash` is same as in the sealer header // - More than 1/3 (in voting power) validators in the validator set of this -// epoch have signed `last_commit_hash` of the sealer header +// epoch have signed `app_hash` of the sealer header // - The epoch medatata is committed to the `app_hash` of the sealer header // - The validator set is committed to the `app_hash` of the sealer header type ProofEpochSealed struct { // validator_set is the validator set of the sealed epoch - // This validator set has generated a BLS multisig on `last_commit_hash` of + // This validator set has generated a BLS multisig on `app_hash` of // the sealer header ValidatorSet []*types2.ValidatorWithBlsKey `protobuf:"bytes,1,rep,name=validator_set,json=validatorSet,proto3" json:"validator_set,omitempty"` // proof_epoch_info is the Merkle proof that the epoch's metadata is committed