REVM Source Code - Execution Flow Part 2
Validate The previous article mentioned that the handler has five major steps. Validate is step one. In this article, we'll analyze it in detail and understand what it's responsible for. // crates/...

Source: DEV Community
Validate The previous article mentioned that the handler has five major steps. Validate is step one. In this article, we'll analyze it in detail and understand what it's responsible for. // crates/handler/src/handler.rs #[inline] fn validate(&self, evm: &mut Self::Evm) -> Result<InitialAndFloorGas, Self::Error> { self.validate_env(evm)?; self.validate_initial_tx_gas(evm) } From the function and internal function call names, we can see that Validate is mainly responsible for two parts: validate_env: Validate the environment. validate_initial_tx_gas: Validate the initial gas for the transaction. validate_env Let's first analyze validate_env — jump in: // crates/handler/src/handler.rs #[inline] fn validate_env(&self, evm: &mut Self::Evm) -> Result<(), Self::Error> { validation::validate_env(evm.ctx()) } Nothing useful — just a function call. Continue jumping: // crates/handler/src/validation.rs pub fn validate_env<CTX: ContextTr, ERROR: From<Invalid