Skip to content
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
27 changes: 23 additions & 4 deletions modules/grandpa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -517,12 +517,31 @@ pub mod pallet {
) -> Result<(), Error<T, I>> {
let super::InitializationData { header, authority_list, set_id, operating_mode } =
init_params;
let authority_set_length = authority_list.len();
let authority_set = StoredAuthoritySet::<T, I>::try_new(authority_list, set_id)
.map_err(|_| Error::TooManyAuthoritiesInSet)?;
let header = StoredBridgedHeader::<T, I>::try_from_inner(*header)
.map_err(|_| Error::<T, I>::TooLargeHeader)?;

.map_err(|_| {
log::error!(
target: LOG_TARGET,
"Failed to initialize bridge. Number of authorities in the set {} is larger than the configured value {}",
authority_set_length,
T::MaxBridgedAuthorities::get(),
);

Error::TooManyAuthoritiesInSet
})?;
let initial_hash = header.hash();
let header = StoredBridgedHeader::<T, I>::try_from_inner(*header).map_err(|e| {
log::error!(
target: LOG_TARGET,
"Failed to initialize bridge. Size of header {:?} ({}) is larger that the configured value {}",
initial_hash,
e.value_size,
e.maximal_size,
);

Error::<T, I>::TooLargeHeader
})?;

<InitialHash<T, I>>::put(initial_hash);
<ImportedHashesPointer<T, I>>::put(0);
insert_header::<T, I>(header, initial_hash);
Expand Down
2 changes: 1 addition & 1 deletion primitives/chain-millau/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ pub const SESSION_LENGTH: BlockNumber = 5 * time_units::MINUTES;
pub const MAX_AUTHORITIES_COUNT: u32 = 5;

/// Maximal SCALE-encoded header size (in bytes) at Millau.
pub const MAX_HEADER_SIZE: u32 = 512;
pub const MAX_HEADER_SIZE: u32 = 1024;

/// Re-export `time_units` to make usage easier.
pub use time_units::*;
Expand Down
2 changes: 1 addition & 1 deletion primitives/chain-rialto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ pub const SESSION_LENGTH: BlockNumber = 4;
pub const MAX_AUTHORITIES_COUNT: u32 = 5;

/// Maximal SCALE-encoded header size (in bytes) at Rialto.
pub const MAX_HEADER_SIZE: u32 = 512;
pub const MAX_HEADER_SIZE: u32 = 1024;

/// Maximal SCALE-encoded size of parachains headers that are stored at Rialto `Paras` pallet.
pub const MAX_NESTED_PARACHAIN_HEAD_SIZE: u32 = MAX_HEADER_SIZE;
Expand Down