cmd, core, params: inital support for yolo-v1 testnet (#21154)
* core,params,puppeth: inital support for yolo-v1 testnet * cmd/geth, core: add yolov1 console flag * cmd, core, params: YoloV1 bakein fixups Co-authored-by: Péter Szilágyi <peterke@gmail.com>
This commit is contained in:
committed by
GitHub
parent
4fc678542d
commit
890757f03a
@ -78,9 +78,9 @@ var PrecompiledContractsIstanbul = map[common.Address]PrecompiledContract{
|
||||
common.BytesToAddress([]byte{9}): &blake2F{},
|
||||
}
|
||||
|
||||
// PrecompiledContractsBerlin contains the default set of pre-compiled Ethereum
|
||||
// contracts used in the Berlin release.
|
||||
var PrecompiledContractsBerlin = map[common.Address]PrecompiledContract{
|
||||
// PrecompiledContractsYoloV1 contains the default set of pre-compiled Ethereum
|
||||
// contracts used in the Yolo v1 test release.
|
||||
var PrecompiledContractsYoloV1 = map[common.Address]PrecompiledContract{
|
||||
common.BytesToAddress([]byte{1}): &ecrecover{},
|
||||
common.BytesToAddress([]byte{2}): &sha256hash{},
|
||||
common.BytesToAddress([]byte{3}): &ripemd160hash{},
|
||||
|
@ -42,7 +42,7 @@ type precompiledFailureTest struct {
|
||||
Name string
|
||||
}
|
||||
|
||||
var allPrecompiles = PrecompiledContractsBerlin
|
||||
var allPrecompiles = PrecompiledContractsYoloV1
|
||||
|
||||
// EIP-152 test vectors
|
||||
var blake2FMalformedInputTests = []precompiledFailureTest{
|
||||
|
@ -51,6 +51,9 @@ func run(evm *EVM, contract *Contract, input []byte, readOnly bool) ([]byte, err
|
||||
if evm.chainRules.IsIstanbul {
|
||||
precompiles = PrecompiledContractsIstanbul
|
||||
}
|
||||
if evm.chainRules.IsYoloV1 {
|
||||
precompiles = PrecompiledContractsYoloV1
|
||||
}
|
||||
if p := precompiles[*contract.CodeAddr]; p != nil {
|
||||
return RunPrecompiledContract(p, input, contract)
|
||||
}
|
||||
|
@ -101,6 +101,8 @@ func NewEVMInterpreter(evm *EVM, cfg Config) *EVMInterpreter {
|
||||
if !cfg.JumpTable[STOP].valid {
|
||||
var jt JumpTable
|
||||
switch {
|
||||
case evm.chainRules.IsYoloV1:
|
||||
jt = yoloV1InstructionSet
|
||||
case evm.chainRules.IsIstanbul:
|
||||
jt = istanbulInstructionSet
|
||||
case evm.chainRules.IsConstantinople:
|
||||
|
@ -57,11 +57,20 @@ var (
|
||||
byzantiumInstructionSet = newByzantiumInstructionSet()
|
||||
constantinopleInstructionSet = newConstantinopleInstructionSet()
|
||||
istanbulInstructionSet = newIstanbulInstructionSet()
|
||||
yoloV1InstructionSet = newYoloV1InstructionSet()
|
||||
)
|
||||
|
||||
// JumpTable contains the EVM opcodes supported at a given fork.
|
||||
type JumpTable [256]operation
|
||||
|
||||
func newYoloV1InstructionSet() JumpTable {
|
||||
instructionSet := newIstanbulInstructionSet()
|
||||
|
||||
enable2315(&instructionSet) // Subroutines - https://eips.ethereum.org/EIPS/eip-2315
|
||||
|
||||
return instructionSet
|
||||
}
|
||||
|
||||
// newIstanbulInstructionSet returns the frontier, homestead
|
||||
// byzantium, contantinople and petersburg instructions.
|
||||
func newIstanbulInstructionSet() JumpTable {
|
||||
|
Reference in New Issue
Block a user