Skip to content

Commit

Permalink
Merge branch 'feat-2.0_docs' into 1361_Changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
ACStone-MTS committed Feb 22, 2024
2 parents 330d1a9 + 6ea3050 commit 5991ea0
Show file tree
Hide file tree
Showing 62 changed files with 555 additions and 180 deletions.
2 changes: 1 addition & 1 deletion config/navbar.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module.exports = {
label: "Support",
},
{
href: "https://discord.com/invite/Q38s3Vh",
href: "https://discord.com/invite/casperblockchain",
label: "Chat",
},

Expand Down
3 changes: 2 additions & 1 deletion config/sidebar.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module.exports = {
"concepts/index",
"concepts/about",
"concepts/intro-to-dapps",
"concepts/addressable-entity",
"concepts/accounts-and-keys",
"concepts/hash-types",
"concepts/deploy-and-deploy-lifecycle",
Expand Down Expand Up @@ -430,7 +431,7 @@ module.exports = {
type: "doc",
id: "users/ledger/index",
},
items: ["users/ledger/ledger-setup", "users/ledger/staking-ledger"],
items: ["users/ledger/ledger-setup", "users/ledger/ledger-live", "users/ledger/ledger-cspr-live", "users/ledger/staking-ledger"],
},
],
};
44 changes: 44 additions & 0 deletions source/docs/casper/concepts/addressable-entity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Addressable Entities

## What is an Addressable Entity?

Casper 2.0 introduces the concept of an [`AddressableEntity`](../concepts/glossary/A.md#addressable-entity) that will supplant the individual `Account` and `Contract` types for any new usage.

The merger of the `Account` and `Contract` concepts will allow for some new possibilities that were previously not available individually to `Accounts` or `Contracts`. Within the context for any given `AddressableEntity`, the `EntityType` will identify if it is an `Account`, a user-deployed `SmartContract`, or a `System` contract such as `Mint` or `HandlePayment`.

This `EntityType` will dictate what the addressable entity can and cannot do.

## Account

An addressable entity marked as an `Account` will behave in much the same way as a traditional legacy account on a Casper network. It will have an associated key pair of a `PublicKey` and a secret key, and an `AccountHash` derived from the public key. There is also an associated main purse.

A legacy account will automatically migrate to an addressable entity when it interacts with the network, with no action necessary on the user side. Their key pair will continue functioning as it did prior to the migration. Further, their main purse will remain the same.

## SmartContract

An addressable entity marked as a `SmartContract` will have the same functionality as a legacy contract, but with several new features. The `SmartContract` now possesses a main purse, and may have [associated keys](../concepts/design/casper-design.md#accounts-associated-keys-weights) and action thresholds that behave in the same way as an account. More information on multi-signature management, associated keys, and action thresholds can be found [here](../resources/advanced/multi-sig/multi-sig-workflow.md).

### Contract Self-Payment

In contrast to legacy smart contracts, entrypoints on a `SmartContract` type of `AddressableEntity` will specify whether they pay for themselves or require the caller to pay for their computation.

In the past, a single minimum balance check occurred prior to execution. This balance check ensured that the account sending the deploy held a minimum of 2.5 CSPR to pay the penalty if the execution failed.

In contrast, the new method checks the balance before paying for each step along the way. Each contract involved in the process that pays for itself will reduce the overall liability of the account starting the call chain. The account will still be required to hold the initial full potential gas cost of the deploy slot it uses in its main purse.

As an example, if an account uses a slot with a hard gas cap of 1000 CSPR, it must hold 1000 CSPR when sending the deploy. If this deploy calls a contract entrypoint set to pay for itself, the potential full cost of the deploy drops by the amount that the contract will cover. If we use an example of 150 CSPR, the deploy will now have a maximum potential cost of 850 CSPR, and 150 CSPR will come from the contract's main purse.

However, the caller sending the initial deploy will still have to pay for any computation that the called contract cannot cover. If the contract's main purse runs out of gas, the caller must make up the difference for the last operation taken. Otherwise, execution will cease. The initial 1,000 CSPR liability is not a cost, but a hold, and any unused CSPR will be released to the caller upon successful execution of the deploy.

In the event that the entrypoint is not set to pay for itself, the caller will be responsible for all actions the contract takes as a result of being called.

## System

As part of the migration to Casper 2.0, system contracts (`Mint`, `Auction` and `HandlePayment`) will migrate to a special type of addressable entity with the `EntityType` of `System`. The `StandardPayment` system contract will be pruned away.

### Further Reading

- [Accounts and Keys](../concepts/accounts-and-keys.md)
- [Smart Contracts](../concepts/smart-contracts.md)
- [Hash Types](../concepts/hash-types.md)
- [Multi-Signature Management](../resources/advanced/multi-sig/index.md)
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ For example, the chainspec file in release 1.3.2 will contain the following info

Delegation fees may change over time, so, it is essential to stay up to date. To do so, select the latest release in [Github](https://github.com/casper-network/casper-node), and navigate to the chainspec.toml file.

If you are unsure about anything, please join the [Discord channel](https://discord.com/invite/PjAQVXRx4Y) to ask us questions.
If you are unsure about anything, please join the [Discord channel](https://discord.com/invite/casperblockchain) to ask us questions.

## First-time Delegation

Expand Down
4 changes: 4 additions & 0 deletions source/docs/casper/concepts/glossary/A.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ An Account is a structure that represents a user on a Casper network. Informatio

The account hash is a 32-byte hash of the public key representing the user account. Information on generating an account hash can be found [here](https://support.casperlabs.io/hc/en-gb/articles/13781616975131-How-do-I-generate-an-account-hash-).

## Addressable Entity {#addressable-entity}

An addressable entity is a post-2.0 type that merges the concept of an `Account` and a `Contract`, bringing in features from both. More information can be found [here](../addressable-entity.md).

## AssemblyScript {#assemblyscript}

AssemblyScript is a TypeScript-based programming language (JavaScript with static types) that is optimized for WebAssembly and compiled to WebAssembly using _asc_, the reference AssemblyScript compiler. It is developed by the AssemblyScript Project and the AssemblyScript community.
Expand Down
8 changes: 6 additions & 2 deletions source/docs/casper/concepts/hash-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ For the sake of user convenience and compatibility, we expect the delivery of ha
|Key::ChainspecRegistry | chainspec-registry- | chainspec-registry-11111111111111111111111111111111 |
|Key::ChecksumRegistry | checksum-registry- | checksum-registry-00000000000000000000000000000000 |
|Key::BidAddr | bid-addr- | `Unified` bid-addr-00ef4687f74d465826239bab05c4e1bdd2223dd8c201b96f361f775125e624ef70, `Validator` bid-addr-01ef4687f74d465826239bab05c4e1bdd2223dd8c201b96f361f775125e624ef70, `Delegator` bid-addr-02ef4687f74d465826239bab05c4e1bdd2223dd8c201b96f361f775125e624ef70ef4687f74d465826239bab05c4e1bdd2223dd8c201b96f361f775125e624ef70 |
|Key::Package | package- | package-2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a|
|Key::AddressableEntity | addressable-entity- | `Account` addressable-entity-account-2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a, `System` addressable-entity-system-2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a, `SmartContract` addressable-entity-contract-2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a|
|Key::ByteCode | byte-code- | `v1-wasm` byte-code-v1-wasm-2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a, `empty` byte-code-empty-2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a|
|Key::Message | message- | message-2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a-topic-name-0202020202020202020202020202020202020202020202020202020202020202-f |

## Hash and Key Explanations {#hash-and-key-explanations}

Expand Down Expand Up @@ -59,6 +63,6 @@ For the sake of user convenience and compatibility, we expect the delivery of ha
- `Key::ChecksumRegistry` is a unique `key` variant under which we write a registry of checksums for a given block. There are two checksums in the registry, one for the execution results and the other for the approvals of all deploys in the block.
- `Key::BidAddr` manages data associated with bids for the `Auction` contract. It may be any one of three variants: `unified`, `validator`, or `delegator`.
- `Key::Package` is a `Key` under which package information is stored.
- `Key::AddressableEntity` is a `Key` under which an [`AddressableEntity`](/developers/json-rpc/types_chain.md/#addressableentity) is stored.
- `Key::ByteCode` is a `Key` under which a byte code record is stored.
- `Key::AddressableEntity` is a `Key` under which an [`AddressableEntity`](/developers/json-rpc/types_chain.md/#addressableentity) is stored. It may be one of three variants: `Account`, `System` or `SmartContract`.
- `Key::ByteCode` is a `Key` under which a byte code record is stored. It may be one of two variants: `v1-wasm` or `empty`.
- `Key::Message` is a `Key` under which a message is stored.
11 changes: 2 additions & 9 deletions source/docs/casper/developers/dapps/sdk/python-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,11 @@ The [Python SDK](https://github.com/casper-network/casper-python-sdk) allows dev

## Installation

Before installing the library, you need to install dependencies from [requirements.txt](https://github.com/casper-network/casper-python-sdk/blob/main/requirements.txt), which you can perform by running the following command:
To install the library, run:

```bash

pip install -r requirements.txt
```

Finally, to install the library, run:

```bash

pip install pycspr
pip3 install pycspr
```

## Tests
Expand Down
26 changes: 19 additions & 7 deletions source/docs/casper/developers/json-rpc/types_chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,23 @@ The first era to which the associated protocol version applies.

## AddressableEntity {#addressableentity}

* [`package_hash`](#packagehash)
* [`action_thresholds`](#actionthresholds)

* [`associated_keys`](#associatedkeys)

* [`byte_code_hash`](#bytecodehash)

* [`named_keys`](#namedkeys)
* [`entity_kind`](#entitykind)

* [`entry_points`](#array_of_namedentrypoint)

* [`protocol_version`](#protocolversion)

* [`main_purse`](#uref)

* [`associated_keys`](#associatedkeys)
* [`message_topics`](#array_of_messagetopic)

* [`action_thresholds`](#actionthresholds)
* [`package_hash`](#packagehash)

* [`message_topics`](#array_of_messagetopic)
* [`protocol_version`](#protocolversion)

## AddressableEntityHash {#addressableentityhash}

Expand Down Expand Up @@ -622,6 +622,18 @@ Required Parameters:

A log of all [transforms](#tranform) produced during execution.

## EntityKind {#entitykind}

The type of [`Package`](#package).

One of:

* [`System`](#systementitytype)

* [`Account`](#accounthash)

* `SmartContract` Packages associated with Wasm stored on chain.

## EntityVersionAndHash {#entityversionandhash}

An entity version associated with the given hash.
Expand Down
2 changes: 1 addition & 1 deletion source/docs/casper/developers/prerequisites.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This page covers the necessary software for your Casper development environment.

:::caution

Casper does not officially support `macOS`. If you encounter any problems, reach out to the community on [Telegram](https://t.me/casperblockchain) or [Discord](https://discord.com/invite/Q38s3Vh).
Casper does not officially support `macOS`. If you encounter any problems, reach out to the community on [Telegram](https://t.me/casperblockchain) or [Discord](https://discord.com/invite/casperblockchain).

:::

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ To check if your node is in sync, compare the current block height at [https://c
curl -s localhost:8888/status | jq .last_added_block_info
```

If you cannot figure out the issue, ask for help in the *node-tech-support* channel on [Discord](https://discord.com/invite/Q38s3Vh).

If you cannot figure out the issue, ask for help in the *node-tech-support* channel on [Discord](https://discord.com/invite/casperblockchain).

## Activating the Bid

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ slug: /resources/tutorials/advanced/transfer-token-to-contract

This tutorial covers two methods to handle tokens via a contract. This is not a native process to a Casper network and will require the use of custom code. The following two scenarios provide a framework for developers and the pros and cons of each example. Developers should choose the option that best suits their individual needs.

For increased security, token transfers from a main purse must be handled via session code (WASM), as shown [here](../../developers/writing-onchain-code/writing-session-code.md#example-3-transfers-using-session-code-transfers-using-session-code). Therefore, `transfer-*` methods are unavailable in stored WASM for tokens originating from an account's main purse, even when the stored WASM runs in the account context.

## Scenario 1 - Creating a Throw-Away Purse {#scenario1}

The first scenario involves the use of a single-use, throw-away purse. The caller creates and funds a purse independent of their main purse, before passing the URef to the callee.
Expand Down
2 changes: 1 addition & 1 deletion source/docs/casper/resources/tokens/cep18/full-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ This section briefly explains the contract methods used in the Casper Fungible T

To see the full implementation of the below contract methods, refer to the [contract file](https://github.com/casper-ecosystem/cep18/blob/master/cep18/src/main.rs) in Github. If you have any questions, review the [casper_erc20](https://docs.rs/casper-erc20-crate/latest/casper_erc20_crate/) library and the [EIP-20](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md#) standard.

Also, for further unresolved issues please contact the Casper support team via the [Discord channel](https://discord.com/invite/Q38s3Vh).
Also, for further unresolved issues please contact the Casper support team via the [Discord channel](https://discord.com/invite/casperblockchain).

Contract methods are:

Expand Down
8 changes: 5 additions & 3 deletions source/docs/casper/users/ledger/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ title: Casper on Ledger

# Using Ledger with Casper

| Topic | Description |
| ----------------------------------------------------- | ----------------------------------------------- |
| [Ledger Setup with Casper](./ledger-setup.md) | Connect a Ledger device to a Casper account using the CSPR.live block explorer |
| Topic | Description |
| ----------------------------------------------------- | --------------------------------------------------- |
| [Ledger Setup with Casper](./ledger-setup.md) | Connect a Ledger device to the Casper application |
| [Using Ledger and Ledger Live](./ledger-live.md) | Send and receive CSPR using Ledger and Ledger Live |
| [Using Ledger and CSPR.live](./ledger-cspr-live.md) | Send and receive CSPR using Ledger and CSPR.live |
| [Delegating with Ledger Devices](./staking-ledger.md) | Delegate tokens using a Ledger device and CSPR.live |

Loading

0 comments on commit 5991ea0

Please sign in to comment.