Skip to content

Commit

Permalink
Integrate faucet in go-obscuro (#1323)
Browse files Browse the repository at this point in the history
* Integrate faucet in go-obscuro

* trying to clean up

* updating checkout

* fixed selfhosted runner

* pr comments

* update readme

* fix deploy workflow

* login to azure registry

* latest:latest

* fix dns

* correct start

* local exec

* update run name
  • Loading branch information
otherview authored Jun 15, 2023
1 parent 612b5d5 commit 3a1eb7a
Show file tree
Hide file tree
Showing 24 changed files with 680 additions and 121 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
build:
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/hardhat-pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/manual-deploy-dev-obscuroscan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Docker
uses: docker/setup-buildx-action@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/manual-deploy-obscuroscan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v3
- name: Azure authentication
uses: azure/login@v1
with:
Expand Down
25 changes: 16 additions & 9 deletions .github/workflows/manual-deploy-testnet-faucet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# dev-testnet-faucet or testnet-faucet.uksouth.azurecontainer.io

name: '[M] Deploy Faucet Testnet'
run-name: '[M] Deploy Faucet Testnet (${{ github.event.action }})'
run-name: '[M] Deploy Faucet Testnet ( ${{ github.event.inputs.testnet_type }} )'
on:
workflow_dispatch:
inputs:
Expand Down Expand Up @@ -43,27 +43,34 @@ jobs:
echo "FAUCET_BUILD_TAG=testnetobscuronet.azurecr.io/obscuronet/dev_faucet_testnet:latest" >> $GITHUB_ENV
echo "TESTNET_ADDR=dev-testnet.obscu.ro" >> $GITHUB_ENV
- name: Build and Push Docker Image
run: |
DOCKER_BUILDKIT=1 docker build -t ${{env.FAUCET_BUILD_TAG}} -f tools/faucet/Dockerfile .
docker push ${{env.FAUCET_BUILD_TAG}}
- name: 'Login to Azure docker registry'
uses: azure/docker-login@v1
with:
login-server: testnetobscuronet.azurecr.io
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: 'Login via Azure CLI'
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Build and Push Docker Image
run: |
DOCKER_BUILDKIT=1 docker build -t ${{env.FAUCET_BUILD_TAG}} -f tools/faucet/Dockerfile .
docker push ${{env.FAUCET_BUILD_TAG}}
- name: 'Deploy to Azure Container Instances'
uses: 'azure/aci-deploy@v1'
with:
resource-group: ${{ secrets.RESOURCE_GROUP }}
dns-name-label: dev-testnet-faucet
image: ${{ FAUCET_BUILD_TAG }}:latest
name: ${{ github.event.inputs.testnet_type }}
dns-name-label: ${{ github.event.inputs.testnet_type }}-faucet
image: ${{ env.FAUCET_BUILD_TAG }}
name: ${{ github.event.inputs.testnet_type }}-faucet
location: 'uksouth'
restart-policy: 'Never'
environment-variables: PORT=80
command-line: cmd/faucet --nodeHost ${{ TESTNET_ADDR }} --pk ${{ secrets.FAUCET_PK }} --jwtSecret ${{ secrets.FAUCET_JWT_SECRET }}
command-line: ./faucet --nodeHost ${{ env.TESTNET_ADDR }} --pk ${{ secrets.FAUCET_PK }} --jwtSecret ${{ secrets.FAUCET_JWT_SECRET }}
ports: '80'
cpu: 2
memory: 2
2 changes: 1 addition & 1 deletion .github/workflows/manual-deploy-testnet-l1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: 'Set up Docker'
uses: docker/setup-buildx-action@v1
Expand Down
23 changes: 8 additions & 15 deletions .github/workflows/manual-deploy-testnet-l2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
L1_HOST: ${{ steps.outputVars.outputs.L1_HOST }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions/setup-go@v4
with:
Expand Down Expand Up @@ -275,7 +275,7 @@ jobs:
- deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: 'Login via Azure CLI'
uses: azure/login@v1
Expand Down Expand Up @@ -316,7 +316,7 @@ jobs:
- check-obscuro-is-healthy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: 'Deploy L2 contracts'
id: deployL2Contracts
Expand Down Expand Up @@ -348,16 +348,9 @@ jobs:
retention-days: 2

deploy-faucet:
runs-on: ubuntu-latest
name: 'Trigger Faucet deployment for dev- / testnet on a new deployment'
uses: ./.github/workflows/manual-deploy-testnet-faucet.yml
with:
testnet_type: ${{github.event.inputs.testnet_type}}
needs:
- check-obscuro-is-healthy
steps:
- name: 'Trigger Faucet deployment for testnet on a new deployment'
if: ${{ (github.event.inputs.testnet_type == 'testnet') }}
run: |
curl -XPOST -H "Authorization: Bearer ${{ secrets.GH_TOKEN }}" -H "Accept:application/vnd.github" -H "Content-Type:application/json" https://api.github.com/repos/obscuronet/faucet/dispatches --data '{ "event_type": "testnet_deployed", "client_payload": { "ref": "${{ github.ref }}" }'
- name: 'Trigger Faucet deployment for dev-testnet on a new deployment'
if: ${{ (github.event.inputs.testnet_type == 'dev-testnet') }}
run: |
curl -XPOST -H "Authorization: Bearer ${{ secrets.GH_TOKEN }}" -H "Accept:application/vnd.github" -H "Content-Type:application/json" https://api.github.com/repos/obscuronet/faucet/dispatches --data '{ "event_type": "dev_testnet_deployed", "client_payload": { "ref": "${{ github.ref }}" }'
- check-obscuro-is-healthy
2 changes: 1 addition & 1 deletion .github/workflows/manual-upgrade-testnet-l2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
VM_BUILD_NUMBER: ${{ steps.outputVars.outputs.VM_BUILD_NUMBER }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions/setup-go@v4
with:
Expand Down
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,12 @@ root
│ ├── <a href="./integration/simulation">simulation</a>: A series of tests that simulate running networks with different setups.
├── <a href="./testnet">testnet</a>: Utilities for deploying a testnet.
└── <a href="./tools">tools</a>: Peripheral tooling.
│ ├── <a href="./tools/azuredeployer">azuredeployer</a>: Automates deployment of Obscuro nodes to SGX-enabled Azure VMs.
│ ├── <a href="./tools/contractdeployer">contractdeployer</a>: Automates deployment of ERC20 and management contracts to the L1.
│ ├── <a href="./tools/networkmanager">networkmanager</a>: Network management tooling. Automates deployment of ERC20 and management contracts to the L1, and allows the injection of transactions into the network to simulate activity.
│ ├── <a href="./tools/obscuroscan">obscuroscan</a>: Tooling to monitor network transactions.
│ └── <a href="./tools/walletextension">walletextension</a>: Ensures sensitive messages to and from the Obscuro node are encrypted.
├── <a href="./tools/azuredeployer">azuredeployer</a>: Automates deployment of Obscuro nodes to SGX-enabled Azure VMs.
├── <a href="./tools/contractdeployer">contractdeployer</a>: Automates deployment of ERC20 and management contracts to the L1.
├── <a href="./tools/networkmanager">networkmanager</a>: Network management tooling. Automates deployment of ERC20 and management contracts to the L1, and allows the injection of transactions into the network to simulate activity.
├── <a href="./tools/faucet">faucet</a>: Faucet for testnet.
├── <a href="./tools/obscuroscan">obscuroscan</a>: Tooling to monitor network transactions.
└── <a h ref="./tools/walletextension">walletextension</a>: Ensures sensitive messages to and from the Obscuro node are encrypted.

</pre>

Expand Down Expand Up @@ -350,13 +351,11 @@ Once started Obscuroscan is available on `http://0.0.0.0:8098`.

### Building and running a local faucet
Deploying and interacting with contracts on Obscuro requires OBX to be allocated to an account via the faucet. The
faucet [repo](https://github.com/obscuronet/faucet) should be cloned, and the container built and started to allow
requests to be made to it. To build and run use;
faucet image should be pulled (or optionally built from scratch), and the container built and started to allow requests to be made to it. To build and run use;

```
git clone [email protected]:obscuronet/faucet.git
cd faucet
./container_build.sh
cd tools/faucet
docker pull testnetobscuronet.azurecr.io/obscuronet/faucet_testnet:latest
./container_run.sh
```

Expand Down
3 changes: 0 additions & 3 deletions docs/.gitmodules

This file was deleted.

51 changes: 28 additions & 23 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,61 +3,58 @@ module github.com/obscuronet/go-obscuro
go 1.20

require (
github.com/Azure/azure-sdk-for-go v63.2.0+incompatible
github.com/Azure/go-autorest/autorest v0.11.25
github.com/Azure/go-autorest/autorest/azure/auth v0.5.11
github.com/Azure/go-autorest/autorest/to v0.4.0
github.com/andybalholm/brotli v1.0.5
github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf
github.com/docker/go-connections v0.4.0
github.com/edgelesssys/ego v1.1.0
github.com/ethereum/go-ethereum v1.10.16
github.com/gin-gonic/gin v1.9.1
github.com/go-kit/kit v0.10.0
github.com/go-sql-driver/mysql v1.4.1
github.com/golang-jwt/jwt v3.2.2+incompatible
github.com/google/uuid v1.3.0
github.com/gorilla/websocket v1.4.2
github.com/kamilsk/breaker v1.2.1
github.com/mattn/go-sqlite3 v1.14.16
github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416
github.com/sanity-io/litter v1.5.5
github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4
github.com/stretchr/testify v1.8.1
github.com/stretchr/testify v1.8.3
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/tidwall/gjson v1.11.0
golang.org/x/crypto v0.4.0
golang.org/x/crypto v0.9.0
golang.org/x/sync v0.1.0
google.golang.org/grpc v1.45.0
google.golang.org/protobuf v1.28.0
google.golang.org/protobuf v1.30.0
)

require (
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.18 // indirect
github.com/Azure/go-autorest/autorest/azure/cli v0.4.5 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/autorest/validation v0.3.0 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/Microsoft/go-winio v0.6.0 // indirect
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
github.com/VictoriaMetrics/fastcache v1.6.0 // indirect
github.com/btcsuite/btcd v0.22.0-beta // indirect
github.com/bytedance/sonic v1.9.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set v1.8.0 // indirect
github.com/dimchansky/utfbom v1.1.1 // indirect
github.com/docker/distribution v2.8.1+incompatible // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/edsrzf/mmap-go v1.0.0 // indirect
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-logfmt/logfmt v0.5.0 // indirect
github.com/go-ole/go-ole v1.2.1 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.14.0 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/gogo/protobuf v1.3.1 // indirect
github.com/golang-jwt/jwt/v4 v4.4.1 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/hashicorp/go-bexpr v0.1.10 // indirect
Expand All @@ -66,16 +63,21 @@ require (
github.com/holiman/uint256 v1.2.0 // indirect
github.com/huin/goupnp v1.0.2 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/pointerstructure v1.2.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/naoina/go-stringutil v0.1.0 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/tsdb v0.7.1 // indirect
Expand All @@ -88,13 +90,16 @@ require (
github.com/tidwall/pretty v1.2.0 // indirect
github.com/tklauser/go-sysconf v0.3.5 // indirect
github.com/tklauser/numcpus v0.2.2 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef // indirect
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
golang.org/x/net v0.3.0 // indirect
golang.org/x/sys v0.3.0 // indirect
golang.org/x/text v0.5.0 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/mod v0.8.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
golang.org/x/tools v0.1.12 // indirect
golang.org/x/tools v0.6.0 // indirect
google.golang.org/appengine v1.6.6 // indirect
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
Expand Down
Loading

0 comments on commit 3a1eb7a

Please sign in to comment.