Skip to content

Commit b554a9d

Browse files
Unique-Divinezeroproofftsinghuacoderk-yangmdqst
authored
feat(evm)!: update to geth v1.14 with new tracers, EIP-1153, PRECOMPILE_ADDRS, and transient storage support (#2274)
* feat(evm)!: squashed commit commit aaf6431 Author: Unique-Divine <[email protected]> Date: Mon Apr 14 10:25:36 2025 -0500 refactor: linter and formatter commit f36399c Author: Unique-Divine <[email protected]> Date: Mon Apr 14 10:07:42 2025 -0500 chore: changelog commit f6bb649 Author: Unique-Divine <[email protected]> Date: Mon Apr 14 10:07:42 2025 -0500 chore: changelog commit a6877ee Author: Unique-Divine <[email protected]> Date: Mon Apr 14 10:06:45 2025 -0500 chore: move Go to v1.22 because it's required for geth commit a1e74e9 Author: Unique-Divine <[email protected]> Date: Mon Apr 14 10:06:45 2025 -0500 chore: move Go to v1.22 because it's required for geth commit b546151 Author: Unique-Divine <[email protected]> Date: Mon Apr 14 10:04:56 2025 -0500 feat(evm)!: update to geth v1.13 with EIP-1153, PRECOMPILE_ADDRS, and transient storage support This commit upgrades the Nibiru EVM module for compatibility with go-ethereum v1.13.14, introducing the following changes: - Updated all references from deprecated types in `rpc` to their new equivalents under `common/math`, such as replacing `rpc.DecimalOrHex` with `math.HexOrDecimal64`. - Removed deprecated EIP-155 seed hash API (`debug_seedHash`) and associated `ethash` import. - Aligned `vm.Config` and fee calculation logic with new EIP-based gas cost parameters (`isShanghai`, `isEIP3860`). - Introduced explicit `PRECOMPILE_ADDRS` constant to aggregate EVM precompiles with NibiruΓÇÖs extensions (FunToken, Wasm, Oracle). - Implemented support for **EIP-1153** (transient storage): - Added `transientStorage` map to `StateDB`, with getters/setters and journaling support. - Added `Prepare` method to reset access lists and transient storage for each tx. - Refactored `SelfDestruct` logic and exposed `HasSelfDestructed` (was `Suicide`) for better clarity and future EIP-6780 readiness. - Reworked balance mutation logic (`AddBalanceSigned`) to correctly handle signed values and prevent `uint256` overflow errors. - Minor typo corrections (e.g., "occured" ΓåÆ "occurred") in proto files and comments. This upgrade also adjusts `go.mod` to: - Replace `go-ethereum v1.10.x` with `v1.13.14` - Downgrade Go version to 1.21 for compatibility with `go-ethereum` and its Pebble dependency - Pin Pebble to a compatible commit required by geth's internal `ethdb` commit 803f9b4 Author: Unique-Divine <[email protected]> Date: Mon Apr 14 10:04:56 2025 -0500 feat(evm)!: update to geth v1.13 with EIP-1153, PRECOMPILE_ADDRS, and transient storage support This commit upgrades the Nibiru EVM module for compatibility with go-ethereum v1.13.14, introducing the following changes: - Updated all references from deprecated types in `rpc` to their new equivalents under `common/math`, such as replacing `rpc.DecimalOrHex` with `math.HexOrDecimal64`. - Removed deprecated EIP-155 seed hash API (`debug_seedHash`) and associated `ethash` import. - Aligned `vm.Config` and fee calculation logic with new EIP-based gas cost parameters (`isShanghai`, `isEIP3860`). - Introduced explicit `PRECOMPILE_ADDRS` constant to aggregate EVM precompiles with NibiruΓÇÖs extensions (FunToken, Wasm, Oracle). - Implemented support for **EIP-1153** (transient storage): - Added `transientStorage` map to `StateDB`, with getters/setters and journaling support. - Added `Prepare` method to reset access lists and transient storage for each tx. - Refactored `SelfDestruct` logic and exposed `HasSelfDestructed` (was `Suicide`) for better clarity and future EIP-6780 readiness. - Reworked balance mutation logic (`AddBalanceSigned`) to correctly handle signed values and prevent `uint256` overflow errors. - Minor typo corrections (e.g., "occured" ΓåÆ "occurred") in proto files and comments. This upgrade also adjusts `go.mod` to: - Replace `go-ethereum v1.10.x` with `v1.13.14` - Downgrade Go version to 1.21 for compatibility with `go-ethereum` and its Pebble dependency - Pin Pebble to a compatible commit required by geth's internal `ethdb` commit 1834a61 Author: Unique-Divine <[email protected]> Date: Sat Apr 12 19:51:44 2025 -0500 feat(evm): Adapt module to Geth v1.13 core package changes This commit updates the Nibiru EVM module to align with significant breaking changes introduced in the upstream go-ethereum v1.13 `core/vm` and `core/types` packages. The goal is to leverage the updated Geth dependencies while ensuring compatibility with Nibiru's specific requirements, particularly its custom precompiles that interact with the Cosmos SDK. This addresses several LSP errors and runtime issues arising from removed or modified upstream functions and interfaces: 1. **Replace `core.NewMessage` Calls:** - The `core.NewMessage` factory function was removed upstream in favor of direct struct instantiation. - All instances have been replaced with `core.Message{...}` struct literals, correctly mapping arguments to fields like `From`, `To`, `Nonce`, `Value`, `GasLimit`, gas price fields (`GasPrice`, `GasFeeCap`, `GasTipCap`), `Data`, `AccessList`. - Monetary and gas values are initialized as `*big.Int` per the `core.Message` definition. - Newer fields relevant to Cancun/EIP-4844 (`BlobGasFeeCap`, `BlobHashes`) and Nibiru-specific fields (`SkipAccountChecks`) are now correctly initialized. 2. **Revert `vm.PrecompiledContract` Interface for Nibiru Precompiles:** - Geth v1.13 simplified the `PrecompiledContract.Run` signature to `Run(input []byte)`. - This change breaks Nibiru's custom precompiles (e.g., Wasm) which require the `*vm.EVM` pointer to access `StateDB` and derive the `sdk.Context` needed for Cosmos SDK keeper interactions. - This commit *reverts* the interface definition within Nibiru's fork back to `Run(evm *vm.EVM, contract *vm.Contract, readonly bool)`. - The `Address() common.Address` method is also restored to the interface and implementations for use by the execution logic. - Standard precompile implementations included in this module have been adapted to match this reverted interface signature. - The `vm.RunPrecompiledContract` helper function is updated to pass the necessary `*vm.EVM`, `*vm.Contract`, and `readonly` context. 3. **Adopt `uint256` for VM Value/Balance Interactions:** - While `core.Message` retains `*big.Int`, the internal VM logic and `StateDB` methods (e.g., `vm.Call`, `vm.Create`, `AddBalance`, `SubBalance`, `Contract.value`) were updated upstream to use `*uint256.Int` (from `holiman/uint256`). - Code passing values into these VM contexts has been updated to perform the necessary `*big.Int` -> `*uint256.Int` conversions. - Added `holiman/uint256` as a direct dependency in `go.mod`. 4. **Replace `StateDB.PrepareAccessList`:** - The `PrepareAccessList` method was removed from the `vm.StateDB` interface upstream. - Calls have been replaced with the new, more comprehensive `StateDB.Prepare(rules, sender, ...)` method. 5. **Replace `evm.ActivePrecompiles` Method:** - The `ActivePrecompiles` method on the `vm.EVM` struct was removed. - Calls have been replaced with the standalone package function `vm.ActivePrecompiles(rules)`, passing the appropriate chain rules. These changes resolve the identified compatibility errors and ensure the EVM module integrates correctly with both the updated Geth core components and Nibiru's specific architecture and custom precompiles. commit af71ded Author: Unique-Divine <[email protected]> Date: Sat Apr 12 19:51:44 2025 -0500 feat(evm): Adapt module to Geth v1.13 core package changes This commit updates the Nibiru EVM module to align with significant breaking changes introduced in the upstream go-ethereum v1.13 `core/vm` and `core/types` packages. The goal is to leverage the updated Geth dependencies while ensuring compatibility with Nibiru's specific requirements, particularly its custom precompiles that interact with the Cosmos SDK. This addresses several LSP errors and runtime issues arising from removed or modified upstream functions and interfaces: 1. **Replace `core.NewMessage` Calls:** - The `core.NewMessage` factory function was removed upstream in favor of direct struct instantiation. - All instances have been replaced with `core.Message{...}` struct literals, correctly mapping arguments to fields like `From`, `To`, `Nonce`, `Value`, `GasLimit`, gas price fields (`GasPrice`, `GasFeeCap`, `GasTipCap`), `Data`, `AccessList`. - Monetary and gas values are initialized as `*big.Int` per the `core.Message` definition. - Newer fields relevant to Cancun/EIP-4844 (`BlobGasFeeCap`, `BlobHashes`) and Nibiru-specific fields (`SkipAccountChecks`) are now correctly initialized. 2. **Revert `vm.PrecompiledContract` Interface for Nibiru Precompiles:** - Geth v1.13 simplified the `PrecompiledContract.Run` signature to `Run(input []byte)`. - This change breaks Nibiru's custom precompiles (e.g., Wasm) which require the `*vm.EVM` pointer to access `StateDB` and derive the `sdk.Context` needed for Cosmos SDK keeper interactions. - This commit *reverts* the interface definition within Nibiru's fork back to `Run(evm *vm.EVM, contract *vm.Contract, readonly bool)`. - The `Address() common.Address` method is also restored to the interface and implementations for use by the execution logic. - Standard precompile implementations included in this module have been adapted to match this reverted interface signature. - The `vm.RunPrecompiledContract` helper function is updated to pass the necessary `*vm.EVM`, `*vm.Contract`, and `readonly` context. 3. **Adopt `uint256` for VM Value/Balance Interactions:** - While `core.Message` retains `*big.Int`, the internal VM logic and `StateDB` methods (e.g., `vm.Call`, `vm.Create`, `AddBalance`, `SubBalance`, `Contract.value`) were updated upstream to use `*uint256.Int` (from `holiman/uint256`). - Code passing values into these VM contexts has been updated to perform the necessary `*big.Int` -> `*uint256.Int` conversions. - Added `holiman/uint256` as a direct dependency in `go.mod`. 4. **Replace `StateDB.PrepareAccessList`:** - The `PrepareAccessList` method was removed from the `vm.StateDB` interface upstream. - Calls have been replaced with the new, more comprehensive `StateDB.Prepare(rules, sender, ...)` method. 5. **Replace `evm.ActivePrecompiles` Method:** - The `ActivePrecompiles` method on the `vm.EVM` struct was removed. - Calls have been replaced with the standalone package function `vm.ActivePrecompiles(rules)`, passing the appropriate chain rules. These changes resolve the identified compatibility errors and ensure the EVM module integrates correctly with both the updated Geth core components and Nibiru's specific architecture and custom precompiles. commit 6370b96 Author: Unique-Divine <[email protected]> Date: Sat Apr 12 10:38:30 2025 -0500 fix(evm): Pass block timestamp to MakeSigner and refactor MsgEthereumTx field usage - Update all calls to `gethcore.MakeSigner` to include the block time as a Unix timestamp (seconds), using `evm.ParseBlockTimeUnixU64(ctx)`. - Add `ParseBlockTimeUnixU64` utility to extract block time from `sdk.Context` in a safe, reusable way. - Refactor usage of MsgEthereumTx field getters to use direct struct fields (`From`, `To`, `Value`, `GasFeeCap`, etc.), improving efficiency and clarity. - Enhance `ParseWeiAsMultipleOfMicronibi` to return `uint256.Int` and handle nil, zero, negative, and overflow edge cases with clear error messages. commit 0fad842 Author: Unique-Divine <[email protected]> Date: Sat Apr 12 10:38:30 2025 -0500 fix(evm): Pass block timestamp to MakeSigner and refactor MsgEthereumTx field usage - Update all calls to `gethcore.MakeSigner` to include the block time as a Unix timestamp (seconds), using `evm.ParseBlockTimeUnixU64(ctx)`. - Add `ParseBlockTimeUnixU64` utility to extract block time from `sdk.Context` in a safe, reusable way. - Refactor usage of MsgEthereumTx field getters to use direct struct fields (`From`, `To`, `Value`, `GasFeeCap`, etc.), improving efficiency and clarity. - Enhance `ParseWeiAsMultipleOfMicronibi` to return `uint256.Int` and handle nil, zero, negative, and overflow edge cases with clear error messages. commit 1002634 Author: Unique-Divine <[email protected]> Date: Sat Apr 12 03:21:08 2025 -0500 refactor(evm): add more compatibility the new geth StateDB inteface, updating AddBalance and SubBalance to use uint256 commit d69a8c3 Author: Unique-Divine <[email protected]> Date: Sat Apr 12 03:21:08 2025 -0500 refactor(evm): add more compatibility the new geth StateDB inteface, updating AddBalance and SubBalance to use uint256 commit d07093c Author: Unique-Divine <[email protected]> Date: Fri Apr 11 21:18:53 2025 -0500 feat: impl slog.Handler for geth v1.13. used in json-rpc These changes update Nibiru's integration with the `go-ethereum/log` package to align with its upstream migration to Go's standard structured logging library (`slog`). The previous logging setup in Nibiru, which relied on `go-ethereum/log`'s deprecated `FuncHandler` and `Record` types, was removed. 1. **Added `LogHandler`:** A new file `app/server/geth_log_handler.go` introduces the `LogHandler` type. This type implements the standard `slog.Handler` interface. Its primary role is to receive log records generated by Geth components (which now use `slog`) and translate them into corresponding calls on Nibiru's standard `cmtlog.Logger` (CometBFT logger). It correctly maps Geth/`slog` levels (including `Trace` and `Crit`) and formats log attributes for compatibility. 2. **Updated Initialization:** In `app/server/json_rpc.go`, the old `ethlog.Root().SetHandler(...)` block was replaced. The code now instantiates the new `LogHandler` (providing it the context logger `ctx.Logger.With("module", "geth")`), wraps it using `gethlog.NewLogger()`, and sets the result as the default logger for `go-ethereum` components via `gethlog.SetDefault()`. The primary reason for this refactor was the breaking change in the `go-ethereum/log` dependency, which deprecated its custom logging implementation in favor of Go's standard `slog`. These changes adapt Nibiru to the new `slog`-based API, ensuring that logs generated within embedded Geth components are correctly captured and processed by Nibiru's existing logging infrastructure (`cmtlog.Logger`). This maintains consistent logging behavior and compatibility with the updated dependency. commit 5937bbe Author: Unique-Divine <[email protected]> Date: Fri Apr 11 21:18:53 2025 -0500 feat: impl slog.Handler for geth v1.13. used in json-rpc These changes update Nibiru's integration with the `go-ethereum/log` package to align with its upstream migration to Go's standard structured logging library (`slog`). The previous logging setup in Nibiru, which relied on `go-ethereum/log`'s deprecated `FuncHandler` and `Record` types, was removed. 1. **Added `LogHandler`:** A new file `app/server/geth_log_handler.go` introduces the `LogHandler` type. This type implements the standard `slog.Handler` interface. Its primary role is to receive log records generated by Geth components (which now use `slog`) and translate them into corresponding calls on Nibiru's standard `cmtlog.Logger` (CometBFT logger). It correctly maps Geth/`slog` levels (including `Trace` and `Crit`) and formats log attributes for compatibility. 2. **Updated Initialization:** In `app/server/json_rpc.go`, the old `ethlog.Root().SetHandler(...)` block was replaced. The code now instantiates the new `LogHandler` (providing it the context logger `ctx.Logger.With("module", "geth")`), wraps it using `gethlog.NewLogger()`, and sets the result as the default logger for `go-ethereum` components via `gethlog.SetDefault()`. The primary reason for this refactor was the breaking change in the `go-ethereum/log` dependency, which deprecated its custom logging implementation in favor of Go's standard `slog`. These changes adapt Nibiru to the new `slog`-based API, ensuring that logs generated within embedded Geth components are correctly captured and processed by Nibiru's existing logging infrastructure (`cmtlog.Logger`). This maintains consistent logging behavior and compatibility with the updated dependency. commit ca3c821 Author: Unique-Divine <[email protected]> Date: Fri Apr 11 19:03:04 2025 -0500 wip!: start with a local brute force jump to a geth v1.13.15 with no changes commit 10010d6 Author: Unique-Divine <[email protected]> Date: Fri Apr 11 19:03:04 2025 -0500 wip!: start with a local brute force jump to a geth v1.13.15 with no changes * feat(evm)!: Update to geth v1.14 with newer pebble and Go 1.24 (#2275) This upgrade bumps Nibiru's Geth dependency from v1.13 to v1.14.13 and updates the Go version to 1.24 across the codebase and CI workflows. The upgrade is motivated by the need to support modern database backends (e.g., Cockroach Pebble), leverage recent Go generics improvements, and remain aligned with upstream changes in the Geth EVM architecture. Key changes: - Refactored EVM backend logic to use Geth's new `core.Block` constructor signature, which requires `core.Body`, `Receipts`, and `TrieHasher` explicitly. - Migrated `TraceTransaction`, `TraceCall`, and `TraceBlock` methods to return `json.RawMessage` as required by Geth's new trace API interfaces. - Replaced `go-ethereum/log` with the new `log/slog` stdlib implementation, per Geth v1.14’s logging changes. - Introduced `SuccessfulTx` struct in EVM tests to simplify managing and reusing stateful block hashes and numbers across assertions. - Updated all Dockerfile and CI workflows to Go 1.24 to ensure compatibility. - Disabled the `revive` linter’s `exported` rule for smoother CI linting. Compatibility notes: - Nibiru remains on the Berlin hard fork to avoid breaking changes from Ethereum’s blob transactions (Cancun) and Verkle tree requirements that are not applicable to Nibiru’s consensus and storage design. - Geth v1.14 is the last compatible version before Cancun-related features become mandatory. BREAKING CHANGE: Trace API return types and internal block construction logic have changed to comply with Geth v1.14. Any downstream tools or integrations depending on older behaviors may need to be updated. * refactor: self-review changes * fix(evm-precompile): get new delegate call behavior using the sender arg * refactor: more self-review * refactor(evm): VerifyFee MUST use the same gethparams.Rules as the EVM * docs: remove consecutive duplicate words (#2285) * Update LEGACY-CHANGELOG.md * Update HACKING.md * chore: fix function name in comment (#2273) Signed-off-by: tsinghuacoder <[email protected]> Co-authored-by: Kevin Yang <[email protected]> * chore: fix typo in RewardBand description (#2234) Co-authored-by: Unique Divine <[email protected]> * Update CHANGELOG.md * fix(eth-rpc): error propagation fixes and tests for the methods exposed by Nibiru's EVM JSON-RPC (#2289) * test(rpcapi): prevent more regressions with runtime service inspection * fix(backend): fix error propagation * fix(eth): error propagation fixes and tests for the methods exposed by Nibiru's EVM JSON-RPC Replace legacy error aliases throughout the eth module with sdkioerrors.Wrapf and sdkerrors.Err* to ensure consistent wrapping of Cosmos SDK errors. Simplify EVM backend error reporting by using fmt.Errorf with clear method prefixes (e.g. “BlockNumberError”, “RPCBlockFromTendermintBlock error”) and defaulting the base fee to evm.BASE_FEE_WEI. Suppress pruning‑related bloom errors by returning empty blooms when data is missing. Unify RPC transaction conversion logic by renaming NewRPCTxFromMsg to NewRPCTxFromMsgEthTx, retiring the older NewRPCTxFromEthTx, and centralizing signer and signature‑value extraction. Refactor BackendSuite tests to use a SuccessfulTx map for structured receipt capture—eliminating global variables and improving setup clarity. Stub out unimplemented debugapi methods with context‑aware signatures and adjust filters, tracing, and utils to inline BlockBloom usage and align imports (e.g. eip1559, tracers) with modern patterns. * chore: changelog PR number --------- Signed-off-by: tsinghuacoder <[email protected]> Co-authored-by: Tomass <[email protected]> Co-authored-by: tsinghuacoder <[email protected]> Co-authored-by: Kevin Yang <[email protected]> Co-authored-by: Dmitry <[email protected]>
1 parent fea4936 commit b554a9d

File tree

93 files changed

+3310
-1309
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+3310
-1309
lines changed

.github/workflows/e2e-wasm.yml

Lines changed: 0 additions & 55 deletions
This file was deleted.

.golangci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ issues:
1111
linters:
1212
enable:
1313
- whitespace
14-
- misspell
1514
- goimports
1615
linters-settings:
1716
misspell:
@@ -20,5 +19,9 @@ linters-settings:
2019
# Put imports beginning with prefix after 3rd-party packages.
2120
# It's a comma-separated list of prefixes.
2221
local-prefixes: github.com/NibiruChain/nibiru
22+
revive:
23+
rules:
24+
- name: exported
25+
disabled: true
2326
severity:
2427
default-severity: error

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4242

4343
- [#2271](https://github.com/NibiruChain/nibiru/pull/2271) - fix(ci): update tag-pattern for changelog step in releases
4444
- [#2270](https://github.com/NibiruChain/nibiru/pull/2270) - refactor(app): remove private keeper struct and transient/mem keys from app
45+
- [#2274](https://github.com/NibiruChain/nibiru/pull/2274) - feat(evm)!: update to geth v1.13 with EIP-1153, PRECOMPILE_ADDRS, and transient storage support
46+
- [#2275](https://github.com/NibiruChain/nibiru/pull/2275) - feat(evm)!: update
47+
to geth v1.14 with tracing updates and new StateDB methods.
48+
- This upgrade keeps Nibiru's EVM on the Berlin upgrade to avoid
49+
incompatibilities stemming from functionality specific to Ethereum's consesnus
50+
setup. Namely, blobs (Cancun) and Verkle additions for zkEVM.
51+
- The jump to v1.14 was necessary to use an up-to-date "cockroach/pebble" DB
52+
dependency and leverage new generics features added in Go 1.23+.
53+
- [#2289](https://github.com/NibiruChain/nibiru/pull/2289) - fix(eth-rpc): error propagation fixes and tests for the methods exposed by Nibiru's EVM JSON-RPC
4554
- [#2288](https://github.com/NibiruChain/nibiru/pull/2288) - chore(ci): add workflow to check for missing upgrade handler
4655
- [#2278](https://github.com/NibiruChain/nibiru/pull/2278) - chore: migrate to cosmossdk.io/mathLegacyDec and cosmossdk.io/math.Int
4756
- [#2293](https://github.com/NibiruChain/nibiru/pull/2293) - ci(release): pack nibid binary with no enclosing directory

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,4 @@ RUN apk --no-cache add ca-certificates
7474
COPY --from=build-source /root/nibid /usr/local/bin/nibid
7575

7676
ENTRYPOINT ["nibid"]
77-
CMD ["start"]
77+
CMD ["start"]

LEGACY-CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ NOTE: It's pragmatic to assume that any change prior to v1.0.0 was state machine
216216
- [#1459](https://github.com/NibiruChain/nibiru/pull/1459) - fix(spot): wire `x/spot` msgService into app router
217217
- [#1452](https://github.com/NibiruChain/nibiru/pull/1452) - fix(oracle): continue with abci hook during error
218218
- [#1451](https://github.com/NibiruChain/nibiru/pull/1451) - fix(perp): decrease position with zero size
219-
- [#1446](https://github.com/NibiruChain/nibiru/pull/1446) - fix(cmd): Add custom InitCmd to set set desired Tendermint consensus params for each node.
219+
- [#1446](https://github.com/NibiruChain/nibiru/pull/1446) - fix(cmd): Add custom InitCmd to set desired Tendermint consensus params for each node.
220220
- [#1441](https://github.com/NibiruChain/nibiru/pull/1441) - fix(oracle): ignore abstain votes in std dev calculation
221221
- [#1425](https://github.com/NibiruChain/nibiru/pull/1425) - fix: remove positions from state when closed with reverse position
222222
- [#1423](https://github.com/NibiruChain/nibiru/pull/1423) - fix: remove panics from abci hooks

api/nibiru/sudo/v1/event.pulsar.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/evmante/evmante_can_transfer.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ func (ctd CanTransferDecorator) AnteHandle(
2525
ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler,
2626
) (sdk.Context, error) {
2727
ethCfg := evm.EthereumConfig(ctd.EVMKeeper.EthChainID(ctx))
28-
signer := gethcore.MakeSigner(ethCfg, big.NewInt(ctx.BlockHeight()))
28+
signer := gethcore.MakeSigner(
29+
ethCfg,
30+
big.NewInt(ctx.BlockHeight()),
31+
evm.ParseBlockTimeUnixU64(ctx),
32+
)
2933

3034
for _, msg := range tx.GetMsgs() {
3135
msgEthTx, ok := msg.(*evm.MsgEthereumTx)
@@ -57,25 +61,25 @@ func (ctd CanTransferDecorator) AnteHandle(
5761
return ctx, errors.Wrapf(
5862
sdkerrors.ErrInsufficientFee,
5963
"gas fee cap (wei) less than block base fee (wei); (%s < %s)",
60-
evmMsg.GasFeeCap(), baseFeeWeiPerGas,
64+
evmMsg.GasFeeCap, baseFeeWeiPerGas,
6165
)
6266
}
6367

6468
// check that caller has enough balance to cover asset transfer for **topmost** call
6569
// NOTE: here the gas consumed is from the context with the infinite gas meter
6670

67-
if evmMsg.Value().Sign() > 0 {
68-
nibiruAddr := eth.EthAddrToNibiruAddr(evmMsg.From())
71+
if evmMsg.Value.Sign() > 0 {
72+
nibiruAddr := eth.EthAddrToNibiruAddr(evmMsg.From)
6973
balanceNative := ctd.Bank.GetBalance(ctx, nibiruAddr, evm.EVMBankDenom).Amount.BigInt()
7074
balanceWei := evm.NativeToWei(balanceNative)
7175

72-
if balanceWei.Cmp(evmMsg.Value()) < 0 {
76+
if balanceWei.Cmp(evmMsg.Value) < 0 {
7377
return ctx, errors.Wrapf(
7478
sdkerrors.ErrInsufficientFunds,
7579
"failed to transfer %s wei ( balance=%s )from address %s using the EVM block context transfer function",
76-
evmMsg.Value(),
80+
evmMsg.Value,
7781
balanceWei,
78-
evmMsg.From(),
82+
evmMsg.From,
7983
)
8084
}
8185
}

app/evmante/evmante_gas_consume.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func (anteDec AnteDecEthGasConsume) AnteHandle(
100100
fees, err := keeper.VerifyFee(
101101
txData,
102102
baseFeeMicronibiPerGas,
103-
ctx.IsCheckTx(),
103+
ctx,
104104
)
105105
if err != nil {
106106
return ctx, errors.Wrapf(err, "failed to verify the fees")

app/evmante/evmante_gas_consume_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func (s *TestSuite) TestAnteDecEthGasConsume() {
2626
beforeTxSetup: func(deps *evmtest.TestDeps, sdb *statedb.StateDB) {
2727
gasLimit := happyGasLimit()
2828
balance := evm.NativeToWei(new(big.Int).Add(gasLimit, big.NewInt(100)))
29-
sdb.AddBalance(deps.Sender.EthAddr, balance)
29+
sdb.AddBalanceSigned(deps.Sender.EthAddr, balance)
3030
},
3131
txSetup: evmtest.HappyCreateContractTx,
3232
wantErr: "",
@@ -47,7 +47,7 @@ func (s *TestSuite) TestAnteDecEthGasConsume() {
4747
beforeTxSetup: func(deps *evmtest.TestDeps, sdb *statedb.StateDB) {
4848
gasLimit := happyGasLimit()
4949
balance := evm.NativeToWei(new(big.Int).Add(gasLimit, big.NewInt(100)))
50-
sdb.AddBalance(deps.Sender.EthAddr, balance)
50+
sdb.AddBalanceSigned(deps.Sender.EthAddr, balance)
5151
},
5252
txSetup: evmtest.HappyCreateContractTx,
5353
wantErr: "exceeds block gas limit (0)",

app/evmante/evmante_handler_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func (s *TestSuite) TestAnteHandlerEVM() {
2929
name: "happy: signed tx, sufficient funds",
3030
beforeTxSetup: func(deps *evmtest.TestDeps, sdb *statedb.StateDB) {
3131
balanceMicronibi := new(big.Int).Add(evmtest.GasLimitCreateContract(), big.NewInt(100))
32-
sdb.AddBalance(
32+
sdb.AddBalanceSigned(
3333
deps.Sender.EthAddr,
3434
evm.NativeToWei(balanceMicronibi),
3535
)

0 commit comments

Comments
 (0)