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

Kaustinen with shapella rebase pathdb #437

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
7de748d
all: implement path-based state scheme (#25963)
rjl493456442 Aug 1, 2023
ac15214
Verkle tree-based state with overlay transition
gballet May 6, 2021
045f53e
move UpdateContractCode to updateStateObject
gballet Aug 4, 2023
9a0784d
fix: generated rlp decoders
gballet Aug 4, 2023
e2ac752
fix: activate Shanghai in test
gballet Aug 4, 2023
faf7fa0
add withdrawals to witness
gballet Aug 4, 2023
ff71485
fix the first half of verkle test
gballet Aug 9, 2023
f5a7321
fix: open an empty storage trie after transition
gballet Aug 10, 2023
c2cdd50
activate verkle on IsVerkle, not IsCancun
gballet Aug 10, 2023
4b54c4b
deactivate snapshot for tests
gballet Aug 10, 2023
e237c1e
enable proof of stake in verkle test
gballet Aug 10, 2023
29c8f98
save last MPT root for transition
gballet Aug 10, 2023
bea2b7e
remove unnecessary snapshot Cap in flush
gballet Aug 11, 2023
0decbd7
fix test: include EIP-3860
gballet Aug 11, 2023
66dd866
implement missing odrDatabase function
gballet Aug 11, 2023
54e060f
fix incorrect equality condition is HasAccount
gballet Aug 11, 2023
a80c2aa
fixes to replay ~500 blocks
gballet Aug 14, 2023
a72e7d9
fix to replay more blocks
gballet Aug 14, 2023
5ba9fb7
fix preimage issue in conversion
gballet Aug 15, 2023
9bb7f41
code cleanup: remove a lot of TODOs & friends
gballet Aug 15, 2023
12c65cb
more code cleanup
gballet Aug 15, 2023
a926f60
fix: alignment of values whose len is < 32
gballet Aug 17, 2023
a0e1995
New access-witness module (#235)
jsign Aug 29, 2023
f090ddb
remove unused map param in MakeVerkleMultiProof (#261)
gballet Aug 30, 2023
ed36c23
core/state: rewrite a new optimized keyValueMigrator (#256)
jsign Aug 31, 2023
9eee5a3
core: move overlay conversion code to its own file (#266)
gballet Sep 9, 2023
b4c3b59
add pre-pbss rebase branches to CI (#270)
gballet Sep 25, 2023
b7648a5
quell zero-tree message
gballet Aug 16, 2023
9db5d5c
port kaustinen code on top of shapella-rebased branch
gballet Aug 29, 2023
713db1b
fix: add ProofInBlocks to chain config (#280)
gballet Sep 25, 2023
f8bacb2
remove StateDB as an extra param to Prepare (#281)
gballet Sep 25, 2023
eb03735
fix: need commitment in tests (#282)
gballet Sep 25, 2023
2403a27
fix linter message
gballet Sep 25, 2023
c94a9dd
fix: a couple of CI issues
gballet Sep 25, 2023
1b72c34
fix more CI complaints
gballet Sep 25, 2023
5032dd4
achieving perfection
gballet Sep 25, 2023
990395c
workaround: disable check for root presence (#283)
gballet Sep 27, 2023
acb4a30
fix: activate verkle at genesis (#284)
gballet Sep 27, 2023
c82ff99
fix: ensure read-only values are resolved in post trie (#285)
gballet Sep 28, 2023
328e180
upgrade deps to get proof generation absence/presence bugfix
gballet Oct 6, 2023
49fdfff
fix: make sure AccessWitness isn't nil when calling RPC methods (#287)
gballet Oct 10, 2023
189a477
fix: incorrect access copy (#288)
gballet Oct 10, 2023
faee2f9
fix: return serialized root in state root, not its mapping to a scala…
gballet Oct 12, 2023
0d51267
add workaround to use --override.prague (#292)
gballet Oct 18, 2023
a29f5d6
Shanghai time workaround (#294)
gballet Oct 18, 2023
e437264
remove pre-state tree warmup (#293)
jsign Oct 18, 2023
e1dd462
Update go-verkle (#296)
jsign Oct 23, 2023
4f9beb0
proofs: remove post-values in Multiproof (#297)
jsign Oct 25, 2023
4815fe2
remove unused EndVerkleTransition in blockchain.go (#301)
gballet Oct 27, 2023
afc6067
mod: update go-verkle (#312)
jsign Nov 27, 2023
f952558
fix: main storage offset value (#329)
gballet Dec 20, 2023
6843ed1
vm: fix access witness recording (#337)
jsign Jan 20, 2024
d6477cd
mod: move from gballet/go-verkle to ethereum/go-verkle (#335)
jsign Jan 20, 2024
f466321
accesswitness: avoid charging cost for origin and target (#334)
jsign Jan 20, 2024
7757a53
force activation of EIP-6780 (#338)
gballet Jan 26, 2024
a5d7482
fix: return error if witness costs OOG in instructions (#319)
gballet Jan 26, 2024
8f2ffed
only add the coinbase to the witness if the block reward > 0 (#332)
gballet Jan 26, 2024
14d5a01
change timeout to 20 minutes
gballet Jan 26, 2024
85a7198
test: check witness when contract creation fails (#333)
gballet Jan 26, 2024
ac3f269
implement eip 2935 (#342)
gballet Jan 26, 2024
7d02a60
fix: support a verkle pre-tree at the conversion block (#313)
gballet Jan 29, 2024
bea12cc
fix: decide if genesis is verkle using genesis timestamp (#290)
gballet Jan 29, 2024
95d7f39
set verkle mode from genesis with override (#308)
gballet Jan 29, 2024
b7bd9e3
fix: test for ExtStatus count when two missing stems collide (#347)
gballet Jan 29, 2024
eb31ae3
accesswitness: touch for origin and to (#348)
jsign Jan 29, 2024
c1e0ff1
fix: only disable HasLegacyNode call for verkle-at-genesis testnets (…
gballet Jan 29, 2024
4c4de31
fix: eip2935 block hash storage in chain makers (#351)
gballet Jan 29, 2024
b7a19b4
trie/utils: bound point cache size (#352)
jsign Jan 30, 2024
c3b9b37
fix: nil pointer when deactivating verkle-incompatible genesis code (…
gballet Jan 31, 2024
9be95a2
another workaround to force verkle at creation
gballet Feb 1, 2024
cc48d57
refactor: move trieDB creation outside of block-making loop (#354)
gballet Feb 2, 2024
afcfa5a
Add eip2935 256th ancestor stem to witness (#355)
gballet Feb 2, 2024
953338b
state: avoid EIP-158 for history storage address (#359)
jsign Feb 3, 2024
7a0eb0b
test: check current and new values in state processor witness
gballet Feb 3, 2024
61ffef7
fix: CREATE-time PUSHn adds non-existent entries to witness (#361)
gballet Feb 5, 2024
2e671ea
eip2935 redesign: insert all 256 ancestors upon transition (#362)
gballet Feb 6, 2024
077ad87
Record witness access in EXTCODEHASH (#370)
jsign Feb 15, 2024
8ac0570
fix integer underflow (#374)
jsign Feb 15, 2024
72211cd
Record witness access in BALANCE opcode (#369)
jsign Feb 15, 2024
f72f782
fix addr alignement (#366)
jsign Feb 15, 2024
c2da198
Fix SELFDESTRUCT incorrect account zeroing & missing beneficiary bala…
jsign Feb 16, 2024
4dc4b39
core/vm: fix contract creation witness gas charging logic (#389)
jsign Feb 27, 2024
f667365
witness: fix contract creation init gas charging (#393)
jsign Feb 28, 2024
c997469
fix: missing MAIN_STORAGE_OFFSET when reading a block hash from the h…
gballet Feb 29, 2024
448b405
Truncate BALANCE opcode parameter for witness recording
jsign Mar 4, 2024
b5495ad
more address truncation fixes (#399)
jsign Mar 6, 2024
6310993
Fix TestProcessVerkle tests (#400)
jsign Mar 6, 2024
40d5153
Use circular buffer for BLOCKHASH history (#402)
jsign Mar 12, 2024
a3232b7
core/txpool/blobpool: fix metrics name for prometheus export (#27901)…
weiihann Mar 17, 2024
c790d1f
trie/verkle: change tree key generation (#401)
jsign Mar 26, 2024
d0ec1be
Fix TestProcessVerkle* tests (#410)
jsign Apr 6, 2024
0d70489
core: change block hash history scope (#411)
jsign Apr 8, 2024
1930b97
simplified gas accounting layer (#405)
gballet Apr 15, 2024
6051fd0
trie/utils: simplify GetTreeKeyWithEvaluatedAddress (#421)
jsign Apr 24, 2024
f50db1e
remove unused code (#423)
gballet Apr 29, 2024
1599b8f
post-genesis transition (#426)
gballet May 4, 2024
8cbdd33
add quick conversion test (#429)
gballet May 6, 2024
5e02d05
Fix iterator from t8n (#434)
gballet May 7, 2024
537d5c0
update branches that CI runs on
gballet May 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ accounts/scwallet @gballet
accounts/abi @gballet @MariusVanDerWijden
cmd/clef @holiman
consensus @karalabe
core/ @karalabe @holiman @rjl493456442
core/ @karalabe @rjl493456442
eth/ @karalabe @holiman @rjl493456442
eth/catalyst/ @gballet
eth/tracers/ @s1na
Expand Down
75 changes: 75 additions & 0 deletions .github/workflows/conversion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Overlay conversion

on:
push:
branches: [ kaustinen-with-shapella, kaustinen-with-shapella-rebase-pathdb ]
pull_request:
branches: [ kaustinen-with-shapella ]
workflow_dispatch:

jobs:
conversion:
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.22.2

- name: Cleanup from previous runs
run: |
rm -f log.txt
rm -rf .shadowfork
rm -f genesis.json
- name: Download genesis file
run: wget https://gist.githubusercontent.com/gballet/0b02a025428aa0e7b67941864d54716c/raw/bfb4e158bca5217b356a19b2ec55c4a45a7b2bad/genesis.json

- name: Init data
run: go run ./cmd/geth --dev --cache.preimages init genesis.json

- name: Run geth in devmode
run: go run ./cmd/geth --dev --dev.period=5 --cache.preimages --http --datadir=.shadowfork --override.overlay-stride=10 --override.prague=$(($(date +%s) + 45)) --http.api=debug &

- name: Wait for the transition to start
run: |
start_time=$(date +%s)
while true; do
sleep 5
current_time=$(date +%s)
elapsed_time=$((current_time - start_time))
# 2 minute timeout
if [ $elapsed_time -ge 120 ]; then
kill -9 $(pgrep -f geth)
exit 1
fi
pgrep -l geth
# Check for signs that the conversion has started
started=`curl -X POST -H "Content-Type: application/json" -d '{ "id": 7, "jsonrpc": "2.0", "method": "debug_conversionStatus", "params": ["latest"]}' http://localhost:8545 -s | jq '.result.started'`
echo $?
echo $started
if [ "$started" == "true" ]; then
break
fi
echo "looping"
done
- name: Wait for the transition to end
run: |
start_time=$(date +%s)
while true; do
sleep 5
current_time=$(date +%s)
elapsed_time=$((current_time - start_time))
# 10 minute timeout
if [ $elapsed_time -ge 300 ]; then
cat log.txt
kill -9 $(pgrep -f geth)
exit 1
fi
# Check for signs that the conversion has ended
ended=`curl -X POST -H "Content-Type: application/json" -d '{ "id": 7, "jsonrpc": "2.0", "method": "debug_conversionStatus", "params": ["latest"]}' http://localhost:8545 -s | jq '.result.started'`
if [ "$ended" == "true" ]; then
kill -9 $(pgrep -f geth)
break
fi
done
58 changes: 58 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Go lint and test

on:
push:
branches: [ kaustinen-with-shapella, kaustinen-with-shapella-rebase-pathdb ]
pull_request:
branches: [ kaustinen-with-shapella, kaustinen-with-shapella-rebase-pathdb ]
workflow_dispatch:

jobs:
build:
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21.1
- name: Build
run: go build -v ./...

lint:
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21.1
- name: Download golangci-lint
run: wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.54.2
- name: Lint
run: ./bin/golangci-lint run
- name: Vet
run: go vet

test:
runs-on: self-hosted
needs: [test-process-verkle]
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21.1
- name: Test
run: go test ./... -timeout=20m

test-process-verkle:
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21.1
- name: Test
run: go test ./core -run=TestProcessVerkle
74 changes: 40 additions & 34 deletions beacon/engine/gen_ed.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 39 additions & 35 deletions beacon/engine/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ type ExecutableData struct {
Withdrawals []*types.Withdrawal `json:"withdrawals"`
BlobGasUsed *uint64 `json:"blobGasUsed"`
ExcessBlobGas *uint64 `json:"excessBlobGas"`

ExecutionWitness *types.ExecutionWitness `json:"executionWitness"`
}

// JSON type overrides for executableData.
Expand Down Expand Up @@ -208,24 +210,25 @@ func ExecutableDataToBlock(params ExecutableData, versionedHashes []common.Hash)
withdrawalsRoot = &h
}
header := &types.Header{
ParentHash: params.ParentHash,
UncleHash: types.EmptyUncleHash,
Coinbase: params.FeeRecipient,
Root: params.StateRoot,
TxHash: types.DeriveSha(types.Transactions(txs), trie.NewStackTrie(nil)),
ReceiptHash: params.ReceiptsRoot,
Bloom: types.BytesToBloom(params.LogsBloom),
Difficulty: common.Big0,
Number: new(big.Int).SetUint64(params.Number),
GasLimit: params.GasLimit,
GasUsed: params.GasUsed,
Time: params.Timestamp,
BaseFee: params.BaseFeePerGas,
Extra: params.ExtraData,
MixDigest: params.Random,
WithdrawalsHash: withdrawalsRoot,
ExcessBlobGas: params.ExcessBlobGas,
BlobGasUsed: params.BlobGasUsed,
ParentHash: params.ParentHash,
UncleHash: types.EmptyUncleHash,
Coinbase: params.FeeRecipient,
Root: params.StateRoot,
TxHash: types.DeriveSha(types.Transactions(txs), trie.NewStackTrie(nil)),
ReceiptHash: params.ReceiptsRoot,
Bloom: types.BytesToBloom(params.LogsBloom),
Difficulty: common.Big0,
Number: new(big.Int).SetUint64(params.Number),
GasLimit: params.GasLimit,
GasUsed: params.GasUsed,
Time: params.Timestamp,
BaseFee: params.BaseFeePerGas,
Extra: params.ExtraData,
MixDigest: params.Random,
WithdrawalsHash: withdrawalsRoot,
ExcessBlobGas: params.ExcessBlobGas,
BlobGasUsed: params.BlobGasUsed,
ExecutionWitness: params.ExecutionWitness,
}
block := types.NewBlockWithHeader(header).WithBody(txs, nil /* uncles */).WithWithdrawals(params.Withdrawals)
if block.Hash() != params.BlockHash {
Expand All @@ -238,23 +241,24 @@ func ExecutableDataToBlock(params ExecutableData, versionedHashes []common.Hash)
// fields from the given block. It assumes the given block is post-merge block.
func BlockToExecutableData(block *types.Block, fees *big.Int, blobs []kzg4844.Blob, commitments []kzg4844.Commitment, proofs []kzg4844.Proof) *ExecutionPayloadEnvelope {
data := &ExecutableData{
BlockHash: block.Hash(),
ParentHash: block.ParentHash(),
FeeRecipient: block.Coinbase(),
StateRoot: block.Root(),
Number: block.NumberU64(),
GasLimit: block.GasLimit(),
GasUsed: block.GasUsed(),
BaseFeePerGas: block.BaseFee(),
Timestamp: block.Time(),
ReceiptsRoot: block.ReceiptHash(),
LogsBloom: block.Bloom().Bytes(),
Transactions: encodeTransactions(block.Transactions()),
Random: block.MixDigest(),
ExtraData: block.Extra(),
Withdrawals: block.Withdrawals(),
BlobGasUsed: block.BlobGasUsed(),
ExcessBlobGas: block.ExcessBlobGas(),
BlockHash: block.Hash(),
ParentHash: block.ParentHash(),
FeeRecipient: block.Coinbase(),
StateRoot: block.Root(),
Number: block.NumberU64(),
GasLimit: block.GasLimit(),
GasUsed: block.GasUsed(),
BaseFeePerGas: block.BaseFee(),
Timestamp: block.Time(),
ReceiptsRoot: block.ReceiptHash(),
LogsBloom: block.Bloom().Bytes(),
Transactions: encodeTransactions(block.Transactions()),
Random: block.MixDigest(),
ExtraData: block.Extra(),
Withdrawals: block.Withdrawals(),
BlobGasUsed: block.BlobGasUsed(),
ExcessBlobGas: block.ExcessBlobGas(),
ExecutionWitness: block.ExecutionWitness(),
}
blobsBundle := BlobsBundleV1{
Commitments: make([]hexutil.Bytes, 0),
Expand Down
7 changes: 7 additions & 0 deletions cmd/evm/internal/t8ntool/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ type stEnv struct {
ExcessBlobGas *uint64 `json:"excessBlobGas,omitempty"`
ParentExcessBlobGas *uint64 `json:"parentExcessBlobGas,omitempty"`
ParentBlobGasUsed *uint64 `json:"parentBlobGasUsed,omitempty"`
ParentHash *common.Hash `json:"parentHash,omitempty"`
}

type stEnvMarshaling struct {
Expand Down Expand Up @@ -182,6 +183,12 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
chainConfig.DAOForkBlock.Cmp(new(big.Int).SetUint64(pre.Env.Number)) == 0 {
misc.ApplyDAOHardFork(statedb)
}
if chainConfig.IsPrague(big.NewInt(int64(pre.Env.Number)), pre.Env.Timestamp) {
// insert all parent hashes in the contract
for i := pre.Env.Number - 1; i > 0 && i >= pre.Env.Number-257; i-- {
core.ProcessParentBlockHash(statedb, i, pre.Env.BlockHashes[math.HexOrDecimal64(i)])
}
}
var blobGasUsed uint64
for i, tx := range txs {
if tx.Type() == types.BlobTxType && vmContext.ExcessBlobGas == nil {
Expand Down
6 changes: 6 additions & 0 deletions cmd/evm/internal/t8ntool/gen_stenv.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading