Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upstream: merge geth date 0114 #2856

Draft
wants to merge 35 commits into
base: develop
Choose a base branch
from

Conversation

buddh0
Copy link
Collaborator

@buddh0 buddh0 commented Jan 16, 2025

Description

upstream: merge geth date 0114

Rationale

part of 3rd round code sync

Example

add an example CLI or API response...

Changes

Notable changes:

  • add each change in a bullet point here
  • ...

rjl493456442 and others added 30 commits December 16, 2024 21:10
In this pull request, the state iterator is implemented. It's mostly a copy-paste
from the original state snapshot package, but still has some important changes
to highlight here:

(a) The iterator for the disk layer consists of a diff iterator and a disk iterator.

Originally, the disk layer in the state snapshot was a wrapper around the disk, 
and its corresponding iterator was also a wrapper around the disk iterator.
However, due to structural differences, the disk layer iterator is divided into
two parts:

- The disk iterator, which traverses the content stored on disk.
- The diff iterator, which traverses the aggregated state buffer.

Checkout `BinaryIterator` and `FastIterator` for more details.

(b) The staleness management is improved in the diffAccountIterator and
diffStorageIterator

Originally, in the `diffAccountIterator`, the layer’s staleness had to be checked 
within the Next function to ensure the iterator remained usable. Additionally, 
a read lock on the associated diff layer was required to first retrieve the account 
blob. This read lock protection is essential to prevent concurrent map read/write. 
Afterward, a staleness check was performed to ensure the retrieved data was 
not outdated.

The entire logic can be simplified as follows: a loadAccount callback is provided 
to retrieve account data. If the corresponding state is immutable (e.g., diff layers
in the path database), the staleness check can be skipped, and a single account 
data retrieval is sufficient. However, if the corresponding state is mutable (e.g., 
the disk layer in the path database), the callback can operate as follows:

```go
func(hash common.Hash) ([]byte, error) {
    dl.lock.RLock()
    defer dl.lock.RUnlock()

    if dl.stale {
        return nil, errSnapshotStale
    }
    return dl.buffer.states.mustAccount(hash)
}
```

The callback solution can eliminate the complexity for managing
concurrency with the read lock for atomic operation.
…ory (#30868)

Updates geth to use the latest uint256, and use faster memory-writer
This change adds methods which makes it possible for to wait for a transaction with a specific hash when deploying contracts during abi bind interaction.

---------

Co-authored-by: Marius van der Wijden <[email protected]>
Adding some missing functionality I noticed while updating the hivechain
tool for the Prague fork:

- we forgot to process the parent block hash
- added `ConsensusLayerRequests` to get the requests list of the block
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from
0.26.0 to 0.31.0.

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Noticed this omission while doing some work on goevmlab. We don't
properly type some of the opcodes, but apparently implicit casting works
in all the internal usecases.
Fixing some issues I found while regenerating RPC tests for Prague:

- Authorization signature values were not encoded as hex
- `requestsRoot` in block should be `requestsHash`
- `authorizationList` should work for `eth_call`
This fixes a regression introduced recently. Without this fix, it's not
possible to use statetests without `.json` suffix. This is problematic for
goevmlab `minimizer`, which appends the suffix `.min` during processing.
Here I am proposing two small changes to the exported API for EIP-7702:

(1) `Authorization` has a very generic name, but it is in fact only used
for one niche use case: authorizing code in a `SetCodeTx`. So I propose
calling it `SetCodeAuthorization` instead. The signing function is
renamed to `SignSetCode` instead of `SignAuth`.
   
(2) The signing function for authorizations should take key as the first
parameter, and the authorization second. The key will almost always be
in a variable, while the authorization can be given as a literal.
The API spec requires the name yParity.
…#30936)

Fixing a regression introduced by 73a4ecf, which I accidentally
pushed to the master branch directly.
As a follow-up to #30933, I propose to also use the SetCode prefix in
our internal APIs for the authorization list.
The `a` parameter should be used in the `MulScalar` function. The
upstream cloudflare and google repos have already merged fixes.

Reference:
*
https://cs.opensource.google/go/x/crypto/+/8d7daa0c54b357f3071e11eaef7efc4e19a417e2
* cloudflare/bn256#33
This commit makes it so that the struct logger will not emit logs while
system calls are being executed. This will make it consistent with
the JSON and MD loggers. It is as it stands hard to distinguish when
system calls are being processed vs when a tx is being processed.

---------

Co-authored-by: Sina Mahmoodi <[email protected]>
…(#30981)

Update the default timestamp increment to 12s for `eth_simulate` endpoint
Fixes an issue where the node panics when an LStat fails with something 
other than os.ErrNotExist

closes ethereum/go-ethereum#30968
This PR attempts to fix a strange test-failure (timeout) observed on a
windows-32 platform.

https://ci.appveyor.com/project/ethereum/go-ethereum/builds/51174391/job/d8ascanwwltrlqd5

A goroutine is stuck trying to deliver a response:
```
goroutine 9632 [select, 29 minutes]:
github.com/ethereum/go-ethereum/eth/protocols/eth.(*Peer).dispatchResponse(0x314f100, 0x3e5f6d0, 0x3acbb84)
	C:/projects/go-ethereum/eth/protocols/eth/dispatcher.go:172 +0x2a5
github.com/ethereum/go-ethereum/eth/protocols/eth.handleBlockHeaders({0x12abe68, 0x30021b8}, {0x12a815c, 0x40b41c0}, 0x314f100)
	C:/projects/go-ethereum/eth/protocols/eth/handlers.go:301 +0x173
github.com/ethereum/go-ethereum/eth/protocols/eth.handleMessage({0x12abe68, 0x30021b8}, 0x314f100)
	C:/projects/go-ethereum/eth/protocols/eth/handler.go:205 +0x4f6
github.com/ethereum/go-ethereum/eth/protocols/eth.Handle({0x12abe68, 0x30021b8}, 0x314f100)
	C:/projects/go-ethereum/eth/protocols/eth/handler.go:149 +0x33
github.com/ethereum/go-ethereum/eth.testSnapSyncDisabling.func1(0x314f100)
	C:/projects/go-ethereum/eth/sync_test.go:65 +0x33
github.com/ethereum/go-ethereum/eth.(*handler).runEthPeer(0x30021b8, 0x314f100, 0x427f648)
	C:/projects/go-ethereum/eth/handler.go:355 +0xe65
created by github.com/ethereum/go-ethereum/eth.testSnapSyncDisabling in goroutine 11
	C:/projects/go-ethereum/eth/sync_test.go:64 +0x54f
FAIL	github.com/ethereum/go-ethereum/eth	1800.138s

```

---------

Co-authored-by: Gary Rong <[email protected]>
Fixes a couple of js-flaws in the docs
This change fixes is a rare bug in test generator: If the run is very unlucky it
can use `modifyAccountOp` / `deleteAccountOp` without creating any
account, leading to have a trie root same as the parent.

This change makes the first operation always be a creation.
As the node hash scheme in verkle and merkle are totally different, the
original default node hasher in pathdb is no longer suitable. Therefore,
this pull request configures different node hasher respectively.
This PR upgrades `golangci-lint` to v1.63.4 and fixes a warn message
which is reported by v1.63.4:

```text
WARN [config_reader] The configuration option `run.skip-dirs-use-default` is deprecated, please use `issues.exclude-dirs-use-default`.
```

Also fixes 2 warnings which are reported by v1.63.4:

```text
core/txpool/blobpool/blobpool.go:1754:12: S1005: unnecessary assignment to the blank identifier (gosimple)
        for acct, _ := range p.index {
                  ^
core/txpool/legacypool/legacypool.go:1989:19: S1005: unnecessary assignment to the blank identifier (gosimple)
        for localSender, _ := range pool.locals.accounts {
                         ^
```
Fix the error comparison in tracer to prevent dropping revert reason data

---------

Co-authored-by: Martin <[email protected]>
Co-authored-by: rjl493456442 <[email protected]>
- it was failing because the maximum data length (previously `dataSize`)
was set to `txMaxSize - 213` but should had been `txMaxSize - 103` and
the last call `dataSize+1+uint64(rand.Intn(10*txMaxSize)))` would
sometimes fail depending on rand.Intn.
- Maximal transaction data size comment (invalid) replaced by code logic
to find the maximum tx length without its data length
- comments and variable naming improved for clarity
- 3rd pool add test replaced to add just 1 above the maximum length,
which is important to ensure the logic is correct
rjl493456442 and others added 4 commits January 14, 2025 11:49
This pull request refactors the genesis setup function, the major
changes are highlighted here:

**(a) Triedb is opened in verkle mode if `EnableVerkleAtGenesis` is
configured in chainConfig or the database has been initialized previously with
`EnableVerkleAtGenesis` configured**.

A new config field `EnableVerkleAtGenesis` has been added in the
chainConfig. This field must be configured with True if Geth wants to initialize 
the genesis in Verkle mode.

In the verkle devnet-7, the verkle transition is activated at genesis.
Therefore, the verkle rules should be used since the genesis. In production
networks (mainnet and public testnets), verkle activation always occurs after
the genesis block. Therefore, this flag is only made for devnet and should be
deprecated later. Besides, verkle transition at non-genesis block hasn't been
implemented yet, it should be done in the following PRs.

**(b) The genesis initialization condition has been simplified**
There is a special mode supported by the Geth is that: Geth can be
initialized with an existing chain segment, which can fasten the node sync
process by retaining the chain freezer folder.

Originally, if the triedb is regarded as uninitialized and the genesis block can
be found in the chain freezer, the genesis block along with genesis state will be
committed. This condition has been simplified to checking the presence of chain
config in key-value store. The existence of chain config can represent the genesis
has been committed.
We still need to decide how to handle non-specfic `chainId` in the JSON
encoding of authorizations. With `chainId` being a uint64, the previous
implementation just used value zero. However, it might actually be more
correct to use the value `null` for this case.
@buddh0 buddh0 changed the title Upstream pectra devnet 5 upstream: pectra devnet 5 Jan 16, 2025
@buddh0 buddh0 force-pushed the upstream-pectra-devnet-5 branch 4 times, most recently from a39b6e5 to c28e362 Compare January 17, 2025 12:35
@buddh0 buddh0 force-pushed the upstream-pectra-devnet-5 branch from c28e362 to cd787d4 Compare January 20, 2025 02:36
@buddh0 buddh0 changed the title upstream: pectra devnet 5 upstream: merge geth date 0114 Jan 20, 2025
@buddh0 buddh0 marked this pull request as ready for review January 20, 2025 03:01
@buddh0 buddh0 marked this pull request as draft January 20, 2025 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.