Skip to content

Commit

Permalink
Merge pull request #516 from Fantom-foundation/fix/genesis-hashes
Browse files Browse the repository at this point in the history
Fix of trusted testnet genesis preset list
  • Loading branch information
uprendis authored Oct 6, 2023
2 parents 11d2d1c + c2e4ce4 commit 384bb85
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
22 changes: 11 additions & 11 deletions cmd/opera/launcher/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,30 +182,30 @@ var (

{
Name: "Testnet-16200 without history",
Header: mainnetHeader,
Header: testnetHeader,
Hashes: genesis.Hashes{
genesisstore.EpochsSection(0): hash.HexToHash("0xd72e9bf39c645df8d978955fab8997a7e9cd7cb5812c007e2bb4b51a8c570a90"),
genesisstore.BlocksSection(0): hash.HexToHash("0x7d651ed0e0f3e92ffd89cb52112598db54afd8bf3050bc083ff0bfe1b98948fd"),
genesisstore.EpochsSection(1): hash.HexToHash("0x7d651ed0e0f3e92ffd89cb52112598db54afd8bf3050bc083ff0bfe1b98948fd"),
genesisstore.BlocksSection(1): hash.HexToHash("0xd72e9bf39c645df8d978955fab8997a7e9cd7cb5812c007e2bb4b51a8c570a90"),
},
},
{
Name: "Testnet-16200 without MPT",
Header: mainnetHeader,
Header: testnetHeader,
Hashes: genesis.Hashes{
genesisstore.EpochsSection(0): hash.HexToHash("0x61040a80f16755b86d67f13880f55c1238d307e2e1c6fc87951eb3bdee0bdff2"),
genesisstore.BlocksSection(0): hash.HexToHash("0x12010621d8cf4dcd4ea357e98eac61edf9517a6df752cb2d929fca69e56bd8d1"),
genesisstore.EpochsSection(1): hash.HexToHash("0xd72e9bf39c645df8d978955fab8997a7e9cd7cb5812c007e2bb4b51a8c570a90"),
genesisstore.BlocksSection(1): hash.HexToHash("0x7d651ed0e0f3e92ffd89cb52112598db54afd8bf3050bc083ff0bfe1b98948fd"),
genesisstore.EpochsSection(1): hash.HexToHash("0x7d651ed0e0f3e92ffd89cb52112598db54afd8bf3050bc083ff0bfe1b98948fd"),
genesisstore.BlocksSection(1): hash.HexToHash("0xd72e9bf39c645df8d978955fab8997a7e9cd7cb5812c007e2bb4b51a8c570a90"),
},
},
{
Name: "Testnet-16200 with pruned MPT",
Header: mainnetHeader,
Header: testnetHeader,
Hashes: genesis.Hashes{
genesisstore.EpochsSection(0): hash.HexToHash("0x61040a80f16755b86d67f13880f55c1238d307e2e1c6fc87951eb3bdee0bdff2"),
genesisstore.BlocksSection(0): hash.HexToHash("0x12010621d8cf4dcd4ea357e98eac61edf9517a6df752cb2d929fca69e56bd8d1"),
genesisstore.EpochsSection(1): hash.HexToHash("0xd72e9bf39c645df8d978955fab8997a7e9cd7cb5812c007e2bb4b51a8c570a90"),
genesisstore.BlocksSection(1): hash.HexToHash("0x7d651ed0e0f3e92ffd89cb52112598db54afd8bf3050bc083ff0bfe1b98948fd"),
genesisstore.EpochsSection(1): hash.HexToHash("0x7d651ed0e0f3e92ffd89cb52112598db54afd8bf3050bc083ff0bfe1b98948fd"),
genesisstore.BlocksSection(1): hash.HexToHash("0xd72e9bf39c645df8d978955fab8997a7e9cd7cb5812c007e2bb4b51a8c570a90"),
genesisstore.EvmSection(0): hash.HexToHash("0xbd66dcbbe77881d5aae5091ee9c455d213cebef2cc53c0d4bb356840c7020f7b"),
},
},
Expand All @@ -215,8 +215,8 @@ var (
Hashes: genesis.Hashes{
genesisstore.EpochsSection(0): hash.HexToHash("0x61040a80f16755b86d67f13880f55c1238d307e2e1c6fc87951eb3bdee0bdff2"),
genesisstore.BlocksSection(0): hash.HexToHash("0x12010621d8cf4dcd4ea357e98eac61edf9517a6df752cb2d929fca69e56bd8d1"),
genesisstore.EpochsSection(1): hash.HexToHash("0xd72e9bf39c645df8d978955fab8997a7e9cd7cb5812c007e2bb4b51a8c570a90"),
genesisstore.BlocksSection(1): hash.HexToHash("0x7d651ed0e0f3e92ffd89cb52112598db54afd8bf3050bc083ff0bfe1b98948fd"),
genesisstore.EpochsSection(1): hash.HexToHash("0x7d651ed0e0f3e92ffd89cb52112598db54afd8bf3050bc083ff0bfe1b98948fd"),
genesisstore.BlocksSection(1): hash.HexToHash("0xd72e9bf39c645df8d978955fab8997a7e9cd7cb5812c007e2bb4b51a8c570a90"),
genesisstore.EvmSection(0): hash.HexToHash("0x9227c80bf56e4af08dc32cb6043cc43672f2be8177d550ab34a7a9f57f4f104b"),
genesisstore.EvmSection(1): hash.HexToHash("0x2376016f7ba13123244c6b56088a76e2e8bd5d5795fa92bad65f61488d12c236"),
},
Expand Down
17 changes: 17 additions & 0 deletions opera/genesis/types.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package genesis

import (
"fmt"
"sort"
"strings"

"github.com/Fantom-foundation/lachesis-base/hash"

"github.com/Fantom-foundation/go-opera/inter/ibr"
Expand Down Expand Up @@ -45,6 +49,19 @@ func (hh Hashes) Equal(hh2 Hashes) bool {
return hh.Includes(hh2) && hh2.Includes(hh)
}

func (hh Hashes) String() string {
bb := make([]string, 0, len(hh))
for n, h := range hh {
bb = append(bb, fmt.Sprintf("%s: %s", n, h.String()))
}
sort.Strings(bb)
return "{" + strings.Join(bb, ", ") + "}"
}

func (h Header) Equal(h2 Header) bool {
return h == h2
}

func (h Header) String() string {
return fmt.Sprintf("{%d, net:%s, id:%s}", h.NetworkID, h.NetworkName, h.GenesisID.String())
}

0 comments on commit 384bb85

Please sign in to comment.