Skip to content

Commit eb21c65

Browse files
authored
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.
1 parent 2e5d141 commit eb21c65

23 files changed

Lines changed: 112 additions & 88 deletions

‎cmd/evm/internal/t8ntool/execution.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
145145
txContext := core.NewEVMTxContext(msg)
146146

147147
evm := vm.NewEVM(vmContext, txContext, statedb, chainConfig, vmConfig)
148-
if chainConfig.IsYoloV2(vmContext.BlockNumber) {
148+
if chainConfig.IsYoloV3(vmContext.BlockNumber) {
149149
statedb.AddAddressToAccessList(msg.From())
150150
if dst := msg.To(); dst != nil {
151151
statedb.AddAddressToAccessList(*dst)

‎cmd/geth/chaincmd.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ The export-preimages command export hash preimages to an RLP encoded stream`,
164164
utils.RinkebyFlag,
165165
utils.TxLookupLimitFlag,
166166
utils.GoerliFlag,
167-
utils.YoloV2Flag,
167+
utils.YoloV3Flag,
168168
utils.LegacyTestnetFlag,
169169
},
170170
Category: "BLOCKCHAIN COMMANDS",
@@ -215,7 +215,7 @@ Use "ethereum dump 0" to dump the genesis block.`,
215215
utils.RopstenFlag,
216216
utils.RinkebyFlag,
217217
utils.GoerliFlag,
218-
utils.YoloV2Flag,
218+
utils.YoloV3Flag,
219219
utils.LegacyTestnetFlag,
220220
utils.SyncModeFlag,
221221
},

‎cmd/geth/consolecmd.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ func remoteConsole(ctx *cli.Context) error {
136136
path = filepath.Join(path, "rinkeby")
137137
} else if ctx.GlobalBool(utils.GoerliFlag.Name) {
138138
path = filepath.Join(path, "goerli")
139-
} else if ctx.GlobalBool(utils.YoloV2Flag.Name) {
140-
path = filepath.Join(path, "yolo-v2")
139+
} else if ctx.GlobalBool(utils.YoloV3Flag.Name) {
140+
path = filepath.Join(path, "yolo-v3")
141141
}
142142
}
143143
endpoint = fmt.Sprintf("%s/geth.ipc", path)

‎cmd/geth/main.go‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,9 @@ var (
148148
utils.RopstenFlag,
149149
utils.RinkebyFlag,
150150
utils.GoerliFlag,
151-
utils.YoloV2Flag,
151+
// YOLOv3 is not yet complete!
152+
// TODO: enable this once 2718/2930 is added
153+
//utils.YoloV3Flag,
152154
utils.VMEnableDebugFlag,
153155
utils.NetworkIdFlag,
154156
utils.EthStatsURLFlag,

‎cmd/geth/usage.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ var AppHelpFlagGroups = []flags.FlagGroup{
4444
utils.MainnetFlag,
4545
utils.GoerliFlag,
4646
utils.RinkebyFlag,
47-
utils.YoloV2Flag,
47+
// TODO: Re-enable this when 2718/2930 is added
48+
//utils.YoloV3Flag,
4849
utils.RopstenFlag,
4950
utils.SyncModeFlag,
5051
utils.ExitWhenSyncedFlag,

‎cmd/puppeth/wizard_genesis.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@ func (w *wizard) manageGenesis() {
236236
w.conf.Genesis.Config.IstanbulBlock = w.readDefaultBigInt(w.conf.Genesis.Config.IstanbulBlock)
237237

238238
fmt.Println()
239-
fmt.Printf("Which block should YOLOv2 come into effect? (default = %v)\n", w.conf.Genesis.Config.YoloV2Block)
240-
w.conf.Genesis.Config.YoloV2Block = w.readDefaultBigInt(w.conf.Genesis.Config.YoloV2Block)
239+
fmt.Printf("Which block should YOLOv3 come into effect? (default = %v)\n", w.conf.Genesis.Config.YoloV3Block)
240+
w.conf.Genesis.Config.YoloV3Block = w.readDefaultBigInt(w.conf.Genesis.Config.YoloV3Block)
241241

242242
out, _ := json.MarshalIndent(w.conf.Genesis.Config, "", " ")
243243
fmt.Printf("Chain configuration updated:\n\n%s\n", out)

‎cmd/utils/flags.go‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ var (
147147
Name: "goerli",
148148
Usage: "Görli network: pre-configured proof-of-authority test network",
149149
}
150-
YoloV2Flag = cli.BoolFlag{
151-
Name: "yolov2",
152-
Usage: "YOLOv2 network: pre-configured proof-of-authority shortlived test network.",
150+
YoloV3Flag = cli.BoolFlag{
151+
Name: "yolov3",
152+
Usage: "YOLOv3 network: pre-configured proof-of-authority shortlived test network.",
153153
}
154154
RinkebyFlag = cli.BoolFlag{
155155
Name: "rinkeby",
@@ -760,8 +760,8 @@ func MakeDataDir(ctx *cli.Context) string {
760760
if ctx.GlobalBool(GoerliFlag.Name) {
761761
return filepath.Join(path, "goerli")
762762
}
763-
if ctx.GlobalBool(YoloV2Flag.Name) {
764-
return filepath.Join(path, "yolo-v2")
763+
if ctx.GlobalBool(YoloV3Flag.Name) {
764+
return filepath.Join(path, "yolo-v3")
765765
}
766766
return path
767767
}
@@ -819,8 +819,8 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
819819
urls = params.RinkebyBootnodes
820820
case ctx.GlobalBool(GoerliFlag.Name):
821821
urls = params.GoerliBootnodes
822-
case ctx.GlobalBool(YoloV2Flag.Name):
823-
urls = params.YoloV2Bootnodes
822+
case ctx.GlobalBool(YoloV3Flag.Name):
823+
urls = params.YoloV3Bootnodes
824824
case cfg.BootstrapNodes != nil:
825825
return // already set, don't apply defaults.
826826
}
@@ -1280,7 +1280,7 @@ func setDataDir(ctx *cli.Context, cfg *node.Config) {
12801280
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "rinkeby")
12811281
case ctx.GlobalBool(GoerliFlag.Name) && cfg.DataDir == node.DefaultDataDir():
12821282
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "goerli")
1283-
case ctx.GlobalBool(YoloV2Flag.Name) && cfg.DataDir == node.DefaultDataDir():
1283+
case ctx.GlobalBool(YoloV3Flag.Name) && cfg.DataDir == node.DefaultDataDir():
12841284
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "yolo-v2")
12851285
}
12861286
}
@@ -1494,7 +1494,7 @@ func SetShhConfig(ctx *cli.Context, stack *node.Node) {
14941494
// SetEthConfig applies eth-related command line flags to the config.
14951495
func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
14961496
// Avoid conflicting network flags
1497-
CheckExclusive(ctx, MainnetFlag, DeveloperFlag, LegacyTestnetFlag, RopstenFlag, RinkebyFlag, GoerliFlag, YoloV2Flag)
1497+
CheckExclusive(ctx, MainnetFlag, DeveloperFlag, LegacyTestnetFlag, RopstenFlag, RinkebyFlag, GoerliFlag, YoloV3Flag)
14981498
CheckExclusive(ctx, LegacyLightServFlag, LightServeFlag, SyncModeFlag, "light")
14991499
CheckExclusive(ctx, DeveloperFlag, ExternalSignerFlag) // Can't use both ephemeral unlocked and external signer
15001500
CheckExclusive(ctx, GCModeFlag, "archive", TxLookupLimitFlag)
@@ -1631,11 +1631,11 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
16311631
}
16321632
cfg.Genesis = core.DefaultGoerliGenesisBlock()
16331633
SetDNSDiscoveryDefaults(cfg, params.GoerliGenesisHash)
1634-
case ctx.GlobalBool(YoloV2Flag.Name):
1634+
case ctx.GlobalBool(YoloV3Flag.Name):
16351635
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
1636-
cfg.NetworkId = 133519467574834 // "yolov2"
1636+
cfg.NetworkId = new(big.Int).SetBytes([]byte("yolov3")).Uint64() // "yolov3"
16371637
}
1638-
cfg.Genesis = core.DefaultYoloV2GenesisBlock()
1638+
cfg.Genesis = core.DefaultYoloV3GenesisBlock()
16391639
case ctx.GlobalBool(DeveloperFlag.Name):
16401640
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
16411641
cfg.NetworkId = 1337
@@ -1824,8 +1824,8 @@ func MakeGenesis(ctx *cli.Context) *core.Genesis {
18241824
genesis = core.DefaultRinkebyGenesisBlock()
18251825
case ctx.GlobalBool(GoerliFlag.Name):
18261826
genesis = core.DefaultGoerliGenesisBlock()
1827-
case ctx.GlobalBool(YoloV2Flag.Name):
1828-
genesis = core.DefaultYoloV2GenesisBlock()
1827+
case ctx.GlobalBool(YoloV3Flag.Name):
1828+
genesis = core.DefaultYoloV3GenesisBlock()
18291829
case ctx.GlobalBool(DeveloperFlag.Name):
18301830
Fatalf("Developer chains are ephemeral")
18311831
}

‎core/genesis.go‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ func (g *Genesis) configOrDefault(ghash common.Hash) *params.ChainConfig {
243243
return params.RinkebyChainConfig
244244
case ghash == params.GoerliGenesisHash:
245245
return params.GoerliChainConfig
246-
case ghash == params.YoloV2GenesisHash:
247-
return params.YoloV2ChainConfig
246+
case ghash == params.YoloV3GenesisHash:
247+
return params.YoloV3ChainConfig
248248
default:
249249
return params.AllEthashProtocolChanges
250250
}
@@ -380,15 +380,15 @@ func DefaultGoerliGenesisBlock() *Genesis {
380380
}
381381
}
382382

383-
func DefaultYoloV2GenesisBlock() *Genesis {
384-
// TODO: Update with yolov2 values + regenerate alloc data
383+
func DefaultYoloV3GenesisBlock() *Genesis {
384+
// Full genesis: https://gist.github.com/holiman/b2c32a05ff2e2712e11c0787d987d46f
385385
return &Genesis{
386-
Config: params.YoloV2ChainConfig,
387-
Timestamp: 0x5f91b932,
386+
Config: params.YoloV3ChainConfig,
387+
Timestamp: 0x60117f8b,
388388
ExtraData: hexutil.MustDecode("0x00000000000000000000000000000000000000000000000000000000000000008a37866fd3627c9205a37c8685666f32ec07bb1b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
389389
GasLimit: 0x47b760,
390390
Difficulty: big.NewInt(1),
391-
Alloc: decodePrealloc(yoloV1AllocData),
391+
Alloc: decodePrealloc(yoloV3AllocData),
392392
}
393393
}
394394

0 commit comments

Comments
 (0)