[TASK] Deterministic JobId for Service Pallet Blueprints #943
Labels
Breaking Change
Breaking change for any dependent apps (gadget, relayer etc..)
feature ➕
Tasks that are functional additions or enhancements
task ✔️
Summary
This RFC proposes replacing the current index-based job identification system with a deterministic hash-based JobId system. This change will make jobs self-identifying, simplify deployment, and improve the development experience.
Problem Statement
Currently, the Service Pallet identifies jobs by their index position in a
Vec<Job>
within a blueprint. This approach has limitations:Proposal
We propose implementing a deterministic hashing mechanism for job identification similar to how EVM contracts handle function identification.
Deterministic JobId Generation
For each job, we will generate a deterministic hash as follows:
Where:
H
is the Keccak256 hash functionFQN(job)
is the fully qualified name of the functionargs
are the concatenated argumentsTechnical Changes
Storage Changes
Vec<Job>
withBTreeMap<u32, Job>
for efficient job lookupBlueprint SDK Changes
The Blueprint SDK will be updated to:
Benefits
Potential Challenges
Implementation Plan
Conclusion
Moving to deterministic job IDs will make the Service Pallet more robust, developer-friendly, and flexible. The proposed change aligns with best practices seen in other systems like EVM contracts and will improve the overall developer experience.
The text was updated successfully, but these errors were encountered: