Skip to content
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

Release v1.12 #10

Merged
merged 145 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
145 commits
Select commit Hold shift + click to select a range
7ecb578
params: begin v1.11.6 release cycle
holiman Mar 21, 2023
2ed8013
build: allow building nightly archives via cron jobs (#26938)
karalabe Mar 21, 2023
8a9a73c
log: add special casing of uint256 into the logger (#26936)
karalabe Mar 21, 2023
905a723
core/rawdb: use atomic int added in go1.19 (#26935)
s7v7nislands Mar 21, 2023
b3f43c8
core/vm: expose jumptable constructors (#26880)
holiman Mar 21, 2023
20f8eb7
eth/catalyst: fix races (#26950)
MariusVanDerWijden Mar 22, 2023
7f3fc15
core/rawdb: update freezertable read meter (#26946)
jsvisa Mar 23, 2023
37ecff0
cmd/evm, tests: record preimages if dump is expected (#26955)
lightclient Mar 23, 2023
8990c92
core/state: add account address to Trie slot accessors (#26934)
gballet Mar 23, 2023
7dc1007
metrics: add cpu counters (#26796)
turboboost55 Mar 23, 2023
f6c3a53
metrics/influxdb: use smaller dependency and reuse code between v1 an…
holiman Mar 23, 2023
b1acaf4
eth/gasprice: change feehistory input type from int to uint64 (#26922)
aaronbuchwald Mar 23, 2023
0137bd6
go.mod: update golang.org/x/tools (#26960)
holiman Mar 24, 2023
792d893
rlp/rlpgen: print want/expect output string if mismatch (#26932)
ucwong Mar 24, 2023
df383ad
ethclient: ensure returned subscription is nil on error (#26976)
norwnd Mar 25, 2023
41f89ca
core/state, trie: remove Try prefix in Trie accessors (#26975)
gballet Mar 27, 2023
117530b
metrics/librato: ensure resp.body closed (#26969)
jsvisa Mar 27, 2023
881fed0
core/vm: use atomic.Bool (#26951)
s7v7nislands Mar 27, 2023
79532a2
core/bloombits: use atomic type (#26993)
s7v7nislands Mar 28, 2023
fb8a3aa
core/state: use atomic.Bool (#26992)
s7v7nislands Mar 28, 2023
a236e03
graphql: fix data races (#26965)
s1na Mar 28, 2023
fd94b4f
eth/tracers/native: prevent panic for LOG edge-cases (#26848)
jwasinger Mar 28, 2023
56c1f98
internal/debug: add log.logfmt flag to set logging to use logfmt (#26…
ajsutton Mar 28, 2023
7ca4f60
docs: update outdated DeriveSha docs comment (#26968)
davidmurdoch Mar 28, 2023
a03490c
remove @gballet as a GraphQL codeowner (#27012)
gballet Mar 30, 2023
949cee2
core: use atomic type (#27011)
s7v7nislands Mar 30, 2023
62fb7d3
graphql: revert storage access regression (#27007)
s1na Mar 30, 2023
2d14928
cmd/geth: Add `--log.format` cli param (#27001)
ajsutton Mar 30, 2023
50317bd
ethdb/pebble: use atomic type (#27014)
s7v7nislands Mar 30, 2023
9ce0474
common: fix json marshaller MixedcaseAddress (#26998)
rjl493456442 Mar 30, 2023
d0fbb10
eth/catalyst: improve consensus heartbeat (#26896)
openex27 Mar 30, 2023
b92d0ea
miner: use atomic type (#27013)
s7v7nislands Mar 31, 2023
00a73fb
accounts/abi/bind: handle UnpackLog with zero topics (#26920)
aaronbuchwald Mar 31, 2023
bed07cd
cmd/evm: use correct parent number for t8n base fee calculation (#27032)
gurukamath Apr 3, 2023
dc2f4b9
go.mod : update snappy (#27027)
ucwong Apr 3, 2023
2c57984
common: delete MakeName (#27023)
lightclient Apr 3, 2023
7076ae0
cmd/geth: enable log rotation (#26843)
sudeepdino008 Apr 3, 2023
94457cc
cmd, miner, signer: avoid panic if keystore is not available (#27039)
rjl493456442 Apr 3, 2023
a25dd80
test/fuzzers: fuzz rlp handling of big.Int and uint256.Int (#26917)
holiman Apr 3, 2023
beda6c4
core/txpool: move some validation to outside of mutex (#27006)
holiman Apr 3, 2023
db18293
eth/downloader: use atomic types (#27030)
s7v7nislands Apr 3, 2023
9b1a82c
core/vm: clarify comment (#27045)
joohhnnn Apr 4, 2023
91faf2c
consensus, core/typer: add 4844 excessDataGas to header, tie it to Ca…
karalabe Apr 4, 2023
d2cf493
consensus/misc, params: add EIP-4844 blobfee conversions (#27041)
karalabe Apr 4, 2023
0b76eb3
eth/tracers: report correct gasLimit in call tracers (#27029)
jsvisa Apr 4, 2023
ab1a404
all: remove debug-field from vm config (#27048)
holiman Apr 4, 2023
b4dcd1a
metrics: make gauge_float64 and counter_float64 lock free (#27025)
Exca-DK Apr 4, 2023
2adce0b
eth/tracers: use atomic type (#27031)
s7v7nislands Apr 4, 2023
9d37102
build: upgrade -dlgo version to Go 1.20.3
sandakersmann Apr 4, 2023
230df98
core/txpool: disallow future churn by remote txs (#26907)
MariusVanDerWijden Apr 5, 2023
b946b7a
core, miner: drop transactions from the same sender when error occurs…
rjl493456442 Apr 5, 2023
4a9fa31
Merge pull request #27051 from sandakersmann/master
karalabe Apr 8, 2023
5aa5295
params: new sepolia bootnodes (#27099)
parithosh Apr 17, 2023
8fe807c
cmd/devp2p: fix erroneous log output in crawler (#27089)
0x00Duke Apr 17, 2023
bedf285
signer/core: rename testdata files (#27063)
taeguk Apr 17, 2023
cb66eba
core: fix comment to reflect function name (#27070)
anusha-ctrl Apr 17, 2023
5e4d726
params: remove `EIP150Hash` from chainconfig (#27087)
jsvisa Apr 18, 2023
b197262
p2p: access embedded fields of Server directly (#27078)
joohhnnn Apr 18, 2023
3768b00
consensus/ethash: use atomic type (#27068)
s7v7nislands Apr 18, 2023
2b0a34b
cmd/devp2p: make crawler-route53-updater less verbose (#27116)
holiman Apr 19, 2023
f2df2b1
cmd/geth: rename --vmodule to --log.vmodule (#27071)
ajsutton Apr 19, 2023
3f7afc3
core/vm: order opcodes properly (#27113)
axic Apr 20, 2023
ae93e0b
metrics: use atomic type (#27121)
s7v7nislands Apr 20, 2023
99f81d2
all: refactor trie API (#26995)
rjl493456442 Apr 20, 2023
ea9e62c
params: go-ethereum v1.11.6 stable
holiman Apr 20, 2023
4ab4e4f
params: begin v1.11.7 release cycle
holiman Apr 20, 2023
bbc565a
core/types, params: add blob transaction type, RLP encoded for now (#…
karalabe Apr 21, 2023
d3ece3a
cmd/utils, node: switch to Pebble as the default db if none exists (#…
karalabe Apr 21, 2023
1e556d2
all: remove notion of trusted checkpoints in the post-merge world (#2…
karalabe Apr 24, 2023
bbcb5ea
core, trie: rework trie database (#26813)
rjl493456442 Apr 24, 2023
f541cad
eth: use new atomic types (#27137)
s7v7nislands Apr 25, 2023
f8f9534
p2p/discover: add traffic metrics (#27008)
Exca-DK Apr 25, 2023
9a12cc9
cmd/geth: remove DAO fork test (#27161)
holiman Apr 25, 2023
2f98dd3
graphql: encode Long values as hex (#26894)
s1na Apr 25, 2023
b1113aa
eth: fix crash on querying finalized block (#27162)
s1na Apr 25, 2023
5d3f580
trie: add node type common package (#27160)
rjl493456442 Apr 26, 2023
f8aa623
core/types: fix discrepancy in receipt.EffectiveGasPrice json encodin…
roberto-bayardo Apr 26, 2023
25f9977
les: use atomic type (#27168)
stephenfire Apr 26, 2023
306d177
light: use atomic type (#27169)
stephenfire Apr 26, 2023
66c0c4e
cmd, eth, les: replace Shanghai override flag with Cancun (#27171)
karalabe Apr 26, 2023
8f37322
cmd/geth: make account commands not require datadir lock (#27084)
jsvisa Apr 27, 2023
47cdea5
p2p/discover: concurrent TALKREQ handling (#27112)
fjl Apr 28, 2023
c387186
eth/ethconfig: go fmt (#27194)
ucwong Apr 28, 2023
a865e28
p2p/discover : typo (#27193)
ucwong Apr 28, 2023
52c246f
eth/gasprice: fix typo (#27202)
chirag-bgh May 2, 2023
ae66009
internal/ethapi: add block overrides to eth_call (#26414)
s1na May 2, 2023
a9d7cda
core/types: go generate (#27196)
ucwong May 2, 2023
7d1ebe5
p2p/discover: fix lint nit (#27206)
holiman May 2, 2023
7f6c045
core: remove unused ContractCode method from BlockChain (#27186)
gballet May 2, 2023
29c33d9
graphql, internal: fix typos in comments (#27184)
DavidRomanovizc May 2, 2023
ac3418d
accounts/abi: resolve name conflict for methods starting with a numbe…
MariusVanDerWijden May 2, 2023
dde2da0
all: remove ethash pow, only retain shims needed for consensus and te…
karalabe May 3, 2023
ffda2c6
rpc: use atomic types (#27214)
s7v7nislands May 4, 2023
79a57d4
eth/downloader: fix error aggregator (#27217)
rjl493456442 May 5, 2023
ba09403
core/txpool : fix map size avoid resizing (#27221)
ucwong May 5, 2023
604e215
eth/tracers: add `txHash` field on txTraceResult (#27183)
sjlee1125 May 5, 2023
cc8d40c
core/state: initialize maps with known size (#27222)
ucwong May 8, 2023
7ac08ba
cmd/geth: rename variable 'extapi' (#27223)
joohhnnn May 8, 2023
81d328a
log: report error when ctx key is non-string (#27226)
ucwong May 8, 2023
5021d36
all: port boring changes from pbss (#27176)
rjl493456442 May 9, 2023
c798507
miner: initialize maps with capacity (#27228)
ucwong May 9, 2023
c62da24
cmd/utils: report the blocknumber when block import fails (#27213)
gballet May 9, 2023
0fb1be0
event: initialize maps with known size (#27233)
ucwong May 9, 2023
a742943
node: fix typos in comments (#27236)
dbadoy May 10, 2023
ae7db28
p2p: initialize maps with known size (#27229)
ucwong May 10, 2023
2169fa3
crypto/kzg4844: pull in the C and Go libs for KZG cryptography (#27155)
karalabe May 10, 2023
c8b0afb
ethclient: acquire the rpc.Client (#27246)
jsvisa May 11, 2023
d17ec0e
ethdb/memorydb: init map with known size (#27241)
ucwong May 11, 2023
7577b9c
core/state: unexport NodeIterator (#27239)
gballet May 11, 2023
a143018
all: new empty trie with types.EmptyRootHash instead of null (#27230)
rjl493456442 May 11, 2023
a340721
metrics: use sync.map in registry (#27159)
Exca-DK May 11, 2023
0b66d47
internal/ethapi: make EstimateGas use `latest` block by default (#24363)
zhiqiangxu May 11, 2023
dffd804
internal/ethapi: remove unused err-return (#27240)
makcandrov May 11, 2023
1982437
core/types: un-ssz blob txs, add json marshalling and tweaks (#27256)
karalabe May 12, 2023
9ca84e6
crypto/kzg4844: upgrade c-kzg-4844 to v0.2.0 (#27257)
jtraglia May 12, 2023
7369752
rpc: websocket should respect the "HTTP_PROXY" by default (#27264)
oseau May 15, 2023
c2148c6
core/asm: remove unused return value (#27272)
joohhnnn May 16, 2023
6e3aa86
internal/ethapi: minor refactor in block serialization (#27268)
jsvisa May 16, 2023
d46f69d
tests/fuzzers/bn256: add PairingCheck fuzzer (#27252)
MariusVanDerWijden May 16, 2023
eb83e7c
core/state/snapshot: check difflayer staleness early (#27255)
holiman May 16, 2023
2f2959d
core/state/pruner: remove unused error-return (#27273)
joohhnnn May 17, 2023
ae1d90e
internal/ethapi: make NewAccount return EIP-55 format (#26973)
alexmylonas May 17, 2023
84c3799
rpc: more accurate checking of handler method signatures (#27287)
stephenfire May 17, 2023
41fafa4
go.mod: upgrade gencodec (#27288)
fjl May 17, 2023
c08dc59
beacon/types: add beacon chain data types (#27292)
zsfelfoldi May 17, 2023
6a6318b
go.mod: use`gopkg.in/yaml.v3` instead of `github.com/go-yaml/yaml` (#…
islishude May 17, 2023
85a4b82
all: tie timestamp based forks to the passage of London (#27279)
karalabe May 19, 2023
99394ad
ethdb/pebble: prevent shutdown-panic (#27238)
holiman May 19, 2023
3223950
cmd/utils: do not check free disk space in dev mode (#27281)
islishude May 19, 2023
944e1a0
beacon/types: auto-generate SyncCommittee marshaling methods (#27296)
fjl May 19, 2023
6fe0252
rpc, internal/cmdtest: increase timeout in tests (#27083)
jsvisa May 22, 2023
b46d37e
graphql: upgrade UI to v2 (#27294)
s1na May 22, 2023
5b792e0
accounts/abi: add ErrorById (#27277)
chawin-a May 22, 2023
a190da9
eth/tracers: fix flatCallTracer crasher (#27304)
minh-bq May 23, 2023
bfded65
core/state: do not ignore null addr while iterative dump (#27320)
pcw109550 May 23, 2023
1a18283
cmd/evm: make batched state-test execution possible (#27318)
holiman May 23, 2023
9231770
rpc: change BlockNumber constant values to match ethclient (#27219)
holiman May 23, 2023
e9c3183
cmd: use errrors.New instead of empty fmt.Errorf (#27329)
jsvisa May 24, 2023
b0095ee
ethclient,event: replace noarg fmt.Errorf with errors.New (#27334)
jsvisa May 24, 2023
21c87e0
crypto: replace noarg fmt.Errorf with errors.New (#27333)
jsvisa May 24, 2023
dd25a4f
les, signer, light: replace noarg fmt.Errorf with errors.New (#27336)
jsvisa May 25, 2023
b21ba66
internal,tests: replace noarg fmt.Errorf with errors.New (#27335)
jsvisa May 25, 2023
8a78a4f
eth,consensus: replace noarg fmt.Errorf with errors.New (#27330)
jsvisa May 25, 2023
33fdd03
ethdb/pebble: fix NewBatchWithSize to set db (#27350)
holiman May 25, 2023
e501b3b
params: go-ethereum v1.12.0 stable
holiman May 25, 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
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ core/ @karalabe @holiman @rjl493456442
eth/ @karalabe @holiman @rjl493456442
eth/catalyst/ @gballet
eth/tracers/ @s1na
graphql/ @gballet @s1na
graphql/ @s1na
les/ @zsfelfoldi @rjl493456442
light/ @zsfelfoldi @rjl493456442
node/ @fjl
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ profile.cov
/dashboard/assets/package-lock.json

**/yarn-error.log
logs/
11 changes: 11 additions & 0 deletions accounts/abi/abi.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,17 @@ func (abi *ABI) EventByID(topic common.Hash) (*Event, error) {
return nil, fmt.Errorf("no event with id: %#x", topic.Hex())
}

// ErrorByID looks up an error by the 4-byte id,
// returns nil if none found.
func (abi *ABI) ErrorByID(sigdata [4]byte) (*Error, error) {
for _, errABI := range abi.Errors {
if bytes.Equal(errABI.ID[:4], sigdata[:]) {
return &errABI, nil
}
}
return nil, fmt.Errorf("no error with id: %#x", sigdata[:])
}

// HasFallback returns an indicator whether a fallback function is included.
func (abi *ABI) HasFallback() bool {
return abi.Fallback.Type == Fallback
Expand Down
28 changes: 28 additions & 0 deletions accounts/abi/abi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,34 @@ func TestABI_EventById(t *testing.T) {
}
}

func TestABI_ErrorByID(t *testing.T) {
abi, err := JSON(strings.NewReader(`[
{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"}],"name":"MyError1","type":"error"},
{"inputs":[{"components":[{"internalType":"uint256","name":"a","type":"uint256"},{"internalType":"string","name":"b","type":"string"},{"internalType":"address","name":"c","type":"address"}],"internalType":"struct MyError.MyStruct","name":"x","type":"tuple"},{"internalType":"address","name":"y","type":"address"},{"components":[{"internalType":"uint256","name":"a","type":"uint256"},{"internalType":"string","name":"b","type":"string"},{"internalType":"address","name":"c","type":"address"}],"internalType":"struct MyError.MyStruct","name":"z","type":"tuple"}],"name":"MyError2","type":"error"},
{"inputs":[{"internalType":"uint256[]","name":"x","type":"uint256[]"}],"name":"MyError3","type":"error"}
]`))
if err != nil {
t.Fatal(err)
}
for name, m := range abi.Errors {
a := fmt.Sprintf("%v", &m)
var id [4]byte
copy(id[:], m.ID[:4])
m2, err := abi.ErrorByID(id)
if err != nil {
t.Fatalf("Failed to look up ABI error: %v", err)
}
b := fmt.Sprintf("%v", m2)
if a != b {
t.Errorf("Error %v (id %x) not 'findable' by id in ABI", name, id)
}
}
// test unsuccessful lookups
if _, err = abi.ErrorByID([4]byte{}); err == nil {
t.Error("Expected error: no error with this id")
}
}

// TestDoubleDuplicateMethodNames checks that if transfer0 already exists, there won't be a name
// conflict and that the second transfer method will be renamed transfer1.
func TestDoubleDuplicateMethodNames(t *testing.T) {
Expand Down
8 changes: 6 additions & 2 deletions accounts/abi/bind/backends/simulated.go
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ func (b *SimulatedBackend) SendTransaction(ctx context.Context, tx *types.Transa
return fmt.Errorf("could not fetch parent")
}
// Check transaction validity
signer := types.MakeSigner(b.blockchain.Config(), block.Number())
signer := types.MakeSigner(b.blockchain.Config(), block.Number(), block.Time())
sender, err := types.Sender(signer, tx)
if err != nil {
return fmt.Errorf("invalid transaction: %v", err)
Expand Down Expand Up @@ -884,7 +884,11 @@ func (fb *filterBackend) GetReceipts(ctx context.Context, hash common.Hash) (typ
if number == nil {
return nil, nil
}
return rawdb.ReadReceipts(fb.db, hash, *number, fb.bc.Config()), nil
header := rawdb.ReadHeader(fb.db, hash, *number)
if header == nil {
return nil, nil
}
return rawdb.ReadReceipts(fb.db, hash, *number, header.Time, fb.bc.Config()), nil
}

func (fb *filterBackend) GetLogs(ctx context.Context, hash common.Hash, number uint64) ([][]*types.Log, error) {
Expand Down
17 changes: 15 additions & 2 deletions accounts/abi/bind/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ import (

const basefeeWiggleMultiplier = 2

var (
errNoEventSignature = errors.New("no event signature")
errEventSignatureMismatch = errors.New("event signature mismatch")
)

// SignerFn is a signer function callback when a contract requires a method to
// sign the transaction before submission.
type SignerFn func(common.Address, *types.Transaction) (*types.Transaction, error)
Expand Down Expand Up @@ -488,8 +493,12 @@ func (c *BoundContract) WatchLogs(opts *WatchOpts, name string, query ...[]inter

// UnpackLog unpacks a retrieved log into the provided output structure.
func (c *BoundContract) UnpackLog(out interface{}, event string, log types.Log) error {
// Anonymous events are not supported.
if len(log.Topics) == 0 {
return errNoEventSignature
}
if log.Topics[0] != c.abi.Events[event].ID {
return fmt.Errorf("event signature mismatch")
return errEventSignatureMismatch
}
if len(log.Data) > 0 {
if err := c.abi.UnpackIntoInterface(out, event, log.Data); err != nil {
Expand All @@ -507,8 +516,12 @@ func (c *BoundContract) UnpackLog(out interface{}, event string, log types.Log)

// UnpackLogIntoMap unpacks a retrieved log into the provided map.
func (c *BoundContract) UnpackLogIntoMap(out map[string]interface{}, event string, log types.Log) error {
// Anonymous events are not supported.
if len(log.Topics) == 0 {
return errNoEventSignature
}
if log.Topics[0] != c.abi.Events[event].ID {
return fmt.Errorf("event signature mismatch")
return errEventSignatureMismatch
}
if len(log.Data) > 0 {
if err := c.abi.UnpackIntoMap(out, event, log.Data); err != nil {
Expand Down
17 changes: 17 additions & 0 deletions accounts/abi/bind/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,23 @@ func TestUnpackIndexedStringTyLogIntoMap(t *testing.T) {
unpackAndCheck(t, bc, expectedReceivedMap, mockLog)
}

func TestUnpackAnonymousLogIntoMap(t *testing.T) {
mockLog := newMockLog(nil, common.HexToHash("0x0"))

abiString := `[{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"received","type":"event"}]`
parsedAbi, _ := abi.JSON(strings.NewReader(abiString))
bc := bind.NewBoundContract(common.HexToAddress("0x0"), parsedAbi, nil, nil, nil)

var received map[string]interface{}
err := bc.UnpackLogIntoMap(received, "received", mockLog)
if err == nil {
t.Error("unpacking anonymous event is not supported")
}
if err.Error() != "no event signature" {
t.Errorf("expected error 'no event signature', got '%s'", err)
}
}

func TestUnpackIndexedSliceTyLogIntoMap(t *testing.T) {
sliceBytes, err := rlp.EncodeToBytes([]string{"name1", "name2", "name3", "name4"})
if err != nil {
Expand Down
17 changes: 16 additions & 1 deletion accounts/abi/bind/bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,19 @@ func Bind(types []string, abis []string, bytecodes []string, fsigs []map[string]
// Normalize the method for capital cases and non-anonymous inputs/outputs
normalized := original
normalizedName := methodNormalizer[lang](alias(aliases, original.Name))

// Ensure there is no duplicated identifier
var identifiers = callIdentifiers
if !original.IsConstant() {
identifiers = transactIdentifiers
}
// Name shouldn't start with a digit. It will make the generated code invalid.
if len(normalizedName) > 0 && unicode.IsDigit(rune(normalizedName[0])) {
normalizedName = fmt.Sprintf("M%s", normalizedName)
normalizedName = abi.ResolveNameConflict(normalizedName, func(name string) bool {
_, ok := identifiers[name]
return ok
})
}
if identifiers[normalizedName] {
return "", fmt.Errorf("duplicated identifier \"%s\"(normalized \"%s\"), use --alias for renaming", original.Name, normalizedName)
}
Expand Down Expand Up @@ -182,6 +189,14 @@ func Bind(types []string, abis []string, bytecodes []string, fsigs []map[string]

// Ensure there is no duplicated identifier
normalizedName := methodNormalizer[lang](alias(aliases, original.Name))
// Name shouldn't start with a digit. It will make the generated code invalid.
if len(normalizedName) > 0 && unicode.IsDigit(rune(normalizedName[0])) {
normalizedName = fmt.Sprintf("E%s", normalizedName)
normalizedName = abi.ResolveNameConflict(normalizedName, func(name string) bool {
_, ok := eventIdentifiers[name]
return ok
})
}
if eventIdentifiers[normalizedName] {
return "", fmt.Errorf("duplicated identifier \"%s\"(normalized \"%s\"), use --alias for renaming", original.Name, normalizedName)
}
Expand Down
23 changes: 23 additions & 0 deletions accounts/abi/bind/bind_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2038,6 +2038,29 @@ var bindTests = []struct {
t.Errorf("error deploying the contract: %v", err)
}
`,
}, {
name: "NumericMethodName",
contract: `
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.22 <0.9.0;

contract NumericMethodName {
event _1TestEvent(address _param);
function _1test() public pure {}
function __1test() public pure {}
function __2test() public pure {}
}
`,
bytecode: []string{"0x6080604052348015600f57600080fd5b5060958061001e6000396000f3fe6080604052348015600f57600080fd5b5060043610603c5760003560e01c80639d993132146041578063d02767c7146049578063ffa02795146051575b600080fd5b60476059565b005b604f605b565b005b6057605d565b005b565b565b56fea26469706673582212200382ca602dff96a7e2ba54657985e2b4ac423a56abe4a1f0667bc635c4d4371f64736f6c63430008110033"},
abi: []string{`[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_param","type":"address"}],"name":"_1TestEvent","type":"event"},{"inputs":[],"name":"_1test","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"__1test","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"__2test","outputs":[],"stateMutability":"pure","type":"function"}]`},
imports: `
"github.com/ethereum/go-ethereum/common"
`,
tester: `
if b, err := NewNumericMethodName(common.Address{}, nil); b == nil || err != nil {
t.Fatalf("combined binding (%v) nil or error (%v) not nil", b, nil)
}
`,
},
}

Expand Down
2 changes: 1 addition & 1 deletion accounts/abi/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func NewError(name string, inputs Arguments) Error {
}
}

func (e *Error) String() string {
func (e Error) String() string {
return e.str
}

Expand Down
67 changes: 67 additions & 0 deletions beacon/merkle/merkle.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Copyright 2022 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// Package merkle implements proof verifications in binary merkle trees.
package merkle

import (
"crypto/sha256"
"errors"
"reflect"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
)

// Value represents either a 32 byte leaf value or hash node in a binary merkle tree/partial proof.
type Value [32]byte

// Values represent a series of merkle tree leaves/nodes.
type Values []Value

var valueT = reflect.TypeOf(Value{})

// UnmarshalJSON parses a merkle value in hex syntax.
func (m *Value) UnmarshalJSON(input []byte) error {
return hexutil.UnmarshalFixedJSON(valueT, input, m[:])
}

// VerifyProof verifies a Merkle proof branch for a single value in a
// binary Merkle tree (index is a generalized tree index).
func VerifyProof(root common.Hash, index uint64, branch Values, value Value) error {
hasher := sha256.New()
for _, sibling := range branch {
hasher.Reset()
if index&1 == 0 {
hasher.Write(value[:])
hasher.Write(sibling[:])
} else {
hasher.Write(sibling[:])
hasher.Write(value[:])
}
hasher.Sum(value[:0])
if index >>= 1; index == 0 {
return errors.New("branch has extra items")
}
}
if index != 1 {
return errors.New("branch is missing items")
}
if common.Hash(value) != root {
return errors.New("root mismatch")
}
return nil
}
39 changes: 24 additions & 15 deletions consensus/ethash/mmap_help_linux.go → beacon/params/params.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 The go-ethereum Authors
// Copyright 2022 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
Expand All @@ -14,22 +14,31 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

//go:build linux
// +build linux
package params

package ethash
const (
EpochLength = 32
SyncPeriodLength = 8192

import (
"os"
BLSSignatureSize = 96
BLSPubkeySize = 48

"golang.org/x/sys/unix"
SyncCommitteeSize = 512
SyncCommitteeBitmaskSize = SyncCommitteeSize / 8
SyncCommitteeSupermajority = (SyncCommitteeSize*2 + 2) / 3
)

// ensureSize expands the file to the given size. This is to prevent runtime
// errors later on, if the underlying file expands beyond the disk capacity,
// even though it ostensibly is already expanded, but due to being sparse
// does not actually occupy the full declared size on disk.
func ensureSize(f *os.File, size int64) error {
// Docs: https://www.man7.org/linux/man-pages/man2/fallocate.2.html
return unix.Fallocate(int(f.Fd()), 0, 0, size)
}
const (
StateIndexGenesisTime = 32
StateIndexGenesisValidators = 33
StateIndexForkVersion = 141
StateIndexLatestHeader = 36
StateIndexBlockRoots = 37
StateIndexStateRoots = 38
StateIndexHistoricRoots = 39
StateIndexFinalBlock = 105
StateIndexSyncCommittee = 54
StateIndexNextSyncCommittee = 55
StateIndexExecPayload = 56
StateIndexExecHead = 908
)
Loading