Skip to content

Commit

Permalink
Partially revert Gas drops from #270
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcardon committed Dec 18, 2024
1 parent 4738d8e commit 227f568
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 59 deletions.
68 changes: 34 additions & 34 deletions pact-tests/gas-goldens/builtinGas.golden
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
>=: 264
^: 868
abs: 100
acquire-module-admin: 234194
acquire-module-admin: 295594
add-time: 750
and?: 628
at: 706
Expand All @@ -20,38 +20,38 @@ base64-encode: 311
bind: 477
ceiling: 200
chain-data: 500
compose-capability: 390200
compose-capability: 514500
compose: 2760
concat: 820
cond: 602
contains: 405
continue: 312950
create-capability-guard: 173950
create-capability-pact-guard: 184700
create-module-guard: 142900
create-pact-guard: 156050
continue: 441150
create-capability-guard: 227750
create-capability-pact-guard: 246700
create-module-guard: 188100
create-pact-guard: 209850
create-principal: 2002
create-table: 423300
create-table: 466600
days: 278
dec: 100
define-keyset: 6804
define-namespace: 37212
describe-keyset: 106804
describe-module: 224100
describe-namespace: 140174
describe-table: 523300
define-keyset: 8404
define-namespace: 43812
describe-keyset: 108404
describe-module: 262700
describe-namespace: 149724
describe-table: 566600
diff-time: 1414
distinct: 2176
drop: 1000
emit-event: 200350
emit-event: 263650
enforce-guard: 3166
enforce-keyset: 3166
enforce-verifier: 10150
enumerate: 524
exp: 4534
filter: 2760
floor: 200
fold-db: 40453150
fold-db: 40500850
fold: 1090
format-time: 1041
format: 1900
Expand All @@ -61,13 +61,13 @@ hyperlane-decode-token-message: 2175
hyperlane-encode-token-message: 2475
hyperlane-message-id: 2743
identity: 100
insert: 452950
install-capability: 505689
insert: 500650
install-capability: 670289
int-to-str: 800
is-charset: 1788
is-principal: 597
keys: 40452950
keyset-ref-guard: 8825
keys: 40500650
keyset-ref-guard: 10425
length: 801
list-modules: 100000
ln: 2016
Expand All @@ -76,49 +76,49 @@ make-list: 125
map: 1315
minutes: 276
mod: 100
namespace: 37224
namespace: 43824
negate: 100
not: 364
not?: 364
or?: 364
pact-id: 169750
pairing-check: 11064258
pact-id: 225850
pairing-check: 12003058
parse-time: 602
point-add: 5500
poseidon-hash-hack-a-chain: 6393700
read-decimal: 303
read-integer: 303
read-keyset: 7008
read-keyset: 8608
read-msg: 303
read-string: 303
read: 457650
read: 507550
remove: 360
require-capability: 304750
resume: 380356
require-capability: 402750
resume: 515256
reverse: 700
round: 200
scalar-mult: 360300
select: 40453100
select: 40500800
shift: 886
show: 1300
sort: 1200
sqrt: 2022
static-redeploy: 199200
static-redeploy: 298800
str-to-int: 408
str-to-list: 751
take: 1800
time: 500
tx-hash: 100
typeof-principal: 797
typeof: 100
update: 482650
update: 534750
validate-principal: 3940
where: 1640
with-default-read: 460916
with-read: 457833
write: 452950
with-default-read: 510816
with-read: 507733
write: 500650
xor: 500
yield: 247675
yield: 328075
zip: 4320
|: 500
~: 250
12 changes: 6 additions & 6 deletions pact-tests/legacy-serial-tests/coin-v5/coin-v5.repl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
(env-gaslog)
(expect
"Gas cost of coin contract account creation"
36 (env-gas))
42 (env-gas))

(create-account 'doug (read-keyset 'doug))

Expand Down Expand Up @@ -91,7 +91,7 @@
(env-gaslog)
(expect
"Gas cost of querying an account's balance"
6 (env-gas))
9 (env-gas))

; account information checks out for new accounts
(env-gas 0) (env-gaslog)
Expand All @@ -102,7 +102,7 @@
(env-gaslog)
(expect
"Gas cost of querying the details of an account"
7 (env-gas))
10 (env-gas))

(commit-tx)

Expand All @@ -128,7 +128,7 @@
(env-gaslog)
(expect
"Gas cost of testing the DEBIT capability"
8 (env-gas))
12 (env-gas))

; debit tests
(expect-failure
Expand Down Expand Up @@ -396,7 +396,7 @@
(env-gaslog)
(expect
"Gas cost of transfer"
99 (env-gas))
121 (env-gas))

(expect-failure "emily->doug capability used up"
"TRANSFER exceeded"
Expand Down Expand Up @@ -433,7 +433,7 @@
(transfer-create 'doug 'will (read-keyset 'will) 1.0))
(env-gaslog)
(expect
"Gas cost of transfer-create" 93 (env-gas))
"Gas cost of transfer-create" 108 (env-gas))

(expect
"doug now has 0.4 coins"
Expand Down
16 changes: 8 additions & 8 deletions pact-tests/pact-tests/coin-v1.repl
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
(env-gaslog)
(expect
"Gas cost of loading fungible contract"
657 (env-gas))
844 (env-gas))

(env-gas 0) (env-gaslog)
(load "coin-v1/coin.pact")
(env-gaslog)
(expect
"Gas cost of loading coin contract"
12562 (env-gas))
16389 (env-gas))
(env-gas 0)
(commit-tx)

Expand Down Expand Up @@ -50,7 +50,7 @@
(env-gaslog)
(expect
"Gas cost of coin contract account creation"
33 (env-gas))
40 (env-gas))

(create-account 'doug (read-keyset 'doug))

Expand Down Expand Up @@ -90,7 +90,7 @@
(env-gaslog)
(expect
"Gas cost of querying an account's balance"
6 (env-gas))
9 (env-gas))

; account information checks out for new accounts
(env-gas 0) (env-gaslog)
Expand All @@ -101,7 +101,7 @@
(env-gaslog)
(expect
"Gas cost of querying the details of an account"
7 (env-gas))
10 (env-gas))

(commit-tx)

Expand All @@ -127,7 +127,7 @@
(env-gaslog)
(expect
"Gas cost of testing the DEBIT capability"
8 (env-gas))
12 (env-gas))

; debit tests
(expect-failure
Expand Down Expand Up @@ -395,7 +395,7 @@
(env-gaslog)
(expect
"Gas cost of transfer"
99 (env-gas))
121 (env-gas))

(expect-failure "emily->doug capability used up"
"TRANSFER exceeded"
Expand Down Expand Up @@ -432,7 +432,7 @@
(transfer-create 'doug 'will (read-keyset 'will) 1.0))
(env-gaslog)
(expect
"Gas cost of transfer-create" 90 (env-gas))
"Gas cost of transfer-create" 106 (env-gas))

(expect
"doug now has 0.4 coins"
Expand Down
18 changes: 9 additions & 9 deletions pact-tests/pact-tests/coin-v5.repl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
(env-gaslog)
(expect
"Gas cost of loading fungible contract"
713 (env-gas))
918 (env-gas))
(commit-tx)

(env-gasmodel "table")
Expand All @@ -18,15 +18,15 @@
(env-gaslog)
(expect
"Gas cost of loading fungible-xchain contract"
291 (env-gas))
371 (env-gas))
(commit-tx)
(begin-tx)
(env-gas 0)
(load "coin-v5/coin-v5.pact")
(env-gaslog)
(expect
"Gas cost of loading coin contract"
15588
20537
(env-gas))

(create-table coin.coin-table)
Expand Down Expand Up @@ -63,7 +63,7 @@
(env-gaslog)
(expect
"Gas cost of coin contract account creation"
36 (env-gas))
42 (env-gas))

(create-account 'doug (read-keyset 'doug))

Expand Down Expand Up @@ -103,7 +103,7 @@
(env-gaslog)
(expect
"Gas cost of querying an account's balance"
6 (env-gas))
9 (env-gas))

; account information checks out for new accounts
(env-gas 0) (env-gaslog)
Expand All @@ -114,7 +114,7 @@
(env-gaslog)
(expect
"Gas cost of querying the details of an account"
7 (env-gas))
10 (env-gas))
(commit-tx)

;; credits + debits should succeed. Both should reflect the correct balance
Expand All @@ -139,7 +139,7 @@
(env-gaslog)
(expect
"Gas cost of testing the DEBIT capability"
8 (env-gas))
12 (env-gas))

; debit tests
(expect-failure
Expand Down Expand Up @@ -407,7 +407,7 @@
(env-gaslog)
(expect
"Gas cost of transfer"
99 (env-gas))
121 (env-gas))

(expect-failure "emily->doug capability used up"
"TRANSFER exceeded"
Expand Down Expand Up @@ -444,7 +444,7 @@
(transfer-create 'doug 'will (read-keyset 'will) 1.0))
(env-gaslog)
(expect
"Gas cost of transfer-create" 93 (env-gas))
"Gas cost of transfer-create" 108 (env-gas))

(expect
"doug now has 0.4 coins"
Expand Down
4 changes: 2 additions & 2 deletions pact/Pact/Core/Gas/TableGasModel.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ tableGasCostConfig = GasCostConfig
-- 80 bytes per microsecond, or 1 byte = 5 milligas after conversions
-- (80 bytes / 1 microsecond) * (2.5 micros / 1000 milligas) = 0.2 milligas per byte or 1 byte = 5 milligas
-- We add some extra overhead here, because we need to serialize and perform other checks.
, _gcPerByteWriteCost = 100
, _gcPerByteWriteCost = 200
-- Reads also tend to be about twice as fast as writes, so we charge a bit less
, _gcPerByteReadCost = 50
, _gcPerByteReadCost = 100
, _gcSortBytePenaltyReduction = 1000
, _gcPoseidonQuadraticGasFactor = 50_000
, _gcPoseidonLinearGasFactor = 38_000
Expand Down

0 comments on commit 227f568

Please sign in to comment.