Skip to content

Commit

Permalink
fix(precompile-funtoken.go): Fixes a bug where the err != nil check i…
Browse files Browse the repository at this point in the history
…s missing in the bankBalance precompile method (#2116)
  • Loading branch information
Unique-Divine authored Nov 26, 2024
1 parent b61c103 commit 7d91c5a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ tests for race conditions within funtoken precompile
- [#2101](https://github.com/NibiruChain/nibiru/pull/2101) - fix(evm): tx receipt proper marshalling
- [#2105](https://github.com/NibiruChain/nibiru/pull/2105) - test(evm): precompile call with revert
- [#2106](https://github.com/NibiruChain/nibiru/pull/2106) - chore: scheduled basic e2e tests for evm testnet endpoint
- [#2107](https://github.com/NibiruChain/nibiru/pull/2107) -
feat(evm-funtoken-precompile): Implement methods: balance, bankBalance, whoAmI
- [#2107](https://github.com/NibiruChain/nibiru/pull/2107) - feat(evm-funtoken-precompile): Implement methods: balance, bankBalance, whoAmI
- [#2108](https://github.com/NibiruChain/nibiru/pull/2108) - fix(evm): removed deprecated root key from eth_getTransactionReceipt
- [#2110](https://github.com/NibiruChain/nibiru/pull/2110) - fix(evm): Restore StateDB to its state prior to ApplyEvmMsg call to ensure deterministic gas usage. This fixes an issue where the StateDB pointer field in NibiruBankKeeper was being updated during readonly query endpoints like eth_estimateGas, leading to non-deterministic gas usage in subsequent transactions.
- [#2111](https://github.com/NibiruChain/nibiru/pull/2111) - fix: e2e-evm-cron.yml
- [#2114](https://github.com/NibiruChain/nibiru/pull/2114) - fix(evm): make gas cost zero in conditional bank keeper flow
- [#2116](https://github.com/NibiruChain/nibiru/pull/2116) - fix(precompile-funtoken.go): Fixes a bug where the err != nil check is missing in the bankBalance precompile method

#### Nibiru EVM | Before Audit 1 - 2024-10-18

Expand Down
3 changes: 3 additions & 0 deletions evm-e2e/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ test-basic:
# Format
fmt:
npm run format

gen-types:
npx hardhat typechain
8 changes: 7 additions & 1 deletion x/evm/precompile/funtoken.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ func (p precompileFunToken) sendToBank(

erc20, amount, to, err := p.parseArgsSendToBank(args)
if err != nil {
err = ErrInvalidArgs(err)
return
}

Expand Down Expand Up @@ -376,6 +377,10 @@ func (p precompileFunToken) bankBalance(
}

addrEth, addrBech32, bankDenom, err := p.parseArgsBankBalance(args)
if err != nil {
err = ErrInvalidArgs(err)
return
}
bankBal := p.evmKeeper.Bank.GetBalance(ctx, addrBech32, bankDenom).Amount.BigInt()

return method.Outputs.Pack([]any{
Expand Down Expand Up @@ -455,7 +460,8 @@ func (p precompileFunToken) whoAmI(

addrEth, addrBech32, err := p.parseArgsWhoAmI(args)
if err != nil {
return bz, err
err = ErrInvalidArgs(err)
return
}

return method.Outputs.Pack([]any{
Expand Down

0 comments on commit 7d91c5a

Please sign in to comment.