{"action":"opened","number":1264,"pull_request":{"url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/pulls/1264","id":208577755,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA4NTc3NzU1","html_url":"https://github.com/gridcoin-community/Gridcoin-Research/pull/1264","diff_url":"https://github.com/gridcoin-community/Gridcoin-Research/pull/1264.diff","patch_url":"https://github.com/gridcoin-community/Gridcoin-Research/pull/1264.patch","issue_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/issues/1264","number":1264,"state":"open","locked":false,"title":"[PoC] Make LoadAdminMessages redundant","user":{"login":"denravonska","id":135439,"node_id":"MDQ6VXNlcjEzNTQzOQ==","avatar_url":"https://avatars0.githubusercontent.com/u/135439?v=4","gravatar_id":"","url":"https://api.github.com/users/denravonska","html_url":"https://github.com/denravonska","followers_url":"https://api.github.com/users/denravonska/followers","following_url":"https://api.github.com/users/denravonska/following{/other_user}","gists_url":"https://api.github.com/users/denravonska/gists{/gist_id}","starred_url":"https://api.github.com/users/denravonska/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denravonska/subscriptions","organizations_url":"https://api.github.com/users/denravonska/orgs","repos_url":"https://api.github.com/users/denravonska/repos","events_url":"https://api.github.com/users/denravonska/events{/privacy}","received_events_url":"https://api.github.com/users/denravonska/received_events","type":"User","site_admin":false},"body":"This is a proof of concept to remove the LoadAdminMessages calls currently done after reorganizing the chain. It is not meant to be merged in its current state, and it needs to be monitored in terms of RAM consumption. It could also benefit from pruning by age.\r\n\r\nIdea\r\n====\r\nThe basic idea is to store a list of memorized message, one list per message type. When disconnecting a block from the chain we would iterate through the transactions and forget each memorized message stored within those messages.\r\n\r\n```\r\n// Message type. \"beacon\", \"project\", \"poll\" etc.\r\ntypedef std::string MessageType_t;\r\n\r\n// Message key. For example, the CPID in beacons.\r\ntypedef std::string MessageKey_t;\r\n\r\n// Type/key map lookup.\r\ntypedef std::pair<MessageType_t, MessageKey_t> MessagePair_t;\r\n\r\n// Collection of hashes. A more logical type is std::stack as it is just that.\r\ntypedef std::list<uint256> TxHashCollection;\r\n\r\n// Lookup table which connects message types to lists of TX:es\r\nstd::map<MessagePair_t, TxHashCollection> messageTable;\r\n```\r\n\r\nMemorizing messages\r\n=================\r\nMessage memorization is in this PR done on every block as they arrive. We no longer call `LoadAdminMessages` at all which makes this PR incompatible as it is now. The memorization is done the same way as before and, if successful, we append the TX hash to the message type list.\r\n\r\nForgetting messages\r\n================\r\nWhen a message is asked to be forgotten we would check the last message in that particular message list. If the message key mismatches the last entry in the message type list we are somehow out of sync. We can assert here as it normally should not happen. \r\n\r\nA message forget is in this PR just the exact message as before but with the command inverted. Added messages get removed, removed messages get added. On second thought this probably won't work as add/delete use different keys and different data, so this will need to be rewritten.\r\n\r\nForgetting a message pops it from the message list and the topmost message in that list is applied instead.","created_at":"2018-08-15T14:25:08Z","updated_at":"2018-08-15T14:25:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":124521310,"node_id":"MDU6TGFiZWwxMjQ1MjEzMTA=","url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"milestone":null,"commits_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/pulls/1264/commits","review_comments_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/pulls/1264/comments","review_comment_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/issues/1264/comments","statuses_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/statuses/0ad7d2c7f7f8eaf2b79f0b7cf44e0ad276a6d7e0","head":{"label":"denravonska:make-loadadmin-redundant","ref":"make-loadadmin-redundant","sha":"0ad7d2c7f7f8eaf2b79f0b7cf44e0ad276a6d7e0","user":{"login":"denravonska","id":135439,"node_id":"MDQ6VXNlcjEzNTQzOQ==","avatar_url":"https://avatars0.githubusercontent.com/u/135439?v=4","gravatar_id":"","url":"https://api.github.com/users/denravonska","html_url":"https://github.com/denravonska","followers_url":"https://api.github.com/users/denravonska/followers","following_url":"https://api.github.com/users/denravonska/following{/other_user}","gists_url":"https://api.github.com/users/denravonska/gists{/gist_id}","starred_url":"https://api.github.com/users/denravonska/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denravonska/subscriptions","organizations_url":"https://api.github.com/users/denravonska/orgs","repos_url":"https://api.github.com/users/denravonska/repos","events_url":"https://api.github.com/users/denravonska/events{/privacy}","received_events_url":"https://api.github.com/users/denravonska/received_events","type":"User","site_admin":false},"repo":{"id":75178327,"node_id":"MDEwOlJlcG9zaXRvcnk3NTE3ODMyNw==","name":"Gridcoin-Research","full_name":"denravonska/Gridcoin-Research","owner":{"login":"denravonska","id":135439,"node_id":"MDQ6VXNlcjEzNTQzOQ==","avatar_url":"https://avatars0.githubusercontent.com/u/135439?v=4","gravatar_id":"","url":"https://api.github.com/users/denravonska","html_url":"https://github.com/denravonska","followers_url":"https://api.github.com/users/denravonska/followers","following_url":"https://api.github.com/users/denravonska/following{/other_user}","gists_url":"https://api.github.com/users/denravonska/gists{/gist_id}","starred_url":"https://api.github.com/users/denravonska/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denravonska/subscriptions","organizations_url":"https://api.github.com/users/denravonska/orgs","repos_url":"https://api.github.com/users/denravonska/repos","events_url":"https://api.github.com/users/denravonska/events{/privacy}","received_events_url":"https://api.github.com/users/denravonska/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/denravonska/Gridcoin-Research","description":"Gridcoin-Research","fork":true,"url":"https://api.github.com/repos/denravonska/Gridcoin-Research","forks_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/forks","keys_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/keys{/key_id}","collaborators_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/teams","hooks_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/hooks","issue_events_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/issues/events{/number}","events_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/events","assignees_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/assignees{/user}","branches_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/branches{/branch}","tags_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/tags","blobs_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/git/refs{/sha}","trees_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/git/trees{/sha}","statuses_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/statuses/{sha}","languages_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/languages","stargazers_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/stargazers","contributors_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/contributors","subscribers_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/subscribers","subscription_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/subscription","commits_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/commits{/sha}","git_commits_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/git/commits{/sha}","comments_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/comments{/number}","issue_comment_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/issues/comments{/number}","contents_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/contents/{+path}","compare_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/compare/{base}...{head}","merges_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/merges","archive_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/downloads","issues_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/issues{/number}","pulls_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/pulls{/number}","milestones_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/milestones{/number}","notifications_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/labels{/name}","releases_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/releases{/id}","deployments_url":"https://api.github.com/repos/denravonska/Gridcoin-Research/deployments","created_at":"2016-11-30T10:53:48Z","updated_at":"2018-05-26T15:12:22Z","pushed_at":"2018-08-15T14:15:49Z","git_url":"git://github.com/denravonska/Gridcoin-Research.git","ssh_url":"git@github.com:denravonska/Gridcoin-Research.git","clone_url":"https://github.com/denravonska/Gridcoin-Research.git","svn_url":"https://github.com/denravonska/Gridcoin-Research","homepage":null,"size":266130,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"gridcoin-community:development","ref":"development","sha":"502b36f945e3f97c1dd8c4ac1437e9abff2d7d7c","user":{"login":"gridcoin-community","id":25387063,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI1Mzg3MDYz","avatar_url":"https://avatars2.githubusercontent.com/u/25387063?v=4","gravatar_id":"","url":"https://api.github.com/users/gridcoin-community","html_url":"https://github.com/gridcoin-community","followers_url":"https://api.github.com/users/gridcoin-community/followers","following_url":"https://api.github.com/users/gridcoin-community/following{/other_user}","gists_url":"https://api.github.com/users/gridcoin-community/gists{/gist_id}","starred_url":"https://api.github.com/users/gridcoin-community/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gridcoin-community/subscriptions","organizations_url":"https://api.github.com/users/gridcoin-community/orgs","repos_url":"https://api.github.com/users/gridcoin-community/repos","events_url":"https://api.github.com/users/gridcoin-community/events{/privacy}","received_events_url":"https://api.github.com/users/gridcoin-community/received_events","type":"Organization","site_admin":false},"repo":{"id":23332350,"node_id":"MDEwOlJlcG9zaXRvcnkyMzMzMjM1MA==","name":"Gridcoin-Research","full_name":"gridcoin-community/Gridcoin-Research","owner":{"login":"gridcoin-community","id":25387063,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI1Mzg3MDYz","avatar_url":"https://avatars2.githubusercontent.com/u/25387063?v=4","gravatar_id":"","url":"https://api.github.com/users/gridcoin-community","html_url":"https://github.com/gridcoin-community","followers_url":"https://api.github.com/users/gridcoin-community/followers","following_url":"https://api.github.com/users/gridcoin-community/following{/other_user}","gists_url":"https://api.github.com/users/gridcoin-community/gists{/gist_id}","starred_url":"https://api.github.com/users/gridcoin-community/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gridcoin-community/subscriptions","organizations_url":"https://api.github.com/users/gridcoin-community/orgs","repos_url":"https://api.github.com/users/gridcoin-community/repos","events_url":"https://api.github.com/users/gridcoin-community/events{/privacy}","received_events_url":"https://api.github.com/users/gridcoin-community/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gridcoin-community/Gridcoin-Research","description":"Gridcoin-Research","fork":false,"url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research","forks_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/forks","keys_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/teams","hooks_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/hooks","issue_events_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/issues/events{/number}","events_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/events","assignees_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/assignees{/user}","branches_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/branches{/branch}","tags_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/tags","blobs_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/git/refs{/sha}","trees_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/statuses/{sha}","languages_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/languages","stargazers_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/stargazers","contributors_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/contributors","subscribers_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/subscribers","subscription_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/subscription","commits_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/commits{/sha}","git_commits_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/git/commits{/sha}","comments_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/comments{/number}","issue_comment_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/issues/comments{/number}","contents_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/contents/{+path}","compare_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/merges","archive_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/downloads","issues_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/issues{/number}","pulls_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/pulls{/number}","milestones_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/milestones{/number}","notifications_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/labels{/name}","releases_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/releases{/id}","deployments_url":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/deployments","created_at":"2014-08-25T23:41:04Z","updated_at":"2018-08-06T09:32:30Z","pushed_at":"2018-08-14T23:56:00Z","git_url":"git://github.com/gridcoin-community/Gridcoin-Research.git","ssh_url":"git@github.com:gridcoin-community/Gridcoin-Research.git","clone_url":"https://github.com/gridcoin-community/Gridcoin-Research.git","svn_url":"https://github.com/gridcoin-community/Gridcoin-Research","homepage":null,"size":252616,"stargazers_count":350,"watchers_count":350,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":155,"mirror_url":null,"archived":false,"open_issues_count":212,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":155,"open_issues":212,"watchers":350,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/pulls/1264"},"html":{"href":"https://github.com/gridcoin-community/Gridcoin-Research/pull/1264"},"issue":{"href":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/issues/1264"},"comments":{"href":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/issues/1264/comments"},"review_comments":{"href":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/pulls/1264/comments"},"review_comment":{"href":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/pulls/1264/commits"},"statuses":{"href":"https://api.github.com/repos/gridcoin-community/Gridcoin-Research/statuses/0ad7d2c7f7f8eaf2b79f0b7cf44e0ad276a6d7e0"}},"author_association":"COLLABORATOR","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":6,"additions":193,"deletions":116,"changed_files":4}}
{"actor":{"display_login":"denravonska"}}