commit_verify/
stl.rs

1// Client-side-validation foundation libraries.
2//
3// SPDX-License-Identifier: Apache-2.0
4//
5// Designed in 2019-2025 by Dr Maxim Orlovsky <orlovsky@lnp-bp.org>
6// Written in 2024-2025 by Dr Maxim Orlovsky <orlovsky@lnp-bp.org>
7//
8// Copyright (C) 2019-2024 LNP/BP Standards Association, Switzerland.
9// Copyright (C) 2024-2025 LNP/BP Laboratories,
10//                         Institute for Distributed and Cognitive Systems
11// (InDCS), Switzerland. Copyright (C) 2019-2025 Dr Maxim Orlovsky.
12// All rights under the above copyrights are reserved.
13//
14// Licensed under the Apache License, Version 2.0 (the "License"); you may not
15// use this file except in compliance with the License. You may obtain a copy of
16// the License at
17//
18//        http://www.apache.org/licenses/LICENSE-2.0
19//
20// Unless required by applicable law or agreed to in writing, software
21// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
22// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
23// License for the specific language governing permissions and limitations under
24// the License.
25
26//! CommitVerify strict type library.
27
28use strict_types::{CompileError, LibBuilder, TypeLib};
29
30use crate::{mpc, MerkleHash, MerkleNode, ReservedBytes, StrictHash, LIB_NAME_COMMIT_VERIFY};
31
32/// Strict type library ID for the CommitVerify types.
33pub const LIB_ID_COMMIT_VERIFY: &str =
34    "stl:wH1wmGy2-0vBNWxL-MK~_eQb-Ayskv~e-oFmDrzI-O_IW_P0#biology-news-adam";
35
36#[allow(clippy::result_large_err)]
37fn _commit_verify_stl() -> Result<TypeLib, CompileError> {
38    LibBuilder::with(libname!(LIB_NAME_COMMIT_VERIFY), [
39        strict_types::stl::std_stl().to_dependency_types()
40    ])
41    .transpile::<ReservedBytes<1>>()
42    .transpile::<ReservedBytes<2>>()
43    .transpile::<ReservedBytes<3>>()
44    .transpile::<ReservedBytes<4>>()
45    .transpile::<ReservedBytes<5>>()
46    .transpile::<ReservedBytes<6>>()
47    .transpile::<ReservedBytes<7>>()
48    .transpile::<ReservedBytes<8>>()
49    .transpile::<ReservedBytes<9>>()
50    .transpile::<ReservedBytes<10>>()
51    .transpile::<ReservedBytes<11>>()
52    .transpile::<ReservedBytes<12>>()
53    .transpile::<ReservedBytes<13>>()
54    .transpile::<ReservedBytes<14>>()
55    .transpile::<ReservedBytes<15>>()
56    .transpile::<ReservedBytes<16>>()
57    .transpile::<ReservedBytes<17>>()
58    .transpile::<ReservedBytes<18>>()
59    .transpile::<ReservedBytes<19>>()
60    .transpile::<ReservedBytes<20>>()
61    .transpile::<ReservedBytes<21>>()
62    .transpile::<ReservedBytes<22>>()
63    .transpile::<ReservedBytes<23>>()
64    .transpile::<ReservedBytes<24>>()
65    .transpile::<ReservedBytes<25>>()
66    .transpile::<ReservedBytes<26>>()
67    .transpile::<ReservedBytes<27>>()
68    .transpile::<ReservedBytes<28>>()
69    .transpile::<ReservedBytes<28>>()
70    .transpile::<ReservedBytes<29>>()
71    .transpile::<ReservedBytes<30>>()
72    .transpile::<ReservedBytes<31>>()
73    .transpile::<ReservedBytes<32>>()
74    .transpile::<mpc::MerkleConcealed>()
75    .transpile::<mpc::MerkleTree>()
76    .transpile::<mpc::MerkleBlock>()
77    .transpile::<mpc::MerkleProof>()
78    .transpile::<mpc::Leaf>()
79    .transpile::<mpc::Commitment>()
80    .transpile::<MerkleNode>()
81    .transpile::<MerkleHash>()
82    .transpile::<StrictHash>()
83    .compile()
84}
85
86/// Compiles CommitVerify strict type library.
87pub fn commit_verify_stl() -> TypeLib {
88    _commit_verify_stl().expect("invalid strict type CommitVerify library")
89}
90
91#[cfg(test)]
92mod test {
93    #![cfg_attr(coverage_nightly, coverage(off))]
94
95    use super::*;
96
97    #[test]
98    fn lib_id() {
99        let lib = commit_verify_stl();
100        assert_eq!(lib.id().to_string(), LIB_ID_COMMIT_VERIFY);
101    }
102}