Closed ClementWalter closed 1 month ago
Hello, can I attempt this one?
Hey @FriendlyLifeguard! Thanks for showing interest. We've created an application for you to contribute to Kakarot zkEVM. Go check it out on OnlyDust!
Do we want to push it for mainnet ? As there is discussion for migration for cairo1, do we want to add this entrypoint now ?
Pseudo implementation:
In kakarot.cairo
:
// @notice The eth_getTransactionCount function as described in the spec
// see https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionCount
// This is a view only function, meaning that it doesn't make any state change.
// @param evm_address The address to get the transaction count from
// @return Transaction count of the address
@view
func eth_get_transaction_count{
syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr, bitwise_ptr: BitwiseBuiltin*
}(evm_address) -> (tx_count: felt) {
Helpers.assert_view_call();
let tx_count = Kakarot.fetch_tx_count(evm_address);
return (tx_count=tx_count);
}
In library.cairo
// @notice Fetches the transaction count of an account
// @param evm_address The address of the account
// @return The transaction count
func fetch_tx_count{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}(
evm_address: felt
) -> felt {
let starknet_address = Account.get_starknet_address(evm_address);
let (tx_count) = IAccount.get_nonce(contract_address=starknet_address);
return tx_count;
}
Interface needs to be updated
Note: RPC needs to take into consideration potential pending transaction and add one to the result if needed
Feature Request
Describe the Feature Request
As per the RPC spec, an entrypoint to retrieve the nonce of an account