Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: LSM changes to staking #7

Merged
merged 22 commits into from
Dec 5, 2023
Merged

Conversation

sainoe
Copy link

@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 Error

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 Error

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 Error

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 Error

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 Error

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 Error

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 Error

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 Warning

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 Warning

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
@@ -17,6 +17,7 @@
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 Warning

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 Warning

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 Warning

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 Warning

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 Warning

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 Warning

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 Warning

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 Warning

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

@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.

x/staking/keeper/liquid_stake.go Dismissed Show dismissed Hide dismissed
x/staking/keeper/liquid_stake.go Dismissed Show dismissed Hide dismissed
x/staking/keeper/slash.go Dismissed Show dismissed Hide dismissed
Copy link
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

x/staking/simulation/operations.go Outdated Show resolved Hide resolved
x/staking/keeper/grpc_query.go Outdated Show resolved Hide resolved
x/staking/keeper/grpc_query.go Show resolved Hide resolved
x/staking/keeper/msg_server.go Outdated Show resolved Hide resolved
x/staking/keeper/msg_server.go Outdated Show resolved Hide resolved
@MSalopek MSalopek merged commit e7220e3 into feat/lsm/v0.47.x Dec 5, 2023
12 of 21 checks passed
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.

3 participants