-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Group Slashing Protection History Packages Idiomatically #9873
Conversation
…ysm into rename-slashing-protect
…ysm into rename-slashing-protect
…ysm into rename-slashing-protect
…ysm into rename-slashing-protect
…ysm into rename-slashing-protect
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.
Very nice improvement. For extra credit I think the package names could be a bit more concise.
@@ -1,4 +1,4 @@ | |||
package slashingprotection | |||
package slashingprotectioncmd |
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 is a really long package name. Considering packages like this are only imported by the command that uses them, maybe we could call them something simple and generic like subcmd
.
// Package slashingprotection defines methods to parse, import, and export slashing protection data | ||
// from a standard JSON file according to EIP-3076 https://eips.ethereum.org/EIPS/eip-3076. This format | ||
// is critical to allow safe interoperability between Ethereum consensus clients. | ||
package slashingprotectionhistory |
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.
Thanks for making package comment files, seeing this is a good reminder for me to do more of that. I used to have a practice of always running godoc to browse how my final docs looked and think about whether I could learn to use a package from that viewpoint, but I've gotten way too lazy about that!
@@ -1,4 +1,4 @@ | |||
package interchangeformat | |||
package slashingprotectionhistory |
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 about a shorter package name like history
?
package slashingprotection | ||
package slashingprotectioncmd |
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.
Why the change? Other packages in cmd
don't have the cmd
suffix.
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.
The reason is that it avoids conflicts with the slashingprotection
package when importing it. For example:
import (
// CONFUSION! Go imports autocomplete doesn't know what to do, need manual aliasing
slashingprotection "github.com/prysm/cmd/validator/slashing-protection"
slashingprotection "github.com/prysm/validator/slashing-protection"
)
vs
import (
// Automatically aliased by IDE
slashingprotectioncmd "github.com/prysm/cmd/validator/slashing-protection"
slashingprotection "github.com/prysm/validator/slashing-protection"
)
"github.com/urfave/cli/v2" | ||
) | ||
|
||
const ( | ||
jsonExportFileName = "slashing_protection.json" | ||
) | ||
|
||
// ExportSlashingProtectionJSONCli extracts a validator's slashing protection | ||
// Extracts a validator's slashing protection |
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.
The doc should begin with the function's name.
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.
Not if the function is unexported
"github.com/urfave/cli/v2" | ||
) | ||
|
||
// ImportSlashingProtectionCLI reads an input slashing protection EIP-3076 | ||
// Reads an input slashing protection EIP-3076 |
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.
The doc should begin with the function's name.
// We encode the standard slashing protection struct into a JSON format. | ||
// We encode the standard slashing protection struct into a JSON |
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.
Why change this?
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.
global find replace, will fix
This command was [recently renamed](prysmaticlabs/prysm#9873).
* Revert "Update slashing-protection.md" This reverts commit d24630d. * slashing-protection -> slashing-protection-history This name was changed in prysmaticlabs/prysm#9873. csantana1121 updated the docs in #387, but unfortunately they only updated the versioned docs without also updating the master docs, and also incorrectly updated version 2.0.0, which did not have this name change.
This PR changes our messy packaging of slashing protection JSON support from:
to
No logic changes are added in this PR