@@ -47,18 +47,18 @@ pub fn new_always_success_chain(txs_size: usize, chains_num: usize) -> Chains {
4747 . input ( CellInput :: new ( OutPoint :: null ( ) , 0 ) )
4848 . output (
4949 CellOutput :: new_builder ( )
50- . capacity ( capacity_bytes ! ( 50_000 ) . pack ( ) )
50+ . capacity ( capacity_bytes ! ( 50_000 ) )
5151 . lock ( always_success_script. clone ( ) )
5252 . build ( ) ,
5353 )
54- . output_data ( data. pack ( ) )
54+ . output_data ( data)
5555 . build ( )
5656 } )
5757 . collect ( ) ;
5858
5959 let genesis_block = BlockBuilder :: default ( )
6060 . dao ( dao)
61- . compact_target ( difficulty_to_compact ( U256 :: from ( 1000u64 ) ) . pack ( ) )
61+ . compact_target ( difficulty_to_compact ( U256 :: from ( 1000u64 ) ) )
6262 . transaction ( tx)
6363 . transactions ( transactions)
6464 . build ( ) ;
@@ -90,7 +90,7 @@ pub fn create_always_success_tx() -> TransactionView {
9090 . witness ( script. clone ( ) . into_witness ( ) )
9191 . input ( CellInput :: new ( OutPoint :: null ( ) , 0 ) )
9292 . output ( always_success_cell. clone ( ) )
93- . output_data ( always_success_cell_data. pack ( ) )
93+ . output_data ( always_success_cell_data)
9494 . build ( )
9595}
9696
@@ -108,11 +108,11 @@ pub fn create_always_success_cellbase(shared: &Shared, parent: &HeaderView) -> T
108108 builder
109109 . output (
110110 CellOutput :: new_builder ( )
111- . capacity ( capacity. pack ( ) )
111+ . capacity ( capacity)
112112 . lock ( always_success_script. clone ( ) )
113113 . build ( ) ,
114114 )
115- . output_data ( Bytes :: new ( ) . pack ( ) )
115+ . output_data ( Bytes :: new ( ) )
116116 . build ( )
117117 }
118118}
@@ -183,11 +183,11 @@ pub fn gen_always_success_block(
183183 . transactions ( transactions)
184184 . proposals ( proposals)
185185 . parent_hash ( p_block. hash ( ) )
186- . number ( number. pack ( ) )
187- . timestamp ( timestamp. pack ( ) )
188- . compact_target ( epoch. compact_target ( ) . pack ( ) )
189- . epoch ( epoch. number_with_fraction ( number) . pack ( ) )
190- . nonce ( random :: < u128 > ( ) . pack ( ) )
186+ . number ( number)
187+ . timestamp ( timestamp)
188+ . compact_target ( epoch. compact_target ( ) )
189+ . epoch ( epoch. number_with_fraction ( number) )
190+ . nonce ( random :: < u128 > ( ) )
191191 . dao ( dao)
192192 . build ( ) ;
193193
@@ -205,7 +205,7 @@ static SECP_DATA_CELL: std::sync::LazyLock<(CellOutput, Bytes)> = std::sync::Laz
205205 let data: Bytes = raw_data. to_vec ( ) . into ( ) ;
206206
207207 let cell = CellOutput :: new_builder ( )
208- . capacity ( Capacity :: bytes ( data. len ( ) ) . unwrap ( ) . pack ( ) )
208+ . capacity ( Capacity :: bytes ( data. len ( ) ) . unwrap ( ) )
209209 . build ( ) ;
210210 ( cell, data)
211211} ) ;
@@ -217,13 +217,13 @@ static SECP_CELL: std::sync::LazyLock<(CellOutput, Bytes, Script)> =
217217 let data: Bytes = raw_data. to_vec ( ) . into ( ) ;
218218
219219 let cell = CellOutput :: new_builder ( )
220- . capacity ( Capacity :: bytes ( data. len ( ) ) . unwrap ( ) . pack ( ) )
220+ . capacity ( Capacity :: bytes ( data. len ( ) ) . unwrap ( ) )
221221 . build ( ) ;
222222
223223 let script = Script :: new_builder ( )
224224 . code_hash ( CellOutput :: calc_data_hash ( & data) )
225- . args ( Bytes :: from ( PUBKEY_HASH . as_bytes ( ) ) . pack ( ) )
226- . hash_type ( ScriptHashType :: Data . into ( ) )
225+ . args ( Bytes :: from ( PUBKEY_HASH . as_bytes ( ) ) )
226+ . hash_type ( ScriptHashType :: Data )
227227 . build ( ) ;
228228
229229 ( cell, data, script)
@@ -241,7 +241,7 @@ pub fn create_secp_tx() -> TransactionView {
241241 let ( secp_data_cell, secp_data_cell_data) = secp_data_cell ( ) ;
242242 let ( secp_cell, secp_cell_data, script) = secp_cell ( ) ;
243243 let outputs = vec ! [ secp_data_cell. clone( ) , secp_cell. clone( ) ] ;
244- let outputs_data = vec ! [ secp_data_cell_data. pack ( ) , secp_cell_data. pack ( ) ] ;
244+ let outputs_data = vec ! [ secp_data_cell_data. into ( ) , secp_cell_data. into ( ) ] ;
245245 TransactionBuilder :: default ( )
246246 . witness ( script. clone ( ) . into_witness ( ) )
247247 . input ( CellInput :: new ( OutPoint :: null ( ) , 0 ) )
@@ -260,21 +260,21 @@ pub fn new_secp_chain(txs_size: usize, chains_num: usize) -> Chains {
260260 . map ( |i| {
261261 let data = Bytes :: from ( i. to_le_bytes ( ) . to_vec ( ) ) ;
262262 let output = CellOutput :: new_builder ( )
263- . capacity ( capacity_bytes ! ( 50_000 ) . pack ( ) )
263+ . capacity ( capacity_bytes ! ( 50_000 ) )
264264 . lock ( secp_script. clone ( ) )
265265 . build ( ) ;
266266 TransactionBuilder :: default ( )
267267 . input ( CellInput :: new ( OutPoint :: null ( ) , 0 ) )
268268 . output ( output. clone ( ) )
269269 . output ( output)
270- . output_data ( data. pack ( ) )
271- . output_data ( data. pack ( ) )
270+ . output_data ( & data)
271+ . output_data ( data)
272272 . build ( )
273273 } )
274274 . collect ( ) ;
275275
276276 let genesis_block = BlockBuilder :: default ( )
277- . compact_target ( difficulty_to_compact ( U256 :: from ( 1000u64 ) ) . pack ( ) )
277+ . compact_target ( difficulty_to_compact ( U256 :: from ( 1000u64 ) ) )
278278 . dao ( dao)
279279 . transaction ( tx)
280280 . transactions ( transactions)
@@ -315,11 +315,11 @@ pub fn create_secp_cellbase(shared: &Shared, parent: &HeaderView) -> Transaction
315315 builder
316316 . output (
317317 CellOutput :: new_builder ( )
318- . capacity ( capacity. pack ( ) )
318+ . capacity ( capacity)
319319 . lock ( secp_script. clone ( ) )
320320 . build ( ) ,
321321 )
322- . output_data ( Bytes :: new ( ) . pack ( ) )
322+ . output_data ( Bytes :: new ( ) )
323323 . build ( )
324324 }
325325}
@@ -392,11 +392,11 @@ pub fn gen_secp_block(
392392 . transactions ( transactions)
393393 . proposals ( proposals)
394394 . parent_hash ( p_block. hash ( ) )
395- . number ( number. pack ( ) )
396- . timestamp ( timestamp. pack ( ) )
397- . compact_target ( epoch. compact_target ( ) . pack ( ) )
398- . epoch ( epoch. number_with_fraction ( number) . pack ( ) )
399- . nonce ( random :: < u128 > ( ) . pack ( ) )
395+ . number ( number)
396+ . timestamp ( timestamp)
397+ . compact_target ( epoch. compact_target ( ) )
398+ . epoch ( epoch. number_with_fraction ( number) )
399+ . nonce ( random :: < u128 > ( ) )
400400 . dao ( dao)
401401 . build ( ) ;
402402
@@ -409,11 +409,11 @@ fn create_transaction(parent_hash: &Byte32, lock: Script, dep: OutPoint) -> Tran
409409 TransactionBuilder :: default ( )
410410 . output (
411411 CellOutput :: new_builder ( )
412- . capacity ( capacity_bytes ! ( 50_000 ) . pack ( ) )
412+ . capacity ( capacity_bytes ! ( 50_000 ) )
413413 . lock ( lock)
414414 . build ( ) ,
415415 )
416- . output_data ( data. pack ( ) )
416+ . output_data ( data)
417417 . input ( CellInput :: new ( OutPoint :: new ( parent_hash. to_owned ( ) , 0 ) , 0 ) )
418418 . cell_dep ( CellDep :: new_builder ( ) . out_point ( dep) . build ( ) )
419419 . build ( )
@@ -428,7 +428,7 @@ pub fn create_2out_transaction(
428428
429429 let cell_inputs = inputs. into_iter ( ) . map ( |pts| CellInput :: new ( pts, 0 ) ) ;
430430 let cell_output = CellOutput :: new_builder ( )
431- . capacity ( capacity_bytes ! ( 50_000 ) . pack ( ) )
431+ . capacity ( capacity_bytes ! ( 50_000 ) )
432432 . lock ( lock)
433433 . build ( ) ;
434434
@@ -437,15 +437,15 @@ pub fn create_2out_transaction(
437437 let raw = TransactionBuilder :: default ( )
438438 . output ( cell_output. clone ( ) )
439439 . output ( cell_output)
440- . output_data ( data. pack ( ) )
441- . output_data ( data. pack ( ) )
440+ . output_data ( & data)
441+ . output_data ( data)
442442 . inputs ( cell_inputs)
443443 . cell_deps ( cell_deps)
444444 . build ( ) ;
445445
446446 let privkey: Privkey = PRIVKEY . into ( ) ;
447447 let witness: WitnessArgs = WitnessArgs :: new_builder ( )
448- . lock ( Some ( Bytes :: from ( vec ! [ 0u8 ; 65 ] ) ) . pack ( ) )
448+ . lock ( Some ( Bytes :: from ( vec ! [ 0u8 ; 65 ] ) ) )
449449 . build ( ) ;
450450 let witness_len: u64 = witness. as_bytes ( ) . len ( ) as u64 ;
451451 let non_sig_witnesses = vec ! [ Bytes :: new( ) ; inputs_count - 1 ] ;
@@ -467,10 +467,10 @@ pub fn create_2out_transaction(
467467 . expect ( "sign tx" )
468468 . serialize ( )
469469 . into ( ) ;
470- let witness = witness. as_builder ( ) . lock ( Some ( sig) . pack ( ) ) . build ( ) ;
470+ let witness = witness. as_builder ( ) . lock ( Some ( sig) ) . build ( ) ;
471471
472- let mut witnesses = vec ! [ witness. as_bytes( ) . pack ( ) ] ;
473- witnesses. extend ( non_sig_witnesses. into_iter ( ) . map ( |w| w. pack ( ) ) ) ;
472+ let mut witnesses = vec ! [ witness. as_bytes( ) . into ( ) ] ;
473+ witnesses. extend ( non_sig_witnesses. into_iter ( ) . map ( |w| w. into ( ) ) ) ;
474474
475475 raw. as_advanced_builder ( ) . set_witnesses ( witnesses) . build ( )
476476}
0 commit comments