Skip to content

Commit

Permalink
Import builtin actors v12 (#170)
Browse files Browse the repository at this point in the history
Co-authored-by: Hubert Bugaj <[email protected]>
  • Loading branch information
sudo-shashank and LesnyRumcajs authored Oct 13, 2023
1 parent 11b28c5 commit 7e1d60a
Show file tree
Hide file tree
Showing 149 changed files with 16,712 additions and 50 deletions.
55 changes: 51 additions & 4 deletions Cargo.lock

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

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,18 @@ resolver = "2"
[workspace.dependencies]
ahash = "0.8"
anyhow = "1.0"
bitflags = "2.4.0"
byteorder = "1.4.3"
cid = { version = "0.10", default-features = false, features = ["std"] }
frc42_macros = "2"
fvm_ipld_amt = { version = "0.6.1", features = ["go-interop"] }
fvm_ipld_amt = "0.6.1"
fvm_ipld_bitfield = "0.6"
fvm_ipld_blockstore = "0.2"
fvm_ipld_encoding = "0.4"
fvm_ipld_hamt = "0.8.0"
fvm_shared = { version = "~2.6", default-features = false }
fvm_shared3 = { package = "fvm_shared", version = "~3.6", default-features = false }
fvm_shared4 = { package = "fvm_shared", version = "~4.0.0-alpha.4", default-features = false }
getrandom = { version = "0.2.10" }
hex = "0.4.3"
hex-literal = "0.4"
Expand Down
1 change: 1 addition & 0 deletions actors/account/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ frc42_macros = { workspace = true }
fvm_ipld_encoding = { workspace = true }
fvm_shared = { workspace = true }
fvm_shared3 = { workspace = true }
fvm_shared4 = { workspace = true }
num-derive = { workspace = true }
num-traits = { workspace = true }
serde = { workspace = true }
1 change: 1 addition & 0 deletions actors/account/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@

pub mod v10;
pub mod v11;
pub mod v12;
pub mod v8;
pub mod v9;
22 changes: 22 additions & 0 deletions actors/account/src/v12/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2019-2022 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT

use fvm_shared4::METHOD_CONSTRUCTOR;
use num_derive::FromPrimitive;

pub use self::state::State;
pub use types::*;

mod state;
mod types;

/// Account actor methods available
#[derive(FromPrimitive)]
#[repr(u64)]
pub enum Method {
Constructor = METHOD_CONSTRUCTOR,
PubkeyAddress = 2,
// Deprecated in v10
// AuthenticateMessage = 3,
AuthenticateMessageExported = frc42_macros::method_hash!("AuthenticateMessage"),
}
11 changes: 11 additions & 0 deletions actors/account/src/v12/state.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright 2019-2022 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT

use fvm_ipld_encoding::tuple::*;
use fvm_shared4::address::Address;

/// State includes the address for the actor
#[derive(Serialize_tuple, Deserialize_tuple, Debug, Clone)]
pub struct State {
pub address: Address,
}
32 changes: 32 additions & 0 deletions actors/account/src/v12/types.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2019-2022 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT

use fvm_ipld_encoding::strict_bytes;
use fvm_ipld_encoding::tuple::*;
use fvm_shared4::address::Address;

#[derive(Debug, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct ConstructorParams {
pub address: Address,
}

#[derive(Debug, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct PubkeyAddressReturn {
pub address: Address,
}

#[derive(Debug, Serialize_tuple, Deserialize_tuple)]
pub struct AuthenticateMessageParams {
#[serde(with = "strict_bytes")]
pub signature: Vec<u8>,
#[serde(with = "strict_bytes")]
pub message: Vec<u8>,
}

#[derive(Debug, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct AuthenticateMessageReturn {
pub authenticated: bool,
}
1 change: 1 addition & 0 deletions actors/cron/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ crate-type = ["cdylib", "lib"]
fvm_ipld_encoding = { workspace = true }
fvm_shared = { workspace = true }
fvm_shared3 = { workspace = true }
fvm_shared4 = { workspace = true }
num-derive = { workspace = true }
num-traits = { workspace = true }
serde = { workspace = true }
1 change: 1 addition & 0 deletions actors/cron/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@

pub mod v10;
pub mod v11;
pub mod v12;
pub mod v8;
pub mod v9;
29 changes: 29 additions & 0 deletions actors/cron/src/v12/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright 2019-2022 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT

use fvm_ipld_encoding::tuple::*;

use fvm_shared4::METHOD_CONSTRUCTOR;
use num_derive::FromPrimitive;

pub use self::state::{Entry, State};

mod state;

// * Updated to specs-actors commit: 845089a6d2580e46055c24415a6c32ee688e5186 (v3.0.0)

/// Cron actor methods available
#[derive(FromPrimitive)]
#[repr(u64)]
pub enum Method {
Constructor = METHOD_CONSTRUCTOR,
EpochTick = 2,
}

/// Constructor parameters for Cron actor, contains entries
/// of actors and methods to call on each epoch
#[derive(Default, Debug, Serialize_tuple, Deserialize_tuple)]
pub struct ConstructorParams {
/// Entries is a set of actors (and corresponding methods) to call during EpochTick.
pub entries: Vec<Entry>,
}
21 changes: 21 additions & 0 deletions actors/cron/src/v12/state.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2019-2022 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT

use fvm_ipld_encoding::tuple::*;
use fvm_shared4::address::Address;
use fvm_shared4::MethodNum;

/// Cron actor state which holds entries to call during epoch tick
#[derive(Default, Serialize_tuple, Deserialize_tuple, Clone, Debug)]
pub struct State {
/// Entries is a set of actors (and corresponding methods) to call during EpochTick.
pub entries: Vec<Entry>,
}

#[derive(Clone, PartialEq, Eq, Debug, Serialize_tuple, Deserialize_tuple)]
pub struct Entry {
/// The actor to call (ID address)
pub receiver: Address,
/// The method number to call (must accept empty parameters)
pub method_num: MethodNum,
}
2 changes: 2 additions & 0 deletions actors/datacap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ frc42_macros = { workspace = true }
fvm_ipld_encoding = { workspace = true }
fvm_shared = { workspace = true }
fvm_shared3 = { workspace = true }
fvm_shared4 = { workspace = true }
lazy_static = { workspace = true }
num-derive = { workspace = true }
num-traits = { workspace = true }
serde = { workspace = true }
1 change: 1 addition & 0 deletions actors/datacap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@

pub mod v10;
pub mod v11;
pub mod v12;
pub mod v9;
Loading

0 comments on commit 7e1d60a

Please sign in to comment.