Skip to content

Commit 8df80f2

Browse files
wangminqioutofxxxKailai-WangDogLiBillyWooo
authored
update 996 (#1491)
* build_assertion error propagate to parachain (#1456) * AssertionBuildFail: add more details * handle errors in on_success method * emit event when vc is non-exists * remove event * remove VCNotExist from Event * Fix benchmarking pallet-teerex (#1460) * remove tee-dev from node default feature * only rococo has tee-dev * remove sccache in docker * missing RUN * update Dockerfile * sleep for 1 second before the event websocket reconnect(fix #1416) (#1462) * debug: Sync of Moonbeam upstream debug (#1450) * debug: change of test * debug: fix benchmark * Fix the panic from WeightInfo in CI (#1466) * update comment * update runner tag * minor update, cleanup history data * fix errors in teeracle * [benchmarking bot] Auto commit generated weights files (#1465) Co-authored-by: Kailai-Wang <[email protected]> * using pallet weights --------- Co-authored-by: BillyWooo <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Kailai-Wang <[email protected]> * build_assertion error case test (#1463) * error verify * batch call of identity * batch call of vc * format code * delete useless code * verify error identity * create error identities * delete useless code * delete useless code * add comment&delete useless code * format code * txs types * step error vc * catch dispatchError * revoke error test * requestVc error * change assert log * fix merge errors * add checkFailReason * check fail reason * move nonce out loop * format code * change test flow(only use A1 trigger error event) * format code * IDGraph adjustment (#1478) * only keep idgraph for verified event * add get_id_graph_with_max_len * add tee pallets unittests * adjust idgraph and prettier * use context.api for better naming * remove empty lines --------- Co-authored-by: Zhouhui Tian <[email protected]> Co-authored-by: Kai <[email protected]> Co-authored-by: Linfeng.Yuan <[email protected]> Co-authored-by: BillyWooo <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Kailai-Wang <[email protected]> Co-authored-by: Verin1005 <[email protected]>
1 parent 0a2446c commit 8df80f2

File tree

107 files changed

+3242
-3050
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+3242
-3050
lines changed

.github/workflows/benchmark-machine.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ env:
1616
jobs:
1717
## run the benchmarking remotely
1818
benchmark-machine:
19-
runs-on: self-hosted
19+
runs-on: dev-builder
2020
steps:
2121
- name: Checkout codes on ${{ github.ref }}
2222
uses: actions/checkout@v3

.github/workflows/benchmark-runtime-weights.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
## build docker image with runtime-benchmarks feature
4040
build-docker:
4141
if: ${{ github.event.inputs.rebuild-docker == 'true' }}
42-
runs-on: self-hosted
42+
runs-on: dev-builder
4343
steps:
4444
- name: Checkout codes on ${{ github.ref }}
4545
uses: actions/checkout@v3
@@ -60,7 +60,7 @@ jobs:
6060
6161
## run the benchmarking remotely
6262
benchmark:
63-
runs-on: self-hosted
63+
runs-on: dev-builder
6464
needs: build-docker
6565
# see https://github.com/actions/runner/issues/491
6666
if: |

.github/workflows/build-docker-with-args.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ env:
2727
jobs:
2828
## build docker image of client binary with args ##
2929
build-docker-with-args:
30-
runs-on: self-hosted
30+
runs-on: dev-builder
3131
steps:
3232
- name: Checkout codes on ${{ github.event.inputs.ref || github.ref }}
3333
uses: actions/checkout@v3

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,12 @@ jobs:
319319
320320
- run: docker images --all
321321

322+
- name: Pallet unittests
323+
working-directory: ./tee-worker
324+
run: |
325+
rustup show
326+
cargo test --locked --release -p pallet-* --lib
327+
322328
- name: Test enclave
323329
# cargo test is not supported in the enclave
324330
# see https://github.com/apache/incubator-teaclave-sgx-sdk/issues/232

.github/workflows/create-release-draft.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ jobs:
104104
## build docker image of client binary ##
105105
build-docker:
106106
if: ${{ github.event.inputs.release_client == 'true' }}
107-
runs-on: self-hosted
107+
runs-on: dev-builder
108108
steps:
109109
- name: Checkout codes on ${{ env.RELEASE_TAG }}
110110
uses: actions/checkout@v3

Makefile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ help:
2626

2727
# build release
2828

29-
.PHONY: build-all ## Build release version
29+
.PHONY: build-all ## Build release all with `tee-dev` feature
3030
build-all:
31-
cargo build --locked --release
31+
cargo build --locked --release --features=tee-dev
3232

33-
.PHONY: build-node ## Build release node with default features
33+
.PHONY: build-node ## Build release node with `tee-dev` feature
3434
build-node:
35-
cargo build --locked -p $(call pkgid, $(NODE_BIN)) --release
35+
cargo build --locked -p $(call pkgid, $(NODE_BIN)) --release --features=tee-dev
3636

3737
.PHONY: build-runtime-litentry ## Build litentry release runtime
3838
build-runtime-litentry:
@@ -59,16 +59,17 @@ srtool-build-wasm-rococo:
5959
@./scripts/build-wasm.sh rococo
6060

6161
.PHONY: build-docker-release ## Build docker image using cargo profile `release`
62+
# with `tee-dev` feature as we use release profile in dev
6263
build-docker-release:
63-
@./scripts/build-docker.sh release
64+
@./scripts/build-docker.sh release latest --features=tee-dev
6465

6566
.PHONY: build-docker-production ## Build docker image using cargo profile `production`
6667
build-docker-production:
6768
@./scripts/build-docker.sh production
6869

6970
.PHONY: build-node-benchmarks ## Build release node with `runtime-benchmarks` feature
7071
build-node-benchmarks:
71-
cargo build --locked --features runtime-benchmarks --release --no-default-features
72+
cargo build --locked --features runtime-benchmarks --release
7273

7374
.PHONY: build-node-tryruntime ## Build release node with `try-runtime` feature
7475
build-node-tryruntime:

docker/Dockerfile

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,10 @@ COPY . /litentry
1313

1414
RUN apt-get update && apt-get install -yq clang libclang-dev cmake protobuf-compiler
1515

16-
# install sccache, must before `ARG RUSTC_WRAPPER`
17-
# otherwise the wrapper is set but sccache is not installed
18-
RUN cargo install sccache
19-
2016
ARG BUILD_ARGS
2117
ARG PROFILE
22-
ARG RUSTC_WRAPPER
23-
24-
RUN type sccache && sccache --version
25-
ENV SCCACHE_CACHE_SIZE=10G
26-
ENV SCCACHE_DIR=/root/.cache/sccache
27-
ENV RUSTC_WRAPPER=$RUSTC_WRAPPER
2818

29-
# please note this only works for self-hosted runner (i.e. on the same host)
30-
# CI across different GH-runners won't work well, my understanding is docker only considers
31-
# image layers as "bulid cache", and mounted cache doesn't belong to it and therefore not
32-
# exported/imported with build-push-action
33-
#
34-
# see https://github.com/docker/build-push-action/issues/716
35-
# https://github.com/moby/buildkit/issues/1512
36-
# https://github.com/moby/buildkit/issues/1673
37-
RUN --mount=type=cache,target=/root/.cache/sccache cargo build --locked --profile $PROFILE $BUILD_ARGS && sccache --show-stats
19+
RUN cargo build --locked --profile $PROFILE $BUILD_ARGS
3820

3921
# ==========================
4022
# stage 2: packaging

node/Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,7 @@ rococo-parachain-runtime = { path = "../runtime/rococo" }
102102
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
103103

104104
[features]
105-
default = [
106-
"tee-dev",
107-
]
105+
default = []
108106
fast-runtime = [
109107
"litentry-parachain-runtime/fast-runtime",
110108
"litmus-parachain-runtime/fast-runtime",
@@ -127,6 +125,5 @@ try-runtime = [
127125
# allow workers to register without remote attestation for dev purposes
128126
# currently only available on litmus and rococo
129127
tee-dev = [
130-
"litmus-parachain-runtime/tee-dev",
131128
"rococo-parachain-runtime/tee-dev",
132129
]

pallets/identity-management/src/lib.rs

Lines changed: 15 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -71,59 +71,26 @@ pub mod pallet {
7171
#[pallet::event]
7272
#[pallet::generate_deposit(pub(super) fn deposit_event)]
7373
pub enum Event<T: Config> {
74-
DelegateeAdded {
75-
account: T::AccountId,
76-
},
77-
DelegateeRemoved {
78-
account: T::AccountId,
79-
},
74+
DelegateeAdded { account: T::AccountId },
75+
DelegateeRemoved { account: T::AccountId },
8076
// TODO: do we need account as event parameter? This needs to be decided by F/E
81-
CreateIdentityRequested {
82-
shard: ShardIdentifier,
83-
},
84-
RemoveIdentityRequested {
85-
shard: ShardIdentifier,
86-
},
87-
VerifyIdentityRequested {
88-
shard: ShardIdentifier,
89-
},
90-
SetUserShieldingKeyRequested {
91-
shard: ShardIdentifier,
92-
},
77+
CreateIdentityRequested { shard: ShardIdentifier },
78+
RemoveIdentityRequested { shard: ShardIdentifier },
79+
VerifyIdentityRequested { shard: ShardIdentifier },
80+
SetUserShieldingKeyRequested { shard: ShardIdentifier },
9381
// event that should be triggered by TEECallOrigin
9482
// these events keep the `account` as public to be consistent with VCMP and better
9583
// indexing see https://github.com/litentry/litentry-parachain/issues/1313
96-
UserShieldingKeySet {
97-
account: T::AccountId,
98-
},
99-
IdentityCreated {
100-
account: T::AccountId,
101-
identity: AesOutput,
102-
code: AesOutput,
103-
id_graph: AesOutput,
104-
},
105-
IdentityRemoved {
106-
account: T::AccountId,
107-
identity: AesOutput,
108-
id_graph: AesOutput,
109-
},
110-
IdentityVerified {
111-
account: T::AccountId,
112-
identity: AesOutput,
113-
id_graph: AesOutput,
114-
},
84+
UserShieldingKeySet { account: T::AccountId },
85+
IdentityCreated { account: T::AccountId, identity: AesOutput, code: AesOutput },
86+
IdentityRemoved { account: T::AccountId, identity: AesOutput },
87+
IdentityVerified { account: T::AccountId, identity: AesOutput, id_graph: AesOutput },
11588
// event errors caused by processing in TEE
11689
// copied from core_primitives::IMPError, we use events instead of pallet::errors,
11790
// see https://github.com/litentry/litentry-parachain/issues/1275
118-
DecodeHexFailed {
119-
reason: ErrorString,
120-
},
121-
HttpRequestFailed {
122-
reason: ErrorString,
123-
},
124-
StfError {
125-
reason: ErrorString,
126-
},
91+
DecodeHexFailed { reason: ErrorString },
92+
HttpRequestFailed { reason: ErrorString },
93+
StfError { reason: ErrorString },
12794
CreateIdentityHandlingFailed,
12895
RemoveIdentityHandlingFailed,
12996
VerifyIdentityHandlingFailed,
@@ -262,10 +229,9 @@ pub mod pallet {
262229
account: T::AccountId,
263230
identity: AesOutput,
264231
code: AesOutput,
265-
id_graph: AesOutput,
266232
) -> DispatchResultWithPostInfo {
267233
let _ = T::TEECallOrigin::ensure_origin(origin)?;
268-
Self::deposit_event(Event::IdentityCreated { account, identity, code, id_graph });
234+
Self::deposit_event(Event::IdentityCreated { account, identity, code });
269235
Ok(Pays::No.into())
270236
}
271237

@@ -275,10 +241,9 @@ pub mod pallet {
275241
origin: OriginFor<T>,
276242
account: T::AccountId,
277243
identity: AesOutput,
278-
id_graph: AesOutput,
279244
) -> DispatchResultWithPostInfo {
280245
let _ = T::TEECallOrigin::ensure_origin(origin)?;
281-
Self::deposit_event(Event::IdentityRemoved { account, identity, id_graph });
246+
Self::deposit_event(Event::IdentityRemoved { account, identity });
282247
Ok(Pays::No.into())
283248
}
284249

pallets/parachain-staking/src/benchmarking.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,9 @@ benchmarks! {
234234

235235
set_total_selected {
236236
Pallet::<T>::set_blocks_per_round(RawOrigin::Root.into(), 100u32)?;
237-
}: _(RawOrigin::Root, 100u32)
237+
}: _(RawOrigin::Root, 99u32)
238238
verify {
239-
assert_eq!(Pallet::<T>::total_selected(), 100u32);
239+
assert_eq!(Pallet::<T>::total_selected(), 99u32);
240240
}
241241

242242
set_collator_commission {
@@ -800,7 +800,7 @@ benchmarks! {
800800
// To set total selected to 40, must first increase round length to at least 40
801801
// to avoid hitting RoundLengthMustBeAtLeastTotalSelectedCollators
802802
Pallet::<T>::set_blocks_per_round(RawOrigin::Root.into(), 100u32)?;
803-
Pallet::<T>::set_total_selected(RawOrigin::Root.into(), 100u32)?;
803+
Pallet::<T>::set_total_selected(RawOrigin::Root.into(), 99u32)?;
804804
// INITIALIZE COLLATOR STATE
805805
let mut collators: Vec<T::AccountId> = Vec::new();
806806
let mut collator_count = 1u32;

0 commit comments

Comments
 (0)