Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3a3747d
wip: switch to broadcastMode sync
tbruyelle Sep 13, 2022
a472cc3
refac(cosmosclient): remove timeout param from Wait* funcs
tbruyelle Sep 20, 2022
7016bbb
feat: cosmosclient.WaitForTx func
tbruyelle Sep 20, 2022
ff3ab61
test: add integration test for network publish
tbruyelle Sep 21, 2022
5ca8337
chore: make BroadcastTx works with BroadcastTxSync
tbruyelle Sep 21, 2022
d70db41
test: clean go/bin/appBinary after serve
tbruyelle Sep 21, 2022
da02140
fix test and remove --broadcastmode flag
tbruyelle Sep 21, 2022
a08cdbb
when you realize you were requesting the wrong chain...
tbruyelle Sep 21, 2022
fef0571
refac: stop calling faucet on BroadcastTx
tbruyelle Sep 21, 2022
d3a95f3
add CL
tbruyelle Sep 21, 2022
fda9687
test: try with http url
tbruyelle Sep 22, 2022
85cab91
revert changing broadcast mode in chain test
tbruyelle Sep 22, 2022
aada4ec
Merge branch 'develop' into chore/switch-broadcastmode-sync
Sep 23, 2022
ab8bf1c
Merge branch 'develop' into chore/switch-broadcastmode-sync
tbruyelle Sep 23, 2022
d535894
Merge branch 'develop' into chore/switch-broadcastmode-sync
tbruyelle Sep 26, 2022
9db4ea3
Merge branch 'develop' into chore/switch-broadcastmode-sync
tbruyelle Sep 26, 2022
c63eac3
test: ensure the correct spn version is used
tbruyelle Sep 26, 2022
92bfebb
test: use env.Ctx() in waitForNextBlock
tbruyelle Sep 27, 2022
bc9a78a
Merge branch 'develop' into chore/switch-broadcastmode-sync
tbruyelle Sep 27, 2022
8a5468b
fix CL
tbruyelle Sep 27, 2022
43c0598
Merge branch 'develop' into chore/switch-broadcastmode-sync
Sep 27, 2022
2302734
Update changelog.md
tbruyelle Sep 27, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Changes

- Switch to broadcast mode sync in `cosmosclient`
- Updated `nodetime`: `ts-proto` to `v1.123.0`, `protobufjs` to `v7.1.1`, `swagger-typescript-api` to `v9.2.0`
- Switched codegen client to use `axios` instead of `fetch`
- nodetime built with `vercel/pkg@5.6.0`
Expand Down
20 changes: 11 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
github.com/emicklei/proto v1.9.0
github.com/fatih/color v1.13.0
github.com/ghodss/yaml v1.0.0
github.com/go-git/go-git/v5 v5.1.0
github.com/go-git/go-git/v5 v5.4.2
github.com/gobuffalo/genny v0.6.0
github.com/gobuffalo/logger v1.0.6
github.com/gobuffalo/packd v1.0.1
Expand Down Expand Up @@ -79,10 +79,12 @@ require (
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect
github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Microsoft/go-winio v0.5.2 // indirect
github.com/Microsoft/go-winio v0.6.0 // indirect
github.com/Microsoft/hcsshim v0.9.3 // indirect
github.com/OpenPeeDeeP/depguard v1.1.0 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect
github.com/Workiva/go-datastructures v1.0.53 // indirect
github.com/acomagu/bufpipe v1.0.3 // indirect
github.com/alecthomas/chroma v0.8.2 // indirect
github.com/alexkohler/prealloc v1.0.0 // indirect
github.com/alingse/asasalint v0.0.11 // indirect
Expand Down Expand Up @@ -141,7 +143,7 @@ require (
github.com/docker/go-units v0.4.0 // indirect
github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac // indirect
github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/esimonov/ifshort v1.0.4 // indirect
github.com/ettle/strcase v0.1.1 // indirect
github.com/fatih/structs v1.1.0 // indirect
Expand All @@ -152,7 +154,7 @@ require (
github.com/fzipp/gocyclo v0.6.0 // indirect
github.com/go-critic/go-critic v0.6.4 // indirect
github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-git/go-billy/v5 v5.0.0 // indirect
github.com/go-git/go-billy/v5 v5.3.1 // indirect
github.com/go-kit/kit v0.12.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
Expand Down Expand Up @@ -228,7 +230,7 @@ require (
github.com/jpillora/sizestr v1.0.0 // indirect
github.com/julz/importas v0.1.0 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/kisielk/errcheck v1.6.2 // indirect
github.com/kisielk/gotool v1.0.0 // indirect
github.com/klauspost/compress v1.15.9 // indirect
Expand Down Expand Up @@ -338,7 +340,7 @@ require (
github.com/ultraware/funlen v0.0.3 // indirect
github.com/ultraware/whitespace v0.0.5 // indirect
github.com/uudashr/gocognit v1.0.6 // indirect
github.com/xanzy/ssh-agent v0.2.1 // indirect
github.com/xanzy/ssh-agent v0.3.2 // indirect
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
github.com/yagipy/maintidx v1.0.0 // indirect
github.com/yeya24/promlinter v0.2.0 // indirect
Expand All @@ -350,11 +352,11 @@ require (
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.21.0 // indirect
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect
golang.org/x/crypto v0.0.0-20220924013350-4ba4fb4dd9e7 // indirect
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/exp/typeparams v0.0.0-20220613132600-b0d781184e0d // indirect
golang.org/x/net v0.0.0-20220726230323-06994584191e // indirect
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect
golang.org/x/net v0.0.0-20220923203811-8be639271d50 // indirect
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect
golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect
google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc // indirect
gopkg.in/ini.v1 v1.66.6 // indirect
Expand Down
62 changes: 35 additions & 27 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ignite/cmd/network_campaign_publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func networkCampaignPublishHandler(cmd *cobra.Command, args []string) error {
}

metadata, _ := cmd.Flags().GetString(flagMetadata)
campaignID, err := n.CreateCampaign(args[0], metadata, totalSupply)
campaignID, err := n.CreateCampaign(cmd.Context(), args[0], metadata, totalSupply)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion ignite/cmd/network_campaign_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func networkCampaignUpdateHandler(cmd *cobra.Command, args []string) error {
proposals = append(proposals, network.WithCampaignTotalSupply(totalSupply))
}

if err = n.UpdateCampaign(campaignID, proposals...); err != nil {
if err = n.UpdateCampaign(cmd.Context(), campaignID, proposals...); err != nil {
return err
}

Expand Down
4 changes: 2 additions & 2 deletions ignite/cmd/network_chain_publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,13 @@ func networkChainPublishHandler(cmd *cobra.Command, args []string) error {
}

if !rewardCoins.IsZero() && rewardDuration > 0 {
if err := n.SetReward(launchID, rewardDuration, rewardCoins); err != nil {
if err := n.SetReward(cmd.Context(), launchID, rewardDuration, rewardCoins); err != nil {
return err
}
}

if !amountCoins.IsZero() {
if err := n.SendAccountRequestForCoordinator(launchID, amountCoins); err != nil {
if err := n.SendAccountRequestForCoordinator(cmd.Context(), launchID, amountCoins); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion ignite/cmd/network_chain_revert_launch.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ func networkChainRevertLaunchHandler(cmd *cobra.Command, args []string) error {
return err
}

return n.RevertLaunch(launchID, c)
return n.RevertLaunch(cmd.Context(), launchID, c)
}
2 changes: 1 addition & 1 deletion ignite/cmd/network_request_approve.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func networkRequestApproveHandler(cmd *cobra.Command, args []string) error {
for _, id := range ids {
reviewals = append(reviewals, network.ApproveRequest(id))
}
if err := n.SubmitRequest(launchID, reviewals...); err != nil {
if err := n.SubmitRequest(cmd.Context(), launchID, reviewals...); err != nil {
return err
}

Expand Down
2 changes: 1 addition & 1 deletion ignite/cmd/network_request_reject.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func networkRequestRejectHandler(cmd *cobra.Command, args []string) error {
for _, id := range ids {
reviewals = append(reviewals, network.RejectRequest(id))
}
if err := n.SubmitRequest(launchID, reviewals...); err != nil {
if err := n.SubmitRequest(cmd.Context(), launchID, reviewals...); err != nil {
return err
}

Expand Down
2 changes: 1 addition & 1 deletion ignite/cmd/network_reward_release.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ func createClient(

spnRelayer, err := n.RewardIBCInfo(cmd.Context(), launchID)
if errors.Is(err, network.ErrObjectNotFound) {
spnRelayer.ClientID, err = n.CreateClient(launchID, unboundingTime, rewardsInfo)
spnRelayer.ClientID, err = n.CreateClient(cmd.Context(), launchID, unboundingTime, rewardsInfo)
}
if err != nil {
return networktypes.RewardIBCInfo{}, networktypes.RewardIBCInfo{}, err
Expand Down
2 changes: 1 addition & 1 deletion ignite/cmd/network_reward_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ func networkChainRewardSetHandler(cmd *cobra.Command, args []string) error {
return err
}

return n.SetReward(launchID, lastRewardHeight, coins)
return n.SetReward(cmd.Context(), launchID, lastRewardHeight, coins)
}
2 changes: 0 additions & 2 deletions ignite/cmd/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ func newNodeCosmosClient(cmd *cobra.Command) (cosmosclient.Client, error) {
gas = getGas(cmd)
gasPrices = getGasPrices(cmd)
fees = getFees(cmd)
broadcastMode = getBroadcastMode(cmd)
generateOnly = getGenerateOnly(cmd)
)
if keyringBackend == "" {
Expand All @@ -53,7 +52,6 @@ func newNodeCosmosClient(cmd *cobra.Command) (cosmosclient.Client, error) {
cosmosclient.WithKeyringBackend(keyringBackend),
cosmosclient.WithKeyringDir(keyringDir),
cosmosclient.WithNodeAddress(xurl.HTTPEnsurePort(node)),
cosmosclient.WithBroadcastMode(broadcastMode),
cosmosclient.WithGenerateOnly(generateOnly),
}

Expand Down
16 changes: 4 additions & 12 deletions ignite/cmd/node_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@ package ignitecmd
import (
"fmt"

"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"
flag "github.com/spf13/pflag"
)

const (
flagGenerateOnly = "generate-only"

gasFlagAuto = "auto"
flagGasPrices = "gas-prices"
flagGas = "gas"
flagFees = "fees"
flagBroadcastMode = "broadcast-mode"
gasFlagAuto = "auto"
flagGasPrices = "gas-prices"
flagGas = "gas"
flagFees = "fees"
)

func NewNodeTx() *cobra.Command {
Expand All @@ -30,7 +28,6 @@ func NewNodeTx() *cobra.Command {
c.PersistentFlags().AddFlagSet(flagSetGenerateOnly())
c.PersistentFlags().AddFlagSet(flagSetGasFlags())
c.PersistentFlags().String(flagFees, "", "Fees to pay along with transaction; eg: 10uatom")
c.PersistentFlags().String(flagBroadcastMode, flags.BroadcastBlock, "Transaction broadcasting mode (sync|async|block), use sync if you encounter timeouts")

c.AddCommand(NewNodeTxBank())

Expand Down Expand Up @@ -69,8 +66,3 @@ func getFees(cmd *cobra.Command) string {
fees, _ := cmd.Flags().GetString(flagFees)
return fees
}

func getBroadcastMode(cmd *cobra.Command) string {
broadcastMode, _ := cmd.Flags().GetString(flagBroadcastMode)
return broadcastMode
}
10 changes: 2 additions & 8 deletions ignite/cmd/node_tx_bank_send.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package ignitecmd

import (
"github.com/cosmos/cosmos-sdk/client/flags"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/spf13/cobra"

Expand Down Expand Up @@ -49,7 +48,7 @@ func nodeTxBankSendHandler(cmd *cobra.Command, args []string) error {
return err
}

tx, err := client.BankSendTx(fromAccount, toAddress, coins)
tx, err := client.BankSendTx(cmd.Context(), fromAccount, toAddress, coins)
if err != nil {
return err
}
Expand All @@ -67,18 +66,13 @@ func nodeTxBankSendHandler(cmd *cobra.Command, args []string) error {
}

session.StartSpinner("Sending transaction...")
resp, err := tx.Broadcast()
resp, err := tx.Broadcast(cmd.Context())
if err != nil {
return err
}

session.StopSpinner()
session.Printf("Transaction broadcast successful! (hash = %s)\n", resp.TxHash)
session.Printf("%s sent from %s to %s\n", amount, fromAccountInput, toAccountInput)
if getBroadcastMode(cmd) != flags.BroadcastBlock {
session.Println("Transaction waiting to be included in a block.")
session.Println("Run the following command to follow the transaction status:")
session.Printf(" ignite node --node %s q tx %s\n", getNode(cmd), resp.TxHash)
}
return nil
}
4 changes: 2 additions & 2 deletions ignite/pkg/cosmosclient/bank.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (c Client) BankBalances(ctx context.Context, address string, pagination *qu
return resp.Balances, nil
}

func (c Client) BankSendTx(fromAccount cosmosaccount.Account, toAddress string, amount sdk.Coins) (TxService, error) {
func (c Client) BankSendTx(ctx context.Context, fromAccount cosmosaccount.Account, toAddress string, amount sdk.Coins) (TxService, error) {
addr, err := fromAccount.Address(c.addressPrefix)
if err != nil {
return TxService{}, err
Expand All @@ -37,5 +37,5 @@ func (c Client) BankSendTx(fromAccount cosmosaccount.Account, toAddress string,
Amount: amount,
}

return c.CreateTx(fromAccount, msg)
return c.CreateTx(ctx, fromAccount, msg)
}
Loading