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

Header Forward Compatibility #99

Merged
merged 9 commits into from
Oct 26, 2022

Conversation

MiguelDD1
Copy link
Contributor

@MiguelDD1 MiguelDD1 commented Oct 20, 2022

Description

Header has been split into 2 parts:

  • A common header which is similar to the generic substrate header,
  • And a header extension field which supports forward compatibility using versions.

Other changes

  • Data Root build uses beefy_merkle_tree and supports no-std.

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

linear bot commented Oct 20, 2022

AVA-397 Compatibility issue between 1.0 & 1.1

Header changes in Header (at KateCommitment) makes incompatibilities between 1.0 and 1.1.

I solved the issue of the header de-codification, but v1.1 is still unable to synchronize with a 1.0 network. It looks the header codification is hight coupled with other stuff like sc_consensus_baba crates, as you can see in the following crash backtrace:

2022-10-11 12:07:51 Polygon Avail Node    
2022-10-11 12:07:51 ✌️  version 1.1.0-062d946-x86_64-linux-gnu    
2022-10-11 12:07:51 ❤️  by Anonymous, 2017-2022    
2022-10-11 12:07:51 📋 Chain specification: Avail-Dev    
2022-10-11 12:07:51 🏷 Node name: Charlie    
2022-10-11 12:07:51 👤 Role: AUTHORITY    
2022-10-11 12:07:51 💾 Database: RocksDb at /mnt/storage/home/miguel/polygon/avail_1/base/charlie/chains/Dev/db/full    
2022-10-11 12:07:51 ⛓  Native runtime: data-avail-5 (data-avail-0.tx1.au10)    

====================

Version: 1.1.0-062d946-x86_64-linux-gnu

0: sp_panic_handler::panic_hook
at /home/miguel/.cargo/git/checkouts/substrate-7e08433d4c370a21/afb74de/primitives/panic-handler/src/lib.rs:166:18
1: sp_panic_handler::set::{{closure}}
at /home/miguel/.cargo/git/checkouts/substrate-7e08433d4c370a21/afb74de/primitives/panic-handler/src/lib.rs:62:12
2: std::panicking::rust_panic_with_hook
at /rustc/efec545293b9263be9edfb283a7aa66350b3acbf/library/std/src/panicking.rs:610:17
3: std::panicking::begin_panic_handler::{{closure}}
at /rustc/efec545293b9263be9edfb283a7aa66350b3acbf/library/std/src/panicking.rs:502:13
4: std::sys_common::backtrace::__rust_end_short_backtrace
at /rustc/efec545293b9263be9edfb283a7aa66350b3acbf/library/std/src/sys_common/backtrace.rs:139:18
5: rust_begin_unwind
at /rustc/efec545293b9263be9edfb283a7aa66350b3acbf/library/std/src/panicking.rs:498:5
6: core::panicking::panic_fmt
at /rustc/efec545293b9263be9edfb283a7aa66350b3acbf/library/core/src/panicking.rs:107:14
7: core::panicking::panic_display
at /rustc/efec545293b9263be9edfb283a7aa66350b3acbf/library/core/src/panicking.rs:63:5
8: core::option::expect_failed
at /rustc/efec545293b9263be9edfb283a7aa66350b3acbf/library/core/src/option.rs:1663:5
9: core::option::Option<T>::expect
at /rustc/efec545293b9263be9edfb283a7aa66350b3acbf/library/core/src/option.rs:710:21
10: sc_consensus_babe::prune_finalized
at /home/miguel/.cargo/git/checkouts/substrate-7e08433d4c370a21/afb74de/client/consensus/babe/src/lib.rs:1659:26
11: sc_consensus_babe::block_import
at /home/miguel/.cargo/git/checkouts/substrate-7e08433d4c370a21/afb74de/client/consensus/babe/src/lib.rs:1702:2
12: data_avail::service::new_partial
at node/src/service.rs:237:34
13: data_avail::service::new_full_base
at node/src/service.rs:364:6
14: data_avail::service::new_full
at node/src/service.rs:578:2

In order to prevent future incompatibilities, we are going to add the version to the header, i.e.:

mod v1;
mod v2;
/// ...

pub enum Header<N, H> {
	V1(v1::Header<N,H>),
    // Future versions ...
	V2(v2::Header<N,H>),
    ...
	Unknown,
}

@codecov-commenter
Copy link

codecov-commenter commented Oct 20, 2022

Codecov Report

Base: 50.80% // Head: 50.79% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (b314047) compared to base (d6d79cf).
Patch coverage: 86.79% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop      #99      +/-   ##
===========================================
- Coverage    50.80%   50.79%   -0.01%     
===========================================
  Files           50       52       +2     
  Lines         9035     8943      -92     
===========================================
- Hits          4590     4543      -47     
+ Misses        4445     4400      -45     
Impacted Files Coverage Δ
node/src/chain_spec.rs 0.00% <0.00%> (ø)
pallets/mocked_runtime/src/test_xt.rs 69.44% <ø> (ø)
pallets/nomad/da-bridge/src/mock.rs 62.66% <0.00%> (-0.85%) ⬇️
pallets/nomad/home/src/mock.rs 75.75% <0.00%> (-1.17%) ⬇️
pallets/nomad/updater-manager/src/mock.rs 56.75% <0.00%> (-1.58%) ⬇️
pallets/system/benchmarking/src/mock.rs 50.00% <0.00%> (-3.34%) ⬇️
pallets/system/src/mock.rs 78.94% <0.00%> (-2.14%) ⬇️
rpc/kate-rpc/src/lib.rs 0.57% <ø> (ø)
runtime/src/lib.rs 9.23% <31.81%> (+0.92%) ⬆️
pallets/system/src/header_builder.rs 84.41% <77.41%> (+4.58%) ⬆️
... and 22 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.

@MiguelDD1 MiguelDD1 marked this pull request as ready for review October 20, 2022 14:59
@MiguelDD1 MiguelDD1 requested review from a team October 20, 2022 15:00
@MiguelDD1 MiguelDD1 merged commit 857a026 into develop Oct 26, 2022
@MiguelDD1 MiguelDD1 deleted the miguel/ava-397-compatibility-issue-between-10-11 branch October 26, 2022 07:45
luka-ethernal pushed a commit that referenced this pull request Nov 9, 2022
* Use new versioned header extensions
* Data Root without hardcode decoding
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]>
momoshell pushed a commit that referenced this pull request Apr 10, 2023
* sync http

* error commit

* changed to arc mutex from channels

* commented changes

* added status endpoint

* fmt

* updated readme

* rebased to develop
umadayal pushed a commit to succinctlabs/avail-core that referenced this pull request Oct 31, 2024
…udit/hal_0x

Audit: Minor/Info items of audit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants