celestiaorg / celestia-app

Celestia consensus node
https://celestiaorg.github.io/celestia-app/
Apache License 2.0
346 stars 293 forks source link

feegrant UX: remove the headache for pre-funds #3221

Open Bidon15 opened 8 months ago

Bidon15 commented 8 months ago

Summary

You need the account to be pre-funded in order to use fee grant module

Problem Definition

celestia-appd tx feegrant grant celestia1sung806mz9r4lwdpaw6usk7hcw42ku7kyun44w celestia1rgj3z5rfydj3xulhm6glqr0zs7j8rr9rfh6ekw --home ~/.celestia-app-devops/ --node [https://rpc.celestia-mocha.com:443](https://rpc.celestia-mocha.com/) --spend-limit 1000000utia --allowed-messages "/cosmos.bank.v1beta1.MsgSend,/celestia.blob.v1.MsgPayForBlobs" --chain-id mocha-4 --keyring-backend test --fees 20000utia --broadcast-mode block --yes

This is a successful tx - https://mocha.celenium.io/tx/802a17777fbeab416f6fa2c25f0c56dd9cc8a92afc2a96293d114ac7c22efb5c

From a user pov - why do you need to prefund this account after the fee that has been granted for blob msgs? celestia1rgj3z5rfydj3xulhm6glqr0zs7j8rr9rfh6ekw

Should the state be updated already if the grant tx is successful? I've tried this hypothesis without prefunding step and failed with insufficient balance error

Proposal

Ideally have the following UX:

  1. user creates a new account -> has 0 tia
  2. 3rd party grants blob submissions to this account
  3. blob submission is working as expected with no prefunding required

For Admin Use

evan-forbes commented 8 months ago

we do have to have a mechanism to pay for the state created in the new account, so we can't create accounts with zero funds, however there likely is a way to automate the creation of an account. One simple way would be add a 1utia bank.MsgSend as the first sdk.Msg of this tx, which would create the account.

Bidon15 commented 7 months ago

we do have to have a mechanism to pay for the state created in the new account, so we can't create accounts with zero funds, however there likely is a way to automate the creation of an account. One simple way would be add a 1utia bank.MsgSend as the first sdk.Msg of this tx, which would create the account.

Ngl, any interim solution is fine as we need this UX feature to be done. Otherwise feegrant is not going to be adopted by RaaS teams due to itching nerves experience

cmwaters commented 7 months ago

What I thought happened was if you grant something to an account that doesn't exist you would create that account such that the account could sign a transaction and part of the fee would go towards setting the pubkey (and executing the rest of the transaction)

cmwaters commented 7 months ago

If you look here we should be creating the account: https://github.com/cosmos/cosmos-sdk/blob/7799bba7bc889288607576aa11655b5fc31a2da9/x/feegrant/keeper/keeper.go#L43-L48

Bidon15 commented 7 months ago

If you look here we should be creating the account: https://github.com/cosmos/cosmos-sdk/blob/7799bba7bc889288607576aa11655b5fc31a2da9/x/feegrant/keeper/keeper.go#L43-L48

you mean by creating the account - it should be created by default once we have the feegrant tx included? bc in Rootul's gist, we are creating the account and funding it before doing the granting tx

https://gist.github.com/rootulp/c47606e177aad1f8959ea31fa077ca5e

evan-forbes commented 6 months ago

To complete this, I think we should write a quick script to sanity test that this is does occur after creating a grant for an account. If it doesn't, then that appears to be a bug in the x/feegrant module. At that point, we can write a simple function that generates a bank.MsgSend of 1utia to the account and appends it to the sdk.Msgs in the feegrant tx, or fix the bug in v3 in a state breaking way.