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

Fd 1211 factable solutions updates october #901

Merged

Conversation

stackdump
Copy link
Contributor

Merge fact able Oct changes into a4

factablesolutions and others added 6 commits October 17, 2019 20:52
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
Copy link
Member

@WhoSoup WhoSoup left a 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
Copy link
Member

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
Copy link
Member

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)
Copy link
Member

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
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

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

two things:

  1. it's a slice not an array
  2. 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
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

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

redundant

@stackdump stackdump force-pushed the FD-1112_a4_rollup branch 2 times, most recently from ba38a7f to bf73f56 Compare October 29, 2019 18:15
@stackdump stackdump merged commit 33855bc into FD-1112_a4_rollup Dec 4, 2019
@PaulBernier PaulBernier deleted the FD-1211_factable_solutions_updates_october branch September 26, 2020 04:40
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.

3 participants