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

SizeSSZ panic when struct has nil pointer #1

Closed
prestonvanloon opened this issue Mar 18, 2020 · 1 comment
Closed

SizeSSZ panic when struct has nil pointer #1

prestonvanloon opened this issue Mar 18, 2020 · 1 comment

Comments

@prestonvanloon
Copy link
Contributor

Cannot Marshal / SizeSSZ when a struct has a nil pointer.

For example, if BeaconBlock.Body is nil, this will panic.

// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlock object
func (b *BeaconBlock) SizeSSZ() (size int) {
        size = 76

        // Field (3) 'Body'
        size += b.Body.SizeSSZ()

        return
}

Using commit f7a73f0

@prestonvanloon
Copy link
Contributor Author

Branch safe-check-nil-structs has a fix for this.

letonchanh pushed a commit to letonchanh/fastssz that referenced this issue Mar 28, 2024
Support for ByteList (aka List(byte, N), as well as List[ByteList, N]
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

No branches or pull requests

2 participants