Skip to content

Commit

Permalink
Merge pull request #3 from logical-mechanism/adding-bound-to-proof
Browse files Browse the repository at this point in the history
Adding bound to proof
  • Loading branch information
logicalmechanism authored Sep 4, 2024
2 parents 7ae7db9 + fdf5b51 commit fd85549
Show file tree
Hide file tree
Showing 28 changed files with 380 additions and 887 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests
name: Continuous Integration

on:
push:
Expand All @@ -10,11 +10,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: aiken-lang/setup-aiken@v0.1.0
- uses: aiken-lang/setup-aiken@v1
with:
version: v1.0.29-alpha

version: v1.1.0
- run: aiken fmt --check
- run: aiken check -D
- run: aiken build
20 changes: 12 additions & 8 deletions aiken.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
name = "logicalmechanism/5eed0e1f"
version = "0.0.1"
license = "GPL-3.0"
name = "logical-mechanism/5eed0e1f"
version = "0.1.0"
compiler = "v1.1.0"
plutus = "v3"
license = "GPL-3.0-or-later"
description = "Aiken contracts for project 'logicalmechanism/5eed0e1f'"

[repository]
user = "logicalmechanism"
user = "logical-mechanism"
project = "5eed0e1f"
platform = "github"

[[dependencies]]
name = "logicalmechanism/stdlib"
version = "plutus-v3"
name = "aiken-lang/stdlib"
version = "v2.0.0"
source = "github"

[[dependencies]]
name = "logicalmechanism/assist"
version = "plutus-v3"
name = "logical-mechanism/assist"
version = "v0.5.0"
source = "github"

[config]
62 changes: 9 additions & 53 deletions complete_build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -e

# create directories if dont exist
Expand All @@ -14,63 +14,19 @@ rm -fr build/ || true
echo -e "\033[1;34m\nBuilding Contracts \033[0m"

# remove all traces
# aiken build --trace-level silent --filter-traces user-defined
aiken build --trace-level silent --filter-traces user-defined

# keep the traces for testing if required
aiken build --trace-level verbose --filter-traces all
# aiken build --trace-level verbose --filter-traces all

ran="04"
ran="00"
ran_cbor=$(python3 -c "import cbor2;hex_string='${ran}';data = bytes.fromhex(hex_string);encoded = cbor2.dumps(data);print(encoded.hex())")

echo -e "\033[1;33m\nBuilding Pointer Contract \033[0m"
aiken blueprint apply -o plutus.json -v pointer.params "${ran_cbor}"
aiken blueprint convert -v pointer.params > contracts/pointer_contract.plutus
cardano-cli conway transaction policyid --script-file contracts/pointer_contract.plutus > hashes/pointer.hash
echo -e "\033[1;33m Pointer Contract Hash: $(cat hashes/pointer.hash) \033[0m"

echo -e "\033[1;33m\nBuilding Wallet Contract \033[0m"
aiken blueprint apply -o plutus.json -v wallet.params "${ran_cbor}"
aiken blueprint convert -v wallet.params > contracts/wallet_contract.plutus
cardano-cli conway transaction policyid --script-file contracts/wallet_contract.plutus > hashes/wallet.hash
echo -e "\033[1;33m Wallet Contract Hash: $(cat hashes/wallet.hash) \033[0m"
echo -e "\033[1;33m\nBuilding Contract \033[0m"
aiken blueprint apply -o plutus.json -v seedelf.contract.spend "${ran_cbor}"
aiken blueprint convert -v seedelf.contract.spend > contracts/seedelf_contract.plutus
cardano-cli conway transaction policyid --script-file contracts/seedelf_contract.plutus > hashes/seedelf.hash
echo -e "\033[1;33m Contract Hash: $(cat hashes/seedelf.hash) \033[0m"

# end of build
echo -e "\033[1;32m\nBuilding Complete! \033[0m"

###############################################################################
######### THIS WILL BE REMOVED WHEN AIKEN MOVES TO V3 #########################
###############################################################################
echo -e "\033[1;34m\nV3 HACK! \033[0m"
jq \
'.type="PlutusScriptV3"' \
./contracts/pointer_contract.plutus | sponge ./contracts/pointer_contract.plutus
aiken build --uplc
sed -i '1s/.*/(program/; 2s/.*/ 1.1.0/' artifacts/pointer.params.uplc
pointer_cbor=$(aiken uplc encode artifacts/pointer.params.uplc --cbor --hex)
pointer_cbor_cbor=$(python3 -c "import cbor2;hex_string='${pointer_cbor}';data = bytes.fromhex(hex_string);encoded = cbor2.dumps(data);print(encoded.hex())")

jq \
--arg cbor "$pointer_cbor_cbor" \
'.cborHex=$cbor
' \
./contracts/pointer_contract.plutus | sponge ./contracts/pointer_contract.plutus

pointer_hash=$(python3 -c "import hashlib;hex_string='03${pointer_cbor}';data = hashlib.blake2b(bytes.fromhex(hex_string), digest_size=28).digest().hex();print(data)")
echo -n "${pointer_hash}" > hashes/pointer.hash

jq \
'.type="PlutusScriptV3"' \
./contracts/wallet_contract.plutus | sponge ./contracts/wallet_contract.plutus
aiken build --uplc
sed -i '1s/.*/(program/; 2s/.*/ 1.1.0/' artifacts/wallet.params.uplc
wallet_cbor=$(aiken uplc encode artifacts/wallet.params.uplc --cbor --hex)
wallet_cbor_cbor=$(python3 -c "import cbor2;hex_string='${wallet_cbor}';data = bytes.fromhex(hex_string);encoded = cbor2.dumps(data);print(encoded.hex())")

jq \
--arg cbor "$wallet_cbor_cbor" \
'.cborHex=$cbor
' \
./contracts/wallet_contract.plutus | sponge ./contracts/wallet_contract.plutus

wallet_hash=$(python3 -c "import hashlib;hex_string='03${wallet_cbor}';data = hashlib.blake2b(bytes.fromhex(hex_string), digest_size=28).digest().hex();print(data)")
echo -n "${wallet_hash}" > hashes/wallet.hash
13 changes: 5 additions & 8 deletions lib/seedelf/bls.ak
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
////
////

use aiken/builtin

/// The generator of the G1 group of the BLS12-381 curve.
/// This constant represents a fixed base point on the elliptic curve.
pub const g1 =
#<Bls12_381, G1>"97f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb"

/// Represents the additive identity (zero) in the G1 group.
pub const zero =
#<Bls12_381, G1>"c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"

/// This is mathematically equivalent to g^x mod q.
pub fn pk(sk: Int) -> G1Element {
builtin.bls12_381_g1_scalar_mul(sk, g1)
}

test pk_of_one_is_g1() {
let u: G1Element = pk(1)
u == g1
}
198 changes: 0 additions & 198 deletions lib/seedelf/elgamal.ak

This file was deleted.

Loading

0 comments on commit fd85549

Please sign in to comment.