Skip to content

Commit

Permalink
feat: bump kakarot (#723)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eikix authored Jan 22, 2024
1 parent 125a1f2 commit 7416750
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/kakarot
Submodule kakarot updated 67 files
+3 −0 .env.example
+1 −0 .github/workflows/ci.yml
+3 −22 .gitignore
+1 −0 .trunk/.gitignore
+13 −13 .trunk/trunk.yaml
+40 −6 README.md
+616 −5,658 blockchain-tests-skip.yml
+1,941 −2,047 poetry.lock
+6 −2 pyproject.toml
+5 −4 scripts/utils/kakarot.py
+6 −9 src/backend/starknet.cairo
+58 −55 src/kakarot/account.cairo
+13 −4 src/kakarot/accounts/eoa/library.cairo
+8 −8 src/kakarot/evm.cairo
+61 −9 src/kakarot/gas.cairo
+1 −1 src/kakarot/instructions/block_information.cairo
+9 −16 src/kakarot/instructions/environmental_information.cairo
+21 −3 src/kakarot/instructions/memory_operations.cairo
+352 −136 src/kakarot/instructions/system_operations.cairo
+4 −4 src/kakarot/interfaces/interfaces.cairo
+11 −7 src/kakarot/interpreter.cairo
+22 −10 src/kakarot/kakarot.cairo
+8 −7 src/kakarot/library.cairo
+5 −4 src/kakarot/model.cairo
+5 −5 src/kakarot/precompiles/precompiles.cairo
+18 −19 src/kakarot/precompiles/ripemd160.cairo
+38 −33 src/kakarot/state.cairo
+0 −2 src/utils/dict.cairo
+19 −36 src/utils/eth_transaction.cairo
+2 −20 src/utils/rlp.cairo
+1 −1 tests/conftest.py
+1 −1 tests/end_to_end/PlainOpcodes/test_plain_opcodes.py
+1 −1 tests/end_to_end/bytecodes.py
+18 −8 tests/end_to_end/test_kakarot.py
+25 −10 tests/fixtures/EVM.cairo
+112 −8 tests/fixtures/starknet.py
+3 −2 tests/integration/accounts/test_contract_account.py
+4 −3 tests/src/kakarot/accounts/eoa/mock_kakarot.cairo
+3 −2 tests/src/kakarot/precompiles/test_precompiles.cairo
+10 −5 tests/src/kakarot/precompiles/test_ripemd160.py
+15 −9 tests/src/kakarot/test_account.cairo
+63 −10 tests/src/kakarot/test_gas.cairo
+85 −20 tests/src/kakarot/test_gas.py
+14 −27 tests/src/kakarot/test_memory.cairo
+13 −23 tests/src/kakarot/test_memory.py
+8 −33 tests/src/kakarot/test_stack.cairo
+14 −30 tests/src/kakarot/test_stack.py
+47 −20 tests/src/kakarot/test_state.cairo
+12 −8 tests/src/kakarot/test_state.py
+47 −27 tests/src/utils/test_array.cairo
+14 −35 tests/src/utils/test_array.py
+63 −60 tests/src/utils/test_bytes.cairo
+25 −56 tests/src/utils/test_bytes.py
+2 −9 tests/src/utils/test_dict.cairo
+10 −25 tests/src/utils/test_dict.py
+63 −21 tests/src/utils/test_eth_transaction.cairo
+40 −55 tests/src/utils/test_eth_transaction.py
+22 −7 tests/src/utils/test_rlp.cairo
+6 −23 tests/src/utils/test_rlp.py
+18 −9 tests/src/utils/test_uint256.cairo
+3 −19 tests/src/utils/test_uint256.py
+33 −56 tests/src/utils/test_utils.cairo
+52 −23 tests/src/utils/test_utils.py
+278 −0 tests/utils/coverage.py
+6 −4 tests/utils/helpers.cairo
+1 −1 tests/utils/helpers.py
+62 −28 tests/utils/reporting.py
6 changes: 3 additions & 3 deletions src/contracts/erc20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use starknet_abigen_parser::cairo_types::CairoArrayLegacy;
use starknet_crypto::FieldElement;

use crate::contracts::kakarot_contract::KakarotCoreReader;
use crate::contracts::kakarot_contract::Uint256 as CairoUint256;
use crate::models::block::EthBlockId;
use crate::models::felt::Felt252Wrapper;
use crate::starknet_client::constants::TX_ORIGIN_ZERO;
Expand Down Expand Up @@ -54,15 +55,14 @@ impl<P: Provider + Send + Sync> EthereumErc20<P> {

let gas_limit = felt!("0x100000");
let gas_price = felt!("0x1");
let value = FieldElement::ZERO;

let (_, return_data, success) = kakarot_reader
let (_, return_data, success, _) = kakarot_reader
.eth_call(
&origin.into(),
&self.address,
&gas_limit,
&gas_price,
&value,
&CairoUint256 { low: FieldElement::ZERO, high: FieldElement::ZERO },
&calldata.len().into(),
&CairoArrayLegacy(calldata),
)
Expand Down
18 changes: 15 additions & 3 deletions src/starknet_client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ use self::errors::EthApiError;
use self::helpers::{prepare_kakarot_eth_send_transaction, split_u256, try_from_u8_iterator};
use crate::contracts::erc20::EthereumErc20;
use crate::contracts::kakarot_contract::KakarotContract;
use crate::contracts::kakarot_contract::Uint256 as KakarotUint256;
use crate::models::balance::{FutureTokenBalance, TokenBalances};
use crate::models::block::{BlockWithTxHashes, BlockWithTxs, EthBlockId};
use crate::models::errors::ConversionError;
Expand Down Expand Up @@ -113,7 +114,10 @@ impl<P: Provider + Send + Sync> KakarotClient<P> {

let gas_price = into_via_try_wrapper!(request.gas_price.unwrap_or_default());

let value = into_via_try_wrapper!(request.value.unwrap_or_default());
let value = {
let value = request.value.unwrap_or_default();
split_u256::<FieldElement>(value)
};

debug!("origin: {:?}", origin);
debug!("to: {:?}", to);
Expand All @@ -122,10 +126,18 @@ impl<P: Provider + Send + Sync> KakarotClient<P> {
debug!("value: {:?}", value);
debug!("calldata: {:?}", calldata);

let (_, return_data, success) = self
let (_, return_data, success, _gas_used) = self
.kakarot_contract
.reader
.eth_call(&origin, &to, &gas_limit, &gas_price, &value, &calldata.len().into(), &CairoArrayLegacy(calldata))
.eth_call(
&origin,
&to,
&gas_limit,
&gas_price,
&KakarotUint256 { low: value[0], high: value[1] },
&calldata.len().into(),
&CairoArrayLegacy(calldata),
)
.block_id(starknet_block_id)
.call()
.await?;
Expand Down

0 comments on commit 7416750

Please sign in to comment.