Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Brillig opcode diff report for programs #5

Merged
merged 7 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ inputs:
required: false
report:
description: Report freshly generated to compare to reference.
default: gatesreport.json
default: gates_report.json
required: false
header:
description: The top section displayed in the markdown output.
Expand All @@ -31,6 +31,9 @@ inputs:
description: The quantile threshold to filter avg gas cost diffs to display in the summary top section.
default: 0.8
required: false
brillig_report:
description: States whether we want to generate a report of ACIR opcodes or Brillig opcodes.
default: false
# sortCriteria:
# description: The list of criteria to order diff rows by in the report (name | min | avg | median | max | calls), separated by a comma. Must have the same length as sortOrders.
# required: false
Expand Down
2 changes: 2 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"version": "0.2",
"words": [
"ACIR",
"Brillig",
"Brilligs",
"Quantile"
]
}
255 changes: 210 additions & 45 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions src/format/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const selectSummaryDiffs = (
functions: functions.filter(
(method) =>
Math.abs(method.circuit_size.percentage) >= minCircuitChangePercentage &&
(method.acir_opcodes.delta !== 0 || method.circuit_size.delta !== 0)
(method.opcodes.delta !== 0 || method.circuit_size.delta !== 0)
),
}))
.filter((diff) => diff.functions.length > 0);
Expand Down Expand Up @@ -109,7 +109,7 @@ export const formatShellDiff = (diffs: ContractDiffReport[], summaryQuantile = 0
"",
colors.bold(colors.grey((methodIndex === 0 ? diff.name : "").padEnd(maxContractLength))),
colors.italic(method.name.padEnd(maxMethodLength)),
...formatShellCell(method.acir_opcodes),
...formatShellCell(method.opcodes),
...formatShellCell(method.circuit_size),
"",
]
Expand All @@ -127,7 +127,7 @@ export const formatShellDiff = (diffs: ContractDiffReport[], summaryQuantile = 0
"",
colors.bold(colors.grey((methodIndex === 0 ? diff.name : "").padEnd(maxContractLength))),
colors.italic(method.name.padEnd(maxMethodLength)),
...formatShellCell(method.acir_opcodes),
...formatShellCell(method.opcodes),
...formatShellCell(method.circuit_size),
"",
]
Expand Down Expand Up @@ -261,7 +261,7 @@ export const formatMarkdownDiff = (
"",
`**${diff.name}**`,
diff.functions.map((method) => `_${method.name}_`).join("<br />"),
...formatMarkdownSummaryCell(diff.functions.map((method) => method.acir_opcodes)),
...formatMarkdownSummaryCell(diff.functions.map((method) => method.opcodes)),
...formatMarkdownSummaryCell(diff.functions.map((method) => method.circuit_size)),
"",
]
Expand All @@ -274,7 +274,7 @@ export const formatMarkdownDiff = (
"",
`**${diff.name}**`,
diff.functions.map((method) => `_${method.name}_`).join("<br />"),
...formatMarkdownFullCell(diff.functions.map((method) => method.acir_opcodes)),
...formatMarkdownFullCell(diff.functions.map((method) => method.opcodes)),
...formatMarkdownFullCell(diff.functions.map((method) => method.circuit_size)),
"",
]
Expand Down
Loading
Loading