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

Upstream merge 1.13 #1287

Closed
wants to merge 193 commits into from
Closed
Changes from 9 commits
Commits
Show all changes
193 commits
Select commit Hold shift + click to select a range
4410c14
params: begin v1.13.7 release cycle
fjl Dec 18, 2023
54a400e
internal/ethapi: ethSendTransaction check baseFee (#27834)
jsvisa Dec 18, 2023
cd58897
core/rawdb: implement size reporting for live items in freezer_table …
wangyifan Dec 18, 2023
952b343
build: make linter emit output (#28704)
holiman Dec 19, 2023
5a9dda6
.travis: set lower GOGC value (#28705)
holiman Dec 19, 2023
435bed5
ci: disable lint on travis (#28706)
holiman Dec 19, 2023
0cc192b
build(deps): bump golang.org/x/crypto from 0.15.0 to 0.17.0 (#28702)
dependabot[bot] Dec 19, 2023
3fd5688
params: go-ethereum v1.13.7 stable
fjl Dec 19, 2023
c3d9ca6
all: release go-ethereum v1.13.7
fjl Dec 19, 2023
9258a44
params: begin go-ethereum v1.13.8 release cycle
fjl Dec 19, 2023
7124057
internal/build: fix crash in MustRunCommandWithOutput (#28709)
fjl Dec 20, 2023
d3452a2
accounts: properly close managed wallets when closing manager (#28710)
holiman Dec 20, 2023
8c2d455
build: upgrade to golangci-lint v1.55.2 (#28712)
fjl Dec 20, 2023
577be37
cmd/devp2p: update eth/snap protocol test suites for PoS (#28340)
lightclient Dec 20, 2023
cca9479
core, cmd, trie: fix the condition of pathdb initialization (#28718)
rjl493456442 Dec 21, 2023
f469470
core/rawdb: improve state scheme checking (#28724)
rjl493456442 Dec 22, 2023
904a278
params: go-ethereum v1.13.8 stable
holiman Dec 22, 2023
b20b4a7
all: release go-ethereum v1.13.8
holiman Dec 22, 2023
8d03918
params: begin v1.13.9 release cycle
holiman Dec 22, 2023
d2e3cb8
core/state: logic equivalence for GetCodeHash (#28733)
cygaar Dec 26, 2023
b5b7003
tests: add currentExcessBlobGas to state tests (#28735)
marioevz Dec 28, 2023
09e0208
accounts,signer: fix typos in comments (#28730)
taeguk Dec 28, 2023
76a5474
build: add support for ubuntu 23.10 (mantic minotaur) (#28728)
holiman Dec 30, 2023
c053eb7
log: avoid setting default slog logger in init (#28747)
fjl Dec 30, 2023
33c94ef
cmd/evm: fix link in README.md (#28755)
ddl-hust Jan 2, 2024
2365d77
core/vm: update comments to match eip number (#28743)
darioush Jan 2, 2024
0b471c3
cmd/evm: Fix blob-gas-used on invalid transactions in t8n (#28734)
marioevz Jan 3, 2024
99eb49e
internal/flags: update copyright year to 2024 (#28760)
sandakersmann Jan 4, 2024
e3eeb64
ethclient: simplify error handling in TransactionReceipt (#28748)
rosenk Jan 4, 2024
877d094
eth/downloader, eth/filters: use defer to call Unsubscribe (#28762)
ucwong Jan 5, 2024
07b17f9
log: emit error level string as "error", not "eror" (#28774)
jwasinger Jan 8, 2024
e7fa158
eth/filters: fix early Unsubscribe of log events (#28769)
ucwong Jan 8, 2024
f29520f
cmd/devp2p/internal/ethtest: fix typos in comments (#28772)
vuittont60 Jan 8, 2024
cfff3cb
params, core/forkid: schedule cancun fork on goerli (#28719)
MariusVanDerWijden Jan 8, 2024
1010a79
cmd/geth: make it possible to autopilot removedb (#28725)
holiman Jan 9, 2024
d0edc5a
accounts/abi: fix bigInt topic encoding (#28764)
rjl493456442 Jan 9, 2024
9e018ce
cmd/geth: update log test data (#28780)
jwasinger Jan 9, 2024
2d08c99
ethclient/simulated: implement new sim backend (#28202)
MariusVanDerWijden Jan 10, 2024
4f82531
params: go-ethereum v1.13.9 stable
fjl Jan 10, 2024
dd938d1
Merge branch 'master' into release/1.13
fjl Jan 10, 2024
daa2e5d
params: begin v1.13.10 release cycle
fjl Jan 10, 2024
a162091
version: release v1.13.10 to fix bad tag
karalabe Jan 11, 2024
bc0be1b
Merge branch 'master' into release/1.13
karalabe Jan 11, 2024
2e8b118
params: begin v1.13.11 release cycle
karalabe Jan 11, 2024
5c2de7f
docs: fix badge in README (#28796)
drstevenbrule Jan 12, 2024
6e235c0
eth: minor change of config-accessor (#28782)
0xmountaintop Jan 12, 2024
ae4ea04
cmd: fix typos (#28798)
vuittont60 Jan 12, 2024
7280a5b
build: fix typo in comment (#28800)
drstevenbrule Jan 12, 2024
065f82a
accounts, ethclient: minor tweaks on the new simulated backend (#28799)
karalabe Jan 12, 2024
43ba7d6
cmd/geth, internal/debug: get rid of by-default log config (#28801)
karalabe Jan 12, 2024
a608c0a
cmd/devp2p/internal/ethtest: skip large tx test on github build (#28794)
s1na Jan 12, 2024
1335ba5
p2p/dnsdisc: use strings.Cut over strings.IndexByte (#28787)
ddl-hust Jan 12, 2024
407f779
internal/ethapi: avoid using pending for defaults (#28784)
s1na Jan 12, 2024
29b7355
core/state: unexport GetOrNewStateObject (#28804)
darioush Jan 14, 2024
1485814
cmd/rlpdump: add -pos flag, displaying byte positions (#28785)
fjl Jan 14, 2024
89ccc68
tests: update reference tests (#28778)
holiman Jan 15, 2024
7596db5
ethclient: add tests for TransactionInBlock (#28283)
hyunchel Jan 15, 2024
18e154e
eth: fix potential hang in waitSnapExtension (#28744)
niuxiaojie81 Jan 15, 2024
9ee6809
core/txpool/blobpool: fix typos
alfiedotwtf Jan 15, 2024
566754c
acounts/usbwallet: fix typo (#28815)
bodhi-crypo Jan 15, 2024
d4f25b4
tests: more verbosity if block decoding fails (#28814)
holiman Jan 16, 2024
c66ca8b
tracer: use proper base fee in tests (#28775)
palango Jan 16, 2024
2e2e89c
miner: fix typo in payload_building_test.go (#28825)
Thabokani Jan 17, 2024
e5d5e09
internal/ethapi: handle blobs in API methods (#28786)
s1na Jan 17, 2024
830f3c7
eth/filters: reset filter.begin in BenchmarkFilters (#28830)
darioush Jan 18, 2024
0e93da3
crypto/kzg4844: add helpers for versioned blob hashes (#28827)
fjl Jan 19, 2024
1c48829
ethclient: apply accessList field in toCallArg (#28832)
colinlyguo Jan 19, 2024
f55a10b
params, core/forkid: enable cancun on sepolia and holesky (#28834)
MariusVanDerWijden Jan 20, 2024
78a3c32
core, core/rawdb, eth/sync: no tx indexing during snap sync (#28703)
rjl493456442 Jan 22, 2024
6a724b9
docs: remove reference to being official (#28858)
holiman Jan 23, 2024
19d9977
go.{mod,sum}: upgrade go-ole to support arm64 (#28859)
gballet Jan 23, 2024
819a497
core: fix genesis setup in benchReadChain (#28856)
darioush Jan 23, 2024
a5a4fa7
all: use uint256 in state (#28598)
holiman Jan 23, 2024
4c8d92d
build: upgrade -dlgo version to Go 1.21.6 (#28836)
sandakersmann Jan 23, 2024
c89a3da
core/state/snapshot: use AddHash/ContainHash instead of Hasher interf…
MariusVanDerWijden Jan 23, 2024
2dc7477
core/vm: fix misleading comment (#28860)
trocher Jan 23, 2024
98eaa57
eth/catalyst: add timestamp checks to fcu and new payload and improve…
lightclient Jan 23, 2024
542c861
core/txpool, eth/catalyst: fix racy simulator due to txpool backgroun…
karalabe Jan 23, 2024
6b0de79
core: move tx indexer to its own file (#28857)
rjl493456442 Jan 23, 2024
a8a8758
eth/catalyst: prefix payload id with version (#28246)
lightclient Jan 24, 2024
765f290
ethclient: fix flaky test (#28864)
rjl493456442 Jan 24, 2024
99dc3fe
params: go-ethereum v1.13.11 stable
holiman Jan 24, 2024
8f7eb9c
all: release go-ethereum v1.13.11 (#28868)
holiman Jan 24, 2024
cd0770e
params: begin v.1.13.12 release cycle
holiman Jan 24, 2024
bc0b87c
internal/flags: fix typo (#28876)
bodhi-crypo Jan 26, 2024
2e947b7
core/types: fix and test handling of faulty nil-returning signer (#28…
protolambda Jan 27, 2024
db98cc4
README.md: fix travis badge (#28889)
keienWang Jan 29, 2024
e2778cd
eth/catalyst: allow payload attributes v1 in fcu v2 (#28882)
lightclient Jan 29, 2024
fc380f5
docs/postmortems: fix outdated link (#28893)
keienWang Jan 29, 2024
eaac53e
core: reset tx lookup cache if necessary (#28865)
rjl493456442 Jan 30, 2024
3adf1ce
build: fix problem with windows line-endings in CI download (#28900)
holiman Jan 31, 2024
5c67066
eth/downloader: fix skeleton cleanup (#28581)
rjl493456442 Jan 31, 2024
06a8711
deps: update memsize (#28916)
holiman Feb 2, 2024
62affdc
core/txpool/blobpool: post-crash cleanup and addition/removal metrics…
karalabe Feb 2, 2024
47d76c5
core/txpool: don't inject lazy resolved transactions into the contain…
karalabe Feb 2, 2024
253447a
core/types: fix typo (#28922)
zoereco Feb 4, 2024
19af900
p2p: fix accidental termination of portMappingLoop (#28911)
ziogaschr Feb 5, 2024
8ec638d
internal/flags: fix --miner.gasprice default listing (#28932)
karalabe Feb 5, 2024
8fd43c8
all: fix typos in comments (#28881)
rex4539 Feb 5, 2024
99e9c07
Makefile: add help target to display available targets (#28845)
Halimao Feb 5, 2024
0b5d8d2
core: cache transaction indexing tail in memory (#28908)
rjl493456442 Feb 6, 2024
16ce7bf
eth, miner: fix enforcing the minimum miner tip (#28933)
karalabe Feb 6, 2024
199e0c9
core/state, core/vm: minor uint256 related perf improvements (#28944)
lmittmann Feb 7, 2024
1f50aa7
cmd,internal/era: implement `export-history` subcommand (#26621)
lightclient Feb 7, 2024
449d3f0
core,params: add holesky to default genesis function (#28903)
lightclient Feb 7, 2024
69f5d5b
node, rpc: add configurable HTTP request limit (#28948)
fjl Feb 7, 2024
2ab365f
all: fix docstring names (#28923)
zoereco Feb 7, 2024
2dc33d4
ethclient/simulated: fix typo (#28952)
bodhi-crypo Feb 8, 2024
ae3b7a0
eth/gasprice: fix percentile validation in eth_feeHistory (#28954)
fjl Feb 8, 2024
8a76a81
cmd/devp2p, eth: drop support for eth/67 (#28956)
karalabe Feb 8, 2024
2732fb1
params, core/forkid: add mainnet timestamp for Cancun (#28958)
lightclient Feb 8, 2024
ac5aa67
internal/ethapi: add support for blobs in eth_fillTransaction (#28839)
s1na Feb 8, 2024
85938dd
internal/era: update block index format to be based on record offset …
lightclient Feb 9, 2024
8facf44
params: go-ethereum v1.13.12 stable
holiman Feb 9, 2024
02eb36a
all: release go-ethereum v1.13.12 (#28961)
holiman Feb 9, 2024
89575ae
params: begin v1.13.13 release cycle
holiman Feb 9, 2024
f0c5b67
build: remove ubuntu 'lunar' build (#28962)
holiman Feb 9, 2024
1a79089
fix: update outdated link to trezor docs (#28966)
krauspt Feb 9, 2024
f1c27c2
internal/ethapi: fix gas estimation bug in eth_fillTransaction for bl…
mask-pp Feb 9, 2024
beb2954
core/txpool/legacypool: use uint256.Int instead of big.Int (#28606)
weiihann Feb 13, 2024
4c15d58
internal/ethapi, signer/core: fix documentation-links (#28979)
lindlof Feb 13, 2024
fe91d47
all: remove the dependency from trie to triedb (#28824)
rjl493456442 Feb 13, 2024
55a46c3
cmd/utils: fix merge-breakage in test (#28985)
holiman Feb 14, 2024
8321fe2
tests: fix goroutine leak related to state snapshot generation (#28974)
holiman Feb 14, 2024
9d537f5
ethereum, ethclient: add blob transaction fields in CallMsg (#28989)
mask-pp Feb 15, 2024
efddedc
core/txpool/blobpool: rename variables in comments (#28981)
bkellerman Feb 15, 2024
2a1d94b
cmd/devp2p: fix modulo in makeBlobTxs (#28970)
colinlyguo Feb 15, 2024
9e3e466
eth/catalyst,beacon/engine: implement GetClientVersionV1 (#28915)
lightclient Feb 15, 2024
886f0e7
tests: update execution spec tests + split statetest exec (#28993)
holiman Feb 15, 2024
2860906
eth/catalyst: add getClientVersion to capabilities (#28994)
MariusVanDerWijden Feb 15, 2024
0c412dc
cmd/evm: fix typo in test script (#28995)
bodhi-crypo Feb 15, 2024
1bdf8b9
cmd/devp2p/internal/ethtest: some fixes for the eth test suite (#28996)
fjl Feb 15, 2024
a193bb0
core/txpool/legacypool: remove a redundant heap.Init (#28910)
colinlyguo Feb 15, 2024
3c30de2
core/txpool/blobpool: update the blob db with corruption handling (#2…
karalabe Feb 16, 2024
95741b1
core: move genesis alloc types to core/types (#29003)
s1na Feb 16, 2024
593e303
core/txpool, eth, miner: pre-filter dynamic fees during pending tx re…
karalabe Feb 17, 2024
034bc46
ethstats: prevent panic if head block is not available (#29020)
rjl493456442 Feb 19, 2024
5d98479
core: using math.MaxUint64 instead of 0xffffffffffffffff (#29022)
cuiweixie Feb 19, 2024
6fb0d09
core/txpool, miner: speed up blob pool pending retrievals (#29008)
karalabe Feb 19, 2024
ac0ff04
core/vm, params: ensure order of forks, prevent overflow (#29023)
holiman Feb 19, 2024
f4852b8
core/txpool, eth, miner: retrieve plain and blob txs separately (#29026)
karalabe Feb 20, 2024
7f5e96d
core/txpool: fix typo (#29031)
buddh0 Feb 20, 2024
bba3fa9
core,eth,internal: fix typo (#29024)
buddh0 Feb 20, 2024
79e340f
params: add cancun upgrade banner (#29042)
tmelhao Feb 21, 2024
b9ca38b
core/txpool: fix typo (#29036)
colinlyguo Feb 21, 2024
b47cf8f
internal/ethapi: fix defaults for blob fields (#29037)
s1na Feb 21, 2024
3b4ede7
params: release go-ethereum v1.13.13 stable
fjl Feb 21, 2024
7f131dc
Merge branch 'master' into release/1.13
fjl Feb 21, 2024
b590cae
params: begin v1.13.14 release cycle
fjl Feb 21, 2024
e47a7c2
internal/ethapi: use overriden baseFee for gasPrice (#29051)
ArtificialPB Feb 22, 2024
b87b9b4
internal/ethapi:fix zero rpc gas cap in eth_createAccessList (#28846)
colinlyguo Feb 22, 2024
93c541a
eth/catalyst: fix wrong error message of payloadV2 after cancun (#29049)
tmelhao Feb 23, 2024
32d4d6e
core/txpool: reject blob txs with blob fee cap below the minimum (#29…
Feb 26, 2024
26724fc
p2p, log, rpc: use errors.New to replace fmt.Errorf with no parameter…
0x2d3c Feb 26, 2024
edffacc
eth/catalyst: enable some commented-out testcases   (#29073)
cuiweixie Feb 26, 2024
8bca93e
internal/ethapi: pass blob hashes to gas estimation (#29085)
mask-pp Feb 26, 2024
821d702
cmd/clef: add spaces in README.md table (#29077)
justindhillon Feb 26, 2024
c1f59b9
eth/catalyst: remove variable in tx conversion loop (#29076)
cuiweixie Feb 26, 2024
63aaac8
core/txpool/blobpool: reduce default database cap for rollout (#29090)
karalabe Feb 26, 2024
45a272c
core/txpool: no need to log loud rotate if no local txs (#29083)
jsvisa Feb 26, 2024
5a0f468
eth/tracers: Fix callTracer logs on onlyTopCall == true (#29068)
andreisilviudragnea Feb 27, 2024
51b479e
core/txpool: elevate the 'already reserved' error into a constant (#2…
Feb 27, 2024
9038ba6
params: release Geth v1.13.14
karalabe Feb 27, 2024
2bd6bd0
Merge branch 'master' into release/1.13
karalabe Feb 27, 2024
5dcf503
eth/protocols/snap: skip retrieval for completed storages (#29378)
rjl493456442 Apr 10, 2024
e343ddf
core/rawdb: add sanity-limit to header accessor (#29534)
holiman Apr 15, 2024
7bcb553
eth/filters: enforce topic-limit early on filter criterias (#29535)
holiman Apr 15, 2024
35e0525
core, eth/protocols/snap, trie: fix cause for snap-sync corruption, i…
rjl493456442 Apr 16, 2024
c5ba367
params: release Geth v 1.13.15
holiman Apr 16, 2024
3278c79
Merge pull request #1254 from maticnetwork/upstream_merge
pratikspatil024 May 29, 2024
d8374ec
bump version to v1.3.3-beta
manav2401 May 30, 2024
a0acefc
eth: broadcast block to static and trusted peers as well (#1258)
pratikspatil024 Jun 6, 2024
c0d1fbb
Fix panic when fetching block in case of reorg (#1259)
pratikspatil024 Jun 6, 2024
5b0805d
version bump to 1.3.3-beta2
pratikspatil024 Jun 6, 2024
57b77e3
chg: fix percentile validation in fee history (#1235)
marcello33 May 1, 2024
e28c203
remove additional bootnodes (#1255)
anshalshukla Jun 6, 2024
6bc8334
eth/fetcher: modify queue limits for improving sync near chain tip (#…
manav2401 Jun 7, 2024
2aa76a9
eth: change block propagation and announcement logs to debug
manav2401 Jun 10, 2024
e6a4625
bump version to v1.3.3-beta3
manav2401 Jun 10, 2024
1351a54
p2p/discover: improved node revalidation (#29572)
fjl May 23, 2024
706cf1c
p2p/discover: fix crash when revalidated node is removed (#29864)
fjl May 28, 2024
be1e580
p2p/enode: fix endpoint determination for IPv6 (#29801)
fjl May 23, 2024
b2c178d
p2p/enode: fix TCPEndpoint (#29827)
AaronChen0 May 23, 2024
7850a9f
p2p/discover: fix update logic in handleAddNode (#29836)
lightclient May 28, 2024
0e093b2
p2p/discover: refactor node and endpoint representation (#29844)
fjl May 29, 2024
642f552
p2p: fix race in dialScheduler (#29235)
fjl Mar 12, 2024
22670cd
version bump to 1.3.3
pratikspatil024 Jun 12, 2024
625774f
Merge pull request #1265 from maticnetwork/1.3.3-candidate
pratikspatil024 Jun 12, 2024
d0a212b
Merge pull request #1266 from maticnetwork/master
pratikspatil024 Jun 12, 2024
d67620c
core, eth, internal, miner, params: enforce 30gwei for gas related co…
marcello33 Jun 12, 2024
bd5d54e
Merge pull request #1267 from maticnetwork/psp-p2p-upstream
pratikspatil024 Jun 13, 2024
0d20e24
chore: fix some function names (#1257)
dufucun Jun 20, 2024
f4c41e2
Merge branch 'release/1.13' into upstream_merge_1.13
anshalshukla Jul 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -9,18 +9,6 @@ jobs:
- azure-osx

include:
# This builder only tests code linters on latest version of Go
- stage: lint
os: linux
dist: bionic
go: 1.21.x
env:
- lint
git:
submodules: false # avoid cloning ethereum/tests
script:
- go run build/ci.go lint

# These builders create the Docker sub-images for multi-arch push and each
# will attempt to push the multi-arch image if they are the last builder
- stage: build
2 changes: 1 addition & 1 deletion build/ci.go
Original file line number Diff line number Diff line change
@@ -366,7 +366,7 @@ func doLint(cmdline []string) {

linter := downloadLinter(*cachedir)
lflags := []string{"run", "--config", ".golangci.yml"}
build.MustRunCommand(linter, append(lflags, packages...)...)
build.MustRunCommandWithOutput(linter, append(lflags, packages...)...)
fmt.Println("You have achieved perfection.")
}

39 changes: 29 additions & 10 deletions core/rawdb/freezer_table.go
Original file line number Diff line number Diff line change
@@ -467,6 +467,20 @@ func (t *freezerTable) truncateHead(items uint64) error {
return nil
}

// sizeHidden returns the total data size of hidden items in the freezer table.
// This function assumes the lock is already held.
func (t *freezerTable) sizeHidden() (uint64, error) {
hidden, offset := t.itemHidden.Load(), t.itemOffset.Load()
if hidden <= offset {
return 0, nil
}
indices, err := t.getIndices(hidden-1, 1)
if err != nil {
return 0, err
}
return uint64(indices[1].offset), nil
}

// truncateTail discards any recent data before the provided threshold number.
func (t *freezerTable) truncateTail(items uint64) error {
t.lock.Lock()
@@ -495,6 +509,12 @@ func (t *freezerTable) truncateTail(items uint64) error {
newTail.unmarshalBinary(buffer)
newTailId = newTail.filenum
}
// Save the old size for metrics tracking. This needs to be done
// before any updates to either itemHidden or itemOffset.
oldSize, err := t.sizeNolock()
if err != nil {
return err
}
// Update the virtual tail marker and hidden these entries in table.
t.itemHidden.Store(items)
if err := writeMetadata(t.meta, newMetadata(items)); err != nil {
@@ -509,18 +529,12 @@ func (t *freezerTable) truncateTail(items uint64) error {
if t.tailId > newTailId {
return fmt.Errorf("invalid index, tail-file %d, item-file %d", t.tailId, newTailId)
}
// Hidden items exceed the current tail file, drop the relevant
// data files. We need to truncate, save the old size for metrics
// tracking.
oldSize, err := t.sizeNolock()
if err != nil {
return err
}
// Count how many items can be deleted from the file.
var (
newDeleted = items
deleted = t.itemOffset.Load()
)
// Hidden items exceed the current tail file, drop the relevant data files.
for current := items - 1; current >= deleted; current -= 1 {
if _, err := t.index.ReadAt(buffer, int64((current-deleted+1)*indexEntrySize)); err != nil {
return err
@@ -680,6 +694,7 @@ func (t *freezerTable) releaseFilesBefore(num uint32, remove bool) {
func (t *freezerTable) getIndices(from, count uint64) ([]*indexEntry, error) {
// Apply the table-offset
from = from - t.itemOffset.Load()

// For reading N items, we need N+1 indices.
buffer := make([]byte, (count+1)*indexEntrySize)
if _, err := t.index.ReadAt(buffer, int64(from*indexEntrySize)); err != nil {
@@ -870,14 +885,18 @@ func (t *freezerTable) size() (uint64, error) {
return t.sizeNolock()
}

// sizeNolock returns the total data size in the freezer table without obtaining
// the mutex first.
// sizeNolock returns the total data size in the freezer table. This function
// assumes the lock is already held.
func (t *freezerTable) sizeNolock() (uint64, error) {
stat, err := t.index.Stat()
if err != nil {
return 0, err
}
total := uint64(t.maxFileSize)*uint64(t.headId-t.tailId) + uint64(t.headBytes) + uint64(stat.Size())
hidden, err := t.sizeHidden()
if err != nil {
return 0, err
}
total := uint64(t.maxFileSize)*uint64(t.headId-t.tailId) + uint64(t.headBytes) + uint64(stat.Size()) - hidden
return total, nil
}

33 changes: 33 additions & 0 deletions core/rawdb/freezer_table_test.go
Original file line number Diff line number Diff line change
@@ -658,6 +658,13 @@ func TestFreezerOffset(t *testing.T) {
}
}

func assertTableSize(t *testing.T, f *freezerTable, size int) {
t.Helper()
if got, err := f.size(); got != uint64(size) {
t.Fatalf("expected size of %d bytes, got %d, err: %v", size, got, err)
}
}

func TestTruncateTail(t *testing.T) {
t.Parallel()
rm, wm, sg := metrics.NewMeter(), metrics.NewMeter(), metrics.NewGauge()
@@ -692,6 +699,9 @@ func TestTruncateTail(t *testing.T) {
5: getChunk(20, 0xaa),
6: getChunk(20, 0x11),
})
// maxFileSize*fileCount + headBytes + indexFileSize - hiddenBytes
expected := 20*7 + 48 - 0
assertTableSize(t, f, expected)

// truncate single element( item 0 ), deletion is only supported at file level
f.truncateTail(1)
@@ -707,6 +717,8 @@ func TestTruncateTail(t *testing.T) {
5: getChunk(20, 0xaa),
6: getChunk(20, 0x11),
})
expected = 20*7 + 48 - 20
assertTableSize(t, f, expected)

// Reopen the table, the deletion information should be persisted as well
f.Close()
@@ -739,6 +751,8 @@ func TestTruncateTail(t *testing.T) {
5: getChunk(20, 0xaa),
6: getChunk(20, 0x11),
})
expected = 20*5 + 36 - 0
assertTableSize(t, f, expected)

// Reopen the table, the above testing should still pass
f.Close()
@@ -760,6 +774,23 @@ func TestTruncateTail(t *testing.T) {
6: getChunk(20, 0x11),
})

// truncate 3 more elements( item 2, 3, 4), the file 1 should be deleted
// file 2 should only contain item 5
f.truncateTail(5)
checkRetrieveError(t, f, map[uint64]error{
0: errOutOfBounds,
1: errOutOfBounds,
2: errOutOfBounds,
3: errOutOfBounds,
4: errOutOfBounds,
})
checkRetrieve(t, f, map[uint64][]byte{
5: getChunk(20, 0xaa),
6: getChunk(20, 0x11),
})
expected = 20*3 + 24 - 20
assertTableSize(t, f, expected)

// truncate all, the entire freezer should be deleted
f.truncateTail(7)
checkRetrieveError(t, f, map[uint64]error{
@@ -771,6 +802,8 @@ func TestTruncateTail(t *testing.T) {
5: errOutOfBounds,
6: errOutOfBounds,
})
expected = 12
assertTableSize(t, f, expected)
}

func TestTruncateHead(t *testing.T) {
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -62,10 +62,10 @@ require (
github.com/tyler-smith/go-bip39 v1.1.0
github.com/urfave/cli/v2 v2.25.7
go.uber.org/automaxprocs v1.5.2
golang.org/x/crypto v0.15.0
golang.org/x/crypto v0.17.0
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
golang.org/x/sync v0.5.0
golang.org/x/sys v0.14.0
golang.org/x/sys v0.15.0
golang.org/x/text v0.14.0
golang.org/x/time v0.3.0
golang.org/x/tools v0.15.0
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -614,8 +614,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA=
golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g=
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@@ -774,8 +774,8 @@ golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
19 changes: 19 additions & 0 deletions internal/build/util.go
Original file line number Diff line number Diff line change
@@ -68,6 +68,25 @@ func MustRunCommand(cmd string, args ...string) {
MustRun(exec.Command(cmd, args...))
}

func MustRunCommandWithOutput(cmd string, args ...string) {
var done chan bool
// This is a little loop to generate some output, so CI does not tear down the
// process after 300 seconds.
go func() {
for i := 0; i < 15; i++ {
fmt.Printf("Waiting for command %q\n", cmd)
select {
case <-time.After(time.Minute):
break
case <-done:
return
}
}
}()
MustRun(exec.Command(cmd, args...))
close(done)
}

var warnedAboutGit bool

// RunGit runs a git subcommand and returns its output.
33 changes: 24 additions & 9 deletions internal/ethapi/transaction_args.go
Original file line number Diff line number Diff line change
@@ -137,20 +137,35 @@ func (args *TransactionArgs) setFeeDefaults(ctx context.Context, b Backend) erro
if args.GasPrice != nil && (args.MaxFeePerGas != nil || args.MaxPriorityFeePerGas != nil) {
return errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified")
}
// If the tx has completely specified a fee mechanism, no default is needed. This allows users
// who are not yet synced past London to get defaults for other tx values. See
// https://github.com/ethereum/go-ethereum/pull/23274 for more information.
// If the tx has completely specified a fee mechanism, no default is needed.
// This allows users who are not yet synced past London to get defaults for
// other tx values. See https://github.com/ethereum/go-ethereum/pull/23274
// for more information.
eip1559ParamsSet := args.MaxFeePerGas != nil && args.MaxPriorityFeePerGas != nil
if (args.GasPrice != nil && !eip1559ParamsSet) || (args.GasPrice == nil && eip1559ParamsSet) {
// Sanity check the EIP-1559 fee parameters if present.
if args.GasPrice == nil && args.MaxFeePerGas.ToInt().Cmp(args.MaxPriorityFeePerGas.ToInt()) < 0 {

// Sanity check the EIP-1559 fee parameters if present.
if args.GasPrice == nil && eip1559ParamsSet {
if args.MaxFeePerGas.ToInt().Sign() == 0 {
return errors.New("maxFeePerGas must be non-zero")
}
if args.MaxFeePerGas.ToInt().Cmp(args.MaxPriorityFeePerGas.ToInt()) < 0 {
return fmt.Errorf("maxFeePerGas (%v) < maxPriorityFeePerGas (%v)", args.MaxFeePerGas, args.MaxPriorityFeePerGas)
}
return nil
return nil // No need to set anything, user already set MaxFeePerGas and MaxPriorityFeePerGas
}
// Now attempt to fill in default value depending on whether London is active or not.
// Sanity check the non-EIP-1559 fee parameters.
head := b.CurrentHeader()
if b.ChainConfig().IsLondon(head.Number) {
isLondon := b.ChainConfig().IsLondon(head.Number)
if args.GasPrice != nil && !eip1559ParamsSet {
// Zero gas-price is not allowed after London fork
if args.GasPrice.ToInt().Sign() == 0 && isLondon {
return errors.New("gasPrice must be non-zero after london fork")
}
return nil // No need to set anything, user already set GasPrice
}

// Now attempt to fill in default value depending on whether London is active or not.
if isLondon {
// London is active, set maxPriorityFeePerGas and maxFeePerGas.
if err := args.setLondonFeeDefaults(ctx, head, b); err != nil {
return err
22 changes: 22 additions & 0 deletions internal/ethapi/transaction_args_test.go
Original file line number Diff line number Diff line change
@@ -52,6 +52,7 @@ func TestSetFeeDefaults(t *testing.T) {

var (
b = newBackendMock()
zero = (*hexutil.Big)(big.NewInt(0))
fortytwo = (*hexutil.Big)(big.NewInt(42))
maxFee = (*hexutil.Big)(new(big.Int).Add(new(big.Int).Mul(b.current.BaseFee, big.NewInt(2)), fortytwo.ToInt()))
al = &types.AccessList{types.AccessTuple{Address: common.Address{0xaa}, StorageKeys: []common.Hash{{0x01}}}}
@@ -66,13 +67,27 @@ func TestSetFeeDefaults(t *testing.T) {
&TransactionArgs{GasPrice: fortytwo},
nil,
},
{
"legacy tx pre-London with zero price",
false,
&TransactionArgs{GasPrice: zero},
&TransactionArgs{GasPrice: zero},
nil,
},
{
"legacy tx post-London, explicit gas price",
true,
&TransactionArgs{GasPrice: fortytwo},
&TransactionArgs{GasPrice: fortytwo},
nil,
},
{
"legacy tx post-London with zero price",
true,
&TransactionArgs{GasPrice: zero},
nil,
errors.New("gasPrice must be non-zero after london fork"),
},

// Access list txs
{
@@ -161,6 +176,13 @@ func TestSetFeeDefaults(t *testing.T) {
nil,
errors.New("maxFeePerGas (0x7) < maxPriorityFeePerGas (0x2a)"),
},
{
"dynamic fee tx post-London, explicit gas price",
true,
&TransactionArgs{MaxFeePerGas: zero, MaxPriorityFeePerGas: zero},
nil,
errors.New("maxFeePerGas must be non-zero"),
},

// Misc
{
2 changes: 1 addition & 1 deletion params/version.go
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ import (
const (
VersionMajor = 1 // Major version component of the current release
VersionMinor = 13 // Minor version component of the current release
VersionPatch = 6 // Patch version component of the current release
VersionPatch = 7 // Patch version component of the current release
VersionMeta = "stable" // Version metadata to append to the version string
)