You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A node will choose a new leader once the following happens:
A timeout is reached after no new blocks were committed, and
Right after the timeout is reached, the pool contains one or more transaction(s)
In pseudo-code:
for {
select {
case<-time.After(timeout):
ifpool.Len() !=0 {
// trigger a view change
}
case<-s.newBlocks:
// ok, continue
}
}
Choosing a new leader is a heavy operation that should be triggered only when the situation truly requires it.
The current process can be a problem for the following reason:
In the unfortunate situation where a transaction is added to the pool right after the timeout: even if the leader is honest, it might just process the transaction too late.
This check only ensures that some transactions are included periodically, but doesn't prevent the leader from censoring specific transactions.
I won't try to solve 2) for the moment. Let's focus on 1), which can be stated as follow: "a view change should be triggered only once a node finds out that the the pool of transaction, if not empty, hasn't be updated after some timeout".
Solution 1 - Add a second timeout
Once the timeout is reached, wait on another timeout and check if some transaction were processed in the meantime:
for {
select {
case<-time.After(timeout):
n:=pool.Len()
ifn!=0 {
// gives some time to the leader to process txstime.Sleep(timeout2)
ifpool.Len() <n {
// okreturnnil
}
// view change
}
case<-s.newBlocks:
// ok, continue
}
}
Pros:
simple to implement
Cons:
there can still be a false negative, in case the leader processed one transaction, but another one got included
Solution 2 - Update the pool implementation
Adds a functionality to the pool that can notify for "rotten transaction".
Introduction
A node will choose a new leader once the following happens:
In pseudo-code:
Choosing a new leader is a heavy operation that should be triggered only when the situation truly requires it.
The current process can be a problem for the following reason:
I won't try to solve 2) for the moment. Let's focus on 1), which can be stated as follow: "a view change should be triggered only once a node finds out that the the pool of transaction, if not empty, hasn't be updated after some timeout".
Solution 1 - Add a second timeout
Once the timeout is reached, wait on another timeout and check if some transaction were processed in the meantime:
Pros:
Cons:
Solution 2 - Update the pool implementation
Adds a functionality to the pool that can notify for "rotten transaction".
Pros:
Cons:
The text was updated successfully, but these errors were encountered: