Rename Ethereum Headers to AuraHeader (#354)

* Rename Header to AuraHeader

This prevents some type conflicts with the PolkadotJS Apps types.

* Fix test and benchmark builds

* Update AuraHeader in types.json
This commit is contained in:
Hernando Castano
2020-09-17 07:31:22 -04:00
committed by Bastian Köcher
parent 750a369273
commit 5163f62df4
16 changed files with 94 additions and 91 deletions
+4 -4
View File
@@ -68,7 +68,7 @@ pub struct HeaderId {
/// An Aura header.
#[derive(Clone, Default, Encode, Decode, PartialEq, RuntimeDebug)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct Header {
pub struct AuraHeader {
/// Parent block hash.
pub parent_hash: H256,
/// Block timestamp.
@@ -182,7 +182,7 @@ pub struct SealedEmptyStep {
pub step: u64,
}
impl Header {
impl AuraHeader {
/// Compute id of this header.
pub fn compute_id(&self) -> HeaderId {
HeaderId {
@@ -558,7 +558,7 @@ sp_api::decl_runtime_apis! {
/// Returns number and hash of the best finalized block known to the bridge module.
fn finalized_block() -> (u64, H256);
/// Returns true if the import of given block requires transactions receipts.
fn is_import_requires_receipts(header: Header) -> bool;
fn is_import_requires_receipts(header: AuraHeader) -> bool;
/// Returns true if header is known to the runtime.
fn is_known_block(hash: H256) -> bool;
}
@@ -573,7 +573,7 @@ sp_api::decl_runtime_apis! {
/// Returns number and hash of the best finalized block known to the bridge module.
fn finalized_block() -> (u64, H256);
/// Returns true if the import of given block requires transactions receipts.
fn is_import_requires_receipts(header: Header) -> bool;
fn is_import_requires_receipts(header: AuraHeader) -> bool;
/// Returns true if header is known to the runtime.
fn is_known_block(hash: H256) -> bool;
}
@@ -23,8 +23,8 @@
pub use secp256k1::SecretKey;
use crate::{
public_to_address, rlp_encode, step_validator, Address, Header, RawTransaction, UnsignedTransaction, H256, H520,
U256,
public_to_address, rlp_encode, step_validator, Address, AuraHeader, RawTransaction, UnsignedTransaction, H256,
H520, U256,
};
use secp256k1::{Message, PublicKey};
@@ -32,9 +32,9 @@ use secp256k1::{Message, PublicKey};
/// Utilities for signing headers.
pub trait SignHeader {
/// Signs header by given author.
fn sign_by(self, author: &SecretKey) -> Header;
fn sign_by(self, author: &SecretKey) -> AuraHeader;
/// Signs header by given authors set.
fn sign_by_set(self, authors: &[SecretKey]) -> Header;
fn sign_by_set(self, authors: &[SecretKey]) -> AuraHeader;
}
/// Utilities for signing transactions.
@@ -43,7 +43,7 @@ pub trait SignTransaction {
fn sign_by(self, author: &SecretKey, chain_id: Option<u64>) -> RawTransaction;
}
impl SignHeader for Header {
impl SignHeader for AuraHeader {
fn sign_by(mut self, author: &SecretKey) -> Self {
self.author = secret_to_address(author);