Introduce Backend trait to allow different RPC (or other) backends to be implemented (#1126)

* WIP backend trait

* WIP converting higher level stuff to using Backend impl

* more implementing new backend trait, mainly storage focused

* Get core code compiling with new backend bits

* subxt crate checks passing

* fix tests

* cargo fmt

* clippy/fixes

* merging and other fixes

* fix test

* fix lightclient code

* Fix some broken doc links

* another book link fix

* fix broken test when moving default_rpc_client

* fix dry_run test

* fix more tests; lightclient and wasm

* fix wasm tests

* fix some doc examples

* use next() instead of next_item()

* missing next_item() -> next()s

* move legacy RPc methods to LegacyRpcMethods type to host generic param instead of RpcClient

* standardise on all RpcClient types prefixed with Rpc, and 'raw' trait types prefixed with RawRpc so it's less ocnfusing which is which

* rename fixes

* doc fixes

* Add back system_dryRun RPC method and rename tx.dry_run() to tx.validate(), to signal that the calls are different

* Add a test that we return the correct extrinsic hash from submit()

* add TransactionValid details back, and protect against out of range bytes

* add test for decoding transaction validation from empty bytes

* fix clippy warning
This commit is contained in:
James Wilson
2023-08-22 12:32:22 +01:00
committed by GitHub
parent 7e15e96e52
commit d7124b56f7
61 changed files with 2627 additions and 3150 deletions
Generated
+1 -50
View File
@@ -1987,7 +1987,6 @@ dependencies = [
"regex",
"scale-info",
"sp-core",
"sp-runtime",
"substrate-runner",
"subxt",
"subxt-codegen",
@@ -2581,12 +2580,6 @@ dependencies = [
"syn 1.0.109",
]
[[package]]
name = "parity-wasm"
version = "0.45.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1ad0aff30c1da14b1254fcb2af73e1fa9a28670e584a626f53a369d0e157304"
[[package]]
name = "parking"
version = "2.1.0"
@@ -3842,18 +3835,6 @@ dependencies = [
"twox-hash",
]
[[package]]
name = "sp-core-hashing-proc-macro"
version = "9.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "727d7c7d42e59a13eb1412758630569dd6c3640c4754d9a948e8d943f99bc932"
dependencies = [
"proc-macro2",
"quote",
"sp-core-hashing",
"syn 2.0.28",
]
[[package]]
name = "sp-debug-derive"
version = "8.0.0"
@@ -4074,36 +4055,6 @@ dependencies = [
"trie-root",
]
[[package]]
name = "sp-version"
version = "22.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a49e88372c9d923e95dc855f1e7bdbca6638574d59a8c3cb9f7e5ecea638481"
dependencies = [
"impl-serde",
"parity-scale-codec",
"parity-wasm",
"scale-info",
"serde",
"sp-core-hashing-proc-macro",
"sp-runtime",
"sp-std",
"sp-version-proc-macro",
"thiserror",
]
[[package]]
name = "sp-version-proc-macro"
version = "8.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39e1e11ab230fd0ede7aefeb246a1ef7e6af58634c490a2d911ce71aabc0718a"
dependencies = [
"parity-scale-codec",
"proc-macro2",
"quote",
"syn 2.0.28",
]
[[package]]
name = "sp-wasm-interface"
version = "14.0.0"
@@ -4235,6 +4186,7 @@ name = "subxt"
version = "0.31.0"
dependencies = [
"assert_matches",
"async-trait",
"base58",
"bitvec",
"blake2",
@@ -4259,7 +4211,6 @@ dependencies = [
"sp-core-hashing",
"sp-keyring",
"sp-runtime",
"sp-version",
"subxt-lightclient",
"subxt-macro",
"subxt-metadata",