-
Notifications
You must be signed in to change notification settings - Fork 28
Conversation
016f456
to
6a02f8d
Compare
name: Docker CI Release | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
env: | ||
DOCKER_IMAGE: thehubbleproject/node | ||
DOCKER_IMAGE_SHA: ${{ env.DOCKER_IMAGE }}:${{ github.sha }} | ||
DOCKER_IMAGE_TAG: ${{ env.DOCKER_IMAGE }}:${{ github.event.release.tag_name }} | ||
DOCKER_IMAGE_LATEST: ${{ env.DOCKER_IMAGE }}:latest | ||
|
||
jobs: | ||
pull-tag-push: | ||
runs-on: ubuntu-latest | ||
needs: images | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- | ||
name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- | ||
name: Pull image for git sha | ||
run: docker pull ${{ env.DOCKER_IMAGE_SHA }} | ||
- | ||
name: Tag image with release | ||
run: docker tag ${{ env.DOCKER_IMAGE_SHA }} ${{ env.DOCKER_IMAGE_TAG }} | ||
- | ||
name: Tag image with latest | ||
if: ${{ github.event.release.prerelease == 'false' }} | ||
run: docker tag ${{ env.DOCKER_IMAGE_SHA }} ${{ env.DOCKER_IMAGE_LATEST }} | ||
- | ||
name: Push tagged image(s) | ||
# Pushing the image name without a tag will push all new tags. | ||
run: docker push ${{ env.DOCKER_IMAGE }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't be able to test this until we tag next release.
SETUP.md
Outdated
+ uint32 public constant BLOCKS_PER_SLOT = 10; | ||
+ uint32 public constant DELTA_BLOCKS_INITIAL_SLOT = 20; | ||
|
||
// donation numerator and demoninator are used to calculate donation amount | ||
uint256 public constant DONATION_DENOMINATOR = 10000; | ||
|
||
|
||
``` | ||
|
||
### generate | ||
|
||
Compiles [Solidity](https://soliditylang.org/) contracts and [TypeChain](https://github.com/ethereum-ts/Typechain) [TypeScript](https://www.typescriptlang.org/) bindings. | ||
```sh | ||
npm run generate | ||
``` | ||
|
||
### deploy | ||
|
||
``` | ||
npm run deploy -- \ | ||
--key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \ | ||
--root 0xbfef011dd64abe7707cee7b3b74a00b86689c8451f548371073ce3c935e09984 \ | ||
--numPubkeys 32 | ||
``` | ||
|
||
This should generate a `genesis.json` file that looks like: | ||
|
||
```json | ||
{ | ||
"parameters": { | ||
"MAX_DEPTH": 32, | ||
"MAX_DEPOSIT_SUBTREE_DEPTH": 2, | ||
"STAKE_AMOUNT": "100000000000000000", | ||
"BLOCKS_TO_FINALISE": 40320, | ||
"MIN_GAS_LEFT": 10000, | ||
"MAX_TXS_PER_COMMIT": 32, | ||
"USE_BURN_AUCTION": true, | ||
"DONATION_ADDRESS": "0x00000000000000000000000000000000000000d0", | ||
"DONATION_NUMERATOR": 7500, | ||
"GENESIS_STATE_ROOT": "0xbfef011dd64abe7707cee7b3b74a00b86689c8451f548371073ce3c935e09984" | ||
}, | ||
"addresses": { | ||
"frontendGeneric": "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9", | ||
"frontendTransfer": "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707", | ||
"frontendMassMigration": "0x0165878A594ca255338adfa4d48449f69242Eb8F", | ||
"frontendCreate2Transfer": "0xa513E6E4b8f2a923D98304ec87F64353C4D5C853", | ||
"blsAccountRegistry": "0x8A791620dd6260079BF849Dc5567aDC3F2FdC318", | ||
"tokenRegistry": "0x610178dA211FEF7D417bC0e6FeD39F05609AD788", | ||
"transfer": "0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0", | ||
"massMigration": "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e", | ||
"create2Transfer": "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82", | ||
"burnAuction": "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6", | ||
"exampleToken": "0x9A676e781A523b5d0C0e43731313A708CB607508", | ||
"spokeRegistry": "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE", | ||
"vault": "0x68B1D87F95878fE05B998F19b66F4baba5De1aed", | ||
"depositManager": "0x3Aa5ebB10DC797CAC828524e59A333d0A371443c", | ||
"rollup": "0xc6e7DF5E7b4f2A278906862b61205850344D4e7d", | ||
"withdrawManager": "0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44" | ||
}, | ||
"auxiliary": { | ||
"domain": "0x4ea7799478a7af2a47ba555f04aec4ae4ba240bf410d7c859c34c310f0413892", | ||
"genesisEth1Block": 306, | ||
"version": "20539ad4d99b3d3e4810de24c14ba41cdd89ea2c" | ||
} | ||
} | ||
``` | ||
|
||
The client will be parameterized using this file. | ||
|
||
## Run Client (Node) | ||
|
||
```sh | ||
npx ts-node ./scripts/simulate.ts --proposer | ||
``` | ||
|
||
### repl (Hubble console) | ||
|
||
```sh | ||
npm run repl | ||
``` | ||
|
||
Then in repl console, run a transfer: | ||
|
||
```sh | ||
hubble.transfer(0, 1, 1, 1) | ||
``` | ||
|
||
## Run Tests | ||
|
||
Note: Full test suite run currently fails due to test state leak | ||
|
||
```sh | ||
npm run test | ||
``` | ||
|
||
### fast/slow/client | ||
|
||
```sh | ||
npm run test -- test/fast/* # slow/client/etc. | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChihChengLiang This is primarily based off setup instructions you gave me for onboarding, figured it would be useful for others as well :)
import { ContractTransaction } from "ethers"; | ||
import { assert, expect } from "chai"; | ||
|
||
export async function expectRevert( | ||
tx: Promise<ContractTransaction>, | ||
revertReason: string | ||
) { | ||
await tx.then( | ||
() => { | ||
assert.fail(`Expect tx to fail with reason: ${revertReason}`); | ||
}, | ||
error => { | ||
expect(error.message).to.have.string(revertReason); | ||
} | ||
); | ||
} | ||
|
||
export async function expectCallRevert( | ||
tx: Promise<any>, | ||
revertReason: string | null | ||
) { | ||
await tx.then( | ||
() => { | ||
assert.fail(`Expect tx to fail with reason: ${revertReason}`); | ||
}, | ||
error => { | ||
if (revertReason === null) { | ||
assert.isNull(error.reason); | ||
} else { | ||
expect(error.reason).to.have.string(revertReason); | ||
} | ||
} | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This properly separates out test/npm devDeps from prod ones for production Node.js assets.
Wicked fast Docker build/push https://github.com/thehubbleproject/hubble-contracts/actions/runs/926988151 |
CI time for Node.js reduced by |
df9386c
to
d2a4fc3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Have a comment on docker instruction, other looks good.
Add alpine based Dockerfile to build production-ready version of Hubble node. Setup Docker CI pipelines for build/push and tagging images with releases. Paralellize Node.js testing steps to decrease CI run time. Move minimist to prod npm deps, use import instead of require. Move chai/testing utils to seperate util file. Add proper error catching to a number of scripts. Update README, add Docker README. Add local dev setup instructions.
d2a4fc3
to
4d1ae23
Compare
Resolves #561
TODO
docker-compose
file as example./docker/README.md