Closed saimeunt closed 2 months ago
@enitrat Thank you for your quick review and your Cairo tips, I made the requested changes by following your best practices insights.
I will apply to #991 as I'd like to continue my work on Kakarot so this is appreciated! 🙌
This PR implements
eth_get_balance
and use it instead of querying the balanceOf function of thenative_token
in the codebase. It also fixes a suspected bug inget_starknet_address
fromKakarotCore
.Pull Request type
Please check the type of change your PR introduces:
What is the current behavior?
The
eth_get_balance
is not implemented and thus we need to query thenative_token
directly in several parts of the codebase.Resolves: #941
What is the new behavior?
The
eth_get_balance
is now implemented and replicates itseth_getBalance
counterpart in the EVM.eth_get_balance
leverages theget_starknet_address
function fromKakarotCore
to get the corresponding starknet address from an evm address. Once we have the underlying starknet address, we query thenative_token
balance. The function has also been added toExtendedKakarotCore
interface.get_starknet_address
, I suspected a bug and from my understanding we should return the registered starknet address only if it is found and thus non-zero, so I think the if condition should be inversed, this is why my PR introduces a bugfix.native_token
querying have been replaced byeth_get_balance
, in particular for theeth_validate_tx
test helper I had to mock additional calls soaccount.get_evm_address
returns the expectedaccount_starknet_address
.eth_get_balance
both for uninitialized and initialized accounts.Does this introduce a breaking change?
This change is