Skip to content

Commit

Permalink
WIP: update sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
Stebalien committed Aug 31, 2022
1 parent 63c5033 commit ec5ce00
Show file tree
Hide file tree
Showing 125 changed files with 1,121 additions and 1,165 deletions.
37 changes: 15 additions & 22 deletions Cargo.lock

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

32 changes: 16 additions & 16 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ members = [
"test_vm",
]

#[patch.crates-io]
#fvm_shared = { git = "https://github.com/filecoin-project/ref-fvm" }
#fvm_sdk = { git = "https://github.com/filecoin-project/ref-fvm" }
#fvm_ipld_hamt = { git = "https://github.com/filecoin-project/ref-fvm" }
#fvm_ipld_amt = { git = "https://github.com/filecoin-project/ref-fvm" }
#fvm_ipld_bitfield = { git = "https://github.com/filecoin-project/ref-fvm" }
#fvm_ipld_encoding = { git = "https://github.com/filecoin-project/ref-fvm" }
#fvm_ipld_blockstore = { git = "https://github.com/filecoin-project/ref-fvm" }
[patch.crates-io]
fvm_shared = { git = "https://github.com/filecoin-project/ref-fvm", branch = "backport/token-ops" }
fvm_sdk = { git = "https://github.com/filecoin-project/ref-fvm", branch = "backport/token-ops" }
fvm_ipld_hamt = { git = "https://github.com/filecoin-project/ref-fvm", branch = "backport/token-ops" }
fvm_ipld_amt = { git = "https://github.com/filecoin-project/ref-fvm", branch = "backport/token-ops" }
fvm_ipld_bitfield = { git = "https://github.com/filecoin-project/ref-fvm", branch = "backport/token-ops" }
fvm_ipld_encoding = { git = "https://github.com/filecoin-project/ref-fvm", branch = "backport/token-ops" }
fvm_ipld_blockstore = { git = "https://github.com/filecoin-project/ref-fvm", branch = "backport/token-ops" }

## 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 All @@ -76,14 +76,14 @@ members = [
## Uncomment entries below when working locally on ref-fvm and this repo simultaneously.
## Assumes the ref-fvm checkout is in a sibling directory with the same name.
## (Valid once FVM modules are published to crates.io)
# [patch.crates-io]
# fvm_shared = { path = "../ref-fvm/shared" }
# fvm_sdk = { path = "../ref-fvm/sdk" }
# fvm_ipld_hamt = { path = "../ref-fvm/ipld/hamt" }
# fvm_ipld_amt = { path = "../ref-fvm/ipld/amt" }
# fvm_ipld_bitfield = { path = "../ref-fvm/ipld/bitfield"}
# fvm_ipld_encoding = { path = "../ref-fvm/ipld/encoding"}
# fvm_ipld_blockstore = { path = "../ref-fvm/ipld/blockstore"}
#[patch.crates-io]
#fvm_shared = { path = "../ref-fvm/shared" }
#fvm_sdk = { path = "../ref-fvm/sdk" }
#fvm_ipld_hamt = { path = "../ref-fvm/ipld/hamt" }
#fvm_ipld_amt = { path = "../ref-fvm/ipld/amt" }
#fvm_ipld_bitfield = { path = "../ref-fvm/ipld/bitfield"}
#fvm_ipld_encoding = { path = "../ref-fvm/ipld/encoding"}
#fvm_ipld_blockstore = { path = "../ref-fvm/ipld/blockstore"}

[profile.wasm]
inherits = "release"
Expand Down
2 changes: 1 addition & 1 deletion actors/account/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ crate-type = ["cdylib", "lib"]

[dependencies]
fil_actors_runtime = { version = "9.0.0-alpha.1", path = "../../runtime", features = ["fil-actor"] }
fvm_shared = { version = "0.8.0", default-features = false }
fvm_shared = { version = "2.0.0-alpha.1", default-features = false }
serde = { version = "1.0.136", features = ["derive"] }
num-traits = "0.2.14"
num-derive = "0.3.3"
Expand Down
2 changes: 1 addition & 1 deletion actors/cron/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ crate-type = ["cdylib", "lib"]

[dependencies]
fil_actors_runtime = { version = "9.0.0-alpha.1", path = "../../runtime", features = ["fil-actor"] }
fvm_shared = { version = "0.8.0", default-features = false }
fvm_shared = { version = "2.0.0-alpha.1", default-features = false }
num-traits = "0.2.14"
num-derive = "0.3.3"
log = "0.4.14"
Expand Down
4 changes: 2 additions & 2 deletions actors/cron/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use fvm_shared::econ::TokenAmount;

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

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

Expand Down Expand Up @@ -68,7 +68,7 @@ impl Actor {
&entry.receiver,
entry.method_num,
RawBytes::default(),
TokenAmount::from(0u8),
TokenAmount::zero(),
);
if let Err(e) = res {
log::error!(
Expand Down
10 changes: 6 additions & 4 deletions actors/cron/tests/cron_actor_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ use fil_actors_runtime::test_utils::*;
use fil_actors_runtime::SYSTEM_ACTOR_ADDR;
use fvm_ipld_encoding::RawBytes;
use fvm_shared::address::Address;
use fvm_shared::econ::TokenAmount;
use fvm_shared::error::ExitCode;
use num_traits::Zero;

fn check_state(rt: &MockRuntime) {
let (_, acc) = check_state_invariants(&rt.get_state());
Expand Down Expand Up @@ -79,31 +81,31 @@ fn epoch_tick_with_entries() {
entry1.receiver,
entry1.method_num,
RawBytes::default(),
0u8.into(),
TokenAmount::zero(),
RawBytes::default(),
ExitCode::OK,
);
rt.expect_send(
entry2.receiver,
entry2.method_num,
RawBytes::default(),
0u8.into(),
TokenAmount::zero(),
RawBytes::default(),
ExitCode::USR_ILLEGAL_ARGUMENT,
);
rt.expect_send(
entry3.receiver,
entry3.method_num,
RawBytes::default(),
0u8.into(),
TokenAmount::zero(),
RawBytes::default(),
ExitCode::OK,
);
rt.expect_send(
entry4.receiver,
entry4.method_num,
RawBytes::default(),
0u8.into(),
TokenAmount::zero(),
RawBytes::default(),
ExitCode::OK,
);
Expand Down
2 changes: 1 addition & 1 deletion actors/init/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ crate-type = ["cdylib", "lib"]

[dependencies]
fil_actors_runtime = { version = "9.0.0-alpha.1", path = "../../runtime", features = ["fil-actor"] }
fvm_shared = { version = "0.8.0", default-features = false }
fvm_shared = { version = "2.0.0-alpha.1", default-features = false }
fvm_ipld_hamt = "0.5.1"
serde = { version = "1.0.136", features = ["derive"] }
num-traits = "0.2.14"
Expand Down
15 changes: 8 additions & 7 deletions actors/init/tests/init_actor_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use fvm_shared::address::Address;
use fvm_shared::econ::TokenAmount;
use fvm_shared::error::ExitCode;
use fvm_shared::{HAMT_BIT_WIDTH, METHOD_CONSTRUCTOR};
use num_traits::Zero;
use serde::Serialize;

fn check_state(rt: &MockRuntime) {
Expand Down Expand Up @@ -72,7 +73,7 @@ fn repeated_robust_address() {
expected_id_addr,
METHOD_CONSTRUCTOR,
RawBytes::serialize(&fake_params).unwrap(),
0u8.into(),
TokenAmount::zero(),
RawBytes::default(),
ExitCode::OK,
);
Expand Down Expand Up @@ -116,8 +117,8 @@ fn create_2_payment_channels() {
let pay_channel_string = format!("paych_{}", n);
let paych = pay_channel_string.as_bytes();

rt.set_balance(TokenAmount::from(100));
rt.value_received = TokenAmount::from(100);
rt.set_balance(TokenAmount::from_atto(100));
rt.value_received = TokenAmount::from_atto(100);

let unique_address = Address::new_actor(paych);
rt.new_actor_addr = Some(Address::new_actor(paych));
Expand All @@ -129,7 +130,7 @@ fn create_2_payment_channels() {
let fake_params = ConstructorParams { network_name: String::from("fake_param") };

// expect anne creating a payment channel to trigger a send to the payment channels constructor
let balance = TokenAmount::from(100u8);
let balance = TokenAmount::from_atto(100u8);

rt.expect_send(
expected_id_addr,
Expand Down Expand Up @@ -177,7 +178,7 @@ fn create_storage_miner() {
expected_id_addr,
METHOD_CONSTRUCTOR,
RawBytes::serialize(&fake_params).unwrap(),
0u8.into(),
TokenAmount::zero(),
RawBytes::default(),
ExitCode::OK,
);
Expand Down Expand Up @@ -228,7 +229,7 @@ fn create_multisig_actor() {
expected_id_addr,
METHOD_CONSTRUCTOR,
RawBytes::serialize(&fake_params).unwrap(),
0u8.into(),
TokenAmount::zero(),
RawBytes::default(),
ExitCode::OK,
);
Expand Down Expand Up @@ -263,7 +264,7 @@ fn sending_constructor_failure() {
expected_id_addr,
METHOD_CONSTRUCTOR,
RawBytes::serialize(&fake_params).unwrap(),
0u8.into(),
TokenAmount::zero(),
RawBytes::default(),
ExitCode::USR_ILLEGAL_STATE,
);
Expand Down
2 changes: 1 addition & 1 deletion actors/market/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ crate-type = ["cdylib", "lib"]
[dependencies]
fil_actors_runtime = { version = "9.0.0-alpha.1", path = "../../runtime", features = ["fil-actor"] }
fvm_ipld_hamt = "0.5.1"
fvm_shared = { version = "0.8.0", default-features = false }
fvm_shared = { version = "2.0.0-alpha.1", default-features = false }
fvm_ipld_bitfield = "0.5.2"
num-traits = "0.2.14"
num-derive = "0.3.3"
Expand Down
Loading

0 comments on commit ec5ce00

Please sign in to comment.