{"action":"created","comment":{"url":"https://api.github.com/repos/dapphub/klab/pulls/comments/238099778","pull_request_review_id":180562725,"id":238099778,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzODA5OTc3OA==","diff_hunk":"@@ -339,13 +342,76 @@ const parseAct = (act_str, silent = false) => {\n }\n \n \n+const buildAct = config => ({act, oog, pass, name}) => {\n+  console.log(\"build \" + name)\n \n+  // HELPERS\n+  // TODO - sideeffect free\n+  const getTerm = ({\n+    output,\n+    statusCode,\n+    accounts,\n+    gas,\n+    pc\n+  }) => ({\n+      \"k\": \"#execute ~> CONTINUATION => \" + ((act.internal && pass && !(oog)) ? \"#execute ~> CONTINUATION\" : \"#halt ~> CONTINUATION\"),\n+    \"ethereum.evm.callState.programBytes\": `#parseByteStack(\"0x${config.contracts[act.subject].bin_runtime}\")`,\n+    \"ethereum.evm.callState.program\":  `#asMapOpCodes(#dasmOpCodes(#parseByteStack(\"0x${config.contracts[act.subject].bin_runtime}\"), BYZANTIUM))`,\n+    \"ethereum.evm.callState.callData\": act.callData,\n+    \"ethereum.evm.callState.callValue\": \"0\",\n+    \"ethereum.evm.callState.wordStack\": wordstack,\n+    \"ethereum.evm.callState.localMem\": act.internal ? \"_\" : \".Map => _\",\n+    \"ethereum.evm.callState.pc\": pc,\n+    \"ethereum.evm.callState.gas\": gas,\n+    \"ethereum.evm.callState.memoryUsed\": act.internal ? \"VMemoryUsed\" : \"0 => _\",\n+    \"ethereum.evm.callState.callDepth\": \"VCallDepth => _\",\n+    \"ethereum.evm.output\":             output,\n+    \"ethereum.evm.statusCode\":         \"_ => \" + statusCode,\n+    \"ethereum.network.activeAccounts\": activeAccounts,\n+    \"ethereum.network.accounts\":       accounts,\n+  })\n+    const buildAccount = varname => {\n+      let fstore = Object.keys(act.storage[varname])\n+      .map(key => storageEntry(varname, key, act.storage[varname][key], pass && !oog))\n+      .concat([\"_:Map\"])\n+      .reverse()\n+      .reduceRight(brackedJoin(STORAGE_DELIMITER), \"\")\n+\n+    if(!(act.varname2alias[varname])) warn(`Implementation of variable \"${varname} : address\" not found!`);\n+    const alias = act.varname2alias[varname];\n+    if(alias && !(config.implementations[alias])) warn(`Implementation of contract alias ${alias} not found!`);\n+    const contract_name = alias\n+      && alias in config.implementations\n+      && config.implementations[alias].name;\n+    const balance = act.balance\n+      && act.balance[varname]\n+      || varname + \"_balance\";\n+\n+    return {account: {\n+      acctID:  varname,\n+      balance: balance,\n+      code:    `#parseByteStack(\"0x${contract_name && config.contracts[contract_name].bin_runtime || \"\"}\")`,\n+      storage: fstore,\n+      nonce:   \"_\"\n+    }}\n+  }\n \n-const buildAct = config => act => {\n-  console.log(\"Building k-spec \" + act.subject + \".\" + act.name)\n+\n+  // TODO - simplify this\n   if(!act.storage) act.storage = {};\n   if(!act.storage.ACCT_ID) act.storage.ACCT_ID = []\n+  const storage = {\n+    ...act.storage,\n+    [act.subject]: act.storage.ACCT_ID\n+  }\n+  delete storage.ACCT_ID;\n+\n+  // GAS\n+  const gas = \"VGas => \" + ((act.hasGas && !oog) ? \"VGas -Int \" + act.gas : \"_\");","path":"lib/build.js","position":119,"original_position":119,"commit_id":"ea433a61e668b488c2eb10e761dbf97fa638e757","original_commit_id":"ea433a61e668b488c2eb10e761dbf97fa638e757","user":{"login":"MrChico","id":8930559,"node_id":"MDQ6VXNlcjg5MzA1NTk=","avatar_url":"https://avatars0.githubusercontent.com/u/8930559?v=4","gravatar_id":"","url":"https://api.github.com/users/MrChico","html_url":"https://github.com/MrChico","followers_url":"https://api.github.com/users/MrChico/followers","following_url":"https://api.github.com/users/MrChico/following{/other_user}","gists_url":"https://api.github.com/users/MrChico/gists{/gist_id}","starred_url":"https://api.github.com/users/MrChico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrChico/subscriptions","organizations_url":"https://api.github.com/users/MrChico/orgs","repos_url":"https://api.github.com/users/MrChico/repos","events_url":"https://api.github.com/users/MrChico/events{/privacy}","received_events_url":"https://api.github.com/users/MrChico/received_events","type":"User","site_admin":false},"body":"The post gas should not be the cleaned up gas expression, but rather the \"raw\" expression, just tokenized. ","created_at":"2018-12-02T13:58:19Z","updated_at":"2018-12-02T13:58:19Z","html_url":"https://github.com/dapphub/klab/pull/95#discussion_r238099778","pull_request_url":"https://api.github.com/repos/dapphub/klab/pulls/95","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/dapphub/klab/pulls/comments/238099778"},"html":{"href":"https://github.com/dapphub/klab/pull/95#discussion_r238099778"},"pull_request":{"href":"https://api.github.com/repos/dapphub/klab/pulls/95"}}},"pull_request":{"url":"https://api.github.com/repos/dapphub/klab/pulls/95","id":233657294,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMzNjU3Mjk0","html_url":"https://github.com/dapphub/klab/pull/95","diff_url":"https://github.com/dapphub/klab/pull/95.diff","patch_url":"https://github.com/dapphub/klab/pull/95.patch","issue_url":"https://api.github.com/repos/dapphub/klab/issues/95","number":95,"state":"open","locked":false,"title":"New gas work","user":{"login":"mhhf","id":446478,"node_id":"MDQ6VXNlcjQ0NjQ3OA==","avatar_url":"https://avatars0.githubusercontent.com/u/446478?v=4","gravatar_id":"","url":"https://api.github.com/users/mhhf","html_url":"https://github.com/mhhf","followers_url":"https://api.github.com/users/mhhf/followers","following_url":"https://api.github.com/users/mhhf/following{/other_user}","gists_url":"https://api.github.com/users/mhhf/gists{/gist_id}","starred_url":"https://api.github.com/users/mhhf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhhf/subscriptions","organizations_url":"https://api.github.com/users/mhhf/orgs","repos_url":"https://api.github.com/users/mhhf/repos","events_url":"https://api.github.com/users/mhhf/events{/privacy}","received_events_url":"https://api.github.com/users/mhhf/received_events","type":"User","site_admin":false},"body":"this replaces gas rebased rebased branch","created_at":"2018-11-26T18:39:14Z","updated_at":"2018-12-02T13:58:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5c98aeac82a8f0e5d220685c4e528b1f2717462e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/dapphub/klab/pulls/95/commits","review_comments_url":"https://api.github.com/repos/dapphub/klab/pulls/95/comments","review_comment_url":"https://api.github.com/repos/dapphub/klab/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dapphub/klab/issues/95/comments","statuses_url":"https://api.github.com/repos/dapphub/klab/statuses/ea433a61e668b488c2eb10e761dbf97fa638e757","head":{"label":"dapphub:new-gas-branch","ref":"new-gas-branch","sha":"ea433a61e668b488c2eb10e761dbf97fa638e757","user":{"login":"dapphub","id":20761241,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwNzYxMjQx","avatar_url":"https://avatars1.githubusercontent.com/u/20761241?v=4","gravatar_id":"","url":"https://api.github.com/users/dapphub","html_url":"https://github.com/dapphub","followers_url":"https://api.github.com/users/dapphub/followers","following_url":"https://api.github.com/users/dapphub/following{/other_user}","gists_url":"https://api.github.com/users/dapphub/gists{/gist_id}","starred_url":"https://api.github.com/users/dapphub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dapphub/subscriptions","organizations_url":"https://api.github.com/users/dapphub/orgs","repos_url":"https://api.github.com/users/dapphub/repos","events_url":"https://api.github.com/users/dapphub/events{/privacy}","received_events_url":"https://api.github.com/users/dapphub/received_events","type":"Organization","site_admin":false},"repo":{"id":130726822,"node_id":"MDEwOlJlcG9zaXRvcnkxMzA3MjY4MjI=","name":"klab","full_name":"dapphub/klab","private":false,"owner":{"login":"dapphub","id":20761241,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwNzYxMjQx","avatar_url":"https://avatars1.githubusercontent.com/u/20761241?v=4","gravatar_id":"","url":"https://api.github.com/users/dapphub","html_url":"https://github.com/dapphub","followers_url":"https://api.github.com/users/dapphub/followers","following_url":"https://api.github.com/users/dapphub/following{/other_user}","gists_url":"https://api.github.com/users/dapphub/gists{/gist_id}","starred_url":"https://api.github.com/users/dapphub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dapphub/subscriptions","organizations_url":"https://api.github.com/users/dapphub/orgs","repos_url":"https://api.github.com/users/dapphub/repos","events_url":"https://api.github.com/users/dapphub/events{/privacy}","received_events_url":"https://api.github.com/users/dapphub/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/dapphub/klab","description":"K framework proof explorer & smart contract specification format","fork":false,"url":"https://api.github.com/repos/dapphub/klab","forks_url":"https://api.github.com/repos/dapphub/klab/forks","keys_url":"https://api.github.com/repos/dapphub/klab/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dapphub/klab/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dapphub/klab/teams","hooks_url":"https://api.github.com/repos/dapphub/klab/hooks","issue_events_url":"https://api.github.com/repos/dapphub/klab/issues/events{/number}","events_url":"https://api.github.com/repos/dapphub/klab/events","assignees_url":"https://api.github.com/repos/dapphub/klab/assignees{/user}","branches_url":"https://api.github.com/repos/dapphub/klab/branches{/branch}","tags_url":"https://api.github.com/repos/dapphub/klab/tags","blobs_url":"https://api.github.com/repos/dapphub/klab/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dapphub/klab/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dapphub/klab/git/refs{/sha}","trees_url":"https://api.github.com/repos/dapphub/klab/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dapphub/klab/statuses/{sha}","languages_url":"https://api.github.com/repos/dapphub/klab/languages","stargazers_url":"https://api.github.com/repos/dapphub/klab/stargazers","contributors_url":"https://api.github.com/repos/dapphub/klab/contributors","subscribers_url":"https://api.github.com/repos/dapphub/klab/subscribers","subscription_url":"https://api.github.com/repos/dapphub/klab/subscription","commits_url":"https://api.github.com/repos/dapphub/klab/commits{/sha}","git_commits_url":"https://api.github.com/repos/dapphub/klab/git/commits{/sha}","comments_url":"https://api.github.com/repos/dapphub/klab/comments{/number}","issue_comment_url":"https://api.github.com/repos/dapphub/klab/issues/comments{/number}","contents_url":"https://api.github.com/repos/dapphub/klab/contents/{+path}","compare_url":"https://api.github.com/repos/dapphub/klab/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dapphub/klab/merges","archive_url":"https://api.github.com/repos/dapphub/klab/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dapphub/klab/downloads","issues_url":"https://api.github.com/repos/dapphub/klab/issues{/number}","pulls_url":"https://api.github.com/repos/dapphub/klab/pulls{/number}","milestones_url":"https://api.github.com/repos/dapphub/klab/milestones{/number}","notifications_url":"https://api.github.com/repos/dapphub/klab/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dapphub/klab/labels{/name}","releases_url":"https://api.github.com/repos/dapphub/klab/releases{/id}","deployments_url":"https://api.github.com/repos/dapphub/klab/deployments","created_at":"2018-04-23T16:37:14Z","updated_at":"2018-11-27T22:21:50Z","pushed_at":"2018-11-28T15:24:31Z","git_url":"git://github.com/dapphub/klab.git","ssh_url":"git@github.com:dapphub/klab.git","clone_url":"https://github.com/dapphub/klab.git","svn_url":"https://github.com/dapphub/klab","homepage":"","size":1516,"stargazers_count":28,"watchers_count":28,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":15,"license":null,"forks":6,"open_issues":15,"watchers":28,"default_branch":"master"}},"base":{"label":"dapphub:master","ref":"master","sha":"29892c62de2ccb7f9df5cf39ae5c5b68179ef394","user":{"login":"dapphub","id":20761241,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwNzYxMjQx","avatar_url":"https://avatars1.githubusercontent.com/u/20761241?v=4","gravatar_id":"","url":"https://api.github.com/users/dapphub","html_url":"https://github.com/dapphub","followers_url":"https://api.github.com/users/dapphub/followers","following_url":"https://api.github.com/users/dapphub/following{/other_user}","gists_url":"https://api.github.com/users/dapphub/gists{/gist_id}","starred_url":"https://api.github.com/users/dapphub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dapphub/subscriptions","organizations_url":"https://api.github.com/users/dapphub/orgs","repos_url":"https://api.github.com/users/dapphub/repos","events_url":"https://api.github.com/users/dapphub/events{/privacy}","received_events_url":"https://api.github.com/users/dapphub/received_events","type":"Organization","site_admin":false},"repo":{"id":130726822,"node_id":"MDEwOlJlcG9zaXRvcnkxMzA3MjY4MjI=","name":"klab","full_name":"dapphub/klab","private":false,"owner":{"login":"dapphub","id":20761241,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwNzYxMjQx","avatar_url":"https://avatars1.githubusercontent.com/u/20761241?v=4","gravatar_id":"","url":"https://api.github.com/users/dapphub","html_url":"https://github.com/dapphub","followers_url":"https://api.github.com/users/dapphub/followers","following_url":"https://api.github.com/users/dapphub/following{/other_user}","gists_url":"https://api.github.com/users/dapphub/gists{/gist_id}","starred_url":"https://api.github.com/users/dapphub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dapphub/subscriptions","organizations_url":"https://api.github.com/users/dapphub/orgs","repos_url":"https://api.github.com/users/dapphub/repos","events_url":"https://api.github.com/users/dapphub/events{/privacy}","received_events_url":"https://api.github.com/users/dapphub/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/dapphub/klab","description":"K framework proof explorer & smart contract specification format","fork":false,"url":"https://api.github.com/repos/dapphub/klab","forks_url":"https://api.github.com/repos/dapphub/klab/forks","keys_url":"https://api.github.com/repos/dapphub/klab/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dapphub/klab/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dapphub/klab/teams","hooks_url":"https://api.github.com/repos/dapphub/klab/hooks","issue_events_url":"https://api.github.com/repos/dapphub/klab/issues/events{/number}","events_url":"https://api.github.com/repos/dapphub/klab/events","assignees_url":"https://api.github.com/repos/dapphub/klab/assignees{/user}","branches_url":"https://api.github.com/repos/dapphub/klab/branches{/branch}","tags_url":"https://api.github.com/repos/dapphub/klab/tags","blobs_url":"https://api.github.com/repos/dapphub/klab/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dapphub/klab/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dapphub/klab/git/refs{/sha}","trees_url":"https://api.github.com/repos/dapphub/klab/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dapphub/klab/statuses/{sha}","languages_url":"https://api.github.com/repos/dapphub/klab/languages","stargazers_url":"https://api.github.com/repos/dapphub/klab/stargazers","contributors_url":"https://api.github.com/repos/dapphub/klab/contributors","subscribers_url":"https://api.github.com/repos/dapphub/klab/subscribers","subscription_url":"https://api.github.com/repos/dapphub/klab/subscription","commits_url":"https://api.github.com/repos/dapphub/klab/commits{/sha}","git_commits_url":"https://api.github.com/repos/dapphub/klab/git/commits{/sha}","comments_url":"https://api.github.com/repos/dapphub/klab/comments{/number}","issue_comment_url":"https://api.github.com/repos/dapphub/klab/issues/comments{/number}","contents_url":"https://api.github.com/repos/dapphub/klab/contents/{+path}","compare_url":"https://api.github.com/repos/dapphub/klab/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dapphub/klab/merges","archive_url":"https://api.github.com/repos/dapphub/klab/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dapphub/klab/downloads","issues_url":"https://api.github.com/repos/dapphub/klab/issues{/number}","pulls_url":"https://api.github.com/repos/dapphub/klab/pulls{/number}","milestones_url":"https://api.github.com/repos/dapphub/klab/milestones{/number}","notifications_url":"https://api.github.com/repos/dapphub/klab/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dapphub/klab/labels{/name}","releases_url":"https://api.github.com/repos/dapphub/klab/releases{/id}","deployments_url":"https://api.github.com/repos/dapphub/klab/deployments","created_at":"2018-04-23T16:37:14Z","updated_at":"2018-11-27T22:21:50Z","pushed_at":"2018-11-28T15:24:31Z","git_url":"git://github.com/dapphub/klab.git","ssh_url":"git@github.com:dapphub/klab.git","clone_url":"https://github.com/dapphub/klab.git","svn_url":"https://github.com/dapphub/klab","homepage":"","size":1516,"stargazers_count":28,"watchers_count":28,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":15,"license":null,"forks":6,"open_issues":15,"watchers":28,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dapphub/klab/pulls/95"},"html":{"href":"https://github.com/dapphub/klab/pull/95"},"issue":{"href":"https://api.github.com/repos/dapphub/klab/issues/95"},"comments":{"href":"https://api.github.com/repos/dapphub/klab/issues/95/comments"},"review_comments":{"href":"https://api.github.com/repos/dapphub/klab/pulls/95/comments"},"review_comment":{"href":"https://api.github.com/repos/dapphub/klab/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dapphub/klab/pulls/95/commits"},"statuses":{"href":"https://api.github.com/repos/dapphub/klab/statuses/ea433a61e668b488c2eb10e761dbf97fa638e757"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"MrChico"}}