-
Notifications
You must be signed in to change notification settings - Fork 92
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
Fd 1211 factable solutions updates october #901
Fd 1211 factable solutions updates october #901
Conversation
sync with their actual values
changes. Calling init() and refactor an else statement
and EC_CHAINID_STRING Comments and receiver changes, and else refactorings
refactor init() call and 'else' statements, delete confusing and mostly duplicative function which is never called outside this file
Fd 1211 factable branch
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.
hope you don't mind but I took the liberty of providing some feedback. there are some ambiguities and some mistakes, as well as some things that could be improved
overall, i think there is a pattern of over-commenting things, particularly of the struct fields (see my "redundant" comments). comments should add extraneous information that you can't determine from just reading the code, or explain difficult to understand processes, or summarize things. just paraphrasing the name of the variable doesn't do anything and is just more work for you
) | ||
|
||
// Returns if factomd is terminated or in the process of terminating | ||
// IsTerminating returns true if factomd is terminated or in the process of terminating |
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.
is this function a misnomer? it turns a hard > Stopping
. the only one that passes is "Stopped". func should be called IsTerminated
imo, or we change this to a >=
. the only place it's used is in missing message requests, quitting those earlier shouldn't be a problem
Running RunState = 2 | ||
Stopping RunState = 3 | ||
Stopped RunState = 4 | ||
New RunState = 0 // State of a newly created Factomd object |
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.
this can be implement as an iota
@@ -15,10 +15,10 @@ import ( | |||
|
|||
// EBlock is the Entry Block. It holds the hashes of the Entries and its Merkle | |||
// Root is written into the Directory Blocks. Each Entry Block represents all | |||
// of the entries for a particular Chain during a 10 minute period. | |||
// of the entries for a particular Chain during a 10 minute period (a single directory block's worth of time) |
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.
Unfortunately, there is some really ambiguous language prevalent throughout these comments and it would be great to clear up some of the confusion.
The first thing is we should distinguish between "eblock entries" and "chain entries". "eblock entries" are the values stored in the eblock's "body" and are 32-byte sized objects that are either a) the entry hash of a chain entry, or b) an end-of-minute marker.
I think this comment should be changed to:
// EBlock (Entry Block) holds an index of all entries written to a particular chain in the course of a Directory Block.
// The EBlock's Merkle Root is written to the Directory Block.
type EBlock struct { | ||
Header interfaces.IEntryBlockHeader `json:"header"` | ||
Body *EBlockBody `json:"body"` | ||
Header interfaces.IEntryBlockHeader `json:"header"` // Header of the Eblock |
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.
this comment is redundant and adds nothing useful
Header interfaces.IEntryBlockHeader `json:"header"` | ||
Body *EBlockBody `json:"body"` | ||
Header interfaces.IEntryBlockHeader `json:"header"` // Header of the Eblock | ||
Body *EBlockBody `json:"body"` // Array of entries from a single chain id associated with this entry block |
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.
two things:
- it's a slice not an array
- with respect to my comment above, this should be "eblock entries". the way its phrased here is very ambiguous. it can also be truncated to just "Slice of EBlock entries" with a comment in EBlockBody explaining what the data is
@@ -15,37 +15,40 @@ import ( | |||
"github.com/FactomProject/factomd/common/primitives" | |||
) | |||
|
|||
// ECBlockHeader contains information related to this EC block as well as the previous EC block |
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.
"meta information"
@@ -11,55 +11,64 @@ import ( | |||
"github.com/FactomProject/factomd/common/primitives" | |||
) | |||
|
|||
// ECBlockBody contains all the entry information for the EC block. The entries will be one of 5 types: | |||
// CommitChain, CommitEntry, IncreaseBalance, MinuteNumber, or ServerIndexNumber |
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.
Index uint64 `json:"index"` | ||
NumEC uint64 `json:"numec"` | ||
ECPubKey *primitives.ByteSlice32 `json:"ecpubkey"` // EC public key that will have balanced increased | ||
TXID interfaces.IHash `json:"txid"` // The transaction id associated with this balance increase |
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'd shorten that to just "// TXID = transaction id", the rest is redundant
type MinuteNumber struct { | ||
Number uint8 `json:"number"` | ||
Number uint8 `json:"number"` // The minute number |
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.
redundant
type ServerIndexNumber struct { | ||
ServerIndexNumber uint8 `json:"serverindexnumber"` | ||
ServerIndexNumber uint8 `json:"serverindexnumber"` // the server index number |
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.
redundant
ba38a7f
to
bf73f56
Compare
Merge fact able Oct changes into a4