-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from CosmWasm/aw/transactions
Add page about transactions
- Loading branch information
Showing
3 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"actor-model": "Actor Model", | ||
"events": "Events" | ||
"events": "Events", | ||
"transactions": "Transactions" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
tags: ["core", "architecture"] | ||
--- | ||
|
||
# Transactions | ||
|
||
Every contract invocation is wrapped into a transaction. If you know about | ||
transactions in SQL databases, you can consider them as the same basic concept. | ||
You execute multiple operations in a single transaction, and if one of them | ||
fails, the whole transaction is rolled back. | ||
|
||
In our case, these operations are invocations of contract entrypoints. If one of | ||
the invocations in the chain fails, the whole transaction is usually rolled | ||
back. | ||
|
||
## Preventing rollbacks in case of failure | ||
|
||
If you don't want your entire transaction to be rolled back in case of a | ||
failure, you can use the `reply_on` field in the message you send. Set the field | ||
to one of the following values and instead of rolling back the transaction, you | ||
will receive a message containing the error: | ||
|
||
- `ReplyOn::Always` | ||
- `ReplyOn::Error` | ||
|
||
That way you can handle the error and decide what to do next, whether you want | ||
to propagate the error, retry the operation, ignore it, etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters