From db5f54a689adcabe676cbae40bd0a1706b21d419 Mon Sep 17 00:00:00 2001 From: Michael Heuer Date: Tue, 1 Oct 2024 11:12:10 +0200 Subject: [PATCH] fix: name clashes --- Anoma/Identity/{Types.juvix => Object.juvix} | 2 +- Anoma/State/ResourceMachine.juvix | 8 ++++---- Anoma/Transaction/Action.juvix | 14 +++++++------- Anoma/Transaction/Index.juvix | 12 ++++++------ Anoma/Transaction/Metadata.juvix | 12 ++++++------ Anoma/Transaction/Object.juvix | 10 +++++----- Anoma/Transaction/Preference.juvix | 2 +- 7 files changed, 30 insertions(+), 30 deletions(-) rename Anoma/Identity/{Types.juvix => Object.juvix} (96%) diff --git a/Anoma/Identity/Types.juvix b/Anoma/Identity/Object.juvix similarity index 96% rename from Anoma/Identity/Types.juvix rename to Anoma/Identity/Object.juvix index 9edc284..15b1018 100644 --- a/Anoma/Identity/Types.juvix +++ b/Anoma/Identity/Object.juvix @@ -1,4 +1,4 @@ -module Anoma.Identity.Types; +module Anoma.Identity.Object; import Stdlib.Prelude open; import Stdlib.Trait.Ord.Eq open using {fromOrdToEq}; diff --git a/Anoma/State/ResourceMachine.juvix b/Anoma/State/ResourceMachine.juvix index 86b3655..6106228 100644 --- a/Anoma/State/ResourceMachine.juvix +++ b/Anoma/State/ResourceMachine.juvix @@ -2,7 +2,7 @@ module Anoma.State.ResourceMachine; import Stdlib.Prelude open; import Data.Set as Set open using {Set}; -import Anoma.Transaction.Object as Transaction open using {Transaction; create; compose; verify}; +import Anoma.Transaction.Object as Transaction open using {Transaction; mkTransaction; composeTransactions; verifyTransaction}; import Anoma.State.CommitmentTree as CommitmentTree open using {Root}; import Anoma.Transaction.Action as Action open; import Anoma.Delta as Delta open using {Delta}; @@ -32,7 +32,7 @@ type ResourceMachine := instance Concrete-ResourceMachine : ResourceMachine := mkResourceMachine@{ - create := Transaction.create; - compose := Transaction.compose; - verify := Transaction.verify + create := Transaction.mkTransaction; + compose := Transaction.composeTransactions; + verify := Transaction.verifyTransaction }; diff --git a/Anoma/Transaction/Action.juvix b/Anoma/Transaction/Action.juvix index cf1bec2..4824ebc 100644 --- a/Anoma/Transaction/Action.juvix +++ b/Anoma/Transaction/Action.juvix @@ -16,7 +16,7 @@ import Anoma.Transaction.AppData open using {AppData}; --- - existence of consumed ;Resource;s in the commitment tree --- - non-existence of consumed ;Resource;s in the nullifier set. type Action := - create { + mkAction { commitments : Set Resource.Commitment; nullifiers : Set Resource.Nullifier; proofs : ProofRecordSet; @@ -28,7 +28,7 @@ type DisjointSetError := | NonDisjointNullifiersError (Set Resource.Nullifier); --- Composes two ;Action; objects. -compose (a1 a2 : Action) : Result DisjointSetError Action := +composeActions (a1 a2 : Action) : Result DisjointSetError Action := case disjointUnion (Action.commitments a1) (Action.commitments a2) , disjointUnion (Action.nullifiers a1) (Action.nullifiers a2) @@ -37,7 +37,7 @@ compose (a1 a2 : Action) : Result DisjointSetError Action := | _, error duplicatedNullifiers := error (NonDisjointNullifiersError duplicatedNullifiers) | ok commitments, ok nullifiers := ok - create@{ + mkAction@{ commitments; nullifiers; appData := union (Action.appData a1) (Action.appData a2); @@ -45,15 +45,15 @@ compose (a1 a2 : Action) : Result DisjointSetError Action := }; --- Verifies an ;Action; by verifying all proofs in the ;ProofRecordSet;. -verify (a : Action) : Bool := ProofRecordSet.verify (Action.proofs a); +verifyAction (a : Action) : Bool := ProofRecordSet.verify (Action.proofs a); module ActionInternal; --- Compares two ;Action; objects. - compare (lhs rhs : Action) : Ordering := - let + compare (lhs rhs : Action) : Ordering := + let prod (a : Action) : _ := Action.commitments a, Action.nullifiers a, Action.proofs a, Action.appData a; - in Ord.cmp (prod lhs) (prod rhs); + in Ord.cmp (prod lhs) (prod rhs); --- Implements the ;Ord; trait for ;Action;. instance diff --git a/Anoma/Transaction/Index.juvix b/Anoma/Transaction/Index.juvix index 6d54f54..528ee6d 100644 --- a/Anoma/Transaction/Index.juvix +++ b/Anoma/Transaction/Index.juvix @@ -1,9 +1,9 @@ module Anoma.Transaction.Index; -import Anoma.Transaction.Action open public; -import Anoma.Transaction.AppData open public; -import Anoma.Transaction.Delta open public; -import Anoma.Transaction.InformationFlow open public; -import Anoma.Transaction.Metadata open public; +import Anoma.Transaction.Action open public; +import Anoma.Transaction.AppData open public; +import Anoma.Transaction.Delta open public; +import Anoma.Transaction.InformationFlow open public; +import Anoma.Transaction.Metadata open public; import Anoma.Transaction.Preference open public; -import Anoma.Transaction.Object open public; +import Anoma.Transaction.Object open public; diff --git a/Anoma/Transaction/Metadata.juvix b/Anoma/Transaction/Metadata.juvix index 118a817..2f4efe0 100644 --- a/Anoma/Transaction/Metadata.juvix +++ b/Anoma/Transaction/Metadata.juvix @@ -2,7 +2,7 @@ module Anoma.Transaction.Metadata; import Stdlib.Prelude open; import Anoma.Transaction.Object as Transaction open using {Transaction}; -import Anoma.Transaction.Preference as Preference open using {Preference; compose}; +import Anoma.Transaction.Preference as Preference open using {Preference; composePreferences}; import Anoma.Transaction.InformationFlow open using {InformationFlowControlPredicate}; --- The metadata that can be associated with a ;Transaction;. @@ -24,20 +24,20 @@ type TransactionWithMetadata := --- Composes two ;TransactionWithMetadata; objects. --- NOTE: For the private testnet, this is not required yet. -compose (txwm1 txwm2 : TransactionWithMetadata) : TransactionWithMetadata := +composeTransactionsWithMetadata (txwm1 txwm2 : TransactionWithMetadata) : TransactionWithMetadata := let meta1 := TransactionWithMetadata.metadata txwm1; meta2 := TransactionWithMetadata.metadata txwm2; in createWithMetadata@{ transaction := - Transaction.compose@{ + Transaction.composeTransactions@{ tx1 := TransactionWithMetadata.transaction txwm1; tx2 := TransactionWithMetadata.transaction txwm2 }; metadata := mkMetadata@{ preference := - Preference.compose@{ + Preference.composePreferences@{ f1 := Metadata.preference meta1; f2 := Metadata.preference meta2 }; @@ -49,5 +49,5 @@ compose (txwm1 txwm2 : TransactionWithMetadata) : TransactionWithMetadata := }; --- Verifies a ;TransactionWithMetadata;. -verify (txwm : TransactionWithMetadata) : Bool := - Transaction.verify (TransactionWithMetadata.transaction txwm); +verifyTransactionWithMetadata (txwm : TransactionWithMetadata) : Bool := + Transaction.verifyTransaction (TransactionWithMetadata.transaction txwm); diff --git a/Anoma/Transaction/Object.juvix b/Anoma/Transaction/Object.juvix index 0fefc10..303f692 100644 --- a/Anoma/Transaction/Object.juvix +++ b/Anoma/Transaction/Object.juvix @@ -13,7 +13,7 @@ import Anoma.Proving.DeltaProof as DeltaProof; --- A record describing a transaction object, the entity constituting a state transition in Anoma. positive type Transaction := - create { + mkTransaction { roots : Set CommitmentTree.Root; actions : Set Action; delta : Delta; @@ -21,8 +21,8 @@ type Transaction := }; --- Composes two ;Transaction; objects. -compose (tx1 tx2 : Transaction) : Transaction := - create@{ +composeTransactions (tx1 tx2 : Transaction) : Transaction := + mkTransaction@{ roots := union (Transaction.roots tx1) (Transaction.roots tx2); actions := union (Transaction.actions tx1) (Transaction.actions tx2); delta := AdditivelyHomomorphic.add (Transaction.delta tx1) (Transaction.delta tx2); @@ -30,8 +30,8 @@ compose (tx1 tx2 : Transaction) : Transaction := }; --- Verifies a ;Transaction;. -verify (tx : Transaction) : Bool := - all (a in Set.toList (Transaction.actions tx)) {Action.verify a} +verifyTransaction (tx : Transaction) : Bool := + all (a in Set.toList (Transaction.actions tx)) {Action.verifyAction a} && DeltaProof.verify (Transaction.deltaProof tx); --- Returns the ;Resource.Commitment; ;Set; of all ;Action;s in a ;Transaction; or the intersection ;Set;. diff --git a/Anoma/Transaction/Preference.juvix b/Anoma/Transaction/Preference.juvix index 59d93af..6480657 100644 --- a/Anoma/Transaction/Preference.juvix +++ b/Anoma/Transaction/Preference.juvix @@ -9,4 +9,4 @@ axiom UnitInterval : Type; Preference : Type := (tx : Transaction) -> UnitInterval; --- The preference function composition function. -axiom compose : (f1 f2 : Preference) -> Preference; +axiom composePreferences : (f1 f2 : Preference) -> Preference;