Skip to content

Commit

Permalink
feat: Brillig opcode diff report for programs (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
vezenovm authored Aug 19, 2024
1 parent 1931aaa commit 3fb8440
Show file tree
Hide file tree
Showing 17 changed files with 825 additions and 180 deletions.
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

0 comments on commit 3fb8440

Please sign in to comment.