File tree Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -220,7 +220,11 @@ impl Rusk {
220
220
}
221
221
222
222
let mut driver_store = self . driver_store . write ( ) ;
223
- driver_store. store_bytecode ( & contract_id, data) ?;
223
+ driver_store. store_bytecode_and_signature (
224
+ & contract_id,
225
+ data,
226
+ signature. to_bytes ( ) ,
227
+ ) ?;
224
228
let mut instance_cache = self . instance_cache . write ( ) ;
225
229
instance_cache. remove ( & contract_id) ;
226
230
Ok ( ResponseData :: new ( UPLOAD_DRIVER_RESPONSE . to_string ( ) ) )
Original file line number Diff line number Diff line change 4
4
//
5
5
// Copyright (c) DUSK NETWORK. All rights reserved.
6
6
7
+ use dusk_bytes:: Serializable ;
7
8
use std:: path:: { Path , PathBuf } ;
8
9
use std:: { fs, io} ;
9
10
10
11
use dusk_core:: abi:: ContractId ;
12
+ use dusk_core:: signatures:: bls:: Signature ;
13
+
14
+ const SIGNATURE_FILE_EXTENSION : & str = "sign" ;
11
15
12
16
pub struct DriverStore {
13
17
store_path : Option < PathBuf > ,
@@ -27,13 +31,27 @@ impl DriverStore {
27
31
self . contract_path ( contract_id) . map ( fs:: read) . transpose ( )
28
32
}
29
33
30
- pub fn store_bytecode (
34
+ pub fn get_signature (
35
+ & self ,
36
+ contract_id : & ContractId ,
37
+ ) -> io:: Result < Option < Vec < u8 > > > {
38
+ self . contract_path ( contract_id)
39
+ . map ( |path| fs:: read ( path. with_extension ( SIGNATURE_FILE_EXTENSION ) ) )
40
+ . transpose ( )
41
+ }
42
+
43
+ pub fn store_bytecode_and_signature (
31
44
& mut self ,
32
45
contract_id : & ContractId ,
33
46
bytecode : & [ u8 ] ,
47
+ signature_bytes : [ u8 ; Signature :: SIZE ] ,
34
48
) -> io:: Result < ( ) > {
35
49
if let Some ( path) = self . contract_path ( contract_id) {
36
- fs:: write ( path, bytecode) ?;
50
+ fs:: write ( & path, bytecode) ?;
51
+ fs:: write (
52
+ path. with_extension ( SIGNATURE_FILE_EXTENSION ) ,
53
+ signature_bytes,
54
+ ) ?;
37
55
}
38
56
Ok ( ( ) )
39
57
}
You can’t perform that action at this time.
0 commit comments