From 5593673af51934e996c976e49edf8a347ff23a5c Mon Sep 17 00:00:00 2001 From: Mateusz Czeladka Date: Fri, 17 Mar 2023 16:30:07 +0100 Subject: [PATCH] Added support for passing ExBudget / InitialBudget externally --- Cargo.toml | 2 +- src/lib.rs | 19 +++++++++---- src/transaction.rs | 68 ++++++++++++++++++++++++++++++++++++---------- 3 files changed, 68 insertions(+), 21 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 52bd84e..3233b4f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aiken-jna-wrapper" -version = "0.0.9" +version = "0.1.0" authors = ["Satya "] edition = "2021" diff --git a/src/lib.rs b/src/lib.rs index c106392..9e06a13 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,9 +3,6 @@ extern crate core; mod transaction; mod build; -use jni::JNIEnv; -use jni::objects::{JClass, JString}; -use jni::sys::jstring; use std::os::raw::c_char; use std::ffi::{CStr, CString}; use std::{mem, panic}; @@ -31,20 +28,30 @@ pub struct InitialBudget { #[no_mangle] #[allow(non_snake_case)] -pub fn eval_phase_two(tx_hex: *const c_char, inputs: *const c_char, outputs: *const c_char, cost_mdls: *const c_char, slot_config: SlotConfig) -> *const c_char { +pub fn eval_phase_two(tx_hex: *const c_char, + inputs: *const c_char, + outputs: *const c_char, + cost_mdls: *const c_char, + initial_budget: InitialBudget, + slot_config: SlotConfig) -> *const c_char { let result = panic::catch_unwind(|| { let tx_hex = to_string(tx_hex); let inputs = to_string(inputs); let outputs = to_string(outputs); let cost_mdls = to_string(cost_mdls); + let ak_ex_budget = uplc::machine::cost_model::ExBudget { + mem: initial_budget.mem as i64, + cpu: initial_budget.cpu as i64, + }; + let ak_slot_config = uplc::tx::script_context::SlotConfig { zero_time: slot_config.zero_time, zero_slot: slot_config.zero_slot, slot_length: slot_config.slot_length, }; - let result = transaction::eval_phase_two(&tx_hex, &inputs, &outputs, &cost_mdls, ak_slot_config); + let result = transaction::eval_phase_two(&tx_hex, &inputs, &outputs, &cost_mdls, ak_ex_budget, ak_slot_config); match result { Ok(redeemer) => { to_ptr(redeemer) @@ -57,7 +64,7 @@ pub fn eval_phase_two(tx_hex: *const c_char, inputs: *const c_char, outputs: *co match result { Ok(c) => c, - Err(cause) => { + Err(_cause) => { to_ptr(String::new()) } } diff --git a/src/transaction.rs b/src/transaction.rs index 545af3f..e59095b 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -1,15 +1,16 @@ -use std::iter; + use pallas_primitives::{ babbage::{TransactionInput, TransactionOutput}, Fragment, }; -use pallas_primitives::babbage::{CostMdls, Redeemer}; +use pallas_primitives::babbage::{CostMdls}; use pallas_traverse::{Era, MultiEraTx}; use uplc::tx; use uplc::tx::error::Error; use uplc::tx::script_context::{ResolvedInput, SlotConfig}; +use uplc::machine::cost_model::ExBudget; -pub fn eval_phase_two(tx_hex: &str, inputs: &str, outputs: &str, cost_mdls: &str, slot_config: SlotConfig) -> Result { +pub fn eval_phase_two(tx_hex: &str, inputs: &str, outputs: &str, cost_mdls: &str, ex_budget: ExBudget, slot_config: SlotConfig) -> Result { let tx_bytes = hex::decode(tx_hex).unwrap(); let tx_bytes = tx_bytes.as_slice(); let tx = MultiEraTx::decode(Era::Babbage, &tx_bytes) @@ -37,7 +38,7 @@ pub fn eval_phase_two(tx_hex: &str, inputs: &str, outputs: &str, cost_mdls: &str if let Some(tx_babbage) = tx.as_babbage() { let result = - tx::eval_phase_two(tx_babbage, &resolved_inputs, Some(&cost_mdls), None, &slot_config, true, |_| {}); + tx::eval_phase_two(tx_babbage, &resolved_inputs, Some(&cost_mdls), Some(&ex_budget), &slot_config, true, |_| {}); let redeemers = result?; let redeemer_bytes = minicbor::to_vec(redeemers).unwrap(); @@ -46,18 +47,15 @@ pub fn eval_phase_two(tx_hex: &str, inputs: &str, outputs: &str, cost_mdls: &str let redeemers_hex = hex::encode(redeemer_bytes); return Ok(redeemers_hex); - } else { - return Ok("".to_owned()); } + + return Ok("".to_owned()); } #[cfg(test)] mod tests { - use std::path::Iter; - use minicbor::decode::{Token, Tokenizer}; - use minicbor::encode::ArrayIter; + use uplc::machine::cost_model::ExBudget; use uplc::tx::script_context::SlotConfig; - use uplc::tx::to_plutus_data::ToPlutusData; use crate::transaction::eval_phase_two; #[test] @@ -73,7 +71,13 @@ mod tests { slot_length: 1000, }; - let redeemer = eval_phase_two(tx_hex, inputs, outputs, cost_mdls, slot_config).unwrap(); + let ex_budget = ExBudget { + cpu: 10000000000, + mem: 16000000, + }; + + let redeemer = eval_phase_two(tx_hex, inputs, outputs, cost_mdls, ex_budget, slot_config).unwrap(); + assert_eq!("818400001824821a00078d1a1a09552e8e", redeemer); println!("{:?}", redeemer) } @@ -90,12 +94,18 @@ mod tests { slot_length: 1000, }; - let redeemer = eval_phase_two(tx_hex, inputs, outputs, cost_mdls, slot_config).unwrap(); + let ex_budget = ExBudget { + cpu: 10000000000, + mem: 16000000, + }; + + let redeemer = eval_phase_two(tx_hex, inputs, outputs, cost_mdls, ex_budget, slot_config).unwrap(); + assert_eq!("85840000d8799f58383531333163323432386237303837623866383435383533343166306265313436303039313333356535303130353562303830383562656162ff821a00200b391a37c51a83840001d8799f58383534393438346266333764386361306235366332373266346361303764633963323633666532343732346464376665363635353165623066ff821a00202ad91a38011f46840002d8799f58386563643032656335366165323862653762326132396333313737313235623139383166616631623631336636336632616663643738366135ff821a00204a791a383d2409840003d8799f58383138653033306639383861653735633762356634653433303334646239383333636661383063616532303263373339376461313861393135ff821a00206a191a387928cc840004d8799f58383336666232323131666138616535383163653439653863393136323835396330663531666535633632333763386336363764376136306361ff821a002089b91a38b52d8f", redeemer); println!("{:?}", redeemer) } #[test] - pub fn eval_phase_test_failed() { + pub fn eval_phase_test_failed_asserted_on_incorrect_constructor_variant() { let tx_hex = "84a6008582582068368129e5057b6a314da2216c95087699ef6551fc7d7dcb316277790085f5250082582068368129e5057b6a314da2216c95087699ef6551fc7d7dcb316277790085f5250182582068368129e5057b6a314da2216c95087699ef6551fc7d7dcb316277790085f5250282582068368129e5057b6a314da2216c95087699ef6551fc7d7dcb316277790085f5250382582068368129e5057b6a314da2216c95087699ef6551fc7d7dcb316277790085f525040182a300581d7027bb75b503c762c185b829d924291b24168690e132ff952a1e5b40aa011a00117e5c028201d818583cd8799fa2d8799f1a0ddaf2d51a0011afdeffd8799f02001a006025c2ffd8799f1a0ddaf2d51a00158f74ffd8799f1a00486079001a006025c2ff00ff82583900bee45311d846fc0a8b6bc6c1d06cc212f577efa60086a9c26783c6eb1708ad5cfcd595d49f19695c86d335a339dc8d4130170e38a2cb0c961a004e861c02000d82825820214135a716a3ace3e2e913936af4acf35a78fb45134d2f3c58fcebbb3aab9384018258203974e34e3cde1dc35f06f7bd6c887c927af5277bc270c74fbab06410cf98cefd051082583900bee45311d846fc0a8b6bc6c1d06cc212f577efa60086a9c26783c6eb1708ad5cfcd595d49f19695c86d335a339dc8d4130170e38a2cb0c961b00000004a727c396111a000f4240a20585840000d8799f58383631616564373365663933336163626365303164663764633932633865333264616335663662363032616634616365363161303366613561ff820000840001d8799f58386136366464613232643465323236303737396362393131303330616365623037663938616237353533316330643634356162613361653265ff820000840002d8799f58383038313164323261323933663730653333313265316333623562306332333833383361373030313937363039313933393339396634363532ff820000840003d8799f58383837633732363365386335643562663236326635383736336136383932343433613136633466636232373430356466376330343139343066ff820000840004d8799f58383231343065663462623264643031303963306164616431613262343034386230336165616437636565643233646437313338396534336431ff8200000681590de0590ddd01000032323232323232323232322225333006323232323232323232323232323232323232323232533301b3370e0029000099191919192999810299981018068020998051bac33019301a33019301a01b48001200400114a0266600e02c02a02e2940cdd2a40006604a6e98004cc094dd42400097ae0323232323232323232330020014bd6f7b63000498008009112999816001080089919191919199980e199804004002003199991111999806802001801000a5eb7bdb180cdd2a4000660646ea0008cc0c8dd4000a5eb80cdd2a4000660646ea0dd6998129813001a4004660646ea0dd6998129813001a4008660646ea0dd6998129813001a400c97ae001a01b01a375a66048604a00890031bad33023302400348010c8c8c8c8c8cdd2a400066068008660686ea000ccc0d0dd40011981a1ba80014bd701919806800a40006601a00890001919806000a40006601800690011919805800a400066016004900219ba548000cc0c0dd41bad33023302400148010cc0c0dd41bad330233024001480192f5c00046060006605c004600200244444a66605800826605a66ec000c0092f5bded8c0264646464a66605666ebccc01401c004cdd2a400097ae01330313376000e00c0102a66605666ebc01c0044cc0c4cdd800380300189981899bb000100233333009009003007006005302d003302d0023030005302e004223253330243370e00290010801099190009bad302c001301e003302637540044464664464a66604c66e1c005200213374a900125eb804c8c8cdd2a40006605c6ea0c0100052f5c06eb4c0b8004c08000cc0a0dd500100091bad3301d301e00448008cc00d2f5c301000081010100810102001299981199b87375a66038603a0069004000899b8700200114a06002002444a66604c004266e9520024bd700991929998119801801099ba548000cc0a4dd400125eb804ccc01401400400cc0a800cdd6981400119191919801000919191981219299981219b87001480004c8c8c8c8c8c8c8c8c8c94ccc0ccc0d800852615330304901364c6973742f5475706c652f436f6e73747220636f6e7461696e73206d6f7265206974656d73207468616e2069742065787065637465640016375a606800260680046eb4c0c8004c0c8008dd6981800098180011bad302e001302e002375c6058002603c0042a6604c92012b436f6e73747220696e64657820646964206e6f74206d6174636820616e7920747970652076617269616e740016302637540020026052002603664a66604466e1d20043025375400220022a660489212a4173736572746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e00163301a301b3301a301b0014800920040153001001222533302500214bd7009919198141801801199802802800801981480198138011bae302300130150171533301b3370e002900109919191919191929998112999811180780309980600b8008a50133300901801701914a064646644646660080064466e9520003302e374c66660306eaccc084c08800920003756660426044002900000b80b198171ba80044bd7000099ba548000cc0acdd325eb7bdb180cc0acdd4000a5eb8000c010c00400488894ccc0a800c40044c8c8cccc018018004010cc01000800cc0b8010c0b000cc8c8cc88cc00c0088c8c8cc0a0c94ccc0a0cdc3800a4000264646464a666062606800426605a66054006464646606064a66606066e1c00520001323232325333039303c002149854cc0d9241364c6973742f5475706c652f436f6e73747220636f6e7461696e73206d6f7265206974656d73207468616e2069742065787065637465640016375a607400260740046eb4c0e0004c0a800c54cc0c92412b436f6e73747220696e64657820646964206e6f74206d6174636820616e7920747970652076617269616e740016303237540046606064a66606066e1c00520001323232323232533303b303e002149854cc0e1241364c6973742f5475706c652f436f6e73747220636f6e7461696e73206d6f7265206974656d73207468616e2069742065787065637465640016375a607800260780046eb4c0e8004c0e8008dd6981c00098150010a9981924812b436f6e73747220696e64657820646964206e6f74206d6174636820616e7920747970652076617269616e740016303237540029318190011818000a4c2a6605c921364c6973742f5475706c652f436f6e73747220636f6e7461696e73206d6f7265206974656d73207468616e2069742065787065637465640016375a606400260640046eacc0c0004c08800854cc0a92412b436f6e73747220696e64657820646964206e6f74206d6174636820616e7920747970652076617269616e740016302a3754002a66604e66e1cdd6998101810800a4004008266e9520003302d0014bd70099ba5480092f5c0605a002603e64a66604c66e1d20043029375400220022a6605092012a4173736572746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e00163301e301f3301e301f0014800920040180043001001222533302800214bd70099191919299981399b87001480084ccc01c01c00c0144c8c8cc0bc004ccc02402401401cc0bc004c084008c0a4dd500098018011816001981500119b8000148008dd6981280098128011bae3023001301501714a0603a6ea8058888c8cc02000c8c8c8cdc78008021bae3026001301832533301f3370e900118111baa0011001153302149012a4173736572746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e0016330173018330173018001480012000332232323232001375c6050002603464a66604266e1d20023024375400220022a6604692012a4173736572746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e001633019301a33019301a33019301a00148009200048000c098004c060c94ccc07ccdc3a400060446ea8004400454cc0852412a4173736572746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e00163300600223375e66030603200290000010018009800800911299980f801099ba5480092f5c026464a6660386006004266e952000330220024bd700999802802800801981180198108011119801801119191980e19299980e19b87001480004c8c8c8c94ccc094c0a00084cc084cc07800c8c8c8cc090c94ccc090cdc3800a4000264646464a66605a60600042930a998152481364c6973742f5475706c652f436f6e73747220636f6e7461696e73206d6f7265206974656d73207468616e2069742065787065637465640016375a605c002605c0046eb4c0b0004c07800c54cc0992412b436f6e73747220696e64657820646964206e6f74206d6174636820616e7920747970652076617269616e740016302637540046604864a66604866e1c00520001323232323232533302f3032002149854cc0b1241364c6973742f5475706c652f436f6e73747220636f6e7461696e73206d6f7265206974656d73207468616e2069742065787065637465640016375a606000260600046eb4c0b8004c0b8008dd69816000980f0010a9981324812b436f6e73747220696e64657820646964206e6f74206d6174636820616e7920747970652076617269616e740016302637540029318130011812000a4c2a66044921364c6973742f5475706c652f436f6e73747220636f6e7461696e73206d6f7265206974656d73207468616e2069742065787065637465640016375a604c002604c0046eacc090004c05800854cc0792412b436f6e73747220696e64657820646964206e6f74206d6174636820616e7920747970652076617269616e740016301e375400266ebc010004c084004c04cc94ccc068cdc3a4008603a6ea8004400454cc0712412a4173736572746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e001633012301300148010c0040048894ccc07000852809919299980c98018010a5113330050050010033020003301e00224a2446644a66602c66e400080044cdd2a400097ae0153330163371e004002266e9520024bd70099ba5480112f5c06ecc008dd980091119ba548000cc068cdd2a4000660346ea0cdc01bad3300d300e00248000dd6998069807000a4000660346ea0cdc01bad3300d300e00248008dd6998069807000a4004660346ea0cdc01bad3300d300e00248010dd6998069807000a400897ae04bd7011111999802802001801000980080091111299980c00208018991919191999980480480199999805003800801003002803002980c801980c801180e002980d0021800800911111299980b80289980c19bb00040034bd6f7b630099191919299980b19baf330050080013374a900025eb804cc070cdd80040038048a99980b19baf0080011323253330183370e0029000099191981019bb000c001007302000130120021005301a375400266600c01000e00426603866ec0004008cccccc02802800c02001c018014c06000cc060008c06c018c064014dd61980218029980218028032400090021bac330033004330033004005480012000301000130023253330093370e900118061baa0011001153300b49012a4173736572746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e00163300130020034800888c8ccc0040052000003222333300c3370e008004026466600800866e0000d200230150010012300b37540022930b180080091129998048010a4c26600a600260160046660060066018004002ae695cdab9c5573aaae7955cfaba05742ae881f5f6"; let inputs = "8582582068368129e5057b6a314da2216c95087699ef6551fc7d7dcb316277790085f5250082582068368129e5057b6a314da2216c95087699ef6551fc7d7dcb316277790085f5250182582068368129e5057b6a314da2216c95087699ef6551fc7d7dcb316277790085f5250282582068368129e5057b6a314da2216c95087699ef6551fc7d7dcb316277790085f5250382582068368129e5057b6a314da2216c95087699ef6551fc7d7dcb316277790085f52504"; let outputs = "85a300581d7027bb75b503c762c185b829d924291b24168690e132ff952a1e5b40aa011a00133418028201d8185856d8799f5840633263363663326165613536343761653538306230663965636238333235343163326334633964376130653231633037633364616239373436356530383634331a0017c5491a0ddaf2d51a0011afde00ffa300581d7027bb75b503c762c185b829d924291b24168690e132ff952a1e5b40aa011a00133418028201d8185856d8799f5840613661353431653461373064323739373839646262633639316636653065353932383364626261303762373133393866373837366332353363656164346261361a004860791a0ddaf2d51a0011afde00ffa300581d7027bb75b503c762c185b829d924291b24168690e132ff952a1e5b40aa011a00133418028201d8185856d8799f5840613661353431653461373064323739373839646262633639316636653065353932383364626261303762373133393866373837366332353363656164346261361a004860791a0ddaf2d51a00158f7400ffa300581d7027bb75b503c762c185b829d924291b24168690e132ff952a1e5b40aa011a00133418028201d8185856d8799f5840633263363663326165613536343761653538306230663965636238333235343163326334633964376130653231633037633364616239373436356530383634331a0017c5491a0ddaf2d51a00158f7400ffa300581d7027bb75b503c762c185b829d924291b24168690e132ff952a1e5b40aa011a00133418028201d8185856d8799f5840613661353431653461373064323739373839646262633639316636653065353932383364626261303762373133393866373837366332353363656164346261361a004860791a0ddaf2d51a00158f7402ff"; @@ -107,7 +117,37 @@ mod tests { slot_length: 1000, }; - let redeemer = eval_phase_two(tx_hex, inputs, outputs, cost_mdls, slot_config); + let ex_budget = ExBudget { + cpu: 10000000000, + mem: 16000000, + }; + + let redeemer = eval_phase_two(tx_hex, inputs, outputs, cost_mdls, ex_budget, slot_config); + assert!(redeemer.is_err()); println!("{:?}", redeemer) } + + #[test] + pub fn eval_phase_test_failed_out_of_budget() { + let tx_hex = "84a600858258205eaa26f02f743fb5ddfa7dd224537fd4a1c9cf92c9e2e8798e640453fffaf739008258205eaa26f02f743fb5ddfa7dd224537fd4a1c9cf92c9e2e8798e640453fffaf739018258205eaa26f02f743fb5ddfa7dd224537fd4a1c9cf92c9e2e8798e640453fffaf739028258205eaa26f02f743fb5ddfa7dd224537fd4a1c9cf92c9e2e8798e640453fffaf739038258205eaa26f02f743fb5ddfa7dd224537fd4a1c9cf92c9e2e8798e640453fffaf739040182a300581d7027bb75b503c762c185b829d924291b24168690e132ff952a1e5b40aa011a00132342028201d8185855d8799fa3d8799f1a0ddaf2d51a00158f74ffd8799f001a0008a3ed00ffd8799f1a1148bbdf1a001328b4ffd8799f001a0017c5491a00510466ffd8799f1a1148bbdf1a0018fb3dffd8799f1a0008a3ed0000ff00ff82583900bee45311d846fc0a8b6bc6c1d06cc212f577efa60086a9c26783c6eb1708ad5cfcd595d49f19695c86d335a339dc8d4130170e38a2cb0c961a004ce13602000d818258203974e34e3cde1dc35f06f7bd6c887c927af5277bc270c74fbab06410cf98cefd051082583900bee45311d846fc0a8b6bc6c1d06cc212f577efa60086a9c26783c6eb1708ad5cfcd595d49f19695c86d335a339dc8d4130170e38a2cb0c961b00000004a6eed66d111a000f4240a20585840000d8799f58383531333163323432386237303837623866383435383533343166306265313436303039313333356535303130353562303830383562656162ff820000840001d8799f58383534393438346266333764386361306235366332373266346361303764633963323633666532343732346464376665363635353165623066ff820000840002d8799f58386563643032656335366165323862653762326132396333313737313235623139383166616631623631336636336632616663643738366135ff820000840003d8799f58383138653033306639383861653735633762356634653433303334646239383333636661383063616532303263373339376461313861393135ff820000840004d8799f58383336666232323131666138616535383163653439653863393136323835396330663531666535633632333763386336363764376136306361ff8200000681590de0590ddd01000032323232323232323232322225333006323232323232323232323232323232323232323232533301b3370e0029000099191919192999810299981018068020998051bac33019301a33019301a01b48001200400114a0266600e02c02a02e2940cdd2a40006604a6e98004cc094dd42400097ae0323232323232323232330020014bd6f7b63000498008009112999816001080089919191919199980e199804004002003199991111999806802001801000a5eb7bdb180cdd2a4000660646ea0008cc0c8dd4000a5eb80cdd2a4000660646ea0dd6998129813001a4004660646ea0dd6998129813001a4008660646ea0dd6998129813001a400c97ae001a01b01a375a66048604a00890031bad33023302400348010c8c8c8c8c8cdd2a400066068008660686ea000ccc0d0dd40011981a1ba80014bd701919806800a40006601a00890001919806000a40006601800690011919805800a400066016004900219ba548000cc0c0dd41bad33023302400148010cc0c0dd41bad330233024001480192f5c00046060006605c004600200244444a66605800826605a66ec000c0092f5bded8c0264646464a66605666ebccc01401c004cdd2a400097ae01330313376000e00c0102a66605666ebc01c0044cc0c4cdd800380300189981899bb000100233333009009003007006005302d003302d0023030005302e004223253330243370e00290010801099190009bad302c001301e003302637540044464664464a66604c66e1c005200213374a900125eb804c8c8cdd2a40006605c6ea0c0100052f5c06eb4c0b8004c08000cc0a0dd500100091bad3301d301e00448008cc00d2f5c301000081010100810102001299981199b87375a66038603a0069004000899b8700200114a06002002444a66604c004266e9520024bd700991929998119801801099ba548000cc0a4dd400125eb804ccc01401400400cc0a800cdd6981400119191919801000919191981219299981219b87001480004c8c8c8c8c8c8c8c8c8c94ccc0ccc0d800852615330304901364c6973742f5475706c652f436f6e73747220636f6e7461696e73206d6f7265206974656d73207468616e2069742065787065637465640016375a606800260680046eb4c0c8004c0c8008dd6981800098180011bad302e001302e002375c6058002603c0042a6604c92012b436f6e73747220696e64657820646964206e6f74206d6174636820616e7920747970652076617269616e740016302637540020026052002603664a66604466e1d20043025375400220022a660489212a4173736572746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e00163301a301b3301a301b0014800920040153001001222533302500214bd7009919198141801801199802802800801981480198138011bae302300130150171533301b3370e002900109919191919191929998112999811180780309980600b8008a50133300901801701914a064646644646660080064466e9520003302e374c66660306eaccc084c08800920003756660426044002900000b80b198171ba80044bd7000099ba548000cc0acdd325eb7bdb180cc0acdd4000a5eb8000c010c00400488894ccc0a800c40044c8c8cccc018018004010cc01000800cc0b8010c0b000cc8c8cc88cc00c0088c8c8cc0a0c94ccc0a0cdc3800a4000264646464a666062606800426605a66054006464646606064a66606066e1c00520001323232325333039303c002149854cc0d9241364c6973742f5475706c652f436f6e73747220636f6e7461696e73206d6f7265206974656d73207468616e2069742065787065637465640016375a607400260740046eb4c0e0004c0a800c54cc0c92412b436f6e73747220696e64657820646964206e6f74206d6174636820616e7920747970652076617269616e740016303237540046606064a66606066e1c00520001323232323232533303b303e002149854cc0e1241364c6973742f5475706c652f436f6e73747220636f6e7461696e73206d6f7265206974656d73207468616e2069742065787065637465640016375a607800260780046eb4c0e8004c0e8008dd6981c00098150010a9981924812b436f6e73747220696e64657820646964206e6f74206d6174636820616e7920747970652076617269616e740016303237540029318190011818000a4c2a6605c921364c6973742f5475706c652f436f6e73747220636f6e7461696e73206d6f7265206974656d73207468616e2069742065787065637465640016375a606400260640046eacc0c0004c08800854cc0a92412b436f6e73747220696e64657820646964206e6f74206d6174636820616e7920747970652076617269616e740016302a3754002a66604e66e1cdd6998101810800a4004008266e9520003302d0014bd70099ba5480092f5c0605a002603e64a66604c66e1d20043029375400220022a6605092012a4173736572746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e00163301e301f3301e301f0014800920040180043001001222533302800214bd70099191919299981399b87001480084ccc01c01c00c0144c8c8cc0bc004ccc02402401401cc0bc004c084008c0a4dd500098018011816001981500119b8000148008dd6981280098128011bae3023001301501714a0603a6ea8058888c8cc02000c8c8c8cdc78008021bae3026001301832533301f3370e900118111baa0011001153302149012a4173736572746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e0016330173018330173018001480012000332232323232001375c6050002603464a66604266e1d20023024375400220022a6604692012a4173736572746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e001633019301a33019301a33019301a00148009200048000c098004c060c94ccc07ccdc3a400060446ea8004400454cc0852412a4173736572746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e00163300600223375e66030603200290000010018009800800911299980f801099ba5480092f5c026464a6660386006004266e952000330220024bd700999802802800801981180198108011119801801119191980e19299980e19b87001480004c8c8c8c94ccc094c0a00084cc084cc07800c8c8c8cc090c94ccc090cdc3800a4000264646464a66605a60600042930a998152481364c6973742f5475706c652f436f6e73747220636f6e7461696e73206d6f7265206974656d73207468616e2069742065787065637465640016375a605c002605c0046eb4c0b0004c07800c54cc0992412b436f6e73747220696e64657820646964206e6f74206d6174636820616e7920747970652076617269616e740016302637540046604864a66604866e1c00520001323232323232533302f3032002149854cc0b1241364c6973742f5475706c652f436f6e73747220636f6e7461696e73206d6f7265206974656d73207468616e2069742065787065637465640016375a606000260600046eb4c0b8004c0b8008dd69816000980f0010a9981324812b436f6e73747220696e64657820646964206e6f74206d6174636820616e7920747970652076617269616e740016302637540029318130011812000a4c2a66044921364c6973742f5475706c652f436f6e73747220636f6e7461696e73206d6f7265206974656d73207468616e2069742065787065637465640016375a604c002604c0046eacc090004c05800854cc0792412b436f6e73747220696e64657820646964206e6f74206d6174636820616e7920747970652076617269616e740016301e375400266ebc010004c084004c04cc94ccc068cdc3a4008603a6ea8004400454cc0712412a4173736572746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e001633012301300148010c0040048894ccc07000852809919299980c98018010a5113330050050010033020003301e00224a2446644a66602c66e400080044cdd2a400097ae0153330163371e004002266e9520024bd70099ba5480112f5c06ecc008dd980091119ba548000cc068cdd2a4000660346ea0cdc01bad3300d300e00248000dd6998069807000a4000660346ea0cdc01bad3300d300e00248008dd6998069807000a4004660346ea0cdc01bad3300d300e00248010dd6998069807000a400897ae04bd7011111999802802001801000980080091111299980c00208018991919191999980480480199999805003800801003002803002980c801980c801180e002980d0021800800911111299980b80289980c19bb00040034bd6f7b630099191919299980b19baf330050080013374a900025eb804cc070cdd80040038048a99980b19baf0080011323253330183370e0029000099191981019bb000c001007302000130120021005301a375400266600c01000e00426603866ec0004008cccccc02802800c02001c018014c06000cc060008c06c018c064014dd61980218029980218028032400090021bac330033004330033004005480012000301000130023253330093370e900118061baa0011001153300b49012a4173736572746564206f6e20696e636f727265637420636f6e7374727563746f722076617269616e742e00163300130020034800888c8ccc0040052000003222333300c3370e008004026466600800866e0000d200230150010012300b37540022930b180080091129998048010a4c26600a600260160046660060066018004002ae695cdab9c5573aaae7955cfaba05742ae881f5f6"; + let inputs = "858258205eaa26f02f743fb5ddfa7dd224537fd4a1c9cf92c9e2e8798e640453fffaf739008258205eaa26f02f743fb5ddfa7dd224537fd4a1c9cf92c9e2e8798e640453fffaf739018258205eaa26f02f743fb5ddfa7dd224537fd4a1c9cf92c9e2e8798e640453fffaf739028258205eaa26f02f743fb5ddfa7dd224537fd4a1c9cf92c9e2e8798e640453fffaf739038258205eaa26f02f743fb5ddfa7dd224537fd4a1c9cf92c9e2e8798e640453fffaf73904"; + let outputs = "85a300581d7027bb75b503c762c185b829d924291b24168690e132ff952a1e5b40aa011a00133418028201d8185856d8799f5840633263363663326165613536343761653538306230663965636238333235343163326334633964376130653231633037633364616239373436356530383634331a0017c5491a1148bbdf1a001328b401ffa300581d7027bb75b503c762c185b829d924291b24168690e132ff952a1e5b40aa011a00133418028201d8185856d8799f5840666135383433316333323432396538393861363132303064323632616133356338343562383365393035373239366430393337653061353237306264613938301a0008a3ed1a1148bbdf1a0018fb3d02ffa300581d7027bb75b503c762c185b829d924291b24168690e132ff952a1e5b40aa011a00133418028201d8185856d8799f5840666135383433316333323432396538393861363132303064323632616133356338343562383365393035373239366430393337653061353237306264613938301a0008a3ed1a0ddaf2d51a00158f7401ffa300581d7027bb75b503c762c185b829d924291b24168690e132ff952a1e5b40aa011a00133418028201d8185856d8799f5840666135383433316333323432396538393861363132303064323632616133356338343562383365393035373239366430393337653061353237306264613938301a0008a3ed1a1148bbdf1a001328b400ffa300581d7027bb75b503c762c185b829d924291b24168690e132ff952a1e5b40aa011a00133418028201d8185856d8799f5840613661353431653461373064323739373839646262633639316636653065353932383364626261303762373133393866373837366332353363656164346261361a004860791a1148bbdf1a001328b400ff"; + let cost_mdls = "a10198af1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a0011b22c1a0005fdde00021a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a0223accc0a1a0374f693194a1f0a1a02515e841980b30a"; + + let slot_config = SlotConfig { + zero_time: 1596059091000, + zero_slot: 0, + slot_length: 1000, + }; + + let ex_budget = ExBudget { + cpu: 1, + mem: 1, + }; + + let redeemer = eval_phase_two(tx_hex, inputs, outputs, cost_mdls, ex_budget, slot_config); + assert!(redeemer.is_err()); + println!("{:?}", redeemer) + } + }