kkrt-labs / kakarot-rpc

Kakarot ZK EVM Ethereum RPC adapter
MIT License
134 stars 89 forks source link

dev: simplify `WithOtherFields<T>` usage #1398

Open tcoratger opened 6 days ago

tcoratger commented 6 days ago

In our codebase, we use the other field of transactions to store isRunOutOfResources information. This leads to extensive usage of WithOtherFields<T> throughout the code after the merge of https://github.com/kkrt-labs/kakarot-rpc/pull/1389, especially when handling conversions between RPC and primitive types, as seen in https://github.com/paradigmxyz/reth/blob/fba837468cac5143b415c9dd4fdc9218d71a926b/crates/primitives/src/alloy_compat.rs#L55-L212.

However, this approach is complex and can be optimized for better readability and management.

Proposal

  1. Simplify where possible: identify and remove unnecessary uses of WithOtherFields<T>, replacing them with just T where the extra fields aren't needed.
  2. Define a reusable type: introduce a type alias such as ExtendedTransaction = WithOtherFields<Transaction> (and similar for blocks) to standardize its usage where necessary.
Samrath49 commented 6 days ago

Hi @tcoratger, I would like to contribute to this issue, kindly assign me.

onlydustapp[bot] commented 6 days ago

Hey @Samrath49! Thanks for showing interest. We've created an application for you to contribute to Kakarot zkEVM. Go check it out on OnlyDust!

tcoratger commented 6 days ago

@Samrath49 Assigned