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

core/types: ensure receipts EncodeIndex writes + support blobtx-receipts #27470

Merged
merged 3 commits into from Jun 15, 2023

Conversation

holiman
Copy link
Contributor

@holiman holiman commented Jun 14, 2023

This PR fixes an issue which can happen on blob-tx-testnets, where we try to encode the receipt of a blob-transaction, but ends up writing nothing: which is "deletion" as far as the stacktrie is concerned, causing panic.

This PR does two things:

  • Always write type first, thereby making sure that even unsupported things cause a write of at least one byte,
  • Add support for blob receipts.

As for the second bullet, a different way of doing it would be to do what the transactions already does

	if tx.Type() == LegacyTxType {
		rlp.Encode(w, tx.inner)
	} else {
		tx.encodeTyped(w)
	}
}

func (tx *Transaction) encodeTyped(w *bytes.Buffer) error {
	w.WriteByte(tx.Type())
	return rlp.Encode(w, tx.inner)
}

Simply write type ... rlp(data) for typed data. That way we wouldn't have to bother with "adding support for type x", it would just work.

I don't know which is best, I currently left it as is.

@fjl fjl merged commit 9cf9fae into ethereum:master Jun 15, 2023
2 checks passed
@fjl fjl added this to the 1.12.1 milestone Jun 15, 2023
MoonShiesty pushed a commit to MoonShiesty/go-ethereum that referenced this pull request Aug 30, 2023
@holiman holiman deleted the fix_deriveshablobs branch October 11, 2023 07:27
devopsbo3 pushed a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 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
Development

Successfully merging this pull request may close these issues.

None yet

3 participants