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

Fix the blob encoding type #443

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nazarhussain
Copy link

The blobs returned from the beacon-apis are the raw bytes not encoded into ssz.

Mentioning it as SSZ encoded cause confusion to decode the output from the API e.g. ssz.Blob.decode(api_response) which will not match with the actual blobs.

Some reference:

https://github.com/ChainSafe/lodestar/blob/ae984f0f6079f78c2445f36ae2ac09c9e868197e/packages/types/src/deneb/types.ts#L8

@nazarhussain
Copy link
Author

@g11tech Please take a look at this small change.

Copy link
Contributor

@g11tech g11tech left a comment

Choose a reason for hiding this comment

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

lgtm

@nflaig
Copy link
Collaborator

nflaig commented Apr 15, 2024

Mentioning it as SSZ encoded cause confusion to decode the output from the API e.g. ssz.Blob.decode(api_response) which will not match with the actual blobs.

What exactly are you trying to do? If you wanna decode the raw hex-encoded blob you can do ssz.Blob.fromJson()

@@ -127,7 +127,7 @@ Blob:
type: string
format: hex
pattern: "^0x[a-fA-F0-9]{262144}$"
description: "A blob is `FIELD_ELEMENTS_PER_BLOB * size_of(BLSFieldElement) = 4096 * 32 = 131072` bytes (`DATA`) representing a SSZ-encoded Blob as defined in Deneb"
description: "A blob is `FIELD_ELEMENTS_PER_BLOB * size_of(BLSFieldElement) = 4096 * 32 = 131072` bytes (`DATA`) representing a Blob as defined in Deneb"
Copy link
Collaborator

@nflaig nflaig Apr 15, 2024

Choose a reason for hiding this comment

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

This is the hex encoded value sent over the wire, the blob is serialized using the ByteVector type, maybe we could slightly rephrase it

Edit: I think that "SSZ-encoded" is meant to refer to JSON mapping in the ssz spec, i.e. how the blob should be encoded over the wire in a JSON response.

Copy link
Author

Choose a reason for hiding this comment

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

It's raw bytes which was sent from the sender of EIP4844 transaction. If we considered it SSZ-Serialized, one will try to deserialize to get the actual blob, which is not the case here.

The raw bytes sent in transaction are the exact bytes returned over the API, where this description is been used.

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.

None yet

3 participants