Skip to content

chore: LSM changes to staking#7

Merged
MSalopek merged 22 commits intofeat/lsm/v0.47.xfrom
sainoe/lsm-staking
Dec 5, 2023
Merged

chore: LSM changes to staking#7
MSalopek merged 22 commits intofeat/lsm/v0.47.xfrom
sainoe/lsm-staking

Conversation

@sainoe
Copy link
Copy Markdown

@sainoe sainoe commented Nov 28, 2023

Description

Closes: #XXXX


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • run make lint and make test
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

DefaultWeightMsgFundCommunityPool int = 50
OpWeightMsgSetWithdrawAddress = "op_weight_msg_set_withdraw_address" //nolint:gosec
OpWeightMsgWithdrawDelegationReward = "op_weight_msg_withdraw_delegation_reward" //nolint:gosec
OpWeightMsgWithdrawValidatorCommission = "op_weight_msg_withdraw_validator_commission" //nolint:gosec

Check failure

Code scanning / gosec

Potential hardcoded credentials

Potential hardcoded credentials
DefaultWeightMsgWithdrawValidatorCommission int = 50
DefaultWeightMsgFundCommunityPool int = 50
OpWeightMsgSetWithdrawAddress = "op_weight_msg_set_withdraw_address" //nolint:gosec
OpWeightMsgWithdrawDelegationReward = "op_weight_msg_withdraw_delegation_reward" //nolint:gosec

Check failure

Code scanning / gosec

Potential hardcoded credentials

Potential hardcoded credentials
DefaultWeightMsgWithdrawDelegationReward int = 50
DefaultWeightMsgWithdrawValidatorCommission int = 50
DefaultWeightMsgFundCommunityPool int = 50
OpWeightMsgSetWithdrawAddress = "op_weight_msg_set_withdraw_address" //nolint:gosec

Check failure

Code scanning / gosec

Potential hardcoded credentials

Potential hardcoded credentials
OpWeightMsgWithdrawDelegationReward = "op_weight_msg_withdraw_delegation_reward" //nolint:gosec
OpWeightMsgWithdrawValidatorCommission = "op_weight_msg_withdraw_validator_commission" //nolint:gosec
OpWeightMsgFundCommunityPool = "op_weight_msg_fund_community_pool" //nolint:gosec
OpWeightMsgWithdrawAllTokenizeShareRecordReward = "op_weight_msg_withdraw_all_tokenize_share_record_reward" //nolint:gosec

Check failure

Code scanning / gosec

Potential hardcoded credentials

Potential hardcoded credentials
OpWeightMsgSetWithdrawAddress = "op_weight_msg_set_withdraw_address" //nolint:gosec
OpWeightMsgWithdrawDelegationReward = "op_weight_msg_withdraw_delegation_reward" //nolint:gosec
OpWeightMsgWithdrawValidatorCommission = "op_weight_msg_withdraw_validator_commission" //nolint:gosec
OpWeightMsgFundCommunityPool = "op_weight_msg_fund_community_pool" //nolint:gosec

Check failure

Code scanning / gosec

Potential hardcoded credentials

Potential hardcoded credentials
TypeMsgRedeemTokensForShares = "redeem_tokens_for_shares"
TypeMsgTransferTokenizeShareRecord = "transfer_tokenize_share_record"
TypeMsgDisableTokenizeShares = "disable_tokenize_shares"
TypeMsgEnableTokenizeShares = "enable_tokenize_shares"

Check failure

Code scanning / gosec

Potential hardcoded credentials

Potential hardcoded credentials
TypeMsgBeginRedelegate = "begin_redelegate"
TypeMsgUpdateParams = "update_params"
TypeMsgTokenizeShares = "tokenize_shares"
TypeMsgRedeemTokensForShares = "redeem_tokens_for_shares"

Check failure

Code scanning / gosec

Potential hardcoded credentials

Potential hardcoded credentials
func (msg MsgWithdrawTokenizeShareRecordReward) GetSigners() []sdk.AccAddress {
owner, err := sdk.AccAddressFromBech32(msg.OwnerAddress)
if err != nil {
panic(err)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
func (msg MsgWithdrawAllTokenizeShareRecordReward) GetSigners() []sdk.AccAddress {
owner, err := sdk.AccAddressFromBech32(msg.OwnerAddress)
if err != nil {
panic(err)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker)

k.TrackHistoricalInfo(ctx)
k.RemoveExpiredTokenizeShareLocks(ctx, ctx.BlockTime())

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call
func (msg MsgUnbondValidator) GetSigners() []sdk.AccAddress {
valAddr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress)
if err != nil {
panic(err)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
func (msg MsgTokenizeShares) GetSigners() []sdk.AccAddress {
delegator, err := sdk.AccAddressFromBech32(msg.DelegatorAddress)
if err != nil {
panic(err)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
func (msg MsgRedeemTokensForShares) GetSigners() []sdk.AccAddress {
delegator, err := sdk.AccAddressFromBech32(msg.DelegatorAddress)
if err != nil {
panic(err)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
func (msg MsgTransferTokenizeShareRecord) GetSigners() []sdk.AccAddress {
sender, err := sdk.AccAddressFromBech32(msg.Sender)
if err != nil {
panic(err)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
func (msg MsgDisableTokenizeShares) GetSigners() []sdk.AccAddress {
sender, err := sdk.AccAddressFromBech32(msg.DelegatorAddress)
if err != nil {
panic(err)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
func (msg MsgEnableTokenizeShares) GetSigners() []sdk.AccAddress {
sender, err := sdk.AccAddressFromBech32(msg.DelegatorAddress)
if err != nil {
panic(err)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
func (msg MsgValidatorBond) GetSigners() []sdk.AccAddress {
delegator, err := sdk.AccAddressFromBech32(msg.DelegatorAddress)
if err != nil {
panic(err)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
@sainoe sainoe marked this pull request as ready for review November 29, 2023 16:42
Copy link
Copy Markdown

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gosec found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.


tokensBz, err := tokens.Marshal()
if err != nil {
panic(err)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt

var tokens sdk.Int
if err := tokens.Unmarshal(tokensBz); err != nil {
panic(err)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
// This only error's if the total liquid staked tokens underflows
// which would indicate there's a corrupted state where the validator has
// liquid tokens that are not accounted for in the global total
panic(err)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
Copy link
Copy Markdown
Collaborator

@mpoke mpoke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic seems good. Check my comments below. Also,

  • the following tests are missing: TestNewTokenizeSharesCmd, TestNewRedeemTokensCmd, TestNewTransferTokenizeShareRecordCmd (before in x/staking/client/testutil/suite.go);
  • signers in proto/cosmos/staking/v1beta1/tx.proto are missing (check x/staking/types/msg.go to identify the signers for each message);
  • let's not forget to add the necessary changes to RandomFees in types/simulation/account.go cc @MSalopek

@MSalopek MSalopek merged commit e7220e3 into feat/lsm/v0.47.x Dec 5, 2023
sainoe pushed a commit that referenced this pull request Apr 25, 2025
* POS-1956: solved conflicts

* POS-1956: refactor ante decorators based on heimdall

* POS-1956: remove comment

* POS-1956: revert some minor changes

* chg: rename todo comments

* chg: comments

* Addressed a few TODOs in auth (#2)

* resolved todos in keeper.go (except 1)

* updated x/auth/keeper/grpc_query.go with comments

* added comments in auth/module.go

* removed depinject from auth.ModuleInputs

* resolved TODOs in auth/keeper/genesis (created NewBaseAccount and passed to processor)

* removed some TODOs from x/auth/types/account.go

* added few comments in x/auth/ante/ante.go

* few final comments and modifications

* add: generate proto files

* chg: solve some TODOs

* chg: solve some TODOs / restore multiSign as this won't be anyway used

* chg: solve some TODOs / restore original AccAddress due to new strategy

* chg: solve some TODOs / fix some tests / continue revert on AccAddress

* chg: fix on signers loop

* chg: fix on signers loop / 2

* chg: fix some tests and skip others

* chg: regress to AccAddress for keyring record

* chg: implement Addresses as hex entities / fix build and tests (for auth)

* chg: fix build for other modules

* chg: fix build for simapp / workaround for evidence module

* chg: address more TODOs / use empty default prefix / fix build for prefix changes

* chg: minor changes

* chg: modify auth README

* chg: remove bech32 comments / fix address codec

* chg: improve comments

* chg: rename hex codecs / add 0x prefix on address strings / fix tests accordingly

* chg: add emptyness check on string method for address / restore original txBuilder tests

* chg: more meaningful comments for the upcoming PR reviews

* chg: remove bech22-related code / remove hex prefix / replace feeCollector with bankKeeper / address PR comments

* chg: address PR comments / temp comment out scheduled CI jobs

* chg: delete pulp related files / fix typo

* chg: solve some TODOs / fix some tests and provide context for skipped tests

* chg: remove SetGasMeter call and fix mempool test accordingly

* chg: remove StdTxRaw

* chg: address PR comments

* chg: unskip other tests / distinguish TODO HV2 comments from HV2 comments

* chg: fix VerifyAddressFormat / move fees reletad vars / remove ante handlers in simapp / adapt tests

* chg: skip AccountProcessors for the time being in depInject / Re-enable tests accordingly

* chg: increase test balances to pay for the DefaultMaxFee in heimdall / re-enable TestAccountRetriever test

* chg: update a comment

* chg: remove AccountProcessors until implemented at the end of migration

* chg: add a TODO comment for HV2 sigVerify

* fix typo in client/keys/show.go

Co-authored-by: Sergio Mena <sergio@informal.systems>

* chg: better comment for a TODO case

* chg: better comment on TODO action

* chg: add comment for credentials tests

* chg: simplify txFeesSum for keeper_test

* chg: fix comment on AddressBytesToString method

* chg: fix comment on AddressBytesToString method /2

* chg: disable multisig

* chg: implement cometBFT changes and adapt tests accordingly

* chg: address PR comments

* chg: better context for HV2 TODOs

* chg: address comments to remove PublicKey_Secp256K1 cases

* chg: updated cometBFT version to first 0xPolygon release

* chg: address PR comments

* chg: address PR comments

* chg: go mod tidy all

* chg: merge auth

* chg: go mod tidy

* chg: fix tests

* chg: fix TestAminoUnmarshalJSON

* chg: add DefaultFeeInMatic concept in auth README

* chg: address comments

* chg: better comment on panic

* chg: remove vesting accounts from RandomGenesisAccounts during simulation

* chg: update go deps for sdk and simapp

* chg: removed comment for HFs

* chg: remove heimdall types

* chg: fix keyring tests

* Porting: gov module (#7)

* add: port gov module

* chg: implement WeightedVoteOptions with constraints

* chg: better TODOs descriptions

* chg: POS-2135: fix some tests

* chg: POS-2135: fix more tests

* chg: POS-2135: update an address format

* chg: fix few more tests

* chg: fix few more tests

* chg: fix some tests / temp revert some others to properly tune params later on

* chg: fix TestHooks

* chg: fix burn related methods / fix tests

* chg: fix query for WeightedVoteOptions / better comments

* chg: fix all tests in gov module

* chg: fix a staking integration test

* chg: POS-2142: edit gov readme

* chg: use AccAddressFromHex in tests instead of addressCodec

* chg: enable one test / provide better context for the only skipped test

* chg: use hex acc addresses in gov tests

* chg: return empty string on ProposalType normalization

* chg: remove TextProposals / add comment for Msgs auto-execution

* chg: re-enable textProposals / TBD with team

* chg: remove comment

* chg: better context for HV2 TODOs

* chg: filter out non valid proposals msgs types and content

* chg: fix typeUrls

* chg: filter out not supported messages at time of proposals submit / fix tests accordingly

* chg: go mod tidy

* chg: address PR comments: filtering dedicated file / test msg types / edit comments

* chg: register interfaces in gov test app

* chg: better context for comments

* chg: comment for future improvements

* chg: consistent example of gov tx for submit proposal

* chg: add msgServers in testApp to allow additional MsgUpdateParams types

* chg: fix tests after merge

* chg: update go deps for sdk and simapp

* chg: comment

* chg: comment in README for further actions

---------

Co-authored-by: Raneet Debnath <raneetdebnath10@gmail.com>

* Porting: bank module (#5)

* proto,x/bank: initial port of heimdall related changes for bank module

* x/bank: rm moduleName param from SubtractCoins + rm MsgSetSendEnabled,add MsgMultiSend to amino registry + rm unused commented code

* simapp,x/auth,x/bank: address PR comments

* x/bank: change feeAmount to defaultFeeAmount in test

* x/bank: address PR comments

* x/bank: use CreateRandomValidatorSet instead of manually initialising validator set in tests

* x/bank,proto: change heimdall v2 comment format

* all: fix broken simapp dep

* x/bank: rm SetCoins

* x/auth,x/bank: modify bank tests with assertions for fee_collector and account balances

* x/bank: minor code refactors

---------

Co-authored-by: Raneet Debnath <raneetdebnath10@gmail.com>
Co-authored-by: Pratik Patil <pratikspatil024@gmail.com>
Co-authored-by: Sergio Mena <sergio@informal.systems>
Co-authored-by: Raneet Debnath <35629432+Raneet10@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants