Skip to content

Commit

Permalink
Fix linter complaints
Browse files Browse the repository at this point in the history
  • Loading branch information
fasmat committed Oct 16, 2024
1 parent 191f19e commit 61dbd10
Show file tree
Hide file tree
Showing 47 changed files with 2,306 additions and 1,006 deletions.
37 changes: 20 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,43 @@

This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.

### Installation
## Installation

```
$ yarn
```bash
yarn
```

### Local Development
## Local Development

```
$ yarn start
```bash
yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
This command starts a local development server and opens up a browser window. Most changes are reflected live without
having to restart the server.

### Build
## Build

```
$ yarn build
```bash
yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.
This command generates static content into the `build` directory and can be served using any static contents hosting
service.

### Deployment
## Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```bash
USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```bash
GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the
`gh-pages` branch.
3 changes: 2 additions & 1 deletion docs/api/construction.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ id: construction-api
title: Under Construction
---

You may notice a lot of blank pages here. This is only temporary, while our team is hard at work producing the content that will fill them up.
You may notice a lot of blank pages here. This is only temporary, while our team is hard at work producing the content

Check failure on line 6 in docs/api/construction.md

View workflow job for this annotation

GitHub Actions / lint

Line length

docs/api/construction.md:6:81 MD013/line-length Line length [Expected: 80; Actual: 118] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md013.md
that will fill them up.
3 changes: 2 additions & 1 deletion docs/ecosystem/construction.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ id: construction-eco
title: Under Construction
---

You may notice a lot of blank pages here. This is only temporary, while our team is hard at work producing the content that will fill them up.
You may notice a lot of blank pages here. This is only temporary, while our team is hard at work producing the content

Check failure on line 6 in docs/ecosystem/construction.md

View workflow job for this annotation

GitHub Actions / lint

Line length

docs/ecosystem/construction.md:6:81 MD013/line-length Line length [Expected: 80; Actual: 118] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md013.md
that will fill them up.
18 changes: 14 additions & 4 deletions docs/learn/accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,20 @@ title: Accounts

![accounts](./../../static/img/protocol_slides/Accounts-and-Templates.png)

Spacemesh implements a form of native account abstraction (a.k.a., account unification): all accounts are smart contract-based accounts. There are no keypair-based "externally owned accounts" (EOAs) as in Ethereum.
Spacemesh implements a form of native account abstraction (a.k.a., account unification): all accounts are smart

Check failure on line 8 in docs/learn/accounts.md

View workflow job for this annotation

GitHub Actions / lint

Line length

docs/learn/accounts.md:8:81 MD013/line-length Line length [Expected: 80; Actual: 111] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md013.md
contract-based accounts. There are no keypair-based "externally owned accounts" (EOAs) as in Ethereum.

Check failure on line 9 in docs/learn/accounts.md

View workflow job for this annotation

GitHub Actions / lint

Line length

docs/learn/accounts.md:9:81 MD013/line-length Line length [Expected: 80; Actual: 102] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md013.md

An account has an address (24 bytes long, typically expressed as a [bech32](https://en.bitcoin.it/wiki/Bech32) string starting with `sm1` for mainnet and `stest1` for testnet), a template address, a nonce, a balance, and state. The template contains the smart contract's code; as of now there are no user-deployed smart contracts and no code stored inside account objects, there's only a short set of hardcoded "precompiled" templates (see [below](#accounts-1)).
An account has an address (24 bytes long, typically expressed as a [bech32](https://en.bitcoin.it/wiki/Bech32) string

Check failure on line 11 in docs/learn/accounts.md

View workflow job for this annotation

GitHub Actions / lint

Line length

docs/learn/accounts.md:11:81 MD013/line-length Line length [Expected: 80; Actual: 117] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md013.md
starting with `sm1` for mainnet and `stest1` for testnet), a template address, a nonce, a balance, and state. The

Check failure on line 12 in docs/learn/accounts.md

View workflow job for this annotation

GitHub Actions / lint

Line length

docs/learn/accounts.md:12:81 MD013/line-length Line length [Expected: 80; Actual: 113] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md013.md
template contains the smart contract's code; as of now there are no user-deployed smart contracts and no code stored

Check failure on line 13 in docs/learn/accounts.md

View workflow job for this annotation

GitHub Actions / lint

Line length

docs/learn/accounts.md:13:81 MD013/line-length Line length [Expected: 80; Actual: 116] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md013.md
inside account objects, there's only a short set of hardcoded "precompiled" templates (see [below](#accounts-1)).

Check failure on line 14 in docs/learn/accounts.md

View workflow job for this annotation

GitHub Actions / lint

Line length

docs/learn/accounts.md:14:81 MD013/line-length Line length [Expected: 80; Actual: 113] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md013.md

Check failure on line 14 in docs/learn/accounts.md

View workflow job for this annotation

GitHub Actions / lint

Link fragments should be valid

docs/learn/accounts.md:14:92 MD051/link-fragments Link fragments should be valid [Context: "[below](#accounts-1)"] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md051.md

A "stub" account has only a balance, no template, nonce, or state. This is simply an account that's received one or more inbound transactions but hasn't been spawned yet. The "spawn" operation occurs when the owner of the account reveals the template address and immutable state used to generate the address (i.e., the account preimage). A simple or multisig wallet must be spawned (i.e., the Spawn method must be called) before funds can be spent (i.e., before the Spend method is called).
A "stub" account has only a balance, no template, nonce, or state. This is simply an account that's received one or more

Check failure on line 16 in docs/learn/accounts.md

View workflow job for this annotation

GitHub Actions / lint

Line length

docs/learn/accounts.md:16:81 MD013/line-length Line length [Expected: 80; Actual: 120] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md013.md
inbound transactions but hasn't been spawned yet. The "spawn" operation occurs when the owner of the account reveals the
template address and immutable state used to generate the address (i.e., the account preimage). A simple or multisig
wallet must be spawned (i.e., the Spawn method must be called) before funds can be spent (i.e., before the Spend method
is called).

Any account with a balance can pay for any transaction. The account that pays for a transaction is known as the "principal" of the transaction. Typically a wallet account serves as the principal for its own transactions, but more complex arrangements are possible including multisigs and applications that pay for user transactions.
Any account with a balance can pay for any transaction. The account that pays for a transaction is known as the
"principal" of the transaction. Typically a wallet account serves as the principal for its own transactions, but more
complex arrangements are possible including multisigs and applications that pay for user transactions.
23 changes: 18 additions & 5 deletions docs/learn/atx.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,32 @@ id: atx
title: ATX
---

After successfully generating the PoST, the smesher creates an Activation Transaction (ATX) and submits it to the network. This transaction includes the smesher’s PoST, their wallet address (to which rewards will go), and some other data. The ATX is then used to calculate the smesher's eligibility to participate in the rewards. For all subsequent epochs, the PoET service uses ATXs as the challenge value instead of the initial PoSp. As such, after the smesher’s first epoch, only a single PoSp (the later PoSp) is required per epoch.
After successfully generating the PoST, the smesher creates an Activation Transaction (ATX) and submits it to the
network. This transaction includes the smesher’s PoST, their wallet address (to which rewards will go), and some other
data. The ATX is then used to calculate the smesher's eligibility to participate in the rewards. For all subsequent
epochs, the PoET service uses ATXs as the challenge value instead of the initial PoSp. As such, after the smesher’s
first epoch, only a single PoSp (the later PoSp) is required per epoch.

## Weight

Every ATX also has a weight. Since multiple smeshers contribute to the same block, it is important to reward them accordingly. The absolute weight is calculated by multiplying the SUs allocated by a smesher by the number of PoET ticks for those allocated SUs (Space Units * PoET ticks). Put simply, the allocated space is multiplied by the time (measured by PoET ticks) that the special data was kept on the disk.
Every ATX also has a weight. Since multiple smeshers contribute to the same block, it is important to reward them
accordingly. The absolute weight is calculated by multiplying the SUs allocated by a smesher by the number of PoET ticks
for those allocated SUs (Space Units * PoET ticks). Put simply, the allocated space is multiplied by the time (measured
by PoET ticks) that the special data was kept on the disk.

Once the ATX’s absolute weight is derived, its relative weight (ATX weight / weight of all ATXs in the epoch) is calculated. This is the ATX’s weight in proportion to the total weight of all ATXs. Based on this relative weight, the number of block proposals a smesher is eligible to publish can be calculated.
Once the ATX’s absolute weight is derived, its relative weight (ATX weight / weight of all ATXs in the epoch) is
calculated. This is the ATX’s weight in proportion to the total weight of all ATXs. Based on this relative weight, the
number of block proposals a smesher is eligible to publish can be calculated.

## Block Proposals

Smeshers who submit a valid ATX during an epoch become eligible to publish block proposals in the following epoch. A block proposal is a set of data that includes transactions from the smesher’s mempool, the smesher’s signature, and some data that proves that this smesher is eligible to publish a block proposal in this layer.
Smeshers who submit a valid ATX during an epoch become eligible to publish block proposals in the following epoch. A
block proposal is a set of data that includes transactions from the smesher’s mempool, the smesher’s signature, and some
data that proves that this smesher is eligible to publish a block proposal in this layer.

Currently, the protocol targets 50 block proposals per layer and there are 4032 layers per epoch, with each layer lasting 5 minutes. The absolute weight of an ATX is divided by the number of block proposals that the smesher is eligible for to determine the weight of each of those block proposals.
Currently, the protocol targets 50 block proposals per layer and there are 4032 layers per epoch, with each layer
lasting 5 minutes. The absolute weight of an ATX is divided by the number of block proposals that the smesher is
eligible for to determine the weight of each of those block proposals.

![Ballots](./../../static/img/protocol_slides/Ballots.png)

Expand Down
47 changes: 36 additions & 11 deletions docs/learn/blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,43 @@ id: blocks
title: Blocks and Transactions
---

In traditional blockchains such as Bitcoin or Ethereum each block contains a "backwards pointer" to the previous known block (i.e., the previous chain head). In this way it's not possible to replace a single, historical block without replacing every block that came after.

Due to its mesh design, Spacemesh doesn't work this way. Spacemesh blocks are freestanding, i.e., each individual block is deemed valid or invalid on its own right by the consensus mechanisms, Tortoise and Hare. The protocol allows for zero or more valid blocks in a given layer. The vast majority of layers are expected to have a single valid, effective block. Empty layers may occur from time to time when certain assumptions are violated, e.g., when many miners are offline and the Hare consensus mechanism fails.

There can only be multiple valid blocks in a given layer when security assumptions are temporarily violated, e.g., when the network temporarily loses synchrony or > 1/3 of miners act dishonestly. In this case the protocol dictates that a single block be deterministically chosen as the only _effective_ block for the layer. Over time the network's self-healing mechanism ensures that all honest nodes reach consensus on the canonical set of valid, effective blocks, zero or one per layer.

In practice this means that a _single historical block_ and its contents may be reorg'ed in or out of the canonical chain. When a historical change occurs, the state rolls back (i.e., reorgs) to the point of change and all subsequent canonical state (i.e., all transactions in the new canonical chain) is replayed from that point forward. This could mean that transactions in the canonical chain that were previously effective now become ineffective, or vice versa. It may also mean that the same transaction (uniquely identified by its transaction ID) may appear in multiple blocks, in the same layer or in multiple layers. When this happens, only the first instance of the transaction in the canonical chain is considered effective; later instances are ignored.

A layer contains zero or more blocks. Most layers contain exactly one block, but it's possible for a layer to have zero blocks (when the network is under attack, or during times when many miners were offline or otherwise acting Byzantine) or more than one block (e.g., after a network partition-and-rejoin). In rare cases of multiple blocks, the network will establish consensus on a single block as canonical; transactions in other blocks will not be included in the canonical mesh nor processed. A block may thus be _valid_ or _invalid_ and there may only be one _valid_ block per layer.
In traditional blockchains such as Bitcoin or Ethereum each block contains a "backwards pointer" to the previous known
block (i.e., the previous chain head). In this way it's not possible to replace a single, historical block without
replacing every block that came after.

Due to its mesh design, Spacemesh doesn't work this way. Spacemesh blocks are freestanding, i.e., each individual block
is deemed valid or invalid on its own right by the consensus mechanisms, Tortoise and Hare. The protocol allows for zero
or more valid blocks in a given layer. The vast majority of layers are expected to have a single valid, effective block.
Empty layers may occur from time to time when certain assumptions are violated, e.g., when many miners are offline and
the Hare consensus mechanism fails.

There can only be multiple valid blocks in a given layer when security assumptions are temporarily violated, e.g., when
the network temporarily loses synchrony or > 1/3 of miners act dishonestly. In this case the protocol dictates that a
single block be deterministically chosen as the only _effective_ block for the layer. Over time the network's
self-healing mechanism ensures that all honest nodes reach consensus on the canonical set of valid, effective blocks,
zero or one per layer.

In practice this means that a _single historical block_ and its contents may be reorg'ed in or out of the canonical
chain. When a historical change occurs, the state rolls back (i.e., reorgs) to the point of change and all subsequent
canonical state (i.e., all transactions in the new canonical chain) is replayed from that point forward. This could mean
that transactions in the canonical chain that were previously effective now become ineffective, or vice versa. It may
also mean that the same transaction (uniquely identified by its transaction ID) may appear in multiple blocks, in the
same layer or in multiple layers. When this happens, only the first instance of the transaction in the canonical chain
is considered effective; later instances are ignored.

A layer contains zero or more blocks. Most layers contain exactly one block, but it's possible for a layer to have zero
blocks (when the network is under attack, or during times when many miners were offline or otherwise acting Byzantine)
or more than one block (e.g., after a network partition-and-rejoin). In rare cases of multiple blocks, the network will
establish consensus on a single block as canonical; transactions in other blocks will not be included in the canonical
mesh nor processed. A block may thus be _valid_ or _invalid_ and there may only be one _valid_ block per layer.

Blocks contain zero or more transactions. Blocks are uniquely indexed by their block hash.

Transactions are uniquely indexed by their transaction ID. The same transaction may be included in multiple blocks, but not in multiple blocks on the canonical chain (i.e., multiple _valid_ blocks). A transaction has a _state_ that may be `pending` (i.e., not processed yet), `mempool` (successfully added to the mempool but not yet mined into a block), or `applied` (successfully mined into a block).
Transactions are uniquely indexed by their transaction ID. The same transaction may be included in multiple blocks, but
not in multiple blocks on the canonical chain (i.e., multiple _valid_ blocks). A transaction has a _state_ that may be
`pending` (i.e., not processed yet), `mempool` (successfully added to the mempool but not yet mined into a block), or
`applied` (successfully mined into a block).

A transaction that was successfully `applied` can still fail if, e.g., the principal account doesn't have enough funds to pay for its gas: we call this an "ineffective" transaction. This is not currently captured cleanly in the API. Implementing transaction receipts is still a work in progress.
A transaction that was successfully `applied` can still fail if, e.g., the principal account doesn't have enough funds
to pay for its gas: we call this an "ineffective" transaction. This is not currently captured cleanly in the API.
Implementing transaction receipts is still a work in progress.
4 changes: 3 additions & 1 deletion docs/learn/coin.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ title: Spacemesh Coin
---

## Basic Units

- `Smesh` (SMH) is the name of the Spacemesh native cryptocurrency. 1 Smesh equals 10^9 (1 billion) Smidge.
- `Smidge` (SMIDGE) is the basic unit of accounting of the Spacemesh platform. It is used mostly by developers in smart contracts code and by users and for transaction fees. One billion (10^9) Smidge equals to one Smesh.
- `Smidge` (SMIDGE) is the basic unit of accounting of the Spacemesh platform. It is used mostly by developers in smart
contracts code and by users and for transaction fees. One billion (10^9) Smidge equals to one Smesh.
18 changes: 13 additions & 5 deletions docs/learn/crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,28 @@ id: crypto
title: What Is Cryptocurrency?
---

A cryptocurrency is a digital currency that is secured by a cryptographically-encrypted ledger called a blockchain. In turn, this ledger contains an immutable record of every transaction that has ever occured using the cryptocurrency.
A cryptocurrency is a digital currency that is secured by a cryptographically-encrypted ledger called a blockchain. In
turn, this ledger contains an immutable record of every transaction that has ever occurred using the cryptocurrency.

## What Makes Cryptocurrency Important

The move to digital currency has been happening since the dawn of the Internet. But these are just digital representations of existing fiat currencies, and are not a true shift from the existing status quo of our financial and monetary systems.
The move to digital currency has been happening since the dawn of the Internet. But these are just digital
representations of existing fiat currencies, and are not a true shift from the existing status quo of our financial and
monetary systems.

Banks and governments still control these assets.

But cryptocurrency is something new: a decentralized, purely digital currency that no single entity or group controls.

It is also fully anonymous. Transactions are recorded on the public ledger, but the identities of the parties involved are not revealed.
It is also fully anonymous. Transactions are recorded on the public ledger, but the identities of the parties involved
are not revealed.

This represents a paradigm shift from our existing system, especially in the realm of financial inclusion. Cryptocurrencies can be used by anyone with an Internet connection, which gives them the potential to reach populations that are unbanked or underserved by traditional financial institutions.
This represents a paradigm shift from our existing system, especially in the realm of financial inclusion.
Cryptocurrencies can be used by anyone with an Internet connection, which gives them the potential to reach populations
that are un-banked or under-served by traditional financial institutions.

## Digital Gold

One of the key features of cryptocurrencies is that they are not fiat currencies. That is, they are tied to a another commodity and must be "mined", meaning that they can't be printed at will. So, like currencies tied to hard commodities like gold, they are inflation-resistant because they cannot be printed at will by central banks.
One of the key features of cryptocurrencies is that they are not fiat currencies. That is, they are tied to a another
commodity and must be "mined", meaning that they can't be printed at will. So, like currencies tied to hard commodities
like gold, they are inflation-resistant because they cannot be printed at will by central banks.
Loading

0 comments on commit 61dbd10

Please sign in to comment.