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

Re-implement the blob tx parser in a lower-level style #7

Merged
merged 1 commit into from
Jan 18, 2023

Conversation

roberto-bayardo
Copy link
Owner

This implementation is more consistent with the existing parsing code: it avoids instantiating new objects and instead grabs data directly from the payload buffer as needed.

@roberto-bayardo roberto-bayardo marked this pull request as ready for review January 18, 2023 03:29
func (s wrapperKzgSequence) At(i int) eth.KZGCommitment {
kzg := eth.KZGCommitment{}
if i >= s.num {
return kzg
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we return a reference for the function? this way you can return nil and make it easier for caller to distinguish return?

Copy link
Owner Author

Choose a reason for hiding this comment

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

this is part of the interface expected by the eth. library in go-kzg -- it's idiomatic in geth code at least to always pass small fixed length arrays like these by value.

@@ -80,6 +79,28 @@ func NewTxParseContext(chainID uint256.Int) *TxParseContext {
return ctx
}

// recover sender address after appropriately populating ctx.Sighash, ctx.R & ctx.S
func (ctx *TxParseContext) RecoverSender(vByte byte, sender []byte) error {
binary.BigEndian.PutUint64(ctx.Sig[0:8], ctx.R[3])
Copy link
Collaborator

Choose a reason for hiding this comment

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

curious about the general encoding choices, I saw both LittleEndian & BigEndian used, is that right?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Unfortunately yes.. ssz uses the opposite of RLP/legacy encoding.

@roberto-bayardo roberto-bayardo merged commit dfe2614 into eip-4844 Jan 18, 2023
@roberto-bayardo roberto-bayardo deleted the parse-fix branch January 18, 2023 17:59
roberto-bayardo added a commit that referenced this pull request Jan 20, 2023
roberto-bayardo added a commit that referenced this pull request Jan 25, 2023
roberto-bayardo added a commit that referenced this pull request Jan 26, 2023
roberto-bayardo added a commit that referenced this pull request Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants