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!: Add Support for Master Blueprint Service Manager #830

Merged
merged 10 commits into from
Nov 26, 2024
Merged

Conversation

shekohex
Copy link
Contributor

@shekohex shekohex commented Nov 21, 2024

Summary of changes

This pull request introduces several significant changes to the pallets/services/src/lib.rs file, focusing on enhancing the management of Master Blueprint Service Managers and refining various hooks and dispatchable functions. The most important changes are summarized below:

Enhancements to Master Blueprint Service Manager

  • Added a new constant MaxMasterBlueprintServiceManagerVersions to define the maximum number of versions allowed for Master Blueprint Service Managers.
  • Introduced a new storage item MasterBlueprintServiceManagerRevisions to store all revisions of the Master Blueprint Service Manager.
  • Added a new dispatchable function update_master_blueprint_service_manager to update the Master Blueprint Service Manager and emit an event upon revision.
  • Added new error variants BlueprintCreationInterrupted, MasterBlueprintServiceManagerRevisionNotFound, and MaxMasterBlueprintServiceManagerVersionsExceeded to handle specific error cases. [1] [2]

Modifications to Hooks and Dispatchable Functions

  • Updated the create_blueprint function to handle Master Blueprint Service Manager revisions and ensure the blueprint creation process is not interrupted.
  • Modified various hooks (on_register_hook, on_unregister_hook, on_update_price_targets, on_request_hook, on_approve_hook, on_service_init_hook, on_reject_hook, on_service_termination_hook, on_job_call_hook, on_job_result_hook) to include blueprint_id as a parameter for better context and validation. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

Removal of Deprecated Events

  • Removed the deprecated EvmLog event to clean up the event definitions.

Mock Runtime Adjustments

  • Added a new constant MaxMasterBlueprintServiceManagerRevisions in the mock runtime configuration to support the new functionality.
  • Updated the mock runtime to include MaxMasterBlueprintServiceManagerVersions and changed the origin for updating the Master Blueprint Service Manager to EnsureRoot.
  • Enhanced the mock environment to deploy additional contracts for testing purposes.

These changes collectively improve the flexibility and robustness of the service management module by allowing for better version control and validation of blueprints and their associated hooks.

Reference issue to close (if applicable)

Closes #828

@shekohex shekohex changed the title feat: Add Support for Master Blueprint Service Manager feat!: Add Support for Master Blueprint Service Manager Nov 22, 2024
@shekohex shekohex marked this pull request as ready for review November 22, 2024 20:07

Choose a reason for hiding this comment

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

Copilot reviewed 11 out of 11 changed files in this pull request and generated no suggestions.

@shekohex
Copy link
Contributor Author

Note: The huge diff in the latest commit is from the tangle-subxt updates

Choose a reason for hiding this comment

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

Copilot reviewed 11 out of 15 changed files in this pull request and generated no suggestions.

Files not reviewed (4)
  • pallets/services/src/mock.rs: Evaluated as low risk
  • precompiles/services/src/tests.rs: Evaluated as low risk
  • tangle-subxt/Cargo.toml: Evaluated as low risk
  • runtime/testnet/src/tangle_services.rs: Evaluated as low risk
Copy link
Contributor

@drewstone drewstone left a comment

Choose a reason for hiding this comment

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

Would love to see more tests, more edge cases, looks good!

pallets/services/src/tests.rs Show resolved Hide resolved
pallets/services/src/tests.rs Show resolved Hide resolved

Choose a reason for hiding this comment

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

Copilot reviewed 17 out of 17 changed files in this pull request and generated no suggestions.

@drewstone drewstone merged commit 03954e9 into main Nov 26, 2024
3 checks passed
@drewstone drewstone deleted the shady/mbsm branch November 26, 2024 15:22
@shekohex shekohex restored the shady/mbsm branch November 26, 2024 16:01
@shekohex shekohex deleted the shady/mbsm branch November 26, 2024 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TASK] Add support for Master Blueprint Service Manager Spec
2 participants