-
Notifications
You must be signed in to change notification settings - Fork 144
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
Basic blockchain types and Tipset methods #28
Conversation
* Defined block header and block structures * Defined ticket structure with vrfproof type * Defined tipset structure and wip new_tip_set fn with tests
* Added utility methods to the Tipset type * Updated comments * Linted using clippy and rustfmt
* Fix min_ticket return statement * update comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should use doc comments for the function documentation (///
instead of //
).
Also -- just wanted to point out the use of pub
on fields in the BlockHeader struct (and elsewhere), I think this is generally a bad practice, but until we have a better sense of how we are constructing the blocks we can probably leave as is.
I added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just minor questions/ comments. One thing I would suggest is we default to making functions private over public unless actually needed to be public. Reason for this is to not crowd possible imports and expose functions/parameters that should not be accessed outside of this module or crate
* Added Tipset comment * Added clone to TipSetKeys * Referenced Address type from vm * Return proper error rather than integer in min_timestamp
@ansermino @austinabell @GregTheGreek changes made as requested |
* Added Option to min_timestamp return rather than error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:D looks like a good framework with what's available. Would be nice to have some sort of tests though so the logic and function signatures don't have to be assumed to be correct
Yeah tests will be added shortly after |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove extern crate. Other than that, its cosmetics, that are opinionated, so feel free to disregard those.
* Added blockheader comment * Added vrfpi comment * Removed error prefixes
* Moved and renamed fn under impl Tipset
@GregTheGreek @ec2 @ansermino changes made as requested |
* Removed extern crate * Moved the vfriproof type to top of file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new commits look good
blockchain/src/blocks/block.rs
Outdated
use cid::Cid; | ||
use vm::address::Address; | ||
|
||
/// BlockHeader defines header of a block in the filecoin blockchain |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filecoin
-> Filecoin
/// MINER INFO | ||
/// | ||
/// miner_address is the address of the miner actor that mined this block | ||
miner_address: Address, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the rational of what needs to be public or private in this struct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the above comments, only make the fields public that are currently being used (e.g. height, parents). Once further functionality has been added the remainder of the fields in this struct will become public.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor cosmetics stuffs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Changes introduced in this PR:
len
,is_empty
,key
,min_ticket
etc.)errors.rs
for blockchain componentStubbed functions:
new
new
which will be used to assemble blocks into aTipSet
.Todo:
mod.rs
Closes #9, closes #23