From bfc93bf076715fa4ee1038ecb0a8932fda130661 Mon Sep 17 00:00:00 2001 From: KtorZ Date: Mon, 12 Aug 2024 02:10:00 +0200 Subject: [PATCH] Add script context translation for new Conway certificates --- crates/uplc/src/tx/phase_one.rs | 27 +- crates/uplc/src/tx/script_context.rs | 118 +- ...t__tests__script_context_certificates.snap | 2191 +++++++++++++++++ crates/uplc/src/tx/to_plutus_data.rs | 224 +- .../script_context/v3/README.md | 50 +- .../ctx/certificates/resolved_inputs.template | 5 + .../v3/ctx/certificates/tx.template | 118 + .../script_context/v3/plutus.json | 15 +- .../v3/validators/certificates.ak | 207 ++ 9 files changed, 2883 insertions(+), 72 deletions(-) create mode 100644 crates/uplc/src/tx/snapshots/uplc__tx__script_context__tests__script_context_certificates.snap create mode 100644 examples/acceptance_tests/script_context/v3/ctx/certificates/resolved_inputs.template create mode 100644 examples/acceptance_tests/script_context/v3/ctx/certificates/tx.template create mode 100644 examples/acceptance_tests/script_context/v3/validators/certificates.ak diff --git a/crates/uplc/src/tx/phase_one.rs b/crates/uplc/src/tx/phase_one.rs index b0eb06eb..5b58bdf8 100644 --- a/crates/uplc/src/tx/phase_one.rs +++ b/crates/uplc/src/tx/phase_one.rs @@ -108,17 +108,24 @@ pub fn scripts_needed(tx: &MintedTx, utxos: &[ResolvedInput]) -> Result { - Some((ScriptPurpose::Certifying(ix, cert.clone()), *h)) - } - Certificate::StakeDelegation(StakeCredential::Scripthash(h), _) => { - Some((ScriptPurpose::Certifying(ix, cert.clone()), *h)) - } - _ => None, + .filter_map(|(ix, cert)| match cert { + Certificate::StakeDeregistration(StakeCredential::Scripthash(h)) + | Certificate::UnReg(StakeCredential::Scripthash(h), _) + | Certificate::VoteDeleg(StakeCredential::Scripthash(h), _) + | Certificate::VoteRegDeleg(StakeCredential::Scripthash(h), _, _) + | Certificate::StakeVoteDeleg(StakeCredential::Scripthash(h), _, _) + | Certificate::StakeRegDeleg(StakeCredential::Scripthash(h), _, _) + | Certificate::StakeVoteRegDeleg(StakeCredential::Scripthash(h), _, _, _) + | Certificate::RegDRepCert(StakeCredential::Scripthash(h), _, _) + | Certificate::UnRegDRepCert(StakeCredential::Scripthash(h), _) + | Certificate::UpdateDRepCert(StakeCredential::Scripthash(h), _) + | Certificate::AuthCommitteeHot(StakeCredential::Scripthash(h), _) + | Certificate::ResignCommitteeCold(StakeCredential::Scripthash(h), _) + | Certificate::StakeDelegation(StakeCredential::Scripthash(h), _) => { + Some((ScriptPurpose::Certifying(ix, cert.clone()), *h)) } + + _ => None, }) .collect::() }) diff --git a/crates/uplc/src/tx/script_context.rs b/crates/uplc/src/tx/script_context.rs index fda3d763..a73b4268 100644 --- a/crates/uplc/src/tx/script_context.rs +++ b/crates/uplc/src/tx/script_context.rs @@ -1,7 +1,9 @@ use super::{to_plutus_data::MintValue, Error}; use itertools::Itertools; use pallas_addresses::{Address, StakePayload}; -use pallas_codec::utils::{KeyValuePairs, NonEmptyKeyValuePairs, NonEmptySet, Nullable}; +use pallas_codec::utils::{ + KeyValuePairs, NonEmptyKeyValuePairs, NonEmptySet, Nullable, PositiveCoin, +}; use pallas_crypto::hash::Hash; use pallas_primitives::{ alonzo, @@ -310,10 +312,10 @@ pub struct TxInfoV3 { pub data: KeyValuePairs, pub proposal_procedures: Vec, pub id: Hash<32>, + pub current_treasury_amount: Option, + pub treasury_donation: Option, // TODO: // votes : KeyValuePairs> - // currentTreasuryAmount : Option - // treasuryDonation : Option } impl TxInfoV3 { @@ -366,6 +368,10 @@ impl TxInfoV3 { data: KeyValuePairs::from(get_data_info(&tx.transaction_witness_set)), redeemers, proposal_procedures, + current_treasury_amount: get_current_treasury_amount_info( + &tx.transaction_body.treasury_value, + ), + treasury_donation: get_treasury_donation_info(&tx.transaction_body.donation), id: tx.transaction_body.original_hash(), })) } @@ -594,6 +600,14 @@ pub fn get_fee_info(fee: &Coin) -> Coin { *fee } +pub fn get_current_treasury_amount_info(amount: &Option) -> Option { + *amount +} + +pub fn get_treasury_donation_info(amount: &Option) -> Option { + *amount +} + pub fn get_certificates_info(certificates: &Option>) -> Vec { certificates.clone().map(|s| s.to_vec()).unwrap_or_default() } @@ -807,20 +821,26 @@ pub fn find_script( .get(redeemer.index as usize) .ok_or(Error::MissingScriptForRedeemer) .and_then(|cert| match cert { - Certificate::StakeDeregistration(stake_credential) => match stake_credential { + Certificate::StakeDeregistration(stake_credential) + | Certificate::UnReg(stake_credential, _) + | Certificate::VoteDeleg(stake_credential, _) + | Certificate::VoteRegDeleg(stake_credential, _, _) + | Certificate::StakeVoteDeleg(stake_credential, _, _) + | Certificate::StakeRegDeleg(stake_credential, _, _) + | Certificate::StakeVoteRegDeleg(stake_credential, _, _, _) + | Certificate::RegDRepCert(stake_credential, _, _) + | Certificate::UnRegDRepCert(stake_credential, _) + | Certificate::UpdateDRepCert(stake_credential, _) + | Certificate::AuthCommitteeHot(stake_credential, _) + | Certificate::ResignCommitteeCold(stake_credential, _) + | Certificate::StakeDelegation(stake_credential, _) => match stake_credential { StakeCredential::Scripthash(hash) => Ok(hash), _ => Err(Error::NonScriptStakeCredential), }, - Certificate::StakeDelegation(stake_credential, _) => match stake_credential { - StakeCredential::Scripthash(hash) => Ok(hash), - _ => Err(Error::NonScriptStakeCredential), - }, - Certificate::PoolRetirement { .. } | Certificate::PoolRegistration { .. } => { - Err(Error::UnsupportedCertificateType) - } - _ => { - todo!("remaining certificate types") - } + Certificate::StakeRegistration { .. } + | Certificate::PoolRetirement { .. } + | Certificate::Reg { .. } + | Certificate::PoolRegistration { .. } => Err(Error::UnsupportedCertificateType), }) .and_then(lookup_script), @@ -1256,4 +1276,74 @@ mod tests { // from the Haskell ledger / cardano node. insta::assert_debug_snapshot!(script_context.to_plutus_data()); } + + #[test] + fn script_context_certificates() { + let redeemer = Redeemer { + tag: RedeemerTag::Cert, + index: 20, + data: Data::constr(0, vec![]), + ex_units: ExUnits { + mem: 1000000, + steps: 100000000, + }, + }; + + // NOTE: The transaction also contains treasury donation and current treasury amount + let script_context = fixture_tx_info( + "84a6008182582000000000000000000000000000000000000000000000000000\ + 00000000000000000180049582008201581c2222222222222222222222222222\ + 222222222222222222222222222282008200581c000000000000000000000000\ + 0000000000000000000000000000000082018200581c00000000000000000000\ + 0000000000000000000000000000000000008a03581c11111111111111111111\ + 1111111111111111111111111111111111115820999999999999999999999999\ + 99999999999999999999999999999999999999991a000f4240190154d81e8201\ + 1864581de0000000000000000000000000000000000000000000000000000000\ + 00d901028080f68304581c111111111111111111111111111111111111111111\ + 1111111111111119053983078200581c00000000000000000000000000000000\ + 0000000000000000000000001a002dc6c083088200581c000000000000000000\ + 000000000000000000000000000000000000001a002dc6c083098200581c0000\ + 00000000000000000000000000000000000000000000000000008200581c0000\ + 000000000000000000000000000000000000000000000000000083098200581c\ + 000000000000000000000000000000000000000000000000000000008201581c\ + 0000000000000000000000000000000000000000000000000000000083098200\ + 581c000000000000000000000000000000000000000000000000000000008102\ + 83098200581c0000000000000000000000000000000000000000000000000000\ + 00008103840a8200581c00000000000000000000000000000000000000000000\ + 000000000000581c111111111111111111111111111111111111111111111111\ + 111111118103840b8200581c0000000000000000000000000000000000000000\ + 0000000000000000581c11111111111111111111111111111111111111111111\ + 1111111111111a002dc6c0840c8200581c000000000000000000000000000000\ + 0000000000000000000000000081031a002dc6c0850d8200581c000000000000\ + 00000000000000000000000000000000000000000000581c1111111111111111\ + 111111111111111111111111111111111111111181031a002dc6c0830e820058\ + 1c00000000000000000000000000000000000000000000000000000000820058\ + 1c22222222222222222222222222222222222222222222222222222222830f82\ + 00581c00000000000000000000000000000000000000000000000000000000f6\ + 84108200581c0000000000000000000000000000000000000000000000000000\ + 00001a002dc6c0f683118200581c000000000000000000000000000000000000\ + 000000000000000000001a002dc6c083128200581c0000000000000000000000\ + 0000000000000000000000000000000000f683028201581c9b24324046544393\ + 443e1fb35c8b72c3c39e18a516a95df5f6654101581c11111111111111111111\ + 11111111111111111111111111111111111102182a151a00989680160ea20581\ + 840214d87980821a000f42401a05f5e1000781587d587b010100323232323232\ + 3225333333008001153330033370e900018029baa00115333007300637540022\ + 4a66600894452615330054911856616c696461746f722072657475726e656420\ + 66616c73650013656002002002002002002153300249010b5f746d70313a2056\ + 6f696400165734ae7155ceaab9e5573eae91f5f6", + "8182582000000000000000000000000000000000000000000000000000000000\ + 0000000000", + "81a200581d600000000000000000000000000000000000000000000000000000\ + 0000011a000f4240", + ) + .into_script_context(&redeemer, None) + .unwrap(); + + // NOTE: The initial snapshot has been generated using the Haskell + // implementation of the ledger library for that same serialized + // transactions. It is meant to control that our construction of the + // script context and its serialization matches exactly those + // from the Haskell ledger / cardano node. + insta::assert_debug_snapshot!(script_context.to_plutus_data()); + } } diff --git a/crates/uplc/src/tx/snapshots/uplc__tx__script_context__tests__script_context_certificates.snap b/crates/uplc/src/tx/snapshots/uplc__tx__script_context__tests__script_context_certificates.snap new file mode 100644 index 00000000..5349e185 --- /dev/null +++ b/crates/uplc/src/tx/snapshots/uplc__tx__script_context__tests__script_context_certificates.snap @@ -0,0 +1,2191 @@ +--- +source: crates/uplc/src/tx/script_context.rs +expression: script_context.to_plutus_data() +--- +Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Array( + [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 0, + }, + ), + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + Map( + Def( + [ + ( + BoundedBytes( + BoundedBytes( + [], + ), + ), + Map( + Def( + [ + ( + BoundedBytes( + BoundedBytes( + [], + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1000000, + }, + ), + ), + ), + ), + ], + ), + ), + ), + ], + ), + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + ], + }, + ), + ], + ), + Array( + [], + ), + Array( + [], + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 42, + }, + ), + ), + ), + Map( + Def( + [], + ), + ), + Array( + [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 1280, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + ], + ), + ), + BoundedBytes( + BoundedBytes( + [ + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 1281, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + ], + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1337, + }, + ), + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 3000000, + }, + ), + ), + ), + ], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 3000000, + }, + ), + ), + ), + ], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 123, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + ], + }, + ), + ], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 123, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + ], + }, + ), + ], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 123, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 123, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 123, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 123, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 123, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + ], + ), + ), + Constr( + Constr { + tag: 123, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 124, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + ], + ), + ), + ], + }, + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 3000000, + }, + ), + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 124, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 123, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 3000000, + }, + ), + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 124, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 123, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + ], + ), + ), + Constr( + Constr { + tag: 123, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 3000000, + }, + ), + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 1282, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + ], + ), + ), + ], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 1283, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 125, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 3000000, + }, + ), + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 127, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 3000000, + }, + ), + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 126, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 123, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 155, + 36, + 50, + 64, + 70, + 84, + 67, + 147, + 68, + 62, + 31, + 179, + 92, + 139, + 114, + 195, + 195, + 158, + 24, + 165, + 22, + 169, + 93, + 245, + 246, + 101, + 65, + 1, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + ], + ), + ), + ], + }, + ), + ], + }, + ), + ], + ), + Map( + Def( + [], + ), + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 123, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + ], + }, + ), + Array( + [], + ), + Map( + Def( + [ + ( + Constr( + Constr { + tag: 124, + any_constructor: None, + fields: [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 20, + }, + ), + ), + ), + Constr( + Constr { + tag: 123, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 155, + 36, + 50, + 64, + 70, + 84, + 67, + 147, + 68, + 62, + 31, + 179, + 92, + 139, + 114, + 195, + 195, + 158, + 24, + 165, + 22, + 169, + 93, + 245, + 246, + 101, + 65, + 1, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + ], + ), + ), + ], + }, + ), + ], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [], + }, + ), + ), + ], + ), + ), + Map( + Def( + [], + ), + ), + BoundedBytes( + BoundedBytes( + [ + 128, + 191, + 104, + 206, + 210, + 197, + 11, + 135, + 52, + 252, + 140, + 235, + 208, + 160, + 73, + 225, + 110, + 83, + 210, + 254, + 94, + 199, + 228, + 40, + 34, + 240, + 124, + 38, + 60, + 237, + 152, + 171, + ], + ), + ), + Map( + Def( + [], + ), + ), + Array( + [], + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 10000000, + }, + ), + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 14, + }, + ), + ), + ), + ], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 124, + any_constructor: None, + fields: [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 20, + }, + ), + ), + ), + Constr( + Constr { + tag: 123, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 155, + 36, + 50, + 64, + 70, + 84, + 67, + 147, + 68, + 62, + 31, + 179, + 92, + 139, + 114, + 195, + 195, + 158, + 24, + 165, + 22, + 169, + 93, + 245, + 246, + 101, + 65, + 1, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + ], + ), + ), + ], + }, + ), + ], + }, + ), + ], + }, + ), + ], + }, +) diff --git a/crates/uplc/src/tx/to_plutus_data.rs b/crates/uplc/src/tx/to_plutus_data.rs index e6e4e7d3..7dc4d78e 100644 --- a/crates/uplc/src/tx/to_plutus_data.rs +++ b/crates/uplc/src/tx/to_plutus_data.rs @@ -10,11 +10,13 @@ use num_integer::Integer; use pallas_addresses::{ Address, ShelleyDelegationPart, ShelleyPaymentPart, StakeAddress, StakePayload, }; -use pallas_codec::utils::{AnyUInt, Bytes, Int, KeyValuePairs, NonEmptyKeyValuePairs, Nullable}; +use pallas_codec::utils::{ + AnyUInt, Bytes, Int, KeyValuePairs, NonEmptyKeyValuePairs, Nullable, PositiveCoin, +}; use pallas_crypto::hash::Hash; use pallas_primitives::conway::{ - AssetName, BigInt, Certificate, Coin, Constitution, Constr, DRepVotingThresholds, DatumOption, - ExUnitPrices, ExUnits, GovAction, GovActionId, Mint, PlutusData, PolicyId, + AssetName, BigInt, Certificate, Coin, Constitution, Constr, DRep, DRepVotingThresholds, + DatumOption, ExUnitPrices, ExUnits, GovAction, GovActionId, Mint, PlutusData, PolicyId, PoolVotingThresholds, ProposalProcedure, ProtocolParamUpdate, PseudoScript, RationalNumber, Redeemer, ScriptRef, StakeCredential, TransactionInput, TransactionOutput, Value, }; @@ -47,6 +49,8 @@ struct WithOptionDatum<'a, T>(&'a T); struct WithArrayRational<'a, T>(&'a T); +struct WithPartialCertificates<'a, T>(&'a T); + pub trait ToPlutusData { fn to_plutus_data(&self) -> PlutusData; } @@ -268,6 +272,12 @@ impl ToPlutusData for usize { } } +impl ToPlutusData for PositiveCoin { + fn to_plutus_data(&self) -> PlutusData { + u64::from(self).to_plutus_data() + } +} + impl<'a> ToPlutusData for WithZeroAdaAsset<'a, Value> { fn to_plutus_data(&self) -> PlutusData { match self.0 { @@ -487,15 +497,27 @@ impl ToPlutusData for StakeCredential { } } -impl ToPlutusData for Certificate { +impl<'a> ToPlutusData for WithPartialCertificates<'a, Vec> { fn to_plutus_data(&self) -> PlutusData { - match self { + self.0 + .iter() + .map(WithPartialCertificates) + .collect::>() + .to_plutus_data() + } +} + +impl<'a> ToPlutusData for WithPartialCertificates<'a, Certificate> { + fn to_plutus_data(&self) -> PlutusData { + match self.0 { Certificate::StakeRegistration(stake_credential) => { wrap_with_constr(0, stake_credential.to_plutus_data()) } + Certificate::StakeDeregistration(stake_credential) => { wrap_with_constr(1, stake_credential.to_plutus_data()) } + Certificate::StakeDelegation(stake_credential, pool_keyhash) => { wrap_multiple_with_constr( 2, @@ -505,6 +527,7 @@ impl ToPlutusData for Certificate { ], ) } + Certificate::PoolRegistration { operator, vrf_keyhash, @@ -519,22 +542,181 @@ impl ToPlutusData for Certificate { 3, vec![operator.to_plutus_data(), vrf_keyhash.to_plutus_data()], ), + Certificate::PoolRetirement(pool_keyhash, epoch) => wrap_multiple_with_constr( 4, vec![pool_keyhash.to_plutus_data(), epoch.to_plutus_data()], ), - _ => todo!("other certificates"), // Reg(StakeCredential, Coin), - // UnReg(StakeCredential, Coin), - // VoteDeleg(StakeCredential, DRep), - // StakeVoteDeleg(StakeCredential, PoolKeyhash, DRep), - // StakeRegDeleg(StakeCredential, PoolKeyhash, Coin), - // VoteRegDeleg(StakeCredential, DRep, Coin), - // StakeVoteRegDeleg(StakeCredential, PoolKeyhash, DRep, Coin), - // AuthCommitteeHot(CommitteeColdCredential, CommitteeHotCredential), - // ResignCommitteeCold(CommitteeColdCredential, Nullable), - // RegDRepCert(DRepCredential, Coin, Nullable), - // UnRegDRepCert(DRepCredential, Coin), - // UpdateDRepCert(StakeCredential, Nullable), + + certificate => unreachable!("unexpected in V1/V2 script context: {certificate:?}"), + } + } +} + +impl ToPlutusData for Certificate { + fn to_plutus_data(&self) -> PlutusData { + match self { + Certificate::StakeRegistration(stake_credential) => wrap_multiple_with_constr( + 0, + vec![ + stake_credential.to_plutus_data(), + None::.to_plutus_data(), + ], + ), + + Certificate::Reg(stake_credential, deposit) => wrap_multiple_with_constr( + 0, + vec![ + stake_credential.to_plutus_data(), + Some(*deposit).to_plutus_data(), + ], + ), + + Certificate::StakeDeregistration(stake_credential) => wrap_multiple_with_constr( + 1, + vec![ + stake_credential.to_plutus_data(), + None::.to_plutus_data(), + ], + ), + + Certificate::UnReg(stake_credential, deposit) => wrap_multiple_with_constr( + 1, + vec![ + stake_credential.to_plutus_data(), + Some(*deposit).to_plutus_data(), + ], + ), + + Certificate::StakeDelegation(stake_credential, pool_id) => wrap_multiple_with_constr( + 2, + vec![ + stake_credential.to_plutus_data(), + wrap_with_constr(0, pool_id.to_plutus_data()), + ], + ), + + Certificate::VoteDeleg(stake_credential, drep) => wrap_multiple_with_constr( + 2, + vec![ + stake_credential.to_plutus_data(), + wrap_with_constr(1, drep.to_plutus_data()), + ], + ), + + Certificate::StakeVoteDeleg(stake_credential, pool_id, drep) => { + wrap_multiple_with_constr( + 2, + vec![ + stake_credential.to_plutus_data(), + wrap_multiple_with_constr( + 2, + vec![pool_id.to_plutus_data(), drep.to_plutus_data()], + ), + ], + ) + } + + Certificate::StakeRegDeleg(stake_credential, pool_id, deposit) => { + wrap_multiple_with_constr( + 3, + vec![ + stake_credential.to_plutus_data(), + wrap_multiple_with_constr(0, vec![pool_id.to_plutus_data()]), + deposit.to_plutus_data(), + ], + ) + } + + Certificate::VoteRegDeleg(stake_credential, drep, deposit) => { + wrap_multiple_with_constr( + 3, + vec![ + stake_credential.to_plutus_data(), + wrap_multiple_with_constr(1, vec![drep.to_plutus_data()]), + deposit.to_plutus_data(), + ], + ) + } + + Certificate::StakeVoteRegDeleg(stake_credential, pool_id, drep, deposit) => { + wrap_multiple_with_constr( + 3, + vec![ + stake_credential.to_plutus_data(), + wrap_multiple_with_constr( + 2, + vec![pool_id.to_plutus_data(), drep.to_plutus_data()], + ), + deposit.to_plutus_data(), + ], + ) + } + + Certificate::RegDRepCert(drep_credential, deposit, _anchor) => { + wrap_multiple_with_constr( + 4, + vec![drep_credential.to_plutus_data(), deposit.to_plutus_data()], + ) + } + + Certificate::UpdateDRepCert(drep_credential, _anchor) => { + wrap_multiple_with_constr(5, vec![drep_credential.to_plutus_data()]) + } + + Certificate::UnRegDRepCert(drep_credential, deposit) => wrap_multiple_with_constr( + 6, + vec![drep_credential.to_plutus_data(), deposit.to_plutus_data()], + ), + + Certificate::PoolRegistration { + operator, + vrf_keyhash, + pledge: _, + cost: _, + margin: _, + reward_account: _, + pool_owners: _, + relays: _, + pool_metadata: _, + } => wrap_multiple_with_constr( + 7, + vec![operator.to_plutus_data(), vrf_keyhash.to_plutus_data()], + ), + + Certificate::PoolRetirement(pool_keyhash, epoch) => wrap_multiple_with_constr( + 8, + vec![pool_keyhash.to_plutus_data(), epoch.to_plutus_data()], + ), + + Certificate::AuthCommitteeHot(cold_credential, hot_credential) => { + wrap_multiple_with_constr( + 9, + vec![ + cold_credential.to_plutus_data(), + hot_credential.to_plutus_data(), + ], + ) + } + + Certificate::ResignCommitteeCold(cold_credential, _anchor) => { + wrap_multiple_with_constr(10, vec![cold_credential.to_plutus_data()]) + } + } + } +} + +impl ToPlutusData for DRep { + fn to_plutus_data(&self) -> PlutusData { + match self { + DRep::Key(hash) => { + wrap_with_constr(0, StakeCredential::AddrKeyhash(*hash).to_plutus_data()) + } + DRep::Script(hash) => { + wrap_with_constr(0, StakeCredential::Scripthash(*hash).to_plutus_data()) + } + DRep::Abstain => empty_constr(1), + DRep::NoConfidence => empty_constr(2), } } } @@ -1147,7 +1329,7 @@ impl ToPlutusData for TxInfo { WithOptionDatum(&WithZeroAdaAsset(&tx_info.outputs)).to_plutus_data(), WithZeroAdaAsset(&tx_info.fee).to_plutus_data(), WithZeroAdaAsset(&tx_info.mint).to_plutus_data(), - tx_info.certificates.to_plutus_data(), + WithPartialCertificates(&tx_info.certificates).to_plutus_data(), WithWrappedStakeCredential(&tx_info.withdrawals).to_plutus_data(), tx_info.valid_range.to_plutus_data(), tx_info.signatories.to_plutus_data(), @@ -1164,7 +1346,7 @@ impl ToPlutusData for TxInfo { WithZeroAdaAsset(&tx_info.outputs).to_plutus_data(), WithZeroAdaAsset(&tx_info.fee).to_plutus_data(), WithZeroAdaAsset(&tx_info.mint).to_plutus_data(), - tx_info.certificates.to_plutus_data(), + WithPartialCertificates(&tx_info.certificates).to_plutus_data(), WithWrappedStakeCredential(&tx_info.withdrawals).to_plutus_data(), tx_info.valid_range.to_plutus_data(), tx_info.signatories.to_plutus_data(), @@ -1190,8 +1372,8 @@ impl ToPlutusData for TxInfo { tx_info.id.to_plutus_data(), Data::map(vec![]), // TODO tx_info.votes :: Map Voter (Map GovernanceActionId Vote) tx_info.proposal_procedures.to_plutus_data(), - empty_constr(1), // TODO tx_info.current_treasury_amount :: Haskell.Maybe V2.Lovelace - empty_constr(1), // TODO tx_info.treasury_donation :: Haskell.Maybe V2.Lovelace + tx_info.current_treasury_amount.to_plutus_data(), + tx_info.treasury_donation.to_plutus_data(), ], ), } diff --git a/examples/acceptance_tests/script_context/v3/README.md b/examples/acceptance_tests/script_context/v3/README.md index 77b88791..856efe2c 100644 --- a/examples/acceptance_tests/script_context/v3/README.md +++ b/examples/acceptance_tests/script_context/v3/README.md @@ -23,7 +23,7 @@ for convenience. - [x] spend - [x] mint - [ ] withdraw - - [ ] publish + - [x] publish - [ ] voting - [x] proposing @@ -41,20 +41,20 @@ for convenience. - [x] none - some - Register credential - - [ ] no deposit - - [ ] with deposit + - [x] no deposit + - [x] with deposit - Unregister credential - - [ ] no deposit - - [ ] with deposit - - [ ] Delegate - - [ ] Register & delegate credential - - [ ] Register drep - - [ ] Unregister drep - - [ ] Update drep - - [ ] Register pool - - [ ] Retire pool - - [ ] Delegate CC - - [ ] Retire CC + - [x] no deposit + - [x] with deposit + - [x] Delegate + - [x] Register & delegate credential + - [x] Register drep + - [x] Unregister drep + - [x] Update drep + - [x] Register pool + - [x] Retire pool + - [x] Delegate CC + - [x] Retire CC - withdrawals - [x] none - [ ] some @@ -71,10 +71,10 @@ for convenience. - [x] none - [x] some - current treasury - - [ ] with + - [x] with - [x] without - treasury donation - - [ ] with + - [x] with - [x] without - Address @@ -102,8 +102,8 @@ for convenience. - Governance Action - parameter change - - [ ] with action id - - [ ] without action id + - [x] with action id + - [x] without action id - hardfork initiation - [x] with action id - [x] without action id @@ -172,15 +172,15 @@ for convenience. - [x] script - Delegatee - - [ ] pool - - [ ] drep - - [ ] pool + drep + - [x] pool + - [x] drep + - [x] pool + drep - DRep - - [ ] key - - [ ] script - - [ ] abstain - - [ ] no confidence + - [x] key + - [x] script + - [x] abstain + - [x] no confidence - Boundary - [ ] closed diff --git a/examples/acceptance_tests/script_context/v3/ctx/certificates/resolved_inputs.template b/examples/acceptance_tests/script_context/v3/ctx/certificates/resolved_inputs.template new file mode 100644 index 00000000..dc99bdb5 --- /dev/null +++ b/examples/acceptance_tests/script_context/v3/ctx/certificates/resolved_inputs.template @@ -0,0 +1,5 @@ +[ + { 0: h'6000000000000000000000000000000000000000000000000000000000' + , 1: 1000000 + } +] diff --git a/examples/acceptance_tests/script_context/v3/ctx/certificates/tx.template b/examples/acceptance_tests/script_context/v3/ctx/certificates/tx.template new file mode 100644 index 00000000..8e96ec3d --- /dev/null +++ b/examples/acceptance_tests/script_context/v3/ctx/certificates/tx.template @@ -0,0 +1,118 @@ +[ + { 0: + [ [h'0000000000000000000000000000000000000000000000000000000000000000', 0] + ] + + , 1: + [] + + , 4: + [ [0, [1, h'22222222222222222222222222222222222222222222222222222222' ] ] + , [0, [0, h'00000000000000000000000000000000000000000000000000000000' ] ] + , [1, [0, h'00000000000000000000000000000000000000000000000000000000' ] ] + , [ 3 + , h'11111111111111111111111111111111111111111111111111111111' + , h'9999999999999999999999999999999999999999999999999999999999999999' + , 1000000 + , 340 + , 30([1, 100]) + , h'E000000000000000000000000000000000000000000000000000000000' + , 258([]) + , [] + , null + ] + , [ 4 + , h'11111111111111111111111111111111111111111111111111111111' + , 1337 + ] + , [ 7 + , [0, h'00000000000000000000000000000000000000000000000000000000' ] + , 3000000 + ] + , [ 8 + , [0, h'00000000000000000000000000000000000000000000000000000000' ] + , 3000000 + ] + , [ 9 + , [0, h'00000000000000000000000000000000000000000000000000000000' ] + , [0, h'00000000000000000000000000000000000000000000000000000000' ] + ] + , [ 9 + , [0, h'00000000000000000000000000000000000000000000000000000000' ] + , [1, h'00000000000000000000000000000000000000000000000000000000' ] + ] + , [ 9 + , [0, h'00000000000000000000000000000000000000000000000000000000' ] + , [ 2 ] + ] + , [ 9 + , [0, h'00000000000000000000000000000000000000000000000000000000' ] + , [ 3 ] + ] + , [ 10 + , [0, h'00000000000000000000000000000000000000000000000000000000' ] + , h'11111111111111111111111111111111111111111111111111111111' + , [ 3 ] + ] + , [ 11 + , [0, h'00000000000000000000000000000000000000000000000000000000' ] + , h'11111111111111111111111111111111111111111111111111111111' + , 3000000 + ] + , [ 12 + , [0, h'00000000000000000000000000000000000000000000000000000000' ] + , [ 3 ] + , 3000000 + ] + , [ 13 + , [0, h'00000000000000000000000000000000000000000000000000000000' ] + , h'11111111111111111111111111111111111111111111111111111111' + , [ 3 ] + , 3000000 + ] + , [ 14 + , [0, h'00000000000000000000000000000000000000000000000000000000' ] + , [0, h'22222222222222222222222222222222222222222222222222222222' ] + ] + , [ 15 + , [0, h'00000000000000000000000000000000000000000000000000000000' ] + , null + ] + , [ 16 + , [0, h'00000000000000000000000000000000000000000000000000000000' ] + , 3000000 + , null + ] + , [ 17 + , [0, h'00000000000000000000000000000000000000000000000000000000' ] + , 3000000 + ] + , [ 18 + , [0, h'00000000000000000000000000000000000000000000000000000000' ] + , null + ] + , [ 2 + , [ 1 + , h'{{ certificates.script.hash }}' + ] + , h'11111111111111111111111111111111111111111111111111111111' + ] + ] + + , 2: 42 + + , 21: 10000000 + + , 22: 14 + + }, + + { 5: [[2, 20, 121([]), [1000000, 100000000]]] + + , 7: [h'{{ certificates.script.cbor }}'] + }, + + true, + + null +] diff --git a/examples/acceptance_tests/script_context/v3/plutus.json b/examples/acceptance_tests/script_context/v3/plutus.json index 8a3576cb..e0e1a335 100644 --- a/examples/acceptance_tests/script_context/v3/plutus.json +++ b/examples/acceptance_tests/script_context/v3/plutus.json @@ -11,6 +11,17 @@ "license": "Apache-2.0" }, "validators": [ + { + "title": "certificates.script", + "redeemer": { + "title": "_tmp1", + "schema": { + "$ref": "#/definitions/Void" + } + }, + "compiledCode": "591a0301010032323232323232323232323232322533333300f00115332330083001300a37540042a66601860166ea8008494ccc024c8c8c8c94ccc034c018c03cdd50008a99980699b87482036b1024dd6980998081baa001132533300e3007301037540022a66601c66e1d201c375a602860226ea80044c8c94ccc040cdd7a612dd8799fd8799fd87a9f581c22222222222222222222222222222222222222222222222222222222ffd87a80ffff00330010054800054ccc040cdd7a612dd8799fd8799fd8799f581c00000000000000000000000000000000000000000000000000000000ffd87a80ffff00330010054800854ccc040cdd7a612dd8799fd87a9fd8799f581c00000000000000000000000000000000000000000000000000000000ffd87a80ffff00330010054801054ccc040cdd7a6149d8799fd905009f581c1111111111111111111111111111111111111111111111111111111158209999999999999999999999999999999999999999999999999999999999999999ffff00330010054801854ccc040cdd7a612ad8799fd905019f581c11111111111111111111111111111111111111111111111111111111190539ffff00330010054802054ccc040cdd7a6133d8799fd8799fd8799f581c00000000000000000000000000000000000000000000000000000000ffd8799f1a002dc6c0ffffff00330010054802854ccc040cdd7a6133d8799fd87a9fd8799f581c00000000000000000000000000000000000000000000000000000000ffd8799f1a002dc6c0ffffff00330010054803054ccc040cdd7a6154d8799fd87b9fd8799f581c00000000000000000000000000000000000000000000000000000000ffd87a9fd8799fd8799f581c00000000000000000000000000000000000000000000000000000000ffffffffff00330010054803854ccc040cdd7a6154d8799fd87b9fd8799f581c00000000000000000000000000000000000000000000000000000000ffd87a9fd8799fd87a9f581c00000000000000000000000000000000000000000000000000000000ffffffffff00330010054804054ccc040cdd7a6131d8799fd87b9fd8799f581c00000000000000000000000000000000000000000000000000000000ffd87a9fd87a80ffffff00330010054804854ccc040cdd7a6131d8799fd87b9fd8799f581c00000000000000000000000000000000000000000000000000000000ffd87a9fd87b80ffffff00330010054805054ccc040cdd7a614fd8799fd87b9fd8799f581c00000000000000000000000000000000000000000000000000000000ffd87b9f581c11111111111111111111111111111111111111111111111111111111d87b80ffffff00330010054805854ccc040cdd7a6151d8799fd87c9fd8799f581c00000000000000000000000000000000000000000000000000000000ffd8799f581c11111111111111111111111111111111111111111111111111111111ff1a002dc6c0ffff00330010054806054ccc040cdd7a6136d8799fd87c9fd8799f581c00000000000000000000000000000000000000000000000000000000ffd87a9fd87b80ff1a002dc6c0ffff00330010054806854ccc040cdd7a6154d8799fd87c9fd8799f581c00000000000000000000000000000000000000000000000000000000ffd87b9f581c11111111111111111111111111111111111111111111111111111111d87b80ff1a002dc6c0ffff00330010054807054ccc040cdd7a614dd8799fd905029fd8799f581c00000000000000000000000000000000000000000000000000000000ffd8799f581c22222222222222222222222222222222222222222222222222222222ffffff00330010054807854ccc040cdd7a612bd8799fd905039fd8799f581c00000000000000000000000000000000000000000000000000000000ffffff00330010054808054ccc040cdd7a612fd8799fd87d9fd8799f581c00000000000000000000000000000000000000000000000000000000ff1a002dc6c0ffff00330010054808854ccc040cdd7a612fd8799fd87f9fd8799f581c00000000000000000000000000000000000000000000000000000000ff1a002dc6c0ffff00330010054809054ccc040cdd7a612ad8799fd87e9fd8799f581c00000000000000000000000000000000000000000000000000000000ffffff0033001005480984c94ccc044c028c04cdd5000899299980919b8748010c050dd500089919299980a19b8748008c058dd5180d0010a99980a1806980b1baa00114a202202260326034002602a6ea800403cc05cc050dd500080719800802a40502a660229201a56578706563740a202020202020536f6d65280a202020202020202055706461746544656c6567617465526570726573656e746174697665207b0a2020202020202020202064656c65676174655f726570726573656e7461746976653a20566572696669636174696f6e4b6579286f6e6c793073292c0a20202020202020207d2c0a20202020202029203d3d206c6973742e6174286365727469666963617465732c2031392900161533011491c66578706563740a202020202020536f6d65280a2020202020202020556e726567697374657244656c6567617465526570726573656e746174697665207b0a2020202020202020202064656c65676174655f726570726573656e7461746976653a20566572696669636174696f6e4b6579286f6e6c793073292c0a20202020202020202020726566756e643a20335f3030305f3030302c0a20202020202020207d2c0a20202020202029203d3d206c6973742e6174286365727469666963617465732c2031382900161533011491c56578706563740a202020202020536f6d65280a2020202020202020526567697374657244656c6567617465526570726573656e746174697665207b0a2020202020202020202064656c65676174655f726570726573656e7461746976653a20566572696669636174696f6e4b6579286f6e6c793073292c0a202020202020202020206465706f7369743a20335f3030305f3030302c0a20202020202020207d2c0a20202020202029203d3d206c6973742e6174286365727469666963617465732c2031372900161533011491b26578706563740a202020202020536f6d65280a202020202020202052657469726546726f6d436f6e737469747574696f6e616c436f6d6d6974746565207b0a20202020202020202020636f6e737469747574696f6e616c5f636f6d6d69747465655f6d656d6265723a20566572696669636174696f6e4b6579286f6e6c793073292c0a20202020202020207d2c0a20202020202029203d3d206c6973742e6174286365727469666963617465732c2031362900161533011491e06578706563740a202020202020536f6d65280a2020202020202020417574686f72697a65436f6e737469747574696f6e616c436f6d6d697474656550726f7879207b0a20202020202020202020636f6e737469747574696f6e616c5f636f6d6d69747465655f6d656d6265723a20566572696669636174696f6e4b6579286f6e6c793073292c0a2020202020202020202070726f78793a20566572696669636174696f6e4b6579286f6e6c793273292c0a20202020202020207d2c0a20202020202029203d3d206c6973742e6174286365727469666963617465732c2031352900161533011491ff6578706563740a202020202020536f6d65280a20202020202020205265676973746572416e6444656c656761746543726564656e7469616c207b0a2020202020202020202063726564656e7469616c3a20566572696669636174696f6e4b6579286f6e6c793073292c0a2020202020202020202064656c65676174653a2044656c6567617465426f7468207b0a2020202020202020202020207374616b655f706f6f6c3a206f6e6c7931732c0a20202020202020202020202064656c65676174655f726570726573656e7461746976653a20416c776179734e6f436f6e666964656e63652c0a202020202020202020207d2c0a20202020202020202020646541706f7369743a20335f3030305f3030302c0a20202020202020207d2c0a20202020202029203d3d206c6973742e6174286365727469666963617465732c2031342900161533011491ed6578706563740a202020202020536f6d65280a20202020202020205265676973746572416e6444656c656761746543726564656e7469616c207b0a2020202020202020202063726564656e7469616c3a20566572696669636174696f6e4b6579286f6e6c793073292c0a2020202020202020202064656c65676174653a2044656c6567617465566f746528416c776179734e6f436f6e666964656e6365292c0a202020202020202020206465706f7369743a20335f3030305f3030302c0a20202020202020207d2c0a20202020202029203d3d206c6973742e6174286365727469666963617465732c2031332900161533011491ec6578706563740a202020202020536f6d65280a20202020202020205265676973746572416e6444656c656761746543726564656e7469616c207b0a2020202020202020202063726564656e7469616c3a20566572696669636174696f6e4b6579286f6e6c793073292c0a2020202020202020202064656c65676174653a2044656c6567617465426c6f636b50726f64756374696f6e286f6e6c793173292c0a202020202020202020206465706f7369743a20335f3030305f3030302c0a20202020202020207d2c0a20202020202029203d3d206c6973742e6174286365727469666963617465732c2031322900161533011491ff6578706563740a202020202020536f6d65280a202020202020202044656c656761746543726564656e7469616c207b0a2020202020202020202063726564656e7469616c3a20566572696669636174696f6e4b6579286f6e6c793073292c0a2020202020202020202064656c65676174653a2044656c6567617465426f7468207b0a2020202020202020202020207374616b655f706f6f6c3a206f6e6c7931732c0a20202020202020202020202064656c65676174655f726570726573656e7461746976653a20416c776179734e6f436f6e666964656e63652c0a202020202020202020207d2c0a20202020202020207d2c0a20202020202029203d3d206c186973742e6174286365727469666963617465732c2031312900161533011491c46578706563740a202020202020536f6d65280a202020202020202044656c656761746543726564656e7469616c207b0a2020202020202020202063726564656e7469616c3a20566572696669636174696f6e4b6579286f6e6c793073292c0a2020202020202020202064656c65676174653a2044656c6567617465566f746528416c776179734e6f436f6e666964656e6365292c0a20202020202020207d2c0a20202020202029203d3d206c6973742e6174286365727469666963617465732c2031302900161533011491be6578706563740a202020202020536f6d65280a202020202020202044656c656761746543726564656e7469616c207b0a2020202020202020202063726564656e7469616c3a20566572696669636174696f6e4b6579286f6e6c793073292c0a2020202020202020202064656c65676174653a2044656c6567617465566f746528416c776179734162737461696e292c0a20202020202020207d2c0a20202020202029203d3d206c6973742e6174286365727469666963617465732c20392900161533011491cb6578706563740a202020202020536f6d65280a202020202020202044656c656761746543726564656e7469616c207b0a2020202020202020202063726564656e7469616c3a20566572696669636174696f6e4b6579286f6e6c793073292c0a2020202020202020202064656c65676174653a2044656c6567617465566f7465285265676973746572656428536372697074286f6e6c7930732929292c0a20202020202020207d2c0a20202020202029203d3d206c6973742e6174286365727469666963617465732c20382900161533011491d46578706563740a202020202020536f6d65280a202020202020202044656c656761746543726564656e7469616c207b0a2020202020202020202063726564656e7469616c3a20566572696669636174696f6e4b6579286f6e6c793073292c0a2020202020202020202064656c65676174653a2044656c6567617465566f7465285265676973746572656428566572696669636174696f6e4b6579286f6e6c7930732929292c0a20202020202020207d2c0a20202020202029203d3d206c6973742e6174286365727469666963617465732c20372900161533011491b26578706563740a202020202020536f6d65280a2020202020202020556e726567697374657243726564656e7469616c207b0a2020202020202020202063726564656e7469616c3a20566572696669636174696f6e4b6579286f6e6c793073292c0a20202020202020202020726566756e643a20536f6d6528335f3030305f303030292c0a20202020202020207d2c0a20202020202029203d3d206c6973742e6174286365727469666963617465732c20362900161533011491b16578706563740a202020202020536f6d65280a2020202020202020526567697374657243726564656e7469616c207b0a2020202020202020202063726564656e7469616c3a20566572696669636174696f6e4b6579286f6e6c793073292c0a202020202020202020206465706f7369743a20536f6d6528335f3030305f303030292c0a20202020202020207d2c0a20202020202029203d3d206c6973742e6174286365727469666963617465732c203529001615330114917e6578706563740a202020202020536f6d65285265746972655374616b65506f6f6c207b207374616b655f706f6f6c3a206f6e6c7931732c2061745f65706f63683a2031333337207d29203d3d206c6973742e6174280a20202020202020206365727469666963617465732c0a2020202020202020342c0a20202020202029001615330114917d6578706563740a202020202020536f6d652852656769737465725374616b65506f6f6c207b207374616b655f706f6f6c3a206f6e6c7931732c207672663a206f6e6c793973207d29203d3d206c6973742e6174280a20202020202020206365727469666963617465732c0a2020202020202020332c0a2020202020202900161533011491a76578706563740a202020202020536f6d65280a2020202020202020556e726567697374657243726564656e7469616c207b0a2020202020202020202063726564656e7469616c3a20566572696669636174696f6e4b6579286f6e6c793073292c0a20202020202020202020726566756e643a204e6f6e652c0a20202020202020207d2c0a20202020202029203d3d206c6973742e6174286365727469666963617465732c20322900161533011491a66578706563740a202020202020536f6d65280a2020202020202020526567697374657243726564656e7469616c207b0a2020202020202020202063726564656e7469616c3a20566572696669636174696f6e4b6579286f6e6c793073292c0a202020202020202020206465706f7369743a204e6f6e652c0a20202020202020207d2c0a20202020202029203d3d206c6973742e6174286365727469666963617465732c20312900161533011491886578706563740a202020202020536f6d6528526567697374657243726564656e7469616c207b2063726564656e7469616c3a20536372697074286f6e6c793273292c206465706f7369743a204e6f6e65207d29203d3d206c6973742e6174280a20202020202020206365727469666963617465732c0a2020202020202020302c0a2020202020202900163001001222533301500214c103d87a8000132325333013300c00313374a90001980c00125eb804ccc014014004cdc0001a40026032006602e004014014602660286028602860286028602860286028602860286028602860286028602860206ea8c00cc040dd500280400418091809980998099809980998099809980998099809980998099809980998079baa3002300f37540086eb0c044c048c048c048c048c048c038dd5180098071baa0032301100132533300a3370e900318061baa00113232533300c3370e90141bad30120021533300c3370e900218071baa00113232533300e3375e98122d8799f581c11111111111111111111111111111111111111111111111111111111ff00301430150021533300e3370e900118081baa001149854cc03d24011e65787065637420536372697074282e2e29203d2063726564656e7469616c0016153300f491416578706563742044656c6567617465426c6f636b50726f64756374696f6e207b207374616b655f706f6f6c3a206f6e6c793173207d203d3d2064656c656761746500163013001300f375400201601660226024002601a6ea8004024c03cc040c040c030dd50008a4c2a6601492011856616c696461746f722072657475726e65642066616c73650013656006370e90000028028028028028a9980324814165787065637420536f6d652831305f3030305f30303029203d206374782e7472616e73616374696f6e2e63757272656e745f74726561737572795f616d6f756e74001615330054913365787065637420536f6d6528313429203d206374782e7472616e73616374696f6e2e74726561737572795f646f6e6174696f6e001615330044918e65787065637420536f6d652844656c656761746543726564656e7469616c207b0a20202020202063726564656e7469616c3a20536372697074282e2e292c0a20202020202064656c65676174653a2044656c6567617465426c6f636b50726f64756374696f6e282e2e292c0a202020207d29203d206c6973742e6174286365727469666963617465732c20323029001615330034910b5f746d70313a20566f69640016153300249149657870656374205075626c697368696e672832302c2044656c656761746543726564656e7469616c207b2063726564656e7469616c2c2064656c6567617465207d29203d20696e666f00165734ae7155ceaab9e5573eae815d0aba257481", + "hash": "9d0e90919e83c40a0c1f5be7c2203a78003210e4e52629c33b017bca" + }, { "title": "mint.mint_1", "redeemer": { @@ -52,8 +63,8 @@ "$ref": "#/definitions/Void" } }, - "compiledCode": "591afc01010032323232323232323232323232323232323225333333013001153323300c3001300e37540042a666020601e6ea8008494ccc034c94ccc038cdc3a401460206ea80044c8c94ccc040c014dd6980b0010992999808980318099baa00113232323253330153370e9001180b9baa301b00415333015300a301737540022646464a66603066ebcccc00801520000014c106d8799f182cff00153330183375e66600400a9001000a6109d8799f1a00025ef5ff00153330183375e66600400a9002000a6109d8799f1a00016000ff00153330183375e66600400a9003000a6107d8799f194000ff00153330183375e66600400a9004000a6107d8799f19044cff00153330183375e66600400a9005000a6109d8799f1a001e8480ff00153330183375e66600400a9006000a6109d8799f1a1dcd6500ff00153330183375e66600400a9007000a6105d8799f12ff00153330183375e66600400a9008000a6107d8799f1901f4ff0013232323232533301d3375e666004014900900098041981119801a400c900a25eb8054ccc074cdd799980100524028002601066044660069003241a01e97ae01533301d3375e666004014900b00098041981119801a4004900525eb8054ccc074cdd79998038052404000c980107d8799f190154ff001533301d3375e66600e014901100326107d8799f1910d6ff001533301d3375e66600401490121000a60103d87a80001533301d3375e66600401490131299999981300080e80e899299981180080f0991929998128008100992999813181480109806998139803001998139803000a5eb80084c09c004c09c008c094004dd600080e80e98041981118041981119801a4104129068079981119801a414416904044bd25eb812f5c0264a66603c66ebcccc00c02d20280014c116d8799fd8799f1a00d59f801b00000002540be400ffff001533301e3375e6660060169015000a6116d8799fd8799f1a03b20b801b00000004a817c800ffff001533301e3375e6660100169016003a6107d8799f191388ff001533301e3375e6660100169017003a6106d8799f1896ff001533301e3375e6660100169018003a6105d8799f03ff001533301e3375e66600601690191299999981380080e00e099299981200080e89919299981300080f899192999814000810899192999815000811899192999816000812899299981698180010980a19817180680499817180a198171806803998171806802a5eb80cc0b8c03400ccc0b8c050cc0b8c034004cc0b930103d87980003302e4c103d87980003302e4c103d87980003302e4c103d87980004bd7025eb80098c0b8004c0b8008c0b0004c0b0008c0a8004c0a8008c0a0004c0a0008c098004dd600080e00e26141d8799fd8799fd8799f18331864ffd8799fd8799f0d1819ffd8799f18351864ffffd8799f181b1832ffd8799fd8799f0b14ffd87980d87980d87980d87980ffffff001533301e3375e646464646464666012022901a129981319b964901186472657020766f74696e67207468726573686f6c64733a20003732660040029101001533333302d001021021132533302a00102213232533302c00102413232533302e00102613232533303000102813232533303200102a13232533303400102c13232533303600102e13232533303800103013232533303a00103213232533303c001034132533303d3040002130243303e301d0133303e30243303e301d0113303e301d00f4bd701981f180e8069981f180e8059981f18121981f260103d87980003303e301d0093303e301d0073303e301d0053303e301d0034bd701981f180e800a5eb800d4c0f8004c0f8008c0f0004c0f0008c0e8004c0e8008c0e0004c0e0008c0d8004c0d8008c0d0004c0d0008c0c8004c0c8008c0c0004c0c0008c0b8004c0b8008c0b0004dd6000810810980080091129999199981700189919191919191980600100099b8a489012800002533302a337100069007099b80483c80400c54ccc0a8cdc4001a410004266e00cdc0241002800690068b2999816800899b8a4881035b5d2900005133714911035b5f2000333300800133714911025d290000522333009009002300600122333009009002001375860560046eb4c0a4004c8cdd81ba83029001374e60540026ea800c4c94ccc0ac0044cdc52441027b7d00003133714911037b5f200032323300100100322533302e00110031533302e3031001132333009009302d001337149101023a2000333009009302e0010043030001132333009009302d001337149101023a2000333009009302e001300633003003303200230300013371491102207d000033756006264a666056002266e29221025b5d00003133714911035b5f2000333300600133714911015d000032233300700700230040012233300700700200137580066e292201022c2000133005375a0040022646466e2922010268270000132333001001337006e3400920013371491101270000322253330293371000490000800899191919980300319b8000548004cdc599b80002533302c33710004900a0a40c02903719b8b33700002a66605866e2000520141481805206e0043370c004901019b8300148080cdc70020011bae0022222323300100100522533302b00110051533302b302e001133003302d001005133004302d00133002002302e001223233001001003225333024301900113371491101300000315333024337100029000099b8a489012d0033002002300c00113300533708002900a19b8b3370066e1400520144818000cc0040048894ccc084cdc4801240002002266600600666e1000920143371666e00cdc2801240289030000a615bd8799fd8799fd8799f18431864ffd8799fd8799f18431864ffd8799f0305ffffd8799f0304ffd8799f0305ffd8799fd87980d8799f18431864ffd8799f18431864ffd8799f18431864ffd8799f0304ffffd8799f18431864ffffff001533301e3375e666010016901b003a6105d8799f07ff001533301e3375e666010016901c003a6106d8799f1892ff001533301e3375e666010016901d003a6105d8799f06ff001533301e3375e666010016901e003a610dd8799f1b000000174876e800ff001533301e3375e666010016901f003a6109d8799f1a1dcd6500ff001533301e3375e6660100169020003a6105d8799f14ff001533301e3375e6660060169021001180499811998022403c900125eb805288a9980fa4817d6578706563740a20202020202028206e65775f706172616d6574657273207c3e207265666572656e63655f736372697074735f746965725f6665655f696e697469616c5f666163746f722029203d3d20536f6d65280a20202020202020206578706563745f726174696f6e616c2831352c2031292c0a202020202020290016153301f491546578706563740a20202020202028206e65775f706172616d6574657273207c3e2064656c65676174655f726570726573656e7461746976655f6d61785f69646c655f74696d652029203d3d20536f6d65283230290016153301f491576578706563740a20202020202028206e65775f706172616d6574657273207c3e2064656c65676174655f726570726573656e7461746976655f6465706f7369742029203d3d20536f6d65283530305f3030305f303030290016153301f491576578706563740a20202020202028206e65775f706172616d6574657273207c3e20676f7665726e616e63655f70726f706f73616c5f6465706f7369742029203d3d20536f6d65283130305f3030305f3030305f303030290016153301f491446578706563742028206e65775f706172616d6574657273207c3e20676f7665726e616e63655f70726f706f73616c5f6c69666574696d652029203d3d20536f6d652836290016153301f491546578706563740a20202020202028206e65775f706172616d6574657273207c3e206d61785f636f6e737469747574696f6e616c5f636f6d6d69747465655f6d616e646174652029203d3d20536f6d6528313436290016153301f491496578706563742028206e65775f706172616d6574657273207c3e206d696e5f636f6e737469747574696f6e616c5f636f6d6d69747465655f73697a652029203d3d20536f6d652837290016153301f491786578706563740a20202020202028206e65775f706172616d6574657273207c3e2064656c65676174655f726570726573656e7461746976655f766f74696e675f7468726573686f6c64732029203d3d20536f6d65280a2020202020202020647265705f7468726573686f6c647328292c0a202020202020290016153301f491736578706563740a20202020202028206e65775f706172616d6574657273207c3e207374616b655f706f6f6c5f6f70657261746f725f766f74696e675f7468726573686f6c64732029203d3d20536f6d65280a202020202020202073706f5f7468726573686f6c647328292c0a202020202020290016153301f4913d6578706563742028206e65775f706172616d6574657273207c3e206d61785f636f6c6c61746572616c5f696e707574732029203d3d20536f6d652833290016153301f4913f6578706563742028206e65775f706172616d6574657273207c3e20636f6c6c61746572616c5f70657263656e746167652029203d3d20536f6d6528313530290016153301f491396578706563742028206e65775f706172616d6574657273207c3e206d61785f76616c75655f73697a652029203d3d20536f6d652835303030290016153301f4918c6578706563740a20202020202028206e65775f706172616d6574657273207c3e206d61785f626c6f636b5f657865637574696f6e5f756e6974732029203d3d20536f6d65280a2020202020202020457865637574696f6e556e697473207b206d656d6f72793a2036323030303030302c206370753a203230303030303030303030207d2c0a202020202020290016153301f491926578706563740a20202020202028206e65775f706172616d6574657273207c3e206d61785f7472616e73616374696f6e5f657865637574696f6e5f756e6974732029203d3d20536f6d65280a2020202020202020457865637574696f6e556e697473207b206d656d6f72793a2031343030303030302c206370753a203130303030303030303030207d2c0a2020202020202900162533333302600101c01c132533302300101d132533333302800101e01e01e132325333026001020132533333302b0010210210211325333028302b0031300f330293750008660526ea00052f5c00446eb4004084c0a0004c0a000cdd680080f18128009bac00101c01c153301e4901d56578706563740a20202020202028206e65775f706172616d6574657273207c3e207363726970745f657865637574696f6e5f7072696365732029203d3d20536f6d65280a2020202020202020536372697074457865637574696f6e507269636573207b0a202020202020202020206d656d6f72793a206578706563745f726174696f6e616c283537372c20315f303030292c0a202020202020202020206370753a206578706563745f726174696f6e616c283732312c20315f3030305f303030292c0a20202020202020207d2c0a202020202020290016153301e491306578706563742028206e65775f706172616d6574657273207c3e20636f73745f6d6f64656c732029203d3d204e6f6e650016153301e491476578706563742028206e65775f706172616d6574657273207c3e206d696e5f7574786f5f6465706f7369745f636f656666696369656e742029203d3d20536f6d652834333130290016153301e4913d6578706563742028206e65775f706172616d6574657273207c3e206d696e5f7374616b655f706f6f6c5f636f73742029203d3d20536f6d6528333430290016153301e491546578706563740a20202020202028206e65775f706172616d6574657273207c3e2074726561737572795f657870616e73696f6e2029203d3d20536f6d65286578706563745f726174696f6e616c28312c203529290016153301e491696578706563740a20202020202028206e65775f706172616d6574657273207c3e206d6f6e65746172795f657870616e73696f6e2029203d3d20536f6d65280a20202020202020206578706563745f726174696f6e616c28332c20315f303030292c0a202020202020290016153301e4916f6578706563740a20202020202028206e65775f706172616d6574657273207c3e207374616b655f706f6f6c5f706c656467655f696e666c75656e63652029203d3d20536f6d65280a20202020202020206578706563745f726174696f6e616c28332c203130292c0a202020202020290016253333330250010170171325333022001018132533333302700101901901913232533302500101b132533333302a00101c01c01c1325333027302a003132533302430193026375400226054604e6ea8004074cc028010004074dd680080e181380098138019bad0010193024001375800202e02e444646600200200844a666048002298103d87a80001323232325333024337100100042980103d87a8000153330243370e0100042601e66052600e00297ae01330060060033026003375a60480046050004604c0024464a66603a6024603e6ea80044c08cc080dd500080b1980180100091299980d98080008a6103d87a80001533301b33710002900009803198101803198101ba83003002330203750600600297ae04bd7009803198101803198101ba800233020375000297ae04bd701b814800054cc0652401476578706563742028206e65775f706172616d6574657273207c3e20646573697265645f6e756d6265725f6f665f7374616b655f706f6f6c732029203d3d20536f6d65283530302900161533019491466578706563742028206e65775f706172616d6574657273207c3e207374616b655f706f6f6c5f7265746972656d656e745f686f72697a6f6e2029203d3d20536f6d652831382900161533019491446578706563742028206e65775f706172616d6574657273207c3e207374616b655f706f6f6c5f6465706f7369742029203d3d20536f6d65283530305f3030305f3030302900161533019491486578706563742028206e65775f706172616d6574657273207c3e207374616b655f63726564656e7469616c5f6465706f7369742029203d3d20536f6d6528325f3030305f3030302900161533019491416578706563742028206e65775f706172616d6574657273207c3e206d61785f626c6f636b5f6865616465725f73697a652029203d3d20536f6d6528315f3130302900161533019491416578706563742028206e65775f706172616d6574657273207c3e206d61785f7472616e73616374696f6e5f73697a652029203d3d20536f6d652831365f3338342900161533019491406578706563742028206e65775f706172616d6574657273207c3e206d61785f626c6f636b5f626f64795f73697a652029203d3d20536f6d652839305f31313229001615330194913e6578706563742028206e65775f706172616d6574657273207c3e206d696e5f6665655f636f6e7374616e742029203d3d20536f6d65283135355f33383129001615330194913c6578706563742028206e65775f706172616d6574657273207c3e206d696e5f6665655f636f656666696369656e742029203d3d20536f6d65283434290016253333330200010130130131375a002026444646600200200844a66603e002298103d87a8000132323232533301f337100100042980103d87a80001533301f3370e01000426014660486ea0c01c0052f5c026600c00c00660420066eb4c07c008c08c008c084004dd2a4000018018603460360046eacc064004c064004c050dd5000804180b180b980b98099baa001007301530160013011375400200a60266028602860206ea8004526153300e4911856616c696461746f722072657475726e65642066616c73650013656004370e90000018018018018018a998052481e86578706563742050726f706f73696e67280a202020202020302c0a20202020202050726f706f73616c50726f636564757265207b0a2020202020202020676f7665726e616e63655f616374696f6e3a2050726f746f636f6c506172616d6574657273207b0a20202020202020202020616e636573746f723a204e6f6e652c0a2020202020202020202067756172647261696c733a20536f6d65282e2e292c0a202020202020202020206e65775f706172616d65746572732c0a20202020202020207d2c0a20202020202020202e2e0a2020202020207d2c0a2020202029203d206374782e696e666f001615330094910b5f746d70313a20566f6964001615330084913565787065637420536f6d65287229203d20726174696f6e616c2e6e6577286e756d657261746f722c2064656e6f6d696e61746f72290016153300749132657870656374205b6e756d657261746f722c2064656e6f6d696e61746f725d3a204c6973743c496e743e203d20706172616d001615330064911965787065637420706172616d3a20496e74203d20706172616d00161533005491ff657870656374205b0a202020206d6f74696f6e5f6f665f6e6f5f636f6e666964656e63652c0a20202020636f6e737469747574696f6e616c5f636f6d6d69747465652c0a20202020636f6e737469747574696f6e616c5f636f6d6d69747465655f756e6465725f6e6f5f636f6e666964656e63652c0a20202020636f6e737469747574696f6e2c0a20202020686172645f666f726b2c0a2020202070726f746f636f6c5f706172616d65746572735f6e6574776f726b5f67726f75702c0a2020202070726f746f636f6c5f706172616d65746572735f65636f6e6f6d69635f67726f75702c0a2020202070726f746f636f6c5f706172616d65746572735f746a6563686e6963616c5f67726f75702c0a2020202070726f746f636f6c5f706172616d65746572735f676f7665726e616e63655f67726f75702c0a2020202074726561737572795f7769746864726177616c2c0a20205d3a204c6973743c446174613e203d20706172616d00161533004491c4657870656374205b0a202020206d6f74696f6e5f6f665f6e6f5f636f6e666964656e63652c0a20202020636f6e737469747574696f6e616c5f636f6d6d69747465652c0a20202020636f6e737469747574696f6e616c5f636f6d6d69747465655f756e6465725f6e6f5f636f6e666964656e63652c0a20202020686172645f666f726b2c0a2020202070726f746f636f6c5f706172616d65746572735f73656375726974795f67726f75702c0a20205d3a204c6973743c446174613e203d20706172616d0016153300349127657870656374205b6d656d6f72792c206370755d3a204c6973743c496e743e203d20706172616d0016153300249128657870656374205b6d656d6f72792c206370755d3a204c6973743c446174613e203d20706172616d00165734ae7155ceaab9e5573eae815d0aba257481", - "hash": "04337e4d2e95967970593e5759b8516364df203f41c0bbe393a5693d" + "compiledCode": "591ad601010032323232323232323232323232323232323225333333013001153323300c3001300e37540042a666020601e6ea8008494ccc034c94ccc038cdc3a401460206ea80044c8c94ccc040c014dd6980b0010992999808980318099baa00113232323253330153370e9001180b9baa301b00415333015300a301737540022646464a66603066ebcccc00801520000014c106d8799f182cff00153330183375e66600400a9001000a6109d8799f1a00025ef5ff00153330183375e66600400a9002000a6109d8799f1a00016000ff00153330183375e66600400a9003000a6107d8799f194000ff00153330183375e66600400a9004000a6107d8799f19044cff00153330183375e66600400a9005000a6109d8799f1a001e8480ff00153330183375e66600400a9006000a6109d8799f1a1dcd6500ff00153330183375e66600400a9007000a6105d8799f12ff00153330183375e66600400a9008000a6107d8799f1901f4ff0013232323232533301d3375e666004014900900098041981119801a400c900a25eb8054ccc074cdd799980100524028002601066044660069003241a01e97ae01533301d3375e666004014900b00098041981119801a4004900525eb8054ccc074cdd79998038052404000c980107d8799f190154ff001533301d3375e66600e014901100326107d8799f1910d6ff001533301d3375e66600401490121000a60103d87a80001533301d3375e66600401490131299999981300080e80e899299981180080f0991929998128008100992999813181480109806998139803001998139803000a5eb80084c09c004c09c008c094004dd600080e80e98041981118041981119801a4104129068079981119801a414416904044bd25eb812f5c0264a66603c66ebcccc00c02d20280014c116d8799fd8799f1a00d59f801b00000002540be400ffff001533301e3375e6660060169015000a6116d8799fd8799f1a03b20b801b00000004a817c800ffff001533301e3375e6660100169016003a6107d8799f191388ff001533301e3375e6660100169017003a6106d8799f1896ff001533301e3375e6660100169018003a6105d8799f03ff001533301e3375e66600601690191299999981380080e00e099299981200080e89919299981300080f899192999814000810899192999815000811899192999816000812899299981698180010980a19817180680499817180a198171806803998171806802a5eb80cc0b8c03400ccc0b8c050cc0b8c034004cc0b930103d87980003302e4c103d87980003302e4c103d87980003302e4c103d87980004bd7025eb80098c0b8004c0b8008c0b0004c0b0008c0a8004c0a8008c0a0004c0a0008c098004dd600080e00e26141d8799fd8799fd8799f18331864ffd8799fd8799f0d1819ffd8799f18351864ffffd8799f181b1832ffd8799fd8799f0b14ffd87980d87980d87980d87980ffffff001533301e3375e646464646464666012022901a129981319b964901186472657020766f74696e67207468726573686f6c64733a20003732660040029101001533333302d001021021132533302a00102213232533302c00102413232533302e00102613232533303000102813232533303200102a13232533303400102c13232533303600102e13232533303800103013232533303a00103213232533303c001034132533303d3040002130243303e301d0133303e30243303e301d0113303e301d00f4bd701981f180e8069981f180e8059981f18121981f260103d87980003303e301d0093303e301d0073303e301d0053303e301d0034bd701981f180e800a5eb800d4c0f8004c0f8008c0f0004c0f0008c0e8004c0e8008c0e0004c0e0008c0d8004c0d8008c0d0004c0d0008c0c8004c0c8008c0c0004c0c0008c0b8004c0b8008c0b0004dd6000810810980080091129999199981700189919191919191980600100099b8a489012800002533302a337100069007099b80483c80400c54ccc0a8cdc4001a410004266e00cdc0241002800690068b2999816800899b8a4881035b5d2900005133714911035b5f2000333300800133714911025d290000522333009009002300600122333009009002001375860560046eb4c0a4004c8cdd81ba83029001374e60540026ea800c4c94ccc0ac0044cdc52441027b7d00003133714911037b5f200032323300100100322533302e00110031533302e3031001132333009009302d001337149101023a2000333009009302e0010043030001132333009009302d001337149101023a2000333009009302e001300633003003303200230300013371491102207d000033756006264a666056002266e29221025b5d00003133714911035b5f2000333300600133714911015d000032233300700700230040012233300700700200137580066e292201022c2000133005375a0040022646466e2922010268270000132333001001337006e3400920013371491101270000322253330293371000490000800899191919980300319b8000548004cdc599b80002533302c33710004900a0a40c02903719b8b33700002a66605866e2000520141481805206e0043370c004901019b8300148080cdc70020011bae0022222323300100100522533302b00110051533302b302e001133003302d001005133004302d00133002002302e001223233001001003225333024301900113371491101300000315333024337100029000099b8a489012d0033002002300c00113300533708002900a19b8b3370066e1400520144818000cc0040048894ccc084cdc4801240002002266600600666e1000920143371666e00cdc2801240289030000a615bd8799fd8799fd8799f18431864ffd8799fd8799f18431864ffd8799f0305ffffd8799f0304ffd8799f0305ffd8799fd87980d8799f18431864ffd8799f18431864ffd8799f18431864ffd8799f0304ffffd8799f18431864ffffff001533301e3375e666010016901b003a6105d8799f07ff001533301e3375e666010016901c003a6106d8799f1892ff001533301e3375e666010016901d003a6105d8799f06ff001533301e3375e666010016901e003a610dd8799f1b000000174876e800ff001533301e3375e666010016901f003a6109d8799f1a1dcd6500ff001533301e3375e6660100169020003a6105d8799f14ff001533301e3375e6660060169021001180499811998022403c900125eb805288a9980fa4817d6578706563740a20202020202028206e65775f706172616d6574657273207c3e207265666572656e63655f736372697074735f746965725f6665655f696e697469616c5f666163746f722029203d3d20536f6d65280a20202020202020206578706563745f726174696f6e616c2831352c2031292c0a202020202020290016153301f491546578706563740a20202020202028206e65775f706172616d6574657273207c3e2064656c65676174655f726570726573656e7461746976655f6d61785f69646c655f74696d652029203d3d20536f6d65283230290016153301f491576578706563740a20202020202028206e65775f706172616d6574657273207c3e2064656c65676174655f726570726573656e7461746976655f6465706f7369742029203d3d20536f6d65283530305f3030305f303030290016153301f491576578706563740a20202020202028206e65775f706172616d6574657273207c3e20676f7665726e616e63655f70726f706f73616c5f6465706f7369742029203d3d20536f6d65283130305f3030305f3030305f303030290016153301f491446578706563742028206e65775f706172616d6574657273207c3e20676f7665726e616e63655f70726f706f73616c5f6c69666574696d652029203d3d20536f6d652836290016153301f491546578706563740a20202020202028206e65775f706172616d6574657273207c3e206d61785f636f6e737469747574696f6e616c5f636f6d6d69747465655f6d616e646174652029203d3d20536f6d6528313436290016153301f491496578706563742028206e65775f706172616d6574657273207c3e206d696e5f636f6e737469747574696f6e616c5f636f6d6d69747465655f73697a652029203d3d20536f6d652837290016153301f491786578706563740a20202020202028206e65775f706172616d6574657273207c3e2064656c65676174655f726570726573656e7461746976655f766f74696e675f7468726573686f6c64732029203d3d20536f6d65280a2020202020202020647265705f7468726573686f6c647328292c0a202020202020290016153301f491736578706563740a20202020202028206e65775f706172616d6574657273207c3e207374616b655f706f6f6c5f6f70657261746f725f766f74696e675f7468726573686f6c64732029203d3d20536f6d65280a202020202020202073706f5f7468726573686f6c647328292c0a202020202020290016153301f4913d6578706563742028206e65775f706172616d6574657273207c3e206d61785f636f6c6c61746572616c5f696e707574732029203d3d20536f6d652833290016153301f4913f6578706563742028206e65775f706172616d6574657273207c3e20636f6c6c61746572616c5f70657263656e746167652029203d3d20536f6d6528313530290016153301f491396578706563742028206e65775f706172616d6574657273207c3e206d61785f76616c75655f73697a652029203d3d20536f6d652835303030290016153301f4918c6578706563740a20202020202028206e65775f706172616d6574657273207c3e206d61785f626c6f636b5f657865637574696f6e5f756e6974732029203d3d20536f6d65280a2020202020202020457865637574696f6e556e697473207b206d656d6f72793a2036323030303030302c206370753a203230303030303030303030207d2c0a202020202020290016153301f491926578706563740a20202020202028206e65775f706172616d6574657273207c3e206d61785f7472616e73616374696f6e5f657865637574696f6e5f756e6974732029203d3d20536f6d65280a2020202020202020457865637574696f6e556e697473207b206d656d6f72793a2031343030303030302c206370753a203130303030303030303030207d2c0a2020202020202900162533333302600101c01c132533302300101d132533333302800101e01e01e132325333026001020132533333302b0010210210211325333028302b0031300f330293750008660526ea00052f5c00446eb4004084c0a0004c0a000cdd680080f18128009bac00101c01c153301e4901d56578706563740a20202020202028206e65775f706172616d6574657273207c3e207363726970745f657865637574696f6e5f7072696365732029203d3d20536f6d65280a2020202020202020536372697074457865637574696f6e507269636573207b0a202020202020202020206d656d6f72793a206578706563745f726174696f6e616c283537372c20315f303030292c0a202020202020202020206370753a206578706563745f726174696f6e616c283732312c20315f3030305f303030292c0a20202020202020207d2c0a202020202020290016153301e491306578706563742028206e65775f706172616d6574657273207c3e20636f73745f6d6f64656c732029203d3d204e6f6e650016153301e491476578706563742028206e65775f706172616d6574657273207c3e206d696e5f7574786f5f6465706f7369745f636f656666696369656e742029203d3d20536f6d652834333130290016153301e4913d6578706563742028206e65775f706172616d6574657273207c3e206d696e5f7374616b655f706f6f6c5f636f73742029203d3d20536f6d6528333430290016153301e491546578706563740a20202020202028206e65775f706172616d6574657273207c3e2074726561737572795f657870616e73696f6e2029203d3d20536f6d65286578706563745f726174696f6e616c28312c203529290016153301e491696578706563740a20202020202028206e65775f706172616d6574657273207c3e206d6f6e65746172795f657870616e73696f6e2029203d3d20536f6d65280a20202020202020206578706563745f726174696f6e616c28332c20315f303030292c0a202020202020290016153301e4916f6578706563740a20202020202028206e65775f706172616d6574657273207c3e207374616b655f706f6f6c5f706c656467655f696e666c75656e63652029203d3d20536f6d65280a20202020202020206578706563745f726174696f6e616c28332c203130292c0a202020202020290016253333330250010170171325333022001018132533333302700101901901913232533302500101b132533333302a00101c01c01c1325333027302a003132533302430193026375400226054604e6ea8004074cc028010004074dd680080e181380098138019bad0010193024001375800202e02e444646600200200844a666048002298103d87a8000132323253330233370e00e6eb4c09400c4c038cc0a0c0180052f5c026600a00a004604a0046050004604c0024464a66603a6024603e6ea80044c08cc080dd500080b1980180100091299980d98080008a60103d87a80001533301b33710002900009803198101803198101ba83003002330203750600600297ae04bd7009803198101803198101ba800233020375000297ae04bd701b814800054cc0652401476578706563742028206e65775f706172616d6574657273207c3e20646573697265645f6e756d6265725f6f665f7374616b655f706f6f6c732029203d3d20536f6d65283530302900161533019491466578706563742028206e65775f706172616d6574657273207c3e207374616b655f706f6f6c5f7265746972656d656e745f686f72697a6f6e2029203d3d20536f6d652831382900161533019491446578706563742028206e65775f706172616d6574657273207c3e207374616b655f706f6f6c5f6465706f7369742029203d3d20536f6d65283530305f3030305f3030302900161533019491486578706563742028206e65775f706172616d6574657273207c3e207374616b655f63726564656e7469616c5f6465706f7369742029203d3d20536f6d6528325f3030305f3030302900161533019491416578706563742028206e65775f706172616d6574657273207c3e206d61785f626c6f636b5f6865616465725f73697a652029203d3d20536f6d6528315f3130302900161533019491416578706563742028206e65775f706172616d6574657273207c3e206d61785f7472616e73616374696f6e5f73697a652029203d3d20536f6d652831365f3338342900161533019491406578706563742028206e65775f706172616d6574657273207c3e206d61785f626c6f636b5f626f64795f73697a652029203d3d20536f6d652839305f31313229001615330194913e6578706563742028206e65775f706172616d6574657273207c3e206d696e5f6665655f636f6e7374616e742029203d3d20536f6d65283135355f33383129001615330194913c6578706563742028206e65775f706172616d6574657273207c3e206d696e5f6665655f636f656666696369656e742029203d3d20536f6d65283434290016253333330200010130130131375a002026444646600200200844a66603e002298103d87a80001323232533301e3370e00e6eb4c08000c4c024cc08cdd41803000a5eb804cc014014008c080008c08c008c084004dd2a4000018018603460360046eacc064004c064004c050dd5000804180b180b980b98099baa001007301530160013011375400200a60266028602860206ea8004526153300e49011856616c696461746f722072657475726e65642066616c73650013656004370e90000018018018018018a998052481e86578706563742050726f706f73696e67280a202020202020302c0a20202020202050726f706f73616c50726f636564757265207b0a2020202020202020676f7665726e616e63655f616374696f6e3a2050726f746f636f6c506172616d6574657273207b0a20202020202020202020616e636573746f723a204e6f6e652c0a2020202020202020202067756172647261696c733a20536f6d65282e2e292c0a202020202020202020206e65775f706172616d65746572732c0a20202020202020207d2c0a20202020202020202e2e0a2020202020207d2c0a2020202029203d206374782e696e666f001615330094910b5f746d70313a20566f6964001615330084913565787065637420536f6d65287229203d20726174696f6e616c2e6e6577286e756d657261746f722c2064656e6f6d696e61746f72290016153300749132657870656374205b6e756d657261746f722c2064656e6f6d696e61746f725d3a204c6973743c496e743e203d20706172616d001615330064911965787065637420706172616d3a20496e74203d20706172616d00161533005491ff657870656374205b0a202020206d6f74696f6e5f6f665f6e6f5f636f6e666964656e63652c0a20202020636f6e737469747574696f6e616c5f636f6d6d69747465652c0a20202020636f6e737469747574696f6e616c5f636f6d6d69747465655f756e6465725f6e6f5f636f6e666964656e63652c0a20202020636f6e737469747574696f6e2c0a20202020686172645f666f726b2c0a2020202070726f746f636f6c5f706172616d65746572735f6e6574776f726b5f67726f75702c0a2020202070726f746f636f6c5f706172616d65746572735f65636f6e6f6d69635f67726f75702c0a2020202070726f746f636f6c5f706172616d65746572735f746a6563686e6963616c5f67726f75702c0a2020202070726f746f636f6c5f706172616d65746572735f676f7665726e616e63655f67726f75702c0a2020202074726561737572795f7769746864726177616c2c0a20205d3a204c6973743c446174613e203d20706172616d00161533004491c4657870656374205b0a202020206d6f74696f6e5f6f665f6e6f5f636f6e666964656e63652c0a20202020636f6e737469747574696f6e616c5f636f6d6d69747465652c0a20202020636f6e737469747574696f6e616c5f636f6d6d69747465655f756e6465725f6e6f5f636f6e666964656e63652c0a20202020686172645f666f726b2c0a2020202070726f746f636f6c5f706172616d65746572735f73656375726974795f67726f75702c0a20205d3a204c6973743c446174613e203d20706172616d0016153300349127657870656374205b6d656d6f72792c206370755d3a204c6973743c496e743e203d20706172616d0016153300249128657870656374205b6d656d6f72792c206370755d3a204c6973743c446174613e203d20706172616d00165734ae7155ceaab9e5573eae815d0aba257481", + "hash": "d0c1c15d5bbd5711902cc8ab659d1ee3af41e44bb7ece80cd9225b48" }, { "title": "simple_spend.spend", diff --git a/examples/acceptance_tests/script_context/v3/validators/certificates.ak b/examples/acceptance_tests/script_context/v3/validators/certificates.ak new file mode 100644 index 00000000..5d5721c8 --- /dev/null +++ b/examples/acceptance_tests/script_context/v3/validators/certificates.ak @@ -0,0 +1,207 @@ +use aiken/collection/list +use cardano/certificate.{ + AlwaysAbstain, AlwaysNoConfidence, AuthorizeConstitutionalCommitteeProxy, + DelegateBlockProduction, DelegateBoth, DelegateCredential, DelegateVote, + RegisterAndDelegateCredential, RegisterCredential, + RegisterDelegateRepresentative, RegisterStakePool, Registered, + RetireFromConstitutionalCommittee, RetireStakePool, UnregisterCredential, + UnregisterDelegateRepresentative, UpdateDelegateRepresentative, +} +use cardano/credential.{Script, VerificationKey} +use cardano/transaction.{Publishing, ScriptContext, ScriptInfo} + +const only0s = #"00000000000000000000000000000000000000000000000000000000" + +const only1s = #"11111111111111111111111111111111111111111111111111111111" + +const only2s = #"22222222222222222222222222222222222222222222222222222222" + +const only9s = + #"9999999999999999999999999999999999999999999999999999999999999999" + +validator { + fn script(_tmp1: Void, ctx: ScriptContext) -> Bool { + assert_script_info(ctx.info) + + let certificates = ctx.transaction.certificates + + expect Some(10_000_000) = ctx.transaction.current_treasury_amount + + expect Some(14) = ctx.transaction.treasury_donation + + expect + Some(RegisterCredential { credential: Script(only2s), deposit: None }) == list.at( + certificates, + 0, + ) + + expect + Some( + RegisterCredential { + credential: VerificationKey(only0s), + deposit: None, + }, + ) == list.at(certificates, 1) + + expect + Some( + UnregisterCredential { + credential: VerificationKey(only0s), + refund: None, + }, + ) == list.at(certificates, 2) + + expect + Some(RegisterStakePool { stake_pool: only1s, vrf: only9s }) == list.at( + certificates, + 3, + ) + + expect + Some(RetireStakePool { stake_pool: only1s, at_epoch: 1337 }) == list.at( + certificates, + 4, + ) + + expect + Some( + RegisterCredential { + credential: VerificationKey(only0s), + deposit: Some(3_000_000), + }, + ) == list.at(certificates, 5) + + expect + Some( + UnregisterCredential { + credential: VerificationKey(only0s), + refund: Some(3_000_000), + }, + ) == list.at(certificates, 6) + + expect + Some( + DelegateCredential { + credential: VerificationKey(only0s), + delegate: DelegateVote(Registered(VerificationKey(only0s))), + }, + ) == list.at(certificates, 7) + + expect + Some( + DelegateCredential { + credential: VerificationKey(only0s), + delegate: DelegateVote(Registered(Script(only0s))), + }, + ) == list.at(certificates, 8) + + expect + Some( + DelegateCredential { + credential: VerificationKey(only0s), + delegate: DelegateVote(AlwaysAbstain), + }, + ) == list.at(certificates, 9) + + expect + Some( + DelegateCredential { + credential: VerificationKey(only0s), + delegate: DelegateVote(AlwaysNoConfidence), + }, + ) == list.at(certificates, 10) + + expect + Some( + DelegateCredential { + credential: VerificationKey(only0s), + delegate: DelegateBoth { + stake_pool: only1s, + delegate_representative: AlwaysNoConfidence, + }, + }, + ) == list.at(certificates, 11) + + expect + Some( + RegisterAndDelegateCredential { + credential: VerificationKey(only0s), + delegate: DelegateBlockProduction(only1s), + deposit: 3_000_000, + }, + ) == list.at(certificates, 12) + + expect + Some( + RegisterAndDelegateCredential { + credential: VerificationKey(only0s), + delegate: DelegateVote(AlwaysNoConfidence), + deposit: 3_000_000, + }, + ) == list.at(certificates, 13) + + expect + Some( + RegisterAndDelegateCredential { + credential: VerificationKey(only0s), + delegate: DelegateBoth { + stake_pool: only1s, + delegate_representative: AlwaysNoConfidence, + }, + deposit: 3_000_000, + }, + ) == list.at(certificates, 14) + + expect + Some( + AuthorizeConstitutionalCommitteeProxy { + constitutional_committee_member: VerificationKey(only0s), + proxy: VerificationKey(only2s), + }, + ) == list.at(certificates, 15) + + expect + Some( + RetireFromConstitutionalCommittee { + constitutional_committee_member: VerificationKey(only0s), + }, + ) == list.at(certificates, 16) + + expect + Some( + RegisterDelegateRepresentative { + delegate_representative: VerificationKey(only0s), + deposit: 3_000_000, + }, + ) == list.at(certificates, 17) + + expect + Some( + UnregisterDelegateRepresentative { + delegate_representative: VerificationKey(only0s), + refund: 3_000_000, + }, + ) == list.at(certificates, 18) + + expect + Some( + UpdateDelegateRepresentative { + delegate_representative: VerificationKey(only0s), + }, + ) == list.at(certificates, 19) + + expect Some(DelegateCredential { + credential: Script(..), + delegate: DelegateBlockProduction(..), + }) = list.at(certificates, 20) + + True + } +} + +fn assert_script_info(info: ScriptInfo) { + expect Publishing(20, DelegateCredential { credential, delegate }) = info + expect DelegateBlockProduction { stake_pool: only1s } == delegate + expect Script(..) = credential + Void +}