forked from matter-labs/zksync
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/dev' into slumber-zks-557-implem…
…ent-listener-for-pg-notification
- Loading branch information
Showing
116 changed files
with
4,653 additions
and
618 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,12 +14,12 @@ jobs: | |
- | ||
id: print | ||
run: echo "::set-output name=shortRev::$(git rev-parse --short HEAD)" | ||
- | ||
- | ||
uses: actions-ecosystem/action-regex-match@v2 | ||
id: regex-match | ||
with: | ||
text: ${{ github.ref }} | ||
regex: '^refs\/tags\/(v[0-9]+\.[0-9]+\.[0-9](-?\w*)?)$' | ||
regex: '^refs\/tags\/(v[0-9]+\.[0-9]+\.[0-9](-?.*)?)$' | ||
- | ||
name: Map runtime environment data | ||
uses: kanga333/[email protected] | ||
|
@@ -29,67 +29,46 @@ jobs: | |
{ | ||
"mainnet": { | ||
"KUBECONF": "KUBECONF_MAINNET", | ||
"HFENV": "zksync-prod" | ||
"HFENV": "zksync-prod", | ||
"RUNNER": "mainnet" | ||
}, | ||
"rinkeby": { | ||
"KUBECONF": "$KUBECONF_TESTNET", | ||
"HFENV": "zksync-${{ github.event.deployment.environment }}" | ||
"KUBECONF": "KUBECONF_TESTNET", | ||
"HFENV": "zksync-${{ github.event.deployment.environment }}", | ||
"RUNNER": "testnet" | ||
}, | ||
"ropsten": { | ||
"KUBECONF": "$KUBECONF_TESTNET", | ||
"HFENV": "zksync-${{ github.event.deployment.environment }}" | ||
"KUBECONF": "KUBECONF_TESTNET", | ||
"HFENV": "zksync-${{ github.event.deployment.environment }}", | ||
"RUNNER": "testnet" | ||
}, | ||
".*": { | ||
"KUBECONF": "KUBECONF_STAGE", | ||
"HFENV": "zksync-${{ github.event.deployment.environment }}" | ||
"HFENV": "zksync-${{ github.event.deployment.environment }}", | ||
"RUNNER": "stage" | ||
} | ||
} | ||
- | ||
name: Cancel deployment (deployment tag missmatch) | ||
if: ${{ steps.regex-match.outputs.group1 == '' }} | ||
uses: chrnorm/deployment-status@releases/v1 | ||
with: | ||
token: ${{ github.token }} | ||
state: failure | ||
deployment_id: ${{ github.event.deployment.id }} | ||
|
||
outputs: | ||
shortRev: ${{ steps.print.outputs.shortRev }} | ||
kubeConf: ${{ env.KUBECONF }} | ||
hfEnv: ${{ env.HFENV }} | ||
runner: ${{ env.RUNNER }} | ||
isTag: ${{ steps.regex-match.outputs.group1 != '' }} | ||
|
||
build-images: | ||
name: Build and Push Docker Images | ||
runs-on: [self-hosted, MAIN] | ||
needs: pre | ||
if: ${{ needs.pre.outputs.isTag == 'true' }} | ||
|
||
# Required services | ||
services: | ||
postgres: | ||
image: postgres:10.4 | ||
ports: | ||
- 5432:5432 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: setup-env | ||
run: | | ||
echo ZKSYNC_HOME=$(pwd) >> $GITHUB_ENV | ||
echo CI=1 >> $GITHUB_ENV | ||
echo $(pwd)/bin >> $GITHUB_PATH | ||
- name: init | ||
run: | | ||
cargo sqlx --version || cargo install --version=0.2.0 sqlx-cli | ||
zk | ||
zk run yarn | ||
cp etc/tokens/{test,localhost}.json | ||
zk run verify-keys unpack | ||
zk db basic-setup | ||
- name: update-images | ||
run: | | ||
docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }} | ||
zk docker push rust | ||
zk docker push nginx | ||
deploy: | ||
name: Deploy Apps | ||
runs-on: [k8s, deployer, "${{ github.event.deployment.environment }}"] | ||
needs: [pre, build-images] | ||
runs-on: [k8s, deployer, "${{ needs.pre.outputs.runner }}"] | ||
needs: pre | ||
if: ${{ needs.pre.outputs.isTag == 'true' }} | ||
|
||
container: | ||
image: dysnix/kubectl:v1.16-gcloud | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
|
||
pragma solidity ^0.7.0; | ||
|
||
pragma experimental ABIEncoderV2; | ||
|
||
import "./Utils.sol"; | ||
import "./Ownable.sol"; | ||
import "./ReentrancyGuard.sol"; | ||
|
||
contract ForcedExit is Ownable, ReentrancyGuard { | ||
// This is the role of the zkSync server | ||
// that will be able to withdraw the funds | ||
address payable public receiver; | ||
|
||
bool public enabled = true; | ||
|
||
constructor(address _master, address _receiver) Ownable(_master) { | ||
initializeReentrancyGuard(); | ||
|
||
// The master is the default receiver | ||
receiver = payable(_receiver); | ||
} | ||
|
||
event FundsReceived(uint256 _amount); | ||
|
||
function setReceiver(address payable _newReceiver) external { | ||
requireMaster(msg.sender); | ||
|
||
receiver = _newReceiver; | ||
} | ||
|
||
function withdrawPendingFunds(address payable _to) external nonReentrant { | ||
require( | ||
msg.sender == receiver || msg.sender == getMaster(), | ||
"Only the receiver or master can withdraw funds from the smart contract" | ||
); | ||
|
||
uint256 balance = address(this).balance; | ||
|
||
(bool success, ) = _to.call{value: balance}(""); | ||
require(success, "ETH withdraw failed"); | ||
} | ||
|
||
// We have to use fallback instead of `receive` since the ethabi | ||
// library can't decode the receive function: | ||
// https://github.com/rust-ethereum/ethabi/issues/185 | ||
fallback() external payable { | ||
emit FundsReceived(msg.value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
|
||
pragma solidity ^0.7.0; | ||
|
||
pragma experimental ABIEncoderV2; | ||
|
||
contract SelfDestruct { | ||
function destroy(address payable to) external { | ||
selfdestruct(to); | ||
} | ||
|
||
// Need this to send some funds to the contract | ||
receive() external payable {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.