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

WIP: tx generate only #3287

Closed
wants to merge 14 commits into from
1 change: 1 addition & 0 deletions PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ FEATURES
* [\#3069](https://github.com/cosmos/cosmos-sdk/pull/3069) Add a custom memo on transactions
* [\#3027](https://github.com/cosmos/cosmos-sdk/issues/3027) Implement
`/gov/proposals/{proposalID}/proposer` to query for a proposal's proposer.
* [\#3284](https://github.com/cosmos/cosmos-sdk/issues/3284) Implement generation of txs without account.

* Gaia CLI (`gaiacli`)
* \#2399 Implement `params` command to query slashing parameters.
Expand Down
35 changes: 30 additions & 5 deletions client/lcd/lcd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func TestCoinSendGenerateSignAndBroadcast(t *testing.T) {
payload := authrest.SignBody{
Tx: msg,
BaseReq: utils.NewBaseReq(
name1, pw, "", viper.GetString(client.FlagChainID), "", "", accnum, sequence, nil, false, false,
name1, pw, "", "", viper.GetString(client.FlagChainID), "", "", accnum, sequence, nil, false, false,
),
}
json, err := cdc.MarshalJSON(payload)
Expand Down Expand Up @@ -399,8 +399,17 @@ func TestBonding(t *testing.T) {
acc := getAccount(t, port, addr)
initialBalance := acc.GetCoins()

var resultTx ctypes.ResultBroadcastTxCommit
var tx auth.StdTx
// generate bond TX
body := doDelegate(t, port, name1, pw, addr, operAddrs[0], 60, fees, true)
err := cdc.UnmarshalJSON([]byte(body), &tx)
require.Nil(t, err)

// create bond TX
resultTx := doDelegate(t, port, name1, pw, addr, operAddrs[0], 60, fees)
body = doDelegate(t, port, name1, pw, addr, operAddrs[0], 60, fees, false)
err = cdc.UnmarshalJSON([]byte(body), &resultTx)
require.Nil(t, err)
tests.WaitForHeight(resultTx.Height+1, port)

require.Equal(t, uint32(0), resultTx.CheckTx.Code)
Expand Down Expand Up @@ -441,8 +450,15 @@ func TestBonding(t *testing.T) {
bondedValidator := getDelegatorValidator(t, port, addr, operAddrs[0])
require.Equal(t, operAddrs[0], bondedValidator.OperatorAddr)

// generate unbond TX
body = doBeginUnbonding(t, port, name1, pw, addr, operAddrs[0], 60, fees, true)
err = cdc.UnmarshalJSON([]byte(body), &tx)
require.Nil(t, err)

// testing unbonding
resultTx = doBeginUnbonding(t, port, name1, pw, addr, operAddrs[0], 30, fees)
body = doBeginUnbonding(t, port, name1, pw, addr, operAddrs[0], 30, fees, false)
err = cdc.UnmarshalJSON([]byte(body), &resultTx)
require.Nil(t, err)
tests.WaitForHeight(resultTx.Height+1, port)

require.Equal(t, uint32(0), resultTx.CheckTx.Code)
Expand Down Expand Up @@ -470,8 +486,15 @@ func TestBonding(t *testing.T) {
unbonding := getUndelegation(t, port, addr, operAddrs[0])
require.Equal(t, int64(30), unbonding.Balance.Amount.Int64())

// generate redelegation TX
body = doBeginRedelegation(t, port, name1, pw, addr, operAddrs[0], operAddrs[1], 30, fees, true)
err = cdc.UnmarshalJSON([]byte(body), &tx)
require.Nil(t, err)

// test redelegation
resultTx = doBeginRedelegation(t, port, name1, pw, addr, operAddrs[0], operAddrs[1], 30, fees)
body = doBeginRedelegation(t, port, name1, pw, addr, operAddrs[0], operAddrs[1], 30, fees, false)
err = cdc.UnmarshalJSON([]byte(body), &resultTx)
require.Nil(t, err)
tests.WaitForHeight(resultTx.Height+1, port)

require.Equal(t, uint32(0), resultTx.CheckTx.Code)
Expand Down Expand Up @@ -678,7 +701,9 @@ func TestVote(t *testing.T) {
require.Equal(t, sdk.ZeroDec(), tally.Yes, "tally should be 0 as the address is not bonded")

// create bond TX
resultTx = doDelegate(t, port, name1, pw, addr, operAddrs[0], 60, fees)
body := doDelegate(t, port, name1, pw, addr, operAddrs[0], 60, fees, false)
err := cdc.UnmarshalJSON([]byte(body), &resultTx)
require.Nil(t, err)
tests.WaitForHeight(resultTx.Height+1, port)

// verify balance
Expand Down
Loading