-
Notifications
You must be signed in to change notification settings - Fork 3
Update RM specs with types #289
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
Draft
jonaprieto
wants to merge
29
commits into
main
Choose a base branch
from
topic-transaction-function
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or 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
|
The typecheck failed. Please check the logs. However, the preview is available at https://specs.anoma.net/pr-289/. |
f2d727f to
5325b6b
Compare
fix the fix
5325b6b to
eb7fadb
Compare
Add implementations for the main container interfaces and syntax aliases used in the RM. This covers the top-right of the DAG in a way which is disciplined and well-organized. --------- Co-authored-by: Jonathan Cubides <[email protected]>
Added the following types; note that many of them need to be reviewed; this is a proposal But it is in heavy development. - Resource - Nullifier - Nullifier key - Nullifier properties - Resource machine - Transaction - Action - Resource logic proof - State (unfinished) - #289 --------- Co-authored-by: AHartNtkn <[email protected]>
jonaprieto
commented
Jan 17, 2025
commit e8cd579 Author: Anthony Hart <[email protected]> Date: Mon Feb 17 10:38:11 2025 -0500 Prose improvements for encryption, verification, and naming engines (#335) Replace overview sections of the main engine files for encryption, verification, and naming engines with something that's, hopefully, more intuitive. I also redid all the flow charts to be more detailed, and added english descriptions of what each flowcharts depict. I also moved the charts to the top of the file. --------- Co-authored-by: Tobias Heindel <[email protected]> Co-authored-by: Jonathan Cubides <[email protected]> commit 9e41081 Author: Jonathan Cubides <[email protected]> Date: Mon Feb 10 08:27:40 2025 -0500 Update versioning instructions commit 18182e5 Merge: f8f89c7 e6b4041 Author: Jonathan Cubides <[email protected]> Date: Tue Feb 4 23:44:19 2025 -0500 Bump up to version 0.1.4 commit e6b4041 Author: Jonathan Cubides <[email protected]> Date: Tue Feb 4 23:32:26 2025 -0500 chore(release): prepare version 0.1.4 with documentation improvements and fixes This commit updates the project version to 0.1.4, including comprehensive improvements in documentation structure, readability enhancements through CSS changes, and various fixes across different subsystems. Additions feature a new tutorial on Anomian and upgraded Juvix type definitions to align with current standards. The changelog reflects these updates, marking the transition from unreleased to released status for numerous entries, organized under corresponding sections like features and fixes. This release focuses on enhancing clarity and consistency within the project's documentation and related materials. commit f8f89c7 Author: Tobias Heindel <[email protected]> Date: Wed Feb 5 04:12:33 2025 +0100 some changes, proposed as a result of specs overall review (revamped) (#336) Add some minor changes with the goal of making the specs more readable. Supersedes [PR-316](#316). --------- Co-authored-by: Jonathan Cubides <[email protected]> commit 717971a Author: Michael <[email protected]> Date: Wed Feb 5 03:37:41 2025 +0100 Add missing deletion criterion to delete blobs after the transaction (#334) After a discussion with @cwgoes, we've found that a deletion criterion to delete blobs right after transaction execution is missing. Blobs stored with this criterion are more short-lived than those stored wit the "delete after block" criterion. In Ethereum, for example, "delete after transaction" corresponds to putting blobs in transient storage (see [EIP-1153](https://eips.ethereum.org/EIPS/eip-1153)), which I am using in the blob storage implementation of our EVM protocol adapter. commit c34bb80 Author: Jonathan Cubides <[email protected]> Date: Tue Feb 4 21:29:32 2025 -0500 Improve layout, documentation structure, navigation and readability with indexes, tags and descriptions (#332) - [x] Add all the missing indexes - [x] Add tags index, clickable tags, revision to all tags in all pages. - [x] Improve everything file. - [x] Improve a few descriptions about the architecture - [x] Add the listing of engines. - [x] Add overall purposes of subsystems. - [x] Add missing separation bars on every page for better readability. - [x] Add missing section on arguments for record types. - [ ] Fix more broken links and wikilinks. - [x] Add in the footer and navigation links to the "Latest" and "Development" version. commit 22ffbb8 Author: Yulia Khalniyazova <[email protected]> Date: Wed Jan 29 13:30:35 2025 +0100 RM type fixes (#331) This PR includes three little changes: - renamed `List` to `OrderedSet` where it was outdated - changed `applicationData` type from `Map Tag (BitString, DeletionCriterion)` to `Map Tag OrderedSet (BitString, DeletionCriterion)` as we agreed to do in a slack discussion - changed verifying key type from `LogicRefHash` to `LogicRef`. After talking to @heueristik I realised it didn't work as intended, so I changed the type and added a couple of annotations. These annotations are not meant to provide a complete explanation of function privacy but rather add notes for future updates and in the meanwhile serve as helpful hints for the developers. Please, treat this PR as a way to fix the previously discussed issues listed above, not as an opportunity to discuss new issues commit eb14d56 Author: Jonathan Cubides <[email protected]> Date: Tue Jan 28 12:22:44 2025 -0500 Add a few corrections to the Anomian doc (#315) - Improved prose and formatting for better readability and understanding of the Anoma system's components. - Fix Juvix coding style and update a few types. --------- Co-authored-by: Tobias Heindel <[email protected]>
commit bc3e6b2 Author: Jonathan Cubides <[email protected]> Date: Wed Feb 19 14:27:56 2025 -0500 Fix mkdocs nav (#343) commit e8cd579 Author: Anthony Hart <[email protected]> Date: Mon Feb 17 10:38:11 2025 -0500 Prose improvements for encryption, verification, and naming engines (#335) Replace overview sections of the main engine files for encryption, verification, and naming engines with something that's, hopefully, more intuitive. I also redid all the flow charts to be more detailed, and added english descriptions of what each flowcharts depict. I also moved the charts to the top of the file. --------- Co-authored-by: Tobias Heindel <[email protected]> Co-authored-by: Jonathan Cubides <[email protected]> commit 9e41081 Author: Jonathan Cubides <[email protected]> Date: Mon Feb 10 08:27:40 2025 -0500 Update versioning instructions commit 18182e5 Merge: f8f89c7 e6b4041 Author: Jonathan Cubides <[email protected]> Date: Tue Feb 4 23:44:19 2025 -0500 Bump up to version 0.1.4 commit e6b4041 Author: Jonathan Cubides <[email protected]> Date: Tue Feb 4 23:32:26 2025 -0500 chore(release): prepare version 0.1.4 with documentation improvements and fixes This commit updates the project version to 0.1.4, including comprehensive improvements in documentation structure, readability enhancements through CSS changes, and various fixes across different subsystems. Additions feature a new tutorial on Anomian and upgraded Juvix type definitions to align with current standards. The changelog reflects these updates, marking the transition from unreleased to released status for numerous entries, organized under corresponding sections like features and fixes. This release focuses on enhancing clarity and consistency within the project's documentation and related materials. commit f8f89c7 Author: Tobias Heindel <[email protected]> Date: Wed Feb 5 04:12:33 2025 +0100 some changes, proposed as a result of specs overall review (revamped) (#336) Add some minor changes with the goal of making the specs more readable. Supersedes [PR-316](#316). --------- Co-authored-by: Jonathan Cubides <[email protected]> commit 717971a Author: Michael <[email protected]> Date: Wed Feb 5 03:37:41 2025 +0100 Add missing deletion criterion to delete blobs after the transaction (#334) After a discussion with @cwgoes, we've found that a deletion criterion to delete blobs right after transaction execution is missing. Blobs stored with this criterion are more short-lived than those stored wit the "delete after block" criterion. In Ethereum, for example, "delete after transaction" corresponds to putting blobs in transient storage (see [EIP-1153](https://eips.ethereum.org/EIPS/eip-1153)), which I am using in the blob storage implementation of our EVM protocol adapter. commit c34bb80 Author: Jonathan Cubides <[email protected]> Date: Tue Feb 4 21:29:32 2025 -0500 Improve layout, documentation structure, navigation and readability with indexes, tags and descriptions (#332) - [x] Add all the missing indexes - [x] Add tags index, clickable tags, revision to all tags in all pages. - [x] Improve everything file. - [x] Improve a few descriptions about the architecture - [x] Add the listing of engines. - [x] Add overall purposes of subsystems. - [x] Add missing separation bars on every page for better readability. - [x] Add missing section on arguments for record types. - [ ] Fix more broken links and wikilinks. - [x] Add in the footer and navigation links to the "Latest" and "Development" version. commit 22ffbb8 Author: Yulia Khalniyazova <[email protected]> Date: Wed Jan 29 13:30:35 2025 +0100 RM type fixes (#331) This PR includes three little changes: - renamed `List` to `OrderedSet` where it was outdated - changed `applicationData` type from `Map Tag (BitString, DeletionCriterion)` to `Map Tag OrderedSet (BitString, DeletionCriterion)` as we agreed to do in a slack discussion - changed verifying key type from `LogicRefHash` to `LogicRef`. After talking to @heueristik I realised it didn't work as intended, so I changed the type and added a couple of annotations. These annotations are not meant to provide a complete explanation of function privacy but rather add notes for future updates and in the meanwhile serve as helpful hints for the developers. Please, treat this PR as a way to fix the previously discussed issues listed above, not as an opportunity to discuss new issues commit eb14d56 Author: Jonathan Cubides <[email protected]> Date: Tue Jan 28 12:22:44 2025 -0500 Add a few corrections to the Anomian doc (#315) - Improved prose and formatting for better readability and understanding of the Anoma system's components. - Fix Juvix coding style and update a few types. --------- Co-authored-by: Tobias Heindel <[email protected]>
…add todos for w… (#299)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
documentation
Improvements or additions to documentation
integration-pr
priority:high
refactor
resource-machine
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
T: The plan: for each page of the resource machine spec, we invent a topic name
X (e.g., the title of the page in question), create a new branch topic-X-rm and open a (draft) PR against #289; if applicable, a comparison with juvix-arm-spes is desirable.
Dependency DAG
Here is an attempt at making a comprehensive DAG of dependencies within the resource machine. This required some assumptions on my (AHartNtkn) part, so I may have identified things which should actually be different, but this should be correct enough to be useful. Note that this does not include application stuff (AppData, AppLogic, etc.) as that's somewhat ancillary and it's not clear how, if at all, that stuff would connect to the rest of the RM specs.
classDiagram %% Core Interfaces class IProvingSystem~VerifyingKey,ProvingKey,Instance,Witness,Proof~ { +prove(ProvingKey, Instance, Witness) Proof +verify(VerifyingKey, Instance, Proof) Bool } class IDeltaProvingSystem~VerifyingKey,ProvingKey,Instance,Witness,Proof~ { +aggregate(Proof, Proof) Proof } class ISet~T~ { +new() Set +new(List) Set +size(Set) Nat +insert(Set, T) Set +union(Set, Set) Set +intersection(Set, Set) Set +difference(Set, Set) Set +disjointUnion(Set, Set) Set +contains(Set, T) Bool } class IOrderedSet~T~ class FixedSize~T,Arg~ { +bit_size: Int +new(Arg) T +equal(T, T) Bool } class Arithmetic~T,Arg~ { +add(T, T) T +sub(T, T) T } class Hash~T,Arg~ class CommitmentAccumulator~Witness,CommitmentIdentifier,AccumulatedValue~ { +add(Accumulator, CommitmentIdentifier) Witness +witness(Accumulator, CommitmentIdentifier) Maybe Witness +verify(CommitmentIdentifier, Witness, AccumulatedValue) Bool +value(Accumulator) AccumulatedValue } class NullifierSet %% Core Data Structures class Resource { +logicRef: LogicHash +labelRef: LabelHash +valueRef: ValueHash +quantity: Quantity +isEphemeral: Bool +nonce: Nonce +nullifierKeyCommitment: NullifierKeyCommitment +randSeed: RandSeed +commitment() Commitment +nullifier(NullifierKey) Nullifier +kind() Kind +delta() DeltaHash +tag(consumed: Bool) Tag } class Action { +created: List Commitment +consumed: List Nullifier +resourceLogicProofs: Map Tag (LogicRefHash, PS.Proof) +complianceUnits: Set ComplianceUnit +applicationData: Map Tag (BitString, DeletionCriterion) +verify() Bool +delta() DeltaHash } class ComplianceUnit { +proof: PS.Proof +refInstance: ReferencedInstance +vk: PS.VerifyingKey +delta() DeltaHash +verify() Bool } class Transaction { +CMTreeRoots: Set CMtree.Value +actions: Set Action +deltaProof: DeltaProvingSystem.Proof +create(Set CMtree.Value, Set Actions) Transaction +compose(Transaction, Transaction) Transaction +verify() Bool +delta() DeltaHash } %% Implementation Classes class ResourceLogicProvingSystem class ComplianceProvingSystem class DeltaProvingSystem class OrderedSet class CMTree class NFSet class DeltaHash class TransactionFunction { +eval() Transaction } class TransactionFunctionVM { +eval(TransactionFunction, GasLimit) Transaction } class TransactionWithPayment { +stateTransitionFunction: TransactionFunction +paymentTransaction: Transaction +gasLimit: Arithmetic } %% Fixed Size Types class Nonce class RandSeed class NullifierKeyCommitment class NullifierKey class Quantity class Balance class LogicHash class LabelHash class ValueHash class Commitment class Nullifier class LogicRefHash %% Proof Related Types class ResourceLogicProofInstance { +tag: Tag +isConsumed: Bool +consumed: List Nullifier +created: List Commitment +applicationData: BitString } class ResourceLogicProofWitness { +consumed: OrderedSet (Resource, NullifierKey) +created: OrderedSet Resource +applicationInputs: Any } class ComplianceProofInstance { +consumed: List (NullifierRef, RootRef, LogicRefHash) +created: List (CommitmentRef, LogicRefHash) +unitDelta: DeltaHash } class ComplianceProofWitness { +consumed: OrderedSet Resource +consumed_nullifierKey: OrderedSet NullifierKey +consumed_cmtreePath: OrderedSet CMtreePath +consumed_commitment: OrderedSet Commitment +consumed_logicRefHash: OrderedSet LogicRefHash +created: OrderedSet Resource +created_logicRefHash: OrderedSet LogicRefHash } class DeltaProofInstance { +delta: DeltaHash +expectedBalance: Balance } class DeltaProofWitness { +resourceDeltaPreimages: List Resource } %% Inheritance/Implementation IProvingSystem --|> IDeltaProvingSystem IProvingSystem --|> ResourceLogicProvingSystem IProvingSystem --|> ComplianceProvingSystem IDeltaProvingSystem --|> DeltaProvingSystem ISet --|> IOrderedSet IOrderedSet --|> OrderedSet CommitmentAccumulator --|> CMTree Timestamp --> CMTree NFSet --|> NullifierSet FixedSize --|> Hash FixedSize --|> Arithmetic Hash --|> DeltaHash Arithmetic --|> DeltaHash LogicHash --> Resource LabelHash --> Resource ValueHash --> Resource Quantity --> Resource Nonce --> Resource NullifierKeyCommitment --> Resource RandSeed --> Resource Commitment --> Resource Nullifier --> Resource class Kind Kind --> Resource DeltaHash --> Resource Tag --> Resource Kind --> Resource Resource --> ComplianceProofWitness Resource --> NullifierSet Resource --> DeltaProofWitness %% Action Componenents Commitment --> Action Nullifier --> Action Tag --> Action IProvingSystem --> Action LogicRefHash --> Action DeletionCriterion --> Action ComplianceUnit --> Action %% Action interface reqs DeltaHash --> Action NullifierKey --> Action Resource --> Action IProvingSystem --> ComplianceUnit %%ReferencedInstance --> ComplianceUnit Commitment --> ComplianceUnit Nullifier --> ComplianceUnit DeltaHash --> ComplianceUnit Action --> Transaction CMTree --> Transaction DeltaProvingSystem --> Transaction DeltaHash --> Transaction Transaction --> TransactionFunction TransactionFunction --> TransactionWithPayment Transaction --> TransactionWithPayment Arithmetic --> TransactionWithPayment TransactionFunction --> TransactionFunctionVM OrderedSet --> ComplianceProofWitness Nullifier --> ComplianceProofInstance CMTree --> ComplianceProofInstance LogicRefHash --> ComplianceProofInstance Commitment --> ComplianceProofInstance CMTree --> ComplianceProofWitness NullifierKey --> ComplianceProofWitness Commitment --> ComplianceProofWitness LogicRefHash --> ComplianceProofWitness Predicate --> DeletionCriterion CMTree --> Transaction NullifierSet --> Transaction Action --> Transaction DeltaHash --> Transaction %% Fixed Size Type Implementation Dependencies Hash --> LogicHash Hash --> LabelHash Hash --> ValueHash Hash --> Commitment Hash --> Nullifier Hash --> Kind Hash --> LogicRefHash Hash --> CMTree Arithmetic --> Quantity Arithmetic --> Balance FixedSize --> Nonce FixedSize --> RandSeed FixedSize --> NullifierKeyCommitment FixedSize --> NullifierKey Balance --> DeltaProofInstance DeltaHash --> DeltaProofInstance NullifierKey --> Nullifier %% Input relationships (required for ResourceLogicProofInstance) Tag --> ResourceLogicProofInstance Nullifier --> ResourceLogicProofInstance Commitment --> ResourceLogicProofInstance Action --> ResourceLogicProofInstance Resource --> ResourceLogicProofInstance %% Output relationships (where ResourceLogicProofInstance is used) ResourceLogicProofInstance --> ResourceLogicProvingSystem %% Input relationships (required for ResourceLogicProofWitness) OrderedSet --> ResourceLogicProofWitness NullifierKey --> ResourceLogicProofWitness Resource --> ResourceLogicProofWitnessDefinitions and Types Todo List
Types and functions which need to be implemented or reviewed. Note, it's not always clear what is going to be imported from where, so these checklists may overlap a bit.
delta's preimage's quantity component", which may imply a function checking this or computing this.expectedBalanceis a non-zero"r.commitment() = cm"r.nullifier(nullifierKey) = nf"## Data blob storagein "notes/storage.juvix.md", but it's not.createdorconsumedcorrespondinglyconsumedlist.createdlist.createis not consistent; in its second appearence it's said to take aCMtreePathalong with every NullifierKey and Resource. CMtreePath is not mentioned outside of this, but presumably is related to "tree path" mentioned in notes/storage.juvix.md.createaccording to steps described under "##create"transactionDelta.verifyaccording to steps described under "##verify"ResourceLogicProvingSystem."ResourceLogicProvingSystemis not described anywhere. Based on the context of primitive_interfaces/proving_system/proving_system.juvix.md, this is likely just an instance of the proving system defined in primitive_interfaces/proving_system/proof.juvix.md.Truegiven the input parameters that describe the state transition induced by the action.ComplianceProvingSystem."ComplianceProvingSystemis not described anywhere. Based on the context of primitive_interfaces/proving_system/proving_system.juvix.md, this is likely just an instance of the proving system defined in primitive_interfaces/proving_system/proof.juvix.md.## Delta.#### Delta for computing balancedescribes a few algorithms for calculating "total balance for a compliance unit, action, or transaction".ComplianceProvingSystemis not described anywhere. Based on the context of primitive_interfaces/proving_system/proving_system.juvix.md, this is likely just an instance of the proving system defined in primitive_interfaces/proving_system/proof.juvix.md.transactionDeltais correctly derived from the actions' deltas and commits to the expected publicly known value, called a balancing value."transactionDeltacommits to the expected balancing value."variable length byte array,deletion criterion) pairs.CommitmentIdentifier, andAccumulatedValue. supports four functions;