Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Vote checkpoints #81

Merged
merged 30 commits into from
Apr 5, 2023
Merged

Vote checkpoints #81

merged 30 commits into from
Apr 5, 2023

Conversation

cryptoAtwill
Copy link
Collaborator

Changes

Update submit_cron_checkpoint to use generic types, as such, the same logic can be applied to checkpoint submissions.

Tests

cargo test --all

cryptoAtwill and others added 17 commits March 20, 2023 18:53
@cryptoAtwill cryptoAtwill changed the base branch from main to cron_impl April 3, 2023 06:00
@cryptoAtwill cryptoAtwill requested a review from adlrocha April 3, 2023 06:14
Copy link
Contributor

@adlrocha adlrocha left a comment

Choose a reason for hiding this comment

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

@cryptoAtwill, I did a first pass over the PR. There's a lot of code, I want to have an additional one tomorrow before approving. I don't much will change in my next pass, but my brain is not working anymore today and I rather do a pass when I am fresh.

}
}

impl<V: Serialize> Serialize for EpochVoteSubmissions<V> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you need this custom serializer and you can't derive them?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Somehow if I use the derive, it would raise a trait not constraint error from Rust which I have already constraint. Only this way I can bypass the compilation error.


/// Handle the epoch voting
#[derive(PartialEq, Eq, Clone)]
pub struct Voting<Vote> {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a generic type, right? I think using Vote is a bit confusing, I was trying to find to the underlying type everywhere

Suggested change
pub struct Voting<Vote> {
pub struct Voting<T> {

sdk/src/vote/voting.rs Outdated Show resolved Hide resolved
sdk/src/vote/voting.rs Outdated Show resolved Hide resolved
sdk/src/vote/voting.rs Outdated Show resolved Hide resolved
sdk/src/vote/mod.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@adlrocha adlrocha left a comment

Choose a reason for hiding this comment

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

Amazing job, @cryptoAtwill. Have a look at my comments before merging. The most important one is to fix how we generate the HAMT keys for epochs. This lead to a bug in the interoperability with Go in checkpoints, so let's try to avoid it again (it was a hard one to fix :) )

sdk/src/vote/submission.rs Outdated Show resolved Hide resolved
sdk/src/vote/submission.rs Outdated Show resolved Hide resolved
sdk/src/vote/submission.rs Outdated Show resolved Hide resolved
sdk/src/vote/submission.rs Outdated Show resolved Hide resolved
sdk/src/vote/voting.rs Outdated Show resolved Hide resolved
sdk/src/vote/voting.rs Outdated Show resolved Hide resolved
@adlrocha adlrocha merged commit de81961 into cron_impl Apr 5, 2023
@adlrocha adlrocha deleted the vote_checkpoints branch April 5, 2023 06:52
adlrocha added a commit that referenced this pull request Apr 10, 2023
* add cron fields

* fmt code

* Update gateway/src/state.rs

Co-authored-by: adlrocha <adlrocha@tutamail.com>

* Update gateway/src/types.rs

Co-authored-by: adlrocha <adlrocha@tutamail.com>

* update cron (#65)

* update cron

* fix lint

---------

Co-authored-by: willesxm <willeslau@gmail.com>

* add submit cron impl

* add more checks

* add some todo

* derive total validators

* add todo

* specify rust tool chain

* add tests

* support abort

* simplify impl

* Track validators (#70)

* track validators

* add validator check to submit cron

* update impl

* Weighted vote (#71)

* track validators

* add validator check to submit cron

* update impl

* weighted vote

* Update gateway/src/cron.rs

Co-authored-by: adlrocha <adlrocha@tutamail.com>

* update method name

---------

Co-authored-by: adlrocha <adlrocha@tutamail.com>

* Cron submit tests (#73)

* track validators

* add validator check to submit cron

* update impl

* weighted vote

* Update gateway/src/cron.rs

Co-authored-by: adlrocha <adlrocha@tutamail.com>

* update method name

* add tests

* refactor pending epoches

* fix clippy

* add more tests

---------

Co-authored-by: adlrocha <adlrocha@tutamail.com>

* Refactor checkpoints (#74)

* track validators

* add validator check to submit cron

* update impl

* weighted vote

* Update gateway/src/cron.rs

Co-authored-by: adlrocha <adlrocha@tutamail.com>

* update method name

* add tests

* refactor pending epoches

* fix clippy

* add more tests

* initial commit

* Cross execution (#75)

* update bottom up execution

* update cross message execution

* fix fmt

* update review and clean up

* check message ordering

* Cross execution tests (#76)

* fix clippy

* fmt code

---------

Co-authored-by: adlrocha <adlrocha@tutamail.com>

* cargo fmt

* Vote checkpoints (#81)

* track validators

* add validator check to submit cron

* update impl

* weighted vote

* Update gateway/src/cron.rs

Co-authored-by: adlrocha <adlrocha@tutamail.com>

* update method name

* add tests

* refactor pending epoches

* fix clippy

* add more tests

* initial commit

* Cross execution (#75)

* update bottom up execution

* update cross message execution

* fix fmt

* update review and clean up

* check message ordering

* Cross execution tests (#76)

* fix clippy

* fmt code

* generics for cron submission

* migrate to sdk

* format code

* remove wip field

* work in progress

* local changes

* reorg code

* update comment

* update tests

* format code and clippy

* fix error

---------

Co-authored-by: adlrocha <adlrocha@tutamail.com>

* rename checkpoints to bottomup and topdown

* fix tests

* use CrossMsg for topdown checkpoint

* fix checkpoint (#85)

* update queue serialization (#86)

* update queue serialization

* remove println

* fix fmt

* genesis_epoch bottomup checkpoints to zero

* fix test with new genesis checkpoint

---------

Co-authored-by: willesxm <willeslau@gmail.com>
Co-authored-by: adlrocha <adlrocha@tutamail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants