Skip to content

Commit 6f5714b

Browse files
committed
tidy fvm_dispatch
1 parent fd4dabb commit 6f5714b

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[workspace]
2+
3+
members = [
4+
"fvm_dispatch"
5+
]

fvm_dispatch/src/hash.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,13 @@ pub struct MethodHasher<T: Hasher> {
2626
impl<T: Hasher> MethodHasher<T> {
2727
const CONSTRUCTOR_METHOD_NAME: &'static str = "Constructor";
2828
const CONSTRUCTOR_METHOD_NUMBER: u64 = 1_u64;
29+
30+
/// Create a new MethodHasher using the given hash algorithm
2931
pub fn new(hasher: T) -> Self {
3032
Self { hasher }
3133
}
3234

35+
/// Generate the conventional method number based off an exported name
3336
pub fn method_number(&self, method_name: &str) -> u64 {
3437
if method_name == Self::CONSTRUCTOR_METHOD_NAME {
3538
Self::CONSTRUCTOR_METHOD_NUMBER

fvm_dispatch/src/message.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ pub struct MethodDispatcher<T: Hasher> {
1010
}
1111

1212
impl<T: Hasher> MethodDispatcher<T> {
13+
/// Create a new MethodDispatcher with a given hasher
1314
pub fn new(hasher: T) -> Self {
1415
Self {
1516
method_hasher: MethodHasher::new(hasher),
1617
}
1718
}
1819

20+
/// Call a method on another actor by conventional name
1921
pub fn call_method(
2022
&self,
2123
to: &Address,

0 commit comments

Comments
 (0)