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 cron contract #3

Closed
ethanfrey opened this issue Mar 8, 2021 · 5 comments
Closed

Add cron contract #3

ethanfrey opened this issue Mar 8, 2021 · 5 comments
Labels
question Further information is requested

Comments

@ethanfrey
Copy link
Contributor

ethanfrey commented Mar 8, 2021

This is inspired by https://github.com/confio/priv_wasmd/pull/3 but using the new APIs, especially SubMsg.

The cron job will register as a BeginBlock Handler. One blocks with registered jobs, it will execute them (with a gas-limited sandbox) and store the result (ok or error) for future queries. Jobs that error will not automatically be re-run.

When registering a job, a user must pay upfront for the gas that will be used in the native fee token. This is converted to a gas allowance using the consensus minimum gas at the point of registration.

Requires confio/tgrade#7 for min gas

Update: more and more of our contracts want to do some delayed action. We should get a basic version of this working (with a whitelist of contracts that can set these jobs), so we don't keep adding the same logic everywhere.

We can add the more complex public gas-charging one later. See #113 and #136

@ethanfrey ethanfrey added this to the Tgrade Contracts 0.3 milestone Mar 8, 2021
@ethanfrey ethanfrey modified the milestones: Contracts 0.3, v0.4.0 Aug 26, 2021
@ethanfrey ethanfrey modified the milestones: v0.4.0, v0.5.0 Sep 12, 2021
@alpe
Copy link
Contributor

alpe commented Sep 20, 2021

I assume we want the cron contract on start up. An accept list for the contracts adds some complexity into the bootstrapping. If we want a "light" version for our contracts then we could decouple this with a new privilege so that we can use the sudo callback here for registration and also receiving triggers. I would expect this to become a Go module for better UX.

A public available version would be more complex with tokenomics and CLI support. The contract registry may be handy here as well

The original spike was using begin_block. I think an end_block may be more effective if we want to act on the new data.

@ethanfrey ethanfrey removed this from the v0.5.0 milestone Sep 20, 2021
@ethanfrey
Copy link
Contributor Author

After reading this, I realise it is easier for privileged contracts to just implement end_block handlers and not try to centralise this. A cron job makes much more sense for permission less contracts who must pay gas and have some limits.

I will remove this from 0.5 milestone and deal with it later as a "value added" contract

@ueco-jb
Copy link

ueco-jb commented Dec 6, 2021

@ethanfrey is this one still valid? From your previous response it seems like not.

@ethanfrey
Copy link
Contributor Author

It is still a valid wish.
It is more a design question about letting people pre-pay for gas.

But I think it will be a very useful feature.
Not ready to implement without some more prep work though

@ueco-jb ueco-jb added the question Further information is requested label Dec 7, 2021
@ethanfrey
Copy link
Contributor Author

Great idea, but for another repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants