-
Notifications
You must be signed in to change notification settings - Fork 199
/
constants.go
96 lines (75 loc) · 3.92 KB
/
constants.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
package process
// BlockHeaderState specifies which is the state of the block header received
type BlockHeaderState int
const (
// BHReceived defines ID of a received block header
BHReceived BlockHeaderState = iota
// BHReceivedTooLate defines ID of a late received block header
BHReceivedTooLate
// BHProcessed defines ID of a processed block header
BHProcessed
// BHProposed defines ID of a proposed block header
BHProposed
// BHNotarized defines ID of a notarized block header
BHNotarized
)
// TransactionType specifies the type of the transaction
type TransactionType int
const (
// MoveBalance defines ID of a payment transaction - moving balances
MoveBalance TransactionType = iota
// SCDeployment defines ID of a transaction to store a smart contract
SCDeployment
// SCInvoking defines ID of a transaction of type smart contract call
SCInvoking
// RewardTx defines ID of a reward transaction
RewardTx
// InvalidTransaction defines unknown transaction type
InvalidTransaction
)
// BlockFinality defines the block finality which is used in meta-chain/shards (the real finality in shards is given
// by meta-chain)
const BlockFinality = 1
// ShardBlockFinality defines the block finality which is used in shards (the real finality in shards is given
// by meta-chain)
const ShardBlockFinality = 1
// MetaBlockFinality defines the block finality which is used in meta-chain
const MetaBlockFinality = 1
// MetaBlockValidity defines the block validity which is when checking a metablock
const MetaBlockValidity = 1
// EpochChangeGracePeriod defines the allowed round numbers till the shard has to change the epoch
const EpochChangeGracePeriod = 1
// MaxHeaderRequestsAllowed defines the maximum number of missing cross-shard headers (gaps) which could be requested
// in one round, when node processes a received block
const MaxHeaderRequestsAllowed = 10
// MaxItemsInBlock defines the maximum threshold which could be set, and represents the maximum number of items
// (hashes of: mini blocks, txs, meta-headers, shard-headers) which could be added in one block
const MaxItemsInBlock = 15000
// MinItemsInBlock defines the minimum threshold which could be set, and represents the maximum number of items
// (hashes of: mini blocks, txs, meta-headers, shard-headers) which could be added in one block
const MinItemsInBlock = 15000
// NonceDifferenceWhenSynced defines the difference between probable highest nonce seen from network and node's last
// committed block nonce, after which, node is considered himself not synced
const NonceDifferenceWhenSynced = 0
// MaxRequestsWithTimeoutAllowed defines the maximum allowed number of requests with timeout,
// before a special action to be applied
const MaxRequestsWithTimeoutAllowed = 5
// MaxHeadersToRequestInAdvance defines the maximum number of headers which will be requested in advance,
// if they are missing
const MaxHeadersToRequestInAdvance = 10
// RoundModulusTrigger defines a round modulus on which a trigger for an action will be released
const RoundModulusTrigger = 10
// MaxOccupancyPercentageAllowed defines the maximum occupancy percentage allowed to be used,
// from the full pool capacity, for the received data which are not needed in the near future
const MaxOccupancyPercentageAllowed = float64(0.9)
// MaxRoundsWithoutCommittedBlock defines the maximum rounds to wait for a new block to be committed,
// before a special action to be applied
const MaxRoundsWithoutCommittedBlock = 20
// MaxNoncesWithoutCrossNotarized defines the maximum nonces to wait for a new block to be cross notarized,
// before a special action to be applied
const MaxNoncesWithoutCrossNotarized = 100
// MinForkRound represents the minimum fork round set by a notarized header received
const MinForkRound = uint64(0)
// MaxNonceDifferences represents the maximum nonce difference between received and committed header, so the received one
// to be stored in advance in block tracker
const MaxNonceDifferences = uint64(1000)