cosmjs icon indicating copy to clipboard operation
cosmjs copied to clipboard

Add redelegateTokens to singingstargateclient.ts

Open msteiner96 opened this issue 4 years ago • 7 comments

msteiner96 avatar Nov 07 '21 17:11 msteiner96

Nice, thanks. Do you need this released as 0.26.x any time soon?

webmaster128 avatar Nov 09 '21 16:11 webmaster128

Not necessarily. While building my tool I just realized it was missing and added it :)

msteiner96 avatar Nov 10 '21 09:11 msteiner96

Could you add a test for that? I would not require it for merge because we don't have tests for the other staking methods as well and writing a new test is not easy if there is no framework/examples. But it would be great to increase coverage.

webmaster128 avatar Nov 10 '21 09:11 webmaster128

Sure thing! Just checked that other tests are missing too so I skipped that :D Gimme some time, gonna add that

msteiner96 avatar Nov 10 '21 10:11 msteiner96

For inspiration: the query tests for staking and distribution might help for checking if the operation was successful:

  • https://github.com/cosmos/cosmjs/blob/main/packages/stargate/src/queries/staking.spec.ts
  • https://github.com/cosmos/cosmjs/blob/main/packages/stargate/src/queries/distribution.spec.ts

webmaster128 avatar Nov 10 '21 10:11 webmaster128

@webmaster128 To write a test for redelegation, I need 2 validators to test. But in packages/stargate/src/testutils.spec.ts there's only one defined. Do you want me to extend that?

msteiner96 avatar Nov 11 '21 13:11 msteiner96

Oh, good point. The problem is the validator does not only need to be added in the test file. Instead it need to exists in the test network which is running as a backend for the tests. The validator is created here: https://github.com/cosmos/cosmjs/blob/v0.26.4/scripts/simapp42/template/.simapp/config/genesis.json#L533-L558.

We can probably not run the network with multiple validators without massive overhead in the docker setups. But maybe we can register a second inactive validator?

webmaster128 avatar Nov 11 '21 18:11 webmaster128

We give up the idea of those wrapper function in general. We can never keep up with all the possible messages this way.

webmaster128 avatar Nov 22 '23 08:11 webmaster128