Skip to content

Commit

Permalink
dev: Precompiles -> Cairo1Helpers (kkrt-labs#1057)
Browse files Browse the repository at this point in the history
<!--- Please provide a general summary of your changes in the title
above -->

<!-- Give an estimate of the time you spent on this PR in terms of work
days.
Did you spend 0.5 days on this PR or rather 2 days?  -->

Time spent on this PR:

## Pull request type

<!-- Please try to limit your pull request to one type,
submit multiple pull requests if needed. -->

Please check the type of change your PR introduces:

- [ ] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, renaming)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] Documentation content changes
- [ ] Other (please describe):

## What is the current behavior?

<!-- Please describe the current behavior that you are modifying,
or link to a relevant issue. -->

Resolves #<Issue number>

## What is the new behavior?

<!-- Please describe the behavior or changes that are being added by
this PR. -->

-
-
-

<!-- Reviewable:start -->
- - -
This change is [<img src="https://reviewable.io/review_button.svg"
height="34" align="absmiddle"
alt="Reviewable"/>](https://reviewable.io/reviews/kkrt-labs/kakarot/1057)
<!-- Reviewable:end -->
  • Loading branch information
enitrat authored Apr 1, 2024
1 parent da76e0e commit e6834d5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion kakarot_scripts/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class ArtifactType(Enum):
{"contract_name": "uninitialized_account", "cairo_version": ArtifactType.cairo0},
{"contract_name": "EVM", "cairo_version": ArtifactType.cairo0},
{"contract_name": "OpenzeppelinAccount", "cairo_version": ArtifactType.cairo0},
{"contract_name": "Precompiles", "cairo_version": ArtifactType.cairo1},
{"contract_name": "Cairo1Helpers", "cairo_version": ArtifactType.cairo1},
{"contract_name": "replace_class", "cairo_version": ArtifactType.cairo0},
]

Expand Down
4 changes: 2 additions & 2 deletions kakarot_scripts/deploy_kakarot.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async def main():
ETH_TOKEN_ADDRESS, # native_token_address_
class_hash["account_contract"], # account_contract_class_hash_
class_hash["uninitialized_account"], # uninitialized_account_class_hash_
class_hash["Precompiles"],
class_hash["Cairo1Helpers"],
BLOCK_GAS_LIMIT,
)

Expand All @@ -68,7 +68,7 @@ async def main():
ETH_TOKEN_ADDRESS, # native_token_address_
class_hash["account_contract"], # account_contract_class_hash_
class_hash["uninitialized_account"], # uninitialized_account_class_hash_
class_hash["Precompiles"],
class_hash["Cairo1Helpers"],
BLOCK_GAS_LIMIT,
)

Expand Down
7 changes: 6 additions & 1 deletion src/kakarot/interfaces/interfaces.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,14 @@ namespace IKakarot {
}

@contract_interface
namespace IPrecompiles {
namespace ICairo1Helpers {
func exec_precompile(address: felt, data_len: felt, data: felt*) -> (
success: felt, gas: felt, return_data_len: felt, return_data: felt*
) {
}

func keccak(
words_len: felt, words: felt*, last_input_word: felt, last_input_num_bytes: felt
) -> (hash: Uint256) {
}
}
4 changes: 2 additions & 2 deletions src/kakarot/precompiles/precompiles.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ from starkware.starknet.common.syscalls import library_call
from starkware.cairo.common.alloc import alloc
from starkware.cairo.common.memcpy import memcpy

from kakarot.interfaces.interfaces import IPrecompiles
from kakarot.interfaces.interfaces import ICairo1Helpers
from kakarot.storages import Kakarot_precompiles_class_hash
from kakarot.errors import Errors
from kakarot.precompiles.blake2f import PrecompileBlake2f
Expand Down Expand Up @@ -130,7 +130,7 @@ namespace Precompiles {
memcpy(calldata + 2, input, input_len);
let (
success, gas, return_data_len, return_data
) = IPrecompiles.library_call_exec_precompile(
) = ICairo1Helpers.library_call_exec_precompile(
class_hash=implementation, address=evm_address, data_len=input_len, data=input
);

Expand Down

0 comments on commit e6834d5

Please sign in to comment.