Skip to main content

midnight_onchain_runtime/
lib.rs

1// This file is part of midnight-ledger.
2// Copyright (C) Midnight Foundation
3// SPDX-License-Identifier: Apache-2.0
4// Licensed under the Apache License, Version 2.0 (the "License");
5// You may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7// http://www.apache.org/licenses/LICENSE-2.0
8// Unless required by applicable law or agreed to in writing, software
9// distributed under the License is distributed on an "AS IS" BASIS,
10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11// See the License for the specific language governing permissions and
12// limitations under the License.
13
14#![deny(unreachable_pub)]
15#![deny(warnings)]
16// Proptest derive triggers this.
17#![allow(non_local_definitions)]
18
19#[macro_use]
20extern crate tracing;
21
22pub mod context;
23pub mod error;
24#[rustfmt::skip]
25#[path = "../vendored/program_fragments.rs"]
26pub mod program_fragments;
27pub mod contract_state_ext;
28pub mod test_utilities;
29pub mod transcript;
30
31pub use onchain_runtime_state::state;
32
33pub use onchain_vm::cost_model;
34pub use onchain_vm::error as vm_error;
35pub use onchain_vm::ops;
36pub use onchain_vm::result_mode;
37pub use onchain_vm::state_value_ext;
38pub use onchain_vm::vm;
39pub use onchain_vm::vm_value;
40
41use base_crypto::fab::AlignedValue;
42use transient_crypto::curve::Fr;
43use transient_crypto::hash::transient_commit;
44
45pub fn communication_commitment(input: AlignedValue, output: AlignedValue, rand: Fr) -> Fr {
46    transient_commit(&AlignedValue::concat([&input, &output]), rand)
47}