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

Release Candidate v5.0 #758

Merged
merged 568 commits into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
568 commits
Select commit Hold shift + click to select a range
1ba1c8e
prepare-v5.0-tests: run both aot and jit modes
aslesarenko Nov 10, 2021
b78a8ee
prepare-v5.0-tests: move check methods to CostingUtils
aslesarenko Nov 11, 2021
0fca9ea
Merge remote-tracking branch 'origin/develop' into prepare-v5.0-tests
aslesarenko Nov 16, 2021
daf7e3a
prepare-v5.0-tests: fixes after merge
aslesarenko Nov 16, 2021
efb9668
prepare-v5.0-tests: use evaluationMode in fullReduction
aslesarenko Nov 16, 2021
83c4281
v5.0-increase-script-version: - increased MaxSupportedScript version;…
aslesarenko Nov 17, 2021
09a96d0
v5.0-increase-script-version: updateMany added to CollecitonUtil
aslesarenko Nov 18, 2021
07362e3
v5.0-increase-script-version: use context.currentErgoTreeVersion in X…
aslesarenko Nov 18, 2021
658ce45
v5.0-increase-script-version: generalize Expected
aslesarenko Nov 18, 2021
c31525a
v5.0-increase-script-version: refactor ProverInterpreter.prove to use…
aslesarenko Nov 18, 2021
2067b91
v5.0-increase-script-version: set evaluationMode for prover in checkV…
aslesarenko Nov 18, 2021
ac0b654
v5.0-increase-script-version: refactor Expected data descriptors (aka…
aslesarenko Nov 24, 2021
901bf32
jitcost-type: added JitCost class with tests
aslesarenko Nov 24, 2021
c0c7999
activation: making evaluationMode optional
aslesarenko Nov 28, 2021
2605168
activation: implemented getEvaluationMode method
aslesarenko Nov 30, 2021
c0cabda
activation: BasicOpsSpecification: remove evaluationMode setting
aslesarenko Nov 30, 2021
1ee6fe9
activation: rootCauseLike method added
aslesarenko Dec 1, 2021
34d0c85
activation: fix tests to work with hibrid (v4 or v5) Interpreter
aslesarenko Dec 1, 2021
dbcf554
simple constructor for SigmaCompiler
aslesarenko Dec 1, 2021
de47a25
Merge pull request #755 from ScorexFoundation/compiler-settings
aslesarenko Dec 2, 2021
0cfb020
activation: cleanup code
aslesarenko Dec 2, 2021
e31de08
activation: refactor CrossVersionProps.scala
aslesarenko Dec 2, 2021
ba14e53
activation: update ScriptVersionSwitchSpecification to cover Block ve…
aslesarenko Dec 2, 2021
5cee2c6
activation: Rules 21,22,23,24
aslesarenko Dec 4, 2021
93a240e
activation: update aot-jit-switch.md
aslesarenko Dec 4, 2021
8239cc7
activation: Interpreter.JitActivationVersion introduced
aslesarenko Dec 7, 2021
388d4f2
jitcost-type: refactoring to use JitCost type
aslesarenko Dec 8, 2021
4e2c130
Merge pull request #753 from ScorexFoundation/activation
aslesarenko Dec 8, 2021
2ad642a
jitcost-type: fix tests
aslesarenko Dec 8, 2021
4db92b6
jitcost-type: fix tests (part 2)
aslesarenko Dec 8, 2021
cbbe9f0
jitcost-type: more ScalaDocs
aslesarenko Dec 9, 2021
4bd6a8a
jitcost-type: remove implicit constructors
aslesarenko Dec 10, 2021
24c92ad
jitcost-type: performance optimizations and cleanup
aslesarenko Dec 10, 2021
074fc8f
jitcost-type: more ScalaDocs for EvaluatedValue hierarchy
aslesarenko Dec 14, 2021
1fb884b
Merge pull request #756 from ScorexFoundation/jitcost-type
aslesarenko Dec 14, 2021
795c176
prepare-v5.0-tests: removed BenchmarkUtil.measureTime
aslesarenko Dec 14, 2021
cf6bb53
Merge remote-tracking branch 'origin/prepare-v5.0-tests' into v5.0-in…
aslesarenko Dec 15, 2021
1700dc1
v5.0-increase-script-version: fixes after merge
aslesarenko Dec 15, 2021
eb3224b
v5.0-increase-script-version: addressing review comments
aslesarenko Dec 16, 2021
e80a0a2
Merge pull request #738 from ScorexFoundation/prepare-v5.0-tests
aslesarenko Dec 17, 2021
ca07fc0
Merge remote-tracking branch 'origin/develop' into v5.0-increase-scri…
aslesarenko Dec 17, 2021
0fa0448
v5.0-finalize: simple TODO optimize
aslesarenko Dec 17, 2021
0592cd8
v5.0-finalize: more tests for TypeSerializer
aslesarenko Dec 19, 2021
5e78287
v5.0-finalize: removed CreateAvlTree operation
aslesarenko Dec 19, 2021
e0905cc
v5.0-finalize: negative test cases when not 1 argument in lambda
aslesarenko Dec 19, 2021
92ef08e
v5.0-finalize: more // TODO cover
aslesarenko Dec 19, 2021
dcc0ad9
v5.0-finalize: removed CreateAvlTree operation (part 2)
aslesarenko Dec 20, 2021
16414f8
v5.0-finalize: more test cases for Tuple and Option in register
aslesarenko Dec 20, 2021
985ce41
v5.0-finalize: mark all TODOs accoring to target release (v5.0, v5.x,…
aslesarenko Dec 20, 2021
cf54654
v5.0-finalize: fixed CollectionUtil.joinSeq method + tests
aslesarenko Dec 21, 2021
b13986c
v5.0-finalize: fixed test
aslesarenko Dec 21, 2021
81ac4cb
v5.0-finalize: identifying the problem with Coll.append
aslesarenko Dec 21, 2021
840c46f
v5.0-finalize: identifying the problem with Coll.append due to non-tr…
aslesarenko Dec 21, 2021
e8c069b
v5.0-fix-xorOf: sigmastate.Versions added and xorOf method fixed
aslesarenko Dec 21, 2021
138c34c
Implement validation for positive integer parsing.
jozanek Dec 22, 2021
554fb9a
v5.0-fix-if: fixed non-lazy If
aslesarenko Dec 22, 2021
dd59bd0
v5.0-fix-if: added allowNewToSucceed parameter + ScalaDocs
aslesarenko Dec 23, 2021
04b3577
v5.0-fix-if: requireMCLowering parameter removed
aslesarenko Dec 23, 2021
b3b9b69
codecov-badge: badges added to README.md
aslesarenko Dec 23, 2021
774e1cf
v5.0-todos: fix CostingBox.equals
aslesarenko Dec 23, 2021
fa0b9c9
v5.0-todos: moved safeNewArray to common module
aslesarenko Dec 23, 2021
56b0cd8
v5.0-protect-interpreter: make reduceToCrypto protected and remove ex…
aslesarenko Dec 24, 2021
f362f6b
v5.0-protect-interpreter: removed TestEvaluationMode
aslesarenko Dec 24, 2021
6d384ec
Merge pull request #748 from ScorexFoundation/v5.0-increase-script-ve…
aslesarenko Dec 25, 2021
f922137
v5.0-todos: fix import of java.util.Arrays
aslesarenko Dec 25, 2021
fd4e318
v5.0-fix-xorOf: added VersionContext
aslesarenko Dec 25, 2021
564338f
Merge branch 'v5.0-fix-xorOf' into v5.0-todos
aslesarenko Dec 25, 2021
547b650
v5.0-todos: fixes after merge of VersionContext
aslesarenko Dec 25, 2021
73b989f
Merge remote-tracking branch 'origin/v5.0-protect-interpreter' into v…
aslesarenko Dec 25, 2021
5ae0c26
v5.0-todos: fixes after merge
aslesarenko Dec 25, 2021
32d4a97
v5.0-todos: whole fullReduction to execute withVersions
aslesarenko Dec 25, 2021
9e1467c
v5.0-todos: simplify verify() and prove()
aslesarenko Dec 25, 2021
bb810c9
v5.0-todos: VersionContext.isJitActivated method added
aslesarenko Dec 26, 2021
66200fc
v5.0-todos: - serialize Box in SigmaDslSpecification tests;
aslesarenko Dec 26, 2021
d2b6484
v5.0-todos: tests of ErgoTrees which build deeply nested collections
aslesarenko Dec 26, 2021
2c25f31
v5.0-todos: unify usage of CheckPositionLimit to allow v6.0 soft-fork
aslesarenko Dec 27, 2021
31df1d9
v5.0-todos: more CrossVersionProps test
aslesarenko Dec 27, 2021
89713cd
v5.0-todos: - ensure all Colls are limited by MaxArrayLength;
aslesarenko Dec 27, 2021
fdca912
v5.0-todos: checkSoftForkCondition both in Interpreter (aka verifier)…
aslesarenko Dec 27, 2021
ca197f8
v5.0-todos: fix Scala 2.11 compilation
aslesarenko Dec 27, 2021
3ea28e7
v5.0-todos: fix property("Spam: Building large nested collection")
aslesarenko Dec 27, 2021
2dacf70
v5.0-todos: fix property("Coll.length")
aslesarenko Dec 27, 2021
77314de
v5.0-fix-zip: added VersionContext.isEvaluateErgoTreeUsingJIT method
aslesarenko Dec 28, 2021
b23c8fe
v5.0-fix-zip: VersionTesting added
aslesarenko Dec 28, 2021
1de796c
v5.0-fix-zip: pairColl method fixed and related tests parameterized b…
aslesarenko Dec 28, 2021
5543568
v5.0-fix-zip: more tests
aslesarenko Dec 28, 2021
9b4d1db
v5.0-fix-zip: CollOverArray.append fixed
aslesarenko Dec 28, 2021
d6ffe14
v5.0-fix-zip: more TODO v5.0 fixed
aslesarenko Dec 28, 2021
01598be
v5.0-fix-selfindex: bug fixed and tests updated
aslesarenko Dec 30, 2021
5531dce
v5.0-fix-substconst: fixed substCostants + tests
aslesarenko Dec 31, 2021
d7b6134
v5.0-fix-flatmap: coverage tests for checkValidFlatmap method
aslesarenko Jan 2, 2022
e82d49f
v5.0-fix-flatmap: coverage tests for checkValidFlatmap method
aslesarenko Jan 2, 2022
76004f7
v5.0-fix-xorOf: fix property("Coll.length")
aslesarenko Jan 4, 2022
e365e96
v5.0-fix-xorOf-2: use VersionContext.current.activatedVersion for ver…
aslesarenko Jan 4, 2022
6836586
v5.0-finalize-part1: rollback CreateAvlTree
aslesarenko Jan 4, 2022
ef7eb6a
v5.0-finalize-part1: rollback change in Append
aslesarenko Jan 24, 2022
0a14315
Merge branch 'v5.0-finalize-part1' into v5.0-fix-xorOf
aslesarenko Jan 24, 2022
5024f23
Publish a snapshot only if env.HAS_SECRETS == 'true'
aslesarenko Jan 24, 2022
7744ee5
v5.0-fix-if: fixed Scala 2.11 compilation
aslesarenko Jan 24, 2022
251784a
Merge pull request #762 from jozanek/v5.0-validate-positive-integer
aslesarenko Jan 24, 2022
eb47811
v5.0-finalize-part1: rollback changes in optionIsZero
aslesarenko Jan 26, 2022
5abc74e
v5.0-finalize-part1: fix tests
aslesarenko Jan 28, 2022
5aa9945
Merge pull request #761 from ScorexFoundation/v5.0-finalize-part1
aslesarenko Jan 28, 2022
ee26c78
Merge remote-tracking branch 'origin/v5.0-finalize' into v5.0-fix-xorOf
aslesarenko Jan 28, 2022
6a98aa1
Merge pull request #760 from ScorexFoundation/v5.0-fix-xorOf
aslesarenko Jan 28, 2022
84163d1
Merge pull request #763 from ScorexFoundation/v5.0-fix-if
aslesarenko Jan 28, 2022
accd5c5
v5.0-finalize: fix compilation and tests
aslesarenko Jan 28, 2022
5b65e77
v5.0-protect-interpreter: fix Scala 2.11 compilation
aslesarenko Jan 28, 2022
e0aa3a8
Merge branch 'v5.0-finalize' into v5.0-protect-interpreter
aslesarenko Jan 29, 2022
e927f5d
v5.0-protect-interpreter: fix after merge
aslesarenko Jan 29, 2022
0b837f0
Merge pull request #768 from ScorexFoundation/v5.0-protect-interpreter
aslesarenko Feb 1, 2022
f051f21
Merge remote-tracking branch 'origin/v5.0-finalize' into v5.0-todos
aslesarenko Feb 1, 2022
7baefef
v5.0-todos: fixes after merge
aslesarenko Feb 1, 2022
2882b56
Merge remote-tracking branch 'origin/v5.0-todos' into v5.0-fix-zip
aslesarenko Feb 2, 2022
bc6ea0f
v5.0-todo-mainnet: refactor ErgoTreeSerializerSpecification.scala
aslesarenko Jan 26, 2022
81300fd
v5.0-todo-mainnet: replace treeWithSegregation usages in tests with m…
aslesarenko Feb 2, 2022
36a7c03
v5.0-todo-mainnet: tests for GroupElement.exp via MethodCall node
aslesarenko Feb 3, 2022
63d4ae1
v5.0-todo-mainnet: tests for GroupElement.multiply
aslesarenko Feb 3, 2022
42c3938
v5.0-todo-mainnet: cleanup
aslesarenko Feb 3, 2022
5c4ef17
v5.0-todo-mainnet: Global.xor can be called via MethodCall node
aslesarenko Feb 5, 2022
c5e005f
v5.0-todo-mainnet: Coll.getOrElse can be called via MethodCall
aslesarenko Feb 7, 2022
e1af187
Merge remote-tracking branch 'origin/develop' into v5.0-todo-mainnet
aslesarenko Feb 7, 2022
de49f0e
v5.0-todos: clarified change in CheckSerializableTypeCode for Option …
aslesarenko Feb 8, 2022
a1f6248
v5.0-todos: clarified change in checkPositionLimit method
aslesarenko Feb 8, 2022
3feb382
v5.0-fix-zip: fixed Coll.length test
aslesarenko Feb 12, 2022
96f8f80
v5.0-fix-zip: rename version checking methods, switch to activation-b…
aslesarenko Feb 14, 2022
1738f4a
v5.0-fix-zip: fix tests
aslesarenko Feb 14, 2022
3b7f2d0
Merge remote-tracking branch 'origin/v5.0-fix-zip' into v5.0-fix-self…
aslesarenko Feb 14, 2022
48c04fc
v5.0-fix-selfindex: switched to activation-based versioning
aslesarenko Feb 14, 2022
3e3eade
v5.0-fix-selfindex: fixed test
aslesarenko Feb 14, 2022
e46beda
Merge branch 'v5.0-fix-selfindex' into v5.0-fix-substconst
aslesarenko Feb 14, 2022
505ab89
v5.0-fix-substconst: addressing review comments
aslesarenko Feb 15, 2022
19c04f7
v5.0-fix-zip: code cleanup
aslesarenko Feb 16, 2022
23d4585
v5.0-todos: added note about ergoTree.complexity
aslesarenko Feb 17, 2022
4b422d9
v5.0-fix-test-for-headers: add new test for headers: fails for v4.x, …
jozanek Feb 7, 2022
9734415
Merge pull request #767 from ScorexFoundation/v5.0-todos
aslesarenko Feb 17, 2022
d179140
Merge pull request #771 from ScorexFoundation/v5.0-fix-zip
aslesarenko Feb 17, 2022
5212765
removed example usage of Option.isEmpty
aslesarenko Feb 19, 2022
5442dc2
v5.0-todo-mainnet: test case for Coll.append as MethodCall
aslesarenko Feb 21, 2022
d1d8e71
v5.0-todo-mainnet: test case for Coll.slice as MethodCall (added irBu…
aslesarenko Feb 21, 2022
0dfd513
v5.0-todo-mainnet: test case for Coll.exists, Coll.forall as MethodCa…
aslesarenko Feb 22, 2022
25a4f5b
v5.0-todo-mainnet: removing pattern cases for Coll.map, Coll.fold fro…
aslesarenko Feb 24, 2022
71f3ed3
Merge pull request #780 from jozanek/v5.0-fix-test-for-headers
aslesarenko Feb 28, 2022
3bd17c6
Merge pull request #772 from ScorexFoundation/v5.0-fix-selfindex
aslesarenko Mar 11, 2022
f4aaf2b
v5.0-fix-substconst: typos
aslesarenko Mar 11, 2022
2119677
Merge pull request #773 from ScorexFoundation/v5.0-fix-substconst
aslesarenko Mar 11, 2022
80658a3
Merge remote-tracking branch 'origin/v5.0-finalize' into v5.0-fix-fla…
aslesarenko Mar 11, 2022
d4acacc
v5.0-fix-flatmap: fixes after merge
aslesarenko Mar 11, 2022
7175a25
v5.0-fix-flatmap: renaming isActivatedVersionGreaterV1 -> isJitActivated
aslesarenko Mar 12, 2022
e6b0148
v5.0-todo-mainnet: updated tests for Coll.fold
aslesarenko Mar 12, 2022
a082eb3
Merge remote-tracking branch 'origin/v5.0-todo-mainnet' into v5.0-tod…
aslesarenko Mar 12, 2022
27a38ef
v5.0-todo-mainnet: fix test
aslesarenko Mar 12, 2022
5c6a053
v5.0-todo-mainnet: removing pattern cases for Option.isDefined, Optio…
aslesarenko Mar 12, 2022
c2719fe
v5.0-todo-mainnet: fix tests
aslesarenko Mar 12, 2022
38b114d
v5.0-fix-flatmap: switch to activation-based versioning
aslesarenko Mar 28, 2022
5dad838
Merge pull request #775 from ScorexFoundation/v5.0-fix-flatmap
aslesarenko Mar 28, 2022
287d351
Merge remote-tracking branch 'origin/v5.0-finalize' into v5.0-fix-xor…
aslesarenko Mar 28, 2022
5cdf87a
v5.0-fix-xorOf-2: use isJitActivated method
aslesarenko Mar 28, 2022
b92e479
Merge remote-tracking branch 'origin/v5.0-fix-xorOf-2' into v5.0-todo…
aslesarenko Mar 28, 2022
a3b0645
v5.0-todo-mainnet: add TODO cover v5.x
aslesarenko Mar 28, 2022
7602213
v5.0-jit-costing: Enhance all tests with expected jit costing
jozanek Mar 17, 2022
5532635
v5.0-add-jit-costing-for-tests: Long methods
aslesarenko Mar 19, 2022
47c1138
v5.0-add-jit-costing-for-tests: fixed property("NEQ of tuples of nume…
aslesarenko Mar 21, 2022
516e80e
v5.0-add-jit-costing-for-tests: fixed property("NEQ of collections of…
aslesarenko Mar 21, 2022
9e96cf4
v5.0-jit-costing: Another bunch of tests uses jit costing
jozanek Mar 29, 2022
2e0ec20
v5.0-jit-costing: binary and method cost details abstraction.
jozanek Mar 30, 2022
51a6977
v5.0-jit-costing: fix test for SAvlTree.valueLengthOptMethod
jozanek Mar 30, 2022
6f834ac
v5.0-jit-costing: Correst expectedExpr for 'Coll fold with nested If'…
jozanek Mar 30, 2022
08b3810
v5.0-test-nested-loops:
jozanek Feb 7, 2022
9bae653
v5.0-test-nested-loops: fix property("nested loops: map inside fold")
aslesarenko Apr 1, 2022
ee22a64
v5.0-test-nested-loops: check exception when !lowerMethodCallsInTests…
aslesarenko Apr 1, 2022
48aba69
v5.0-test-nested-loops: roll back BitOp case
aslesarenko Apr 1, 2022
a7d2321
v5.0-add-jit-costing-for-tests: renamings
aslesarenko Apr 1, 2022
53ea2a4
v5.0-test-nested-loops: remove unnecessary code.
jozanek Apr 2, 2022
77b96b1
Merge pull request #788 from ScorexFoundation/v5.0-test-nested-loops
aslesarenko Apr 4, 2022
c84aa35
v5.0-fix-flatmap: remove checkValidFlatmap from flatMap_eval (which i…
aslesarenko Apr 4, 2022
bee7396
v5.0-fix-flatmap: comment test code
aslesarenko Apr 4, 2022
d37ba99
Merge remote-tracking branch 'origin/v5.0-fix-flatmap' into v5.0-add-…
aslesarenko Apr 4, 2022
d25924a
v5.0-jit-costing: Coll.flatMap equivalence failing test due to costDe…
jozanek Mar 30, 2022
e50a12c
v5.0-jitc-failing-Coll-flatmap-equivalence: fix tests
aslesarenko Apr 4, 2022
b5ee207
v5.0-jit-costing: AvlTree.contains failing test due to expectedCost.
jozanek Mar 30, 2022
1659cbd
Merge pull request #777 from ScorexFoundation/v5.0-fix-xorOf-2
aslesarenko Apr 5, 2022
894903c
v5.0-jitc-for-changed-feature-testing: Enable jitc for ChangedFeature
jozanek Apr 6, 2022
b109f81
v5.0-jitc-for-changed-feature-testing: Add jitc to 'Random headers ac…
jozanek Apr 6, 2022
24917d3
v5.0-jitc-for-changed-feature-testing: Add jitc to 'Context propertie…
jozanek Apr 6, 2022
cb3d771
v5.0-jitc-for-changed-feature-testing: Add jitc to 'xorOf equivalence…
jozanek Apr 6, 2022
8a8e9c0
v5.0-jitc-for-changed-feature-testing: Add jitc to 'Global.xor equiva…
jozanek Apr 6, 2022
f616d68
v5.0-jitc-for-changed-feature-testing: Add jitc to 'Option fold worka…
jozanek Apr 6, 2022
fc95085
v5.0-jitc-for-changed-feature-testing: Add jitc to 'substConstants eq…
jozanek Apr 6, 2022
325dfda
v5.0-jitc-for-changed-feature-testing: Comments for tests which ignor…
jozanek Apr 6, 2022
261bc3c
v5.0-jitc-for-changed-feature-testing: Add jitc to 'Global.xor equiva…
jozanek Apr 6, 2022
3654798
v5.0-jitc-for-changed-feature-testing: Comment
jozanek Apr 6, 2022
2bbc256
v5.0-jitc-failing-Coll-flatmap-equivalence: Remove unused method and …
jozanek Apr 7, 2022
700917c
Merge pull request #786 from ScorexFoundation/v5.0-jitc-failing-Coll-…
jozanek Apr 7, 2022
599a0e0
v5.0-jitc-failing-avltree-contains: Hardcoded scenario for some avltr…
jozanek Apr 13, 2022
48a0a4d
Merge pull request #787 from ScorexFoundation/v5.0-jitc-failing-avltr…
aslesarenko Apr 15, 2022
28da029
v5.0-jitc-for-changed-feature-testing: checking CostDetails
aslesarenko Apr 15, 2022
4bcc605
v5.0-jitc-for-changed-feature-testing: checking CostDetails (part 2)
aslesarenko Apr 15, 2022
fc7de98
v5.0-jitc-for-changed-feature-testing: checking CostDetails (part 3)
aslesarenko Apr 15, 2022
f6d9991
v5.0-jitc-for-changed-feature-testing: checking CostDetails (part 4)
aslesarenko Apr 15, 2022
a8633b6
Merge branch 'v5.0-add-jit-costing-for-tests' into v5.0-jitc-for-chan…
jozanek Apr 19, 2022
3f94014
v5.0-jitc-for-changed-feature-testing: Add jitc to 'Coll flatMap meth…
jozanek Apr 19, 2022
be20e3a
v5.0-jitc-for-changed-feature-testing: Add jitc to 'Option fold worka…
jozanek Apr 19, 2022
91cd31b
v5.0-jitc-for-changed-feature-testing: Add jitc to 'Coll flatMap meth…
jozanek Apr 19, 2022
d91406d
v5.0-jitc-for-changed-feature-testing: Add jitc to 'AlvTree.{get,getM…
jozanek Apr 19, 2022
f9e05a8
v5.0-jitc-for-changed-feature-testing: Add jitc to 'AvlTree.update eq…
jozanek Apr 20, 2022
19607a7
v5.0-jitc-for-changed-feature-testing: Add jitc to 'AvlTree.remove eq…
jozanek Apr 20, 2022
5bef13c
v5.0-jitc-for-changed-feature-testing: Add jitc to 'AvlTree.{contains…
jozanek Apr 21, 2022
46b0f44
v5.0-jitc-for-changed-feature-testing: Add jitc to 'AvlTree.insert eq…
jozanek Apr 21, 2022
c106776
v5.0-jitc-for-changed-feature-testing: Add jitc to 'AvlTree.update eq…
jozanek Apr 21, 2022
99d260d
v5.0-jitc-for-changed-feature-testing: Add jitc to 'AvlTree.remove eq…
jozanek Apr 21, 2022
d4dadd1
v5.0-add-jit-costing-for-tests: 'Coll slice method equivalence' test
jozanek Apr 22, 2022
4e269e9
v5.0-jitc-for-changed-feature-testing: resolve remaining TODO mainnet
aslesarenko Apr 22, 2022
41e1f2a
v5.0-jitc-for-changed-feature-testing: code cleanup + ScalaDocs
aslesarenko Apr 23, 2022
0d8e873
v5.0-jitc-for-changed-feature-testing: renamings
aslesarenko Apr 23, 2022
743123c
Merge pull request #791 from ScorexFoundation/v5.0-jitc-for-changed-f…
aslesarenko Apr 23, 2022
1bc187f
Merge branch 'v5.0-finalize' of github.com:ScorexFoundation/sigmastat…
kushti May 5, 2022
83a4066
v5.0-todo-mainnet: rollback Value.checkType call
aslesarenko May 6, 2022
9e271ca
v5.0-todo-mainnet: address review comments
aslesarenko May 6, 2022
9770e99
Merge remote-tracking branch 'origin/v5.0-todo-mainnet' into v5.0-tod…
aslesarenko May 6, 2022
67e0485
add-from-base-16: Update test scenarios.
jozanek May 6, 2022
d6dc354
Merge pull request #779 from ScorexFoundation/v5.0-todo-mainnet
aslesarenko May 9, 2022
96db78d
Merge branch 'v5.0-todo-mainnet' of github.com:ScorexFoundation/sigma…
kushti May 9, 2022
9bee61f
add-from-base-16: Enhance language specification.
jozanek May 13, 2022
c59139b
Merge pull request #737 from thub1271/add-from-base-16
aslesarenko May 16, 2022
07a7d74
v5.0-fix-costing-deserialize: accumulate cost of deserialization and …
aslesarenko May 18, 2022
9c8cf91
v5.0-fix-costing-deserialize: rename constant
aslesarenko May 18, 2022
90f025b
Merge pull request #785 from ScorexFoundation/v5.0-add-jit-costing-fo…
aslesarenko Jun 1, 2022
154ac87
Merge pull request #790 from ScorexFoundation/v5.0-fix-flatmap
aslesarenko Jun 1, 2022
a23d71f
Merge remote-tracking branch 'origin/develop' into v5.0-finalize
aslesarenko Jun 1, 2022
31f62da
Merge pull request #805 from ScorexFoundation/v5.0-fix-costing-deseri…
aslesarenko Jun 1, 2022
826a7bd
Merge remote-tracking branch 'origin/master' into v5.0-finalize
aslesarenko Jun 13, 2022
281d021
v5.0-finalize: fix after merge
aslesarenko Jun 13, 2022
e5e6e76
Merge remote-tracking branch 'origin/v5.0-finalize' into v5.0-finalize
aslesarenko Jun 13, 2022
12610cf
set HAS_SECRETS on CI env;
greenhat Jun 15, 2022
6392cbc
Merge pull request #813 from ScorexFoundation/ci-add-has-secrets
aslesarenko Jun 15, 2022
85336ec
Merge remote-tracking branch 'origin/develop' into v5.0-finalize
aslesarenko Jun 15, 2022
4f2579b
v5.0-unit-register-test: added test for Unit registers
aslesarenko Jul 5, 2022
d6033c6
v5.0-unit-register-test: added test which accesses Unit register valu…
aslesarenko Jul 5, 2022
5a3690a
v5.0-unit-register-test: fixes for Scala 2.11
aslesarenko Jul 8, 2022
d22386c
v5.0-unit-register-test: versioned SUnit -> UnitElement conversion, o…
aslesarenko Jul 8, 2022
da43b85
v5.0-unit-register-test: added testcase for UnitConstant serialization
aslesarenko Jul 8, 2022
7582170
v5.0-unit-register-test: removed changes in RuntimeCosting
aslesarenko Jul 13, 2022
52492dc
v5.0-unit-register-test: more ScalaDocs + issue reference
aslesarenko Jul 14, 2022
d254cad
Merge pull request #817 from ScorexFoundation/v5.0-unit-register-test
aslesarenko Jul 16, 2022
89c722c
Merge branch 'master' of github.com:ScorexFoundation/sigmastate-inter…
kushti Oct 5, 2022
c89bfae
v5.0-finalize: remove unused imports
aslesarenko Oct 10, 2022
b55ec75
v5.0-finalize: comment for Apply.eval
aslesarenko Oct 11, 2022
ac86fcb
v5.0-finalize: descriptions for `fromBase**` predefined operations
aslesarenko Oct 11, 2022
f100992
v5.0-finalize: more ScalaDocs, cleanups and clarifying comments
aslesarenko Oct 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
fail_ci_if_error: true

- name: Publish a snapshot ${{ github.ref }}
if: env.HAS_SECRETS == 'true'
run: sbt ++${{ matrix.scala }} publish
env:
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[![CI](https://github.com/ScorexFoundation/sigmastate-interpreter/actions/workflows/ci.yml/badge.svg)](https://github.com/ScorexFoundation/sigmastate-interpreter/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/ScorexFoundation/sigmastate-interpreter/branch/develop/graph/badge.svg?token=HNu2ZEOoV6)](https://codecov.io/gh/ScorexFoundation/sigmastate-interpreter)

# ErgoScript compiler and ErgoTree interpreter

This repository contains implementations of ErgoScript compiler and ErgoTree
Expand Down
46 changes: 43 additions & 3 deletions common/src/main/scala/scalan/util/CollectionUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ import scala.reflect.ClassTag

object CollectionUtil {

/** @deprecated shouldn't be used other than for backwards compatibility with v3.x, v4.x. */
def concatArrays[T](xs: Array[T], ys: Array[T]): Array[T] = {
val len = xs.length + ys.length
val result = (xs match {
case arr: Array[AnyRef] => new Array[AnyRef](len)
case arr: Array[AnyRef] => new Array[AnyRef](len) // creates an array with invalid type descriptor (i.e. when T == Tuple2)
case arr: Array[Byte] => new Array[Byte](len)
case arr: Array[Short] => new Array[Short](len)
case arr: Array[Int] => new Array[Int](len)
Expand All @@ -30,6 +31,21 @@ object CollectionUtil {
result
}

/** Concatenates two arrays into a new resulting array.
* All items of both arrays are copied to the result using System.arraycopy.
* This method takes ClassTag to create proper resulting array.
* Can be used in v5.0 and above.
*/
def concatArrays_v5[T:ClassTag](arr1: Array[T], arr2: Array[T]): Array[T] = {
val l1 = arr1.length
val l2 = arr2.length
val length: Int = l1 + l2
val result: Array[T] = new Array[T](length)
System.arraycopy(arr1, 0, result, 0, l1)
System.arraycopy(arr2, 0, result, l1, l2)
result
}

def deepHashCode[T](arr: Array[T]): Int = arr match {
case arr: Array[AnyRef] => util.Arrays.deepHashCode(arr)
case arr: Array[Byte] => util.Arrays.hashCode(arr)
Expand All @@ -50,6 +66,10 @@ object CollectionUtil {
}
}

/** Group the given sequence of pairs by first values as keys.
* @param kvs sequence of values which is traversed once
* @return a multimap with ArrayBuffer of values for each key.
*/
def createMultiMap[K,V](kvs: GenIterable[(K,V)]): Map[K, ArrayBuffer[V]] = {
val res = HashMap.empty[K, ArrayBuffer[V]]
kvs.foreach { case (k, v) =>
Expand All @@ -62,12 +82,17 @@ object CollectionUtil {
res.toMap
}

// TODO optimize: using cfor and avoiding allocations
/** Perform relational inner join of two sequences using the given key projections. */
def joinSeqs[O, I, K](outer: GenIterable[O], inner: GenIterable[I])(outKey: O=>K, inKey: I=>K): GenIterable[(O,I)] = {
val kvs = createMultiMap(inner.map(i => (inKey(i), i)))
val res = outer.flatMap(o => {
val ko = outKey(o)
kvs(ko).map(i => (o,i))
kvs.get(ko) match {
case Some(inners) =>
inners.map(i => (o,i))
case None =>
Nil
}
})
res
}
Expand Down Expand Up @@ -182,6 +207,21 @@ object CollectionUtil {

implicit class TraversableOps[A, Source[X] <: GenIterable[X]](val xs: Source[A]) extends AnyVal {

/** Returns a copy of this collection where elements at `items(i)._1` are replaced
* with `items(i)._2` for each i.
*/
def updateMany(items: Seq[(Int, A)])(implicit tA: ClassTag[A]): Seq[A] = {
val res = xs.toArray
val nItems = items.length
var i = 0
while (i < nItems) {
val item = items(i)
res(item._1) = item._2
i += 1
}
res
}

def filterCast[B:ClassTag](implicit cbf: CanBuildFrom[Source[A], B, Source[B]]): Source[B] = {
val b = cbf()
for (x <- xs) {
Expand Down
101 changes: 101 additions & 0 deletions common/src/main/scala/sigmastate/VersionContext.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
package sigmastate

import sigmastate.VersionContext.JitActivationVersion

import scala.util.DynamicVariable

/** Represent currently activated protocol version and currently executed ErgoTree version.
*
* This parameters, once set in DynamicVariable can be accessed everywhere on the current
* thread.
*
* @param activatedVersion Currently activated script version == Block.headerVersion - 1
* @param ergoTreeVersion version of the currently executed ErgoTree
*
* @see
*/
case class VersionContext(activatedVersion: Byte, ergoTreeVersion: Byte) {
require(ergoTreeVersion <= activatedVersion,
s"In a valid VersionContext ergoTreeVersion must never exceed activatedVersion: $this")

/** @return true, if the activated script version of Ergo protocol on the network is
* greater than v1. */
def isJitActivated: Boolean = activatedVersion >= JitActivationVersion

/** @return true, if the version of ErgoTree being executed greater than v1. */
def isErgoTreeVersionGreaterV1: Boolean =
ergoTreeVersion >= JitActivationVersion
}

object VersionContext {
/** Maximum version of ErgoTree supported by this interpreter release.
* See version bits in `ErgoTree.header` for more details.
* This value should be increased with each new protocol update via soft-fork.
* The following values are used for current and upcoming forks:
* - version 3.x this value must be 0
* - in v4.0 must be 1
* - in v5.x must be 2
* etc.
*/
val MaxSupportedScriptVersion: Byte = 2 // supported versions 0, 1, 2

/** The first version of ErgoTree starting from which the JIT costing interpreter must be used.
* It must also be used for all subsequent versions (3, 4, etc).
*/
val JitActivationVersion: Byte = 2

private val _defaultContext = VersionContext(
activatedVersion = 1/* v4.x */,
ergoTreeVersion = 1
)

/** Universally accessible version context which is used to version the code
* across the whole repository.
*
* The default value represent activated Ergo protocol and highest ErgoTree version.
*/
private val _versionContext: DynamicVariable[VersionContext] =
new DynamicVariable[VersionContext](_defaultContext)

/** Returns the current VersionContext attached to the current thread.
* Each thread can have only one current version context at any time, which can be
* changed using `withVersions` method.
*
* @see withVersions()
*/
def current: VersionContext = {
val ctx = _versionContext.value
if (ctx == null)
throw new IllegalStateException(
s"VersionContext is not specified on thread ${Thread.currentThread().getId}")
ctx
}

/** Executes the given block under the given version context attached to the current thread.
*
* The typical usage is to use `VersionContext.withVersions(activatedVersion,
* treeVersion) {...}` when the block of code needs to be executed with the given
* versions.
*
* For example, sigmastate.Interpreter uses it to execute operations according to the
* necessary versions of Ergo protocol and ErgoTree.
*
* @param activatedVersion Currently activated script version == Block.headerVersion - 1
* @param ergoTreeVersion ErgoTree version to be set on the current thread
* @param block block of code to execute
* @return result of block execution
*/
def withVersions[T](activatedVersion: Byte, ergoTreeVersion: Byte)(block: => T): T =
_versionContext.withValue(VersionContext(activatedVersion, ergoTreeVersion))(block)

/** Checks the version context has the given versions*/
def checkVersions(activatedVersion: Byte, ergoTreeVersion: Byte) = {
val ctx = VersionContext.current
if (ctx.activatedVersion != activatedVersion || ctx.ergoTreeVersion != ergoTreeVersion) {
val expected = VersionContext(activatedVersion, ergoTreeVersion)
throw new IllegalStateException(
s"Global VersionContext.current = ${ctx} while expected $expected.")
}
}

}
31 changes: 31 additions & 0 deletions common/src/main/scala/sigmastate/util.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package sigmastate

import scalan.util.CollectionUtil

import scala.reflect.ClassTag

object util {
/** Maximum length of an allocatable array. */
val MaxArrayLength: Int = 100000

private def checkLength[A](len: Int)(implicit tA: ClassTag[A]) = {
if (len > MaxArrayLength)
throw new RuntimeException(
s"Cannot allocate array of $tA with $len items: max limit is $MaxArrayLength")
}

/** Allocates a new array with `len` items of type `A`.
* Should be used instead of `new Array[A](n)` or `Array.ofDim[A](n)`
*/
final def safeNewArray[A](len: Int)(implicit tA: ClassTag[A]): Array[A] = {
checkLength[A](len)
new Array[A](len)
}

/** Concatenate two arrays checking length limit of the resulting array.
* Should be used in implementation of Coll operations of v5.0 and above. */
final def safeConcatArrays_v5[A](arr1: Array[A], arr2: Array[A])(implicit tA: ClassTag[A]): Array[A] = {
checkLength[A](arr1.length + arr2.length)
CollectionUtil.concatArrays_v5(arr1, arr2)
}
}
47 changes: 43 additions & 4 deletions common/src/test/scala/scalan/util/CollectionUtilTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,31 @@ class CollectionUtilTests extends BaseTests {
import scalan.util.CollectionUtil._
import java.lang.{Byte => JByte, Integer}

test("updateMany") {
val xs: Seq[Byte] = Array[Byte](1,2,3)
xs.updateMany(Seq.empty) shouldBe xs
xs.updateMany(Seq(0 -> 2)) shouldBe Seq(2, 2, 3)
xs.updateMany(Seq(0 -> 2, 2 -> 2)) shouldBe Seq(2, 2, 2)
an[IndexOutOfBoundsException] should be thrownBy {
xs.updateMany(Seq(3 -> 2))
}
}

test("concatArrays") {
val xs = Array[Byte](1,2,3)
val ys = Array[Byte](4,5,6)
val zs = concatArrays(xs, ys)
assertResult(Array[Byte](1, 2, 3, 4, 5, 6))(zs)

// val jxs = Array[JByte](new JByte(1), new JByte(2), new JByte(3))
// val jys = Array[JByte](new JByte(4), new JByte(5), new JByte(6))
// val jzs = concatArrays(jxs, jys)
// assertResult(Array[Byte](1, 2, 3, 4, 5, 6))(jzs)
val pairs = xs.zip(ys)
// this reproduces the problem which takes place in v3.x, v4.x (ErgoTree v0, v1)
an[ClassCastException] should be thrownBy(concatArrays(pairs, pairs))

// and this is the fix in v5.0
concatArrays_v5(pairs, pairs) shouldBe Array((1, 4), (2, 5), (3, 6), (1, 4), (2, 5), (3, 6))

val xOpts = xs.map(Option(_))
concatArrays_v5(xOpts, xOpts) shouldBe Array(Some(1), Some(2), Some(3), Some(1), Some(2), Some(3))
}

def join(l: Map[Int,Int], r: Map[Int,Int]) =
Expand All @@ -28,6 +43,30 @@ class CollectionUtilTests extends BaseTests {
def joinPairs(l: Seq[(String,Int)], r: Seq[(String,Int)]) =
outerJoinSeqs(l, r)(l => l._1, r => r._1)((_,l) => l._2, (_,r) => r._2, (k,l,r) => l._2 + r._2)

test("joinSeqs") {
def key(p : (Int, String)): Int = p._1

{
val res = CollectionUtil.joinSeqs(
outer = Seq(1 -> "o1", 1 -> "o1"),
inner = Seq(1 -> "i1", 2 -> "i2"))(key, key)
res shouldBe Seq(
(1 -> "o1") -> (1 -> "i1"),
(1 -> "o1") -> (1 -> "i1")
)
}

{ // same as above, but swapping inner and outer
val res = CollectionUtil.joinSeqs(
outer = Seq(1 -> "o1", 2 -> "o2"),
inner = Seq(1 -> "i1", 1 -> "i1"))(key, key)
res shouldBe Seq(
(1 -> "o1") -> (1 -> "i1"),
(1 -> "o1") -> (1 -> "i1")
)
}
}

test("outerJoin maps") {
val left = Map(1 -> 1, 2 -> 2, 3 -> 3)
val right = Map(2 -> 2, 3 -> 3, 4 -> 4)
Expand Down
87 changes: 87 additions & 0 deletions common/src/test/scala/sigmastate/VersionTesting.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
package sigmastate

import spire.syntax.all.cfor

import scala.util.DynamicVariable

trait VersionTesting {

protected val activatedVersions: Seq[Byte] =
(0 to VersionContext.MaxSupportedScriptVersion).map(_.toByte).toArray[Byte]

private[sigmastate] val _currActivatedVersion = new DynamicVariable[Byte](0)
def activatedVersionInTests: Byte = _currActivatedVersion.value

/** Checks if the current activated script version used in tests corresponds to v4.x. */
def isActivatedVersion4: Boolean = activatedVersionInTests < VersionContext.JitActivationVersion

val ergoTreeVersions: Seq[Byte] =
(0 to VersionContext.MaxSupportedScriptVersion).map(_.toByte).toArray[Byte]

private[sigmastate] val _currErgoTreeVersion = new DynamicVariable[Byte](0)

/** Current ErgoTree version assigned dynamically. */
def ergoTreeVersionInTests: Byte = _currErgoTreeVersion.value

/** Executes the given block for each combination of _currActivatedVersion and
* _currErgoTreeVersion assigned to dynamic variables.
*/
def forEachScriptAndErgoTreeVersion
(activatedVers: Seq[Byte], ergoTreeVers: Seq[Byte])
(block: => Unit): Unit = {
cfor(0)(_ < activatedVers.length, _ + 1) { i =>
val activatedVersion = activatedVers(i)
// setup each activated version
_currActivatedVersion.withValue(activatedVersion) {

cfor(0)(
i => i < ergoTreeVers.length && ergoTreeVers(i) <= activatedVersion,
_ + 1) { j =>
val treeVersion = ergoTreeVers(j)
// for each tree version up to currently activated, set it up and execute block
_currErgoTreeVersion.withValue(treeVersion)(block)
}

}
}
}

/** Helper method which executes the given `block` once for each `activatedVers`.
* The method sets the dynamic variable activatedVersionInTests with is then available
* in the block.
*/
def forEachActivatedScriptVersion(activatedVers: Seq[Byte])(block: => Unit): Unit = {
cfor(0)(_ < activatedVers.length, _ + 1) { i =>
val activatedVersion = activatedVers(i)
_currActivatedVersion.withValue(activatedVersion)(block)
}
}

/** Helper method which executes the given `block` once for each `ergoTreeVers`.
* The method sets the dynamic variable ergoTreeVersionInTests with is then available
* in the block.
*/
def forEachErgoTreeVersion(ergoTreeVers: Seq[Byte])(block: => Unit): Unit = {
cfor(0)(_ < ergoTreeVers.length, _ + 1) { i =>
val version = ergoTreeVers(i)
_currErgoTreeVersion.withValue(version)(block)
}
}

val printVersions: Boolean = false

protected def testFun_Run(testName: String, testFun: => Any): Unit = {
def msg = s"""property("$testName")(ActivatedVersion = $activatedVersionInTests; ErgoTree version = $ergoTreeVersionInTests)"""
if (printVersions) println(msg)
try testFun
catch {
case t: Throwable =>
if (!printVersions) {
// wasn't printed, print it now
println(msg)
}
throw t
}
}

}
Loading