diff --git a/Cargo.lock b/Cargo.lock index 5ba2eaa424e5..41010b59c672 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3159,6 +3159,7 @@ dependencies = [ "fvm 2.11.1", "fvm 3.13.1", "fvm 4.7.2", + "fvm_actor_utils", "fvm_ipld_blockstore", "fvm_ipld_encoding", "fvm_shared 2.11.1", diff --git a/Cargo.toml b/Cargo.toml index bde7c85f824e..2e8d5e1a2a98 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -224,6 +224,7 @@ zstd = "0.13" # optional dependencies console-subscriber = { version = "0.4", features = ["parking_lot"], optional = true } +fvm_actor_utils = "14.0.0" paste = "1" tikv-jemallocator = { version = "0.6", optional = true } tracing-chrome = { version = "0.7", optional = true } diff --git a/src/lotus_json/actor_states/methods/mod.rs b/src/lotus_json/actor_states/methods/mod.rs index 41f73239107d..26306884b914 100644 --- a/src/lotus_json/actor_states/methods/mod.rs +++ b/src/lotus_json/actor_states/methods/mod.rs @@ -1,5 +1,6 @@ // Copyright 2019-2025 ChainSafe Systems // SPDX-License-Identifier: Apache-2.0, MIT + use super::*; mod account_authenticate_params; mod account_constructor_params; @@ -14,3 +15,4 @@ mod miner_constructor_params; mod multisig_actor; mod power_actor; mod reward_methods; +pub mod verified_reg_actor; diff --git a/src/lotus_json/actor_states/methods/verified_reg_actor.rs b/src/lotus_json/actor_states/methods/verified_reg_actor.rs new file mode 100644 index 000000000000..06d86ba03102 --- /dev/null +++ b/src/lotus_json/actor_states/methods/verified_reg_actor.rs @@ -0,0 +1,1255 @@ +// Copyright 2019-2025 ChainSafe Systems +// SPDX-License-Identifier: Apache-2.0, MIT + +use super::*; +use crate::shim::address::Address; +use crate::shim::clock::ChainEpoch; +use crate::shim::sector::SectorNumber; +use ::cid::Cid; +use fvm_ipld_encoding::RawBytes; +use fvm_shared4::{ActorID, bigint::BigInt}; +use paste::paste; +use serde::{Deserialize, Serialize}; + +#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone, PartialEq)] +#[serde(rename_all = "PascalCase")] +pub struct ConstructorParamsLotusJson( + #[schemars(with = "LotusJson
")] + #[serde(with = "crate::lotus_json")] + Address, +); + +#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone, PartialEq)] +#[serde(rename_all = "PascalCase")] +pub struct VerifierParamsLotusJson { + #[schemars(with = "LotusJson
")] + #[serde(with = "crate::lotus_json")] + pub address: Address, + #[schemars(with = "LotusJson")] + #[serde(with = "crate::lotus_json")] + pub allowance: BigInt, +} + +#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone, PartialEq)] +#[serde(rename_all = "PascalCase")] +pub struct RemoveVerifierParamsLotusJson( + #[schemars(with = "LotusJson
")] + #[serde(with = "crate::lotus_json")] + Address, +); + +// Version-specific structs for different FVM versions to avoid conversion issues +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] +#[serde(rename_all = "PascalCase")] +pub struct RemoveDataCapParamsV2LotusJson { + #[serde(with = "crate::lotus_json")] + pub verified_client_to_remove: Address, + #[serde(with = "crate::lotus_json")] + pub data_cap_amount_to_remove: BigInt, + pub verifier_request_1: RemoveDataCapRequestV2LotusJson, + pub verifier_request_2: RemoveDataCapRequestV2LotusJson, +} + +#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone, PartialEq)] +#[serde(rename_all = "PascalCase")] +pub struct RemoveDataCapRequestV2LotusJson { + #[schemars(with = "LotusJson
")] + #[serde(with = "crate::lotus_json")] + pub verifier: Address, + #[schemars(with = "LotusJson")] + #[serde(with = "crate::lotus_json")] + #[serde(rename = "VerifierSignature")] + pub signature: fvm_shared2::crypto::signature::Signature, +} + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] +#[serde(rename_all = "PascalCase")] +pub struct RemoveDataCapParamsV3LotusJson { + #[serde(with = "crate::lotus_json")] + pub verified_client_to_remove: Address, + #[serde(with = "crate::lotus_json")] + pub data_cap_amount_to_remove: BigInt, + pub verifier_request_1: RemoveDataCapRequestV3LotusJson, + pub verifier_request_2: RemoveDataCapRequestV3LotusJson, +} + +#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone, PartialEq)] +#[serde(rename_all = "PascalCase")] +pub struct RemoveDataCapRequestV3LotusJson { + #[schemars(with = "LotusJson
")] + #[serde(with = "crate::lotus_json")] + pub verifier: Address, + #[schemars(with = "LotusJson")] + #[serde(with = "crate::lotus_json")] + #[serde(rename = "VerifierSignature")] + pub signature: fvm_shared3::crypto::signature::Signature, +} + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] +#[serde(rename_all = "PascalCase")] +pub struct RemoveDataCapParamsV4LotusJson { + #[serde(with = "crate::lotus_json")] + pub verified_client_to_remove: Address, + #[serde(with = "crate::lotus_json")] + pub data_cap_amount_to_remove: BigInt, + pub verifier_request_1: RemoveDataCapRequestV4LotusJson, + pub verifier_request_2: RemoveDataCapRequestV4LotusJson, +} + +#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone, PartialEq)] +#[serde(rename_all = "PascalCase")] +pub struct RemoveDataCapRequestV4LotusJson { + #[schemars(with = "LotusJson
")] + #[serde(with = "crate::lotus_json")] + pub verifier: Address, + #[schemars(with = "LotusJson")] + #[serde(with = "crate::lotus_json")] + #[serde(rename = "VerifierSignature")] + pub signature: fvm_shared4::crypto::signature::Signature, +} + +#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone, PartialEq)] +#[serde(rename_all = "PascalCase")] +pub struct RemoveExpiredAllocationsParamsLotusJson { + #[schemars(with = "LotusJson")] + #[serde(with = "crate::lotus_json")] + pub client: ActorID, + #[schemars(with = "LotusJson>")] + #[serde(with = "crate::lotus_json")] + pub allocation_ids: Vec, +} + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] +#[serde(rename_all = "PascalCase")] +pub struct ClaimAllocationsParamsLotusJson { + pub sectors: Vec, + pub all_or_nothing: bool, +} + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] +#[serde(rename_all = "PascalCase")] +pub struct SectorAllocationClaimsLotusJson { + #[serde(with = "crate::lotus_json")] + pub sector: SectorNumber, + #[serde(with = "crate::lotus_json")] + #[serde(rename = "SectorExpiry")] + pub expiry: ChainEpoch, + pub claims: Vec, +} + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] +#[serde(rename_all = "PascalCase")] +pub struct AllocationClaimLotusJson { + #[serde(with = "crate::lotus_json")] + pub client: ActorID, + pub allocation_id: u64, + #[serde(with = "crate::lotus_json")] + pub data: Cid, + pub size: u64, +} + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] +#[serde(rename_all = "PascalCase")] +pub struct ClaimAllocationsParamsV11LotusJson { + pub sectors: Vec, + pub all_or_nothing: bool, +} + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] +#[serde(rename_all = "PascalCase")] +pub struct SectorAllocationClaimV11LotusJson { + #[serde(with = "crate::lotus_json")] + pub client: ActorID, + pub allocation_id: u64, + #[serde(with = "crate::lotus_json")] + pub data: Cid, + pub size: u64, + #[serde(with = "crate::lotus_json")] + pub sector: SectorNumber, + #[serde(with = "crate::lotus_json")] + pub sector_expiry: ChainEpoch, +} + +#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone, PartialEq)] +#[serde(rename_all = "PascalCase")] +pub struct GetClaimsParamsLotusJson { + #[schemars(with = "LotusJson")] + #[serde(with = "crate::lotus_json")] + pub provider: ActorID, + #[schemars(with = "LotusJson>")] + #[serde(with = "crate::lotus_json")] + pub claim_ids: Vec, +} + +#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone, PartialEq)] +#[serde(rename_all = "PascalCase")] +pub struct ExtendClaimTermsParamsLotusJson { + pub terms: Vec, +} + +#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone, PartialEq)] +#[serde(rename_all = "PascalCase")] +pub struct ClaimTermLotusJson { + #[schemars(with = "LotusJson")] + #[serde(with = "crate::lotus_json")] + pub provider: ActorID, + pub claim_id: u64, + #[schemars(with = "LotusJson")] + #[serde(with = "crate::lotus_json")] + pub term_max: ChainEpoch, +} + +#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone, PartialEq)] +#[serde(rename_all = "PascalCase")] +pub struct RemoveExpiredClaimsParamsLotusJson { + #[schemars(with = "LotusJson")] + #[serde(with = "crate::lotus_json")] + pub provider: ActorID, + #[schemars(with = "LotusJson>")] + #[serde(with = "crate::lotus_json")] + pub claim_ids: Vec, +} + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] +#[serde(rename_all = "PascalCase")] +pub struct AllocationRequestsLotusJson { + pub allocations: Vec, + pub extensions: Vec, +} + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] +#[serde(rename_all = "PascalCase")] +pub struct AllocationRequestLotusJson { + #[serde(with = "crate::lotus_json")] + pub provider: ActorID, + #[serde(with = "crate::lotus_json")] + pub data: Cid, + pub size: PaddedPieceSize, + #[serde(with = "crate::lotus_json")] + pub term_min: ChainEpoch, + #[serde(with = "crate::lotus_json")] + pub term_max: ChainEpoch, + #[serde(with = "crate::lotus_json")] + pub expiration: ChainEpoch, +} + +#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone, PartialEq)] +#[serde(rename_all = "PascalCase")] +pub struct ClaimExtensionRequestLotusJson { + #[schemars(with = "LotusJson")] + #[serde(with = "crate::lotus_json")] + pub provider: ActorID, + pub claim: u64, + #[schemars(with = "LotusJson")] + #[serde(with = "crate::lotus_json")] + pub term_max: ChainEpoch, +} + +#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone, PartialEq)] +#[serde(rename_all = "PascalCase")] +pub struct UniversalReceiverParamsLotusJson { + #[serde(rename = "Type_")] + pub type_: u32, + #[schemars(with = "LotusJson")] + #[serde(with = "crate::lotus_json")] + pub payload: RawBytes, +} + +#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone, PartialEq)] +#[serde(rename_all = "PascalCase")] +pub struct BytesParamsLotusJson { + #[schemars(with = "LotusJson
")] + #[serde(with = "crate::lotus_json")] + pub address: Address, + #[schemars(with = "LotusJson")] + #[serde(with = "crate::lotus_json")] + pub deal_size: BigInt, +} + +macro_rules! impl_constructor_params { + ($($version:literal),+) => { + $( + paste! { + impl HasLotusJson for fil_actor_verifreg_state::[]::ConstructorParams { + type LotusJson = ConstructorParamsLotusJson; + + #[cfg(test)] + fn snapshots() -> Vec<(serde_json::Value, Self)> { + vec![( + json!({ + "RootKey": "f01234", + }), + Self { + root_key: Address::new_id(1234).into(), + }, + )] + } + + fn into_lotus_json(self) -> Self::LotusJson { + ConstructorParamsLotusJson(self.root_key.into()) + } + + fn from_lotus_json(lotus_json: Self::LotusJson) -> Self { + Self { + root_key: lotus_json.0.into(), + } + } + } + } + )+ + }; +} + +macro_rules! impl_verifier_params { + ($($version:literal),+) => { + $( + paste! { + impl HasLotusJson for fil_actor_verifreg_state::[]::VerifierParams { + type LotusJson = VerifierParamsLotusJson; + + #[cfg(test)] + fn snapshots() -> Vec<(serde_json::Value, Self)> { + vec![( + json!({ + "Address": "f01234", + "Allowance": "1000000000000000000", + }), + Self { + address: Address::new_id(1234).into(), + allowance: BigInt::from(1000000000000000000u64), + }, + )] + } + + fn into_lotus_json(self) -> Self::LotusJson { + VerifierParamsLotusJson { + address: self.address.into(), + allowance: self.allowance, + } + } + + fn from_lotus_json(lotus_json: Self::LotusJson) -> Self { + Self { + address: lotus_json.address.into(), + allowance: lotus_json.allowance, + } + } + } + } + )+ + }; +} + +// Implementation for RemoveVerifierParams +macro_rules! impl_remove_verifier_params { + ($($version:literal),+) => { + $( + paste! { + impl HasLotusJson for fil_actor_verifreg_state::[]::RemoveVerifierParams { + type LotusJson = RemoveVerifierParamsLotusJson; + + #[cfg(test)] + fn snapshots() -> Vec<(serde_json::Value, Self)> { + vec![( + json!({ + "Verifier": "f01234", + }), + Self { + verifier: Address::new_id(1234).into(), + }, + )] + } + + fn into_lotus_json(self) -> Self::LotusJson { + RemoveVerifierParamsLotusJson(self.verifier.into()) + } + + fn from_lotus_json(lotus_json: Self::LotusJson) -> Self { + Self { + verifier: lotus_json.0.into(), + } + } + } + } + )+ + }; +} + +// Implementation for RemoveExpiredAllocationsParams +macro_rules! impl_remove_expired_allocations_params { + ($($version:literal),+) => { + $( + paste! { + impl HasLotusJson for fil_actor_verifreg_state::[]::RemoveExpiredAllocationsParams { + type LotusJson = RemoveExpiredAllocationsParamsLotusJson; + + #[cfg(test)] + fn snapshots() -> Vec<(serde_json::Value, Self)> { + vec![( + json!({ + "Client": 1001, + "AllocationIds": [1, 2, 3], + }), + Self { + client: 1001, + allocation_ids: vec![1, 2, 3], + }, + )] + } + + fn into_lotus_json(self) -> Self::LotusJson { + RemoveExpiredAllocationsParamsLotusJson { + client: self.client, + allocation_ids: self.allocation_ids, + } + } + + fn from_lotus_json(lotus_json: Self::LotusJson) -> Self { + Self { + client: lotus_json.client, + allocation_ids: lotus_json.allocation_ids, + } + } + } + } + )+ + }; +} + +// Implementation for GetClaimsParams +macro_rules! impl_get_claims_params { + ($($version:literal),+) => { + $( + paste! { + impl HasLotusJson for fil_actor_verifreg_state::[]::GetClaimsParams { + type LotusJson = GetClaimsParamsLotusJson; + + #[cfg(test)] + fn snapshots() -> Vec<(serde_json::Value, Self)> { + vec![( + json!({ + "Provider": 1001, + "ClaimIds": [1, 2, 3], + }), + Self { + provider: 1001, + claim_ids: vec![1, 2, 3], + }, + )] + } + + fn into_lotus_json(self) -> Self::LotusJson { + GetClaimsParamsLotusJson { + provider: self.provider, + claim_ids: self.claim_ids, + } + } + + fn from_lotus_json(lotus_json: Self::LotusJson) -> Self { + Self { + provider: lotus_json.provider, + claim_ids: lotus_json.claim_ids, + } + } + } + } + )+ + }; +} + +// Implementation for RemoveExpiredClaimsParams +macro_rules! impl_remove_expired_claims_params { + ($($version:literal),+) => { + $( + paste! { + impl HasLotusJson for fil_actor_verifreg_state::[]::RemoveExpiredClaimsParams { + type LotusJson = RemoveExpiredClaimsParamsLotusJson; + + #[cfg(test)] + fn snapshots() -> Vec<(serde_json::Value, Self)> { + vec![( + json!({ + "Provider": 1001, + "ClaimIds": [1, 2, 3], + }), + Self { + provider: 1001, + claim_ids: vec![1, 2, 3], + }, + )] + } + + fn into_lotus_json(self) -> Self::LotusJson { + RemoveExpiredClaimsParamsLotusJson { + provider: self.provider, + claim_ids: self.claim_ids, + } + } + + fn from_lotus_json(lotus_json: Self::LotusJson) -> Self { + Self { + provider: lotus_json.provider, + claim_ids: lotus_json.claim_ids, + } + } + } + } + )+ + }; +} + +// Implementation for UniversalReceiverParams (not version-specific) +impl HasLotusJson for fvm_actor_utils::receiver::UniversalReceiverParams { + type LotusJson = UniversalReceiverParamsLotusJson; + + #[cfg(test)] + fn snapshots() -> Vec<(serde_json::Value, Self)> { + vec![( + json!({ + "Type": 1, + "Payload": "dGVzdCBwYXlsb2Fk", + }), + Self { + type_: 1, + payload: RawBytes::new(b"test payload".to_vec()), + }, + )] + } + + fn into_lotus_json(self) -> Self::LotusJson { + UniversalReceiverParamsLotusJson { + type_: self.type_, + payload: self.payload, + } + } + + fn from_lotus_json(lotus_json: Self::LotusJson) -> Self { + Self { + type_: lotus_json.type_, + payload: lotus_json.payload, + } + } +} + +// Implementation for ExtendClaimTermsParams +macro_rules! impl_extend_claim_terms_params { + ($($version:literal),+) => { + $( + paste! { + impl HasLotusJson for fil_actor_verifreg_state::[]::ExtendClaimTermsParams { + type LotusJson = ExtendClaimTermsParamsLotusJson; + + #[cfg(test)] + fn snapshots() -> Vec<(serde_json::Value, Self)> { + vec![( + json!({ + "Terms": [ + { + "Provider": 1001, + "ClaimId": 1, + "TermMax": 12345, + } + ], + }), + Self { + terms: vec![fil_actor_verifreg_state::[]::ClaimTerm { + provider: 1001, + claim_id: 1, + term_max: 12345, + }], + }, + )] + } + + fn into_lotus_json(self) -> Self::LotusJson { + ExtendClaimTermsParamsLotusJson { + terms: self + .terms + .into_iter() + .map(|term| ClaimTermLotusJson { + provider: term.provider, + claim_id: term.claim_id, + term_max: term.term_max, + }) + .collect(), + } + } + + fn from_lotus_json(lotus_json: Self::LotusJson) -> Self { + Self { + terms: lotus_json + .terms + .into_iter() + .map(|term| fil_actor_verifreg_state::[]::ClaimTerm { + provider: term.provider, + claim_id: term.claim_id, + term_max: term.term_max, + }) + .collect(), + } + } + } + } + )+ + }; +} + +// Implementation for RemoveDataCapParams with version-specific types +macro_rules! impl_remove_data_cap_params_v2 { + ($($version:literal),+) => { + $( + paste! { + impl HasLotusJson for fil_actor_verifreg_state::[]::RemoveDataCapParams { + type LotusJson = RemoveDataCapParamsV2LotusJson; + + #[cfg(test)] + fn snapshots() -> Vec<(serde_json::Value, Self)> { + vec![( + json!({ + "VerifiedClientToRemove": "f01234", + "DataCapAmountToRemove": "1000000000000000000", + "VerifierRequest1": { + "Verifier": "f01235", + "Signature": { + "Type": 1, + "Data": "dGVzdA==", + } + }, + "VerifierRequest2": { + "Verifier": "f01236", + "Signature": { + "Type": 1, + "Data": "dGVzdA==", + } + }, + }), + Self { + verified_client_to_remove: Address::new_id(1234).into(), + data_cap_amount_to_remove: BigInt::from(1000000000000000000u64), + verifier_request_1: fil_actor_verifreg_state::[]::RemoveDataCapRequest { + verifier: Address::new_id(1235).into(), + signature: fvm_shared2::crypto::signature::Signature { + sig_type: fvm_shared2::crypto::signature::SignatureType::Secp256k1, + bytes: b"test".to_vec(), + }, + }, + verifier_request_2: fil_actor_verifreg_state::[]::RemoveDataCapRequest { + verifier: Address::new_id(1236).into(), + signature: fvm_shared2::crypto::signature::Signature { + sig_type: fvm_shared2::crypto::signature::SignatureType::Secp256k1, + bytes: b"test".to_vec(), + }, + }, + }, + )] + } + + fn into_lotus_json(self) -> Self::LotusJson { + RemoveDataCapParamsV2LotusJson { + verified_client_to_remove: self.verified_client_to_remove.into(), + data_cap_amount_to_remove: self.data_cap_amount_to_remove, + verifier_request_1: RemoveDataCapRequestV2LotusJson { + verifier: self.verifier_request_1.verifier.into(), + signature: self.verifier_request_1.signature, + }, + verifier_request_2: RemoveDataCapRequestV2LotusJson { + verifier: self.verifier_request_2.verifier.into(), + signature: self.verifier_request_2.signature, + }, + } + } + + fn from_lotus_json(lotus_json: Self::LotusJson) -> Self { + Self { + verified_client_to_remove: lotus_json.verified_client_to_remove.into(), + data_cap_amount_to_remove: lotus_json.data_cap_amount_to_remove, + verifier_request_1: fil_actor_verifreg_state::[]::RemoveDataCapRequest { + verifier: lotus_json.verifier_request_1.verifier.into(), + signature: lotus_json.verifier_request_1.signature, + }, + verifier_request_2: fil_actor_verifreg_state::[]::RemoveDataCapRequest { + verifier: lotus_json.verifier_request_2.verifier.into(), + signature: lotus_json.verifier_request_2.signature, + }, + } + } + } + } + )+ + }; +} + +macro_rules! impl_remove_data_cap_params_v3 { + ($($version:literal),+) => { + $( + paste! { + impl HasLotusJson for fil_actor_verifreg_state::[]::RemoveDataCapParams { + type LotusJson = RemoveDataCapParamsV3LotusJson; + + #[cfg(test)] + fn snapshots() -> Vec<(serde_json::Value, Self)> { + vec![( + json!({ + "VerifiedClientToRemove": "f01234", + "DataCapAmountToRemove": "1000000000000000000", + "VerifierRequest1": { + "Verifier": "f01235", + "VerifierSignature": { + "Type": 1, + "Data": "dGVzdA==", + } + }, + "VerifierRequest2": { + "Verifier": "f01236", + "VerifierSignature": { + "Type": 1, + "Data": "dGVzdA==", + } + }, + }), + Self { + verified_client_to_remove: Address::new_id(1234).into(), + data_cap_amount_to_remove: BigInt::from(1000000000000000000u64), + verifier_request_1: fil_actor_verifreg_state::[]::RemoveDataCapRequest { + verifier: Address::new_id(1235).into(), + signature: fvm_shared3::crypto::signature::Signature { + sig_type: fvm_shared3::crypto::signature::SignatureType::Secp256k1, + bytes: b"test".to_vec(), + }, + }, + verifier_request_2: fil_actor_verifreg_state::[]::RemoveDataCapRequest { + verifier: Address::new_id(1236).into(), + signature: fvm_shared3::crypto::signature::Signature { + sig_type: fvm_shared3::crypto::signature::SignatureType::Secp256k1, + bytes: b"test".to_vec(), + }, + }, + }, + )] + } + + fn into_lotus_json(self) -> Self::LotusJson { + RemoveDataCapParamsV3LotusJson { + verified_client_to_remove: self.verified_client_to_remove.into(), + data_cap_amount_to_remove: self.data_cap_amount_to_remove, + verifier_request_1: RemoveDataCapRequestV3LotusJson { + verifier: self.verifier_request_1.verifier.into(), + signature: self.verifier_request_1.signature, + }, + verifier_request_2: RemoveDataCapRequestV3LotusJson { + verifier: self.verifier_request_2.verifier.into(), + signature: self.verifier_request_2.signature, + }, + } + } + + fn from_lotus_json(lotus_json: Self::LotusJson) -> Self { + Self { + verified_client_to_remove: lotus_json.verified_client_to_remove.into(), + data_cap_amount_to_remove: lotus_json.data_cap_amount_to_remove, + verifier_request_1: fil_actor_verifreg_state::[]::RemoveDataCapRequest { + verifier: lotus_json.verifier_request_1.verifier.into(), + signature: lotus_json.verifier_request_1.signature, + }, + verifier_request_2: fil_actor_verifreg_state::[]::RemoveDataCapRequest { + verifier: lotus_json.verifier_request_2.verifier.into(), + signature: lotus_json.verifier_request_2.signature, + }, + } + } + } + } + )+ + }; +} + +macro_rules! impl_remove_data_cap_params_v4 { + ($($version:literal),+) => { + $( + paste! { + impl HasLotusJson for fil_actor_verifreg_state::[]::RemoveDataCapParams { + type LotusJson = RemoveDataCapParamsV4LotusJson; + + #[cfg(test)] + fn snapshots() -> Vec<(serde_json::Value, Self)> { + vec![( + json!({ + "VerifiedClientToRemove": "f01234", + "DataCapAmountToRemove": "1000000000000000000", + "VerifierRequest1": { + "Verifier": "f01235", + "VerifierSignature": { + "Type": 1, + "Data": "dGVzdA==", + } + }, + "VerifierRequest2": { + "Verifier": "f01236", + "VerifierSignature": { + "Type": 1, + "Data": "dGVzdA==", + } + }, + }), + Self { + verified_client_to_remove: Address::new_id(1234).into(), + data_cap_amount_to_remove: BigInt::from(1000000000000000000u64), + verifier_request_1: fil_actor_verifreg_state::[]::RemoveDataCapRequest { + verifier: Address::new_id(1235).into(), + signature: fvm_shared4::crypto::signature::Signature { + sig_type: fvm_shared4::crypto::signature::SignatureType::Secp256k1, + bytes: b"test".to_vec(), + }, + }, + verifier_request_2: fil_actor_verifreg_state::[]::RemoveDataCapRequest { + verifier: Address::new_id(1236).into(), + signature: fvm_shared4::crypto::signature::Signature { + sig_type: fvm_shared4::crypto::signature::SignatureType::Secp256k1, + bytes: b"test".to_vec(), + }, + }, + }, + )] + } + + fn into_lotus_json(self) -> Self::LotusJson { + RemoveDataCapParamsV4LotusJson { + verified_client_to_remove: self.verified_client_to_remove.into(), + data_cap_amount_to_remove: self.data_cap_amount_to_remove, + verifier_request_1: RemoveDataCapRequestV4LotusJson { + verifier: self.verifier_request_1.verifier.into(), + signature: self.verifier_request_1.signature, + }, + verifier_request_2: RemoveDataCapRequestV4LotusJson { + verifier: self.verifier_request_2.verifier.into(), + signature: self.verifier_request_2.signature, + }, + } + } + + fn from_lotus_json(lotus_json: Self::LotusJson) -> Self { + Self { + verified_client_to_remove: lotus_json.verified_client_to_remove.into(), + data_cap_amount_to_remove: lotus_json.data_cap_amount_to_remove, + verifier_request_1: fil_actor_verifreg_state::[]::RemoveDataCapRequest { + verifier: lotus_json.verifier_request_1.verifier.into(), + signature: lotus_json.verifier_request_1.signature, + }, + verifier_request_2: fil_actor_verifreg_state::[]::RemoveDataCapRequest { + verifier: lotus_json.verifier_request_2.verifier.into(), + signature: lotus_json.verifier_request_2.signature, + }, + } + } + } + } + )+ + }; +} + +// Implementation for ClaimAllocationsParams (v12-v16 with nested structure) +macro_rules! impl_claim_allocations_params_v12_plus { + ($type_suffix:path: $($version:literal),+) => { + $( + paste! { + impl HasLotusJson for fil_actor_verifreg_state::[]::ClaimAllocationsParams { + type LotusJson = ClaimAllocationsParamsLotusJson; + + #[cfg(test)] + fn snapshots() -> Vec<(serde_json::Value, Self)> { + vec![( + json!({ + "Sectors": [ + { + "Sector": 1, + "Expiry": 12345, + "Claims": [ + { + "Client": 1001, + "AllocationId": 1, + "Data": {"/": "bafk2bzacedbdmwqy4jrh4tgm7l77vz5fxb27jgmb2xkuprzzudbe2xj5u2nzm"}, + "Size": 2048, + } + ], + } + ], + "AllOrNothing": true, + }), + Self { + sectors: vec![fil_actor_verifreg_state::[]::SectorAllocationClaims { + sector: 1, + expiry: 12345, + claims: vec![fil_actor_verifreg_state::[]::AllocationClaim { + client: 1001, + allocation_id: 1, + data: Cid::try_from( + "bafk2bzacedbdmwqy4jrh4tgm7l77vz5fxb27jgmb2xkuprzzudbe2xj5u2nzm", + ) + .unwrap(), + size: $type_suffix::piece::PaddedPieceSize(2048), + }], + }], + all_or_nothing: true, + }, + )] + } + + fn into_lotus_json(self) -> Self::LotusJson { + ClaimAllocationsParamsLotusJson { + sectors: self + .sectors + .into_iter() + .map(|sector| SectorAllocationClaimsLotusJson { + sector: sector.sector, + expiry: sector.expiry, + claims: sector + .claims + .into_iter() + .map(|claim| AllocationClaimLotusJson { + client: claim.client, + allocation_id: claim.allocation_id, + data: claim.data, + size: claim.size.0, + }) + .collect(), + }) + .collect(), + all_or_nothing: self.all_or_nothing, + } + } + + fn from_lotus_json(lotus_json: Self::LotusJson) -> Self { + Self { + sectors: lotus_json + .sectors + .into_iter() + .map( + |sector| fil_actor_verifreg_state::[]::SectorAllocationClaims { + sector: sector.sector, + expiry: sector.expiry, + claims: sector + .claims + .into_iter() + .map(|claim| fil_actor_verifreg_state::[]::AllocationClaim { + client: claim.client, + allocation_id: claim.allocation_id, + data: claim.data, + size: $type_suffix::piece::PaddedPieceSize(claim.size), + }) + .collect(), + }, + ) + .collect(), + all_or_nothing: lotus_json.all_or_nothing, + } + } + } + } + )+ + }; +} + +// Implementation for ClaimAllocationsParams (v9-v11 with flat structure) +macro_rules! impl_claim_allocations_params_v11 { + ($type_suffix:path: $($version:literal),+) => { + $( + paste! { + impl HasLotusJson for fil_actor_verifreg_state::[]::ClaimAllocationsParams { + type LotusJson = ClaimAllocationsParamsV11LotusJson; + + #[cfg(test)] + fn snapshots() -> Vec<(serde_json::Value, Self)> { + vec![( + json!({ + "Sectors": [ + { + "Client": 1001, + "AllocationId": 1, + "Data": {"/": "bafk2bzacedbdmwqy4jrh4tgm7l77vz5fxb27jgmb2xkuprzzudbe2xj5u2nzm"}, + "Size": 2048, + "Sector": 1, + "SectorExpiry": 12345, + } + ], + "AllOrNothing": true, + }), + Self { + sectors: vec![fil_actor_verifreg_state::[]::SectorAllocationClaim { + client: 1001, + allocation_id: 1, + data: Cid::try_from( + "bafk2bzacedbdmwqy4jrh4tgm7l77vz5fxb27jgmb2xkuprzzudbe2xj5u2nzm", + ) + .unwrap(), + size: $type_suffix::piece::PaddedPieceSize(2048), + sector: 1, + sector_expiry: 12345, + }], + all_or_nothing: true, + }, + )] + } + + fn into_lotus_json(self) -> Self::LotusJson { + ClaimAllocationsParamsV11LotusJson { + sectors: self + .sectors + .into_iter() + .map(|sector| SectorAllocationClaimV11LotusJson { + client: sector.client, + allocation_id: sector.allocation_id, + data: sector.data, + size: sector.size.0, + sector: sector.sector, + sector_expiry: sector.sector_expiry, + }) + .collect(), + all_or_nothing: self.all_or_nothing, + } + } + + fn from_lotus_json(lotus_json: Self::LotusJson) -> Self { + Self { + sectors: lotus_json + .sectors + .into_iter() + .map(|sector| fil_actor_verifreg_state::[]::SectorAllocationClaim { + client: sector.client, + allocation_id: sector.allocation_id, + data: sector.data, + size: $type_suffix::piece::PaddedPieceSize(sector.size), + sector: sector.sector, + sector_expiry: sector.sector_expiry, + }) + .collect(), + all_or_nothing: lotus_json.all_or_nothing, + } + } + } + } + )+ + }; +} + +// Implementation for AllocationRequests (unified for all versions) +macro_rules! impl_allocation_requests { + ($type_suffix:path: $($version:literal),+) => { + $( + paste! { + impl HasLotusJson for fil_actor_verifreg_state::[]::AllocationRequests { + type LotusJson = AllocationRequestsLotusJson; + + #[cfg(test)] + fn snapshots() -> Vec<(serde_json::Value, Self)> { + vec![( + json!({ + "Allocations": [ + { + "Provider": 1001, + "Data": {"/": "bafk2bzacedbdmwqy4jrh4tgm7l77vz5fxb27jgmb2xkuprzzudbe2xj5u2nzm"}, + "Size": 2048, + "TermMin": 1000, + "TermMax": 2000, + "Expiration": 12345, + } + ], + "Extensions": [ + { + "Provider": 1002, + "Claim": 1, + "TermMax": 3000, + } + ], + }), + Self { + allocations: vec![fil_actor_verifreg_state::[]::AllocationRequest { + provider: 1001, + data: Cid::try_from( + "bafk2bzacedbdmwqy4jrh4tgm7l77vz5fxb27jgmb2xkuprzzudbe2xj5u2nzm", + ) + .unwrap(), + size: $type_suffix::piece::PaddedPieceSize(2048), + term_min: 1000, + term_max: 2000, + expiration: 12345, + }], + extensions: vec![fil_actor_verifreg_state::[]::ClaimExtensionRequest { + provider: 1002, + claim: 1, + term_max: 3000, + }], + }, + )] + } + + fn into_lotus_json(self) -> Self::LotusJson { + AllocationRequestsLotusJson { + allocations: self + .allocations + .into_iter() + .map(|alloc| AllocationRequestLotusJson { + provider: alloc.provider, + data: alloc.data, + size: PaddedPieceSize(alloc.size.0), + term_min: alloc.term_min, + term_max: alloc.term_max, + expiration: alloc.expiration, + }) + .collect(), + extensions: self + .extensions + .into_iter() + .map(|ext| ClaimExtensionRequestLotusJson { + provider: ext.provider, + claim: ext.claim, + term_max: ext.term_max, + }) + .collect(), + } + } + + fn from_lotus_json(lotus_json: Self::LotusJson) -> Self { + Self { + allocations: lotus_json + .allocations + .into_iter() + .map(|alloc| fil_actor_verifreg_state::[]::AllocationRequest { + provider: alloc.provider, + data: alloc.data, + size: $type_suffix::piece::PaddedPieceSize(alloc.size.0), + term_min: alloc.term_min, + term_max: alloc.term_max, + expiration: alloc.expiration, + }) + .collect(), + extensions: lotus_json + .extensions + .into_iter() + .map(|ext| fil_actor_verifreg_state::[]::ClaimExtensionRequest { + provider: ext.provider, + claim: ext.claim, + term_max: ext.term_max, + }) + .collect(), + } + } + } + } + )+ + }; +} + +// v8 has unique BytesParams for UseBytes/RestoreBytes methods +impl HasLotusJson for fil_actor_verifreg_state::v8::BytesParams { + type LotusJson = BytesParamsLotusJson; + + #[cfg(test)] + fn snapshots() -> Vec<(serde_json::Value, Self)> { + vec![( + json!({ + "Address": "f01234", + "DealSize": "1048576", // 1MB + }), + Self { + address: Address::new_id(1234).into(), + deal_size: BigInt::from(1048576u64), + }, + )] + } + + fn into_lotus_json(self) -> Self::LotusJson { + BytesParamsLotusJson { + address: self.address.into(), + deal_size: self.deal_size, + } + } + + fn from_lotus_json(lotus_json: Self::LotusJson) -> Self { + Self { + address: lotus_json.address.into(), + deal_size: lotus_json.deal_size, + } + } +} + +impl HasLotusJson for fil_actor_verifreg_state::v8::VerifierParams { + type LotusJson = VerifierParamsLotusJson; + + #[cfg(test)] + fn snapshots() -> Vec<(serde_json::Value, Self)> { + vec![( + json!({ + "Address": "f01234", + "Allowance": "1000000000000000000", + }), + Self { + address: Address::new_id(1234).into(), + allowance: BigInt::from(1000000000000000000u64), + }, + )] + } + + fn into_lotus_json(self) -> Self::LotusJson { + VerifierParamsLotusJson { + address: self.address.into(), + allowance: self.allowance, + } + } + + fn from_lotus_json(lotus_json: Self::LotusJson) -> Self { + Self { + address: lotus_json.address.into(), + allowance: lotus_json.allowance, + } + } +} + +impl HasLotusJson for fil_actor_verifreg_state::v9::AddVerifierClientParams { + type LotusJson = VerifierParamsLotusJson; + + #[cfg(test)] + fn snapshots() -> Vec<(serde_json::Value, Self)> { + vec![( + json!({ + "Address": "f01234", + "Allowance": "1000000000000000000", + }), + Self { + address: Address::new_id(1234).into(), + allowance: BigInt::from(1000000000000000000u64), + }, + )] + } + + fn into_lotus_json(self) -> Self::LotusJson { + VerifierParamsLotusJson { + address: self.address.into(), + allowance: self.allowance, + } + } + + fn from_lotus_json(lotus_json: Self::LotusJson) -> Self { + Self { + address: lotus_json.address.into(), + allowance: lotus_json.allowance, + } + } +} + +impl_constructor_params!(11, 12, 13, 14, 15, 16); +impl_verifier_params!(10, 11, 12, 13, 14, 15, 16); // Exclude v8,v9 due to different param names +impl_remove_verifier_params!(11, 12, 13, 14, 15, 16); +impl_remove_expired_allocations_params!(9, 10, 11, 12, 13, 14, 15, 16); +impl_get_claims_params!(9, 10, 11, 12, 13, 14, 15, 16); +impl_remove_expired_claims_params!(9, 10, 11, 12, 13, 14, 15, 16); +impl_extend_claim_terms_params!(9, 10, 11, 12, 13, 14, 15, 16); + +impl_remove_data_cap_params_v2!(8, 9); +impl_remove_data_cap_params_v3!(10, 11); +impl_remove_data_cap_params_v4!(12, 13, 14, 15, 16); + +impl_claim_allocations_params_v11!(fvm_shared2: 9); +impl_claim_allocations_params_v11!(fvm_shared3: 10, 11); +impl_claim_allocations_params_v12_plus!(fvm_shared4: 12, 13, 14, 15, 16); +impl_allocation_requests!(fvm_shared4: 12, 13, 14, 15, 16); +impl_allocation_requests!(fvm_shared3: 11); diff --git a/src/lotus_json/signature.rs b/src/lotus_json/signature.rs index a329c787e1d8..44ec3d828800 100644 --- a/src/lotus_json/signature.rs +++ b/src/lotus_json/signature.rs @@ -16,6 +16,42 @@ pub struct SignatureLotusJson { data: Vec, } +#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, JsonSchema)] +#[serde(rename_all = "PascalCase")] +#[schemars(rename = "Signature")] +pub struct SignatureV2LotusJson { + #[schemars(with = "LotusJson")] + #[serde(with = "crate::lotus_json")] + r#type: fvm_shared2::crypto::signature::SignatureType, + #[schemars(with = "LotusJson>")] + #[serde(with = "crate::lotus_json")] + data: Vec, +} + +#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, JsonSchema)] +#[serde(rename_all = "PascalCase")] +#[schemars(rename = "Signature")] +pub struct SignatureV3LotusJson { + #[schemars(with = "LotusJson")] + #[serde(with = "crate::lotus_json")] + r#type: fvm_shared3::crypto::signature::SignatureType, + #[schemars(with = "LotusJson>")] + #[serde(with = "crate::lotus_json")] + data: Vec, +} + +#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, JsonSchema)] +#[serde(rename_all = "PascalCase")] +#[schemars(rename = "Signature")] +pub struct SignatureV4LotusJson { + #[schemars(with = "LotusJson")] + #[serde(with = "crate::lotus_json")] + r#type: fvm_shared4::crypto::signature::SignatureType, + #[schemars(with = "LotusJson>")] + #[serde(with = "crate::lotus_json")] + data: Vec, +} + impl HasLotusJson for Signature { type LotusJson = SignatureLotusJson; @@ -46,3 +82,90 @@ impl HasLotusJson for Signature { } } } + +impl HasLotusJson for fvm_shared2::crypto::signature::Signature { + type LotusJson = SignatureV2LotusJson; + + #[cfg(test)] + fn snapshots() -> Vec<(serde_json::Value, Self)> { + vec![( + json!({"Type": 2, "Data": "aGVsbG8gd29ybGQh"}), + Self { + sig_type: fvm_shared2::crypto::signature::SignatureType::BLS, + bytes: Vec::from_iter(*b"hello world!"), + }, + )] + } + + fn into_lotus_json(self) -> Self::LotusJson { + SignatureV2LotusJson { + r#type: self.sig_type, + data: self.bytes, + } + } + + fn from_lotus_json(lotus_json: Self::LotusJson) -> Self { + Self { + sig_type: lotus_json.r#type, + bytes: lotus_json.data, + } + } +} + +impl HasLotusJson for fvm_shared3::crypto::signature::Signature { + type LotusJson = SignatureV3LotusJson; + + #[cfg(test)] + fn snapshots() -> Vec<(serde_json::Value, Self)> { + vec![( + json!({"Type": 1, "Data": "aGVsbG8gd29ybGQh"}), + Self { + sig_type: fvm_shared3::crypto::signature::SignatureType::Secp256k1, + bytes: Vec::from_iter(*b"hello world!"), + }, + )] + } + + fn into_lotus_json(self) -> Self::LotusJson { + SignatureV3LotusJson { + r#type: self.sig_type, + data: self.bytes, + } + } + + fn from_lotus_json(lotus_json: Self::LotusJson) -> Self { + Self { + sig_type: lotus_json.r#type, + bytes: lotus_json.data, + } + } +} + +impl HasLotusJson for fvm_shared4::crypto::signature::Signature { + type LotusJson = SignatureV4LotusJson; + + #[cfg(test)] + fn snapshots() -> Vec<(serde_json::Value, Self)> { + vec![( + json!({"Type": 1, "Data": "aGVsbG8gd29ybGQh"}), + Self { + sig_type: fvm_shared4::crypto::signature::SignatureType::Secp256k1, + bytes: Vec::from_iter(*b"hello world!"), + }, + )] + } + + fn into_lotus_json(self) -> Self::LotusJson { + SignatureV4LotusJson { + r#type: self.sig_type, + data: self.bytes, + } + } + + fn from_lotus_json(lotus_json: Self::LotusJson) -> Self { + Self { + sig_type: lotus_json.r#type, + bytes: lotus_json.data, + } + } +} diff --git a/src/lotus_json/signature_type.rs b/src/lotus_json/signature_type.rs index 1d0289f026cc..07aad5ac2cfe 100644 --- a/src/lotus_json/signature_type.rs +++ b/src/lotus_json/signature_type.rs @@ -48,3 +48,96 @@ fn deserialize_integer() { serde_json::from_value(json!(2)).unwrap() ); } + +#[derive(Deserialize, Serialize, JsonSchema)] +#[serde(untagged)] +pub enum SignatureTypeV2LotusJson { + Integer(#[schemars(with = "u8")] fvm_shared2::crypto::signature::SignatureType), +} + +#[derive(Deserialize, Serialize, JsonSchema)] +#[serde(untagged)] +pub enum SignatureTypeV3LotusJson { + Integer(#[schemars(with = "u8")] fvm_shared3::crypto::signature::SignatureType), +} + +#[derive(Deserialize, Serialize, JsonSchema)] +#[serde(untagged)] +pub enum SignatureTypeV4LotusJson { + Integer(#[schemars(with = "u8")] fvm_shared4::crypto::signature::SignatureType), +} + +impl HasLotusJson for fvm_shared2::crypto::signature::SignatureType { + type LotusJson = SignatureTypeV2LotusJson; + + #[cfg(test)] + fn snapshots() -> Vec<(serde_json::Value, Self)> { + vec![ + ( + json!(1), + fvm_shared2::crypto::signature::SignatureType::Secp256k1, + ), + (json!(2), fvm_shared2::crypto::signature::SignatureType::BLS), + ] + } + + fn into_lotus_json(self) -> Self::LotusJson { + SignatureTypeV2LotusJson::Integer(self) + } + + fn from_lotus_json(lotus_json: Self::LotusJson) -> Self { + match lotus_json { + SignatureTypeV2LotusJson::Integer(inner) => inner, + } + } +} + +impl HasLotusJson for fvm_shared3::crypto::signature::SignatureType { + type LotusJson = SignatureTypeV3LotusJson; + + #[cfg(test)] + fn snapshots() -> Vec<(serde_json::Value, Self)> { + vec![ + ( + json!(1), + fvm_shared3::crypto::signature::SignatureType::Secp256k1, + ), + (json!(2), fvm_shared3::crypto::signature::SignatureType::BLS), + ] + } + + fn into_lotus_json(self) -> Self::LotusJson { + SignatureTypeV3LotusJson::Integer(self) + } + + fn from_lotus_json(lotus_json: Self::LotusJson) -> Self { + match lotus_json { + SignatureTypeV3LotusJson::Integer(inner) => inner, + } + } +} + +impl HasLotusJson for fvm_shared4::crypto::signature::SignatureType { + type LotusJson = SignatureTypeV4LotusJson; + + #[cfg(test)] + fn snapshots() -> Vec<(serde_json::Value, Self)> { + vec![ + ( + json!(1), + fvm_shared4::crypto::signature::SignatureType::Secp256k1, + ), + (json!(2), fvm_shared4::crypto::signature::SignatureType::BLS), + ] + } + + fn into_lotus_json(self) -> Self::LotusJson { + SignatureTypeV4LotusJson::Integer(self) + } + + fn from_lotus_json(lotus_json: Self::LotusJson) -> Self { + match lotus_json { + SignatureTypeV4LotusJson::Integer(inner) => inner, + } + } +} diff --git a/src/rpc/registry/actors/account.rs b/src/rpc/registry/actors/account.rs index d44574645293..dce848fa62a4 100644 --- a/src/rpc/registry/actors/account.rs +++ b/src/rpc/registry/actors/account.rs @@ -3,7 +3,6 @@ use crate::rpc::registry::methods_reg::{MethodRegistry, register_actor_methods}; use crate::shim::message::MethodNum; -use anyhow::Result; use cid::Cid; /// Macro to generate account method registration for different versions diff --git a/src/rpc/registry/actors/cron.rs b/src/rpc/registry/actors/cron.rs index 12f9143cafb4..56117b2afbaf 100644 --- a/src/rpc/registry/actors/cron.rs +++ b/src/rpc/registry/actors/cron.rs @@ -3,7 +3,6 @@ use crate::rpc::registry::methods_reg::{MethodRegistry, register_actor_methods}; use crate::shim::message::MethodNum; -use anyhow::Result; use cid::Cid; macro_rules! register_cron_version { diff --git a/src/rpc/registry/actors/datacap.rs b/src/rpc/registry/actors/datacap.rs index df13780b9948..d21bd4b22bed 100644 --- a/src/rpc/registry/actors/datacap.rs +++ b/src/rpc/registry/actors/datacap.rs @@ -4,7 +4,6 @@ use crate::rpc::registry::methods_reg::{MethodRegistry, register_actor_methods}; use crate::shim::address::Address; use crate::shim::message::MethodNum; -use anyhow::Result; use cid::Cid; macro_rules! register_datacap_v9 { diff --git a/src/rpc/registry/actors/evm.rs b/src/rpc/registry/actors/evm.rs index 618093c5d731..99114b21a339 100644 --- a/src/rpc/registry/actors/evm.rs +++ b/src/rpc/registry/actors/evm.rs @@ -3,7 +3,6 @@ use crate::rpc::registry::methods_reg::{MethodRegistry, register_actor_methods}; use crate::shim::message::MethodNum; -use anyhow::Result; use cid::Cid; macro_rules! register_evm_version { diff --git a/src/rpc/registry/actors/init.rs b/src/rpc/registry/actors/init.rs index 18939c822b2c..af06ef04c449 100644 --- a/src/rpc/registry/actors/init.rs +++ b/src/rpc/registry/actors/init.rs @@ -3,7 +3,6 @@ use crate::rpc::registry::methods_reg::{MethodRegistry, register_actor_methods}; use crate::shim::message::MethodNum; -use anyhow::Result; use cid::Cid; // Macro for versions 8-10 that only have Exec method diff --git a/src/rpc/registry/actors/miner.rs b/src/rpc/registry/actors/miner.rs index cc4f0a59624e..c5deaca03092 100644 --- a/src/rpc/registry/actors/miner.rs +++ b/src/rpc/registry/actors/miner.rs @@ -3,7 +3,6 @@ use crate::rpc::registry::methods_reg::{MethodRegistry, register_actor_methods}; use crate::shim::message::MethodNum; -use anyhow::Result; use cid::Cid; macro_rules! register_miner_version { diff --git a/src/rpc/registry/actors/mod.rs b/src/rpc/registry/actors/mod.rs index a71063322c6b..4935fe4b8a51 100644 --- a/src/rpc/registry/actors/mod.rs +++ b/src/rpc/registry/actors/mod.rs @@ -11,3 +11,4 @@ pub(crate) mod multisig; pub(crate) mod power; pub(crate) mod reward; pub(crate) mod system; +pub(crate) mod verified_reg; diff --git a/src/rpc/registry/actors/multisig.rs b/src/rpc/registry/actors/multisig.rs index 543e11d1890a..b7b6c689ce6a 100644 --- a/src/rpc/registry/actors/multisig.rs +++ b/src/rpc/registry/actors/multisig.rs @@ -3,7 +3,6 @@ use crate::rpc::registry::methods_reg::{MethodRegistry, register_actor_methods}; use crate::shim::message::MethodNum; -use anyhow::Result; use cid::Cid; // Macro for version 8 that doesn't have UniversalReceiverHook diff --git a/src/rpc/registry/actors/power.rs b/src/rpc/registry/actors/power.rs index 64a1224ac2b6..50b0a1b06472 100644 --- a/src/rpc/registry/actors/power.rs +++ b/src/rpc/registry/actors/power.rs @@ -3,7 +3,6 @@ use crate::rpc::registry::methods_reg::{MethodRegistry, register_actor_methods}; use crate::shim::message::MethodNum; -use anyhow::Result; use cid::Cid; // Macro for versions 8-9 that have limited methods diff --git a/src/rpc/registry/actors/reward.rs b/src/rpc/registry/actors/reward.rs index f5e6ca51f0ae..344459dc94d0 100644 --- a/src/rpc/registry/actors/reward.rs +++ b/src/rpc/registry/actors/reward.rs @@ -3,7 +3,6 @@ use crate::rpc::registry::methods_reg::{MethodRegistry, register_actor_methods}; use crate::shim::message::MethodNum; -use anyhow::Result; use cid::Cid; macro_rules! register_reward_version_11_to_16 { diff --git a/src/rpc/registry/actors/verified_reg.rs b/src/rpc/registry/actors/verified_reg.rs new file mode 100644 index 000000000000..719b789fad62 --- /dev/null +++ b/src/rpc/registry/actors/verified_reg.rs @@ -0,0 +1,251 @@ +// Copyright 2019-2025 ChainSafe Systems +// SPDX-License-Identifier: Apache-2.0, MIT + +use crate::rpc::registry::methods_reg::{MethodRegistry, register_actor_methods}; +use crate::shim::address::Address; +use crate::shim::message::MethodNum; +use cid::Cid; +use paste::paste; + +// Core methods present in all versions +macro_rules! register_core_methods { + ($registry:expr, $cid:expr, v8) => {{ + use fil_actor_verifreg_state::v8::{Method, RemoveDataCapParams, VerifierParams}; + register_actor_methods!( + $registry, + $cid, + [ + (Method::Constructor, Address), + (Method::AddVerifier, VerifierParams), + (Method::RemoveVerifier, Address), + (Method::AddVerifiedClient, VerifierParams), + (Method::RemoveVerifiedClientDataCap, RemoveDataCapParams), + ] + ); + }}; + + ($registry:expr, $cid:expr, v9) => {{ + use fil_actor_verifreg_state::v9::{ + AddVerifierClientParams, AddVerifierParams, Method, RemoveDataCapParams, + }; + register_actor_methods!( + $registry, + $cid, + [ + (Method::Constructor, Address), + (Method::AddVerifier, AddVerifierParams), + (Method::RemoveVerifier, Address), + (Method::AddVerifiedClient, AddVerifierClientParams), + (Method::RemoveVerifiedClientDataCap, RemoveDataCapParams), + ] + ); + }}; + + ($registry:expr, $cid:expr, v10) => {{ + use fil_actor_verifreg_state::v10::{ + AddVerifiedClientParams, AddVerifierParams, Method, RemoveDataCapParams, + }; + register_actor_methods!( + $registry, + $cid, + [ + (Method::Constructor, Address), + (Method::AddVerifier, AddVerifierParams), + (Method::RemoveVerifier, Address), + (Method::AddVerifiedClient, AddVerifiedClientParams), + (Method::RemoveVerifiedClientDataCap, RemoveDataCapParams), + ] + ); + }}; + + ($registry:expr, $cid:expr, $state_version:path) => {{ + use $state_version::{ + AddVerifiedClientParams, AddVerifierParams, ConstructorParams, Method, + RemoveDataCapParams, RemoveVerifierParams, + }; + register_actor_methods!( + $registry, + $cid, + [ + (Method::Constructor, ConstructorParams), + (Method::AddVerifier, AddVerifierParams), + (Method::RemoveVerifier, RemoveVerifierParams), + (Method::AddVerifiedClient, AddVerifiedClientParams), + (Method::RemoveVerifiedClientDataCap, RemoveDataCapParams), + ] + ); + }}; +} + +// unique methods (UseBytes/RestoreBytes) +macro_rules! register_v8_unique_methods { + ($registry:expr, $cid:expr) => {{ + use fil_actor_verifreg_state::v8::{BytesParams, Method}; + register_actor_methods!( + $registry, + $cid, + [ + (Method::UseBytes, BytesParams), + (Method::RestoreBytes, BytesParams), + ] + ); + }}; +} + +// Allocation/Claims methods +macro_rules! register_allocation_methods { + ($registry:expr, $cid:expr, v9) => {{ + use fil_actor_verifreg_state::v9::{ + ClaimAllocationsParams, ExtendClaimTermsParams, GetClaimsParams, Method, + RemoveExpiredAllocationsParams, RemoveExpiredClaimsParams, + }; + register_actor_methods!( + $registry, + $cid, + [ + ( + Method::RemoveExpiredAllocations, + RemoveExpiredAllocationsParams + ), + (Method::ClaimAllocations, ClaimAllocationsParams), + (Method::GetClaims, GetClaimsParams), + (Method::ExtendClaimTerms, ExtendClaimTermsParams), + (Method::RemoveExpiredClaims, RemoveExpiredClaimsParams), + ] + ); + }}; + + ($registry:expr, $cid:expr, $state_version:path, no_claim) => {{ + use $state_version::{ + ExtendClaimTermsParams, GetClaimsParams, Method, RemoveExpiredAllocationsParams, + RemoveExpiredClaimsParams, + }; + register_actor_methods!( + $registry, + $cid, + [ + ( + Method::RemoveExpiredAllocations, + RemoveExpiredAllocationsParams + ), + (Method::GetClaims, GetClaimsParams), + (Method::ExtendClaimTerms, ExtendClaimTermsParams), + (Method::RemoveExpiredClaims, RemoveExpiredClaimsParams), + ] + ); + }}; + + ($registry:expr, $cid:expr, $state_version:path) => {{ + use $state_version::{ + ClaimAllocationsParams, ExtendClaimTermsParams, GetClaimsParams, Method, + RemoveExpiredAllocationsParams, RemoveExpiredClaimsParams, + }; + register_actor_methods!( + $registry, + $cid, + [ + ( + Method::RemoveExpiredAllocations, + RemoveExpiredAllocationsParams + ), + (Method::ClaimAllocations, ClaimAllocationsParams), + (Method::GetClaims, GetClaimsParams), + (Method::ExtendClaimTerms, ExtendClaimTermsParams), + (Method::RemoveExpiredClaims, RemoveExpiredClaimsParams), + ] + ); + }}; +} + +macro_rules! register_exported_methods { + ($registry:expr, $cid:expr, $state_version:path) => {{ + use $state_version::{ + AddVerifiedClientParams, ExtendClaimTermsParams, GetClaimsParams, Method, + RemoveExpiredAllocationsParams, RemoveExpiredClaimsParams, + }; + register_actor_methods!( + $registry, + $cid, + [ + (Method::AddVerifiedClientExported, AddVerifiedClientParams), + ( + Method::RemoveExpiredAllocationsExported, + RemoveExpiredAllocationsParams + ), + (Method::GetClaimsExported, GetClaimsParams), + (Method::ExtendClaimTermsExported, ExtendClaimTermsParams), + ( + Method::RemoveExpiredClaimsExported, + RemoveExpiredClaimsParams + ), + ] + ); + }}; +} + +macro_rules! register_universal_receiver_hook { + ($registry:expr, $cid:expr, $version:tt) => { + paste! { + { + use fil_actor_verifreg_state::[<$version>]::Method; + register_actor_methods!( + $registry, + $cid, + [( + Method::UniversalReceiverHook, + fvm_actor_utils::receiver::UniversalReceiverParams + ),] + ); + } + } + }; +} + +fn register_verified_reg_v8(registry: &mut MethodRegistry, cid: Cid) { + register_core_methods!(registry, cid, v8); + register_v8_unique_methods!(registry, cid); +} + +fn register_verified_reg_v9(registry: &mut MethodRegistry, cid: Cid) { + register_core_methods!(registry, cid, v9); + register_allocation_methods!(registry, cid, v9); + register_universal_receiver_hook!(registry, cid, v9); +} + +fn register_verified_reg_v10(registry: &mut MethodRegistry, cid: Cid) { + register_core_methods!(registry, cid, v10); + register_allocation_methods!(registry, cid, fil_actor_verifreg_state::v10, no_claim); + register_exported_methods!(registry, cid, fil_actor_verifreg_state::v10); + register_universal_receiver_hook!(registry, cid, v10); +} + +fn register_verified_reg_v11(registry: &mut MethodRegistry, cid: Cid) { + register_core_methods!(registry, cid, fil_actor_verifreg_state::v11); + register_allocation_methods!(registry, cid, fil_actor_verifreg_state::v11, no_claim); + register_exported_methods!(registry, cid, fil_actor_verifreg_state::v11); + register_universal_receiver_hook!(registry, cid, v11); +} + +macro_rules! register_verified_reg_v12_plus { + ($registry:expr, $cid:expr, $state_version:path, $version:tt) => {{ + register_core_methods!($registry, $cid, $state_version); + register_allocation_methods!($registry, $cid, $state_version); + register_exported_methods!($registry, $cid, $state_version); + register_universal_receiver_hook!($registry, $cid, $version); + }}; +} + +pub(crate) fn register_actor_methods(registry: &mut MethodRegistry, cid: Cid, version: u64) { + match version { + 8 => register_verified_reg_v8(registry, cid), + 9 => register_verified_reg_v9(registry, cid), + 10 => register_verified_reg_v10(registry, cid), + 11 => register_verified_reg_v11(registry, cid), + 12 => register_verified_reg_v12_plus!(registry, cid, fil_actor_verifreg_state::v12, v12), + 13 => register_verified_reg_v12_plus!(registry, cid, fil_actor_verifreg_state::v13, v13), + 14 => register_verified_reg_v12_plus!(registry, cid, fil_actor_verifreg_state::v14, v14), + 15 => register_verified_reg_v12_plus!(registry, cid, fil_actor_verifreg_state::v15, v15), + 16 => register_verified_reg_v12_plus!(registry, cid, fil_actor_verifreg_state::v16, v16), + _ => {} + } +} diff --git a/src/rpc/registry/methods_reg.rs b/src/rpc/registry/methods_reg.rs index 708752c63c82..4aa6d6c0f1d5 100644 --- a/src/rpc/registry/methods_reg.rs +++ b/src/rpc/registry/methods_reg.rs @@ -74,7 +74,7 @@ impl MethodRegistry { fn register_known_methods(&mut self) { use crate::rpc::registry::actors::{ - account, cron, datacap, evm, init, miner, multisig, power, reward, system, + account, cron, datacap, evm, init, miner, multisig, power, reward, system, verified_reg, }; for (&cid, &(actor_type, version)) in ACTOR_REGISTRY.iter() { @@ -93,6 +93,9 @@ impl MethodRegistry { BuiltinActor::Reward => reward::register_actor_methods(self, cid, version), BuiltinActor::Cron => cron::register_actor_methods(self, cid, version), BuiltinActor::Multisig => multisig::register_actor_methods(self, cid, version), + BuiltinActor::VerifiedRegistry => { + verified_reg::register_actor_methods(self, cid, version) + } _ => {} } } @@ -136,7 +139,7 @@ macro_rules! register_actor_methods { $registry.register_method( $code_cid, $method as MethodNum, - |bytes| -> Result<$param_type> { Ok(fvm_ipld_encoding::from_slice(bytes)?) }, + |bytes| -> anyhow::Result<$param_type> { Ok(fvm_ipld_encoding::from_slice(bytes)?) }, ); )* }; diff --git a/src/tool/subcommands/api_cmd/api_compare_tests.rs b/src/tool/subcommands/api_cmd/api_compare_tests.rs index 61dfc2403702..25f81b3e687e 100644 --- a/src/tool/subcommands/api_cmd/api_compare_tests.rs +++ b/src/tool/subcommands/api_cmd/api_compare_tests.rs @@ -1799,147 +1799,75 @@ fn eth_tests_with_tipset(store: &Arc, shared_tipset: &Tipset } fn state_decode_params_api_tests(tipset: &Tipset) -> anyhow::Result> { - let account_constructor_params = fil_actor_account_state::v16::types::ConstructorParams { - address: Address::new_id(1234).into(), - }; - - let account_auth_params = fil_actor_account_state::v16::types::AuthenticateMessageParams { - signature: vec![0x00; 32], // dummy signature - message: b"test message".to_vec(), - }; - - let miner_constructor_params = fil_actor_miner_state::v16::MinerConstructorParams { - owner: Address::new_id(1000).into(), - worker: Address::new_id(1001).into(), - control_addresses: vec![Address::new_id(1002).into(), Address::new_id(1003).into()], - window_post_proof_type: fvm_shared4::sector::RegisteredPoStProof::StackedDRGWindow32GiBV1P1, - peer_id: b"miner".to_vec(), - multi_addresses: Default::default(), - }; - - let miner_change_worker_params = fil_actor_miner_state::v16::ChangeWorkerAddressParams { - new_worker: Address::new_id(2000).into(), - new_control_addresses: vec![Address::new_id(2001).into()], - }; - let evm_constructor_params = fil_actor_evm_state::v16::ConstructorParams { creator: fil_actor_evm_state::evm_shared::v16::address::EthAddress([0; 20]), initcode: fvm_ipld_encoding::RawBytes::new(vec![0x12, 0x34, 0x56]), // dummy bytecode }; - - let init_constructor_params = fil_actor_init_state::v16::ConstructorParams { - network_name: "calibnet".to_string(), - }; - - let init_exec4_params = fil_actor_init_state::v16::Exec4Params { - code_cid: Cid::default(), - constructor_params: fvm_ipld_encoding::RawBytes::new(vec![0x12, 0x34, 0x56]), // dummy bytecode - subaddress: fvm_ipld_encoding::RawBytes::new(vec![0x12, 0x34, 0x56]), // dummy bytecode - }; - - let init_exec_params = fil_actor_init_state::v16::ExecParams { - code_cid: Cid::default(), - constructor_params: fvm_ipld_encoding::RawBytes::new(vec![0x12, 0x34, 0x56]), // dummy bytecode - }; - - let power_create_miner_params = fil_actor_power_state::v16::CreateMinerParams { - owner: Address::new_id(1000).into(), - worker: Address::new_id(1001).into(), - window_post_proof_type: fvm_shared4::sector::RegisteredPoStProof::StackedDRGWinning2KiBV1, - peer: b"miner".to_vec(), - multiaddrs: Default::default(), - }; - - // not supported by the lotus - // let _power_miner_power_exp_params = fil_actor_power_state::v16::MinerPowerParams{ - // miner: 1234, - // }; - - let power_update_claim_params = fil_actor_power_state::v16::UpdateClaimedPowerParams { - raw_byte_delta: StoragePower::from(1024u64), - quality_adjusted_delta: StoragePower::from(2048u64), - }; - - let power_enroll_event_params = fil_actor_power_state::v16::EnrollCronEventParams { - event_epoch: 123, - payload: Default::default(), - }; - - let power_update_pledge_ttl_params = fil_actor_power_state::v16::UpdatePledgeTotalParams { - pledge_delta: Default::default(), - }; - - let power_miner_raw_params = fil_actor_power_state::v16::MinerRawPowerParams { miner: 1234 }; - - let reward_constructor_params = fil_actor_reward_state::v16::ConstructorParams { - power: Some(Default::default()), - }; - - let reward_award_block_reward_params = fil_actor_reward_state::v16::AwardBlockRewardParams { - miner: Address::new_id(1000).into(), - penalty: Default::default(), - gas_reward: Default::default(), - win_count: 0, - }; - - let reward_update_network_params = fil_actor_reward_state::v16::UpdateNetworkKPIParams { - curr_realized_power: Option::from(fvm_shared4::bigint::bigint_ser::BigIntDe(BigInt::from( - 111, - ))), - }; - - // TODO(go-state-types): https://github.com/filecoin-project/go-state-types/issues/396 - // Enable this test when lotus supports it in go-state-types. + // // TODO(go-state-types): https://github.com/filecoin-project/go-state-types/issues/396 + // // Enable this test when lotus supports it in go-state-types. // let cron_constructor_params = fil_actor_cron_state::v16::ConstructorParams { // entries: vec![fil_actor_cron_state::v16::Entry { // receiver: Address::new_id(1000).into(), // method_num: fil_actor_cron_state::v16::Method::EpochTick as u64, // }], // }; - let multisig_constructor_params = fil_actor_multisig_state::v16::ConstructorParams { - signers: vec![Address::new_id(1000).into(), Address::new_id(1001).into()], - num_approvals_threshold: Default::default(), - unlock_duration: Default::default(), - start_epoch: Default::default(), - }; - - let multisig_propose_params = fil_actor_multisig_state::v16::ProposeParams { - to: Address::new_id(1000).into(), - value: Default::default(), - method: 0, - params: Default::default(), - }; - - let multisig_tx_id_params = fil_actor_multisig_state::v16::TxnIDParams { - id: Default::default(), - proposal_hash: vec![Default::default()], - }; + let mut tests = vec![ + RpcTest::identity(StateDecodeParams::request(( + Address::from_str(EVM_ADDRESS).unwrap(), // evm actor + 1, + to_vec(&evm_constructor_params)?, + tipset.key().into(), + ))?), + RpcTest::identity(StateDecodeParams::request(( + Address::SYSTEM_ACTOR, + fil_actor_system_state::v16::Method::Constructor as u64, + vec![], + tipset.key().into(), + ))?), + // // TODO(go-state-types): https://github.com/filecoin-project/go-state-types/issues/396 + // Enable this test when lotus supports it in go-state-types. + // RpcTest::identity(StateDecodeParams::request(( + // Address::CRON_ACTOR, + // fil_actor_cron_state::v16::Method::Constructor as u64, + // to_vec(&cron_constructor_params)?, + // tipset.key().into(), + // ))?), + RpcTest::identity(StateDecodeParams::request(( + Address::CRON_ACTOR, + fil_actor_cron_state::v16::Method::EpochTick as u64, + vec![], + tipset.key().into(), + ))?), + ]; - let multisig_add_signer_params = fil_actor_multisig_state::v16::AddSignerParams { - signer: Address::new_id(1012).into(), - increase: false, - }; + tests.extend(miner_actor_state_decode_params_tests(tipset)?); + tests.extend(account_actor_state_decode_params_tests(tipset)?); + tests.extend(init_actor_state_decode_params_tests(tipset)?); + tests.extend(reward_actor_state_decode_params_tests(tipset)?); + tests.extend(power_actor_state_decode_params_tests(tipset)?); + tests.extend(datacap_actor_state_decode_params_tests(tipset)?); + tests.extend(multisig_actor_state_decode_params_tests(tipset)?); + tests.extend(verified_reg_actor_state_decode_params_tests(tipset)?); - let multisig_remove_signer_params = fil_actor_multisig_state::v16::RemoveSignerParams { - signer: Address::new_id(1012).into(), - decrease: false, - }; + Ok(tests) +} - let multisig_swap_signer_params = fil_actor_multisig_state::v16::SwapSignerParams { - from: Address::new_id(122).into(), - to: Address::new_id(1234).into(), +fn miner_actor_state_decode_params_tests(tipset: &Tipset) -> anyhow::Result> { + let miner_constructor_params = fil_actor_miner_state::v16::MinerConstructorParams { + owner: Address::new_id(1000).into(), + worker: Address::new_id(1001).into(), + control_addresses: vec![Address::new_id(1002).into(), Address::new_id(1003).into()], + window_post_proof_type: fvm_shared4::sector::RegisteredPoStProof::StackedDRGWindow32GiBV1P1, + peer_id: b"miner".to_vec(), + multi_addresses: Default::default(), }; - let multisig_change_num_app_params = - fil_actor_multisig_state::v16::ChangeNumApprovalsThresholdParams { new_threshold: 2 }; - - let multisig_lock_bal_params = fil_actor_multisig_state::v16::LockBalanceParams { - start_epoch: 22, - unlock_duration: 12, - amount: Default::default(), + let miner_change_worker_params = fil_actor_miner_state::v16::ChangeWorkerAddressParams { + new_worker: Address::new_id(2000).into(), + new_control_addresses: vec![Address::new_id(2001).into()], }; - let mut tests = vec![ + Ok(vec![ RpcTest::identity(StateDecodeParams::request(( MINER_ADDRESS, 1, @@ -1952,6 +1880,20 @@ fn state_decode_params_api_tests(tipset: &Tipset) -> anyhow::Result to_vec(&miner_change_worker_params)?, tipset.key().into(), ))?), + ]) +} + +fn account_actor_state_decode_params_tests(tipset: &Tipset) -> anyhow::Result> { + let account_constructor_params = fil_actor_account_state::v16::types::ConstructorParams { + address: Address::new_id(1234).into(), + }; + + let account_auth_params = fil_actor_account_state::v16::types::AuthenticateMessageParams { + signature: vec![0x00; 32], // dummy signature + message: b"test message".to_vec(), + }; + + Ok(vec![ RpcTest::identity(StateDecodeParams::request(( ACCOUNT_ADDRESS, 1, @@ -1964,12 +1906,26 @@ fn state_decode_params_api_tests(tipset: &Tipset) -> anyhow::Result to_vec(&account_auth_params)?, tipset.key().into(), ))?), - RpcTest::identity(StateDecodeParams::request(( - Address::from_str(EVM_ADDRESS).unwrap(), // evm actor - 1, - to_vec(&evm_constructor_params)?, - tipset.key().into(), - ))?), + ]) +} + +fn init_actor_state_decode_params_tests(tipset: &Tipset) -> anyhow::Result> { + let init_constructor_params = fil_actor_init_state::v16::ConstructorParams { + network_name: "calibnet".to_string(), + }; + + let init_exec4_params = fil_actor_init_state::v16::Exec4Params { + code_cid: Cid::default(), + constructor_params: fvm_ipld_encoding::RawBytes::new(vec![0x12, 0x34, 0x56]), // dummy bytecode + subaddress: fvm_ipld_encoding::RawBytes::new(vec![0x12, 0x34, 0x56]), // dummy bytecode + }; + + let init_exec_params = fil_actor_init_state::v16::ExecParams { + code_cid: Cid::default(), + constructor_params: fvm_ipld_encoding::RawBytes::new(vec![0x12, 0x34, 0x56]), // dummy bytecode + }; + + Ok(vec![ RpcTest::identity(StateDecodeParams::request(( Address::INIT_ACTOR, 1, @@ -1988,6 +1944,28 @@ fn state_decode_params_api_tests(tipset: &Tipset) -> anyhow::Result to_vec(&init_exec4_params)?, tipset.key().into(), ))?), + ]) +} + +fn reward_actor_state_decode_params_tests(tipset: &Tipset) -> anyhow::Result> { + let reward_constructor_params = fil_actor_reward_state::v16::ConstructorParams { + power: Some(Default::default()), + }; + + let reward_award_block_reward_params = fil_actor_reward_state::v16::AwardBlockRewardParams { + miner: Address::new_id(1000).into(), + penalty: Default::default(), + gas_reward: Default::default(), + win_count: 0, + }; + + let reward_update_network_params = fil_actor_reward_state::v16::UpdateNetworkKPIParams { + curr_realized_power: Option::from(fvm_shared4::bigint::bigint_ser::BigIntDe(BigInt::from( + 111, + ))), + }; + + Ok(vec![ RpcTest::identity(StateDecodeParams::request(( Address::REWARD_ACTOR, fil_actor_reward_state::v16::Method::Constructor as u64, @@ -2012,26 +1990,46 @@ fn state_decode_params_api_tests(tipset: &Tipset) -> anyhow::Result vec![], tipset.key().into(), ))?), + ]) +} + +fn power_actor_state_decode_params_tests(tipset: &Tipset) -> anyhow::Result> { + let power_create_miner_params = fil_actor_power_state::v16::CreateMinerParams { + owner: Address::new_id(1000).into(), + worker: Address::new_id(1001).into(), + window_post_proof_type: fvm_shared4::sector::RegisteredPoStProof::StackedDRGWinning2KiBV1, + peer: b"miner".to_vec(), + multiaddrs: Default::default(), + }; + + // not supported by the lotus + // let _power_miner_power_exp_params = fil_actor_power_state::v16::MinerPowerParams{ + // miner: 1234, + // }; + + let power_update_claim_params = fil_actor_power_state::v16::UpdateClaimedPowerParams { + raw_byte_delta: StoragePower::from(1024u64), + quality_adjusted_delta: StoragePower::from(2048u64), + }; + + let power_enroll_event_params = fil_actor_power_state::v16::EnrollCronEventParams { + event_epoch: 123, + payload: Default::default(), + }; + + let power_update_pledge_ttl_params = fil_actor_power_state::v16::UpdatePledgeTotalParams { + pledge_delta: Default::default(), + }; + + let power_miner_raw_params = fil_actor_power_state::v16::MinerRawPowerParams { miner: 1234 }; + + Ok(vec![ RpcTest::identity(StateDecodeParams::request(( Address::POWER_ACTOR, fil_actor_power_state::v16::Method::CreateMiner as u64, to_vec(&power_create_miner_params)?, tipset.key().into(), ))?), - // TODO(go-state-types): https://github.com/filecoin-project/go-state-types/issues/396 - // Enable this test when lotus supports it in go-state-types. - // RpcTest::identity(StateDecodeParams::request(( - // Address::CRON_ACTOR, - // fil_actor_cron_state::v16::Method::Constructor as u64, - // to_vec(&cron_constructor_params)?, - // tipset.key().into(), - // ))?), - RpcTest::identity(StateDecodeParams::request(( - Address::CRON_ACTOR, - fil_actor_cron_state::v16::Method::EpochTick as u64, - vec![], - tipset.key().into(), - ))?), RpcTest::identity(StateDecodeParams::request(( Address::POWER_ACTOR, fil_actor_power_state::v16::Method::UpdateClaimedPower as u64, @@ -2062,127 +2060,51 @@ fn state_decode_params_api_tests(tipset: &Tipset) -> anyhow::Result to_vec(&power_miner_raw_params)?, tipset.key().into(), ))?), - RpcTest::identity(StateDecodeParams::request(( - Address::POWER_ACTOR, - fil_actor_power_state::v16::Method::Constructor as u64, - vec![], - tipset.key().into(), - ))?), - RpcTest::identity(StateDecodeParams::request(( - Address::POWER_ACTOR, - fil_actor_power_state::v16::Method::OnEpochTickEnd as u64, - vec![], - tipset.key().into(), - ))?), - RpcTest::identity(StateDecodeParams::request(( - Address::POWER_ACTOR, - fil_actor_power_state::v16::Method::CurrentTotalPower as u64, - vec![], - tipset.key().into(), - ))?), - RpcTest::identity(StateDecodeParams::request(( - Address::POWER_ACTOR, - fil_actor_power_state::v16::Method::NetworkRawPowerExported as u64, - vec![], - tipset.key().into(), - ))?), - RpcTest::identity(StateDecodeParams::request(( - Address::POWER_ACTOR, - fil_actor_power_state::v16::Method::MinerCountExported as u64, - vec![], - tipset.key().into(), - ))?), - RpcTest::identity(StateDecodeParams::request(( - Address::POWER_ACTOR, - fil_actor_power_state::v16::Method::MinerConsensusCountExported as u64, - vec![], - tipset.key().into(), - ))?), // Not supported by the lotus, // TODO(go-state-types): https://github.com/filecoin-project/go-state-types/issues/401 // RpcTest::identity(StateDecodeParams::request(( - // Address::POWER_ACTOR, - // Method::MinerPowerExported as u64, - // to_vec(&power_miner_power_exp_params)?, - // tipset.key().into(), - // ))?), - RpcTest::identity(StateDecodeParams::request(( - Address::new_id(18101), // https://calibration.filscan.io/en/address/t018101/, - fil_actor_multisig_state::v16::Method::Constructor as u64, - to_vec(&multisig_constructor_params)?, - tipset.key().into(), - ))?), - RpcTest::identity(StateDecodeParams::request(( - Address::new_id(18101), // https://calibration.filscan.io/en/address/t018101/, - fil_actor_multisig_state::v16::Method::Propose as u64, - to_vec(&multisig_propose_params)?, - tipset.key().into(), - ))?), - RpcTest::identity(StateDecodeParams::request(( - Address::new_id(18101), // https://calibration.filscan.io/en/address/t018101/, - fil_actor_multisig_state::v16::Method::Approve as u64, - to_vec(&multisig_tx_id_params)?, - tipset.key().into(), - ))?), - RpcTest::identity(StateDecodeParams::request(( - Address::new_id(18101), // https://calibration.filscan.io/en/address/t018101/, - fil_actor_multisig_state::v16::Method::Cancel as u64, - to_vec(&multisig_tx_id_params)?, - tipset.key().into(), - ))?), - RpcTest::identity(StateDecodeParams::request(( - Address::new_id(18101), // https://calibration.filscan.io/en/address/t018101/, - fil_actor_multisig_state::v16::Method::AddSigner as u64, - to_vec(&multisig_add_signer_params)?, - tipset.key().into(), - ))?), - RpcTest::identity(StateDecodeParams::request(( - Address::new_id(18101), // https://calibration.filscan.io/en/address/t018101/, - fil_actor_multisig_state::v16::Method::RemoveSigner as u64, - to_vec(&multisig_remove_signer_params)?, - tipset.key().into(), - ))?), + // Address::POWER_ACTOR, + // Method::MinerPowerExported as u64, + // to_vec(&power_miner_power_exp_params)?, + // tipset.key().into(), + // ))?), RpcTest::identity(StateDecodeParams::request(( - Address::new_id(18101), // https://calibration.filscan.io/en/address/t018101/, - fil_actor_multisig_state::v16::Method::SwapSigner as u64, - to_vec(&multisig_swap_signer_params)?, + Address::POWER_ACTOR, + fil_actor_power_state::v16::Method::Constructor as u64, + vec![], tipset.key().into(), ))?), RpcTest::identity(StateDecodeParams::request(( - Address::new_id(18101), // https://calibration.filscan.io/en/address/t018101/, - fil_actor_multisig_state::v16::Method::ChangeNumApprovalsThreshold as u64, - to_vec(&multisig_change_num_app_params)?, + Address::POWER_ACTOR, + fil_actor_power_state::v16::Method::OnEpochTickEnd as u64, + vec![], tipset.key().into(), ))?), RpcTest::identity(StateDecodeParams::request(( - Address::new_id(18101), // https://calibration.filscan.io/en/address/t018101/, - fil_actor_multisig_state::v16::Method::LockBalance as u64, - to_vec(&multisig_lock_bal_params)?, + Address::POWER_ACTOR, + fil_actor_power_state::v16::Method::CurrentTotalPower as u64, + vec![], tipset.key().into(), ))?), RpcTest::identity(StateDecodeParams::request(( - Address::new_id(18101), // https://calibration.filscan.io/en/address/t018101/, - fil_actor_multisig_state::v16::Method::LockBalance as u64, - to_vec(&multisig_lock_bal_params)?, + Address::POWER_ACTOR, + fil_actor_power_state::v16::Method::NetworkRawPowerExported as u64, + vec![], tipset.key().into(), ))?), RpcTest::identity(StateDecodeParams::request(( - Address::new_id(18101), // https://calibration.filscan.io/en/address/t018101/, - fil_actor_multisig_state::v16::Method::UniversalReceiverHook as u64, - BASE64_STANDARD.decode("ghgqRBI0Vng=").unwrap(), + Address::POWER_ACTOR, + fil_actor_power_state::v16::Method::MinerCountExported as u64, + vec![], tipset.key().into(), ))?), RpcTest::identity(StateDecodeParams::request(( - Address::SYSTEM_ACTOR, - fil_actor_system_state::v16::Method::Constructor as u64, + Address::POWER_ACTOR, + fil_actor_power_state::v16::Method::MinerConsensusCountExported as u64, vec![], tipset.key().into(), ))?), - ]; - - tests.extend(datacap_actor_state_decode_params_tests(tipset)?); - - Ok(tests) + ]) } fn datacap_actor_state_decode_params_tests(tipset: &Tipset) -> anyhow::Result> { @@ -2353,6 +2275,312 @@ fn datacap_actor_state_decode_params_tests(tipset: &Tipset) -> anyhow::Result anyhow::Result> { + let multisig_constructor_params = fil_actor_multisig_state::v16::ConstructorParams { + signers: vec![Address::new_id(1000).into(), Address::new_id(1001).into()], + num_approvals_threshold: Default::default(), + unlock_duration: Default::default(), + start_epoch: Default::default(), + }; + + let multisig_propose_params = fil_actor_multisig_state::v16::ProposeParams { + to: Address::new_id(1000).into(), + value: Default::default(), + method: 0, + params: Default::default(), + }; + + let multisig_tx_id_params = fil_actor_multisig_state::v16::TxnIDParams { + id: Default::default(), + proposal_hash: vec![Default::default()], + }; + + let multisig_add_signer_params = fil_actor_multisig_state::v16::AddSignerParams { + signer: Address::new_id(1012).into(), + increase: false, + }; + + let multisig_remove_signer_params = fil_actor_multisig_state::v16::RemoveSignerParams { + signer: Address::new_id(1012).into(), + decrease: false, + }; + + let multisig_swap_signer_params = fil_actor_multisig_state::v16::SwapSignerParams { + from: Address::new_id(122).into(), + to: Address::new_id(1234).into(), + }; + + let multisig_change_num_app_params = + fil_actor_multisig_state::v16::ChangeNumApprovalsThresholdParams { new_threshold: 2 }; + + let multisig_lock_bal_params = fil_actor_multisig_state::v16::LockBalanceParams { + start_epoch: 22, + unlock_duration: 12, + amount: Default::default(), + }; + + Ok(vec![ + RpcTest::identity(StateDecodeParams::request(( + Address::new_id(18101), // https://calibration.filscan.io/en/address/t018101/, + fil_actor_multisig_state::v16::Method::Constructor as u64, + to_vec(&multisig_constructor_params)?, + tipset.key().into(), + ))?), + RpcTest::identity(StateDecodeParams::request(( + Address::new_id(18101), // https://calibration.filscan.io/en/address/t018101/, + fil_actor_multisig_state::v16::Method::Propose as u64, + to_vec(&multisig_propose_params)?, + tipset.key().into(), + ))?), + RpcTest::identity(StateDecodeParams::request(( + Address::new_id(18101), // https://calibration.filscan.io/en/address/t018101/, + fil_actor_multisig_state::v16::Method::Approve as u64, + to_vec(&multisig_tx_id_params)?, + tipset.key().into(), + ))?), + RpcTest::identity(StateDecodeParams::request(( + Address::new_id(18101), // https://calibration.filscan.io/en/address/t018101/, + fil_actor_multisig_state::v16::Method::Cancel as u64, + to_vec(&multisig_tx_id_params)?, + tipset.key().into(), + ))?), + RpcTest::identity(StateDecodeParams::request(( + Address::new_id(18101), // https://calibration.filscan.io/en/address/t018101/, + fil_actor_multisig_state::v16::Method::AddSigner as u64, + to_vec(&multisig_add_signer_params)?, + tipset.key().into(), + ))?), + RpcTest::identity(StateDecodeParams::request(( + Address::new_id(18101), // https://calibration.filscan.io/en/address/t018101/, + fil_actor_multisig_state::v16::Method::RemoveSigner as u64, + to_vec(&multisig_remove_signer_params)?, + tipset.key().into(), + ))?), + RpcTest::identity(StateDecodeParams::request(( + Address::new_id(18101), // https://calibration.filscan.io/en/address/t018101/, + fil_actor_multisig_state::v16::Method::SwapSigner as u64, + to_vec(&multisig_swap_signer_params)?, + tipset.key().into(), + ))?), + RpcTest::identity(StateDecodeParams::request(( + Address::new_id(18101), // https://calibration.filscan.io/en/address/t018101/, + fil_actor_multisig_state::v16::Method::ChangeNumApprovalsThreshold as u64, + to_vec(&multisig_change_num_app_params)?, + tipset.key().into(), + ))?), + RpcTest::identity(StateDecodeParams::request(( + Address::new_id(18101), // https://calibration.filscan.io/en/address/t018101/, + fil_actor_multisig_state::v16::Method::LockBalance as u64, + to_vec(&multisig_lock_bal_params)?, + tipset.key().into(), + ))?), + RpcTest::identity(StateDecodeParams::request(( + Address::new_id(18101), // https://calibration.filscan.io/en/address/t018101/, + fil_actor_multisig_state::v16::Method::LockBalance as u64, + to_vec(&multisig_lock_bal_params)?, + tipset.key().into(), + ))?), + RpcTest::identity(StateDecodeParams::request(( + Address::new_id(18101), // https://calibration.filscan.io/en/address/t018101/, + fil_actor_multisig_state::v16::Method::UniversalReceiverHook as u64, + BASE64_STANDARD.decode("ghgqRBI0Vng=").unwrap(), + tipset.key().into(), + ))?), + ]) +} + +fn verified_reg_actor_state_decode_params_tests(tipset: &Tipset) -> anyhow::Result> { + let verified_reg_constructor_params = fil_actor_verifreg_state::v16::ConstructorParams { + root_key: Address::new_id(1000).into(), + }; + + let verified_reg_add_verifier_params = fil_actor_verifreg_state::v16::AddVerifierParams { + address: Address::new_id(1234).into(), + allowance: StoragePower::from(1048576u64), // 1MB + }; + + let verified_reg_remove_verifier_params = fil_actor_verifreg_state::v16::RemoveVerifierParams { + verifier: Address::new_id(1234).into(), + }; + + let verified_reg_add_verified_client_params = + fil_actor_verifreg_state::v16::AddVerifiedClientParams { + address: Address::new_id(1235).into(), + allowance: fil_actor_verifreg_state::v16::types::DataCap::from(2097152u64), // 2MB + }; + + let verified_reg_remove_data_cap_params = fil_actor_verifreg_state::v16::RemoveDataCapParams { + verified_client_to_remove: Address::new_id(1236).into(), + data_cap_amount_to_remove: fil_actor_verifreg_state::v16::types::DataCap::from(1048576u64), + verifier_request_1: fil_actor_verifreg_state::v16::RemoveDataCapRequest { + verifier: Address::new_id(1237).into(), + signature: fvm_shared4::crypto::signature::Signature::new_bls( + b"test_signature_1".to_vec(), + ), + }, + verifier_request_2: fil_actor_verifreg_state::v16::RemoveDataCapRequest { + verifier: Address::new_id(1238).into(), + signature: fvm_shared4::crypto::signature::Signature::new_secp256k1( + b"test_signature_2".to_vec(), + ), + }, + }; + + let verified_reg_remove_expired_allocations_params = + fil_actor_verifreg_state::v16::RemoveExpiredAllocationsParams { + client: 1239, + allocation_ids: vec![1001, 1002, 1003], + }; + + let verified_reg_claim_allocations_params = + fil_actor_verifreg_state::v16::ClaimAllocationsParams { + sectors: vec![fil_actor_verifreg_state::v16::SectorAllocationClaims { + sector: 42, + expiry: 2000000, + claims: vec![ + fil_actor_verifreg_state::v16::AllocationClaim { + client: 1240, + allocation_id: 2001, + data: Cid::default(), + size: fvm_shared4::piece::PaddedPieceSize(1024), + }, + fil_actor_verifreg_state::v16::AllocationClaim { + client: 1241, + allocation_id: 2002, + data: Cid::default(), + size: fvm_shared4::piece::PaddedPieceSize(2048), + }, + ], + }], + all_or_nothing: false, + }; + + let verified_reg_get_claims_params = fil_actor_verifreg_state::v16::GetClaimsParams { + provider: 1242, + claim_ids: vec![3001, 3002, 3003], + }; + + let verified_reg_extend_claim_terms_params = + fil_actor_verifreg_state::v16::ExtendClaimTermsParams { + terms: vec![fil_actor_verifreg_state::v16::ClaimTerm { + provider: 12, + claim_id: 12, + term_max: 123, + }], + }; + + let verified_reg_remove_expired_claims_params = + fil_actor_verifreg_state::v16::RemoveExpiredClaimsParams { + provider: 1243, + claim_ids: vec![4001, 4002, 4003], + }; + + let verified_reg_universal_receiver_params = + fvm_actor_utils::receiver::UniversalReceiverParams { + type_: 42, + payload: fvm_ipld_encoding::RawBytes::new(vec![0x12, 0x34, 0x56, 0x78]), + }; + + Ok(vec![ + RpcTest::identity(StateDecodeParams::request(( + Address::VERIFIED_REGISTRY_ACTOR, + fil_actor_verifreg_state::v16::Method::Constructor as u64, + to_vec(&verified_reg_constructor_params)?, + tipset.key().into(), + ))?), + RpcTest::identity(StateDecodeParams::request(( + Address::VERIFIED_REGISTRY_ACTOR, + fil_actor_verifreg_state::v16::Method::AddVerifier as u64, + to_vec(&verified_reg_add_verifier_params)?, + tipset.key().into(), + ))?), + RpcTest::identity(StateDecodeParams::request(( + Address::VERIFIED_REGISTRY_ACTOR, + fil_actor_verifreg_state::v16::Method::RemoveVerifier as u64, + to_vec(&verified_reg_remove_verifier_params)?, + tipset.key().into(), + ))?), + RpcTest::identity(StateDecodeParams::request(( + Address::VERIFIED_REGISTRY_ACTOR, + fil_actor_verifreg_state::v16::Method::AddVerifiedClient as u64, + to_vec(&verified_reg_add_verified_client_params)?, + tipset.key().into(), + ))?), + RpcTest::identity(StateDecodeParams::request(( + Address::VERIFIED_REGISTRY_ACTOR, + fil_actor_verifreg_state::v16::Method::RemoveVerifiedClientDataCap as u64, + to_vec(&verified_reg_remove_data_cap_params)?, + tipset.key().into(), + ))?), + RpcTest::identity(StateDecodeParams::request(( + Address::VERIFIED_REGISTRY_ACTOR, + fil_actor_verifreg_state::v16::Method::RemoveExpiredAllocations as u64, + to_vec(&verified_reg_remove_expired_allocations_params)?, + tipset.key().into(), + ))?), + RpcTest::identity(StateDecodeParams::request(( + Address::VERIFIED_REGISTRY_ACTOR, + fil_actor_verifreg_state::v16::Method::ClaimAllocations as u64, + to_vec(&verified_reg_claim_allocations_params)?, + tipset.key().into(), + ))?), + RpcTest::identity(StateDecodeParams::request(( + Address::VERIFIED_REGISTRY_ACTOR, + fil_actor_verifreg_state::v16::Method::GetClaims as u64, + to_vec(&verified_reg_get_claims_params)?, + tipset.key().into(), + ))?), + RpcTest::identity(StateDecodeParams::request(( + Address::VERIFIED_REGISTRY_ACTOR, + fil_actor_verifreg_state::v16::Method::ExtendClaimTerms as u64, + to_vec(&verified_reg_extend_claim_terms_params)?, + tipset.key().into(), + ))?), + RpcTest::identity(StateDecodeParams::request(( + Address::VERIFIED_REGISTRY_ACTOR, + fil_actor_verifreg_state::v16::Method::RemoveExpiredClaims as u64, + to_vec(&verified_reg_remove_expired_claims_params)?, + tipset.key().into(), + ))?), + RpcTest::identity(StateDecodeParams::request(( + Address::VERIFIED_REGISTRY_ACTOR, + fil_actor_verifreg_state::v16::Method::AddVerifiedClientExported as u64, + to_vec(&verified_reg_add_verified_client_params)?, // reuse same params + tipset.key().into(), + ))?), + RpcTest::identity(StateDecodeParams::request(( + Address::VERIFIED_REGISTRY_ACTOR, + fil_actor_verifreg_state::v16::Method::RemoveExpiredAllocationsExported as u64, + to_vec(&verified_reg_remove_expired_allocations_params)?, // reuse same params + tipset.key().into(), + ))?), + RpcTest::identity(StateDecodeParams::request(( + Address::VERIFIED_REGISTRY_ACTOR, + fil_actor_verifreg_state::v16::Method::GetClaimsExported as u64, + to_vec(&verified_reg_get_claims_params)?, // reuse same params + tipset.key().into(), + ))?), + RpcTest::identity(StateDecodeParams::request(( + Address::VERIFIED_REGISTRY_ACTOR, + fil_actor_verifreg_state::v16::Method::ExtendClaimTermsExported as u64, + to_vec(&verified_reg_extend_claim_terms_params)?, // reuse same params + tipset.key().into(), + ))?), + RpcTest::identity(StateDecodeParams::request(( + Address::VERIFIED_REGISTRY_ACTOR, + fil_actor_verifreg_state::v16::Method::RemoveExpiredClaimsExported as u64, + to_vec(&verified_reg_remove_expired_claims_params)?, // reuse same params + tipset.key().into(), + ))?), + RpcTest::identity(StateDecodeParams::request(( + Address::VERIFIED_REGISTRY_ACTOR, + fil_actor_verifreg_state::v16::Method::UniversalReceiverHook as u64, + to_vec(&verified_reg_universal_receiver_params)?, + tipset.key().into(), + ))?), + ]) +} + fn read_state_api_tests(tipset: &Tipset) -> anyhow::Result> { let tests = vec![ RpcTest::identity(StateReadState::request(( diff --git a/src/tool/subcommands/api_cmd/test_snapshots.txt b/src/tool/subcommands/api_cmd/test_snapshots.txt index 649a923a4da8..8a388ebd11b2 100644 --- a/src/tool/subcommands/api_cmd/test_snapshots.txt +++ b/src/tool/subcommands/api_cmd/test_snapshots.txt @@ -178,6 +178,22 @@ filecoin_multisig_statedecodeparams_1754230255631872.rpcsnap.json.zst filecoin_multisig_statedecodeparams_1754230255631946.rpcsnap.json.zst filecoin_multisig_statedecodeparams_1754230255632019.rpcsnap.json.zst filecoin_multisig_statedecodeparams_1754581573704814.rpcsnap.json.zst +filecoin_verified_reg_statedecodeparams_1754401651142334.rpcsnap.json.zst +filecoin_verified_reg_statedecodeparams_1754492006350827.rpcsnap.json.zst +filecoin_verified_reg_statedecodeparams_1754401651146246.rpcsnap.json.zst +filecoin_verified_reg_statedecodeparams_1754401651146327.rpcsnap.json.zst +filecoin_verified_reg_statedecodeparams_1754401651146402.rpcsnap.json.zst +filecoin_verified_reg_statedecodeparams_1754401651146485.rpcsnap.json.zst +filecoin_verified_reg_statedecodeparams_1754401651146560.rpcsnap.json.zst +filecoin_verified_reg_statedecodeparams_1754401651146644.rpcsnap.json.zst +filecoin_verified_reg_statedecodeparams_1754401651146719.rpcsnap.json.zst +filecoin_verified_reg_statedecodeparams_1754401651146788.rpcsnap.json.zst +filecoin_verified_reg_statedecodeparams_1754401651146860.rpcsnap.json.zst +filecoin_verified_reg_statedecodeparams_1754401651146948.rpcsnap.json.zst +filecoin_verified_reg_statedecodeparams_1754401651147022.rpcsnap.json.zst +filecoin_verified_reg_statedecodeparams_1754401651147091.rpcsnap.json.zst +filecoin_verified_reg_statedecodeparams_1754401651147157.rpcsnap.json.zst +filecoin_verified_reg_statedecodeparams_1754401651147231.rpcsnap.json.zst filecoin_statereplay_1743504051038215.rpcsnap.json.zst filecoin_statesearchmsg_1741784596636715.rpcsnap.json.zst filecoin_statesearchmsglimited_1741784596704876.rpcsnap.json.zst