Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/v0.5.0 #3

Merged
merged 4 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 0 additions & 103 deletions .circleci/config.yml

This file was deleted.

20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: ci

on:
pull_request:
branches:
- '**'

jobs:
lint_test:
uses: babylonlabs-io/.github/.github/workflows/[email protected]
with:
run-unit-tests: true
run-integration-tests: true
run-lint: true

docker_pipeline:
uses: babylonlabs-io/.github/.github/workflows/[email protected]
secrets: inherit
with:
publish: false
24 changes: 24 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: docker_publish

on:
push:
branches:
- 'main'
- 'dev'
tags:
- '*'

jobs:
lint_test:
uses: babylonlabs-io/.github/.github/workflows/[email protected]
with:
run-unit-tests: true
run-integration-tests: true
run-lint: true

docker_pipeline:
needs: ["lint_test"]
uses: babylonlabs-io/.github/.github/workflows/[email protected]
secrets: inherit
with:
publish: true
196 changes: 98 additions & 98 deletions CHANGELOG.md

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ FROM golang:1.22.3 as builder
RUN apt-get update && apt-get install -y make git bash gcc curl jq

# Build
WORKDIR /go/src/github.com/babylonchain/btc-staker
WORKDIR /go/src/github.com/babylonlabs-io/btc-staker
# Cache dependencies
COPY go.mod go.sum /go/src/github.com/babylonchain/btc-staker/
COPY go.mod go.sum /go/src/github.com/babylonlabs-io/btc-staker/
RUN go mod download

# Copy the rest of the files
COPY ./ /go/src/github.com/babylonchain/btc-staker/
COPY ./ /go/src/github.com/babylonlabs-io/btc-staker/

RUN BUILD_TAGS=netgo \
LDFLAGS="-w -s" \
Expand All @@ -22,7 +22,7 @@ FROM debian:bookworm-slim AS run
RUN addgroup --gid 1138 --system btcstaker && adduser --uid 1138 --system --home /home/btcstaker btcstaker
RUN apt-get update && apt-get install -y bash curl jq wget

COPY --from=builder /go/src/github.com/babylonchain/btc-staker/go.mod /tmp
COPY --from=builder /go/src/github.com/babylonlabs-io/btc-staker/go.mod /tmp
RUN WASMVM_VERSION=$(grep github.com/CosmWasm/wasmvm /tmp/go.mod | cut -d' ' -f2) && \
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm.$(uname -m).so \
-O /lib/libwasmvm.$(uname -m).so && \
Expand All @@ -31,8 +31,8 @@ RUN WASMVM_VERSION=$(grep github.com/CosmWasm/wasmvm /tmp/go.mod | cut -d' ' -f2
sha256sum /lib/libwasmvm.$(uname -m).so | grep $(cat /tmp/checksums.txt | grep libwasmvm.$(uname -m) | cut -d ' ' -f 1)
RUN rm -f /tmp/go.mod

COPY --from=builder /go/src/github.com/babylonchain/btc-staker/build/stakerd /bin/stakerd
COPY --from=builder /go/src/github.com/babylonchain/btc-staker/build/stakercli /bin/stakercli
COPY --from=builder /go/src/github.com/babylonlabs-io/btc-staker/build/stakerd /bin/stakerd
COPY --from=builder /go/src/github.com/babylonlabs-io/btc-staker/build/stakercli /bin/stakercli

WORKDIR /home/btcstaker
RUN chown -R btcstaker /home/btcstaker
Expand Down
6 changes: 3 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.

Parameters

Licensor: Babylonchain, Inc.
Licensor: Babylon Labs, Ltd.

Licensed Work: btc-staker
The Licensed Work is (c) 2023 Babylonchain, Inc.
The Licensed Work is (c) 2023 Babylon Labs, Ltd.

Additional Use Grant: None.

Change Date: 2027-01-20 (January 20th, 2027]
Change Date: 2027-01-20 (January 20th, 2027)

Change License: Apache 2.0

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ DOCKER = $(shell which docker)
BUILDDIR ?= $(CURDIR)/build
TOOLS_DIR := tools

BABYLON_PKG := github.com/babylonchain/babylon/cmd/babylond
BABYLON_PKG := github.com/babylonlabs-io/babylon/cmd/babylond

GO_BIN := ${GOPATH}/bin

Expand Down Expand Up @@ -42,7 +42,7 @@ $(BUILDDIR)/:
mkdir -p $(BUILDDIR)/

build-docker:
$(DOCKER) build --tag babylonchain/btc-staker -f Dockerfile \
$(DOCKER) build --tag babylonlabs-io/btc-staker -f Dockerfile \
$(shell git rev-parse --show-toplevel)

.PHONY: build build-docker
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ Please update the following configurations in the provided file:
and this [link](https://github.com/bitcoin/bitcoin/pull/28597).
4. If you want to enable remote connections to the node, you can add
`rpcallowip=0.0.0.0/0` and `rpcbind=0.0.0.0` to the bitcoind command.
5. Start the `bitcoind` with `-txindex` option to make sure btc-staker can get
5. Start the `bitcoind` with `-txindex` option to make sure btc-staker can get
all needed bitcoin transaction data.

```bash
```bash
# Create the service file
sudo tee /etc/systemd/system/bitcoind.service >/dev/null <<EOF
[Unit]
Expand Down Expand Up @@ -228,7 +228,7 @@ command
getwalletinfo
```
The output should be similar to this and the `format` should be `bdb`:
```bash
```bash
{
"walletname": "btcstaker",
"walletversion": 169900,
Expand Down Expand Up @@ -276,11 +276,11 @@ sudo apt install build-essential
To get started, clone the repository to your local machine from Github:

```bash
git clone https://github.com/babylonchain/btc-staker.git
git clone https://github.com/babylonlabs-io/btc-staker.git
```

You can choose a specific version from
the [official releases page](https://github.com/babylonchain/btc-staker/releases)
the [official releases page](https://github.com/babylonlabs-io/btc-staker/releases)

```bash
cd btc-staker # cd into the project directory
Expand Down
18 changes: 9 additions & 9 deletions babylonclient/babyloncontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ import (
"strings"
"time"

btcctypes "github.com/babylonchain/babylon/x/btccheckpoint/types"
btcctypes "github.com/babylonlabs-io/babylon/x/btccheckpoint/types"

sdkErr "cosmossdk.io/errors"
sdkmath "cosmossdk.io/math"
"github.com/avast/retry-go/v4"
bbnclient "github.com/babylonchain/babylon/client/client"
bbntypes "github.com/babylonchain/babylon/types"
bcctypes "github.com/babylonchain/babylon/x/btccheckpoint/types"
btclctypes "github.com/babylonchain/babylon/x/btclightclient/types"
btcstypes "github.com/babylonchain/babylon/x/btcstaking/types"
"github.com/babylonchain/btc-staker/stakercfg"
"github.com/babylonchain/btc-staker/stakerdb"
"github.com/babylonchain/btc-staker/utils"
bbnclient "github.com/babylonlabs-io/babylon/client/client"
bbntypes "github.com/babylonlabs-io/babylon/types"
bcctypes "github.com/babylonlabs-io/babylon/x/btccheckpoint/types"
btclctypes "github.com/babylonlabs-io/babylon/x/btclightclient/types"
btcstypes "github.com/babylonlabs-io/babylon/x/btcstaking/types"
"github.com/babylonlabs-io/btc-staker/stakercfg"
"github.com/babylonlabs-io/btc-staker/stakerdb"
"github.com/babylonlabs-io/btc-staker/utils"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/btcsuite/btcd/btcec/v2/schnorr"
"github.com/btcsuite/btcd/btcutil"
Expand Down
4 changes: 2 additions & 2 deletions babylonclient/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"

sdkmath "cosmossdk.io/math"
"github.com/babylonchain/babylon/testutil/datagen"
"github.com/babylonchain/babylon/x/btcstaking/types"
"github.com/babylonlabs-io/babylon/testutil/datagen"
"github.com/babylonlabs-io/babylon/x/btcstaking/types"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/btcsuite/btcd/btcutil"
"github.com/btcsuite/btcd/chaincfg"
Expand Down
2 changes: 1 addition & 1 deletion babylonclient/msgsender.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
pv "github.com/cosmos/relayer/v2/relayer/provider"
"golang.org/x/sync/semaphore"

"github.com/babylonchain/btc-staker/utils"
"github.com/babylonlabs-io/btc-staker/utils"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/sirupsen/logrus"
)
Expand Down
42 changes: 40 additions & 2 deletions babylonclient/pop.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ package babylonclient
import (
"fmt"

bbn "github.com/babylonchain/babylon/types"
btcstypes "github.com/babylonchain/babylon/x/btcstaking/types"
"github.com/babylonlabs-io/babylon/crypto/bip322"
bbn "github.com/babylonlabs-io/babylon/types"
btcstypes "github.com/babylonlabs-io/babylon/x/btcstaking/types"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/btcsuite/btcd/btcutil"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/wire"
sdk "github.com/cosmos/cosmos-sdk/types"
)

Expand All @@ -23,6 +26,8 @@ type BabylonPop struct {
BtcSig []byte
}

// NewBabylonPop Generic constructor for BabylonPop that do as little validation
// as possible. It assumes passed btcSigOverBbnAddr is matching the popType `t`
func NewBabylonPop(t BabylonBtcPopType, btcSigOverBbnAddr []byte) (*BabylonPop, error) {
if len(btcSigOverBbnAddr) == 0 {
return nil, fmt.Errorf("cannot create BabylonPop with empty signatures")
Expand All @@ -34,6 +39,39 @@ func NewBabylonPop(t BabylonBtcPopType, btcSigOverBbnAddr []byte) (*BabylonPop,
}, nil
}

// NewBabylonBip322Pop build proper BabylonPop in BIP322 style, it verifies the
// the bip322 signature validity
func NewBabylonBip322Pop(
msg []byte,
w wire.TxWitness,
a btcutil.Address) (*BabylonPop, error) {
// TODO: bip322.Verify does not use it last parameter and this parameter should
// be removed from the function signature upstream.
// after that, we can remove the nil parameter here
if err := bip322.Verify(msg, w, a, nil); err != nil {
return nil, fmt.Errorf("invalid bip322 pop parameters: %w", err)
}

serializedWitness, err := bip322.SerializeWitness(w)

if err != nil {
return nil, fmt.Errorf("failed to serialize bip322 witness: %w", err)
}

bip322Sig := btcstypes.BIP322Sig{
Sig: serializedWitness,
Address: a.EncodeAddress(),
}

m, err := bip322Sig.Marshal()

if err != nil {
return nil, fmt.Errorf("failed to serialize btcstypes.BIP322Sig proto: %w", err)
}

return NewBabylonPop(Bip322Type, m)
}

func NewBTCSigType(t BabylonBtcPopType) (btcstypes.BTCSigType, error) {
switch t {
case SchnorrType:
Expand Down
6 changes: 3 additions & 3 deletions babylonclient/utils.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package babylonclient

import (
babylontypes "github.com/babylonchain/babylon/types"
btcctypes "github.com/babylonchain/babylon/x/btccheckpoint/types"
"github.com/babylonchain/btc-staker/utils"
babylontypes "github.com/babylonlabs-io/babylon/types"
btcctypes "github.com/babylonlabs-io/babylon/x/btccheckpoint/types"
"github.com/babylonlabs-io/btc-staker/utils"
"github.com/btcsuite/btcd/wire"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/stakercli/admin/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"os"
"path"

babylonApp "github.com/babylonchain/babylon/app"
"github.com/babylonchain/btc-staker/stakercfg"
babylonApp "github.com/babylonlabs-io/babylon/app"
"github.com/babylonlabs-io/btc-staker/stakercfg"
"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/go-bip39"
Expand Down
Loading