payload: {"action":"created","comment":{"url":"https://api.github.com/repos/kadena-io/pact/pulls/comments/329871384","pull_request_review_id":295358143,"id":329871384,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMyOTg3MTM4NA==","diff_hunk":"@@ -818,22 +818,56 @@ applyPact _ _ t _ = evalError' t \"applyPact: invalid defpact body, expected list\n -- | Resume a pact, either as specified or as found in database.\n -- Expects a 'PactStep' to be populated in the environment.\n resumePact :: Info -> Maybe PactExec -> Eval e (Term Name)\n-resumePact i pe = do\n+resumePact i crossChainContinuation = do\n \n   ps@PactStep{..} <- view eePactStep >>= (`maybe` pure)\n     (evalError i \"resumePact: no step in environment\")\n \n-  context <- case pe of\n-    Just p -> return p\n-    Nothing -> do\n-      contextM <- readRow i Pacts _psPactId >>= (`maybe` pure)\n-        (evalError i $ \"resumePact: no previous execution found for: \" <> pretty _psPactId)\n-\n-      case contextM of\n-        Nothing -> evalError i $ \"resumePact: pact completed: \" <> pretty _psPactId\n-        Just c -> return c\n-\n-  resumePactExec i ps context\n+  -- query for previous exec\n+  dbState <- readRow i Pacts _psPactId\n+\n+  -- validate db state\n+  let proceed = resumePactExec i ps\n+  case (dbState,crossChainContinuation) of\n+\n+    -- Terminated pact in db: always fail\n+    (Just Nothing,_) ->\n+      evalError i $ \"resumePact: pact completed: \" <> pretty _psPactId\n+\n+    -- Nothing in db, Nothing cross-chain continuation: fail\n+    (Nothing,Nothing) ->\n+      evalError i $ \"resumePact: no previous execution found for: \" <> pretty _psPactId\n+\n+    -- Nothing in db, Just cross-chain continuation: proceed with cross-chain\n+    (Nothing,Just ccExec) -> proceed ccExec\n+\n+    -- Active db record, Nothing cross-chain continuation: proceed with db\n+    (Just (Just dbExec),Nothing) -> proceed dbExec\n+\n+    -- Active db record, cross-chain continuation:\n+    -- TODO: this is a fishy case, consider disallowing.\n+    -- TODO: if we do decide to allow, cover in tests.\n+    -- For now, a valid possibility iff this is a flip-flop from another chain, e.g.\n+    --   0. This chain: start pact\n+    --   1. Other chain: continue pact\n+    --   2. This chain: continue pact\n+    (Just (Just dbExec),Just ccExec)","path":"src/Pact/Eval.hs","position":null,"original_position":49,"commit_id":"7f28ae1451d44fc266cf6d927346bb0f498253ec","original_commit_id":"52b371c68380e6cc1776539417f2fbc091359922","user":{"login":"slpopejoy","id":8353613,"node_id":"MDQ6VXNlcjgzNTM2MTM=","avatar_url":"https://avatars2.githubusercontent.com/u/8353613?v=4","gravatar_id":"","url":"https://api.github.com/users/slpopejoy","html_url":"https://github.com/slpopejoy","followers_url":"https://api.github.com/users/slpopejoy/followers","following_url":"https://api.github.com/users/slpopejoy/following{/other_user}","gists_url":"https://api.github.com/users/slpopejoy/gists{/gist_id}","starred_url":"https://api.github.com/users/slpopejoy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slpopejoy/subscriptions","organizations_url":"https://api.github.com/users/slpopejoy/orgs","repos_url":"https://api.github.com/users/slpopejoy/repos","events_url":"https://api.github.com/users/slpopejoy/events{/privacy}","received_events_url":"https://api.github.com/users/slpopejoy/received_events","type":"User","site_admin":false},"body":"Per discussion, allowed if skipping at least one, and validated continuation and step count (the others are ignored in `resumePactExec`","created_at":"2019-10-01T04:03:42Z","updated_at":"2019-10-01T04:03:43Z","html_url":"https://github.com/kadena-io/pact/pull/664#discussion_r329871384","pull_request_url":"https://api.github.com/repos/kadena-io/pact/pulls/664","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/kadena-io/pact/pulls/comments/329871384"},"html":{"href":"https://github.com/kadena-io/pact/pull/664#discussion_r329871384"},"pull_request":{"href":"https://api.github.com/repos/kadena-io/pact/pulls/664"}},"in_reply_to_id":329687625},"pull_request":{"url":"https://api.github.com/repos/kadena-io/pact/pulls/664","id":322443167,"node_id":"MDExOlB1bGxSZXF1ZXN0MzIyNDQzMTY3","html_url":"https://github.com/kadena-io/pact/pull/664","diff_url":"https://github.com/kadena-io/pact/pull/664.diff","patch_url":"https://github.com/kadena-io/pact/pull/664.patch","issue_url":"https://api.github.com/repos/kadena-io/pact/issues/664","number":664,"state":"open","locked":false,"title":"Fix cross chain multiple redeem bug + fix API docs, ApiReq docs","user":{"login":"slpopejoy","id":8353613,"node_id":"MDQ6VXNlcjgzNTM2MTM=","avatar_url":"https://avatars2.githubusercontent.com/u/8353613?v=4","gravatar_id":"","url":"https://api.github.com/users/slpopejoy","html_url":"https://github.com/slpopejoy","followers_url":"https://api.github.com/users/slpopejoy/followers","following_url":"https://api.github.com/users/slpopejoy/following{/other_user}","gists_url":"https://api.github.com/users/slpopejoy/gists{/gist_id}","starred_url":"https://api.github.com/users/slpopejoy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slpopejoy/subscriptions","organizations_url":"https://api.github.com/users/slpopejoy/orgs","repos_url":"https://api.github.com/users/slpopejoy/repos","events_url":"https://api.github.com/users/slpopejoy/events{/privacy}","received_events_url":"https://api.github.com/users/slpopejoy/received_events","type":"User","site_admin":false},"body":"","created_at":"2019-09-28T20:06:55Z","updated_at":"2019-10-01T04:03:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1e4d81d3140e358d5edd5e2f7bea821ea87ccc38","assignee":null,"assignees":[],"requested_reviewers":[{"login":"LindaOrtega","id":10335533,"node_id":"MDQ6VXNlcjEwMzM1NTMz","avatar_url":"https://avatars0.githubusercontent.com/u/10335533?v=4","gravatar_id":"","url":"https://api.github.com/users/LindaOrtega","html_url":"https://github.com/LindaOrtega","followers_url":"https://api.github.com/users/LindaOrtega/followers","following_url":"https://api.github.com/users/LindaOrtega/following{/other_user}","gists_url":"https://api.github.com/users/LindaOrtega/gists{/gist_id}","starred_url":"https://api.github.com/users/LindaOrtega/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LindaOrtega/subscriptions","organizations_url":"https://api.github.com/users/LindaOrtega/orgs","repos_url":"https://api.github.com/users/LindaOrtega/repos","events_url":"https://api.github.com/users/LindaOrtega/events{/privacy}","received_events_url":"https://api.github.com/users/LindaOrtega/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/kadena-io/pact/pulls/664/commits","review_comments_url":"https://api.github.com/repos/kadena-io/pact/pulls/664/comments","review_comment_url":"https://api.github.com/repos/kadena-io/pact/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kadena-io/pact/issues/664/comments","statuses_url":"https://api.github.com/repos/kadena-io/pact/statuses/7f28ae1451d44fc266cf6d927346bb0f498253ec","head":{"label":"kadena-io:bug/cross-chain-multiple-redeem-bug","ref":"bug/cross-chain-multiple-redeem-bug","sha":"7f28ae1451d44fc266cf6d927346bb0f498253ec","user":{"login":"kadena-io","id":19830776,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5ODMwNzc2","avatar_url":"https://avatars1.githubusercontent.com/u/19830776?v=4","gravatar_id":"","url":"https://api.github.com/users/kadena-io","html_url":"https://github.com/kadena-io","followers_url":"https://api.github.com/users/kadena-io/followers","following_url":"https://api.github.com/users/kadena-io/following{/other_user}","gists_url":"https://api.github.com/users/kadena-io/gists{/gist_id}","starred_url":"https://api.github.com/users/kadena-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kadena-io/subscriptions","organizations_url":"https://api.github.com/users/kadena-io/orgs","repos_url":"https://api.github.com/users/kadena-io/repos","events_url":"https://api.github.com/users/kadena-io/events{/privacy}","received_events_url":"https://api.github.com/users/kadena-io/received_events","type":"Organization","site_admin":false},"repo":{"id":73597023,"node_id":"MDEwOlJlcG9zaXRvcnk3MzU5NzAyMw==","name":"pact","full_name":"kadena-io/pact","private":false,"owner":{"login":"kadena-io","id":19830776,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5ODMwNzc2","avatar_url":"https://avatars1.githubusercontent.com/u/19830776?v=4","gravatar_id":"","url":"https://api.github.com/users/kadena-io","html_url":"https://github.com/kadena-io","followers_url":"https://api.github.com/users/kadena-io/followers","following_url":"https://api.github.com/users/kadena-io/following{/other_user}","gists_url":"https://api.github.com/users/kadena-io/gists{/gist_id}","starred_url":"https://api.github.com/users/kadena-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kadena-io/subscriptions","organizations_url":"https://api.github.com/users/kadena-io/orgs","repos_url":"https://api.github.com/users/kadena-io/repos","events_url":"https://api.github.com/users/kadena-io/events{/privacy}","received_events_url":"https://api.github.com/users/kadena-io/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/kadena-io/pact","description":"The Pact Smart Contract Language","fork":false,"url":"https://api.github.com/repos/kadena-io/pact","forks_url":"https://api.github.com/repos/kadena-io/pact/forks","keys_url":"https://api.github.com/repos/kadena-io/pact/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kadena-io/pact/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kadena-io/pact/teams","hooks_url":"https://api.github.com/repos/kadena-io/pact/hooks","issue_events_url":"https://api.github.com/repos/kadena-io/pact/issues/events{/number}","events_url":"https://api.github.com/repos/kadena-io/pact/events","assignees_url":"https://api.github.com/repos/kadena-io/pact/assignees{/user}","branches_url":"https://api.github.com/repos/kadena-io/pact/branches{/branch}","tags_url":"https://api.github.com/repos/kadena-io/pact/tags","blobs_url":"https://api.github.com/repos/kadena-io/pact/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kadena-io/pact/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kadena-io/pact/git/refs{/sha}","trees_url":"https://api.github.com/repos/kadena-io/pact/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kadena-io/pact/statuses/{sha}","languages_url":"https://api.github.com/repos/kadena-io/pact/languages","stargazers_url":"https://api.github.com/repos/kadena-io/pact/stargazers","contributors_url":"https://api.github.com/repos/kadena-io/pact/contributors","subscribers_url":"https://api.github.com/repos/kadena-io/pact/subscribers","subscription_url":"https://api.github.com/repos/kadena-io/pact/subscription","commits_url":"https://api.github.com/repos/kadena-io/pact/commits{/sha}","git_commits_url":"https://api.github.com/repos/kadena-io/pact/git/commits{/sha}","comments_url":"https://api.github.com/repos/kadena-io/pact/comments{/number}","issue_comment_url":"https://api.github.com/repos/kadena-io/pact/issues/comments{/number}","contents_url":"https://api.github.com/repos/kadena-io/pact/contents/{+path}","compare_url":"https://api.github.com/repos/kadena-io/pact/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kadena-io/pact/merges","archive_url":"https://api.github.com/repos/kadena-io/pact/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kadena-io/pact/downloads","issues_url":"https://api.github.com/repos/kadena-io/pact/issues{/number}","pulls_url":"https://api.github.com/repos/kadena-io/pact/pulls{/number}","milestones_url":"https://api.github.com/repos/kadena-io/pact/milestones{/number}","notifications_url":"https://api.github.com/repos/kadena-io/pact/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kadena-io/pact/labels{/name}","releases_url":"https://api.github.com/repos/kadena-io/pact/releases{/id}","deployments_url":"https://api.github.com/repos/kadena-io/pact/deployments","created_at":"2016-11-13T05:16:00Z","updated_at":"2019-09-28T19:49:43Z","pushed_at":"2019-10-01T04:02:51Z","git_url":"git://github.com/kadena-io/pact.git","ssh_url":"git@github.com:kadena-io/pact.git","clone_url":"https://github.com/kadena-io/pact.git","svn_url":"https://github.com/kadena-io/pact","homepage":"https://pact.kadena.io","size":10183,"stargazers_count":314,"watchers_count":314,"language":"Haskell","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":37,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":92,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":37,"open_issues":92,"watchers":314,"default_branch":"master"}},"base":{"label":"kadena-io:master","ref":"master","sha":"f9d57f18f9ee33a3aa769b2858e8540784700c1b","user":{"login":"kadena-io","id":19830776,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5ODMwNzc2","avatar_url":"https://avatars1.githubusercontent.com/u/19830776?v=4","gravatar_id":"","url":"https://api.github.com/users/kadena-io","html_url":"https://github.com/kadena-io","followers_url":"https://api.github.com/users/kadena-io/followers","following_url":"https://api.github.com/users/kadena-io/following{/other_user}","gists_url":"https://api.github.com/users/kadena-io/gists{/gist_id}","starred_url":"https://api.github.com/users/kadena-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kadena-io/subscriptions","organizations_url":"https://api.github.com/users/kadena-io/orgs","repos_url":"https://api.github.com/users/kadena-io/repos","events_url":"https://api.github.com/users/kadena-io/events{/privacy}","received_events_url":"https://api.github.com/users/kadena-io/received_events","type":"Organization","site_admin":false},"repo":{"id":73597023,"node_id":"MDEwOlJlcG9zaXRvcnk3MzU5NzAyMw==","name":"pact","full_name":"kadena-io/pact","private":false,"owner":{"login":"kadena-io","id":19830776,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5ODMwNzc2","avatar_url":"https://avatars1.githubusercontent.com/u/19830776?v=4","gravatar_id":"","url":"https://api.github.com/users/kadena-io","html_url":"https://github.com/kadena-io","followers_url":"https://api.github.com/users/kadena-io/followers","following_url":"https://api.github.com/users/kadena-io/following{/other_user}","gists_url":"https://api.github.com/users/kadena-io/gists{/gist_id}","starred_url":"https://api.github.com/users/kadena-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kadena-io/subscriptions","organizations_url":"https://api.github.com/users/kadena-io/orgs","repos_url":"https://api.github.com/users/kadena-io/repos","events_url":"https://api.github.com/users/kadena-io/events{/privacy}","received_events_url":"https://api.github.com/users/kadena-io/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/kadena-io/pact","description":"The Pact Smart Contract Language","fork":false,"url":"https://api.github.com/repos/kadena-io/pact","forks_url":"https://api.github.com/repos/kadena-io/pact/forks","keys_url":"https://api.github.com/repos/kadena-io/pact/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kadena-io/pact/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kadena-io/pact/teams","hooks_url":"https://api.github.com/repos/kadena-io/pact/hooks","issue_events_url":"https://api.github.com/repos/kadena-io/pact/issues/events{/number}","events_url":"https://api.github.com/repos/kadena-io/pact/events","assignees_url":"https://api.github.com/repos/kadena-io/pact/assignees{/user}","branches_url":"https://api.github.com/repos/kadena-io/pact/branches{/branch}","tags_url":"https://api.github.com/repos/kadena-io/pact/tags","blobs_url":"https://api.github.com/repos/kadena-io/pact/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kadena-io/pact/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kadena-io/pact/git/refs{/sha}","trees_url":"https://api.github.com/repos/kadena-io/pact/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kadena-io/pact/statuses/{sha}","languages_url":"https://api.github.com/repos/kadena-io/pact/languages","stargazers_url":"https://api.github.com/repos/kadena-io/pact/stargazers","contributors_url":"https://api.github.com/repos/kadena-io/pact/contributors","subscribers_url":"https://api.github.com/repos/kadena-io/pact/subscribers","subscription_url":"https://api.github.com/repos/kadena-io/pact/subscription","commits_url":"https://api.github.com/repos/kadena-io/pact/commits{/sha}","git_commits_url":"https://api.github.com/repos/kadena-io/pact/git/commits{/sha}","comments_url":"https://api.github.com/repos/kadena-io/pact/comments{/number}","issue_comment_url":"https://api.github.com/repos/kadena-io/pact/issues/comments{/number}","contents_url":"https://api.github.com/repos/kadena-io/pact/contents/{+path}","compare_url":"https://api.github.com/repos/kadena-io/pact/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kadena-io/pact/merges","archive_url":"https://api.github.com/repos/kadena-io/pact/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kadena-io/pact/downloads","issues_url":"https://api.github.com/repos/kadena-io/pact/issues{/number}","pulls_url":"https://api.github.com/repos/kadena-io/pact/pulls{/number}","milestones_url":"https://api.github.com/repos/kadena-io/pact/milestones{/number}","notifications_url":"https://api.github.com/repos/kadena-io/pact/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kadena-io/pact/labels{/name}","releases_url":"https://api.github.com/repos/kadena-io/pact/releases{/id}","deployments_url":"https://api.github.com/repos/kadena-io/pact/deployments","created_at":"2016-11-13T05:16:00Z","updated_at":"2019-09-28T19:49:43Z","pushed_at":"2019-10-01T04:02:51Z","git_url":"git://github.com/kadena-io/pact.git","ssh_url":"git@github.com:kadena-io/pact.git","clone_url":"https://github.com/kadena-io/pact.git","svn_url":"https://github.com/kadena-io/pact","homepage":"https://pact.kadena.io","size":10183,"stargazers_count":314,"watchers_count":314,"language":"Haskell","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":37,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":92,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":37,"open_issues":92,"watchers":314,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kadena-io/pact/pulls/664"},"html":{"href":"https://github.com/kadena-io/pact/pull/664"},"issue":{"href":"https://api.github.com/repos/kadena-io/pact/issues/664"},"comments":{"href":"https://api.github.com/repos/kadena-io/pact/issues/664/comments"},"review_comments":{"href":"https://api.github.com/repos/kadena-io/pact/pulls/664/comments"},"review_comment":{"href":"https://api.github.com/repos/kadena-io/pact/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kadena-io/pact/pulls/664/commits"},"statuses":{"href":"https://api.github.com/repos/kadena-io/pact/statuses/7f28ae1451d44fc266cf6d927346bb0f498253ec"}},"author_association":"CONTRIBUTOR"}}
other: {"actor":{"display_login":"slpopejoy"}}