kkrt-labs / kakarot

Kakarot is a zkEVM written in Cairo, leveraging the STARK proof system.
https://kakarot.org
MIT License
965 stars 279 forks source link

dev: group Kakarot entrypoints in dedicated files #1303

Open ClementWalter opened 1 month ago

ClementWalter commented 1 month ago

Why

Currently, the Kakarot contract is one single file with all the entry points.

As the contract gets bigger, it becomes difficult to read and understand what does what.

What

Create several sub contract with meaningful entrypoints

  1. eth
  2. config
  3. messaging
  4. admin

keep in the main kakarot.cairo only the constructor and imports all the functions defined in the other sub contracts (presets)

The simple getter and setter defined in the library.cairo should also be directly inlined in the corresponding entry points

(e.g.

@view
func get_native_token{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}() -> (
    native_token_address: felt
) {
    return Kakarot.get_native_token();
}

should be inlined in Kakarot.get_native_token)

ClementWalter commented 1 week ago

This is partially done (see #1352) we could do the others as well. tbd