Skip to content

Commit

Permalink
Merge pull request #125 from b2network/bridge
Browse files Browse the repository at this point in the history
Bridge module
  • Loading branch information
Stonepapa authored Feb 26, 2024
2 parents 0110903 + 00b820a commit eb0a355
Show file tree
Hide file tree
Showing 161 changed files with 32,895 additions and 131 deletions.
25 changes: 25 additions & 0 deletions .env.bitcoin
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
BITCOIN_BRIDGE_AA_KERNEL_FACTORY=0xB457BF68D71a17Fa5030269Fb895e29e6cD2DF25
BITCOIN_BRIDGE_AA_SCA_REGISTRY=0xB457BF68D71a17Fa5030269Fb895e29e6cD2DF24
BITCOIN_BRIDGE_ABI=aaa.abi
BITCOIN_BRIDGE_CONTRACT_ADDRESS=0xB457BF68D71a17Fa5030269Fb895e29e6cD2DF22
BITCOIN_BRIDGE_ETH_PRIV_KEY=
BITCOIN_BRIDGE_ETH_RPC_URL=127.0.0.1:8545
BITCOIN_BRIDGE_GAS_LIMIT=23333
BITCOIN_DESTINATION=tb1qfhhxljfajcppfhwa09uxwty5dz4xwfptnqmvtv
BITCOIN_ENABLE_COMMITTER=false
BITCOIN_ENABLE_INDEXER=false
BITCOIN_EVM_DEPOSIT=0x01bee1bfa4116bd0440a1108ef6cb6a2f6eb9b611d8f53260aec20d39e84ee89
BITCOIN_EVM_ENABLE_LISTENER=false
BITCOIN_EVM_WITHDRAW=0xda335c6ae73006d1145bdcf9a98bc76d789b653b13fe6200e6fc4c5dd54add86
BITCOIN_INDEXER_LISTEN_ADDRESS=tb1qgm39cu009lyvq93afx47pp4h9wxq5x92lxxgnz
BITCOIN_NETWORK_NAME=testnet
BITCOIN_RPC_HOST=127.0.0.1
BITCOIN_RPC_PASS=123456
BITCOIN_RPC_PORT=8888
BITCOIN_RPC_USER=test
BITCOIN_STATE_DB_NAME=db
BITCOIN_STATE_HOST=localhost
BITCOIN_STATE_PASS=password
BITCOIN_STATE_PORT=5432
BITCOIN_STATE_USER=user
BITCOIN_WALLET_NAME=test
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
pull_request:
branches:
- main
- dev

jobs:
cleanup-runs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ name: "CodeQL"

on:
push:
branches: [main]
branches: [main, dev]
pull_request:
# The branches below must be a subset of the branches above
branches: [main]
branches: [main, dev]
schedule:
- cron: '37 21 * * 4'

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy-contract.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
pull_request:
branches:
- main
- dev

jobs:
cleanup-runs:
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build docker images

on:
push:
branches:
- "main"
- "dev"
tags:
- "v*.*.*"
pull_request:
branches:
- "main"
- "dev"

jobs:
docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Git fetch everything
run: git fetch --prune --unshallow
-
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/${{ github.repository }}
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=sha
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64, linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
9 changes: 5 additions & 4 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
name: "Pull Request Labeler"
on:
pull_request:
pull_request_target:
push:
branches:
- main
- dev

jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/labeler@v4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
push:
branches:
- main
- dev
jobs:
golangci:
name: Run golangci-lint
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/markdown-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
push:
branches:
- main
- dev
paths:
- '**.md'

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- dev

jobs:
Gosec:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/semgrep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- main
- dev
paths:
- .github/workflows/semgrep.yml
schedule:
Expand All @@ -15,11 +16,11 @@ jobs:
name: Scan
runs-on: ubuntu-latest
container:
image: returntocorp/semgrep
image: returntocorp/semgrep:1.47.0
if: (github.actor != 'dependabot[bot]')
steps:
- name: Permission issue fix
run: git config --global --add safe.directory /__w/ethermint/ethermint
run: git config --global --add safe.directory /__w/b2-node/b2-node
- uses: actions/checkout@v3
- name: Get Diff
uses: technote-space/[email protected]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ name: Lint Code Base

on:
push:
branches: ["main"]
branches: ["main", "dev"]
pull_request:
branches: ["main"]
branches: ["main", "dev"]
jobs:
run-lint:
runs-on: ubuntu-latest
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- dev
- release/**

jobs:
Expand All @@ -18,9 +19,9 @@ jobs:
test-unit-cover:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
- uses: actions/setup-go@v4.1.0
with:
go-version: 1.19
go-version: 1.20.11
check-latest: true
- uses: actions/checkout@v3
- uses: technote-space/[email protected]
Expand Down Expand Up @@ -87,10 +88,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
- uses: cachix/install-nix-action@v23
- uses: cachix/cachix-action@v12
with:
name: ethermint
name: b2-node
signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}"
- uses: technote-space/[email protected]
with:
Expand Down Expand Up @@ -122,10 +123,10 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
- uses: cachix/install-nix-action@v23
- uses: cachix/cachix-action@v12
with:
name: ethermint
name: b2-node
signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}"
- name: 'instantiate integration test env'
run: nix-store -r "$(nix-instantiate tests/integration_tests/shell.nix)"
3 changes: 2 additions & 1 deletion .gitleaks.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ paths = [
'''(go.mod|go.sum)$''',
'''node_modules''',
'''vendor''',
'''init.sh'''
'''init.sh''',
'''init.bat'''
]

[[rules]]
Expand Down
14 changes: 7 additions & 7 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ run:
linters:
enable:
- bodyclose
- depguard
# - depguard
- dogsled
- dupl
- errcheck
Expand Down Expand Up @@ -67,9 +67,9 @@ linters-settings:
gomodguard:
blocked:
versions: # List of blocked module version constraints
- https://github.com/etcd-io/etcd: # Blocked module with version constraint
version: ">= 3.4.10 || ~3.3.23" # Version constraint, see https://github.com/Masterminds/semver#basic-comparisons
reason: "CVE-2020-15114; CVE-2020-15136; CVE-2020-15115" # Reason why the version constraint exists. (Optional)
- https://github.com/dgrijalva/jwt-go: # Blocked module with version constraint
version: ">= 4.0.0-preview1" # Version constraint, see https://github.com/Masterminds/semver#basic-comparisons
reason: "CVE-2020-26160" # Reason why the version constraint exists. (Optional)
- https://github.com/etcd-io/etcd: # Blocked module with version constraint
version: ">= 3.4.10 || ~3.3.23" # Version constraint, see https://github.com/Masterminds/semver#basic-comparisons
reason: "CVE-2020-15114; CVE-2020-15136; CVE-2020-15115" # Reason why the version constraint exists. (Optional)
- https://github.com/dgrijalva/jwt-go: # Blocked module with version constraint
version: ">= 4.0.0-preview1" # Version constraint, see https://github.com/Masterminds/semver#basic-comparisons
reason: "CVE-2020-26160" # Reason why the version constraint exists. (Optional)
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ endif

ifeq (, $(shell which go-bindata))
@echo "Installing go-bindata..."
@go get github.com/kevinburke/go-bindata/go-bindata
@go get github.com/kevinburke/go-bindata/v4/...@latest
else
@echo "go-bindata already installed; skipping..."
endif
Expand Down Expand Up @@ -312,6 +312,7 @@ test-all: test-unit test-race
PACKAGES_UNIT=$(shell go list ./... | grep -Ev 'vendor|importer')
TEST_PACKAGES=./...
TEST_TARGETS := test-unit test-unit-cover test-race
SKIP_TEST_METHOD='(TestNewInscriptionTool|^TestLocal)'

# Test runs-specific rules. To add a new test target, just add
# a new rule, customise ARGS or TEST_PACKAGES ad libitum, and
Expand All @@ -328,9 +329,9 @@ test-unit-cover: TEST_PACKAGES=$(PACKAGES_UNIT)

run-tests:
ifneq (,$(shell which tparse 2>/dev/null))
go test -mod=readonly -json $(ARGS) $(EXTRA_ARGS) $(TEST_PACKAGES) | tparse
go test -skip=$(SKIP_TEST_METHOD) -mod=readonly -json $(ARGS) $(EXTRA_ARGS) $(TEST_PACKAGES) | tparse
else
go test -mod=readonly $(ARGS) $(EXTRA_ARGS) $(TEST_PACKAGES)
go test -skip=$(SKIP_TEST_METHOD) -mod=readonly $(ARGS) $(EXTRA_ARGS) $(TEST_PACKAGES)
endif

test-import:
Expand All @@ -357,7 +358,7 @@ test-solidity:


benchmark:
@go test -mod=readonly -bench=. $(PACKAGES_NOSIMULATION)
@go test -skip=$(SKIP_TEST_METHOD) -mod=readonly -bench=. $(PACKAGES_NOSIMULATION)
.PHONY: benchmark

###############################################################################
Expand Down
Loading

0 comments on commit eb0a355

Please sign in to comment.