{"action":"created","comment":{"url":"https://api.github.com/repos/JeremyRubin/stellar-core/pulls/comments/141109237","pull_request_review_id":65276621,"id":141109237,"diff_hunk":"@@ -0,0 +1,101 @@\n+// Copyright 2017 Stellar Development Foundation and contributors. Licensed\n+// under the Apache License, Version 2.0. See the COPYING file at the root\n+// of this distribution or at http://www.apache.org/licenses/LICENSE-2.0\n+\n+#include \"transactions/BumpSequenceOpFrame.h\"\n+#include \"transactions/TransactionFrame.h\"\n+#include \"crypto/SignerKey.h\"\n+#include \"database/Database.h\"\n+#include \"main/Application.h\"\n+#include \"medida/meter.h\"\n+#include \"medida/metrics_registry.h\"\n+\n+namespace stellar\n+{\n+using xdr::operator==;\n+\n+\n+BumpSequenceOpFrame::BumpSequenceOpFrame(Operation const& op, OperationResult& res,\n+                                     TransactionFrame& parentTx)\n+    : OperationFrame(op, res, parentTx)\n+    , mBumpSequence(mOperation.body.bumpSequenceOp())\n+{\n+}\n+\n+ThresholdLevel\n+BumpSequenceOpFrame::getThresholdLevel() const\n+{\n+    // bumping sequence is low threshold\n+    return ThresholdLevel::LOW;\n+}\n+\n+bool\n+BumpSequenceOpFrame::doApply(Application& app, LedgerDelta& delta,\n+                           LedgerManager& ledgerManager)\n+{\n+    // sourceAccount guaranteed to exist as precondition to calling doApply.\n+    AccountFrame& bumpAccount = getSourceAccount();\n+\n+    SequenceNumber current = bumpAccount.getSeqNum();\n+    // fail if the current sequence is not in the allowed range (inclusive)\n+    if (mBumpSequence.range && (current < mBumpSequence.range->min || current > mBumpSequence.range->max)) {\n+        app.getMetrics()\n+            .NewMeter({\"op-bump-sequence\", \"failure\", \"out-of-range\"},\n+                    \"operation\")\n+            .Mark();\n+        innerResult().code(BUMP_SEQ_OUT_OF_RANGE);\n+        return false;\n+    }\n+\n+    // Apply the bump (bump succeeds silently if bumpTo < current)\n+    bumpAccount.setSeqNum(std::max(mBumpSequence.bumpTo, current));\n+    bumpAccount.storeChange(delta, ledgerManager.getDatabase());\n+\n+    // Return successful results\n+    innerResult().code(BUMP_SEQ_SUCCESS);\n+    app.getMetrics()\n+        .NewMeter({\"op-bump-sequence\", \"success\", \"apply\"}, \"operation\")\n+        .Mark();\n+    return true;\n+}\n+\n+bool\n+BumpSequenceOpFrame::doCheckValid(Application& app)\n+{\n+    if (app.getLedgerManager().getCurrentLedgerVersion() < 9)\n+    {\n+        app.getMetrics()\n+            .NewMeter({\"op-bump-sequence\", \"failure\", \"not-supported-yet\"},\n+                    \"operation\")\n+            .Mark();\n+        innerResult().code(BUMP_SEQ_NOT_SUPPORTED_YET);\n+        return false;\n+    }\n+\n+    // Check that we aren't self-bumping\n+    if (mParentTx.getEnvelope().tx.sourceAccount == getSourceID()) {","path":"src/transactions/BumpSequenceOpFrame.cpp","position":76,"original_position":76,"commit_id":"83d07b20305cb64cdd380b432e3ca10a8ab01709","original_commit_id":"83d07b20305cb64cdd380b432e3ca10a8ab01709","user":{"login":"MonsieurNicolas","id":4213763,"avatar_url":"https://avatars3.githubusercontent.com/u/4213763?v=4","gravatar_id":"","url":"https://api.github.com/users/MonsieurNicolas","html_url":"https://github.com/MonsieurNicolas","followers_url":"https://api.github.com/users/MonsieurNicolas/followers","following_url":"https://api.github.com/users/MonsieurNicolas/following{/other_user}","gists_url":"https://api.github.com/users/MonsieurNicolas/gists{/gist_id}","starred_url":"https://api.github.com/users/MonsieurNicolas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MonsieurNicolas/subscriptions","organizations_url":"https://api.github.com/users/MonsieurNicolas/orgs","repos_url":"https://api.github.com/users/MonsieurNicolas/repos","events_url":"https://api.github.com/users/MonsieurNicolas/events{/privacy}","received_events_url":"https://api.github.com/users/MonsieurNicolas/received_events","type":"User","site_admin":false},"body":"why aren't we allowing self-bumping?","created_at":"2017-09-26T16:24:09Z","updated_at":"2017-09-26T16:24:09Z","html_url":"https://github.com/JeremyRubin/stellar-core/pull/1#discussion_r141109237","pull_request_url":"https://api.github.com/repos/JeremyRubin/stellar-core/pulls/1","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/JeremyRubin/stellar-core/pulls/comments/141109237"},"html":{"href":"https://github.com/JeremyRubin/stellar-core/pull/1#discussion_r141109237"},"pull_request":{"href":"https://api.github.com/repos/JeremyRubin/stellar-core/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/JeremyRubin/stellar-core/pulls/1","id":142652446,"html_url":"https://github.com/JeremyRubin/stellar-core/pull/1","diff_url":"https://github.com/JeremyRubin/stellar-core/pull/1.diff","patch_url":"https://github.com/JeremyRubin/stellar-core/pull/1.patch","issue_url":"https://api.github.com/repos/JeremyRubin/stellar-core/issues/1","number":1,"state":"open","locked":false,"title":"Add the BumpSequence Operation & Tests","user":{"login":"JeremyRubin","id":886523,"avatar_url":"https://avatars0.githubusercontent.com/u/886523?v=4","gravatar_id":"","url":"https://api.github.com/users/JeremyRubin","html_url":"https://github.com/JeremyRubin","followers_url":"https://api.github.com/users/JeremyRubin/followers","following_url":"https://api.github.com/users/JeremyRubin/following{/other_user}","gists_url":"https://api.github.com/users/JeremyRubin/gists{/gist_id}","starred_url":"https://api.github.com/users/JeremyRubin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JeremyRubin/subscriptions","organizations_url":"https://api.github.com/users/JeremyRubin/orgs","repos_url":"https://api.github.com/users/JeremyRubin/repos","events_url":"https://api.github.com/users/JeremyRubin/events{/privacy}","received_events_url":"https://api.github.com/users/JeremyRubin/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-09-22T19:28:59Z","updated_at":"2017-09-26T16:24:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/JeremyRubin/stellar-core/pulls/1/commits","review_comments_url":"https://api.github.com/repos/JeremyRubin/stellar-core/pulls/1/comments","review_comment_url":"https://api.github.com/repos/JeremyRubin/stellar-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JeremyRubin/stellar-core/issues/1/comments","statuses_url":"https://api.github.com/repos/JeremyRubin/stellar-core/statuses/83d07b20305cb64cdd380b432e3ca10a8ab01709","head":{"label":"JeremyRubin:bumpseq","ref":"bumpseq","sha":"83d07b20305cb64cdd380b432e3ca10a8ab01709","user":{"login":"JeremyRubin","id":886523,"avatar_url":"https://avatars0.githubusercontent.com/u/886523?v=4","gravatar_id":"","url":"https://api.github.com/users/JeremyRubin","html_url":"https://github.com/JeremyRubin","followers_url":"https://api.github.com/users/JeremyRubin/followers","following_url":"https://api.github.com/users/JeremyRubin/following{/other_user}","gists_url":"https://api.github.com/users/JeremyRubin/gists{/gist_id}","starred_url":"https://api.github.com/users/JeremyRubin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JeremyRubin/subscriptions","organizations_url":"https://api.github.com/users/JeremyRubin/orgs","repos_url":"https://api.github.com/users/JeremyRubin/repos","events_url":"https://api.github.com/users/JeremyRubin/events{/privacy}","received_events_url":"https://api.github.com/users/JeremyRubin/received_events","type":"User","site_admin":false},"repo":{"id":104413050,"name":"stellar-core","full_name":"JeremyRubin/stellar-core","owner":{"login":"JeremyRubin","id":886523,"avatar_url":"https://avatars0.githubusercontent.com/u/886523?v=4","gravatar_id":"","url":"https://api.github.com/users/JeremyRubin","html_url":"https://github.com/JeremyRubin","followers_url":"https://api.github.com/users/JeremyRubin/followers","following_url":"https://api.github.com/users/JeremyRubin/following{/other_user}","gists_url":"https://api.github.com/users/JeremyRubin/gists{/gist_id}","starred_url":"https://api.github.com/users/JeremyRubin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JeremyRubin/subscriptions","organizations_url":"https://api.github.com/users/JeremyRubin/orgs","repos_url":"https://api.github.com/users/JeremyRubin/repos","events_url":"https://api.github.com/users/JeremyRubin/events{/privacy}","received_events_url":"https://api.github.com/users/JeremyRubin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JeremyRubin/stellar-core","description":"stellar-core is the backbone of the Stellar network. It maintains a local copy of the ledger, communicating and staying in sync with other instances of stellar-core on the network. Optionally, stellar-core can store historical records of the ledger and participate in consensus.","fork":true,"url":"https://api.github.com/repos/JeremyRubin/stellar-core","forks_url":"https://api.github.com/repos/JeremyRubin/stellar-core/forks","keys_url":"https://api.github.com/repos/JeremyRubin/stellar-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JeremyRubin/stellar-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JeremyRubin/stellar-core/teams","hooks_url":"https://api.github.com/repos/JeremyRubin/stellar-core/hooks","issue_events_url":"https://api.github.com/repos/JeremyRubin/stellar-core/issues/events{/number}","events_url":"https://api.github.com/repos/JeremyRubin/stellar-core/events","assignees_url":"https://api.github.com/repos/JeremyRubin/stellar-core/assignees{/user}","branches_url":"https://api.github.com/repos/JeremyRubin/stellar-core/branches{/branch}","tags_url":"https://api.github.com/repos/JeremyRubin/stellar-core/tags","blobs_url":"https://api.github.com/repos/JeremyRubin/stellar-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JeremyRubin/stellar-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JeremyRubin/stellar-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/JeremyRubin/stellar-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JeremyRubin/stellar-core/statuses/{sha}","languages_url":"https://api.github.com/repos/JeremyRubin/stellar-core/languages","stargazers_url":"https://api.github.com/repos/JeremyRubin/stellar-core/stargazers","contributors_url":"https://api.github.com/repos/JeremyRubin/stellar-core/contributors","subscribers_url":"https://api.github.com/repos/JeremyRubin/stellar-core/subscribers","subscription_url":"https://api.github.com/repos/JeremyRubin/stellar-core/subscription","commits_url":"https://api.github.com/repos/JeremyRubin/stellar-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/JeremyRubin/stellar-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/JeremyRubin/stellar-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/JeremyRubin/stellar-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/JeremyRubin/stellar-core/contents/{+path}","compare_url":"https://api.github.com/repos/JeremyRubin/stellar-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JeremyRubin/stellar-core/merges","archive_url":"https://api.github.com/repos/JeremyRubin/stellar-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JeremyRubin/stellar-core/downloads","issues_url":"https://api.github.com/repos/JeremyRubin/stellar-core/issues{/number}","pulls_url":"https://api.github.com/repos/JeremyRubin/stellar-core/pulls{/number}","milestones_url":"https://api.github.com/repos/JeremyRubin/stellar-core/milestones{/number}","notifications_url":"https://api.github.com/repos/JeremyRubin/stellar-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JeremyRubin/stellar-core/labels{/name}","releases_url":"https://api.github.com/repos/JeremyRubin/stellar-core/releases{/id}","deployments_url":"https://api.github.com/repos/JeremyRubin/stellar-core/deployments","created_at":"2017-09-22T00:40:40Z","updated_at":"2017-09-22T00:40:45Z","pushed_at":"2017-09-25T22:14:44Z","git_url":"git://github.com/JeremyRubin/stellar-core.git","ssh_url":"git@github.com:JeremyRubin/stellar-core.git","clone_url":"https://github.com/JeremyRubin/stellar-core.git","svn_url":"https://github.com/JeremyRubin/stellar-core","homepage":"","size":12529,"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,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"JeremyRubin:master","ref":"master","sha":"69eb704d788392a19624b7f85afad3d580793dc1","user":{"login":"JeremyRubin","id":886523,"avatar_url":"https://avatars0.githubusercontent.com/u/886523?v=4","gravatar_id":"","url":"https://api.github.com/users/JeremyRubin","html_url":"https://github.com/JeremyRubin","followers_url":"https://api.github.com/users/JeremyRubin/followers","following_url":"https://api.github.com/users/JeremyRubin/following{/other_user}","gists_url":"https://api.github.com/users/JeremyRubin/gists{/gist_id}","starred_url":"https://api.github.com/users/JeremyRubin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JeremyRubin/subscriptions","organizations_url":"https://api.github.com/users/JeremyRubin/orgs","repos_url":"https://api.github.com/users/JeremyRubin/repos","events_url":"https://api.github.com/users/JeremyRubin/events{/privacy}","received_events_url":"https://api.github.com/users/JeremyRubin/received_events","type":"User","site_admin":false},"repo":{"id":104413050,"name":"stellar-core","full_name":"JeremyRubin/stellar-core","owner":{"login":"JeremyRubin","id":886523,"avatar_url":"https://avatars0.githubusercontent.com/u/886523?v=4","gravatar_id":"","url":"https://api.github.com/users/JeremyRubin","html_url":"https://github.com/JeremyRubin","followers_url":"https://api.github.com/users/JeremyRubin/followers","following_url":"https://api.github.com/users/JeremyRubin/following{/other_user}","gists_url":"https://api.github.com/users/JeremyRubin/gists{/gist_id}","starred_url":"https://api.github.com/users/JeremyRubin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JeremyRubin/subscriptions","organizations_url":"https://api.github.com/users/JeremyRubin/orgs","repos_url":"https://api.github.com/users/JeremyRubin/repos","events_url":"https://api.github.com/users/JeremyRubin/events{/privacy}","received_events_url":"https://api.github.com/users/JeremyRubin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JeremyRubin/stellar-core","description":"stellar-core is the backbone of the Stellar network. It maintains a local copy of the ledger, communicating and staying in sync with other instances of stellar-core on the network. Optionally, stellar-core can store historical records of the ledger and participate in consensus.","fork":true,"url":"https://api.github.com/repos/JeremyRubin/stellar-core","forks_url":"https://api.github.com/repos/JeremyRubin/stellar-core/forks","keys_url":"https://api.github.com/repos/JeremyRubin/stellar-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JeremyRubin/stellar-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JeremyRubin/stellar-core/teams","hooks_url":"https://api.github.com/repos/JeremyRubin/stellar-core/hooks","issue_events_url":"https://api.github.com/repos/JeremyRubin/stellar-core/issues/events{/number}","events_url":"https://api.github.com/repos/JeremyRubin/stellar-core/events","assignees_url":"https://api.github.com/repos/JeremyRubin/stellar-core/assignees{/user}","branches_url":"https://api.github.com/repos/JeremyRubin/stellar-core/branches{/branch}","tags_url":"https://api.github.com/repos/JeremyRubin/stellar-core/tags","blobs_url":"https://api.github.com/repos/JeremyRubin/stellar-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JeremyRubin/stellar-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JeremyRubin/stellar-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/JeremyRubin/stellar-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JeremyRubin/stellar-core/statuses/{sha}","languages_url":"https://api.github.com/repos/JeremyRubin/stellar-core/languages","stargazers_url":"https://api.github.com/repos/JeremyRubin/stellar-core/stargazers","contributors_url":"https://api.github.com/repos/JeremyRubin/stellar-core/contributors","subscribers_url":"https://api.github.com/repos/JeremyRubin/stellar-core/subscribers","subscription_url":"https://api.github.com/repos/JeremyRubin/stellar-core/subscription","commits_url":"https://api.github.com/repos/JeremyRubin/stellar-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/JeremyRubin/stellar-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/JeremyRubin/stellar-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/JeremyRubin/stellar-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/JeremyRubin/stellar-core/contents/{+path}","compare_url":"https://api.github.com/repos/JeremyRubin/stellar-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JeremyRubin/stellar-core/merges","archive_url":"https://api.github.com/repos/JeremyRubin/stellar-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JeremyRubin/stellar-core/downloads","issues_url":"https://api.github.com/repos/JeremyRubin/stellar-core/issues{/number}","pulls_url":"https://api.github.com/repos/JeremyRubin/stellar-core/pulls{/number}","milestones_url":"https://api.github.com/repos/JeremyRubin/stellar-core/milestones{/number}","notifications_url":"https://api.github.com/repos/JeremyRubin/stellar-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JeremyRubin/stellar-core/labels{/name}","releases_url":"https://api.github.com/repos/JeremyRubin/stellar-core/releases{/id}","deployments_url":"https://api.github.com/repos/JeremyRubin/stellar-core/deployments","created_at":"2017-09-22T00:40:40Z","updated_at":"2017-09-22T00:40:45Z","pushed_at":"2017-09-25T22:14:44Z","git_url":"git://github.com/JeremyRubin/stellar-core.git","ssh_url":"git@github.com:JeremyRubin/stellar-core.git","clone_url":"https://github.com/JeremyRubin/stellar-core.git","svn_url":"https://github.com/JeremyRubin/stellar-core","homepage":"","size":12529,"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,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JeremyRubin/stellar-core/pulls/1"},"html":{"href":"https://github.com/JeremyRubin/stellar-core/pull/1"},"issue":{"href":"https://api.github.com/repos/JeremyRubin/stellar-core/issues/1"},"comments":{"href":"https://api.github.com/repos/JeremyRubin/stellar-core/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/JeremyRubin/stellar-core/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/JeremyRubin/stellar-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JeremyRubin/stellar-core/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/JeremyRubin/stellar-core/statuses/83d07b20305cb64cdd380b432e3ca10a8ab01709"}},"author_association":"OWNER"}}
{"actor":{"display_login":"MonsieurNicolas"}}