Skip to content

Commit

Permalink
Drop Cbor impl for method params and return types
Browse files Browse the repository at this point in the history
  • Loading branch information
arajasek committed Dec 13, 2022
1 parent ada5a7e commit 11e8590
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 94 deletions.
4 changes: 1 addition & 3 deletions actors/account/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use fvm_ipld_encoding::serde_bytes;
use fvm_ipld_encoding::tuple::*;
use fvm_ipld_encoding::{serde_bytes, Cbor};

#[derive(Debug, Serialize_tuple, Deserialize_tuple)]
pub struct AuthenticateMessageParams {
Expand All @@ -8,5 +8,3 @@ pub struct AuthenticateMessageParams {
#[serde(with = "serde_bytes")]
pub message: Vec<u8>,
}

impl Cbor for AuthenticateMessageParams {}
5 changes: 0 additions & 5 deletions actors/datacap/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use fvm_ipld_encoding::tuple::*;
use fvm_ipld_encoding::Cbor;
use fvm_shared::address::Address;
use fvm_shared::econ::TokenAmount;

Expand All @@ -13,12 +12,8 @@ pub struct MintParams {
pub operators: Vec<Address>,
}

impl Cbor for MintParams {}

#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct DestroyParams {
pub owner: Address,
pub amount: TokenAmount,
}

impl Cbor for DestroyParams {}
5 changes: 1 addition & 4 deletions actors/init/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use cid::Cid;
use fvm_ipld_encoding::tuple::*;
use fvm_ipld_encoding::{Cbor, RawBytes};
use fvm_ipld_encoding::RawBytes;
use fvm_shared::address::Address;

/// Init actor Constructor parameters
Expand All @@ -27,6 +27,3 @@ pub struct ExecReturn {
/// Reorg safe address for actor
pub robust_address: Address,
}

impl Cbor for ExecReturn {}
impl Cbor for ExecParams {}
5 changes: 0 additions & 5 deletions actors/market/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use cid::Cid;
use fil_actors_runtime::Array;
use fvm_ipld_bitfield::BitField;
use fvm_ipld_encoding::tuple::*;
use fvm_ipld_encoding::Cbor;
use fvm_shared::address::Address;
use fvm_shared::bigint::{bigint_ser, BigInt};
use fvm_shared::clock::ChainEpoch;
Expand All @@ -28,8 +27,6 @@ pub struct WithdrawBalanceParams {
pub amount: TokenAmount,
}

impl Cbor for WithdrawBalanceParams {}

#[derive(Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct WithdrawBalanceReturn {
Expand All @@ -54,8 +51,6 @@ pub struct PublishStorageDealsParams {
pub deals: Vec<ClientDealProposal>,
}

impl Cbor for PublishStorageDealsParams {}

#[derive(Serialize_tuple, Deserialize_tuple, Debug)]
pub struct PublishStorageDealsReturn {
pub ids: Vec<DealID>,
Expand Down
41 changes: 1 addition & 40 deletions actors/miner/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use cid::Cid;
use fvm_ipld_bitfield::BitField;
use fvm_ipld_encoding::tuple::*;
use fvm_ipld_encoding::{serde_bytes, BytesDe, Cbor};
use fvm_ipld_encoding::{serde_bytes, BytesDe};
use fvm_shared::address::Address;
use fvm_shared::bigint::bigint_ser;
use fvm_shared::clock::ChainEpoch;
Expand Down Expand Up @@ -119,17 +119,13 @@ pub struct SubmitWindowedPoStParams {
pub chain_commit_rand: Randomness,
}

impl Cbor for SubmitWindowedPoStParams {}

#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct ProveCommitSectorParams {
pub sector_number: SectorNumber,
#[serde(with = "serde_bytes")]
pub proof: Vec<u8>,
}

impl Cbor for ProveCommitSectorParams {}

#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct CheckSectorProvenParams {
pub sector_number: SectorNumber,
Expand All @@ -140,8 +136,6 @@ pub struct ExtendSectorExpirationParams {
pub extensions: Vec<ExpirationExtension>,
}

impl Cbor for ExtendSectorExpirationParams {}

#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct ExpirationExtension {
pub deadline: u64,
Expand All @@ -155,17 +149,13 @@ pub struct ExtendSectorExpiration2Params {
pub extensions: Vec<ExpirationExtension2>,
}

impl Cbor for ExtendSectorExpiration2Params {}

#[derive(Clone, Debug, Serialize_tuple, Deserialize_tuple)]
pub struct SectorClaim {
pub sector_number: SectorNumber,
pub maintain_claims: Vec<ClaimID>,
pub drop_claims: Vec<ClaimID>,
}

impl Cbor for SectorClaim {}

#[derive(Clone, Debug, Serialize_tuple, Deserialize_tuple)]
pub struct ExpirationExtension2 {
pub deadline: u64,
Expand All @@ -175,8 +165,6 @@ pub struct ExpirationExtension2 {
pub new_expiration: ChainEpoch,
}

impl Cbor for ExpirationExtension2 {}

// From is straightforward when there are no claim bearing sectors
impl From<&ExpirationExtension> for ExpirationExtension2 {
fn from(e: &ExpirationExtension) -> Self {
Expand All @@ -195,8 +183,6 @@ pub struct TerminateSectorsParams {
pub terminations: Vec<TerminationDeclaration>,
}

impl Cbor for TerminateSectorsParams {}

#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct TerminationDeclaration {
pub deadline: u64,
Expand Down Expand Up @@ -234,8 +220,6 @@ pub struct DeclareFaultsRecoveredParams {
pub recoveries: Vec<RecoveryDeclaration>,
}

impl Cbor for DeclareFaultsRecoveredParams {}

#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct RecoveryDeclaration {
/// The deadline to which the recovered sectors are assigned, in range [0..WPoStPeriodDeadlines)
Expand All @@ -246,8 +230,6 @@ pub struct RecoveryDeclaration {
pub sectors: BitField,
}

impl Cbor for RecoveryDeclaration {}

#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct CompactPartitionsParams {
pub deadline: u64,
Expand All @@ -274,8 +256,6 @@ pub struct WithdrawBalanceParams {
pub amount_requested: TokenAmount,
}

impl Cbor for WithdrawBalanceParams {}

#[derive(Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct WithdrawBalanceReturn {
Expand Down Expand Up @@ -308,21 +288,16 @@ pub struct PreCommitSectorParams {
pub replace_sector_number: SectorNumber,
}

impl Cbor for PreCommitSectorParams {}

#[derive(Debug, PartialEq, Eq, Clone, Serialize_tuple, Deserialize_tuple)]
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 PreCommitSectorBatchParams2 {}

#[derive(Debug, Default, PartialEq, Eq, Clone, Serialize_tuple, Deserialize_tuple)]
pub struct SectorPreCommitInfo {
pub seal_proof: RegisteredSealProof,
Expand Down Expand Up @@ -392,16 +367,12 @@ pub struct ApplyRewardParams {
pub penalty: TokenAmount,
}

impl Cbor for DisputeWindowedPoStParams {}

#[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize_tuple, Deserialize_tuple)]
pub struct DisputeWindowedPoStParams {
pub deadline: u64,
pub post_index: u64, // only one is allowed at a time to avoid loading too many sector infos.
}

impl Cbor for ProveCommitAggregateParams {}

#[derive(Debug, Serialize_tuple, Deserialize_tuple)]
pub struct ProveCommitAggregateParams {
pub sector_numbers: BitField,
Expand All @@ -426,8 +397,6 @@ pub struct ProveReplicaUpdatesParams {
pub updates: Vec<ReplicaUpdate>,
}

impl Cbor for ProveReplicaUpdatesParams {}

#[derive(Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ReplicaUpdate2 {
pub sector_number: SectorNumber,
Expand All @@ -446,8 +415,6 @@ pub struct ProveReplicaUpdatesParams2 {
pub updates: Vec<ReplicaUpdate2>,
}

impl Cbor for ProveReplicaUpdatesParams2 {}

#[derive(Debug, Clone, Serialize_tuple, Deserialize_tuple)]
pub struct ChangeBeneficiaryParams {
pub new_beneficiary: Address,
Expand All @@ -465,20 +432,14 @@ impl ChangeBeneficiaryParams {
}
}

impl Cbor for ChangeBeneficiaryParams {}

#[derive(Debug, Serialize_tuple, Deserialize_tuple)]
pub struct ActiveBeneficiary {
pub beneficiary: Address,
pub term: BeneficiaryTerm,
}

impl Cbor for ActiveBeneficiary {}

#[derive(Debug, Serialize_tuple, Deserialize_tuple)]
pub struct GetBeneficiaryReturn {
pub active: ActiveBeneficiary,
pub proposed: Option<PendingBeneficiaryChange>,
}

impl Cbor for GetBeneficiaryReturn {}
2 changes: 1 addition & 1 deletion actors/miner/tests/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ impl ActorHarness {
rt: &mut MockRuntime,
sectors: &[SectorPreCommitInfo],
method: MethodNum,
param: impl Cbor,
param: impl Serialize,
first_for_miner: bool,
base_fee: &TokenAmount,
) -> Result<RawBytes, ActorError> {
Expand Down
12 changes: 1 addition & 11 deletions actors/multisig/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use std::fmt::Display;

use fvm_ipld_encoding::tuple::*;
use fvm_ipld_encoding::{serde_bytes, Cbor, RawBytes};
use fvm_ipld_encoding::{serde_bytes, RawBytes};
use fvm_ipld_hamt::BytesKey;
use fvm_shared::address::Address;

Expand Down Expand Up @@ -96,9 +96,6 @@ pub struct ProposeReturn {
pub ret: RawBytes,
}

impl Cbor for ProposeParams {}
impl Cbor for ProposeReturn {}

/// Parameters for approve and cancel multisig functions.
#[derive(Clone, PartialEq, Eq, Debug, Serialize_tuple, Deserialize_tuple)]
pub struct TxnIDParams {
Expand All @@ -122,9 +119,6 @@ pub struct ApproveReturn {
pub ret: RawBytes,
}

impl Cbor for TxnIDParams {}
impl Cbor for ApproveReturn {}

/// Add signer params.
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct AddSignerParams {
Expand All @@ -139,17 +133,13 @@ pub struct RemoveSignerParams {
pub decrease: bool,
}

impl Cbor for RemoveSignerParams {}

/// Swap signer multisig method params
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct SwapSignerParams {
pub from: Address,
pub to: Address,
}

impl Cbor for SwapSignerParams {}

/// Propose method call parameters
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct ChangeNumApprovalsThresholdParams {
Expand Down
3 changes: 1 addition & 2 deletions actors/power/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0, MIT

use fvm_ipld_encoding::tuple::*;
use fvm_ipld_encoding::{serde_bytes, BytesDe, Cbor, RawBytes};
use fvm_ipld_encoding::{serde_bytes, BytesDe, RawBytes};
use fvm_shared::address::Address;
use fvm_shared::bigint::bigint_ser;
use fvm_shared::clock::ChainEpoch;
Expand Down Expand Up @@ -32,7 +32,6 @@ pub struct CreateMinerParams {
pub peer: Vec<u8>,
pub multiaddrs: Vec<BytesDe>,
}
impl Cbor for CreateMinerParams {}

#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct CreateMinerReturn {
Expand Down
Loading

0 comments on commit 11e8590

Please sign in to comment.