internet-computer-protocol / evm-rpc-canister

Interact with EVM blockchains from the Internet Computer.
https://internetcomputer.org/docs/current/developer-docs/multi-chain/ethereum/evm-rpc/overview
Apache License 2.0
63 stars 13 forks source link

refactor: Remove dependency on `ic-cketh-minter` #275

Closed gregorydemay closed 1 month ago

gregorydemay commented 1 month ago

Remove the dependency on the ic-cketh-minter.

This includes copying over the various files needed, while keeping refactoring at a minimum to somewhat try to ease the review. Additional refactoring will take place in follow-up PRs.

Overview of copied file

Source: ic-cketh-minter Target: PR
src/checked_amount.rs src/rpc_client/checked_amount/mod.rs
src/checked_amount/tests.rs src/rpc_client/checked_amount/tests.rs
src/eth_rpc.rs src/rpc_client/eth_rpc/mod.rs
src/eth_rpc/tests.rs src/rpc_client/eth_rpc/tests.rs
src/eth_rpc_error/mod.rs src/rpc_client/eth_rpc_error/mod.rs
src/eth_rpc_error/tests.rs src/rpc_client/eth_rpc_error/tests.rs
src/eth_rpc_client/mod.rs src/rpc_client/mod.rs
src/numeric/mod.rs src/rpc_client/numeric/mod.rs
src/numeric/tests.rs src/rpc_client/numeric/tests.rs
src/eth_rpc_client/providers.rs src/rpc_client/providers.rs
src/eth_rpc_client/requests.rs src/rpc_client/requests.rs
src/eth_rpc_client/responses.rs src/rpc_client/responses.rs
src/eth_rpc_client/tests.rs src/rpc_client/tests.rs

Noticeable changes:

  1. Remove anything related to minicbor, excepted for the HTTPs transform (cleanup_response), where the type of transform to use is encoded via minicbor.
  2. Remove CandidType for all types used in JSON requests or responses. Those types are implementation details and should not be exposed outside of this canister.
  3. Logging is currently disabled and will be the subject of a future PR (#276).
  4. Copied metrics in src/rpc_client/eth_rpc/mod.rs is currently dead code and will be removed in a future PR (#277).

Noticeable Added Dependencies:

The goal is that none of the productive code depends on the IC repository and is the main driver for this PR. 2 temporary exceptions were added, which are crates with a very self-contain scoped:

  1. ic-crypto-sha3: a wrapper around sha3. This crate will be published on crates.io
  2. ic-ethereum-types: a crate for common Etheurem types (e.g. Address). This crate will be published on crates.io.
rvanasa commented 1 month ago

Thank you so much for taking this on! I pushed a commit to fix merge conflicts. This should be good to merge so we can build on top of these changes in parallel.