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

Ghali/prepare mainnet #76

Merged
merged 4 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
541 changes: 263 additions & 278 deletions Cargo.lock

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ tiny-keccak = { version = "2.0.2", default-features = false, features = ["keccak


# Substrate
binary-merkle-tree = { git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-v1.6.0-patch", default-features = false, optional = true }
binary-merkle-tree = { git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-1.7.1-patch", default-features = false, optional = true }
codec = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "max-encoded-len"] }
scale-info = { version = "2", default-features = false, features = ["derive"] }
sp-arithmetic = { git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-v1.6.0-patch", default-features = false }
sp-core = { git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-v1.6.0-patch", default-features = false }
sp-io = { git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-v1.6.0-patch", default-features = false }
sp-std = { git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-v1.6.0-patch", default-features = false }
sp-trie = { git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-v1.6.0-patch", default-features = false }
sp-arithmetic = { git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-1.7.1-patch", default-features = false }
sp-core = { git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-1.7.1-patch", default-features = false }
sp-io = { git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-1.7.1-patch", default-features = false }
sp-std = { git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-1.7.1-patch", default-features = false }
sp-trie = { git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-1.7.1-patch", default-features = false }

# Substrate Runtime
frame-support = { git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-v1.6.0-patch", default-features = false, optional = true }
sp-runtime = { git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-v1.6.0-patch", default-features = false, optional = true }
sp-runtime-interface = {git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-v1.6.0-patch", default-features = false, optional = true }
frame-support = { git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-1.7.1-patch", default-features = false, optional = true }
sp-runtime = { git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-1.7.1-patch", default-features = false, optional = true }
sp-runtime-interface = {git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-1.7.1-patch", default-features = false, optional = true }

[dev-dependencies]
hex-literal = { version = "0.3.4" }
Expand Down
197 changes: 0 additions & 197 deletions core/src/data_proof.rs

This file was deleted.

31 changes: 10 additions & 21 deletions core/src/header/extension/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,29 @@

use crate::{DataLookup, HeaderVersion};

pub mod v1;
pub mod v2;
pub mod v3;

/// Header extension data.
#[derive(PartialEq, Eq, Clone, RuntimeDebug, TypeInfo, Encode, Decode)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "runtime", derive(PassByCodec))]
#[repr(u8)]
pub enum HeaderExtension {
V1(v1::HeaderExtension),
V2(v2::HeaderExtension),
V3(v3::HeaderExtension) = 3,

Check warning on line 19 in core/src/header/extension/mod.rs

View workflow job for this annotation

GitHub Actions / build_and_test

casting integer literal to `u8` is unnecessary
}

/// It forwards the call to the inner version of the header. Any invalid version will return the
/// default value or execute an empty block.
macro_rules! forward_to_version {
($self:ident, $function:ident) => {{
match $self {
HeaderExtension::V1(ext) => ext.$function(),
HeaderExtension::V2(ext) => ext.$function(),
HeaderExtension::V3(ext) => ext.$function(),
}
}};

($self:ident, $function:ident, $arg:expr) => {{
match $self {
HeaderExtension::V1(ext) => ext.$function($arg),
HeaderExtension::V2(ext) => ext.$function($arg),
HeaderExtension::V3(ext) => ext.$function($arg),
}
}};
}
Expand All @@ -57,28 +54,20 @@

pub fn get_header_version(&self) -> HeaderVersion {
match self {
HeaderExtension::V1(_) => HeaderVersion::V1,
HeaderExtension::V2(_) => HeaderVersion::V2,
HeaderExtension::V3(_) => HeaderVersion::V3,
}
}
}

impl Default for HeaderExtension {
fn default() -> Self {
v1::HeaderExtension::default().into()
v3::HeaderExtension::default().into()
}
}

impl From<v1::HeaderExtension> for HeaderExtension {
impl From<v3::HeaderExtension> for HeaderExtension {
#[inline]
fn from(ext: v1::HeaderExtension) -> Self {
Self::V1(ext)
}
}

impl From<v2::HeaderExtension> for HeaderExtension {
#[inline]
fn from(ext: v2::HeaderExtension) -> Self {
Self::V2(ext)
fn from(ext: v3::HeaderExtension) -> Self {
Self::V3(ext)
}
}
33 changes: 0 additions & 33 deletions core/src/header/extension/v2.rs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use scale_info::TypeInfo;
use serde::{Deserialize, Serialize};
use sp_core::{RuntimeDebug, H256};

use crate::{v1::KateCommitment, DataLookup};
use crate::{v3::KateCommitment, DataLookup};

#[derive(PartialEq, Eq, Clone, RuntimeDebug, TypeInfo, Encode, Decode, Default)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
Expand Down
Loading
Loading