-
Notifications
You must be signed in to change notification settings - Fork 102
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
Emit synthetic cross-chain events #875
Conversation
emitEventUnsafe (QualifiedName "pact" name def) params mhash | ||
|
||
emitEventUnsafe :: QualifiedName -> [PactValue] -> ModuleHash -> Eval e () | ||
emitEventUnsafe QualifiedName{..} params mh = do |
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 not append here? Also, what about using a dlist
?
EDIT: I meant to say cons instead of append.
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.
Events are rarely more than 1-2 long so not concerned about append performance as of yet ...
return result | ||
|
||
applyPact _ _ t _ = evalError' t "applyPact: invalid defpact body, expected list of steps" | ||
|
||
|
||
-- | Synthesize events for cross chain. | ||
emitXChainEvents :: Maybe Yield -> PactExec -> Eval e () | ||
emitXChainEvents mResume PactExec {..} = do |
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.
Is it acceptable that mResume
is Nothing
while _peYield
yields (pardon the obvious pun) a Just
value?
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.
Yes, in fact that's expected. I'll update comments
Emit synthetic events for cross-chain
defpact
executions. The signatures are(pact.X_YIELD targetChain continuationName continuationArgs)
for cross-chain yields(pact.X_RESUME sourceChain continuationName continuationArgs)
for cross-chain resumesThus a cross-chain transfer send from 0 to 1 would be
(pact.X_YIELD "1" "coin.transfer-crosschain" ["Bob" "Alice" 10.0])
on 0 then(pact.X_RESUME "0" "coin.transfer-crosschain" ["Bob" "Alice" 10.0])
on 1.