Skip to content

Commit

Permalink
Merge pull request #3 from babylonlabs-io/release/v0.5.0
Browse files Browse the repository at this point in the history
Release/v0.5.0
  • Loading branch information
KonradStaniec authored Jul 30, 2024
2 parents 976c1a5 + 9ec494f commit 0961f94
Show file tree
Hide file tree
Showing 46 changed files with 645 additions and 499 deletions.
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

0 comments on commit 0961f94

Please sign in to comment.