Merge branch 'develop' into bug/remove-stale-externs

This commit is contained in:
Tetiana Churikova 2018-03-26 10:21:21 +03:00 committed by GitHub
commit a79ddc54a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 62 additions and 88 deletions

View File

@ -6,14 +6,17 @@ How to test PR? Steps below could help a bit!
### Prerequisites
Requirements for PRs to be tested:
* should be in `To test` column in `Pipeline For Pull Requests` project
* should be updated to last develop. If button `Update` is avaivable on particular PR, click it and wait until it will be built.
* shouldn't have conflicts with `develop` branch
* should have a successful build in Jenkins [status-openbounty-app](https://jenkins.status.im/job/status-openbounty/job/status-openbounty-app/view/change-requests/)
### Deployment
In order to deploy feature to [testing env](https://testing.openbounty.status.im/) you should **rebuild** PR you are about to test.
In order to deploy feature to [testing env](https://testing.openbounty.status.im/) you should **rebuild** PR you are about to test (all open PRs are in [Jenkins](https://jenkins.status.im/job/status-openbounty/job/status-openbounty-app/view/change-requests/)).
Only one PR can be deployed on [testing env](https://testing.openbounty.status.im/)
When PR is successfully build and deployed, [testing env](https://testing.openbounty.status.im/) with deployed PR is accessible in 2-3 mins.
Only one at one time PR can be deployed on [testing env](https://testing.openbounty.status.im/)
Fresh develop branch with last changes is deployed automatically on [staging env](https://openbounty.status.im:444)
@ -21,7 +24,8 @@ Fresh develop branch with last changes is deployed automatically on [staging env
1) Move appropriate PR card to IN TESTING on the [Board](https://github.com/status-im/open-bounty/projects/3) and let people know you are on it - assign it to yourself! :)
2) Сheck the functionality current PR fixes / delivers (positive/negative tests related to the feature). In curtain cases it's worth to look in 'Files changed' tab in GitHub to check the list of what was changed to get understanding of the test coverage or "weak" places that have to be covered. Ask PR-author in #openbounty channel in slack what was changed if it's not clear from the notes in PR.
3) Check reasonable regression using [SOB-general test suite](https://ethstatus.testrail.net/index.php?/suites/view/27&group_by=cases:section_id&group_order=asc)
4) No issues? Perfect! Put appropriate label to the PR (`Tested - OK`), merge it to develop and move the PR instance to `Merged to develop`.
5) Found issues? Check for duplicates before adding one. Hint: make sure the issue is really introduced by current PR - check latest `develop` branch on [staging env](https://openbounty.status.im:444) . Issue exists in develop? Check existing issues list and make sure you are not adding duplicates before creating your own bug :) **All PR-specific issues should be added as comments to tested PR.**
4) No issues? Perfect! Put appropriate label to the PR (`Tested - OK`), merge it to develop (using `Rebase-Merge`) and move the PR instance to `Merged to develop`.
5) Found issues? Check for duplicates before adding one. Hint: make sure the issue is really introduced by current PR - check latest `develop` branch on [staging env](https://openbounty.status.im:444) . Issue exists in develop? Check existing issues list and make sure you are not adding duplicates before creating your own bug :)
**All PR-specific issues should be added as comments to tested PR.**
Once all issues are logged put label `Tested-issues` to the PR and notify developer that there are several problems that are preventing the PR to merge. Move the PR to `Reviewing, waiting for contributor` on the board if PR is developed by external contributor, and to `Developing` - if it is presented by core contributor.

View File

@ -193,20 +193,6 @@ AND i.contract_address IS NULL
AND i.transaction_hash IS NOT NULL;
-- :name list-failed-deployments :? :*
-- :doc retrieves failed contract deployments
SELECT
i.issue_id as issue_id,
i.transaction_hash as transaction_hash,
u.address as owner_address
FROM issues i, users u, repositories r
WHERE r.user_id = u.id
AND i.repo_id = r.repo_id
AND i.contract_address IS NULL
AND i.transaction_hash IS NOT NULL
AND i.updated < now() at time zone 'UTC' - interval '1 hour';
-- Pull Requests -------------------------------------------------------------------
-- :name save-pull-request! :! :n
@ -249,7 +235,10 @@ WHERE pr_id = :pr_id;
-- :doc bounty issues where deploy contract has failed
SELECT
i.issue_id AS issue_id,
u.address AS owner_address
i.issue_number AS issue_number,
r.owner AS owner,
u.address AS owner_address,
r.repo AS repo
FROM issues i, users u, repositories r
WHERE
r.user_id = u.id

View File

@ -20,6 +20,26 @@
(let [labels (:labels issue)]
(some #(= label-name (:name %)) labels)))
(defn deploy-contract [owner owner-address repo issue-id issue-number]
(if (empty? owner-address)
(log/error "Unable to deploy bounty contract because"
"repo owner has no Ethereum addres")
(do
(log/info "deploying contract to " owner-address)
(if-let [transaction-hash (multisig/deploy-multisig owner-address)]
(do
(log/info "Contract deployed, transaction-hash:"
transaction-hash)
(let [resp (github/post-deploying-comment owner
repo
issue-number
transaction-hash)
_ (log/info "post-deploying-comment response:" resp)
comment-id (:id resp)]
(issues/update-comment-id issue-id comment-id))
(issues/update-transaction-hash issue-id transaction-hash))
(log/error "Failed to deploy contract to" owner-address)))))
(defn add-bounty-for-issue [repo repo-id issue]
(let [{issue-id :id
issue-number :number
@ -29,24 +49,7 @@
owner :owner} (users/get-repo-owner repo-id)]
(log/debug "Adding bounty for issue " repo issue-number "owner address: " owner-address)
(if (= 1 created-issue)
(if (empty? owner-address)
(log/error "Unable to deploy bounty contract because"
"repo owner has no Ethereum addres")
(do
(log/debug "deploying contract to " owner-address)
(let [transaction-hash (multisig/deploy-multisig owner-address)]
(if (nil? transaction-hash)
(log/error "Failed to deploy contract to" owner-address)
(do
(log/info "Contract deployed, transaction-hash:"
transaction-hash)
(->> (github/post-deploying-comment owner
repo
issue-number
transaction-hash)
:id
(issues/update-comment-id issue-id))))
(issues/update-transaction-hash issue-id transaction-hash))))
(deploy-contract owner owner-address repo issue-id issue-number)
(log/debug "Issue already exists in DB, ignoring"))))
(defn maybe-add-bounty-for-issue [repo repo-id issue]

View File

@ -63,12 +63,6 @@
(jdbc/with-db-connection [con-db *db*]
(db/list-pending-deployments con-db)))
(defn list-failed-deployments
[]
(jdbc/with-db-connection [con-db *db*]
(db/list-failed-deployments con-db)))
(defn update-eth-balance
[contract-address balance-eth]
(jdbc/with-db-connection [con-db *db*]

View File

@ -127,13 +127,17 @@
result (safe-read-str (:body response))]
(log/debug body "\n" result)
(if (= (:id result) request-id)
(:result result)
(do
(log/error "Geth returned an invalid json-rpc request ID,"
"ignoring response")
(when-let [error (:error result)]
(log/error "Method: " method ", error: " error))))))
(cond
;; Ignore any responses that have mismatching request ID
(not= (:id result) request-id)
(log/error "Geth returned an invalid json-rpc request ID, ignoring response")
;; If request ID matches but contains error, throw
(:error result)
(throw (ex-info "Error submitting transaction via eth-rpc" (:error result)))
:else
(:result result))))
(defn hex->big-integer
[hex]

View File

@ -275,7 +275,7 @@
(defn post-deploying-comment
[owner repo issue-number tx-id]
(let [comment (generate-deploying-comment owner repo issue-number tx-id)]
(log/debug "Posting comment to" (str owner "/" repo "/" issue-number) ":" comment)
(log/info "Posting comment to" (str owner "/" repo "/" issue-number) ":" comment)
(issues/create-comment owner repo issue-number comment (self-auth-params))))
(defn make-patch-request [end-point positional query]

View File

@ -84,34 +84,17 @@
(log/info "Exit update-issue-contract-address"))
(defn deploy-contract [owner-address issue-id]
(let [transaction-hash (multisig/deploy-multisig owner-address)]
(if (nil? transaction-hash)
(log/error "Failed to deploy contract to" owner-address)
(log/info "Contract deployed, transaction-hash:"
transaction-hash ))
(issues/update-transaction-hash issue-id transaction-hash)))
(defn redeploy-failed-contracts
"If the bot account runs out of gas, we end up with transaction-id in db, but with nothing written to blockchain. In this case we should try to re-deploy the contract."
[]
(doseq [{issue-id :issue_id
transaction-hash :transaction_hash
owner-address :owner_address} (issues/list-failed-deployments)]
(when (nil? (eth/get-transaction-receipt transaction-hash))
(log/info "Detected nil transaction receipt for pending contract deployment for issue" issue-id ", re-deploying contract")
(deploy-contract owner-address issue-id))))
(defn deploy-pending-contracts
"Under high-concurrency circumstances or in case geth is in defunct state, a bounty contract may not deploy successfully when the bounty label is addded to an issue. This function deploys such contracts."
[]
(p :deploy-pending-contracts
(doseq [{issue-id :issue_id
owner-address :owner_address} (db-bounties/pending-contracts)]
(p :deploy-pending-contracts
(doseq [{issue-id :issue_id
issue-number :issue_number
owner :owner
owner-address :owner_address
repo :repo} (db-bounties/pending-contracts)]
(log/debug "Trying to re-deploy failed bounty contract deployment, issue-id:" issue-id)
(deploy-contract owner-address issue-id))))
(bounties/deploy-contract owner owner-address repo issue-id issue-number))))
(defn self-sign-bounty
"Walks through all issues eligible for bounty payout and signs corresponding transaction"
@ -400,8 +383,7 @@
;; TODO: disabled for now. looks like it may cause extraneus
;; contract deployments and costs
(run-tasks
[;;redeploy-failed-contracts
deploy-pending-contracts
[deploy-pending-contracts
update-issue-contract-address
update-confirm-hash
update-payout-receipt

View File

@ -74,19 +74,17 @@
(defn tabs [mobile?]
(let [user (rf/subscribe [:user])
owner-bounties (rf/subscribe [:owner-bounties])
current-page (rf/subscribe [:page])]
(fn []
(let [tabs (apply conj [[:bounties (str (when-not @user "Open ") "Bounties")]
[:activity "Activity"]]
(when @user
[
;; NOTE(oskarth) Disabling this as repo management happens through GH app
#_[:repos "Repositories"]
[:manage-payouts (str (when-not mobile? "Manage ") "Payouts")]
(when (:status-team-member? @user)
[:usage-metrics "Usage metrics"])]))]
(fn tabs-render []
(let [tabs [[:bounties (str (when-not @user "Open ") "Bounties")]
[:activity "Activity"]
(when (seq @owner-bounties)
[:manage-payouts (str (when-not mobile? "Manage ") "Payouts")])
(when (:status-team-member? @user)
[:usage-metrics "Usage metrics"])]]
(into [:div.ui.attached.tabular.menu.tiny]
(for [[page caption] tabs]
(for [[page caption] (remove nil? tabs)]
(let [props {:class (str "ui item"
(when (= @current-page page) " active"))
:on-click #(commiteth.routes/nav! page)}]