{"action":"created","comment":{"url":"https://api.github.com/repos/ripple/rippled/pulls/comments/83455656","pull_request_review_id":4298662,"id":83455656,"diff_hunk":"@@ -0,0 +1,211 @@\n+//------------------------------------------------------------------------------\n+/*\n+    This file is part of rippled: https://github.com/ripple/rippled\n+    Copyright (c) 2016 Ripple Labs Inc.\n+\n+    Permission to use, copy, modify, and/or distribute this software for any\n+    purpose  with  or without fee is hereby granted, provided that the above\n+    copyright notice and this permission notice appear in all copies.\n+\n+    THE  SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n+    WITH  REGARD  TO  THIS  SOFTWARE  INCLUDING  ALL  IMPLIED  WARRANTIES  OF\n+    MERCHANTABILITY  AND  FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n+    ANY  SPECIAL ,  DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n+    WHATSOEVER  RESULTING  FROM  LOSS  OF USE, DATA OR PROFITS, WHETHER IN AN\n+    ACTION  OF  CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n+    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n+*/\n+//==============================================================================\n+\n+#include <ripple/conditions/condition.h>\n+#include <ripple/conditions/fulfillment.h>\n+#include <ripple/conditions/hashlock.h>\n+#include <ripple/conditions/prefix_sha256.h>\n+#include <ripple/conditions/ed25519.h>\n+#include <ripple/conditions/rsa_sha256.h>\n+#include <ripple/conditions/impl/utils.h>\n+#include <boost/regex.hpp>\n+#include <boost/optional.hpp>\n+#include <type_traits>\n+#include <vector>\n+\n+namespace ripple {\n+namespace cryptoconditions {\n+\n+bool\n+fulfills (\n+    fulfillment_t const& f,\n+    condition_t const& c)\n+{\n+    // Fast check: the fulfillment's type must match the\n+    // conditions's type:\n+    if (f.type() != c.type)\n+        return false;\n+\n+    return f.condition() == c;\n+}\n+\n+bool\n+validate (\n+    fulfillment_t const& f,\n+    condition_t const& c,\n+    Slice const& m)\n+{\n+    if (!fulfills (f, c))\n+        return false;\n+\n+    // Check if the message validates:\n+    return f.validate (m);","path":"src/ripple/conditions/impl/fulfillment.cpp","position":58,"original_position":58,"commit_id":"98a2649cd8fc14df4e1291396cc2cf08b2c773a8","original_commit_id":"98a2649cd8fc14df4e1291396cc2cf08b2c773a8","user":{"login":"seelabs","id":5853458,"avatar_url":"https://avatars.githubusercontent.com/u/5853458?v=3","gravatar_id":"","url":"https://api.github.com/users/seelabs","html_url":"https://github.com/seelabs","followers_url":"https://api.github.com/users/seelabs/followers","following_url":"https://api.github.com/users/seelabs/following{/other_user}","gists_url":"https://api.github.com/users/seelabs/gists{/gist_id}","starred_url":"https://api.github.com/users/seelabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seelabs/subscriptions","organizations_url":"https://api.github.com/users/seelabs/orgs","repos_url":"https://api.github.com/users/seelabs/repos","events_url":"https://api.github.com/users/seelabs/events{/privacy}","received_events_url":"https://api.github.com/users/seelabs/received_events","type":"User","site_admin":false},"body":"Could simplify to `fulfills(f,c) && f.validate(m)`","created_at":"2016-10-14T16:23:56Z","updated_at":"2016-10-14T16:32:18Z","html_url":"https://github.com/ripple/rippled/pull/1872#discussion_r83455656","pull_request_url":"https://api.github.com/repos/ripple/rippled/pulls/1872","_links":{"self":{"href":"https://api.github.com/repos/ripple/rippled/pulls/comments/83455656"},"html":{"href":"https://github.com/ripple/rippled/pull/1872#discussion_r83455656"},"pull_request":{"href":"https://api.github.com/repos/ripple/rippled/pulls/1872"}}},"pull_request":{"url":"https://api.github.com/repos/ripple/rippled/pulls/1872","id":89322659,"html_url":"https://github.com/ripple/rippled/pull/1872","diff_url":"https://github.com/ripple/rippled/pull/1872.diff","patch_url":"https://github.com/ripple/rippled/pull/1872.patch","issue_url":"https://api.github.com/repos/ripple/rippled/issues/1872","number":1872,"state":"open","locked":false,"title":"Cryptoconditions Framework (RIPD-1139)","user":{"login":"nbougalis","id":5085415,"avatar_url":"https://avatars.githubusercontent.com/u/5085415?v=3","gravatar_id":"","url":"https://api.github.com/users/nbougalis","html_url":"https://github.com/nbougalis","followers_url":"https://api.github.com/users/nbougalis/followers","following_url":"https://api.github.com/users/nbougalis/following{/other_user}","gists_url":"https://api.github.com/users/nbougalis/gists{/gist_id}","starred_url":"https://api.github.com/users/nbougalis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbougalis/subscriptions","organizations_url":"https://api.github.com/users/nbougalis/orgs","repos_url":"https://api.github.com/users/nbougalis/repos","events_url":"https://api.github.com/users/nbougalis/events{/privacy}","received_events_url":"https://api.github.com/users/nbougalis/received_events","type":"User","site_admin":false},"body":"Cryptoconditions provide a mechanism to describe a signed message such\r\nthat multiple actors in a distributed system can all verify the same\r\nsigned message and agree on whether it matches the description. This\r\nprovides a useful primitive for event-based systems that are distributed\r\non the Internet since we can describe events in a standard deterministic\r\nmanner (represented by signed messages) and therefore define generic\r\nauthenticated event handlers.\r\n\r\nThe cryptoconditions specification is available at:\r\n    https://interledger.org/five-bells-condition/spec.html\r\n\r\nThis PR includes PREIMAGE-SHA-256 (RIPD-1210), PREFIX-SHA-256 (RIPD-1211), RSA-SHA-256 (RIPD-1213) and ED25519 (RIPD-1214).","created_at":"2016-10-14T04:23:01Z","updated_at":"2016-10-14T16:32:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"674f88402082810de104888b6132e0e5ca976dd0","assignee":{"login":"JoelKatz","id":877549,"avatar_url":"https://avatars.githubusercontent.com/u/877549?v=3","gravatar_id":"","url":"https://api.github.com/users/JoelKatz","html_url":"https://github.com/JoelKatz","followers_url":"https://api.github.com/users/JoelKatz/followers","following_url":"https://api.github.com/users/JoelKatz/following{/other_user}","gists_url":"https://api.github.com/users/JoelKatz/gists{/gist_id}","starred_url":"https://api.github.com/users/JoelKatz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoelKatz/subscriptions","organizations_url":"https://api.github.com/users/JoelKatz/orgs","repos_url":"https://api.github.com/users/JoelKatz/repos","events_url":"https://api.github.com/users/JoelKatz/events{/privacy}","received_events_url":"https://api.github.com/users/JoelKatz/received_events","type":"User","site_admin":false},"assignees":[{"login":"JoelKatz","id":877549,"avatar_url":"https://avatars.githubusercontent.com/u/877549?v=3","gravatar_id":"","url":"https://api.github.com/users/JoelKatz","html_url":"https://github.com/JoelKatz","followers_url":"https://api.github.com/users/JoelKatz/followers","following_url":"https://api.github.com/users/JoelKatz/following{/other_user}","gists_url":"https://api.github.com/users/JoelKatz/gists{/gist_id}","starred_url":"https://api.github.com/users/JoelKatz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoelKatz/subscriptions","organizations_url":"https://api.github.com/users/JoelKatz/orgs","repos_url":"https://api.github.com/users/JoelKatz/repos","events_url":"https://api.github.com/users/JoelKatz/events{/privacy}","received_events_url":"https://api.github.com/users/JoelKatz/received_events","type":"User","site_admin":false},{"login":"vinniefalco","id":1503976,"avatar_url":"https://avatars.githubusercontent.com/u/1503976?v=3","gravatar_id":"","url":"https://api.github.com/users/vinniefalco","html_url":"https://github.com/vinniefalco","followers_url":"https://api.github.com/users/vinniefalco/followers","following_url":"https://api.github.com/users/vinniefalco/following{/other_user}","gists_url":"https://api.github.com/users/vinniefalco/gists{/gist_id}","starred_url":"https://api.github.com/users/vinniefalco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vinniefalco/subscriptions","organizations_url":"https://api.github.com/users/vinniefalco/orgs","repos_url":"https://api.github.com/users/vinniefalco/repos","events_url":"https://api.github.com/users/vinniefalco/events{/privacy}","received_events_url":"https://api.github.com/users/vinniefalco/received_events","type":"User","site_admin":false},{"login":"seelabs","id":5853458,"avatar_url":"https://avatars.githubusercontent.com/u/5853458?v=3","gravatar_id":"","url":"https://api.github.com/users/seelabs","html_url":"https://github.com/seelabs","followers_url":"https://api.github.com/users/seelabs/followers","following_url":"https://api.github.com/users/seelabs/following{/other_user}","gists_url":"https://api.github.com/users/seelabs/gists{/gist_id}","starred_url":"https://api.github.com/users/seelabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seelabs/subscriptions","organizations_url":"https://api.github.com/users/seelabs/orgs","repos_url":"https://api.github.com/users/seelabs/repos","events_url":"https://api.github.com/users/seelabs/events{/privacy}","received_events_url":"https://api.github.com/users/seelabs/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ripple/rippled/pulls/1872/commits","review_comments_url":"https://api.github.com/repos/ripple/rippled/pulls/1872/comments","review_comment_url":"https://api.github.com/repos/ripple/rippled/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ripple/rippled/issues/1872/comments","statuses_url":"https://api.github.com/repos/ripple/rippled/statuses/98a2649cd8fc14df4e1291396cc2cf08b2c773a8","head":{"label":"nbougalis:cc","ref":"cc","sha":"98a2649cd8fc14df4e1291396cc2cf08b2c773a8","user":{"login":"nbougalis","id":5085415,"avatar_url":"https://avatars.githubusercontent.com/u/5085415?v=3","gravatar_id":"","url":"https://api.github.com/users/nbougalis","html_url":"https://github.com/nbougalis","followers_url":"https://api.github.com/users/nbougalis/followers","following_url":"https://api.github.com/users/nbougalis/following{/other_user}","gists_url":"https://api.github.com/users/nbougalis/gists{/gist_id}","starred_url":"https://api.github.com/users/nbougalis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbougalis/subscriptions","organizations_url":"https://api.github.com/users/nbougalis/orgs","repos_url":"https://api.github.com/users/nbougalis/repos","events_url":"https://api.github.com/users/nbougalis/events{/privacy}","received_events_url":"https://api.github.com/users/nbougalis/received_events","type":"User","site_admin":false},"repo":{"id":12092814,"name":"rippled","full_name":"nbougalis/rippled","owner":{"login":"nbougalis","id":5085415,"avatar_url":"https://avatars.githubusercontent.com/u/5085415?v=3","gravatar_id":"","url":"https://api.github.com/users/nbougalis","html_url":"https://github.com/nbougalis","followers_url":"https://api.github.com/users/nbougalis/followers","following_url":"https://api.github.com/users/nbougalis/following{/other_user}","gists_url":"https://api.github.com/users/nbougalis/gists{/gist_id}","starred_url":"https://api.github.com/users/nbougalis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbougalis/subscriptions","organizations_url":"https://api.github.com/users/nbougalis/orgs","repos_url":"https://api.github.com/users/nbougalis/repos","events_url":"https://api.github.com/users/nbougalis/events{/privacy}","received_events_url":"https://api.github.com/users/nbougalis/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nbougalis/rippled","description":"Ripple peer-to-peer network daemon","fork":true,"url":"https://api.github.com/repos/nbougalis/rippled","forks_url":"https://api.github.com/repos/nbougalis/rippled/forks","keys_url":"https://api.github.com/repos/nbougalis/rippled/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nbougalis/rippled/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nbougalis/rippled/teams","hooks_url":"https://api.github.com/repos/nbougalis/rippled/hooks","issue_events_url":"https://api.github.com/repos/nbougalis/rippled/issues/events{/number}","events_url":"https://api.github.com/repos/nbougalis/rippled/events","assignees_url":"https://api.github.com/repos/nbougalis/rippled/assignees{/user}","branches_url":"https://api.github.com/repos/nbougalis/rippled/branches{/branch}","tags_url":"https://api.github.com/repos/nbougalis/rippled/tags","blobs_url":"https://api.github.com/repos/nbougalis/rippled/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nbougalis/rippled/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nbougalis/rippled/git/refs{/sha}","trees_url":"https://api.github.com/repos/nbougalis/rippled/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nbougalis/rippled/statuses/{sha}","languages_url":"https://api.github.com/repos/nbougalis/rippled/languages","stargazers_url":"https://api.github.com/repos/nbougalis/rippled/stargazers","contributors_url":"https://api.github.com/repos/nbougalis/rippled/contributors","subscribers_url":"https://api.github.com/repos/nbougalis/rippled/subscribers","subscription_url":"https://api.github.com/repos/nbougalis/rippled/subscription","commits_url":"https://api.github.com/repos/nbougalis/rippled/commits{/sha}","git_commits_url":"https://api.github.com/repos/nbougalis/rippled/git/commits{/sha}","comments_url":"https://api.github.com/repos/nbougalis/rippled/comments{/number}","issue_comment_url":"https://api.github.com/repos/nbougalis/rippled/issues/comments{/number}","contents_url":"https://api.github.com/repos/nbougalis/rippled/contents/{+path}","compare_url":"https://api.github.com/repos/nbougalis/rippled/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nbougalis/rippled/merges","archive_url":"https://api.github.com/repos/nbougalis/rippled/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nbougalis/rippled/downloads","issues_url":"https://api.github.com/repos/nbougalis/rippled/issues{/number}","pulls_url":"https://api.github.com/repos/nbougalis/rippled/pulls{/number}","milestones_url":"https://api.github.com/repos/nbougalis/rippled/milestones{/number}","notifications_url":"https://api.github.com/repos/nbougalis/rippled/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nbougalis/rippled/labels{/name}","releases_url":"https://api.github.com/repos/nbougalis/rippled/releases{/id}","deployments_url":"https://api.github.com/repos/nbougalis/rippled/deployments","created_at":"2013-08-13T20:58:04Z","updated_at":"2015-05-06T20:28:38Z","pushed_at":"2016-10-14T06:11:31Z","git_url":"git://github.com/nbougalis/rippled.git","ssh_url":"git@github.com:nbougalis/rippled.git","clone_url":"https://github.com/nbougalis/rippled.git","svn_url":"https://github.com/nbougalis/rippled","homepage":"https://ripple.com","size":78448,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop-next"}},"base":{"label":"ripple:develop","ref":"develop","sha":"aa11effdd6eec8457bfea849cbf0b3f429c0cd77","user":{"login":"ripple","id":3165523,"avatar_url":"https://avatars.githubusercontent.com/u/3165523?v=3","gravatar_id":"","url":"https://api.github.com/users/ripple","html_url":"https://github.com/ripple","followers_url":"https://api.github.com/users/ripple/followers","following_url":"https://api.github.com/users/ripple/following{/other_user}","gists_url":"https://api.github.com/users/ripple/gists{/gist_id}","starred_url":"https://api.github.com/users/ripple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ripple/subscriptions","organizations_url":"https://api.github.com/users/ripple/orgs","repos_url":"https://api.github.com/users/ripple/repos","events_url":"https://api.github.com/users/ripple/events{/privacy}","received_events_url":"https://api.github.com/users/ripple/received_events","type":"Organization","site_admin":false},"repo":{"id":2724167,"name":"rippled","full_name":"ripple/rippled","owner":{"login":"ripple","id":3165523,"avatar_url":"https://avatars.githubusercontent.com/u/3165523?v=3","gravatar_id":"","url":"https://api.github.com/users/ripple","html_url":"https://github.com/ripple","followers_url":"https://api.github.com/users/ripple/followers","following_url":"https://api.github.com/users/ripple/following{/other_user}","gists_url":"https://api.github.com/users/ripple/gists{/gist_id}","starred_url":"https://api.github.com/users/ripple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ripple/subscriptions","organizations_url":"https://api.github.com/users/ripple/orgs","repos_url":"https://api.github.com/users/ripple/repos","events_url":"https://api.github.com/users/ripple/events{/privacy}","received_events_url":"https://api.github.com/users/ripple/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ripple/rippled","description":"Decentralized cryptocurrency blockchain daemon implementing the Ripple Consensus Ledger in C++","fork":false,"url":"https://api.github.com/repos/ripple/rippled","forks_url":"https://api.github.com/repos/ripple/rippled/forks","keys_url":"https://api.github.com/repos/ripple/rippled/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ripple/rippled/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ripple/rippled/teams","hooks_url":"https://api.github.com/repos/ripple/rippled/hooks","issue_events_url":"https://api.github.com/repos/ripple/rippled/issues/events{/number}","events_url":"https://api.github.com/repos/ripple/rippled/events","assignees_url":"https://api.github.com/repos/ripple/rippled/assignees{/user}","branches_url":"https://api.github.com/repos/ripple/rippled/branches{/branch}","tags_url":"https://api.github.com/repos/ripple/rippled/tags","blobs_url":"https://api.github.com/repos/ripple/rippled/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ripple/rippled/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ripple/rippled/git/refs{/sha}","trees_url":"https://api.github.com/repos/ripple/rippled/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ripple/rippled/statuses/{sha}","languages_url":"https://api.github.com/repos/ripple/rippled/languages","stargazers_url":"https://api.github.com/repos/ripple/rippled/stargazers","contributors_url":"https://api.github.com/repos/ripple/rippled/contributors","subscribers_url":"https://api.github.com/repos/ripple/rippled/subscribers","subscription_url":"https://api.github.com/repos/ripple/rippled/subscription","commits_url":"https://api.github.com/repos/ripple/rippled/commits{/sha}","git_commits_url":"https://api.github.com/repos/ripple/rippled/git/commits{/sha}","comments_url":"https://api.github.com/repos/ripple/rippled/comments{/number}","issue_comment_url":"https://api.github.com/repos/ripple/rippled/issues/comments{/number}","contents_url":"https://api.github.com/repos/ripple/rippled/contents/{+path}","compare_url":"https://api.github.com/repos/ripple/rippled/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ripple/rippled/merges","archive_url":"https://api.github.com/repos/ripple/rippled/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ripple/rippled/downloads","issues_url":"https://api.github.com/repos/ripple/rippled/issues{/number}","pulls_url":"https://api.github.com/repos/ripple/rippled/pulls{/number}","milestones_url":"https://api.github.com/repos/ripple/rippled/milestones{/number}","notifications_url":"https://api.github.com/repos/ripple/rippled/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ripple/rippled/labels{/name}","releases_url":"https://api.github.com/repos/ripple/rippled/releases{/id}","deployments_url":"https://api.github.com/repos/ripple/rippled/deployments","created_at":"2011-11-07T04:40:15Z","updated_at":"2016-10-14T02:45:03Z","pushed_at":"2016-10-14T16:09:48Z","git_url":"git://github.com/ripple/rippled.git","ssh_url":"git@github.com:ripple/rippled.git","clone_url":"https://github.com/ripple/rippled.git","svn_url":"https://github.com/ripple/rippled","homepage":"https://ripple.com","size":131826,"stargazers_count":1162,"watchers_count":1162,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":360,"mirror_url":null,"open_issues_count":119,"forks":360,"open_issues":119,"watchers":1162,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/ripple/rippled/pulls/1872"},"html":{"href":"https://github.com/ripple/rippled/pull/1872"},"issue":{"href":"https://api.github.com/repos/ripple/rippled/issues/1872"},"comments":{"href":"https://api.github.com/repos/ripple/rippled/issues/1872/comments"},"review_comments":{"href":"https://api.github.com/repos/ripple/rippled/pulls/1872/comments"},"review_comment":{"href":"https://api.github.com/repos/ripple/rippled/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ripple/rippled/pulls/1872/commits"},"statuses":{"href":"https://api.github.com/repos/ripple/rippled/statuses/98a2649cd8fc14df4e1291396cc2cf08b2c773a8"}}}}
{"actor":{"display_login":"seelabs"}}