-
Notifications
You must be signed in to change notification settings - Fork 807
Add canoto serialization support to the block context #3709
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
Conversation
ecf54bc
to
5e50cf2
Compare
Co-authored-by: Razvan <36448915+rrazvan1@users.noreply.github.com> Signed-off-by: aaronbuchwald <aaron.buchwald56@gmail.com>
// Because PreForkBlocks and PostForkOptions do not verify their execution | ||
// against the P-chain's state, this context is undefined for those blocks. | ||
PChainHeight uint64 | ||
PChainHeight uint64 `canoto:"fint64,1" json:"pChainHeight"` |
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 don't think this should be a fint64
- I think this should just be an int
. (The PChainHeight
is not going to be > 2^56 for a long time). Even if this was fint32
I think int
is more efficient for the foreseeable future.
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.
Can we add a go:generate
at the top of this 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.
Do we run go generate
during CI to ensure the generated files are up-to-date?
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.
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.
Copied the syntax from the mock generation to regex what go generate
commands to run. I think ideally, we'd have one CI job for proto, mocks, and canoto, but don't think it makes sense to make such a change in this PR.
check_canotogen: | ||
name: Up-to-date canoto | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/setup-go-for-project | ||
- shell: bash | ||
run: go generate -run "github.com/StephenButtolph/canoto/canoto" ./... | ||
- shell: bash | ||
run: .github/workflows/check-clean-branch.sh |
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.
Copied from directly above
Signed-off-by: aaronbuchwald <aaron.buchwald56@gmail.com> Co-authored-by: Razvan <36448915+rrazvan1@users.noreply.github.com>
This PR adds Canoto serialization support for the
block.Context
type, so that downstream consumers that want to serialize it with Canoto can do so easily.