Skip to content

Commit 5c63de2

Browse files
committed
Add CMR to compiler output
1 parent 568b462 commit 5c63de2

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/main.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@ struct Output {
1414
witness: Option<String>,
1515
/// Simplicity program ABI metadata to the program which the user provides.
1616
abi_meta: Option<AbiMeta>,
17+
/// Commitment Merkle Root (CMR) of the program, hex encoded.
18+
cmr: String,
1719
}
1820

1921
impl fmt::Display for Output {
2022
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2123
writeln!(f, "Program:\n{}", self.program)?;
24+
writeln!(f, "CMR:\n{}", self.cmr)?;
2225
if let Some(witness) = &self.witness {
2326
writeln!(f, "Witness:\n{}", witness)?;
2427
}
@@ -156,10 +159,12 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
156159
None
157160
};
158161

162+
let cmr_hex = compiled.commit().cmr().to_string();
159163
let output = Output {
160164
program: Base64Display::new(&program_bytes, &STANDARD).to_string(),
161165
witness: witness_bytes.map(|bytes| Base64Display::new(&bytes, &STANDARD).to_string()),
162166
abi_meta: abi_opt,
167+
cmr: cmr_hex,
163168
};
164169

165170
if output_json {

0 commit comments

Comments
 (0)