Skip to content

Commit

Permalink
Merge branch 'fix/selfdestruct-test' into raulk/events-alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
raulk committed Jan 31, 2023
2 parents 7e8c667 + a8f1ed0 commit b8fcf04
Show file tree
Hide file tree
Showing 145 changed files with 5,922 additions and 3,460 deletions.
309 changes: 199 additions & 110 deletions Cargo.lock

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fil_actor_system = { version = "10.0.0-alpha.1", path = "./actors/system", featu
fil_actor_verifreg = { version = "10.0.0-alpha.1", path = "./actors/verifreg", features = ["fil-actor"] }

[build-dependencies]
fil_actor_bundler = "4.1.0"
fil_actor_bundler = "5.0.0"
cid = { version = "0.8.3", default-features = false, features = ["serde-codec"] }
fil_actors_runtime = { version = "10.0.0-alpha.1", path = "runtime" }
num-traits = "0.2.15"
Expand All @@ -53,17 +53,16 @@ m2-native = []
members = ["actors/*", "state", "runtime", "test_vm"]

[patch.crates-io]
frc42_dispatch = { git = "https://github.com/filecoin-project/filecoin-actor-utils", branch = "feat/fvm-m2" }
frc46_token = { git = "https://github.com/filecoin-project/filecoin-actor-utils", branch = "feat/fvm-m2" }
fvm_actor_utils = { git = "https://github.com/filecoin-project/filecoin-actor-utils", branch = "feat/fvm-m2" }
#fvm_shared = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }
#fvm_sdk = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }
#fvm_ipld_hamt = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }
#fvm_ipld_kamt = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }
#fvm_ipld_amt = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }
#fvm_ipld_bitfield = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }
#fvm_ipld_encoding = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }
#fvm_ipld_blockstore = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }
#fvm_actor_utils = { git = "https://github.com/helix-onchain/filecoin", branch = "main" }
#frc42_dispatch = { git = "https://github.com/helix-onchain/filecoin", branch = "main" }
#frc46_token = { git = "https://github.com/helix-onchain/filecoin", branch = "main" }

## Uncomment when working locally on ref-fvm and this repo simultaneously.
## Assumes the ref-fvm checkout is in a sibling directory with the same name.
Expand Down
8 changes: 4 additions & 4 deletions actors/account/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ crate-type = ["cdylib", "lib"]

[dependencies]
fil_actors_runtime = { version = "10.0.0-alpha.1", path = "../../runtime" }
fvm_shared = { version = "3.0.0-alpha.16", default-features = false }
frc42_dispatch = "3.0.0"
fvm_actor_utils = "3.0.0"
frc42_dispatch = "3.0.1-alpha.1"
fvm_actor_utils = "4.0.0"
fvm_shared = { version = "3.0.0-alpha.17", default-features = false }
serde = { version = "1.0.136", features = ["derive"] }
num-traits = "0.2.14"
num-derive = "0.3.3"
fvm_ipld_blockstore = "0.1.1"
fvm_ipld_encoding = "0.3.2"
fvm_ipld_encoding = "0.3.3"
anyhow = "1.0.65"

[dev-dependencies]
Expand Down
23 changes: 13 additions & 10 deletions actors/account/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
// Copyright 2019-2022 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT

use fvm_actor_utils::receiver::UniversalReceiverParams;
use fvm_ipld_encoding::ipld_block::IpldBlock;
use fvm_shared::address::{Address, Protocol};
use fvm_shared::crypto::signature::SignatureType::{Secp256k1, BLS};
use fvm_shared::crypto::signature::{Signature, SignatureType};
use fvm_shared::error::ExitCode;
use fvm_shared::{MethodNum, METHOD_CONSTRUCTOR};
use num_derive::FromPrimitive;
use num_traits::FromPrimitive;

use fil_actors_runtime::builtin::singletons::SYSTEM_ACTOR_ADDR;
use fil_actors_runtime::runtime::{ActorCode, Runtime};
use fil_actors_runtime::{actor_dispatch, restrict_internal_api, ActorDowncast};
use fil_actors_runtime::{actor_dispatch, ActorDowncast, FIRST_EXPORTED_METHOD_NUMBER};
use fil_actors_runtime::{actor_error, ActorError};

use crate::types::AuthenticateMessageParams;
Expand All @@ -35,7 +34,6 @@ pub enum Method {
// Deprecated in v10
// AuthenticateMessage = 3,
AuthenticateMessageExported = frc42_dispatch::method_hash!("AuthenticateMessage"),
UniversalReceiverHook = frc42_dispatch::method_hash!("Receive"),
}

/// Account Actor
Expand Down Expand Up @@ -92,13 +90,18 @@ impl Actor {
Ok(())
}

// Always succeeds, accepting any transfers.
pub fn universal_receiver_hook(
/// Fallback method for unimplemented method numbers.
pub fn fallback(
rt: &mut impl Runtime,
_params: UniversalReceiverParams,
) -> Result<(), ActorError> {
method: MethodNum,
_: Option<IpldBlock>,
) -> Result<Option<IpldBlock>, ActorError> {
rt.validate_immediate_caller_accept_any()?;
Ok(())
if method >= FIRST_EXPORTED_METHOD_NUMBER {
Ok(None)
} else {
Err(actor_error!(unhandled_message; "invalid method: {}", method))
}
}
}

Expand All @@ -108,6 +111,6 @@ impl ActorCode for Actor {
Constructor => constructor,
PubkeyAddress => pubkey_address,
AuthenticateMessageExported => authenticate_message,
UniversalReceiverHook => universal_receiver_hook,
_ => fallback [raw],
}
}
2 changes: 1 addition & 1 deletion actors/account/tests/account_actor_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fn token_receiver() {
rt.expect_validate_caller_any();
let ret = rt
.call::<AccountActor>(
Method::UniversalReceiverHook as MethodNum,
frc42_dispatch::method_hash!("Receive"),
IpldBlock::serialize_cbor(&UniversalReceiverParams {
type_: 0,
payload: RawBytes::new(vec![1, 2, 3]),
Expand Down
4 changes: 2 additions & 2 deletions actors/cron/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ crate-type = ["cdylib", "lib"]

[dependencies]
fil_actors_runtime = { version = "10.0.0-alpha.1", path = "../../runtime" }
fvm_shared = { version = "3.0.0-alpha.16", default-features = false }
fvm_shared = { version = "3.0.0-alpha.17", default-features = false }
num-traits = "0.2.14"
num-derive = "0.3.3"
log = "0.4.14"
serde = { version = "1.0.136", features = ["derive"] }
fvm_ipld_blockstore = "0.1.1"
fvm_ipld_encoding = "0.3.2"
fvm_ipld_encoding = "0.3.3"

[dev-dependencies]
fil_actors_runtime = { version = "10.0.0-alpha.1", path = "../../runtime", features = ["test_utils", "sector-default"] }
Expand Down
8 changes: 3 additions & 5 deletions actors/cron/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
// SPDX-License-Identifier: Apache-2.0, MIT

use fil_actors_runtime::runtime::{ActorCode, Runtime};
use fil_actors_runtime::{
actor_dispatch, actor_error, restrict_internal_api, ActorError, SYSTEM_ACTOR_ADDR,
};
use fil_actors_runtime::{actor_dispatch, actor_error, ActorError, SYSTEM_ACTOR_ADDR};

use fvm_ipld_encoding::tuple::*;
use fvm_shared::econ::TokenAmount;

use fvm_shared::{MethodNum, METHOD_CONSTRUCTOR};
use fvm_shared::METHOD_CONSTRUCTOR;
use num_derive::FromPrimitive;
use num_traits::{FromPrimitive, Zero};
use num_traits::Zero;

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

Expand Down
10 changes: 5 additions & 5 deletions actors/datacap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ crate-type = ["cdylib", "lib"]
fil_actors_runtime = { version = "10.0.0-alpha.1", path = "../../runtime"}

cid = { version = "0.8.3", default-features = false, features = ["serde-codec"] }
frc42_dispatch = "3.0.0"
frc46_token = "3.1.0"
fvm_actor_utils = "3.0.0"
frc42_dispatch = "3.0.1-alpha.1"
frc46_token = "4.0.0"
fvm_actor_utils = "4.0.0"
fvm_ipld_blockstore = "0.1.1"
fvm_ipld_encoding = "0.3.2"
fvm_ipld_encoding = "0.3.3"
fvm_ipld_hamt = "0.6.1"
fvm_shared = { version = "3.0.0-alpha.16", default-features = false }
fvm_shared = { version = "3.0.0-alpha.17", default-features = false }
lazy_static = "1.4.0"
num-derive = "0.3.3"
num-traits = "0.2.14"
Expand Down
Loading

0 comments on commit b8fcf04

Please sign in to comment.