Skip to content

Commit af5d85c

Browse files
authored
Refactor A8 AssertionNetworks to enum (#1534)
* refactor A8 AssertionNetworks to enum * a small fix * add comment
1 parent 02dcf41 commit af5d85c

File tree

11 files changed

+240
-282
lines changed

11 files changed

+240
-282
lines changed

primitives/core/src/assertion.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,17 @@ use sp_runtime::{traits::ConstU32, BoundedVec};
2424

2525
type MaxStringLength = ConstU32<64>;
2626
pub type ParameterString = BoundedVec<u8, MaxStringLength>;
27-
pub type Network = BoundedVec<u8, MaxStringLength>;
28-
pub type AssertionNetworks = BoundedVec<Network, MaxStringLength>;
27+
pub type IndexingNetworks = BoundedVec<IndexingNetwork, MaxStringLength>;
28+
29+
#[derive(Encode, Decode, Clone, Debug, PartialEq, Eq, TypeInfo, MaxEncodedLen)]
30+
pub enum IndexingNetwork {
31+
Litentry,
32+
Litmus,
33+
Polkadot,
34+
Kusama,
35+
Khala,
36+
Ethereum,
37+
}
2938

3039
#[rustfmt::skip]
3140
#[derive(Encode, Decode, Clone, Debug, PartialEq, Eq, TypeInfo, MaxEncodedLen)]
@@ -37,16 +46,13 @@ pub enum Assertion {
3746
A5(ParameterString, ParameterString), // (twitter_account, tweet_id)
3847
A6,
3948
A7(Balance), // (minimum_amount)
40-
A8(AssertionNetworks), // litentry, litmus, polkadot, kusama, khala, ethereum
49+
A8(IndexingNetworks), // litentry, litmus, polkadot, kusama, khala, ethereum
4150
A9,
4251
A10(Balance), // (minimum_amount)
4352
A11(Balance), // (minimum_amount)
4453
A13(u32), // (Karma_amount) - TODO: unsupported
4554
}
4655

47-
pub const ASSERTION_NETWORKS: [&str; 6] =
48-
["litentry", "litmus", "polkadot", "kusama", "khala", "ethereum"];
49-
5056
pub const ASSERTION_FROM_DATE: [&str; 7] = [
5157
"2017-01-01",
5258
"2018-01-01",

tee-worker/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tee-worker/enclave-runtime/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tee-worker/litentry/core/assertion-build/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ url_sgx = { package = "url", git = "https://github.com/mesalock-linux/rust-url-s
2626

2727
# no_std dependencies
2828
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
29-
lazy_static = { version = "1.1.0", features = ["spin_no_std"] }
3029
log = { version = "0.4", default-features = false }
3130
serde = { version = "1.0", default-features = false, features = ["derive", "alloc"] }
3231
serde_json = { version = "1.0", default-features = false, features = ["alloc"] }

0 commit comments

Comments
 (0)