Skip to content

Commit

Permalink
Enable Forward Compatibility methods and add tests (#650)
Browse files Browse the repository at this point in the history
* Enable Forward Compatibility methods and add tests

Signed-off-by: Jakub Sztandera <[email protected]>

* Address review

Signed-off-by: Jakub Sztandera <[email protected]>

* Add tests for ReplicaUpdate2

Signed-off-by: Jakub Sztandera <[email protected]>

* Remove duplicate pub use

Signed-off-by: Jakub Sztandera <[email protected]>

* Test v2 pre-commit in integration test

Signed-off-by: Jakub Sztandera <[email protected]>

Signed-off-by: Jakub Sztandera <[email protected]>
  • Loading branch information
Jakub Sztandera authored Sep 21, 2022
1 parent d98b5b7 commit fa94365
Show file tree
Hide file tree
Showing 10 changed files with 548 additions and 153 deletions.
24 changes: 24 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions actors/miner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ fil_actor_market = { path = "../market" }
rand = "0.8.5"
cid = { version = "0.8.3", default-features = false, features = ["serde-codec"] }
multihash = { version = "0.16.1", default-features = false }
test-case = "2.2.1"
[features]
fil-actor = []

7 changes: 2 additions & 5 deletions actors/miner/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub use bitfield_queue::*;
use byteorder::{BigEndian, ByteOrder, WriteBytesExt};
use cid::multihash::Code;
use cid::Cid;
pub use commd::*;
pub use deadline_assignment::*;
pub use deadline_info::*;
pub use deadline_state::*;
Expand All @@ -33,6 +34,7 @@ use fvm_shared::econ::TokenAmount;
// They're not expected to ever happen, but if they do, distinguished codes can help us
// diagnose the problem.

use crate::Code::Blake2b256;
pub use beneficiary::*;
use fil_actors_runtime::cbor::{deserialize, serialize, serialize_vec};
use fil_actors_runtime::runtime::builtins::Type;
Expand All @@ -55,9 +57,6 @@ pub use termination::*;
pub use types::*;
pub use vesting_state::*;

use crate::commd::{is_unsealed_sector, CompactCommD};
use crate::Code::Blake2b256;

#[cfg(feature = "fil-actor")]
fil_actors_runtime::wasm_trampoline!(Actor);

Expand Down Expand Up @@ -4866,13 +4865,11 @@ impl ActorCode for Actor {
}
#[allow(unreachable_code)]
Some(Method::PreCommitSectorBatch2) => {
return Err(actor_error!(unhandled_message, "Invalid method"));
Self::pre_commit_sector_batch2(rt, cbor::deserialize_params(params)?)?;
Ok(RawBytes::default())
}
#[allow(unreachable_code)]
Some(Method::ProveReplicaUpdates2) => {
return Err(actor_error!(unhandled_message, "Invalid method"));
let res = Self::prove_replica_updates2(rt, cbor::deserialize_params(params)?)?;
Ok(RawBytes::serialize(res)?)
}
Expand Down
4 changes: 3 additions & 1 deletion actors/miner/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,14 @@ impl Cbor for PreCommitSectorParams {}
pub struct PreCommitSectorBatchParams {
pub sectors: Vec<PreCommitSectorParams>,
}
impl Cbor for PreCommitSectorBatchParams {}

#[derive(Debug, PartialEq, Eq, Clone, Serialize_tuple, Deserialize_tuple)]
pub struct PreCommitSectorBatchParams2 {
pub sectors: Vec<SectorPreCommitInfo>,
}

impl Cbor for PreCommitSectorBatchParams {}
impl Cbor for PreCommitSectorBatchParams2 {}

#[derive(Debug, Default, PartialEq, Eq, Clone, Serialize_tuple, Deserialize_tuple)]
pub struct SectorPreCommitInfo {
Expand Down
Loading

0 comments on commit fa94365

Please sign in to comment.