Skip to content

Commit

Permalink
Mainnet Release v2025.0.0 (#4831) from harmony-one/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
sophoah authored Jan 22, 2025
2 parents bcc0b51 + a63980b commit 7721af7
Show file tree
Hide file tree
Showing 178 changed files with 2,675 additions and 961 deletions.
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/openssl@1.1 /usr/local/opt/openssl
# hack for older chip (macos)
sudo mkdir -p /opt/homebrew/opt
sudo ln -sf /usr/local/opt/openssl@1.1 /opt/homebrew/opt/openssl@1.1
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()
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

0 comments on commit 7721af7

Please sign in to comment.