-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# What Add the SNIP9 entrypoint Todo - [x] decode the tx only once at the beginning - [x] update `accounts.library.validate` to get the signature in argument and not from `tx_info` - [x] block `__validate__` and `__execute__` usage ``` with_attr error_message("EOA: declare not supported") { assert 1 = 0; } return (); ``` - [x] remove recursion in Account.validate and inline Internals.validate - [x] remove useless storage `Account_cairo1_helpers_class_hash` add get class from `Kakarot.get_cairo1_helpers_class_hash()` - [x] add in `Account.validate` the logic from Interpreter.execute (see [here](https://github.com/ClementWalter/kakarot/blob/af697701bd545e1d60991464d15a7880e7ddc687/src/kakarot/interpreter.cairo#L878 )) - [x] fix unit tests - [x] update all python utils to have the relayer send the txs - [x] update [ef-tests](https://github.com/kkrt-labs/ef-tests) / remove Account_cairo1_helpers_class_hash storage / ensure nonce is not increased anymore (see [here](#956 (comment))) Snippet to send a tx with relayer in python ```python #%% Imports import os import random os.environ["STARKNET_NETWORK"] = "katana" from eth_account import Account as EvmAccount from kakarot_scripts.utils.kakarot import * from kakarot_scripts.utils.starknet import * from kakarot_scripts.constants import RPC_CLIENT, NETWORK, DEFAULT_GAS_PRICE from tests.utils.helpers import pack_calldata, rlp_encode_signed_data from tests.utils.uint256 import int_to_uint256 #%% Get accounts relayer = await get_starknet_account() eoa = await get_eoa() # %% Send tx current_timestamp = (await RPC_CLIENT.get_block("latest")).timestamp nonce = await eoa.get_nonce() outside_execution = { "caller": int.from_bytes(b"ANY_CALLER", "big"), "nonce": nonce, "execute_after": current_timestamp - 60 * 60, "execute_before": current_timestamp + 60 * 60, } data_len = 130_000 random.seed(data_len) typed_transaction = TypedTransaction.from_dict({ "type": 0x2, "chainId": NETWORK["chain_id"], "nonce": nonce, "gas": 2_000_000, "maxPriorityFeePerGas": 1, "maxFeePerGas": DEFAULT_GAS_PRICE, "to": None, "value": 0, "data": os.urandom(data_len), }).as_dict() evm_tx = EvmAccount.sign_transaction( typed_transaction, hex(eoa.signer.private_key), ) encoded_unsigned_tx = rlp_encode_signed_data(typed_transaction) packed_encoded_unsigned_tx = pack_calldata(bytes(encoded_unsigned_tx)) response = await get_contract("account_contract", address=eoa.address, provider=relayer).functions["execute_from_outside"].invoke_v1( outside_execution=outside_execution, call_array=[{ "to": 0xDEAD, "selector": 0xDEAD, "data_offset": 0, "data_len": len(packed_encoded_unsigned_tx), }], calldata=list(packed_encoded_unsigned_tx), signature=[ *int_to_uint256(evm_tx.r), *int_to_uint256(evm_tx.s), evm_tx.v, ], max_fee=int(1e18) ) ``` Resolves: #1240 <!-- 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/1246) <!-- Reviewable:end --> --------- Co-authored-by: Oba <[email protected]>
- Loading branch information
1 parent
7d3e00e
commit 47c5ba1
Showing
29 changed files
with
799 additions
and
851 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.