Skip to content

Commit

Permalink
fix formatting and update workflow version
Browse files Browse the repository at this point in the history
  • Loading branch information
MicroProofs committed Mar 27, 2024
1 parent e475816 commit d9655fc
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: 🧰 Install Aiken
uses: aiken-lang/[email protected]
with:
version: v1.0.25-alpha
version: v1.0.26-alpha

- name: 📝 Run fmt
run: aiken fmt --check
Expand Down
6 changes: 3 additions & 3 deletions lib/aiken/cbor.ak
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ fn do_diagnostic(self: Data, builder: ByteArray) -> ByteArray {

bytes
|> encode_base16(
length_of_bytearray(bytes) - 1,
append_bytearray(#"27", builder),
)
length_of_bytearray(bytes) - 1,
append_bytearray(#"27", builder),
)
|> append_bytearray(#"6827", _)
},
)
Expand Down
40 changes: 20 additions & 20 deletions lib/aiken/int.ak
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,26 @@ pub fn compare(left: Int, right: Int) -> Ordering {
pub fn from_utf8(bytes: ByteArray) -> Option<Int> {
bytes
|> bytearray.foldr(
Some((0, 0)),
fn(byte, st) {
when st is {
None -> None
Some((n, e)) ->
if byte < 48 || byte > 57 {
if byte == 45 {
Some((-n, 0))
} else {
None
}
} else if n < 0 {
None
} else {
let digit = byte - 48
Some((n + digit * math.pow(10, e), e + 1))
}
}
},
)
Some((0, 0)),
fn(byte, st) {
when st is {
None -> None
Some((n, e)) ->
if byte < 48 || byte > 57 {
if byte == 45 {
Some((-n, 0))
} else {
None
}
} else if n < 0 {
None
} else {
let digit = byte - 48
Some((n + digit * math.pow(10, e), e + 1))
}
}
},
)
|> option.map(fn(tuple) { tuple.1st })
}

Expand Down
12 changes: 6 additions & 6 deletions lib/aiken/math/rational.ak
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ test compare_with_eq() {
expect Some(x) = new(2, 3)
expect Some(y) = new(3, 4)

!eq(x, y)? && ( !eq(y, x)? && eq(x, x)? )
!eq(x, y)? && !eq(y, x)? && eq(x, x)?
}

test compare_with_neq() {
Expand All @@ -654,7 +654,7 @@ test compare_with_neq() {
expect Some(x) = new(2, 3)
expect Some(y) = new(3, 4)

neq(x, y)? && ( neq(y, x)? && !neq(x, x)? )
neq(x, y)? && neq(y, x)? && !neq(x, x)?
}

test compare_with_gte() {
Expand All @@ -664,7 +664,7 @@ test compare_with_gte() {
expect Some(x) = new(2, 3)
expect Some(y) = new(3, 4)

!gte(x, y)? && ( gte(y, x)? && gte(x, x)? )
!gte(x, y)? && gte(y, x)? && gte(x, x)?
}

test compare_with_gt() {
Expand All @@ -674,7 +674,7 @@ test compare_with_gt() {
expect Some(x) = new(2, 3)
expect Some(y) = new(3, 4)

!gt(x, y)? && ( gt(y, x)? && !gt(x, x)? )
!gt(x, y)? && gt(y, x)? && !gt(x, x)?
}

test compare_with_lte() {
Expand All @@ -684,7 +684,7 @@ test compare_with_lte() {
expect Some(x) = new(2, 3)
expect Some(y) = new(3, 4)

lte(x, y)? && ( !lte(y, x)? && lte(x, x)? )
lte(x, y)? && !lte(y, x)? && lte(x, x)?
}

test compare_with_lt() {
Expand All @@ -694,7 +694,7 @@ test compare_with_lt() {
expect Some(x) = new(2, 3)
expect Some(y) = new(3, 4)

lt(x, y)? && ( !lt(y, x)? && !lt(x, x)? )
lt(x, y)? && !lt(y, x)? && !lt(x, x)?
}

/// Calculate the arithmetic mean between two `Rational` values.
Expand Down
56 changes: 28 additions & 28 deletions lib/aiken/transaction.ak
Original file line number Diff line number Diff line change
Expand Up @@ -183,26 +183,26 @@ pub fn find_datum(
datums
|> dict.get(datum_hash)
|> option.or_try(
fn() {
outputs
|> list.filter_map(
fn(output) {
when output.datum is {
InlineDatum(data) ->
if
blake2b_256(builtin.serialise_data(data)) == datum_hash{
Some(data)
} else {
None
}
_ -> None
}
},
)
|> list.head
},
)
fn() {
outputs
|> list.filter_map(
fn(output) {
when output.datum is {
InlineDatum(data) ->
if
blake2b_256(builtin.serialise_data(data)) == datum_hash{

Some(data)
} else {
None
}
_ -> None
}
},
)
|> list.head
},
)
}

/// Find all outputs that are paying into the given script hash, if any. This is useful for
Expand All @@ -213,12 +213,12 @@ pub fn find_script_outputs(
) -> List<Output> {
outputs
|> list.filter(
fn(output) {
when output.address.payment_credential is {
ScriptCredential(addr_script_hash) ->
script_hash == addr_script_hash
VerificationKeyCredential(_) -> False
}
},
)
fn(output) {
when output.address.payment_credential is {
ScriptCredential(addr_script_hash) ->
script_hash == addr_script_hash
VerificationKeyCredential(_) -> False
}
},
)
}

0 comments on commit d9655fc

Please sign in to comment.