Skip to content

Commit

Permalink
Merge branch 'main' into v9n-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
shawntabrizi authored Aug 27, 2024
2 parents 1ddd472 + e85992d commit a90903e
Show file tree
Hide file tree
Showing 91 changed files with 388 additions and 15,444 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ Default localhost port configuration:
```env
GATSBY_WEBSITE_URL=http://localhost:8100
GATSBY_DOCS_URL=http://localhost:8200
GATSBY_MARKETPLACE_URL=http://localhost:8300
GATSBY_CAREERS_URL=https://careers.substrate.io
```

**Start development server**
Expand Down
14 changes: 1 addition & 13 deletions config/menus.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { MARKETPLACE_URL, WEBSITE_URL, CAREERS_URL } = require('./webConsts.js');
const { WEBSITE_URL } = require('./webConsts.js');

/* the main menu, ids of items must match
the submenu's key of this js object */
Expand Down Expand Up @@ -58,14 +58,6 @@ const developers = [
url: 'https://paritytech.github.io/substrate/master/sc_service/',
id: 'developers.rustdocs',
},
{
url: MARKETPLACE_URL,
id: 'developers.marketplace',
},
{
url: WEBSITE_URL + '/developers/playground/',
id: 'developers.playground',
},
{
url: WEBSITE_URL + '/developers/smart-contracts/',
id: 'developers.smart-contracts',
Expand Down Expand Up @@ -132,10 +124,6 @@ const opportunities = [
url: WEBSITE_URL + '/ecosystem/opportunities/grants',
id: 'ecosystem.opportunities.grants',
},
{
url: CAREERS_URL,
id: 'ecosystem.opportunities.careers',
},
];

const resources = [
Expand Down
4 changes: 1 addition & 3 deletions config/siteMetadata.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const menus = require('./menus.js');
const { WEBSITE_URL, DOCS_URL, MARKETPLACE_URL, CAREERS_URL } = require('./webConsts.js');
const { WEBSITE_URL, DOCS_URL } = require('./webConsts.js');

module.exports = {
menus,
Expand All @@ -10,8 +10,6 @@ module.exports = {
siteUrl: DOCS_URL,
websiteUrl: WEBSITE_URL,
docsUrl: DOCS_URL,
marketplaceUrl: MARKETPLACE_URL,
careersUrl: CAREERS_URL,
author: 'Parity WebDev/W3F WebOps',
pressEmail: '[email protected]',
email: '[email protected]',
Expand Down
4 changes: 0 additions & 4 deletions config/webConsts.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
const WEBSITE_URL = process.env.GATSBY_WEBSITE_URL;
const DOCS_URL = process.env.GATSBY_DOCS_URL;
const MARKETPLACE_URL = process.env.GATSBY_MARKETPLACE_URL;
const CAREERS_URL = process.env.GATSBY_CAREERS_URL;

module.exports = {
WEBSITE_URL,
DOCS_URL,
MARKETPLACE_URL,
CAREERS_URL,
};
3 changes: 0 additions & 3 deletions content/locales/en/menus.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
"developers.home": "Home",
"developers.docs": "Docs",
"developers.rustdocs": "Rust Docs",
"developers.marketplace": "Marketplace",
"developers.playground": "Playground",
"developers.smart-contracts": "Smart Contracts",
"developers.substrate-connect": "Substrate Connect",
"developers.rococo-network": "Rococo Network",
Expand All @@ -32,7 +30,6 @@

"ecosystem.opportunities.hackathons": "Hackathons",
"ecosystem.opportunities.grants": "Grants",
"ecosystem.opportunities.careers": "Careers",

"ecosystem.resources.seminar": "Substrate Seminar",
"ecosystem.resources.past-seminars": "Past Seminars",
Expand Down
8 changes: 4 additions & 4 deletions content/md/en/docs/build/build-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));

This code includes the compact WebAssembly binary (`WASM_BINARY`) and the uncompressed WebAssembly binary generated by the compiler (`WASM_BINARY_BLOATY`) in its compilation result, and the final executable binary for the project is generated.

At each stage of the build process, the WebAssembly binary is compressed to a smaller and smaller size.
At each stage of the build process, the WebAssembly binary is compressed to a smaller size than earlier.
For example, you can compare the sizes of each WebAssembly binary artifact for Polkadot:

```bash
Expand Down Expand Up @@ -118,7 +118,7 @@ For example, you might want to use the native runtime for initial synchronizatio
To use the native runtime for synchronizing blocks, you can start the node using the `--execution-syncing native` or `--execution-syncing native-else-wasm` command-line option.

For information about using the command-line options to specify an execution strategy for all or specific operations, see [node-template](/reference/command-line-tools/node-template).
For information about the execution strategy variant, see [ExecutionStrategy](https://paritytech.github.io/substrate/master/sp_state_machine/enum.ExecutionStrategy.html)
For information about the execution strategy variant, see [ExecutionStrategy](https://paritytech.github.io/substrate/master/sc_cli/arg_enums/enum.ExecutionStrategy.html)

## Building WebAssembly without a native runtime

Expand All @@ -127,7 +127,7 @@ After an initial WebAssembly runtime is provided, the blob that represents the W
In some rare cases, you might want to compile the WebAssembly target without the native runtime.
For example, if you're testing a WebAssembly runtime to prepare for a forkless upgrade, you might want to compile just the new WebAssembly binary.

Although it's a rare use case, you can use the [build-only-wasm.sh](https://github.com/paritytech/substrate/blob/master/.maintain/build-only-wasm.sh) script to build the `no_std` WebAssembly binary without compiling the native runtime.
Although it's a rare use case, you can use the [build-only-wasm.sh](https://github.com/paritytech/polkadot-sdk/blob/master/substrate/.maintain/build-only-wasm.sh) script to build the `no_std` WebAssembly binary without compiling the native runtime.

You can also use the `wasm-runtime-overrides` command-line option to load the WebAssembly from the file system.

Expand All @@ -138,6 +138,6 @@ This option is primarily used for faster compile time when you don't need to upd

## Where to go next

- [Wasm-builder README](https://github.com/paritytech/substrate/blob/master/utils/wasm-builder/README.md)
- [Wasm-builder source](https://github.com/paritytech/polkadot-sdk/blob/master/substrate/utils/wasm-builder/src/lib.rs)
- [Rust compilation options](https://doc.rust-lang.org/cargo/commands/cargo-build.html#compilation-options)
- [Discussion: Removing the native runtime](https://github.com/paritytech/substrate/issues/10579)
7 changes: 6 additions & 1 deletion content/md/en/docs/build/genesis-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ description:
keywords:
---

<div class="warning">
<strong>⚠️ WARNING:</strong> This page contains outdated information. Please refer to the <a href="https://paritytech.github.io/polkadot-sdk/master/frame_support/pallet_macros/attr.genesis_build.html">Rust docs</a> for the most up-to-date documentation on this topic.
</div>


The first block produced by any blockchain is referred to as the genesis block.
The hash associated with this block is the top-level parent of all blocks produced after that first block.

Expand Down Expand Up @@ -193,7 +198,7 @@ pub struct RuntimeGenesisConfig {

Ultimately, the `RuntimeGenesisConfig` is exposed by way of the [`ChainSpec`](https://paritytech.github.io/substrate/master/sc_chain_spec/trait.ChainSpec.html) trait.

For a more complete example of genesis storage configuration for Substrate, see the [chain specification that ships with the Substrate code base](https://github.com/paritytech/substrate/blob/master/bin/node/cli/src/chain_spec.rs).
For a more complete example of genesis storage configuration for Substrate, see the [chain specification that ships with the Substrate code base](https://github.com/paritytech/polkadot-sdk/blob/master/substrate/bin/node/cli/src/chain_spec.rs).

## Initialize storage items within a pallet

Expand Down
12 changes: 8 additions & 4 deletions content/md/en/docs/build/origins.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ keywords:
- origins
---

<div class="warning">
<strong>⚠️ WARNING:</strong> This page contains outdated information. Please refer to the <a href="https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/reference_docs/frame_origin/index.html">Rust docs</a> for the most up-to-date documentation on this topic.
</div>

The runtime origin is used by dispatchable functions to check where a call has come from.

## Raw origins
Expand Down Expand Up @@ -50,7 +54,7 @@ You can look at the source code of the [Sudo module](https://paritytech.github.i
In addition to the three core origin types, runtime developers are also able to define custom origins.
These can be used as authorization checks inside functions from specific modules in your runtime, or to define custom access-control logic around the sources of runtime requests.

Customizing origins allows runtime developers to specify valid origins depending on their runtime logic. For example, it may be desirable to restrict access of certain functions to special custom origins and authorize dispatch calls only from members of a [collective](https://github.com/paritytech/substrate/tree/master/frame/collective). The advantage of using custom origins is that it provides runtime developers a way to configure privileged access over dispatch calls to the runtime.
Customizing origins allows runtime developers to specify valid origins depending on their runtime logic. For example, it may be desirable to restrict access of certain functions to special custom origins and authorize dispatch calls only from members of a [collective](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame/collective). The advantage of using custom origins is that it provides runtime developers a way to configure privileged access over dispatch calls to the runtime.

## Next steps

Expand All @@ -60,11 +64,11 @@ Customizing origins allows runtime developers to specify valid origins depending

### Examples

- View the [Sudo pallet](https://github.com/paritytech/substrate/tree/master/frame/sudo) to see how it allows a user to call with `Root` and `Signed` origin.
- View the [Sudo pallet](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame/sudo) to see how it allows a user to call with `Root` and `Signed` origin.

- View the [Timestamp pallet](https://github.com/paritytech/substrate/tree/master/frame/timestamp) to see how it validates an a call with `None` origin.
- View the [Timestamp pallet](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame/timestamp) to see how it validates an a call with `None` origin.

- View the [Collective pallet](https://github.com/paritytech/substrate/tree/master/frame/collective) to see how it constructs a custom `Member` origin.
- View the [Collective pallet](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame/collective) to see how it constructs a custom `Member` origin.

- View our recipe for creating and using a custom origin.

Expand Down
15 changes: 12 additions & 3 deletions content/md/en/docs/build/pallet-coupling.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ keywords:
- pallet design
---

<div class="warning">
<p>
<strong>⚠️ WARNING:</strong> This page contains potentially outdated information. Reading it might still be useful, yet we suggest taking it with a grain of salt.
</p>
<p>
Please refer to the <a href="https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/reference_docs/frame_pallet_coupling/index.html">`polkadot-sdk-docs` crate</a> for the most up-to-date documentation on this topic.
</p>
</div>

The term **coupling** is often used to describe the degree to which two software modules depend on each other.
For example, in object-oriented programming tight coupling and loose coupling are used to describe the relationship between objects classes:

Expand Down Expand Up @@ -104,10 +113,10 @@ In general, loose coupling provides more flexibility than tight coupling and is
It guarantees better maintainability, reusability, and extensibility of your code.
However, tight coupling can be useful for pallets that are less complex or that have more overlap in methods and types than differences.

In FRAME, there are two pallets that are tightly coupled to [`pallet_treasury`](https://github.com/paritytech/substrate/tree/master/frame/treasury):
In FRAME, there are two pallets that are tightly coupled to [`pallet_treasury`](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame/treasury):

- [Bounties pallet](https://github.com/paritytech/substrate/tree/master/frame/bounties)
- [Tipping pallet](https://github.com/paritytech/substrate/tree/master/frame/tips)
- [Bounties pallet](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame/bounties)
- [Tipping pallet](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame/tips)

As a general rule, the more complex a pallet is, the less desirable it is to tightly couple it.
This evokes a concept in computer science called [cohesion](<https://en.wikipedia.org/wiki/Cohesion_(computer_science)>), a metric used to examine the overall quality of a software system.
Expand Down
25 changes: 14 additions & 11 deletions content/md/en/docs/build/remote-procedure-calls.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ keywords:
- frontend
---

<div class="warning">
<strong>⚠️ WARNING:</strong> This page may contain outdated information. Please refer to the <a href="https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/reference_docs/custom_runtime_api_rpc/index.html">Rust docs</a> for the most up-to-date documentation on this topic.
</div>

Remote procedure calls, or RPC methods, are a way for an external program—for example, a browser or front-end application—to communicate with a Substrate node.
In general, these methods enable an RPC client to connect to an RPC server endpoint to request some type of service.
For example, you might use an RPC method to read a stored value, submit a transaction, or request information about the chain a node is connected to.
Expand Down Expand Up @@ -55,24 +59,23 @@ The way to do it is through a [JSON-RPC](/reference/glossary#json-rpc) proxy tha

## RPCs for remote_externalities

Substrate also provides some specialized RPC methods to call [`remote_externalities`](https://github.com/paritytech/substrate/blob/master/utils/frame/remote-externalities/src/lib.rs#L320-#L764) for a node.
Substrate also provides some specialized RPC methods to call [`remote_externalities`](https://github.com/paritytech/polkadot-sdk/blob/master/substrate/utils/frame/remote-externalities/src/lib.rs#L347-#L746) for a node.
These specialized methods for remote externalities enable you to make one-off RPC calls to a Substrate node to get information about blocks and headers.
The information returned by these calls can be useful for testing purposes with tools like [`try-runtime`](/reference/command-line-tools/try-runtime/).

## Endpoints

When you start a Substrate node locally, there are two endpoints available by default:
When you start a Substrate node locally, there is one endpoint available by default:

- HTTP endpoint: `http://localhost:9933/`
- WebSocket endpoint: `ws://localhost:9944/`
- HTTP & WebSocket endpoint: `ws://localhost:9944/`

Most of the Substrate front-end libraries and tools use the WebSocket endpoint to interact with the blockchain.
For example, if you use the Polkadot-JS application to connect to a local node or a public chain, your are typically connecting to the WebSocket endpoint.
Most of the Substrate front-end libraries and tools use the endpoint to interact with the blockchain.
For example, if you use the Polkadot-JS application to connect to a local node or a public chain, your are typically connecting to the HTTP & WebSocket endpoint.
WebSocket connections allow for bidirectional communication between the front-end application and the backend node responding to requests.
However, you can also call RPC methods individually without keeping an open communication channel by connecting to the HTTP endpoint using `curl` commands.
However, you can also call RPC methods individually without keeping an open communication channel by connecting to the endpoint using `curl` commands.
For example, you can use curl commands to get system information or subscribe to a chain to receive notification when there are specific types of changes to the block state.

To call RPC methods using the HTTP endpoint:
To call RPC methods using the endpoint:

1. Open a terminal shell and change to the root directory for the Substrate node template.

Expand All @@ -85,7 +88,7 @@ To call RPC methods using the HTTP endpoint:
3. Connect to the local node and call the `rpc_methods` endpoint by running the following command:

```bash
curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "rpc_methods"}' http://localhost:9933/
curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "rpc_methods"}' http://localhost:9944/
```

This command returns a list of the JSON-RPC methods exposed for the local node.
Expand All @@ -95,7 +98,7 @@ To call RPC methods using the HTTP endpoint:
For example, you can run the following command to get version information about the local node:

```bash
curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "system_version"}' http://localhost:9933/
curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "system_version"}' http://localhost:9944/
```

In most cases, connecting to the RPC endpoint directly returns JSON-formatted results.
Expand All @@ -118,7 +121,7 @@ This is how RPC endpoints know where to look.
To get metadata for a local node, you can run the following command:

```bash
curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "state_getMetadata"}' http://localhost:9933/
curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "state_getMetadata"}' http://localhost:9944/
```

This command returns the metadata in hex-encoded bytes rather than a human-readable format.
Expand Down
1 change: 0 additions & 1 deletion content/md/en/docs/build/troubleshoot-your-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ For example:

```text
#[pallet::pallet]
#[pallet::generate_store(pub(super) trait Store)]
#[pallet::without_storage_info]
pub struct Pallet<T>(_);
```
Expand Down
8 changes: 4 additions & 4 deletions content/md/en/docs/build/tx-weights-fees.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ To account for this variability, the Transaction Payment pallet provides the [`F
The default update function is inspired by the Polkadot network and implements a targeted adjustment in which a target saturation level of block weight is defined.
If the previous block is more saturated, then the fees are slightly increased.
Similarly, if the previous block has fewer transactions than the target, fees are decreased by a small amount.
For more information about fee multiplier adjustments, see the [Web3 research page](https://w3f-research.readthedocs.io/en/latest/polkadot/overview/2-token-economics.html#relay-chain-transaction-fees-and-per-block-transaction-limits).
For more information about fee multiplier adjustments, see the [Web3 research page](https://research.web3.foundation/Polkadot/overview/token-economics#relay-chain-transaction-fees-and-per-block-transaction-limits).

## Transactions with special requirements

Expand Down Expand Up @@ -237,12 +237,12 @@ use frame_support:: {
Pays::Yes,
},
weights::Weight,
};

#[pallet::weight(FunctionOf(
|args: (&Vec<User>,)| args.0.len().saturating_mul(10_000),
)
]

fn handle_users(origin, calls: Vec<User>) {
// Do something per user
}
Expand Down Expand Up @@ -397,7 +397,7 @@ You can use Substrate **benchmarking functions** and `frame-benchmarking` calls

- [Benchmark](/test/benchmark/)
- [SignedExtension](https://paritytech.github.io/substrate/master/sp_runtime/traits/trait.SignedExtension.html)
- [Custom weights for the Example pallet](https://github.com/paritytech/substrate/blob/master/frame/examples/basic/src/weights.rs)
- [Web3 Foundation Research](https://w3f-research.readthedocs.io/en/latest/polkadot/overview/2-token-economics.html#relay-chain-transaction-fees-and-per-block-transaction-limits)
- [Custom weights for the Example pallet](https://github.com/paritytech/polkadot-sdk/blob/master/substrate/frame/examples/basic/src/weights.rs)
- [Web3 Foundation Research](https://research.web3.foundation/Polkadot/overview/token-economics#relay-chain-transaction-fees-and-per-block-transaction-limits)

<!-- - [Calculate weight](/reference/how-to-guides/weights/) -->
2 changes: 1 addition & 1 deletion content/md/en/docs/deploy/deployment-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ ENTRYPOINT ["/usr/local/bin/node-template"]

### Automated build pipeline

The following sample [GitHub action](https://github.com/substrate-developer-hub/substrate-node-template/blob/main/.github/workflows/build-publish-image.yml) builds and publishes a Docker image to DockerHub.
The following sample [GitHub action](https://github.com/substrate-developer-hub/substrate-node-template/blob/main/.github/workflows/release.yml) builds and publishes a Docker image to DockerHub.
In most cases, you trigger this action using a manual workflow or when a new release is published.

Note that you must add secrets to your GitHub repository or organization as described in [Encrypted secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets) to publish images securely.
Expand Down
Loading

0 comments on commit a90903e

Please sign in to comment.