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

simple proposal election calculation #1

Open
Jovonni opened this issue May 14, 2020 · 0 comments
Open

simple proposal election calculation #1

Jovonni opened this issue May 14, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@Jovonni
Copy link
Contributor

Jovonni commented May 14, 2020

The proposal creation function still iterates congruently, but the expected node id is not what is expected. All tests pass now, but this is was the bug. It didn't stop proposal generation for nodes, but it chose the wrong participant to create the next proposal

aos-paper/aos.tex

Lines 343 to 353 in bdf32e5

\begin{equation}
\texttt{PCE} := ((B_i + 1) \: \texttt{mod} \: \vert N \vert) + 1
\end{equation}
\hspace*{15pt}
where we add \(1\) to \(B_i\) to represent the next block id, and we add \(1\) to the result assuming node ids, \(N_{id}\) begin at \(1\), not \(0\). The node then checks for whether or not its own node id, \(N_{id}\), is equal to the result of \texttt{PCE}. Effectively, this is checking whether or not \(N_{id}\) is congruent to the next \(B_i\) modulo the cardinality of nodes being considered or proposal creation, \(\vert N \vert\).
\begin{equation}
N_{id} = (B_i +1) \: (\texttt{mod} \: \vert N \vert)
\end{equation}

Should be:

\begin{equation} 
 	\texttt{PCE} := (B_i  \: \texttt{mod} \: \vert N \vert) + 1 
 \end{equation} 
  
 \hspace*{15pt} 
 where we add \(1\) to the result assuming node ids, \(N_{id}\) begin at \(1\), not \(0\). The node then checks for whether or not its own node id, \(N_{id}\), is equal to the result of \texttt{PCE}. Effectively, this is checking whether or not \(N_{id}\) is congruent to the next \(B_i\) modulo the cardinality of nodes being considered or proposal creation, \(\vert N \vert\).   
  
 \begin{equation} 
 	N_{id} = B_i \: (\texttt{mod} \: \vert N \vert) 
 \end{equation} 

Because

[print( ( (x+1) % (3 + 1) ) + 1 ) for x in range(0,10)]
2
3
4
1
2
3
4
1
2
3

but this is correct

[print((x % 3) + 1) for x in range(0,10)]
1
2
3
1
2
3
1
2
3
1

This works for three, and for 2 peers

[print((x % 2) + 1) for x in range(0,10)]
1
2
1
2
1
2
1
2
1
2

and for 5 peers

[print((x % 5) + 1) for x in range(0,10)]
1
2
3
4
5
1
2
3
4
5

The update will be made on in the aos repo as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant