This is a library, written in Rust, for serialization & deserialization of data structures used in Cardano's Haskell implementation of Alonzo along with useful utility functions.
Other
230
stars
124
forks
source link
DatumSource struct makes the script input to be reference input #650
I'm facing some troubles when I'm trying to build a transaction. The script UTxO has an inline datum and I'm using txInputsBuilder.add_plutus_script_input. The datum is created as DatumSource::RefInput(input). Maybe I'm wrong, but I understand that when I create a datum as ref, I'm really indicating an inline datum not a reference input.
This DatumSourceis pattern matched in the get_ref_inputs:
pub fn get_ref_inputs(&self) -> TransactionInputs {
let mut inputs = Vec::new();
for wintess in self.required_witnesses.scripts.iter()
.flat_map(|(_, tx_wits)| tx_wits.values())
.filter_map(|wit| wit.as_ref()) {
match wintess {
ScriptWitnessType::NativeScriptWitness(NativeScriptSourceEnum::RefInput(input, _, _)) => {
inputs.push(input.clone());
},
ScriptWitnessType::PlutusScriptWitness(plutus_witness) => {
if let Some(DatumSourceEnum::RefInput(input)) = &plutus_witness.datum {
inputs.push(input.clone());
}
if let PlutusScriptSourceEnum::RefInput(input, _, _) = &plutus_witness.script {
inputs.push(input.clone());
}
},
_ => ()
}
}
TransactionInputs(inputs)
}
This is causing that my redeemer is adding for each inline datum a refence input. That makes fail my validator. Am I correctly understanding this DatumSource struct? How should I add Plutus Witnesses with inline datum?
By the way, there is a typo in the word witness in the rust script. It's typed as wintess.
Hello
I'm facing some troubles when I'm trying to build a transaction. The script UTxO has an inline datum and I'm using
txInputsBuilder.add_plutus_script_input
. The datum is created asDatumSource::RefInput(input)
. Maybe I'm wrong, but I understand that when I create a datum as ref, I'm really indicating an inline datum not a reference input.This
DatumSource
is pattern matched in theget_ref_inputs
:This is causing that my redeemer is adding for each inline datum a refence input. That makes fail my validator. Am I correctly understanding this DatumSource struct? How should I add Plutus Witnesses with inline datum?
By the way, there is a typo in the word witness in the rust script. It's typed as wintess.