Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Add flashbots block validation endpoint v3 #104

Open
wants to merge 169 commits into
base: cancun-1.12.2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
169 commits
Select commit Hold shift + click to select a range
8d1db16
eth/filters, core/rawdb: remove unused param, refactor filtering-loop…
holiman Aug 10, 2023
86d7f5a
deps: update supranational/blst to 0.3.11 (#27890)
dependabot[bot] Aug 10, 2023
5e89ff4
graphql: validate block params (#27876)
s1na Aug 10, 2023
503f1f7
all: activate pbss as experimental feature (#26274)
rjl493456442 Aug 10, 2023
e2507a1
params: switch release family to 1.13 to prep for PBSS
karalabe Aug 10, 2023
6ddb92c
core/txpool/blobpool: fix metrics name for prometheus export (#27901)
imulmat4 Aug 11, 2023
35f7f3d
ethdb/leveldb: support more than 7 levels in metrics (#27904)
jsvisa Aug 11, 2023
8f8ef2b
rpc: attempt to fix ping/pong logic race (#27733)
fjl Aug 11, 2023
80b76a9
core/types: remove duplication in eip2930 signer (#27860)
GDdark Aug 11, 2023
0ce331f
trie/triedb/pathdb: make shutdown journal log friendlier (#27905)
karalabe Aug 11, 2023
be65b47
all: update golang/x/ext and fix slice sorting fallout (#27909)
karalabe Aug 11, 2023
e91b21c
go.mod, build: upgrade c-kzg-4844 (#27907)
fjl Aug 11, 2023
6886006
internal/build: apply -ubuntu to env (#27910)
fjl Aug 12, 2023
2a6beb6
core/types: support for optional blob sidecar in BlobTx (#27841)
fjl Aug 14, 2023
6885521
cmd/utils: restore support for txlookuplimit flag (#27917)
jsvisa Aug 14, 2023
509cd42
go.mod: upgrade goja (#27899)
ucwong Aug 14, 2023
f1801a9
internal/ethapi: implement eth_getBlockReceipts (#27702)
jsvisa Aug 15, 2023
05a8b88
crypto/bls12381: fix typo in comment (#27930)
lei335 Aug 15, 2023
ab28680
trie: add tests for "short" nodes in StackTrie (#27932)
chfast Aug 15, 2023
e0b1198
eth/tracers/js: use t.toBig on ctx.GasPrice for js tracing (#27903)
nettijoe96 Aug 15, 2023
a16d757
build: remove ubuntu kinetic (deprecated) (#27933)
holiman Aug 16, 2023
386cba1
node: increase batch limits for auth rpc API (#27924)
jsvisa Aug 16, 2023
a3e3541
core/types: fix unmarshalling of BlobTx values (#27939)
lightclient Aug 16, 2023
32fde3f
core/forkid: correctly compute forkid when timestamp fork is activate…
lightclient Aug 16, 2023
1aa5520
core/txpool/legacypool: protect cache with mutex (#27898)
holiman Aug 17, 2023
649deb6
eth/downloader: fix rare crash when parent header missing in db (#27945)
jsvisa Aug 17, 2023
950ccdd
internal/ethapi: optimize & clean up EstimateGas (#27710)
roberto-bayardo Aug 18, 2023
7dea9c1
internal/ethapi: eth API changes needed for 4844 (#27928)
MariusVanDerWijden Aug 18, 2023
5976e58
trie: reduce allocs in recHash (#27770)
MariusVanDerWijden Aug 18, 2023
b3024e8
eth: ignore genesis block on importChain (#27956)
MariusVanDerWijden Aug 21, 2023
f56ee7d
eth/catalyst: set finalized block hash properly in dev mode (#27886)
jwasinger Aug 21, 2023
9f4a528
internal/ethapi: add testcases for blobTx (#27818)
jsvisa Aug 22, 2023
7c0d90c
core: ensure txindex will be triggered at least once (#27847)
jsvisa Aug 22, 2023
bbee0e7
miner: fix reply -> replay typo (#27961)
shuoli84 Aug 22, 2023
55c5f59
travis, build: update Go to 1.21.0 (#27958)
holiman Aug 22, 2023
0b4b299
go.mod: update docker (#27970)
MariusVanDerWijden Aug 22, 2023
b8d38e7
core, params, beacon/engine: implement EIP 4788 BeaconRoot (#27849)
holiman Aug 22, 2023
8d24929
cmd/evm: add back stateroot to jsonl-output (#27968)
holiman Aug 22, 2023
4c7053b
core: add BeaconRoot to header in GenerateChain (#27974)
fjl Aug 22, 2023
16946d2
rpc: use go-winio for named pipes (#27972)
holiman Aug 23, 2023
c31f9cf
graphql: fix nil deref on a timer (#27978)
jsvisa Aug 23, 2023
ab3762b
go.mod: update pebble to crl-release-23.1 (#27967)
karalabe Aug 23, 2023
0c6bbeb
core, eth, trie: expose more detailed dirty ram tracking for diff lay…
karalabe Aug 23, 2023
bce5c46
eth/catalyst: disable full payload when not in dev mode (#27921)
rjl493456442 Aug 23, 2023
00fead9
cmd/utils: fix a startup issue on deleted chaindata but dangling anci…
karalabe Aug 23, 2023
4af98d4
travis: increase travis wait time (#27975)
holiman Aug 23, 2023
76d4ac1
account/abi: convert if-else-if chain to tagged switch (#27869)
islishude Aug 23, 2023
52219ce
travis: get rid of old useless GO111MODULE directives (#27991)
karalabe Aug 23, 2023
5c7136a
rlp: remove allocation of bytes.Reader in DecodeBytes (#27987)
fjl Aug 23, 2023
f0f8703
core/rawdb, ethdb/pebble: avoid fsync db in tests (#27836)
holiman Aug 23, 2023
e3f3e01
les: use new atomic types (#27856)
ucwong Aug 23, 2023
4abc412
crypto/bn256: eliminate dead store (#27944)
cuiweixie Aug 23, 2023
2f4dbb4
core/rawdb: allocate database keys with explicit size to avoid slice …
MariusVanDerWijden Aug 23, 2023
eb6cbe3
core/state: remove public method ForEachStorage (#27986)
holiman Aug 23, 2023
d1f6735
core/rawdb: fix 32bit build (#27995)
fjl Aug 23, 2023
feb8f41
miner: add to build block with EIP-4844 blobs (#27875)
lightclient Aug 23, 2023
60ec41c
miner: refactor getSealingBlock method (#27993)
MariusVanDerWijden Aug 23, 2023
9b46986
all: use rlp.DecodeBytes instead of rlp.Decode where possible (#27994)
fjl Aug 24, 2023
45b198d
eth/catalyst: disable heartbeat for simulated beacon node (#27979)
jsvisa Aug 24, 2023
1a21350
eth/catalyst: use block as finalization (#28000)
rjl493456442 Aug 24, 2023
0ba2d3c
core/vm/runtime: Add Random field to config (#28001)
guidovranken Aug 25, 2023
56d2366
core/state/snapshot: replace diffToDisk ideal batch size with 64MB (#…
aaronbuchwald Aug 25, 2023
6dc9cdf
core: support null balance in genesis (#28005)
fjl Aug 25, 2023
5e0eb62
eth/protocols/eth: stop advertising eth/66 for pathdb nodes (#28006)
karalabe Aug 25, 2023
6b98d18
cmd, core, params: add support for the Holesky testnet (#28007)
karalabe Aug 25, 2023
9bbb9df
core/types: transaction and receipt encoding/decoding optimizations (…
fjl Aug 25, 2023
cde462c
eth/catalyst: reset to current header if chain is rewound (in dev mod…
jsvisa Aug 25, 2023
6aa88cc
beacon/engine, eth/catalyst, miner: EIP-4788 CL/EL protocol updates (…
holiman Aug 26, 2023
5ca7fb8
account/abi: handle solidity panic revert (#27868)
islishude Aug 26, 2023
3ff6b3c
core/state: implement fast storage deletion (#27955)
rjl493456442 Aug 26, 2023
3a662d4
eth: remove check for tdd reached on pos api block tags (#27799)
lightclient Aug 26, 2023
d4e345c
core/state: fix missing import (#28010)
holiman Aug 26, 2023
f174ddb
build, tests: add execution-spec-tests (#26985)
MariusVanDerWijden Aug 26, 2023
fe24d22
miner/stress/clique: fix typo (#28016)
Cr4shOv3rrid3 Aug 28, 2023
b8adb4c
tests: use 'sender' in state tests if present (#28023)
holiman Aug 29, 2023
41ee96f
core/txpool/blobpool: fix rlp decoding flaw during offload (#28027)
lightclient Aug 30, 2023
5b15949
go.mod: regenerate all indirect dependencies to clean up the junk (#2…
karalabe Aug 31, 2023
53f3c2a
metrics, cmd/geth: informational metrics (prometheus, influxdb, opent…
jorgeacortes Aug 31, 2023
0acc0a1
core/state: simplify storage trie update and commit (#28030)
rjl493456442 Aug 31, 2023
2885708
eth/catalyst: set random value in dev mode (#27940)
MariusVanDerWijden Aug 31, 2023
f260a9e
beacon/engine: add `shouldOverrideBuilder` to payload envelope (#28029)
lightclient Sep 4, 2023
eff7c3b
core/forkid: skip genesis forks by time (#28034)
lightclient Sep 4, 2023
25733a4
params: update 4844 parameters (#28026)
lightclient Sep 5, 2023
2f77299
go.mod: goupnp 1.3.0 (#28053)
ucwong Sep 6, 2023
2e02c1f
core/rawdb: don't warn for missing "unclean shutdown markers" (#28014)
jsvisa Sep 6, 2023
c60f7dd
deps: update minisign (#28066)
holiman Sep 7, 2023
a8d7201
log: avoid stack lookups when not needed/used (#28069)
holiman Sep 7, 2023
a7842c9
core, trie: cleanup trie database (#28062)
rjl493456442 Sep 7, 2023
83886e4
go.mod: pull in a fix from pebble crl-release-23.1 (#28081)
karalabe Sep 8, 2023
5cf53f5
ethclient: use 'input', not 'data' as field for transaction input (#2…
holiman Sep 8, 2023
1efd12f
core: fix calculation of blob gasprice in tx receipt (#28082)
lightclient Sep 11, 2023
12ef276
consensus/misc: fix min gas limit error message (#28085)
0xmuralik Sep 11, 2023
7371b38
params: release Geth v1.13.0
karalabe Sep 12, 2023
766272f
params: begin v1.13.1 release cycle
karalabe Sep 12, 2023
64ba830
Add flashbots block validation endpoint v3
avalonche Aug 26, 2023
43df612
internal, log: remove code for old unsupported go-versions (#28090)
holiman Sep 13, 2023
8d38b1f
core/rawdb: skip pathdb state inspection in hashdb mode (#28108)
karalabe Sep 13, 2023
8b6cf12
metrics: refactor metrics (#28035)
holiman Sep 13, 2023
eb74389
cmd/geth: rename the protocols field in the metrics gague (#28102)
karalabe Sep 13, 2023
76c6382
Merge tag 'v1.13.0' into block-validation-v3
avalonche Sep 14, 2023
b9b99a1
eth: abort on api operations not available in pbss-mode (#28104)
s1na Sep 14, 2023
d9fbb71
cmd/geth, internal/flags, go.mod: colorize cli help, support env vars…
karalabe Sep 14, 2023
636c64c
build: upgrade -dlgo version to Go 1.21.1 (#28113)
sandakersmann Sep 14, 2023
86bc2cd
internal/flags: fix linter
karalabe Sep 14, 2023
8514d66
graphql: add 4844 blob fields (#27963)
jsvisa Sep 14, 2023
ee65462
internal/flags: fix loading env vars for custom flags (#28117)
karalabe Sep 14, 2023
909dd4a
rlp/rlpgen: remove build tag (#28106)
fjl Sep 14, 2023
65a17c0
metrics: add support for enabling metrics from env vars (#28118)
karalabe Sep 14, 2023
6047350
Update block validation logic and fix test
avalonche Sep 14, 2023
48fdb79
core/state: check err for iter.Error in fastDeleteStorage (#28122)
darioush Sep 15, 2023
4fa3db4
eth/downloader: prevent pivot moves after state commit (#28126)
karalabe Sep 15, 2023
16cd1a7
cmd/geth, internal/flags: print envvar config source and bad names (#…
karalabe Sep 15, 2023
3128174
nil pointer panic fix
avalonche Sep 14, 2023
9a9db3d
eth/catalyst: fix engine API (#28135)
rjl493456442 Sep 17, 2023
2177193
internal/ethapi: correctly calculate effective gas price (#28130)
cam-schultz Sep 17, 2023
52234eb
internal/flags: fix typo (#28133)
phenix3443 Sep 17, 2023
d8a351b
params: fix typo in comment (#28129)
phenix3443 Sep 17, 2023
c53b0fe
core, eth/downloader: fix genesis state missing due to state sync (#2…
rjl493456442 Sep 17, 2023
3f40e65
params: release Geth v1.13.1
karalabe Sep 17, 2023
90d5bd8
params: begin Geth v1.13.2 release cycle
karalabe Sep 17, 2023
a3a9b1f
Merge tag 'v1.13.1' into block-validation-v3
avalonche Sep 19, 2023
e9f78db
cmd/evm: fix some issues with the evm run command (#28109)
fjl Sep 19, 2023
ef76afa
core/rawdb: fix typo in comment (#28140)
jsvisa Sep 19, 2023
4b748b7
eth: fix typo in comment (#28146)
bnovil Sep 19, 2023
41a0ad9
cmd/devp2p: use bootnodes as crawl input (#28139)
jsvisa Sep 19, 2023
30d5d7c
go.mod: use existing version of karalabe/usb (#28127)
holiman Sep 19, 2023
7ed5bc0
trie: add getter for preimage store in trie.Database (#28155)
gballet Sep 19, 2023
5c6f4b9
cmd/utils: fix typo in comment (#28159)
phenix3443 Sep 19, 2023
5b9cbe3
cmd/clef: suppress fsnotify error if keydir not exists (#28160)
jsvisa Sep 20, 2023
545f4c5
core/rawdb: no need to run truncateFile for readonly mode (#28145)
jsvisa Sep 21, 2023
7289aaa
set sbundle pool
avalonche Sep 19, 2023
4773dcb
trie: remove internal nodes between shortNode and child in path mode …
rjl493456442 Sep 22, 2023
03c2176
trie/triedb/pathdb: improve error log (#28177)
rjl493456442 Sep 22, 2023
83f3fc2
core/state/snapshot: be very noisy if the generator hits a trie error…
karalabe Sep 22, 2023
d135baf
cmd/geth: print progress logs when iterating large contracts too (#28…
karalabe Sep 22, 2023
f1b2ec0
core/rawdb: use readonly file lock in readonly mode (#28180)
jsvisa Sep 22, 2023
82ec555
cmd: add state.scheme to the database flag group for local flag handl…
karalabe Sep 22, 2023
7c8a23d
private blob tx support
avalonche Sep 23, 2023
8a1b037
submit deneb blocks
avalonche Sep 23, 2023
323542a
core, params: update Holesky testnet to relaunched spec (#28191)
karalabe Sep 25, 2023
d051ea5
params: update hash for Holesky relaunch (#28192)
karalabe Sep 25, 2023
c2cfe35
core/bloombits: fix deadlock when matcher session hits an error (#28184)
msmania Sep 25, 2023
1fa3362
core/forkid: add forkid test for holesky (#28193)
MariusVanDerWijden Sep 25, 2023
c3742a9
internal/debug: add --log.rotate to the logging category (#28190)
fjl Sep 25, 2023
3d297fc
cmd/geth: ensure db is closed before exit (#28150)
jsvisa Sep 25, 2023
f6f64cc
cmd/utils: fix bootnodes config priority (#28095)
buddh0 Sep 25, 2023
4985d83
ethclient: fix BlockReceipts parameter encoding (#28087)
kandrianov Sep 25, 2023
4de89e9
core/vm: minor code formatting (#28199)
hzysvilla Sep 26, 2023
4021910
eth/downloader: typo in comment (#28196)
phenix3443 Sep 26, 2023
2b7bc2c
eth/fetcher: allow underpriced transactions in after timeout (#28097)
MariusVanDerWijden Sep 26, 2023
adb9b31
internal/ethapi: eth_call block parameter is optional (#28165)
s1na Sep 26, 2023
b85c183
eth/downloader: remove header rollback mechanism (#28147)
rjl493456442 Sep 26, 2023
614804b
core/txpool: fix typos (#28208)
bnovil Sep 27, 2023
a081130
core/txpool: fix typos (#28213)
0xbstn Sep 28, 2023
73f5bcb
core, accounts, eth, trie: handle genesis state missing (#28171)
rjl493456442 Sep 28, 2023
dc34fe8
params: release Geth v1.13.2
karalabe Sep 28, 2023
3dc45a3
params: begin v1.13.3 release cycle
karalabe Sep 28, 2023
37a2d91
params: update 4788 beacon roots contract addr (#28205)
lightclient Sep 28, 2023
46c850a
internal/ethapi: compact db missing key starts with 0xff (#28207)
jsvisa Sep 28, 2023
b9450bf
core, eth: typos and some code formatting (#28201)
phenix3443 Sep 28, 2023
f988b23
ethdb, internal/ethapi: support exposing Pebble stats too, beside Lev…
karalabe Sep 28, 2023
f605b4c
core/txpool,internal/ethapi: allow blob txs before fork
lightclient Sep 14, 2023
d819ee7
eth/catalyst: change fcu param and timestamp checking behaviour
lightclient Sep 19, 2023
ff4536e
eth/catalyst: add validation error in new paylaod hash mismatch
lightclient Sep 25, 2023
2443467
core: implement blobfee opcode
MariusVanDerWijden Sep 12, 2023
7be94e1
add parent beacon block root to payload attributes
avalonche Sep 29, 2023
1f9274b
fix bug
avalonche Sep 29, 2023
90a21f2
Merge remote-tracking branch 'lightclient/devnet-9' into block-valida…
avalonche Oct 2, 2023
bb61ba5
add sidecar and parent block root in block building
avalonche Oct 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
42 changes: 15 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- stage: lint
os: linux
dist: bionic
go: 1.20.x
go: 1.21.x
env:
- lint
git:
Expand All @@ -28,7 +28,7 @@ jobs:
os: linux
arch: amd64
dist: bionic
go: 1.20.x
go: 1.21.x
env:
- docker
services:
Expand All @@ -45,7 +45,7 @@ jobs:
os: linux
arch: arm64
dist: bionic
go: 1.20.x
go: 1.21.x
env:
- docker
services:
Expand All @@ -63,10 +63,9 @@ jobs:
os: linux
dist: bionic
sudo: required
go: 1.20.x
go: 1.21.x
env:
- azure-linux
- GO111MODULE=on
git:
submodules: false # avoid cloning ethereum/tests
addons:
Expand Down Expand Up @@ -97,10 +96,9 @@ jobs:
- stage: build
if: type = push
os: osx
go: 1.20.x
go: 1.21.x
env:
- azure-osx
- GO111MODULE=on
git:
submodules: false # avoid cloning ethereum/tests
script:
Expand All @@ -112,41 +110,34 @@ jobs:
os: linux
arch: amd64
dist: bionic
go: 1.20.x
env:
- GO111MODULE=on
go: 1.21.x
script:
- go run build/ci.go test $TEST_PACKAGES
- travis_wait 30 go run build/ci.go test $TEST_PACKAGES

- stage: build
if: type = pull_request
os: linux
arch: arm64
dist: bionic
go: 1.19.x
env:
- GO111MODULE=on
go: 1.20.x
script:
- go run build/ci.go test $TEST_PACKAGES
- travis_wait 30 go run build/ci.go test $TEST_PACKAGES

- stage: build
os: linux
dist: bionic
go: 1.19.x
env:
- GO111MODULE=on
go: 1.20.x
script:
- go run build/ci.go test $TEST_PACKAGES
- travis_wait 30 go run build/ci.go test $TEST_PACKAGES

# This builder does the Ubuntu PPA nightly uploads
- stage: build
if: type = cron || (type = push && tag ~= /^v[0-9]/)
os: linux
dist: bionic
go: 1.20.x
go: 1.21.x
env:
- ubuntu-ppa
- GO111MODULE=on
git:
submodules: false # avoid cloning ethereum/tests
addons:
Expand All @@ -167,10 +158,9 @@ jobs:
if: type = cron
os: linux
dist: bionic
go: 1.20.x
go: 1.21.x
env:
- azure-purge
- GO111MODULE=on
git:
submodules: false # avoid cloning ethereum/tests
script:
Expand All @@ -181,9 +171,7 @@ jobs:
if: type = cron
os: linux
dist: bionic
go: 1.20.x
env:
- GO111MODULE=on
go: 1.21.x
script:
- go run build/ci.go test -race $TEST_PACKAGES
- travis_wait 30 go run build/ci.go test -race $TEST_PACKAGES

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG VERSION=""
ARG BUILDNUM=""

# Build Geth in a stock Go builder container
FROM golang:1.20-alpine as builder
FROM golang:1.21-alpine as builder

RUN apk add --no-cache gcc musl-dev linux-headers git

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

GOBIN = ./build/bin
GO ?= latest
GORUN = env GO111MODULE=on go run
GORUN = go run

geth:
$(GORUN) build/ci.go install ./cmd/geth
Expand All @@ -29,7 +29,7 @@ fmt:
go mod tidy

clean:
env GO111MODULE=on go clean -cache
go clean -cache
rm -fr build/_workspace/pkg/ $(GOBIN)/*

# The devtools target installs tools required for 'go generate'.
Expand Down
66 changes: 54 additions & 12 deletions accounts/abi/abi.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"errors"
"fmt"
"io"
"math/big"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
Expand Down Expand Up @@ -246,24 +247,65 @@ func (abi *ABI) HasReceive() bool {
// revertSelector is a special function selector for revert reason unpacking.
var revertSelector = crypto.Keccak256([]byte("Error(string)"))[:4]

// panicSelector is a special function selector for panic reason unpacking.
var panicSelector = crypto.Keccak256([]byte("Panic(uint256)"))[:4]

// panicReasons map is for readable panic codes
// see this linkage for the deails
// https://docs.soliditylang.org/en/v0.8.21/control-structures.html#panic-via-assert-and-error-via-require
// the reason string list is copied from ether.js
// https://github.com/ethers-io/ethers.js/blob/fa3a883ff7c88611ce766f58bdd4b8ac90814470/src.ts/abi/interface.ts#L207-L218
var panicReasons = map[uint64]string{
0x00: "generic panic",
0x01: "assert(false)",
0x11: "arithmetic underflow or overflow",
0x12: "division or modulo by zero",
0x21: "enum overflow",
0x22: "invalid encoded storage byte array accessed",
0x31: "out-of-bounds array access; popping on an empty array",
0x32: "out-of-bounds access of an array or bytesN",
0x41: "out of memory",
0x51: "uninitialized function",
}

// UnpackRevert resolves the abi-encoded revert reason. According to the solidity
// spec https://solidity.readthedocs.io/en/latest/control-structures.html#revert,
// the provided revert reason is abi-encoded as if it were a call to a function
// `Error(string)`. So it's a special tool for it.
// the provided revert reason is abi-encoded as if it were a call to function
// `Error(string)` or `Panic(uint256)`. So it's a special tool for it.
func UnpackRevert(data []byte) (string, error) {
if len(data) < 4 {
return "", errors.New("invalid data for unpacking")
}
if !bytes.Equal(data[:4], revertSelector) {
switch {
case bytes.Equal(data[:4], revertSelector):
typ, err := NewType("string", "", nil)
if err != nil {
return "", err
}
unpacked, err := (Arguments{{Type: typ}}).Unpack(data[4:])
if err != nil {
return "", err
}
return unpacked[0].(string), nil
case bytes.Equal(data[:4], panicSelector):
typ, err := NewType("uint256", "", nil)
if err != nil {
return "", err
}
unpacked, err := (Arguments{{Type: typ}}).Unpack(data[4:])
if err != nil {
return "", err
}
pCode := unpacked[0].(*big.Int)
// uint64 safety check for future
// but the code is not bigger than MAX(uint64) now
if pCode.IsUint64() {
if reason, ok := panicReasons[pCode.Uint64()]; ok {
return reason, nil
}
}
return fmt.Sprintf("unknown panic code: %#x", pCode), nil
default:
return "", errors.New("invalid data for unpacking")
}
typ, err := NewType("string", "", nil)
if err != nil {
return "", err
}
unpacked, err := (Arguments{{Type: typ}}).Unpack(data[4:])
if err != nil {
return "", err
}
return unpacked[0].(string), nil
}
2 changes: 2 additions & 0 deletions accounts/abi/abi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1173,6 +1173,8 @@ func TestUnpackRevert(t *testing.T) {
{"", "", errors.New("invalid data for unpacking")},
{"08c379a1", "", errors.New("invalid data for unpacking")},
{"08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000d72657665727420726561736f6e00000000000000000000000000000000000000", "revert reason", nil},
{"4e487b710000000000000000000000000000000000000000000000000000000000000000", "generic panic", nil},
{"4e487b7100000000000000000000000000000000000000000000000000000000000000ff", "unknown panic code: 0xff", nil},
}
for index, c := range cases {
t.Run(fmt.Sprintf("case %d", index), func(t *testing.T) {
Expand Down
19 changes: 9 additions & 10 deletions accounts/abi/bind/backends/simulated.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ func (b *SimulatedBackend) CodeAt(ctx context.Context, contract common.Address,
if err != nil {
return nil, err
}

return stateDB.GetCode(contract), nil
}

Expand All @@ -230,7 +229,6 @@ func (b *SimulatedBackend) BalanceAt(ctx context.Context, contract common.Addres
if err != nil {
return nil, err
}

return stateDB.GetBalance(contract), nil
}

Expand All @@ -243,7 +241,6 @@ func (b *SimulatedBackend) NonceAt(ctx context.Context, contract common.Address,
if err != nil {
return 0, err
}

return stateDB.GetNonce(contract), nil
}

Expand All @@ -256,7 +253,6 @@ func (b *SimulatedBackend) StorageAt(ctx context.Context, contract common.Addres
if err != nil {
return nil, err
}

val := stateDB.GetState(contract, key)
return val[:], nil
}
Expand Down Expand Up @@ -718,8 +714,10 @@ func (b *SimulatedBackend) SendTransaction(ctx context.Context, tx *types.Transa
}
block.AddTxWithChain(b.blockchain, tx)
})
stateDB, _ := b.blockchain.State()

stateDB, err := b.blockchain.State()
if err != nil {
return err
}
b.pendingBlock = blocks[0]
b.pendingState, _ = state.New(b.pendingBlock.Root(), stateDB.Database(), nil)
b.pendingReceipts = receipts[0]
Expand Down Expand Up @@ -839,11 +837,12 @@ func (b *SimulatedBackend) AdjustTime(adjustment time.Duration) error {
blocks, _ := core.GenerateChain(b.config, block, ethash.NewFaker(), b.database, 1, func(number int, block *core.BlockGen) {
block.OffsetTime(int64(adjustment.Seconds()))
})
stateDB, _ := b.blockchain.State()

stateDB, err := b.blockchain.State()
if err != nil {
return err
}
b.pendingBlock = blocks[0]
b.pendingState, _ = state.New(b.pendingBlock.Root(), stateDB.Database(), nil)

return nil
}

Expand Down Expand Up @@ -910,7 +909,7 @@ func (fb *filterBackend) GetReceipts(ctx context.Context, hash common.Hash) (typ
}

func (fb *filterBackend) GetLogs(ctx context.Context, hash common.Hash, number uint64) ([][]*types.Log, error) {
logs := rawdb.ReadLogs(fb.db, hash, number, fb.bc.Config())
logs := rawdb.ReadLogs(fb.db, hash, number)
return logs, nil
}

Expand Down
7 changes: 4 additions & 3 deletions accounts/abi/method.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,12 @@ func NewMethod(name string, rawName string, funType FunctionType, mutability str
state = state + " "
}
identity := fmt.Sprintf("function %v", rawName)
if funType == Fallback {
switch funType {
case Fallback:
identity = "fallback"
} else if funType == Receive {
case Receive:
identity = "receive"
} else if funType == Constructor {
case Constructor:
identity = "constructor"
}
str := fmt.Sprintf("%v(%v) %sreturns(%v)", identity, strings.Join(inputNames, ", "), state, strings.Join(outputNames, ", "))
Expand Down
7 changes: 4 additions & 3 deletions accounts/abi/method_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,12 @@ func TestMethodString(t *testing.T) {

for _, test := range table {
var got string
if test.method == "fallback" {
switch test.method {
case "fallback":
got = abi.Fallback.String()
} else if test.method == "receive" {
case "receive":
got = abi.Receive.String()
} else {
default:
got = abi.Methods[test.method].String()
}
if got != test.expectation {
Expand Down
7 changes: 4 additions & 3 deletions accounts/abi/unpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,14 @@ func forEachUnpack(t Type, output []byte, start, size int) (interface{}, error)
// this value will become our slice or our array, depending on the type
var refSlice reflect.Value

if t.T == SliceTy {
switch t.T {
case SliceTy:
// declare our slice
refSlice = reflect.MakeSlice(t.GetType(), size, size)
} else if t.T == ArrayTy {
case ArrayTy:
// declare our array
refSlice = reflect.New(t.GetType()).Elem()
} else {
default:
return nil, errors.New("abi: invalid type in array/slice unpacking stage")
}

Expand Down
5 changes: 4 additions & 1 deletion accounts/keystore/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package keystore

import (
"os"
"time"

"github.com/ethereum/go-ethereum/log"
Expand Down Expand Up @@ -77,7 +78,9 @@ func (w *watcher) loop() {
}
defer watcher.Close()
if err := watcher.Add(w.ac.keydir); err != nil {
logger.Warn("Failed to watch keystore folder", "err", err)
if !os.IsNotExist(err) {
logger.Warn("Failed to watch keystore folder", "err", err)
}
return
}

Expand Down
1 change: 1 addition & 0 deletions beacon/engine/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ var (
InvalidPayloadAttributes = &EngineAPIError{code: -38003, msg: "Invalid payload attributes"}
TooLargeRequest = &EngineAPIError{code: -38004, msg: "Too large request"}
InvalidParams = &EngineAPIError{code: -32602, msg: "Invalid parameters"}
UnsupportedFork = &EngineAPIError{code: -38005, msg: "Unsupported fork"}

STATUS_INVALID = ForkChoiceResponse{PayloadStatus: PayloadStatusV1{Status: INVALID}, PayloadID: nil}
STATUS_SYNCING = ForkChoiceResponse{PayloadStatus: PayloadStatusV1{Status: SYNCING}, PayloadID: nil}
Expand Down
Loading
Loading