Skip to content

Commit

Permalink
Merge branch 'dev' into 1176-migrate-from-other-chains
Browse files Browse the repository at this point in the history
  • Loading branch information
Karol Marter authored and Karol Marter committed Sep 13, 2023
2 parents 78faea0 + aaaa26f commit e2730be
Show file tree
Hide file tree
Showing 130 changed files with 10,911 additions and 7,724 deletions.
72 changes: 62 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Docusaurus CICD

env:
prod_pages_fqdn: ${{ vars.PROD_PAGES_FQDN }}
selected_node_version: 16.14

on:
push:
Expand All @@ -27,9 +28,6 @@ jobs:
build:
runs-on: ubuntu-latest

env:
selected_node_version: 16.14

steps:
- uses: actions/checkout@v3

Expand All @@ -39,7 +37,7 @@ jobs:
node-version: ${{ env.selected_node_version }}
cache: yarn

- name: Template credentials
- name: Template credentials - production
if: github.ref == 'refs/heads/dev'
uses: cuchi/jinja2-action@1149b92d9ea6db61d7f71c22e3d5028d8065f140
with:
Expand All @@ -62,6 +60,19 @@ jobs:
ALGOLIA_SITE_INDEX_NAME: ${{ vars.ALGOLIA_SITE_INDEX_NAME }}
BASE_URL: ${{ vars.BASE_URL }}

- name: Template credentials - preview
if: github.event_name == 'pull_request'
uses: cuchi/jinja2-action@1149b92d9ea6db61d7f71c22e3d5028d8065f140
with:
template: .github/templates/.env.production.j2
output_file: .env.production
env:
DIRECTUS_URL: ${{ secrets.PREVIEW_DIRECTUS_URL }}
DIRECTUS_GRAPHQL_URL: ${{ secrets.PREVIEW_DIRECTUS_GRAPHQL_URL }}
DIRECTUS_TOKEN: ${{ secrets.PREVIEW_DIRECTUS_TOKEN }}
SITE_URL: ${{ vars.SITE_URL }}
BASE_URL: ${{ vars.BASE_URL }}

- name: Yarn install
run: |
yarn install
Expand All @@ -70,10 +81,6 @@ jobs:
run: |
yarn format
- name: Validate external links
run: |
yarn check:externals
- name: Clear Docusaurus cache
run: |
yarn clear
Expand All @@ -93,6 +100,27 @@ jobs:
name: gh-pages-depl-payload
path: ./docs

validate-external-links:
needs: build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Use Node.js ${{ env.selected_node_version }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.selected_node_version }}
cache: yarn

- name: Yarn install
run: |
yarn install
- name: Validate external links
run: |
yarn check:externals
system-tests-predeployment:
needs: build
runs-on: ubuntu-latest
Expand Down Expand Up @@ -148,6 +176,32 @@ jobs:
curl --fail http://127.0.0.1:4000/concepts/serialization-standard/
working-directory: ./docs

deploy-preview:
if: github.event_name == 'pull_request'
needs: [build]
runs-on: ubuntu-latest

steps:
- uses: actions/download-artifact@master
with:
name: gh-pages-depl-payload
path: ./docs

- name: Deploy to Netlify
uses: nwtgck/[email protected]
with:
publish-dir: 'docs'
production-deploy: false
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: ${{ github.event.pull_request.title }}
enable-pull-request-comment: true
enable-commit-comment: false
enable-github-deployment: false
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.PREVIEW_NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.PREVIEW_NETLIFY_SITE_ID }}
timeout-minutes: 1

deploy-prod:
if: ${{ github.ref == 'refs/heads/dev' && github.repository == 'casper-network/docs' }}
needs: [backup, system-tests-predeployment]
Expand Down Expand Up @@ -203,5 +257,3 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs


4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ In that case run the command ```npm run swizzle @docusaurus/theme-classic Navbar

For more information about this: https://docusaurus.io/docs/swizzling

Complete the following enviroment variables to enable the navbar.
Complete the following environment variables to enable the navbar.

```
DIRECTUS_URL=REPLACE_WITH_YOUR_DIRECTUS_URL
Expand Down Expand Up @@ -283,7 +283,7 @@ info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this comm

This is a [known issue on Docusaurus side](https://github.com/facebook/docusaurus/issues/5778) which has been closed.

There is a workaround which consists on setting an environment variable before running the command or in your shell/system environment:
There is a workaround which consists of setting an environment variable before running the command or in your shell/system environment:

```bash
export NODE_OPTIONS=--openssl-legacy-provider
Expand Down
2 changes: 1 addition & 1 deletion check-md-unused.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const fs = require("fs");
// Constants
//----------------------------------
const excludedFolders = ["./source/blog/**/*", "./source/i18n/**/*"];
const excludedFiles = ["./source/docs/casper/index.md"];
const excludedFiles = ["./source/docs/casper/concepts/about.md"];

//----------------------------------
// Private Vars
Expand Down
48 changes: 39 additions & 9 deletions config/sidebar.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
module.exports = {
concepts: [
"concepts/index",
"concepts/about",
"concepts/intro-to-dapps",
"concepts/accounts-and-keys",
"concepts/hash-types",
"concepts/deploy-and-deploy-lifecycle",
"concepts/global-state",
"concepts/smart-contracts",
"concepts/list-auth-keys",
"concepts/callstack",
"concepts/dictionaries",
"concepts/serialization-standard",
Expand Down Expand Up @@ -34,9 +36,17 @@ module.exports = {
"concepts/economics/consensus",
"concepts/economics/runtime",
"concepts/economics/gas-concepts",
"concepts/economics/concepts",
"concepts/economics/staking",
"concepts/economics/delegation",
{
type: "category",
label: "Staking",
collapsible: true,
collapsed: true,
link: {
type: "doc",
id: "concepts/economics/staking/concepts",
},
items: ["concepts/economics/staking/staking", "concepts/economics/staking/delegation"],
},
],
},
{
Expand Down Expand Up @@ -80,7 +90,6 @@ module.exports = {
],
developers: [
"developers/index",
"developers/table-of-contents",
"developers/prerequisites",
{
type: "category",
Expand Down Expand Up @@ -154,19 +163,19 @@ module.exports = {
],
},
"developers/dapps/technology-stack",
"developers/dapps/setup-nctl",
"developers/dapps/nctl-test",
"developers/dapps/template-frontend",
"developers/dapps/signing-a-deploy",
"developers/dapps/sending-deploys",
"developers/dapps/speculative-exec",
"developers/dapps/setup-nctl",
"developers/dapps/nctl-test",
//"developers/dapps/signer-integration",
//"developers/dapps/callstack-based", // NEW CONTENT WILL BE HERE
"developers/dapps/monitor-and-consume-events",
],
},
{
type: "category",
label: "Interacting with the Blockchain using CLI",
label: "Interacting with the Blockchain",
collapsible: true,
collapsed: true,
link: {
Expand All @@ -190,8 +199,11 @@ module.exports = {
],
},
"developers/cli/delegate",
"developers/cli/redelegate",
"developers/cli/undelegate",
"developers/cli/sending-deploys",
"developers/cli/installing-contracts",
"developers/cli/querying-global-state",
"developers/cli/calling-contracts",
"developers/cli/execution-error-codes",
],
Expand All @@ -213,6 +225,7 @@ module.exports = {
"operators/setup/basic-node-configuration",
"operators/setup/node-endpoints",
"operators/setup/install-node",
"operators/setup/fast-sync",
"operators/setup/open-files",
"operators/setup/upgrade",
"operators/setup/joining",
Expand Down Expand Up @@ -244,7 +257,12 @@ module.exports = {
type: "doc",
id: "operators/setup-network/index",
},
items: ["operators/setup-network/chain-spec", "operators/setup-network/create-private", "operators/setup-network/staging-files-for-new-network"],
items: [
"operators/setup-network/genesis",
"operators/setup-network/chain-spec",
"operators/setup-network/create-private",
"operators/setup-network/staging-files-for-new-network",
],
},
{
type: "category",
Expand Down Expand Up @@ -322,7 +340,19 @@ module.exports = {
},
items: [
"resources/advanced/two-party-multi-sig",
{
type: "category",
label: "Multi-Sig Management",
collapsible: true,
collapsed: true,
items: [
"resources/advanced/multi-sig/index",
"resources/advanced/multi-sig/multi-sig-workflow",
"resources/advanced/multi-sig/other-scenarios",
],
},
"resources/advanced/return-values-tutorial",
"resources/advanced/list-auth-keys-tutorial",
"resources/advanced/transfer-token-to-contract",
"resources/advanced/storage-workflow",
"resources/advanced/cross-contract",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
---
id: welcome
title: Welcome
title: What is Casper?
slug: /
---

## What is Casper? {#what-is-casper}

Casper is a new [Turing-complete](./concepts/glossary/T.md#turing-complete-blockchain) smart-contracting platform, backed by a Proof-of-Stake (PoS) consensus algorithm and WebAssembly (Wasm). The network is a [permissionless](./concepts/glossary/P.md#permissionless), decentralized, public blockchain.
Casper is a new [Turing-complete](../concepts/glossary/T.md#turing-complete-blockchain) smart-contracting platform, backed by a Proof-of-Stake (PoS) consensus algorithm and WebAssembly (Wasm). The network is a [permissionless](../concepts/glossary/P.md#permissionless), decentralized, public blockchain.

The network's consensus protocol is called [Highway](https://arxiv.org/pdf/2101.02159.pdf), and it has several benefits over classic Byzantine Fault Tolerant (BFT) consensus protocols. First, Highway allows networks to reach higher thresholds of _finality_, meaning that more blocks are finalized, and validators agree to add them to the blockchain. Second, the protocol achieves flexibility by expressing block finality in ways not possible in BFT models. This protocol is built on the [correct-by-construction (CBC) Casper](https://github.com/cbc-casper/cbc-casper-paper) research.

Additionally, the Casper Network is optimized for enterprise and developer adoption. While leveraging blockchain technology, the network seeks to accelerate business operations via unique features like predictable network fees, upgradeable contracts, on-chain governance, privacy flexibility, and developer-friendly languages. Casper's [core features and strengths](./resources/build-on-casper.md) enable developers and enterprises to reap the benefits of blockchain technology.
Additionally, the Casper Network is optimized for enterprise and developer adoption. While leveraging blockchain technology, the network seeks to accelerate business operations via unique features like predictable network fees, upgradeable contracts, on-chain governance, privacy flexibility, and developer-friendly languages. Casper's [core features and strengths](../resources/build-on-casper.md) enable developers and enterprises to reap the benefits of blockchain technology.

Casper also solves the scalability trilemma. Notably, the network is optimized for security, decentralization, and high throughput. All this is achieved while evolving to provide leading solutions for open-source projects and enterprises.

## How does Casper work? {#how-does-casper-work}

Casper relies on a group of validators to verify transactions and uphold the network. Unlike Proof-of-Work networks, which need to centralize validators for economies of scale, Casper allows for the geographical decentralization of validators. Casper validators verify transactions based on staked tokens and receive CSPR rewards for participating in the PoS consensus mechanism. CSPR is the native token on the Casper Network.

To understand the design further, read [this article](../concepts/design/casper-design.md).

## Other Sections
## Disclaimer

- [Disclaimer](./disclaimer.md): Legal Disclaimer
Read the [Legal Disclaimer](../disclaimer.md) regarding this CasperLabs Tech Spec (this "Whitepaper").
2 changes: 1 addition & 1 deletion source/docs/casper/concepts/accounts-and-keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ casper-client get-account-info --help

### Using a block explorer

Using the [cspr.live](http://cspr.live) block explorer, open the Account in question, and expand the `Raw Data` section. Look for the `main_purse` field and find the corresponding URef. If you do not see data in the `Raw Data` section, then the account has not been funded yet.
Using the block explorer for [Mainnet](https://cspr.live/) or [Testnet](https://testnet.cspr.live/), open the Account in question, and expand the `Raw Data` section. Look for the `main_purse` field and find the corresponding URef. If you do not see data in the `Raw Data` section, then the account has not been funded yet.

<p align="center">
<img src={"/image/design/main_purse_uref.png"} alt="Image showing an account's main purse" width="500"/>
Expand Down
10 changes: 5 additions & 5 deletions source/docs/casper/concepts/callstack.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ import useBaseUrl from '@docusaurus/useBaseUrl';

# Understanding Call Stacks

Users wishing to interact with a Casper network must do so through [sending a Deploy](../developers/dapps/sending-deploys.md). All Deploys consist of [session code](../developers/writing-onchain-code/writing-session-code.md) run in the context of the user account that sent the Deploy. The session code may [install contract code to global state](../developers/cli/installing-contracts.md), or interact with previously [installed contract code](../developers/writing-onchain-code/calling-contracts.md).
Users wishing to interact with a Casper network must do so through [sending a Deploy](../developers/cli/sending-deploys.md). All Deploys consist of [session code](../developers/writing-onchain-code/writing-session-code.md) run in the context of the user account that sent the Deploy. The session code may [install contract code to global state](../developers/cli/installing-contracts.md), or interact with previously [installed contract code](../developers/writing-onchain-code/calling-contracts.md).

When the session code within a Deploy interacts with one or more contracts, this is the beginning of a [`Call Stack`](https://docs.rs/casper-types/latest/casper_types/system/enum.CallStackElement.html). A call stack is the chronological order in which contracts call other contracts, initiated by an instance of session code.

## The Caller

In every instance of a call stack, the originating caller is the session code within the account's context that began the interaction. Contract code cannot spontaneously act without session code to activate it. As such, the session code represents the *zeroth* entity in each call stack.
In every instance of a call stack, the originating caller is the session code within the account's context that began the interaction. Contract code cannot spontaneously act without session code to activate it. As such, the session code represents the *zeroth* entity in each call stack. The account that initiated the deploy can be retrieved with the [contract_api::runtime::get_caller](https://docs.rs/casper-contract/3.0.0/casper_contract/contract_api/runtime/fn.get_caller.html) function.

## The Immediate Caller
## The Call Stack

The [immediate caller](https://docs.rs/casper-types/1.5.0/casper_types/system/mint/trait.RuntimeProvider.html#tymethod.get_immediate_caller) is the caller that interacted directly with the contract in question.
Developers can access the call stack with the [contract_api::runtime::get_call_stack](https://docs.rs/casper-contract/3.0.0/casper_contract/contract_api/runtime/fn.get_call_stack.html) function.

If session code calls a contract, which in turn calls another contract, then the session code would represent the *zeroth* entity in the stack, the contract called by the initiating session code would be the *first* and the contract called by the first contract would be the *second*.

In this example, the first contract would be the `immediate caller` of the second contract. The session code would remain the `caller`.
In this example, the first contract would be the `immediate caller` of the second contract, meaning it interacted directly with it. The session code would remain the `caller`.

<img class="align-center" src={useBaseUrl("/image/callstack.png")} width="450" alt="Call Stack" />

Expand Down
2 changes: 1 addition & 1 deletion source/docs/casper/concepts/deploy-and-deploy-lifecycle.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Deploys and the Deploy Lifecycle
title: Deploy Lifecycle
slug: /deploy-and-deploy-lifecycle
---

Expand Down
10 changes: 7 additions & 3 deletions source/docs/casper/concepts/design/casper-design.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Overview of a Casper Network
---
title: Network Design
---

# Casper Network Design

## Introduction

Expand Down Expand Up @@ -44,7 +48,7 @@ A Wasm module is not natively able to create any effects outside of reading or w

![Casper Network Runtime](/image/design/casper-runtime.png)

All these features are accessible via functions in the [Casper External FFI](https://docs.rs/casper-contract/1.4.4/casper_contract/ext_ffi/index.html).
All these features are accessible via functions in the [Casper External FFI](https://docs.rs/casper-contract/latest/casper_contract/ext_ffi/index.html).

#### Generating `URef`s {#execution-semantics-urefs}

Expand Down Expand Up @@ -225,7 +229,7 @@ Refer to the [Serialization Standard](../serialization-standard.md) for addition

## Tokens {#tokens-head}

Casper is a decentralized Proof-of-Stake blockchain platform that uses a consensus algorithm called [Highway](./highway.md). Having a unit of value is required to make this system work because users must pay for computation, and validators must have [stake](../economics/staking.md) to bond. In the blockchain space, this unit of value is a _token_.
Casper is a decentralized Proof-of-Stake blockchain platform that uses a consensus algorithm called [Highway](./highway.md). Having a unit of value is required to make this system work because users must pay for computation, and validators must have [stake](../economics/staking/staking.md) to bond. In the blockchain space, this unit of value is a _token_.

This chapter describes tokens and how one can use them on the Casper platform.

Expand Down
4 changes: 4 additions & 0 deletions source/docs/casper/concepts/design/highway.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
title: Highway Consensus
---

# The Highway Consensus Protocol

## What is Consensus?
Expand Down
Loading

0 comments on commit e2730be

Please sign in to comment.