forked from bnb-chain/bsc
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] the Implementaion of Parallel EVM 2.0
1.features of 2.0: ** Streaming Pipeline ** Implement universal unconfirmed state db reference, try best to get account object state. ** New conflict detect, check based on what it has read. ** Do parallel KV conflict check for large KV read ** new Interface StateDBer and ParallelStateDB ** shared memory pool for parallel objects ** use map in sequential mode and sync.map in parallel mode for concurrent StateObject access ** replace DeepCopy by LightCopy to avoid redundant memory copy of StateObject ** do trie prefetch in advance ** dispatcher 2.0 Static Dispatch & Dynamic Dispatch Stolen mode for TxReq when a slot finished its static dispatched tasks RealTime result confirm in Stage2, when most if the tx have been executed at least once Make it configurable 2.Handle of corner case: ** don't panic if there is anything wrong reading state ** handle system address, skip its balance check ** handle WBNB contract to reduce conflict rate by balance make up WBNB balance makeup by GetBalanceOpCode & depth add a lock to fix WBNB make up concurrent crash add a new interface GetBalanceOpCode
- Loading branch information
Showing
10 changed files
with
3,055 additions
and
1,061 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
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,82 @@ | ||
// Copyright 2016 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 state | ||
|
||
import ( | ||
"math/big" | ||
|
||
"github.com/ethereum/go-ethereum/common" | ||
"github.com/ethereum/go-ethereum/core/types" | ||
) | ||
|
||
// StateDBer is copied from vm/interface.go | ||
// It is used by StateObject & Journal right now, to abstract StateDB & ParallelStateDB | ||
type StateDBer interface { | ||
getBaseStateDB() *StateDB | ||
getStateObject(common.Address) *StateObject // only accessible for journal | ||
storeStateObj(common.Address, *StateObject) // only accessible for journal | ||
|
||
CreateAccount(common.Address) | ||
|
||
SubBalance(common.Address, *big.Int) | ||
AddBalance(common.Address, *big.Int) | ||
GetBalance(common.Address) *big.Int | ||
|
||
GetNonce(common.Address) uint64 | ||
SetNonce(common.Address, uint64) | ||
|
||
GetCodeHash(common.Address) common.Hash | ||
GetCode(common.Address) []byte | ||
SetCode(common.Address, []byte) | ||
GetCodeSize(common.Address) int | ||
|
||
AddRefund(uint64) | ||
SubRefund(uint64) | ||
GetRefund() uint64 | ||
|
||
GetCommittedState(common.Address, common.Hash) common.Hash | ||
GetState(common.Address, common.Hash) common.Hash | ||
SetState(common.Address, common.Hash, common.Hash) | ||
|
||
Suicide(common.Address) bool | ||
HasSuicided(common.Address) bool | ||
|
||
// Exist reports whether the given account exists in state. | ||
// Notably this should also return true for suicided accounts. | ||
Exist(common.Address) bool | ||
// Empty returns whether the given account is empty. Empty | ||
// is defined according to EIP161 (balance = nonce = code = 0). | ||
Empty(common.Address) bool | ||
|
||
PrepareAccessList(sender common.Address, dest *common.Address, precompiles []common.Address, txAccesses types.AccessList) | ||
AddressInAccessList(addr common.Address) bool | ||
SlotInAccessList(addr common.Address, slot common.Hash) (addressOk bool, slotOk bool) | ||
// AddAddressToAccessList adds the given address to the access list. This operation is safe to perform | ||
// even if the feature/fork is not active yet | ||
AddAddressToAccessList(addr common.Address) | ||
// AddSlotToAccessList adds the given (address,slot) to the access list. This operation is safe to perform | ||
// even if the feature/fork is not active yet | ||
AddSlotToAccessList(addr common.Address, slot common.Hash) | ||
|
||
RevertToSnapshot(int) | ||
Snapshot() int | ||
|
||
AddLog(*types.Log) | ||
AddPreimage(common.Hash, []byte) | ||
|
||
ForEachStorage(common.Address, func(common.Hash, common.Hash) bool) error | ||
} |
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
Oops, something went wrong.