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

Replace inflationary task funding with treasury-funded task creation #1042

Merged
merged 36 commits into from
Aug 14, 2024

Conversation

4meta5
Copy link
Contributor

@4meta5 4meta5 commented Jul 30, 2024

WIP Closes #1040
Also closes #760 by removing all task funding via inflation

  • fund register/unregister shard operations funded from the Treasury
  • fund the recv_msg operation due to submit_result from the Treasury
  • make recv_msg fallible, propagate the error, and move storage changes after erring (necessary for above change)
  • fund send_message from the Treasury
  • fund the recv_msg operation due to register_gateway from the Treasury, propagate error if insufficient balance & move storage changes to after this fallible call
  • fix and update all unit tests broken by these changes
  • fix and update all benchmarks broken by these changes

Notes for Research

Significantly simplified design by David's suggestion to fund all task creation outside of create_task via the Treasury. This handles a lot of edge case handling that was discussed before.

The impact is that it adds the requirement that we always keep the Treasury well funded to our list of operational requirements. There are events and errors that will be emitted when/if the Treasury is not well funded, but we should ensure it is via by balancing funds regularly.

create_task is the only path that funds task creation from the caller. This flow would be effected by #1065 which should probably make all task creation funded by the treasury, which could simplify much of the code by removing TaskFunder and its usage altogether.

@4meta5 4meta5 changed the title Replace task funding via inflation with shard stake, caller, and treasury Replace inflationary task funding with treasury-funded task creation Aug 6, 2024
@4meta5 4meta5 added the ready-for-review PR author(s) done with coding and reviewer[s] can start label Aug 10, 2024
@4meta5
Copy link
Contributor Author

4meta5 commented Aug 10, 2024

WIP and Ready for Review because the implementation is ready for review, but there are remaining TODOs before we merge (listed in PR description).

@4meta5 4meta5 removed the WIP label Aug 12, 2024
@@ -216,6 +216,5 @@ pub struct RewardConfig<Balance, BlockNumber> {
#[derive(Debug, Clone, Decode, Encode, TypeInfo, PartialEq, Eq, PartialOrd, Ord)]
pub enum TaskFunder {
Account(AccountId),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

NOTE for reviewers that, after the changes in this PR, this variant is only used when create_task is called

@4meta5 4meta5 requested review from dvc94ch, FlorianFranzen and taniasaleem and removed request for dvc94ch and FlorianFranzen August 13, 2024 19:11
@dvc94ch dvc94ch merged commit c4c8d5c into development Aug 14, 2024
@dvc94ch dvc94ch deleted the amar-new-task-funding-mechanisms branch August 14, 2024 10:27
/// Insufficient Treasury Balance to create UnRegisterShard task
InsufficientTreasuryBalanceToUnRegisterShard(ShardId),
/// Insufficient Treasury Balance To Create SendMessage task as an effect of calling `submit_result`
InsufficientTreasuryBalanceToSendMessage(Msg),
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Registering and unregistering of shards should be funded from the shards' stake.
SendMessage is the execution of a GMP message; its cost should be covered by the chronicle, and oracle will reimburse.
Treasury fund should only be used for root calls required for system working.

ManojJiSharma pushed a commit that referenced this pull request Aug 28, 2024
…1042)

Co-authored-by: Metadata Update Bot <[email protected]>
Co-authored-by: Github Actions <41898282+github-actions[bot]@users.noreply.github.com>
ManojJiSharma pushed a commit that referenced this pull request Aug 29, 2024
…1042)

Co-authored-by: Metadata Update Bot <[email protected]>
Co-authored-by: Github Actions <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
!ci-benchmark Benchmark and commit new weights priority: high ready-for-review PR author(s) done with coding and reviewer[s] can start
Projects
None yet
3 participants