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

Feature/skip waiting 100 sign with lock free message validation #4740

Draft
wants to merge 9 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fixed tests.
  • Loading branch information
Frozen committed Aug 19, 2024
commit 5daf9309c7f44094d90313e39897d2cfa0931a02
2 changes: 0 additions & 2 deletions consensus/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,6 @@ func (consensus *Consensus) getLeaderPubKey() *bls_cosi.PublicKeyWrapper {
}

func (consensus *Consensus) SetLeaderPubKey(pub *bls_cosi.PublicKeyWrapper) {
consensus.mutex.Lock()
defer consensus.mutex.Unlock()
consensus.setLeaderPubKey(pub)
}

Expand Down
2 changes: 1 addition & 1 deletion consensus/consensus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestConsensusInitialization(t *testing.T) {
assert.NoError(t, err)

messageSender := &MessageSender{host: host, retryTimes: int(phaseDuration.Seconds()) / RetryIntervalInSec}
state := State{mode: Normal}
state := NewState(Normal)

timeouts := createTimeout()
expectedTimeouts := make(map[TimeoutType]time.Duration)
Expand Down
5 changes: 2 additions & 3 deletions consensus/view_change_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ func TestBasicViewChanging(t *testing.T) {
_, _, consensus, _, err := GenerateConsensusForTesting()
assert.NoError(t, err)

state := State{mode: Normal}
state := NewState(Normal)

// Change Mode
assert.Equal(t, state.mode, consensus.current.mode)
assert.Equal(t, state.Mode(), consensus.current.Mode())

consensus.current.SetMode(ViewChanging)
assert.Equal(t, ViewChanging, consensus.current.mode)
assert.Equal(t, ViewChanging, consensus.current.Mode())

// Change ViewID
Expand Down Expand Up @@ -114,7 +113,7 @@ func TestGetNextLeaderKeyShouldSucceed(t *testing.T) {
consensus.Decider().UpdateParticipants(wrappedBLSKeys, []bls.PublicKeyWrapper{})
assert.Equal(t, keyCount, consensus.Decider().ParticipantsCount())

consensus.LeaderPubKey = &wrappedBLSKeys[0]
consensus.setLeaderPubKey(&wrappedBLSKeys[0])
nextKey := consensus.getNextLeaderKey(uint64(1), nil)

assert.Equal(t, nextKey, &wrappedBLSKeys[1])
Expand Down
2 changes: 1 addition & 1 deletion node/node_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func TestVerifyVRF(t *testing.T) {
shardState.Epoch = big.NewInt(1)
shardState.Shards = append(shardState.Shards, com)

node.Consensus.LeaderPubKey = &bls.PublicKeyWrapper{Bytes: spKey, Object: pubKey}
node.Consensus.SetLeaderPubKey(&bls.PublicKeyWrapper{Bytes: spKey, Object: pubKey})
node.Worker.GetCurrentHeader().SetEpoch(big.NewInt(1))
node.Consensus.GenerateVrfAndProof(node.Worker.GetCurrentHeader())
block, _ := node.Worker.FinalizeNewBlock(
Expand Down