This repository has been archived by the owner on Jan 8, 2025. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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