Skip to content

Commit

Permalink
Merge pull request #40 from orbs-network/matic-integration
Browse files Browse the repository at this point in the history
Matic integration
  • Loading branch information
daviddayag authored Mar 8, 2022
2 parents e5ca455 + aeab22f commit 94eec5b
Show file tree
Hide file tree
Showing 15 changed files with 25,484 additions and 1,825 deletions.
22 changes: 13 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,52 @@
version: 2.1
orbs:
node: circleci/node@3.0.1
node: circleci/node@4.9.0
docker: circleci/[email protected]
jobs:
build-and-test:
machine: true
machine:
image: ubuntu-2004:202010-01 # recommended linux image
steps:
- checkout
- node/install:
node-version: '12.18.0'
node-version: '16.13.1'
- docker/install-docker
- run: node --version
- run: npm --version
- run: docker --version
- run: python --version
- run: env
- node/install-packages
- run: npm install --no-save tap-xunit
- run: mkdir -p _out/unit _out/e2e
- run: npm test -- --timeout=1m --tap| npx tap-xunit > _out/unit/test.xml
- run: npm run build
- run: npm run test:e2e -- --timeout=1m --tap| npx tap-xunit > _out/e2e/test.xml
- run: npm run test:e2e -- --timeout=1m --tap| npx tap-xunit > _out/e2e/test.xml
- store_test_results:
path: _out
- store_artifacts:
path: _out
path: _out

build-and-release:
machine: true
machine:
image: ubuntu-2004:202010-01 # recommended linux image
steps:
- checkout
- node/install:
node-version: '12.18.0'
node-version: '16.13.1'
- docker/install-docker
- run: ./boyar/create-version-file.sh
- node/install-packages
- run: ./boyar/docker-build.sh
- run: ./.circleci/release.sh

build-and-release-to-staging:
machine: true
machine:
image: ubuntu-2004:202010-01 # recommended linux image
steps:
- checkout
- node/install:
node-version: '12.18.0'
node-version: '16.13.1'
- docker/install-docker
- run: ./boyar/create-version-file.sh
- node/install-packages
Expand Down
14 changes: 13 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14-alpine
FROM node:16-alpine

ENV NODE_ENV production

Expand All @@ -8,6 +8,18 @@ COPY package*.json ./
COPY .version ./version

RUN apk add --no-cache git

# see https://github.com/nodejs/docker-node/issues/282

# --no-cache: download package index on-the-fly, no need to cleanup afterwards
# --virtual: bundle packages, remove whole bundle at once, when done
RUN apk --no-cache --virtual build-dependencies add \
python3 \
make \
g++ \
&& npm install \
&& apk del build-dependencies

RUN npm install

COPY dist ./dist
Expand Down
5 changes: 3 additions & 2 deletions custom_typings/orbs-signer-client/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
declare module 'orbs-signer-client' {
import { TransactionConfig, SignedTransaction } from 'web3-core';
import { SignedTransaction } from 'web3-core';
import {TxData} from "@ethereumjs/tx";

export default class Signer {
public constructor(host: string);
sign(transaction: TransactionConfig): Promise<SignedTransaction>;
sign(transaction: TxData, chainId?: Number, expectedSenderAddress?: String): Promise<SignedTransaction>;
}
}
2 changes: 1 addition & 1 deletion e2e/Dockerfile-chain-43.test
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ COPY chain-43/*.js ./
RUN npm install

CMD [ "node", "index.js" ]
EXPOSE 8080
EXPOSE 8080
2 changes: 1 addition & 1 deletion e2e/Dockerfile-management-service.test
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ COPY management-service/*.js ./
RUN npm install

CMD [ "node", "index.js" ]
EXPOSE 8080
EXPOSE 8080
17 changes: 12 additions & 5 deletions e2e/driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class TestEnvironment {
public nodeOrbsAddress: string;
public testLogger: (lines: string) => void;

constructor(private pathToDockerCompose: string) {}
constructor(private pathToDockerCompose: string) { }

getAppConfig() {
return {
Expand Down Expand Up @@ -80,13 +80,20 @@ export class TestEnvironment {
t.log('[E2E] deploy ethereum PoS contracts to ganache');
t.timeout(5 * 60 * 1000);
const ganacheAddress = await getAddressForService(this.envName, this.pathToDockerCompose, 'ganache', 7545);
console.log(ganacheAddress);
console.log(`[posv2] about to deploy contracts`);
await new Promise((resolve) => {
console.log('waiting...')
setTimeout(resolve, 20000);

})
console.log('Done!');
this.ethereumPosDriver = await EthereumPosDriver.new({
web3Provider: () => {
return new Web3(
new (HDWalletProvider as any)(
'vanish junk genuine web seminar cook absurd royal ability series taste method identify elevator liquid',
`http://localhost:${portFromAddress(ganacheAddress)}`,
`http://${ganacheAddress}`,
0,
100,
false
Expand Down Expand Up @@ -124,14 +131,14 @@ export class TestEnvironment {
const configFilePath = join(__dirname, 'app-config.json');
try {
unlinkSync(configFilePath);
} catch (err) {}
} catch (err) { }
const config = this.getAppConfig();
if (require('./signer/keys.json')['node-address'] != config.NodeOrbsAddress) {
throw new Error(
`Incorrect address in ./signer/keys.json, use address ${config.NodeOrbsAddress} with private key ${(this
.ethereumPosDriver.web3.currentProvider as any).wallets['0x' + config.NodeOrbsAddress]._privKey.toString(
'hex'
)}`
'hex'
)}`
);
}
writeFileSync(configFilePath, JSON.stringify(config));
Expand Down
Loading

0 comments on commit 94eec5b

Please sign in to comment.