-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update runtime to new spec/ impl (#256)
* Initial pass to update to new spec/ impl * Small updates
- Loading branch information
1 parent
0c45139
commit 17a447e
Showing
16 changed files
with
320 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2020 ChainSafe Systems | ||
// SPDX-License-Identifier: Apache-2.0, MIT | ||
|
||
use num_derive::FromPrimitive; | ||
use num_traits::FromPrimitive; | ||
|
||
/// Specifies a domain for randomness generation. | ||
#[derive(PartialEq, Eq, Copy, Clone, FromPrimitive, Debug, Hash)] | ||
pub enum DomainSeparationTag { | ||
TicketProduction = 1, | ||
ElectionPoStChallengeSeed = 2, | ||
WindowedPoStChallengeSeed = 3, | ||
SealRandomness = 4, | ||
InteractiveSealChallengeSeed = 5, | ||
} | ||
|
||
impl DomainSeparationTag { | ||
/// from_byte allows generating DST from encoded byte | ||
pub fn from_byte(b: u8) -> Option<Self> { | ||
FromPrimitive::from_u8(b) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[package] | ||
name = "forest_abi" | ||
version = "0.1.0" | ||
authors = ["ChainSafe Systems <info@chainsafe.io>"] | ||
edition = "2018" | ||
|
||
[dependencies] | ||
cid = { package = "forest_cid", path = "../../ipld/cid" } | ||
num-traits = "0.2" | ||
num-derive = "0.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Copyright 2020 ChainSafe Systems | ||
// SPDX-License-Identifier: Apache-2.0, MIT | ||
|
||
mod piece; | ||
mod sector; | ||
|
||
pub use self::piece::*; | ||
pub use self::sector::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2020 ChainSafe Systems | ||
// SPDX-License-Identifier: Apache-2.0, MIT | ||
|
||
use cid::Cid; | ||
|
||
type _UnpaddedPieceSize = u64; | ||
type PaddedPieceSize = u64; | ||
|
||
// TODO implement | ||
pub struct PieceInfo { | ||
/// Size in nodes. For BLS12-381 (capacity 254 bits), must be >= 16. (16 * 8 = 128) | ||
pub size: PaddedPieceSize, | ||
/// Content identifier for piece | ||
pub cid: Cid, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright 2020 ChainSafe Systems | ||
// SPDX-License-Identifier: Apache-2.0, MIT | ||
|
||
use num_derive::FromPrimitive; | ||
use num_traits::FromPrimitive; | ||
|
||
// This ordering, defines mappings to UInt in a way which MUST never change. | ||
#[derive(PartialEq, Eq, Copy, Clone, FromPrimitive, Debug, Hash)] | ||
pub enum RegisteredProof { | ||
StackedDRG32GiBSeal = 1, | ||
StackedDRG32GiBPoSt = 2, | ||
StackedDRG2KiBSeal = 3, | ||
StackedDRG2KiBPoSt = 4, | ||
StackedDRG8MiBSeal = 5, | ||
StackedDRG8MiBPoSt = 6, | ||
StackedDRG512MiBSeal = 7, | ||
StackedDRG512MiBPoSt = 8, | ||
} | ||
|
||
impl RegisteredProof { | ||
pub fn from_byte(b: u8) -> Option<Self> { | ||
FromPrimitive::from_u8(b) | ||
} | ||
} | ||
|
||
pub struct SealVerifyInfo { | ||
// TODO implement SealVerifyInfo | ||
} | ||
|
||
pub struct PoStVerifyInfo { | ||
// TODO implement PoStVerifyInfo | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.