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

Mainnet Release v2025.0.0 #4831

Merged
merged 85 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from 84 commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
8561e05
fix: slice init length (#4767)
cuishuang Oct 17, 2024
2274c29
Improve P2P Stream Handling & Stream Sync Enhancements (#4762)
GheisMohammadi Oct 24, 2024
525a9b1
improve pickAvailableStream to continue looking for other available s…
GheisMohammadi Sep 24, 2024
0d7e499
add thread safe map to request manager in p2p stream layer
GheisMohammadi Sep 26, 2024
a2f8ac8
improve lock in request manager test
GheisMohammadi Oct 1, 2024
f5cfef8
thread safe sync cycle for stream sync
GheisMohammadi Oct 14, 2024
3efc1e6
thread safe status for stream sync
GheisMohammadi Oct 14, 2024
30a5533
improve resultQueue for stream sync
GheisMohammadi Oct 14, 2024
50a1d39
improve getBlocksByHashManager for stream sync
GheisMohammadi Oct 14, 2024
00a24bf
improve lock in blockHashResults for stream sync
GheisMohammadi Oct 14, 2024
a6e0767
use RWMutex to improve receipt_download_manager
GheisMohammadi Oct 14, 2024
240d695
thread safe beacon helper
GheisMohammadi Oct 14, 2024
1af798a
Improved Concurrency Handling and Graceful Shutdown in Downloader
GheisMohammadi Oct 14, 2024
6f68f89
add function descriptions and comments to helpers in stream sync
GheisMohammadi Oct 14, 2024
7711bee
Enhance Concurrency and Lock Management in Staged Stream Sync Module …
sophoah Oct 28, 2024
d3d604f
improve pickAvailableStream to continue looking for other available s…
GheisMohammadi Sep 24, 2024
1c410e9
add thread safe map to request manager in p2p stream layer
GheisMohammadi Sep 26, 2024
964a650
add trusted nodes functionality to p2p host
GheisMohammadi Oct 22, 2024
2e462ad
add TrustedNodes to harmony and boot configs, migrate configs to new …
GheisMohammadi Oct 22, 2024
e6852cf
add test for trusted nodes
GheisMohammadi Oct 22, 2024
799fa1c
fix p2p test issue
GheisMohammadi Oct 22, 2024
06e56bb
Add Support for Trusted Nodes in P2P Host (#4777)
sophoah Oct 29, 2024
75ae438
improve consensus finalCommit (#4786)
GheisMohammadi Oct 31, 2024
fe1cbbf
Improve logging for consensus leader setup (#4791)
GheisMohammadi Nov 7, 2024
9f66e34
[fix] - update macos from 12 to 13, sync the CI steps for macos (#4792)
mur-me Nov 7, 2024
84513f9
Optimize Syncing-Consensus Communication to Prevent Unnecessary Conse…
GheisMohammadi Nov 13, 2024
6dafc07
Moved the `UpdateConsensusInformation` method to the test suite (#4790)
Frozen Nov 13, 2024
8b3cf46
add logs for new block proposal to track the source and reason (#4801)
GheisMohammadi Nov 20, 2024
db7f17c
add new version of NthNextValidator to find next leader
GheisMohammadi Nov 12, 2024
5253e39
add NthNextValidatorV2 to consensus and adjust hf epochs
GheisMohammadi Nov 12, 2024
d5d8358
add NthNextValidatorV2 to decider, fix epoch number for leader rotati…
GheisMohammadi Nov 20, 2024
e103771
Additional logs for consensus (#4785)
Frozen Nov 20, 2024
c22db0f
add test for NthNextValidatorV2
GheisMohammadi Nov 21, 2024
e09262e
add a test for a failed edge case for NthNextValidator
GheisMohammadi Nov 21, 2024
781bae5
add a new test for a failed edge cases for NthNextValidator
GheisMohammadi Nov 21, 2024
d1ef361
add a new test for a failed edge cases for NthNextValidator to show h…
GheisMohammadi Nov 22, 2024
d498d36
Add test for NthNextValidatorV2 to validate handling of edge case 1
GheisMohammadi Nov 22, 2024
0263b49
Add test for NthNextValidatorV2 to validate handling of edge case 2
GheisMohammadi Nov 22, 2024
918e55e
Add test for NthNextValidatorV2 to validate handling of edge case 3
GheisMohammadi Nov 22, 2024
d5f6f9a
fix quorom test format
GheisMohammadi Nov 22, 2024
8172901
[localnet] multibls network setup + ops improvement (#4793)
sophoah Nov 25, 2024
6e7b891
Merge pull request Enhance Leader Rotation Logic to Address Edge Case…
sophoah Nov 27, 2024
bcc8869
add check for faucet key existence before building validator
GheisMohammadi Nov 28, 2024
356dfcf
replace validator with faucet in message for build external validator
GheisMohammadi Nov 28, 2024
e403dd5
Merge pull request #4805 from harmony-one/improve/build_validator
sophoah Dec 2, 2024
afe9357
Add Localnet Config to Adjust Blocks per Epoch (#4807)
GheisMohammadi Dec 4, 2024
f7cb8b8
Moved method `WaitForConsensusReadyV2` from `Consensus` struct. (#4803)
Frozen Dec 4, 2024
c21ca0f
fix quorum calculation issue for multi bls validators
GheisMohammadi Nov 12, 2024
5840493
refactor onCommit to support multi bls key leaders
GheisMohammadi Nov 12, 2024
64147f9
simplifiy check for multi bls key
GheisMohammadi Nov 14, 2024
704875e
add new quorum logic for consensus's prepare phase
GheisMohammadi Nov 20, 2024
2b466b1
Allow Adding New Signatures in Prepare Phase Despite Existing Quorum
GheisMohammadi Nov 20, 2024
3580e89
Improve Consensus logic for Multi-BLS Validators with quorum (#4799)
sophoah Dec 5, 2024
17597d4
add resource manager to p2p host
GheisMohammadi Dec 12, 2024
ce94097
add resource manager options to harmony configs
GheisMohammadi Dec 13, 2024
248f32c
add resource manager flags for p2p configuration
GheisMohammadi Dec 13, 2024
50af5aa
add resource manager flags to boot node
GheisMohammadi Dec 13, 2024
c0d4126
enable resource manager by default for boot node
GheisMohammadi Dec 13, 2024
baaafc9
Fix Multi-BLS Key Validator Leader Rotation to Prevent Multiple Block…
GheisMohammadi Dec 16, 2024
89b0c63
Prevents BlocksSynchronized being called before finalCommit (#4804)
Frozen Dec 16, 2024
a539159
fix maxMemory comment
sophoah Dec 18, 2024
0f09d6a
add new command in makefile for debug multi bls with terminal
GheisMohammadi Dec 19, 2024
f922c82
add new commands to 'make help'
GheisMohammadi Dec 19, 2024
c84173a
Add Resource Manager to P2P Host (#4815)
sophoah Dec 19, 2024
b17d14c
Merge pull request #4818 from harmony-one/feature/debug_multi_bls_ter…
sophoah Dec 20, 2024
2e1bcb6
Fix for excess propose signals. (#4816)
Frozen Dec 23, 2024
5349795
[ops] multi bls multi ext node (#4819)
sophoah Dec 23, 2024
efd6625
Effective gas price. WIP
Frozen Sep 9, 2024
6887f0e
Effective gas price.
Frozen Sep 17, 2024
b910f7c
Added test is effective gas price is optional.
Frozen Sep 17, 2024
e0d8ca9
Added code to state processor.
Frozen Sep 17, 2024
fba8f9e
Added tests for rlp empty EffectiveGasPrice.
Frozen Sep 17, 2024
49bc99b
Removed commented block code.
Frozen Sep 20, 2024
af03638
Run tests against branch feature/effective-gas-price
Frozen Sep 25, 2024
0711d44
Added effectiveGasPrice to TxReceipt.
Frozen Sep 26, 2024
a40e6eb
Added `effectiveGasPrice` to eth epi.
Frozen Oct 14, 2024
d97d413
effectiveGasPrice in hex
Frozen Oct 16, 2024
d308ae9
Effective gas price to staking transaction.
Frozen Jan 9, 2025
acfda32
add resource manager to p2p configs only if it is enabled
GheisMohammadi Jan 10, 2025
f9cfd2e
uint64 for effectiveGasPrice in V2
Frozen Jan 10, 2025
9dba11d
Add Resource Manager to P2P Configs When Enabled (#4827)
sophoah Jan 13, 2025
7a89fb2
refactor: CI - fallback to the master branch in harmony-test repo if …
mur-me Jan 16, 2025
10be052
Merge branch 'dev' into feature/effective-gas-price
sophoah Jan 17, 2025
8245c99
Effective gas price (#4759)
sophoah Jan 20, 2025
a63980b
update harmony and bootnode version (#4834)
sophoah Jan 22, 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
8 changes: 6 additions & 2 deletions .github/workflows/ci-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
if: needs.check.outputs.tag_annotated == 'true'
strategy:
matrix:
os: [ubuntu-22.04, macos-12, [self-hosted, linux, ARM64]]
os: [ubuntu-22.04, macos-13, [self-hosted, linux, ARM64]]

steps:
- name: Import GPG key
Expand Down Expand Up @@ -104,11 +104,15 @@ jobs:
working-directory: harmony

- name: Build harmony binary and packages for MacOS
if: matrix.os == 'macos-12'
if: matrix.os == 'macos-13'
run: |
brew install bash
sudo rm -f /usr/local/opt/openssl
sudo ln -sf /usr/local/opt/[email protected] /usr/local/opt/openssl
# hack for older chip (macos)
sudo mkdir -p /opt/homebrew/opt
sudo ln -sf /usr/local/opt/[email protected] /opt/homebrew/opt/[email protected]
sudo ln -sf /usr/local/opt/gmp /opt/homebrew/opt/gmp
make
cd ./bin && mkdir ./lib && mv ./*.dylib ./lib && rm -f ./bootnode
gpg --detach-sign harmony
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
if: needs.check.outputs.tag_annotated == 'true'
strategy:
matrix:
os: [ubuntu-22.04, macos-12, [self-hosted, linux, ARM64]]
os: [ubuntu-22.04, macos-13, [self-hosted, linux, ARM64]]

steps:
- name: Import GPG key
Expand Down Expand Up @@ -102,7 +102,7 @@ jobs:
working-directory: harmony

- name: Build harmony binary and packages for MacOS
if: matrix.os == 'macos-12'
if: matrix.os == 'macos-13'
run: |
brew install bash
sudo rm -f /usr/local/opt/openssl
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a010bc1550956a3a4935cdc6f8633ea770bd0321094cfaccd25d3ea3b5382417cb5c150de0357ee8b6eeeec135ae0ec379701c7f35ae33da9030e93a630dc3a988577d1a1b0a9e60976f79d5cefa68123ac77c636f2ccab149fc8fc7
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eb388b59c8a4ed1d6a1713551a3404e775fdf27b5f92d302b01874e2ced1465ff9baa93eba1d3e24620d71e0557231087bbfea0c89cdb829c3868e990abaaa7595a61a13ba40d61262c5395066bccf2681f65b9f53a621a37e1b8123
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
81e67ac67dc10c4d89baa7ae800d6afffbc4105766a2202ee30998669e118ce2842ae64cb8a20282d10974c1bba6ce3cdda6e2bb00124bf4ab154aeebe081a7c44ce5b010b0b069bfa37d35beccffe44209ac376b4b14885f5b3625a
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a010bc1550956a3a4935cdc6f8633ea770bd0321094cfaccd25d3ea3b5382417cb5c150de0357ee8b6eeeec135ae0ec379701c7f35ae33da9030e93a630dc3a988577d1a1b0a9e60976f79d5cefa68123ac77c636f2ccab149fc8fc7
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eb388b59c8a4ed1d6a1713551a3404e775fdf27b5f92d302b01874e2ced1465ff9baa93eba1d3e24620d71e0557231087bbfea0c89cdb829c3868e990abaaa7595a61a13ba40d61262c5395066bccf2681f65b9f53a621a37e1b8123
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
81e67ac67dc10c4d89baa7ae800d6afffbc4105766a2202ee30998669e118ce2842ae64cb8a20282d10974c1bba6ce3cdda6e2bb00124bf4ab154aeebe081a7c44ce5b010b0b069bfa37d35beccffe44209ac376b4b14885f5b3625a
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10f1173239fc903360055a2ffe37948cddbb2b199f66572af56e623b6681c100f2fc71b08cef8fd59c0a784047f321543d81aee9a2d493214c31e72852c5d1c8f350baf4d8667fec16f520680fc59371a0f874ffcc9cd5c824291ff5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
926454b15914a0d0a18686173dcee027bd6cb3911866f360a3b383b240431c75130e2f3b3697f5117e072a6c7fc39dcdeb8b1e790034e844b070867740d5eb2d918b649701490e56aecdb7ef22c335d6300a103719c98bb094aec530
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e859f90f6cb272e078c5601ba6f921e53a881422928b10240aa50c5868af3db6f4fbbb30d91b232a8c0a1000355b8da9b510c0bb6eea36ba17a5ed8df875656e6e3467728c830e51ddfee1e736f986438e9d79ed56bc8f3d0e7734ec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b9a18c5f14b14ac6a648a792265d28f81dab207b7367573b83c4a206e01e1bd238f3a0416c66554254a77a473dec0e68bd8bf30185c91b12b07d634e53fd3f7a059eaeca39ff2b67bc848eb05869fc05255121d53c1f0a11bf4f511d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
56e7156cfa4151f7beb62d94f92bf08f0544cc35aa65eec1c68f0db99fdef68dd0cc354ba61e949dd962100216155e86052272965b7063d8ebb9a6c7be9c35ab421415f12d05dc0c719b6ac2b3ec20fedc267fbf6a4f022925bc45bf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2d531f231ea393b00d1e74887135dbc6144ccbb683438b7f1b7b9a217ca890ef82ba0a2fad7c103f31ac46cc6cbf073d4489726b3069af3414c930234d284453292cd1a5c14baf884a1f074fe4f70856c2e454e0da1f6acd1d745671
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5ea6f866b075e1c42d2a0aa72862f5161b45e4e5064f87f12c241d43425cdce6f785697d3a7dc40a7b17222543390dac8e4908e71c44a7180f86bda6930b1df96d59adb70f24756c4c4430325b6a2ba36364870dd768d55a4a0c86e1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8e1c2ffc67eeb241e00f5a87a280cb1705f38dd5e21a727aaccf1f82f60256ff9b7e409e2a059fcaae2f7b41a76ef58149d25fe9c47626ca1df012661d344d9f8a25d817183c55e8be840f5a155e7374cf1044e0abbaa23e6ac0c041
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e176a1a8d9c533ad7efbaa9caca1d839146495683f669be35dddfebe2f39497c73fc2a6d7da116acd3698f582fcfe6b7b9fc18fd286a42bcdf007dc7a618bab958eb5c97f6082104ff723705d36744289b9885a692c01731cb45c698
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b64f0601353691a6bbe68658103c044ec0e075ebe2cdb8328a07269c1cf4e5574ac81fb48fb49c90cf1e0fbf0e5ed97a5806a30505104717a68d7ae341c08a7ef98bf5d4c607c236ef80d9dbfc0d3212191e0c0436b4d78890b7da68
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2ea158c2fd1d4cefcfe4dc4d987099ef93731decee88db87d007d6a5da2b87e4528abe3013814fc7183651ac1e301b2f3caa8f03071d2bd110746be8c1004dd88f22495449ae6d8c5a7cce5783a6964a4663c9319570433a68ef2f31
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e176a1a8d9c533ad7efbaa9caca1d839146495683f669be35dddfebe2f39497c73fc2a6d7da116acd3698f582fcfe6b7b9fc18fd286a42bcdf007dc7a618bab958eb5c97f6082104ff723705d36744289b9885a692c01731cb45c698
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b64f0601353691a6bbe68658103c044ec0e075ebe2cdb8328a07269c1cf4e5574ac81fb48fb49c90cf1e0fbf0e5ed97a5806a30505104717a68d7ae341c08a7ef98bf5d4c607c236ef80d9dbfc0d3212191e0c0436b4d78890b7da68
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2ea158c2fd1d4cefcfe4dc4d987099ef93731decee88db87d007d6a5da2b87e4528abe3013814fc7183651ac1e301b2f3caa8f03071d2bd110746be8c1004dd88f22495449ae6d8c5a7cce5783a6964a4663c9319570433a68ef2f31
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3866b51e59955446f625063edc6a6f352662e92224ce78a2921e7699d478ace9d1c7a3c7c1932a81c5d7fc677e9c7620fe414a0b8e852bc075d600455e8b07b0918296e2914a656764e438e6978623f23ae63207ef4b377aac478048
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
764e55fb6b84617d188846e274152ca564b8b013cfe661661bd7c6681fdae3b000ef96c0654cdd7ff8755d32768e3770c4137e9d08c5ea7c8083705f41aae761bc03737cf316382f51c63d9e335a4c6a2d770e190ce5306cdca7821a
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cdaa7ee86f59aa4bd326af635a899afb21b204882b1e911f5e5a250c76c044d1ccfbb15772d26e36ee9ffe6c290bdebfe49ac1cf1989c913f3d06c76d4c20ebf8ba4a00644405064e51ce2fbdc14c35892393c84e4cc98ca5f2780e6
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2feddeb82936401a582b4d48aa7bc62f1ccabcad430ee9e70ca682392767a8a162d17f691cc22089f434c76c790e57ad0ce93a61aa070b87f802f42d84ac02d3d33cc4baa4a643eeb53b19c4105ba01e2dd7a3cccb75b0678cc71d21
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
d2e561f8184c1e2ab98a77c82cec7aa6ee2d729ce7664c35784299245c5a2f98afeda45049ff55ac19ad7fe8c9a13d57fd2f250b4a0bcba9146f01d789ce8fbab4433ca09fbf3f6d476f7832a62539c4c12ac7fa5ce37d535c1d21e9
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dbbf69ebbe21d0da28bbf96294171b17644f40bce2bd38470b9345c75811b9685587b0acf9b1806b48a28e7cc56e5e4daad281d2950612beaeef607e8aa71bbc33ed91f76c170b1efe6691a4038ab3b149ac771279ee9ea90b501444
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b3dae95cb93d7081949f19fa14b682254b52034de91020394a7df5bc87c0629ff73e3fc8ad760d911ea9fb488587d3bc36520e936d85e29bfa303db66dacc56728191906b686fc5ea73a63efb83c423f01e150b6737bd07c4763155c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
04708dbccd097c7f1278b51f6e72a8dead4f913c55dbc412f5d4519ed67d8fb56944c719a544fe724f0648ac9a74875d5458855e7bb434eaae0249f3b6fafbf311147de2f1e64e0394043e55c6cec92ce28af61dda93da6bf65523d3
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ install:
# default working directory with source code is automatically set to
# /home/travis/gopath/src/github.com/harmony-one/harmony
# https://docs.travis-ci.com/user/languages/go/#go-import-path
- echo $TRAVIS_PULL_REQUEST_BRANCH
- TEST_REPO_BRANCH="master"
- git clone https://github.com/harmony-one/mcl.git $GOPATH/src/github.com/harmony-one/mcl
- git clone https://github.com/harmony-one/bls.git $GOPATH/src/github.com/harmony-one/bls
- git clone --branch $TEST_REPO_BRANCH https://github.com/harmony-one/harmony-test.git $GOPATH/src/github.com/harmony-one/harmony-test
- git clone https://github.com/harmony-one/harmony-test.git $GOPATH/src/github.com/harmony-one/harmony-test
- (cd $GOPATH/src/github.com/harmony-one/mcl; make -j4)
- (cd $GOPATH/src/github.com/harmony-one/bls; make BLS_SWAP_G=1 -j4)
# - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.41.1
Expand Down
39 changes: 30 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ help:
@echo "trace-pointer - build the harmony binary & bootnode with pointer analysis"
@echo "debug - start a localnet with 2 shards (s0 rpc endpoint = localhost:9700; s1 rpc endpoint = localhost:9800)"
@echo "debug-kill - force kill the localnet"
@echo "debug-multi-bls - start a localnet with external validators and multi-BLS keys in the background"
@echo "debug-multi-bls-with-terminal - start a localnet with external validators and multi-BLS keys using screen, providing real-time logs and automatic cleanup on exit"
@echo "debug-ext - start a localnet with 2 shards and external (s0 rpc endpoint = localhost:9598; s1 rpc endpoint = localhost:9596)"
@echo "clean - remove node files & logs created by localnet"
@echo "distclean - remove node files & logs created by localnet, and all libs"
Expand Down Expand Up @@ -78,18 +80,41 @@ debug:
#export GOLOG_OUTPUT=stdout
# 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
bash ./test/debug.sh
bash ./test/debug.sh ./test/configs/local-resharding.txt

debug-kill:
bash ./test/kill_node.sh
pkill -9 -f debug.sh

debug-ext:
# update localnet block per epoch to ensure a stable localnet
sed -i 's/localnetBlocksPerEpoch\s*=\s*[0-9]*/localnetBlocksPerEpoch = 64/' internal/configs/sharding/localnet.go
sed -i 's/localnetBlocksPerEpochV2\s*=\s*[0-9]*/localnetBlocksPerEpochV2 = 64/' internal/configs/sharding/localnet.go
# 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
bash ./test/debug-external.sh &
./test/debug.sh ./test/configs/local-resharding-with-external.txt 64 64 &
echo sleep 10s before creating the external validator
sleep 10
bash ./test/build-localnet-validator.sh

debug-multi-bls:
# 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.txt 64 64 &
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
screen -L -Logfile ./tmp_log/localnet_terminal.log -dmS localnet bash -c './test/debug.sh ./test/configs/local-multi-bls.txt 64 64; echo "Press any key to exit..."; read -n 1'
echo sleep 10s before creating the external validator
sleep 10
bash ./test/build-localnet-validator.sh
screen -r localnet

debug-multi-bls-multi-ext-node: pre-external
# 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 &
echo sleep 10s before creating the external validator
sleep 10
bash ./test/build-localnet-validator.sh
Expand Down Expand Up @@ -202,13 +227,9 @@ travis_go_checker:
bash ./scripts/travis_go_checker.sh

travis_rpc_checker:
# value from command line will override this value, use point test to non-default
TEST_REPO_BRANCH='master'
bash ./scripts/travis_rpc_checker.sh

travis_rosetta_checker:
# value from command line will override this value, use point test to non-default
TEST_REPO_BRANCH='master'
bash ./scripts/travis_rosetta_checker.sh

debug_external: clean
Expand Down
6 changes: 3 additions & 3 deletions api/service/blockproposal/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import (
type Service struct {
stopChan chan struct{}
stoppedChan chan struct{}
c *consensus.Consensus
c *consensus.Proposer
messageChan chan *msg_pb.Message
}

// New returns a block proposal service.
func New(c *consensus.Consensus) *Service {
func New(proposer *consensus.Proposer) *Service {
return &Service{
c: c,
c: proposer,
stopChan: make(chan struct{}),
stoppedChan: make(chan struct{}),
}
Expand Down
2 changes: 1 addition & 1 deletion api/service/legacysync/syncing.go
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@ func (ss *StateSync) SyncLoop(bc core.BlockChain, isBeacon bool, consensus *cons
}
// TODO: move this to explorer handler code.
if ss.isExplorer {
consensus.UpdateConsensusInformation()
consensus.UpdateConsensusInformation("handle explorer")
}
}
utils.Logger().Info().Msgf("legacy sync is executed")
Expand Down
28 changes: 26 additions & 2 deletions api/service/stagedstreamsync/beacon_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package stagedstreamsync

import (
"errors"
"sync"
"time"

"github.com/harmony-one/harmony/core"
Expand All @@ -28,6 +29,8 @@ type (
insertC chan insertTask
closeC chan struct{}
logger zerolog.Logger

lock sync.RWMutex
}

insertTask struct {
Expand Down Expand Up @@ -55,7 +58,15 @@ func (bh *beaconHelper) start() {
}

func (bh *beaconHelper) close() {
close(bh.closeC)
bh.lock.Lock()
sophoah marked this conversation as resolved.
Show resolved Hide resolved
defer bh.lock.Unlock()

select {
case <-bh.closeC:
// Already closed, do nothing
default:
close(bh.closeC)
}
}

func (bh *beaconHelper) loop() {
Expand All @@ -73,7 +84,9 @@ func (bh *beaconHelper) loop() {
if b == nil {
continue
}
bh.lock.Lock()
bh.lastMileCache.push(b)
bh.lock.Unlock()
bh.insertAsync()

case it := <-bh.insertC:
Expand Down Expand Up @@ -102,6 +115,9 @@ func (bh *beaconHelper) loop() {
// insertAsync triggers the insert last mile without blocking
func (bh *beaconHelper) insertAsync() {
select {
case <-bh.closeC:
// Do nothing if closed
return
case bh.insertC <- insertTask{
doneC: make(chan struct{}),
}:
Expand All @@ -114,11 +130,19 @@ func (bh *beaconHelper) insertSync() {
task := insertTask{
doneC: make(chan struct{}),
}
bh.insertC <- task
select {
case <-bh.closeC:
// Do nothing if closed
return
case bh.insertC <- task:
}
<-task.doneC
}

func (bh *beaconHelper) insertLastMileBlocks() (inserted int, bn uint64, err error) {
bh.lock.Lock()
defer bh.lock.Unlock()

bn = bh.bc.CurrentBlock().NumberU64() + 1
for {
b := bh.getNextBlock(bn)
Expand Down
34 changes: 15 additions & 19 deletions api/service/stagedstreamsync/block_by_hash_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type getBlocksByHashManager struct {
results map[common.Hash]blockResult
whitelist []sttypes.StreamID

lock sync.Mutex
lock sync.RWMutex
}

func newGetBlocksByHashManager(hashes []common.Hash, whitelist []sttypes.StreamID) *getBlocksByHashManager {
Expand All @@ -28,8 +28,8 @@ func newGetBlocksByHashManager(hashes []common.Hash, whitelist []sttypes.StreamI
}

func (m *getBlocksByHashManager) getNextHashes() ([]common.Hash, []sttypes.StreamID, error) {
m.lock.Lock()
defer m.lock.Unlock()
m.lock.RLock()
defer m.lock.RUnlock()

num := m.numBlocksPerRequest()
hashes := make([]common.Hash, 0, num)
Expand Down Expand Up @@ -93,8 +93,8 @@ func (m *getBlocksByHashManager) handleResultError(hashes []common.Hash, stid st
}

func (m *getBlocksByHashManager) getResults() ([]*types.Block, []sttypes.StreamID, error) {
m.lock.Lock()
defer m.lock.Unlock()
m.lock.RLock()
defer m.lock.RUnlock()

blocks := make([]*types.Block, 0, len(m.hashes))
stids := make([]sttypes.StreamID, 0, len(m.hashes))
Expand All @@ -109,25 +109,21 @@ func (m *getBlocksByHashManager) getResults() ([]*types.Block, []sttypes.StreamI
}

func (m *getBlocksByHashManager) isDone() bool {
m.lock.Lock()
defer m.lock.Unlock()
m.lock.RLock()
defer m.lock.RUnlock()

return len(m.results) == len(m.hashes)
}

func (m *getBlocksByHashManager) removeStreamID(target sttypes.StreamID) {
// O(n^2) complexity. But considering the whitelist size is small, should not
// have performance issue.
loop:
for i, stid := range m.whitelist {
if stid == target {
if i == len(m.whitelist) {
m.whitelist = m.whitelist[:i]
} else {
m.whitelist = append(m.whitelist[:i], m.whitelist[i+1:]...)
}
goto loop
m.lock.Lock()
defer m.lock.Unlock()

newWhitelist := m.whitelist[:0]
for _, stid := range m.whitelist {
if stid != target {
newWhitelist = append(newWhitelist, stid)
}
}
return
m.whitelist = newWhitelist
}
Loading