-
Notifications
You must be signed in to change notification settings - Fork 0
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
[draft] ZSA assets swap #116
base: zsa1
Are you sure you want to change the base?
Conversation
9e0b5bf
to
0f00238
Compare
b9e9112
to
f4fdf5c
Compare
All set of keys (user1, user2, matcher, reference) must be different.
.iter() | ||
.fold( | ||
self.action_group | ||
.prepare_for_action_group(&mut rng, action_group_digest), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we get action_group_digest as parameter? Unlike sighash it is available via self, isn't it? This should be more fool-proof
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is exactly similar to the prepare function for Bundle.
It is inside the prepare_for_action_group function that you save the digest into self.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, yeah, I see where this design is coming from. It's just that in case of tx sighash it makes more sense because you don't have it inside the bundle
Anyway, given our conversations regarding signing sighash for action groups too unders some circumstances (e.g. when ther is only single action group inside tx) - it starts to be relevant for action group too
This PR introduces the ability to create
ActionGroup
andSwapBundle
for performing asset swaps.This PR modifies the
Builder
:reference_notes
element has been added, which contains reference split notes. These notes can be used when creating actions.build_action_group
function allows the creation of anActionGroup
from aBuilder
. Like when creating aBundle
, theActionGroup
will initially be without proof and signatures. You will need to callcreate_proof
andapply_signatures
to add them.This PR creates a new
SwapBundle
structure. ASwapBundle
is created from a list ofActionGroups
. During this creation, the following operations are performedSwapBundle
(by summing the value balances of eachActionGroup
).bsk
of theSwapBundle
(by summing thebsk
of eachActionGroup
).SwapBundle
which is equal to the signature of the SwapBundle SIGHASH with the binding signature keybsk
.TODO