Skip to content
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

fix(content): filecoin VM interface update #1056

Merged
merged 4 commits into from Sep 4, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions content/systems/filecoin_vm/_index.md
Expand Up @@ -4,11 +4,15 @@ description: VM - Virtual Machine
bookCollapseSection: true
weight: 3
dashboardWeight: 2
dashboardState: wip
dashboardState: reliable
dashboardAudit: missing
dashboardTests: 0
---

# VM - Virtual Machine

{{<embed src="vm.id" lang="go" >}}
An Actor in the Filecoin Blockchain is the equivalent of the smart contract in the Ethereum Virtual Machine. Actors carry the logic needed in order to submit transactions, proofs and blocks, among other things, to the Filecoin blockchain. Every actor is identified by a unique address.

The Filecoin Virtual Machine (VM) is the system component that is in charge of execution of all actors code. Execution of actors on the Filecoin VM (i.e., on-chain executions) incur a gas cost.

Any operation applied (i.e., executed) on the Filecoin VM produces an output in the form of a _State Tree_ (discussed below). The latest _State Tree_ is the current source of truth in the Filecoin Blockchain. The _State Tree_ is identified by a CID, which is stored in the IPLD store.
13 changes: 10 additions & 3 deletions content/systems/filecoin_vm/actor/_index.md
Expand Up @@ -2,14 +2,21 @@
title: Actor
weight: 1
dashboardWeight: 2
dashboardState: wip
dashboardState: reliable
dashboardAudit: wip
dashboardTests: 0
---

# VM Actor Interface

As mentioned above, Actors are the Filecoin equivalent of smart contracts in the Ethereum Virtual Machine. As such, Actors are very central components of the system. Any change to the current state of the Filecoin blockchain has to be triggered through an actor method invocation.

{{<embed src="actor.id" lang="go" >}}
This sub-section describes the _interface_ between Actors and the Filecoin Virtual Machine. This means that most of what is described below does not strictly belong to the VM. Instead it is logic that sits on the interface between the VM and Actors logic.

{{<embed src="actor.go" lang="go" >}}
There are eleven (11) types of _builtin_ Actors in total, not all of which interact with the VM. Some Actors do not invoke changes to the StateTree of the blockchain and therefore, do not need to have an interface to the VM. We discuss the details of all System Actors later on in the System Actors subsection.

The _actor address_ is a stable address generated by hashing the sender's public key and a creation nonce. It should be stable across chain re-organizations. The _actor ID address_ on the other hand, is an auto-incrementing address that is compact but can change in case of chain re-organizations. That being said, after being created, actors should use an _actor address_.

{{<embed src="/externals/specs-actors/actors/builtin/singletons.go" lang="go">}}

The `ActorState` structure is composed of the actor's balance, in terms of tokens held by this actor, as well as a group of state methods used to query, inspect and interact with chain state. All methods take a TipSetKey as a parameter. The state looked up is the state at that tipset. A nil TipSetKey can be provided as a param, this will cause the heaviest tipset in the chain to be used.
yiannisbot marked this conversation as resolved.
Show resolved Hide resolved