Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 4 additions & 15 deletions docs/arch/node/engines/commitment_behaviour.juvix.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ tags:
import arch.node.engines.commitment_messages open;
import arch.node.engines.commitment_config open;
import arch.node.engines.commitment_environment open;
import arch.node.utils open;
import arch.node.types.basics open;
import arch.node.types.identities open;
import arch.node.types.messages open;
Expand Down Expand Up @@ -248,23 +249,11 @@ commitAction
(CommitmentCfg.signer (EngineCfg.cfg cfg))
(CommitmentCfg.backend (EngineCfg.cfg cfg))
(RequestCommitment.data request);
responseMsg := mkReplyCommitment@{
responseMsg := Anoma.MsgCommitment (MsgCommitmentReply mkReplyCommitment@{
commitment := signedData;
err := none
}
in some mkActionEffect@{
env := env;
msgs := [
mkEngineMsg@{
sender := getEngineIDFromEngineCfg cfg;
target := EngineMsg.sender emsg;
mailbox := some 0;
msg := Anoma.MsgCommitment (MsgCommitmentReply responseMsg)
}
];
timers := [];
engines := []
}
})
in some (defaultReplyActionEffect env cfg (EngineMsg.sender emsg) responseMsg)
| _ := none
}
| _ := none
Expand Down
20 changes: 5 additions & 15 deletions docs/arch/node/engines/decryption_behaviour.juvix.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ tags:
import prelude open;
import arch.node.types.messages open;
import arch.system.identity.identity open;
import arch.node.utils open;
import arch.node.types.engine open;
import arch.node.engines.decryption_config open;
import arch.node.engines.decryption_environment open;
Expand Down Expand Up @@ -261,7 +262,7 @@ decryptAction
(DecryptionCfg.decryptor (EngineCfg.cfg cfg))
(DecryptionCfg.backend (EngineCfg.cfg cfg))
(RequestDecryption.data request);
responseMsg := case decryptedData of {
responseMsg' := case decryptedData of {
| none := mkReplyDecryption@{
data := emptyByteString;
err := some "Decryption Failed"
Expand All @@ -270,20 +271,9 @@ decryptAction
data := plaintext;
err := none
}
}
in some mkActionEffect@{
env := env;
msgs := [
mkEngineMsg@{
sender := getEngineIDFromEngineCfg cfg;
target := EngineMsg.sender emsg;
mailbox := some 0;
msg := Anoma.MsgDecryption (MsgDecryptionReply responseMsg)
}
];
timers := [];
engines := []
}
};
responseMsg := Anoma.MsgDecryption (MsgDecryptionReply responseMsg');
in some (defaultReplyActionEffect env cfg (EngineMsg.sender emsg) responseMsg)
| _ := none
}
| _ := none
Expand Down
68 changes: 23 additions & 45 deletions docs/arch/node/engines/encryption_behaviour.juvix.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ tags:
import arch.node.engines.encryption_messages open;
import arch.node.engines.encryption_config open;
import arch.node.engines.reads_for_messages open;
import arch.node.utils open;
import arch.node.types.anoma as Anoma open;
import arch.node.types.engine open;
import arch.node.types.identities open;
Expand Down Expand Up @@ -343,26 +344,14 @@ encryptAction
| Anoma.MsgEncryption (MsgEncryptionRequest (mkRequestEncrypt data externalIdentity useReadsFor)) :=
case useReadsFor of {
| false :=
some mkActionEffect@{
env := env;
msgs := [
mkEngineMsg@{
sender := getEngineIDFromEngineCfg cfg;
target := EngineMsg.sender emsg;
mailbox := some 0;
msg := Anoma.MsgEncryption (MsgEncryptionReply (
mkReplyEncrypt@{
ciphertext := Encryptor.encrypt
(EncryptionCfg.encryptor (EngineCfg.cfg cfg) Set.empty externalIdentity)
(EncryptionCfg.backend (EngineCfg.cfg cfg))
data;
err := none
}))
}
];
timers := [];
engines := []
}
let responseMsg := Anoma.MsgEncryption (MsgEncryptionReply mkReplyEncrypt@{
ciphertext := Encryptor.encrypt
(EncryptionCfg.encryptor (EngineCfg.cfg cfg) Set.empty externalIdentity)
(EncryptionCfg.backend (EngineCfg.cfg cfg))
data;
err := none
})
in some (defaultReplyActionEffect env cfg (EngineMsg.sender emsg) responseMsg)
| true :=
let existingRequests := Map.lookup externalIdentity (EncryptionLocalState.pendingRequests localState);
newPendingList := case existingRequests of {
Expand All @@ -372,23 +361,17 @@ encryptAction
newLocalState := localState@EncryptionLocalState{
pendingRequests := Map.insert externalIdentity newPendingList (EncryptionLocalState.pendingRequests localState)
};
responseMsg := Anoma.MsgReadsFor (MsgQueryReadsForEvidenceRequest
mkRequestQueryReadsForEvidence@{
externalIdentity := externalIdentity
})
in some mkActionEffect@{
env := env@EngineEnv{
localState := newLocalState
};
msgs := case existingRequests of {
| some _ := []
| none := [
mkEngineMsg@{
sender := getEngineIDFromEngineCfg cfg;
target := EncryptionCfg.readsForEngineAddress (EngineCfg.cfg cfg);
mailbox := some 0;
msg := Anoma.MsgReadsFor (MsgQueryReadsForEvidenceRequest (
mkRequestQueryReadsForEvidence@{
externalIdentity := externalIdentity
}))
}
]
| none := [defaultReplyMsg cfg (EncryptionCfg.readsForEngineAddress (EngineCfg.cfg cfg)) responseMsg]
};
timers := [];
engines := []
Expand Down Expand Up @@ -442,20 +425,15 @@ handleReadsForReplyAction
};
msgs := map
(\{req := let whoAsked := fst req;
data := snd req;
in mkEngineMsg@{
sender := getEngineIDFromEngineCfg cfg;
target := whoAsked;
mailbox := some 0;
msg := Anoma.MsgEncryption (MsgEncryptionReply (
mkReplyEncrypt@{
ciphertext := Encryptor.encrypt
(EncryptionCfg.encryptor (EngineCfg.cfg cfg) evidence externalIdentity)
(EncryptionCfg.backend (EngineCfg.cfg cfg))
data;
err := none
}))
}})
data := snd req;
responseMsg := Anoma.MsgEncryption (MsgEncryptionReply mkReplyEncrypt@{
ciphertext := Encryptor.encrypt
(EncryptionCfg.encryptor (EngineCfg.cfg cfg) evidence externalIdentity)
(EncryptionCfg.backend (EngineCfg.cfg cfg))
data;
err := none
})
in defaultReplyMsg cfg whoAsked responseMsg})
reqs;
timers := [];
engines := []
Expand Down
8 changes: 2 additions & 6 deletions docs/arch/node/engines/executor_behaviour.juvix.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ tags:
import arch.node.engines.shard_messages open;

import prelude open;
import arch.node.utils open;
import arch.node.types.basics open;
import arch.node.types.identities open;
import arch.node.types.messages open;
Expand Down Expand Up @@ -292,12 +293,7 @@ processReadAction
| some (MsgShard (ShardMsgKVSRead (mkKVSReadMsg@{key := readKey; data := readValue}))) :=
let
envelope (target : EngineID) (msg : Anoma.PreMsg KVSKey KVSDatum Executable) : EngineMsg (Anoma.PreMsg KVSKey KVSDatum Executable) :=
mkEngineMsg@{
sender := getEngineIDFromEngineCfg (ActionInput.cfg input);
target := target;
mailbox := some 0;
msg := msg
};
defaultReplyMsg (ActionInput.cfg input) target msg;
local := EngineEnv.localState env;
reads := ExecutorLocalState.completed_reads local;
writes := ExecutorLocalState.completed_writes local;
Expand Down
Loading
Loading