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

feat(node): Pause programs after specific amount of blocks #2507

Merged
merged 47 commits into from
Apr 26, 2023

Conversation

gshep
Copy link
Member

@gshep gshep commented Apr 4, 2023

Resolves #2301 , #2570

  • refactoring: unify mock.rs for pallets; add remove_reservation_slot function; use GasBalanceOf in pallet-gear;
  • implement PausedProgramStorage and the corresponding functionality;
  • test case that pausing programs actually works

Release notes: this PR is the first one in the series of task for charging programs. It introduces pausing programs mechanism: uploaded on-chain programs have free period of rent during which they operate as usual. When the period finishes the program is paused: all its resources (memory pages, messages in wait list, etc) are removed from storage and the corresponding record added to the storage of paused programs for later ability to resume the program.

@gear-tech/dev

@gshep gshep added A1-inprogress Issue is in progress or PR draft is not ready to be reviewed D2-node Gear Node B1-releasenotes The feature deserves to be added to the Release Notes C1-feature Feature request labels Apr 4, 2023
@gshep gshep self-assigned this Apr 4, 2023
gshep added 2 commits April 4, 2023 10:06
Conflicts:
	common/src/event.rs
	pallets/gear-program/src/lib.rs
	pallets/gear/src/benchmarking/syscalls.rs
@gshep gshep requested review from ark0f and breathx April 5, 2023 13:37
@gshep gshep added A0-pleasereview PR is ready to be reviewed by the team and removed A1-inprogress Issue is in progress or PR draft is not ready to be reviewed labels Apr 5, 2023
@gshep gshep marked this pull request as ready for review April 5, 2023 13:39
Copy link
Member

@ark0f ark0f left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems program will be always paused after 1000 blocks. How to unpause it? Or what will unpause it?

gsdk/src/storage.rs Outdated Show resolved Hide resolved
pallets/gear-program/src/lib.rs Outdated Show resolved Hide resolved
common/src/lib.rs Outdated Show resolved Hide resolved
pallets/gear/src/queue.rs Outdated Show resolved Hide resolved
runtime/gear/src/lib.rs Outdated Show resolved Hide resolved
pallets/gear-program/src/migration.rs Show resolved Hide resolved
pallets/gear/src/manager/journal.rs Outdated Show resolved Hide resolved
common/src/program_storage.rs Outdated Show resolved Hide resolved
pallets/gear/src/lib.rs Outdated Show resolved Hide resolved
Conflicts:
	gsdk/src/signer/calls.rs
common/src/event.rs Outdated Show resolved Hide resolved
common/src/lib.rs Outdated Show resolved Hide resolved
common/src/lib.rs Show resolved Hide resolved
common/src/paused_program_storage.rs Outdated Show resolved Hide resolved
common/src/program_storage.rs Outdated Show resolved Hide resolved
runtime/gear/src/lib.rs Show resolved Hide resolved
pallets/gear/src/tests.rs Outdated Show resolved Hide resolved
pallets/gear/src/tests.rs Outdated Show resolved Hide resolved
pallets/gear/src/tests.rs Outdated Show resolved Hide resolved
pallets/gear/src/tests.rs Show resolved Hide resolved
@gshep gshep requested a review from breathx April 20, 2023 14:32
@gshep gshep changed the title Charge programs for storing on-chain feat(node): Pause programs after specific amount of blocks Apr 21, 2023
@gshep
Copy link
Member Author

gshep commented Apr 25, 2023

@osipov-mit please take a look. In particular at ProgramChangeKind

@ark0f ark0f mentioned this pull request Apr 25, 2023
Copy link
Member

@breathx breathx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥳

common/src/event.rs Outdated Show resolved Hide resolved
common/src/event.rs Show resolved Hide resolved
common/src/lib.rs Outdated Show resolved Hide resolved
gsdk/src/metadata/mod.rs Outdated Show resolved Hide resolved
pallets/airdrop/src/mock.rs Show resolved Hide resolved
pallets/airdrop/src/mock.rs Outdated Show resolved Hide resolved
pallets/gear/src/queue.rs Outdated Show resolved Hide resolved
runtime/gear/src/constants.rs Outdated Show resolved Hide resolved
runtime/vara/src/constants.rs Outdated Show resolved Hide resolved
pallets/gear/src/tests.rs Outdated Show resolved Hide resolved
@gshep gshep added A2-mergeoncegreen PR is ready to merge after CI passes and removed A0-pleasereview PR is ready to be reviewed by the team labels Apr 26, 2023
@gshep gshep merged commit cf98c94 into master Apr 26, 2023
@gshep gshep deleted the gshep/issue-2301-1 branch April 26, 2023 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A2-mergeoncegreen PR is ready to merge after CI passes B1-releasenotes The feature deserves to be added to the Release Notes C1-feature Feature request D2-node Gear Node
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Charge programs for storing on-chain (blocked by #1381)
5 participants