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

add authz command set #2530

Closed
gjermundgaraba opened this issue May 23, 2022 · 1 comment
Closed

add authz command set #2530

gjermundgaraba opened this issue May 23, 2022 · 1 comment
Labels
type:feat To implement new feature. type:request Feature request.

Comments

@gjermundgaraba
Copy link
Contributor

Authz is one of those things that creates a whole new set of use cases on Cosmos chains. Validators provide auto-compounding services. You can give your hot wallet permissions to vote with the stake from your cold wallet. The list goes on.

One of pains when using Authz with CLI's in a multi-chain world is that you have to maintain multiple binaries and keyrings (one for each chain).

If the ignite cli could provide a single CLI where you could interact with any authz-enabled cosmos chain (obviously, also including local ones you are developing and testing against) it would be valuable for end-users, validators and anyone wanting to create automation scripts much easier.

The solution is similar to what is outlined for the ignite node bank commands (#2489).

Implement the following commands:

  • ignite node query authz grantee-grants
  • ignite node query authz granter-grants
  • ignite node query authz grants
  • ignite node tx authz exec
  • ignite node tx authz grant
  • ignite node tx authz revoke

All the commands need the --rpc flag.
The query commands also need the pagination flags.
The tx commands also need gas, keyring and --generate-only flags

Take a look at for instance the gaiad query/tx authz command commands to see which other flags we might need. You can also look at the flags implemented for ignite node query bank balances and ignite node tx bank send to see what some of the basic flags are and how they are implemented.

For the grant and revoke commands, notice especially the --msg-type, --spend-limit, --expiration, --allowed-validators and --deny-validators flags

Please note that we need to define their respective top level commands for the above commands.

In the ignite/cmd package we should create a file for each command (some already exist):

cmd/
    node.go 
    node_query.go
    node_query_authz.go
    node_query_authz_grantee_grants.go
    node_query_authz_granter_grants.go
    node_query_authz_grants.go
    node_tx.go
    node_tx_authz.go
    node_tx_authz_exec.go
    node_tx_authz_grant.go
    node_tx_authz_revoke.go

You need to initialize ignite/pkg/cosmosclient inside ignite/cmd and have all the business logic implement there for these new commands.

So we need to implement the functions inside the cosmosclient package. Look at how this is already done for the bank commands.

These commands should be able to be used for any chain.

Sample usages:

  • ignite node q authz granter-grants [cosmos... / or / account-name ] --node https://rpc.cosmos.network:443
  • ignite node tx authz grant [cosmos... / or / account-name ] generic --msg-type --node https://rpc.cosmos.network:443

account-name above and also the value of --from taken from the account names when you use ignite account command set.

These balances and send commands pretty similar to the ones in gaiad but with an exception that we need to make them compatible with all Cosmos-SDK based chains and make it use accounts from ignite account.

Make sure to add an integration test that will:

  • Scaffold a chain with a custom address prefix
  • Grant different types of grants <authorization_type="send"|"generic"|"delegate"|"unbond"|"redelegate">
  • Query the grants
  • Execute a ignite node tx authz exec command with the output from the ignite node tx bank send command (by using --generate-only and putting the output in a file)
  • Revoke grant
  • Try to execute again and see that it fails
@gjermundgaraba gjermundgaraba added the type:request Feature request. label May 23, 2022
@aljo242 aljo242 added the type:feat To implement new feature. label Oct 28, 2022
@julienrbrt
Copy link
Member

Ignite node has been deprecated in favor of ignite connect, which will support this by default.
ref: ignite/apps#102

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feat To implement new feature. type:request Feature request.
Projects
None yet
Development

No branches or pull requests

3 participants