File tree Expand file tree Collapse file tree 5 files changed +43
-13
lines changed Expand file tree Collapse file tree 5 files changed +43
-13
lines changed Original file line number Diff line number Diff line change @@ -224,7 +224,7 @@ namespace fc::common {
224
224
* @return reference to stream
225
225
*/
226
226
template <class Stream ,
227
- typename = std::enable_if_t <Stream::is_encoder_stream >>
227
+ typename = std::enable_if_t <Stream::is_cbor_encoder_stream >>
228
228
Stream &operator <<(Stream &s, const Buffer &buffer) {
229
229
return s << buffer.toVector ();
230
230
}
@@ -237,7 +237,7 @@ namespace fc::common {
237
237
* @return reference to stream
238
238
*/
239
239
template <class Stream ,
240
- typename = std::enable_if_t <Stream::is_decoder_stream >>
240
+ typename = std::enable_if_t <Stream::is_cbor_decoder_stream >>
241
241
Stream &operator >>(Stream &s, Buffer &buffer) {
242
242
std::vector<uint8_t > data;
243
243
s >> data;
Original file line number Diff line number Diff line change @@ -28,12 +28,37 @@ namespace fc::vm::actor {
28
28
*/
29
29
struct MethodNumber {
30
30
uint64_t method_number;
31
+
32
+ inline bool operator ==(const MethodNumber &other) const {
33
+ return method_number == other.method_number ;
34
+ }
31
35
};
32
36
37
+ template <class Stream ,
38
+ typename = std::enable_if_t <
39
+ std::remove_reference<Stream>::type::is_cbor_encoder_stream>>
40
+ Stream &operator <<(Stream &&s, const MethodNumber &method) noexcept {
41
+ return s << method.method_number ;
42
+ }
43
+
44
+ template <class Stream ,
45
+ typename = std::enable_if_t <
46
+ std::remove_reference<Stream>::type::is_cbor_decoder_stream>>
47
+ Stream &operator >>(Stream &&s, MethodNumber &method) noexcept {
48
+ return s >> method.method_number ;
49
+ }
50
+
33
51
/* *
34
52
* MethodParams is serialized parameters to the method call
35
53
*/
36
- class MethodParams : public Buffer {};
54
+ class MethodParams : public Buffer {
55
+ using Buffer::Buffer;
56
+
57
+ public:
58
+ inline bool operator ==(const MethodParams &other) const {
59
+ return Buffer::operator ==(static_cast <const Buffer &>(other));
60
+ }
61
+ };
37
62
38
63
/* *
39
64
* CodeID identifies an actor's code (either one of the builtin actors, or, in
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ add_library(message
12
12
target_link_libraries (message
13
13
Boost::boost
14
14
address
15
+ buffer
15
16
logger
16
17
keystore
17
18
outcome
Original file line number Diff line number Diff line change 12
12
#include " crypto/signature/signature.hpp"
13
13
#include " primitives/address/address.hpp"
14
14
#include " primitives/big_int.hpp"
15
+ #include " vm/actor/actor.hpp"
15
16
16
17
namespace fc ::vm::message {
17
18
@@ -24,6 +25,8 @@ namespace fc::vm::message {
24
25
VERIFICATION_FAILURE
25
26
};
26
27
28
+ using actor::MethodNumber;
29
+ using actor::MethodParams;
27
30
using crypto::signature::Signature;
28
31
using primitives::BigInt;
29
32
using primitives::address::Address;
@@ -42,8 +45,8 @@ namespace fc::vm::message {
42
45
BigInt gasPrice;
43
46
BigInt gasLimit;
44
47
45
- uint64_t method;
46
- std::vector< uint8_t > params;
48
+ MethodNumber method;
49
+ MethodParams params;
47
50
48
51
/* *
49
52
* @brief Message equality operator
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ using fc::vm::message::cid;
45
45
using fc::vm::message::MessageError;
46
46
using fc::vm::message::MessageSigner;
47
47
using fc::vm::message::MessageSignerImpl;
48
+ using fc::vm::message::MethodParams;
48
49
using fc::vm::message::SignedMessage;
49
50
using fc::vm::message::UnsignedMessage;
50
51
@@ -59,14 +60,14 @@ UnsignedMessage makeMessage(Address const &from,
59
60
Address const &to,
60
61
uint64_t nonce) {
61
62
return UnsignedMessage{
62
- to, // to Address
63
- from, // from Address
64
- nonce, // nonce
65
- BigInt (1 ), // transfer value
66
- BigInt (0 ), // gasPrice
67
- BigInt (1 ), // gasLimit
68
- 0 , // method num
69
- " " _unhex // method params
63
+ to, // to Address
64
+ from, // from Address
65
+ nonce, // nonce
66
+ BigInt (1 ), // transfer value
67
+ BigInt (0 ), // gasPrice
68
+ BigInt (1 ), // gasLimit
69
+ 0 , // method num
70
+ MethodParams{ " " _unhex} // method params
70
71
};
71
72
}
72
73
You can’t perform that action at this time.
0 commit comments