-
Notifications
You must be signed in to change notification settings - Fork 232
feat(evm)!: update to geth v1.14 with new tracers, EIP-1153, PRECOMPILE_ADDRS, and transient storage support #2274
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
Changes from 4 commits
00e77d1
197e353
7c52ee3
d496db3
86111b9
3d1c685
1ab808b
b12c04b
1a39fef
2d82c81
36b5160
6f4821a
d4233c8
a27954c
7b0e334
912899b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The "misspell" linter was in conflict with the use of British English in imports from go-ethereum. It kept renaming |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,6 +42,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |
|
|
||
| - [#2271](https://github.com/NibiruChain/nibiru/pull/2271) - fix(ci): update tag-pattern for changelog step in releases | ||
| - [#2270](https://github.com/NibiruChain/nibiru/pull/2270) - refactor(app): remove private keeper struct and transient/mem keys from app | ||
| - [#2274](https://github.com/NibiruChain/nibiru/pull/2274) - feat(evm)!: update to geth v1.13 with EIP-1153, PRECOMPILE_ADDRS, and transient storage support | ||
| - [#2275](https://github.com/NibiruChain/nibiru/pull/2275) - feat(evm)!: update | ||
| to geth v1.14 with tracing updates and new StateDB methods. | ||
|
||
| - This upgrade keeps Nibiru's EVM on the Berlin upgrade to avoid | ||
| incompatibilities stemming from functionality specific to Ethereum's consesnus | ||
| setup. Namely, blobs (Cancun) and Verkle additions for zkEVM. | ||
| - The jump to v1.14 was necessary to use an up-to-date "cockroach/pebble" DB | ||
| dependency and leverage new generics features added in Go 1.23+. | ||
|
|
||
| ## v2.3.0 | ||
|
|
||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,109 @@ | ||||||||||||||||||||||||||||||||||||||||||||
| package server | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| import ( | ||||||||||||||||||||||||||||||||||||||||||||
| // Use "log/slog" from the Go std lib because Geth migrated to support | ||||||||||||||||||||||||||||||||||||||||||||
| // slog and deprecated the original go-ethereum/log implementation. | ||||||||||||||||||||||||||||||||||||||||||||
| // For more info on the migration, see https://github.com/ethereum/go-ethereum/pull/28187 | ||||||||||||||||||||||||||||||||||||||||||||
| "context" | ||||||||||||||||||||||||||||||||||||||||||||
| "log/slog" | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| cmtlog "github.com/cometbft/cometbft/libs/log" | ||||||||||||||||||||||||||||||||||||||||||||
| gethlog "github.com/ethereum/go-ethereum/log" | ||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+10
to
+12
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion
Once the switch statement stops referencing -import (
- …
- gethlog "github.com/ethereum/go-ethereum/log"
-)
+import (
+ …
+)📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| // Ensure LogHandler implements slog.Handler | ||||||||||||||||||||||||||||||||||||||||||||
| var _ slog.Handler = (*LogHandler)(nil) | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| // LogHandler implements slog.Handler, which is needed to construct the | ||||||||||||||||||||||||||||||||||||||||||||
| // conventional go-ethereum.Logger, using a CometBFT logger | ||||||||||||||||||||||||||||||||||||||||||||
| // ("github.com/cometbft/cometbft/libs/log".Logger). | ||||||||||||||||||||||||||||||||||||||||||||
| type LogHandler struct { | ||||||||||||||||||||||||||||||||||||||||||||
| CmtLogger cmtlog.Logger | ||||||||||||||||||||||||||||||||||||||||||||
| attrs []slog.Attr // Attributes gathered via WithAttrs | ||||||||||||||||||||||||||||||||||||||||||||
| group string // Group name gathered via WithGroup (simple implementation) | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| // Enabled decides whether a log record should be processed. | ||||||||||||||||||||||||||||||||||||||||||||
| // We let the underlying CometBFT logger handle filtering. | ||||||||||||||||||||||||||||||||||||||||||||
| func (h *LogHandler) Enabled(_ context.Context, level slog.Level) bool { | ||||||||||||||||||||||||||||||||||||||||||||
| // You could potentially check the CmtLogger's level here if needed, | ||||||||||||||||||||||||||||||||||||||||||||
| // but returning true is usually sufficient. | ||||||||||||||||||||||||||||||||||||||||||||
| return true | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| // Handle processes the log record and sends it to the CometBFT logger. | ||||||||||||||||||||||||||||||||||||||||||||
| func (h *LogHandler) Handle(_ context.Context, r slog.Record) error { | ||||||||||||||||||||||||||||||||||||||||||||
| // 1. Determine the corresponding CometBFT log function | ||||||||||||||||||||||||||||||||||||||||||||
| var logFunc func(msg string, keyvals ...interface{}) | ||||||||||||||||||||||||||||||||||||||||||||
| switch r.Level { | ||||||||||||||||||||||||||||||||||||||||||||
| // Check against Geth's custom levels first if they exist | ||||||||||||||||||||||||||||||||||||||||||||
| // This handler covers all defined slog and go-ethereum log levels. | ||||||||||||||||||||||||||||||||||||||||||||
| case gethlog.LevelTrace, slog.LevelDebug: // Handles -8, -4 | ||||||||||||||||||||||||||||||||||||||||||||
| logFunc = h.CmtLogger.Debug | ||||||||||||||||||||||||||||||||||||||||||||
| case slog.LevelInfo, slog.LevelWarn: // Handles 0, 4 | ||||||||||||||||||||||||||||||||||||||||||||
| logFunc = h.CmtLogger.Info | ||||||||||||||||||||||||||||||||||||||||||||
| case gethlog.LevelCrit, slog.LevelError: // Handles 12, 8 | ||||||||||||||||||||||||||||||||||||||||||||
| // Map Geth Crit level along with standard Error | ||||||||||||||||||||||||||||||||||||||||||||
| logFunc = h.CmtLogger.Error | ||||||||||||||||||||||||||||||||||||||||||||
| default: // Handle any other levels (e.g., below Debug) | ||||||||||||||||||||||||||||||||||||||||||||
| logFunc = h.CmtLogger.Debug // Default to Debug or Info as appropriate | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+38
to
+50
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Compile‑time type mismatch between
A simple fix is to map purely on - switch r.Level {
- case gethlog.LevelTrace, slog.LevelDebug: // Handles -8, -4
- logFunc = h.CmtLogger.Debug
- case slog.LevelInfo, slog.LevelWarn: // Handles 0, 4
- logFunc = h.CmtLogger.Info
- case gethlog.LevelCrit, slog.LevelError: // Handles 12, 8
- logFunc = h.CmtLogger.Error
- default:
- logFunc = h.CmtLogger.Debug
- }
+ switch {
+ case r.Level < slog.LevelInfo: // Debug & anything more verbose
+ logFunc = h.CmtLogger.Debug
+ case r.Level < slog.LevelError: // Info & Warn
+ logFunc = h.CmtLogger.Info
+ default: // Error and above
+ logFunc = h.CmtLogger.Error
+ }This removes the cross‑package constant dependency, compiles cleanly, and still preserves the intended level mapping. 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| // 2. Collect attributes (key-value pairs) | ||||||||||||||||||||||||||||||||||||||||||||
| // Preallocate assuming 2 slots per attribute plus handler attrs | ||||||||||||||||||||||||||||||||||||||||||||
| keyvals := make([]interface{}, 0, (r.NumAttrs()+len(h.attrs))*2) | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| // Add attributes stored in the handler first (from WithAttrs) | ||||||||||||||||||||||||||||||||||||||||||||
| currentGroup := h.group | ||||||||||||||||||||||||||||||||||||||||||||
| for _, attr := range h.attrs { | ||||||||||||||||||||||||||||||||||||||||||||
| key := attr.Key | ||||||||||||||||||||||||||||||||||||||||||||
| if currentGroup != "" { | ||||||||||||||||||||||||||||||||||||||||||||
| key = currentGroup + "." + key // Basic grouping | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| keyvals = append(keyvals, key, attr.Value.Any()) | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| // Add attributes from the specific log record | ||||||||||||||||||||||||||||||||||||||||||||
| r.Attrs(func(attr slog.Attr) bool { | ||||||||||||||||||||||||||||||||||||||||||||
| key := attr.Key | ||||||||||||||||||||||||||||||||||||||||||||
| if currentGroup != "" { | ||||||||||||||||||||||||||||||||||||||||||||
| key = currentGroup + "." + key // Basic grouping | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| keyvals = append(keyvals, key, attr.Value.Any()) | ||||||||||||||||||||||||||||||||||||||||||||
| return true // Continue iterating | ||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| // 3. Call the CometBFT logger function | ||||||||||||||||||||||||||||||||||||||||||||
| logFunc(r.Message, keyvals...) | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| return nil // No error to return in this basic implementation | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| // WithAttrs returns a new LogHandler with the provided attributes added. | ||||||||||||||||||||||||||||||||||||||||||||
| func (h *LogHandler) WithAttrs(attrs []slog.Attr) slog.Handler { | ||||||||||||||||||||||||||||||||||||||||||||
| // Create a new handler, cloning existing state and adding new attrs | ||||||||||||||||||||||||||||||||||||||||||||
| newHandler := &LogHandler{ | ||||||||||||||||||||||||||||||||||||||||||||
| CmtLogger: h.CmtLogger, // Keep the same underlying logger | ||||||||||||||||||||||||||||||||||||||||||||
| // Important: Clone slices to avoid modifying the original handler's state | ||||||||||||||||||||||||||||||||||||||||||||
| attrs: append(append([]slog.Attr{}, h.attrs...), attrs...), | ||||||||||||||||||||||||||||||||||||||||||||
| group: h.group, | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| return newHandler | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| // WithGroup returns a new LogHandler associated with the specified group. | ||||||||||||||||||||||||||||||||||||||||||||
| func (h *LogHandler) WithGroup(name string) slog.Handler { | ||||||||||||||||||||||||||||||||||||||||||||
| // Create a new handler, cloning attributes and setting/appending the group | ||||||||||||||||||||||||||||||||||||||||||||
| newHandler := &LogHandler{ | ||||||||||||||||||||||||||||||||||||||||||||
| CmtLogger: h.CmtLogger, | ||||||||||||||||||||||||||||||||||||||||||||
| attrs: append([]slog.Attr{}, h.attrs...), // Clone attributes | ||||||||||||||||||||||||||||||||||||||||||||
| // Basic implementation: Overwrites group. Could concatenate if nesting needed. | ||||||||||||||||||||||||||||||||||||||||||||
| group: name, | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| // If nested groups are needed: | ||||||||||||||||||||||||||||||||||||||||||||
| // if h.group != "" { | ||||||||||||||||||||||||||||||||||||||||||||
| // name = h.group + "." + name | ||||||||||||||||||||||||||||||||||||||||||||
| // } | ||||||||||||||||||||||||||||||||||||||||||||
| // newHandler.group = name | ||||||||||||||||||||||||||||||||||||||||||||
| return newHandler | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it was outdated and not adding much value at all