Skip to content

Commit

Permalink
Merge pull request #576 from oasisprotocol/ptrus/feature/eden-genesis…
Browse files Browse the repository at this point in the history
…-values

config: Add Eden chain context and genesis heights
  • Loading branch information
ptrus authored Nov 29, 2023
2 parents 6b2fe2e + e6e278e commit f642372
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 34 deletions.
24 changes: 2 additions & 22 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/knadh/koanf/parsers/yaml"
"github.com/knadh/koanf/providers/env"
"github.com/knadh/koanf/providers/file"

sdkConfig "github.com/oasisprotocol/oasis-sdk/client-sdk/go/config"

"github.com/oasisprotocol/nexus/common"
Expand Down Expand Up @@ -158,7 +159,7 @@ type SourceConfig struct {

// Nodes describe the oasis-node(s) to connect to. Keys are "archive
// names," which are named after mainnet releases, in lowercase e.g.
// "cobalt" and "damask."
// "cobalt", "damask" and "eden".
Nodes map[string]*ArchiveConfig `koanf:"nodes"`

// IPFS holds the configuration for accessing IPFS.
Expand Down Expand Up @@ -188,27 +189,6 @@ func (sc *SourceConfig) SDKParaTime(runtime common.Runtime) *sdkConfig.ParaTime
return sc.SDKNetwork().ParaTimes.All[string(runtime)]
}

func CustomSingleNetworkSourceConfig(rpc string, chainContext string) *SourceConfig {
return &SourceConfig{
CustomChain: &CustomChainConfig{
History: SingleRecordHistory(chainContext),
SDKNetwork: &sdkConfig.Network{},
},
Nodes: SingleNetworkLookup(rpc),
FastStartup: true,
}
}

func SingleNetworkLookup(rpc string) map[string]*ArchiveConfig {
return map[string]*ArchiveConfig{
"damask": {
DefaultNode: &NodeConfig{
RPC: rpc,
},
},
}
}

type CacheConfig struct {
// CacheDir is the directory where the cache data is stored
CacheDir string `koanf:"cache_dir"`
Expand Down
23 changes: 11 additions & 12 deletions config/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,21 +80,20 @@ func (h *History) RecordForRuntimeRound(runtime common.Runtime, round uint64) (*
)
}

func SingleRecordHistory(chainContext string) *History {
return &History{
Records: []*Record{
{
ArchiveName: "damask",
GenesisHeight: 1,
ChainContext: chainContext,
},
},
}
}

var DefaultChains = map[common.ChainName]*History{
common.ChainNameMainnet: {
Records: []*Record{
{
// https://github.com/oasisprotocol/mainnet-artifacts/releases/tag/2023-11-29
ArchiveName: "eden",
GenesisHeight: 16817956,
RuntimeStartRounds: map[common.Runtime]uint64{
common.RuntimeCipher: 44054,
common.RuntimeEmerald: 7875129,
common.RuntimeSapphire: 1357486,
},
ChainContext: "bb3d748def55bdfb797a2ac53ee6ee141e54cd2ab2dc2375f4a0703a178e6e55",
},
{
// https://github.com/oasisprotocol/mainnet-artifacts/releases/tag/2022-04-11
ArchiveName: "damask",
Expand Down

0 comments on commit f642372

Please sign in to comment.