Skip to content
This repository was archived by the owner on Jul 17, 2026. It is now read-only.

Commit cc9cecb

Browse files
Organisation data pallet (#269)
* Organisation data pallet Introduces a new pallet for setting organisation scoped data blobs. * Fix comments * Fix indentation * Fix indentation * Update readme * Update lock * Version bump
1 parent a10b13f commit cc9cecb

17 files changed

Lines changed: 810 additions & 24 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ weights/*.rs
1010
*.iml
1111
.idea
1212
.vscode
13+
data

Cargo.lock

Lines changed: 33 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ resolver = "2"
44

55
[workspace.package]
66
edition = "2021"
7-
version = "12.4.0"
7+
version = "12.5.0"
88

99
[workspace.dependencies]
1010
##############################

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,31 @@ pub(super) fn doas_root_unchecked_weight(origin: OriginFor<T>, call: Box<<T as C
293293
pub(super) fn doas(origin: OriginFor<T>, who: <T::Lookup as StaticLookup>::Source, call: Box<<T as Config>::Call>) -> DispatchResultWithPostInfo { ... }
294294
```
295295

296-
### CUstom RPCs
296+
### OrganisationData pallet
297+
298+
The `OrganisationData` pallet allows for storing key/value pairs for members of the chain. This is initially for storing endpoints needed to fetch files from a given member. Values here can either be short 32 byte literals or stored as blob preimages via a hash reference.
299+
300+
The pallet exposes one extrinsic:
301+
302+
```rust
303+
pub(super) fn set_value(origin: OriginFor<T>, key: T::OrgDataKey, value: T::OrgDataValue) -> DispatchResult { ... }
304+
```
305+
306+
Where `T::OrgDataKey` and `T::OrgDataValue` are set as:
307+
308+
```rust
309+
pub enum OrgDataKey {
310+
AttachmentEndpoint,
311+
OidcConfigurationEndpoint,
312+
}
313+
314+
pub enum OrgDataValue {
315+
Literal(BoundedVec<u8, ConstU32<32>>),
316+
Preimage(Hash),
317+
}
318+
```
319+
320+
### Custom RPCs
297321

298322
`sqnc-node` exposes the following custom rpcs:
299323

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[package]
2+
name = 'pallet-organisation-data'
3+
authors = ['Digital Catapult <https://www.digicatapult.org.uk>']
4+
description = 'Pallet for managing member organisation data'
5+
edition = '2021'
6+
license = 'Apache-2.0'
7+
repository = 'https://github.com/digicatapult/sqnc-node/'
8+
version = { workspace = true }
9+
10+
[dependencies]
11+
sp-core = { workspace = true }
12+
sp-io = { workspace = true }
13+
sp-runtime = { workspace = true }
14+
sp-std = { workspace = true }
15+
sp-staking = { workspace = true }
16+
frame-benchmarking = { workspace = true, optional = true }
17+
frame-support = { workspace = true }
18+
frame-system = { workspace = true }
19+
sp-weights = { workspace = true }
20+
scale-info = { workspace = true, features = ['derive', 'serde'] }
21+
log = { workspace = true }
22+
parity-scale-codec = { workspace = true, features = ["derive"] }
23+
pallet-membership = { workspace = true }
24+
25+
[dev-dependencies]
26+
sp-state-machine = { workspace = true }
27+
serde = { workspace = true, features = ['derive'] }
28+
29+
[features]
30+
default = ['std']
31+
runtime-benchmarks = ['frame-benchmarking/runtime-benchmarks']
32+
std = [
33+
'parity-scale-codec/std',
34+
'frame-benchmarking/std',
35+
'frame-support/std',
36+
'frame-system/std',
37+
'scale-info/std',
38+
'sp-core/std',
39+
'sp-io/std',
40+
'sp-std/std',
41+
'sp-runtime/std',
42+
'pallet-membership/std',
43+
]
44+
try-runtime = ['frame-support/try-runtime']
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#![cfg(feature = "runtime-benchmarks")]
2+
3+
use super::*;
4+
use frame_benchmarking::v1::{account, benchmarks};
5+
use frame_system::RawOrigin;
6+
7+
const SEED: u32 = 0;
8+
9+
benchmarks! {
10+
set_value {
11+
let caller: T::AccountId = account("owner", 0, SEED);
12+
<OrgDataCount<T>>::set(caller.clone(), 0);
13+
14+
let key: T::OrgDataKey = Default::default();
15+
let value: T::OrgDataValue = Default::default();
16+
}: _(RawOrigin::Signed(caller), key, value)
17+
18+
impl_benchmark_test_suite!(
19+
OrganisationData,
20+
crate::mock::new_test_ext(),
21+
crate::mock::Test,
22+
);
23+
}

0 commit comments

Comments
 (0)