# Week 1 Updates This week, I started off by building some additional familiarity of reth via a couple FOSS contributions: - [chore: add node synced helper](https://github.com/paradigmxyz/reth/pull/16928) - [chore: add block gas limit to block added log](https://github.com/paradigmxyz/reth/pull/16875) Building small features for the codebase is teaching me the team's preferred coding patterns, which I believe will make it easier to implement my project. ## Project Updates - In my previous [post](https://hackmd.io/@gk32CG_5S26favMLDmI06A/SktO8wIMlx), I dove into the engine api updates that will be required to implement for delayed execution. This week, I investigated [EIP-7886](https://eips.ethereum.org/EIPS/eip-7886)'s EL static validation flow updates as to gain a solid understand about why each aspect is important. ## Static Validations ### Block Header The `pre-*` and `parent-*` attributes in block `N`'s header will refer to the execution results of block `N-1`. The EL will then be responsible to compare those to cached results. ``` validate_header(chain, block.header) # Validate deferred execution outputs from the parent if block.header.parent_transactions_root != chain.last_transactions_root: raise InvalidBlock if block.header.parent_receipt_root != chain.last_receipt_root: raise InvalidBlock if block.header.parent_bloom != chain.last_block_logs_bloom: raise InvalidBlock if block.header.parent_requests_hash != chain.last_requests_hash: raise InvalidBlock if block.header.pre_state_root != state_root(chain.state): raise InvalidBlock if block.header.parent_execution_reverted != chain.last_execution_reverted: raise InvalidBlock ``` These checks ensure the legitimacy of the block header itself. ### Balance and Nonce Checks We loop over the transaction list of block `N` and check whether the transaction senders balance and nonce are adequate. ``` # Verify sender has sufficient balance if sender_balances[sender_address] < max_gas_fee + Uint(tx.value): raise InvalidBlock # Verify correct nonce if sender_nonces[sender_address] != tx.nonce: raise InvalidBlock ``` where `max_gas_fee = tx.gas * effective_gas_price + blob_gas_used * blob_gas_price`. The value of the balance check is that we want to ensure that each transaction's account has enough ETH to cover their tx cost, since it is now possible with [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) to have a smart wallet account `A`'s tx earlier in a block that drains account `B`'s funds before account `B`'s transaction executes during the same block. > Later, during the execution phase, we actually pre-charge the senders these `max_gas_fees` before executing all transactions for the same reason. The static check allows us to invalidate the block earlier. Additionally, this pre-charging mechanism helps our implementation be FOCIL compatible, since we need to be able to determine whether an IL tx has enough funds to be included in the block as a mechanism to prove that it should be included (supposing there is enough gas left in the block for the IL tx). ### Inclusion Gas Checks We check that the inclusion gas of all the transactions (mostly consisting of calldata cost, SC init code cost, base fee, and access list cost) are less than the declared `gasUsed` from the block header ``` if total_inclusion_gas > block.header.gas_used: raise InvalidBlock if total_blob_gas_used != block.header.blob_gas_used: raise InvalidBlock ``` These checks ensure that the proposer doesn't set the `gas_used` by the block lower than the initial costs just to set up the tsx + blobs since that would certainly result in a failed block and waste of resources. ## Week 2 TODOs Next week, I plan to: - Investigate the changes to the EL's execution phase updates per the EIP - Start on the EthCC presentation - Work on the project proposal spec