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

Initial implementation of Tendermint #2185

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

IronGauntlets
Copy link
Contributor

@IronGauntlets IronGauntlets commented Sep 29, 2024

All of the Tendermint algorithm has been implemented.

Outstanding tasks are described in various "todos".

Once sufficient tests have been added I will split the PR into multiple commits and it will be ready to merge.

@IronGauntlets IronGauntlets force-pushed the IronGauntlets/tendermint branch from 244b3d9 to c0b79c3 Compare October 15, 2024 04:16
@IronGauntlets IronGauntlets changed the title Initial Tendermint message handling loop Initial implementation of Tendermint Oct 15, 2024
}

algo.messages.addPrevote(val3Prevote)
prevoteListener := listeners.PrecommitListener.(*senderAndReceiver[Precommit[felt.Felt, felt.Felt], value,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo. Also, do you think we could collapse the above three tests into a single test? It seems most of the code is repeated

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to make the tests independent. If we start sharing variables, it becomes difficult to debug because of side effects. I have variables that don't change at the top of the test.

t.scheduledTms = append(t.scheduledTms, tm)
}

func (t *Tendermint[_, H, A]) OnTimeoutPropose(h, r uint) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So imagine that we start up a node, and it never recieves messages from other nodes. We start round 0, schedule the propose timeout, which eventually gets hit, and we end up here. Then we cast a nil prevote, set step to prevote and continue. We will end up back at startRound(0) again, reset everything, and the process will repeat indefinitely, right? We would effectively be casting nil prevotes with round=0 forever? (I would have thought the round would increase..)

t.Run("Line 22: receive a new proposal before timeout expiry", func(t *testing.T) {
})
//
//t.Run("Line 28: receive an old proposal before timeout expiry", func(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we also need tests for line 36?

Comment on lines +229 to +230
time.Sleep(time.Millisecond)
algo.Stop()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing these two lines seems to have no effect. Which is weird, I would have thought there were needed, and don't understand how algo.Stop() is triggered..

@IronGauntlets IronGauntlets force-pushed the IronGauntlets/tendermint branch from c0b79c3 to 2ea56e2 Compare December 10, 2024 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants