-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Bank OCapKeeper #12404
Comments
OCap isn't a way to address this IMO. I'm not really sure what you're trying to achieve here TBH. |
as an author of
and the bank keeper won't stop me from doing that. What I want is that user will have to define Allowance and pair it with the transaction / message to inject into the bankKeeper methods. |
Added a note about the middlewares, and injecting that ocap required objects into the wrappers:
One idea is that we can have a special messages: OcapMessages, which are not part of the transaction flow, but support messages which are going to handled by middlewares and injected into the "dynamic" dependencies (so here, bank Keeper is a dynamic dependency, instantiated whenever we process a message) |
So you basically want a wrapper around a keeper? Sounds similar to what @fdymylja proposed with admission handlers, no? We can set something up like that with depinject, either using module-scoped providers or interface bindings. |
@aaronc , it's a bit different. @fdymylja design is based on controllers (pre / post admission controllers) which work as pre /post ante handlers. They don't have a knowledge how one module will call another module. The idea I'm proposing here will have the following flow:
So on every RPC call, module M will get updated dependencies. That's one idea how this can be implemented. Maybe we can find other ways how this should work. The goal is that module |
IMO I think this is complete overkill. |
I think we need a standard for admissions between the modules. |
closing in favour of #17579 |
Summary
Problem Definition
Today, user doesn't have a way to allow spending limit to message handlers which will use x/bank keeper.
For example, today a keeper can depend on x/bank keeper and use user funds.
One way to work around this is to add additional parameter to the message, eg
MaxFee: Coin
. This way user can specify the maximum amount he is willing to pay when the message is processed.However, the x/bank doesn't have any way to protect miss using the spend limits or allowance.
Proposal
DRAFT
OcapKeeper
x/bank/internal/keeper
packagex/bank will can define OCap structure, which has to be pass to every x/bank execution. For example, in x/bank proto we can define:
Then we need to create a x/bank external keeper, which takes the
Allowance
parameter to every external method which mutates the state, eg:Then module, who want's do depend on bank keeper, will get standard interface, and the transaction middleware can inject the Allowance objects.
This can be generalized to every module.
Open problems:
Related to
For Admin Use
The text was updated successfully, but these errors were encountered: