Skip to content

Commit f9aa270

Browse files
authored
Merge pull request #146 from IntersectMBO/yura/pebble-submissions
Add Pebble submissions with external repository references
2 parents 79a4003 + 1d5b059 commit f9aa270

12 files changed

Lines changed: 507 additions & 44 deletions

File tree

flake.nix

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -205,45 +205,6 @@
205205
# JSON Schema validation (required by submission validation script)
206206
check-jsonschema
207207

208-
# Pretty-print UPLC files in place
209-
(writeShellScriptBin "pretty-uplc" ''
210-
set -e
211-
212-
if [ $# -eq 0 ]; then
213-
echo "Usage: pretty-uplc <path-to-uplc-file>" >&2
214-
exit 1
215-
fi
216-
217-
uplc_file="$1"
218-
219-
if [ ! -f "$uplc_file" ]; then
220-
echo "Error: File not found: $uplc_file" >&2
221-
exit 1
222-
fi
223-
224-
# Create temporary file
225-
temp_file=$(mktemp) || {
226-
echo "Error: Failed to create temporary file" >&2
227-
exit 1
228-
}
229-
230-
# Ensure temp file cleanup on exit
231-
trap 'rm -f "$temp_file"' EXIT
232-
233-
# Pretty-print to temp file, then move to original location
234-
if plutus "$uplc_file" -o "$temp_file"; then
235-
# Ensure file ends with a newline
236-
if [ -s "$temp_file" ] && [ "$(tail -c 1 "$temp_file" | wc -l)" -eq 0 ]; then
237-
echo "" >> "$temp_file"
238-
fi
239-
mv "$temp_file" "$uplc_file"
240-
echo "✓ Pretty-printed: $uplc_file"
241-
else
242-
echo "Error: plutus command failed for $uplc_file" >&2
243-
exit 1
244-
fi
245-
'')
246-
247208
# CAPE project management tool
248209
(writeShellScriptBin "cape" ''
249210
# Prefer repo-local cape.sh when available; fallback to store copy
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Benchmark Implementation Notes
2+
3+
**Scenario**: `factorial_naive_recursion`
4+
5+
**Submission ID**: `Pebble_0.1.2_michele-nuzzi`
6+
7+
## Implementation Details
8+
9+
- **Compiler**: `Pebble 0.1.2`
10+
- **Implementation Approach**: `naive recursive`
11+
- **Compilation Flags**: `none (default)`
12+
13+
## Performance Results
14+
15+
- See [metrics.json](metrics.json) for detailed performance measurements
16+
17+
## Source Code
18+
19+
- See [source/README.md](source/README.md) for source code and reproducibility instructions
20+
21+
## Notes
22+
23+
Naive recursive implementation targeting Plutus Core 1.1.0. Source code maintained in external repository for reproducibility.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
(program
2+
1.1.0
3+
(case
4+
(constr
5+
0
6+
[ (builtin addInteger) (con integer -1) ]
7+
[ (builtin lessThanInteger) (con integer 1) ]
8+
(force (builtin ifThenElse)))
9+
(lam
10+
i_0
11+
(lam
12+
i_1
13+
(lam
14+
i_2
15+
[
16+
(lam i_3 [ i_3 i_3 ])
17+
(lam
18+
i_4
19+
(lam
20+
i_5
21+
(force
22+
(case
23+
(constr
24+
0
25+
[ i_1 i_5 ]
26+
(delay
27+
[
28+
[ (builtin multiplyInteger) i_5 ]
29+
[ [ i_4 i_4 ] [ i_0 i_5 ] ]
30+
]
31+
)
32+
(delay (con integer 1)))
33+
i_2)
34+
)
35+
)
36+
)
37+
]
38+
)
39+
)
40+
))
41+
)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"compiler": {
3+
"name": "Pebble",
4+
"version": "0.1.2",
5+
"commit_hash": "40887038e5d00f171e4684f4c456ffd468008445"
6+
},
7+
"compilation_config": {
8+
"optimization_level": "none",
9+
"target": "uplc",
10+
"flags": []
11+
},
12+
"contributors": [
13+
{
14+
"name": "Michele Nuzzi",
15+
"organization": "Harmonic Labs",
16+
"contact": "michele@harmoniclabs.tech"
17+
}
18+
],
19+
"submission": {
20+
"date": "2025-11-25T00:00:00Z",
21+
"source_available": true,
22+
"source_repository": "https://github.com/Unisay/pebble-cape-submissions",
23+
"source_commit_hash": "ebb35dbe7538a0e95006e0b91dfff1eec022f1ca",
24+
"implementation_notes": "Naive recursive implementation using Pebble 0.1.2 with default compilation settings"
25+
}
26+
}
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
{
2+
"evaluations": [
3+
{
4+
"cpu_units": 633439,
5+
"description": "Factorial of 0 should return 1 (mathematical definition)",
6+
"execution_result": "success",
7+
"memory_units": 3302,
8+
"name": "factorial_0"
9+
},
10+
{
11+
"cpu_units": 633439,
12+
"description": "Factorial of 1 should return 1",
13+
"execution_result": "success",
14+
"memory_units": 3302,
15+
"name": "factorial_1"
16+
},
17+
{
18+
"cpu_units": 1282939,
19+
"description": "Factorial of 2 should return 2",
20+
"execution_result": "success",
21+
"memory_units": 5408,
22+
"name": "factorial_2"
23+
},
24+
{
25+
"cpu_units": 1932439,
26+
"description": "Factorial of 3 should return 6",
27+
"execution_result": "success",
28+
"memory_units": 7514,
29+
"name": "factorial_3"
30+
},
31+
{
32+
"cpu_units": 2581939,
33+
"description": "Factorial of 4 should return 24",
34+
"execution_result": "success",
35+
"memory_units": 9620,
36+
"name": "factorial_4"
37+
},
38+
{
39+
"cpu_units": 3231439,
40+
"description": "Factorial of 5 should return 120",
41+
"execution_result": "success",
42+
"memory_units": 11726,
43+
"name": "factorial_5"
44+
},
45+
{
46+
"cpu_units": 5179939,
47+
"description": "Factorial of 8 should return 40320",
48+
"execution_result": "success",
49+
"memory_units": 18044,
50+
"name": "factorial_8"
51+
},
52+
{
53+
"cpu_units": 6478939,
54+
"description": "Factorial of 10 should return 3628800 (original benchmark target)",
55+
"execution_result": "success",
56+
"memory_units": 22256,
57+
"name": "factorial_10"
58+
},
59+
{
60+
"cpu_units": 7777939,
61+
"description": "Factorial of 12 should return 479001600",
62+
"execution_result": "success",
63+
"memory_units": 26468,
64+
"name": "factorial_12"
65+
},
66+
{
67+
"cpu_units": 633439,
68+
"description": "Factorial of negative number should return 1 based on current implementation (n <= 0 case)",
69+
"execution_result": "success",
70+
"memory_units": 3302,
71+
"name": "factorial_negative"
72+
}
73+
],
74+
"execution_environment": {
75+
"evaluator": "unknown"
76+
},
77+
"measurements": {
78+
"block_cpu_budget_pct": 0.0194448475,
79+
"block_memory_budget_pct": 0.04269032258064516,
80+
"cpu_units": {
81+
"maximum": 7777939,
82+
"median": 2257189,
83+
"minimum": 633439,
84+
"sum": 30365890,
85+
"sum_negative": 0,
86+
"sum_positive": 30365890
87+
},
88+
"execution_fee_lovelace": 8591,
89+
"memory_units": {
90+
"maximum": 26468,
91+
"median": 8567,
92+
"minimum": 3302,
93+
"sum": 110942,
94+
"sum_negative": 0,
95+
"sum_positive": 110942
96+
},
97+
"reference_script_fee_lovelace": 720,
98+
"script_size_bytes": 48,
99+
"scripts_per_block": 2342,
100+
"scripts_per_tx": 528,
101+
"term_size": 41,
102+
"total_fee_lovelace": 9311,
103+
"tx_cpu_budget_pct": 0.07777939,
104+
"tx_memory_budget_pct": 0.18905714285714284
105+
},
106+
"scenario": "factorial_naive_recursion",
107+
"timestamp": "2025-11-25T13:50:57Z",
108+
"version": "1.0.0",
109+
"notes": "Generated using UPLC-CAPE measure tool"
110+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Pebble Factorial Naive Recursion Implementation
2+
3+
**Source Code**: [factorial_naive_recursion.pebble](https://github.com/Unisay/pebble-cape-submissions/blob/ebb35dbe7538a0e95006e0b91dfff1eec022f1ca/benchmarks/factorial_naive_recursion/factorial_naive_recursion.pebble)
4+
5+
**Repository**: <https://github.com/Unisay/pebble-cape-submissions>
6+
7+
**Commit**: `ebb35dbe7538a0e95006e0b91dfff1eec022f1ca`
8+
9+
**Path**: `benchmarks/factorial_naive_recursion/factorial_naive_recursion.pebble`
10+
11+
This submission uses Pebble compiler version 0.1.2 with naive recursive implementation.
12+
13+
## Reproducing the Compilation
14+
15+
1. Clone the repository:
16+
17+
```bash
18+
git clone https://github.com/Unisay/pebble-cape-submissions
19+
cd pebble-cape-submissions
20+
```
21+
22+
2. Check out the specific commit:
23+
24+
```bash
25+
git checkout ebb35dbe7538a0e95006e0b91dfff1eec022f1ca
26+
```
27+
28+
3. Enter the Nix development environment:
29+
30+
```bash
31+
nix develop
32+
```
33+
34+
4. Install dependencies:
35+
36+
```bash
37+
bun install
38+
```
39+
40+
5. Build the benchmark:
41+
42+
```bash
43+
bun run compile:fact
44+
```
45+
46+
6. The compiled UPLC output should match `factorial_naive_recursion.uplc` in this submission
47+
48+
For detailed build instructions and environment setup, see the repository README.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Benchmark Implementation Notes
2+
3+
**Scenario**: `fibonacci_naive_recursion`
4+
5+
**Submission ID**: `Pebble_0.1.2_michele-nuzzi`
6+
7+
## Implementation Details
8+
9+
- **Compiler**: `Pebble 0.1.2`
10+
- **Implementation Approach**: `naive recursive`
11+
- **Compilation Flags**: `none (default)`
12+
13+
## Performance Results
14+
15+
- See [metrics.json](metrics.json) for detailed performance measurements
16+
17+
## Source Code
18+
19+
- See [source/README.md](source/README.md) for source code and reproducibility instructions
20+
21+
## Notes
22+
23+
Naive recursive implementation targeting Plutus Core 1.1.0. Source code maintained in external repository for reproducibility.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
(program
2+
1.1.0
3+
(case
4+
(constr
5+
0
6+
[ (builtin addInteger) (con integer -1) ]
7+
[ (builtin addInteger) (con integer -2) ]
8+
[ (builtin lessThanInteger) (con integer 1) ]
9+
(force (builtin ifThenElse)))
10+
(lam
11+
i_0
12+
(lam
13+
i_1
14+
(lam
15+
i_2
16+
(lam
17+
i_3
18+
[
19+
(lam i_4 [ i_4 i_4 ])
20+
(lam
21+
i_5
22+
(lam
23+
i_6
24+
(force
25+
(case
26+
(constr
27+
0
28+
[ i_2 i_6 ]
29+
(delay
30+
[
31+
[ (builtin addInteger) [ [ i_5 i_5 ] [ i_1 i_6 ] ] ]
32+
[ [ i_5 i_5 ] [ i_0 i_6 ] ]
33+
]
34+
)
35+
(delay i_6))
36+
i_3)
37+
)
38+
)
39+
)
40+
]
41+
)
42+
)
43+
)
44+
))
45+
)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"compiler": {
3+
"name": "Pebble",
4+
"version": "0.1.2",
5+
"commit_hash": "40887038e5d00f171e4684f4c456ffd468008445"
6+
},
7+
"compilation_config": {
8+
"optimization_level": "none",
9+
"target": "uplc",
10+
"flags": []
11+
},
12+
"contributors": [
13+
{
14+
"name": "Michele Nuzzi",
15+
"organization": "Harmonic Labs",
16+
"contact": "michele@harmoniclabs.tech"
17+
}
18+
],
19+
"submission": {
20+
"date": "2025-11-25T00:00:00Z",
21+
"source_available": true,
22+
"source_repository": "https://github.com/Unisay/pebble-cape-submissions",
23+
"source_commit_hash": "ebb35dbe7538a0e95006e0b91dfff1eec022f1ca",
24+
"implementation_notes": "Naive recursive implementation using Pebble 0.1.2 with default compilation settings"
25+
}
26+
}

0 commit comments

Comments
 (0)