diff --git a/cmd/geth/main.go b/cmd/geth/main.go index caf35eff5d..1503c0581b 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -344,6 +344,10 @@ func geth(ctx *cli.Context) error { return fmt.Errorf("failed to setup suave development mode: %v", err) } + if err := prepareSuaveNetworksRemapping(ctx); err != nil { + return err + } + prepare(ctx) stack, backend := makeFullNode(ctx) defer stack.Close() @@ -482,6 +486,15 @@ func unlockAccounts(ctx *cli.Context, stack *node.Node) { } } +func prepareSuaveNetworksRemapping(ctx *cli.Context) error { + if ctx.Bool(utils.RigilFlag.Name) { + if err := ctx.Set(utils.CustomChainFlag.Name, "rigil"); err != nil { + return err + } + } + return nil +} + func prepareSuaveDev(ctx *cli.Context) error { // if suave dev mode is enabled, we need to set some defaults if !ctx.Bool(utils.SuaveDevModeFlag.Name) { diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 7180e51a57..07bac21398 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -172,6 +172,11 @@ var ( Usage: "Path to a custom chain specification file", Category: flags.EthCategory, } + RigilFlag = &cli.BoolFlag{ + Name: "rigil", + Usage: "Rigil network: pre-configured proof-of-authority test network", + Category: flags.EthCategory, + } // Dev mode DeveloperFlag = &cli.BoolFlag{ @@ -996,6 +1001,7 @@ var ( SuaveFlag, SepoliaFlag, CustomChainFlag, + RigilFlag, } // NetworkFlags is the flag group of all built-in supported networks. NetworkFlags = append([]cli.Flag{MainnetFlag}, TestnetFlags...) diff --git a/suave/genesis/fixtures/rigil.json b/suave/genesis/fixtures/rigil.json new file mode 100644 index 0000000000..962c86b5e2 --- /dev/null +++ b/suave/genesis/fixtures/rigil.json @@ -0,0 +1,47 @@ +{ + "name": "suave-rigil", + "config": { + "chainId": 16813125, + "homesteadBlock": 0, + "eip150Block": 0, + "eip155Block": 0, + "eip158Block": 0, + "byzantiumBlock": 0, + "constantinopleBlock": 0, + "petersburgBlock": 0, + "istanbulBlock": 0, + "berlinBlock": 0, + "suaveBlock": 0, + "clique": { + "period": 4, + "epoch": 30000, + "initial_signers": [ + "0981717712ed2c4919fdbc27dfc804800a9eeff9", + "0e5b9aa4925ed1beeb08d1c5a92477a1b719baa7", + "0e8705e07bbe1ce2c39093df3d20aaa5120bfc7a" + ] + } + }, + "difficulty": "1", + "gasLimit": "30000000", + "alloc": { + "7514bf4200868b9e40b6ea36bbeb6ce4965d4a57": { + "balance": "524288000000000000000000" + }, + "a5104355c4cdca495fc00b17f4d8d29ad4fc0000": { + "balance": "524288000000000000000000" + }, + "0981717712ed2c4919fdbc27dfc804800a9eeff9": { + "balance": "524288000000000000000000" + }, + "0e5b9aa4925ed1beeb08d1c5a92477a1b719baa7": { + "balance": "524288000000000000000000" + }, + "0e8705e07bbe1ce2c39093df3d20aaa5120bfc7a": { + "balance": "524288000000000000000000" + } + }, + "bootnodes": [ + "enode://3e575f38caa316c3c9cde227080578bbab03e3966e324616eaa22dac2aa085d9b77ac20c0fd0c67b7077b296b29db493af30a69e283d7a8c7c737203b5639ed2@bootnode-0.rigil.suave.flashbots.net:0?discport=30303" + ] +} \ No newline at end of file diff --git a/suave/genesis/genesis.go b/suave/genesis/genesis.go index c6e104d430..00fa932993 100644 --- a/suave/genesis/genesis.go +++ b/suave/genesis/genesis.go @@ -2,14 +2,12 @@ package genesis import ( "embed" + "io/fs" "os" "strings" ) -// Right now there is only a test.json file because -// the binary does not compile if the embed.FS is empty. -// -//go:embed *.json +//go:embed fixtures var genesisFiles embed.FS func Load(name string) ([]byte, error) { @@ -22,8 +20,12 @@ func Load(name string) ([]byte, error) { return genesisRaw, nil } - // load 'name' frrom the embedded files - data, err := genesisFiles.ReadFile(name + ".json") + // load 'name' from the embedded files + fsys, err := fs.Sub(genesisFiles, "fixtures") + if err != nil { + return nil, err + } + data, err := fs.ReadFile(fsys, name+".json") if err != nil { return nil, err } diff --git a/suave/genesis/genesis_test.go b/suave/genesis/genesis_test.go index f6ad6b593f..36535cf254 100644 --- a/suave/genesis/genesis_test.go +++ b/suave/genesis/genesis_test.go @@ -7,7 +7,10 @@ import ( ) func TestGenesis(t *testing.T) { - _, err := Load("test") + _, err := Load("genesis-test") + require.NoError(t, err) + + _, err = Load("rigil") require.NoError(t, err) _, err = Load("./fixtures/genesis-test.json") diff --git a/suave/genesis/test.json b/suave/genesis/test.json deleted file mode 100644 index 9e26dfeeb6..0000000000 --- a/suave/genesis/test.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file