Skip to content

ZSA assets swap#116

Open
ConstanceBeguier wants to merge 50 commits intozsa1from
zsa_swap
Open

ZSA assets swap#116
ConstanceBeguier wants to merge 50 commits intozsa1from
zsa_swap

Conversation

@ConstanceBeguier
Copy link
Copy Markdown
Collaborator

@ConstanceBeguier ConstanceBeguier commented Oct 10, 2024

This PR introduces the ability to create ActionGroup and SwapBundle for performing asset swaps.

This PR modifies the Builder:

  • A new reference_notes element has been added, which contains reference split notes. These notes can be used when creating actions.
  • A new build_action_group function allows the creation of an ActionGroup from a Builder. Like when creating a Bundle, the ActionGroup will initially be without proof and signatures. You will need to call create_proof and apply_signatures to add them.

This PR creates a new SwapBundle structure. A SwapBundle is created from a list of ActionGroups. During this creation, the following operations are performed

  • The evaluation of the value balance of the SwapBundle (by summing the value balances of each ActionGroup).
  • The evaluation of the binding signature key bsk of the SwapBundle (by summing the bsk of each ActionGroup).
  • The binding signature of the SwapBundle which is equal to the signature of the SwapBundle SIGHASH with the binding signature key bsk.

TODO

  • Should remove timelimit inside ActionGroup struct (this value is already present in Bundle)
  • In this PR, burning is not allowed in an ActionGroup, but we would like to allow it and store burning into inside ActionGroup.
    • The SpecificBuilderParams struct, the BurnNotEmptyInActionGroup error, and the bundle method need to be updated accordingly.
  • A Bundle can now contain an ActionGroup. This modification must be implemented.
/// An action group.
#[derive(Debug)]
pub struct ActionGroup<A: Authorization, V> {
    /// The action group main content.
    action_group: Bundle<A, V, OrchardZSA>,
    /// The action group timelimit.
    timelimit: u32,
    /// The binding signature key for the action group.
    ///
    /// During the building of the action group, this key is not set.
    /// Once the action group is finalized (it contains a spend authorizing signature for each
    /// action and a proof), the key is set.
    bsk: Option<redpallas::SigningKey<Binding>>,
}
  • There are currently two functions for computing orchard_action_groups_digest. These should be merged into a single function for better maintainability.
  • The function binding_validating_key into swap_bundle.rs must take into account the burns.

ZIP

  • The value balance of a swap order is missing in the current ZIP. The matcher (the entity who creates the swap bundle from the swap orders) must know the value balance of each swap order in order to compute the value balance of the swap bundle. The value balance of the swap bundle is equal to the sum of the value balance of each swap order.

@QED-it QED-it deleted a comment from what-the-diff bot Oct 10, 2024
@ConstanceBeguier ConstanceBeguier force-pushed the zsa_swap branch 2 times, most recently from b9e9112 to f4fdf5c Compare October 15, 2024 10:58
@ConstanceBeguier ConstanceBeguier changed the title [WIP] ZSA assets swap ZSA assets swap Oct 18, 2024
@ConstanceBeguier ConstanceBeguier changed the title ZSA assets swap [draft] ZSA assets swap Nov 25, 2024
@ConstanceBeguier ConstanceBeguier marked this pull request as draft November 25, 2024 09:14
@PaulLaux PaulLaux mentioned this pull request Mar 9, 2025
@alexeykoren alexeykoren marked this pull request as ready for review January 20, 2026 14:42
@PaulLaux PaulLaux changed the title [draft] ZSA assets swap ZSA assets swap Mar 25, 2026
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