Rework 'blueprint apply' command and wrap up wiring up validation.
The apply command now works only from a serialized CBOR data (instead of a UPLC syntax). So it is no longer possible to specify arbitrary cbor terms through the CLI. I believe it to be an acceptable limitation for now; especially given that Aiken will never generate blueprints with non-data terms at the interface boundary.
This commit is contained in:
@@ -154,11 +154,15 @@ impl Validator {
|
||||
}
|
||||
|
||||
impl Validator {
|
||||
pub fn apply(self, arg: &Term<DeBruijn>) -> Result<Self, Error> {
|
||||
pub fn apply(
|
||||
self,
|
||||
definitions: &Definitions<Annotated<Schema>>,
|
||||
arg: &Term<DeBruijn>,
|
||||
) -> Result<Self, Error> {
|
||||
match self.parameters.split_first() {
|
||||
None => Err(Error::NoParametersToApply),
|
||||
Some((head, tail)) => {
|
||||
head.validate(&self.definitions, arg)?;
|
||||
head.validate(definitions, arg)?;
|
||||
Ok(Self {
|
||||
program: self.program.apply_term(arg),
|
||||
parameters: tail.to_vec(),
|
||||
|
||||
Reference in New Issue
Block a user