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

Constant folding #45

Open
wants to merge 515 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
515 commits
Select commit Hold shift + click to select a range
add2ed0
wip complexifyValue
morganthomas Dec 12, 2022
2670eae
Merge branch 'fkv' of github.com:CasperAssociation/osl into fkv
morganthomas Dec 12, 2022
ca3d73a
wip complexifyValue
morganthomas Dec 13, 2022
4453e39
complexifyValue
morganthomas Dec 13, 2022
0487fd4
wip simplify type tests
morganthomas Dec 13, 2022
9aeb10d
wip Sudoku witness generation
morganthomas Dec 13, 2022
d392245
wip sudoku satisfaction test
morganthomas Dec 13, 2022
9ae6665
refactor: introduce loadContext
morganthomas Dec 13, 2022
be3c105
wip sudoku satisfaction test case
morganthomas Dec 13, 2022
4db9b50
wip debug evaluation
morganthomas Dec 13, 2022
230f783
improve complexifyValue error reporting
morganthomas Dec 13, 2022
5936539
fix Sudoku example solution
morganthomas Dec 13, 2022
f132acd
fix type error
morganthomas Dec 13, 2022
3bf2e6c
fix evaluation bug
morganthomas Dec 13, 2022
d212518
more specific evaluation errors
morganthomas Dec 13, 2022
1b312ef
wip reform evaluation
morganthomas Dec 14, 2022
ec70cd5
fix getDirectSubformulas and getDirectSubformulasWithWitnesses?
morganthomas Dec 14, 2022
58edf82
fix non-termination in witness preprocessing?
morganthomas Dec 14, 2022
a9284f9
make some fixes to getDirectSubformulas[AndPairedWitnesses] and add i…
morganthomas Dec 14, 2022
10b68f6
avoid excessively long error messages
morganthomas Dec 14, 2022
56ccb48
wip
morganthomas Dec 14, 2022
20e2468
wip re-reform evaluation
morganthomas Dec 14, 2022
c8792e5
fix type error
morganthomas Dec 14, 2022
03fd8b0
sudoku is satisfied!
morganthomas Dec 14, 2022
9251f95
ormolu
morganthomas Dec 14, 2022
69d8c3c
lint
morganthomas Dec 14, 2022
4ac1fd9
refactor
morganthomas Dec 14, 2022
479b64e
add failing sudoku test
morganthomas Dec 14, 2022
d8cc892
getWitnessType local contexts
morganthomas Dec 14, 2022
3c44cad
Prop-valued let in lambda
morganthomas Dec 14, 2022
5348875
wip check witnesses are in bounds
morganthomas Dec 14, 2022
8c3bdb2
check witnesses are in bounds
morganthomas Dec 15, 2022
6d6fc03
remove old todo
morganthomas Dec 15, 2022
7b234fa
wip generators
morganthomas Dec 15, 2022
313ef08
wip simplify type property tests
morganthomas Dec 15, 2022
18b3557
limit test complexity
morganthomas Dec 15, 2022
b3a2e9f
ormolu
morganthomas Dec 15, 2022
61939c3
lint
morganthomas Dec 15, 2022
e26ce74
Merge pull request #22 from CasperAssociation/fkv
morganthomas Dec 15, 2022
f6c4b20
sigma11 evaluation
morganthomas Dec 15, 2022
a852dd2
wip argument -> sigma11 argument conversion
morganthomas Dec 15, 2022
6082d2e
wip argument -> sigma11 argument conversion
morganthomas Dec 16, 2022
74427ee
sigma11 evaluation: bounds checking
morganthomas Dec 16, 2022
330782b
wip sudoku sigma11 semantics spec
morganthomas Dec 16, 2022
7d15050
defaultSigma11Values
morganthomas Dec 16, 2022
66c9097
wip sudoku sigma11 semantics spec
morganthomas Dec 16, 2022
60b4fbb
auxTablesToEvalContext
morganthomas Dec 16, 2022
a018dfc
incorporate default values in maybe-valued functions in sigma11 argum…
morganthomas Dec 16, 2022
9add0ca
set first-order values to cardinality 1
morganthomas Dec 16, 2022
57c71f7
uncross some wires
morganthomas Dec 16, 2022
9982a0b
sigma11 formula for sudoku
morganthomas Dec 19, 2022
06cdde8
wip fix witness processing in sigma11 formula evaluation
morganthomas Dec 19, 2022
b257850
wip fix witness processing in sigma11 formula evaluation
morganthomas Dec 19, 2022
8f69757
wip toSigma11ValueTree
morganthomas Dec 22, 2022
1e0d0a2
wip toSigma11ValueTree (second attempt)
morganthomas Dec 22, 2022
2ca7d55
wip toSigma11ValueTree (second attempt)
morganthomas Dec 23, 2022
0c9f21f
wip toSigma11ValueTree (second attempt)
morganthomas Dec 23, 2022
a0b36da
toSigma11ValueTree: introduce local context and local context mapping…
morganthomas Dec 23, 2022
e8bf8b5
toSigma11ValueTree: support props in let expressions
morganthomas Dec 23, 2022
d473cc1
toSigma11Argument: make tests compile
morganthomas Dec 23, 2022
b03b63a
toSigma11ValueTree: add lambda case
morganthomas Dec 23, 2022
f834c9d
more specific error reporting
morganthomas Dec 23, 2022
0783b18
wip debug toSigma11ValueTree
morganthomas Dec 23, 2022
3561d7f
wip debug toSigma11ValueTree
morganthomas Dec 26, 2022
f7b8cd5
wip debug Sudoku example sigma11 translation
morganthomas Dec 26, 2022
00d05db
wip debug Sudoku example sigma11 translation
morganthomas Dec 27, 2022
3e653e2
debug Sudoku example sigma11 translation
morganthomas Dec 27, 2022
6c4e226
fix tests
morganthomas Dec 27, 2022
5e3678a
ormolu
morganthomas Dec 27, 2022
33119d7
lint
morganthomas Dec 27, 2022
fedd7fb
remove trace
morganthomas Dec 27, 2022
260eb95
remove commented code
morganthomas Dec 27, 2022
3766f1a
remove compiler output
morganthomas Dec 27, 2022
be283c0
refactor
morganthomas Dec 27, 2022
433ccba
refactor
morganthomas Dec 27, 2022
c14047f
Merge pull request #23 from CasperAssociation/fkv
morganthomas Dec 27, 2022
e2da34e
bugfix for computing argument forms: flip negated quantifiers
morganthomas Dec 27, 2022
fc847fb
deBruijnToGensymsEvalContext
morganthomas Dec 27, 2022
4aed927
wip gensym sigma11 evaluation
morganthomas Dec 27, 2022
307311b
wip gensym sigma11 evaluation
morganthomas Dec 27, 2022
cbfb9e3
wip gensym sigma11 evaluation
morganthomas Dec 28, 2022
392d6d9
gensym sigma11 evaluation
morganthomas Dec 28, 2022
a8a6f3f
Merge pull request #24 from CasperAssociation/fkv
morganthomas Dec 28, 2022
fe1a5d4
wip mergeWitnessesConjunctive
morganthomas Dec 28, 2022
f80ab88
mergeWitnessesConjunctive
morganthomas Dec 28, 2022
bca0d25
get rid of mergeQuantifiersDisjunctive because it complicates witness…
morganthomas Dec 28, 2022
b833122
witnessToPrenexNormalForm
morganthomas Dec 28, 2022
4d915aa
wip codegen stage 3 (prenex normal form) semantics preservation
morganthomas Dec 28, 2022
ebcf3c8
add debug tracing
morganthomas Dec 29, 2022
3091a16
wip codegen stage 3 (prenex normal form) semantics preservation
morganthomas Dec 29, 2022
827c60f
wip codegen stage 3 (prenex normal form) semantics preservation
morganthomas Dec 29, 2022
4c9499a
add short circuiting behavior for logical connectives in sigma11 eval…
morganthomas Dec 29, 2022
98e0d47
fix conjunctive quantifier merging: and -> implies
morganthomas Dec 29, 2022
cae7205
remove traces
morganthomas Dec 29, 2022
8fdfd91
Merge pull request #25 from CasperAssociation/fkv
morganthomas Dec 29, 2022
ff8233b
wip witness generation stage 4 (strong prenex normal form)
morganthomas Jan 3, 2023
e859448
wip witness generation stage 4 (strong prenex normal form)
morganthomas Jan 3, 2023
d5a620c
wip witness generation stage 4 (strong prenex normal form)
morganthomas Jan 4, 2023
cf6b59f
wip witness generation stage 4 (strong prenex normal form)
morganthomas Jan 4, 2023
cb45dfb
wip witness generation stage 4 (strong prenex normal form)
morganthomas Jan 4, 2023
a7e4482
improve sigma11 formula formatting
morganthomas Jan 5, 2023
a10a205
strong prenex normal form translation bugfix
morganthomas Jan 5, 2023
c38fc41
ormolu
morganthomas Jan 5, 2023
a256cc4
lint
morganthomas Jan 5, 2023
66cc18b
Merge pull request #26 from CasperAssociation/fkv
morganthomas Jan 5, 2023
f6fa3fc
witness generation stage 5 (super strong prenex normal form)
morganthomas Jan 5, 2023
288d3a3
Merge pull request #27 from CasperAssociation/fkv
morganthomas Jan 5, 2023
75e7ac8
wip circuit semantics
morganthomas Jan 5, 2023
6ee5f00
wip circuit semantics
morganthomas Jan 5, 2023
6dfb030
wip circuit semantics
morganthomas Jan 5, 2023
7d52dd0
wip circuit semantics
morganthomas Jan 5, 2023
d475adc
wip circuit semantics
morganthomas Jan 8, 2023
2f0ea65
wip(?) circuit semantics
morganthomas Jan 8, 2023
f114192
wip semicircuit to logic circuit argument conversion
morganthomas Jan 8, 2023
9a69c66
wip semicircuit to logic circuit argument conversion
morganthomas Jan 8, 2023
0ffb582
indexedCoproduct -> indexedProduct
morganthomas Jan 8, 2023
c8b623e
refactor: require term bound in universal quantifiers
morganthomas Jan 8, 2023
46d57e6
getUniversalTable
morganthomas Jan 8, 2023
c9dbc9e
wip semicircuit to logic circuit argument conversion
morganthomas Jan 9, 2023
db08a00
wip semicircuit to logic circuit argument conversion
morganthomas Jan 9, 2023
13fdca1
wip semicircuit to logic circuit semantics preservation
morganthomas Jan 9, 2023
c268b2a
wip semicircuit to logic circuit argument conversion
morganthomas Jan 10, 2023
36b5525
Merge branch 'fkv' of github.com:CasperAssociation/osl into fkv
morganthomas Jan 10, 2023
04e8240
wip semicircuit to logic circuit semantics preservation
morganthomas Jan 10, 2023
bb5ccc6
wip semicircuit to logic circuit semantics preservation
morganthomas Jan 10, 2023
f3c7f14
wip semicircuit to logic circuit semantics preservation
morganthomas Jan 10, 2023
0caa84d
label logic constraints
morganthomas Jan 10, 2023
d4b5fa3
semicircuit to logic circuit semantics preservation
morganthomas Jan 10, 2023
b12e376
Merge pull request #28 from CasperAssociation/fkv
morganthomas Jan 10, 2023
44dd757
short circuiting evaluation in trace types
morganthomas Jan 10, 2023
3b7a092
add trace type
morganthomas Jan 10, 2023
259b346
wip trace semantics
morganthomas Jan 10, 2023
7252bb9
wip trace semantics
morganthomas Jan 11, 2023
92e9625
trace semantics
morganthomas Jan 11, 2023
650ac28
wip argumentToTrace
morganthomas Jan 11, 2023
65dfc99
wip argumentToTrace
morganthomas Jan 12, 2023
c04964a
allow subexpression traces to pass in additional advice values
morganthomas Jan 12, 2023
d54c1cb
wip argumentToTrace
morganthomas Jan 12, 2023
1502824
wip argumentToTrace
morganthomas Jan 12, 2023
a57ad35
wip argumentToTrace
morganthomas Jan 12, 2023
92e3d0f
wip argumentToTrace
morganthomas Jan 12, 2023
dd6a19b
Merge branch 'fkv' of github.com:CasperAssociation/osl into fkv
morganthomas Jan 12, 2023
eaa305e
wip argumentToTrace
morganthomas Jan 12, 2023
d822f24
wip argumentToTrace
morganthomas Jan 12, 2023
6b37f2b
Merge branch 'fkv' of github.com:CasperAssociation/osl into fkv
morganthomas Jan 13, 2023
ee9243b
bugfix lookup step types
morganthomas Jan 13, 2023
5b489e2
wip argumentToTrace
morganthomas Jan 13, 2023
aa3ecf5
remove lookup argument support in logic circuit compiler
morganthomas Jan 13, 2023
ab28b0a
lookupArgumentSubexpressionTraces
morganthomas Jan 15, 2023
c0f76b3
wip getLookupCaches
morganthomas Jan 15, 2023
4ceb659
getLookupTableCache
morganthomas Jan 16, 2023
4de4a22
evalTranslatedFormula7
morganthomas Jan 16, 2023
265bfd2
wip: debug logic circuit -> trace
morganthomas Jan 16, 2023
c83582b
various byte decomposition fixes
morganthomas Jan 16, 2023
3a46f15
add comments
morganthomas Jan 16, 2023
996d8c2
wip: debug logic circuit -> trace argument conversion
morganthomas Jan 16, 2023
d447ec7
update sydtest
morganthomas Jan 16, 2023
a5449df
really update sydtest
morganthomas Jan 16, 2023
2ebd20d
wip: debug logic circuit argument -> trace conversion
morganthomas Jan 16, 2023
39dde9c
wip debug logic circuit -> trace conversion
morganthomas Jan 17, 2023
524d887
refactor: make subexpression links a map, not a set, for faster lookups
morganthomas Jan 19, 2023
fdd1979
wip refactor sudoku example to compile more simply
morganthomas Jan 19, 2023
fce2ddd
make byte decomposition tables as long as the circuit
morganthomas Jan 19, 2023
6358269
label polynomials
morganthomas Jan 19, 2023
eab2789
wip debug logic circuit -> trace conversion
morganthomas Jan 20, 2023
799240a
wip debug logic circuit -> trace conversion
morganthomas Jan 20, 2023
6e83360
field property tests
morganthomas Jan 20, 2023
de85cf6
logic circuit -> trace type: load from different case bugfixes
morganthomas Jan 20, 2023
e1ade8a
logic circuit -> trace type: bugfix assert step type
morganthomas Jan 20, 2023
3f96297
refactor lookup trace construction
morganthomas Jan 22, 2023
d357357
wip debug logic circuit -> trace conversion
morganthomas Jan 23, 2023
d36f081
wip debug logic circuit -> trace conversion
morganthomas Jan 23, 2023
19b0cb5
wip casper ledger spec
morganthomas Jan 23, 2023
e366995
make casper ledger spec compile
morganthomas Jan 23, 2023
b712771
finish spec
morganthomas Jan 23, 2023
6f18f2d
wip Casper program type
morganthomas Jan 23, 2023
b849a01
Casper program type
morganthomas Jan 23, 2023
7d497fd
fix gas
morganthomas Jan 23, 2023
79f97f3
Merge pull request #30 from CasperAssociation/casper
morganthomas Jan 24, 2023
a8dafbe
Merge pull request #29 from CasperAssociation/fkv
morganthomas Jan 27, 2023
2976ab5
comment out failing stage 7 semantics test
morganthomas Jan 27, 2023
0c0a7bf
wip generics
morganthomas Jan 27, 2023
af5ca29
wip generics
morganthomas Jan 27, 2023
c51ee4a
wip generics
morganthomas Jan 27, 2023
d66c749
wip generics
morganthomas Jan 27, 2023
537fc7e
wip generics
morganthomas Jan 27, 2023
83ef94b
wip generics
morganthomas Jan 27, 2023
8389460
wip generics
morganthomas Jan 28, 2023
13c4d31
generics: records with four fields
morganthomas Jan 28, 2023
fc2163e
generics: time of day test
morganthomas Jan 28, 2023
4f068b3
generics: local time test
morganthomas Jan 28, 2023
0841c49
wip generics
morganthomas Jan 28, 2023
57314c0
GAddToOSLContext class
morganthomas Jan 28, 2023
8270c57
wip GAddToOSLContext newtypes
morganthomas Jan 28, 2023
a45f3ff
wip Sudoku generics
morganthomas Jan 28, 2023
8ac083b
wip Sudoku generics
morganthomas Jan 28, 2023
31ef712
wip generics
morganthomas Jan 29, 2023
07ea5e9
ditch generics; Sudoku type generation
morganthomas Jan 29, 2023
ae2ddb1
record type conversion in OSL (de-boilerplated using TH)
morganthomas Jan 29, 2023
4572231
time of day and local time conversion tests
morganthomas Jan 29, 2023
dd7f0d4
transpile enum types
morganthomas Jan 29, 2023
e078da2
wip actus dictionary
morganthomas Jan 29, 2023
dc6966e
ormolu
morganthomas Jan 29, 2023
5b41455
lint
morganthomas Jan 29, 2023
dbfc3e2
Merge pull request #31 from CasperAssociation/generics
morganthomas Jan 29, 2023
bbff74c
wip OSL output formatting
morganthomas Jan 29, 2023
50c0b50
add actus-core
morganthomas Jan 29, 2023
142f82b
wip actus dictionary
morganthomas Jan 29, 2023
51f2416
wip actus dictionary
morganthomas Jan 29, 2023
4ada0c2
wip actus dictionary
morganthomas Jan 30, 2023
5de4c90
wip actus dictionary
morganthomas Jan 30, 2023
5e4c86b
wip actus dictionary
morganthomas Jan 30, 2023
332c446
wip actus dictionary
morganthomas Jan 30, 2023
ddd1d77
Merge branch 'master' into actus
morganthomas Jan 30, 2023
6c83193
ormolu
morganthomas Jan 30, 2023
71ec334
lint
morganthomas Jan 31, 2023
8bb45c8
Merge pull request #32 from CasperAssociation/actus
morganthomas Jan 31, 2023
987623e
bugfix lookups
morganthomas Jan 31, 2023
816f1e5
bugfix: add missing byte decompositions
morganthomas Jan 31, 2023
9d070bb
wip: bugfix universal table
morganthomas Jan 31, 2023
85c5ccb
bugfix universal table (stage 6)
morganthomas Feb 5, 2023
28e4b4b
rm traces
morganthomas Feb 5, 2023
d8a7313
bugfix load from different case
morganthomas Feb 6, 2023
db78434
stage 7 semantics preservation!
morganthomas Feb 6, 2023
138b034
ormolu
morganthomas Feb 6, 2023
db4bf87
lint
morganthomas Feb 6, 2023
94fd383
Merge pull request #33 from CasperAssociation/fkv
morganthomas Feb 6, 2023
4d3a6b9
wip stage 8 argument conversion
morganthomas Feb 6, 2023
f454adc
wip stage 8 argument conversion
morganthomas Feb 6, 2023
1195601
wip stage 8 argument conversion
morganthomas Feb 6, 2023
1addd57
wip stage 8 argument conversion
morganthomas Feb 7, 2023
66ca687
add trace type fixed values
morganthomas Feb 7, 2023
f53edf4
remove old cruft
morganthomas Feb 7, 2023
00a9cb1
wip stage 8 semantics preservation
morganthomas Feb 7, 2023
f6ae182
wip stage 8 semantics preservating: gating step types correctly
morganthomas Feb 8, 2023
0c69a01
wip stage 8 semantics preservating: gating step types correctly
morganthomas Feb 8, 2023
20ce58d
wip stage 8 semantics preservating: gating step types correctly
morganthomas Feb 9, 2023
1570f39
wip stage 8 semantics preservating: gating step types correctly
morganthomas Feb 9, 2023
20f0524
wip stage 8 semantics preservating: gating step types correctly
morganthomas Feb 9, 2023
6eb7218
Merge branch 'fkv' of github.com:CasperAssociation/osl into fkv
morganthomas Feb 9, 2023
855d281
wip stage 8 semantics preservating: gating step types correctly
morganthomas Feb 9, 2023
a247f5e
add comments
morganthomas Feb 10, 2023
767d5a2
add comments
morganthomas Feb 14, 2023
3a5ecdc
wip stage 8 semantics preservating: gating step types correctly
morganthomas Feb 14, 2023
d1de12a
stage 8 semantics preservation
morganthomas Feb 14, 2023
e796479
remove traces
morganthomas Feb 16, 2023
c3ab61d
ormolu
morganthomas Feb 16, 2023
6758315
Merge pull request #34 from Polytopoi/fkv
morganthomas Feb 16, 2023
827cb5b
logic constraint constant folding
morganthomas Feb 16, 2023
3ffe640
bypass super strong prenex conversion for reduced row count
morganthomas Feb 16, 2023
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
2 changes: 2 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Copyright 2023 Casper Association
Copyright 2023 Input Output (Hong Kong) Ltd.
Copyright 2022 Orbis Labs

Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Orbis Specification Language (OSL)
# Open Specification Language (OSL)

This repo contains a compiler for the OSL spec language, which targets arithmetic circuits for zero knowledge proofs.

OSL (Open Specification Language) is a fork, by Casper Association, of OSL (Orbis Specification Language), by Orbis Labs.

For information about OSL, see: https://eprint.iacr.org/2022/1003

Expand Down
322 changes: 322 additions & 0 deletions examples/casper.osl
Original file line number Diff line number Diff line change
@@ -0,0 +1,322 @@
data BlockNumber ~= Fin(18446744073709551616).

data Time ~= Fin(18446744073709551616). -- Unix timestamp (millisecond precision)

data Byte ~= Fin(256).

data Char ~= Byte.

data Text ~= List^18446744073709551616(Char).

data Bytes ~= List^18446744073709551616(Byte).

data ProtocolVersion ~= Text.

data ChainSpec ~= Bytes.

data ChainSpecs ~=
Map^18446744073709551616
(ProtocolVersion, ChainSpec).

data NodeVersion ~= List^4096(Char).

data NodeVersions ~=
Map^18446744073709551616
(ProtocolVersion, NodeVersion).

data NodeBinary ~=
NodeVersion * Bytes.

data NodeBinaries ~=
Map^18446744073709551616
(NodeVersion, NodeBinary).

data StateKeyType ~= Fin(18446744073709551616).

data StateKeyValue ~= Fin(512) -> Byte.

data StateKey ~= StateKeyType + StateKeyValue.

data StateValue ~= Bytes.

data GlobalStateSnapshot ~=
Map^18446744073709551616
(StateKey, StateValue).

data EraId ~= Fin(18446744073709551616).

data RandomBit ~= Fin(2).

data SystemPublicKey ~= Fin(1).

data Ed25519Key ~= Fin(32) -> Byte.

data Secp256k1Key ~= Fin(33) -> Byte.

data PublicKey ~= SystemPublicKey + Ed25519Key + Secp256k1Key.

data Blake2b256Hash ~= Fin(32) -> Byte.

data AccountHash ~= Blake2b256Hash.

data ValidatorId ~= PublicKey.

data Equivocators ~= List^18446744073709551616(ValidatorId).

data MoteAmount ~= Fin(64) -> Byte.

data Reward ~= MoteAmount.

data Rewards ~= Map^18446744073709551616(ValidatorId, Reward).

data InactiveValidators ~= List^18446744073709551616(ValidatorId).

data EraReport ~= Equivocators * Rewards * InactiveValidators.

data ValidatorWeight ~= Fin(64) -> Byte.

data NextEraValidatorWeights ~=
Map^18446744073709551616(ValidatorId, ValidatorWeight).

data EraEnd ~= EraReport * NextEraValidatorWeights.

data BlockHeader ~= RandomBit * Maybe(EraEnd) * Time * EraId * ProtocolVersion.

data Proposer ~= ValidatorId.

data DeployHash ~= Blake2b256Hash.

data DeployHashes ~= List^18446744073709551616(DeployHash).

data TransferHashes ~= List^18446744073709551616(DeployHash).

data BlockBody ~= Proposer * DeployHashes * TransferHashes.

data Block ~= BlockHeader * BlockBody.

data Protocols ~= NodeVersions * ChainSpecs * NodeBinaries.

data BlockList ~=
Map^18446744073709551616
(BlockNumber, Block).

data GenesisSnapshotId ~= Fin(1).

data UpgradeSnapshotId ~= BlockNumber.

data StandardSnapshotId ~= BlockNumber.

data GlobalStateSnapshotId ~=
GenesisSnapshotId + UpgradeSnapshotId + StandardSnapshotId.

data GlobalStateHistory ~=
Map^18446744073709551616
(GlobalStateSnapshotId, GlobalStateSnapshot).

data TimeDiff ~= Fin(18446744073709551616).

data TTL ~= TimeDiff.

data GasPrice ~= Fin(18446744073709551616).

data DeployDependencies ~=
List^18446744073709551616(DeployHash).

data DeployChainName ~= Text.

data DeployHeader ~= PublicKey * Time * TTL * GasPrice * DeployDependencies * DeployChainName.

data WASMModule ~= Bytes.

data RuntimeArgs ~= Map^18446744073709551616(Text, Bytes).

data ModuleBytes ~= WASMModule * RuntimeArgs.

data ContractHash ~= Blake2b256Hash.

data ContractPackageHash ~= Blake2b256Hash.

data EntryPointName ~= Text.

data StoredContractByHash ~= ContractHash * EntryPointName * RuntimeArgs.

data ContractName ~= Text.

data StoredContractByName ~= ContractName * EntryPointName * RuntimeArgs.

data ContractVersion ~= Fin(4294967296).

data StoredVersionedContractByHash ~=
ContractPackageHash * Maybe(ContractVersion) * EntryPointName * RuntimeArgs.

data StoredVersionedContractByName ~=
ContractName * Maybe(ContractVersion) * EntryPointName * RuntimeArgs.

data Transfer ~= RuntimeArgs.

data ExecutableDeployItem ~=
ModuleBytes +
StoredContractByHash +
StoredContractByName +
StoredVersionedContractByHash +
StoredVersionedContractByName +
Transfer.

data DeployPayment ~= ExecutableDeployItem.

data DeploySession ~= ExecutableDeployItem.

data Ed25519Signature ~= Fin(64) -> Byte.

data Secp256k1Signature ~= Fin(128) -> Byte.

data SystemSignature ~= Ed25519Signature. -- TODO: is this correct?

data Signature ~=
SystemSignature + Ed25519Signature + Secp256k1Signature.

data Approval ~= PublicKey * Signature.

data DeployApprovals ~= List^18446744073709551616(Approval).

data DeployBody ~= DeployHeader * DeployPayment * DeploySession * DeployApprovals.

data Deploys ~=
Map^18446744073709551616
(DeployHash, DeployBody).

data Ledger ~= Deploys * BlockList * GlobalStateHistory * Protocols.

data Transform ~= StateValue -> StateValue.

data Journal ~= List^18446744073709551616(StateKey * Transform).

-- This could potentially be context dependent, i.e., different program
-- executions could have different readable state.
data ReadableGlobalState ~= GlobalStateSnapshot.

data WritableGlobalState ~= GlobalStateSnapshot.

data ModuleBytesSessionStackFrame ~= AccountHash * ContractHash.

data StoredSessionStackFrame ~= AccountHash * ContractHash * ContractPackageHash.

data StoredContractStackFrame ~= ContractHash * ContractPackageHash.

data StackFrame ~= ModuleBytesSessionStackFrame + StoredSessionStackFrame + StoredContractStackFrame.

data CallStack ~= List^256(StackFrame).

data URefAddr ~= Fin(32) -> Byte.

data Readable ~= Fin(2).
data Writable ~= Fin(2).
data Addable ~= Fin(2).

data AccessRights ~= Readable * Writable * Addable.

data URef ~= URefAddr * AccessRights.

data MainPurse ~= URef.

data AccountWeight ~= Byte.

data AssociatedKeys ~= List^256(AccountHash * AccountWeight).

data DeploymentThreshold ~= Byte.

data KeyManagementThreshold ~= Byte.

data ActionThresholds ~= DeploymentThreshold * KeyManagementThreshold.

data NamedKeys ~=
Map^1024(StateKey, StateValue).

data Account ~=
AccountHash *
NamedKeys *
MainPurse *
AssociatedKeys *
ActionThresholds.

data AccessKey ~= AccountHash + ContractHash.

data ContextAccessRights ~=
AccessKey *
Map^65536(URefAddr, AccessRights).

data RuntimeApproval ~= AccountHash.

data RuntimeApprovals ~= List^65536(RuntimeApproval).

data GasLimit ~= Fin(64) -> Byte.

data PaymentPhase ~= Fin(1).
data SessionPhase ~= Fin(1).
data FinalizePhase ~= Fin(1).
data SystemPhase ~= Fin(1).

data Phase ~= PaymentPhase + SessionPhase + FinalizePhase + SystemPhase.

data MaxAssociatedKeys ~= Fin(4294967296).

data MaxRuntimeCallStackHeight ~= Fin(4294967296).

data MinimumDelegationAmount ~= MoteAmount.

data StrictArgumentChecking ~= Fin(2).

data VestingSchedulePeriod ~= Fin(1). -- TODO

data WasmConfig ~= Fin(1). -- TODO

data SystemConfig ~= Fin(1). -- TODO

data EngineConfig ~=
MaxAssociatedKeys *
MaxRuntimeCallStackHeight *
MinimumDelegationAmount *
StrictArgumentChecking *
VestingSchedulePeriod *
WasmConfig *
SystemConfig.

data SessionEntryPoint ~= Fin(1).
data ContractEntryPoint ~= Fin(1).

data EntryPointType ~= SessionEntryPoint + ContractEntryPoint.

data TransferAddr ~= Fin(32) -> Byte.

data Transfers ~= List^4294967296(TransferAddr).

data RuntimeContext ~=
RuntimeArgs *
CallStack *
Account *
ContextAccessRights *
Account *
RuntimeApprovals *
Time *
DeployHash * -- This is used for a pseudo-randomness seed
GasLimit *
ProtocolVersion *
Phase *
EngineConfig *
EntryPointType.

data SuccessfulResult ~= Journal * Transfers * GasPrice.

data ErrorMessage ~= Text.

data FailedResult ~= Journal * Transfers * GasPrice * ErrorMessage.

data ExecutionResult ~= SuccessfulResult + FailedResult.

data Program ~=
(RuntimeContext * ReadableGlobalState)
-> ExecutionResult.

-- def commitJournal : GlobalStateSnapshot -> Journal -> GlobalStateSnapshot := todo.

def entryPoint : Prop := 0N = 0N.
20 changes: 20 additions & 0 deletions examples/max.osl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
def a : Prop
:= (0N maxN 1N) = 1N.

def b : Prop
:= (0Z maxZ 1Z) = 1Z.

def c : Prop
:= (0F maxF 1F) = 1F.

def a' : Prop
:= (0N maxℕ 1N) = 1N.

def b' : Prop
:= (0Z maxℤ 1Z) = 1Z.

def c' : Prop
:= (0F max𝔽 1F) = 1F.

def foo : Prop
:= a & b & c & a' & b' & c'.
Loading