Skip to content

Commit

Permalink
Merge pull request #387 from EYBlockchain/daveroga/remove-subdirector…
Browse files Browse the repository at this point in the history
…y-dockerfiles

daveroga/Remove subdirectory-level Dockerfiles
  • Loading branch information
Westlad authored Jan 28, 2022
2 parents 62ca1d3 + f691c81 commit 0192862
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 165 deletions.
22 changes: 12 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ version: '3.5'
services:
client1:
build:
dockerfile: Dockerfile
context: ./nightfall-client
dockerfile: client.Dockerfile
context: .
volumes:
- type: bind
source: ./nightfall-client/src
Expand Down Expand Up @@ -48,8 +48,8 @@ services:

client2:
build:
dockerfile: Dockerfile
context: ./nightfall-client
dockerfile: client.Dockerfile
context: .
volumes:
- type: bind
source: ./nightfall-client/src
Expand Down Expand Up @@ -93,8 +93,8 @@ services:
worker:
# image: 3800decac71d
build:
dockerfile: Dockerfile
context: ./zokrates-worker
dockerfile: worker.Dockerfile
context: .
volumes:
- type: volume
source: proving_files
Expand All @@ -119,8 +119,8 @@ services:
deployer:
#image: docker.pkg.github.com/eyblockchain/nightfall-deployer/nightfall_deployer:1.1.0
build:
context: ./nightfall-deployer
dockerfile: Dockerfile
dockerfile: deployer.Dockerfile
context: .
volumes:
- type: volume
source: build
Expand Down Expand Up @@ -179,7 +179,8 @@ services:

optimist1:
build:
context: ./nightfall-optimist
dockerfile: optimist.Dockerfile
context: .
depends_on:
- deployer
networks:
Expand Down Expand Up @@ -213,7 +214,8 @@ services:

optimist2:
build:
context: ./nightfall-optimist
dockerfile: optimist.Dockerfile
context: .
depends_on:
- deployer
networks:
Expand Down
30 changes: 0 additions & 30 deletions nightfall-client/Dockerfile

This file was deleted.

18 changes: 0 additions & 18 deletions nightfall-deployer/Dockerfile

This file was deleted.

42 changes: 0 additions & 42 deletions nightfall-optimist/Dockerfile

This file was deleted.

2 changes: 0 additions & 2 deletions test/constants.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ export const ethereumSigningKeyProposer1 =
// '0x35d9f2b07aaa323d56d031934e0eda93dd3d46a49e5a3f026a45f0e83f3c9ede';
export const ethereumSigningKeyProposer2 =
'0xd42905d0582c476c4b74757be6576ec323d715a0c7dcff231b6348b7ab0190eb';
export const ethereumSigningKeyProposer3 =
'0xfbc1ee1c7332e2e5a76a99956f50b3ba2639aff73d56477e877ef8390c41e0c6';
export const ethereumSigningKeyChallenger =
'0xd42905d0582c476c4b74757be6576ec323d715a0c7dcff231b6348b7ab0190eb';
export const ethereumSigningKeyLiquidityProvider =
Expand Down
57 changes: 17 additions & 40 deletions test/e2e/nightfall-sdk.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
ethereumSigningKeyUser2,
ethereumSigningKeyProposer1,
ethereumSigningKeyProposer2,
ethereumSigningKeyProposer3,
ethereumSigningKeyLiquidityProvider,
ethereumSigningKeyChallenger,
txPerBlock,
Expand Down Expand Up @@ -51,7 +50,6 @@ describe('Testing the Nightfall SDK', () => {
const nf3User2 = new Nf3(web3WsUrl, ethereumSigningKeyUser2, environment);
const nf3Proposer1 = new Nf3(web3WsUrl, ethereumSigningKeyProposer1, environment);
const nf3Proposer2 = new Nf3(web3WsUrl, ethereumSigningKeyProposer2, environment);
const nf3Proposer3 = new Nf3(web3WsUrl, ethereumSigningKeyProposer3, environment);
const nf3Challenger = new Nf3(web3WsUrl, ethereumSigningKeyChallenger, environment);
const nf3LiquidityProvider = new Nf3(web3WsUrl, ethereumSigningKeyLiquidityProvider, environment);

Expand Down Expand Up @@ -161,7 +159,6 @@ describe('Testing the Nightfall SDK', () => {
await nf3User2.init(mnemonicUser2); // 2nd client to do transfer tests and checks
await nf3Proposer1.init(mnemonicProposer);
await nf3Proposer2.init(mnemonicProposer);
await nf3Proposer3.init(mnemonicProposer);
await nf3Challenger.init(mnemonicChallenger);
await nf3LiquidityProvider.init(mnemonicLiquidityProvider);

Expand All @@ -176,7 +173,6 @@ describe('Testing the Nightfall SDK', () => {
if (!(await nf3User2.healthcheck('client'))) throw new Error('Healthcheck failed');
if (!(await nf3Proposer1.healthcheck('optimist'))) throw new Error('Healthcheck failed');
if (!(await nf3Proposer2.healthcheck('optimist'))) throw new Error('Healthcheck failed');
if (!(await nf3Proposer3.healthcheck('optimist'))) throw new Error('Healthcheck failed');
if (!(await nf3Challenger.healthcheck('optimist'))) throw new Error('Healthcheck failed');
if (!(await nf3LiquidityProvider.healthcheck('optimist')))
throw new Error('Healthcheck failed');
Expand Down Expand Up @@ -219,6 +215,19 @@ describe('Testing the Nightfall SDK', () => {
const balances = await getERCInfo(erc20Address, nf3LiquidityProvider.ethereumAddress, web3);
console.log(`BALANCES LIQUIDITY PROVIDER FOR ERC20 (${erc20Address}): `, balances);

const txDataToSign = await approve(
erc20Address,
nf3LiquidityProvider.ethereumAddress,
nf3LiquidityProvider.shieldContractAddress,
tokenType,
value,
web3,
!!nf3LiquidityProvider.ethereumSigningKey,
);
if (txDataToSign) {
await nf3LiquidityProvider.submitTransaction(txDataToSign, erc20Address, 0);
}

// Liquidity provider for instant withdraws
const emitter = await nf3User1.getInstantWithdrawalRequestedEmitter();
emitter.on('data', async (withdrawTransactionHash, paidBy, amount) => {
Expand All @@ -228,37 +237,24 @@ describe('Testing the Nightfall SDK', () => {
web3,
);
// approve tokens to be advanced by liquidity provider in the instant withdraw
let txDataToSign;
try {
txDataToSign = await approve(
erc20Address,
nf3LiquidityProvider.ethereumAddress,
nf3LiquidityProvider.shieldContractAddress,
tokenType,
value,
web3,
!!nf3LiquidityProvider.ethereumSigningKey,
);
if (txDataToSign) {
await nf3LiquidityProvider.submitTransaction(txDataToSign, erc20Address, 0);
}
await nf3LiquidityProvider.advanceInstantWithdrawal(withdrawTransactionHash);
stateBalance += fee + BLOCK_STAKE;
} catch (e) {
console.log(e);
console.log('ERROR Liquidity Provider: ', e);
}

console.log(` Serviced instant-withdrawal request from ${paidBy}, with fee ${amount}`);
await new Promise(resolve => setTimeout(resolve, 5000));
for (let i = 0; i < txPerBlock; i++) {
// eslint-disable-next-line no-await-in-loop
res = await nf3User1.transfer(
await nf3User1.transfer(
false,
erc20Address,
tokenType,
value,
tokenId,
nf3User1.zkpKeys.compressedPkd,
nf3User1.zkpKeys.pkd,
fee,
);
}
Expand Down Expand Up @@ -339,21 +335,6 @@ describe('Testing the Nightfall SDK', () => {
expect(thisProposer.length).to.be.equal(1);
});

it('should register other proposer', async () => {
let proposers;
({ proposers } = await nf3Proposer3.getProposers());
// we have to pay 10 ETH to be registered
const startBalance = await getBalance(nf3Proposer3.ethereumAddress);
const res = await nf3Proposer3.registerProposer();
stateBalance += bond;
expectTransaction(res);
({ proposers } = await nf3Proposer3.getProposers());
const endBalance = await getBalance(nf3Proposer3.ethereumAddress);
expect(endBalance - startBalance).to.closeTo(-bond, gasCosts);
const thisProposer = proposers.filter(p => p.thisAddress === nf3Proposer3.ethereumAddress);
expect(thisProposer.length).to.be.equal(1);
});

it('should de-register a proposer', async () => {
let proposers;
({ proposers } = await nf3Proposer1.getProposers());
Expand Down Expand Up @@ -400,7 +381,6 @@ describe('Testing the Nightfall SDK', () => {
after(async () => {
// After the proposer tests, re-register proposers
await nf3Proposer2.deregisterProposer();
await nf3Proposer3.deregisterProposer();
await nf3Proposer1.registerProposer();
stateBalance += bond;
});
Expand Down Expand Up @@ -1082,13 +1062,11 @@ describe('Testing the Nightfall SDK', () => {
tokenType,
value,
tokenId,
nf3User1.zkpKeys.compressedPkd,
nf3User1.zkpKeys.pkd,
fee,
);
}
stateBalance += fee + BLOCK_STAKE;
// console.log(' Waiting for blockProposed event...');
// eventLogs = await waitForEvent(eventLogs, ['blockProposed']);
// we wait for the liquidity provider to send the instant withdraw
console.log(' Waiting for instantWithdraw event...');
await waitForTxExecution(count, 'instantWithdraw');
Expand Down Expand Up @@ -1368,7 +1346,6 @@ describe('Testing the Nightfall SDK', () => {
nf3User2.close();
nf3Proposer1.close();
nf3Proposer2.close();
nf3Proposer3.close();
nf3Challenger.close();
nf3LiquidityProvider.close();
closeWeb3Connection();
Expand Down
23 changes: 0 additions & 23 deletions zokrates-worker/Dockerfile

This file was deleted.

0 comments on commit 0192862

Please sign in to comment.