forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
persist conversion state to db and use an LRU cache for active transi…
…tion states (#375) * persist conversion state to db * fix: don't recreate LRU when writing state * opt: only write state to db if not already present in LRU * fix: rlp can't encode TransitionState * fix: use gob because binary.Write does not support structs 🤦♂️ * fix: nil pointer panic * add logs to debug shadowfork * no such thing as not enough traces * ditto * fix stupid bug * add a comment for readability * add more traces * Lock the state transition during conversion (#384) * heavy handed approach: lock the state transition during conversion * also lock transition state loading/unloading * reduce logs verbosity * add conversion test to workflow (#386) * add conversion test to workflow * mandatory -f switch fix in rm * forgot & at the end of the geth command * remove incorrect kill * add debug traces * add an overlay stride * fix typo * Apply suggestions from code review
- Loading branch information
Showing
8 changed files
with
212 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: Overlay conversion | ||
|
||
on: | ||
push: | ||
branches: [ master, transition-post-genesis, store-transition-state-in-db ] | ||
pull_request: | ||
branches: [ master, kaustinen-with-shapella, transition-post-genesis, store-transition-state-in-db, lock-overlay-transition ] | ||
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: 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)) > log.txt & | ||
|
||
- 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 | ||
# Check for signs that the conversion has started | ||
if grep -q "Processing verkle conversion starting at" log.txt; then | ||
break | ||
fi | ||
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 started | ||
if egrep -q "at block.*performing transition\? false" log.txt; then | ||
kill -9 $(pgrep -f geth) | ||
break | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright 2024 The go-ethereum Authors | ||
// This file is part of the go-ethereum library. | ||
// | ||
// The go-ethereum library is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// The go-ethereum library is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
package rawdb | ||
|
||
import ( | ||
"github.com/ethereum/go-ethereum/common" | ||
"github.com/ethereum/go-ethereum/ethdb" | ||
) | ||
|
||
func ReadVerkleTransitionState(db ethdb.KeyValueReader, hash common.Hash) ([]byte, error) { | ||
return db.Get(transitionStateKey(hash)) | ||
} | ||
|
||
func WriteVerkleTransitionState(db ethdb.KeyValueWriter, hash common.Hash, state []byte) error { | ||
return db.Put(transitionStateKey(hash), state) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters