This repository has been archived by the owner on Jun 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
25 changed files
with
525 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: 2 | ||
updates: | ||
# Maintain dependencies for GitHub Actions | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Docker CI | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
env: | ||
DOCKER_IMAGE: thehubbleproject/node | ||
|
||
jobs: | ||
build-push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- | ||
name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- | ||
name: Build and push git sha | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
file: docker/Dockerfile | ||
push: true | ||
tags: ${{ env.DOCKER_IMAGE }}:${{ github.sha }} | ||
# Consider using GitHub local cache in the future | ||
# https://docs.docker.com/ci-cd/github-actions/#optimizing-the-workflow | ||
# https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md#github-cache | ||
cache-from: type=registry,ref=${{ env.DOCKER_IMAGE }}:latest | ||
cache-to: type=inline | ||
- | ||
name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ types/ethers-contracts/ | |
cache/ | ||
artifacts/ | ||
build/ | ||
docker/testData |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,55 @@ | ||
# Hubble Optimistic Rollup Contracts | ||
# Hubble Optimistic Rollup Contracts & NodeJS TypeScript Client (Node) | ||
|
||
![Node.js CI](https://github.com/thehubbleproject/RedditHubble/workflows/Node.js%20CI/badge.svg) | ||
|
||
## About Hubble | ||
|
||
Hubble is a token transfer solution to improve Ethereum throughput from 20 transactions per second to 2600. | ||
Hubble is an [ERC-20](https://ethereum.org/en/developers/docs/standards/tokens/erc-20/) token transfer solution that improves Ethereum throughput from 20 transactions per second to ~2700. | ||
|
||
### How it work | ||
### How it works | ||
|
||
People sumit transfers to a coordinator, who then submits transactions and the state root of the balances update to a Ethereum contract. | ||
Accounts submit transfers to a coordinator node who then submits transactions and the state root of the balance updates to an Ethereum smart contract ([Rollup.sol](./contracts/rollup/Rollup.sol)). | ||
|
||
### Why can that improve the throughput | ||
### How does this improve throughput? | ||
|
||
The contract does not validate either the correctness of the balances update or the authenticity of the sender. | ||
The contract does not validate either the correctness of the balance updates or the authenticity of the sender. | ||
|
||
### What if the coordinator submit incorrect balances update? | ||
### What if the coordinator submits incorrect balance updates? | ||
|
||
Anyone can trigger the dispute methods of the contract and penalize the coordinator by burning the assets they staked beforehand. The contract rolls back to the last state when the balance was correct. | ||
Anyone can trigger the dispute methods of the contract and penalize the coordinator by burning the assets they staked beforehand. The contract rolls back to the last state when the balances were correct. | ||
|
||
### How is it different from these projects | ||
### How is it different from other Layer 2 (L2) Ethereum projects? | ||
|
||
- Optimism: Hubble does not support virtual machine, ... yet. | ||
- ZK rollups: Both improve throughput but Hubble is ZK free. No zero-knowledge moon math, only boring EVM at work. | ||
- [Optimism](https://optimism.io/): Hubble does not support the EVM virtual machine, ... yet. | ||
- [ZK (zero knowledge proof) rollups](https://docs.ethhub.io/ethereum-roadmap/layer-2-scaling/zk-rollups/): Both improve throughput but Hubble is ZK free. No zero-knowledge moon math, only boring EVM at work. | ||
- ZK optimistic rollups: Hubble does not address privacy. | ||
|
||
Hubble has the highest throughput compared with all above applications, since | ||
Hubble has the highest throughput compared with the above, since: | ||
|
||
- We use BLS signature aggregation to reduce the size to store data on chain | ||
- We optimize for simple transfer | ||
- Hubble use BLS signature aggregation to reduce the size to store data on chain. | ||
- We optimize for simple token transfers. | ||
|
||
### What else can Hubble do | ||
|
||
- Mass Migration: Users can migrate their tokens to other layer 2 solutions without withdraw to and deposit from layer 1 again. | ||
- Create2Transfer: Users can onboard Hubble without going through layer 1. The coordinator can register pubkeys for them and they can acquire tokens from holders who are already in Hubble. | ||
#### Mass Migration | ||
|
||
Users can migrate their tokens to other L2 solutions without withdrawing to and depositing from Layer 1 (L1) again. | ||
|
||
## Getting Started | ||
#### Create2Transfer | ||
|
||
```sh | ||
npm install | ||
npm run generate | ||
``` | ||
Users can onboard accounts to Hubble without going through L1. The coordinator can register their public keys and then they can acquire tokens from holders who are already in the Hubble L2. | ||
|
||
## Local Development | ||
|
||
## Testing | ||
See [Setup](./SETUP.md) instructions | ||
|
||
## Docker | ||
|
||
https://hub.docker.com/r/thehubbleproject/node | ||
|
||
```sh | ||
npm run test | ||
docker pull thehubbleproject/node:latest | ||
# or for a specific release, ...:v0.x.y | ||
``` | ||
|
||
See [Docker](./docker/README.md) instructions. |
Oops, something went wrong.