Skip to content

Commit

Permalink
add babe primitive
Browse files Browse the repository at this point in the history
  • Loading branch information
nhathuyenqt committed Jan 23, 2024
1 parent a4882c0 commit 4271b50
Show file tree
Hide file tree
Showing 2,465 changed files with 602,985 additions and 6 deletions.
51 changes: 49 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions client/allocator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "sc-allocator"
version = "4.1.0-dev"
authors = ["Parity Technologies <[email protected]>"]
edition = "2021"
license = "Apache-2.0"
homepage = "https://substrate.io"
repository = "https://github.com/paritytech/substrate/"
description = "Collection of allocator implementations."
documentation = "https://docs.rs/sc-allocator"
readme = "README.md"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
log = "0.4.17"
thiserror = "1.0.30"
sp-core = { version = "21.0.0", path = "../../primitives/core" }
sp-wasm-interface = { version = "14.0.0", path = "../../primitives/wasm-interface" }
6 changes: 6 additions & 0 deletions client/allocator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Collection of allocator implementations.

This crate provides the following allocator implementations:
- A freeing-bump allocator: [`FreeingBumpHeapAllocator`](https://docs.rs/sc-allocator/latest/sc_allocator/struct.FreeingBumpHeapAllocator.html)

License: Apache-2.0
33 changes: 33 additions & 0 deletions client/allocator/src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// This file is part of Substrate.

// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/// The error type used by the allocators.
#[derive(thiserror::Error, Debug, PartialEq)]
pub enum Error {
/// Someone tried to allocate more memory than the allowed maximum per allocation.
#[error("Requested allocation size is too large")]
RequestedAllocationTooLarge,
/// Allocator run out of space.
#[error("Allocator ran out of space")]
AllocatorOutOfSpace,
/// The client passed a memory instance which is smaller than previously observed.
#[error("Shrinking of the underlying memory is observed")]
MemoryShrinked,
/// Some other error occurred.
#[error("Other: {0}")]
Other(&'static str),
}
Loading

0 comments on commit 4271b50

Please sign in to comment.