Skip to content

docs: snow package #2035

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

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

docs: snow package #2035

wants to merge 13 commits into from

Conversation

Elvis339
Copy link
Contributor

@Elvis339 Elvis339 commented Apr 24, 2025

Closes: #2011

Having doc.go file to describe the whole package lacks examples and context instead I have decided to add documentation to each exported function which is already enforced by the revive lint rule.

Test

Run godoc -http 8080 and navigate to http://localhost:8080/pkg/github.com/ava-labs/hypersdk/snow/

@Elvis339 Elvis339 self-assigned this Apr 24, 2025
@Elvis339 Elvis339 requested a review from aaronbuchwald as a code owner April 24, 2025 16:51
// alternative block handler functions that provide the snowman.Block type to the
// consensus engine.
//
//nolint:revive
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Without this directive we're getting:

snow/snow_vm.go:23:6: exported: type name will be used as snow.SnowVM by other packages, and that is repetitive; consider calling this VM (revive)
type SnowVM[I Block, O Block, A Block] struct {
     ^
1 issues:

Copy link
Contributor

@tsachiherman tsachiherman left a comment

Choose a reason for hiding this comment

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

one comment seems to be incorrect. the rest are good.

@Elvis339 Elvis339 requested a review from tsachiherman April 24, 2025 20:21
snow/vm.go Outdated
func (v *VM[I, O, A]) GetNetwork() *p2p.Network {
return v.network
}

// AddAcceptedSub adds subscriotions tracking accepted blocks
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// AddAcceptedSub adds subscriotions tracking accepted blocks
// AddAcceptedSub adds subscriptions that track accepted blocks

func (v *VM[I, O, A]) GetInputCovariantVM() *InputCovariantVM[I, O, A] {
return &InputCovariantVM[I, O, A]{vm: v}
}

// GetNetwork returns *p2p.Network
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we change this? Saying that GetNetwork() returns *p2p.Network is repetitive (we already know this from the function signature).

Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment for GetInputCovariantVM()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How would you change it? I tried to override revivew lint rule to omit functions starting with Get and Set but couldn't find a way without forking it.

@Elvis339
Copy link
Contributor Author

Elvis339 commented Apr 25, 2025

@RodrigoVillar

I'm using Grazie Pro plugin to help me with spelling and grammar. Grazie Pro reports the same for each proposed update in comments on the PR.

Screenshot 2025-04-25 at 4 43 39 PM

English is not my native language. Personally I think it's unnecessary and plugin seems to agree but if you really think it should be added than I will update documentation.

@Elvis339 Elvis339 requested a review from RodrigoVillar April 25, 2025 12:56
Copy link
Contributor

@tsachiherman tsachiherman left a comment

Choose a reason for hiding this comment

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

thanks for the changes

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.

4 participants