-
Notifications
You must be signed in to change notification settings - Fork 20.3k
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
eth, les: rework chain tracer #25143
Conversation
b33c305
to
9da9e2e
Compare
I am syncing a goerli node at the moment and want to manually confirm chain tracing is not broken. |
I think this may have to do with me, can somebody guide me how to upgrade my node properly? |
@holiman I have carefully compared the memory usage/trace output with master. I am confident about this PR now.
Both master and PR will use additional 2,3GB memory after 40 minutes tracing, but the the real held memory(dirty cache of triedb) is limited by 500MB properly. So I guess it's just because the Golang GC doesn't release the memory very soon.
In my test scenario(goerli archive node), when the dirty cache size exceeds 500MB, it fallbacks to disk state. In this case master will always use disk state without proper releasing, eventually it's killed because of high memory usage. PR doesn't have this issue, can trace 70K blocks successfully. TL;DR, I think the PR itself is good, please take another look. |
open |
fef79d0
to
4e257bf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (haven't tested personally)
ec74ce9
to
7be3326
Compare
This PR simplifies the logic of chain tracer and also adds the unit tests. The most important change has been made in this PR is the state management. Whenever a tracing state is acquired there is a corresponding release function be returned as well. It must be called once the state is used up, otherwise resource leaking can happen. And also the logic of state management has been simplified a lot. Specifically, the state provider(eth backend, les backend) should ensure the state is available and referenced. State customers can use the state according to their own needs, or build other states based on the given state. But once the release function is called, there is no guarantee of the availability of the state. Co-authored-by: Sina Mahmoodi <[email protected]> Co-authored-by: Péter Szilágyi <[email protected]>
This PR simplifies the logic of chain tracer and also adds the unit tests. The most important change has been made in this PR is the state management. Whenever a tracing state is acquired there is a corresponding release function be returned as well. It must be called once the state is used up, otherwise resource leaking can happen. And also the logic of state management has been simplified a lot. Specifically, the state provider(eth backend, les backend) should ensure the state is available and referenced. State customers can use the state according to their own needs, or build other states based on the given state. But once the release function is called, there is no guarantee of the availability of the state. Co-authored-by: Sina Mahmoodi <[email protected]> Co-authored-by: Péter Szilágyi <[email protected]>
* cmd/faucet: add sepolia network support (ethereum#25128) cmd/faucet: Add Sepolia network support to faucet * trie: fix size accounting in cleaner (ethereum#25007) Decrease children size instead of dirties size when marking dirties as cleaned up in trie cleaner * all: remove concept of public/private API definitions (ethereum#25053) * internal/ethapi: rename PublicEthereumAPI to EthereumAPI * eth: rename PublicEthereumAPI to EthereumAPI * internal/ethapi: rename PublicTxPoolAPI to TxPoolAPI * internal/ethapi: rename PublicAccountAPI to EthereumAccountAPI * internal/ethapi: rename PrivateAccountAPI to PersonalAccountAPI * internal/ethapi: rename PublicBlockChainAPI to BlockChainAPI * internal/ethapi: rename PublicTransactionPoolAPI to TransactionAPI * internal/ethapi: rename PublicDebugAPI to DebugAPI * internal/ethapi: move PrivateDebugAPI methods to DebugAPI * internal/ethapi: rename PublicNetAPI to NetAPI * les: rename PrivateLightServerAPI to LightServerAPI * les: rename PrivateLightAPI to LightAPI * les: rename PrivateDebugAPI to DebugAPI * les: rename PublicDownloaderAPI to DownloaderAPI * eth,les: rename PublicFilterAPI to FilterAPI * eth: rename PublicMinerAPI to MinerAPI * eth: rename PublicDownloaderAPI to DownloaderAPI * eth: move PrivateMinerAPI methods to MinerAPI * eth: rename PrivateAdminAPI to AdminAPI * eth: rename PublicDebugAPI to DebugAPI * eth: move PrivateDebugAPI methods to DebugAPI * node: rename publicAdminAPI to adminAPI * node: move privateAdminAPI methods to adminAPI * node: rename publicWeb3API to web3API * eth,internal/ethapi: sync comments with previous renamings * cmd/geth: drop geth js command (ethereum#25000) * cmd/geth: drop js command * cmd: simplify ipc path determination for attach * Add deprecation warning for js * rm testdata for exec * fix account unlock test cases * Update cmd/geth/consolecmd.go Co-authored-by: Martin Holst Swende <[email protected]> * fix Co-authored-by: Martin Holst Swende <[email protected]> * README,rpc: remove mention of "shh" RPC API (ethereum#25137) * eth, miner: retrieve mining state from live database (ethereum#25139) * miner: retrieve mining state from live database * eth/catalyst: ignore stale fcu events from cl * core: fix typo in txpool (ethereum#25149) Fix typo in txPool truncateQueue comment * go.mod: upgrade to latest goleveldb (ethereum#25067) Co-authored-by: Felix Lange <[email protected]> * eth/tracers: optimize goja buffer conversion (ethereum#25156) This changes the []byte <-> Uint8Array conversion to use an ArrayBuffer, avoiding inefficient copying of the slice data in Goja. Co-authored-by: Felix Lange <[email protected]> * eth: fix typo (ethereum#25161) * internal/ethapi: always return chain id (ethereum#25166) The error was introduced in PR ethereum#21686, but there is no good reason to enforce sync in this method, and it causes issues with EL/CL integration. * internal/ethapi: add note about eth_chainId compatibility with EIP-695 (ethereum#25168) Co-authored-by: Felix Lange <[email protected]> * all: remove `public` field from `rpc.API` (ethereum#25059) all: remove public field from rpc.API * cmd: migrate to urfave/cli/v2 (ethereum#24751) This change updates our urfave/cli dependency to the v2 branch of the library. There are some Go API changes in cli v2: - Flag values can now be accessed using the methods ctx.Bool, ctx.Int, ctx.String, ... regardless of whether the flag is 'local' or 'global'. - v2 has built-in support for flag categories. Our home-grown category system is removed and the categories of flags are assigned as part of the flag definition. For users, there is only one observable difference with cli v2: flags must now strictly appear before regular arguments. For example, the following command is now invalid: geth account import mykey.json --password file.txt Instead, the command must be invoked as follows: geth account import --password file.txt mykey.json * params: set TTD for sepolia testnet (ethereum#25179) * cmd/geth, p2p: add support for custom discovery UDP port (ethereum#24979) This adds a new flag to set the discovery port to be different from the TCP listener port. Co-authored-by: Felix Lange <[email protected]> * fix: linter warning (ethereum#25192) * core/rawdb: fix typo in comment (ethereum#25191) * core/rawdb: simplify TestDiskSeek to use memorydb (ethereum#25182) * cmd/utils: fix applying bootstrap nodes from config file (ethereum#25174) * internal/ethapi: return chain id for EIP-155 legacy txs (ethereum#25155) * common: increase StorageSize test coverage (ethereum#25188) * consensus/beacon: check that only the latest pow block is valid ttd block (ethereum#25187) * consensus/beacon: check that only the latest pow block is valid ttd block * consensus/beacon: move verification to async function * consensus/beacon: fix verifyTerminalPoWBlock, add test cases * consensus/beacon: cosmetic changes * consensus/beacon: apply karalabe's fixes * build: fix auto-completion scripts and include them in .deb package (ethereum#25195) Co-authored-by: Felix Lange <[email protected]> * build: upgrade to golangci-lint v1.46.2 (ethereum#25202) This upgrade is required to fix lint issues with urfave/cli/v2, which uses generics when built with Go 1.18 * build/deb: fix auto-completion install paths (ethereum#25204) * params: go-ethereum v1.10.20 stable * params: begin v1.10.21 release cycle * common/prque: fix typo * eth/catalyst: disallow importing blocks via newPayload during snap sync (ethereum#25210) * eth/catalyst: disallow importing blocks via newPayload during snap sync * eth/catalyst: make tests pass by using full sync only * eth/catalysts: make the import delay a bit cleaner * eth/catalyst: fix typo Co-authored-by: Marius van der Wijden <[email protected]> Co-authored-by: Marius van der Wijden <[email protected]> * Replace fmt.Errorf with errors.New in abi argument (ethereum#25181) Replace unnecessary fmt.Errorf with errors.New in accounts/abi/argument.go * all: change format `0x%x` to `%#x` (ethereum#25221) * consensus/beacon: copy td value so we can modify it (ethereum#25230) * consensus/beacon: copy td value so we can modify it * consensus/beacon: copy td value so we can modify it * core: allow external code to set the block validator for malicious tests (ethereum#25119) * core: don't validate state * core: allow external validator * core: revert * core: comments * Update blockchain_reader.go * core: move SetValidator to blockchain.go * core: rename method * core: apply ttd override to uninitialized db (ethereum#25136) * core: apply ttd override to genesis block * core: apply overrides properly * signer/core/apitypes: support primitive types int96/uint96 (ethereum#25105) I have a EIP712 typehash using uint96, but it's currently not supported by go-ethereum. This change fixes it. * cmd/geth, cmd/devp2p: fix some cli parsing issues (ethereum#25234) * cmd/geth: add some missing argument count checks * internal/flags: skip cmds with no action func in MigrateGlobalFlags * internal/flags: add Merge * cmd/devp2p: re-add listener config flags in discv4 commands * core: allow external processor (ethereum#25233) * consensus/beacon: verify timestamp is greater than parent timestamp (ethereum#25236) * go.mod: updated logfmt dependency (ethereum#25231) This fixes an issue in abigen tests with go 1.17. * internal/ethapi: add basefee to block overrides (ethereum#25219) * trie: fix typo in comment (ethereum#25241) paralallel -> parallel * core/types: fix typo in comment (ethereum#25249) * internal/ethapi: fix chain ID check to return all non-zero IDs (ethereum#25244) * rpc: add graceful shutdown timeout for HTTP server (ethereum#25258) This change ensures the HTTP server will always terminate within at most 5s, even when all connections are busy and do not become idle. Co-authored-by: Felix Lange <[email protected]> * p2p/discover: fix typos in comments (ethereum#25272) * build: upgrade -dlgo version to Go 1.18.3 * core, eth: pre-allocate map in storage copy (ethereum#25279) * eth/tracers: add initial revertReasonTracer tracer (ethereum#25265) Adds a native tracer that returns that in case of failure returns the error message or the revert reason of a transaction. Co-authored-by: Martin Holst Swende <[email protected]> * params: enable DNS discovery on Sepolia too * internal/build: add a timestamp to the tar archive folder * build: upgrade -dlgo version to Go 1.18.4 * accounts/abi: fix typo in comment (ethereum#25271) * accounts/abi/bind/backends: return hash of new blocks (ethereum#25163) Co-authored-by: Jens <[email protected]> * all: remove version field from rpc.API * internal/ethapi: error if tx args includes chain id that doesn't match local (ethereum#25157) * internal/ethapi: error if tx args includes chain id that doesn't match local * internal/ethapi: simplify code a bit Co-authored-by: Péter Szilágyi <[email protected]> * core: remove lock in BlockChain.ExportN (ethereum#25254) * Remove locking in (*BlockChain).ExportN Since ExportN is read-only, it shouldn't need the lock. (?) * Add hash check to detect reorgs during export. * fix check order * Update blockchain.go * Update blockchain.go Co-authored-by: rjl493456442 <[email protected]> * core: prevent negative fee during RPC calls (ethereum#25214) During RPC calls such as eth_call and eth_estimateGas, st.evm.Config.NoBaseFee is set which allows the gas price to be below the base fee. This results the tip being negative, and balance being subtracted from the coinbase instead of added to it, which results in a potentially negative coinbase balance interestingly. This can't happen during normal chain processing as outside of RPC calls the gas price is required to be at least the base fee, as NoBaseFee is false. This change prevents this behavior by disabling fee payment when the fee is not set. Co-authored-by: [email protected] <[email protected]> Co-authored-by: Felix Lange <[email protected]> * core, les, eth: port snap sync changes (ethereum#24898) core, eth, les, trie: rework snap sync * tests: only activate merge on london rules (ethereum#25239) * trie: fix 'gosimple' lint issue (ethereum#25309) * p2p/discover: apply netrestrict in discv5 response handler (ethereum#25304) * cmd/geth: remove redundant 0x in dbGet/dbDelete (ethereum#25315) * accounts/abi: substitude arg%d to the range keyword (ethereum#25307) * accounts/abi: substitude arg%d to the range keyword * support more keywords * review feedback * params: Add Shanghai and Cancun blocks (ethereum#25305) * params: Add Shangai and Cancun blocks * fix copy/paste error Co-authored-by: Martin Holst Swende <[email protected]> * fix typo in Shanghai name Co-authored-by: Martin Holst Swende <[email protected]> * cmd/puppeth: remove support for exporting non-Geth genesis configurations (ethereum#25329) * cmd/puppeth: remove support for exporting non-Geth genesis configurations * remove unused function * params: set goerli TTD to 10_790_000 (ethereum#25324) * signer/core: add canonical TypedData hashing methods (ethereum#25283) * params: set sepolia mergeNetsplitBlock to 1735371 (ethereum#25372) * cmd/geth: eth/catalyst: enable authrpc by default (ethereum#25152) * cmd/geth: eth/catalyst: enable authrpc by default * eth/catalyst: rename catalyst -> Engine API in logs * eth/catalyst: don't panic * deps: update goleveldb * eth/catalyst: better warning for ttd not configured (ethereum#25394) * cmd: use flags.Merge for grouping flags (ethereum#25392) * consensus/beacon: fix typo in comment (ethereum#25391) * p2p/netutil: minor code cosmetic Signed-off-by: Abirdcfly <[email protected]> * eth, internal, light: fix error string capitalization (ethereum#25364) * light: fix differTries err message in tests (ethereum#25358) * all: add whitespace linter (ethereum#25312) * golangci: typo Signed-off-by: Delweng <[email protected]> * golangci: add whietspace Signed-off-by: Delweng <[email protected]> * *: rm whitesapce using golangci-lint Signed-off-by: Delweng <[email protected]> * cmd/puppeth: revert accidental resurrection Co-authored-by: Péter Szilágyi <[email protected]> * eth/tracers/js: fix capitalization in tests * eth: support bubbling up bad blocks from sync to the engine API (ethereum#25190) * eth: support bubbling up bad blocks from sync to the engine API * eth/catalyst: fix typo Co-authored-by: Marius van der Wijden <[email protected]> * eth/catalyst: fix typo Co-authored-by: Marius van der Wijden <[email protected]> * Update eth/catalyst/api.go * eth/catalyst: when forgetting bad hashes, also forget descendants * eth/catalyst: minor bad block tweaks for resilience Co-authored-by: Marius van der Wijden <[email protected]> Co-authored-by: Martin Holst Swende <[email protected]> * params: change Merge config to print simpler message This fixes ethereum#25366 * core: eth: rpc: implement safe rpc block (ethereum#25165) * core: eth: rpc: implement safe rpc block * core: fix setHead, panics * go.mod: downgrade leveldb (ethereum#25413) * params: go-ethereum v1.10.21 stable * params: begin v1.10.22 release cycle * core, trie, eth, cmd: rework preimage store (ethereum#25287) * core, trie, eth, cmd: rework preimage store * trie: address comment * eth/catalyst: fix NewPayload warn log when dropping due to snap sync * node: set JWT expiry to 60 seconds (ethereum#25416) * node: set JWT expiry to 60 seconds * node: rename var * eth/catalyst: return syncing not accepted (ethereum#25414) * eth/catalyst: return syncing not accepted * eth/catalyst: fix test * eth/catalyst: return 0x0 if latestvalid is pow block (ethereum#25423) * eth/catalyst: return 0x0 if latestvalid is pow block * eth/catalyst: return 0x0 if latestvalid is pow block * eth/catalyst: fix header retrieval, fix sign check Co-authored-by: Péter Szilágyi <[email protected]> * ethereum, ethclient: add FeeHistory support (ethereum#25403) Co-authored-by: Felix Lange <[email protected]> * all: use AbsTime.Add instead of conversion (ethereum#25417) * cm/puppeth: fix crash when of ethstats specifier doesn't contain `:` (ethereum#25405) Signed-off-by: Delweng <[email protected]> * eth: fix typo in comment (ethereum#25327) * common/compiler: json unmarshalling error checks (ethereum#25449) complier/solidity:add json.Unmarshal err check * cmd, core, eth, les, params: add merge-passed chain config (ethereum#24538) * cmd, core, eth, les, params: add merge-passed chain config * eth/catalyst, params: add various warning on malfunctioning beacons * eth/catalyst: fix warning for beacons without transition exchanges * eth: fix typo in catalyst api (ethereum#25460) eth: fix typo * eth/gasprice/feehistory: support finalized block (ethereum#25442) * build: upgrade -dlgo version to Go 1.18.5 * consensus/ethash: remove temp files created during DAG generation (ethereum#25381) This makes it remove not only the actual DAG file, but also the temporary file which the DAG data is written to while generating. * cmd/devp2p/internal/ethtest: update tests for eth/67 (ethereum#25306) * node, rpc: add ReadHeaderTimeout config option (ethereum#25338) This change makes http.Server.ReadHeaderTimeout configurable separately from ReadTimeout for RPC servers. The default is set to the same as ReadTimeout, which in order to cause no change in existing deployments. * core/types: fix typo in comment (ethereum#25359) * core: preallocate batch size in bloomIndexer (ethereum#25289) This change reduces allocations when committing bloombits indexes by creating the database batch with a larger initial size. * internal/ethapi: don't estimate gas if no limit provided in eth_createAccessList (ethereum#25467) Because the goal of eth_createAccessList is providing the caller with the largest-possible access list, it's generally not important that the gas limit used by the tracer will match the usage of the call exactly. Avoiding the gas estimation step is a performance improvement. As long as the call does not branch based on gas limit, the returned access list will be accurate. * graphql: embed *Resolver instead of backend interface (ethereum#25468) This creates some infrastructure to share resources between graphql API objects. * node: remove noop path.Join (ethereum#25475) Signed-off-by: Delweng <[email protected]> * core, trie: rework trie committer (ethereum#25320) * all: rework trie and trie committer * all: get rid of internal cache in trie * all: fixes * trie: polish * core, trie: address comments * trie: fix imports * core/state: address comments * core/state/snapshot: polish * trie: remove unused code * trie: update tests * trie: don't set db as nil * trie: address comments * trie: unskip test * core: use TryGetAccount to read what TryUpdateAccount has written (ethereum#25458) * core: use TryGetAccount to read where TryUpdateAccount has been used to write * Gary's review feedback * implement Gary's suggestion * fix bug + rename NewSecure into NewStateTrie * trie: add backwards-compatibility aliases for SecureTrie * Update database.go * make the linter happy Co-authored-by: Felix Lange <[email protected]> Co-authored-by: rjl493456442 <[email protected]> * cmd, core, ethdb, node: move chain freezer one folder deeper (ethereum#25487) * cmd, core, ethdb, node: create chain freezer in a sub folder * core/rawdb: remove unused code * core, ethdb, node: add AncientDatadir API back * cmd, core: extend freezer info dump for sub-ancient-store * core/rawdb: rework freezer inspector * core/rawdb: address comments from Peter * core/rawdb: fix build issue * eth/downloader: fix log errors of queue_test.go (ethereum#25494) * core: fix uncle creation in TestFastVsFullChains (ethereum#25476) Co-authored-by: Felix Lange <[email protected]> * eth: formatted error nit (ethereum#25499) * eth/tracers: add onlyTopCall option to callTracer (ethereum#25430) This PR allows users to pass in a config object directly to the tracers. Previously only the struct logger was configurable. It also adds an option to the call tracer which if enabled makes it ignore any subcall and collect only information about the top-level call. See ethereum#25419 for discussion. The tracers will silently ignore if they are passed a config they don't care about. * all: cleanup the APIs for initializing genesis (ethereum#25473) * all: polish tests * core: apply feedback from Guillaume * core: fix comment * signer/rules: register clef api properly when rules are used (ethereum#25455) signer/rules: register clef api properly when rules are used, fixes ethereum#25298 * core: remove unused bc ChainContext in applyTransaction * build: add static linking support (ethereum#25492) This adds support for building statically-linked executables using ci.go. Static linking is enabled by default in Docker builds, making it possible to use the geth executable in any Docker image, regardless of the Linux distribution the Dockerfile is based on. Co-authored-by: Felix Lange <[email protected]> * accounts/abi: display name in "method/event not found" error (ethereum#25512) * internal/ethapi: rework setDefaults for tx args so fee logic is separate (ethereum#25197) Co-authored-by: bobpkr <[email protected]> * core/genesis: remove calaverasAllocData (ethereum#25516) core/genesis: calaverasAllocData no longer used * params: set ttdpassed on goerli (ethereum#25519) * params: set mainnet terminal total difficulty for the merge (ethereum#25528) * params: set mainnet ttd to 58_750_000_000_000_000_000_000 * params: set mainnet ttd to 58_750_000_000_000_000_000_000 * core, trie: flush preimages to db on blockchain close (ethereum#25533) * core, trie: flush preimages to db on database close Co-authored-by: rjl493456442 <[email protected]> * rename Close to CommitPreimages for clarity * core, trie: nitpick fixes Co-authored-by: rjl493456442 <[email protected]> Co-authored-by: Péter Szilágyi <[email protected]> * core/state, trie, light: add a TryDeleteAccount method (ethereum#25531) * core/state, trie, light: Add a DeleteAccount method * review feedback * Update database.go * pr triage feedback Co-authored-by: rjl493456442 <[email protected]> * core: make tx journal check and open atomic (ethereum#25530) * core: reduce system call about `os` * avoid deprecated method * cmd. core: save preimages on genesis creation (ethereum#25538) force preimage dump for genesis * rlp/rlpgen: fix error handling when target type not found (ethereum#25547) typ will be nil when lookupStructType returns an error. cfg.Type should be used instead. * trie: improve node rlp decoding performance (ethereum#25357) This avoids copying the input []byte while decoding trie nodes. In most cases, particularly when the input slice is provided by the underlying database, this optimization is safe to use. For cases where the origin of the input slice is unclear, the copying version is retained. The new code performs better even when the input must be copied, because it is now only copied once in decodeNode. * all: fix some typos (ethereum#25551) * Fix some typos * Fix some mistakes * Revert 4byte.json * Fix an incorrect fix * Change files to fails * internal/ethapi: fix comment typo (ethereum#25548) * accounts/abi/bind/backends: typo fix (ethereum#25549) * eth, les: unlock downloader peerSet if there's an error (ethereum#25546) Unlock peerSet if there's an error in the downloader * cmd/geth: parse uint64 value with ParseUint instead of Atoi (ethereum#25545) Parse uint64 value with ParseUint instead of Atoi * consensus/beacon: check ttd reached on pos blocks (ethereum#25552) * consensus/beacon: check ttd reached on pos blocks * consensus/beacon: check ttd reached on pos blocks * consensus/beacon: check ttd reached on pos blocks * eth/filters: add global block logs cache (ethereum#25459) This adds a cache for block logs which is shared by all filters. The cache size of is configurable using the `--cache.blocklogs` flag. Co-authored-by: Felix Lange <[email protected]> * accounts/abi: fix set function (ethereum#25477) * accounts/abi: fix set function * don't break things * update test * internal/ethapi: fix build regression (ethereum#25555) * eth/fetcher: don't spend too much time on transaction inclusion (ethereum#25524) * eth/fetcher: introduce some lag in tx fetching * eth/fetcher: change conditions a bit * eth/fetcher: use per-batch quota check * eth/fetcher: fix some comments * eth/fetcher: address review concerns * eth/fetcher: fix panic + add warn log * eth/fetcher: fix log * eth/fetcher: fix log * cmd/devp2p/internal/ethtest: fix ignorign tx announcements from prev. tests * cmd/devp2p/internal/ethtest: fix TestLargeTxRequest This increases the number of tx relay messages the test waits for. Since go-ethereum now processes incoming txs in smaller batches, the announcement messages it sends are also smaller. Co-authored-by: Felix Lange <[email protected]> * Revert "eth/fetcher: don't spend too much time on transaction inclusion" (ethereum#25567) Revert "eth/fetcher: don't spend too much time on transaction inclusion (ethereum#25524)" This reverts commit 0ce494b. * eth/catalyst: warn less frequently if no beacon client is available (ethereum#25569) * eth/catalyst: warn less frequently if no beacon client is available * eth/catalyst: tweak warning frequency a bit * eth/catalyst: some more tweaks * Update api.go Co-authored-by: Felix Lange <[email protected]> * params: release go-ethereum v1.10.22 * params: begin v1.10.23 release cycle * core, eth/downloader: handle spurious junk bodies from racey rollbacks (ethereum#25578) * eth/downloader: handle junkbodies/receipts in the beacon sync * core: check for header presence when checking for blocks * core/state, trie: fix trie flush order for proper pruning * consensus/beacon: don't ignore errors * params: release Geth v1.10.23 * params: begin v1.10.24 release cycle * params: begin go-ethereum v1.11 release cycle * internal/ethapi: rename debug getters to match spec (ethereum#25176) Some small fixes to get the existing debug methods to conform to the spec. Mainly dropping the encoding information from the method name as it should be deduced from the debug context and allowing the method to be invoked by either block number or block hash. It also adds the method debug_getTransaction which returns the raw tx bytes by tx hash. This is pretty much equivalent to the eth_getRawTransactionByHash method. * accounts/abi/bind: add const for tx fee elasticity multiplier (ethereum#25504) Co-authored-by: Felix Lange <[email protected]> Co-authored-by: rjl493456442 <[email protected]> * all: remove duplicate word in comments (ethereum#25618) Signed-off-by: Abirdcfly <[email protected]> Signed-off-by: Abirdcfly <[email protected]> * cmd/geth: fix legacy receipt detection for empty db (ethereum#25609) * build: fix ignored errors (ethereum#25591) * docs: specify execution client (ethereum#25566) Co-authored-by: Felix Lange <[email protected]> * ethclient: add 'finalized' and 'safe' block number support (ethereum#25580) * node: change JWT error status to 401 Unauthorized (ethereum#25629) * node: fix regression in TestJWT (ethereum#25635) * all: move genesis initialization to blockchain (ethereum#25523) * all: move genesis initialization to blockchain * core: add one more check * core: fix tests * eth/catalyst: adjust eta for themerge (ethereum#25601) * eth/catalyst: adjust eta for themerge * squash * squash * eth/catalyst: address review concerns * mobile: close node on error (ethereum#25643) * graphql: return correct logs for tx (ethereum#25612) * graphql: fix tx logs * minor * Use optimized search for selecting tx logs * trie: fix grammar in comment (ethereum#25648) * trie: cleanup stateTrie (ethereum#25640) It's a trivial PR to hide the error log when the trie node is not found in the database. The idea for this change is for all TryXXX functions, the error is already returned and we don't need to fire a log explicitly. Recently there are a few tickets ethereum#25613 ethereum#25589 reporting that the trie nodes are missing because of debug.SetHead. The root cause is after resetting, the chain rewinds to a historical point and re-imports the blocks on top. Since the node is already synced and started to accept transactions previously, these transactions are still kept in the txpool and verified by txpool with a live state. This live state is constructed based on the live trie database, which is changed fast by node referencing and de-referencing. Unfortunately, when we construct a live state(like the state in txpool), we don't reference the state we have. The blockchain will garbage collect the intermediate version nodes in another thread which leads the broken live state. The best solution for this is to forcibly obtain a reference for all live states we create and call release function once it's used up. But it might end up with more junks persisted into disk. Will try to find an elegant solution later in the following PR. * eth/catalyst: prevent division by zero (ethereum#25654) eth/catalyst: prevent diff by zero * trie: better error reporting (ethereum#25645) * core/state: filter out nil trie for copy (ethereum#25575) * eth/protocols/snap: fix problems due to idle-but-busy peers * mobile: register filter APIs (ethereum#25642) This fixes a regression introduced in PR ethereum#25459. * README.md: improve grammar (ethereum#25646) Co-authored-by: Felix Lange <[email protected]> * eth/tracers/js: fill in log.refund field (ethereum#25661) For some reason, an accessor method for this field exists in JS, but the value was never actually assigned. * eth/fetcher: throttle peers which deliver many invalid transactions (ethereum#25573) Co-authored-by: Felix Lange <[email protected]> * node, rpc: add JWT auth support in client (ethereum#24911) This adds a generic mechanism for 'dial options' in the RPC client, and also implements a specific dial option for the JWT authentication mechanism used by the engine API. Some real tests for the server-side authentication handling are also added. Co-authored-by: Joshua Gutow <[email protected]> Co-authored-by: Felix Lange <[email protected]> * rpc: check that "version" is "2.0" in request objects (ethereum#25570) The JSON-RPC spec requires the "version" field to be exactly "2.0", so we should verify that. This change is not backwards-compatible with sloppy client implementations, but I decided to go ahead with it anyway because the failure will be caught via the returned error. * trie: fix typo in comment (ethereum#25667) * trie: fix unhandled error in test (ethereum#25628) * eth/tracers/js: improve integer types in log object (ethereum#25668) All fields related to gas must be represented as uint64. Depth is internally tracked as int, so it makes sense to also store it as int. * trie: check childrens' existence concurrently for snap heal * core, light, trie: remove DiskDB function from trie database (ethereum#25690) * params: update chts (ethereum#25707) * core/vm: rename RANDOM to PREVRANDAO (ethereum#25691) See: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-4399.md > This EIP supplants the semantics of the return value of existing DIFFICULTY (0x44) opcode and renames the opcode to PREVRANDAO (0x44). * all: cleanup tests (ethereum#25641) Follow-up to PR ethereum#25523 to cleanup all relevant tests. * eth, les: rework chain tracer (ethereum#25143) This PR simplifies the logic of chain tracer and also adds the unit tests. The most important change has been made in this PR is the state management. Whenever a tracing state is acquired there is a corresponding release function be returned as well. It must be called once the state is used up, otherwise resource leaking can happen. And also the logic of state management has been simplified a lot. Specifically, the state provider(eth backend, les backend) should ensure the state is available and referenced. State customers can use the state according to their own needs, or build other states based on the given state. But once the release function is called, there is no guarantee of the availability of the state. Co-authored-by: Sina Mahmoodi <[email protected]> Co-authored-by: Péter Szilágyi <[email protected]> * eth/tracer: fix broken test (ethereum#25715) * trie: update comments + err check for preimages (ethereum#25672) This PR includes minor updates to comments in trie/committer that reference insertion to the db, and adds an err != nil check for the return value of preimages.commit. * eth/protocols/snap: throttle trie heal requests when peers DoS us (ethereum#25666) * eth/protocols/snap: throttle trie heal requests when peers DoS us * eth/protocols/snap: lower heal throttle log to debug Co-authored-by: Martin Holst Swende <[email protected]> * eth/protocols/snap: fix comment Co-authored-by: Martin Holst Swende <[email protected]> * p2p/msgrate: be more lenient when calculating 'mean' (ethereum#25653) The p2p msgrate tracker is a thing which tries to estimate some mean round-trip times. However, it did so in a very curious way: if a node had 200 peers, it would sort their 200 respective rtt estimates, and then it would pick item number 2 as the mean. So effectively taking third fastest and calling it mean. This probably works "ok" when the number of peers are low (there are other factors too, such as ttlScaling which takes some of the edge off this) -- however when the number of peers is high, it becomes very skewed. This PR instead bases the 'mean' on the square root of the length of the list. Still pretty harsh, but a bit more lenient. * rpc: improve error codes for internal server errors (ethereum#25678) This changes the error code returned by the RPC server in certain situations: - handler panic: code -32603 - result marshaling error: code -32603 - attempt to subscribe via HTTP: code -32001 In all of the above cases, the server previously returned the default error code -32000. Co-authored-by: Nicholas Zhao <[email protected]> Co-authored-by: Felix Lange <[email protected]> * core: place a cap on reorglogs (ethereum#25711) This PR makes the event-sending for deleted and new logs happen in batches, to prevent OOM situation due to large reorgs. Co-authored-by: Felix Lange <[email protected]> * build: upgrade to go 1.19 (ethereum#25726) This changes the CI / release builds to use the latest Go version. It also upgrades golangci-lint to a newer version compatible with Go 1.19. In Go 1.19, godoc has gained official support for links and lists. The syntax for code blocks in doc comments has changed and now requires a leading tab character. gofmt adapts comments to the new syntax automatically, so there are a lot of comment re-formatting changes in this PR. We need to apply the new format in order to pass the CI lint stage with Go 1.19. With the linter upgrade, I have decided to disable 'gosec' - it produces too many false-positive warnings. The 'deadcode' and 'varcheck' linters have also been removed because golangci-lint warns about them being unmaintained. 'unused' provides similar coverage and we already have it enabled, so we don't lose much with this change. * p2p/discover/v5wire: reject packets smaller than 63 bytes (ethereum#25740) * core: preallocate maps in TxPool helper methods (ethereum#25737) * accounts/abi: fix typo in error message (ethereum#25742) * graphql: fixes missing tx logs (ethereum#25745) * graphql: fix tx logs * graphql: refactor test service setup * graphql: add test for tx logs * cmd/geth: add a verkle subcommand (ethereum#25718) * cmd/geth: add a verkle subcommand * fix copyright year * remove unused command parameters * check that the output file was successfully written to Co-authored-by: Martin Holst Swende <[email protected]> * cmd/geth: goimports fix Co-authored-by: Martin Holst Swende <[email protected]> * node: fix HTTP server always force closing (ethereum#25755) Co-authored-by: Felix Lange <[email protected]> * core: fix log order in "Imported new chain segment" (ethereum#25768) * node: fix lint issue in rpcstack.go (ethereum#25774) * les/catalyst/api: add support for ExchangeTransitionConfigurationV1 (ethereum#25752) This method is missing in light client mode and breaks consensus clients that require a valid response. * params: set TerminalTotalDifficultyPassed to true (ethereum#25769) * params: set TerminalTotalDifficultyPassed to true * Update params/config.go Co-authored-by: Martin Holst Swende <[email protected]> * trie: handle more batch commit errors in Database (ethereum#25674) * core/rawdb: fix leak of backoff timer (ethereum#25776) * crypto/bls12381: docfix of g1 Affine (ethereum#25729) bls12381: docfix of g1 Affine. * internal/ethapi: return error when requesting invalid trie key (ethereum#25762) This change makes eth_getProof and eth_getStorageAt return an error when the argument contains invalid hex in storage keys. Co-authored-by: Felix Lange <[email protected]> * core: don't cache zero nonce in txNoncer (ethereum#25603) This changes the nonce cache used by TxPool to not store cached nonces for non-existing accounts. * core: more compact bad block report (ethereum#25714) This shortens the chain config summary in bad block reports, and adds go-ethereum version information as well. Co-authored-by: Felix Lange <[email protected]> * core: move build version reading to its own package (ethereum#25806) This fixes the build with Go 1.17, which does not have BuildInfo.Settings yet. * eth: fix a rare datarace on CHT challenge reply / shutdown * core/vm: return copy of input slice in identity precompile, avoid returndata copy (ethereum#25183) * core/vm: return copy of input slice in identity precompile. don't deep copy return data slice upon call completion * make use of common.CopyBytes * core/blockchain: downgrade tx indexing and unindexing logs (ethereum#25832) core/blockchain: downgrade tx indexing and unindexing logs from info to debug If a user has a finite tx lookup limit, they will see an "unindexing" info level log each time a block is imported. This information might help a user understand that they are removing the index each block and some txs may not be retrievable by hash, but overall it is generally more of a nuisance than a benefit. This change downgrades the log to a debug log. * eth/tracers: fix trace config for `TraceCall` (ethereum#25821) Co-authored-by: AtomicAzzaz <[email protected]> Co-authored-by: ewile <[email protected]> * eth/catalyst: add locking around newpayload (ethereum#25816) Sometimes we get stuck on db compaction, and the CL re-issues the "same" command to us multiple times. Each request get stuck on the same place, in the middle of the handler. This changes makes it so we do not reprocess the same payload, but instead detects it early. * eth/catalyst: make tests run faster (ethereum#25818) * cmd/utils: make --authrpc.jwtsecret a DirectoryFlag (ethereum#25849) Signed-off-by: Delweng <[email protected]> * eth/protocols/snap: make log messages more clear that sync is ongoing (ethereum#25837) * eth/protocols/snap: make log messages more clear that sync is ongoing * Update sync.go Co-authored-by: Felix Lange <[email protected]> * .github: add CL client to issue template (ethereum#25814) * p2p: add channel buffers to avoid goroutine leaks in tests (ethereum#24929) * internal/version: use gitCommit injection in version handling code (ethereum#25851) This changes the CI build to store the git commit and date into package internal/version instead of package main. Doing this essentially merges our two ways of tracking the go-ethereum version into a single place, achieving two objectives: - Bad block reports, which use version.Info(), will now have the git commit information even when geth is built in an environment such as launchpad.net where git access is unavailable. - For geth builds created by `go build ./cmd/geth` (i.e. not using `go run build/ci.go install`), git information stored by the go tool is now used in the p2p node name as well as in `geth version` and `geth version-check`. * cmd/abigen: change --exc to exclude by type name (ethereum#22620) The abigen exclusion pattern, previously on the form "path:type", now supports wildcards. Examples "*:type" to exclude a named type in all files, or "/path/to/foo.sol:*" all types in foo.sol. * tests, les, eth: remove mentions of deprecated Morden testnet (ethereum#23570) * remove morden * Update commons.go * Update handler.go * empty commit to make appveyor happy * all: clean up the configs for pruner and snapshotter (ethereum#22396) This PR cleans up the configurations for pruner and snapshotter by passing a config struct. And also, this PR disables the snapshot background generation if the chain is opened in "read-only" mode. The read-only mode is necessary in some cases. For example, we have a list of commands to open the etheruem node in "read-only" mode, like export-chain. In these cases, the snapshot background generation is non expected and should be banned explicitly. * cmd/puppeth, cmd/utils: finalize removal of gasTarget flag (ethereum#24370) This PR fully removes the --miner.gastarget flag, as previously it was only hidden from the geth --help command, but could still be used. * core/types: improve accuracy of header.Size() (ethereum#25859) The header.Size() method did not take the basefee into account. * eth/tracers: pad memory slice on OOB case (ethereum#25213) * eth/tracers: pad memory slice on oob case * eth/tracers/js: fix testfailure due to err msg capitalization Co-authored-by: Martin Holst Swende <[email protected]> * cmd/faucet: fix readme typos (ethereum#25867) * Fix: typos Fix: typos * Undo change Undo change * core: fix datarace in txpool, fixes ethereum#25870 and ethereum#25869 (ethereum#25872) core: fix datarace in txpool pendingnoce, fixes ethereum#25870 * eth/downloader, les/downloader: fix subtle flaw in queue delivery (ethereum#25861) * fix queue.deliver * les/downloader: fix queue.deliver Co-authored-by: Martin Holst Swende <[email protected]> * core/vm: better handle error on eip activation check (ethereum#25131) * core/vm: correct logic for eip check of NewEVMInterpreter * refactor * cmd/geth: make dumpgenesis load genesis datadir if it exists (ethereum#25135) `geth dumpgenesis` currently does not respect the content of the data directory. Instead, it outputs the genesis block created by command-line flags. This PR fixes it to read the genesis from the database, if the database already exists. Co-authored-by: Martin Holst Swende <[email protected]> * tests: fix state test error checking (ethereum#25702) Some tests define an 'expectException' error but the tests runner does not check for conditions where this test value is filled (error expected) but in which no error is returned by the test runner. An example of this scenario is GeneralStateTests/stTransactionTest/HighGasPrice.json, which expects a 'TR_NoFunds' error, but the test runner does not return any error. Signed-off-by: meows <[email protected]> * eth/tracers: use gencodec for native tracers (ethereum#25637) The call tracer and prestate tracer store data JSON-encoded in memory. In order to support alternative encodings (specifically RLP), it's better to keep data a native format during tracing. This PR does marshalling at the end, using gencodec. OBS! This PR changes the call tracer result slightly: - Order of type and value fields are changed (should not matter). - Output fields are completely omitted when they're empty (no more output: "0x"). Previously, this was only _sometimes_ omitted (e.g. when call ended in a non-revert error) and otherwise 0x when the output was actually empty. * cmd, core, eth, les, light: track deleted nodes (ethereum#25757) * cmd, core, eth, les, light: track deleted nodes * trie: add docs * trie: address comments * cmd, core, eth, les, light, trie: trie id * trie: add tests * trie, core: updates * trie: fix imports * trie: add utility print-method for nodeset * trie: import err * trie: fix go vet warnings Co-authored-by: Martin Holst Swende <[email protected]> * eth: return state error via GetEVM (ethereum#25876) * make vmError more useful * fix for review * Update api.go * revert calling site Co-authored-by: rjl493456442 <[email protected]> * eth/downloader: make flakey test less flakey (ethereum#25879) * ethclient/gethclient: fix bugs in override object encoding (ethereum#25616) This fixes a bug where contract code would be overridden to empty code ("0x") when the Code field of OverrideAccount was left nil. The change also cleans up the encoding of overrides to only send necessary fields, and improves documentation. Fixes ethereum#25615 Co-authored-by: Felix Lange <[email protected]> Co-authored-by: Martin Holst Swende <[email protected]> * trie, eth/protocols/snap: less tiny db-writes during trie-healing (ethereum#25681) This PR prevent making tiny writes during state healing, by only performing the batch-write if the accumulated data is large enough to be meaningful. * accounts/abi/bind/backends: fix AdjustTime to respect Fork (ethereum#25225) * tests: report mgas/s metric in evm benchmarks (ethereum#25700) * test(state): report mgas/s metric in EVM benchmark * revert testdata submodule update * aggregate mgas/s results * calculate elapsed time better * tests: benchmarks - handle access list + take refund into account Co-authored-by: Martin Holst Swende <[email protected]> * core/vm: minor trivial clean up (ethereum#25880) * dropped `vm.keccakState` for `crypto.KeccakState` * cleaned up `OpCode.IsPush()` * eth/tracers: fix a bug in prestateTracer (ethereum#25884) * internal/ethapi: handle odd length hex in decodeHash (ethereum#25883) This change adds zero-padding (prefix) of odd nibbles in the decodeHash function. Co-authored-by: ty <[email protected]> * core: rework tx indexer (ethereum#25723) This PR reworks tx indexer a bit. Compared to the original version, one scenario is no longer handled - upgrading from legacy geth without indexer support. The tx indexer was introduced in 2020 and have been present through hardforks, so it can be assumed that all Geth nodes have tx indexer already. So we can simplify the tx indexer logic a bit: - If the tail flag is not present, it means node is just initialized may or may not with an ancient store attached. In this case all blocks are regarded as unindexed - If the tail flag is present, it means blocks below tail are unindexed, blocks above tail are indexed This change also address some weird cornercases that could make the indexer not work after a crash. * accounts/abi: return toGoType error immediately (ethereum#25565) * eth/tracers: remove revertReasonTracer, add revert reason to callTracer (ethereum#25508) * eth/tracers: add revertReason to callTracer * update callframe gen json * add revertal to calltrace test * accounts/abi/bind: parse ABI only once on bind (ethereum#25574) * accounts/abi/bind: parse ABI once on bind * accounts/abi/bind: suppress 'imported and not used' error for abi package * internal/flags: fix issue with stringslice migration (ethereum#25830) This fixes a cornercase bug where the flag migration would mess up the value of StringSlice flags. * cmd/geth, cmd/utils: geth attach with custom headers (ethereum#25829) This PR makes it possible to set custom headers, in particular for two scenarios: - geth attach - geth commands which can use --remotedb, e..g geth db inspect The ability to use custom headers is typically useful for connecting to cloud-apis, e.g. providing an infura- or alchemy key, or for that matter access-keys for environments behind cloudflare. Co-authored-by: Felix Lange <[email protected]> * add market gas price to simulate duplicate nonce behavior (#7) * fix duplicated test * add back tests Signed-off-by: Abirdcfly <[email protected]> Signed-off-by: Delweng <[email protected]> Signed-off-by: meows <[email protected]> Co-authored-by: Zachinquarantine <[email protected]> Co-authored-by: aaronbuchwald <[email protected]> Co-authored-by: lightclient <[email protected]> Co-authored-by: Sina Mahmoodi <[email protected]> Co-authored-by: Martin Holst Swende <[email protected]> Co-authored-by: rjl493456442 <[email protected]> Co-authored-by: ucwong <[email protected]> Co-authored-by: Felix Lange <[email protected]> Co-authored-by: int88 <[email protected]> Co-authored-by: willian.eth <[email protected]> Co-authored-by: Marius van der Wijden <[email protected]> Co-authored-by: zeim839 <[email protected]> Co-authored-by: Guillaume Ballet <[email protected]> Co-authored-by: Ruohui Wang <[email protected]> Co-authored-by: Andre Patta <[email protected]> Co-authored-by: Seungbae.yu <[email protected]> Co-authored-by: Péter Szilágyi <[email protected]> Co-authored-by: スパイク <[email protected]> Co-authored-by: Brion <[email protected]> Co-authored-by: Marius Kjærstad <[email protected]> Co-authored-by: Philip Fan <[email protected]> Co-authored-by: Ikko Ashimine <[email protected]> Co-authored-by: Jens W <[email protected]> Co-authored-by: Jens <[email protected]> Co-authored-by: [email protected] <[email protected]> Co-authored-by: henridf <[email protected]> Co-authored-by: Lee Bousfield <[email protected]> Co-authored-by: Ha ĐANG <[email protected]> Co-authored-by: jwasinger <[email protected]> Co-authored-by: Nikhil Suri <[email protected]> Co-authored-by: Abirdcfly <[email protected]> Co-authored-by: Eval EXEC <[email protected]> Co-authored-by: Delweng <[email protected]> Co-authored-by: Rithwik Babu <[email protected]> Co-authored-by: Henry <[email protected]> Co-authored-by: Manoj Kumar <[email protected]> Co-authored-by: Tristan-Wilson <[email protected]> Co-authored-by: yong <[email protected]> Co-authored-by: Seungbae Yu <[email protected]> Co-authored-by: ycyraum <[email protected]> Co-authored-by: 0xe3b0c4 <[email protected]> Co-authored-by: Darioush Jalali <[email protected]> Co-authored-by: bobpkr <[email protected]> Co-authored-by: Justin Traglia <[email protected]> Co-authored-by: zhiqiangxu <[email protected]> Co-authored-by: xinbenlv <[email protected]> Co-authored-by: uji <[email protected]> Co-authored-by: Marius Kjærstad <[email protected]> Co-authored-by: Rachel Bousfield <[email protected]> Co-authored-by: Jakub Freebit <[email protected]> Co-authored-by: xternet <[email protected]> Co-authored-by: protolambda <[email protected]> Co-authored-by: Joshua Gutow <[email protected]> Co-authored-by: Amir Hossein <[email protected]> Co-authored-by: Nicholas <[email protected]> Co-authored-by: Nicholas Zhao <[email protected]> Co-authored-by: Benjamin Prosnitz <[email protected]> Co-authored-by: Nicolas Gotchac <[email protected]> Co-authored-by: pinkiebell <[email protected]> Co-authored-by: George Carder <[email protected]> Co-authored-by: makcandrov <[email protected]> Co-authored-by: AtomicAzzaz <[email protected]> Co-authored-by: ewile <[email protected]> Co-authored-by: Boqin@MetaSecureLabs <[email protected]> Co-authored-by: Sebastian Stammler <[email protected]> Co-authored-by: omahs <[email protected]> Co-authored-by: Leon <[email protected]> Co-authored-by: meowsbits <[email protected]> Co-authored-by: Janko Simonovic <[email protected]> Co-authored-by: Alexey Shekhirin <[email protected]> Co-authored-by: lmittmann <[email protected]> Co-authored-by: TY <[email protected]> Co-authored-by: ty <[email protected]> Co-authored-by: Ceyhun Onur <[email protected]> Co-authored-by: Mikhail Vazhnov <[email protected]> Co-authored-by: susannapaxos <[email protected]>
* cmd. core: save preimages on genesis creation (ethereum#25538) force preimage dump for genesis * rlp/rlpgen: fix error handling when target type not found (ethereum#25547) typ will be nil when lookupStructType returns an error. cfg.Type should be used instead. * trie: improve node rlp decoding performance (ethereum#25357) This avoids copying the input []byte while decoding trie nodes. In most cases, particularly when the input slice is provided by the underlying database, this optimization is safe to use. For cases where the origin of the input slice is unclear, the copying version is retained. The new code performs better even when the input must be copied, because it is now only copied once in decodeNode. * all: fix some typos (ethereum#25551) * Fix some typos * Fix some mistakes * Revert 4byte.json * Fix an incorrect fix * Change files to fails * internal/ethapi: fix comment typo (ethereum#25548) * accounts/abi/bind/backends: typo fix (ethereum#25549) * eth, les: unlock downloader peerSet if there's an error (ethereum#25546) Unlock peerSet if there's an error in the downloader * cmd/geth: parse uint64 value with ParseUint instead of Atoi (ethereum#25545) Parse uint64 value with ParseUint instead of Atoi * consensus/beacon: check ttd reached on pos blocks (ethereum#25552) * consensus/beacon: check ttd reached on pos blocks * consensus/beacon: check ttd reached on pos blocks * consensus/beacon: check ttd reached on pos blocks * eth/filters: add global block logs cache (ethereum#25459) This adds a cache for block logs which is shared by all filters. The cache size of is configurable using the `--cache.blocklogs` flag. Co-authored-by: Felix Lange <[email protected]> * accounts/abi: fix set function (ethereum#25477) * accounts/abi: fix set function * don't break things * update test * internal/ethapi: fix build regression (ethereum#25555) * eth/fetcher: don't spend too much time on transaction inclusion (ethereum#25524) * eth/fetcher: introduce some lag in tx fetching * eth/fetcher: change conditions a bit * eth/fetcher: use per-batch quota check * eth/fetcher: fix some comments * eth/fetcher: address review concerns * eth/fetcher: fix panic + add warn log * eth/fetcher: fix log * eth/fetcher: fix log * cmd/devp2p/internal/ethtest: fix ignorign tx announcements from prev. tests * cmd/devp2p/internal/ethtest: fix TestLargeTxRequest This increases the number of tx relay messages the test waits for. Since go-ethereum now processes incoming txs in smaller batches, the announcement messages it sends are also smaller. Co-authored-by: Felix Lange <[email protected]> * Revert "eth/fetcher: don't spend too much time on transaction inclusion" (ethereum#25567) Revert "eth/fetcher: don't spend too much time on transaction inclusion (ethereum#25524)" This reverts commit 0ce494b. * eth/catalyst: warn less frequently if no beacon client is available (ethereum#25569) * eth/catalyst: warn less frequently if no beacon client is available * eth/catalyst: tweak warning frequency a bit * eth/catalyst: some more tweaks * Update api.go Co-authored-by: Felix Lange <[email protected]> * params: release go-ethereum v1.10.22 * params: begin v1.10.23 release cycle * core, eth/downloader: handle spurious junk bodies from racey rollbacks (ethereum#25578) * eth/downloader: handle junkbodies/receipts in the beacon sync * core: check for header presence when checking for blocks * core/state, trie: fix trie flush order for proper pruning * consensus/beacon: don't ignore errors * params: release Geth v1.10.23 * params: begin v1.10.24 release cycle * params: begin go-ethereum v1.11 release cycle * internal/ethapi: rename debug getters to match spec (ethereum#25176) Some small fixes to get the existing debug methods to conform to the spec. Mainly dropping the encoding information from the method name as it should be deduced from the debug context and allowing the method to be invoked by either block number or block hash. It also adds the method debug_getTransaction which returns the raw tx bytes by tx hash. This is pretty much equivalent to the eth_getRawTransactionByHash method. * accounts/abi/bind: add const for tx fee elasticity multiplier (ethereum#25504) Co-authored-by: Felix Lange <[email protected]> Co-authored-by: rjl493456442 <[email protected]> * all: remove duplicate word in comments (ethereum#25618) Signed-off-by: Abirdcfly <[email protected]> Signed-off-by: Abirdcfly <[email protected]> * cmd/geth: fix legacy receipt detection for empty db (ethereum#25609) * build: fix ignored errors (ethereum#25591) * docs: specify execution client (ethereum#25566) Co-authored-by: Felix Lange <[email protected]> * ethclient: add 'finalized' and 'safe' block number support (ethereum#25580) * node: change JWT error status to 401 Unauthorized (ethereum#25629) * node: fix regression in TestJWT (ethereum#25635) * all: move genesis initialization to blockchain (ethereum#25523) * all: move genesis initialization to blockchain * core: add one more check * core: fix tests * eth/catalyst: adjust eta for themerge (ethereum#25601) * eth/catalyst: adjust eta for themerge * squash * squash * eth/catalyst: address review concerns * mobile: close node on error (ethereum#25643) * graphql: return correct logs for tx (ethereum#25612) * graphql: fix tx logs * minor * Use optimized search for selecting tx logs * trie: fix grammar in comment (ethereum#25648) * eth/protocols/snap: fix problems due to idle-but-busy peers * trie: cleanup stateTrie (ethereum#25640) It's a trivial PR to hide the error log when the trie node is not found in the database. The idea for this change is for all TryXXX functions, the error is already returned and we don't need to fire a log explicitly. Recently there are a few tickets ethereum#25613 ethereum#25589 reporting that the trie nodes are missing because of debug.SetHead. The root cause is after resetting, the chain rewinds to a historical point and re-imports the blocks on top. Since the node is already synced and started to accept transactions previously, these transactions are still kept in the txpool and verified by txpool with a live state. This live state is constructed based on the live trie database, which is changed fast by node referencing and de-referencing. Unfortunately, when we construct a live state(like the state in txpool), we don't reference the state we have. The blockchain will garbage collect the intermediate version nodes in another thread which leads the broken live state. The best solution for this is to forcibly obtain a reference for all live states we create and call release function once it's used up. But it might end up with more junks persisted into disk. Will try to find an elegant solution later in the following PR. * eth/catalyst: prevent division by zero (ethereum#25654) eth/catalyst: prevent diff by zero * trie: better error reporting (ethereum#25645) * core/state: filter out nil trie for copy (ethereum#25575) * mobile: register filter APIs (ethereum#25642) This fixes a regression introduced in PR ethereum#25459. * README.md: improve grammar (ethereum#25646) Co-authored-by: Felix Lange <[email protected]> * eth/tracers/js: fill in log.refund field (ethereum#25661) For some reason, an accessor method for this field exists in JS, but the value was never actually assigned. * eth/fetcher: throttle peers which deliver many invalid transactions (ethereum#25573) Co-authored-by: Felix Lange <[email protected]> * node, rpc: add JWT auth support in client (ethereum#24911) This adds a generic mechanism for 'dial options' in the RPC client, and also implements a specific dial option for the JWT authentication mechanism used by the engine API. Some real tests for the server-side authentication handling are also added. Co-authored-by: Joshua Gutow <[email protected]> Co-authored-by: Felix Lange <[email protected]> * rpc: check that "version" is "2.0" in request objects (ethereum#25570) The JSON-RPC spec requires the "version" field to be exactly "2.0", so we should verify that. This change is not backwards-compatible with sloppy client implementations, but I decided to go ahead with it anyway because the failure will be caught via the returned error. * trie: fix typo in comment (ethereum#25667) * trie: fix unhandled error in test (ethereum#25628) * eth/tracers/js: improve integer types in log object (ethereum#25668) All fields related to gas must be represented as uint64. Depth is internally tracked as int, so it makes sense to also store it as int. * trie: check childrens' existence concurrently for snap heal * core, light, trie: remove DiskDB function from trie database (ethereum#25690) * params: update chts (ethereum#25707) * core/vm: rename RANDOM to PREVRANDAO (ethereum#25691) See: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-4399.md > This EIP supplants the semantics of the return value of existing DIFFICULTY (0x44) opcode and renames the opcode to PREVRANDAO (0x44). * all: cleanup tests (ethereum#25641) Follow-up to PR ethereum#25523 to cleanup all relevant tests. * eth, les: rework chain tracer (ethereum#25143) This PR simplifies the logic of chain tracer and also adds the unit tests. The most important change has been made in this PR is the state management. Whenever a tracing state is acquired there is a corresponding release function be returned as well. It must be called once the state is used up, otherwise resource leaking can happen. And also the logic of state management has been simplified a lot. Specifically, the state provider(eth backend, les backend) should ensure the state is available and referenced. State customers can use the state according to their own needs, or build other states based on the given state. But once the release function is called, there is no guarantee of the availability of the state. Co-authored-by: Sina Mahmoodi <[email protected]> Co-authored-by: Péter Szilágyi <[email protected]> * eth/tracer: fix broken test (ethereum#25715) * trie: update comments + err check for preimages (ethereum#25672) This PR includes minor updates to comments in trie/committer that reference insertion to the db, and adds an err != nil check for the return value of preimages.commit. * eth/protocols/snap: throttle trie heal requests when peers DoS us (ethereum#25666) * eth/protocols/snap: throttle trie heal requests when peers DoS us * eth/protocols/snap: lower heal throttle log to debug Co-authored-by: Martin Holst Swende <[email protected]> * eth/protocols/snap: fix comment Co-authored-by: Martin Holst Swende <[email protected]> * p2p/msgrate: be more lenient when calculating 'mean' (ethereum#25653) The p2p msgrate tracker is a thing which tries to estimate some mean round-trip times. However, it did so in a very curious way: if a node had 200 peers, it would sort their 200 respective rtt estimates, and then it would pick item number 2 as the mean. So effectively taking third fastest and calling it mean. This probably works "ok" when the number of peers are low (there are other factors too, such as ttlScaling which takes some of the edge off this) -- however when the number of peers is high, it becomes very skewed. This PR instead bases the 'mean' on the square root of the length of the list. Still pretty harsh, but a bit more lenient. * rpc: improve error codes for internal server errors (ethereum#25678) This changes the error code returned by the RPC server in certain situations: - handler panic: code -32603 - result marshaling error: code -32603 - attempt to subscribe via HTTP: code -32001 In all of the above cases, the server previously returned the default error code -32000. Co-authored-by: Nicholas Zhao <[email protected]> Co-authored-by: Felix Lange <[email protected]> * core: place a cap on reorglogs (ethereum#25711) This PR makes the event-sending for deleted and new logs happen in batches, to prevent OOM situation due to large reorgs. Co-authored-by: Felix Lange <[email protected]> * build: upgrade to go 1.19 (ethereum#25726) This changes the CI / release builds to use the latest Go version. It also upgrades golangci-lint to a newer version compatible with Go 1.19. In Go 1.19, godoc has gained official support for links and lists. The syntax for code blocks in doc comments has changed and now requires a leading tab character. gofmt adapts comments to the new syntax automatically, so there are a lot of comment re-formatting changes in this PR. We need to apply the new format in order to pass the CI lint stage with Go 1.19. With the linter upgrade, I have decided to disable 'gosec' - it produces too many false-positive warnings. The 'deadcode' and 'varcheck' linters have also been removed because golangci-lint warns about them being unmaintained. 'unused' provides similar coverage and we already have it enabled, so we don't lose much with this change. * p2p/discover/v5wire: reject packets smaller than 63 bytes (ethereum#25740) * core: preallocate maps in TxPool helper methods (ethereum#25737) * accounts/abi: fix typo in error message (ethereum#25742) * graphql: fixes missing tx logs (ethereum#25745) * graphql: fix tx logs * graphql: refactor test service setup * graphql: add test for tx logs * cmd/geth: add a verkle subcommand (ethereum#25718) * cmd/geth: add a verkle subcommand * fix copyright year * remove unused command parameters * check that the output file was successfully written to Co-authored-by: Martin Holst Swende <[email protected]> * cmd/geth: goimports fix Co-authored-by: Martin Holst Swende <[email protected]> * node: fix HTTP server always force closing (ethereum#25755) Co-authored-by: Felix Lange <[email protected]> * core: fix log order in "Imported new chain segment" (ethereum#25768) * node: fix lint issue in rpcstack.go (ethereum#25774) * les/catalyst/api: add support for ExchangeTransitionConfigurationV1 (ethereum#25752) This method is missing in light client mode and breaks consensus clients that require a valid response. * params: set TerminalTotalDifficultyPassed to true (ethereum#25769) * params: set TerminalTotalDifficultyPassed to true * Update params/config.go Co-authored-by: Martin Holst Swende <[email protected]> * trie: handle more batch commit errors in Database (ethereum#25674) * core/rawdb: fix leak of backoff timer (ethereum#25776) * crypto/bls12381: docfix of g1 Affine (ethereum#25729) bls12381: docfix of g1 Affine. * internal/ethapi: return error when requesting invalid trie key (ethereum#25762) This change makes eth_getProof and eth_getStorageAt return an error when the argument contains invalid hex in storage keys. Co-authored-by: Felix Lange <[email protected]> * core: don't cache zero nonce in txNoncer (ethereum#25603) This changes the nonce cache used by TxPool to not store cached nonces for non-existing accounts. * core: more compact bad block report (ethereum#25714) This shortens the chain config summary in bad block reports, and adds go-ethereum version information as well. Co-authored-by: Felix Lange <[email protected]> * core: move build version reading to its own package (ethereum#25806) This fixes the build with Go 1.17, which does not have BuildInfo.Settings yet. * eth: fix a rare datarace on CHT challenge reply / shutdown * core/vm: return copy of input slice in identity precompile, avoid returndata copy (ethereum#25183) * core/vm: return copy of input slice in identity precompile. don't deep copy return data slice upon call completion * make use of common.CopyBytes * core/blockchain: downgrade tx indexing and unindexing logs (ethereum#25832) core/blockchain: downgrade tx indexing and unindexing logs from info to debug If a user has a finite tx lookup limit, they will see an "unindexing" info level log each time a block is imported. This information might help a user understand that they are removing the index each block and some txs may not be retrievable by hash, but overall it is generally more of a nuisance than a benefit. This change downgrades the log to a debug log. * eth/tracers: fix trace config for `TraceCall` (ethereum#25821) Co-authored-by: AtomicAzzaz <[email protected]> Co-authored-by: ewile <[email protected]> * eth/catalyst: add locking around newpayload (ethereum#25816) Sometimes we get stuck on db compaction, and the CL re-issues the "same" command to us multiple times. Each request get stuck on the same place, in the middle of the handler. This changes makes it so we do not reprocess the same payload, but instead detects it early. * eth/catalyst: make tests run faster (ethereum#25818) * cmd/utils: make --authrpc.jwtsecret a DirectoryFlag (ethereum#25849) Signed-off-by: Delweng <[email protected]> * eth/protocols/snap: make log messages more clear that sync is ongoing (ethereum#25837) * eth/protocols/snap: make log messages more clear that sync is ongoing * Update sync.go Co-authored-by: Felix Lange <[email protected]> * .github: add CL client to issue template (ethereum#25814) * p2p: add channel buffers to avoid goroutine leaks in tests (ethereum#24929) * internal/version: use gitCommit injection in version handling code (ethereum#25851) This changes the CI build to store the git commit and date into package internal/version instead of package main. Doing this essentially merges our two ways of tracking the go-ethereum version into a single place, achieving two objectives: - Bad block reports, which use version.Info(), will now have the git commit information even when geth is built in an environment such as launchpad.net where git access is unavailable. - For geth builds created by `go build ./cmd/geth` (i.e. not using `go run build/ci.go install`), git information stored by the go tool is now used in the p2p node name as well as in `geth version` and `geth version-check`. * cmd/abigen: change --exc to exclude by type name (ethereum#22620) The abigen exclusion pattern, previously on the form "path:type", now supports wildcards. Examples "*:type" to exclude a named type in all files, or "/path/to/foo.sol:*" all types in foo.sol. * tests, les, eth: remove mentions of deprecated Morden testnet (ethereum#23570) * remove morden * Update commons.go * Update handler.go * empty commit to make appveyor happy * all: clean up the configs for pruner and snapshotter (ethereum#22396) This PR cleans up the configurations for pruner and snapshotter by passing a config struct. And also, this PR disables the snapshot background generation if the chain is opened in "read-only" mode. The read-only mode is necessary in some cases. For example, we have a list of commands to open the etheruem node in "read-only" mode, like export-chain. In these cases, the snapshot background generation is non expected and should be banned explicitly. * cmd/puppeth, cmd/utils: finalize removal of gasTarget flag (ethereum#24370) This PR fully removes the --miner.gastarget flag, as previously it was only hidden from the geth --help command, but could still be used. * core/types: improve accuracy of header.Size() (ethereum#25859) The header.Size() method did not take the basefee into account. * eth/tracers: pad memory slice on OOB case (ethereum#25213) * eth/tracers: pad memory slice on oob case * eth/tracers/js: fix testfailure due to err msg capitalization Co-authored-by: Martin Holst Swende <[email protected]> * cmd/faucet: fix readme typos (ethereum#25867) * Fix: typos Fix: typos * Undo change Undo change * core: fix datarace in txpool, fixes ethereum#25870 and ethereum#25869 (ethereum#25872) core: fix datarace in txpool pendingnoce, fixes ethereum#25870 * eth/downloader, les/downloader: fix subtle flaw in queue delivery (ethereum#25861) * fix queue.deliver * les/downloader: fix queue.deliver Co-authored-by: Martin Holst Swende <[email protected]> * core/vm: better handle error on eip activation check (ethereum#25131) * core/vm: correct logic for eip check of NewEVMInterpreter * refactor * cmd/geth: make dumpgenesis load genesis datadir if it exists (ethereum#25135) `geth dumpgenesis` currently does not respect the content of the data directory. Instead, it outputs the genesis block created by command-line flags. This PR fixes it to read the genesis from the database, if the database already exists. Co-authored-by: Martin Holst Swende <[email protected]> * tests: fix state test error checking (ethereum#25702) Some tests define an 'expectException' error but the tests runner does not check for conditions where this test value is filled (error expected) but in which no error is returned by the test runner. An example of this scenario is GeneralStateTests/stTransactionTest/HighGasPrice.json, which expects a 'TR_NoFunds' error, but the test runner does not return any error. Signed-off-by: meows <[email protected]> * eth/tracers: use gencodec for native tracers (ethereum#25637) The call tracer and prestate tracer store data JSON-encoded in memory. In order to support alternative encodings (specifically RLP), it's better to keep data a native format during tracing. This PR does marshalling at the end, using gencodec. OBS! This PR changes the call tracer result slightly: - Order of type and value fields are changed (should not matter). - Output fields are completely omitted when they're empty (no more output: "0x"). Previously, this was only _sometimes_ omitted (e.g. when call ended in a non-revert error) and otherwise 0x when the output was actually empty. * cmd, core, eth, les, light: track deleted nodes (ethereum#25757) * cmd, core, eth, les, light: track deleted nodes * trie: add docs * trie: address comments * cmd, core, eth, les, light, trie: trie id * trie: add tests * trie, core: updates * trie: fix imports * trie: add utility print-method for nodeset * trie: import err * trie: fix go vet warnings Co-authored-by: Martin Holst Swende <[email protected]> * eth: return state error via GetEVM (ethereum#25876) * make vmError more useful * fix for review * Update api.go * revert calling site Co-authored-by: rjl493456442 <[email protected]> * eth/downloader: make flakey test less flakey (ethereum#25879) * ethclient/gethclient: fix bugs in override object encoding (ethereum#25616) This fixes a bug where contract code would be overridden to empty code ("0x") when the Code field of OverrideAccount was left nil. The change also cleans up the encoding of overrides to only send necessary fields, and improves documentation. Fixes ethereum#25615 Co-authored-by: Felix Lange <[email protected]> Co-authored-by: Martin Holst Swende <[email protected]> * trie, eth/protocols/snap: less tiny db-writes during trie-healing (ethereum#25681) This PR prevent making tiny writes during state healing, by only performing the batch-write if the accumulated data is large enough to be meaningful. * accounts/abi/bind/backends: fix AdjustTime to respect Fork (ethereum#25225) * tests: report mgas/s metric in evm benchmarks (ethereum#25700) * test(state): report mgas/s metric in EVM benchmark * revert testdata submodule update * aggregate mgas/s results * calculate elapsed time better * tests: benchmarks - handle access list + take refund into account Co-authored-by: Martin Holst Swende <[email protected]> * core/vm: minor trivial clean up (ethereum#25880) * dropped `vm.keccakState` for `crypto.KeccakState` * cleaned up `OpCode.IsPush()` * eth/tracers: fix a bug in prestateTracer (ethereum#25884) * internal/ethapi: handle odd length hex in decodeHash (ethereum#25883) This change adds zero-padding (prefix) of odd nibbles in the decodeHash function. Co-authored-by: ty <[email protected]> * core: rework tx indexer (ethereum#25723) This PR reworks tx indexer a bit. Compared to the original version, one scenario is no longer handled - upgrading from legacy geth without indexer support. The tx indexer was introduced in 2020 and have been present through hardforks, so it can be assumed that all Geth nodes have tx indexer already. So we can simplify the tx indexer logic a bit: - If the tail flag is not present, it means node is just initialized may or may not with an ancient store attached. In this case all blocks are regarded as unindexed - If the tail flag is present, it means blocks below tail are unindexed, blocks above tail are indexed This change also address some weird cornercases that could make the indexer not work after a crash. * accounts/abi: return toGoType error immediately (ethereum#25565) * eth/tracers: remove revertReasonTracer, add revert reason to callTracer (ethereum#25508) * eth/tracers: add revertReason to callTracer * update callframe gen json * add revertal to calltrace test * accounts/abi/bind: parse ABI only once on bind (ethereum#25574) * accounts/abi/bind: parse ABI once on bind * accounts/abi/bind: suppress 'imported and not used' error for abi package * internal/flags: fix issue with stringslice migration (ethereum#25830) This fixes a cornercase bug where the flag migration would mess up the value of StringSlice flags. * cmd/geth, cmd/utils: geth attach with custom headers (ethereum#25829) This PR makes it possible to set custom headers, in particular for two scenarios: - geth attach - geth commands which can use --remotedb, e..g geth db inspect The ability to use custom headers is typically useful for connecting to cloud-apis, e.g. providing an infura- or alchemy key, or for that matter access-keys for environments behind cloudflare. Co-authored-by: Felix Lange <[email protected]> * core/types: add a testcase to TestLegacyReceiptDecoding (ethereum#25909) add a testcase to TestLegacyReceiptDecoding * eth/protocols/snap: serve snap requests when possible (ethereum#25644) This PR makes it so that the snap server responds to trie heal requests when possible, even if the snapshot does not exist. The idea being that it might prolong the lifetime of a state root, so we don't have to pivot quite as often. * eth, miner: add timeout for building sealing block (ethereum#25407) * eth, miner: add timeout for building sealing block * eth, cmd, miner: add newpayloadtimeout flag * eth, miner, cmd: address comments * eth, miner: minor fixes Co-authored-by: Martin Holst Swende <[email protected]> * all: fix docstrings * core: fix linter complaint (ethereum#25927) * eth/tracers: add diffMode to prestateTracer (ethereum#25422) Backwards compatibility warning: The result will from now on omit empty fields instead of including a zero value (e.g. no more `balance: '0x'`). The prestateTracer will now take an option `diffMode: bool`. In this mode the tracer will output the pre state and post data for the modified parts of state. Read-only accesses will be completely omitted. Creations (be it account or slot) will be signified by omission in the `pre` list and inclusion in `post`. Whereas deletion (be it account or slot) will be signified by inclusion in `pre` and omission in `post` list. Signed-off-by: Delweng <[email protected]> * eth/traces: add state limit (ethereum#25812) This PR introduces a new mechanism in chain tracer for preventing creating too many trace states. The workflow of chain tracer can be divided into several parts: - state creator generates trace state in a thread - state tracer retrieves the trace state and applies the tracing on top in another thread - state collector gathers all result from state tracer and stream to users It's basically a producer-consumer model here, while if we imagine that the state producer generates states too fast, then it will lead to accumulate lots of unused states in memory. Even worse, in path-based state scheme it will only keep the latest 128 states in memory, and the newly generated state will invalidate the oldest one by marking it as stale. The solution for fixing it is to limit the speed of state generation. If there are over 128 states un-consumed in memory, then the creation will be paused until the states are be consumed properly. * core/bloombits: speed up windows-test (ethereum#25844) core/bloombits: remove micro-sleep * core, ethclient/gethclient: improve flaky tests (ethereum#25918) * ethclient/gethclient: improve time-sensitive flaky test * eth/catalyst: fix (?) flaky test * core: stop blockchains in tests after use * core: fix dangling blockchain instances * core: rm whitespace * eth/gasprice, eth/tracers, consensus/clique: stop dangling blockchains in tests * all: address review concerns * core: goimports * eth/catalyst: fix another time-sensitive test * consensus/clique: add snapshot test run function * core: rename stop() to stopWithoutSaving() Co-authored-by: Felix Lange <[email protected]> * node: prevent exposing engine API on unauthenticated endpoint (ethereum#25939) * node: prevent exposing engine API on unauthenticated endpoint * node: improve RPC setup * eth/filters: fix for eth_getLogs failing with finalized- and safe tag (ethereum#25922) Prior to this change, f.begin (and possibly end) stay negative, leading to strange results later in the code. With this change, filters using "safe" and "finalized" block produce results consistent w/ the overall behavior of this RPC method. Co-authored-by: Martin Holst Swende <[email protected]> * cmd/geth: fix help output issues (ethereum#25941) This update resolves an issue where StringSliceFlag would not be rendered correctly in help output + mention that -H can be used multiple times Co-authored-by: Martin Holst Swende <[email protected]> * accounts/usbwallet: support Ledger Nano S Plus and FTS (ethereum#25933) * usbwallet support Ledger Nano S Plus * accounts/usbwallet: add definitions + ref to ledger docs Co-authored-by: Martin Holst Swende <[email protected]> * all: fix spelling mistakes (ethereum#25961) * cmd/geth, core: fix typo in comment (ethereum#25954) * fix typo on comment * typo "can't accept" * core/rawdb: provide more info on 'gap in the chain' error (ethereum#25938) * core/types: add more context around ErrInvalidChainID (ethereum#25367) This changes the error message for mismatching chain ID to show the given and expected value. Callers expecting this error must be changed to use errors.Is. * common/math: optimized modexp (+ fuzzer) (ethereum#25525) This adds a * core/vm, tests: optimized modexp + fuzzer * common/math: modexp optimizations * core/vm: special case base 1 in big modexp * core/vm: disable fastexp * tests/fuzzers/modexp: gofmt (ethereum#25972) * node: drop support for static & trusted node list files (ethereum#25610) This changes the node setup to ignore datadir files static-nodes.json trusted-nodes.json When these files are present, it an error will be printed to the log. * accounts/keystore: faster tests (ethereum#25827) This PR removes some optimistic tests -- a'la "do something, wait a while, and hope it has trickled through and continue" -- and instead uses some introspection to ensure that prerequisites are met. * eth/protocols/eth: fix typo in log message (ethereum#25969) * eth/filters, ethclient/gethclient: add fullTx option to pending tx filter (ethereum#25186) This PR adds a way to subscribe to the _full_ pending transactions, as opposed to just being notified about hashes. In use cases where client subscribes to newPendingTransactions and gets txhashes only to then request the actual transaction, the caller can now shortcut that flow and obtain the transactions directly. Co-authored-by: Felix Lange <[email protected]> * go.mod: upgrade github.com/dop251/goja (ethereum#25955) This upgrade pulls in a fix to handling of 'continue' in loops. * eth/tracers: fix the issue of panic in prestate with diffmode (ethereum#25957) In some cases, inner contract creation may not be successful, and an inner contract was not created. This PR fixes a crash that could occur when doing tracing in such situations. * Revert "go.mod: upgrade github.com/dop251/goja" (ethereum#25975) Revert "go.mod: upgrade github.com/dop251/goja (ethereum#25955)" This reverts commit 9207e34. * common/math, tests/fuzzers: use big.Int clone (ethereum#26006) * common/math, tests/fuzzers: use big.Int clone * common/math: license * cmd/utils: enable snapshot generation in import-mode (ethereum#25990) This PR fixes a regression causing snapshots not to be generated in "geth --import" mode. It also fixes the geth export command to be truly readonly, and adds a new test for geth export. * core/rawdb: refactor db key prefix (ethereum#26000) Co-authored-by: seven <[email protected]> * core/rawdb: open meta file in read only mode (ethereum#26009) * internal/ethapi, accounts/abi/backends: use error defined in core (ethereum#26012) Co-authored-by: seven <[email protected]> * eth/tracers: fix the issue prestate missing existing contract state (ethereum#25996) The prestate tracer did not report accounts that existed at a given address prior to a contract being created at that address. Signed-off-by: Delweng <[email protected]> Co-authored-by: Sina Mahmoodi <[email protected]> * eth/tracers: simplify test framework (ethereum#25973) Co-authored-by: Sina Mahmoodi <[email protected]> * all: refactor txpool into it's own package in prep for 4844 * core/types: rename tx files to group them better together * core, eth: for types with accurate size calcs, return uint64, not float (ethereum#26046) * core, eth: for types with accurate size calcs, return uint64, not float * core/types: proper tx size tests * core/types: extend tx size test with decoded sizes, fix error * core/txpool: fix linter Co-authored-by: Martin Holst Swende <[email protected]> * build: upgrade -dlgo version to Go 1.19.2 * accounts/scwallet: fix keycard data signing error (ethereum#25331) accounts/scwallet: fix keycard data signing * build: make ios work again (ethereum#26052) * core/vm: use optimized bigint (ethereum#26021) * eth/filters: change filter block to be by-ref (ethereum#26054) This PR changes the block field in the filter to be a pointer, to disambiguate between empty hash and no hash * core/rawdb: refactor db inspector for extending multiple ancient store (ethereum#25896) This PR ports a few changes from PBSS: - Fix the snapshot generator waiter in case the generation is not even initialized - Refactor db inspector for ancient store * cmd/evm: calc base fee if parent data is present (ethereum#26051) Currently, in order to chain together sequential valid t8n transitions the caller must manually calculate the block base fee. This PR adds support for the necessary parent fee market data to calculate the base fee for the current transition. Concretely, env is extended to accept the following: parentBaseFee parentGasUsed parentGasLimit Example usage can be found in ./cmd/evm/testdata/25. Co-authored-by: Martin Holst Swende <[email protected]> * eth/tracers: fix gasUsed for native and JS tracers (ethereum#26048) * eth/tracers: fix gasUsed in call tracer * fix js tracers gasUsed * fix legacy prestate tracer * fix restGas in test * drop intrinsicGas field from js tracers * cmd, eth: implement full-sync tester (ethereum#26035) This PR adds a parameter to startup, --synctarget. The synctarget flag is a developer-flag, that can be useful in some scenarios as a replacement for a CL node. It defines a fixed block sync target: geth --syncmode=full --synctarget=./block_15816882.hex_rlp The --synctarget is only made available during syncmode=full * rpc: update docstring (ethereum#26072) Co-authored-by: seven <[email protected]> * Fix trace call for inner reverts (ethereum#25971) Inner call reverts will now return the reason similar to the top-level call. Separately, if top-level call is of type CREATE and it fails, its `to` field will now be cleared to `0x00...00` instead of being set to the created address. * eth: implement eth/68 (ethereum#25980) * eth: implement eth/68 * eth/protocols/eth: added tx size to announcement * eth/protocols/eth: check equal lengths on receiving announcement * eth/protocols/eth: add +1 to tx size because of the type byte * eth: happy lint, add eth68 tests, enable eth68 * eth: various nitpick fixes on eth/68 * eth/protocols/eth: fix announced tx size wrt type byte Co-authored-by: MariusVanDerWijden <[email protected]> Co-authored-by: Péter Szilágyi <[email protected]> * eth/tracers: add withLog to callTracer (ethereum#25991) In some cases, it is desirable to capture what is triggered by each trace, when using the `callTracer`. For example: call `USDT.transfer` will trigger a `Transfer(from, to, value)` event. This PR adds the option to capture logs to the call tracer, by specifying `{"withLog": true}` in the tracerconfig. Any logs belonging to failed/reverted call-scopes are removed from the output, to prevent interpretation mistakes. Signed-off-by: Delweng <[email protected]> Co-authored-by: Sina Mahmoodi <[email protected]> * eth/tracers: prestateTracer - exclude unchanged storage slots in diffMode (ethereum#25944) Fixes ethereum#25943 * accounts/abi: return error on fixed bytes with size larger than 32 bytes (ethereum#26075) * fixed bytes with size larger than 32 bytes is not allowed * add testcase * consensus/ethash: fix typo (ethereum#26016) fix typo * docs/postmortems: remove wrong parentheses (ethereum#26066) Removed parentheses in line 71 because line 80 doesn't have them either. * miner, eth: implement recommit mechanism for payload building (ethereum#25836) * miner, eth: implement recommit for payload building * miner: address comments from marius * miner: fail early if core.NewBlockChain fails (ethereum#26079) don't ignore errors returned by core.NewBlockChain when initializing tests * p2p/discover: fix handling of distance 256 in lookupDistances (ethereum#26087) Noticed that lookupDistances for FINDNODE requests didn't consider 256 a valid distance. This is actually part of the example in the comment above the function, surprised that wasn't tested before. * rlp: add more tests for nil pointer / optional field encoding (ethereum#26077) * rpc: handle wrong HTTP batch response length (ethereum#26064) * cmd/clef: add `list-accounts` and `list-wallets` to CLI (ethereum#26080) This commit adds support for two new commands to clef, making it possible to list accounts / wallets from the command-line-interface. Co-authored-by: Martin Holst Swende <[email protected]> * merge devnet-v3 with latest master, part 1 * crypto/bls12381: docs - fix broken links to references (ethereum#26095) Signed-off-by: Abirdcfly <[email protected]> Signed-off-by: Delweng <[email protected]> Signed-off-by: meows <[email protected]> Co-authored-by: Guillaume Ballet <[email protected]> Co-authored-by: Justin Traglia <[email protected]> Co-authored-by: rjl493456442 <[email protected]> Co-authored-by: ucwong <[email protected]> Co-authored-by: Marius van der Wijden <[email protected]> Co-authored-by: Sina Mahmoodi <[email protected]> Co-authored-by: Felix Lange <[email protected]> Co-authored-by: zhiqiangxu <[email protected]> Co-authored-by: Martin Holst Swende <[email protected]> Co-authored-by: Péter Szilágyi <[email protected]> Co-authored-by: lightclient <[email protected]> Co-authored-by: xinbenlv <[email protected]> Co-authored-by: Abirdcfly <[email protected]> Co-authored-by: uji <[email protected]> Co-authored-by: Marius Kjærstad <[email protected]> Co-authored-by: Rachel Bousfield <[email protected]> Co-authored-by: Seungbae Yu <[email protected]> Co-authored-by: Jakub Freebit <[email protected]> Co-authored-by: aaronbuchwald <[email protected]> Co-authored-by: xternet <[email protected]> Co-authored-by: protolambda <[email protected]> Co-authored-by: Joshua Gutow <[email protected]> Co-authored-by: Amir Hossein <[email protected]> Co-authored-by: Darioush Jalali <[email protected]> Co-authored-by: Nicholas <[email protected]> Co-authored-by: Nicholas Zhao <[email protected]> Co-authored-by: Benjamin Prosnitz <[email protected]> Co-authored-by: Nicolas Gotchac <[email protected]> Co-authored-by: pinkiebell <[email protected]> Co-authored-by: George Carder <[email protected]> Co-authored-by: jwasinger <[email protected]> Co-authored-by: makcandrov <[email protected]> Co-authored-by: AtomicAzzaz <[email protected]> Co-authored-by: ewile <[email protected]> Co-authored-by: Delweng <[email protected]> Co-authored-by: Boqin@MetaSecureLabs <[email protected]> Co-authored-by: Sebastian Stammler <[email protected]> Co-authored-by: Zachinquarantine <[email protected]> Co-authored-by: omahs <[email protected]> Co-authored-by: Leon <[email protected]> Co-authored-by: meowsbits <[email protected]> Co-authored-by: Janko Simonovic <[email protected]> Co-authored-by: Alexey Shekhirin <[email protected]> Co-authored-by: lmittmann <[email protected]> Co-authored-by: TY <[email protected]> Co-authored-by: ty <[email protected]> Co-authored-by: Ceyhun Onur <[email protected]> Co-authored-by: Mikhail Vazhnov <[email protected]> Co-authored-by: Ryan Schneider <[email protected]> Co-authored-by: jin <[email protected]> Co-authored-by: Paul <[email protected]> Co-authored-by: Jens W <[email protected]> Co-authored-by: s7v7nislands <[email protected]> Co-authored-by: seven <[email protected]> Co-authored-by: Sina Mahmoodi <[email protected]> Co-authored-by: Marius Kjærstad <[email protected]> Co-authored-by: vdwijden <[email protected]> Co-authored-by: Sebastian Supreme <[email protected]> Co-authored-by: Jordan Krage <[email protected]> Co-authored-by: Joseph Cook <[email protected]>
* merge devnet-v3 with latest master (#43) * cmd. core: save preimages on genesis creation (ethereum#25538) force preimage dump for genesis * rlp/rlpgen: fix error handling when target type not found (ethereum#25547) typ will be nil when lookupStructType returns an error. cfg.Type should be used instead. * trie: improve node rlp decoding performance (ethereum#25357) This avoids copying the input []byte while decoding trie nodes. In most cases, particularly when the input slice is provided by the underlying database, this optimization is safe to use. For cases where the origin of the input slice is unclear, the copying version is retained. The new code performs better even when the input must be copied, because it is now only copied once in decodeNode. * all: fix some typos (ethereum#25551) * Fix some typos * Fix some mistakes * Revert 4byte.json * Fix an incorrect fix * Change files to fails * internal/ethapi: fix comment typo (ethereum#25548) * accounts/abi/bind/backends: typo fix (ethereum#25549) * eth, les: unlock downloader peerSet if there's an error (ethereum#25546) Unlock peerSet if there's an error in the downloader * cmd/geth: parse uint64 value with ParseUint instead of Atoi (ethereum#25545) Parse uint64 value with ParseUint instead of Atoi * consensus/beacon: check ttd reached on pos blocks (ethereum#25552) * consensus/beacon: check ttd reached on pos blocks * consensus/beacon: check ttd reached on pos blocks * consensus/beacon: check ttd reached on pos blocks * eth/filters: add global block logs cache (ethereum#25459) This adds a cache for block logs which is shared by all filters. The cache size of is configurable using the `--cache.blocklogs` flag. Co-authored-by: Felix Lange <[email protected]> * accounts/abi: fix set function (ethereum#25477) * accounts/abi: fix set function * don't break things * update test * internal/ethapi: fix build regression (ethereum#25555) * eth/fetcher: don't spend too much time on transaction inclusion (ethereum#25524) * eth/fetcher: introduce some lag in tx fetching * eth/fetcher: change conditions a bit * eth/fetcher: use per-batch quota check * eth/fetcher: fix some comments * eth/fetcher: address review concerns * eth/fetcher: fix panic + add warn log * eth/fetcher: fix log * eth/fetcher: fix log * cmd/devp2p/internal/ethtest: fix ignorign tx announcements from prev. tests * cmd/devp2p/internal/ethtest: fix TestLargeTxRequest This increases the number of tx relay messages the test waits for. Since go-ethereum now processes incoming txs in smaller batches, the announcement messages it sends are also smaller. Co-authored-by: Felix Lange <[email protected]> * Revert "eth/fetcher: don't spend too much time on transaction inclusion" (ethereum#25567) Revert "eth/fetcher: don't spend too much time on transaction inclusion (ethereum#25524)" This reverts commit 0ce494b. * eth/catalyst: warn less frequently if no beacon client is available (ethereum#25569) * eth/catalyst: warn less frequently if no beacon client is available * eth/catalyst: tweak warning frequency a bit * eth/catalyst: some more tweaks * Update api.go Co-authored-by: Felix Lange <[email protected]> * params: release go-ethereum v1.10.22 * params: begin v1.10.23 release cycle * core, eth/downloader: handle spurious junk bodies from racey rollbacks (ethereum#25578) * eth/downloader: handle junkbodies/receipts in the beacon sync * core: check for header presence when checking for blocks * core/state, trie: fix trie flush order for proper pruning * consensus/beacon: don't ignore errors * params: release Geth v1.10.23 * params: begin v1.10.24 release cycle * params: begin go-ethereum v1.11 release cycle * internal/ethapi: rename debug getters to match spec (ethereum#25176) Some small fixes to get the existing debug methods to conform to the spec. Mainly dropping the encoding information from the method name as it should be deduced from the debug context and allowing the method to be invoked by either block number or block hash. It also adds the method debug_getTransaction which returns the raw tx bytes by tx hash. This is pretty much equivalent to the eth_getRawTransactionByHash method. * accounts/abi/bind: add const for tx fee elasticity multiplier (ethereum#25504) Co-authored-by: Felix Lange <[email protected]> Co-authored-by: rjl493456442 <[email protected]> * all: remove duplicate word in comments (ethereum#25618) Signed-off-by: Abirdcfly <[email protected]> Signed-off-by: Abirdcfly <[email protected]> * cmd/geth: fix legacy receipt detection for empty db (ethereum#25609) * build: fix ignored errors (ethereum#25591) * docs: specify execution client (ethereum#25566) Co-authored-by: Felix Lange <[email protected]> * ethclient: add 'finalized' and 'safe' block number support (ethereum#25580) * node: change JWT error status to 401 Unauthorized (ethereum#25629) * node: fix regression in TestJWT (ethereum#25635) * all: move genesis initialization to blockchain (ethereum#25523) * all: move genesis initialization to blockchain * core: add one more check * core: fix tests * eth/catalyst: adjust eta for themerge (ethereum#25601) * eth/catalyst: adjust eta for themerge * squash * squash * eth/catalyst: address review concerns * mobile: close node on error (ethereum#25643) * graphql: return correct logs for tx (ethereum#25612) * graphql: fix tx logs * minor * Use optimized search for selecting tx logs * trie: fix grammar in comment (ethereum#25648) * eth/protocols/snap: fix problems due to idle-but-busy peers * trie: cleanup stateTrie (ethereum#25640) It's a trivial PR to hide the error log when the trie node is not found in the database. The idea for this change is for all TryXXX functions, the error is already returned and we don't need to fire a log explicitly. Recently there are a few tickets ethereum#25613 ethereum#25589 reporting that the trie nodes are missing because of debug.SetHead. The root cause is after resetting, the chain rewinds to a historical point and re-imports the blocks on top. Since the node is already synced and started to accept transactions previously, these transactions are still kept in the txpool and verified by txpool with a live state. This live state is constructed based on the live trie database, which is changed fast by node referencing and de-referencing. Unfortunately, when we construct a live state(like the state in txpool), we don't reference the state we have. The blockchain will garbage collect the intermediate version nodes in another thread which leads the broken live state. The best solution for this is to forcibly obtain a reference for all live states we create and call release function once it's used up. But it might end up with more junks persisted into disk. Will try to find an elegant solution later in the following PR. * eth/catalyst: prevent division by zero (ethereum#25654) eth/catalyst: prevent diff by zero * trie: better error reporting (ethereum#25645) * core/state: filter out nil trie for copy (ethereum#25575) * mobile: register filter APIs (ethereum#25642) This fixes a regression introduced in PR ethereum#25459. * README.md: improve grammar (ethereum#25646) Co-authored-by: Felix Lange <[email protected]> * eth/tracers/js: fill in log.refund field (ethereum#25661) For some reason, an accessor method for this field exists in JS, but the value was never actually assigned. * eth/fetcher: throttle peers which deliver many invalid transactions (ethereum#25573) Co-authored-by: Felix Lange <[email protected]> * node, rpc: add JWT auth support in client (ethereum#24911) This adds a generic mechanism for 'dial options' in the RPC client, and also implements a specific dial option for the JWT authentication mechanism used by the engine API. Some real tests for the server-side authentication handling are also added. Co-authored-by: Joshua Gutow <[email protected]> Co-authored-by: Felix Lange <[email protected]> * rpc: check that "version" is "2.0" in request objects (ethereum#25570) The JSON-RPC spec requires the "version" field to be exactly "2.0", so we should verify that. This change is not backwards-compatible with sloppy client implementations, but I decided to go ahead with it anyway because the failure will be caught via the returned error. * trie: fix typo in comment (ethereum#25667) * trie: fix unhandled error in test (ethereum#25628) * eth/tracers/js: improve integer types in log object (ethereum#25668) All fields related to gas must be represented as uint64. Depth is internally tracked as int, so it makes sense to also store it as int. * trie: check childrens' existence concurrently for snap heal * core, light, trie: remove DiskDB function from trie database (ethereum#25690) * params: update chts (ethereum#25707) * core/vm: rename RANDOM to PREVRANDAO (ethereum#25691) See: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-4399.md > This EIP supplants the semantics of the return value of existing DIFFICULTY (0x44) opcode and renames the opcode to PREVRANDAO (0x44). * all: cleanup tests (ethereum#25641) Follow-up to PR ethereum#25523 to cleanup all relevant tests. * eth, les: rework chain tracer (ethereum#25143) This PR simplifies the logic of chain tracer and also adds the unit tests. The most important change has been made in this PR is the state management. Whenever a tracing state is acquired there is a corresponding release function be returned as well. It must be called once the state is used up, otherwise resource leaking can happen. And also the logic of state management has been simplified a lot. Specifically, the state provider(eth backend, les backend) should ensure the state is available and referenced. State customers can use the state according to their own needs, or build other states based on the given state. But once the release function is called, there is no guarantee of the availability of the state. Co-authored-by: Sina Mahmoodi <[email protected]> Co-authored-by: Péter Szilágyi <[email protected]> * eth/tracer: fix broken test (ethereum#25715) * trie: update comments + err check for preimages (ethereum#25672) This PR includes minor updates to comments in trie/committer that reference insertion to the db, and adds an err != nil check for the return value of preimages.commit. * eth/protocols/snap: throttle trie heal requests when peers DoS us (ethereum#25666) * eth/protocols/snap: throttle trie heal requests when peers DoS us * eth/protocols/snap: lower heal throttle log to debug Co-authored-by: Martin Holst Swende <[email protected]> * eth/protocols/snap: fix comment Co-authored-by: Martin Holst Swende <[email protected]> * p2p/msgrate: be more lenient when calculating 'mean' (ethereum#25653) The p2p msgrate tracker is a thing which tries to estimate some mean round-trip times. However, it did so in a very curious way: if a node had 200 peers, it would sort their 200 respective rtt estimates, and then it would pick item number 2 as the mean. So effectively taking third fastest and calling it mean. This probably works "ok" when the number of peers are low (there are other factors too, such as ttlScaling which takes some of the edge off this) -- however when the number of peers is high, it becomes very skewed. This PR instead bases the 'mean' on the square root of the length of the list. Still pretty harsh, but a bit more lenient. * rpc: improve error codes for internal server errors (ethereum#25678) This changes the error code returned by the RPC server in certain situations: - handler panic: code -32603 - result marshaling error: code -32603 - attempt to subscribe via HTTP: code -32001 In all of the above cases, the server previously returned the default error code -32000. Co-authored-by: Nicholas Zhao <[email protected]> Co-authored-by: Felix Lange <[email protected]> * core: place a cap on reorglogs (ethereum#25711) This PR makes the event-sending for deleted and new logs happen in batches, to prevent OOM situation due to large reorgs. Co-authored-by: Felix Lange <[email protected]> * build: upgrade to go 1.19 (ethereum#25726) This changes the CI / release builds to use the latest Go version. It also upgrades golangci-lint to a newer version compatible with Go 1.19. In Go 1.19, godoc has gained official support for links and lists. The syntax for code blocks in doc comments has changed and now requires a leading tab character. gofmt adapts comments to the new syntax automatically, so there are a lot of comment re-formatting changes in this PR. We need to apply the new format in order to pass the CI lint stage with Go 1.19. With the linter upgrade, I have decided to disable 'gosec' - it produces too many false-positive warnings. The 'deadcode' and 'varcheck' linters have also been removed because golangci-lint warns about them being unmaintained. 'unused' provides similar coverage and we already have it enabled, so we don't lose much with this change. * p2p/discover/v5wire: reject packets smaller than 63 bytes (ethereum#25740) * core: preallocate maps in TxPool helper methods (ethereum#25737) * accounts/abi: fix typo in error message (ethereum#25742) * graphql: fixes missing tx logs (ethereum#25745) * graphql: fix tx logs * graphql: refactor test service setup * graphql: add test for tx logs * cmd/geth: add a verkle subcommand (ethereum#25718) * cmd/geth: add a verkle subcommand * fix copyright year * remove unused command parameters * check that the output file was successfully written to Co-authored-by: Martin Holst Swende <[email protected]> * cmd/geth: goimports fix Co-authored-by: Martin Holst Swende <[email protected]> * node: fix HTTP server always force closing (ethereum#25755) Co-authored-by: Felix Lange <[email protected]> * core: fix log order in "Imported new chain segment" (ethereum#25768) * node: fix lint issue in rpcstack.go (ethereum#25774) * les/catalyst/api: add support for ExchangeTransitionConfigurationV1 (ethereum#25752) This method is missing in light client mode and breaks consensus clients that require a valid response. * params: set TerminalTotalDifficultyPassed to true (ethereum#25769) * params: set TerminalTotalDifficultyPassed to true * Update params/config.go Co-authored-by: Martin Holst Swende <[email protected]> * trie: handle more batch commit errors in Database (ethereum#25674) * core/rawdb: fix leak of backoff timer (ethereum#25776) * crypto/bls12381: docfix of g1 Affine (ethereum#25729) bls12381: docfix of g1 Affine. * internal/ethapi: return error when requesting invalid trie key (ethereum#25762) This change makes eth_getProof and eth_getStorageAt return an error when the argument contains invalid hex in storage keys. Co-authored-by: Felix Lange <[email protected]> * core: don't cache zero nonce in txNoncer (ethereum#25603) This changes the nonce cache used by TxPool to not store cached nonces for non-existing accounts. * core: more compact bad block report (ethereum#25714) This shortens the chain config summary in bad block reports, and adds go-ethereum version information as well. Co-authored-by: Felix Lange <[email protected]> * core: move build version reading to its own package (ethereum#25806) This fixes the build with Go 1.17, which does not have BuildInfo.Settings yet. * eth: fix a rare datarace on CHT challenge reply / shutdown * core/vm: return copy of input slice in identity precompile, avoid returndata copy (ethereum#25183) * core/vm: return copy of input slice in identity precompile. don't deep copy return data slice upon call completion * make use of common.CopyBytes * core/blockchain: downgrade tx indexing and unindexing logs (ethereum#25832) core/blockchain: downgrade tx indexing and unindexing logs from info to debug If a user has a finite tx lookup limit, they will see an "unindexing" info level log each time a block is imported. This information might help a user understand that they are removing the index each block and some txs may not be retrievable by hash, but overall it is generally more of a nuisance than a benefit. This change downgrades the log to a debug log. * eth/tracers: fix trace config for `TraceCall` (ethereum#25821) Co-authored-by: AtomicAzzaz <[email protected]> Co-authored-by: ewile <[email protected]> * eth/catalyst: add locking around newpayload (ethereum#25816) Sometimes we get stuck on db compaction, and the CL re-issues the "same" command to us multiple times. Each request get stuck on the same place, in the middle of the handler. This changes makes it so we do not reprocess the same payload, but instead detects it early. * eth/catalyst: make tests run faster (ethereum#25818) * cmd/utils: make --authrpc.jwtsecret a DirectoryFlag (ethereum#25849) Signed-off-by: Delweng <[email protected]> * eth/protocols/snap: make log messages more clear that sync is ongoing (ethereum#25837) * eth/protocols/snap: make log messages more clear that sync is ongoing * Update sync.go Co-authored-by: Felix Lange <[email protected]> * .github: add CL client to issue template (ethereum#25814) * p2p: add channel buffers to avoid goroutine leaks in tests (ethereum#24929) * internal/version: use gitCommit injection in version handling code (ethereum#25851) This changes the CI build to store the git commit and date into package internal/version instead of package main. Doing this essentially merges our two ways of tracking the go-ethereum version into a single place, achieving two objectives: - Bad block reports, which use version.Info(), will now have the git commit information even when geth is built in an environment such as launchpad.net where git access is unavailable. - For geth builds created by `go build ./cmd/geth` (i.e. not using `go run build/ci.go install`), git information stored by the go tool is now used in the p2p node name as well as in `geth version` and `geth version-check`. * cmd/abigen: change --exc to exclude by type name (ethereum#22620) The abigen exclusion pattern, previously on the form "path:type", now supports wildcards. Examples "*:type" to exclude a named type in all files, or "/path/to/foo.sol:*" all types in foo.sol. * tests, les, eth: remove mentions of deprecated Morden testnet (ethereum#23570) * remove morden * Update commons.go * Update handler.go * empty commit to make appveyor happy * all: clean up the configs for pruner and snapshotter (ethereum#22396) This PR cleans up the configurations for pruner and snapshotter by passing a config struct. And also, this PR disables the snapshot background generation if the chain is opened in "read-only" mode. The read-only mode is necessary in some cases. For example, we have a list of commands to open the etheruem node in "read-only" mode, like export-chain. In these cases, the snapshot background generation is non expected and should be banned explicitly. * cmd/puppeth, cmd/utils: finalize removal of gasTarget flag (ethereum#24370) This PR fully removes the --miner.gastarget flag, as previously it was only hidden from the geth --help command, but could still be used. * core/types: improve accuracy of header.Size() (ethereum#25859) The header.Size() method did not take the basefee into account. * eth/tracers: pad memory slice on OOB case (ethereum#25213) * eth/tracers: pad memory slice on oob case * eth/tracers/js: fix testfailure due to err msg capitalization Co-authored-by: Martin Holst Swende <[email protected]> * cmd/faucet: fix readme typos (ethereum#25867) * Fix: typos Fix: typos * Undo change Undo change * core: fix datarace in txpool, fixes ethereum#25870 and ethereum#25869 (ethereum#25872) core: fix datarace in txpool pendingnoce, fixes ethereum#25870 * eth/downloader, les/downloader: fix subtle flaw in queue delivery (ethereum#25861) * fix queue.deliver * les/downloader: fix queue.deliver Co-authored-by: Martin Holst Swende <[email protected]> * core/vm: better handle error on eip activation check (ethereum#25131) * core/vm: correct logic for eip check of NewEVMInterpreter * refactor * cmd/geth: make dumpgenesis load genesis datadir if it exists (ethereum#25135) `geth dumpgenesis` currently does not respect the content of the data directory. Instead, it outputs the genesis block created by command-line flags. This PR fixes it to read the genesis from the database, if the database already exists. Co-authored-by: Martin Holst Swende <[email protected]> * tests: fix state test error checking (ethereum#25702) Some tests define an 'expectException' error but the tests runner does not check for conditions where this test value is filled (error expected) but in which no error is returned by the test runner. An example of this scenario is GeneralStateTests/stTransactionTest/HighGasPrice.json, which expects a 'TR_NoFunds' error, but the test runner does not return any error. Signed-off-by: meows <[email protected]> * eth/tracers: use gencodec for native tracers (ethereum#25637) The call tracer and prestate tracer store data JSON-encoded in memory. In order to support alternative encodings (specifically RLP), it's better to keep data a native format during tracing. This PR does marshalling at the end, using gencodec. OBS! This PR changes the call tracer result slightly: - Order of type and value fields are changed (should not matter). - Output fields are completely omitted when they're empty (no more output: "0x"). Previously, this was only _sometimes_ omitted (e.g. when call ended in a non-revert error) and otherwise 0x when the output was actually empty. * cmd, core, eth, les, light: track deleted nodes (ethereum#25757) * cmd, core, eth, les, light: track deleted nodes * trie: add docs * trie: address comments * cmd, core, eth, les, light, trie: trie id * trie: add tests * trie, core: updates * trie: fix imports * trie: add utility print-method for nodeset * trie: import err * trie: fix go vet warnings Co-authored-by: Martin Holst Swende <[email protected]> * eth: return state error via GetEVM (ethereum#25876) * make vmError more useful * fix for review * Update api.go * revert calling site Co-authored-by: rjl493456442 <[email protected]> * eth/downloader: make flakey test less flakey (ethereum#25879) * ethclient/gethclient: fix bugs in override object encoding (ethereum#25616) This fixes a bug where contract code would be overridden to empty code ("0x") when the Code field of OverrideAccount was left nil. The change also cleans up the encoding of overrides to only send necessary fields, and improves documentation. Fixes ethereum#25615 Co-authored-by: Felix Lange <[email protected]> Co-authored-by: Martin Holst Swende <[email protected]> * trie, eth/protocols/snap: less tiny db-writes during trie-healing (ethereum#25681) This PR prevent making tiny writes during state healing, by only performing the batch-write if the accumulated data is large enough to be meaningful. * accounts/abi/bind/backends: fix AdjustTime to respect Fork (ethereum#25225) * tests: report mgas/s metric in evm benchmarks (ethereum#25700) * test(state): report mgas/s metric in EVM benchmark * revert testdata submodule update * aggregate mgas/s results * calculate elapsed time better * tests: benchmarks - handle access list + take refund into account Co-authored-by: Martin Holst Swende <[email protected]> * core/vm: minor trivial clean up (ethereum#25880) * dropped `vm.keccakState` for `crypto.KeccakState` * cleaned up `OpCode.IsPush()` * eth/tracers: fix a bug in prestateTracer (ethereum#25884) * internal/ethapi: handle odd length hex in decodeHash (ethereum#25883) This change adds zero-padding (prefix) of odd nibbles in the decodeHash function. Co-authored-by: ty <[email protected]> * core: rework tx indexer (ethereum#25723) This PR reworks tx indexer a bit. Compared to the original version, one scenario is no longer handled - upgrading from legacy geth without indexer support. The tx indexer was introduced in 2020 and have been present through hardforks, so it can be assumed that all Geth nodes have tx indexer already. So we can simplify the tx indexer logic a bit: - If the tail flag is not present, it means node is just initialized may or may not with an ancient store attached. In this case all blocks are regarded as unindexed - If the tail flag is present, it means blocks below tail are unindexed, blocks above tail are indexed This change also address some weird cornercases that could make the indexer not work after a crash. * accounts/abi: return toGoType error immediately (ethereum#25565) * eth/tracers: remove revertReasonTracer, add revert reason to callTracer (ethereum#25508) * eth/tracers: add revertReason to callTracer * update callframe gen json * add revertal to calltrace test * accounts/abi/bind: parse ABI only once on bind (ethereum#25574) * accounts/abi/bind: parse ABI once on bind * accounts/abi/bind: suppress 'imported and not used' error for abi package * internal/flags: fix issue with stringslice migration (ethereum#25830) This fixes a cornercase bug where the flag migration would mess up the value of StringSlice flags. * cmd/geth, cmd/utils: geth attach with custom headers (ethereum#25829) This PR makes it possible to set custom headers, in particular for two scenarios: - geth attach - geth commands which can use --remotedb, e..g geth db inspect The ability to use custom headers is typically useful for connecting to cloud-apis, e.g. providing an infura- or alchemy key, or for that matter access-keys for environments behind cloudflare. Co-authored-by: Felix Lange <[email protected]> * core/types: add a testcase to TestLegacyReceiptDecoding (ethereum#25909) add a testcase to TestLegacyReceiptDecoding * eth/protocols/snap: serve snap requests when possible (ethereum#25644) This PR makes it so that the snap server responds to trie heal requests when possible, even if the snapshot does not exist. The idea being that it might prolong the lifetime of a state root, so we don't have to pivot quite as often. * eth, miner: add timeout for building sealing block (ethereum#25407) * eth, miner: add timeout for building sealing block * eth, cmd, miner: add newpayloadtimeout flag * eth, miner, cmd: address comments * eth, miner: minor fixes Co-authored-by: Martin Holst Swende <[email protected]> * all: fix docstrings * core: fix linter complaint (ethereum#25927) * eth/tracers: add diffMode to prestateTracer (ethereum#25422) Backwards compatibility warning: The result will from now on omit empty fields instead of including a zero value (e.g. no more `balance: '0x'`). The prestateTracer will now take an option `diffMode: bool`. In this mode the tracer will output the pre state and post data for the modified parts of state. Read-only accesses will be completely omitted. Creations (be it account or slot) will be signified by omission in the `pre` list and inclusion in `post`. Whereas deletion (be it account or slot) will be signified by inclusion in `pre` and omission in `post` list. Signed-off-by: Delweng <[email protected]> * eth/traces: add state limit (ethereum#25812) This PR introduces a new mechanism in chain tracer for preventing creating too many trace states. The workflow of chain tracer can be divided into several parts: - state creator generates trace state in a thread - state tracer retrieves the trace state and applies the tracing on top in another thread - state collector gathers all result from state tracer and stream to users It's basically a producer-consumer model here, while if we imagine that the state producer generates states too fast, then it will lead to accumulate lots of unused states in memory. Even worse, in path-based state scheme it will only keep the latest 128 states in memory, and the newly generated state will invalidate the oldest one by marking it as stale. The solution for fixing it is to limit the speed of state generation. If there are over 128 states un-consumed in memory, then the creation will be paused until the states are be consumed properly. * core/bloombits: speed up windows-test (ethereum#25844) core/bloombits: remove micro-sleep * core, ethclient/gethclient: improve flaky tests (ethereum#25918) * ethclient/gethclient: improve time-sensitive flaky test * eth/catalyst: fix (?) flaky test * core: stop blockchains in tests after use * core: fix dangling blockchain instances * core: rm whitespace * eth/gasprice, eth/tracers, consensus/clique: stop dangling blockchains in tests * all: address review concerns * core: goimports * eth/catalyst: fix another time-sensitive test * consensus/clique: add snapshot test run function * core: rename stop() to stopWithoutSaving() Co-authored-by: Felix Lange <[email protected]> * node: prevent exposing engine API on unauthenticated endpoint (ethereum#25939) * node: prevent exposing engine API on unauthenticated endpoint * node: improve RPC setup * eth/filters: fix for eth_getLogs failing with finalized- and safe tag (ethereum#25922) Prior to this change, f.begin (and possibly end) stay negative, leading to strange results later in the code. With this change, filters using "safe" and "finalized" block produce results consistent w/ the overall behavior of this RPC method. Co-authored-by: Martin Holst Swende <[email protected]> * cmd/geth: fix help output issues (ethereum#25941) This update resolves an issue where StringSliceFlag would not be rendered correctly in help output + mention that -H can be used multiple times Co-authored-by: Martin Holst Swende <[email protected]> * accounts/usbwallet: support Ledger Nano S Plus and FTS (ethereum#25933) * usbwallet support Ledger Nano S Plus * accounts/usbwallet: add definitions + ref to ledger docs Co-authored-by: Martin Holst Swende <[email protected]> * all: fix spelling mistakes (ethereum#25961) * cmd/geth, core: fix typo in comment (ethereum#25954) * fix typo on comment * typo "can't accept" * core/rawdb: provide more info on 'gap in the chain' error (ethereum#25938) * core/types: add more context around ErrInvalidChainID (ethereum#25367) This changes the error message for mismatching chain ID to show the given and expected value. Callers expecting this error must be changed to use errors.Is. * common/math: optimized modexp (+ fuzzer) (ethereum#25525) This adds a * core/vm, tests: optimized modexp + fuzzer * common/math: modexp optimizations * core/vm: special case base 1 in big modexp * core/vm: disable fastexp * tests/fuzzers/modexp: gofmt (ethereum#25972) * node: drop support for static & trusted node list files (ethereum#25610) This changes the node setup to ignore datadir files static-nodes.json trusted-nodes.json When these files are present, it an error will be printed to the log. * accounts/keystore: faster tests (ethereum#25827) This PR removes some optimistic tests -- a'la "do something, wait a while, and hope it has trickled through and continue" -- and instead uses some introspection to ensure that prerequisites are met. * eth/protocols/eth: fix typo in log message (ethereum#25969) * eth/filters, ethclient/gethclient: add fullTx option to pending tx filter (ethereum#25186) This PR adds a way to subscribe to the _full_ pending transactions, as opposed to just being notified about hashes. In use cases where client subscribes to newPendingTransactions and gets txhashes only to then request the actual transaction, the caller can now shortcut that flow and obtain the transactions directly. Co-authored-by: Felix Lange <[email protected]> * go.mod: upgrade github.com/dop251/goja (ethereum#25955) This upgrade pulls in a fix to handling of 'continue' in loops. * eth/tracers: fix the issue of panic in prestate with diffmode (ethereum#25957) In some cases, inner contract creation may not be successful, and an inner contract was not created. This PR fixes a crash that could occur when doing tracing in such situations. * Revert "go.mod: upgrade github.com/dop251/goja" (ethereum#25975) Revert "go.mod: upgrade github.com/dop251/goja (ethereum#25955)" This reverts commit 9207e34. * common/math, tests/fuzzers: use big.Int clone (ethereum#26006) * common/math, tests/fuzzers: use big.Int clone * common/math: license * cmd/utils: enable snapshot generation in import-mode (ethereum#25990) This PR fixes a regression causing snapshots not to be generated in "geth --import" mode. It also fixes the geth export command to be truly readonly, and adds a new test for geth export. * core/rawdb: refactor db key prefix (ethereum#26000) Co-authored-by: seven <[email protected]> * core/rawdb: open meta file in read only mode (ethereum#26009) * internal/ethapi, accounts/abi/backends: use error defined in core (ethereum#26012) Co-authored-by: seven <[email protected]> * eth/tracers: fix the issue prestate missing existing contract state (ethereum#25996) The prestate tracer did not report accounts that existed at a given address prior to a contract being created at that address. Signed-off-by: Delweng <[email protected]> Co-authored-by: Sina Mahmoodi <[email protected]> * eth/tracers: simplify test framework (ethereum#25973) Co-authored-by: Sina Mahmoodi <[email protected]> * all: refactor txpool into it's own package in prep for 4844 * core/types: rename tx files to group them better together * core, eth: for types with accurate size calcs, return uint64, not float (ethereum#26046) * core, eth: for types with accurate size calcs, return uint64, not float * core/types: proper tx size tests * core/types: extend tx size test with decoded sizes, fix error * core/txpool: fix linter Co-authored-by: Martin Holst Swende <[email protected]> * build: upgrade -dlgo version to Go 1.19.2 * accounts/scwallet: fix keycard data signing error (ethereum#25331) accounts/scwallet: fix keycard data signing * build: make ios work again (ethereum#26052) * core/vm: use optimized bigint (ethereum#26021) * eth/filters: change filter block to be by-ref (ethereum#26054) This PR changes the block field in the filter to be a pointer, to disambiguate between empty hash and no hash * core/rawdb: refactor db inspector for extending multiple ancient store (ethereum#25896) This PR ports a few changes from PBSS: - Fix the snapshot generator waiter in case the generation is not even initialized - Refactor db inspector for ancient store * cmd/evm: calc base fee if parent data is present (ethereum#26051) Currently, in order to chain together sequential valid t8n transitions the caller must manually calculate the block base fee. This PR adds support for the necessary parent fee market data to calculate the base fee for the current transition. Concretely, env is extended to accept the following: parentBaseFee parentGasUsed parentGasLimit Example usage can be found in ./cmd/evm/testdata/25. Co-authored-by: Martin Holst Swende <[email protected]> * eth/tracers: fix gasUsed for native and JS tracers (ethereum#26048) * eth/tracers: fix gasUsed in call tracer * fix js tracers gasUsed * fix legacy prestate tracer * fix restGas in test * drop intrinsicGas field from js tracers * cmd, eth: implement full-sync tester (ethereum#26035) This PR adds a parameter to startup, --synctarget. The synctarget flag is a developer-flag, that can be useful in some scenarios as a replacement for a CL node. It defines a fixed block sync target: geth --syncmode=full --synctarget=./block_15816882.hex_rlp The --synctarget is only made available during syncmode=full * rpc: update docstring (ethereum#26072) Co-authored-by: seven <[email protected]> * Fix trace call for inner reverts (ethereum#25971) Inner call reverts will now return the reason similar to the top-level call. Separately, if top-level call is of type CREATE and it fails, its `to` field will now be cleared to `0x00...00` instead of being set to the created address. * eth: implement eth/68 (ethereum#25980) * eth: implement eth/68 * eth/protocols/eth: added tx size to announcement * eth/protocols/eth: check equal lengths on receiving announcement * eth/protocols/eth: add +1 to tx size because of the type byte * eth: happy lint, add eth68 tests, enable eth68 * eth: various nitpick fixes on eth/68 * eth/protocols/eth: fix announced tx size wrt type byte Co-authored-by: MariusVanDerWijden <[email protected]> Co-authored-by: Péter Szilágyi <[email protected]> * eth/tracers: add withLog to callTracer (ethereum#25991) In some cases, it is desirable to capture what is triggered by each trace, when using the `callTracer`. For example: call `USDT.transfer` will trigger a `Transfer(from, to, value)` event. This PR adds the option to capture logs to the call tracer, by specifying `{"withLog": true}` in the tracerconfig. Any logs belonging to failed/reverted call-scopes are removed from the output, to prevent interpretation mistakes. Signed-off-by: Delweng <[email protected]> Co-authored-by: Sina Mahmoodi <[email protected]> * eth/tracers: prestateTracer - exclude unchanged storage slots in diffMode (ethereum#25944) Fixes ethereum#25943 * accounts/abi: return error on fixed bytes with size larger than 32 bytes (ethereum#26075) * fixed bytes with size larger than 32 bytes is not allowed * add testcase * consensus/ethash: fix typo (ethereum#26016) fix typo * docs/postmortems: remove wrong parentheses (ethereum#26066) Removed parentheses in line 71 because line 80 doesn't have them either. * miner, eth: implement recommit mechanism for payload building (ethereum#25836) * miner, eth: implement recommit for payload building * miner: address comments from marius * miner: fail early if core.NewBlockChain fails (ethereum#26079) don't ignore errors returned by core.NewBlockChain when initializing tests * p2p/discover: fix handling of distance 256 in lookupDistances (ethereum#26087) Noticed that lookupDistances for FINDNODE requests didn't consider 256 a valid distance. This is actually part of the example in the comment above the function, surprised that wasn't tested before. * rlp: add more tests for nil pointer / optional field encoding (ethereum#26077) * rpc: handle wrong HTTP batch response length (ethereum#26064) * cmd/clef: add `list-accounts` and `list-wallets` to CLI (ethereum#26080) This commit adds support for two new commands to clef, making it possible to list accounts / wallets from the command-line-interface. Co-authored-by: Martin Holst Swende <[email protected]> * merge devnet-v3 with latest master, part 1 * crypto/bls12381: docs - fix broken links to references (ethereum#26095) Signed-off-by: Abirdcfly <[email protected]> Signed-off-by: Delweng <[email protected]> Signed-off-by: meows <[email protected]> Co-authored-by: Guillaume Ballet <[email protected]> Co-authored-by: Justin Traglia <[email protected]> Co-authored-by: rjl493456442 <[email protected]> Co-authored-by: ucwong <[email protected]> Co-authored-by: Marius van der Wijden <[email protected]> Co-authored-by: Sina Mahmoodi <[email protected]> Co-authored-by: Felix Lange <[email protected]> Co-authored-by: zhiqiangxu <[email protected]> Co-authored-by: Martin Holst Swende <[email protected]> Co-authored-by: Péter Szilágyi <[email protected]> Co-authored-by: lightclient <[email protected]> Co-authored-by: xinbenlv <[email protected]> Co-authored-by: Abirdcfly <[email protected]> Co-authored-by: uji <[email protected]> Co-authored-by: Marius Kjærstad <[email protected]> Co-authored-by: Rachel Bousfield <[email protected]> Co-authored-by: Seungbae Yu <[email protected]> Co-authored-by: Jakub Freebit <[email protected]> Co-authored-by: aaronbuchwald <[email protected]> Co-authored-by: xternet <[email protected]> Co-authored-by: protolambda <[email protected]> Co-authored-by: Joshua Gutow <[email protected]> Co-authored-by: Amir Hossein <[email protected]> Co-authored-by: Darioush Jalali <[email protected]> Co-authored-by: Nicholas <[email protected]> Co-authored-by: Nicholas Zhao <[email protected]> Co-authored-by: Benjamin Prosnitz <[email protected]> Co-authored-by: Nicolas Gotchac <[email protected]> Co-authored-by: pinkiebell <[email protected]> Co-authored-by: George Carder <[email protected]> Co-authored-by: jwasinger <[email protected]> Co-authored-by: makcandrov <[email protected]> Co-authored-by: AtomicAzzaz <[email protected]> Co-authored-by: ewile <[email protected]> Co-authored-by: Delweng <[email protected]> Co-authored-by: Boqin@MetaSecureLabs <[email protected]> Co-authored-by: Sebastian Stammler <[email protected]> Co-authored-by: Zachinquarantine <[email protected]> Co-authored-by: omahs <[email protected]> Co-authored-by: Leon <[email protected]> Co-authored-by: meowsbits <[email protected]> Co-authored-by: Janko Simonovic <[email protected]> Co-authored-by: Alexey Shekhirin <[email protected]> Co-authored-by: lmittmann <[email protected]> Co-authored-by: TY <[email protected]> Co-authored-by: ty <[email protected]> Co-authored-by: Ceyhun Onur <[email protected]> Co-authored-by: Mikhail Vazhnov <[email protected]> Co-authored-by: Ryan Schneider <[email protected]> Co-authored-by: jin <[email protected]> Co-authored-by: Paul <[email protected]> Co-authored-by: Jens W <[email protected]> Co-authored-by: s7v7nislands <[email protected]> Co-authored-by: seven <[email protected]> Co-authored-by: Sina Mahmoodi <[email protected]> Co-authored-by: Marius Kjærstad <[email protected]> Co-authored-by: vdwijden <[email protected]> Co-authored-by: Sebastian Supreme <[email protected]> Co-authored-by: Jordan Krage <[email protected]> Co-authored-by: Joseph Cook <[email protected]> * remove legacy kzg verification, put all initialization on top (#44) * add header & block fields for Withdrawals (#45) * add header & block fields for Withdrawals * Update cmd/evm/internal/t8ntool/block.go Co-authored-by: Inphi <[email protected]> Co-authored-by: Inphi <[email protected]> * use go-kzg PolyLinComb instead of local impl * make verify_kzg_proof apis more closely mimic the specs (#46) * move more low-level kzg stuff into kzg_new (#48) * start using custom types from the 4844 spec * move ComputePowers into kzg_new * 1) move BlobsToKZGCommitment functionality into kzg_new and make it more closely follow the spec. 2) Remove the BlobsBatch stuff which seems only to be for legacy benchmarking. * Replace kzg-related data_blob.go type methods Parse, ComputeCommitment, and Point, so we can move methods that depend on them into the kzg package. * Remove ComputeCommitments which is unused. * Add BytesToBLSField go kzg_new, use it instead of hashToFr * Update KZG library according to latest consensus spec changes (#49) * Replace kzg-related data_blob.go type methods Parse, ComputeCommitment, and Point, so we can move methods that depend on them into the kzg package. * Remove ComputeCommitments which is unused. * Migrate remaining EIP-4844 consensus spec code into kzg_new, updated to include the latest consensus spec updates. * Start implementing a bytes API with appropriate interfaces Also fix incorrect hash type (Keccac -> Sha256) when computing versioned hash. * pure bytes API for VerifyKZGProof per 3097, and move kzg_new back into kzg.go now that updates are near complete * rename verifyBlobs validateBlobTransactionWrapper per updated spec, and make implementation more closely follow it * fix tests & type bug in kzg verification * more consensus layer support in kzg package * remove aggregated proof from blobs bundle * propagate malformed blob errors when processing a sent transaction so that these get rejected * move more CL eip-4844 methods from prysm to shared lib (#50) Signed-off-by: Abirdcfly <[email protected]> Signed-off-by: Delweng <[email protected]> Signed-off-by: meows <[email protected]> Co-authored-by: Guillaume Ballet <[email protected]> Co-authored-by: Justin Traglia <[email protected]> Co-authored-by: rjl493456442 <[email protected]> Co-authored-by: ucwong <[email protected]> Co-authored-by: Marius van der Wijden <[email protected]> Co-authored-by: Sina Mahmoodi <[email protected]> Co-authored-by: Felix Lange <[email protected]> Co-authored-by: zhiqiangxu <[email protected]> Co-authored-by: Martin Holst Swende <[email protected]> Co-authored-by: Péter Szilágyi <[email protected]> Co-authored-by: lightclient <[email protected]> Co-authored-by: xinbenlv <[email protected]> Co-authored-by: Abirdcfly <[email protected]> Co-authored-by: uji <[email protected]> Co-authored-by: Marius Kjærstad <[email protected]> Co-authored-by: Rachel Bousfield <[email protected]> Co-authored-by: Seungbae Yu <[email protected]> Co-authored-by: Jakub Freebit <[email protected]> Co-authored-by: aaronbuchwald <[email protected]> Co-authored-by: xternet <[email protected]> Co-authored-by: protolambda <[email protected]> Co-authored-by: Joshua Gutow <[email protected]> Co-authored-by: Amir Hossein <[email protected]> Co-authored-by: Darioush Jalali <[email protected]> Co-authored-by: Nicholas <[email protected]> Co-authored-by: Nicholas Zhao <[email protected]> Co-authored-by: Benjamin Prosnitz <[email protected]> Co-authored-by: Nicolas Gotchac <[email protected]> Co-authored-by: pinkiebell <[email protected]> Co-authored-by: George Carder <[email protected]> Co-authored-by: jwasinger <[email protected]> Co-authored-by: makcandrov <[email protected]> Co-authored-by: AtomicAzzaz <[email protected]> Co-authored-by: ewile <[email protected]> Co-authored-by: Delweng <[email protected]> Co-authored-by: Boqin@MetaSecureLabs <[email protected]> Co-authored-by: Sebastian Stammler <[email protected]> Co-authored-by: Zachinquarantine <[email protected]> Co-authored-by: omahs <[email protected]> Co-authored-by: Leon <[email protected]> Co-authored-by: meowsbits <[email protected]> Co-authored-by: Janko Simonovic <[email protected]> Co-authored-by: Alexey Shekhirin <[email protected]> Co-authored-by: lmittmann <[email protected]> Co-authored-by: TY <[email protected]> Co-authored-by: ty <[email protected]> Co-authored-by: Ceyhun Onur <[email protected]> Co-authored-by: Mikhail Vazhnov <[email protected]> Co-authored-by: Ryan Schneider <[email protected]> Co-authored-by: jin <[email protected]> Co-authored-by: Paul <[email protected]> Co-authored-by: Jens W <[email protected]> Co-authored-by: s7v7nislands <[email protected]> Co-authored-by: seven <[email protected]> Co-authored-by: Sina Mahmoodi <[email protected]> Co-authored-by: Marius Kjærstad <[email protected]> Co-authored-by: vdwijden <[email protected]> Co-authored-by: Sebastian Supreme <[email protected]> Co-authored-by: Jordan Krage <[email protected]> Co-authored-by: Joseph Cook <[email protected]> Co-authored-by: Inphi <[email protected]>
This PR simplifies the logic of chain tracer and also adds the unit tests.
The most important change has been made in this PR is the state management. Whenever a tracing state is acquired there is a corresponding release function be returned as well. It must be called once the state is used up, otherwise resource leaking can happen.
And also the logic of state management has been simplified a lot. Specifically, the state provider(eth backend, les backend) should ensure the state is available and referenced. State customers can use the state according to their own needs, or build other states based on the given state. But once the release function is called, there is no guarantee of the availability of the state.