-
Notifications
You must be signed in to change notification settings - Fork 0
/
keys.go
54 lines (43 loc) · 1.68 KB
/
keys.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
package state
import "github.com/dnerochain/dnero/common"
//
// ------------------------- Ledger State Keys -------------------------
//
// ChainIDKey returns the key for chainID
func ChainIDKey() common.Bytes {
return common.Bytes("chainid")
}
// AccountKey constructs the state key for the given address
func AccountKey(addr common.Address) common.Bytes {
return append(common.Bytes("ls/a/"), addr[:]...)
}
// SplitRuleKeyPrefix returns the prefix for the split rule key
func SplitRuleKeyPrefix() common.Bytes {
return common.Bytes("ls/ssc/split/") // special smart contract / split rule
}
// SplitRuleKey constructs the state key for the given resourceID
func SplitRuleKey(resourceID string) common.Bytes {
resourceIDBytes := common.Bytes(resourceID)
return append(SplitRuleKeyPrefix(), resourceIDBytes[:]...)
}
// CodeKey constructs the state key for the given code hash
func CodeKey(codeHash common.Bytes) common.Bytes {
return append(common.Bytes("ls/ch/"), codeHash...)
}
// ValidatorCandidatePoolKey returns the state key for the validator stake holder set
func ValidatorCandidatePoolKey() common.Bytes {
return common.Bytes("ls/vcp")
}
// SentryCandidatePoolKey returns the state key for the guadian stake holder set
func SentryCandidatePoolKey() common.Bytes {
return common.Bytes("ls/gcp")
}
// StakeTransactionHeightListKey returns the state key the heights of blocks
// that contain stake related transactions (i.e. StakeDeposit, StakeWithdraw, etc)
func StakeTransactionHeightListKey() common.Bytes {
return common.Bytes("ls/sthl")
}
// StatePruningProgressKey returns the key for the state pruning progress
func StatePruningProgressKey() common.Bytes {
return common.Bytes("ls/spp")
}