Skip to content

Commit

Permalink
Tm w3q integration (ethereum#89)
Browse files Browse the repository at this point in the history
* update genesis and config

* change Epoch
  • Loading branch information
ping-ke committed May 25, 2022
1 parent 3c7a07e commit c0d9297
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 6 deletions.
8 changes: 8 additions & 0 deletions core/genesis.go
Expand Up @@ -438,7 +438,15 @@ func DefaultWeb3QTestnetGenesisBlock() *Genesis {
Timestamp: 1644537097,
Alloc: map[common.Address]GenesisAccount{
common.HexToAddress("0x0E961a6A6235eFDB9a0F0BC753E395211B77cc28"): {Balance: new(big.Int).Mul(big.NewInt(1000000000000000000), big.NewInt(1000000000))}, // 1e9 Ether
common.HexToAddress("0x5C935469C5592Aeeac3372e922d9bCEabDF8830d"): {Balance: new(big.Int).Mul(big.NewInt(1000000000000000000), big.NewInt(1000000000))}, // 1e9 Ether
},
NextValidators: []common.Address{
common.HexToAddress("0x2cff0b8e36522eba76f6f5c328d58581243882e4"),
common.HexToAddress("0x959994471dee37411f579dd2820a8743cba20f46"),
common.HexToAddress("0x977cfc676bb06daed7ddfa7711bcfe8d50c93081"),
common.HexToAddress("0xcd21538af6e33ff6fcf1e2ca20f771413004cfd3"),
},
NextValidatorPowers: []uint64{1, 1, 1, 1},
}
}

Expand Down
2 changes: 1 addition & 1 deletion internal/ethapi/api.go
Expand Up @@ -1206,7 +1206,7 @@ func RPCMarshalHeader(head *types.Header) map[string]interface{} {
"timeMs": head.TimeMs,
"nextValidators": head.NextValidators,
"nextValidatorPowers": head.NextValidatorPowers,
"LastCommitHash": head.LastCommitHash,
"lastCommitHash": head.LastCommitHash,
"commit": head.Commit,
}

Expand Down
37 changes: 32 additions & 5 deletions params/config.go
Expand Up @@ -34,7 +34,7 @@ var (
SepoliaGenesisHash = common.HexToHash("0x25a5cc106eea7138acab33231d7160d69cb777ee0c2c553fcddf5138993e6dd9")
RinkebyGenesisHash = common.HexToHash("0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177")
GoerliGenesisHash = common.HexToHash("0xbf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a")
Web3QTestnetGenesisHash = common.HexToHash("0x1cf5a870ae77dcff37b14ca5ca8ba05d428e3dc722f544f958c4e19e4747953d")
Web3QTestnetGenesisHash = common.HexToHash("0xe1b551a47236ea806a1a9f6a9082ab989cffd999a44caa6015edc27136e0aab5")
Web3QGalileoGenesisHash = common.HexToHash("0xa576a985390f3a643e2acdeaed074cc9866c99f6bdf3ca8c49ec959054703745")
)

Expand Down Expand Up @@ -256,6 +256,11 @@ var (
Threshold: 2,
}

Web3QTestnetValBootnodes = []string{
"/ip4/68.183.157.114/udp/33333/quic/p2p/12D3KooWEZ94qZgJgUNYiLwXahknkniYgozxw5eocijZJkew6Mj5",
"/ip4/128.199.102.174/udp/33333/quic/p2p/12D3KooWNjKALie7Cdpb4KG8axgABA4VCCsKoBQdvYvRhVZhbtPk",
}

// Web3QTestnetChainConfig contains the chain parameters to run a node on the Web3Q test network.
Web3QTestnetChainConfig = &ChainConfig{
ChainID: big.NewInt(3333),
Expand All @@ -273,9 +278,31 @@ var (
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
ArrowGlacierBlock: nil,
Clique: &CliqueConfig{
Period: 6,
Epoch: 100800, // one week
Tendermint: &TendermintConfig{
Epoch: 10000,
ValidatorContract: "",
ContractChainID: 0,
ValidatorChangeEpochId: 0,
ValRpc: "",
P2pPort: 33333,
ProposerRepetition: 8,
P2pBootstrap: strings.Join(Web3QTestnetValBootnodes, ","),
NodeKeyPath: "",
ConsensusConfig: ConsensusConfig{
// WalPath: filepath.Join(defaultDataDir, "cs.wal", "wal"),
TimeoutPropose: 3000 * time.Millisecond,
TimeoutProposeDelta: 500 * time.Millisecond,
TimeoutPrevote: 1000 * time.Millisecond,
TimeoutPrevoteDelta: 500 * time.Millisecond,
TimeoutPrecommit: 1000 * time.Millisecond,
TimeoutPrecommitDelta: 500 * time.Millisecond,
TimeoutCommit: 5000 * time.Millisecond,
SkipTimeoutCommit: false,
PeerGossipSleepDuration: 100 * time.Millisecond,
PeerQueryMaj23SleepDuration: 2000 * time.Millisecond,
DoubleSignCheckHeight: uint64(0),
ConsensusSyncRequestDuration: 500 * time.Millisecond,
},
},
}

Expand Down Expand Up @@ -503,7 +530,7 @@ type TendermintConfig struct {
Epoch uint64 `json:"epoch"` // Epoch lengh to vote new validator
ValidatorContract string `json:"validatorContract"` // Validator set contract
ContractChainID uint64 `json:"contractChainId"` // Chain ID which Validator contract on
ValidatorChangeEpochId uint64 `json:"valChangeEpochId"` // Epoch to enable update ValidatorSet from contract
ValidatorChangeEpochId uint64 `json:"valChangeEpochId"` // Epoch to enable update ValidatorSet from contract
ValRpc string `json:"valRpc"` // rpc for ethclient to get ValidatorSet from contract
NodeKeyPath string
P2pPort uint
Expand Down

0 comments on commit c0d9297

Please sign in to comment.