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

Kwxm/costing/bitwise 4 #6301

Merged
merged 24 commits into from
Jul 24, 2024
Merged

Kwxm/costing/bitwise 4 #6301

merged 24 commits into from
Jul 24, 2024

Conversation

kwxm
Copy link
Contributor

@kwxm kwxm commented Jul 11, 2024

This adds costing benchmarks for the new bitwise builtins and a cost model based on the benchmark results. I ran a large number of exploratory benchmarks at various scales and with various configurations (eg, extension semantics v. truncation semantics for andByteString and different indices for readBit). The final benchmarks are designed to measure the worst case behaviour and to be fairly accurate for "small" inputs (mostly up to 1200 bytes). The models based on these benchmarks generally extrapolate well to larger inputs. The attached graph is fairly typical (the blue points are benchmark times for large inputs, the red points are the times for the final benchmarks, and the orange line is the line of best fit through the red points).

ComplementByteString

@kwxm kwxm added Builtins Costing Anything relating to costs, fees, gas, etc. labels Jul 11, 2024
@kwxm kwxm requested review from zliu41 and effectfully July 11, 2024 02:03
@@ -100,6 +103,10 @@ genConstant tr
, Just HRefl <- eqTypeRep trList (typeRep @[]) =
case genConstant trElem of
SomeGen genElem -> SomeGen $ Gen.list (Range.linear 0 10) genElem
| trList' `App` trElem <- tr
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@effectfully Does this look right to you?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, looks correct to me. Except the range is somewhat short, but maybe that's how it's supposed to be, don't know. In the bright future I'll kill all of it and create a proper QuickCheck generator for all this stuff.

Copy link
Contributor Author

@kwxm kwxm Jul 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except the range is somewhat short,

I just copied that from the case for [] without thinking. I'm not sure exactly which tests these generators get used in, so it's not clear to me whether we need bigger lists.

@kwxm
Copy link
Contributor Author

kwxm commented Jul 11, 2024

/benchmark validation

1 similar comment
@kwxm
Copy link
Contributor Author

kwxm commented Jul 11, 2024

/benchmark validation

Copy link
Contributor

Click here to check the status of your benchmark.

@kwxm
Copy link
Contributor Author

kwxm commented Jul 11, 2024

/benchmark nofib

Copy link
Contributor

Comparing benchmark results of 'validation' on '42d08e08a' (base) and 'e4fa023d5' (PR)

Results table
Script 42d08e0 e4fa023 Change
auction_1-1 177.1 μs 175.2 μs -1.1%
auction_1-2 645.8 μs 618.9 μs -4.2%
auction_1-3 638.2 μs 615.6 μs -3.5%
auction_1-4 228.6 μs 227.0 μs -0.7%
auction_2-1 180.7 μs 177.9 μs -1.5%
auction_2-2 655.9 μs 629.5 μs -4.0%
auction_2-3 854.7 μs 825.8 μs -3.4%
auction_2-4 647.7 μs 623.7 μs -3.7%
auction_2-5 230.7 μs 228.7 μs -0.9%
crowdfunding-success-1 211.1 μs 208.0 μs -1.5%
crowdfunding-success-2 208.0 μs 208.3 μs +0.1%
crowdfunding-success-3 208.4 μs 207.8 μs -0.3%
currency-1 248.5 μs 244.0 μs -1.8%
escrow-redeem_1-1 352.9 μs 345.1 μs -2.2%
escrow-redeem_1-2 354.9 μs 343.7 μs -3.2%
escrow-redeem_2-1 412.2 μs 402.5 μs -2.4%
escrow-redeem_2-2 412.1 μs 404.3 μs -1.9%
escrow-redeem_2-3 412.1 μs 409.2 μs -0.7%
escrow-refund-1 155.8 μs 154.2 μs -1.0%
future-increase-margin-1 251.4 μs 244.9 μs -2.6%
future-increase-margin-2 549.2 μs 538.4 μs -2.0%
future-increase-margin-3 547.5 μs 537.5 μs -1.8%
future-increase-margin-4 497.8 μs 487.8 μs -2.0%
future-increase-margin-5 832.0 μs 813.6 μs -2.2%
future-pay-out-1 251.1 μs 246.5 μs -1.8%
future-pay-out-2 546.4 μs 538.7 μs -1.4%
future-pay-out-3 547.4 μs 540.3 μs -1.3%
future-pay-out-4 831.5 μs 812.7 μs -2.3%
future-settle-early-1 250.7 μs 247.5 μs -1.3%
future-settle-early-2 547.8 μs 539.7 μs -1.5%
future-settle-early-3 548.3 μs 538.9 μs -1.7%
future-settle-early-4 620.0 μs 608.4 μs -1.9%
game-sm-success_1-1 392.5 μs 390.5 μs -0.5%
game-sm-success_1-2 199.5 μs 199.0 μs -0.3%
game-sm-success_1-3 651.4 μs 646.2 μs -0.8%
game-sm-success_1-4 225.6 μs 225.3 μs -0.1%
game-sm-success_2-1 392.9 μs 391.5 μs -0.4%
game-sm-success_2-2 200.1 μs 198.8 μs -0.6%
game-sm-success_2-3 651.4 μs 644.2 μs -1.1%
game-sm-success_2-4 225.9 μs 229.6 μs +1.6%
game-sm-success_2-5 651.5 μs 644.8 μs -1.0%
game-sm-success_2-6 226.0 μs 226.8 μs +0.4%
multisig-sm-1 402.4 μs 399.6 μs -0.7%
multisig-sm-2 392.9 μs 389.4 μs -0.9%
multisig-sm-3 397.5 μs 394.3 μs -0.8%
multisig-sm-4 398.9 μs 396.9 μs -0.5%
multisig-sm-5 564.6 μs 561.5 μs -0.5%
multisig-sm-6 402.5 μs 399.5 μs -0.7%
multisig-sm-7 393.8 μs 390.0 μs -1.0%
multisig-sm-8 394.5 μs 393.8 μs -0.2%
multisig-sm-9 400.2 μs 397.3 μs -0.7%
multisig-sm-10 564.2 μs 559.3 μs -0.9%
ping-pong-1 331.8 μs 327.3 μs -1.4%
ping-pong-2 334.7 μs 327.0 μs -2.3%
ping-pong_2-1 202.3 μs 200.9 μs -0.7%
prism-1 169.8 μs 170.1 μs +0.2%
prism-2 417.3 μs 414.3 μs -0.7%
prism-3 368.8 μs 368.7 μs -0.0%
pubkey-1 142.9 μs 142.7 μs -0.1%
stablecoin_1-1 916.3 μs 912.4 μs -0.4%
stablecoin_1-2 195.3 μs 196.2 μs +0.5%
stablecoin_1-3 1.053 ms 1.052 ms -0.1%
stablecoin_1-4 206.5 μs 207.5 μs +0.5%
stablecoin_1-5 1.352 ms 1.350 ms -0.1%
stablecoin_1-6 256.2 μs 257.6 μs +0.5%
stablecoin_2-1 915.8 μs 913.6 μs -0.2%
stablecoin_2-2 195.1 μs 196.9 μs +0.9%
stablecoin_2-3 1.052 ms 1.050 ms -0.2%
stablecoin_2-4 206.6 μs 207.0 μs +0.2%
token-account-1 192.3 μs 191.2 μs -0.6%
token-account-2 341.0 μs 340.5 μs -0.1%
uniswap-1 419.2 μs 413.6 μs -1.3%
uniswap-2 223.7 μs 222.7 μs -0.4%
uniswap-3 1.763 ms 1.764 ms +0.1%
uniswap-4 332.3 μs 336.3 μs +1.2%
uniswap-5 1.158 ms 1.165 ms +0.6%
uniswap-6 320.0 μs 324.5 μs +1.4%
vesting-1 352.5 μs 351.4 μs -0.3%
TOTAL 35.60 ms 35.23 ms -1.1%

Copy link
Contributor

Click here to check the status of your benchmark.

Copy link
Contributor

Comparing benchmark results of 'validation' on '42d08e08a' (base) and 'e4fa023d5' (PR)

Results table
Script 42d08e0 e4fa023 Change
auction_1-1 178.2 μs 179.4 μs +0.7%
auction_1-2 652.6 μs 634.2 μs -2.8%
auction_1-3 649.5 μs 628.2 μs -3.3%
auction_1-4 231.3 μs 229.8 μs -0.6%
auction_2-1 180.8 μs 179.6 μs -0.7%
auction_2-2 655.2 μs 637.5 μs -2.7%
auction_2-3 855.3 μs 830.1 μs -2.9%
auction_2-4 648.5 μs 627.0 μs -3.3%
auction_2-5 231.3 μs 229.8 μs -0.6%
crowdfunding-success-1 211.4 μs 209.5 μs -0.9%
crowdfunding-success-2 212.4 μs 209.9 μs -1.2%
crowdfunding-success-3 211.5 μs 209.4 μs -1.0%
currency-1 251.5 μs 245.0 μs -2.6%
escrow-redeem_1-1 353.1 μs 346.6 μs -1.8%
escrow-redeem_1-2 353.8 μs 344.7 μs -2.6%
escrow-redeem_2-1 412.4 μs 404.3 μs -2.0%
escrow-redeem_2-2 412.0 μs 404.7 μs -1.8%
escrow-redeem_2-3 413.9 μs 405.1 μs -2.1%
escrow-refund-1 155.6 μs 158.9 μs +2.1%
future-increase-margin-1 251.3 μs 244.9 μs -2.5%
future-increase-margin-2 549.8 μs 535.1 μs -2.7%
future-increase-margin-3 548.1 μs 536.8 μs -2.1%
future-increase-margin-4 498.3 μs 486.5 μs -2.4%
future-increase-margin-5 832.9 μs 810.0 μs -2.7%
future-pay-out-1 251.4 μs 244.9 μs -2.6%
future-pay-out-2 547.2 μs 533.6 μs -2.5%
future-pay-out-3 550.2 μs 535.4 μs -2.7%
future-pay-out-4 832.6 μs 809.1 μs -2.8%
future-settle-early-1 250.8 μs 245.5 μs -2.1%
future-settle-early-2 536.5 μs 539.8 μs +0.6%
future-settle-early-3 540.9 μs 542.4 μs +0.3%
future-settle-early-4 611.2 μs 604.9 μs -1.0%
game-sm-success_1-1 388.2 μs 390.4 μs +0.6%
game-sm-success_1-2 197.3 μs 198.6 μs +0.7%
game-sm-success_1-3 644.3 μs 649.1 μs +0.7%
game-sm-success_1-4 223.7 μs 228.1 μs +2.0%
game-sm-success_2-1 388.8 μs 394.7 μs +1.5%
game-sm-success_2-2 197.4 μs 200.6 μs +1.6%
game-sm-success_2-3 644.4 μs 649.6 μs +0.8%
game-sm-success_2-4 223.4 μs 227.3 μs +1.7%
game-sm-success_2-5 644.0 μs 649.2 μs +0.8%
game-sm-success_2-6 222.8 μs 229.4 μs +3.0%
multisig-sm-1 397.8 μs 403.1 μs +1.3%
multisig-sm-2 387.3 μs 392.3 μs +1.3%
multisig-sm-3 393.7 μs 395.7 μs +0.5%
multisig-sm-4 391.6 μs 397.5 μs +1.5%
multisig-sm-5 554.1 μs 563.8 μs +1.8%
multisig-sm-6 394.4 μs 401.6 μs +1.8%
multisig-sm-7 384.0 μs 391.5 μs +2.0%
multisig-sm-8 388.9 μs 395.7 μs +1.7%
multisig-sm-9 393.2 μs 398.7 μs +1.4%
multisig-sm-10 553.5 μs 563.2 μs +1.8%
ping-pong-1 326.8 μs 330.0 μs +1.0%
ping-pong-2 326.7 μs 329.2 μs +0.8%
ping-pong_2-1 197.9 μs 202.2 μs +2.2%
prism-1 166.3 μs 170.3 μs +2.4%
prism-2 406.4 μs 414.1 μs +1.9%
prism-3 361.4 μs 371.5 μs +2.8%
pubkey-1 139.9 μs 143.3 μs +2.4%
stablecoin_1-1 900.4 μs 915.7 μs +1.7%
stablecoin_1-2 190.9 μs 196.8 μs +3.1%
stablecoin_1-3 1.033 ms 1.053 ms +1.9%
stablecoin_1-4 202.4 μs 207.0 μs +2.3%
stablecoin_1-5 1.325 ms 1.353 ms +2.1%
stablecoin_1-6 251.4 μs 258.7 μs +2.9%
stablecoin_2-1 900.6 μs 915.3 μs +1.6%
stablecoin_2-2 192.9 μs 196.8 μs +2.0%
stablecoin_2-3 1.053 ms 1.053 ms 0.0%
stablecoin_2-4 206.7 μs 206.6 μs -0.0%
token-account-1 188.5 μs 191.4 μs +1.5%
token-account-2 335.1 μs 341.7 μs +2.0%
uniswap-1 411.0 μs 414.0 μs +0.7%
uniswap-2 218.8 μs 222.1 μs +1.5%
uniswap-3 1.731 ms 1.769 ms +2.2%
uniswap-4 326.7 μs 337.0 μs +3.2%
uniswap-5 1.146 ms 1.169 ms +2.0%
uniswap-6 320.3 μs 324.9 μs +1.4%
vesting-1 345.5 μs 353.3 μs +2.3%
TOTAL 35.29 ms 35.34 ms +0.1%

Copy link
Contributor

Click here to check the status of your benchmark.

Copy link
Contributor

Comparing benchmark results of 'nofib' on '42d08e08a' (base) and 'e4fa023d5' (PR)

Results table
Script 42d08e0 e4fa023 Change
clausify/formula1 3.060 ms 3.173 ms +3.7%
clausify/formula2 4.074 ms 4.231 ms +3.9%
clausify/formula3 11.15 ms 11.57 ms +3.8%
clausify/formula4 25.56 ms 26.52 ms +3.8%
clausify/formula5 53.73 ms 56.03 ms +4.3%
knights/4x4 17.42 ms 18.07 ms +3.7%
knights/6x6 46.29 ms 47.54 ms +2.7%
knights/8x8 80.86 ms 83.43 ms +3.2%
primetest/05digits 9.888 ms 10.29 ms +4.1%
primetest/08digits 16.19 ms 16.70 ms +3.2%
primetest/10digits 19.77 ms 20.16 ms +2.0%
primetest/20digits 39.42 ms 40.13 ms +1.8%
primetest/30digits 60.64 ms 61.61 ms +1.6%
primetest/40digits 82.12 ms 83.54 ms +1.7%
primetest/50digits 100.2 ms 101.9 ms +1.7%
queens4x4/bt 5.426 ms 5.473 ms +0.9%
queens4x4/bm 6.830 ms 6.942 ms +1.6%
queens4x4/bjbt1 6.598 ms 6.684 ms +1.3%
queens4x4/bjbt2 6.157 ms 6.226 ms +1.1%
queens4x4/fc 13.83 ms 14.05 ms +1.6%
queens5x5/bt 73.42 ms 74.08 ms +0.9%
queens5x5/bm 76.78 ms 78.01 ms +1.6%
queens5x5/bjbt1 85.75 ms 86.67 ms +1.1%
queens5x5/bjbt2 82.97 ms 84.03 ms +1.3%
queens5x5/fc 175.6 ms 178.1 ms +1.4%
TOTAL 1.104 s 1.125 s +1.9%

@kwxm
Copy link
Contributor Author

kwxm commented Jul 11, 2024

/benchmark nofib

Copy link
Contributor

Click here to check the status of your benchmark.

Copy link
Contributor

Comparing benchmark results of 'nofib' on '42d08e08a' (base) and 'e4fa023d5' (PR)

Results table
Script 42d08e0 e4fa023 Change
clausify/formula1 3.107 ms 3.062 ms -1.4%
clausify/formula2 4.121 ms 4.110 ms -0.3%
clausify/formula3 11.33 ms 11.30 ms -0.3%
clausify/formula4 25.84 ms 25.81 ms -0.1%
clausify/formula5 54.48 ms 54.62 ms +0.3%
knights/4x4 17.27 ms 17.65 ms +2.2%
knights/6x6 45.65 ms 46.25 ms +1.3%
knights/8x8 80.53 ms 81.10 ms +0.7%
primetest/05digits 9.790 ms 10.03 ms +2.5%
primetest/08digits 15.82 ms 16.53 ms +4.5%
primetest/10digits 19.15 ms 19.87 ms +3.8%
primetest/20digits 38.26 ms 39.68 ms +3.7%
primetest/30digits 58.86 ms 61.12 ms +3.8%
primetest/40digits 79.48 ms 83.09 ms +4.5%
primetest/50digits 98.13 ms 101.4 ms +3.3%
queens4x4/bt 5.284 ms 5.455 ms +3.2%
queens4x4/bm 6.679 ms 6.939 ms +3.9%
queens4x4/bjbt1 6.471 ms 6.658 ms +2.9%
queens4x4/bjbt2 6.025 ms 6.215 ms +3.2%
queens4x4/fc 13.56 ms 14.05 ms +3.6%
queens5x5/bt 72.19 ms 74.07 ms +2.6%
queens5x5/bm 76.93 ms 78.11 ms +1.5%
queens5x5/bjbt1 86.19 ms 86.74 ms +0.6%
queens5x5/bjbt2 83.40 ms 84.16 ms +0.9%
queens5x5/fc 175.4 ms 178.5 ms +1.8%
TOTAL 1.094 s 1.117 s +2.1%

@kwxm
Copy link
Contributor Author

kwxm commented Jul 12, 2024

/benchmark nofib

@kwxm
Copy link
Contributor Author

kwxm commented Jul 12, 2024

/benchmark validation

Copy link
Contributor

Click here to check the status of your benchmark.

Copy link
Contributor

Comparing benchmark results of 'nofib' on '42d08e08a' (base) and 'e4fa023d5' (PR)

Results table
Script 42d08e0 e4fa023 Change
clausify/formula1 3.083 ms 3.098 ms +0.5%
clausify/formula2 4.117 ms 4.148 ms +0.8%
clausify/formula3 11.32 ms 11.31 ms -0.1%
clausify/formula4 25.85 ms 25.97 ms +0.5%
clausify/formula5 54.84 ms 55.07 ms +0.4%
knights/4x4 17.64 ms 17.79 ms +0.9%
knights/6x6 46.62 ms 46.70 ms +0.2%
knights/8x8 81.78 ms 82.20 ms +0.5%
primetest/05digits 9.989 ms 10.14 ms +1.5%
primetest/08digits 16.18 ms 16.52 ms +2.1%
primetest/10digits 19.59 ms 19.82 ms +1.2%
primetest/20digits 38.89 ms 39.70 ms +2.1%
primetest/30digits 60.23 ms 61.39 ms +1.9%
primetest/40digits 81.04 ms 83.22 ms +2.7%
primetest/50digits 99.05 ms 101.4 ms +2.4%
queens4x4/bt 5.391 ms 5.501 ms +2.0%
queens4x4/bm 6.783 ms 6.938 ms +2.3%
queens4x4/bjbt1 6.584 ms 6.682 ms +1.5%
queens4x4/bjbt2 6.109 ms 6.229 ms +2.0%
queens4x4/fc 13.75 ms 14.06 ms +2.3%
queens5x5/bt 72.89 ms 74.02 ms +1.6%
queens5x5/bm 76.27 ms 78.16 ms +2.5%
queens5x5/bjbt1 85.18 ms 86.77 ms +1.9%
queens5x5/bjbt2 82.60 ms 84.08 ms +1.8%
queens5x5/fc 174.8 ms 178.6 ms +2.2%
TOTAL 1.101 s 1.120 s +1.7%

Copy link
Contributor

Click here to check the status of your benchmark.

Copy link
Contributor

Comparing benchmark results of 'validation' on '42d08e08a' (base) and '1c763cdb1' (PR)

Results table
Script 42d08e0 1c763cd Change
auction_1-1 180.6 μs 187.9 μs +4.0%
auction_1-2 655.9 μs 655.0 μs -0.1%
auction_1-3 650.6 μs 646.1 μs -0.7%
auction_1-4 231.6 μs 236.4 μs +2.1%
auction_2-1 181.7 μs 184.5 μs +1.5%
auction_2-2 654.6 μs 652.5 μs -0.3%
auction_2-3 859.4 μs 848.4 μs -1.3%
auction_2-4 651.0 μs 635.8 μs -2.3%
auction_2-5 233.4 μs 231.3 μs -0.9%
crowdfunding-success-1 212.4 μs 211.2 μs -0.6%
crowdfunding-success-2 212.3 μs 211.5 μs -0.4%
crowdfunding-success-3 212.1 μs 211.3 μs -0.4%
currency-1 252.2 μs 246.6 μs -2.2%
escrow-redeem_1-1 348.8 μs 347.9 μs -0.3%
escrow-redeem_1-2 347.7 μs 348.7 μs +0.3%
escrow-redeem_2-1 405.9 μs 406.3 μs +0.1%
escrow-redeem_2-2 406.0 μs 407.9 μs +0.5%
escrow-redeem_2-3 409.1 μs 407.9 μs -0.3%
escrow-refund-1 154.1 μs 159.6 μs +3.6%
future-increase-margin-1 248.8 μs 246.4 μs -1.0%
future-increase-margin-2 542.1 μs 538.5 μs -0.7%
future-increase-margin-3 550.8 μs 539.1 μs -2.1%
future-increase-margin-4 499.4 μs 489.2 μs -2.0%
future-increase-margin-5 837.5 μs 813.5 μs -2.9%
future-pay-out-1 252.1 μs 246.7 μs -2.1%
future-pay-out-2 549.2 μs 537.5 μs -2.1%
future-pay-out-3 549.8 μs 540.8 μs -1.6%
future-pay-out-4 826.9 μs 811.8 μs -1.8%
future-settle-early-1 247.3 μs 245.9 μs -0.6%
future-settle-early-2 538.1 μs 540.6 μs +0.5%
future-settle-early-3 540.6 μs 538.5 μs -0.4%
future-settle-early-4 608.5 μs 608.2 μs -0.0%
game-sm-success_1-1 387.6 μs 389.6 μs +0.5%
game-sm-success_1-2 196.6 μs 198.7 μs +1.1%
game-sm-success_1-3 641.2 μs 640.9 μs -0.0%
game-sm-success_1-4 222.2 μs 224.5 μs +1.0%
game-sm-success_2-1 387.6 μs 391.0 μs +0.9%
game-sm-success_2-2 196.6 μs 198.6 μs +1.0%
game-sm-success_2-3 640.8 μs 641.5 μs +0.1%
game-sm-success_2-4 222.6 μs 224.4 μs +0.8%
game-sm-success_2-5 641.4 μs 652.8 μs +1.8%
game-sm-success_2-6 221.9 μs 230.1 μs +3.7%
multisig-sm-1 396.9 μs 405.5 μs +2.2%
multisig-sm-2 385.8 μs 394.4 μs +2.2%
multisig-sm-3 391.2 μs 397.2 μs +1.5%
multisig-sm-4 394.3 μs 401.3 μs +1.8%
multisig-sm-5 555.9 μs 566.6 μs +1.9%
multisig-sm-6 396.4 μs 404.2 μs +2.0%
multisig-sm-7 387.0 μs 395.2 μs +2.1%
multisig-sm-8 390.8 μs 389.3 μs -0.4%
multisig-sm-9 393.7 μs 393.7 μs 0.0%
multisig-sm-10 557.4 μs 557.3 μs -0.0%
ping-pong-1 328.0 μs 331.2 μs +1.0%
ping-pong-2 330.0 μs 331.2 μs +0.4%
ping-pong_2-1 203.4 μs 203.3 μs -0.0%
prism-1 170.0 μs 171.9 μs +1.1%
prism-2 418.3 μs 417.9 μs -0.1%
prism-3 371.4 μs 372.7 μs +0.4%
pubkey-1 144.2 μs 144.0 μs -0.1%
stablecoin_1-1 920.9 μs 900.5 μs -2.2%
stablecoin_1-2 196.2 μs 194.0 μs -1.1%
stablecoin_1-3 1.058 ms 1.044 ms -1.3%
stablecoin_1-4 207.6 μs 205.4 μs -1.1%
stablecoin_1-5 1.359 ms 1.341 ms -1.3%
stablecoin_1-6 256.4 μs 258.9 μs +1.0%
stablecoin_2-1 923.5 μs 919.2 μs -0.5%
stablecoin_2-2 196.7 μs 196.8 μs +0.1%
stablecoin_2-3 1.059 ms 1.036 ms -2.2%
stablecoin_2-4 207.3 μs 205.8 μs -0.7%
token-account-1 193.4 μs 189.4 μs -2.1%
token-account-2 343.0 μs 338.6 μs -1.3%
uniswap-1 421.2 μs 411.2 μs -2.4%
uniswap-2 224.3 μs 221.2 μs -1.4%
uniswap-3 1.774 ms 1.777 ms +0.2%
uniswap-4 334.0 μs 337.9 μs +1.2%
uniswap-5 1.164 ms 1.172 ms +0.7%
uniswap-6 321.3 μs 326.7 μs +1.7%
vesting-1 354.1 μs 352.7 μs -0.4%
TOTAL 35.54 ms 35.43 ms -0.3%

Copy link
Contributor

@effectfully effectfully left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modulo what I think is a bug, this all is great. I didn't dive too deep into the costing stuff though, just a shallow review.

@@ -0,0 +1,6 @@
<!--
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably want to remove the <!-- and --> parts.

Comment on lines +72 to +81
-- FIXME. This is arguably slightly incorrect because some of the arguments are
-- wrapped in newtypes that change the memory usage instance of their content
-- and this isn't reflected in the output. We're able to fix this for
-- LiteralInYOrLinearInZ since we can tell from the constructor that the second
-- argument is wrapped, but this doesn't work for `replicateByte`, where the
-- replication count is wrapped in NumBytesCostedAsNumWords and we don't see that
-- here. We should really print "x bytes" instead of just "x", but to fix that
-- we'd need access to the signatures of the builtins here as well. Maybe it
-- could be argued that the user should be aware of the wrappings and interpret
-- the output accordingly, but it would be helpful to make it explicit.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's nasty, perhaps we should indeed render models for specific builtins rather than models alone? Dunno, maybe it's fine to omit the units...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a terribly important program so I didn't put the effort in to fix it. I'll think about what to do though.

@@ -69,23 +93,23 @@ renderModel =
QuadraticInY f -> [ renderOneVariableQuadraticFunction f "y" ]
QuadraticInZ f -> [ renderOneVariableQuadraticFunction f "z" ]
QuadraticInXAndY f -> [ renderTwoVariableQuadraticFunction f "x" "y" ]
LinearInMaxYZ f -> [ renderLinearFunction f "max(y,z)" ]
LinearInYAndZ f -> [ renderTwoVariableLinearFunction f "y" "z" ]
LiteralInYOrLinearInZ f -> [ "if y==0"
, printf "then %s" $ renderLinearFunction f "z"
, printf "else y bytes"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... but then should we omit them everywhere and here as well?

++ " bytes)"
emit $ "Length requested: " <> (pack . show $ len)
evaluationFailure
| otherwise = pure . BS.replicate (fromIntegral len) $ w8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the change from Int to Integer and this fromIntegral call? I'm not a fan of the under/overflowing fromIntegral even if we shielded ourselves here with the < 0 and > integerToByteStringMaximumOutputLength checks. I'm just nitpicking though.

Copy link
Contributor Author

@kwxm kwxm Jul 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the change from Int to Integer and this fromIntegral call?

The reason for that is that we already had the NumBytesCostedAsNumWords wrapper for one of the arguments to integerToByteString and I needed it again here, but integerToByteString takes an Integer argument so that's what it was wrapping. Here the underlying function took an Int so I would have needed a separate wrapper (wouldn't I?). Maybe we should introduce a version of fromIntegral that fails if the argument doesn't fit into an Int just to avoid any unpleasant surprises.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've put this back to the way it was before and changed the contents of NumBytesCostedAsNumWords to Int.

)
=> MakeKnownIn DefaultUni term (ListCostedByLength a)
deriving newtype instance
forall term tyname a .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had no idea it was possible to use forall here. Thank you!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I just tried that randomly and it worked! I was quite surprised when it did.

Copy link
Contributor Author

@kwxm kwxm Jul 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, wait. I think that's why we need AllowAmbiguousTypes. Without that, at line 492 I get

plutus-core/src/PlutusCore/Default/Universe.hs:492:3: error: [GHC-39999]
    • Could not deduce ‘KnownTypeAst tyname0 DefaultUni a’
      from the context: (Contains DefaultUni a,
                         HasConstantIn DefaultUni term, KnownTypeAst tyname DefaultUni a)
        bound by a stand-alone deriving instance declaration:
                   forall term tyname a.
                   (Contains DefaultUni a, HasConstantIn DefaultUni term,
                    KnownTypeAst tyname DefaultUni a) =>
                   MakeKnownIn DefaultUni term (ListCostedByLength a)
        at plutus-core/src/PlutusCore/Default/Universe.hs:(492,3)-(497,55)
      The type variable ‘tyname0’ is ambiguous
       <etc. etc. etc.>

I'm not sure why it does that, but later it says

In the ambiguity check for a stand-alone deriving instance declaration
      To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
      In the stand-alone deriving instance for
        ‘forall term tyname a. (Contains DefaultUni a,
                                HasConstantIn DefaultUni term,
                                KnownTypeAst tyname DefaultUni a) =>
                               MakeKnownIn DefaultUni term (ListCostedByLength a)’

and I did what it told me to,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, why do you have a KnownTypeAst constraint in there? I'll take a close look.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in this commit.

let shiftByteStringDenotation :: BS.ByteString -> Int -> BS.ByteString
shiftByteStringDenotation = Bitwise.shiftByteString
let shiftByteStringDenotation :: BS.ByteString -> IntegerCostedLiterally -> BS.ByteString
shiftByteStringDenotation s (IntegerCostedLiterally n) = Bitwise.shiftByteString s (fromIntegral n)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a major bug I believe. fromIntegral wraps around:

>>> fromIntegral (toInteger (maxBound :: Int) + 1) :: Int
-9223372036854775808

and costing won't save you because the builtin is linear in its first argument and the second one is irrelevant costing-wise. Meaning this builtin now accepts large integers, runs and misbehaves without throwing, while previously it'd throw a runtime operational error along the lines of "the given Integer isn't in the bounds of Int".

And even if this isn't a bug, you can't use fromIntegral. Quoting the docs in this module

    YOU MUST NEVER USE 'fromIntegral' AND SIMILAR FUNCTIONS THAT CAN SILENTLY UNDER- OR OVERFLOW
    WHEN DEFINING A BUILT-IN FUNCTION

It's way too general and can easily result in overflow/underflow if Int is changed to Integer in the type signature of a builtin like you did with replicateByte.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops! Thanks for pointing that out. I'll fix it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be fixed now, but we need to see what happens with #6309 before merging this PR.

let rotateByteStringDenotation :: BS.ByteString -> Int -> BS.ByteString
rotateByteStringDenotation = Bitwise.rotateByteString
let rotateByteStringDenotation :: BS.ByteString -> IntegerCostedLiterally -> BS.ByteString
rotateByteStringDenotation s (IntegerCostedLiterally n) = Bitwise.rotateByteString s (fromIntegral n)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same.

-}
newtype IntegerCostedLiterally = IntegerCostedLiterally { unIntegerCostedLiterally :: Integer }
instance ExMemoryUsage IntegerCostedLiterally where
memoryUsage (IntegerCostedLiterally n) = singletonRose . fromIntegral $ abs n
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handling of negative values is kinda weird. So it's not quite a CostedLiterally integer?

Copy link
Contributor Author

@kwxm kwxm Jul 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it's not quite a CostedLiterally integer?

No, not exactly. This gets used for shiftByteString where you are allowed to shift by negative amounts, and the amount of work you do depends on the size of the shift (there's less copying to do if a lot of bits fall off the end and most of the result is zeros). I couldn't think of a better name though.

@@ -100,6 +103,10 @@ genConstant tr
, Just HRefl <- eqTypeRep trList (typeRep @[]) =
case genConstant trElem of
SomeGen genElem -> SomeGen $ Gen.list (Range.linear 0 10) genElem
| trList' `App` trElem <- tr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, looks correct to me. Except the range is somewhat short, but maybe that's how it's supposed to be, don't know. In the bright future I'll kill all of it and create a proper QuickCheck generator for all this stuff.

Comment on lines +39 to +43
-- *** FIXME !!! *** : The introduction of the new bitwise builtins has messed
-- this up because defaultCostModelParamsForTesting is the cost model parameters
-- for model C, which now includes the new bitwise builtins.
-- , testCase "default values costmodelparamsfortesting" $ do
-- defaultCostModelParamsForTesting @=? Just (toCostModelParams V3.costModelParamsForTesting)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this about?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The increased flexibility of the cost models means that some invariants that were being tested aren't invariants any more (for example, it's no longer the case that the Vn cost model parameters are a subset of the V(n+1) ones). There's an issue to fix this (#6089) but for the time being I've left some commented-out tests so that we know what to fix when we get round to it.

@kwxm kwxm requested a review from effectfully July 21, 2024 22:16
@kwxm
Copy link
Contributor Author

kwxm commented Jul 21, 2024

@effectfully I think I've addressed your earlier concerns about fromIntegral. I've also updated this to incorporate some implementation changes from the last week (#6309 etc), so it should be mergeable without any problems.

Copy link
Contributor

@effectfully effectfully left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I didn't review the costing benchmarks properly.

Let me quickly take a look at the default universe module, I feel like it can be simplified.

@@ -17,27 +17,27 @@ import Data.ByteString qualified as BS (empty)

benchHashAndAddG1 :: EvaluationContext -> Integer -> Benchmark
benchHashAndAddG1 ctx n =
let prog = mkHashAndAddG1Script (listOfSizedByteStrings n 4)
let prog = mkHashAndAddG1Script (listOfByteStringsOfLength n 4)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great rename by the way.

++ show integerToByteStringMaximumOutputLength
++ " bytes)"
emit $ "Length requested: " <> (pack . show $ len)
evaluationFailure
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, we both did it. I think my version is slightly better than yours, because it avoids checking the bounds of Int, given that we check smaller bounds anyway. I'm fine either way and let's merge yours just not to keep the PR hanging.

@@ -701,7 +707,7 @@ benefit: if the requested rotation or shift happens to be an exact multiple
of 8, we can be _much_ faster, as Step 2 becomes unnecessary in that case.
-}

-- | Shifts, as per [CIP-123](https://github.com/mlabs-haskell/CIPs/blob/koz/bitwise/CIP-0123/README.md).
-- | Shifts, as per [CIP-123](https://github.com/cardano-foundation/CIPs/tree/master/CIP-0123).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

)
=> MakeKnownIn DefaultUni term (ListCostedByLength a)
deriving newtype instance
forall term tyname a .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, why do you have a KnownTypeAst constraint in there? I'll take a close look.

Comment on lines +646 to 647
let !width = sumCostStream costs2
in if width == 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that you force width right in the next line after let, you don't really need the bang, but it's fine either way.

lazy $ \_ costs2 costs3 ->
let !size2 = sumCostStream costs2
!size3 = sumCostStream costs3
in scaleLinearly intercept slope $ CostLast (max size2 size3)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should define and use maxCostStream analogous to minCostStream, but it's perhaps not important right now.

newtype LiteralByteSize = LiteralByteSize { unLiteralByteSize :: Integer }
instance ExMemoryUsage LiteralByteSize where
memoryUsage (LiteralByteSize n) = singletonRose . fromIntegral $ ((n-1) `div` 8) + 1
newtype NumBytesCostedAsNumWords = NumBytesCostedAsNumWords { unNumBytesCostedAsNumWords :: Int }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like we should do bounds checking manually, since we're interested in a smaller range than Integer for bitwise builtins, so we don't really need to convert stuff to Int at the interface level, so this probably should be Integer. I don't know though and I don't think it should block this PR.

Copy link
Contributor Author

@kwxm kwxm Jul 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I went back and forth on whether this should be Integer or Int and eventually came down on the side of Int because this currently gets used for integerToByteString and replicateByte, and in both of these it specifies a number of bytes (as the name suggests) and for that not to fit into an Int you'd be wanting more than something like 37 petabytes, which seems unlikely. If we made it into Integer then we'd have to add a range check and conversion in the implementation of replicateByte, but that's very fast anyway so the added cost wouldn't be important. I'll merge this as is, but I may come back and change it to Integer for consistency.

@@ -109,7 +110,8 @@ smallConstant tr
| Just HRefl <- eqTypeRep tr (typeRep @Integer) = SomeConst (0 :: Integer)
| Just HRefl <- eqTypeRep tr (typeRep @Int) = SomeConst (0 :: Integer)
| Just HRefl <- eqTypeRep tr (typeRep @Word8) = SomeConst (0 :: Integer)
| Just HRefl <- eqTypeRep tr (typeRep @LiteralByteSize) = SomeConst (0 :: Integer)
| Just HRefl <- eqTypeRep tr (typeRep @NumBytesCostedAsNumWords) = SomeConst (0 :: Integer)
| Just HRefl <- eqTypeRep tr (typeRep @IntegerCostedLiterally) = SomeConst (0 :: Integer)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I should update these tests in my PR as well...

@kwxm kwxm enabled auto-merge (squash) July 24, 2024 03:54
@kwxm kwxm merged commit 39ae101 into master Jul 24, 2024
6 checks passed
@kwxm kwxm deleted the kwxm/costing/bitwise-4 branch July 24, 2024 12:33
ramsay-t added a commit that referenced this pull request Aug 6, 2024
* Trace removal re-implemented as a IR rewrite rule (#5907)

* refactor: Internal module for RewriteRules, Monoid Instance

* Trace removal re-implemented as a IR rewrite rule

* Test case for an impure trace message, added note.

* CIP-0057 Howto: exporting a Plutus contract blueprint (#5817)

* Howto: exporting a Plutus contract blueprint

* howto/exporting-a-blueprint uses literal includes

* Changelog record

* Paragraph about `deriveArgumentBlueprint` / `deriveParameterBlueprint`

* Include plutus.json literally

* [Release] 1.26.0.0 (#5914)

Signed-off-by: Ana Pantilie <ana.pantilie95@gmail.com>

* A quick isabelle experiment. (#5913)

* PLT-8171: Combine PIR, PLC, and UPLC into a single executable (#5699)

Acked-by: Nikolaos Bezirgiannis <bezirg@users.noreply.github.com>

Co-authored-by: Nikolaos Bezirgiannis <bezirg@users.noreply.github.com>

* chore(deps): bump slackapi/slack-github-action from 1.25.0 to 1.26.0 (#5915)

Bumps [slackapi/slack-github-action](https://github.com/slackapi/slack-github-action) from 1.25.0 to 1.26.0.
- [Release notes](https://github.com/slackapi/slack-github-action/releases)
- [Commits](slackapi/slack-github-action@v1.25.0...v1.26.0)

---
updated-dependencies:
- dependency-name: slackapi/slack-github-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Kwxm/plc spec/bitwise conversions (#5911)

* Intial text for bitwise conversions

* Intial text for bitwise conversions

* Updates

* Tidying up

* Tidying up

* Deal with edge cases more concisely

* More tidying up

* Rearrange some cases

* Almost done

* More clarification

* Update specification date

* Some clarification after PR comments

* Use Int64 in CostModelParams (#5920)

* Change CMTooFewParamsError to a warning (#5912)

* [Costing] Provide support for multiple 'CostModel's (#5851)

* CaseOfCase kind mismatch error fix (#5923)

* Fix issue #5922

* test_extractTyArgs

* CaseOfCase: cover types with two type args

* Fix some Notes so they pass the check (#5930)

* Restore old cost model param names (#5932)

* Tidy up SimpleJSON.hs (#5936)

* chore: formatting (#5937)

* 1.27.0.0 (#5938)

* Do not build the plutus executable if GHC <9.6 (#5940)

* Update CONTRIBUTING.adoc (#5950)

* Add 'Note [Table of all possible ledger's states w.r.t. cost model parameters update]' (#5935)

* Remove annoying error message (#5956)

* Add plutus-tx-template Release Instructions and GH Workflow (#5952)

* [StdLib] Strictify 'fix' (#5939)


This makes `fix` stricter so that the body of the function that it takes always gets forced regardless of whether the necessary argument is provided or not.

Resolves #5961.

---------

Co-authored-by: Yura Lazaryev <Yuriy.Lazaryev@iohk.io>

* [PIR] Don't generate 'fixBy' if you don't need to (#5954)

Removes unnecessary generation of `fixBy` when we only need `fix`.

* Chore: formatting, imports, pragmas. (#5965)

* CaseOfCase UPLC transformation tests. (#5960)

* Avoid evaluating `nilCase` strictly in `matchList`, and rename the original `matchList` to `matchList'` (#5901)

* Improvements to plutus-metatheory site (#5959)

* Improvements to plutus-metatheory site

* Added markdown titles to markdown files so they get built properly. Not all of the titles are very interesting.

---------

Co-authored-by: Ramsay Taylor <ramsay.taylor@iohk.io>

* chore(deps): bump nixbuild/nix-quick-install-action from 27 to 28 (#5951)

Bumps [nixbuild/nix-quick-install-action](https://github.com/nixbuild/nix-quick-install-action) from 27 to 28.
- [Release notes](https://github.com/nixbuild/nix-quick-install-action/releases)
- [Changelog](https://github.com/nixbuild/nix-quick-install-action/blob/master/RELEASE)
- [Commits](nixbuild/nix-quick-install-action@v27...v28)

---
updated-dependencies:
- dependency-name: nixbuild/nix-quick-install-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* [Build] Remove the doctests runner of 'prettyprinter-configurable' (#5974)

* Kwxm/mainnet script budgets (#5973)

* Mainnet script budget analysis

* Comment

* Add a comment

* Release 1.28.0.0 (#5975)

* [PlutusTx] [Builtins] Split 'FromBuiltin' and 'ToBuiltin' (#5971)

This addresses the [inconsistencies](#5547 (comment)) that we got from using the now retired `FromBuiltin`/`ToBuiltin` classes for two mutually exclusive purposes. Now we have two versions of those classes: one is used for converting builtins to Plutus Tx types and back, while the other one is for making builtins transparent/opaque within Plutus Tx. These two purposes are very similar, but also subtly different and that is explained in the docs.

* Update README.md (#5997)

* chore(deps): bump cachix/install-nix-action from 26 to 27 (#5999)

Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 26 to 27.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](cachix/install-nix-action@v26...V27)

---
updated-dependencies:
- dependency-name: cachix/install-nix-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Script to prepare binary executables for uploading to the github release page. (#6015)

* Kwxm/mainnet script budgets 2 (#6057)

* Get the script analysis executable to print out actual execution costs

* Tidying up

* Empty comment

* Dot

* Output evaluation status too

* Oops

* Add integerToByteString and byteStringToInteger to PlutusV2 at PV10 (#6056)

* [Refactoring] Remove 'UnknownBuiltin' and 'UnknownBuiltinType' (#6064)

* Conditionally add 'triage' label to new issues (#6061)

* Add triage label only when the issue does not have any of the 'Internal' labels

* Fix bug in add-triage-label.yml (#6067)

* chore(deps): bump benchmark-action/github-action-benchmark (#6058)

Bumps [benchmark-action/github-action-benchmark](https://github.com/benchmark-action/github-action-benchmark) from 1.19.3 to 1.20.3.
- [Release notes](https://github.com/benchmark-action/github-action-benchmark/releases)
- [Changelog](https://github.com/benchmark-action/github-action-benchmark/blob/master/CHANGELOG.md)
- [Commits](benchmark-action/github-action-benchmark@v1.19.3...v1.20.3)

---
updated-dependencies:
- dependency-name: benchmark-action/github-action-benchmark
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Add integerToByteString and byteStringToInteger to V2.ParamName (#6065)

* Add PlutusTx Map backed by Data (#5927)

Co-authored-by: Ziyang Liu <unsafeFixIO@gmail.com>
Signed-off-by: Ana Pantilie <ana.pantilie95@gmail.com>

* Let nightly.yml accept hedgehog-tests input (#6062)

* Let nightly.yml accept hedgehog-tests input
* Default tests from 10k to 50k

* Remove obsolete defer-plugin-errors flag (#6080)

* Add a Plutus Tx test utility package (#6086)

Signed-off-by: Ana Pantilie <ana.pantilie95@gmail.com>

* [Errors] polish evaluation errors (#6043)

We have this distinction of "user" vs "internal" errors that made some sense when TPLC was what was evaluated, but now that it's UPLC, all of those are "user" errors. So I was going to remove the distinction entirely just to realize that it in fact still makes sense, it's just now "operational" vs "structural". This PR clarifies this.

I've also tweaked errors a bit while I was here, plus removed a bunch of unsafe functions from the CEK machine API (they were convenient when they were exposed from a single module, but now that we have several of them, it's no longer worth the trouble, plus we really should use some different approach to calling the CEK machine in the benchmarks, but that's not within the scope of this PR).

* [Test] Add do-notation support for 'TestNested' (#5948)

This refactors the `TestNested` machinery, so that

1. it supports listing tests in a `do`-block, which is something that I need in a different PR to update a huge `do`-block so that some of the tests there become golden
2. the API is more granular and pushes the user in the right direction

I've also improved some of the tests while I was there and unified the formatting. Most of the tests we have use 4 spaces instead of 2, so I preserved that, we're probably going to run `fourmolu` over all the files eventually anyway and that'll make the indentation 2-space-based.

* Run nightly tests on plutus-benchmark (#6091)

* [Exe] Generalize 'withL' to 'withLangGeneral' (#5918)

* Kwxm/provisional conway cost model (#6087)

* Rename semantics variants

* Change some names

* Get uplc to use correct cost model for semvar

* Dumping cost models

* Dumping cost models

* Tidy up exports and tests

* Move a function

* More updates

* Fix some typos

* Update models.R

* Add updated cost models

* Add updated cost models

* Update test results

* Remove obsolete entries from V3.ParamName

* Fix cost model interface test

* Fix (sort of) plutus-ledger-api tests

* Various small fixes

* Forgot to update parameters

* Add changelog entries

* Fix the changelog entries

* Address PR review comments

* Add costs for new builtins to V1 and V2 cost model files

* Fix some dependencies in plutus-benchmark

* Fix partial reversion of #6086 caused by merge

* Remove old cost model files

* Update/rename benchmark CSV files

* Update issue templates (#6037)

* Remove reference to benching.csv in plutus-core.cabal (#6149)

* PlutusV3: Datum/Redeemer in ScriptContext, Datum Optional, Unified Script Type (#5934)

* Kwxm/costing/reduce CEK CPU step costs B (#6153)

* Make CEK step costs for models B anc C identical

* Add changelog entry

* Add changelog entry

* [Test] Dump UPLC for 'strictLetRec' (#5963)

* Use the most recent evaluation context for most of the benchmarks (#6152)

* [Builtins] Polish handling of integral types (#6036)

This

- adds support for throwing operational unlifting errors in the builtins machinery, which allows us to attach a message to an unlifting failure. Unfortunately this is still not enough to propagate proper error messages to the user, because they get erased by the evaluation machinery down the line, this is our 2018's legacy of the stupid idea to have raw evaluation failures that don't carry any content
- makes handling of integral types in `PlutusCore.Default.Universe` uniform (it was a mess before with a weird partial set of instances and morally the same instances being implemented differently)

* Tests for the `preserve-logging` flag. (#6162)

* Require PlutusV3 scripts to evaluate to BuiltinUnit (#6159)

* Quadratic costing for integer division functions (#6161)

* Quadratic costing for integer division functions

* Correct some typos

* Agda typo

* Fix V2's costModelParamsForTesting (#6166)

* Release 1.29.0.0 (#6170)

* Update update-version.sh to match package names less greedily (#6174)

* Update update-version.sh to match package names less greedily

* Allow whitespace after comma

* Allow whitespace after comma

* Clarify comment

* More error checking (#6179)

* Reorganized Plutus user guide on the Docusaurus platform initial deployment (#6177)

* Initial Docusaurus Setup

* uploaded docs files and images

* added code files and images

* cleaned up mermaid diagrams for platform page

* committed yarn.lock file

* Add markdown link styling

* Update Plutus styling and add GA plugin

* updating yarn.lock file

* CSV Rendering component

* adding cost model parameters page that imports CSV files

* Fix gradient overflow on tables for dark mode

* changing title to Plutus user guide

* Update favicon and social card assets

* Remove landing page and set /docs to base path

* Update literal include roots

* Rename Haddock workflow and update to include Docusaurus build

* Update docusaurus/README.md

Co-authored-by: olgahryniuk <67585499+olgahryniuk@users.noreply.github.com>

* Update docusaurus/docs/adr/adr-index.md

Co-authored-by: olgahryniuk <67585499+olgahryniuk@users.noreply.github.com>

* Update docusaurus/docs/adr/adr-index.md

Co-authored-by: olgahryniuk <67585499+olgahryniuk@users.noreply.github.com>

* Update docusaurus/docs/adr/adr-index.md

Co-authored-by: olgahryniuk <67585499+olgahryniuk@users.noreply.github.com>

* Update docusaurus/docs/adr/adr1.md

Co-authored-by: olgahryniuk <67585499+olgahryniuk@users.noreply.github.com>

* Update docusaurus/docs/adr/adr2.md

Co-authored-by: olgahryniuk <67585499+olgahryniuk@users.noreply.github.com>

* Update docusaurus/docs/essential-concepts/language-versions.md

Co-authored-by: olgahryniuk <67585499+olgahryniuk@users.noreply.github.com>

* Update docusaurus/docs/essential-concepts/language-versions.md

Co-authored-by: olgahryniuk <67585499+olgahryniuk@users.noreply.github.com>

* Update docusaurus/docs/essential-concepts/language-versions.md

Co-authored-by: olgahryniuk <67585499+olgahryniuk@users.noreply.github.com>

* Update docusaurus/docs/essential-concepts/language-versions.md

Co-authored-by: olgahryniuk <67585499+olgahryniuk@users.noreply.github.com>

* Update docusaurus/docs/adr/adr1.md

Co-authored-by: olgahryniuk <67585499+olgahryniuk@users.noreply.github.com>

* Update docusaurus/docs/adr/adr1.md

Co-authored-by: olgahryniuk <67585499+olgahryniuk@users.noreply.github.com>

* Update docusaurus/docs/adr/adr1.md

Co-authored-by: olgahryniuk <67585499+olgahryniuk@users.noreply.github.com>

* Update docusaurus/docs/adr/adr1.md

Co-authored-by: olgahryniuk <67585499+olgahryniuk@users.noreply.github.com>

* Update docusaurus/docs/adr/adr1.md

Co-authored-by: olgahryniuk <67585499+olgahryniuk@users.noreply.github.com>

* Update docusaurus/docs/adr/adr1.md

Co-authored-by: olgahryniuk <67585499+olgahryniuk@users.noreply.github.com>

* Update docusaurus/docs/adr/adr1.md

Co-authored-by: olgahryniuk <67585499+olgahryniuk@users.noreply.github.com>

* Update docusaurus/docs/adr/adr1.md

Co-authored-by: olgahryniuk <67585499+olgahryniuk@users.noreply.github.com>

* Update docusaurus/docs/adr/adr1.md

Co-authored-by: olgahryniuk <67585499+olgahryniuk@users.noreply.github.com>

* Update docusaurus/docs/adr/adr1.md

Co-authored-by: olgahryniuk <67585499+olgahryniuk@users.noreply.github.com>

* Update docusaurus/docs/adr/adr1.md

Co-authored-by: olgahryniuk <67585499+olgahryniuk@users.noreply.github.com>

* Update docusaurus/docs/adr/adr1.md

Co-authored-by: olgahryniuk <67585499+olgahryniuk@users.noreply.github.com>

* committing after running pre-commit run --all-files command to fix build errors

---------

Co-authored-by: ianhanssoniohk <ian.hansson@iohk.io>
Co-authored-by: olgahryniuk <67585499+olgahryniuk@users.noreply.github.com>

* Initial version of new combined-haddock.yml workflow (#6182)

* [Builtins] Make 'BuiltinSuccess' the first constructor (#5885)

This makes `BuiltinSuccess` the first constructor of `BuiltinResult`, see the comment there of why we want that.

See [this](#5885 (comment)) comment for the very ambiguous benchmarking results.

* [PlutusLedgerApi] [Refactoring] Polish imports and exports (#6178)

This

- resolves #6098
- moves a bunch of stuff shared among `V1`/`V2`/`V3` into `Common` (see the PR review)
- makes all imports in the `Common`/`V1`/`V2`/`V3` modules qualified so that it's clear where definitions come from and whether they are inherited from `Common` or an earlier ledger language
- fixes some formatting, adds a definition for consistency etc

* Adding link to Haddock documentation to index.md (#6187)

* removing outdated and incorrect content from the Plutus platform page (#6188)

* Add `Data.Value` to `PlutusLedgerAPI` (#6143)

Signed-off-by: Ana Pantilie <ana.pantilie95@gmail.com>

* added the term Haddock where the public Plutus code libraries are mentioned since it is a term likely to be used in searches (#6190)

* Refactored Serialise/Flat-Via. Fixes #6083 (#6144)

Co-authored-by: Nikolaos Bezirgiannis <bezirg@users.noreply.github.com>

* Add Redeemer to V3 ScriptContext Pretty instance (#6191)

* Logical operations (#5970)

* Initial port of logical ops

* Add PlutusTx correspondents to the new builtins

* Tests for logical operations

* Rest of tests

* Formatting of denotations

* Rename byteStringReplicate to replicateByteString

* Correct references to CIP-121

* Changelogs, document tests

* Note commutativity for new operations

* Properly rename replicate builtin, add to plutus-tx-plugin

* Make new logical builtins available in V3

* Fix links to CIP-122, use toOpaque and fromOpaque instead

* Correct all references to CIP-122

* Rename bitwise builtins, use proper costing

* Bitwise primops will not be in Conway

* Rename tests to suit new primop names

* Combined Haddock Generation (#6146)

* Run nightly tests on plutus-shared instead of plutus-benchmark (#6195)

* Run combined-haddock.yml workflow on plutus-shared instead of plutus-runner (#6196)

* Fix combined_haddock.sh script (#6199)

* [Test] [Builtins] Add golden tests with unlifting errors (#6189)

This refactors a file with tests so that unit tests that are supposed to result in evaluation failure also become golden tests with the error message printed to a golden file. Need it to demonstrate that #6181 does indeed allow us to preserve operational unlifting errors.

* Changed the term "Documentation" to "User guide" in the upper left area of the docs site (#6200)

* Styling updates to docusaurus site

* Changed the term Documentation to User guide in the upper left corner of the docs site next to the PLUTUS wordmark logo.

* Add .yarn to .gitignore

---------

Co-authored-by: ianhanssoniohk <ian.hansson@iohk.io>

* Update Alert Message in longitudinal-benchmark.yml (#6201)

* [Test] Add missing bitwise builtins golden files (#6204)

* [Errors] Preserve operational unlifting errors (#6181)

* Docs raise visibility code libraries (#6203)

* added more visibility to Haddock Plutus code libraries on index.md page

* adding new Haddock documentation page under the Reference nav menu

* updated Reference top-level page description

* minor style edit update docusaurus/docs/index.md

Co-authored-by: olgahryniuk <67585499+olgahryniuk@users.noreply.github.com>

* style edits update docusaurus/docs/reference/haddock-documentation.md

Co-authored-by: olgahryniuk <67585499+olgahryniuk@users.noreply.github.com>

---------

Co-authored-by: olgahryniuk <67585499+olgahryniuk@users.noreply.github.com>

* [Test] [Builtin] Polish 'MakeRead' tests (#6202)

* Remove AssocMap comparison instances (#6173)



Signed-off-by: Ana Pantilie <ana.pantilie95@gmail.com>

* Update README.adoc (#6206)

Updated the link in README to point to the Plutus docs site on the docusaurus platform instead of Read the docs.

* Remove PyF as it depends on GHC and causes depenecy conflicts downstream. (#6208)

* Bitwise operations (#6090)

* Initial bitwise primitives

* Wire up new builtins

* Tests

* Changelogs

* Fix failing goldens

* Fix cost model for tests

* Bitwise primitives are not in Conway

* Finish shift tests

* Fix goldens

* Rest of tests

* Rename operations

* Note about split composition for shift property

* Explain bitwise tests in comments, remove AND and OR tests for finding and counting bits

* Goldens for bitwise primops

* Chop down property test running times a bit

* Add test for finding first in zero byte string, rename some tests for clarity

* Clarify implementation choices in the comments

* Tidy up helpers for property tests

* Consolidate all bitwise ops, retarget links to CIPs

* Reduce coverage limits for signature verification tests (#6209)

* moved the Getting Started page to immediately follow the Introduction page (#6211)

* Haskell Eq for AssocMap (#6213)



Signed-off-by: Ana Pantilie <ana.pantilie95@gmail.com>

* Shorten some filenames in the conformance tests (#6214)

Shorten some file names

* MK-5422 move getting started page fixing link (#6215)

* moved the Getting Started page to immediately follow the Introduction page

* fixed broken link

* [Evaluation] Move stuff under `enterComputeCek` (#6156)

This polishes the structure of the CEK machine code a little: moves definitions having CEK-specific constraints around (as per `Note [Compilation peculiarities]`), removes outdated comments and moves pragmas around.

* Release 1.30.0.0 (#6216)

* plutus-ir: fix redundant imports (#6218)

* Fix incorrect Note reference (#6217)

* Add documentation to `Data.Value` (#6220)

* [Builtins] Replace 'EvaluationResult' with 'BuiltinResult' (#5926)

This replaces several `Emitter (EvaluationResult a)` occurrences with `BuiltinResult`, something that I missed the last [time](#5728).

In addition to that, it also replaces `EvaluationResult` with `BuiltinResult` in general. It doesn't matter performance-wise (modulo a regression that we didn't notice some time ago), but `BuiltinResult`, unlike `EvaluationResult`, allows one to attach an error message to a failure, which we do in this PR as well, meaning we now get better error messages. And we also now respect the operational vs structural evaluation errors distinction.

The PR also replaces `Emitter` with `BuiltinResult`. And makes the GHC Core of builtins smaller by making error-throwing functions (not) inline (see `Note [INLINE and OPAQUE on error-related definitions]` for details).

* New `./scripts/combined-haddock.sh` (#6205)

* Add workflow for publishing Agda Metatheory site (#6223)

* Add workflow for publishing AGDA metatheory site

* wip

* wip

* Fixes to `metatheory-site.yml` workflow (#6228)

* Final changes to `metatheory-site.yml` workflow (#6229)

* Update RELEASE.adoc with instructions to delete unused branches and tags (#6230)

* Complete Migration from RDT to Docusaurus (#6227)

- Delete the contents of doc/read-the-docs-site, only keeping the README with a migration notice.
- Move docusaurus folder into doc folder.
- Update the GH workflows for publishing the haddock site and docusaurus site.
- Delete GH web hook and update redirects on RTD site.
- Remove mentions of read-the-docs and combined-haddock from nix code
- Update release process, mentioning how to publish Docusaurus and the Haddock site
- Update links in Docusaurus mentioning the new haddock site

* Fix broken links in docusaurus docs (#6232)

* Add flake.nix for doc/docusaurus (#6233)

* New shell for Docusaurus
* Fix broken links

* making a spelling correction on the doc/docusaurus README file (#6235)

* [Builtins] Remove 'Emitter' and 'MonadEmitter' (#6224)

* Refactor GitHub Workflows (#6124)

* Fix & simplify SOP encoding example comment (#6231)

Here's a small fix for the comment:

- use one variable for the type everywhere
- fix ordering of `constr` arguments

Additionally,

- align the corresponding parts in the text

* Update github-action-benchmark version (#6238)

* Make it build with ghc 9.10 (#6079)

* Make it build with ghc 9.10
* Nix updates
* Disable failing test (cseExpensive test in untyped-plutus-core-test suite)
* plutus-tx-plugin-tests: Accept some CSE golden changes

* Update version of github-action-benchmark to v1.20.3 (#6240)

* Update version of github-action-benchmark to v1.20.3

* Fix bug in triage-label.yml

* Add workflows to check broken links and deploy papers to GH Pages (#6236)

* Add workflows to check broken links and deploy papers to GH Pages

* Publish papers and specs on push to master only (#6246)

* Cabal project to compile docusaurus examples. (#6239)

* Added cardano-constitution package (#6234)

* Added cardano-constitution package

* Remove cardano-constitution checks from CI

* Restrist x-compiling

---------

Co-authored-by: Nikolaos Bezirgiannis <bezirg@users.noreply.github.com>
Co-authored-by: zeme <lorenzo.calegari@iohk.io>

* [Test] Turn off CSE for problematic tests (#6249)

* [Test] Turn off CSE for the 'patternMatching' test (#6251)

* [Optimization] Remove case-of-case (#6248)

* Spec that verifies various script sizes (#6247)

* Add cardano-constitution-tests and slack-message-broker workflows (#6253)

* Updates to slack-message-broker.yml (#6258)

* Update slackapi/slack-github-action version -> v1.26.0 (#6259)

* Improve messages in slack-message-broker.yml (#6260)

* Fix error message in slack-message-broker.yml (#6261)

* Fix another error in slack-message-broker.yml (#6262)

* Fix "un-rolling" a list type. (#6165)

* Fix "un-rolling" a list type.

* Un-roll other general types: [], Maybe, (,), BuiltinUnit, BuiltinPair

* constitution: Add executable that creates json envelope (#6267)

Co-authored-by: Jamie Bertram <jamie.bertram@tweag.io>

* Fix bug in ./script/combined-haddock.sh (#6263)

* Update baseUrl in docusaurus.config.ts (#6275)

* Improvements to haddock-site.yml (support auto-publish on push to master) (#6276)

* Better messages in slack-message-broker.yml (#6280)

* Remove --ignore-url's from linkchecker step in combined-haddock.sh (#6281)

* Add cabal update step in combined-haddock.sh (#6283)

* Fix CsvTable.tsx and LiteralInclde.tsx in docusaurus (#6282)

* Fix haddock documentation for cardano-constitution (#6284)

* Stronger docusaurus builds and general QOL improvements (#6287)

* Move package-lock.json from top-level to scripts/blueprints (#6289)

* Fix editUrl in docusaurus.config.ts (#6291)

* chore(deps): bump JamesIves/github-pages-deploy-action (#6292)

Bumps [JamesIves/github-pages-deploy-action](https://github.com/jamesives/github-pages-deploy-action) from 4.6.1 to 4.6.3.
- [Release notes](https://github.com/jamesives/github-pages-deploy-action/releases)
- [Commits](JamesIves/github-pages-deploy-action@v4.6.1...v4.6.3)

---
updated-dependencies:
- dependency-name: JamesIves/github-pages-deploy-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fix typos (#6288)

* fix typo

* fix typos

* fix typo

* fix typo

* Detect broken links for haddock,metatheory,docusaurus + local repo files (#6294)

* Fix broken linkchecker workflows (#6295)

* Add .github/linkchecker/action.yml

* Add support for ghc910 to hydraJobs (#6293)

* Disable linkchecker on live sites (#6298)

* [Bug] Fix 'isNormalType' and add 'prop_normalizedTypeIsNormal' (#6272)

* Analyse script events supports PlutusLedgerLanguage V3 (#6300)

* fix: parameter 33 should be a Rational (#6302)

* Address guardrail script audit comments (#6305)

* All names are printed with their unique values by default. (#5972)

* chore: explicit imports

* Test demonstrates that without printed unique value a name won't roundtrip printing/parsing

* Pretty-printing with indexes by default, simple representation by
opt-in.

* Updated golden files

* fix: types in defaultConstitution (#6307)

More descriptive type names in the defaultConstitution

Co-authored-by: Nikolaos Bezirgiannis <329939+bezirg@users.noreply.github.com>

* Fix overflow bug in shiftByteString, rotateByteString, add tests to ensure it stays fixed (#6309)

* Fix overflow bug in shiftByteString, add tests to ensure it stays fixed

* Fix similar issue in rotations

* Add shift wrapper for bounds checks

* Fix rotations similarly, note in docs

* Fix typo, note about fromIntegral

* Release 1.31.0.0 (#6312)

* Re-export bitwise builtins from PlutusTx.Prelude (#6313)

* [Costing] Increase the cost of constructors of '[]' (#6285)

* Change writeBits to take changelists as two separate lists (#6317)

* fix: types in defaultConstitution (#6307)

More descriptive type names in the defaultConstitution

Co-authored-by: Nikolaos Bezirgiannis <329939+bezirg@users.noreply.github.com>

* Fix overflow bug in shiftByteString, rotateByteString, add tests to ensure it stays fixed (#6309)

* Fix overflow bug in shiftByteString, add tests to ensure it stays fixed

* Fix similar issue in rotations

* Add shift wrapper for bounds checks

* Fix rotations similarly, note in docs

* Fix typo, note about fromIntegral

* Release 1.31.0.0 (#6312)

* Modify writeBits to use two lists as arguments

* Fix writeBits in PlutusTx to match new API

* Fix goldens

---------

Co-authored-by: Romain Soulat <117812549+RSoulatIOHK@users.noreply.github.com>
Co-authored-by: Nikolaos Bezirgiannis <329939+bezirg@users.noreply.github.com>
Co-authored-by: Yura Lazarev <1009751+Unisay@users.noreply.github.com>

* [Costing] Remove the 'ExMemoryUsage' instance for 'SomeTypeIn' (#6318)

* feat: New version of VT-CC-01 (#6320)

Signed
Changed the defaultConstitution.json (+ random fixes in some $comment)
Changed the tests values
Changed the traceability documents and updated the versioning
New golden test values

"All 654 tests passed (99.02s)"

* [Test] Make tests take reasonable time (#6286)

This dramatically reduces the number of tests run locally making evaluation times of plutus-test drop by more than 10x.

The reduced number of tests run locally is balanced by running the old amount of tests in the nightly test suite.

* fix: haddock error (#6323)

* Reverse hunk test_multiSplitSound (#6324)

Co-authored-by: Nikolaos Bezirgiannis <bezirg@users.noreply.github.com>

* Kwxm/costing/bitwise 4 (#6301)

* Costing for new bitwise builtins

* Fix alignment problem

* Add changelog entry

* Update some CIP URLs

* Update some CIP URLs

* Remove outdated comment

* Address some review comments

* Address some review comments

* Fix for changes in main branch

* Update costing for revised version of writeBits

* Fix benchmark tests for integer division builtins

* Fix comments

* Update benchmark results for writeBits split updates

* Try removing zip in writeBits

* Remove wrapper

* Rearrange code again

* Tidying up

* Fix plutus-tx

* Make some helpers INLINEABLE

* Rearrange code again

* Simplify known type instances for 'ListCostedByLength'

---------

Co-authored-by: effectfully <effectfully@gmail.com>

* 8-queens using bitwise primops benchmark (#6311)

* Milestone 3 benchmark, test

* Fix cabal file

* Update writeBits use in NQueens

* [Plinth] [Builtins] Fix 'writeBits' (#6329)

* [Plinth] Ban using 'toBuiltin' and 'fromBuiltin' (#6342)

It used to be possible to use `toBuiltin`/`fromBuiltin` within a smart contract, but this is no longer the case, but this isn't obvious to the users as they already have code with `toBuiltin`/`fromBuiltin` that now just misbehaves instead of throwing a type error or breaking compilation some other way. This fixes the problem by throwing on any usage of `toBuiltin`/`fromBuiltin` with a suggestion to use `toOpaque`/`fromOpaque` instead.

* Kwxm/bitwise/enable nqueens benchmark (#6343)

This enables the bitwise `nqueens` benchmark following the fix for `writeBits` in Plinth in #6309.

```
$ cabal bench bitwise-bench
Build profile: -w ghc-9.6.6 -O1
In order, the following will be built (use -v for more details):
 - plutus-benchmark-0.1.0.0 (bench:bitwise-bench) (first run)
Preprocessing benchmark 'bitwise-bench' for plutus-benchmark-0.1.0.0...
Building benchmark 'bitwise-bench' for plutus-benchmark-0.1.0.0...
Running 1 benchmarks...
Benchmark bitwise-bench: RUNNING...
benchmarking 8-queens
time                 683.4 ms   (681.5 ms .. 685.0 ms)
                     1.000 R²   (1.000 R² .. 1.000 R²)
mean                 678.6 ms   (674.1 ms .. 680.4 ms)
std dev              3.211 ms   (92.63 μs .. 3.978 ms)
variance introduced by outliers: 19% (moderately inflated)

Benchmark bitwise-bench: FINISH
```

* [plc] Support for `Natural` numbers in the default universe, backed by `Integer`. (#6346)

Co-authored-by: Nikolaos Bezirgiannis <bezirg@users.noreply.github.com>

* nothunks ^>= 0.2 (#6349)

* Make NumBytesCostedAsNumWords use Integer instead of Int (#6350)

The `NumBytesCostedAsNumWords` wrapper contained an `Int`, but this changes it to `Integer` for consistency with the other wrappers.  This change also affects the type of `Bitwise.replicateByte`.

* [Benchmark] Reduce the number of benchmarks (#6328)

* [Test] Improve distribution of generated integers (#6315)

This improves distribution of generated integers, so that we more often hit important edge cases such as `2 ^ 16`, `2 ^ 32 - 1`, `2 ^ 32`, `2 ^ 64` etc.

* [Plinth] [Builtins] Add a general 'mkNil' (#6347)

This replaces the `mkNilInteger`, `mkNilData` etc boilerplate with a single `mkNil` function at the expense of moving the boilerplate to the compiler code.

* [Refactoring] Use 'KnownBuiltinTypeIn' instead of 'HasConstant' consistently (#6353)

* Restore auto generation of compiler option table (#6373)

* Add the bitwise builtins to the metatheory (#6368)

* Initial metatheory for rest of bitwise builtins

* Separate lists of expected failures for evaluation tests and budget tests

* Remove temporary test data

* Fix memory usage for lists in Agda

* Forgot about haskell-steppable-conformance

* Remove suprious s

* Restore CI checks for doc site code (#6376)

* andByteString conformance cases (#6356)

* andByteString conformance cases

* Move each case to its own directory

* Update goldens for merge

* Conformance cases for complementByteString (#6359)

* Conformance for orByteString (#6357)

* Conformance cases for readBit (#6360)

* Conformance for shiftByteString (#6363)

* Conformance for findFirstSetBit (#6366)

* Conformance for xorByteString (#6358)

* Conformance for countSetBits (#6365)

---------

Signed-off-by: Ana Pantilie <ana.pantilie95@gmail.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Yura Lazarev <Unisay@users.noreply.github.com>
Co-authored-by: Ana Pantilie <45069775+ana-pantilie@users.noreply.github.com>
Co-authored-by: Nikolaos Bezirgiannis <329939+bezirg@users.noreply.github.com>
Co-authored-by: Nikolaos Bezirgiannis <bezirg@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kenneth MacKenzie <kwxm@inf.ed.ac.uk>
Co-authored-by: Ziyang Liu <unsafeFixIO@gmail.com>
Co-authored-by: effectfully <effectfully@gmail.com>
Co-authored-by: Yura Lazarev <1009751+Unisay@users.noreply.github.com>
Co-authored-by: zeme-wana <15709674+zeme-wana@users.noreply.github.com>
Co-authored-by: Yura Lazaryev <Yuriy.Lazaryev@iohk.io>
Co-authored-by: Joseph Fajen <104791413+joseph-fajen@users.noreply.github.com>
Co-authored-by: ianhanssoniohk <ian.hansson@iohk.io>
Co-authored-by: olgahryniuk <67585499+olgahryniuk@users.noreply.github.com>
Co-authored-by: Koz Ross <koz.ross@retro-freedom.nz>
Co-authored-by: Samuel Leathers <samuel.leathers@iohk.io>
Co-authored-by: Vladimir Kalnitsky <klntsky@gmail.com>
Co-authored-by: Erik de Castro Lopo <erikd@mega-nerd.com>
Co-authored-by: zeme <lorenzo.calegari@iohk.io>
Co-authored-by: Jamie Bertram <jamie.bertram@tweag.io>
Co-authored-by: omahs <73983677+omahs@users.noreply.github.com>
Co-authored-by: Romain Soulat <117812549+RSoulatIOHK@users.noreply.github.com>
effectfully added a commit that referenced this pull request Aug 6, 2024
* Costing for new bitwise builtins

* Fix alignment problem

* Add changelog entry

* Update some CIP URLs

* Update some CIP URLs

* Remove outdated comment

* Address some review comments

* Address some review comments

* Fix for changes in main branch

* Update costing for revised version of writeBits

* Fix benchmark tests for integer division builtins

* Fix comments

* Update benchmark results for writeBits split updates

* Try removing zip in writeBits

* Remove wrapper

* Rearrange code again

* Tidying up

* Fix plutus-tx

* Make some helpers INLINEABLE

* Rearrange code again

* Simplify known type instances for 'ListCostedByLength'

---------

Co-authored-by: effectfully <effectfully@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Builtins Costing Anything relating to costs, fees, gas, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants