Skip to content

Commit ec0e41c

Browse files
committed
Added transactions page.
1 parent e53cdac commit ec0e41c

File tree

2 files changed

+27
-24
lines changed

2 files changed

+27
-24
lines changed

.vitepress/config.mts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ export default withMermaid({
3030
{
3131
text: 'Architecture', link: '/guide/cosmwasm-core/architecture/architecture',
3232
items: [
33+
{text: 'Actor model', link: '/guide/cosmwasm-core/architecture/actor-model'},
3334
{text: 'Gas', link: '/guide/cosmwasm-core/architecture/gas'},
35+
{text: 'Transactions', link: '/guide/cosmwasm-core/architecture/transactions'},
3436
]
3537
}
3638
]
@@ -57,7 +59,9 @@ export default withMermaid({
5759
{
5860
text: 'Architecture', collapsed: true, link: '/guide/cosmwasm-core/architecture/architecture',
5961
items: [
62+
{text: 'Actor model', link: '/guide/cosmwasm-core/architecture/actor-model'},
6063
{text: 'Gas', link: '/guide/cosmwasm-core/architecture/gas'},
64+
{text: 'Transactions', link: '/guide/cosmwasm-core/architecture/transactions'},
6165
]
6266
},
6367
]

pages/guide/cosmwasm-core/architecture/transactions.md

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
---
2-
tags: ["core", "architecture"]
3-
---
4-
51
# Transactions
62

73
Every contract invocation is wrapped into a transaction. If you know about transactions in SQL
@@ -26,7 +22,7 @@ However, we do this to prevent one of the most widespread and hardest to detect
2622
Ethereum contracts - reentrancy. We do this by following the actor model, which doesn't nest
2723
function calls, but returns messages that will be executed later. This means all state that is
2824
carried over between one call and the next happens in storage and not in memory. For more
29-
information on this design, I recommend you read [our docs on the Actor Model](actor-model.mdx).
25+
information on this design, I recommend you read [our docs on the Actor Model](./actor-model).
3026

3127
A common request was the ability to get the result from one of the messages you dispatched. For
3228
example, you want to create a new contract with
@@ -81,26 +77,29 @@ Submessages handling follows _depth first_ order rules. Let's see the following
8177
```mermaid
8278
8379
sequenceDiagram
84-
Note over Contract1: Contract1 returns two submessages:<br/> 1. Execute Contract2<br/> 2. Execute Contract4
85-
Contract1->>Contract2: 1. Execute
86-
Note over Contract2: Contract2 returns one submessage:<br/> 1. Execute Contract3
87-
Contract2->>Contract3: 2. Execute
88-
Contract3->>Contract2: 3. Response
89-
Note over Contract2: Contract2 can handle the Response<br/>in the reply entrypoint or leave it
90-
Contract2->>Contract1: 4. Response
91-
Note over Contract1: Contract1 can handle the Response<br/>in the reply entrypoint or leave it
92-
Contract1->>Contract4: 5. Execute
93-
Contract4->>Contract1: 6. Response
94-
Note over Contract1: Contract1 can handle the Response<br/>in the reply entrypoint or leave it
80+
Note over Contract 1: Contract 1 returns two submessages:<br/> 1. Execute Contract 2<br/> 2. Execute Contract 4
81+
Contract 1->>Contract 2: 1. Execute
82+
Note over Contract 2: Contract 2 returns one submessage:<br/> 1. Execute Contract 3
83+
Contract 2->>Contract 3: 2. Execute
84+
Contract 3->>Contract 2: 3. Response
85+
Note over Contract 2: Contract 2 can handle the Response<br/>in the reply entrypoint or leave it
86+
Contract 2->>Contract 1: 4. Response
87+
Note over Contract 1: Contract 1 can handle the Response<br/>in the reply entrypoint or leave it
88+
Contract 1->>Contract 4: 5. Execute
89+
Contract 4->>Contract 1: 6. Response
90+
Note over Contract 1: Contract 1 can handle the Response<br/>in the reply entrypoint or leave it
9591
9692
```
9793

98-
**Note1:** The
99-
[msg_responses](https://docs.rs/cosmwasm-std/latest/cosmwasm_std/struct.SubMsgResponse.html#structfield.msg_responses)
100-
of the response are not forwarded down the call path. It means that for e.g. if `Contract2` will not
101-
explicitly handle response from `Contract3` and forward any data, then `Contract1` will never learn
102-
about results from `Contract3`.
94+
**Note 1**
95+
96+
The [msg_responses](https://docs.rs/cosmwasm-std/latest/cosmwasm_std/struct.SubMsgResponse.html#structfield.msg_responses)
97+
of the response are not forwarded down the call path. It means that for e.g. if `Contract 2` will not
98+
explicitly handle response from `Contract 3` and forward any data, then `Contract 1` will never learn
99+
about results from `Contract 3`.
100+
101+
**Note 2**
103102

104-
**Note2:** If `Contract2` returns an error, the error message can be handled by the `Contract1`
105-
reply entry-point and prevent the whole transaction from rollback. In such a case only the
106-
`Contract2` and `Contract3` states changes are reverted.
103+
If `Contract 2` returns an error, the error message can be handled by the `Contract 1`
104+
reply entrypoint and prevent the whole transaction from rollback. In such a case only the
105+
`Contract 2` and `Contract 3` states changes are reverted.

0 commit comments

Comments
 (0)