-
Notifications
You must be signed in to change notification settings - Fork 84
/
nested_msgs.go
95 lines (74 loc) · 3.6 KB
/
nested_msgs.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package msgs
import (
sdk "github.com/cosmos/cosmos-sdk/types"
gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
upgrade "github.com/cosmos/cosmos-sdk/x/upgrade/types"
"github.com/dydxprotocol/v4-chain/protocol/testutil/constants"
"github.com/dydxprotocol/v4-chain/protocol/testutil/encoding"
prices "github.com/dydxprotocol/v4-chain/protocol/x/prices/types"
)
func init() {
testEncodingCfg := encoding.GetTestEncodingCfg()
testTxBuilder := testEncodingCfg.TxConfig.NewTxBuilder()
_ = testTxBuilder.SetMsgs(MsgSoftwareUpgrade)
MsgSoftwareUpgradeTxBytes, _ = testEncodingCfg.TxConfig.TxEncoder()(testTxBuilder.GetTx())
_ = testTxBuilder.SetMsgs(MsgCancelUpgrade)
MsgCancelUpgradeTxBytes, _ = testEncodingCfg.TxConfig.TxEncoder()(testTxBuilder.GetTx())
_ = testTxBuilder.SetMsgs(MsgSubmitProposalWithEmptyInner)
MsgSubmitProposalWithEmptyInnerTxBytes, _ = testEncodingCfg.TxConfig.TxEncoder()(testTxBuilder.GetTx())
_ = testTxBuilder.SetMsgs(MsgSubmitProposalWithUnsupportedInner)
MsgSubmitProposalWithUnsupportedInnerTxBytes, _ = testEncodingCfg.TxConfig.TxEncoder()(testTxBuilder.GetTx())
_ = testTxBuilder.SetMsgs(MsgSubmitProposalWithAppInjectedInner)
MsgSubmitProposalWithAppInjectedInnerTxBytes, _ = testEncodingCfg.TxConfig.TxEncoder()(testTxBuilder.GetTx())
_ = testTxBuilder.SetMsgs(MsgSubmitProposalWithDoubleNestedInner)
MsgSubmitProposalWithDoubleNestedInnerTxBytes, _ = testEncodingCfg.TxConfig.TxEncoder()(testTxBuilder.GetTx())
_ = testTxBuilder.SetMsgs(MsgSubmitProposalWithUpgrade)
MsgSubmitProposalWithUpgradeTxBytes, _ = testEncodingCfg.TxConfig.TxEncoder()(testTxBuilder.GetTx())
_ = testTxBuilder.SetMsgs(MsgSubmitProposalWithUpgradeAndCancel)
MsgSubmitProposalWithUpgradeAndCancelTxBytes, _ = testEncodingCfg.TxConfig.TxEncoder()(testTxBuilder.GetTx())
}
const (
testMetadata = "test-metadata"
testTitle = "test-title"
testSummary = "test-summary"
)
var (
testProposer = constants.Bob_Num0.Owner
// Inner msgs.
MsgSoftwareUpgrade = &upgrade.MsgSoftwareUpgrade{
Authority: constants.Bob_Num0.Owner,
Plan: upgrade.Plan{
Name: "test-plan",
Height: 10,
Info: "test-info",
},
}
MsgSoftwareUpgradeTxBytes []byte
MsgCancelUpgrade = &upgrade.MsgCancelUpgrade{
Authority: constants.Bob_Num0.Owner,
}
MsgCancelUpgradeTxBytes []byte
// Invalid MsgSubmitProposals
MsgSubmitProposalWithEmptyInner, _ = gov.NewMsgSubmitProposal(
[]sdk.Msg{}, nil, testProposer, testMetadata, testTitle, testSummary)
MsgSubmitProposalWithEmptyInnerTxBytes []byte
MsgSubmitProposalWithUnsupportedInner, _ = gov.NewMsgSubmitProposal(
[]sdk.Msg{GovBetaMsgSubmitProposal}, nil, testProposer, testMetadata, testTitle, testSummary)
MsgSubmitProposalWithUnsupportedInnerTxBytes []byte
MsgSubmitProposalWithAppInjectedInner, _ = gov.NewMsgSubmitProposal(
[]sdk.Msg{&prices.MsgUpdateMarketPrices{}}, nil, testProposer, testMetadata, testTitle, testSummary)
MsgSubmitProposalWithAppInjectedInnerTxBytes []byte
MsgSubmitProposalWithDoubleNestedInner, _ = gov.NewMsgSubmitProposal(
[]sdk.Msg{MsgSubmitProposalWithUpgradeAndCancel}, nil, testProposer, testMetadata, testTitle, testSummary)
MsgSubmitProposalWithDoubleNestedInnerTxBytes []byte
// Valid MsgSubmitProposals
MsgSubmitProposalWithUpgrade, _ = gov.NewMsgSubmitProposal(
[]sdk.Msg{MsgSoftwareUpgrade}, nil, testProposer, testMetadata, testTitle, testSummary)
MsgSubmitProposalWithUpgradeTxBytes []byte
MsgSubmitProposalWithUpgradeAndCancel, _ = gov.NewMsgSubmitProposal(
[]sdk.Msg{
MsgSoftwareUpgrade,
MsgCancelUpgrade,
}, nil, testProposer, testMetadata, testTitle, testSummary)
MsgSubmitProposalWithUpgradeAndCancelTxBytes []byte
)