Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
afd52e4
quell zero-tree message
gballet Aug 16, 2023
ba2fa09
port kaustinen code on top of shapella-rebased branch
gballet Aug 29, 2023
4f3c822
fix: add ProofInBlocks to chain config (#280)
gballet Sep 25, 2023
c30a2cc
remove StateDB as an extra param to Prepare (#281)
gballet Sep 25, 2023
3b351fe
fix: need commitment in tests (#282)
gballet Sep 25, 2023
19d8466
fix linter message
gballet Sep 25, 2023
b993a43
fix: a couple of CI issues
gballet Sep 25, 2023
160f735
fix more CI complaints
gballet Sep 25, 2023
3e6b005
achieving perfection
gballet Sep 25, 2023
7d66867
workaround: disable check for root presence (#283)
gballet Sep 27, 2023
ad81cb7
fix: activate verkle at genesis (#284)
gballet Sep 27, 2023
d6da14e
fix: ensure read-only values are resolved in post trie (#285)
gballet Sep 28, 2023
0d935b4
upgrade deps to get proof generation absence/presence bugfix
gballet Oct 6, 2023
332dfe2
fix: make sure AccessWitness isn't nil when calling RPC methods (#287)
gballet Oct 10, 2023
2b8427c
fix: incorrect access copy (#288)
gballet Oct 10, 2023
fc5410b
fix: return serialized root in state root, not its mapping to a scala…
gballet Oct 12, 2023
5f4f379
add workaround to use --override.prague (#292)
gballet Oct 18, 2023
6d7e4fa
Shanghai time workaround (#294)
gballet Oct 18, 2023
a45a9f2
remove pre-state tree warmup (#293)
jsign Oct 18, 2023
66ad9be
Update go-verkle (#296)
jsign Oct 23, 2023
3f4159b
proofs: remove post-values in Multiproof (#297)
jsign Oct 25, 2023
fc8f4b9
remove unused EndVerkleTransition in blockchain.go (#301)
gballet Oct 27, 2023
7f310da
mod: update go-verkle (#312)
jsign Nov 27, 2023
0191752
fix: main storage offset value (#329)
gballet Dec 20, 2023
ce90e13
vm: fix access witness recording (#337)
jsign Jan 20, 2024
ce387dc
mod: move from gballet/go-verkle to ethereum/go-verkle (#335)
jsign Jan 20, 2024
f68c3f7
accesswitness: avoid charging cost for origin and target (#334)
jsign Jan 20, 2024
1191d6c
force activation of EIP-6780 (#338)
gballet Jan 26, 2024
095c2ba
fix: return error if witness costs OOG in instructions (#319)
gballet Jan 26, 2024
2a753ab
only add the coinbase to the witness if the block reward > 0 (#332)
gballet Jan 26, 2024
601fafb
change timeout to 20 minutes
gballet Jan 26, 2024
884b57c
test: check witness when contract creation fails (#333)
gballet Jan 26, 2024
10e3065
implement eip 2935 (#342)
gballet Jan 26, 2024
609c973
fix: support a verkle pre-tree at the conversion block (#313)
gballet Jan 29, 2024
8a07de6
fix: decide if genesis is verkle using genesis timestamp (#290)
gballet Jan 29, 2024
16737a7
set verkle mode from genesis with override (#308)
gballet Jan 29, 2024
dcf99be
fix: test for ExtStatus count when two missing stems collide (#347)
gballet Jan 29, 2024
d29dd03
accesswitness: touch for origin and to (#348)
jsign Jan 29, 2024
4c831fb
fix: only disable HasLegacyNode call for verkle-at-genesis testnets (…
gballet Jan 29, 2024
18a4632
fix: eip2935 block hash storage in chain makers (#351)
gballet Jan 29, 2024
0b0735a
trie/utils: bound point cache size (#352)
jsign Jan 30, 2024
aa4c9c1
fix: nil pointer when deactivating verkle-incompatible genesis code (…
gballet Jan 31, 2024
6d7b22c
another workaround to force verkle at creation
gballet Feb 1, 2024
5c269ed
refactor: move trieDB creation outside of block-making loop (#354)
gballet Feb 2, 2024
28ec376
Add eip2935 256th ancestor stem to witness (#355)
gballet Feb 2, 2024
4efa34d
state: avoid EIP-158 for history storage address (#359)
jsign Feb 3, 2024
ed217c8
test: check current and new values in state processor witness
gballet Feb 3, 2024
7d866f0
fix: CREATE-time PUSHn adds non-existent entries to witness (#361)
gballet Feb 5, 2024
0b110bd
eip2935 redesign: insert all 256 ancestors upon transition (#362)
gballet Feb 6, 2024
540fa4e
Record witness access in EXTCODEHASH (#370)
jsign Feb 15, 2024
4767773
fix integer underflow (#374)
jsign Feb 15, 2024
a8db450
Record witness access in BALANCE opcode (#369)
jsign Feb 15, 2024
a2cce69
fix addr alignement (#366)
jsign Feb 15, 2024
5f05456
Fix SELFDESTRUCT incorrect account zeroing & missing beneficiary bala…
jsign Feb 16, 2024
da8b32e
core/vm: fix contract creation witness gas charging logic (#389)
jsign Feb 27, 2024
45e7cb6
witness: fix contract creation init gas charging (#393)
jsign Feb 28, 2024
32705b9
fix: missing MAIN_STORAGE_OFFSET when reading a block hash from the h…
gballet Feb 29, 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
6 changes: 2 additions & 4 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
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 latest
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
Expand All @@ -42,7 +42,5 @@ jobs:
uses: actions/setup-go@v2
with:
go-version: 1.21.1
- name: Download precomputed points
run: wget -nv https://github.com/gballet/go-verkle/releases/download/banderwagonv3/precomp -Otrie/utils/precomp
- name: Test
run: go test ./...
run: go test ./... -timeout=20m
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.

11 changes: 9 additions & 2 deletions cmd/geth/chaincmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var (
Name: "init",
Usage: "Bootstrap and initialize a new genesis block",
ArgsUsage: "<genesisPath>",
Flags: flags.Merge([]cli.Flag{utils.CachePreimagesFlag}, utils.DatabasePathFlags),
Flags: flags.Merge([]cli.Flag{utils.CachePreimagesFlag, utils.OverridePrague}, utils.DatabasePathFlags),
Description: `
The init command initializes a new genesis block and definition for the network.
This is a destructive action and changes the network in which you will be
Expand Down Expand Up @@ -201,15 +201,22 @@ func initGenesis(ctx *cli.Context) error {
stack, _ := makeConfigNode(ctx)
defer stack.Close()

var overrides core.ChainOverrides
if ctx.IsSet(utils.OverridePrague.Name) {
v := ctx.Uint64(utils.OverridePrague.Name)
overrides.OverridePrague = &v
}

for _, name := range []string{"chaindata", "lightchaindata"} {
chaindb, err := stack.OpenDatabaseWithFreezer(name, 0, 0, ctx.String(utils.AncientFlag.Name), "", false)
if err != nil {
utils.Fatalf("Failed to open database: %v", err)
}
triedb := trie.NewDatabaseWithConfig(chaindb, &trie.Config{
Preimages: ctx.Bool(utils.CachePreimagesFlag.Name),
Verkle: genesis.IsVerkle(),
})
_, hash, err := core.SetupGenesisBlock(chaindb, triedb, genesis)
_, hash, err := core.SetupGenesisBlockWithOverride(chaindb, triedb, genesis, &overrides)
if err != nil {
utils.Fatalf("Failed to write genesis block: %v", err)
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/geth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
v := ctx.Uint64(utils.OverrideCancun.Name)
cfg.Eth.OverrideCancun = &v
}
if ctx.IsSet(utils.OverrideVerkle.Name) {
v := ctx.Uint64(utils.OverrideVerkle.Name)
cfg.Eth.OverrideVerkle = &v
if ctx.IsSet(utils.OverridePrague.Name) {
v := ctx.Uint64(utils.OverridePrague.Name)
cfg.Eth.OverridePrague = &v
}
backend, eth := utils.RegisterEthService(stack, &cfg.Eth)

Expand Down
2 changes: 1 addition & 1 deletion cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ var (
utils.USBFlag,
utils.SmartCardDaemonPathFlag,
utils.OverrideCancun,
utils.OverrideVerkle,
utils.OverridePrague,
utils.EnablePersonal,
utils.TxPoolLocalsFlag,
utils.TxPoolNoLocalsFlag,
Expand Down
10 changes: 5 additions & 5 deletions cmd/geth/verkle.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/trie"
tutils "github.com/ethereum/go-ethereum/trie/utils"
"github.com/gballet/go-verkle"
"github.com/ethereum/go-verkle"
"github.com/holiman/uint256"
cli "github.com/urfave/cli/v2"
)
Expand Down Expand Up @@ -202,7 +202,7 @@ func convertToVerkle(ctx *cli.Context) error {

// Otherwise, store the previous group in the tree with a
// stem insertion.
vRoot.InsertStem(chunkkey[:31], values, chaindb.Get)
vRoot.InsertValuesAtStem(chunkkey[:31], values, chaindb.Get)
}

// Write the code size in the account header group
Expand Down Expand Up @@ -267,7 +267,7 @@ func convertToVerkle(ctx *cli.Context) error {
copy(k[:], []byte(s))
// reminder that InsertStem will merge leaves
// if they exist.
vRoot.InsertStem(k[:31], vs, chaindb.Get)
vRoot.InsertValuesAtStem(k[:31], vs, chaindb.Get)
}
translatedStorage = make(map[string][][]byte)
vRoot.FlushAtDepth(2, saveverkle)
Expand All @@ -276,7 +276,7 @@ func convertToVerkle(ctx *cli.Context) error {
for s, vs := range translatedStorage {
var k [31]byte
copy(k[:], []byte(s))
vRoot.InsertStem(k[:31], vs, chaindb.Get)
vRoot.InsertValuesAtStem(k[:31], vs, chaindb.Get)
}
storageIt.Release()
if storageIt.Error() != nil {
Expand All @@ -285,7 +285,7 @@ func convertToVerkle(ctx *cli.Context) error {
}
}
// Finish with storing the complete account header group inside the tree.
vRoot.InsertStem(stem[:31], newValues, chaindb.Get)
vRoot.InsertValuesAtStem(stem[:31], newValues, chaindb.Get)

if time.Since(lastReport) > time.Second*8 {
log.Info("Traversing state", "accounts", accounts, "elapsed", common.PrettyDuration(time.Since(start)))
Expand Down
4 changes: 2 additions & 2 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ var (
Usage: "Manually specify the Cancun fork timestamp, overriding the bundled setting",
Category: flags.EthCategory,
}
OverrideVerkle = &cli.Uint64Flag{
Name: "override.verkle",
OverridePrague = &cli.Uint64Flag{
Name: "override.prague",
Usage: "Manually specify the Verkle fork timestamp, overriding the bundled setting",
Category: flags.EthCategory,
}
Expand Down
Loading