1
1
// Copyright 2019-2022 ChainSafe Systems
2
2
// SPDX-License-Identifier: Apache-2.0, MIT
3
3
4
- use fvm_ipld_blockstore:: Blockstore ;
5
4
use fvm_ipld_encoding:: RawBytes ;
6
5
use fvm_shared:: address:: { Address , Protocol } ;
7
6
use fvm_shared:: crypto:: signature:: SignatureType :: { Secp256k1 , BLS } ;
@@ -42,11 +41,7 @@ pub struct Actor;
42
41
43
42
impl Actor {
44
43
/// Constructor for Account actor
45
- pub fn constructor < BS , RT > ( rt : & mut RT , address : Address ) -> Result < ( ) , ActorError >
46
- where
47
- BS : Blockstore ,
48
- RT : Runtime < BS > ,
49
- {
44
+ pub fn constructor ( rt : & mut impl Runtime , address : Address ) -> Result < ( ) , ActorError > {
50
45
rt. validate_immediate_caller_is ( std:: iter:: once ( & SYSTEM_ACTOR_ADDR ) ) ?;
51
46
match address. protocol ( ) {
52
47
Protocol :: Secp256k1 | Protocol :: BLS => { }
@@ -60,11 +55,7 @@ impl Actor {
60
55
}
61
56
62
57
/// Fetches the pubkey-type address from this actor.
63
- pub fn pubkey_address < BS , RT > ( rt : & mut RT ) -> Result < Address , ActorError >
64
- where
65
- BS : Blockstore ,
66
- RT : Runtime < BS > ,
67
- {
58
+ pub fn pubkey_address ( rt : & mut impl Runtime ) -> Result < Address , ActorError > {
68
59
rt. validate_immediate_caller_accept_any ( ) ?;
69
60
let st: State = rt. state ( ) ?;
70
61
Ok ( st. address )
@@ -73,14 +64,10 @@ impl Actor {
73
64
/// Authenticates whether the provided signature is valid for the provided message.
74
65
/// Should be called with the raw bytes of a signature, NOT a serialized Signature object that includes a SignatureType.
75
66
/// Errors with USR_ILLEGAL_ARGUMENT if the authentication is invalid.
76
- pub fn authenticate_message < BS , RT > (
77
- rt : & mut RT ,
67
+ pub fn authenticate_message (
68
+ rt : & mut impl Runtime ,
78
69
params : AuthenticateMessageParams ,
79
- ) -> Result < ( ) , ActorError >
80
- where
81
- BS : Blockstore ,
82
- RT : Runtime < BS > ,
83
- {
70
+ ) -> Result < ( ) , ActorError > {
84
71
rt. validate_immediate_caller_accept_any ( ) ?;
85
72
let st: State = rt. state ( ) ?;
86
73
let address = st. address ;
@@ -104,28 +91,23 @@ impl Actor {
104
91
}
105
92
106
93
// Always succeeds, accepting any transfers.
107
- pub fn universal_receiver_hook < BS , RT > (
108
- rt : & mut RT ,
94
+ pub fn universal_receiver_hook (
95
+ rt : & mut impl Runtime ,
109
96
_params : & RawBytes ,
110
- ) -> Result < ( ) , ActorError >
111
- where
112
- BS : Blockstore ,
113
- RT : Runtime < BS > ,
114
- {
97
+ ) -> Result < ( ) , ActorError > {
115
98
rt. validate_immediate_caller_accept_any ( ) ?;
116
99
Ok ( ( ) )
117
100
}
118
101
}
119
102
120
103
impl ActorCode for Actor {
121
- fn invoke_method < BS , RT > (
104
+ fn invoke_method < RT > (
122
105
rt : & mut RT ,
123
106
method : MethodNum ,
124
107
params : & RawBytes ,
125
108
) -> Result < RawBytes , ActorError >
126
109
where
127
- BS : Blockstore ,
128
- RT : Runtime < BS > ,
110
+ RT : Runtime ,
129
111
{
130
112
match FromPrimitive :: from_u64 ( method) {
131
113
Some ( Method :: Constructor ) => {
0 commit comments