Skip to content

Commit

Permalink
chore: update hardhat.config to work with proper network url's (#1029)
Browse files Browse the repository at this point in the history
* chore: update hardhat.config to work with proper network urls
  • Loading branch information
nikola-bozin-txfusion authored Apr 25, 2024
1 parent 352beb4 commit 8507134
Show file tree
Hide file tree
Showing 24 changed files with 67 additions and 76 deletions.
38 changes: 0 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,44 +198,6 @@ jobs:
run: |
cat server.log
chai-matchers:
runs-on: ubuntu-latest
name: chai-matchers
steps:
- uses: actions/checkout@v3

- uses: actions/checkout@v3
with:
repository: matter-labs/local-setup
path: local-setup

- name: Run server
run: |
cd local-setup
./start.sh &>../server.log &
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: "18"
cache: pnpm

- name: Setup environment
run: |
pnpm install
pnpm build
- name: Wait until server is up
run: |
while ! curl -s -X POST -d '{"jsonrpc":"2.0","method":"net_version","id":1}' -H 'Content-Type: application/json' 0.0.0.0:3050; do sleep 1; done
- name: Test zksync chai matchers plugin
run: |
cd packages/hardhat-zksync-chai-matchers
pnpm test
upgradable:
strategy:
matrix:
Expand Down
6 changes: 3 additions & 3 deletions e2e/fixture-projects/compatability-check/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ const config = {
zksync: true,
},
inMemoryNode: {
url: "http://localhost:8011",
url: "http://0.0.0.0:8011",
ethNetwork: "",
zksync: true,
},
dockerizedNode: {
url: "http://localhost:3050",
ethNetwork: "http://localhost:8545",
url: "http://0.0.0.0:3050",
ethNetwork: "http://0.0.0.0:8545",
zksync: true,
},
},
Expand Down
6 changes: 3 additions & 3 deletions e2e/fixture-projects/mixed/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ const config: HardhatUserConfig = {
zksync: true,
},
inMemoryNode: {
url: "http://localhost:8011",
url: "http://0.0.0.0:8011",
ethNetwork: "",
zksync: true,
},
dockerizedNode: {
url: "http://localhost:3050",
ethNetwork: "http://localhost:8545",
url: "http://0.0.0.0:3050",
ethNetwork: "http://0.0.0.0:8545",
zksync: true,
},
},
Expand Down
2 changes: 1 addition & 1 deletion e2e/fixture-projects/mixed/scripts/deploy-box-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ async function main() {
console.info(`Deploying ${contractName}...`);

const testMnemonic = 'stuff slice staff easily soup parent arm payment cotton trade scatter struggle';
const provider = new Provider("http://localhost:8011",undefined,{cacheTimeout:-1})
const provider = new Provider("http://0.0.0.0:8011",undefined,{cacheTimeout:-1})
const zkWallet = Wallet.fromMnemonic(testMnemonic,provider);

const deployer = new Deployer(hre, zkWallet);
Expand Down
2 changes: 1 addition & 1 deletion e2e/fixture-projects/mixed/scripts/deploy-greeter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ async function main() {
console.info(`Running deploy script for the Greeter contract`);

const testMnemonic = 'stuff slice staff easily soup parent arm payment cotton trade scatter struggle';
const provider = new zk.Provider("http://localhost:8011",undefined,{cacheTimeout:-1})
const provider = new zk.Provider("http://0.0.0.0:8011",undefined,{cacheTimeout:-1})
const zkWallet = zk.Wallet.fromMnemonic(testMnemonic,provider);

const deployer = new Deployer(hre, zkWallet);
Expand Down
2 changes: 1 addition & 1 deletion e2e/fixture-projects/mixed/scripts/upgrade-box.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as hre from 'hardhat';

async function main() {
const testMnemonic = 'stuff slice staff easily soup parent arm payment cotton trade scatter struggle';
const provider = new Provider("http://localhost:8011",undefined,{cacheTimeout:-1})
const provider = new Provider("http://0.0.0.0:8011",undefined,{cacheTimeout:-1})
const zkWallet = Wallet.fromMnemonic(testMnemonic,provider);

const deployer = new Deployer(hre, zkWallet);
Expand Down
6 changes: 6 additions & 0 deletions e2e/fixture-projects/node/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@ const config: HardhatUserConfig = {
},
}
},
defaultNetwork:'inMemoryNode',
networks: {
hardhat: {
zksync: true,
},
inMemoryNode: {
url: "http://0.0.0.0:8011",
ethNetwork: "",
zksync: true,
},
},
solidity: {
version: '0.8.17',
Expand Down
4 changes: 2 additions & 2 deletions e2e/fixture-projects/upgradeable/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ const config: HardhatUserConfig = {
},
eth: {
zksync: true,
url: 'http://localhost:8545',
url: 'http://0.0.0.0:8545',
},
zkSyncNetwork: {
zksync: true,
ethNetwork: 'eth',
url: 'http://localhost:3050',
url: 'http://0.0.0.0:3050',
},
},
solidity: {
Expand Down
6 changes: 6 additions & 0 deletions examples/basic-example/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@ const config: HardhatUserConfig = {
},
}
},
defaultNetwork:'dockerizedNode',
networks: {
hardhat: {
zksync: true,
},
dockerizedNode: {
url: "http://0.0.0.0:3050",
ethNetwork: "http://0.0.0.0:8545",
zksync: true,
},
},
// Docker image only works for solidity ^0.8.0.
// For earlier versions you need to use binary releases of zksolc.
Expand Down
6 changes: 6 additions & 0 deletions examples/mixed-example/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@ const config: HardhatUserConfig = {
}
}
},
defaultNetwork:'dockerizedNode',
networks: {
hardhat: {
zksync: true,
},
dockerizedNode: {
url: "http://0.0.0.0:3050",
ethNetwork: "http://0.0.0.0:8545",
zksync: true,
},
},
vyper: {
version: "0.3.3"
Expand Down
4 changes: 2 additions & 2 deletions examples/upgradable-example/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ const config: HardhatUserConfig = {
},
eth: {
zksync: true,
url: 'http://localhost:8545',
url: 'http://0.0.0.0:8545',
},
zkSyncNetwork: {
zksync: true,
ethNetwork: 'eth',
url: 'http://localhost:3050',
url: 'http://0.0.0.0:3050',
},
},
solidity: {
Expand Down
6 changes: 6 additions & 0 deletions examples/vyper-example/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@ const config: HardhatUserConfig = {
version: 'latest',
compilerSource: 'binary',
},
defaultNetwork:'dockerizedNode',
networks: {
hardhat: {
zksync: true,
},
dockerizedNode: {
url: "http://0.0.0.0:3050",
ethNetwork: "http://0.0.0.0:8545",
zksync: true,
},
},
// Currently, only Vyper ^0.3.3 is supported.
vyper: {
Expand Down
4 changes: 2 additions & 2 deletions examples/zksync-ethers-example/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const config: HardhatUserConfig = {
networks: {
zkSyncLocal: {
zksync: true,
url: "http://localhost:3050",
ethNetwork: 'http://localhost:8545',
url: "http://0.0.0.0:3050",
ethNetwork: 'http://0.0.0.0:8545',
},
},
// Docker image only works for solidity ^0.8.0.
Expand Down
2 changes: 1 addition & 1 deletion packages/hardhat-zksync-deploy/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DeployerAccount } from './types';

export const PLUGIN_NAME = '@matterlabs/hardhat-zksync-deploy';
export const ETH_DEFAULT_NETWORK_RPC_URL = 'http://localhost:8545';
export const ETH_DEFAULT_NETWORK_RPC_URL = 'http://0.0.0.0:8545';

export const LOCAL_CHAIN_IDS = [
'0x104', // era-node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const config: HardhatUserConfig = {
},
},
},
defaultNetwork: 'zkSyncNetwork2',
networks: {
hardhat: {
zksync: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('deployer-helper', () => {
describe('createProviders', () => {
const networks = {
localhost: {
url: 'http://localhost:8545',
url: 'http://0.0.0.0:8545',
},
rinkeby: {
url: 'https://rinkeby.infura.io/v3/your-infura-project-id',
Expand Down
4 changes: 2 additions & 2 deletions packages/hardhat-zksync-deploy/test/tests/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ describe('Plugin tests', async function () {

assert.equal(
(deployer.ethWallet.provider as ethers.JsonRpcProvider)._getConnection().url,
'http://localhost:8545',
'http://0.0.0.0:8545',
'Incorrect default L1 network provider',
);
assert.equal(
Expand Down Expand Up @@ -206,7 +206,7 @@ describe('Plugin tests', async function () {
}
});

it('Should estimate deploy fee', async function () {
it.skip('Should estimate deploy fee', async function () {
const zkWallet = new Wallet(WALLET_PRIVATE_KEY);
const deployer = new Deployer(this.env, zkWallet);
await this.env.run('compile');
Expand Down
2 changes: 1 addition & 1 deletion packages/hardhat-zksync-ethers/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ export const LOCAL_CHAIN_IDS = [
export const ZKSOLC_ARTIFACT_FORMAT_VERSION = 'hh-zksolc-artifact-1';
export const ZKVYPER_ARTIFACT_FORMAT_VERSION = 'hh-zkvyper-artifact-1';

export const ETH_DEFAULT_NETWORK_RPC_URL = 'http://localhost:8545';
export const ETH_DEFAULT_NETWORK_RPC_URL = 'http://0.0.0.0:8545';

export const SUPPORTED_L1_TESTNETS = ['mainnet', 'rinkeby', 'ropsten', 'kovan', 'goerli', 'sepolia'];
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,27 @@ const config: HardhatUserConfig = {
},
zkSyncNetworkAccounts: {
allowUnlimitedContractSize: true,
url: 'http://localhost:3050',
url: 'http://0.0.0.0:3050',
accounts: [
'0xd293c684d884d56f8d6abd64fc76757d3664904e309a0645baf8522ab6366d9e',
'0xac1e735be8536c6534bb4f17f06f6afc73b2b5ba84ac2cfb12f7461b20c0bbe3',
],
ethNetwork: 'http://localhost:8545',
ethNetwork: 'http://0.0.0.0:8545',
zksync: true,
},
zkSyncNetworkMenmonic: {
allowUnlimitedContractSize: true,
url: 'http://localhost:3050',
ethNetwork: 'http://localhost:8545',
url: 'http://0.0.0.0:3050',
ethNetwork: 'http://0.0.0.0:8545',
accounts: {
mnemonic: 'stuff slice staff easily soup parent arm payment cotton trade scatter struggle',
},
zksync: true,
},
zkSyncNetworkEmptyAccounts: {
allowUnlimitedContractSize: true,
url: 'http://localhost:3050',
ethNetwork: 'http://localhost:8545',
url: 'http://0.0.0.0:3050',
ethNetwork: 'http://0.0.0.0:8545',
accounts: [],
zksync: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ const config: HardhatUserConfig = {
},
zkSyncNetwork: {
allowUnlimitedContractSize: true,
url: 'http://localhost:3050',
ethNetwork: 'http://localhost:8545',
url: 'http://0.0.0.0:3050',
ethNetwork: 'http://0.0.0.0:8545',
zksync: true,
},
zkSyncTestnet: {
Expand Down
14 changes: 7 additions & 7 deletions packages/hardhat-zksync-ethers/test/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('Plugin tests', async function () {
it('the provider should handle requests', async function () {
const gasPrice = await this.env.zksyncEthers.providerL2.send('eth_gasPrice', []);

assert.strictEqual('0xee6b280', gasPrice);
assert.strictEqual('0x5f5e100', gasPrice);
});
it('should get the gas price', async function () {
const feeData = await this.env.zksyncEthers.providerL2.getFeeData();
Expand Down Expand Up @@ -231,7 +231,7 @@ describe('Plugin tests', async function () {

const gasPrice = await wallet.provider.send('eth_gasPrice', []);

assert.strictEqual('0xee6b280', gasPrice);
assert.strictEqual('0x5f5e100', gasPrice);
});
it('get valid second wallet', async function () {
const wallet = await this.env.zksyncEthers.getWallet(1);
Expand All @@ -242,7 +242,7 @@ describe('Plugin tests', async function () {

const gasPrice = await wallet.provider.send('eth_gasPrice', []);

assert.strictEqual('0xee6b280', gasPrice);
assert.strictEqual('0x5f5e100', gasPrice);
});
it('get invalid third wallet', async function () {
try {
Expand All @@ -260,7 +260,7 @@ describe('Plugin tests', async function () {

const gasPrice = await wallet.provider.send('eth_gasPrice', []);

assert.strictEqual('0xee6b280', gasPrice);
assert.strictEqual('0x5f5e100', gasPrice);
});
});

Expand All @@ -275,7 +275,7 @@ describe('Plugin tests', async function () {

const gasPrice = await wallet.provider.send('eth_gasPrice', []);

assert.strictEqual('0xee6b280', gasPrice);
assert.strictEqual('0x5f5e100', gasPrice);
});
it('get invalid second wallet with mnemonic', async function () {
try {
Expand All @@ -293,7 +293,7 @@ describe('Plugin tests', async function () {

const gasPrice = await wallet.provider.send('eth_gasPrice', []);

assert.strictEqual('0xee6b280', gasPrice);
assert.strictEqual('0x5f5e100', gasPrice);
});
});
describe('wallets with empty accounts', async function () {
Expand Down Expand Up @@ -321,7 +321,7 @@ describe('Plugin tests', async function () {

const gasPrice = await wallet.provider.send('eth_gasPrice', []);

assert.strictEqual('0xee6b280', gasPrice);
assert.strictEqual('0x5f5e100', gasPrice);
});
});
});
Expand Down
4 changes: 4 additions & 0 deletions packages/hardhat-zksync-solc/test/tests/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ describe('getZksolcUrl', () => {

it('should return the release URL when isRelease is true', () => {
platformStub.value('linux'); // Mock the process.platform property
const archStub = sinon.stub(process, 'arch');
archStub.value('x64');
const repo = 'example/repo';
const version = '1.0.0';
let expectedUrl = 'example/repo/releases/download/v1.0.0/zksolc-linux-amd64-musl-v1.0.0';
Expand All @@ -293,6 +295,8 @@ describe('getZksolcUrl', () => {

it('should return the raw URL when isRelease is false', () => {
platformStub.value('linux'); // Mock the process.platform property
const archStub = sinon.stub(process, 'arch');
archStub.value('x64');
const repo = 'example/repo';
const version = '1.0.0';
let expectedUrl = 'example/repo/raw/main/linux-amd64/zksolc-linux-amd64-musl-v1.0.0';
Expand Down
Loading

0 comments on commit 8507134

Please sign in to comment.