From 5feefb6a549de7624426823e3e66f9ffcc16d83d Mon Sep 17 00:00:00 2001 From: Daniil Lashin Date: Mon, 6 Dec 2021 18:36:23 +0300 Subject: [PATCH 01/14] Fix relayer --- orchestrator/relayer/src/batch_relaying.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/orchestrator/relayer/src/batch_relaying.rs b/orchestrator/relayer/src/batch_relaying.rs index cf22f35..4c0cc88 100644 --- a/orchestrator/relayer/src/batch_relaying.rs +++ b/orchestrator/relayer/src/batch_relaying.rs @@ -146,7 +146,6 @@ async fn get_batches_and_signatures( // older batches so that we don't invalidate newer batches for (_key, value) in possible_batches.iter_mut() { value.sort(); - value.reverse(); } return possible_batches; From 642cb95a408a531dfcd53291d75cf67b0fbd5453 Mon Sep 17 00:00:00 2001 From: Daniil Lashin Date: Mon, 6 Dec 2021 21:20:25 +0300 Subject: [PATCH 02/14] Do not panic on estimation error --- .../ethereum_gravity/src/submit_batch.rs | 23 +++++++++++++------ orchestrator/mhub2_utils/src/error.rs | 4 ++++ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/orchestrator/ethereum_gravity/src/submit_batch.rs b/orchestrator/ethereum_gravity/src/submit_batch.rs index 897f9a8..a49aca4 100644 --- a/orchestrator/ethereum_gravity/src/submit_batch.rs +++ b/orchestrator/ethereum_gravity/src/submit_batch.rs @@ -2,6 +2,7 @@ use crate::utils::{get_tx_batch_nonce, GasCost}; use clarity::PrivateKey as EthPrivateKey; use clarity::{Address as EthAddress, Uint256}; use mhub2_utils::error::GravityError; +use mhub2_utils::error::GravityError::InvalidEstimationError; use mhub2_utils::message_signatures::encode_tx_batch_confirm_hashed; use mhub2_utils::types::*; use std::collections::HashMap; @@ -119,7 +120,7 @@ pub async fn estimate_tx_batch_cost( gas: val, gas_price, total_fee_eth: if eth_fee_calculator_url.is_some() { - get_total_batch_fee_in_eth(eth_fee_calculator_url.unwrap(), batch, chain_id) + get_total_batch_fee_in_eth(eth_fee_calculator_url.unwrap(), batch, chain_id)? } else { 0u64.into() }, @@ -130,7 +131,7 @@ fn get_total_batch_fee_in_eth( base_url: String, batch: TransactionBatch, chain_id: String, -) -> Uint256 { +) -> Result { let mut url: String = base_url.to_owned(); url.push_str("?contract=".into()); url.push_str(batch.total_fee.token_contract_address.to_string().as_str()); @@ -138,12 +139,20 @@ fn get_total_batch_fee_in_eth( url.push_str(batch.total_fee.amount.to_string().as_str()); url.push_str("&chain_id=".into()); url.push_str(&*chain_id.clone()); - let data = reqwest::blocking::get(url) - .unwrap() - .json::>() - .unwrap(); + let data = reqwest::blocking::get(url); + if data.is_err() { + return Err(InvalidEstimationError); + } + + let data = data.unwrap().json::>(); + if data.is_err() { + return Err(InvalidEstimationError); + } - Uint256::from_str_radix(data.get("result").unwrap(), 10).unwrap() + match data.unwrap().get("result") { + Some(s) => Ok(Uint256::from_str_radix(s, 10)?), + None => Err(InvalidEstimationError), + } } /// Encodes the batch payload for both estimate_tx_batch_cost and send_eth_transaction_batch diff --git a/orchestrator/mhub2_utils/src/error.rs b/orchestrator/mhub2_utils/src/error.rs index 64d82ad..2f7ff28 100644 --- a/orchestrator/mhub2_utils/src/error.rs +++ b/orchestrator/mhub2_utils/src/error.rs @@ -27,6 +27,7 @@ pub enum GravityError { GravityGrpcError(Status), InsufficientVotingPowerToPass(String), ParseBigIntError(ParseBigIntError), + InvalidEstimationError, } impl fmt::Display for GravityError { @@ -56,6 +57,9 @@ impl fmt::Display for GravityError { write!(f, "{}", val) } GravityError::ParseBigIntError(val) => write!(f, "Failed to parse big integer {}", val), + GravityError::InvalidEstimationError => { + write!(f, "Failed to retrieve batch price estimation") + } } } } From 8bca9b12026d88f21fe56d8ae4efe23129f20cc6 Mon Sep 17 00:00:00 2001 From: Daniil Lashin Date: Tue, 7 Dec 2021 10:09:32 +0300 Subject: [PATCH 03/14] Add test for batch sorting --- orchestrator/relayer/src/batch_relaying.rs | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/orchestrator/relayer/src/batch_relaying.rs b/orchestrator/relayer/src/batch_relaying.rs index 4c0cc88..d1d607f 100644 --- a/orchestrator/relayer/src/batch_relaying.rs +++ b/orchestrator/relayer/src/batch_relaying.rs @@ -272,3 +272,53 @@ async fn submit_batches( } } } + +#[cfg(test)] +mod tests { + use crate::batch_relaying::SubmittableBatch; + use mhub2_utils::types::TransactionBatch; + + #[test] + fn sorting() { + let mut list: Vec = Vec::new(); + + list.push(SubmittableBatch { + batch: TransactionBatch { + nonce: 1, + batch_timeout: 0, + transactions: vec![], + total_fee: Default::default(), + token_contract: Default::default(), + }, + sigs: vec![], + }); + + list.push(SubmittableBatch { + batch: TransactionBatch { + nonce: 3, + batch_timeout: 0, + transactions: vec![], + total_fee: Default::default(), + token_contract: Default::default(), + }, + sigs: vec![], + }); + + list.push(SubmittableBatch { + batch: TransactionBatch { + nonce: 2, + batch_timeout: 0, + transactions: vec![], + total_fee: Default::default(), + token_contract: Default::default(), + }, + sigs: vec![], + }); + + list.sort(); + + assert_eq!(list.get(0).unwrap().batch.nonce, 1u64); + assert_eq!(list.get(1).unwrap().batch.nonce, 2u64); + assert_eq!(list.get(2).unwrap().batch.nonce, 3u64); + } +} From 8b7b67ef95073259422c7eefd39c91e7f51518f8 Mon Sep 17 00:00:00 2001 From: Daniil Lashin Date: Tue, 7 Dec 2021 10:13:37 +0300 Subject: [PATCH 04/14] Update holders once in an hour --- oracle/cmd/mhub-oracle/main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/oracle/cmd/mhub-oracle/main.go b/oracle/cmd/mhub-oracle/main.go index 74f070d..6c03192 100644 --- a/oracle/cmd/mhub-oracle/main.go +++ b/oracle/cmd/mhub-oracle/main.go @@ -19,6 +19,8 @@ import ( "google.golang.org/grpc/backoff" ) +const holdersUpdatePeriod = 144 + func main() { logger := log.NewTMLogger(os.Stdout) cfg := config.Get() @@ -67,7 +69,7 @@ func relayPricesAndHolders( } } - if response.GetEpoch().Nonce%10 == 0 { + if response.GetEpoch().Nonce%holdersUpdatePeriod == 0 { holders := getHolders(cfg) jsonHolders, _ := json.Marshal(holders.List) logger.Info("Holders", "val", string(jsonHolders)) From c4ee26017921d49d5c2ea81166a1003318b1dee3 Mon Sep 17 00:00:00 2001 From: Daniil Lashin Date: Tue, 7 Dec 2021 10:16:40 +0300 Subject: [PATCH 05/14] Send validators commission to proper addresses --- module/x/mhub2/keeper/batch.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/x/mhub2/keeper/batch.go b/module/x/mhub2/keeper/batch.go index b5df4c6..5ad734d 100644 --- a/module/x/mhub2/keeper/batch.go +++ b/module/x/mhub2/keeper/batch.go @@ -125,7 +125,7 @@ func (k Keeper) batchTxExecuted(ctx sdk.Context, chainId types.ChainID, external // pay val's commissions if totalValCommission.IsPositive() { - valset := k.CurrentSignerSet(ctx, chainId) + valset := k.CurrentSignerSet(ctx, "minter") var totalPower uint64 for _, val := range valset { totalPower += val.Power From 4e3b906a21e280e7ed6dcdcd65fa70397a40cad2 Mon Sep 17 00:00:00 2001 From: Daniil Lashin Date: Tue, 7 Dec 2021 12:37:04 +0300 Subject: [PATCH 06/14] Add upgrade handler for v0.1.0 --- module/app/app.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/module/app/app.go b/module/app/app.go index a4a282e..1964d96 100644 --- a/module/app/app.go +++ b/module/app/app.go @@ -597,6 +597,10 @@ func NewMhub2App( app.ScopedIBCKeeper = scopedIBCKeeper app.ScopedTransferKeeper = scopedTransferKeeper + app.upgradeKeeper.SetUpgradeHandler("v0.1.0", func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + return nil, nil + }) + return app } From 03f598087f9b5fc37afc7d1b26fcddd29e3f40a4 Mon Sep 17 00:00:00 2001 From: Daniil Lashin Date: Tue, 7 Dec 2021 14:23:45 +0300 Subject: [PATCH 07/14] Fix holders voting --- module/x/mhub2/keeper/keeper.go | 24 ++++++------ module/x/oracle/keeper/attestation_handler.go | 39 +++++++------------ module/x/oracle/types/msgs.go | 14 +++++++ 3 files changed, 41 insertions(+), 36 deletions(-) diff --git a/module/x/mhub2/keeper/keeper.go b/module/x/mhub2/keeper/keeper.go index ac5443c..9960b88 100644 --- a/module/x/mhub2/keeper/keeper.go +++ b/module/x/mhub2/keeper/keeper.go @@ -701,25 +701,25 @@ func (k Keeper) GetCommissionForHolder(ctx sdk.Context, addresses []string, comm // 16 HUB -50% // 32 HUB -60% - discont1 := convertDecimals(0, 18, sdk.NewInt(1)) - discont2 := convertDecimals(0, 18, sdk.NewInt(2)) - discont4 := convertDecimals(0, 18, sdk.NewInt(4)) - discont8 := convertDecimals(0, 18, sdk.NewInt(8)) - discont16 := convertDecimals(0, 18, sdk.NewInt(16)) - discont32 := convertDecimals(0, 18, sdk.NewInt(32)) + discount1 := convertDecimals(0, 18, sdk.NewInt(1)) + discount2 := convertDecimals(0, 18, sdk.NewInt(2)) + discount4 := convertDecimals(0, 18, sdk.NewInt(4)) + discount8 := convertDecimals(0, 18, sdk.NewInt(8)) + discount16 := convertDecimals(0, 18, sdk.NewInt(16)) + discount32 := convertDecimals(0, 18, sdk.NewInt(32)) switch { - case maxValue.GTE(discont32): + case maxValue.GTE(discount32): return commission.Sub(commission.MulInt64(60).QuoInt64(100)) - case maxValue.GTE(discont16): + case maxValue.GTE(discount16): return commission.Sub(commission.MulInt64(50).QuoInt64(100)) - case maxValue.GTE(discont8): + case maxValue.GTE(discount8): return commission.Sub(commission.MulInt64(40).QuoInt64(100)) - case maxValue.GTE(discont4): + case maxValue.GTE(discount4): return commission.Sub(commission.MulInt64(30).QuoInt64(100)) - case maxValue.GTE(discont2): + case maxValue.GTE(discount2): return commission.Sub(commission.MulInt64(20).QuoInt64(100)) - case maxValue.GTE(discont1): + case maxValue.GTE(discount1): return commission.Sub(commission.MulInt64(10).QuoInt64(100)) } diff --git a/module/x/oracle/keeper/attestation_handler.go b/module/x/oracle/keeper/attestation_handler.go index b96d511..cfbb7a9 100644 --- a/module/x/oracle/keeper/attestation_handler.go +++ b/module/x/oracle/keeper/attestation_handler.go @@ -1,6 +1,7 @@ package keeper import ( + "fmt" "math" "sort" @@ -66,41 +67,31 @@ func (a AttestationHandler) Handle(ctx sdk.Context, att types.Attestation, claim a.keeper.storePrices(ctx, &prices) case *types.MsgHoldersClaim: - votes := att.GetVotes() - holdersVotes := map[string]sdk.Int{} + holdersTally := map[string]int64{} + holdersVotes := map[string]*types.Holders{} powers := a.keeper.GetNormalizedValPowers(ctx) - - for _, valaddr := range votes { + for _, valaddr := range att.GetVotes() { validator, _ := sdk.ValAddressFromBech32(valaddr) - power := sdk.NewDec(int64(powers[valaddr])).QuoInt64(math.MaxUint16) + power := sdk.NewDec(int64(powers[valaddr])).QuoInt64(math.MaxUint16).TruncateInt64() holdersClaim := a.keeper.GetHoldersClaim(ctx, sdk.AccAddress(validator).String(), claim.Epoch).(*types.GenericClaim).GetHoldersClaim() - for _, item := range holdersClaim.GetHolders().List { - if _, has := holdersVotes[item.Address]; !has { - holdersVotes[item.Address] = sdk.NewInt(0) - } + hash := fmt.Sprintf("%x", holdersClaim.StabilizedClaimHash()) + holdersVotes[hash] = holdersClaim.Holders - holdersVotes[item.Address] = holdersVotes[item.Address].Add(item.Value.ToDec().Mul(power).TruncateInt()) + for _, item := range holdersClaim.GetHolders().List { + holdersTally[item.Address] = holdersTally[item.Address] + power } } - var addresses []string - for address := range holdersVotes { - addresses = append(addresses, address) - } - sort.Strings(addresses) - - holders := types.Holders{} - for _, address := range addresses { - holders.List = append(holders.List, &types.Holder{ - Address: address, - Value: holdersVotes[address], - }) + // todo: should we iterate this in sorted way? + for hash, votes := range holdersTally { + if votes > math.MaxUint16*2/3 { + a.keeper.storeHolders(ctx, holdersVotes[hash]) + return nil + } } - a.keeper.storeHolders(ctx, &holders) - default: return sdkerrors.Wrapf(types.ErrInvalid, "event type: %s", claim.GetType()) } diff --git a/module/x/oracle/types/msgs.go b/module/x/oracle/types/msgs.go index 3f9316b..43f4612 100644 --- a/module/x/oracle/types/msgs.go +++ b/module/x/oracle/types/msgs.go @@ -1,7 +1,9 @@ package types import ( + "encoding/json" "fmt" + "sort" "strings" sdk "github.com/cosmos/cosmos-sdk/types" @@ -198,3 +200,15 @@ func (msg MsgHoldersClaim) Route() string { return RouterKey } func (msg *MsgHoldersClaim) ClaimHash() []byte { return tmhash.Sum([]byte("holder_claim")) } + +func (msg *MsgHoldersClaim) StabilizedClaimHash() []byte { + var holders []string + for _, holder := range msg.Holders.List { + holders = append(holders, fmt.Sprintf("%s:%s", holder.Address, holder.Value.String())) + } + sort.Strings(holders) + + b, _ := json.Marshal(holders) + + return tmhash.Sum(b) +} From 54848b88eb82b7927c543cec081c38b81ca63780 Mon Sep 17 00:00:00 2001 From: Daniil Lashin Date: Tue, 7 Dec 2021 15:22:20 +0300 Subject: [PATCH 08/14] Voting for new coins list --- module/app/app.go | 5 +- module/proto/mhub2/v1/mhub2.proto | 7 + module/x/mhub2/client/cli/tx.go | 56 +++ module/x/mhub2/client/proposal_handler.go | 5 +- .../mhub2/client/utils/token_infos_change.go | 74 ++++ module/x/mhub2/handler.go | 5 +- module/x/mhub2/types/codec.go | 1 + module/x/mhub2/types/mhub2.pb.go | 348 +++++++++++++----- module/x/mhub2/types/proposal.go | 32 ++ 9 files changed, 442 insertions(+), 91 deletions(-) create mode 100644 module/x/mhub2/client/utils/token_infos_change.go diff --git a/module/app/app.go b/module/app/app.go index 1964d96..e24b337 100644 --- a/module/app/app.go +++ b/module/app/app.go @@ -131,7 +131,8 @@ var ( distrclient.ProposalHandler, upgradeclient.ProposalHandler, upgradeclient.CancelProposalHandler, - mhub2client.ProposalHandler, + mhub2client.ProposalColdStorageHandler, + mhub2client.ProposalTokensChangeHandler, ), params.AppModuleBasic{}, crisis.AppModuleBasic{}, @@ -419,7 +420,7 @@ func NewMhub2App( AddRoute(paramsproposal.RouterKey, params.NewParamChangeProposalHandler(app.paramsKeeper)). AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.distrKeeper)). AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.upgradeKeeper)). - AddRoute(mhub2types.RouterKey, mhub2.NewColdStorageTransferProposalHandler(app.mhub2Keeper)). + AddRoute(mhub2types.RouterKey, mhub2.NewProposalsHandler(app.mhub2Keeper)). AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.ibcKeeper.ClientKeeper)) app.govKeeper = govkeeper.NewKeeper( diff --git a/module/proto/mhub2/v1/mhub2.proto b/module/proto/mhub2/v1/mhub2.proto index 610c422..6bbcd98 100644 --- a/module/proto/mhub2/v1/mhub2.proto +++ b/module/proto/mhub2/v1/mhub2.proto @@ -140,3 +140,10 @@ message ColdStorageTransferProposal { [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; } +message TokenInfosChangeProposal { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + + TokenInfos new_infos = 1; +} diff --git a/module/x/mhub2/client/cli/tx.go b/module/x/mhub2/client/cli/tx.go index 659348e..a4de1d6 100644 --- a/module/x/mhub2/client/cli/tx.go +++ b/module/x/mhub2/client/cli/tx.go @@ -258,3 +258,59 @@ Where proposal.json contains: }, } } + +func NewSubmitTokenInfosChangeProposalTxCmd() *cobra.Command { + return &cobra.Command{ + Use: "token-infos-change [proposal-file]", + Args: cobra.ExactArgs(1), + Short: "Submit a token infos change proposal", + Long: strings.TrimSpace( + fmt.Sprintf(`Submit a token infos change proposal along with an initial deposit. +The proposal details must be supplied via a JSON file. For values that contains +objects, only non-empty fields will be updated. + +Example: +$ %s tx gov submit-proposal token-infos-change --from= + +Where proposal.json contains: + +{ + "new_token_infos": ..., + "deposit": "1000hub" +} +`, + version.AppName, + ), + ), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + proposal, err := utils.ParseTokenInfosChangeProposalJSON(clientCtx.LegacyAmino, args[0]) + if err != nil { + return err + } + + from := clientCtx.GetFromAddress() + content := types.NewTokenInfosChangeProposal( + proposal.NewTokenInfos, + ) + + deposit, err := sdk.ParseCoinsNormalized(proposal.Deposit) + if err != nil { + return err + } + + msg, err := govtypes.NewMsgSubmitProposal(content, deposit, from) + if err != nil { + return err + } + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } +} diff --git a/module/x/mhub2/client/proposal_handler.go b/module/x/mhub2/client/proposal_handler.go index 73dab18..434b707 100644 --- a/module/x/mhub2/client/proposal_handler.go +++ b/module/x/mhub2/client/proposal_handler.go @@ -6,5 +6,6 @@ import ( govclient "github.com/cosmos/cosmos-sdk/x/gov/client" ) -// ProposalHandler is the param change proposal handler. -var ProposalHandler = govclient.NewProposalHandler(cli.NewSubmitColdStorageTransferProposalTxCmd, rest.ProposalRESTHandler) +// ProposalColdStorageHandler is the param change proposal handler. +var ProposalColdStorageHandler = govclient.NewProposalHandler(cli.NewSubmitColdStorageTransferProposalTxCmd, rest.ProposalRESTHandler) +var ProposalTokensChangeHandler = govclient.NewProposalHandler(cli.NewSubmitColdStorageTransferProposalTxCmd, rest.ProposalRESTHandler) diff --git a/module/x/mhub2/client/utils/token_infos_change.go b/module/x/mhub2/client/utils/token_infos_change.go new file mode 100644 index 0000000..8c718d5 --- /dev/null +++ b/module/x/mhub2/client/utils/token_infos_change.go @@ -0,0 +1,74 @@ +package utils + +import ( + "io/ioutil" + + "github.com/MinterTeam/mhub2/module/x/mhub2/types" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/rest" +) + +type ( + // TokenInfosChangesJSON defines a slice of TokenInfosChangeJSON objects which can be + // converted to a slice of TokenInfosChange objects. + TokenInfosChangesJSON []TokenInfosChangeJSON + + // TokenInfosChangeJSON defines a parameter change used in JSON input. This + // allows values to be specified in raw JSON instead of being string encoded. + TokenInfosChangeJSON struct { + NewTokenInfos *types.TokenInfos `json:"new_token_infos" yaml:"new_token_infos"` + } + + // TokenInfosChangeProposalJSON defines a ParameterChangeProposal with a deposit used + // to parse parameter change proposals from a JSON file. + TokenInfosChangeProposalJSON struct { + NewTokenInfos *types.TokenInfos `json:"new_token_infos" yaml:"new_token_infos"` + Deposit string `json:"deposit" yaml:"deposit"` + } + + // TokenInfosChangeProposalReq defines a parameter change proposal request body. + TokenInfosChangeProposalReq struct { + BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` + + NewTokenInfos *types.TokenInfos `json:"new_token_infos" yaml:"new_token_infos"` + Proposer sdk.AccAddress `json:"proposer" yaml:"proposer"` + Deposit sdk.Coins `json:"deposit" yaml:"deposit"` + } +) + +func NewTokenInfosChangeJSON(tokenInfos *types.TokenInfos) TokenInfosChangeJSON { + return TokenInfosChangeJSON{tokenInfos} +} + +// ToTokenInfosChange converts a TokenInfosChangeJSON object to TokenInfosChange. +func (pcj TokenInfosChangeJSON) ToTokenInfosChange() types.TokenInfosChangeProposal { + return *types.NewTokenInfosChangeProposal(pcj.NewTokenInfos) +} + +// ToTokenInfosChanges converts a slice of TokenInfosChangeJSON objects to a slice of +// TokenInfosChange. +func (pcj TokenInfosChangesJSON) ToTokenInfosChanges() []types.TokenInfosChangeProposal { + res := make([]types.TokenInfosChangeProposal, len(pcj)) + for i, pc := range pcj { + res[i] = pc.ToTokenInfosChange() + } + return res +} + +// ParseTokenInfosChangeProposalJSON reads and parses a TokenInfosChangeProposalJSON from +// file. +func ParseTokenInfosChangeProposalJSON(cdc *codec.LegacyAmino, proposalFile string) (TokenInfosChangeProposalJSON, error) { + proposal := TokenInfosChangeProposalJSON{} + + contents, err := ioutil.ReadFile(proposalFile) + if err != nil { + return proposal, err + } + + if err := cdc.UnmarshalJSON(contents, &proposal); err != nil { + return proposal, err + } + + return proposal, nil +} diff --git a/module/x/mhub2/handler.go b/module/x/mhub2/handler.go index 91b1240..f3eb371 100644 --- a/module/x/mhub2/handler.go +++ b/module/x/mhub2/handler.go @@ -47,11 +47,14 @@ func NewHandler(k keeper.Keeper) sdk.Handler { } } -func NewColdStorageTransferProposalHandler(k keeper.Keeper) govtypes.Handler { +func NewProposalsHandler(k keeper.Keeper) govtypes.Handler { return func(ctx sdk.Context, content govtypes.Content) error { switch c := content.(type) { case *types.ColdStorageTransferProposal: return k.ColdStorageTransfer(ctx, c) + case *types.TokenInfosChangeProposal: + k.SetTokenInfos(ctx, c.NewInfos) + return nil default: return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized proposal content type: %T", c) diff --git a/module/x/mhub2/types/codec.go b/module/x/mhub2/types/codec.go index 2f929de..e8fa879 100644 --- a/module/x/mhub2/types/codec.go +++ b/module/x/mhub2/types/codec.go @@ -50,6 +50,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { registry.RegisterImplementations( (*govtypes.Content)(nil), &ColdStorageTransferProposal{}, + &TokenInfosChangeProposal{}, ) registry.RegisterInterface( diff --git a/module/x/mhub2/types/mhub2.pb.go b/module/x/mhub2/types/mhub2.pb.go index 0efb685..71a0dc5 100644 --- a/module/x/mhub2/types/mhub2.pb.go +++ b/module/x/mhub2/types/mhub2.pb.go @@ -944,6 +944,42 @@ func (m *ColdStorageTransferProposal) XXX_DiscardUnknown() { var xxx_messageInfo_ColdStorageTransferProposal proto.InternalMessageInfo +type TokenInfosChangeProposal struct { + NewInfos *TokenInfos `protobuf:"bytes,1,opt,name=new_infos,json=newInfos,proto3" json:"new_infos,omitempty"` +} + +func (m *TokenInfosChangeProposal) Reset() { *m = TokenInfosChangeProposal{} } +func (*TokenInfosChangeProposal) ProtoMessage() {} +func (*TokenInfosChangeProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_e98aa13e7c3fc003, []int{13} +} +func (m *TokenInfosChangeProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TokenInfosChangeProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TokenInfosChangeProposal.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TokenInfosChangeProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_TokenInfosChangeProposal.Merge(m, src) +} +func (m *TokenInfosChangeProposal) XXX_Size() int { + return m.Size() +} +func (m *TokenInfosChangeProposal) XXX_DiscardUnknown() { + xxx_messageInfo_TokenInfosChangeProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_TokenInfosChangeProposal proto.InternalMessageInfo + func init() { proto.RegisterEnum("mhub2.v1.TxStatusType", TxStatusType_name, TxStatusType_value) proto.RegisterType((*ExternalEventVoteRecord)(nil), "mhub2.v1.ExternalEventVoteRecord") @@ -959,97 +995,100 @@ func init() { proto.RegisterType((*IDSet)(nil), "mhub2.v1.IDSet") proto.RegisterType((*TxStatus)(nil), "mhub2.v1.TxStatus") proto.RegisterType((*ColdStorageTransferProposal)(nil), "mhub2.v1.ColdStorageTransferProposal") + proto.RegisterType((*TokenInfosChangeProposal)(nil), "mhub2.v1.TokenInfosChangeProposal") } func init() { proto.RegisterFile("mhub2/v1/mhub2.proto", fileDescriptor_e98aa13e7c3fc003) } var fileDescriptor_e98aa13e7c3fc003 = []byte{ - // 1354 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xcf, 0x6f, 0x1b, 0xc5, - 0x17, 0xf7, 0xda, 0x89, 0xe3, 0x3c, 0x27, 0x4e, 0x32, 0x8d, 0x1a, 0xc7, 0xfd, 0x7e, 0x6d, 0xcb, - 0x88, 0x12, 0x0a, 0xf5, 0x36, 0x69, 0x91, 0xaa, 0x0a, 0x90, 0xe2, 0x1f, 0x25, 0x41, 0x90, 0x96, - 0xf5, 0xa6, 0xaa, 0xb8, 0x58,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, 0xaf, 0x46, 0xc4, 0xbf, 0x79, 0x4a, 0x5c, 0x11, 0xca, 0x95, 0x13, 0x0d, 0x66, - 0x6a, 0x98, 0x5b, 0x3d, 0x73, 0x82, 0x4a, 0x90, 0xed, 0xf8, 0xc7, 0x76, 0x94, 0x24, 0x08, 0xd5, - 0x8e, 0x60, 0x9a, 0x87, 0x19, 0x7f, 0xec, 0xe8, 0x28, 0xa0, 0x1a, 0x88, 0xe8, 0x43, 0x98, 0xe3, - 0x1e, 0x76, 0x19, 0xb6, 0xb8, 0x43, 0xdd, 0x73, 0x08, 0xb7, 0x88, 0x6b, 0x9b, 0x34, 0xa0, 0x68, - 0xc4, 0xd0, 0xe8, 0x0a, 0x2c, 0x85, 0x25, 0xe5, 0xf4, 0x01, 0x71, 0xdb, 0x8e, 0x2d, 0x98, 0x46, - 0x6a, 0x6a, 0xfa, 0xfa, 0x6d, 0x3b, 0x52, 0xad, 0xe9, 0x58, 0xb5, 0xa2, 0x49, 0xa6, 0xcf, 0x24, - 0xf9, 0x6b, 0x0a, 0x72, 0x71, 0x02, 0x28, 0x07, 0x49, 0xc7, 0x56, 0x29, 0x26, 0x1d, 0x11, 0x96, - 0x11, 0xd7, 0x26, 0x9e, 0xea, 0xa5, 0x92, 0xd0, 0x55, 0x40, 0x21, 0x35, 0x8f, 0x58, 0xce, 0xd0, - 0xf1, 0xc7, 0x3e, 0x25, 0x30, 0x21, 0x69, 0x23, 0x30, 0xa0, 0x55, 0xc8, 0x58, 0x3d, 0xec, 0x44, - 0x12, 0x98, 0x11, 0xf2, 0xb6, 0x8d, 0xae, 0xc3, 0xb4, 0xc8, 0x4d, 0xf0, 0xce, 0x6e, 0xac, 0xbc, - 0xd8, 0x4c, 0x91, 0x62, 0x6d, 0xea, 0xf1, 0x71, 0x29, 0x61, 0x48, 0x2c, 0xd2, 0x21, 0xb5, 0x47, - 0x64, 0x42, 0xaf, 0x74, 0xf1, 0x91, 0x68, 0x05, 0x66, 0xf8, 0xa4, 0xd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0x9f, 0x28, 0x51, 0xb4, 0xa5, 0x93, 0x16, 0xef, 0xd5, 0xeb, 0xff, 0x06, 0x00, 0x00, - 0xff, 0xff, 0x55, 0x69, 0x98, 0x43, 0x98, 0x0b, 0x00, 0x00, + // 1390 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0x3f, 0x6f, 0x1b, 0x47, + 0x16, 0xe7, 0x92, 0x12, 0x45, 0x3e, 0x4a, 0x94, 0x34, 0x16, 0x2c, 0x8a, 0xbe, 0x23, 0x09, 0x1e, + 0xce, 0xa7, 0xf3, 0x9d, 0xb9, 0x96, 0xec, 0x03, 0x0c, 0xe3, 0xee, 0x00, 0xf1, 0x8f, 0x4f, 0x3a, + 0x24, 0xb2, 0xb3, 0x5c, 0x19, 0x46, 0x52, 0x10, 0xc3, 0xdd, 0x11, 0xb9, 0x30, 0xb9, 0xc3, 0xec, + 0x0c, 0x69, 0xea, 0x1b, 0x18, 0xaa, 0x52, 0xa4, 0x48, 0xa3, 0x40, 0x40, 0x90, 0xc6, 0x49, 0x99, + 0x7c, 0x07, 0x23, 0x95, 0xcb, 0x20, 0x85, 0x1c, 0xc8, 0x4d, 0xe0, 0x3e, 0x4d, 0xaa, 0x60, 0x67, + 0x66, 0x57, 0xbb, 0xb2, 0x1c, 0xdb, 0x15, 0xe7, 0xfd, 0x9d, 0xdf, 0x7b, 0xbf, 0xf7, 0xb8, 0x03, + 0x2b, 0xc3, 0xfe, 0xb8, 0xbb, 0xa9, 0x4f, 0x36, 0x74, 0x71, 0xa8, 0x8d, 0x3c, 0xca, 0x29, 0xca, + 0x48, 0x61, 0xb2, 0x51, 0x5c, 0xb3, 0x28, 0x1b, 0x52, 0xd6, 0x11, 0x7a, 0x5d, 0x0a, 0xd2, 0xa9, + 0x58, 0xee, 0x51, 0xda, 0x1b, 0x10, 0x5d, 0x48, 0xdd, 0xf1, 0xbe, 0xce, 0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 0xf4, 0x31, 0xf1, 0x54, 0x56, 0x29, 0xa0, 0xbf, 0xc3, 0x52, 0x78, 0x2b, + 0xb6, 0x6d, 0x8f, 0x30, 0x26, 0xf2, 0x65, 0x8d, 0x10, 0xcd, 0x96, 0x54, 0x57, 0x8f, 0x35, 0xc8, + 0xc9, 0x5c, 0x6d, 0xc2, 0xcd, 0xa9, 0x9f, 0xd0, 0xa5, 0xae, 0x45, 0x82, 0x84, 0x42, 0x40, 0x97, + 0x21, 0x1d, 0x83, 0xa5, 0x24, 0xf4, 0x3f, 0x98, 0x63, 0x22, 0x98, 0x15, 0x52, 0x95, 0xd4, 0x7a, + 0x6e, 0xb3, 0x50, 0x0b, 0x26, 0xa5, 0x16, 0x47, 0x5a, 0xbf, 0xf4, 0xf4, 0x45, 0x79, 0x31, 0xae, + 0x63, 0x46, 0x10, 0xed, 0x37, 0x96, 0x91, 0x4f, 0xc7, 0xc4, 0xbf, 0x79, 0x46, 0x5c, 0x11, 0xca, + 0xd5, 0x53, 0x0d, 0xe6, 0xea, 0x98, 0x5b, 0x7d, 0x73, 0x8a, 0xca, 0x90, 0xeb, 0xfa, 0xc7, 0x4e, + 0x14, 0x24, 0x08, 0xd5, 0xae, 0x40, 0x5a, 0x80, 0x39, 0x7f, 0xec, 0xe8, 0x38, 0x80, 0x1a, 0x88, + 0xe8, 0xdf, 0x30, 0xcf, 0x3d, 0xec, 0x32, 0x6c, 0x71, 0x87, 0xba, 0x17, 0x00, 0x6e, 0x13, 0xd7, + 0x36, 0x69, 0x00, 0xd1, 0x88, 0x79, 0xa3, 0x6b, 0xb0, 0x1c, 0xb6, 0x94, 0xd3, 0x47, 0xc4, 0xed, + 0x38, 0xb6, 0x40, 0x1a, 0xe9, 0xa9, 0xe9, 0xeb, 0x77, 0xec, 0x48, 0xb7, 0x66, 0x63, 0xdd, 0x8a, + 0x16, 0x99, 0x3e, 0x57, 0xe4, 0xf7, 0x29, 0xc8, 0xc7, 0x01, 0xa0, 0x3c, 0x24,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9e, 0x59, 0xeb, 0x5b, 0x66, 0x63, 0xbb, 0xd3, 0x30, 0x5a, 0x5b, 0x66, 0xab, + 0xb9, 0x94, 0x2c, 0x5e, 0x39, 0x3c, 0xaa, 0xbc, 0xc9, 0x8c, 0xee, 0x40, 0xe1, 0xbc, 0xa9, 0xf5, + 0xb0, 0xd5, 0xd8, 0xf3, 0x43, 0x53, 0xc5, 0x3f, 0x1d, 0x1e, 0x55, 0xde, 0x68, 0x47, 0x35, 0x40, + 0x67, 0x36, 0xa3, 0x75, 0x77, 0x6f, 0xb7, 0xd9, 0x6a, 0x2e, 0xcd, 0x14, 0x2f, 0x1f, 0x1e, 0x55, + 0x2e, 0xb0, 0x14, 0x67, 0x9e, 0x7c, 0x55, 0x4a, 0xd4, 0xff, 0xff, 0xec, 0xb4, 0xa4, 0x3d, 0x3f, + 0x2d, 0x69, 0x3f, 0x9f, 0x96, 0xb4, 0xcf, 0x5e, 0x96, 0x12, 0xcf, 0x5f, 0x96, 0x12, 0x3f, 0xbe, + 0x2c, 0x25, 0x3e, 0xbe, 0x11, 0x61, 0xf9, 0x43, 0xc7, 0xe5, 0xc4, 0x33, 0x09, 0x1e, 0xca, 0x77, + 0xbc, 0x3e, 0xa4, 0xf6, 0x78, 0x40, 0xf4, 0xa9, 0x12, 0x05, 0xe7, 0xdd, 0xb4, 0x78, 0x0c, 0xdf, + 0xfc, 0x3d, 0x00, 0x00, 0xff, 0xff, 0x88, 0x78, 0x3b, 0x5e, 0xf5, 0x0b, 0x00, 0x00, } func (m *ExternalEventVoteRecord) Marshal() (dAtA []byte, err error) { @@ -1760,6 +1799,41 @@ func (m *ColdStorageTransferProposal) MarshalToSizedBuffer(dAtA []byte) (int, er return len(dAtA) - i, nil } +func (m *TokenInfosChangeProposal) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TokenInfosChangeProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TokenInfosChangeProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.NewInfos != nil { + { + size, err := m.NewInfos.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMhub2(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintMhub2(dAtA []byte, offset int, v uint64) int { offset -= sovMhub2(v) base := offset @@ -2086,6 +2160,19 @@ func (m *ColdStorageTransferProposal) Size() (n int) { return n } +func (m *TokenInfosChangeProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.NewInfos != nil { + l = m.NewInfos.Size() + n += 1 + l + sovMhub2(uint64(l)) + } + return n +} + func sovMhub2(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -4275,6 +4362,95 @@ func (m *ColdStorageTransferProposal) Unmarshal(dAtA []byte) error { } return nil } +func (m *TokenInfosChangeProposal) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMhub2 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TokenInfosChangeProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TokenInfosChangeProposal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewInfos", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMhub2 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMhub2 + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMhub2 + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.NewInfos == nil { + m.NewInfos = &TokenInfos{} + } + if err := m.NewInfos.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMhub2(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMhub2 + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMhub2 + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipMhub2(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/module/x/mhub2/types/proposal.go b/module/x/mhub2/types/proposal.go index 4c882ac..6aef759 100644 --- a/module/x/mhub2/types/proposal.go +++ b/module/x/mhub2/types/proposal.go @@ -11,20 +11,27 @@ import ( const ( // ProposalTypeColdStorageTransfer defines the type for a ColdStorageTransferProposal ProposalTypeColdStorageTransfer = "ColdStorageTransfer" + ProposalTypeTokenInfosChange = "TokenInfosChange" ) // Assert ColdStorageTransferProposal implements govtypes.Content at compile-time var _ govtypes.Content = &ColdStorageTransferProposal{} +var _ govtypes.Content = &TokenInfosChangeProposal{} func init() { govtypes.RegisterProposalType(ProposalTypeColdStorageTransfer) govtypes.RegisterProposalTypeCodec(&ColdStorageTransferProposal{}, "mhub2/ColdStorageTransferProposal") + govtypes.RegisterProposalTypeCodec(&TokenInfosChangeProposal{}, "mhub2/TokenInfosChangeProposal") } func NewColdStorageTransferProposal(chainId ChainID, amount sdk.Coins) *ColdStorageTransferProposal { return &ColdStorageTransferProposal{chainId.String(), amount} } +func NewTokenInfosChangeProposal(tokenInfos *TokenInfos) *TokenInfosChangeProposal { + return &TokenInfosChangeProposal{NewInfos: tokenInfos} +} + // GetTitle returns the title of a community pool spend proposal. func (csp *ColdStorageTransferProposal) GetTitle() string { return "ColdStorageTransferProposal" } @@ -54,3 +61,28 @@ func (csp ColdStorageTransferProposal) String() string { Amount: %s`, csp.Amount)) return b.String() } + +func (tic *TokenInfosChangeProposal) GetTitle() string { return "TokenInfosChangeProposal" } + +func (tic *TokenInfosChangeProposal) GetDescription() string { return "TokenInfosChangeProposal" } + +func (tic *TokenInfosChangeProposal) ProposalRoute() string { return RouterKey } + +func (tic *TokenInfosChangeProposal) ProposalType() string { return ProposalTypeTokenInfosChange } + +func (tic *TokenInfosChangeProposal) ValidateBasic() error { + err := govtypes.ValidateAbstract(tic) + if err != nil { + return err + } + + return nil +} + +// String implements the Stringer interface. +func (tic TokenInfosChangeProposal) String() string { + var b strings.Builder + b.WriteString(fmt.Sprintf(`Token Infos Change Proposal: + New Tokens: %s`, tic.NewInfos)) + return b.String() +} From b86ef782c84708dd183d5b539a5b44ca97056685 Mon Sep 17 00:00:00 2001 From: Daniil Lashin Date: Wed, 8 Dec 2021 08:24:41 +0300 Subject: [PATCH 09/14] Fix empty valset error --- orchestrator/mhub2_utils/src/error.rs | 4 ++++ orchestrator/relayer/src/find_latest_valset.rs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/orchestrator/mhub2_utils/src/error.rs b/orchestrator/mhub2_utils/src/error.rs index 2f7ff28..f1511f5 100644 --- a/orchestrator/mhub2_utils/src/error.rs +++ b/orchestrator/mhub2_utils/src/error.rs @@ -28,6 +28,7 @@ pub enum GravityError { InsufficientVotingPowerToPass(String), ParseBigIntError(ParseBigIntError), InvalidEstimationError, + ValsetNotFoundError, } impl fmt::Display for GravityError { @@ -60,6 +61,9 @@ impl fmt::Display for GravityError { GravityError::InvalidEstimationError => { write!(f, "Failed to retrieve batch price estimation") } + GravityError::ValsetNotFoundError => { + write!(f, "Last observed valset not found") + } } } } diff --git a/orchestrator/relayer/src/find_latest_valset.rs b/orchestrator/relayer/src/find_latest_valset.rs index 1619ca0..e465ccd 100644 --- a/orchestrator/relayer/src/find_latest_valset.rs +++ b/orchestrator/relayer/src/find_latest_valset.rs @@ -14,5 +14,9 @@ pub async fn find_latest_valset( let cosmos_chain_valset = cosmos_gravity::query::get_last_observed_valset(grpc_client, chain_id.clone()).await?; + if cosmos_chain_valset.is_none() { + return Err(GravityError::ValsetNotFoundError); + } + Ok(cosmos_chain_valset.unwrap()) } From a68f286964299f81efc8341a0d613235a9b4316d Mon Sep 17 00:00:00 2001 From: Daniil Lashin Date: Wed, 8 Dec 2021 08:59:28 +0300 Subject: [PATCH 10/14] Fix tests and holders tally --- auto-tests/main.go | 2 +- module/x/oracle/keeper/attestation_handler.go | 5 +---- oracle/cmd/mhub-oracle/main.go | 8 ++++++-- oracle/config/config.go | 6 ++++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/auto-tests/main.go b/auto-tests/main.go index f73c60c..d4187b0 100644 --- a/auto-tests/main.go +++ b/auto-tests/main.go @@ -193,7 +193,7 @@ func main() { } time.Sleep(time.Second * 10) - go runOrPanic("mhub-oracle --config=oracle-config.toml --cosmos-mnemonic=%s", cosmosMnemonic) + go runOrPanic("mhub-oracle --testnet --config=oracle-config.toml --cosmos-mnemonic=%s", cosmosMnemonic) go runOrPanic("mhub-minter-connector --config=connector-config.toml --cosmos-mnemonic=%s --minter-private-key=%s --minter-multisig-addr=%s", cosmosMnemonic, ethPrivateKeyString, minterMultisig) go runOrPanic("orchestrator --chain-id=ethereum --eth-fee-calculator-url=http://localhost:8840 --cosmos-phrase=%s --ethereum-key=%s --cosmos-grpc=%s --ethereum-rpc=%s --contract-address=%s --fees=%s --address-prefix=hub --metrics-listen=127.0.0.1:3000", cosmosMnemonic, ethPrivateKeyString, "http://localhost:9090", "http://localhost:8545", ethContract, denom) go runOrPanic("orchestrator --chain-id=bsc --eth-fee-calculator-url=http://localhost:8840 --cosmos-phrase=%s --ethereum-key=%s --cosmos-grpc=%s --ethereum-rpc=%s --contract-address=%s --fees=%s --address-prefix=hub --metrics-listen=127.0.0.1:3001", cosmosMnemonic, ethPrivateKeyString, "http://localhost:9090", "http://localhost:8546", bscContract, denom) diff --git a/module/x/oracle/keeper/attestation_handler.go b/module/x/oracle/keeper/attestation_handler.go index cfbb7a9..5987ad0 100644 --- a/module/x/oracle/keeper/attestation_handler.go +++ b/module/x/oracle/keeper/attestation_handler.go @@ -78,10 +78,7 @@ func (a AttestationHandler) Handle(ctx sdk.Context, att types.Attestation, claim holdersClaim := a.keeper.GetHoldersClaim(ctx, sdk.AccAddress(validator).String(), claim.Epoch).(*types.GenericClaim).GetHoldersClaim() hash := fmt.Sprintf("%x", holdersClaim.StabilizedClaimHash()) holdersVotes[hash] = holdersClaim.Holders - - for _, item := range holdersClaim.GetHolders().List { - holdersTally[item.Address] = holdersTally[item.Address] + power - } + holdersTally[hash] = holdersTally[hash] + power } // todo: should we iterate this in sorted way? diff --git a/oracle/cmd/mhub-oracle/main.go b/oracle/cmd/mhub-oracle/main.go index 6c03192..e3515c1 100644 --- a/oracle/cmd/mhub-oracle/main.go +++ b/oracle/cmd/mhub-oracle/main.go @@ -19,13 +19,17 @@ import ( "google.golang.org/grpc/backoff" ) -const holdersUpdatePeriod = 144 +var holdersUpdatePeriod uint64 = 144 func main() { logger := log.NewTMLogger(os.Stdout) - cfg := config.Get() + cfg, isTestnet := config.Get() cosmos.Setup(cfg) + if isTestnet { + holdersUpdatePeriod = 1 + } + orcAddress, orcPriv := cosmos.GetAccount(cfg.Cosmos.Mnemonic) logger.Info("Orc address", "address", orcAddress.String()) diff --git a/oracle/config/config.go b/oracle/config/config.go index 951f692..8d60ca7 100644 --- a/oracle/config/config.go +++ b/oracle/config/config.go @@ -18,11 +18,13 @@ type Config struct { PricesUrl string `mapstructure:"prices_url"` } -func Get() *Config { +func Get() (*Config, bool) { cfg := &Config{} configPath := flag.String("config", "config.toml", "path to the configuration file") cosmosMnemonic := flag.String("cosmos-mnemonic", "", "") + testnet := flag.Bool("testnet", false, "") + flag.Parse() v := viper.New() @@ -40,5 +42,5 @@ func Get() *Config { cfg.Cosmos.Mnemonic = *cosmosMnemonic } - return cfg + return cfg, *testnet } From 5baaf5f4eeb1b6a3d0c1ccda3eccddc9e8993dfd Mon Sep 17 00:00:00 2001 From: Daniil Lashin Date: Wed, 8 Dec 2021 08:59:39 +0300 Subject: [PATCH 11/14] Optimize relayer --- orchestrator/ethereum_gravity/src/submit_batch.rs | 4 +++- orchestrator/relayer/src/batch_relaying.rs | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/orchestrator/ethereum_gravity/src/submit_batch.rs b/orchestrator/ethereum_gravity/src/submit_batch.rs index a49aca4..add7a88 100644 --- a/orchestrator/ethereum_gravity/src/submit_batch.rs +++ b/orchestrator/ethereum_gravity/src/submit_batch.rs @@ -7,6 +7,7 @@ use mhub2_utils::message_signatures::encode_tx_batch_confirm_hashed; use mhub2_utils::types::*; use std::collections::HashMap; use std::{cmp::min, time::Duration}; +use web30::types::SendTxOption::Nonce; use web30::{client::Web3, types::TransactionRequest}; /// this function generates an appropriate Ethereum transaction @@ -21,6 +22,7 @@ pub async fn send_eth_transaction_batch( gravity_contract_address: EthAddress, gravity_id: String, our_eth_key: EthPrivateKey, + nonce: Uint256, ) -> Result<(), GravityError> { let new_batch_nonce = batch.nonce; let eth_address = our_eth_key.to_public_key().unwrap(); @@ -61,7 +63,7 @@ pub async fn send_eth_transaction_batch( 0u32.into(), eth_address, our_eth_key, - vec![], + vec![Nonce(nonce)], ) .await?; info!("Sent batch update with txid {:#066x}", tx); diff --git a/orchestrator/relayer/src/batch_relaying.rs b/orchestrator/relayer/src/batch_relaying.rs index d1d607f..ec2d85e 100644 --- a/orchestrator/relayer/src/batch_relaying.rs +++ b/orchestrator/relayer/src/batch_relaying.rs @@ -12,6 +12,7 @@ use mhub2_utils::message_signatures::encode_tx_batch_confirm_hashed; use mhub2_utils::types::Valset; use mhub2_utils::types::{BatchConfirmResponse, TransactionBatch}; use std::collections::HashMap; +use std::ops::Add; use std::time::Duration; use tonic::transport::Channel; use web30::client::Web3; @@ -203,6 +204,13 @@ async fn submit_batches( return; } let latest_ethereum_batch = latest_ethereum_batch.unwrap(); + let nonce = web3.eth_get_transaction_count(our_ethereum_address).await; + if nonce.is_err() { + error!("Failed to get latest Ethereum nonce",); + return; + } + + let mut nonce = nonce.unwrap(); for batch in possible_batches { let oldest_signed_batch = batch.batch; @@ -263,8 +271,10 @@ async fn submit_batches( gravity_contract_address, gravity_id.clone(), ethereum_key, + nonce.clone(), ) .await; + nonce = nonce.add(1u64.into()); if res.is_err() { info!("Batch submission failed with {:?}", res); } From afd277c0e7a95374db9c579a9de833c3caeabe2b Mon Sep 17 00:00:00 2001 From: Daniil Lashin Date: Wed, 8 Dec 2021 09:46:23 +0300 Subject: [PATCH 12/14] Fixes --- auto-tests/main.go | 62 +++++++++++++++++++ module/x/mhub2/client/proposal_handler.go | 4 +- module/x/mhub2/client/rest/rest.go | 43 +++++++++++-- module/x/mhub2/types/proposal.go | 1 + module/x/oracle/keeper/attestation_handler.go | 5 +- 5 files changed, 106 insertions(+), 9 deletions(-) diff --git a/auto-tests/main.go b/auto-tests/main.go index d4187b0..03ddc9e 100644 --- a/auto-tests/main.go +++ b/auto-tests/main.go @@ -24,6 +24,7 @@ import ( secp256k12 "github.com/ethereum/go-ethereum/crypto/secp256k1" "github.com/ethereum/go-ethereum/ethclient" "github.com/status-im/keycard-go/hexutils" + "github.com/stretchr/testify/assert" "github.com/tendermint/tendermint/libs/log" "google.golang.org/grpc" "google.golang.org/grpc/backoff" @@ -241,6 +242,7 @@ func main() { testMinterToEthereumTransfer(ctx) testMinterToBscTransfer(ctx) testColdStorageTransfer(ctx) + testVoteForTokenInfosUpdate(ctx) testEthEthereumToMinterTransfer(ctx) testEthMinterToEthereumTransfer(ctx) @@ -283,7 +285,67 @@ func main() { println("All tests are done") } +func testVoteForTokenInfosUpdate(ctx *Context) { + ctx.TestsWg.Add(1) + addr, priv := cosmos.GetAccount(ctx.CosmosMnemonic) + + initialDeposit := sdk.NewCoins(sdk.NewCoin(denom, sdk.NewInt(10000000))) + + client := mhubtypes.NewQueryClient(ctx.CosmosConn) + + response, err := client.TokenInfos(context.TODO(), &mhubtypes.TokenInfosRequest{}) + if err != nil { + panic(err) + } + + newInfos := &response.List + newInfos.TokenInfos = append(newInfos.TokenInfos, &mhubtypes.TokenInfo{ + Id: 999, + Denom: "TEST", + ChainId: "minter", + ExternalTokenId: "123", + ExternalDecimals: 18, + Commission: bridgeCommission, + }) + + proposal := &govtypes.MsgSubmitProposal{} + proposal.SetInitialDeposit(initialDeposit) + proposal.SetProposer(addr) + if err := proposal.SetContent(&mhubtypes.TokenInfosChangeProposal{ + NewInfos: newInfos, + }); err != nil { + panic(err) + } + + cosmos.SendCosmosTx([]sdk.Msg{ + proposal, + govtypes.NewMsgVote(addr, 4, govtypes.OptionYes), + }, addr, priv, ctx.CosmosConn, log.NewTMLogger(os.Stdout), true) + + go func() { + startTime := time.Now() + for { + if time.Now().Sub(startTime).Seconds() > testTimeout.Seconds() { + panic("Timeout waiting for the token infos to update") + } + + response, err := client.TokenInfos(context.TODO(), &mhubtypes.TokenInfosRequest{}) + if err != nil { + panic(err) + } + + if !assert.ObjectsAreEqual(&response.List, newInfos) { + time.Sleep(time.Second) + continue + } + + println("SUCCESS: vote for new token list") + ctx.TestsWg.Done() + break + } + }() +} func testColdStorageTransfer(ctx *Context) { ctx.TestsWg.Add(1) addr, priv := cosmos.GetAccount(ctx.CosmosMnemonic) diff --git a/module/x/mhub2/client/proposal_handler.go b/module/x/mhub2/client/proposal_handler.go index 434b707..541c82d 100644 --- a/module/x/mhub2/client/proposal_handler.go +++ b/module/x/mhub2/client/proposal_handler.go @@ -7,5 +7,5 @@ import ( ) // ProposalColdStorageHandler is the param change proposal handler. -var ProposalColdStorageHandler = govclient.NewProposalHandler(cli.NewSubmitColdStorageTransferProposalTxCmd, rest.ProposalRESTHandler) -var ProposalTokensChangeHandler = govclient.NewProposalHandler(cli.NewSubmitColdStorageTransferProposalTxCmd, rest.ProposalRESTHandler) +var ProposalColdStorageHandler = govclient.NewProposalHandler(cli.NewSubmitColdStorageTransferProposalTxCmd, rest.ColdStorageTransferProposalRESTHandler) +var ProposalTokensChangeHandler = govclient.NewProposalHandler(cli.NewSubmitTokenInfosChangeProposalTxCmd, rest.TokenInfosChangeProposalRESTHandler) diff --git a/module/x/mhub2/client/rest/rest.go b/module/x/mhub2/client/rest/rest.go index 8e52b2d..8706ffd 100644 --- a/module/x/mhub2/client/rest/rest.go +++ b/module/x/mhub2/client/rest/rest.go @@ -12,16 +12,51 @@ import ( govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) -// ProposalRESTHandler returns a ProposalRESTHandler that exposes the param +// ColdStorageTransferProposalRESTHandler returns a ProposalRESTHandler that exposes the param // change REST handler with a given sub-route. -func ProposalRESTHandler(clientCtx client.Context) govrest.ProposalRESTHandler { +func ColdStorageTransferProposalRESTHandler(clientCtx client.Context) govrest.ProposalRESTHandler { return govrest.ProposalRESTHandler{ SubRoute: "cold_storage_transfer", - Handler: postProposalHandlerFn(clientCtx), + Handler: postProposalColdStorageTransferHandlerFn(clientCtx), } } -func postProposalHandlerFn(clientCtx client.Context) http.HandlerFunc { +func postProposalColdStorageTransferHandlerFn(clientCtx client.Context) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req utils.ColdStorageTransferProposalReq + if !rest.ReadRESTReq(w, r, clientCtx.LegacyAmino, &req) { + return + } + + req.BaseReq = req.BaseReq.Sanitize() + if !req.BaseReq.ValidateBasic(w) { + return + } + + content := types.NewColdStorageTransferProposal(types.ChainID(req.ChainId), req.Amount) + + msg, err := govtypes.NewMsgSubmitProposal(content, req.Deposit, req.Proposer) + if rest.CheckBadRequestError(w, err) { + return + } + if rest.CheckBadRequestError(w, msg.ValidateBasic()) { + return + } + + tx.WriteGeneratedTxResponse(clientCtx, w, req.BaseReq, msg) + } +} + +// TokenInfosChangeProposalRESTHandler returns a ProposalRESTHandler that exposes the param +// change REST handler with a given sub-route. +func TokenInfosChangeProposalRESTHandler(clientCtx client.Context) govrest.ProposalRESTHandler { + return govrest.ProposalRESTHandler{ + SubRoute: "token_infos_change", + Handler: postProposalTokenInfosChangeHandlerFn(clientCtx), + } +} + +func postProposalTokenInfosChangeHandlerFn(clientCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req utils.ColdStorageTransferProposalReq if !rest.ReadRESTReq(w, r, clientCtx.LegacyAmino, &req) { diff --git a/module/x/mhub2/types/proposal.go b/module/x/mhub2/types/proposal.go index 6aef759..59865fd 100644 --- a/module/x/mhub2/types/proposal.go +++ b/module/x/mhub2/types/proposal.go @@ -20,6 +20,7 @@ var _ govtypes.Content = &TokenInfosChangeProposal{} func init() { govtypes.RegisterProposalType(ProposalTypeColdStorageTransfer) + govtypes.RegisterProposalType(ProposalTypeTokenInfosChange) govtypes.RegisterProposalTypeCodec(&ColdStorageTransferProposal{}, "mhub2/ColdStorageTransferProposal") govtypes.RegisterProposalTypeCodec(&TokenInfosChangeProposal{}, "mhub2/TokenInfosChangeProposal") } diff --git a/module/x/oracle/keeper/attestation_handler.go b/module/x/oracle/keeper/attestation_handler.go index 5987ad0..5b2b75c 100644 --- a/module/x/oracle/keeper/attestation_handler.go +++ b/module/x/oracle/keeper/attestation_handler.go @@ -67,18 +67,17 @@ func (a AttestationHandler) Handle(ctx sdk.Context, att types.Attestation, claim a.keeper.storePrices(ctx, &prices) case *types.MsgHoldersClaim: - holdersTally := map[string]int64{} + holdersTally := map[string]uint64{} holdersVotes := map[string]*types.Holders{} powers := a.keeper.GetNormalizedValPowers(ctx) for _, valaddr := range att.GetVotes() { validator, _ := sdk.ValAddressFromBech32(valaddr) - power := sdk.NewDec(int64(powers[valaddr])).QuoInt64(math.MaxUint16).TruncateInt64() holdersClaim := a.keeper.GetHoldersClaim(ctx, sdk.AccAddress(validator).String(), claim.Epoch).(*types.GenericClaim).GetHoldersClaim() hash := fmt.Sprintf("%x", holdersClaim.StabilizedClaimHash()) holdersVotes[hash] = holdersClaim.Holders - holdersTally[hash] = holdersTally[hash] + power + holdersTally[hash] = holdersTally[hash] + powers[valaddr] } // todo: should we iterate this in sorted way? From b20addc450b6f5bee46b80e1f69cac45cb496dc7 Mon Sep 17 00:00:00 2001 From: Daniil Lashin Date: Wed, 8 Dec 2021 12:25:26 +0300 Subject: [PATCH 13/14] Update testnet --- readme.md | 10 +++++----- testnet/genesis.json | 38 +++++++++++++++++++------------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/readme.md b/readme.md index 007fece..7626817 100644 --- a/readme.md +++ b/readme.md @@ -80,7 +80,7 @@ curl https://raw.githubusercontent.com/MinterTeam/mhub2/master/testnet/genesis.j # Start and sync Minter Hub node mhub2 start \ - --p2p.persistent_peers="9fb8440290a6180174e86e82bbba205af9d98779@46.101.215.17:26656" + --p2p.persistent_peers="99d3c94add8faccdfe37aaa0e0a5889e1a06426a@46.101.215.17:26656" ``` 4. Generate Hub account @@ -131,8 +131,8 @@ mhub2 tx mhub2 set-delegate-keys --fro Ethereum Contract for mainnet: 0x897c27Fa372AA730D4C75B1243E7EA38879194E2 BSC Contract for mainnet: 0xF5b0ed82a0b3e11567081694cC66c3df133f7C8F -Ethereum Contract for testnet: 0xb150480c8f280C9A3f0CF1b7412dDaeF9eedb101 -BSC Contract for testnet: 0xcD53640C87Acd89BD7935765167D1E6330201C89 +Ethereum Contract for testnet: 0x06AC113939C66c3D0e68a09F64849A6EcC6099f1 +BSC Contract for testnet: 0x0c8ed00B0A80c4d436E9FCb67986bC3b1ee470d5 ``` ```bash @@ -161,8 +161,8 @@ orchestrator \ - **Start Hub ↔ Minter oracle.** ``` -Minter Multisig for testnet: Mxa7013f2c9a66db96a2712f0942784d4f9ba50378 -Start Minter Block for testnet: 6647833 +Minter Multisig for testnet: Mx8938134f2d7e1218a1756e76b0da2868b0ad20a1 +Start Minter Block for testnet: 6830657 Minter Multisig for mainnet: Mx68f4839d7f32831b9234f9575f3b95e1afe21a56 Start Minter Block for mainnet: 7696500 diff --git a/testnet/genesis.json b/testnet/genesis.json index 8ac1499..288e8ff 100644 --- a/testnet/genesis.json +++ b/testnet/genesis.json @@ -1,5 +1,5 @@ { - "genesis_time": "2021-11-29T11:06:28.42747565Z", + "genesis_time": "2021-12-08T08:55:31.127372793Z", "chain_id": "mhub-test-19", "initial_height": "1", "consensus_params": { @@ -33,7 +33,7 @@ "accounts": [ { "@type": "/cosmos.auth.v1beta1.BaseAccount", - "address": "hub1yus8nl8qlnjgn4vpyz7nn44smzcu2hftcfddl7", + "address": "hub16rqagasjcmqsv3en2zccj0ekmfrt77mhtkq7tv", "pub_key": null, "account_number": "0", "sequence": "0" @@ -47,7 +47,7 @@ }, "balances": [ { - "address": "hub1yus8nl8qlnjgn4vpyz7nn44smzcu2hftcfddl7", + "address": "hub16rqagasjcmqsv3en2zccj0ekmfrt77mhtkq7tv", "coins": [ { "denom": "hub", @@ -111,11 +111,11 @@ "max_change_rate": "0.010000000000000000" }, "min_self_delegation": "1", - "delegator_address": "hub1yus8nl8qlnjgn4vpyz7nn44smzcu2hftcfddl7", - "validator_address": "cosmosvaloper1yus8nl8qlnjgn4vpyz7nn44smzcu2hftqa5el2", + "delegator_address": "hub16rqagasjcmqsv3en2zccj0ekmfrt77mhtkq7tv", + "validator_address": "cosmosvaloper16rqagasjcmqsv3en2zccj0ekmfrt77mhnze2tc", "pubkey": { "@type": "/cosmos.crypto.ed25519.PubKey", - "key": "8NnaBHPpgFXm0/t42w+jMqivaCASCl5ewlkkdbY+Tpg=" + "key": "GJkTzozdv5IpI8mClnTJNiZ50tZ4VBtJ/sOPVahARgE=" }, "value": { "denom": "hub", @@ -124,30 +124,30 @@ }, { "@type": "/mhub2.v1.MsgDelegateKeys", - "validator_address": "cosmosvaloper1yus8nl8qlnjgn4vpyz7nn44smzcu2hftqa5el2", - "orchestrator_address": "hub1yus8nl8qlnjgn4vpyz7nn44smzcu2hftcfddl7", + "validator_address": "cosmosvaloper16rqagasjcmqsv3en2zccj0ekmfrt77mhnze2tc", + "orchestrator_address": "hub16rqagasjcmqsv3en2zccj0ekmfrt77mhtkq7tv", "external_address": "0x3bc0fed55E108bb21E1D7e6DCaEC68771E63DE20", - "eth_signature": "jDNvXxoKYbtwz8XA086fxqF9UuKHXL5Xdx4ypy1Z/9I8gT8R6GxdbeVJW26NNpfP6jdj8IyFyhrZyvnfmuOhEAA=", + "eth_signature": "CLyAjuqXfz6bYqIXHnMvlQ0r85LHgfNrabpx+jY5S8Q4swcxIFO4nDZJ/7+chN3oTQVCzYtSfqY5yhvmqHDpeAE=", "chain_id": "ethereum" }, { "@type": "/mhub2.v1.MsgDelegateKeys", - "validator_address": "cosmosvaloper1yus8nl8qlnjgn4vpyz7nn44smzcu2hftqa5el2", - "orchestrator_address": "hub1yus8nl8qlnjgn4vpyz7nn44smzcu2hftcfddl7", + "validator_address": "cosmosvaloper16rqagasjcmqsv3en2zccj0ekmfrt77mhnze2tc", + "orchestrator_address": "hub16rqagasjcmqsv3en2zccj0ekmfrt77mhtkq7tv", "external_address": "0x3bc0fed55E108bb21E1D7e6DCaEC68771E63DE20", - "eth_signature": "jDNvXxoKYbtwz8XA086fxqF9UuKHXL5Xdx4ypy1Z/9I8gT8R6GxdbeVJW26NNpfP6jdj8IyFyhrZyvnfmuOhEAA=", + "eth_signature": "CLyAjuqXfz6bYqIXHnMvlQ0r85LHgfNrabpx+jY5S8Q4swcxIFO4nDZJ/7+chN3oTQVCzYtSfqY5yhvmqHDpeAE=", "chain_id": "minter" }, { "@type": "/mhub2.v1.MsgDelegateKeys", - "validator_address": "cosmosvaloper1yus8nl8qlnjgn4vpyz7nn44smzcu2hftqa5el2", - "orchestrator_address": "hub1yus8nl8qlnjgn4vpyz7nn44smzcu2hftcfddl7", + "validator_address": "cosmosvaloper16rqagasjcmqsv3en2zccj0ekmfrt77mhnze2tc", + "orchestrator_address": "hub16rqagasjcmqsv3en2zccj0ekmfrt77mhtkq7tv", "external_address": "0x3bc0fed55E108bb21E1D7e6DCaEC68771E63DE20", - "eth_signature": "jDNvXxoKYbtwz8XA086fxqF9UuKHXL5Xdx4ypy1Z/9I8gT8R6GxdbeVJW26NNpfP6jdj8IyFyhrZyvnfmuOhEAA=", + "eth_signature": "CLyAjuqXfz6bYqIXHnMvlQ0r85LHgfNrabpx+jY5S8Q4swcxIFO4nDZJ/7+chN3oTQVCzYtSfqY5yhvmqHDpeAE=", "chain_id": "bsc" } ], - "memo": "9fb8440290a6180174e86e82bbba205af9d98779@46.101.215.17:26656", + "memo": "99d3c94add8faccdfe37aaa0e0a5889e1a06426a@46.101.215.17:26656", "timeout_height": "0", "extension_options": [], "non_critical_extension_options": [] @@ -157,7 +157,7 @@ { "public_key": { "@type": "/cosmos.crypto.secp256k1.PubKey", - "key": "AjZNAS3WHy7Q/XJx73tvjnu7OQWxKsp03A2ay5yK/ApK" + "key": "Avi7lHaECGAtKDdKUaQb3vWOkBlbyrFLdzqnsoKM6iy2" }, "mode_info": { "single": { @@ -175,7 +175,7 @@ } }, "signatures": [ - "66UdJnFAvi4veEJ6iPjSZndcV90I1qniUin79eN5TNQGDcGZKbkYbymEXy91bFX7nnz8Ice8bTb+sk+clQmb+A==" + "v8lW7/vHZzgB2Z35/u8DMft8Wu+WxTkFiOIkQnwuEx9CShRIoPkND9bJDn0jDKg04ccVUUU4Utn86Ip4FvNPXQ==" ] } ] @@ -195,7 +195,7 @@ "max_deposit_period": "172800s" }, "voting_params": { - "voting_period": "172800s" + "voting_period": "60s" }, "tally_params": { "quorum": "0.334000000000000000", From 7e9bf0fa3de6fbac3b5f9dfbaf3bcd481fa94fc1 Mon Sep 17 00:00:00 2001 From: Daniil Lashin Date: Wed, 8 Dec 2021 13:54:15 +0300 Subject: [PATCH 14/14] Fix default power reduction --- module/app/app.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/app/app.go b/module/app/app.go index e24b337..10499a0 100644 --- a/module/app/app.go +++ b/module/app/app.go @@ -401,7 +401,7 @@ func NewMhub2App( app.bankKeeper, app.slashingKeeper, app.oracleKeeper, - sdk.NewIntFromUint64(1e18), + sdk.DefaultPowerReduction, ) app.stakingKeeper = *stakingKeeper.SetHooks(