-
Notifications
You must be signed in to change notification settings - Fork 39
/
metadata.sol
74 lines (58 loc) · 1.81 KB
/
metadata.sol
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
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0;
// **Notice**
// The solidity contract only define the interface of metadata contract. The real
// implementation is in `core/executor/src/system_contract/metadata`.
contract MetadataManager {
uint64 constant U64_MAX = 2 ** 64 - 1;
struct MetadataVersion {
uint64 start;
uint64 end;
}
struct ValidatorExtend {
bytes bls_pub_key;
bytes pub_key;
address address_;
uint32 propose_weight;
uint32 vote_weight;
}
struct Metadata {
MetadataVersion version;
uint64 epoch;
ValidatorExtend[] verifier_list;
ProposeCount[] propose_counter;
ConsensusConfig consensus_config;
}
struct ProposeCount {
address address_;
uint64 count;
}
struct ConsensusConfig {
uint64 propose_ratio;
uint64 prevote_ratio;
uint64 precommit_ratio;
uint64 brake_ratio;
uint64 tx_num_limit;
uint64 max_tx_size;
uint64 gas_limit;
uint64 gas_price;
uint64 interval;
}
struct CkbRelatedInfo {
bytes32 metadata_type_id;
bytes32 checkpoint_type_id;
bytes32 xudt_args;
bytes32 stake_smt_type_id;
bytes32 delegate_smt_type_id;
bytes32 reward_smt_type_id;
}
// to store all metadata with epoch as key
mapping(uint64 => Metadata) metadata_set;
// to identify current highest epoch number
uint64 highest_epoch;
function construct() public {}
function appendMetadata(Metadata memory metadata) public {}
function updateConsensusConfig(ConsensusConfig memory config) public view {}
function getMetadata(uint64 epoch) public view returns (Metadata memory) {}
function setCkbRelatedInfo() public view {}
}