Skip to content

Commit

Permalink
Checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
MicroProofs committed Jan 15, 2025
1 parent f03a1a9 commit 29e4539
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
4 changes: 2 additions & 2 deletions aiken.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ requirements = []
source = "github"

[etags]
"aiken-lang/fuzz@main" = [{ secs_since_epoch = 1736935183, nanos_since_epoch = 201404000 }, "e594326795accb687e9bfacd6a0553eb1d611ba23d5bba31b49ec7fe29445e3c"]
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1736935182, nanos_since_epoch = 487923000 }, "9191378e1310dcd34d3f8a883f67fb6440c5535897e210e84ba90ec207b884fc"]
"aiken-lang/fuzz@main" = [{ secs_since_epoch = 1736960088, nanos_since_epoch = 509643000 }, "e594326795accb687e9bfacd6a0553eb1d611ba23d5bba31b49ec7fe29445e3c"]
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1736960087, nanos_since_epoch = 837763000 }, "9191378e1310dcd34d3f8a883f67fb6440c5535897e210e84ba90ec207b884fc"]
5 changes: 4 additions & 1 deletion lib/constraint_utils.ak
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ pub fn check_val(vals: List<Data>, value: Value) -> Bool {
}
}

pub fn handle_inp_constraint(inputs: List<Input>, con: Data) -> Data {
pub fn handle_inp_constraint(
inputs: List<Input>,
con: Data<InputConstraint>,
) -> Data {
expect InputConstraint { address, value, datum_field, in_ref } = con

let runnable_val =
Expand Down
2 changes: 1 addition & 1 deletion lib/intention_types.ak
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub type Constraint {

pub type IntentNonce {
Sequential(Int)
Parallel(OutputReference)
Parallel(Data<OutputReference>)
}

pub type Intent {
Expand Down
23 changes: 13 additions & 10 deletions lib/intention_utils.ak
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,7 @@ pub fn fold_intent_counts(
// need to match the input
let (lace, val) = value_leaving

// fourth part prepare total_value_leaving user account
let value_leaving =
fn(a) { a(lace, builtin.un_map_data(val)) }
let val = builtin.un_map_data(val)

// fifth part: deal with remaining intents
// Fold over one or more remaining intentions
Expand All @@ -268,8 +266,8 @@ pub fn fold_intent_counts(
let
first_nonce: Int,
last_nonce: Int,
parallel_nonce_list: List<OutputReference>,
total_value_leaving: LaceAndValue<Bool>,
parallel_nonce_list: List<Data<OutputReference>>,
add_value_leaving: LaceAndValue<Bool>,
remaining_intents: List<Data<SignedIntention>>,
<-
fn(callback) {
Expand Down Expand Up @@ -323,7 +321,7 @@ pub fn fold_intent_counts(
nonce_numb,
nonce_numb,
parallel_nonce_list,
value_leaving,
fn(a) { a(0, []) },
rest_intents,
)
} else {
Expand All @@ -347,6 +345,11 @@ pub fn fold_intent_counts(
}
}

let add_lace, add_val <- add_value_leaving

let total_value_leaving =
fn(a) { a(lace + add_lace, fast_combine_natural_values(add_val, val)) }

// sixth part: fold over inputs. Validate the inputs that belong to user
// and return the accumulated value for the user
// and return the other bullet inputs belonging to other users
Expand Down Expand Up @@ -419,7 +422,7 @@ fn fold_inputs(
inputs: List<Input>,
remaining_inputs: List<Input>,
acc_value: LaceAndValue<Bool>,
parallel_nonce_list: List<OutputReference>,
parallel_nonce_list: List<Data<OutputReference>>,
callback: fn(LaceAndValue<Bool>, List<Input>) -> Bool,
) {
when inputs is {
Expand Down Expand Up @@ -450,7 +453,7 @@ fn fold_inputs(

let nonce_list =
if InlineDatum(ParallelNonce) == datum {
list.delete(parallel_nonce_list, output_reference)
list.delete(parallel_nonce_list, dataify(output_reference))
} else {
parallel_nonce_list
}
Expand Down Expand Up @@ -542,15 +545,15 @@ fn fold_intents(
constraint_validator: fn(Data<Constraint>, Data) -> Data,
intents: List<Data<SignedIntention>>,
remaining_intents: List<Data<SignedIntention>>,
parallel_nonce_list: List<OutputReference>,
parallel_nonce_list: List<Data<OutputReference>>,
first_nonce: Int,
last_nonce: Int,
additional_intents: ByteArray,
index: Int,
callback: fn(
Int,
Int,
List<OutputReference>,
List<Data<OutputReference>>,
LaceAndValue<Bool>,
List<Data<SignedIntention>>,
) ->
Expand Down

0 comments on commit 29e4539

Please sign in to comment.