risechain / pevm

Blazingly fast Parallel EVM
MIT License
173 stars 17 forks source link

refactor: add chain as a parameter to functions calculate_receipt_root and get_block_spec #205

Closed kien-rise closed 2 months ago

kien-rise commented 2 months ago

One step towards https://github.com/risechain/pevm/issues/60

1. Adding parameter chain: Chain

chain: Chain has been added as a parameter to get_block_spec, calculate_receipt_root. Although the parameter might be unused for now, it will be used soon once we support other chains (e.g. Optimism Mainnet, Ethereum Sepolia).

2. Extract fn encode_receipt_2718

Another notable change of this PR is to extract encode_receipt_2718 to a standalone function. By doing so, we can support other chains conveniently:

fn encode_receipt_2718(chain: Chain, tx_type: u8, tx_result: &PevmTxExecutionResult) {
  #[cfg(feature = "optimism")]
  if chain.is_optimism() && tx_type == 126 {
    return { ... }
  }

  ... // handler for Mainnet
}
kien-rise commented 2 months ago

moved to https://github.com/risechain/pevm/pull/206