risechain / pevm

Blazingly fast Parallel EVM
MIT License
217 stars 41 forks source link

Why is read_origins `Vec` in `ReadSet`? #264

Closed jackwener closed 1 month ago

jackwener commented 1 month ago

I think MemoryLocation just can be read once in a Tx.

So

ReadSet = HashMap<MemoryLocationHash, ReadOrigin, BuildIdentityHasher>;

is enough.

I also run test mainnet, read_origins len always is 1.

Is there something I didn't consider? @hai-rise

hai-rise commented 1 month ago

It used to be a single ReadOrigin until we added lazy updates, which would store a chain of transactions that lazy updated the memory location until we hit a "strict"/"absolute" origin. This should happen for blocks with an explicit read on the beneficiary balance (like the validator spends ETH in their block), or blocks with many raw ETH transfers that we lazy update the senders and recipients.

I had a talk about pevm recently at Paradigm Frontiers with intuitive examples: https://www.youtube.com/live/1xQTHCjcWVk?si=YNGOc9zvqjMR5hCP&t=11794

Will write detailed doc on lazy updates and all our changes to the original Block-STM designs soon 🙏.

jackwener commented 1 month ago

Thank you! I get it.