-
Notifications
You must be signed in to change notification settings - Fork 483
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conformance tests for bitwise conversions (#5744)
* Move conversion code into Plutus Core * Documentation and notes on implementations * Wrap implementations into builtins * Properties as per CIP-0087 * CIP-0087 examples as tests * Add new builtins to PlutusTx * Document fromIntegral usage as a note * Changelogs for CIP-0087 primitives * Ensure conversions don't break on too-large arguments * Ensure that conversions are available in V3 * Remove unnecessary pragmata on tests * Fix overly-long test names, clarify test meaning in comments * CIP link consistency * Re-order integerToByteString arguments, avoid unnecessary padding * Better documentation for implementations * Correct properties for ByteStringToInteger * Address feedback * Integer/ByteString conversion costing experiments * Turn off warning * Turn off warning * Initial costing for bitwise conversions * Update print-cost-model; add some FIXMEs * Update print-cost-model; add some FIXMEs * Minor updates * Fix typo * Fix plugin; use byteStringToInteger in bls12-318-costs * Fix some tests * Add generator for LiteralByteSize in plc evaluation tests * Update parameter names in plutus-ledger-api * Separate file for bitwise costing benchmarks * More comprehensive exploratory costing benchmarks * More comprehensive exploratory costing benchmarks * Wrong test input sizes * Correct costing benchmarks input widths * One more benchmark * All 0xFF benchmarks * Wrong number * Smaller bytetring inputs * Try to keep CI happy * Bigger benchmarks * Another benchmarking run * Fix modelling code for integer/bytestring conversions * Remove experimental benchmarks; tidy up R code * Tidying up; fix budget benchmarks for byteStringToInteger * Move bitwise Convert module * Move bitwise Convert module * Update cost model * Update bls12-381 cost test results * Update comment * Add changelog entries * Remove accidentally-committed file * Cost model tests for bitwise conversions * Fix failing test * Fix another failing test * Address some small PR comments * Address some small PR comments * Initial conformance tests for bitwise conversion builtins * Move size limit check back to Convert.hs and add some tests * Move size limit check back to Convert.hs and add some tests * Workaround for integerLog2 missing in GHC 8.10 * Workaround for integerLog2 missing in GHC 8.10 * Workaround for integerLog2 missing in GHC 8.10 * Add some more test cases * More test cases * More test cases * More tests * More test cases * Formatting * Test output mysteriously rearranged again * Tidying up --------- Co-authored-by: Koz Ross <[email protected]>
- Loading branch information
Showing
34 changed files
with
33 additions
and
38 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...uation/builtin/semantics/byteStringToInteger/big-endian/all-zeros/all-zeros.uplc.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
(program 1.0.0 (con integer 0)) | ||
(program 1.0.0 (con integer 0)) |
2 changes: 1 addition & 1 deletion
2
...ltin/semantics/byteStringToInteger/big-endian/correct-output/correct-output.uplc.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
(program 1.0.0 (con integer 20016001699311)) | ||
(program 1.0.0 (con integer 20016001699311)) |
2 changes: 1 addition & 1 deletion
2
...plc/evaluation/builtin/semantics/byteStringToInteger/big-endian/empty/empty.uplc.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
(program 1.0.0 (con integer 0)) | ||
(program 1.0.0 (con integer 0)) |
2 changes: 1 addition & 1 deletion
2
...uiltin/semantics/byteStringToInteger/big-endian/leading-zeros/leading-zeros.uplc.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
(program 1.0.0 (con bool True)) | ||
(program 1.0.0 (con bool True)) |
2 changes: 1 addition & 1 deletion
2
...lc/evaluation/builtin/semantics/byteStringToInteger/both-endian/both-endian.uplc.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
(program 1.0.0 (con bool True)) | ||
(program 1.0.0 (con bool True)) |
2 changes: 1 addition & 1 deletion
2
...ion/builtin/semantics/byteStringToInteger/little-endian/all-zeros/all-zeros.uplc.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
(program 1.0.0 (con integer 0)) | ||
(program 1.0.0 (con integer 0)) |
2 changes: 1 addition & 1 deletion
2
...n/semantics/byteStringToInteger/little-endian/correct-output/correct-output.uplc.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
(program 1.0.0 (con integer 263666621887506)) | ||
(program 1.0.0 (con integer 263666621887506)) |
2 changes: 1 addition & 1 deletion
2
.../evaluation/builtin/semantics/byteStringToInteger/little-endian/empty/empty.uplc.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
(program 1.0.0 (con integer 0)) | ||
(program 1.0.0 (con integer 0)) |
2 changes: 1 addition & 1 deletion
2
...n/semantics/byteStringToInteger/little-endian/trailing-zeros/trailing-zeros.uplc.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
(program 1.0.0 (con bool True)) | ||
(program 1.0.0 (con bool True)) |
2 changes: 1 addition & 1 deletion
2
...ng/big-endian/bounded/correct-output-exact-width/correct-output-exact-width.uplc.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
(program 1.0.0 (con bytestring #123456abcdef)) | ||
(program 1.0.0 (con bytestring #123456abcdef)) |
2 changes: 1 addition & 1 deletion
2
...ng/big-endian/bounded/correct-output-extra-width/correct-output-extra-width.uplc.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
(program 1.0.0 (con bytestring #000000000000123456abcdef)) | ||
(program 1.0.0 (con bytestring #000000000000123456abcdef)) |
4 changes: 2 additions & 2 deletions
4
...String/big-endian/bounded/max-input-fits-max-width/max-input-fits-max-width.uplc.expected
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...mantics/integerToByteString/big-endian/bounded/maximum-width-zero/maximum-width-zero.uplc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
-- Check that we can encode zero using the maximum width (8192). | ||
(program 1.0.0 | ||
[(builtin integerToByteString) (con bool True) (con integer 8192) (con integer 0)] | ||
) | ||
) |
2 changes: 1 addition & 1 deletion
2
...ntegerToByteString/big-endian/bounded/maximum-width-zero/maximum-width-zero.uplc.expected
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,3 @@ | |
(program 1.0.0 | ||
[(builtin integerToByteString) (con bool True) (con integer 20) (con integer -5)] | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,3 @@ | |
(program 1.0.0 | ||
[(builtin integerToByteString) (con bool True) (con integer -20) (con integer 5)] | ||
) | ||
|
2 changes: 1 addition & 1 deletion
2
...ation/builtin/semantics/integerToByteString/big-endian/bounded/too-narrow/too-narrow.uplc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
-- Check that trying to encode an integer to a bytestring usingn too narrow a width fails. | ||
-- Check that trying to encode an integer to a bytestring using too narrow a width fails. | ||
(program 1.0.0 | ||
[(builtin integerToByteString) (con bool True) (con integer 5) (con integer 20016001699311)] | ||
) |
2 changes: 1 addition & 1 deletion
2
...mantics/integerToByteString/big-endian/bounded/width-too-big-zero/width-too-big-zero.uplc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
-- Check that a width greater than the maximum of 8192 is rejected when encoding zero. | ||
(program 1.0.0 | ||
[(builtin integerToByteString) (con bool True) (con integer 8193) (con integer 0)] | ||
) | ||
) |
2 changes: 1 addition & 1 deletion
2
...aluation/builtin/semantics/integerToByteString/big-endian/bounded/zero/zero.uplc.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
(program 1.0.0 (con bytestring #000000000000000000000000)) | ||
(program 1.0.0 (con bytestring #000000000000000000000000)) |
2 changes: 1 addition & 1 deletion
2
...tics/integerToByteString/big-endian/unbounded/correct-output/correct-output.uplc.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
(program 1.0.0 (con bytestring #123456abcdef)) | ||
(program 1.0.0 (con bytestring #123456abcdef)) |
2 changes: 1 addition & 1 deletion
2
...antics/integerToByteString/big-endian/unbounded/maximum-input/maximum-input.uplc.expected
Large diffs are not rendered by default.
Oops, something went wrong.
3 changes: 1 addition & 2 deletions
3
...tin/semantics/integerToByteString/big-endian/unbounded/negative-input/negative-input.uplc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
-- Negative inputs give an error | ||
-- Negative inputs cause an error. | ||
(program 1.0.0 | ||
[(builtin integerToByteString) (con bool True) (con integer 0) (con integer -5)] | ||
) | ||
|
2 changes: 1 addition & 1 deletion
2
...uation/builtin/semantics/integerToByteString/big-endian/unbounded/zero/zero.uplc.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
(program 1.0.0 (con bytestring #)) | ||
(program 1.0.0 (con bytestring #)) |
2 changes: 1 addition & 1 deletion
2
...little-endian/bounded/correct-output-exact-width/correct-output-exact-width.uplc.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
(program 1.0.0 (con bytestring #efcdab563412)) | ||
(program 1.0.0 (con bytestring #efcdab563412)) |
2 changes: 1 addition & 1 deletion
2
...little-endian/bounded/correct-output-extra-width/correct-output-extra-width.uplc.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
(program 1.0.0 (con bytestring #efcdab563412000000000000)) | ||
(program 1.0.0 (con bytestring #efcdab563412000000000000)) |
2 changes: 1 addition & 1 deletion
2
...ation/builtin/semantics/integerToByteString/little-endian/bounded/zero/zero.uplc.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
(program 1.0.0 (con bytestring #000000000000000000000000)) | ||
(program 1.0.0 (con bytestring #000000000000000000000000)) |
2 changes: 1 addition & 1 deletion
2
.../semantics/integerToByteString/little-endian/unbounded/correct-output/correct-output.uplc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
-- Check that a particular bytestring decodes to the expected integer. | ||
-- Check that a particular integer encodes to the expected bytestring. | ||
(program 1.0.0 | ||
[(builtin integerToByteString) (con bool False) (con integer 0) (con integer 20016001699311)] | ||
) |
2 changes: 1 addition & 1 deletion
2
...s/integerToByteString/little-endian/unbounded/correct-output/correct-output.uplc.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
(program 1.0.0 (con bytestring #efcdab563412)) | ||
(program 1.0.0 (con bytestring #efcdab563412)) |
2 changes: 1 addition & 1 deletion
2
...in/semantics/integerToByteString/little-endian/unbounded/input-too-big/input-too-big.uplc
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
.../semantics/integerToByteString/little-endian/unbounded/negative-input/negative-input.uplc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ion/builtin/semantics/integerToByteString/little-endian/unbounded/zero/zero.uplc.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
(program 1.0.0 (con bytestring #)) | ||
(program 1.0.0 (con bytestring #)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
993c338
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible performance regression was detected for benchmark 'Plutus Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold
1.05
.validation-auction_1-2
656.8
μs618.2
μs1.06
validation-auction_1-3
653.4
μs616.9
μs1.06
validation-auction_2-2
659.1
μs620.9
μs1.06
validation-auction_2-3
860.7
μs810.3
μs1.06
validation-auction_2-4
654
μs615.9
μs1.06
validation-currency-1
254.1
μs240.8
μs1.06
validation-escrow-redeem_2-1
405.5
μs385.9
μs1.05
validation-escrow-redeem_2-2
406.3
μs386.8
μs1.05
validation-escrow-redeem_2-3
406.3
μs386.7
μs1.05
validation-future-increase-margin-1
255.6
μs241.7
μs1.06
validation-future-increase-margin-2
546.4
μs519.4
μs1.05
validation-future-increase-margin-3
547.9
μs519.1
μs1.06
validation-future-increase-margin-4
499.5
μs473.5
μs1.05
validation-future-increase-margin-5
835.1
μs786.6
μs1.06
validation-future-pay-out-1
255.3
μs241.2
μs1.06
validation-future-pay-out-2
547.5
μs517.3
μs1.06
validation-future-pay-out-3
548.8
μs519
μs1.06
validation-future-pay-out-4
834.8
μs787.9
μs1.06
validation-future-settle-early-1
255.1
μs241.2
μs1.06
validation-future-settle-early-2
547.2
μs520
μs1.05
validation-future-settle-early-3
546.9
μs519.3
μs1.05
validation-future-settle-early-4
621.6
μs588
μs1.06
validation-game-sm-success_1-3
656.1
μs620
μs1.06
validation-game-sm-success_2-1
387.5
μs368.9
μs1.05
validation-game-sm-success_2-3
656
μs619.4
μs1.06
validation-game-sm-success_2-5
656.5
μs620
μs1.06
validation-multisig-sm-1
399.8
μs379.3
μs1.05
validation-multisig-sm-2
386.6
μs368
μs1.05
validation-multisig-sm-3
392.7
μs373.8
μs1.05
validation-multisig-sm-5
567.7
μs535.5
μs1.06
validation-multisig-sm-6
399.7
μs379.8
μs1.05
validation-multisig-sm-8
393.8
μs374
μs1.05
validation-multisig-sm-9
399.2
μs377.2
μs1.06
validation-multisig-sm-10
566.9
μs535.9
μs1.06
validation-ping-pong-1
331.2
μs314.3
μs1.05
validation-prism-2
413.7
μs393.1
μs1.05
validation-prism-3
372.3
μs353.7
μs1.05
validation-token-account-1
190.7
μs181.5
μs1.05
validation-uniswap-1
424.2
μs397.1
μs1.07
validation-uniswap-3
1785
μs1694
μs1.05
validation-uniswap-5
1170
μs1113
μs1.05
validation-vesting-1
350.8
μs332.6
μs1.05
This comment was automatically generated by workflow using github-action-benchmark.
CC: @input-output-hk/plutus-core