-
Notifications
You must be signed in to change notification settings - Fork 231
chore: fix function name in comment #2273
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
chore: fix function name in comment #2273
Conversation
Signed-off-by: tsinghuacoder <[email protected]>
📝 WalkthroughWalkthroughThe changes update comments in the Changes
Suggested labels
Suggested reviewers
Poem
Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments (2)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Thanks for your review! |
36b5160
into
NibiruChain:ud/geth/v1.13.15
…LE_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]>
* 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]> * 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. * refactor: use importas linter for consistent imports * refactor: use importas linter for consistent imports * refactor: sdkmath import alias * linter fixes * 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: Unique-Divine <[email protected]> Co-authored-by: Tomass <[email protected]> Co-authored-by: tsinghuacoder <[email protected]> Co-authored-by: Dmitry <[email protected]>
Purpose / Abstract
fix function name in comment