-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DFI-603] Disable rewards txes (#192)
* Denied messages list (to disable rewards txs), same for CLI * cosmos version to v0.39.1 (previous branch missed) * Test disabled distribution txs * fixed comment
- Loading branch information
1 parent
be4e53f
commit 1256df9
Showing
10 changed files
with
139 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// +build unit | ||
|
||
package app | ||
|
||
import ( | ||
"testing" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/errors" | ||
"github.com/cosmos/cosmos-sdk/x/distribution" | ||
"github.com/tendermint/tendermint/crypto/secp256k1" | ||
|
||
"github.com/dfinance/dnode/cmd/config" | ||
) | ||
|
||
// Check disabled distribution transactions. | ||
func TestDistribution_MessagesNotWorking(t *testing.T) { | ||
t.Parallel() | ||
|
||
app, appStop := NewTestDnAppMockVM() | ||
defer appStop() | ||
|
||
genValidators, _, _, _ := CreateGenAccounts(9, GenDefCoins(t)) | ||
nodePrivKey := secp256k1.PrivKeySecp256k1(CheckSetGenesisMockVM(t, app, genValidators)) | ||
nodePubKey := nodePrivKey.PubKey() | ||
nodeAddress := sdk.AccAddress(nodePubKey.Address()) | ||
valAddress := sdk.ValAddress(nodePubKey.Address()) | ||
|
||
// check withdraw rewards tx. | ||
{ | ||
senderAcc, senderPrivKey := GetAccountCheckTx(app, nodeAddress), nodePrivKey | ||
// need delegator and validator address. | ||
withdrawRewardsMsg := distribution.NewMsgWithdrawDelegatorReward(nodeAddress, valAddress) | ||
tx := GenTx([]sdk.Msg{withdrawRewardsMsg}, []uint64{senderAcc.GetAccountNumber()}, []uint64{senderAcc.GetSequence()}, senderPrivKey) | ||
CheckDeliverSpecificErrorTx(t, app, tx, errors.ErrUnknownRequest) | ||
} | ||
|
||
// check withdraw validator comission tx. | ||
{ | ||
senderAcc, senderPrivKey := GetAccountCheckTx(app, nodeAddress), nodePrivKey | ||
withdrawComissionMsg := distribution.NewMsgWithdrawValidatorCommission(valAddress) | ||
tx := GenTx([]sdk.Msg{withdrawComissionMsg}, []uint64{senderAcc.GetAccountNumber()}, []uint64{senderAcc.GetSequence()}, senderPrivKey) | ||
CheckDeliverSpecificErrorTx(t, app, tx, errors.ErrUnknownRequest) | ||
} | ||
|
||
// check fund community pool. | ||
{ | ||
senderAcc, senderPrivKey := GetAccountCheckTx(app, nodeAddress), nodePrivKey | ||
withdrawComissionMsg := distribution.MsgFundCommunityPool(sdk.NewCoins(sdk.NewCoin(config.MainDenom, sdk.NewInt(1))), nodeAddress) | ||
tx := GenTx([]sdk.Msg{withdrawComissionMsg}, []uint64{senderAcc.GetAccountNumber()}, []uint64{senderAcc.GetSequence()}, senderPrivKey) | ||
CheckDeliverSpecificErrorTx(t, app, tx, errors.ErrUnknownRequest) | ||
} | ||
|
||
// check set withdraw address. | ||
{ | ||
senderAcc, senderPrivKey := GetAccountCheckTx(app, nodeAddress), nodePrivKey | ||
withdrawAddress := distribution.NewMsgSetWithdrawAddress(nodeAddress, sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address())) | ||
tx := GenTx([]sdk.Msg{withdrawAddress}, []uint64{senderAcc.GetAccountNumber()}, []uint64{senderAcc.GetSequence()}, senderPrivKey) | ||
CheckDeliverSpecificErrorTx(t, app, tx, errors.ErrUnknownRequest) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters