Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into ci_all_runners
Browse files Browse the repository at this point in the history
# Conflicts:
#	.dockerignore
#	.gitignore
#	infrastructure/zk/src/env.ts
#	infrastructure/zk/src/test/integration.ts
  • Loading branch information
Deniallugo committed Jan 15, 2021
2 parents e045d1a + 8b4759e commit 967d1be
Show file tree
Hide file tree
Showing 152 changed files with 2,676 additions and 1,308 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
!docker/zk/entrypoint.sh
!etc/env/dev.env.example
!etc/env/docker.env
!etc/env/base
!etc/tokens
!keys/packed
!docker/nginx/nginx.conf
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Cargo.lock
/etc/env/*
!/etc/env/dev.env.example
!/etc/env/docker.env
!/etc/env/ci.env
!/etc/env/base
/etc/tokens/localhost.json
!/keys
/keys/*
Expand Down
12 changes: 11 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 6 additions & 7 deletions changelog/core.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ All notable changes to the core components will be documented in this file.

## Unreleased

- Removed the limitation on the number of withdrawals in the block.
- (`FeeTicker`): Increased gas price estimate for transaction.

### Changed

### Added
Expand All @@ -15,11 +18,14 @@ All notable changes to the core components will be documented in this file.
### Changed

- `gen_token_add_contract` crate is rewritten in ts.
- Metrics were added to some functions from lib/storage.
- `get_tx_by_hash` function was simplified.

### Added

- `closest_greater_or_eq_packable_fee_amount` and `closest_greater_or_eq_packable_token_amount` functions.
`test_float_conversions` test was expanded.
- Loadtest scenario for stressing transaction batches

### Removed

Expand Down Expand Up @@ -48,10 +54,3 @@ All notable changes to the core components will be documented in this file.
### Fixed

- Bug with delay between receiving a job and starting sending heartbeats.

## Unreleased

### Changed

- Metrics were added to some functions from lib/storage.
- `get_tx_by_hash` function was simplified.
4 changes: 4 additions & 0 deletions changelog/js-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ All notable changes to `zksync.js` will be documented in this file.
- `closestGreaterOrEqPackableTransactionAmount` and `closestGreaterOrEqPackableTransactionFee` functions. Tests for
them.

### Changed

- HTTP provider is now the default one.

### Fixed

- Bug with `integerToFloat` function. Now, it really rounds to the closest less or equal float number.
Expand Down
Empty file.
4 changes: 2 additions & 2 deletions contracts/scripts/check-price.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const ethers = require('ethers');
const provider = new ethers.providers.JsonRpcProvider(process.env.WEB3_URL);
const provider = new ethers.providers.JsonRpcProvider(process.env.ETH_CLIENT_WEB3_URL);

const rinkeby = ethers.getDefaultProvider('rinkeby');
const mainnet = new ethers.providers.InfuraProvider();
Expand All @@ -20,7 +20,7 @@ async function main() {
console.log('gas price mainnet', (await mainnet.getGasPrice()).toNumber());
console.log('gas price mainnet2', (await mainnet2.getGasPrice()).toNumber());

calc('0x' + process.env.SENDER_ACCOUNT);
calc('0x' + process.env.ETH_SENDER_SENDER_OPERATOR_COMMIT_ETH_ADDR);
calc('0xB0587796F36E39c4b0d79790D2Efa874386dcD6d');
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/scripts/contract-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as path from 'path';
import { Wallet } from 'ethers';
import { Deployer } from '../src.ts/deploy';

const provider = new ethers.providers.JsonRpcProvider(process.env.WEB3_URL);
const provider = new ethers.providers.JsonRpcProvider(process.env.ETH_CLIENT_WEB3_URL);
const testConfigPath = path.join(process.env.ZKSYNC_HOME as string, `etc/test_config/constant`);
const ethTestConfig = JSON.parse(fs.readFileSync(`${testConfigPath}/eth.json`, { encoding: 'utf-8' }));

Expand Down
4 changes: 2 additions & 2 deletions contracts/scripts/deploy-eip1271.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ const ethTestConfig = JSON.parse(fs.readFileSync(`${testConfigPath}/eth.json`, {

(async () => {
try {
if (!['test', 'localhost'].includes(process.env.ETH_NETWORK)) {
if (!['test', 'localhost'].includes(process.env.CHAIN_ETH_NETWORK)) {
console.error('This deploy script is only for localhost-test network');
process.exit(1);
}

const provider = new ethers.providers.JsonRpcProvider(process.env.WEB3_URL);
const provider = new ethers.providers.JsonRpcProvider(process.env.ETH_CLIENT_WEB3_URL);
provider.pollingInterval = 10;

const deployWallet = ethers.Wallet.fromMnemonic(ethTestConfig.test_mnemonic, "m/44'/60'/0'/0/0").connect(
Expand Down
2 changes: 1 addition & 1 deletion contracts/scripts/deploy-erc20.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import * as path from 'path';
const testConfigPath = path.join(process.env.ZKSYNC_HOME as string, `etc/test_config/constant`);
const ethTestConfig = JSON.parse(fs.readFileSync(`${testConfigPath}/eth.json`, { encoding: 'utf-8' }));

const provider = new ethers.providers.JsonRpcProvider(process.env.WEB3_URL);
const provider = new ethers.providers.JsonRpcProvider(process.env.ETH_CLIENT_WEB3_URL);
const wallet = Wallet.fromMnemonic(ethTestConfig.mnemonic, "m/44'/60'/0'/0/1").connect(provider);

type Token = {
Expand Down
8 changes: 4 additions & 4 deletions contracts/scripts/deploy-testkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ const ethTestConfig = JSON.parse(fs.readFileSync(`${testConfigPath}/eth.json`, {
});
parser.addArgument('--genesisRoot', { required: true, help: 'genesis root' });
const args = parser.parseArgs(process.argv.slice(2));
process.env.GENESIS_ROOT = args.genesisRoot;
process.env.CONTRACTS_GENESIS_ROOT = args.genesisRoot;

if (process.env.ETH_NETWORK !== 'test') {
if (process.env.CHAIN_ETH_NETWORK !== 'test') {
console.error('This deploy script is only for localhost-test network');
process.exit(1);
}

const provider = new ethers.providers.JsonRpcProvider(process.env.WEB3_URL);
const provider = new ethers.providers.JsonRpcProvider(process.env.ETH_CLIENT_WEB3_URL);
provider.pollingInterval = 10;

const deployWallet = ethers.Wallet.fromMnemonic(ethTestConfig.test_mnemonic, "m/44'/60'/0'/0/0").connect(provider);
Expand All @@ -44,7 +44,7 @@ const ethTestConfig = JSON.parse(fs.readFileSync(`${testConfigPath}/eth.json`, {
['Matter Labs Trial Token', 'MLTT', 18],
{ gasLimit: 5000000 }
);
console.log(`TEST_ERC20=${erc20.address}`);
console.log(`CONTRACTS_TEST_ERC20=${erc20.address}`);
await (await governance.addToken(erc20.address)).wait();
if ((await governance.tokenIds(erc20.address)) !== 1) {
console.error('Problem with testkit deployment, TEST_ERC20 token should have id 1');
Expand Down
14 changes: 9 additions & 5 deletions contracts/scripts/deploy-testnet-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ const ethTestConfig = JSON.parse(fs.readFileSync(`${testConfigPath}/eth.json`, {
parser.addArgument('--deployerPrivateKey', { required: false, help: 'Wallet used to deploy contracts' });
const args = parser.parseArgs(process.argv.slice(2));

const provider = new ethers.providers.JsonRpcProvider(process.env.WEB3_URL);
const provider = new ethers.providers.JsonRpcProvider(process.env.ETH_CLIENT_WEB3_URL);
const wallet = args.deployerPrivateKey
? new Wallet(args.deployerPrivateKey, provider)
: Wallet.fromMnemonic(ethTestConfig.mnemonic, "m/44'/60'/0'/0/1").connect(provider);

const contractCode = readContractCode('TestnetERC20Token');

if (process.env.ETH_NETWORK === 'mainnet') {
if (process.env.CHAIN_ETH_NETWORK === 'mainnet') {
throw new Error('Test ERC20 tokens should not be deployed to mainnet');
}

Expand All @@ -46,7 +46,11 @@ const ethTestConfig = JSON.parse(fs.readFileSync(`${testConfigPath}/eth.json`, {
}
try {
console.log(`Publishing code for : ${token.symbol}, ${token.address}`);
const constructorArgs = [`${token.name} (${process.env.ETH_NETWORK})`, token.symbol, token.decimals];
const constructorArgs = [
`${token.name} (${process.env.CHAIN_ETH_NETWORK})`,
token.symbol,
token.decimals
];
const rawArgs = encodeConstructorArgs(contractCode, constructorArgs);
await publishSourceCodeToEtherscan(token.address, 'TestnetERC20Token', rawArgs, 'contracts/test');
verifiedOnce = true;
Expand All @@ -60,7 +64,7 @@ const ethTestConfig = JSON.parse(fs.readFileSync(`${testConfigPath}/eth.json`, {
const result = [];

for (const token of mainnetTokens) {
const constructorArgs = [`${token.name} (${process.env.ETH_NETWORK})`, token.symbol, token.decimals];
const constructorArgs = [`${token.name} (${process.env.CHAIN_ETH_NETWORK})`, token.symbol, token.decimals];

console.log(`Deploying testnet ERC20: ${constructorArgs.toString()}`);
const erc20 = await deployContract(wallet, contractCode, constructorArgs, { gasLimit: 800000 });
Expand All @@ -71,7 +75,7 @@ const ethTestConfig = JSON.parse(fs.readFileSync(`${testConfigPath}/eth.json`, {
}

fs.writeFileSync(
`${process.env.ZKSYNC_HOME}/etc/tokens/${process.env.ETH_NETWORK}.json`,
`${process.env.ZKSYNC_HOME}/etc/tokens/${process.env.CHAIN_ETH_NETWORK}.json`,
JSON.stringify(result, null, 2)
);
})();
2 changes: 1 addition & 1 deletion contracts/scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { formatUnits, parseUnits } from 'ethers/lib/utils';
import * as fs from 'fs';
import * as path from 'path';

const provider = new ethers.providers.JsonRpcProvider(process.env.WEB3_URL);
const provider = new ethers.providers.JsonRpcProvider(process.env.ETH_CLIENT_WEB3_URL);
const testConfigPath = path.join(process.env.ZKSYNC_HOME as string, `etc/test_config/constant`);
const ethTestConfig = JSON.parse(fs.readFileSync(`${testConfigPath}/eth.json`, { encoding: 'utf-8' }));

Expand Down
2 changes: 1 addition & 1 deletion contracts/scripts/gen-token-add-contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as fs from 'fs';
import * as path from 'path';
import * as Handlebars from 'handlebars';

const network = process.env.ETH_NETWORK as string;
const network = process.env.CHAIN_ETH_NETWORK as string;
const ZKSYNC_HOME = process.env.ZKSYNC_HOME as string;
if (!network) {
throw new Error('ETH_NETWORK is not set');
Expand Down
6 changes: 3 additions & 3 deletions contracts/scripts/init-faucet-account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import * as zksync from 'zksync';
import { ethers } from 'ethers';

const DEPOSIT_AMOUNT = ethers.utils.parseEther('10000000000');
const network = process.env.ETH_NETWORK;
const network = process.env.CHAIN_ETH_NETWORK;

const provider = new ethers.providers.JsonRpcProvider(process.env.WEB3_URL);
const provider = new ethers.providers.JsonRpcProvider(process.env.ETH_CLIENT_WEB3_URL);
const testConfigPath = path.join(process.env.ZKSYNC_HOME as string, `etc/test_config/constant`);
const ethTestConfig = JSON.parse(fs.readFileSync(`${testConfigPath}/eth.json`, { encoding: 'utf-8' }));

Expand Down Expand Up @@ -61,7 +61,7 @@ async function main() {
type: 'function'
}
];
if (process.env.NETWORK !== 'localhost') {
if (process.env.CHAIN_ETH_NETWORK !== 'localhost') {
const erc20Mintable = new ethers.Contract(TOKEN_ADDRESS, ABI, deployerEthWallet);
const mintTx = await erc20Mintable.mint(deployerEthWallet.address, DEPOSIT_AMOUNT);
await mintTx.wait();
Expand Down
2 changes: 1 addition & 1 deletion contracts/scripts/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Deployer } from '../src.ts/deploy';
try {
// Wallet is not needed for publishing
const deployer = new Deployer({ deployWallet: Wallet.createRandom() });
if (process.env.ETH_NETWORK === 'localhost') {
if (process.env.CHAIN_ETH_NETWORK === 'localhost') {
await deployer.publishSourcesToTesseracts();
} else {
await deployer.publishSourcesToEtherscan();
Expand Down
2 changes: 1 addition & 1 deletion contracts/scripts/revert-reason.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function hex_to_ascii(str1) {
async function reason() {
const args = process.argv.slice(2);
const hash = args[0];
const web3 = args[1] == null ? process.env.WEB3_URL : args[1];
const web3 = args[1] == null ? process.env.ETH_CLIENT_WEB3_URL : args[1];
console.log('tx hash:', hash);
console.log('provider:', web3);

Expand Down
2 changes: 1 addition & 1 deletion contracts/scripts/submit-test-proof.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as path from 'path';
import { deployContract } from 'ethereum-waffle';
import { Wallet } from 'ethers';

const provider = new ethers.providers.JsonRpcProvider(process.env.WEB3_URL);
const provider = new ethers.providers.JsonRpcProvider(process.env.ETH_CLIENT_WEB3_URL);
const testConfigPath = path.join(process.env.ZKSYNC_HOME as string, `etc/test_config/constant`);
const ethTestConfig = JSON.parse(fs.readFileSync(`${testConfigPath}/eth.json`, { encoding: 'utf-8' }));

Expand Down
4 changes: 2 additions & 2 deletions contracts/scripts/test-upgrade-franklin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ async function main() {
parser.addArgument('contractAddress');
parser.addArgument('upgradeGatekeeperAddress');
const args = parser.parseArgs(process.argv.slice(2));
if (process.env.ETH_NETWORK !== 'test') {
if (process.env.CHAIN_ETH_NETWORK !== 'test') {
console.log('Upgrading test contract not on test network is not allowed');
process.exit(1);
}

const provider = new ethers.providers.JsonRpcProvider(process.env.WEB3_URL);
const provider = new ethers.providers.JsonRpcProvider(process.env.ETH_CLIENT_WEB3_URL);

const wallet = ethers.Wallet.fromMnemonic(ethTestConfig.test_mnemonic, "m/44'/60'/0'/0/0").connect(provider);

Expand Down
2 changes: 1 addition & 1 deletion contracts/scripts/upgrade-testnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { formatUnits, parseUnits } from 'ethers/lib/utils';
import * as fs from 'fs';
import * as path from 'path';

const provider = new ethers.providers.JsonRpcProvider(process.env.WEB3_URL);
const provider = new ethers.providers.JsonRpcProvider(process.env.ETH_CLIENT_WEB3_URL);
const testConfigPath = path.join(process.env.ZKSYNC_HOME as string, `etc/test_config/constant`);
const ethTestConfig = JSON.parse(fs.readFileSync(`${testConfigPath}/eth.json`, { encoding: 'utf-8' }));

Expand Down
Loading

0 comments on commit 967d1be

Please sign in to comment.