Skip to content

Commit 3db93d7

Browse files
authored
0.7.5 pre (#269)
* readme: update tee-worker readme * fix: div zero bug * feat: challenge starts in 3 days * update cess-testnet chain spec
1 parent 6ede050 commit 3db93d7

File tree

5 files changed

+85
-16
lines changed

5 files changed

+85
-16
lines changed

c-pallets/audit/src/lib.rs

+8
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,11 @@ pub mod pallet {
933933
fn generate_challenge(now: BlockNumberOf<T>) -> Weight {
934934
let mut weight: Weight = Weight::zero();
935935

936+
let one_day = T::OneDay::get();
937+
if now < one_day.saturating_mul(3u32.saturated_into()) {
938+
return weight;
939+
}
940+
936941
weight = weight.saturating_add(T::DbWeight::get().reads(1));
937942
let miner_list = match T::MinerControl::get_all_miner() {
938943
Ok(miner_list) => miner_list,
@@ -1002,6 +1007,9 @@ pub mod pallet {
10021007
let one_hour = T::OneHours::get();
10031008
weight = weight.saturating_add(T::DbWeight::get().reads(1));
10041009
let tee_length = T::TeeWorkerHandler::get_controller_list().len();
1010+
if tee_length == 0 {
1011+
return weight;
1012+
}
10051013
let verify_life: u32 = (idle_space
10061014
.saturating_add(service_space)
10071015
.saturating_div(IDLE_VERIFY_RATE)

c-pallets/cess-treasury/src/README.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Cess Treasury Module
2+
3+
Manage meta information of cess-treasury.
4+
5+
## Terminology
6+
7+
## Extrinsic
8+
9+
10+
## Interface
11+
12+
### TeeWorkerHandler
13+
14+
15+
#### Usage
16+
17+
18+
## Implementation Details
19+
20+
###

c-pallets/tee-worker/README.md

+50-11
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,61 @@
1-
# File Map Module
1+
# Tee Worker Module
22

3-
Store scheduling related information
3+
Manage meta information of tee-worker.
44

5-
### Terminology
5+
## Terminology
66

7-
* **Ip:** Scheduled IP address.
7+
* **EndPoint:** The ip+port of tee-worker, or the domain name of tee-worker. Selected independently by tee-workers.
8+
* **StashAccount:** Staking account when bond a consensus node.
9+
* **ControllerAccount:** The control account bound when registering the consensus node, used for work transaction signatures.
10+
* **Podr2Pbk:** The only public key shared between tee-workers in the entire network.
11+
* **SgxAttestationReport:** The SGX report certificate applied for tee-worker certification is provided by Inter.
812

13+
## Extrinsic
14+
* `register()` - The extrinsic used for tee-worker registration requires bond to become a consensus before registration. The report will be verified in Extrinsic to confirm that the registrant is a legitimate sgx.
15+
* `update_whitelist()` - Used to support iterative updates of sgx. When the internal code of sgx is updated, the new identification code needs to be added to the whitelist.
16+
* `exit()` - Tee worker exit function, when the last tee worker exits, the only public key in the entire network will be cleared. However, this function will not affect the unbundling of consensus stashes.
17+
* `update_podr2_pk()` - Method to update root permissions of the only public key in the entire network.
18+
* `force_register()` - Forced registration of tee workers through root privileges will ignore a series of qualification certifications such as verification reports. After mainnet login, this method will be removed
919

1020
## Interface
11-
### Trait
12-
#### TeeWorkerHandler
21+
22+
### TeeWorkerHandler
1323

1424
A series of methods for finding consensus scheduling.
1525
* `contains_scheduler` - Judge whether the controller account exists.
16-
* `get_controller_acc` - Obtain controller account through stash account.
26+
* `get_controller_list` - Get the list of controller accounts of currently registered tee workers.
1727
* `get_first_controller` - Get the first consensus in the list.
18-
### Dispatchable Functions
28+
* `get_tee_publickey` - Get the network-wide unique public key of the tee worker to verify the signature of sgx.
29+
* `punish_scheduler` - Punish tee workers and deduct credibility points.
30+
31+
#### Usage
32+
in pallet::Config
33+
```rust
34+
pub trait Config:
35+
frame_system::Config + sp_std::fmt::Debug
36+
{
37+
//...
38+
type TeeWorkerHandler: TeeWorkerHandler<Self::AccountId>;
39+
//...
40+
}
41+
```
42+
in runtime.rs
43+
```rust
44+
impl pallet_audit::Config for Runtime {
45+
//...
46+
type TeeWorkerHandler = TeeWorker;
47+
//...
48+
}
49+
```
50+
51+
## Implementation Details
52+
53+
### Verify SGX report
54+
Use the `verify_miner_cert` method to verify sgx reports. The method uses the third-party library webpki internally to verify the sgx report. At the same time, it will also check whether the custom information of tee worker in the report is legal.
55+
56+
Custom information includes the following:
57+
* `sign` - the certificate signature.
58+
* `cert_der` - certificate.
59+
* `report_json_raw` - the json format string of the report.
60+
* `identity_hash` - some basic registration information of tee worker, which is composed of peer_id, podr2_pbk, end_point, and finally the hash value calculated by sha2_256 algorithm.
1961

20-
* `registration_scheduler` - The interface for scheduling registration has no special restrictions at present.
21-
* `update_scheduler` - Consensus Method for Updating IP Endpoints.
22-
* `init_public_key` - Initialize the public key related to the certificate.

node/ccg/cess-testnet-spec-raw.json

+5-3
Large diffs are not rendered by default.

runtime/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
168168
// `spec_version`, and `authoring_version` are the same between Wasm and native.
169169
// This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use
170170
// the compatible custom types.
171-
spec_version: 107,
171+
spec_version: 100,
172172
impl_version: 1,
173173
apis: RUNTIME_API_VERSIONS,
174174
transaction_version: 1,
@@ -626,7 +626,7 @@ parameter_types! {
626626
pub const ProposalBondMinimum: Balance = 1 * DOLLARS;
627627
// For TESTING
628628
pub const SpendPeriod: BlockNumber = 1 * MINUTES;
629-
pub const Burn: Permill = Permill::from_percent(50);
629+
pub const Burn: Permill = Permill::from_percent(0);
630630
pub const TipCountdown: BlockNumber = 1 * DAYS;
631631
pub const TipFindersFee: Percent = Percent::from_percent(20);
632632
pub const TipReportDepositBase: Balance = 1 * DOLLARS;

0 commit comments

Comments
 (0)