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

Berlin update #4858

Draft
wants to merge 65 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
0535d0c
harmony-one/dependabot/go_modules/golang.org/x/net-0.33.0 (#4836)
dependabot[bot] Jan 23, 2025
c766715
Double propose fix on epoch change.
Frozen Jan 23, 2025
7a522d8
Proper deploy process termination.
Frozen Jan 23, 2025
8e05122
refactor download manager in staged stream sync
GheisMohammadi Dec 27, 2024
be3649e
rename block download manager to download manager and generalize its …
GheisMohammadi Dec 30, 2024
f03d97a
add block hashes to list of stream sync stages
GheisMohammadi Dec 30, 2024
ba6f577
add block hashes stage to staged stream sync
GheisMohammadi Dec 30, 2024
6f2865f
optimize final block hash calculations, remove invalid streams
GheisMohammadi Dec 30, 2024
5b41be5
add new function to stream client for requesting blocks by hashes
GheisMohammadi Dec 31, 2024
d1d7191
refactor stage bodies to use hashes rather than block numbers
GheisMohammadi Dec 31, 2024
047d69e
fix download manager issue of skipping blocks
GheisMohammadi Jan 6, 2025
3734a1d
add comment and TODO to download manager and stage bodies to check so…
GheisMohammadi Jan 6, 2025
8d93ecc
add contains function to prioritizedNumbers
GheisMohammadi Jan 10, 2025
aea57f4
add tests for stream sync download manager
GheisMohammadi Jan 10, 2025
c74880a
fix using internal transaction in stage bodies
GheisMohammadi Jan 23, 2025
997e8fd
refactor save progress in stage block hashes
GheisMohammadi Jan 23, 2025
1ea865e
update logs identifiers to differentiate between staged sync and stag…
GheisMohammadi Jan 24, 2025
70175de
add block number to logs for re-download bad block function
GheisMohammadi Jan 24, 2025
ce62cf5
save progress for last two stages; block bodies and states
GheisMohammadi Jan 24, 2025
3040907
support reserved stream list in p2p stream manager
GheisMohammadi Jan 8, 2025
5a4616d
add test for reserved stream list
GheisMohammadi Jan 8, 2025
bb63cf8
improve handling new streams for reserved list, improve test comments
GheisMohammadi Jan 8, 2025
1b4d625
Refactor Staged Stream Sync Long Range (#4824)
sophoah Jan 24, 2025
fffcfd3
feat(localnet log aggregation): store localnet logs between runs
mur-me Jan 14, 2025
27230b5
refactor(Makefile): remove redundant debug_external command
mur-me Jan 16, 2025
2cda0ae
feat(localnet log aggregation): fix loki config path, tweak loki conf…
mur-me Jan 24, 2025
f7bec84
feat: store localnet logs between runs (#4830)
sophoah Jan 27, 2025
fa0422a
Improve multiple propose at epoch change (#4837)
sophoah Jan 27, 2025
03a37af
fix some function names in comment (#4812)
depthlending Jan 29, 2025
9893cdd
improve ListPeer to return only existed joined peers
GheisMohammadi Jan 30, 2025
5dd1523
close stream if its sanity check fails
GheisMohammadi Jan 30, 2025
9369fe7
Fix for num shards.
Frozen Nov 17, 2023
f8b7bfb
add test for ShardIDFromKey
sophoah Jan 29, 2025
e65ceec
Fix for ShardIDFromKey (#4566)
sophoah Jan 30, 2025
c5e7f3c
fix streamSet pop stream lock handling
GheisMohammadi Jan 30, 2025
350573a
Enhance P2P Streams with Reserved Stream Replacement (#4826)
sophoah Jan 30, 2025
e4ce1ac
Moved several consensus fields to state struct (#4825)
Frozen Jan 31, 2025
41caa6c
Apply suggestions from code review
Frozen Feb 3, 2025
72e90f7
Merge pull request #4838 from harmony-one/fix/kill-deploy
mur-me Feb 4, 2025
f150090
fix make debug-multi-bls without external
sophoah Feb 5, 2025
76607e5
fix make debug-multi-bls without external (#4842)
sophoah Feb 5, 2025
a8ffc2f
Prevents explorer nodes from accepting out-of-sequence future blocks
GheisMohammadi Feb 7, 2025
bdf0491
remove consensus block number from logs in explorer node
GheisMohammadi Feb 11, 2025
7a97722
fix explorer node connectivity issue of streams
GheisMohammadi Feb 12, 2025
602fcee
add a few logs to stream manager for better visibility
GheisMohammadi Feb 12, 2025
a566c25
change log type to debug to not have overloaded logs
GheisMohammadi Feb 12, 2025
0da69c1
Fix Explorer Node's Stream Connectivity Issues (#4846)
sophoah Feb 12, 2025
100fcba
improve condition checking and log for node explorer
GheisMohammadi Feb 13, 2025
ad33d99
Create a local logger for each stage with the corresponding module an…
GheisMohammadi Feb 13, 2025
3f3ed59
use a local logger for staged sync helpers
GheisMohammadi Feb 13, 2025
4c425f5
use a local logger for download manager in staged sync
GheisMohammadi Feb 13, 2025
5a429b4
add local logger to receipt download manager in staged sync
GheisMohammadi Feb 13, 2025
da7d567
add a few logs to staged sync downloader to monitor stream connections
GheisMohammadi Feb 13, 2025
c59f3d9
refactor advertisement logic with retries and dynamic sleep adjustments
GheisMohammadi Feb 13, 2025
876dca6
fix protocol test by passing background context
GheisMohammadi Feb 14, 2025
8771bfa
comment out getPeerTopics because it's not being used yet
GheisMohammadi Feb 15, 2025
0c3134a
Update Makefile to include additional help commands
Feb 17, 2025
b727624
Add MacOS setup configurations to Readme.md
GheisMohammadi Feb 17, 2025
a513ba8
Prevent Explorer Nodes from Adding Future Blocks (#4845)
sophoah Feb 17, 2025
51e4eda
Merge pull request #4851 from harmony-one/improve/help_readme
sophoah Feb 18, 2025
36b6d22
Improve P2P Stream Removal Tracking and Cooldown Handling
GheisMohammadi Feb 18, 2025
b2225ac
Stream Removal if its Sanity Check Fails #4839
sophoah Feb 20, 2025
d3ed01c
n Refactor Staged Stream Sync Logger #4847
sophoah Feb 20, 2025
d240733
Refactor advertisement logic with retries and dynamic sleep adjustmen…
sophoah Feb 20, 2025
b62c88b
Enhance P2P Layer: Stream Removal Tracking and Cooldown Handling #4853
sophoah Feb 20, 2025
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,4 @@ cache_*_db

# log aggregation logs folder variable file, no sense to track it
test/logs_aggregator/.env
test/logs_aggregator/loki
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dd11eabd17b257220f9523efd6524f12b7c1356f21667a87fe1b8c630bdf9f7d247087f85a8f661a7ef8ccde6e6287d54361aa2287fdf258321a1cc1d885b45a3b636a23e40aec0357dbd699c82a36e07fff9ca6fd85f79652320113
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
837cdffcc049ba89931d570e4be38bfef513df65d8dd277b0da8e62adf8c23b3c5229a2a4b36aa2c90c17d490dd5f95869365ebc4429d1efc784d25a64db246870d4bb4831d98ec02317ea88b76491a7fdfd2fa5e10f267e8f3989d9
26 changes: 17 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ RPMBUILD=$(HOME)/rpmbuild
DEBBUILD=$(HOME)/debbuild
SHELL := bash

.PHONY: all help libs exe race trace-pointer debug debug-ext debug-kill test test-go test-api test-api-attach linux_static deb_init deb_build deb debpub_dev debpub_prod rpm_init rpm_build rpm rpmpub_dev rpmpub_prod clean distclean docker
.PHONY: all help libs exe race trace-pointer debug debug-ext debug-kill test test-go test-api test-api-attach linux_static deb_init deb_build deb debpub_dev debpub_prod rpm_init rpm_build rpm rpmpub_dev rpmpub_prod clean distclean docker go-vet go-test docker build_localnet_validator protofiles travis_go_checker travis_rpc_checker travis_rosetta_checker debug-start-log debug-stop-log debug-restart-log debug-delete-log

all: libs
bash ./scripts/go_executable_build.sh -S

help:
@echo "all - build the harmony binary & bootnode along with the MCL & BLS libs (if necessary)"
@echo "libs - build only the MCL & BLS libs (if necessary) "
@echo "libs - build only the MCL & BLS libs (if necessary)"
@echo "exe - build the harmony binary & bootnode"
@echo "race - build the harmony binary & bootnode with race condition checks"
@echo "trace-pointer - build the harmony binary & bootnode with pointer analysis"
Expand Down Expand Up @@ -55,10 +55,15 @@ help:
@echo "travis_rpc_checker - run the Travis RPC checker script, defaulting the test branch to 'master' unless overridden by TEST_REPO_BRANCH"
@echo "travis_rosetta_checker - run the Travis Rosetta checker script, defaulting the test branch to 'master' unless overridden by TEST_REPO_BRANCH"
@echo "debug_external - cleans up environment, rebuilds the binary, and deploys with external nodes"
@echo "debug-multi-bls - cleans up environment, rebuilds the binary, and deploys with external nodes in configuration 1 harmony process -> 2 validators"
@echo "build_localnet_validator - imports validator keys, funds validator accounts, waits for the epoch, and creates external validators on a local network"
@echo "debug-start-log - start a docker compose Promtail->Loki->Grafana stack against localnet logs, needs docker compose and started localnet"
@echo "debug-start-log - start a docker compose Promtail->Loki->Grafana stack against localnet logs, creates"\
"persistent volume to store parsed logs between localnet runs, needs docker compose and started localnet"
@echo "debug-stop-log - stops a docker compose Promtail->Loki->Grafana stack"
@echo "debug-restart-log - restart a docker compose Promtail->Loki->Grafana stack"
@echo "debug-delete-log - removes persistent volume for the Loki and host folder for it"
@echo "debug-multi-bls-multi-ext-node - start a localnet with multiple external nodes and multi-BLS configuration"
@echo "protofiles - generate Go code from protobuf files"

libs:
make -C $(TOP)/mcl -j8
Expand All @@ -85,6 +90,7 @@ debug:
debug-kill:
bash ./test/kill_node.sh
pkill -9 -f debug.sh
pkill -9 -f deploy.sh

debug-ext:
# add VERBOSE=true before bash or run `export VERBOSE=true` on the shell level for have max logging
Expand All @@ -101,7 +107,7 @@ debug-multi-bls:
echo sleep 10s before creating the external validator
sleep 10
bash ./test/build-localnet-validator.sh

debug-multi-bls-with-terminal:
# add VERBOSE=true before bash or run `export VERBOSE=true` on the shell level for have max logging
# add LEGACY_SYNC=true before bash or run `export LEGACY_SYNC=true` on the shell level to switch to the legacy sync
Expand All @@ -111,7 +117,7 @@ debug-multi-bls-with-terminal:
bash ./test/build-localnet-validator.sh
screen -r localnet

debug-multi-bls-multi-ext-node: pre-external
debug-multi-bls-multi-ext-node:
# add VERBOSE=true before bash or run `export VERBOSE=true` on the shell level for have max logging
# add LEGACY_SYNC=true before bash or run `export LEGACY_SYNC=true` on the shell level to switch to the legacy sync
./test/debug.sh ./test/configs/local-multi-bls-multi-ext-node.txt &
Expand All @@ -120,7 +126,7 @@ debug-multi-bls-multi-ext-node: pre-external
bash ./test/build-localnet-validator.sh

clean:
rm -rf ./tmp_log*
rm -rf ./tmp_log/*
rm -rf ./.dht*
rm -rf ./db-*
rm -rf ./latest
Expand Down Expand Up @@ -232,9 +238,6 @@ travis_rpc_checker:
travis_rosetta_checker:
bash ./scripts/travis_rosetta_checker.sh

debug_external: clean
bash test/debug-external.sh

build_localnet_validator:
bash test/build-localnet-validator.sh

Expand All @@ -248,3 +251,8 @@ debug-stop-log:
bash ./test/logs_aggregator/stop_log_aggregator.sh

debug-restart-log: debug-stop-log debug-start-log

debug-delete-log:
docker volume rm logs_aggregator_loki_data
@echo "[WARN] - it needs sudo to remove folder created with loki docker image user"
sudo rm -rf test/logs_aggregator/loki
65 changes: 50 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ brew install gmp
brew install openssl
sudo ln -sf /usr/local/opt/[email protected] /usr/local/opt/openssl
```
On Linux (Ubuntu)
On Linux (Ubuntu):
```bash
sudo apt install libgmp-dev libssl-dev make gcc g++
sudo apt install libgmp-dev libssl-dev make gcc g++
```
On Linux (Cent OS / Amazon Linux 2)
On Linux (Cent OS / Amazon Linux 2):
```bash
sudo yum install glibc-static gmp-devel gmp-static openssl-libs openssl-static gcc-c++
```

### **Docker** (for testing)

On macOS:
Expand All @@ -41,13 +42,55 @@ brew install --cask docker
open /Applications/Docker.app
```
On Linux, reference official documentation [here](https://docs.docker.com/engine/install/).

### **Bash 4+**

For macOS, you can reference this [guide](http://tldrdevnotes.com/bash-upgrade-3-4-macos). For Linux, you can reference this [guide](https://fossbytes.com/installing-gnu-bash-4-4-linux-distros/).

### **Developer Tools for macOS**

On macOS, make sure you have the **Xcode Command Line Tools** installed. This includes essential tools like `git`, `make`, and other development utilities:
```bash
xcode-select --install
```

## Setting Up MCL & BLS Libraries on macOS

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.

### 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/[email protected]/include"
export CGO_LDFLAGS="-L$MCL_PATH/lib -L$BLS_PATH/lib -L/opt/homebrew/opt/[email protected]/lib"
export LD_LIBRARY_PATH=$MCL_PATH/lib:$BLS_PATH/lib:/opt/homebrew/opt/[email protected]/lib
export LIBRARY_PATH=$LD_LIBRARY_PATH
export DYLD_FALLBACK_LIBRARY_PATH=$LD_LIBRARY_PATH
```

Then, apply the changes by running:
```bash
source ~/.zshrc
```

## Dev Environment

**Most repos from [harmony-one](https://github.com/harmony-one) assumes the GOPATH convention. More information [here](https://github.com/golang/go/wiki/GOPATH).**
**Most repos from [harmony-one](https://github.com/harmony-one) assume the GOPATH convention. More information [here](https://github.com/golang/go/wiki/GOPATH).**

### First Install
Clone and set up all of the repos with the following set of commands:
Expand Down Expand Up @@ -77,9 +120,7 @@ make

## Dev Docker Image

Included in this repo is a Dockerfile that has a full harmony development environment and
comes with emacs, vim, ag, tig and other creature comforts. Most importantly, it already has the go environment
with our C/C++ based library dependencies (`libbls` and `mcl`) set up correctly for you.
Included in this repo is a Dockerfile that has a full harmony development environment and comes with emacs, vim, ag, tig, and other creature comforts. Most importantly, it already has the go environment with our C/C++ based library dependencies (`libbls` and `mcl`) set up correctly for you.

You can build the docker image for yourself with the following commands:
```bash
Expand All @@ -93,8 +134,6 @@ docker build -t harmony .
> ```
> Learn more about the `--platform` arg and multi-CPU architecture support, [here](https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope) and [here](https://docs.docker.com/desktop/multi-arch/).



Then you can start your docker container with the following command:
```bash
docker run --rm --name harmony -it -v "$(go env GOPATH)/src/github.com/harmony-one/harmony:/root/go/src/github.com/harmony-one/harmony" harmony /bin/bash
Expand Down Expand Up @@ -204,13 +243,9 @@ make test-rosetta-attach

## License

Harmony is licensed under GNU Lesser General Public License v3.0. See [`LICENSE`](LICENSE) file for
the terms and conditions.
Harmony is licensed under GNU Lesser General Public License v3.0. See [`LICENSE`](LICENSE) file for the terms and conditions.

Harmony includes third-party open-source code. In general, a source subtree
with a `LICENSE` or `COPYRIGHT` file is from a third party, and our
modifications thereto are licensed under the same third-party open source
license.
Harmony includes third-party open-source code. In general, a source subtree with a `LICENSE` or `COPYRIGHT` file is from a third party, and our modifications thereto are licensed under the same third-party open source license.

Also please see [our Fiduciary License Agreement](FLA.md) if you are
contributing to the project. By your submission of your contribution to us, you
Expand Down
1 change: 1 addition & 0 deletions api/service/stagedstreamsync/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type syncProtocol interface {
GetRawBlocksByNumber(ctx context.Context, bns []uint64, opts ...syncproto.Option) ([][]byte, [][]byte, sttypes.StreamID, error)
GetBlockHashes(ctx context.Context, bns []uint64, opts ...syncproto.Option) ([]common.Hash, sttypes.StreamID, error)
GetBlocksByHashes(ctx context.Context, hs []common.Hash, opts ...syncproto.Option) ([]*types.Block, sttypes.StreamID, error)
GetRawBlocksByHashes(ctx context.Context, hs []common.Hash, opts ...syncproto.Option) ([][]byte, [][]byte, sttypes.StreamID, error)
GetReceipts(ctx context.Context, hs []common.Hash, opts ...syncproto.Option) (receipts []types.Receipts, stid sttypes.StreamID, err error)
GetNodeData(ctx context.Context, hs []common.Hash, opts ...syncproto.Option) (data [][]byte, stid sttypes.StreamID, err error)
GetAccountRange(ctx context.Context, root common.Hash, origin common.Hash, limit common.Hash, bytes uint64, opts ...syncproto.Option) (accounts []*message.AccountData, proof [][]byte, stid sttypes.StreamID, err error)
Expand Down
6 changes: 2 additions & 4 deletions api/service/stagedstreamsync/beacon_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (

"github.com/harmony-one/harmony/core"
"github.com/harmony-one/harmony/core/types"
"github.com/harmony-one/harmony/internal/utils"
"github.com/rs/zerolog"
)

Expand Down Expand Up @@ -38,16 +37,15 @@ type (
}
)

func newBeaconHelper(bc blockChain, blockC <-chan *types.Block, insertHook func()) *beaconHelper {
func newBeaconHelper(bc blockChain, logger zerolog.Logger, blockC <-chan *types.Block, insertHook func()) *beaconHelper {
return &beaconHelper{
bc: bc,
blockC: blockC,
insertHook: insertHook,
lastMileCache: newBlocksByNumber(lastMileCap),
insertC: make(chan insertTask, 1),
closeC: make(chan struct{}),
logger: utils.Logger().With().
Str("module", "staged stream sync").
logger: logger.With().
Str("sub-module", "beacon helper").
Logger(),
}
Expand Down
Loading