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

Commit 17b8c8b

Browse files
Revert ACL-based changes to process flows (#336)
1 parent 135561d commit 17b8c8b

37 files changed

Lines changed: 1325 additions & 2582 deletions

.github/workflows/check-and-test.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ concurrency:
1212
jobs:
1313
get-version:
1414
name: Get version
15-
runs-on: ubuntu-latest
15+
runs-on: sqnc-node-builder
1616
outputs:
1717
toolchain: ${{ steps.get_toolchain.outputs.TOOLCHAIN }}
1818
steps:
@@ -33,7 +33,7 @@ jobs:
3333
3434
check-weights-have-changes:
3535
name: Check Weights
36-
runs-on: ubuntu-latest
36+
runs-on: sqnc-node-builder
3737
permissions:
3838
issues: write
3939
pull-requests: write
@@ -82,7 +82,7 @@ jobs:
8282
8383
check:
8484
name: Check and test
85-
runs-on: ubuntu-latest
85+
runs-on: sqnc-node-builder
8686
needs: [get-version]
8787

8888
steps:
@@ -135,17 +135,17 @@ jobs:
135135
env:
136136
RUSTC_WRAPPER: ${{ runner.temp }}/sccache
137137
SCCACHE_DIR: ${{ runner.temp }}/cache
138-
SCCACHE_CACHE_SIZE: "1G"
138+
SCCACHE_CACHE_SIZE: "2G"
139139
run: cargo fmt --check
140140
- name: Cargo check
141141
env:
142142
RUSTC_WRAPPER: ${{ runner.temp }}/sccache
143143
SCCACHE_DIR: ${{ runner.temp }}/cache
144-
SCCACHE_CACHE_SIZE: "1G"
144+
SCCACHE_CACHE_SIZE: "2G"
145145
run: cargo check
146146
- name: Cargo test
147147
env:
148148
RUSTC_WRAPPER: ${{ runner.temp }}/sccache
149149
SCCACHE_DIR: ${{ runner.temp }}/cache
150-
SCCACHE_CACHE_SIZE: "1G"
150+
SCCACHE_CACHE_SIZE: "2G"
151151
run: cargo test

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
# Gets the build version and information about if this is a new version
2222
get-version:
2323
name: Get version
24-
runs-on: ubuntu-latest
24+
runs-on: sqnc-node-builder
2525
outputs:
2626
is_new_version: ${{ steps.get_version.outputs.IS_NEW_VERSION }}
2727
version: ${{ steps.get_version.outputs.VERSION }}
@@ -48,7 +48,7 @@ jobs:
4848
# Github releases are only performed when the release version changes
4949
build-binary:
5050
name: Build binary
51-
runs-on: ubuntu-latest
51+
runs-on: sqnc-node-builder
5252
needs: [get-version]
5353
if: ${{ needs.get-version.outputs.is_new_version == 'true' || needs.get-version.outputs.is_prerelease == 'true'}}
5454
strategy:
@@ -128,7 +128,7 @@ jobs:
128128
129129
build-release:
130130
name: Build release
131-
runs-on: ubuntu-latest
131+
runs-on: sqnc-node-builder
132132
needs: [get-version, build-binary]
133133
if: ${{ needs.get-version.outputs.is_new_version == 'true' || needs.get-version.outputs.is_prerelease == 'true'}}
134134

@@ -207,7 +207,7 @@ jobs:
207207
# Docker build are always performed but are only version tagged on new version
208208
build-docker:
209209
name: Build Docker
210-
runs-on: ubuntu-latest
210+
runs-on: sqnc-node-builder
211211
needs: [get-version, build-release]
212212
steps:
213213
- uses: actions/checkout@v5

Cargo.lock

Lines changed: 12 additions & 14 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 = "13.0.0"
7+
version = "14.0.0"
88

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

README.md

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -124,19 +124,8 @@ Tokens can be minted/burnt by calling the following extrinsic under `UtxoNFT`:
124124
pub fn run_process(
125125
origin: OriginFor<T>,
126126
process: ProcessId<T>,
127-
inputs: BoundedVec<Input<T::TokenId>, T::MaxInputCount>,
128-
outputs: BoundedVec<Output<T>, T::MaxOutputCount>,
129-
) -> DispatchResultWithPostInfo { ... }
130-
```
131-
132-
For processes that must be run as the system privilege (root) there is also:
133-
134-
```rust
135-
pub fn run_process_as_root(
136-
origin: OriginFor<T>,
137-
process: ProcessId<T>,
138-
inputs: BoundedVec<Input<T::TokenId>, T::MaxInputCount>,
139-
outputs: BoundedVec<Output<T>, T::MaxOutputCount>,
127+
inputs: BoundedVec<T::TokenId, T::MaxInputCount>,
128+
outputs: BoundedVec<Output<T>, T::MaxOutputCount>
140129
) -> DispatchResultWithPostInfo { ... }
141130
```
142131

@@ -167,7 +156,6 @@ Pallet for defining process restrictions. Intended for use with `pallet-utxo-nft
167156
pub fn create_process(
168157
origin: OriginFor<T>,
169158
id: T::ProcessIdentifier,
170-
version: T::ProcessVersion,
171159
program: BoundedVec<
172160
BooleanExpressionSymbol<
173161
T::RoleKey,
@@ -242,20 +230,25 @@ A complete truth table set of binary operators is available when writing a proce
242230

243231
The pallet defines various type of process restrictions that can be applied to a process. These include:
244232

245-
| Restriction | description |
246-
| :-------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
247-
| `None` | Default `Restriction` value that always succeeds |
248-
| `Fail` | `Restriction` value that always fails |
249-
| `SenderIsRoot` | Specifies that the caller of the transaction must be the system (root) |
250-
| `SenderHasArgRole` | Requires that the process `sender` is assigned to a specified role on a specified (by index) input, reference or output token |
251-
| `ArgHasRole` | Requires that a specified (by index) input, reference or output token has a role |
252-
| `ArgHasMetadata` | Requires that a specified (by index) input, reference or output token has a metadata item with a given key |
253-
| `MatchArgsRole` | Requires that the account of a specified role on a specified (by index) input, reference or output token matches the account of a specified role on a specified (by index) input, reference or output token |
254-
| `MatchArgsMetadataValue` | Requires that the metadata value of a specified key on a specified (by index) input, reference or output token matches the metadata value of a specified key on a specified (by index) input, reference or output token |
255-
| `MatchArgIdToMetadataValue` | Requires that the metadata value of a specified key on a specified (by index) input, reference or output token matches the id of a specified (by index) input, reference or output token |
256-
| `FixedArgCount` | Requires that the number of input, reference or output tokens must be a specified integer |
257-
| `FixedArgMetadataValue` | Requires that a metadata item of a specified key must have a specified value, on a specified (by index) input, reference or output token |
258-
| `FixedArgMetadataValueType` | Requires that a metadata item of a specified key must have a value of a specified type, on a specified (by index) input, reference or output token |
233+
| Restriction | description |
234+
| :-------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
235+
| `None` | Default `Restriction` value that always succeeds |
236+
| `Fail` | `Restriction` value that always fails |
237+
| `Combined` | Requires two specified restrictions combined via a specified operator [`AND`, `OR`, `XOR`, `NAND`, `NOR`] returns `true` |
238+
| `SenderHasInputRole` | Requires that the process `sender` is assigned to a specified role on a specified (by index) input token |
239+
| `SenderHasOutputRole` | Requires that the process `sender` is assigned to a specified role on a specified (by index) output token |
240+
| `OutputHasRole` | Requires that a specified (by index) output token has a role |
241+
| `OutputHasMetadata` | Requires that a specified (by index) output token has a metadata item with a given key |
242+
| `InputHasRole` | Requires that a specified (by index) input token has a role |
243+
| `InputHasMetadata` | Requires that a specified (by index) input token has a metadata item with a given key |
244+
| `MatchInputOutputRole` | Requires that the account of a specified role on a specified (by index) output token matches the account of a specified role on a specified (by index) input token |
245+
| `MatchInputOutputMetadataValue` | Requires that the metadata value of a specified key on a specified (by index) output token matches the metadata value of a specified key on a specified (by index) input token |
246+
| `MatchInputIdOutputMetadataValue` | Requires that the metadata value of a specified key on a specified (by index) output token matches the id of a specified (by index) input token |
247+
| `FixedNumberOfInputs` | Requires that the number of inputs must be a specified integer |
248+
| `FixedNumberOfOutputs` | Requires that the number of outputs must be a specified integer |
249+
| `FixedInputMetadataValue` | Requires that a metadata item of a specified key must have a specified value, on a specified (by index) input token |
250+
| `FixedOutputMetadataValue` | Requires that a metadata item of a specified key must have a specified value, on a specified (by index) output token |
251+
| `FixedOutputMetadataValueType` | Requires that a metadata item of a specified key must have a value of a specified type, on a specified (by index) output token |
259252

260253
### IPFSKey pallet
261254

Upgrade.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,13 @@ First attempt to build each of the pallets.
5454
```bash
5555
cargo build --release \
5656
-p pallet-doas \
57+
-p pallet-organisation-data \
5758
-p pallet-process-validation \
5859
-p pallet-symmetric-key \
5960
-p sqnc-pallet-traits \
6061
-p pallet-transaction-payment-free \
61-
-p pallet-utxo-nft
62+
-p pallet-utxo-nft \
63+
-p pallet-validator-set
6264
```
6365

6466
Pallets can also be built one at a time e.g. `cargo build --release -p pallet-doas`.

pallets/process-validation/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ parity-scale-codec = { workspace = true, features = ["derive"] }
1717
frame-support = { workspace = true }
1818
frame-system = { workspace = true }
1919
frame-benchmarking = { workspace = true, optional = true }
20-
log = { workspace = true }
2120
sp-runtime = { workspace = true, features = ["serde"] }
2221
sp-io = { workspace = true }
2322
sp-std = { workspace = true }

pallets/process-validation/src/benchmarking.rs

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,11 @@ type ProcessFullyQualifiedId<T> =
2727
sqnc_pallet_traits::ProcessFullyQualifiedId<<T as Config>::ProcessIdentifier, <T as Config>::ProcessVersion>;
2828

2929
fn prepare_program<T: Config>(l: u32) -> BoundedVec<BooleanExpressionSymbol<T>, T::MaxProcessProgramLength> {
30-
let metadata_restriction = Restriction::MatchArgsMetadataValue {
31-
left_arg_type: ArgType::Input,
32-
left_index: 0u32,
33-
left_metadata_key: Default::default(),
34-
right_arg_type: ArgType::Input,
35-
right_index: 0u32,
36-
right_metadata_key: Default::default(),
30+
let metadata_restriction = Restriction::MatchInputOutputMetadataValue {
31+
input_index: 0u32,
32+
input_metadata_key: Default::default(),
33+
output_index: 0u32,
34+
output_metadata_key: Default::default(),
3735
};
3836

3937
let mut program = BoundedVec::<_, _>::with_bounded_capacity(T::MaxProcessProgramLength::get() as usize);
@@ -92,45 +90,60 @@ benchmarks! {
9290
validate_process {
9391
let r in 1 .. (1 + T::MaxProcessProgramLength::get() / 2);
9492

95-
let origin: RawOrigin<T::AccountId> = RawOrigin::Signed(account("owner", 0, 0));
93+
let account_id: T::AccountId = account("owner", 0, 0);
9694
let program = prepare_program::<T>(r);
9795
let process = create_process_fixture::<T>(&program);
9896

99-
let args = vec![ProcessIO::<T> {
97+
let inputs = vec![ProcessIO::<T> {
98+
id: Default::default(),
99+
roles: BTreeMap::new(),
100+
metadata: BTreeMap::from_iter(vec![(Default::default(), Default::default())])
101+
}; 10];
102+
let outputs = vec![ProcessIO::<T> {
100103
id: Default::default(),
101104
roles: BTreeMap::new(),
102105
metadata: BTreeMap::from_iter(vec![(Default::default(), Default::default())])
103106
}; 10];
104107
}: {
105-
let _ = ProcessValidation::<T>::validate_process(&process, &origin, &args, &args, &args);
108+
let _ = ProcessValidation::<T>::validate_process(&process, &account_id, &inputs, &outputs);
106109
}
107110

108111
validate_process_min {
109-
let origin: RawOrigin<T::AccountId> = RawOrigin::Signed(account("owner", 0, 0));
112+
let account_id: T::AccountId = account("owner", 0, 0);
110113
let program = prepare_program::<T>(1);
111114
let process = create_process_fixture::<T>(&program);
112115

113-
let args = vec![ProcessIO::<T> {
116+
let inputs = vec![ProcessIO::<T> {
117+
id: Default::default(),
118+
roles: BTreeMap::new(),
119+
metadata: BTreeMap::from_iter(vec![(Default::default(), Default::default())])
120+
}; 10];
121+
let outputs = vec![ProcessIO::<T> {
114122
id: Default::default(),
115123
roles: BTreeMap::new(),
116124
metadata: BTreeMap::from_iter(vec![(Default::default(), Default::default())])
117125
}; 10];
118126
}: {
119-
let _ = ProcessValidation::<T>::validate_process(&process, &origin, &args, &args, &args);
127+
let _ = ProcessValidation::<T>::validate_process(&process, &account_id, &inputs, &outputs);
120128
}
121129

122130
validate_process_max {
123-
let origin: RawOrigin<T::AccountId> = RawOrigin::Signed(account("owner", 0, 0));
131+
let account_id: T::AccountId = account("owner", 0, 0);
124132
let program = prepare_program::<T>(1 + T::MaxProcessProgramLength::get() / 2);
125133
let process = create_process_fixture::<T>(&program);
126134

127-
let args = vec![ProcessIO::<T> {
135+
let inputs = vec![ProcessIO::<T> {
136+
id: Default::default(),
137+
roles: BTreeMap::new(),
138+
metadata: BTreeMap::from_iter(vec![(Default::default(), Default::default())])
139+
}; 10];
140+
let outputs = vec![ProcessIO::<T> {
128141
id: Default::default(),
129142
roles: BTreeMap::new(),
130143
metadata: BTreeMap::from_iter(vec![(Default::default(), Default::default())])
131144
}; 10];
132145
}: {
133-
let _ = ProcessValidation::<T>::validate_process(&process, &origin, &args, &args, &args);
146+
let _ = ProcessValidation::<T>::validate_process(&process, &account_id, &inputs, &outputs);
134147
}
135148
}
136149

0 commit comments

Comments
 (0)