Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a46109a
add the space for the incremental rewrite of the RM specs
heindel Mar 20, 2025
8f21279
initial commit for testing kroki-plantuml (also better for class diag…
heindel Mar 20, 2025
c323508
Update pull-requests.yml
heindel Mar 20, 2025
61263b3
that is the goal
heindel Mar 21, 2025
64f5d20
wip
heindel Mar 21, 2025
d712d9a
the actual initial commit of content: the start of the overview diagr…
heindel Mar 24, 2025
d528012
Start intro, add picture, add footer to pic
heindel Mar 24, 2025
c4d3e99
A copy of the Anthony dag, showing the progress of the work
heindel Mar 25, 2025
cf30d62
add Arithmetic with TODOs
heindel Mar 25, 2025
8e5e409
Fix issues detected by pre-commit
Mar 25, 2025
166f6cf
found a reference for all but one resource methods
heindel Mar 26, 2025
f928f70
fix version to be fixed
heindel Mar 26, 2025
c81368a
add some comments (just for the good style)
heindel Mar 26, 2025
e9ffd89
add tag comment
heindel Mar 26, 2025
73aafff
should be squased with previous commit
heindel Mar 26, 2025
bb36438
add todo note
heindel Mar 27, 2025
e2cf11a
Shorten link and add proving system interface
heindel Mar 27, 2025
3b0773f
starting a mindmap for proving system
heindel Mar 27, 2025
815b5f1
not needed, in particular not here
heindel Mar 28, 2025
89cf007
the new file name
heindel Mar 28, 2025
2e7cfd2
moved
heindel Mar 28, 2025
a71bfc4
take aways from a session with Artem
heindel Mar 28, 2025
34c4426
some improvements (links)
heindel Mar 28, 2025
1976859
add commentary for self
heindel Mar 28, 2025
94c97be
go for transaction as next item
heindel Mar 28, 2025
5e9e10c
add note for completeness, soundness; statments
heindel Mar 31, 2025
7e83605
adapt to support multiple parallel mindmaps idiomatically
heindel Mar 31, 2025
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
6 changes: 3 additions & 3 deletions .github/workflows/pull-requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
cache: enable
rename-to: juvix
chmod: 0755
- uses: actions/cache@v4.0.2
- uses: actions/cache@v4
with:
key: juvix-cache-${{ hashFiles('**/*.juvix.md') }}-${{ hashFiles('**/*.juvix') }}
path: .juvix-build
Expand Down Expand Up @@ -106,14 +106,14 @@ jobs:
poetry config virtualenvs.in-project true --local
- run: echo "cache_id=$(date --utc '+%V')-${{ hashFiles( '**/poetry.lock' )}}-${{ hashFiles( '**/*.py' )}}" >> $GITHUB_ENV
- name: Cache .cache
uses: actions/cache@v4.0.2
uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- name: Cache .cache-juvix-mkdocs
uses: actions/cache@v4.0.2
uses: actions/cache@v4
with:
key: .cache-juvix-mkdocs-${{ env.cache_id }}
path: .cache-juvix-mkdocs
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.1.4
v0.3
3 changes: 3 additions & 0 deletions docs/arch/system/state/resource_machine_03/dag.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@startuml
Bob -> Alice : [[https://research.anoma.net Forums]]
@enduml
275 changes: 275 additions & 0 deletions docs/arch/system/state/resource_machine_03/dag.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,275 @@
classDiagram
%% Core Interfaces
class IProvingSystem~VerifyingKey,ProvingKey,Instance,Witness,Proof~ {
+prove(ProvingKey, Instance, Witness) Proof
+verify(VerifyingKey, Instance, Proof) Bool
}
%%IProvingSystem done.
%%ProvingSystem done.
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
}
%%Arithmetic done.
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
%%Resource done.
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
}
%%Transaction done.

%% 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 --> ResourceLogicProofWitness
58 changes: 58 additions & 0 deletions docs/arch/system/state/resource_machine_03/index.juvix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
icon: material/file-document-outline
search:
exclude: false
boost: 2
tags:
- resource-machine
- protocol
- commitment
- nullifier
- accumulator
- resource logic
---

```juvix
module arch.system.state.resource_machine_03.index;
```

# Introduction

The resource machine provides the default interfaces
that controllers can use to perform state changes.

```kroki-plantuml
@from_file:./arch/system/state/resource_machine_03/rm-overview-diagram.puml
```

<!--
**The Anoma Resource Machine (ARM)** is the part of the Anoma protocol that defines and enforces the rules for valid state updates that satisfy users' preferences. The new proposed state is then agreed on by the consensus participants. In that sense the role of the Anoma Resource Machine in the Anoma protocol is similar to the role of the Ethereum Virtual Machine in the Ethereum protocol.

## Data structures

The atomic unit of the ARM state is called a [[Resource | **resource**]]. Resources are immutable, they can be created once and consumed once. The system state is represented by the set of active resources: the resources that were created but not nullified.

[[Transaction | **Transactions**]] produced by the ARM represent the proposed state update. They consist of [[Action|**actions**]], which group resources with the same execution context.

Ensuring the correctness of the transaction is achieved with the help of non-interactive proofs attached to it:

1. to prove the transaction is balanced correctly, there are [[Delta proof | delta proofs]]. Balance is the criterion of a transaction's completeness.
2. to prove the transaction complies with the ARM rules, there are [[Compliance proof | compliance proofs]]. Actions are partitioned into [[Compliance unit | compliance units]] that define the compliance proof scope.
3. to prove the transaction satisfies the user constraints, there are [[Resource logic proof | resource logic proofs]].


![Proof contexts associated with data structures](proof_contexts.svg)


## The role of the ARM

The ARM is used to create, compose, and verify transactions. It is stateless and run by every node that processes transactions. Anoma users submit their intents to the intent gossip network in the form of unbalanced ARM transactions with metadata, which are received and processed by solvers that output balanced ARM transactions. These transactions are then ordered and finally sent to the executor node, that verifies and executes the transactions in the determined order, updating the global state.

## The specification

This specification describes a common interface shared by all ARM instantiations. Depending on the primitive instantiation choices, the resulting ARM instantiation will have different properties. For example, using zk-SNARKs to create and verify the ARM proofs might result in a succinct or even shielded ARM instantiation. The ARM interface is designed to provide interoperability between different ARM instantiations.

The design of the Anoma Resource Machine was significantly inspired by the [Zcash protocol](https://zips.z.cash/protocol/protocol.pdf).

- Keywords: anoma, blockchain technology, protocol design, resource machine
-->
Loading
Loading