# Final Report This is my final project update,feeling kinda emotional now looking back at my entire journey. I joined as an permissionless fellow in [epf cohort 6](https://github.com/eth-protocol-fellows/cohort-six) and worked on [eip 7928](https://github.com/eth-protocol-fellows/cohort-six/blob/master/projects/block-level-access-lists-in-reth.md) that is *BAL* during the timeframe. [Block-Level Access Lists](https://eips.ethereum.org/EIPS/eip-7928) aims to store all the state reads ( storage slots ) and writes ( such as nonce, balance, code and storage), during transaction, pre-execution ( system contracts ) and post execution (system contracts and balance changes such as withdrawals etc) which will enable faster verification as well as help in achieving true parallelization instead of optimistic parallelization. ## Reflecting On Final State I am happy to share that the implementation is almost complete.Looking at the results in **hive** and **kurtosis** I feel kind of happy with what I have achieved.Moreover we have [bal-devnet-0](https://github.com/paradigmxyz/reth/tree/bal-devnet-0/crates/chain-state) in reth, which is built on top of our implementation. Roadmap for Block-Level Access List: * **Core structures**: Implementation of core structures like `AccountChanges`,`SlotChanges`,`CodeChange`,`NonceChange`,`BalanceChange`,`StorageChange` in [alloy/eips](https://github.com/alloy-rs/eips/tree/main/crates/eip7928). * **Modification to existing structs**:Adding `BlockAccessList` to BlockBody and `block_access_list_hash` to Header in alloy. * **Tracking transaction level changes**:Adding supporting tracking structures to [revm](https://github.com/Soubhik-10/revm/tree/bal) to track changes per execution through `journal`(opcodes like-sstore,sload,etc). * **Tracking pre and post execution changes**:Tracking pre and post execution changes in [alloy/evm](https://github.com/Rimeeeeee/evm/tree/bal) and build bal after sorting and removing duplicate entries. * **New payload and supporting functions**:Adding new payload like `ExecutionPayloadV4` and methods like `engine_getPayloadV6` and `engine_newPayloadV5` and perform bal matching and validation of computed hash of bal in body against bal hash in header. * **Testing**:Adding transaction level tests in revm,and checking bal building in evm. * **Kurtosis and Hive**:Running kurtosis for local devnet and also running hive. ## My work in implementing BAL * Added some of the core structures in [alloy](https://github.com/Soubhik-10/alloy/commits/bal/?author=Rimeeeeee) like `Code Change`,`Nonce Change`,`Storage Change` and `Balance Change` which later got moved to alloy/eips. * Tested possible edge-cases with respect to `Storage Change` and `Storage Reads` in [revm](https://github.com/Soubhik-10/revm/commits/bal/?author=Rimeeeeee).(Cases like-only read,read and write,only write). * Recorded changes for `Balance Change` via `balance_incr`,`transfer`,`Nonce Change` and `Code Change` during creation as well as implemented the revert change logic. * Track pre execution changes concerning eip-2935 and post-execution changes concerning eip-7002 in [alloy/evm](https://github.com/Soubhik-10/revm/commits/bal/?author=Rimeeeeee).Performing sorting and removing duplication on the final BAL.Handled access list changes from state and changes concerning withdrawals in [current implementation](https://github.com/Rimeeeeee/evm/commits/new-approach4/?author=Rimeeeeee). * Added bal validation checks in `validate_body_against_header`,`validate_amsterdam_block_Access_lists` etc along with respective error types(`InvalidBalMissingAccount`,`InvalidBalExtraAccount` and more) in [reth](https://github.com/Rimeeeeee/reth/commits/bal/?author=Rimeeeeee). * Implemented `ExecutionPayloadV4`,`engine_getPayloadV6` which are similar as `ExecutionPayloadV3` but has extra BAL field and their associative changes. * Refactored and modified the implementation across alloy,reth etc to accomodate [Dragan's changes](https://github.com/bluealloy/revm/tree/rakita/bal),since now we are using his revm branch instead of ours. * Ran kurtosis with reth and besu in EL and lodestar in CL and had [positive results](https://hackmd.io/6wcrsFWwTz6iaLsamxC9DA).Also ran hive. * Added ` debug_getBlockAccessList` rpc endpoint in reth. More PRs for reference: * [The present BAL branch](https://github.com/Rimeeeeee/reth/tree/new-approach3) * [Modification in evm to support BAL branch](https://github.com/Rimeeeeee/evm/tree/new-approach4) The only things we are due with are actually using our implementation for **parellization** and also keeping the changes **consistent** with ever evolving specifications.The parallelization will be taken over by the team internally,however I hope to follow along and have some additions. Some in between changes included shifting our revm implementation to **Dragan's**.His set of changes were less dependent on alloy/evm.He had the setup almost well fitted in [blockchaintest](https://github.com/bluealloy/revm/blob/rakita/bal/bins/revme/src/cmd/blockchaintest.rs).This made my modifications in reth and alloy/evm all the more simple.Initially it included using `BalDatabase` directly for which we needed trait expansion but soon was replaced by BAL in State itself. The project as of now encompasses a successful implementation of `BlockAccessList`,allowing building BAL from block during execution. It can used by the reth team for parallelization I believe. ## Future Of BAL My future goals concerning BAL include keeping the changes upto date as per the evolving eip. At present there is an discussion about inclusion of `gas_used` as a part of it which will enable scheduling the transactions.This is due for inclusion in the current implementation.Will continue looking more deeply into edgecases,the eip has a lot of them.Even though I was careful not to exploit them plus has all amsterdam test passing in hive. One of the future goal also includes implementing some parts of parallelization along with reth team,having some more endpoint(for BadBlock etc). ## Reflecting On BAL Journey I started working on BAL when it was relatively new,from there it has come a long way.Initially my approach was chalking down the area of implementation,deciding upon using inspectors/making changes to opcode levels.For this I made notes,re-read the eip and closely studied the reth codebase.I am fortunate to have mentors who have guided me throughout.I tried to closely navigate the possible loopholes and tried to make sure that we have least of them.I tried to keep the work upto date with the evolving specs. Ran kurtosis and hive which I had no experience in prior to cohort and had lot of fun collaborating with fellow friend.I tried to keep the idea of `BAL in Reth` alive throughout the time period(still will). I am happy what results our implementation has as of now.We managed to get all tests passing in hive and ran multiclient kurtosis till **27 epochs** and got positive results.Also my work for BAL to be `bal-devnet-0` branch for reth is huge for me :) ![G4bJ6bIWIAAPb40](https://hackmd.io/_uploads/S1nIEUXg-g.png) ## Reflecting On Cohort Journey When I started cohort 6, I had no idea one day I will be presenting at Devconnect. It was an pleasant experience getting to know the fellows who are doing amazing works.I tried to follow the office hours(directly/youtube) and they were very much insightful. Whenever I had some blockers I reached out to my mentors,eip author or EF team,they were always there to guide me.Even though sometimes my questions were stupid. To be really honest I got to learn a lot of new things which I have never done before and it was so much fun. Whenever I discovered a new approach in fixing something,or felt something might cause an error I always reached out to my mentor or BAL discord.Now having the BAL implementation ready gives me a sense of achievement. ## Thank You Note I will be doomed if I donot express how thankful I am to everyone who guided me through the entire cohort.Starting with **Josh** and **Mario** who helped me with every technical/non-technical stuff. My fellow friend **Soubhik** who implemented the eip along with me,with whom I formulated and worked it out.**Nerolation** who helped me whenever I reached out to him.The **EF team** for them helping me with the testing part of it.**Dragan Rakita** his constant support and inputs.And finally **Matthias Seitz** who was always there with his support and guidance at every possible time. To whom I must have asked endless questions and still got very patiently answered. It would not be possible without him.Thanks a lot for suggesting me to take this project up.And finally a big shoutout to the **reth team** for their constant support. I remained consistent in my effort of having a successful implementation for BAL in Reth.And this made me try a bunch of things- some which were successful ,some which failed pretty badly. It is great to see how far it came since I started.If one thing I will hold on to is keeping our work upto date with the evolving specs. Signing out of this cohort (as the little weird lady I am) with a lot of wonderful learning and experiences to hold onto for the rest of my life :)