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

refactor(consensus): switch ValidatorId to a plain Felt #2137

Closed
wants to merge 1 commit into from

Conversation

matan-starkware
Copy link
Contributor

@matan-starkware matan-starkware commented Jun 23, 2024

This change is Reviewable

@matan-starkware matan-starkware marked this pull request as ready for review June 23, 2024 17:42
Copy link

codecov bot commented Jun 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 65.56%. Comparing base (9c88127) to head (394f4c5).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2137      +/-   ##
==========================================
- Coverage   65.62%   65.56%   -0.07%     
==========================================
  Files         135      135              
  Lines       17875    17875              
  Branches    17875    17875              
==========================================
- Hits        11730    11719      -11     
- Misses       4859     4869      +10     
- Partials     1286     1287       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@ShahakShama ShahakShama left a comment

Choose a reason for hiding this comment

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

Reviewed 5 of 5 files at r1, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @matan-starkware)

a discussion (no related file):
Why is this PR needed? What's wrong with contract address?



crates/papyrus_protobuf/src/consensus.rs line 8 at r1 (raw file):

pub struct Proposal {
    pub height: u64,
    pub proposer: StarkHash,

Why StarkHash and not felt? Is the proposer representing some hash?


crates/sequencing/papyrus_consensus/src/types.rs line 15 at r1 (raw file):

///    signatures.
// TODO(matan): Determine the actual type of NodeId.
pub type ValidatorId = StarkHash;

Same here. Why Hash and not Felt?

Copy link
Contributor Author

@matan-starkware matan-starkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @ShahakShama)

a discussion (no related file):

Previously, ShahakShama wrote…

Why is this PR needed? What's wrong with contract address?

Well it's not actually certain that we will be using ContractAddress. Also ContractAddress didn't have Display, which is nice for readable printing. So I decided to just go to a more basic type (ContractAddress is basically just an alias for Felt anyways).



crates/papyrus_protobuf/src/consensus.rs line 8 at r1 (raw file):

Previously, ShahakShama wrote…

Why StarkHash and not felt? Is the proposer representing some hash?

Done.


crates/sequencing/papyrus_consensus/src/types.rs line 15 at r1 (raw file):

Previously, ShahakShama wrote…

Same here. Why Hash and not Felt?

Done.

@matan-starkware matan-starkware force-pushed the matan/consensus_validator_id_felt branch from 77789e7 to 688b677 Compare June 24, 2024 13:31
@matan-starkware matan-starkware changed the base branch from 06-19-refactor_consensus_add_test_util_to_more_cleanly_create_validator_ids to main June 24, 2024 13:31
@dan-starkware
Copy link
Collaborator

Please add @ittaysw (FYI) in proto/specs related PRs

Copy link
Contributor Author

@matan-starkware matan-starkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 2 of 5 files reviewed, 3 unresolved discussions (waiting on @ShahakShama)

a discussion (no related file):

Previously, matan-starkware wrote…

Well it's not actually certain that we will be using ContractAddress. Also ContractAddress didn't have Display, which is nice for readable printing. So I decided to just go to a more basic type (ContractAddress is basically just an alias for Felt anyways).

  1. ContractAddress is just a few layers of abstraction over Felt
  2. The current thought is to use contract address, but it isn't actually set in stone yet
  3. ContractAddress didn't have the Display trait and given (2) I didn't want to invest in adding it to an external crate

Dan said the Debug for ContractAddress is being fixed so there is no need to do this. Holding off on this PR for now.


@matan-starkware matan-starkware force-pushed the matan/consensus_validator_id_felt branch from 688b677 to 394f4c5 Compare June 25, 2024 14:40
@github-actions github-actions bot locked and limited conversation to collaborators Jun 27, 2024
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.

3 participants