Skip to content

Reviews and refactors the code in order to demonstrate D3L functionality#4

Merged
alxmirap merged 25 commits intoparitytech:cheme/externalstatefrom
alxmirap:alx/deferred-execution
Apr 17, 2026
Merged

Reviews and refactors the code in order to demonstrate D3L functionality#4
alxmirap merged 25 commits intoparitytech:cheme/externalstatefrom
alxmirap:alx/deferred-execution

Conversation

@alxmirap
Copy link
Copy Markdown
Collaborator

Extracts the concept of Execution Mode, and refactors it to recognise 3 types of packages:

  • Immediate: the logic of the package's work item is executed immediately, and both refinement and accumulation are executed.
  • Deferring: the logic of the package is verified to be valid, but accumulation is not executed. Instead, the operations and state are exported to the D3L
  • Deferred: the package does not carry any operation or witness. These are retrieved from the D3L during refinement, and then the accumulation logic is executed, completing the operation started in the Deferring package.

The builder has been expanded to create and submit the two related packages at the same time.

This PR should be merged on top of #2 and #3.

alxmirap added 23 commits March 25, 2026 17:50
- renamed `token-ledger-v1` to `token-ledger-service-v1`, to maintain the parallel with v2
- in the Tutorial, updated an example command since `cargo run` no longer requires expliction `-i` or `-o` options. However, there are some more changes in this command, and the documentation will have to be all reviewed later.
- Added a paragraph describing the purpose of a new binary to convert user-friendly Json operations into fully-specified ones.
 - some changes to justfile to enable it to be invoked from any location, and not only from that of the `justfile`. Commands build-service, create-service, query-service and submit-file, and functions to get and save the last service id,  have been successfully tested
- added a command to connect to an RPC node, for the moment still unhandled. Ensures that we must have either this or output specified.
- Extracts some functions in main.rs to make the code more readable.
… WorkPackage directly to it.

WiP: still needs some refactoring to reduce the size of long functions.
Also, builder has new features:
- ability to receive a user-friendly JSON file without signatures and valid AccountIds (ie Public Keys)
- ability to connect to an RPC node and submit Work Package directly without having to encode it first.
Creates a Work Package builder able to submit encoded payloads directly to an RPC Node

Also:

rewrites and expands the 3rd part tutorial
improves the experience with justfile by allowing commands to be called from different directories
extensive clippy and formatting changes
Moves the basic structs and functions to token-ledger-common.
- Comments the code associated to preimages and segments
Adds an Extrinsic mode, to deliver the witness via extrinsic and outside the payload.
…ges: first package exports a segment, second package imports it.

This includes also a deep refactoring of the code, and commenting out everything related to pre-images.

Also adds a new example payload.
@alxmirap alxmirap requested a review from cheme April 16, 2026 11:52
Copy link
Copy Markdown

@cheme cheme left a comment

Choose a reason for hiding this comment

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

Generally in favor of merging all open pr (not just this one on #2 or #3) and advance on small commit from now on.

@alxmirap alxmirap merged commit e544adc into paritytech:cheme/externalstate Apr 17, 2026
3 checks passed
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.

2 participants