cmd,core,eth,params,tests: define yolov3 + enable EIP-2565 (#22213)

Removes the yolov2 definition, adds yolov3, including EIP-2565. This PR also disables some of the erroneously generated blockchain and statetests, and adds the new genesis hash + alloc for yolov3. 
This PR disables the CLI switches for yolo, since it's not complete until we merge support for 2930.
This commit is contained in:
Sina Mahmoodi
2021-01-28 21:19:07 +01:00
committed by GitHub
parent 2e5d141708
commit eb21c652c0
23 changed files with 112 additions and 88 deletions

View File

@ -45,6 +45,13 @@ func TestBlockchain(t *testing.T) {
bt.skipLoad(`.*randomStatetest94.json.*`)
bt.walk(t, blockTestDir, func(t *testing.T, name string, test *BlockTest) {
if test.json.Network == "Berlin" {
// Our current berlin-tests were generated using YOLOv2 rules, hence a lot of them
// fail when berlin is defined as YOLOv3. We skip those, until they've been
// regenerated and re-imported
// TODO (@holiman)
return
}
if err := bt.checkFailure(t, name+"/trie", test.Run(false)); err != nil {
t.Errorf("test without snapshotter failed: %v", err)
}

View File

@ -79,7 +79,7 @@ func checkInput(id byte, inputLen int) bool {
// other values are reserved for future use.
func fuzz(id byte, data []byte) int {
// Even on bad input, it should not crash, so we still test the gas calc
precompile := vm.PrecompiledContractsYoloV2[common.BytesToAddress([]byte{id})]
precompile := vm.PrecompiledContractsBLS[common.BytesToAddress([]byte{id})]
gas := precompile.RequiredGas(data)
if !checkInput(id, len(data)) {
return 0

View File

@ -141,7 +141,7 @@ var Forks = map[string]*params.ChainConfig{
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(5),
},
"YOLOv2": {
"YOLOv3": {
ChainID: big.NewInt(1),
HomesteadBlock: big.NewInt(0),
EIP150Block: big.NewInt(0),
@ -151,9 +151,9 @@ var Forks = map[string]*params.ChainConfig{
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
YoloV2Block: big.NewInt(0),
YoloV3Block: big.NewInt(0),
},
// This specification is subject to change, but is for now identical to YOLOv2
// This specification is subject to change, but is for now identical to YOLOv3
// for cross-client testing purposes
"Berlin": {
ChainID: big.NewInt(1),
@ -165,7 +165,7 @@ var Forks = map[string]*params.ChainConfig{
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
YoloV2Block: big.NewInt(0),
YoloV3Block: big.NewInt(0),
},
}

View File

@ -62,6 +62,14 @@ func TestState(t *testing.T) {
} {
st.walk(t, dir, func(t *testing.T, name string, test *StateTest) {
for _, subtest := range test.Subtests() {
if subtest.Fork == "Berlin" {
// Our current berlin-tests were generated using YOLOv2 rules, hence a lot of them
// fail when berlin is defined as YOLOv3. We skip those, until they've been
// regenerated and re-imported
// TODO (@holiman)
continue
}
subtest := subtest
key := fmt.Sprintf("%s/%d", subtest.Fork, subtest.Index)
name := name + "/" + key

View File

@ -187,7 +187,7 @@ func (t *StateTest) RunNoVerify(subtest StateSubtest, vmconfig vm.Config, snapsh
context.GetHash = vmTestBlockHash
evm := vm.NewEVM(context, txContext, statedb, config, vmconfig)
if config.IsYoloV2(context.BlockNumber) {
if config.IsYoloV3(context.BlockNumber) {
statedb.AddAddressToAccessList(msg.From())
if dst := msg.To(); dst != nil {
statedb.AddAddressToAccessList(*dst)