Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 4 additions & 3 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import (
"github.com/ava-labs/libevm/core/vm"
"github.com/ava-labs/libevm/ethdb"
"github.com/ava-labs/libevm/event"
"github.com/ava-labs/libevm/libevm/stateconf"
"github.com/ava-labs/libevm/log"
"github.com/ava-labs/libevm/metrics"
"github.com/ava-labs/libevm/trie"
Expand Down Expand Up @@ -1760,16 +1761,16 @@ func (bc *BlockChain) commitWithSnap(
) (common.Hash, error) {
// blockHashes must be passed through [state.StateDB]'s Commit since snapshots
// are based on the block hash.
blockHashes := snapshot.WithBlockHashes(current.Hash(), current.ParentHash())
root, err := statedb.Commit(current.NumberU64(), bc.chainConfig.IsEIP158(current.Number()), blockHashes)
snapshotOpt := snapshot.WithBlockHashes(current.Hash(), current.ParentHash())
root, err := statedb.Commit(current.NumberU64(), bc.chainConfig.IsEIP158(current.Number()), stateconf.WithSnapshotUpdateOpts(snapshotOpt))
if err != nil {
return common.Hash{}, err
}
// Upstream does not perform a snapshot update if the root is the same as the
// parent root, however here the snapshots are based on the block hash, so
// this update is necessary. Note blockHashes are passed here as well.
if bc.snaps != nil && root == parentRoot {
if err := bc.snaps.Update(root, parentRoot, nil, nil, nil, blockHashes); err != nil {
if err := bc.snaps.Update(root, parentRoot, nil, nil, nil, snapshotOpt); err != nil {
return common.Hash{}, err
}
}
Expand Down
4 changes: 2 additions & 2 deletions core/state/snapshot/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ type blockHashes struct {
}

func WithBlockHashes(blockHash, parentBlockHash common.Hash) stateconf.SnapshotUpdateOption {
return stateconf.WithUpdatePayload(blockHashes{blockHash, parentBlockHash})
return stateconf.WithSnapshotUpdatePayload(blockHashes{blockHash, parentBlockHash})
}

// Update adds a new snapshot into the tree, if that can be linked to an existing
Expand All @@ -337,7 +337,7 @@ func (t *Tree) Update(
return fmt.Errorf("missing block hashes")
}

payload := stateconf.ExtractUpdatePayload(opts[0])
payload := stateconf.ExtractSnapshotUpdatePayload(opts[0])
p, ok := payload.(blockHashes)
if !ok {
return fmt.Errorf("invalid block hashes payload type: %T", payload)
Expand Down
5 changes: 3 additions & 2 deletions core/state/trie_prefetcher_extra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/ava-labs/libevm/core/rawdb"
"github.com/ava-labs/libevm/core/types"
"github.com/ava-labs/libevm/ethdb"
"github.com/ava-labs/libevm/libevm/stateconf"
"github.com/ava-labs/libevm/metrics"
"github.com/ava-labs/libevm/triedb"
"github.com/ava-labs/subnet-evm/core/state/snapshot"
Expand Down Expand Up @@ -183,8 +184,8 @@ func addKVs(
statedb.SetState(address, common.BytesToHash(key), common.BytesToHash(value))
}
}
blockHashes := snapshot.WithBlockHashes(fakeHash(block+1), fakeHash(block))
root, err = statedb.Commit(block+1, true, blockHashes)
snapshotOpt := snapshot.WithBlockHashes(fakeHash(block+1), fakeHash(block))
root, err = statedb.Commit(block+1, true, stateconf.WithSnapshotUpdateOpts(snapshotOpt))
if err != nil {
return nil, common.Hash{}, fmt.Errorf("committing with snap: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/VictoriaMetrics/fastcache v1.12.1
github.com/antithesishq/antithesis-sdk-go v0.3.8
github.com/ava-labs/avalanchego v1.13.2-rc.0
github.com/ava-labs/libevm v1.13.14-0.2.0.release
github.com/ava-labs/libevm v1.13.14-0.3.0.rc.1
github.com/davecgh/go-spew v1.1.1
github.com/deckarep/golang-set/v2 v2.1.0
github.com/fjl/gencodec v0.1.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ github.com/ava-labs/avalanchego v1.13.2-rc.0 h1:BWV5z/u6oJwRPx/zuACBbge4puhoDV38
github.com/ava-labs/avalanchego v1.13.2-rc.0/go.mod h1:BCxJWx2E1zeCDoQuH12I+B7BsrAbBpF19af4O0V7b/8=
github.com/ava-labs/coreth v0.15.2-rc.0.0.20250610170140-2fcf45f828a2 h1:/E1w2S6xvEhkO2+C9sGCV8W80qaeSN5WBFqdKLl12HM=
github.com/ava-labs/coreth v0.15.2-rc.0.0.20250610170140-2fcf45f828a2/go.mod h1:cqwBag+zzqifDutdPVzZKovfC2d0L8Zxq4YgTGaMCwg=
github.com/ava-labs/libevm v1.13.14-0.2.0.release h1:uKGCc5/ceeBbfAPRVtBUxbQt50WzB2pEDb8Uy93ePgQ=
github.com/ava-labs/libevm v1.13.14-0.2.0.release/go.mod h1:+Iol+sVQ1KyoBsHf3veyrBmHCXr3xXRWq6ZXkgVfNLU=
github.com/ava-labs/libevm v1.13.14-0.3.0.rc.1 h1:vBMYo+Iazw0rGTr+cwjkBdh5eadLPlv4ywI4lKye3CA=
github.com/ava-labs/libevm v1.13.14-0.3.0.rc.1/go.mod h1:+Iol+sVQ1KyoBsHf3veyrBmHCXr3xXRWq6ZXkgVfNLU=
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
Expand Down
6 changes: 6 additions & 0 deletions params/hooks_libevm.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/ava-labs/libevm/core/vm"
"github.com/ava-labs/libevm/libevm"
"github.com/ava-labs/libevm/libevm/legacy"
ethparams "github.com/ava-labs/libevm/params"
"github.com/ava-labs/subnet-evm/params/extras"
customheader "github.com/ava-labs/subnet-evm/plugin/evm/header"
"github.com/ava-labs/subnet-evm/precompile/contract"
Expand Down Expand Up @@ -52,6 +53,11 @@ func (r RulesExtra) ActivePrecompiles(existing []common.Address) []common.Addres
return existing
}

// MinimumGasConsumption is a no-op.
func (r RulesExtra) MinimumGasConsumption(x uint64) uint64 {
return (ethparams.NOOPHooks{}).MinimumGasConsumption(x)
}

// precompileOverrideBuiltin specifies precompiles that were activated prior to the
// dynamic precompile activation registry.
// These were only active historically and are not active in the current network.
Expand Down
3 changes: 2 additions & 1 deletion triedb/hashdb/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (
"github.com/ava-labs/libevm/core/rawdb"
"github.com/ava-labs/libevm/core/types"
"github.com/ava-labs/libevm/ethdb"
"github.com/ava-labs/libevm/libevm/stateconf"
"github.com/ava-labs/libevm/log"
"github.com/ava-labs/libevm/metrics"
"github.com/ava-labs/libevm/rlp"
Expand Down Expand Up @@ -649,7 +650,7 @@ func (db *Database) Initialized(genesisRoot common.Hash) bool {
// account trie with multiple storage tries if necessary.
// If ReferenceRootAtomicallyOnUpdate was enabled in the config, it will also add a reference from
// the root to the metaroot while holding the db's lock.
func (db *Database) Update(root common.Hash, parent common.Hash, block uint64, nodes *trienode.MergedNodeSet, states *triestate.Set) error {
func (db *Database) Update(root common.Hash, parent common.Hash, block uint64, nodes *trienode.MergedNodeSet, states *triestate.Set, _ ...stateconf.TrieDBUpdateOption) error {
// Ensure the parent state is present and signal a warning if not.
if parent != types.EmptyRootHash {
if blob, _ := db.node(parent); len(blob) == 0 {
Expand Down
3 changes: 2 additions & 1 deletion triedb/pathdb/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
"github.com/ava-labs/libevm/core/rawdb"
"github.com/ava-labs/libevm/core/types"
"github.com/ava-labs/libevm/ethdb"
"github.com/ava-labs/libevm/libevm/stateconf"
"github.com/ava-labs/libevm/log"
"github.com/ava-labs/libevm/trie/trienode"
"github.com/ava-labs/libevm/trie/triestate"
Expand Down Expand Up @@ -241,7 +242,7 @@ func (db *Database) Reader(root common.Hash) (database.Reader, error) {
//
// The passed in maps(nodes, states) will be retained to avoid copying everything.
// Therefore, these maps must not be changed afterwards.
func (db *Database) Update(root common.Hash, parentRoot common.Hash, block uint64, nodes *trienode.MergedNodeSet, states *triestate.Set) error {
func (db *Database) Update(root common.Hash, parentRoot common.Hash, block uint64, nodes *trienode.MergedNodeSet, states *triestate.Set, _ ...stateconf.TrieDBUpdateOption) error {
// Hold the lock to prevent concurrent mutations.
db.lock.Lock()
defer db.lock.Unlock()
Expand Down
Loading