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

Use ethereum encoding where applicable for state #1529

Open
eyusufatik opened this issue Nov 27, 2024 · 0 comments
Open

Use ethereum encoding where applicable for state #1529

eyusufatik opened this issue Nov 27, 2024 · 0 comments
Milestone

Comments

@eyusufatik
Copy link
Member

eyusufatik commented Nov 27, 2024

In #1518 we saw that with updates from external dependencies, bincode serialization on things we commit to the state sometimes change, enforcing us to implement weird workarounds.

I am going to admit that we were in the wrong by not implementing such a system for everything we write to state / accessory state:

  • No encoding raw bytes StateValue / StateVec / StateMap
  • Using existing ethereum encoding (e.g. RLP) after reading from such State*

For example, the serialization of header structure in alloy::consensus changes, and it will change, because it's not something you should commit to. It's for RPC implementations...

However, the encode/decode function of the header on the other hand, won't ever change, and always has to be backwards compatible. Because no one will go back and change what's committed in Ethereum. Those encode / decode functions abide by Ethereum spec.

If we were to implement such a thing, we wouldn't worry about updating reth or alloy, because we would always pull the encoded bytes from state and decode in to the new versions struct. (BTW we can have a "CustomCodec" which calls a trait function of a type, which we hook to these encode/decode functions. BUT WE CAN'T IMPLEMENT TRAITS FOR EXTERNAL DEPENDENCIES SO A LITTLE BIT OF UGLIER CODE AND HANDLING ENCODING FOR STATE* MANUALLY EVERYWHERE IS FINE)

This will be very very very hard to implement on testnet probably, however, we can do it right before mainnet, and worry about updating the testnet later.

@eyusufatik eyusufatik added this to the Mainnet Must milestone Nov 27, 2024
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

1 participant