Skip to content

Partially reword the actor model page #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 24, 2024
Merged
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
14 changes: 9 additions & 5 deletions src/pages/core/architecture/actor-model.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,13 @@ means a contract can only interact with the outside world via messages and only
manipulate its own state.

Picture two people living in two houses, each house has a mailbox. If person A
wants to talk to person B, they write a letter and put it in person B's mailbox.
Person B will read the letter and write a response, putting it in person A's
mailbox.
wants to talk to person B, they write a letter, address to to person B, and send
it off. The mailman (or in this case, the chain) will put the letter in person
B's mailbox.

Person B will then read the letter and can choose to write a response, address
it to person A with a note indicating that this is a reply, and send it off once
again.

No direct interaction is happening here, nobody visits each other's house which
would allow them to rummage around in their belongings (state). They simply
Expand All @@ -50,8 +54,8 @@ be.

But how does that fix reentrancy? In CosmWasm, you can only send out messages at
the end of a contract execution as part of the response. This ensures you have
already written everything to the state, meaning your state is in a consistent
state.
already written everything to the state, meaning the state can't suddenly change
mid-execution and make your contract exhibit buggy behaviour.

CosmWasm effectively forces you to follow the
[CEI pattern (Checks, Effects, Interactions)](https://fravoll.github.io/solidity-patterns/checks_effects_interactions.html)
Expand Down