标签: substrate

无法指定“edition2021”以便在 Rust 中使用不稳定的包

我想通过 Cargo 运行一个示例,但遇到错误:

error: failed to parse manifest at `/Users/aviralsrivastava/dev/subxt/Cargo.toml`
Run Code Online (Sandbox Code Playgroud)

完整的堆栈跟踪是:

error: failed to parse manifest at `/Users/aviralsrivastava/dev/subxt/Cargo.toml`

Caused by:
  feature `edition2021` is required

  The package requires the Cargo feature called `edition2021`, but that feature is not stabilized in this version of Cargo (1.56.0-nightly (b51439fd8 2021-08-09)).
  Consider adding `cargo-features = ["edition2021"]` to the top of Cargo.toml (above the [package] table) to tell Cargo you are opting in to use this unstable feature.
  See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#edition-2021 for more information about the status …
Run Code Online (Sandbox Code Playgroud)

rust substrate polkadot

43
推荐指数
3
解决办法
3万
查看次数

无法为“librocksdb-sys v6.11.4”运行自定义构建命令时发生一些错误

我尝试创建我的第一个底物链。创建您的第一个 Substrate 链

但是我在编译基质时遇到了一些错误。

无法运行自定义构建命令librocksdb-sys v6.11.4

有人知道如何解决这个问题吗?

rust blockchain substrate

10
推荐指数
3
解决办法
1万
查看次数

遇到错误无法完成基材前端模板的纱线安装

按照此处提供的安装步骤进行操作

\n

https://docs.substrate.io/tutorials/v3/create-your-first-substrate-chain/

\n

使用节点版本 v16.14.0 采取的步骤

\n
git clone https://github.com/substrate-developer-hub/substrate-front-end-template\nyarn install\n
Run Code Online (Sandbox Code Playgroud)\n

错误代码

\n
Resolution step\n\xe2\x9e\xa4 YN0002: \xe2\x94\x82 eslint-config-react-app@npm:7.0.0 [e199f] doesn\'t provide @babel/plugin-syntax-flow (p79568), requested by eslint-plugin-flowtype\n\xe2\x9e\xa4 YN0002: \xe2\x94\x82 eslint-config-react-app@npm:7.0.0 [e199f] doesn\'t provide @babel/plugin-transform-react-jsx (p2880e), requested by eslint-plugin-flowtype\n\xe2\x9e\xa4 YN0002: \xe2\x94\x82 react-dev-utils@npm:12.0.0 doesn\'t provide typescript (p08c91), requested by fork-ts-checker-webpack-plugin\n\xe2\x9e\xa4 YN0002: \xe2\x94\x82 react-dev-utils@npm:12.0.0 doesn\'t provide webpack (pf80ce), requested by fork-ts-checker-webpack-plugin\n\xe2\x9e\xa4 YN0002: \xe2\x94\x82 react-scripts@npm:5.0.0 [9c894] doesn\'t provide autoprefixer (peca2e), requested by tailwindcss\n\xe2\x9e\xa4 YN0060: \xe2\x94\x82 react-scripts@npm:5.0.0 [9c894] provides eslint (p3d1f2) with version 8.6.0, …
Run Code Online (Sandbox Code Playgroud)

node.js blockchain substrate polkadot

10
推荐指数
1
解决办法
8028
查看次数

我们如何使用天平托盘而不是系统托盘来存储天平

如果我们查看 polkadot js 文档,我们可以看到以下注释:这仅在该托盘用于存储余额的情况下使用。现在我们如何使用余额托盘来存储余额?因为我们还有这个api.query.system.account函数而不是api.query.balances.account

substrate

9
推荐指数
1
解决办法
1070
查看次数

Substrate 节点模板无法创建运行时错误=其他(“无法反序列化模块:UnknownOpcode(192)”)

我正在尝试按照此过程https://docs.substrate.io/tutorials/build-a-blockchain/build-local-blockchain/#start-the-local-node启动本地节点。但它总是给我错误:

\n
\xe2\x9e\x9c  substrate-node-template git:(my-wip-branch) ./target/release/node-template --dev\n\n2023-04-07 12:59:26 Substrate Node    \n2023-04-07 12:59:26 \xe2\x9c\x8c\xef\xb8\x8f  version 4.0.0-dev-700c3a186e5    \n2023-04-07 12:59:26 \xe2\x9d\xa4\xef\xb8\x8f  by Substrate DevHub <https://github.com/substrate-developer-hub>, 2017-2023    \n2023-04-07 12:59:26  Chain specification: Development    \n2023-04-07 12:59:26   Node name: extra-large-arch-5066    \n2023-04-07 12:59:26  Role: AUTHORITY    \n2023-04-07 12:59:26  Database: RocksDb at /var/folders/dy/1hb072zd0g1d5ppckgm48ml40000gn/T/substrateekR4s0/chains/dev/db/full    \n2023-04-07 12:59:26 \xe2\x9b\x93  Native runtime: node-template-100 (node-template-1.tx1.au1)    \nError: Service(Client(VersionInvalid("cannot deserialize module: UnknownOpcode(192)")))\n2023-04-07 12:59:26 Cannot create a runtime error=Other("cannot deserialize module: UnknownOpcode(192)")\n
Run Code Online (Sandbox Code Playgroud)\n

我在另一个页面看到我必须没有最新版本的 rustup,所以我目前的版本已于 2023/01/01 更新:

\n
\xe2\x9e\x9c  substrate-node-template git:(my-wip-branch) rustup toolchain list\nstable-aarch64-apple-darwin\nnightly-2021-03-14-aarch64-apple-darwin\nnightly-2022-03-14-aarch64-apple-darwin\nnightly-2022-06-30-aarch64-apple-darwin\nnightly-2023-01-01-aarch64-apple-darwin (default)\n
Run Code Online (Sandbox Code Playgroud)\n …

rust blockchain substrate

7
推荐指数
1
解决办法
1262
查看次数

在 Substrate 运行时中跨不同模块调用 `on_initialize` 的顺序是什么?

我需要确保on_initialize特定模块的处理程序在运行时中的所有其他模块之前的相同处理程序之前运行。

a) 如何确保这一点?

b) 是否有一些编译或运行时检查我可以强制执行以绝对保证这将得到尊重?

rust blockchain substrate

6
推荐指数
1
解决办法
213
查看次数

如何正确升级 Substrate 节点上的运行时?

在创建第一个基板链之后,一切正常。

然后我想更进一步来自定义我的demo.rs文件,这是我在做什么:

  1. 这里的代码完全替换demo.rs中的代码,现在涉及事件。

  2. 更新lib.rs

Demo: demo::{Module, Call, Storage, Event<T>},  
Run Code Online (Sandbox Code Playgroud)

impl demo::Trait for Runtime {
    type Event = Event;
}
Run Code Online (Sandbox Code Playgroud)
  1. ./scripts/build.rs
  2. ./target/release/node-name --dev

然后我看到Polkadot Web App上没有列出我更新的外部函数,或者substrate_node_template_runtime_wasm.compact.wasm按照教程中第 5 步上传文件

所以我必须运行以下代码才能进行更新:

rm -rf ./target
cargo build --release
./target/release/node-name --dev
Run Code Online (Sandbox Code Playgroud)

通过与@shawntabrizi 讨论,他建议使用以下命令

./scripts/build.sh
cargo build --release
./target/release/node-name purge-chain --dev
./target/release/node-name --dev
Run Code Online (Sandbox Code Playgroud)

看来,如果没有purge-chain这两个substrate_node_template_runtime_wasm.compact.wasm,并./target/release/node-name没有更新的。

在这里引用

通过升级运行时,您只需切换出将接收外部和读取存储的代码块。

但我想更深入地了解,升级运行时节点时,build.sh和背后有什么区别cargo …

substrate

6
推荐指数
1
解决办法
666
查看次数

如何出于 Docker 目的绑定到 0.0.0.0 而不是 localhost

我目前正在尝试将整个 Node 包装在 Docker 容器中。然而,当我运行时,它在本地主机上运行。我似乎找不到将其绑定到 0.0.0.0 的方法,因为由于虚拟机作为许多环境的中介的性质,Docker 无法很好地绑定到本地主机。

substrate

6
推荐指数
1
解决办法
3万
查看次数

在 Substrate 中,`spec_version` 和 `authoring_version` 有什么区别?

每个 Substrate 运行时都有一个RuntimeVersion。此 RuntimeVersion 结构中的字段指示运行时的各个方面何时发生变化,并且每个字段都有自己在这些文档中描述的语义。

我不确定这authoring_version意味着什么,什么时候应该改变。文档中的描述对我来说并不完全清楚

authoring_version: u32

authoring_version is the version of the authorship interface.
An authoring node will not attempt to author blocks unless this
is equal to its native runtime.
Run Code Online (Sandbox Code Playgroud)

如果可能,请提供升级示例,其中:

  • 双方spec_versionauthoring_version会改变
  • spec_version会改变,但authoring_version不会
  • authoring_version会改变,但spec_version不会

parity-io substrate

6
推荐指数
1
解决办法
97
查看次数

运行时构建:在此范围内找不到字符串

基板开发人员可能会遇到的一个常见问题是:开发自定义托盘以将映射存储到具有常见类型的存储中,例如String. 举个例子:

#[derive(Encode, Decode, Clone, Default, RuntimeDebug)]
pub struct ClusterMetadata {
    ip_address: String,
    namespace: String,
    whitelisted_ips: String,
}
Run Code Online (Sandbox Code Playgroud)

在构建运行时,您会收到每个错误String

     |
  21 |     ip_address: String,
     |                 ^^^^^^ not found in this scope
Run Code Online (Sandbox Code Playgroud)

为什么Strings不包括在范围内?和其他std锈类型?

string rust substrate rust-no-std

6
推荐指数
1
解决办法
665
查看次数

标签 统计

substrate ×10

rust ×5

blockchain ×4

polkadot ×2

node.js ×1

parity-io ×1

rust-no-std ×1

string ×1