Skip to content

Recheck konsensus and fix issues #837

@JekaMas

Description

@JekaMas

Type:

Issue

What happened? / What do you need?:

While working on #808 a few issues were discovered:

  1. We need something to not sync processes using time.Sleep. It causes data races between Fetcher and Validator. The consensus should not rely on sleep and waits. Ethereum can garauntee only ~7sec sync between peers, so we can't rely on sleeps ~ 100 - 1000ms

  2. Too complicated flow control in client/knode/validator/validator.go

running    int32
validating int32
canStart    int32 // can start indicates whether we can start the validation operation
shouldStart int32 // should start indicates whether we should start after sync
isStarted   int32 // is Start method has been already called
wg sync.WaitGroup

We should have as simple as possible flow control and validator start.

  1. We're creating a few goroutines in client/knode/validator/validator.go that have no external control or a way to shutdown them.

  2. Something wrong with e2e tests. It looks racy or something. Eg:

./e2e --features ./features
....................P---.....P-....F----.P-.P- 46


--- Failed steps:

  Scenario: Wrong chain ID # features/token.feature:22
    And the token balance of A should be 15 mTokens # features/token.feature:25
      Error: account 0xdEe18552F77aea976eABE2F0AaD2Ce413b17DC05 have 20000000000000000000 mTokens, expected 15000000000000000000

But Scenario: Wrong chain ID is in e2e/features/node.feature and it hasn't And the token balance of A should be 15 mTokens step.

All of them should be fixed and all code related to Validator should be rechecked and simplified.

  1. state initialization is devided between init() and newRoundState() methods. It leads to bugs

Priority:

High

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions