Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.

Migrate Stateful-v1.11.2 changes onto v1.11.4 release #13

Closed
wants to merge 41 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
cc1238a
stateful
Jan 16, 2023
527b51d
use PrecompileExecutor
calbera Jan 18, 2023
fa71e1c
use host terminology
calbera Jan 18, 2023
bd7853d
return precompiledContract and bool
calbera Jan 18, 2023
2e58beb
use ctx in Run instead of statedb
calbera Jan 18, 2023
23abedc
change to ph
Jan 19, 2023
252a807
bing bong
Jan 19, 2023
d024add
rename to runner
calbera Jan 23, 2023
e181e29
rename constructor
calbera Jan 23, 2023
b68f406
new precompile function types
calbera Jan 24, 2023
6738bc9
precompile controller
calbera Jan 24, 2023
c1877f5
make PrecompileController public
calbera Jan 25, 2023
e677eab
ctx setter
calbera Jan 25, 2023
4500de4
add statedb in contract.Run
calbera Jan 25, 2023
52ba783
use Prepare on controller
calbera Jan 25, 2023
1a7ad27
prepare for state transition
calbera Jan 25, 2023
c40db52
contract has registry key
calbera Feb 2, 2023
205de59
has and get
calbera Feb 2, 2023
ddff03c
controller > manager
calbera Feb 2, 2023
c032807
with statedb
calbera Feb 3, 2023
dfc88fb
with ctx
calbera Feb 3, 2023
3bcbe77
simple precompile manager
calbera Feb 6, 2023
d04e4af
allow setting block context to evm
calbera Feb 10, 2023
f7ab8a6
remove unneded evm funcs
calbera Feb 10, 2023
7fde4c9
simplify precompile manager
calbera Feb 16, 2023
553a202
updated go.sum
Feb 17, 2023
9ca5cc4
removing extra bits
Feb 17, 2023
bd59462
typo fixes
Feb 17, 2023
b9c956b
ethapi
Feb 18, 2023
6f9e9af
cleanup precomp manager
calbera Feb 19, 2023
c90cd37
add get chain id
Feb 22, 2023
85c513b
make access list public
calbera Feb 23, 2023
becca16
make access list struct public
calbera Feb 23, 2023
900690c
fix typos
calbera Feb 23, 2023
86a96c5
ethpub
Feb 23, 2023
9fdaf4f
use the StateDB interface in the API
calbera Feb 23, 2023
991a177
make compatible
calbera Feb 24, 2023
d8cad92
fixed merge conflicts
Feb 28, 2023
ec6ffde
Merge pull request #11 from berachain/stateful-test
transmissions12 Feb 28, 2023
f629cbb
remove unecessary vm imports
calbera Feb 28, 2023
364e922
add signature to signer interface
calbera Mar 6, 2023
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
Prev Previous commit
Next Next commit
simplify precompile manager
  • Loading branch information
calbera authored and t12s committed Feb 28, 2023
commit 7fde4c92bced4baf7bacf421c43a10434fc6fcae
13 changes: 5 additions & 8 deletions core/vm/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ type (

// `PrecompileManager` allows the EVM to execute a precompiled contract.
type PrecompileManager interface {
// `Reset` sets the native precompile context before beginning a state
// transition.
Reset(ctx context.Context)

// `Has` returns if a precompiled contract was found at `addr`.
Expand All @@ -55,7 +53,7 @@ type PrecompileManager interface {
Get(addr common.Address) PrecompiledContract

// `Run` runs a precompiled contract and returns the remaining gas.
Run(p PrecompiledContract, input []byte, caller common.Address,
Run(sdb StateDB, p PrecompiledContract, input []byte, caller common.Address,
value *big.Int, suppliedGas uint64, readonly bool,
) (ret []byte, remainingGas uint64, err error)
}
Expand Down Expand Up @@ -226,9 +224,8 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
}

if isPrecompile {

ret, gas, err = evm.PrecompileManager.Run(
evm.PrecompileManager.Get(addr), input, caller.Address(), value, gas, false,
evm.StateDB, evm.PrecompileManager.Get(addr), input, caller.Address(), value, gas, false,
)
} else {
// Initialise a new contract and set the code that is to be used by the EVM.
Expand Down Expand Up @@ -293,7 +290,7 @@ func (evm *EVM) CallCode(caller ContractRef, addr common.Address, input []byte,
// It is allowed to call precompiles, even via delegatecall
if isPrecompile := evm.PrecompileManager.Has(addr); isPrecompile {
ret, gas, err = evm.PrecompileManager.Run(
evm.PrecompileManager.Get(addr), input, caller.Address(), value, gas, true,
evm.StateDB, evm.PrecompileManager.Get(addr), input, caller.Address(), value, gas, true,
)
} else {
addrCopy := addr
Expand Down Expand Up @@ -341,7 +338,7 @@ func (evm *EVM) DelegateCall(caller ContractRef, addr common.Address, input []by
if isPrecompile := evm.PrecompileManager.Has(addr); isPrecompile {
parent := caller.(*Contract)
ret, gas, err = evm.PrecompileManager.Run(
evm.PrecompileManager.Get(addr), input, parent.CallerAddress, parent.value, gas, false,
evm.StateDB, evm.PrecompileManager.Get(addr), input, parent.CallerAddress, parent.value, gas, false,
)
} else {
addrCopy := addr
Expand Down Expand Up @@ -392,7 +389,7 @@ func (evm *EVM) StaticCall(caller ContractRef, addr common.Address, input []byte

if isPrecompile := evm.PrecompileManager.Has(addr); isPrecompile {
ret, gas, err = evm.PrecompileManager.Run(
evm.PrecompileManager.Get(addr), input, caller.Address(), new(big.Int), gas, true,
evm.StateDB, evm.PrecompileManager.Get(addr), input, caller.Address(), new(big.Int), gas, true,
)
} else {
// At this point, we use a copy of address. If we don't, the go compiler will
Expand Down