Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@

- [#6014](https://github.com/ChainSafe/forest/pull/6014) Removed `unordered-graph-traversal` from `forest-tool benchmark`.


### Fixed

## Forest v0.29.0 "Fëanor"
Expand Down
1 change: 1 addition & 0 deletions src/lotus_json/actor_states/methods/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ mod init_exec4_params;
mod init_exec_params;
mod miner_actor_params;
mod multisig_actor;
mod paych_params;
mod power_actor;
mod reward_methods;
pub mod verified_reg_actor;
546 changes: 546 additions & 0 deletions src/lotus_json/actor_states/methods/paych_params.rs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/rpc/registry/actors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub(crate) mod evm;
pub(crate) mod init;
pub(crate) mod miner;
pub(crate) mod multisig;
pub(crate) mod payment_channel;
pub(crate) mod power;
pub(crate) mod reward;
pub(crate) mod system;
Expand Down
45 changes: 45 additions & 0 deletions src/rpc/registry/actors/payment_channel.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// 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::message::MethodNum;
use cid::Cid;

macro_rules! register_payment_channel_reg_versions {
($registry:expr, $code_cid:expr, $version:literal) => {{
paste::paste!{
use fil_actor_paych_state::[<v $version>]::{ConstructorParams, Method, UpdateChannelStateParams};
}

// Register methods with parameters
register_actor_methods!(
$registry,
$code_cid,
[
(Method::Constructor, ConstructorParams),
(Method::UpdateChannelState, UpdateChannelStateParams),
]
);

// Register methods without parameters
register_actor_methods!(
$registry,
$code_cid,
[(Method::Settle, empty), (Method::Collect, empty),]
);
}};
}

pub(crate) fn register_actor_methods(registry: &mut MethodRegistry, cid: Cid, version: u64) {
macro_rules! register_versions {
($($version:literal),+) => {{
match version {
$(
$version => register_payment_channel_reg_versions!(registry, cid, $version),
)+
_ => {}
}
}};
}
register_versions!(8, 9, 10, 11, 12, 13, 14, 15, 16)
}
7 changes: 5 additions & 2 deletions src/rpc/registry/methods_reg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ impl MethodRegistry {

fn register_known_methods(&mut self) {
use crate::rpc::registry::actors::{
account, cron, datacap, eth_account, evm, init, miner, multisig, power, reward, system,
verified_reg,
account, cron, datacap, eth_account, evm, init, miner, multisig, payment_channel,
power, reward, system, verified_reg,
};

for (&cid, &(actor_type, version)) in ACTOR_REGISTRY.iter() {
Expand All @@ -98,6 +98,9 @@ impl MethodRegistry {
verified_reg::register_actor_methods(self, cid, version)
}
BuiltinActor::EthAccount => eth_account::register_actor_methods(self, cid, version),
BuiltinActor::PaymentChannel => {
payment_channel::register_actor_methods(self, cid, version)
}
_ => {}
}
}
Expand Down
60 changes: 60 additions & 0 deletions src/tool/subcommands/api_cmd/api_compare_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1902,10 +1902,70 @@ fn state_decode_params_api_tests(tipset: &Tipset) -> anyhow::Result<Vec<RpcTest>
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)?);
tests.extend(paych_actor_state_decode_params_tests(tipset)?);

Ok(tests)
}

fn paych_actor_state_decode_params_tests(tipset: &Tipset) -> anyhow::Result<Vec<RpcTest>> {
// payment channel actor address `t066116`
// https://calibration.filscan.io/en/address/t066116/
let paych_address = Address::new_id(66116);

let constructor_params = fil_actor_paych_state::v16::ConstructorParams {
from: Address::new_id(1234).into(),
to: Address::new_id(8457).into(),
};

let update_channel_state = fil_actor_paych_state::v16::UpdateChannelStateParams {
sv: fil_actor_paych_state::v16::SignedVoucher {
channel_addr: Address::new_id(1000).into(),
time_lock_min: 21,
time_lock_max: 234,
secret_pre_image: vec![],
extra: Some(fil_actor_paych_state::v16::ModVerifyParams {
actor: Address::new_id(1234).into(),
method: 223,
data: Default::default(),
}),
lane: 234,
nonce: 231,
amount: Default::default(),
min_settle_height: 0,
merges: vec![],
signature: None,
},
secret: vec![0x11, 0x22, 0x33, 0x44, 0x55], // dummy data
};

Ok(vec![
RpcTest::identity(StateDecodeParams::request((
paych_address,
fil_actor_paych_state::v16::Method::Constructor as u64,
to_vec(&constructor_params).unwrap(),
tipset.key().into(),
))?),
RpcTest::identity(StateDecodeParams::request((
paych_address,
fil_actor_paych_state::v16::Method::UpdateChannelState as u64,
to_vec(&update_channel_state).unwrap(),
tipset.key().into(),
))?),
RpcTest::identity(StateDecodeParams::request((
paych_address,
fil_actor_paych_state::v16::Method::Settle as u64,
vec![],
tipset.key().into(),
))?),
RpcTest::identity(StateDecodeParams::request((
paych_address,
fil_actor_paych_state::v16::Method::Collect as u64,
vec![],
tipset.key().into(),
))?),
])
}

fn evm_actor_state_decode_params_tests(tipset: &Tipset) -> anyhow::Result<Vec<RpcTest>> {
let evm_constructor_params = fil_actor_evm_state::v16::ConstructorParams {
creator: fil_actor_evm_state::evm_shared::v16::address::EthAddress([0; 20]),
Expand Down
4 changes: 4 additions & 0 deletions src/tool/subcommands/api_cmd/test_snapshots.txt
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ filecoin_miner_statedecodeparams_1755027105573353.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105571760.rpcsnap.json.zst
filecoin_miner_statedecodeparams_1755027105573989.rpcsnap.json.zst
filecoin_ethaccount_statedecodeparams_1756186350854913.rpcsnap.json.zst
filecoin_payment_channel_statedecodeparams_1756194613312797.rpcsnap.json.zst
filecoin_payment_channel_statedecodeparams_1756194613312868.rpcsnap.json.zst
filecoin_payment_channel_statedecodeparams_1756194613312941.rpcsnap.json.zst
filecoin_payment_channel_statedecodeparams_1756194613313007.rpcsnap.json.zst
Comment thread
coderabbitai[bot] marked this conversation as resolved.
filecoin_statereplay_1743504051038215.rpcsnap.json.zst
filecoin_statesearchmsg_1741784596636715.rpcsnap.json.zst
filecoin_statesearchmsglimited_1741784596704876.rpcsnap.json.zst
Expand Down
Loading