feat!: native core SDK command support#892
Conversation
| @@ -0,0 +1,204 @@ | |||
| package cosmos | |||
There was a problem hiding this comment.
This file is unchanged, just moved from chain_node.go
| propId, err := strconv.ParseUint(proposalTx.ProposalID, 10, 64) | ||
| require.NoError(t, err, "failed to convert proposal ID to uint64") | ||
|
|
||
| _, err = cosmos.PollForProposalStatus(ctx, simdChain, height, height+heightDelta, propId, govv1beta1.StatusPassed) |
There was a problem hiding this comment.
minor formatting fix (use govv1beta1 type)
|
|
||
| // IBC-Go <= v7 / SDK <= v0.47 | ||
| ProposalStatusUnspecified = "PROPOSAL_STATUS_UNSPECIFIED" | ||
| ProposalStatusPassed = "PROPOSAL_STATUS_PASSED" | ||
| ProposalStatusFailed = "PROPOSAL_STATUS_FAILED" | ||
| ProposalStatusRejected = "PROPOSAL_STATUS_REJECTED" | ||
| ProposalStatusVotingPeriod = "PROPOSAL_STATUS_VOTING_PERIOD" | ||
| ProposalStatusDepositPeriod = "PROPOSAL_STATUS_DEPOSIT_PERIOD" | ||
|
|
||
| // IBC-Go v8 / SDK v50 | ||
| ProposalStatusUnspecifiedV8 = 0 | ||
| ProposalStatusDepositPeriodV8 = 1 | ||
| ProposalStatusVotingPeriodV8 = 2 | ||
| ProposalStatusPassedV8 = 3 | ||
| ProposalStatusRejectedV8 = 4 | ||
| ProposalStatusFailedV8 = 5 |
There was a problem hiding this comment.
Since we use the govv1beta1 or govv1 types now, these are not needed.
| // Depending on the chain parameters, this may require a lot of gas (Juno, Osmosis) if the DenomCreationGasConsume param is enabled. | ||
| // If not, the default implementation cost 10,000,000 micro tokens (utoken) of the chain's native token. | ||
| func TokenFactoryCreateDenom(c *CosmosChain, ctx context.Context, user ibc.Wallet, denomName string, gas uint64) (string, string, error) { | ||
| func (tn *ChainNode) TokenFactoryCreateDenom(ctx context.Context, user ibc.Wallet, denomName string, gas uint64) (string, string, error) { |
There was a problem hiding this comment.
Moves all to tn *ChainNode since we need to run Txs vs being on the first node
| func (c *CosmosChain) getFullNode() *ChainNode { | ||
| c.findTxMu.Lock() | ||
| defer c.findTxMu.Unlock() | ||
| if len(c.FullNodes) > 0 { | ||
| // use first full node | ||
| return c.FullNodes[0] | ||
| } | ||
| // use first validator | ||
| return c.Validators[0] | ||
| return c.GetNode() | ||
| } |
There was a problem hiding this comment.
When a test adds or removes a full node, this then switches which node the user was original acting on. This results in a NPE and causes a lot of confusion (including for myself). This uses GetNode() (validator[0]) now so commands always happen on the same machine as a user expects
| // GetCodec returns the codec for the chain. | ||
| func (c *CosmosChain) GetCodec() *codec.ProtoCodec { | ||
| return c.cdc | ||
| } |
There was a problem hiding this comment.
Required for module_auth.go (converting the any types -> accounts)
| @@ -0,0 +1,210 @@ | |||
| package cosmos | |||
There was a problem hiding this comment.
these functions were moved from chain_node.go. Only GovQuery* functions were added.
You can now specify to query govv1beta1 (< v47) or govv1 (SDK v50)
|
|
||
| // ProtoMessage is implemented by generated protocol buffer messages. | ||
| // Pulled from github.com/cosmos/gogoproto/proto. | ||
| type ProtoMessage interface { |
There was a problem hiding this comment.
used in module_gov to not require SDK import (BuildProposal)
jtieri
left a comment
There was a problem hiding this comment.
this is a beast of a PR!! love the extension to include the core SDK commands as well as the reorganization of existing code.
had a few nits, nothing major at all. other than that this looks good to go 🚢 🚢 🚢
| func (c *CosmosChain) getFullNode() *ChainNode { | ||
| c.findTxMu.Lock() | ||
| defer c.findTxMu.Unlock() | ||
| if len(c.FullNodes) > 0 { | ||
| // use first full node | ||
| return c.FullNodes[0] | ||
| } | ||
| // use first validator | ||
| return c.Validators[0] | ||
| return c.GetNode() | ||
| } |
closes #885
ref: #256 may be a good time to start this after this PR merges
Builds all core transaction & query components from SDK v50
To backport to branch
v7for SDK v47, we have to redo some commands. I will manually backport in another PRTODO