Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(precompile-funtoken.go): Fixes a bug where the err != nil check is missing in the bankBalance precompile method #2116

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@

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

Check warning on line 121 in x/evm/precompile/funtoken.go

View check run for this annotation

Codecov / codecov/patch

x/evm/precompile/funtoken.go#L121

Added line #L121 was not covered by tests
return
}

Expand Down Expand Up @@ -376,6 +377,10 @@
}

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

Check warning on line 383 in x/evm/precompile/funtoken.go

View check run for this annotation

Codecov / codecov/patch

x/evm/precompile/funtoken.go#L381-L383

Added lines #L381 - L383 were not covered by tests
bankBal := p.evmKeeper.Bank.GetBalance(ctx, addrBech32, bankDenom).Amount.BigInt()

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

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

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