Skip to content

Commit

Permalink
clean up PR
Browse files Browse the repository at this point in the history
  • Loading branch information
Unique-Divine committed Dec 6, 2024
1 parent f874263 commit 0102cce
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 17 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Nibiru EVM

- [#2xxx](https://github.com/NibiruChain/nibiru/pull/2xxx) - fix(evm): Guarantee
- [#2119](https://github.com/NibiruChain/nibiru/pull/2119) - fix(evm): Guarantee
that gas consumed during any send operation of the "NibiruBankKeeper" depends
only on the "bankkeeper.BaseKeeper"'s gas consumption.

Expand Down
6 changes: 1 addition & 5 deletions x/evm/keeper/bank_extension_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ import (
"github.com/NibiruChain/nibiru/v2/x/evm/evmtest"
)

// TODO: UD-DEBUG:
// non-nil StaetDB bank send and record gas consumed
// nil StaetDB bank send and record gas consumed
// Both should be equal.

// TestGasConsumedInvariantSend: The "NibiruBankKeeper" is defined such that
// send operations are meant to have consistent gas consumption regardless of the
// whether the active "StateDB" instance is defined or undefined (nil). This is
Expand Down Expand Up @@ -214,6 +209,7 @@ func (f FunctionalGasConsumedInvariantScenario) Run(s *Suite) {
)
}

// See [Suite.TestGasConsumedInvariantSend].
func (s *Suite) TestGasConsumedInvariantOther() {
to := evmtest.NewEthPrivAcc() // arbitrary constant
bankDenom := evm.EVMBankDenom
Expand Down
2 changes: 1 addition & 1 deletion x/evm/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ func (k *Keeper) ApplyEvmMsg(ctx sdk.Context,
)

defer func() {
if commit && err == nil && !resp.Failed() {
if commit && err == nil && resp != nil && !resp.Failed() {
k.Bank.StateDB = stateDB
} else {
k.Bank.StateDB = oldStateDB
Expand Down
10 changes: 0 additions & 10 deletions x/evm/keeper/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,16 +184,6 @@ func (k *Keeper) DeleteAccount(ctx sdk.Context, addr gethcommon.Address) error {
return nil
}

func GaslessOperation(ctx sdk.Context, op func(ctx sdk.Context)) {
gasMeterBeforeOp := ctx.GasMeter()
defer func() {
ctx = ctx.WithGasMeter(gasMeterBeforeOp)
}()

freeGasCtx := ctx.WithGasMeter(sdk.NewGasMeter(gasMeterBeforeOp.Limit()))
op(freeGasCtx)
}

// GetAccountWithoutBalance load nonce and codehash without balance,
// more efficient in cases where balance is not needed.
func (k *Keeper) GetAccountWithoutBalance(ctx sdk.Context, addr gethcommon.Address) *statedb.Account {
Expand Down

0 comments on commit 0102cce

Please sign in to comment.