Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miguel/ava 405 rpc not working with scripts #102

Merged
merged 17 commits into from
Nov 1, 2022

Conversation

MiguelDD1
Copy link
Contributor

@MiguelDD1 MiguelDD1 commented Oct 26, 2022

Description

The query_data_proof RPC now uses the new way to filter, extract, and decode the data field from DataAvailability::submit_data calls (submitted_call::call_proof), and it is aligned with the code used inside the runtime, removing duplications.

@MiguelDD1 MiguelDD1 self-assigned this Oct 26, 2022
@linear
Copy link

linear bot commented Oct 26, 2022

AVA-405 RPC not working with scripts

We have custom kate RPCs enabled from the substrate node.

Its now working with the changes done in the explorer where we have added rpc field to the definitions(Overridebundledefinitions). But there are still concern regarding the message passing parameter needs to be initialised which is a bit complex case( ex: NumberOrHex). But can be solved with proper definitions for those fields.

image (1).png

The main problem that is happening is that the custom RPC should be working the with js/ts scripts if initialised as the same way we declare the custom header in the CreateApi() function. So as per the polkadot's documentation we should be able to call

api.rpc.kate.blockLength() 

But its actually failing with the following error

Property 'kate' does not exist on type 'DecoratedRpc<"promise", RpcInterface>'.

This is not a new case for the api and the closest regarding this is mentioned in this issue. The solution mentioned in the issue is not really a solution for our script it seems.

@codecov-commenter
Copy link

Codecov Report

Base: 50.77% // Head: 50.56% // Decreases project coverage by -0.21% ⚠️

Coverage data is based on head (dc4dd66) compared to base (857a026).
Patch coverage: 29.72% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #102      +/-   ##
===========================================
- Coverage    50.77%   50.56%   -0.22%     
===========================================
  Files           52       52              
  Lines         8930     8906      -24     
===========================================
- Hits          4534     4503      -31     
- Misses        4396     4403       +7     
Impacted Files Coverage Δ
pallets/dactr/src/mock.rs 100.00% <ø> (+1.88%) ⬆️
pallets/mocked_runtime/src/lib.rs 53.84% <ø> (-1.71%) ⬇️
pallets/nomad/da-bridge/src/mock.rs 63.51% <ø> (+0.84%) ⬆️
pallets/nomad/home/src/mock.rs 76.92% <ø> (+1.16%) ⬆️
pallets/nomad/updater-manager/src/mock.rs 58.33% <ø> (+1.57%) ⬆️
pallets/system/benchmarking/src/mock.rs 53.33% <ø> (+3.33%) ⬆️
pallets/system/src/header_builder.rs 98.48% <ø> (+14.06%) ⬆️
pallets/system/src/mock.rs 81.08% <ø> (+2.13%) ⬆️
rpc/kate-rpc-runtime-api/src/lib.rs 6.66% <0.00%> (-5.84%) ⬇️
rpc/kate-rpc/src/lib.rs 0.66% <0.00%> (+0.11%) ⬆️
... and 11 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

…com-miguelDD1:maticnetwork/avail into miguel/ava-405-rpc-not-working-with-scripts
@MiguelDD1 MiguelDD1 requested review from a team October 31, 2022 11:18
@MiguelDD1 MiguelDD1 added the bug Something isn't working label Oct 31, 2022
@MiguelDD1 MiguelDD1 marked this pull request as ready for review October 31, 2022 11:18

#[rpc(name = "kate_queryDataProof")]
fn query_data_proof(&self, block_number: NumberOrHex, index: u32) -> Result<Vec<H256>>;
fn query_data_proof(&self, data_index: u32, at: Option<HashOf<Block>>) -> Result<DataProof>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this mean the API now accepts both block number or hash instead of block number earlier?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it only accepts the hash. It is a kind of de-facto standard in RPC calls on substrate.

@MiguelDD1 MiguelDD1 merged commit 68a67d0 into develop Nov 1, 2022
@MiguelDD1 MiguelDD1 deleted the miguel/ava-405-rpc-not-working-with-scripts branch November 1, 2022 07:29
luka-ethernal pushed a commit that referenced this pull request Nov 9, 2022
* Use custom branch

* Use header extensions

* Fix fmt

* Data Root without hardcode decoding

* Use `avail-core` tag

* Bump `avail-core` dep

* Comment from codereview

* RPC minor fixes

* Use temporay branch for `avail-core`

* RPC `query_data_proof` uses runtime extractor

* Rollback to tagged `avail-core` & disable VTest

* Update `avail-core` deps

* Fix `BlockLength` decodification bug

* Data Proof RPC uses block instead runtime
MiguelDD1 added a commit that referenced this pull request Nov 9, 2022
* Use substrate v0.9.29 - Partial

* Revert "Bump Runtime and Node versions (#88)"

This reverts commit 86af7d1.

* Revert "Use substrate v0.9.29 - Partial"

This reverts commit 58d4a96.

* Add nomad v1 pallets (#84)

* add nomad primitives

* patch dependencies to fix build issues

* remove tiny keccak from merkle

* add tiny keccak back to merkle and use to avoid extra allocation in left/right hash

* port nomad pallets, build failing

* add node and runtime changes

* add subxt changes

* fix compact block header and add specs to node for genesis info

* add new script for submitting data and header

* rename enqueue_data_root to dispatch_data_root

* rebase on primitive changes and change da-bridge message and TypedMessage to use BoundedVec

* fix failing home test after max message len change

* rebase on merged primitives

* remove unnecessary methods and add da-bridge docs

* update metadata and have home tree put default

* make da-bridge message type struct-based not vector-based

* remove panic in da bridge message

* remove finalized block hash mapping

* fix vec dependency after rebase on post-primitives PR

* make non body length public for tests

* Safety review

* Add benchmarks to `Nomad-home`

* Code review changes

  - New Benchmarks for `nomad/da-bridge`
  - Add header hash to `try_dispatch_data_root`.
  - Add assertions to `verify` section in benchmarks.

* Update `avail-subxt` examples

* Full header is needed

* Fmt fix

* fix double import and missing let after rebase

* fix subxt scripts with new da-bridge header metadata

* fix home update pallet weight

Co-authored-by: Miguel <[email protected]>
Co-authored-by: miguelDD1 <[email protected]>

* release change

* Miguel/ava 141 hard fork on plonk update 3 (#96)

* Header builder can use `Kate 0.1.0` and `0.2.0`

    - `Kate` & `da-primitives` have been moved out to another repo.
    - New version of `header_builder::build` which uses `Kate 0.2.0`.
      Version 1 is still available.

* `Kate` deps to tags and bump RT version

* Keep unstable fmt

* Add 1.64 toolchain to git workflow

* Coverage support on stable compiler

* Header builder can use `Kate 0.1.0` and `0.2.0`

    - `Kate` & `da-primitives` have been moved out to another repo.
    - New version of `header_builder::build` which uses `Kate 0.2.0`.
      Version 1 is still available.

* `Kate` deps to tags and bump RT version

* Keep unstable fmt

* Add 1.64 toolchain to git workflow

* Coverage support on stable compiler

* Header builder can use `Kate 0.1.0` and `0.2.0`

    - `Kate` & `da-primitives` have been moved out to another repo.
    - New version of `header_builder::build` which uses `Kate 0.2.0`.
      Version 1 is still available.

* `Kate` deps to tags and bump RT version

* Keep unstable fmt

* Coverage support on stable compiler

* Update `Kate/v0.2.1`

* Header Forward Compatibility (#99)

* Use new versioned header extensions
* Data Root without hardcode decoding

* Fix header format for avail-subxt.

* Miguel/ava 405 rpc not working with scripts (#102)

* Use custom branch

* Use header extensions

* Fix fmt

* Data Root without hardcode decoding

* Use `avail-core` tag

* Bump `avail-core` dep

* Comment from codereview

* RPC minor fixes

* Use temporay branch for `avail-core`

* RPC `query_data_proof` uses runtime extractor

* Rollback to tagged `avail-core` & disable VTest

* Update `avail-core` deps

* Fix `BlockLength` decodification bug

* Data Proof RPC uses block instead runtime

* Fix header format for avail-subxt. (#103)

* Use `subxt-cli` to generate `api_dev.rs`

* New E2E tool: Run examples using an avail-node

* Add `README.md`

* Fix some merge issues

* Update `avail-subxt` doc

* Add decoding support to Extrinsics

* Bump some version

* Increase Epoch to 1h (#108)

* Uses the right version of `subxt` (#109)

* Empty-Commit

* Use substrate v0.9.29 - Partial

* Revert "Bump Runtime and Node versions (#88)"

This reverts commit 86af7d1.

* Revert "Use substrate v0.9.29 - Partial"

This reverts commit 58d4a96.

* Add nomad v1 pallets (#84)

* add nomad primitives

* patch dependencies to fix build issues

* remove tiny keccak from merkle

* add tiny keccak back to merkle and use to avoid extra allocation in left/right hash

* port nomad pallets, build failing

* add node and runtime changes

* add subxt changes

* fix compact block header and add specs to node for genesis info

* add new script for submitting data and header

* rename enqueue_data_root to dispatch_data_root

* rebase on primitive changes and change da-bridge message and TypedMessage to use BoundedVec

* fix failing home test after max message len change

* rebase on merged primitives

* remove unnecessary methods and add da-bridge docs

* update metadata and have home tree put default

* make da-bridge message type struct-based not vector-based

* remove panic in da bridge message

* remove finalized block hash mapping

* fix vec dependency after rebase on post-primitives PR

* make non body length public for tests

* Safety review

* Add benchmarks to `Nomad-home`

* Code review changes

  - New Benchmarks for `nomad/da-bridge`
  - Add header hash to `try_dispatch_data_root`.
  - Add assertions to `verify` section in benchmarks.

* Update `avail-subxt` examples

* Full header is needed

* Fmt fix

* fix double import and missing let after rebase

* fix subxt scripts with new da-bridge header metadata

* fix home update pallet weight

Co-authored-by: Miguel <[email protected]>
Co-authored-by: miguelDD1 <[email protected]>

* release change

* Miguel/ava 141 hard fork on plonk update 3 (#96)

* Header builder can use `Kate 0.1.0` and `0.2.0`

    - `Kate` & `da-primitives` have been moved out to another repo.
    - New version of `header_builder::build` which uses `Kate 0.2.0`.
      Version 1 is still available.

* `Kate` deps to tags and bump RT version

* Keep unstable fmt

* Add 1.64 toolchain to git workflow

* Coverage support on stable compiler

* Header builder can use `Kate 0.1.0` and `0.2.0`

    - `Kate` & `da-primitives` have been moved out to another repo.
    - New version of `header_builder::build` which uses `Kate 0.2.0`.
      Version 1 is still available.

* `Kate` deps to tags and bump RT version

* Keep unstable fmt

* Add 1.64 toolchain to git workflow

* Coverage support on stable compiler

* Header builder can use `Kate 0.1.0` and `0.2.0`

    - `Kate` & `da-primitives` have been moved out to another repo.
    - New version of `header_builder::build` which uses `Kate 0.2.0`.
      Version 1 is still available.

* `Kate` deps to tags and bump RT version

* Keep unstable fmt

* Coverage support on stable compiler

* Update `Kate/v0.2.1`

* Header Forward Compatibility (#99)

* Use new versioned header extensions
* Data Root without hardcode decoding

* Fix header format for avail-subxt.

* Use `subxt-cli` to generate `api_dev.rs`

* New E2E tool: Run examples using an avail-node

* Add `README.md`

* Miguel/ava 405 rpc not working with scripts (#102)

* Use custom branch

* Use header extensions

* Fix fmt

* Data Root without hardcode decoding

* Use `avail-core` tag

* Bump `avail-core` dep

* Comment from codereview

* RPC minor fixes

* Use temporay branch for `avail-core`

* RPC `query_data_proof` uses runtime extractor

* Rollback to tagged `avail-core` & disable VTest

* Update `avail-core` deps

* Fix `BlockLength` decodification bug

* Data Proof RPC uses block instead runtime

* Fix header format for avail-subxt. (#103)

* Fix some merge issues

* Update `avail-subxt` doc

* Add decoding support to Extrinsics

* Bump some version

* Increase Epoch to 1h (#108)

* Uses the right version of `subxt` (#109)

* Empty-Commit

* Js script header changes  (#112)

* api file addition

(cherry picked from commit 921616f)

* empty comit

* Minor fixes for non-JS users

Co-authored-by: miguelDD1 <[email protected]>

Co-authored-by: Luke Tchang <[email protected]>
Co-authored-by: Miguel <[email protected]>
Co-authored-by: Kailas <[email protected]>
Co-authored-by: Luka Borkovic <[email protected]>
Co-authored-by: luka-ethernal <[email protected]>
MiguelDD1 added a commit that referenced this pull request Nov 18, 2022
* Release 1.3.0 (#111)

* Use substrate v0.9.29 - Partial

* Revert "Bump Runtime and Node versions (#88)"

This reverts commit 86af7d1.

* Revert "Use substrate v0.9.29 - Partial"

This reverts commit 58d4a96.

* Add nomad v1 pallets (#84)

* add nomad primitives

* patch dependencies to fix build issues

* remove tiny keccak from merkle

* add tiny keccak back to merkle and use to avoid extra allocation in left/right hash

* port nomad pallets, build failing

* add node and runtime changes

* add subxt changes

* fix compact block header and add specs to node for genesis info

* add new script for submitting data and header

* rename enqueue_data_root to dispatch_data_root

* rebase on primitive changes and change da-bridge message and TypedMessage to use BoundedVec

* fix failing home test after max message len change

* rebase on merged primitives

* remove unnecessary methods and add da-bridge docs

* update metadata and have home tree put default

* make da-bridge message type struct-based not vector-based

* remove panic in da bridge message

* remove finalized block hash mapping

* fix vec dependency after rebase on post-primitives PR

* make non body length public for tests

* Safety review

* Add benchmarks to `Nomad-home`

* Code review changes

  - New Benchmarks for `nomad/da-bridge`
  - Add header hash to `try_dispatch_data_root`.
  - Add assertions to `verify` section in benchmarks.

* Update `avail-subxt` examples

* Full header is needed

* Fmt fix

* fix double import and missing let after rebase

* fix subxt scripts with new da-bridge header metadata

* fix home update pallet weight

Co-authored-by: Miguel <[email protected]>
Co-authored-by: miguelDD1 <[email protected]>

* release change

* Miguel/ava 141 hard fork on plonk update 3 (#96)

* Header builder can use `Kate 0.1.0` and `0.2.0`

    - `Kate` & `da-primitives` have been moved out to another repo.
    - New version of `header_builder::build` which uses `Kate 0.2.0`.
      Version 1 is still available.

* `Kate` deps to tags and bump RT version

* Keep unstable fmt

* Add 1.64 toolchain to git workflow

* Coverage support on stable compiler

* Header builder can use `Kate 0.1.0` and `0.2.0`

    - `Kate` & `da-primitives` have been moved out to another repo.
    - New version of `header_builder::build` which uses `Kate 0.2.0`.
      Version 1 is still available.

* `Kate` deps to tags and bump RT version

* Keep unstable fmt

* Add 1.64 toolchain to git workflow

* Coverage support on stable compiler

* Header builder can use `Kate 0.1.0` and `0.2.0`

    - `Kate` & `da-primitives` have been moved out to another repo.
    - New version of `header_builder::build` which uses `Kate 0.2.0`.
      Version 1 is still available.

* `Kate` deps to tags and bump RT version

* Keep unstable fmt

* Coverage support on stable compiler

* Update `Kate/v0.2.1`

* Header Forward Compatibility (#99)

* Use new versioned header extensions
* Data Root without hardcode decoding

* Fix header format for avail-subxt.

* Miguel/ava 405 rpc not working with scripts (#102)

* Use custom branch

* Use header extensions

* Fix fmt

* Data Root without hardcode decoding

* Use `avail-core` tag

* Bump `avail-core` dep

* Comment from codereview

* RPC minor fixes

* Use temporay branch for `avail-core`

* RPC `query_data_proof` uses runtime extractor

* Rollback to tagged `avail-core` & disable VTest

* Update `avail-core` deps

* Fix `BlockLength` decodification bug

* Data Proof RPC uses block instead runtime

* Fix header format for avail-subxt. (#103)

* Use `subxt-cli` to generate `api_dev.rs`

* New E2E tool: Run examples using an avail-node

* Add `README.md`

* Fix some merge issues

* Update `avail-subxt` doc

* Add decoding support to Extrinsics

* Bump some version

* Increase Epoch to 1h (#108)

* Uses the right version of `subxt` (#109)

* Empty-Commit

* Use substrate v0.9.29 - Partial

* Revert "Bump Runtime and Node versions (#88)"

This reverts commit 86af7d1.

* Revert "Use substrate v0.9.29 - Partial"

This reverts commit 58d4a96.

* Add nomad v1 pallets (#84)

* add nomad primitives

* patch dependencies to fix build issues

* remove tiny keccak from merkle

* add tiny keccak back to merkle and use to avoid extra allocation in left/right hash

* port nomad pallets, build failing

* add node and runtime changes

* add subxt changes

* fix compact block header and add specs to node for genesis info

* add new script for submitting data and header

* rename enqueue_data_root to dispatch_data_root

* rebase on primitive changes and change da-bridge message and TypedMessage to use BoundedVec

* fix failing home test after max message len change

* rebase on merged primitives

* remove unnecessary methods and add da-bridge docs

* update metadata and have home tree put default

* make da-bridge message type struct-based not vector-based

* remove panic in da bridge message

* remove finalized block hash mapping

* fix vec dependency after rebase on post-primitives PR

* make non body length public for tests

* Safety review

* Add benchmarks to `Nomad-home`

* Code review changes

  - New Benchmarks for `nomad/da-bridge`
  - Add header hash to `try_dispatch_data_root`.
  - Add assertions to `verify` section in benchmarks.

* Update `avail-subxt` examples

* Full header is needed

* Fmt fix

* fix double import and missing let after rebase

* fix subxt scripts with new da-bridge header metadata

* fix home update pallet weight

Co-authored-by: Miguel <[email protected]>
Co-authored-by: miguelDD1 <[email protected]>

* release change

* Miguel/ava 141 hard fork on plonk update 3 (#96)

* Header builder can use `Kate 0.1.0` and `0.2.0`

    - `Kate` & `da-primitives` have been moved out to another repo.
    - New version of `header_builder::build` which uses `Kate 0.2.0`.
      Version 1 is still available.

* `Kate` deps to tags and bump RT version

* Keep unstable fmt

* Add 1.64 toolchain to git workflow

* Coverage support on stable compiler

* Header builder can use `Kate 0.1.0` and `0.2.0`

    - `Kate` & `da-primitives` have been moved out to another repo.
    - New version of `header_builder::build` which uses `Kate 0.2.0`.
      Version 1 is still available.

* `Kate` deps to tags and bump RT version

* Keep unstable fmt

* Add 1.64 toolchain to git workflow

* Coverage support on stable compiler

* Header builder can use `Kate 0.1.0` and `0.2.0`

    - `Kate` & `da-primitives` have been moved out to another repo.
    - New version of `header_builder::build` which uses `Kate 0.2.0`.
      Version 1 is still available.

* `Kate` deps to tags and bump RT version

* Keep unstable fmt

* Coverage support on stable compiler

* Update `Kate/v0.2.1`

* Header Forward Compatibility (#99)

* Use new versioned header extensions
* Data Root without hardcode decoding

* Fix header format for avail-subxt.

* Use `subxt-cli` to generate `api_dev.rs`

* New E2E tool: Run examples using an avail-node

* Add `README.md`

* Miguel/ava 405 rpc not working with scripts (#102)

* Use custom branch

* Use header extensions

* Fix fmt

* Data Root without hardcode decoding

* Use `avail-core` tag

* Bump `avail-core` dep

* Comment from codereview

* RPC minor fixes

* Use temporay branch for `avail-core`

* RPC `query_data_proof` uses runtime extractor

* Rollback to tagged `avail-core` & disable VTest

* Update `avail-core` deps

* Fix `BlockLength` decodification bug

* Data Proof RPC uses block instead runtime

* Fix header format for avail-subxt. (#103)

* Fix some merge issues

* Update `avail-subxt` doc

* Add decoding support to Extrinsics

* Bump some version

* Increase Epoch to 1h (#108)

* Uses the right version of `subxt` (#109)

* Empty-Commit

* Js script header changes  (#112)

* api file addition

(cherry picked from commit 921616f)

* empty comit

* Minor fixes for non-JS users

Co-authored-by: miguelDD1 <[email protected]>

Co-authored-by: Luke Tchang <[email protected]>
Co-authored-by: Miguel <[email protected]>
Co-authored-by: Kailas <[email protected]>
Co-authored-by: Luka Borkovic <[email protected]>
Co-authored-by: luka-ethernal <[email protected]>

* ops(ci): Switching to nightly rust for build

* ops(security): Adding Security CI Files

* fix: adding wasm32

* fix: switching wasm32 to nightly as well

* Add RPC for app data rows fetching.

* Disable security workflow.

* Update versions.

Co-authored-by: Luke Tchang <[email protected]>
Co-authored-by: Miguel <[email protected]>
Co-authored-by: Kailas <[email protected]>
Co-authored-by: Luka Borkovic <[email protected]>
Co-authored-by: luka-ethernal <[email protected]>
Co-authored-by: John Hilliard <[email protected]>
Co-authored-by: Aleksandar Terentić <[email protected]>
Co-authored-by: aterentic-ethernal <[email protected]>
umadayal pushed a commit to succinctlabs/avail-core that referenced this pull request Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants