Commit c611bb3
authored
feat(nibiru): Move to geth v1.13 (#7)
* Sync to exact code state of go-ethereum v1.13.15 to see what breaks in Nibiru
* docs: function documentation for signer constructor
* Sync all files with upstream v1.13.15
* Pull in changes from 06312f9
* feat(vm): Restore EVM context in PrecompiledContract interface
Upstream go-ethereum v1.13 refactored the PrecompiledContract interface,
removing the `*vm.EVM`, `*vm.Contract`, and `readonly bool` parameters
from the `Run` method signature (`Run(input []byte)`). The `Address()`
method was also removed from the precompile structs, and the
`RunPrecompiledContract` helper function was updated accordingly.
While this simplifies the interface for standard EVM precompiles, Nibiru
Chain utilizes custom precompiles (e.g., for Wasm contract interaction)
that require access to the underlying Cosmos SDK state and keepers. This
access is facilitated by deriving an `sdk.Context` from the `vm.EVM`'s
`StateDB`.
This commit reverts these specific interface and implementation changes
to maintain compatibility with Nibiru's custom precompiles:
- Restored the `Run(*EVM, *Contract, bool)` signature to the
`vm.PrecompiledContract` interface.
- Added the `Address() common.Address` method back to the interface.
- Re-implemented the `Address()` method for all standard precompile structs.
- Reverted the `vm.RunPrecompiledContract` helper function to accept the
EVM, caller, value, and readonly context and pass it to the precompile's
`Run` method, including logic to construct the necessary `Contract` object.
- Updated the standard precompile implementations (`ecrecover`, `sha256hash`,
`ripemd160hash`, `dataCopy`, `bigModExp`, `bn256*`, `blake2F`, `bls*`,
`kzgPointEvaluation`) to match the reverted `Run` signature, allowing them
to compile and function alongside custom precompiles expecting the older interface.
- Updated EVM call methods (`Call`, `CallCode`, `DelegateCall`, `StaticCall`)
to use the reverted `RunPrecompiledContract` signature.
- Updated relevant tests and fuzzers to align with the reverted signatures.
This change allows Nibiru's precompiles to continue accessing the required
Cosmos SDK context via the `vm.EVM` object provided during execution.
* feat(common): add back Hash function
* fix(sorting): This commit removes usage of
`golang.org/x/exp/slices.SortFunc` throughout the codebase and replaces
it with equivalent calls to `sort.Slice` from the Go standard library.
This change improves build stability across Go versions and ensures
compatibility with the project’s explicitly declared `go 1.20`
toolchain.
- `slices.SortFunc` relies on generic type inference and comparator
functions returning `int`, which introduces inconsistencies and build
failures under newer Go versions (e.g., 1.21+), especially when
function signatures drift or implicit type inference fails.
- `sort.Slice` is stable, well-understood, and idiomatic for sorting
slices in-place using `bool`-returning comparators.
- This replacement avoids upgrading Go beyond version 1.20, preserving
build correctness and minimizing future toolchain-related bugs.
- Avoids unnecessary dependencies on `golang.org/x/exp`, which is not
guaranteed to be stable.
- For all `slices.SortFunc(...)` calls, equivalent `sort.Slice(...)`
expressions were used.
- Where the previous comparator used `Cmp` or custom integer return
values, those were mapped to `bool` conditions consistent with sort
order expectations.
- All test files and logic remain functionally unchanged aside from the
sorting mechanism.
This refactor maintains semantic equivalence while improving long-term maintainability and version safety.1 parent 6231a0a commit c611bb3
File tree
1,420 files changed
+118338
-91889
lines changed- .github
- ISSUE_TEMPLATE
- workflows
- accounts
- abi
- bind
- backends
- external
- keystore
- scwallet
- usbwallet
- trezor
- beacon
- engine
- light
- merkle
- params
- types
- build
- deb/ethereum
- tools
- cmd
- abigen
- bootnode
- checkpoint-admin
- clef
- devp2p
- internal
- ethtest
- testdata
- v4test
- v5test
- era
- ethkey
- evm
- internal/t8ntool
- testdata
- 10
- 12
- 13
- 14
- 19
- 1
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 2
- 30
- 3
- 4
- 5
- 7
- 8
- 9
- faucet
- geth
- testdata
- logging
- vcheck/minisig-sigs-new
- p2psim
- puppeth
- testdata
- rlpdump
- utils
- common
- bitutil
- hexutil
- lru
- math
- mclock
- prque
- consensus
- beacon
- clique
- ethash
- misc
- eip1559
- eip4844
- console
- contracts/checkpointoracle
- contract
- core
- asm
- beacon
- bloombits
- forkid
- rawdb
- state
- pruner
- snapshot
- txpool
- blobpool
- legacypool
- types
- vm
- runtime
- testdata/precompiles
- crypto
- blake2b
- bls12381
- bn256
- cloudflare
- google
- ecies
- kzg4844
- secp256k1
- libsecp256k1
- src
- modules/recovery
- signify
- docs/postmortems
- ethclient
- gethclient
- simulated
- ethdb
- dbtest
- leveldb
- memorydb
- pebble
- remotedb
- ethstats
- eth
- catalyst
- downloader
- ethconfig
- fetcher
- filters
- gasestimator
- gasprice
- protocols
- eth
- snap
- tracers
- internal/tracetest
- testdata
- call_tracer_flat
- call_tracer_legacy
- call_tracer_withLog
- call_tracer
- prestate_tracer_legacy
- prestate_tracer_with_diff_mode
- prestate_tracer
- js
- internal/tracers
- logger
- native
- event
- graphql
- internal/graphiql
- internal
- blocktest
- build
- cmdtest
- debug
- era
- e2store
- ethapi
- testdata
- flags
- guide
- jsre
- deps
- reexec
- testlog
- testrand
- utesting
- version
- web3ext
- les
- catalyst
- checkpointoracle
- downloader
- fetcher
- flowcontrol
- utils
- vflux
- client
- server
- light
- log
- metrics
- exp
- influxdb
- testdata
- internal
- librato
- prometheus
- testdata
- testdata
- miner
- stress
- 1559
- beacon
- clique
- ethash
- mobile
- node
- p2p
- discover
- v4wire
- v5wire
- dnsdisc
- enode
- enr
- msgrate
- nat
- netutil
- nodestate
- rlpx
- simulations
- adapters
- examples
- params
- forks
- rlp
- internal/rlpstruct
- rlpgen
- testdata
- rpc
- testdata
- signer
- core
- apitypes
- testdata
- fourbyte
- rules
- storage
- swarm
- tests
- fuzzers
- abi
- bitutil
- bls12381
- bn256
- difficulty
- debug
- keystore
- corpus
- les
- debug
- rangeproof
- debug
- rlp
- corpus
- runtime
- secp256k1
- snap/debug
- stacktrie
- debug
- trie
- txfetcher
- vflux
- triedb
- database
- hashdb
- pathdb
- trie
- testutil
- trienode
- triestate
- utils
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
1,420 files changed
+118338
-91889
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
14 | | - | |
| 13 | + | |
15 | 14 | | |
16 | 15 | | |
17 | | - | |
18 | 16 | | |
19 | 17 | | |
20 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | | - | |
| 31 | + | |
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
0 commit comments