Skip to content
Open
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
29 changes: 0 additions & 29 deletions .github/workflows/ci-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,6 @@ jobs:
path: go/src/github.com/harmony-one/harmony
persist-credentials: false

- &checkout-mcl
name: Checkout mcl
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 #v7.0.0
with:
repository: harmony-one/mcl
fetch-depth: 1
ref: master
path: go/src/github.com/harmony-one/mcl
persist-credentials: false

- &checkout-bls
name: Checkout bls
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 #v7.0.0
with:
repository: harmony-one/bls
fetch-depth: 1
ref: master
path: go/src/github.com/harmony-one/bls
persist-credentials: false

- &setup-go
name: Set up Go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 #v6.5.0
Expand Down Expand Up @@ -90,15 +70,7 @@ jobs:
strategy: *arch-matrix
steps:
- *checkout-harmony
- *checkout-mcl
- *checkout-bls
- *setup-go
- name: Build mcl
run: make -j4
working-directory: go/src/github.com/harmony-one/mcl
- name: Build bls
run: make BLS_SWAP_G=1 -j4
working-directory: go/src/github.com/harmony-one/bls
- name: Install tools
run: |
go install golang.org/x/tools/cmd/goimports@v0.30.0
Expand Down Expand Up @@ -163,7 +135,6 @@ jobs:
strategy: *arch-matrix
steps:
- *checkout-harmony
- *checkout-bls
- *download-harmony-binaries
- *prepare-harmony-binaries
- *checkout-harmony-test
Expand Down
18 changes: 0 additions & 18 deletions .github/workflows/ci-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,24 +83,6 @@ jobs:
- ubuntu-24.04-arm

steps:
- name: Checkout mcl
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 #v7.0.0
with:
repository: harmony-one/mcl
path: mcl
ref: master
fetch-depth: 1
persist-credentials: false

- name: Checkout bls
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 #v7.0.0
with:
repository: harmony-one/bls
path: bls
ref: master
fetch-depth: 1
persist-credentials: false

- name: Checkout harmony core code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 #v7.0.0
with:
Expand Down
11 changes: 0 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ ENV GOPATH=/root/go
ENV GO111MODULE=on
ENV HMY_PATH=${GOPATH}/src/github.com/harmony-one
ENV OPENSSL_DIR=/usr/lib/ssl
ENV MCL_DIR=${HMY_PATH}/mcl
ENV BLS_DIR=${HMY_PATH}/bls
ENV CGO_CFLAGS="-I${BLS_DIR}/include -I${MCL_DIR}/include"
ENV CGO_LDFLAGS="-L${BLS_DIR}/lib"
ENV LD_LIBRARY_PATH=${BLS_DIR}/lib:${MCL_DIR}/lib
ENV GIMME_GO_VERSION=${GOLANG_VERSION}
ENV PATH="/root/bin:${PATH}"

Expand All @@ -31,14 +26,8 @@ RUN eval "$(~/bin/gimme ${GIMME_GO_VERSION})"

RUN git clone https://github.com/harmony-one/harmony.git ${HMY_PATH}/harmony

RUN git clone https://github.com/harmony-one/bls.git ${HMY_PATH}/bls

RUN git clone https://github.com/harmony-one/mcl.git ${HMY_PATH}/mcl

RUN git clone https://github.com/harmony-one/go-sdk.git ${HMY_PATH}/go-sdk

RUN cd ${HMY_PATH}/bls && make -j8 BLS_SWAP_G=1

RUN touch /root/.bash_profile && \
gimme ${GIMME_GO_VERSION} >> /root/.bash_profile && \
echo "GIMME_GO_VERSION='${GIMME_GO_VERSION}'" >> /root/.bash_profile && \
Expand Down
16 changes: 2 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
TOP:=$(realpath ..)
export CGO_CFLAGS:=-I$(TOP)/bls/include -I$(TOP)/mcl/include -I/opt/homebrew/opt/openssl@1.1/include
export CGO_LDFLAGS:=-L$(TOP)/bls/lib -L/opt/homebrew/opt/openssl@1.1/lib
export LD_LIBRARY_PATH:=$(TOP)/bls/lib:$(TOP)/mcl/lib:/opt/homebrew/opt/openssl@1.1/lib:/opt/homebrew/opt/gmp/lib/:/opt/homebrew/opt/openssl@1.1/lib
export LIBRARY_PATH:=$(LD_LIBRARY_PATH)
export DYLD_FALLBACK_LIBRARY_PATH:=$(LD_LIBRARY_PATH)
export GO111MODULE:=on
PKGNAME=harmony
VERSION?=$(shell git tag -l --sort=-v:refname | head -n 1 | tr -d v)
Expand Down Expand Up @@ -70,8 +64,7 @@ help:
@echo "protofiles - generate Go code from protobuf files"

libs:
make -C $(TOP)/mcl -j8
make -C $(TOP)/bls BLS_SWAP_G=1 -j8
go mod download github.com/herumi/bls-eth-go-binary

exe:
bash ./scripts/go_executable_build.sh -S
Expand Down Expand Up @@ -144,11 +137,8 @@ clean:
rm -f coverage.txt

distclean: clean
make -C $(TOP)/mcl clean
make -C $(TOP)/bls clean

go-get:
source ./scripts/setup_bls_build_flags.sh
go get -v ./...

test:
Expand All @@ -170,8 +160,6 @@ test-rosetta-attach:
bash ./test/rosetta.sh attach

linux_static:
make -C $(TOP)/mcl -j8
make -C $(TOP)/bls minimised_static BLS_SWAP_G=1 -j8
bash ./scripts/go_executable_build.sh -s

linux_static_quick:
Expand Down Expand Up @@ -271,4 +259,4 @@ debug-delete-log:


docker-go-test:
docker run --rm -it -v "$PWD":/go/src/github.com/harmony-one/harmony frozen621/harmony-test bash -c 'make go-test'
docker run --rm -it -v "$PWD":/go/src/github.com/harmony-one/harmony frozen621/harmony-test bash -c 'make go-test'
52 changes: 8 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,38 +54,15 @@ On macOS, make sure you have the **Xcode Command Line Tools** installed. This in
xcode-select --install
```

## Setting Up MCL & BLS Libraries on macOS
## BLS dependency

The Harmony project depends on the MCL (multi-curve library) and BLS (Boneh-Lynn-Shacham) cryptographic libraries. These need to be installed and configured before building the project.
Harmony uses Herumi's official Go package with prebuilt static BLS libraries.
No separate BLS or MCL checkout is required:

### Clone and Build MCL & BLS Repositories
First, clone the MCL and BLS repositories:
```bash
git clone https://github.com/harmony-one/mcl.git
git clone https://github.com/harmony-one/bls.git
```

### Update `.zshrc` for MCL and BLS Paths

To ensure the libraries are correctly located when building the project, you need to add the MCL and BLS library paths to your `.zshrc` file.

Add the following lines to your `.zshrc` (or `.bash_profile` for bash users):
```bash
# MCL & BLS paths for Harmony
export MCL_PATH=$GOPATH/src/github.com/harmony-one/mcl
export BLS_PATH=$GOPATH/src/github.com/harmony-one/bls

# Add library paths for MCL and BLS
export CGO_CFLAGS="-I$MCL_PATH/include -I$BLS_PATH/include -I/opt/homebrew/opt/openssl@1.1/include"
export CGO_LDFLAGS="-L$MCL_PATH/lib -L$BLS_PATH/lib -L/opt/homebrew/opt/openssl@1.1/lib"
export LD_LIBRARY_PATH=$MCL_PATH/lib:$BLS_PATH/lib:/opt/homebrew/opt/openssl@1.1/lib
export LIBRARY_PATH=$LD_LIBRARY_PATH
export DYLD_FALLBACK_LIBRARY_PATH=$LD_LIBRARY_PATH
```

Then, apply the changes by running:
```bash
source ~/.zshrc
git clone https://github.com/harmony-one/harmony.git
cd harmony
go mod download
```

## Dev Environment
Expand All @@ -102,10 +79,8 @@ cd $(go env GOPATH)/src/github.com/harmony-one
```
> If you get 'unknown command' or something along those lines, make sure to install [golang](https://golang.org/doc/install) first.

2. Clone this repo & dependent repos.
2. Clone this repo.
```bash
git clone https://github.com/harmony-one/mcl.git
git clone https://github.com/harmony-one/bls.git
git clone https://github.com/harmony-one/harmony.git
cd harmony
```
Expand Down Expand Up @@ -151,17 +126,7 @@ Learn more about docker [here](https://docker-curriculum.com/).

The `make` command should automatically build the Harmony binary & all dependent libs.

However, if you wish to bypass the Makefile, first export the build flags:
```bash
export CGO_CFLAGS="-I$GOPATH/src/github.com/harmony-one/bls/include -I$GOPATH/src/github.com/harmony-one/mcl/include -I/opt/homebrew/opt/openssl@1.1/include"
export CGO_LDFLAGS="-L$GOPATH/src/github.com/harmony-one/bls/lib -L/opt/homebrew/opt/openssl@1.1/lib"
export LD_LIBRARY_PATH=$GOPATH/src/github.com/harmony-one/bls/lib:$GOPATH/src/github.com/harmony-one/mcl/lib:/opt/homebrew/opt/openssl@1.1/lib
export LIBRARY_PATH=$LD_LIBRARY_PATH
export DYLD_FALLBACK_LIBRARY_PATH=$LD_LIBRARY_PATH
export GO111MODULE=on
```

Then you can build all executables with the following command:
You can build all executables directly with:
```bash
bash ./scripts/go_executable_build.sh -S
```
Expand Down Expand Up @@ -276,4 +241,3 @@ See [`CONTRIBUTING`](CONTRIBUTING.md) for details.
- Integration with WASM
- Fast state synchronization
- Auditable privacy asset using ZK proof

8 changes: 2 additions & 6 deletions Test.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,11 @@ RUN apt-get update && \

WORKDIR /go/src/github.com/harmony-one

RUN git clone https://github.com/harmony-one/mcl.git && \
git clone https://github.com/harmony-one/bls.git

RUN echo "Cloning branch: ${ENV}" && \
git clone -b ${ENV} https://github.com/harmony-one/harmony.git && \
cd harmony && \
go mod tidy && \
make deps
go mod download

WORKDIR /go/src/github.com/harmony-one/harmony

CMD ["make", "go-test"]
CMD ["make", "go-test"]
2 changes: 1 addition & 1 deletion cmd/harmony/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
ethCommon "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/log"
"github.com/harmony-one/bls/ffi/go/bls"
"github.com/harmony-one/harmony/api/service"
"github.com/harmony-one/harmony/api/service/crosslink_sending"
"github.com/harmony-one/harmony/api/service/pprof"
Expand All @@ -28,6 +27,7 @@ import (
"github.com/harmony-one/harmony/consensus"
"github.com/harmony-one/harmony/consensus/quorum"
"github.com/harmony-one/harmony/core"
bls "github.com/harmony-one/harmony/crypto/bls/core"
"github.com/harmony-one/harmony/internal/chain"
"github.com/harmony-one/harmony/internal/cli"
"github.com/harmony-one/harmony/internal/common"
Expand Down
2 changes: 1 addition & 1 deletion consensus/beacon_header_slash_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/rlp"
bls_core "github.com/harmony-one/bls/ffi/go/bls"
"github.com/harmony-one/harmony/block"
blockfactory "github.com/harmony-one/harmony/block/factory"
"github.com/harmony-one/harmony/common/denominations"
Expand All @@ -18,6 +17,7 @@ import (
coretypes "github.com/harmony-one/harmony/core/types"
"github.com/harmony-one/harmony/core/vm"
hmybls "github.com/harmony-one/harmony/crypto/bls"
bls_core "github.com/harmony-one/harmony/crypto/bls/core"
chain2 "github.com/harmony-one/harmony/internal/chain"
nodeconfig "github.com/harmony-one/harmony/internal/configs/node"
shardingconfig "github.com/harmony-one/harmony/internal/configs/sharding"
Expand Down
2 changes: 1 addition & 1 deletion consensus/checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"bytes"
"encoding/binary"

libbls "github.com/harmony-one/bls/ffi/go/bls"
msg_pb "github.com/harmony-one/harmony/api/proto/message"
"github.com/harmony-one/harmony/core/types"
"github.com/harmony-one/harmony/crypto/bls"
libbls "github.com/harmony-one/harmony/crypto/bls/core"
"github.com/harmony-one/harmony/crypto/hash"
"github.com/pkg/errors"
protobuf "google.golang.org/protobuf/proto"
Expand Down
2 changes: 1 addition & 1 deletion consensus/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import (
"time"

"github.com/harmony-one/abool"
bls_core "github.com/harmony-one/bls/ffi/go/bls"
"github.com/harmony-one/harmony/consensus/engine"
"github.com/harmony-one/harmony/consensus/quorum"
"github.com/harmony-one/harmony/core"
"github.com/harmony-one/harmony/core/types"
"github.com/harmony-one/harmony/crypto/bls"
bls_cosi "github.com/harmony-one/harmony/crypto/bls"
bls_core "github.com/harmony-one/harmony/crypto/bls/core"
"github.com/harmony-one/harmony/internal/registry"
"github.com/harmony-one/harmony/internal/utils"
"github.com/harmony-one/harmony/multibls"
Expand Down
2 changes: 1 addition & 1 deletion consensus/consensus_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"time"

"github.com/ethereum/go-ethereum/common"
bls_core "github.com/harmony-one/bls/ffi/go/bls"
"github.com/harmony-one/harmony/api/proto"
msg_pb "github.com/harmony-one/harmony/api/proto/message"
consensus_engine "github.com/harmony-one/harmony/consensus/engine"
Expand All @@ -16,6 +15,7 @@ import (
"github.com/harmony-one/harmony/core/types"
"github.com/harmony-one/harmony/crypto/bls"
bls_cosi "github.com/harmony-one/harmony/crypto/bls"
bls_core "github.com/harmony-one/harmony/crypto/bls/core"
"github.com/harmony-one/harmony/crypto/hash"
"github.com/harmony-one/harmony/internal/chain"
nodeconfig "github.com/harmony-one/harmony/internal/configs/node"
Expand Down
2 changes: 1 addition & 1 deletion consensus/consensus_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/rlp"
bls2 "github.com/harmony-one/bls/ffi/go/bls"
msg_pb "github.com/harmony-one/harmony/api/proto/message"
proto_node "github.com/harmony-one/harmony/api/proto/node"
"github.com/harmony-one/harmony/block"
Expand All @@ -18,6 +17,7 @@ import (
"github.com/harmony-one/harmony/core"
"github.com/harmony-one/harmony/core/types"
"github.com/harmony-one/harmony/crypto/bls"
bls2 "github.com/harmony-one/harmony/crypto/bls/core"
vrf_bls "github.com/harmony-one/harmony/crypto/vrf/bls"
nodeconfig "github.com/harmony-one/harmony/internal/configs/node"
"github.com/harmony-one/harmony/numeric"
Expand Down
2 changes: 1 addition & 1 deletion consensus/construct.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"bytes"
"errors"

bls_core "github.com/harmony-one/bls/ffi/go/bls"
"github.com/harmony-one/harmony/api/proto"
msg_pb "github.com/harmony-one/harmony/api/proto/message"
"github.com/harmony-one/harmony/consensus/quorum"
"github.com/harmony-one/harmony/crypto/bls"
bls_core "github.com/harmony-one/harmony/crypto/bls/core"
protobuf "google.golang.org/protobuf/proto"
)

Expand Down
2 changes: 1 addition & 1 deletion consensus/construct_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"testing"

"github.com/ethereum/go-ethereum/common"
bls_core "github.com/harmony-one/bls/ffi/go/bls"
msg_pb "github.com/harmony-one/harmony/api/proto/message"
"github.com/harmony-one/harmony/consensus/quorum"
"github.com/harmony-one/harmony/crypto/bls"
bls_core "github.com/harmony-one/harmony/crypto/bls/core"
"github.com/harmony-one/harmony/internal/registry"
"github.com/harmony-one/harmony/internal/utils"
"github.com/harmony-one/harmony/multibls"
Expand Down
2 changes: 1 addition & 1 deletion consensus/crosslink_cache_invalid_shard_reward_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/rlp"
bls_core "github.com/harmony-one/bls/ffi/go/bls"
"github.com/harmony-one/harmony/block"
blockfactory "github.com/harmony-one/harmony/block/factory"
"github.com/harmony-one/harmony/consensus/quorum"
Expand All @@ -19,6 +18,7 @@ import (
coretypes "github.com/harmony-one/harmony/core/types"
"github.com/harmony-one/harmony/core/vm"
hmybls "github.com/harmony-one/harmony/crypto/bls"
bls_core "github.com/harmony-one/harmony/crypto/bls/core"
chain2 "github.com/harmony-one/harmony/internal/chain"
nodeconfig "github.com/harmony-one/harmony/internal/configs/node"
shardingconfig "github.com/harmony-one/harmony/internal/configs/sharding"
Expand Down
2 changes: 1 addition & 1 deletion consensus/double_sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"sort"

"github.com/ethereum/go-ethereum/common"
bls_core "github.com/harmony-one/bls/ffi/go/bls"
"github.com/harmony-one/harmony/consensus/quorum"
"github.com/harmony-one/harmony/crypto/bls"
bls_core "github.com/harmony-one/harmony/crypto/bls/core"
"github.com/harmony-one/harmony/staking/slash"
)

Expand Down
Loading