Skip to content

Conversation

@tbruyelle
Copy link
Contributor

@tbruyelle tbruyelle commented Sep 21, 2022

Fix #2721

The main work of this PR was to ensure that cosmosclient.BroadcastTx continues to work as expected, meaning it continues to return the response tx once the tx is confirmed.

With the previous setting BroadcastModeBlock it was easy, but with BroadcastModeSync, you have to wait for the tx to be confirmed, and then reads it data. This is done thanks to a new method WaitForTx which relies on WaitForNextBlock that was previously added.

I also started some integration tests on the network commands, because they are the main consumers of cosmosclient.BroadcastTx.

The flag --broadcast-mode has been removed from the node command, because it has been added to prevent timeouts when BroadcastModeBlock was used. Since this mode is no longer used, I think it's no longer required to expose such setting.

TODO: update BroadcastTx calls so they can actually get the response of
the transaction.
Consumer can pass a ctx with a timeout to get the exact same behavior
with a better level of customization.
This func will be handy once we'll switch to BroadcastMode Sync.
The test works in BroadcastModeBlock, but not any more in
BroadcastTxSync, it will serve as a proof that the transition is OK.
This is already done in `CreateTx` so if it's no longer done in
BroadcastTx, this should have very limited impacts.

The good part is that removes complexity.
@tbruyelle tbruyelle changed the title chore: switch to broadcast mode sync chore(cosmosclient): switch to BroadcastModeSync Sep 21, 2022
aljo242
aljo242 previously approved these changes Sep 23, 2022
jeronimoalbi
jeronimoalbi previously approved these changes Sep 27, 2022
jeronimoalbi
jeronimoalbi previously approved these changes Sep 27, 2022
@aljo242
Copy link
Contributor

aljo242 commented Sep 27, 2022

LGTM !

Co-authored-by: Alex Johnson <alex@shmeeload.xyz>
@aljo242 aljo242 merged commit 048b4e9 into develop Sep 27, 2022
@aljo242 aljo242 deleted the chore/switch-broadcastmode-sync branch September 27, 2022 18:02
Jchicode pushed a commit to Jchicode/cli that referenced this pull request Aug 9, 2023
* wip: switch to broadcastMode sync

TODO: update BroadcastTx calls so they can actually get the response of
the transaction.

* refac(cosmosclient): remove timeout param from Wait* funcs

Consumer can pass a ctx with a timeout to get the exact same behavior
with a better level of customization.

* feat: cosmosclient.WaitForTx func

This func will be handy once we'll switch to BroadcastMode Sync.

* test: add integration test for network publish

The test works in BroadcastModeBlock, but not any more in
BroadcastTxSync, it will serve as a proof that the transition is OK.

* chore: make BroadcastTx works with BroadcastTxSync

* test: clean go/bin/appBinary after serve

* fix test and remove --broadcastmode flag

* when you realize you were requesting the wrong chain...

* refac: stop calling faucet on BroadcastTx

This is already done in `CreateTx` so if it's no longer done in
BroadcastTx, this should have very limited impacts.

The good part is that removes complexity.

* add CL

* test: try with http url

* revert changing broadcast mode in chain test

* test: ensure the correct spn version is used

* test: use env.Ctx() in waitForNextBlock

* fix CL

* Update changelog.md

Co-authored-by: Alex Johnson <alex@shmeeload.xyz>

Co-authored-by: Alex Johnson <alex@shmeeload.xyz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: deprecate BroadcastModeBlock

4 participants