Skip to content

Commit 8e8c062

Browse files
committed
Fix the tx-cost-diff scripts for new scripts, and some small bugs
1 parent 8e637ff commit 8e8c062

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

.editorconfig

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ insert_final_newline = true
1212
indent_size = 2
1313

1414
[*.py]
15-
indent_size = 4
16-
max_line_length = 80
15+
indent_size = 2

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,9 @@ hspec-results.md
3333
/demo/.env
3434
/demo/devnet/
3535
/docs/static/haddock/
36+
37+
# tx-cost-difference files
38+
diff.md
39+
old.md
40+
new.md
41+
new-headers.txt

hydra-node/bench/tx-cost/Main.hs

+1
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ scriptSizes =
157157
, "| " <> "νDeposit" <> " | " <> serialiseToRawBytesHexText depositScriptHash <> " | " <> show depositScriptSize <> " | "
158158
, ""
159159
, "* The minting policy hash is only usable for comparison. As the script is parameterized, the actual script is unique per head."
160+
, ""
160161
]
161162
where
162163
ScriptInfo

scripts/diff.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ def parties(df):
2424
def utxo(df):
2525
return df.set_index("UTxO")
2626

27+
def utxo_and_parties(df):
28+
df = df.set_index(["UTxO", "Parties"])
29+
30+
df.index = df.index.to_flat_index()
31+
df.index.name = "UTxO, Parties"
32+
33+
return df
34+
2735
def compare(f, old, new):
2836
# New should be better, so we compare to that.
2937
df = f(new) - f(old)
@@ -67,12 +75,15 @@ def update_colour(x):
6775
, (headers[2], compare( utxo, base[3], branch[3]))
6876
]
6977

70-
# Then the remaining are all the same.
71-
for i in range(4, 9 + 1):
78+
# Then (almost all) the remaining are all the same,
79+
for i in range(4, 8 + 1):
7280
diffs.append(( headers[i - 1]
7381
, compare( parties, base[i], branch[i] )
7482
))
7583

84+
# Except fanout is different; it has parties _and_ UTxO
85+
diffs.append((headers[9], compare(utxo_and_parties, base[10], branch[10])))
86+
7687
# Check that ther was _some_ difference, at least.
7788
some_change = any( df.to_numpy().sum() != 0 for _, df in diffs )
7889

0 commit comments

Comments
 (0)