Skip to content

Commit 2db9146

Browse files
authored
Merge pull request #90 from casper-network/dev
PR to merge PR#89 changes from `dev` to `main`
2 parents 77f787b + 2279582 commit 2db9146

File tree

15 files changed

+318
-196
lines changed

15 files changed

+318
-196
lines changed

condor/jsonrpc-comp/rpc-2.0/schema.json.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"title": "Client API of Casper Node",
77
"description": "This describes the JSON-RPC 2.0 API of a node on the Casper network.",
88
"contact": {
9-
"name": "Casper Labs",
10-
"url": "https://casperlabs.io"
9+
"name": "Casper Association",
10+
"url": "https://docs.casper.network"
1111
},
1212
"license": {
1313
"name": "APACHE LICENSE, VERSION 2.0",

docs/concepts/economics/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ The fee elimination model will be different from the refund model introduced on
5959

6060
## Ecosystem {#ecosystem}
6161

62-
The ecosystem layer encompasses dApp design and operation. Casper Labs maintains multiple partnerships with prospective dApp developers, and we anticipate devoting significant resources to research the economics of prospective dApps.
62+
The ecosystem layer encompasses dApp design and operation. Casper Association maintains multiple partnerships with prospective dApp developers, and we anticipate devoting significant resources to research the economics of prospective dApps.
6363

6464
## Macroeconomy {#macroeconomy}
6565

docs/concepts/glossary/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ slug: /glossary
55

66
# Glossary
77

8-
These definitions are correct in the context of the Casper Labs. They may (and probably will) have slightly different semantics in other contexts, including other blockchain contexts.
8+
These definitions are correct in the context of the Casper Association. They may (and probably will) have slightly different semantics in other contexts, including other blockchain contexts.
99

1010
---
1111

docs/concepts/serialization/primitives.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ enum CLType {
2121
String, // e.g. "Hello, World!"
2222
URef, // unforgeable reference (see above)
2323
Key, // global state key (see above)
24-
PublicKey // A Casper system PublicKey type
24+
PublicKey, // A Casper system PublicKey type
2525
Option(CLType), // optional value of the given type
2626
List(CLType), // list of values of the given type (e.g. Vec in rust)
2727
ByteArray(CLType, u32), // same as `List` above, but number of elements

docs/concepts/serialization/structures.md

Lines changed: 88 additions & 126 deletions
Large diffs are not rendered by default.

docs/concepts/serialization/types.md

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ Hex-encoded bytes serialized as a `u32` value describing the length of the bytes
214214

215215
## ByteCodeKind
216216

217-
The type of byte code, serialized as a single `u8` value. A `0` indicates empty byte code, while a `1` indicates a `V1CasperWasm` to be executed with the first version of the Casper execution engine.
217+
The type of byte code, serialized as a single `u8` value. A `0` indicates empty byte code. `1` indicates a `V1CasperWasm` to be executed with the first version of the Casper execution engine. `2` indicates a `V2CasperWasm` to be executed with the second version of the Casper execution engine.
218218

219219
## Caller {#caller}
220220

@@ -252,6 +252,9 @@ ChainspecRegistry is a unique key variant which contains a mapping of file names
252252

253253
The checksum registry. It serializes as a `BTreeMap` where the first 4 bytes represent a `u32` value describing the number of checksum names as strings and [digests](#digest) held within. The remainder consists of a repeating pattern of serialized strings and then digests of the length dictated by the first four bytes.
254254

255+
## ContractRuntimeTag {#contract-runtime-tag}
256+
A tag for the contracts runtime tag, serialized as a single `u8` tag of 0 for `VmCasperV1`, 1 for `VmCasperV2`.
257+
255258
## Delegator {#delegator}
256259

257260
Represents a party delegating their stake to a validator (or "delegatee"). The structure consists of the following fields:
@@ -378,9 +381,9 @@ The context of method execution. It serializes as one of the following:
378381

379382
- `Caller`: Serializes as a single `u8`, `0b00000000`
380383

381-
- `Called`: Serializes as a single `u8`, `0b00000001`
384+
- `DirectInvocationOnly`: Serializes as a single `u8`, `0b00000001`
382385

383-
- `Factory`: Serializes as a single `u8`, `0b10000000`
386+
- `SelfOnward`: Serializes as a single `u8`, `0b10000000`
384387

385388
## EntrypointV2
386389

@@ -486,10 +489,6 @@ A (labeled) "user group". Each method of a versioned contract may be associated
486489

487490
They are serialized as a `BTreeMap` where the first 4 bytes represent a `u32` value describing the number of user groups and `BTreeSets` of [`URef`](./primitives.md#clvalue-uref)s held within. The remainder consists of a repeating pattern of serialized user groups and `BTreeSets` of the length dictated by the first four bytes.
488491

489-
## InitiatorAddr {#initiatoraddr}
490-
491-
The address of the initiator of a [`TransactionV1`](./structures.md#transactionV1), which serializes as a `u8` of `0` followed by a [`PublicKey`](#publickey) or a `1` followed by an [`AccountHash`](#account-hash).
492-
493492
## Keys {#serialization-standard-state-keys}
494493

495494
A _key_ in [Global State](../design/casper-design.md) is one of the following data types:
@@ -687,23 +686,6 @@ The lock status of the package, serialized as a [`boolean`](./primitives.md#clva
687686

688687
Parameter to a method, structured as a name followed by a `CLType`. It is serialized as a [`String`](./primitives.md#clvalue-string) followed by a [`CLType`](./primitives.md#clvalue-cltype).
689688

690-
## PricingMode {#pricingmode}
691-
692-
The pricing mode of a transaction, with two possible variants. It serializes as a `u8` tag followed by additional data based on the following table:
693-
694-
| Tag | PricingMode| Description |
695-
| --- | ---------- | ----------- |
696-
| 0 | Classic | The original payment model, in which the creator of a transaction specifies how much they will pay and at which gas price. |
697-
| 1 | Fixed | The cost of the transaction is determined by the cost table, per the transaction kind. |
698-
699-
### Classic {#pricingmode-classic}
700-
701-
After the `0` tag, a `Classic` `PricingMode` serializes as the [`u64`](./primitives.md#clvalue-numeric) `payment_amount` followed by the `u64` value of the `gas_price`.
702-
703-
### Fixed {#pricingmode-fixed}
704-
705-
After the `1` tag, a `Fixed` `PricingMode` serializes as the [`u64`](./primitives.md#clvalue-numeric) `gas_price_tolerance`.
706-
707689
## ProtocolVersion {#protocolversion}
708690

709691
A newtype indicating the Casper Platform protocol version. It is serialized as three [`u32`](./primitives.md#clvalue-numeric) values indicating major, minor and patch versions in that order.
@@ -770,9 +752,9 @@ Entity types for system contracts, serialized as a single `u8` tag identifying t
770752
| Tag | System Contract |
771753
| --- | --------------- |
772754
| 0 | `Mint` |
773-
| 1 | `Auction` |
755+
| 1 | `HandlePayment` |
774756
| 2 | `StandardPayment` |
775-
| 3 | `HandlePayment` |
757+
| 3 | `Auction` |
776758

777759
## TimeDiff {#timediff}
778760

docs/developers/cli/opcode-costs.md

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,166 @@ The static cost is a **fixed cost for each opcode that is hardcoded** and **vali
1111

1212
If you are building for a private network or other instance of Casper, you will need to verify these costs in the associated `chainspec.toml`.
1313

14+
## OpCodeCosts
15+
16+
|Attribute |Description | Cost |
17+
|----------------- |-----------------------------------------------|-----------------|
18+
|bit | Bit operations multiplier. | 300 |
19+
|add | Arithmetic add operations multiplier. | 210|
20+
|mul | Mul operations multiplier. | 240|
21+
|div | Div operations multiplier. | 320|
22+
|load | Memory load operation multiplier. | 2_500|
23+
|store |Memory store operation multiplier. | 4_700|
24+
|const | Const store operation multiplier. | 110|
25+
|local | Local operations multiplier. | 390|
26+
|global | Global operations multiplier. | 390|
27+
|integer_comparison | Integer operations multiplier. | 250|
28+
|conversion | Conversion operations multiplier. | 420|
29+
|unreachable | Unreachable operation multiplier. | 270|
30+
|nop | Nop operation multiplier. | 200|
31+
|current_memory | Get the current memory operation multiplier. | 290|
32+
|grow_memory | Grow memory cost per page (64 kB). | 240_000|
33+
34+
## ControlFlowCost
35+
36+
|Attribute |Description | Cost |
37+
|----------------- |-----------------------------------------------|-----------------|
38+
|block | Cost for `block` opcode. | 440|
39+
|loop | Cost for `loop` opcode. | 440|
40+
|if | Cost for `if` opcode. | 440|
41+
|else | Cost for `else` opcode. | 440|
42+
|end | Cost for `end` opcode. | 440|
43+
|br | Cost for `br` opcode. | 35_000|
44+
|br_if | Cost for `br_if` opcode. | 35_000|
45+
|return | Cost for `return` opcode. | 440|
46+
|select | Cost for `select` opcode. | 440|
47+
|call | Cost for `call` opcode. | 68_000|
48+
|call_indirect | Cost for `call_indirect` opcode. | 68_000|
49+
|drop | Cost for `drop` opcode. | 440|
50+
51+
## `Br_Table` OpCode Costs
52+
53+
|Attribute |Description | Cost |
54+
|----------------- |-----------------------------------------------|-----------------|
55+
|cost | Fixed cost per `br_table` opcode. | 35_000|
56+
|size_multiplier | Size of target labels in the `br_table` opcode will be multiplied by `size_multiplier`. | 100|
57+
58+
## External Function Costs
59+
60+
The following costs are for low-level bindings for host-side ("external") functions. More information on the Casper external FFI can be found [here](https://docs.rs/casper-contract/latest/casper_contract/ext_ffi/index.html).
61+
62+
|Host-Side Function| Cost | Arguments |
63+
| ---------------- | ---- | --------- |
64+
| add | 5_800 | [0, 0, 0, 0] |
65+
| add_associated_key | 1_200_000 | [0, 0, 0] |
66+
| add_contract_version | 200 | [0, 0, 0, 0, 120_000, 0, 0, 0, 30_000, 0, 0] |
67+
| blake2b | 1_200_000 | [0, 120_000, 0, 0] |
68+
| call_contract | 300_000_000 | [0, 0, 0, 120_000, 0, 120_000, 0] |
69+
| call_versioned_contract | 300_000_000 | [0, 0, 0, 0, 120_000, 0, 120_000, 0] |
70+
| create_contract_package_at_hash | 200 | [0, 0] |
71+
| create_contract_user_group | 200 | [0, 0, 0, 0, 0, 0, 0, 0] |
72+
| create_purse | 2_500_000_000 | [0, 0] |
73+
| disable_contract_version | 200 | [0, 0, 0, 0] |
74+
| get_balance | 3_000_000 | [0, 0, 0] |
75+
| get_blocktime | 330 | [0] |
76+
| get_caller | 380 | [0] |
77+
| get_key | 2_000 | [0, 440, 0, 0, 0] |
78+
| get_main_purse | 1_300 | [0] |
79+
| get_named_arg | 200 | [0, 120_000, 0, 120_000] |
80+
| get_named_arg_size | 200 | [0, 0, 0] |
81+
| get_phase | 710 | [0] |
82+
| get_system_contract | 1_100 | [0, 0, 0] |
83+
| has_key | 1_500 | [0, 840] |
84+
| is_valid_uref | 760 | [0, 0] |
85+
| load_named_keys | 42_000 | [0, 0] |
86+
| new_uref | 17_000 | [0, 0, 590] |
87+
| random_bytes | 200 | [0, 0] |
88+
| print | 20_000 | [0, 4_600] |
89+
| provision_contract_user_group_uref | 200 | [0, 0, 0, 0, 0] |
90+
| put_key | 100_000_000 | [0, 120_000, 0, 120_000] |
91+
| read_host_buffer | 3_500 | [0, 310, 0] |
92+
| read_value | 60_000 | [0, 120_000, 0] |
93+
| read_value_local | 5_500 | [0, 590, 0] |
94+
| remove_associated_key | 4_200 | [0, 0] |
95+
| remove_contract_user_group | 200 | [0, 0, 0, 0] |
96+
| remove_contract_user_group_urefs | 200 | [0, 0, 0, 0, 0, 120_000] |
97+
| remove_key | 61_000 | [0, 3_200] |
98+
| ret | 23_000 | [0, 420_000] |
99+
| revert | 500 | [0] |
100+
| set_action_threshold | 74_000 | [0, 0] |
101+
| transfer_from_purse_to_account | 2_500_000_000 | [0, 0, 0, 0, 0, 0, 0, 0, 0] |
102+
| transfer_from_purse_to_purse | 82_000_000 | [0, 0, 0, 0, 0, 0, 0, 0] |
103+
| transfer_to_account | 2_500_000_000 | [0, 0, 0, 0, 0, 0, 0] |
104+
| update_associated_key | 4_200 | [0, 0, 0] |
105+
| write | 14_000 | [0, 0, 0, 980] |
106+
| dictionary_put | 9_500 | [0, 1_800, 0, 520] |
107+
| enable_contract_version | 200 | [0, 0, 0, 0] |
108+
| manage_message_topic | 200 | [0, 30_000, 0, 0] |
109+
| emit_message | 200 | [0, 30_000, 0, 120_000] |
110+
| cost_increase_per_message | 50 | |
111+
112+
### `Auction` System Contract Costs
113+
114+
These are the costs of calling `auction` system contract entrypoints.
115+
116+
|Entrypoint |Description | Cost |
117+
|----------------- |-----------------------------------------------|-----------------|
118+
|get_era_validators | Cost of calling the `get_era_validators` entrypoint. | 10_000|
119+
|read_seigniorage_recipients | Cost of calling the `read_seigniorage_recipients` entrypoint. | 10_000|
120+
|add_bid | Cost of calling the `add_bid` entrypoint. | 2_500_000_000|
121+
|withdraw_bid | Cost of calling the `withdraw_bid` entrypoint. | 2_500_000_000|
122+
|delegate | Cost of calling the `delegate` entrypoint. | 2_500_000_000|
123+
|undelegate | Cost of calling the `undelegate` entrypoint. | 2_500_000_000|
124+
|run_auction | Cost of calling the `run_auction` entrypoint. | 10_000|
125+
|slash | Cost of calling the `slash` entrypoint. | 10_000|
126+
|distribute | Cost of calling the `distribute` entrypoint. | 10_000|
127+
|withdraw_delegator_reward | Cost of calling the `withdraw_delegator_reward` entrypoint. | 10_000|
128+
|withdraw_validator_reward | Cost of calling the `withdraw_validator_reward` entrypoint. | 10_000|
129+
|read_era_id | Cost of calling the `read_era_id` entrypoint. | 10_000|
130+
|activate_bid | Cost of calling the `activate_bid` entrypoint. | 10_000|
131+
|redelegate | Cost of calling the `redelegate` entrypoint. | 2_500_000_000|
132+
|change_bid_public_key | Cost of calling the `change_bid_public_key` entrypoint. | 5_000_000_000 |
133+
134+
### `Mint` System Contract Costs
135+
136+
These are the costs of calling `mint` system contract entrypoints.
137+
138+
|Entrypoint |Description | Cost |
139+
|----------------- |-----------------------------------------------|-----------------|
140+
|mint | Cost of calling the `mint` entrypoint. | 2_500_000_000|
141+
|reduce_total_supply | Cost of calling the `reduce_total_supply` entrypoint. | 10_000|
142+
|create | Cost of calling the `create` entrypoint. | 2_500_000_000|
143+
|balance | Cost of calling the `balance` entrypoint. | 10_000|
144+
|burn | Cost of calling the `burn` entrypoint. | 10_000|
145+
|transfer | Cost of calling the `transfer` entrypoint. | 10_000|
146+
|read_base_round_reward | Cost of calling the `read_base_round_reward` entrypoint. | 10_000|
147+
|mint_into_existing_purse | Cost of calling the `mint_into_existing_purse` entrypoint. | 2_500_000_000|
148+
149+
150+
### `Handle_Payment` System Contract Costs
151+
152+
These are the costs of calling entrypoints on the `handle_payment` system contract.
153+
154+
|Entrypoint |Description | Cost |
155+
|----------------- |-----------------------------------------------|-----------------|
156+
|get_payment_purse | Cost of calling the `get_payment_purse` entrypoint. |10_000|
157+
|set_refund_purse | Cost of calling the `set_refund_purse` entrypoint. |10_000|
158+
|get_refund_purse | Cost of calling the `get_refund_purse` entrypoint. |10_000|
159+
|finalize_payment | Cost of calling the `finalize_payment` entrypoint. |10_000|
160+
161+
### `Standard_Payment` System Contract Costs
162+
163+
These settings manage the costs of calling entrypoints on the `standard_payment` system contract.
164+
165+
|Entrypoint |Description | Cost |
166+
|----------------- |-----------------------------------------------|-----------------|
167+
|pay| Cost of calling the `pay` entrypoint and sending an amount to a payment purse. |10_000|
168+
169+
## StorageCosts
170+
171+
|Attribute |Description | Cost |
172+
|----------------- |-----------------------------------------------|-----------------|
173+
|gas_per_byte | Gas charged per byte stored in global state. | 1_117_587|
14174

15175
:::note
16176

docs/operators/setup/install-node.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Ensure the requirements listed in the following sections are met before you star
1111
The following ports are used by the node:
1212

1313
- 35000 (required to be externally visible)
14-
- 7777 RPC endpoint for interaction with JSON-RPC API
14+
- 7777 RPC endpoint for interaction with JSON-RPC API (The default port for JSON-RPC server, is now served by Casper Sidecar from Casper 2.0 onwards)
1515
- 8888 REST endpoint for status and metrics (having this accessible allows your node to be part of network status)
1616
- 9999 SSE endpoint for event stream
1717

@@ -125,9 +125,9 @@ In the past, we have used a lower `trusted_hash`. Connecting at the tip, we now
125125

126126
### Node Address
127127

128-
NODE_ADDR can be set to an IP of a trusted node, or to Casper Labs' public nodes
128+
NODE_ADDR can be set to an IP of a trusted node, or to Casper Association's public nodes
129129

130-
You can find active peers at https://cspr.live/tools/peers or use the following Casper Labs public nodes:
130+
You can find active peers at https://cspr.live/tools/peers or use the following Casper Association public nodes:
131131

132132
* Testnet - NODE_ADDR=https://node.testnet.casper.network
133133

versioned_docs/version-2.0.0/concepts/accounts-and-keys.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ By default, a transactional interaction with the blockchain takes the form of a
1010

1111
The Casper platform supports two types of keys for creating accounts and signing transactions:
1212
- [Ed25519](#eddsa-keys) keys, which use the Edwards-curve Digital Signature Algorithm (EdDSA) and are 66 characters / 33 bytes long and comprising of;
13-
- - `01` - 1 byte prefix (indicates `Ed25519` key type in Casper)
13+
- `01` - 1 byte prefix (indicates `Ed25519` key type in Casper)
1414
- 32 bytes of actual `Ed25519` public key data
1515
- Example: [`01a0d23e084a95cdee9c2fb226d54033d645873a7c7c9739de2158725c7dfe672f`](https://cspr.live/account/01a0d23e084a95cdee9c2fb226d54033d645873a7c7c9739de2158725c7dfe672f)
1616

versioned_docs/version-2.0.0/concepts/economics/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ The fee elimination model will be different from the refund model introduced on
5959

6060
## Ecosystem {#ecosystem}
6161

62-
The ecosystem layer encompasses dApp design and operation. Casper Labs maintains multiple partnerships with prospective dApp developers, and we anticipate devoting significant resources to research the economics of prospective dApps.
62+
The ecosystem layer encompasses dApp design and operation. Casper Association maintains multiple partnerships with prospective dApp developers, and we anticipate devoting significant resources to research the economics of prospective dApps.
6363

6464
## Macroeconomy {#macroeconomy}
6565

0 commit comments

Comments
 (0)