-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconsts.go
98 lines (84 loc) · 2.3 KB
/
consts.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// Copyright 2020 Thinkium
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package common
var (
DefaultStarterPK = "0450d64512b100d1bf9d726a2b9708c2d406778439d2feee42728c1f6d898deb4eb051d85950ad27a16628f66b78e997bdfd78fd80325c206a653bd901f7d1a31a"
BlocksInEpoch uint64 = 1000
EpochsInEra uint64 = 36
// base chainid for ethereum compatible
BigChainIDBaseV2 uint64 = 100007
BigChainIDBase uint64 = 70000
)
const (
// default configuration
DefaultP2PPort1 = 31000
DefaultP2pPort2 = 31050
DefaultRpcAddress = "127.0.0.1:23017"
DefaultEthRpcAddress = "127.0.0.1:32007"
DefaultCompatible = true
// chain id related
ReservedMaxChainID uint32 = 1 << 20
MainChainID = ChainID(0)
NilChainID = ChainID(ReservedMaxChainID)
// length of types
NodeIDBits = 512
NodeIDBytes = NodeIDBits / 8
HashLength = 32
AddressLength = 20
SeedLength = 20
ChainBytesLength = 4 // chain id
HeightBytesLength = 8 // height
// upper limit of shards:<= 2^MaxExponentOfShards
MaxExponentOfShards = 8
)
const (
// chain mode
Root ChainMode = 0x10 + iota
Branch
Shard
UnknownMode
)
const (
Consensus NodeType = 0
Data NodeType = 1
Memo NodeType = 2
NoneNodeType NodeType = 0xFF
)
const (
// network type
BasicNet NetType = iota
ConsensusNet1
ConsensusNet2
RootDataNet // Only in the main chain layer, including all data nodes of the main chain and its sub chains
BranchDataNet // Only in the sub chain layer, including all data nodes of the sub chain and its shards
// UnknownNet
)
const (
// event type of monitoring
P2P = iota
Event
Block
)
const (
// state of system services
SSCreated ServiceStatus = iota
SSInitialized
SSStarted
SSStopped
)
const (
// 0: origin
// 1: add Version/Auditors
ChainInfoVersion = 1
)