Eli5 the comm rule  

  RSS

Rholand
(@roland)
Active Member
Joined:4 months  ago
Posts: 12
09/05/2018 12:49 pm  

Reading the architecture documentationits still hard to understand the COMM rule.  https://rchain-architecture.readthedocs.io/en/latest/contracts/contract-design.html

Seems the purpose is to substitute a pattern with a process Q. 

Now this is claimed to be a transaction. 

Can somebody explain in layman's  therms how this is a Blockchain transaction? Maybe with an example?


ReplyQuote
MichaelBirch
(@michaelbirch)
Member Moderator
Joined:6 months  ago
Posts: 38
09/05/2018 1:24 pm  

It's important to think about what the data being transmitted across the channel could represent. For example, sending a purse* from one person to another would constitute a single comm event. But it is also worth noting that not all comm events will look like "blockchain transactions" because they are also just part of the computational model in Rholang. So a smart contract will have "internal" comm events as it performs its computations, as well as comm events to send its results to other interested parties.

 

*If you are not familiar with the notion of a "purse" (as opposed to a global account system like Ethereum) there is a good description here.

Edited: 3 months  ago

Rholand liked
ReplyQuote
Rholand
(@roland)
Active Member
Joined:4 months  ago
Posts: 12
09/05/2018 2:48 pm  

Q/ptrn meant substitute a pattern with a process. Does that mean the owner is substituted in you example of transmitting a purse?


ReplyQuote
MichaelBirch
(@michaelbirch)
Member Moderator
Joined:6 months  ago
Posts: 38
09/05/2018 5:34 pm  

When a comm event happens, some free variables in the continuation (i.e. the process which comes after the comm event) are bound based on the data that is sent over the channel. This binding of values is the substitution step. The data must match the "pattern" (i.e. particular structural form) specified by the receiving end. 

In my purse example, the pattern would be the structural form of a purse and the continuation would be the post-processing that the receiver does with the purse after they have received it. The free variable that gets bound in the continuation (i.e. the substitution that occurs) would be the purse reference, thus allowing the receiver to work with the purse. I suppose at a high level that is something like "substituting ownership", but that is not strictly speaking accurate.

Edited: 3 months  ago

Rholand liked
ReplyQuote
dckc
 dckc
(@dckc)
Member Moderator
Joined:5 months  ago
Posts: 20
22/05/2018 3:26 am  

Ok, kids, see all these boxes where we put our shoes, papers, and things? These are channels. The other thing besides channels in our game is processes, that is combinations of things to do. The simplest one is Nil, that is, stop! The send process is written like box!(instructions); for example box1!(Nil), for putting Nil at box1. And we have for(something <- box) { ...instructions for what to do with something... }. Another is written doThis | doThat, which means do both (you can start doThat right away; you don't have to wait for doThis to finish). A funny thing: note how all are channel boxes are named by writing out processes, i.e. quoting them.

Whenever boxA!(stuffToDo) and for(something <- boxA) { ...instructions for what to do with something ...} are both happening, take the instructions, and everywhere you see something, write out stuffToDo instead. And keep playing! (The grown-ups call that the COMM rule.)

One last kind of instructions: if you see *toDo, where toDo is the written-out (quoted) form of a process, follow the toDo instructions.

🙂

p.s. I suppose this doesn't explain how COMM makes transactions, but it was fun to write.

 

Edited: 3 months  ago

Rholand liked
ReplyQuote
Mike Stay
(@stay)
Member Moderator
Joined:4 months  ago
Posts: 19
31/05/2018 9:37 pm  
for (@{(row /\ <query>) | @"sequence number"!(0)} <- table) {
table!(row | @"sequence number"(1)) |
if (<condition>) {
<body>
}
}

is analogous to

SELECT <query> FROM <table> WHERE <condition>

and then doing

<body>

with the resulting rows.  The sequence numbers are there to prevent you from reading the same "row" twice (readers are sequentialized in this pattern).


ReplyQuote
  
Working

Please Login or Register