Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
f51160a
Add Docker support for Go tests with new Makefile target and Dockerfile
Frozen Jun 30, 2025
1b1c827
Refactor Dockerfile for Go tests: remove unnecessary commands and ens…
Frozen Jun 30, 2025
6f4580d
update 1.9.25
Frozen Mar 7, 2025
b4ec8ca
update 1.9.25
Frozen Mar 7, 2025
6dbe632
update 1.9.25
Frozen Mar 7, 2025
4cb1d35
update 1.9.25
Frozen Mar 7, 2025
562b395
Fixed code
Frozen Mar 7, 2025
9dbd12c
Fixed StructLog
Frozen Mar 7, 2025
820f116
compiled
Frozen Mar 10, 2025
d0f32b9
BlockContext
Frozen Mar 12, 2025
592f3f8
Fixed interpreter.
Frozen Mar 13, 2025
6784533
Fixed tests partially.
Frozen Mar 15, 2025
1b1e615
Passed unit tests.
Frozen Mar 17, 2025
b91bbfa
Fixed imports
Frozen Mar 18, 2025
6ec5b0f
Removed commented block
Frozen Mar 24, 2025
23b6b99
Fixed StructLog initialization
Frozen Mar 26, 2025
b2913c1
Fixed formatting
Frozen Mar 26, 2025
c3d8897
Removed unused
Frozen Mar 26, 2025
4dfefd6
Fixed code generation
Frozen Mar 26, 2025
bb6e87c
Removed intpool
Frozen Mar 27, 2025
4e2e1d2
Fixed rpc override.go
Frozen Mar 27, 2025
b21e10d
Fixed rpc override_test.go
Frozen Mar 28, 2025
b240c46
Add gas prices for BLS12-381 elliptic curve operations
Frozen Jun 6, 2025
32339c5
Add gas discount table for BLS12-381 G1 and G2 multi exponentiation o…
Frozen Jun 6, 2025
7e70243
Refactor CaptureStart method to remove unused EVM parameter
Frozen Jun 7, 2025
4a3a6ff
Fix chain rules check in readonly mode to use Byzantium instead of S3
Frozen Jun 7, 2025
4f3a08c
Update gas calculations to reflect EIP-150 and EIP-158 rules
Frozen Jun 7, 2025
e329c0b
Add EIP flags for gas calculations in config
Frozen Jun 13, 2025
93b751d
Refactor precompiled contracts to use WriteCapablePrecompiledContract…
Frozen Jun 14, 2025
38d096b
Refactor precompiled contract tests to use RequiredGas method with up…
Frozen Jun 16, 2025
a8e5ece
Add readOnly parameter to RunPrecompiledContract and implement IsWrit…
Frozen Jun 17, 2025
7ef436a
Update RunPrecompiledContract calls in tests to include readOnly para…
Frozen Jun 18, 2025
7a5e9a3
Update RunPrecompiledContract calls in tests to include gas parameter
Frozen Jun 18, 2025
679d198
Add BLS12-381 failure test cases and implement IsWrite method for dum…
Frozen Jun 18, 2025
342f65f
Fix code hash retrieval in contract execution for precompiled contracts
Frozen Jul 17, 2025
86c284b
Handle validator addresses in EVM to avoid using code and codeHash fi…
Frozen Jul 17, 2025
92296f7
Fixed issue with tests running.
Frozen Jul 22, 2025
512c925
Remove commented-out test data for bn256 addition and scalar multipli…
Frozen Jul 23, 2025
9a54df8
Refactor precompiled contracts to use wrapper for write capability an…
Frozen Jul 23, 2025
7d920ee
Refactor precompiled contracts to use wrapper for write capability an…
Frozen Jul 24, 2025
0f5f99e
Update EVM initialization in TestEIP2537Precompile to include BlockCo…
Frozen Jul 24, 2025
991d434
Skip tests for EIP 2565 precompiled modexp implementation
Frozen Jul 24, 2025
931cb4f
Fix gas calculation in precompiled contract tests to ensure accurate …
Frozen Jul 29, 2025
4dcf13f
Update IsWrite method in precompiled contracts to reflect correct wri…
Frozen Jul 29, 2025
829e591
Refactor precompiled contract tests to remove unused variables and im…
Frozen Jul 29, 2025
c4682e1
Fix read-only write protection check and enhance precompiled contract…
Frozen Aug 4, 2025
3358cb1
Reorder precompiled contract mappings for improved readability
Frozen Aug 4, 2025
69c50a8
Uncomment execution reverted error in errors.go and update related co…
Frozen Aug 4, 2025
ea1db56
update 1.9.25
Frozen Mar 7, 2025
0f1bae5
BlockContext
Frozen Mar 12, 2025
225e31f
Fixed imports
Frozen Mar 18, 2025
5be02a3
Added access list.
Frozen May 27, 2025
ef46043
Provided eips.
Frozen Jun 1, 2025
8d18edf
Add EIP implementations and Harmony-specific support to EVM
Frozen Jun 6, 2025
7cbd6cb
Add new function signatures for validator and staking precompiles in EVM
Frozen Jun 6, 2025
e537e9e
Add RosettaLogAddressItem struct and RosettaTracer interface to EVM
Frozen Jun 6, 2025
07b2655
Remove obsolete error definitions and add new error types for EVM exe…
Frozen Jun 6, 2025
12eb68f
Refactor opcode definitions for clarity and consistency in opcodes.go
Frozen Jun 6, 2025
ecb87e9
Refactor contract code by removing unused validJumpSubdest function a…
Frozen Jun 6, 2025
c595725
Add TODO comment to check precompiles in EVM precompile method
Frozen Jun 6, 2025
6ef0f60
Refactor gas calculations and update function names for clarity in ga…
Frozen Aug 8, 2025
01d9c3c
Refactor EVM context by removing unused BlockContext and TxContext ty…
Frozen Aug 9, 2025
c0ca5a0
Refactor EVM code by updating chain configuration and simplifying con…
Frozen Aug 12, 2025
1879cf6
Uncomment execution reverted error and clean up commented code in EVM
Frozen Aug 12, 2025
69685da
Add WithDataCopyFix field to contract struct for EVM execution
Frozen Aug 12, 2025
a902f64
Use ErrWriteProtection constant for error handling in contracts.go
Frozen Aug 12, 2025
1f6ce50
Refactor EVM contract handling by updating precompile execution logic…
Frozen Aug 12, 2025
b7eb3ce
Update chain configuration to include London hard fork in precompiles
Frozen Aug 12, 2025
d63aa26
Refactor opAdd function to use ScopeContext for stack operations
Frozen Aug 12, 2025
31312cd
Update EVM instruction handling for S3 chain rules and adjust difficu…
Frozen Aug 12, 2025
0125aec
Fix EVM configuration reference for debugging in evm.go
Frozen Aug 12, 2025
ff2b968
Add gas parameters for KECCAK256 operations in protocol_params.go
Frozen Aug 13, 2025
b0b2097
Rename memorySha3 function to memoryKeccak256 for clarity
Frozen Aug 13, 2025
583b7c0
Rename memorySha3 function to memoryKeccak256 for clarity
Frozen Aug 13, 2025
87dab30
Update SetCode method call to include 'false' parameter for state dat…
Frozen Aug 13, 2025
c27a165
Refactor gas usage validation in interpreter to simplify logic
Frozen Aug 14, 2025
3ede4da
Comment out StateDB.Prepare() calls in runtime and state_transition f…
Frozen Aug 14, 2025
d2f3715
Add SetTxContext method to reset EVM with new transaction context
Frozen Aug 14, 2025
a4e188a
Remove unnecessary return statement in CaptureEnd method of ParityBlo…
Frozen Aug 14, 2025
e345cd7
Implement stubs for transaction capture methods in ParityBlockTracer
Frozen Aug 18, 2025
881559c
Refactor ParityBlockTracer to replace uint256.Int with big.Int for va…
Frozen Aug 19, 2025
a31cc4f
Update Tracer methods to include EVM context in state capture
Frozen Aug 21, 2025
88a75be
Fix CaptureFault method to include memory and stack in fault logging
Frozen Aug 21, 2025
33c7b35
Enhance state capture in interpreter by including memory, stack, and …
Frozen Aug 21, 2025
108d345
Fix logger to use big.Int for stack logging and remove unused PaddedB…
Frozen Aug 21, 2025
0bbfbe6
Refactor RosettaBlockTracer to use big.Int for value initialization
Frozen Aug 21, 2025
ca7d5bd
Refactor RosettaLogItem to use uint256 for value representation
Frozen Aug 21, 2025
0193605
Update CaptureStart method to return an error for improved error hand…
Frozen Aug 21, 2025
ccc15c7
Refactor tracer to use uint256 for stack representation
Frozen Aug 21, 2025
ee475f1
Add CaptureEnter and CaptureExit methods to Tracer for enhanced traci…
Frozen Aug 21, 2025
08f3c3b
Add CaptureEnter method to StructLogger and refactor stack logging to…
Frozen Aug 21, 2025
f41d453
Refactor JSONLogger methods and improve stack logging functionality
Frozen Aug 21, 2025
f82173c
Refactor JSONLogger methods and improve stack logging functionality
Frozen Aug 22, 2025
5d0bc97
Refactor block tracer tests to replace uint256 with big.Int for value…
Frozen Aug 22, 2025
8de50d6
Refactor EVMInterpreter initialization to use env.Config instead of e…
Frozen Aug 22, 2025
2efd92e
Refactor EVMInterpreter initialization to use env.Config instead of e…
Frozen Aug 23, 2025
18ca2c0
Refactor test utility functions to improve clarity and update file wr…
Frozen Aug 26, 2025
a79447c
Refactor test utility functions to improve clarity and update file wr…
Frozen Aug 26, 2025
afaef5b
Refactor instructions tests to replace callCtx with ScopeContext and …
Frozen Aug 26, 2025
c3084cf
Add storage field to StructLogger for improved state management
Frozen Aug 26, 2025
3e715f7
Refactor TestStoreCapture to remove unused return stack parameter
Frozen Aug 26, 2025
39ccab4
Fix TestBigToHash to dereference uint256.NewInt for correct comparison
Frozen Aug 26, 2025
600e994
Update ChainConfig.Rules to accept isMerge parameter and adjust runti…
Frozen Aug 26, 2025
b70fb58
Remove isMerge parameter from ChainConfig.Rules and clean up related …
Frozen Aug 26, 2025
99512d3
Fix uint256ToHash function to use common.BigToHash and enhance TestBi…
Frozen Aug 26, 2025
cdd0ee9
Fix uint256ToHash function to use common.BigToHash and enhance TestBi…
Frozen Aug 27, 2025
ed32602
Refactor EVM contract initialization to streamline code execution flow
Frozen Sep 1, 2025
1552062
Comment out Stack field in structLogMarshaling for clarity
Frozen Sep 1, 2025
fc40363
Rename variable for clarity in GetState method
Frozen Sep 2, 2025
14d78d1
Skip TestStoreCapture due to misconfiguration
Frozen Sep 4, 2025
d5833b7
Update go:generate directive to specify gencodec version
Frozen Sep 7, 2025
18474e2
Update go:generate directive to simplify command for AccessTuple
Frozen Sep 8, 2025
5e6afb5
Add JSON marshaling and unmarshaling for AccessTuple and StructLog
Frozen Sep 19, 2025
6082a58
Refactored consensus decider access and improved thread safety.
Frozen Oct 6, 2025
074cc8a
Refactored consensus decider access and improved thread safety.
Frozen Oct 6, 2025
182e39e
Feature: transient storage (#4950)
Frozen Oct 19, 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
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -269,3 +269,6 @@ debug-delete-log:
@echo "[WARN] - it needs sudo to remove folder created with loki docker image user"
sudo rm -rf test/logs_aggregator/loki


docker-go-test:
docker run --rm -it -v "$PWD":/go/src/github.com/harmony-one/harmony frozen621/harmony-test bash -c 'make go-test'
22 changes: 22 additions & 0 deletions Test.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM golang:1.24

ARG ENV=dev

RUN apt-get update && \
apt-get install -y build-essential make git curl libgmp-dev libssl-dev gcc g++ && \
rm -rf /var/lib/apt/lists/*

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

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

CMD ["make", "go-test"]
20 changes: 12 additions & 8 deletions consensus/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ type DownloadAsync interface {

// Consensus is the main struct with all states and data related to consensus process.
type Consensus struct {
decider quorum.Decider
// FBFTLog stores the pbft messages and blocks during FBFT process
fBFTLog *FBFTLog
// current indicates what state a node is in
Expand Down Expand Up @@ -147,6 +146,10 @@ func (consensus *Consensus) Blockchain() core.BlockChain {
return consensus.registry.GetBlockchain()
}

func (consensus *Consensus) decider() quorum.Decider {
return consensus.registry.GetQuorum()
}

func (consensus *Consensus) FBFTLog() FBFT {
return threadsafeFBFTLog{
log: consensus.fBFTLog,
Expand Down Expand Up @@ -217,7 +220,7 @@ func (consensus *Consensus) BlocksNotSynchronized(reason string) {
func (consensus *Consensus) VdfSeedSize() int {
consensus.mutex.RLock()
defer consensus.mutex.RUnlock()
return int(consensus.decider.ParticipantsCount()) * 2 / 3
return int(consensus.decider().ParticipantsCount()) * 2 / 3
}

// GetPublicKeys returns the public keys
Expand Down Expand Up @@ -285,11 +288,11 @@ func New(
Decider quorum.Decider, minPeers int, aggregateSig bool,
) (*Consensus, error) {
consensus := Consensus{
mutex: &sync.RWMutex{},
ShardID: shard,
fBFTLog: NewFBFTLog(),
current: NewState(Normal, shard),
decider: Decider,
mutex: &sync.RWMutex{},
ShardID: shard,
fBFTLog: NewFBFTLog(),
current: NewState(Normal, shard),
//decider: Decider,
registry: registry,
MinPeers: minPeers,
AggregateSig: aggregateSig,
Expand All @@ -300,6 +303,7 @@ func New(
dHelper: downloadAsync{},
pendingCXReceipts: make(map[utils.CXKey]*types.CXReceiptsProof), // All the receipts received but not yet processed for Consensus
}
registry.SetQuorum(Decider)

if multiBLSPriKey != nil {
consensus.priKey = multiBLSPriKey
Expand Down Expand Up @@ -338,7 +342,7 @@ func (consensus *Consensus) Registry() *registry.Registry {
}

func (consensus *Consensus) Decider() quorum.Decider {
return quorum.NewThreadSafeDecider(consensus.decider, consensus.mutex)
return consensus.registry.GetQuorum()
}

// InitConsensusWithValidators initialize shard state
Expand Down
35 changes: 18 additions & 17 deletions consensus/consensus_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package consensus

import (
"math/big"
"sync"
"time"

"github.com/ethereum/go-ethereum/common"
Expand Down Expand Up @@ -75,7 +76,7 @@ func (consensus *Consensus) signAndMarshalConsensusMessage(message *msg_pb.Messa
}

func (consensus *Consensus) updatePublicKeys(pubKeys, allowlist []bls_cosi.PublicKeyWrapper) int64 {
consensus.decider.UpdateParticipants(pubKeys, allowlist)
consensus.decider().UpdateParticipants(pubKeys, allowlist)
consensus.getLogger().Info().Msg("My Committee updated")
for i := range pubKeys {
consensus.getLogger().Info().
Expand All @@ -84,7 +85,7 @@ func (consensus *Consensus) updatePublicKeys(pubKeys, allowlist []bls_cosi.Publi
Msg("Member")
}

allKeys := consensus.decider.Participants()
allKeys := consensus.decider().Participants()
if len(allKeys) != 0 {
consensus.setLeaderPubKey(&allKeys[0])
consensus.getLogger().Info().
Expand All @@ -108,7 +109,7 @@ func (consensus *Consensus) updatePublicKeys(pubKeys, allowlist []bls_cosi.Publi
if !consensus.isViewChangingMode() {
consensus.resetViewChangeState()
}
return consensus.decider.ParticipantsCount()
return consensus.decider().ParticipantsCount()
}

// Sign on the hash of the message
Expand Down Expand Up @@ -136,7 +137,7 @@ func signConsensusMessage(message *msg_pb.Message,
func (consensus *Consensus) updateBitmaps() {
consensus.getLogger().Debug().
Msg("[UpdateBitmaps] Updating consensus bitmaps")
members := consensus.decider.Participants()
members := consensus.decider().Participants()
prepareBitmap := bls_cosi.NewMask(members)
commitBitmap := bls_cosi.NewMask(members)
multiSigBitmap := bls_cosi.NewMask(members)
Expand All @@ -153,9 +154,9 @@ func (consensus *Consensus) sendLastSignPower() {
consensus.getLogger().Err(err).Msg("Leader not found in the committee")
return
}
comm := getOrZero(consensus.decider.CurrentTotalPower(quorum.Commit))
prep := getOrZero(consensus.decider.CurrentTotalPower(quorum.Prepare))
view := consensus.decider.ComputeTotalPowerByMask(consensus.vc.GetViewIDBitmap(consensus.current.viewChangingID)).Int64()
comm := getOrZero(consensus.decider().CurrentTotalPower(quorum.Commit))
prep := getOrZero(consensus.decider().CurrentTotalPower(quorum.Prepare))
view := consensus.decider().ComputeTotalPowerByMask(consensus.vc.GetViewIDBitmap(consensus.current.viewChangingID)).Int64()
for view > 100 {
view /= 10
}
Expand Down Expand Up @@ -199,7 +200,7 @@ func (consensus *Consensus) resetState() {

consensus.current.blockHash = [32]byte{}
consensus.current.block = []byte{}
consensus.decider.ResetPrepareAndCommitVotes()
consensus.decider().ResetPrepareAndCommitVotes()
if consensus.prepareBitmap != nil {
consensus.prepareBitmap.Clear()
}
Expand All @@ -216,7 +217,7 @@ func (consensus *Consensus) IsValidatorInCommittee(pubKey bls.SerializedPublicKe
}

func (consensus *Consensus) isValidatorInCommittee(pubKey bls.SerializedPublicKey) bool {
return consensus.decider.IndexOf(pubKey) != -1
return consensus.decider().IndexOf(pubKey) != -1
}

// SetMode sets the mode of consensus
Expand Down Expand Up @@ -304,7 +305,7 @@ func (consensus *Consensus) setBlockNum(blockNum uint64) {
// ReadSignatureBitmapPayload read the payload for signature and bitmap; offset is the beginning position of reading
func (consensus *Consensus) ReadSignatureBitmapPayload(recvPayload []byte, offset int) (*bls_core.Sign, *bls_cosi.Mask, error) {
consensus.mutex.RLock()
members := consensus.decider.Participants()
members := consensus.decider().Participants()
consensus.mutex.RUnlock()
return readSignatureBitmapPayload(recvPayload, offset, members)
}
Expand Down Expand Up @@ -370,12 +371,12 @@ func (consensus *Consensus) updateConsensusInformation(reason string) Mode {
isFirstTimeStaking := consensus.Blockchain().Config().IsStaking(nextEpoch) &&
curHeader.IsLastBlockInEpoch() && !consensus.Blockchain().Config().IsStaking(curEpoch)
haventUpdatedDecider := consensus.Blockchain().Config().IsStaking(curEpoch) &&
consensus.decider.Policy() != quorum.SuperMajorityStake
consensus.decider().Policy() != quorum.SuperMajorityStake

// Only happens once, the flip-over to a new Decider policy
if isFirstTimeStaking || haventUpdatedDecider {
decider := quorum.NewDecider(quorum.SuperMajorityStake, consensus.ShardID)
consensus.decider = decider
decider := quorum.NewThreadSafeDecider(quorum.NewDecider(quorum.SuperMajorityStake, consensus.ShardID), &sync.RWMutex{})
consensus.registry.SetQuorum(decider)
}

var committeeToSet *shard.Committee
Expand Down Expand Up @@ -448,7 +449,7 @@ func (consensus *Consensus) updateConsensusInformation(reason string) Mode {
consensus.updatePublicKeys(pubKeys, shard.Schedule.InstanceForEpoch(nextEpoch).ExternalAllowlist())

// Update voters in the committee
if _, err := consensus.decider.SetVoters(
if _, err := consensus.decider().SetVoters(
committeeToSet, epochToSet,
); err != nil {
consensus.getLogger().Error().
Expand Down Expand Up @@ -619,7 +620,7 @@ func (consensus *Consensus) selfCommit(payload []byte) error {
return errGetPreparedBlock
}

aggSig, mask, err := readSignatureBitmapPayload(payload, 32, consensus.decider.Participants())
aggSig, mask, err := readSignatureBitmapPayload(payload, 32, consensus.decider().Participants())
if err != nil {
return errReadBitmapPayload
}
Expand All @@ -643,7 +644,7 @@ func (consensus *Consensus) selfCommit(payload []byte) error {
continue
}

if _, err := consensus.decider.AddNewVote(
if _, err := consensus.decider().AddNewVote(
quorum.Commit,
[]*bls_cosi.PublicKeyWrapper{key.Pub},
key.Pri.SignHash(commitPayload),
Expand All @@ -665,7 +666,7 @@ func (consensus *Consensus) selfCommit(payload []byte) error {
// Method is thread safe.
func (consensus *Consensus) NumSignaturesIncludedInBlock(block *types.Block) uint32 {
count := uint32(0)
members := consensus.decider.Participants()
members := consensus.decider().Participants()
pubKeys := consensus.getPublicKeys()

// TODO(audit): do not reconstruct the Mask
Expand Down
14 changes: 7 additions & 7 deletions consensus/consensus_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (consensus *Consensus) HandleMessageUpdate(ctx context.Context, peer libp2p
case t == msg_pb.MessageType_VIEWCHANGE:
fbftMsg, err = ParseViewChangeMessage(msg)
case t == msg_pb.MessageType_NEWVIEW:
members := consensus.decider.Participants()
members := consensus.decider().Participants()
fbftMsg, err = ParseNewViewMessage(msg, members)
case t == msg_pb.MessageType_LAST_SIGN_POWER:
return nil
Expand Down Expand Up @@ -151,7 +151,7 @@ func (consensus *Consensus) finalCommit(waitTime time.Duration, viewID uint64, i
}

func (consensus *Consensus) _finalCommit(isLeader bool) {
numCommits := consensus.decider.SignersCount(quorum.Commit)
numCommits := consensus.decider().SignersCount(quorum.Commit)

consensus.getLogger().Info().
Int64("NumCommits", numCommits).
Expand Down Expand Up @@ -478,7 +478,7 @@ func (consensus *Consensus) BlockChannel(newBlock *types.Block) {
Int("numTxs", len(newBlock.Transactions())).
Int("numStakingTxs", len(newBlock.StakingTransactions())).
Time("startTime", startTime).
Int64("publicKeys", consensus.decider.ParticipantsCount()).
Int64("publicKeys", consensus.decider().ParticipantsCount()).
Msg("[ConsensusMainLoop] STARTING CONSENSUS")
consensus.announce(newBlock)
})
Expand Down Expand Up @@ -788,18 +788,18 @@ func (consensus *Consensus) rotateLeader(epoch *big.Int, defaultKey *bls.PublicK

for i := 0; i < len(committee.Slots); i++ {
if bc.Config().IsLeaderRotationV2Epoch(epoch) {
wasFound, next = consensus.decider.NthNextValidatorV2(committee.Slots, leader, offset)
wasFound, next = consensus.decider().NthNextValidatorV2(committee.Slots, leader, offset)
} else if bc.Config().IsLeaderRotationExternalValidatorsAllowed(epoch) {
wasFound, next = consensus.decider.NthNextValidator(committee.Slots, leader, offset)
wasFound, next = consensus.decider().NthNextValidator(committee.Slots, leader, offset)
} else {
wasFound, next = consensus.decider.NthNextHmy(shard.Schedule.InstanceForEpoch(epoch), leader, offset)
wasFound, next = consensus.decider().NthNextHmy(shard.Schedule.InstanceForEpoch(epoch), leader, offset)
}
if !wasFound {
consensus.getLogger().Error().Msg("Failed to get next leader")
// Seems like nothing we can do here.
return defaultKey
}
members := consensus.decider.Participants()
members := consensus.decider().Participants()
mask := bls.NewMask(members)
skipped := 0
for i := 0; i < blocksCountAliveness; i++ {
Expand Down
4 changes: 2 additions & 2 deletions consensus/construct.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (consensus *Consensus) construct(
)
} else {
// TODO: use a persistent bitmap to report bitmap
mask := bls.NewMask(consensus.decider.Participants())
mask := bls.NewMask(consensus.decider().Participants())
for _, key := range priKeys {
mask.SetKey(key.Pub.Bytes, true)
}
Expand Down Expand Up @@ -158,7 +158,7 @@ func (consensus *Consensus) construct(
func (consensus *Consensus) constructQuorumSigAndBitmap(p quorum.Phase) []byte {
buffer := bytes.Buffer{}
// 96 bytes aggregated signature
aggSig := consensus.decider.AggregateVotes(p)
aggSig := consensus.decider().AggregateVotes(p)
buffer.Write(aggSig.Serialize())
// Bitmap
if p == quorum.Prepare {
Expand Down
2 changes: 1 addition & 1 deletion consensus/double_sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func (consensus *Consensus) checkDoubleSign(recvMsg *FBFTMessage) bool {
if consensus.couldThisBeADoubleSigner(recvMsg) {
addrSet := map[common.Address]struct{}{}
for _, pubKey2 := range recvMsg.SenderPubkeys {
if alreadyCastBallot := consensus.decider.ReadBallot(
if alreadyCastBallot := consensus.decider().ReadBallot(
quorum.Commit, pubKey2.Bytes,
); alreadyCastBallot != nil {
for _, pubKey1 := range alreadyCastBallot.SignerPubKeys {
Expand Down
Loading