aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei-Ning Huang <w@cobinhood.com>2018-10-13 16:48:50 +0800
committerWei-Ning Huang <w@dexon.org>2019-03-12 12:19:09 +0800
commitf4936aa1eb7fa01f56c28f081af266c2a4924a61 (patch)
tree1b6a801a3e0deb4b812d6f4ffeac48e0005e436f
parent0e24664c5a4133e8404868bdc83f4a3da8806ab8 (diff)
downloaddexon-f4936aa1eb7fa01f56c28f081af266c2a4924a61.tar
dexon-f4936aa1eb7fa01f56c28f081af266c2a4924a61.tar.gz
dexon-f4936aa1eb7fa01f56c28f081af266c2a4924a61.tar.bz2
dexon-f4936aa1eb7fa01f56c28f081af266c2a4924a61.tar.lz
dexon-f4936aa1eb7fa01f56c28f081af266c2a4924a61.tar.xz
dexon-f4936aa1eb7fa01f56c28f081af266c2a4924a61.tar.zst
dexon-f4936aa1eb7fa01f56c28f081af266c2a4924a61.zip
core: populate genesis CRS in genesis state
-rw-r--r--core/genesis.go5
-rw-r--r--misc/genesis.json1
-rw-r--r--params/config.go4
3 files changed, 9 insertions, 1 deletions
diff --git a/core/genesis.go b/core/genesis.go
index 94b1deff2..945476d6a 100644
--- a/core/genesis.go
+++ b/core/genesis.go
@@ -32,6 +32,7 @@ import (
"github.com/dexon-foundation/dexon/core/state"
"github.com/dexon-foundation/dexon/core/types"
"github.com/dexon-foundation/dexon/core/vm"
+ "github.com/dexon-foundation/dexon/crypto"
"github.com/dexon-foundation/dexon/ethdb"
"github.com/dexon-foundation/dexon/log"
"github.com/dexon-foundation/dexon/params"
@@ -253,6 +254,10 @@ func (g *Genesis) ToBlock(db ethdb.Database) *types.Block {
// Governance configuration.
govStateHelper.UpdateConfiguration(g.Config.Dexcon)
+ // Genesis CRS.
+ crs := crypto.Keccak256([]byte(g.Config.Dexcon.GenesisCRSText))
+ govStateHelper.PushCRS(common.BytesToHash(crs))
+
root := statedb.IntermediateRoot(false)
head := &types.Header{
Number: new(big.Int).SetUint64(g.Number),
diff --git a/misc/genesis.json b/misc/genesis.json
index 36284b6b7..d2b1d2b7e 100644
--- a/misc/genesis.json
+++ b/misc/genesis.json
@@ -7,6 +7,7 @@
"eip155Block": 3,
"eip158Block": 3,
"dexcon": {
+ "genesisCRSText": "In DEXON, we trust.",
"numChain": 4,
"lambdaBA": 250,
"lambdaDKG": 2500,
diff --git a/params/config.go b/params/config.go
index 901a93a9f..967e70b23 100644
--- a/params/config.go
+++ b/params/config.go
@@ -218,6 +218,7 @@ func (c *CliqueConfig) String() string {
// DexconConfig is the consensus engine configs for DEXON consensus.
type DexconConfig struct {
+ GenesisCRSText string `json:"genesisCRSText"`
NumChains uint32 `json:"numChains"`
LambdaBA uint64 `json:"lambdaBA"`
LambdaDKG uint64 `json:"lambdaDKG"`
@@ -232,7 +233,8 @@ type DexconConfig struct {
// String implements the stringer interface, returning the consensus engine details.
func (d *DexconConfig) String() string {
- return fmt.Sprintf("{NumChains: %v LambdaBA: %v LambdaDKG: %v K: %v PhiRatio: %v NotarySetSize: %v DKGSetSize: %v RoundInterval: %v MinBlockInterval: %v MaxBlockInterval: %v",
+ return fmt.Sprintf("{GenesisCRSText: %v NumChains: %v LambdaBA: %v LambdaDKG: %v K: %v PhiRatio: %v NotarySetSize: %v DKGSetSize: %v RoundInterval: %v MinBlockInterval: %v MaxBlockInterval: %v",
+ d.GenesisCRSText,
d.NumChains,
d.LambdaBA,
d.LambdaDKG,