@@ -5030,20 +5030,20 @@ fn link_map_delete_fn(linker: &mut Linker<ClarityWasmContext>) -> Result<(), Err
5030
5030
5031
5031
fn check_height_valid (
5032
5032
caller : & mut Caller < ' _ , ClarityWasmContext > ,
5033
- memory : & Memory ,
5033
+ memory : Memory ,
5034
5034
height_lo : i64 ,
5035
5035
height_hi : i64 ,
5036
5036
return_offset : i32 ,
5037
5037
) -> Result < u32 , Error > {
5038
- let height = ( height_lo as u128 ) | ( ( height_hi as u128 ) << 64 ) ;
5038
+ let height = ( height_hi as u128 ) << 64 | ( ( height_lo as u64 ) as u128 ) ;
5039
5039
5040
5040
let height_value = match u32:: try_from ( height) {
5041
5041
Ok ( result) => result,
5042
5042
_ => {
5043
5043
// Write a 0 to the return buffer for `none`
5044
5044
write_to_wasm (
5045
5045
caller,
5046
- * memory,
5046
+ memory,
5047
5047
& TypeSignature :: BoolType ,
5048
5048
return_offset,
5049
5049
return_offset + get_type_size ( & TypeSignature :: BoolType ) ,
@@ -5063,7 +5063,7 @@ fn check_height_valid(
5063
5063
// Write a 0 to the return buffer for `none`
5064
5064
write_to_wasm (
5065
5065
caller,
5066
- * memory,
5066
+ memory,
5067
5067
& TypeSignature :: BoolType ,
5068
5068
return_offset,
5069
5069
return_offset + get_type_size ( & TypeSignature :: BoolType ) ,
@@ -5094,20 +5094,21 @@ fn link_get_block_info_time_property_fn(
5094
5094
. ok_or ( Error :: Wasm ( WasmError :: MemoryNotFound ) ) ?;
5095
5095
5096
5096
let height_value =
5097
- check_height_valid ( & mut caller, & memory, height_lo, height_hi, return_offset) ?;
5097
+ check_height_valid ( & mut caller, memory, height_lo, height_hi, return_offset) ?;
5098
5098
5099
5099
let block_time = caller
5100
5100
. data_mut ( )
5101
5101
. global_context
5102
5102
. database
5103
5103
. get_block_time ( height_value) ?;
5104
+ let ( result, ty) = ( Value :: UInt ( block_time as u128 ) , TypeSignature :: UIntType ) ;
5104
5105
write_to_wasm (
5105
5106
& mut caller,
5106
5107
memory,
5107
- & TypeSignature :: UIntType ,
5108
+ & ty ,
5108
5109
return_offset,
5109
- return_offset + get_type_size ( & TypeSignature :: UIntType ) ,
5110
- & Value :: UInt ( block_time as u128 ) ,
5110
+ return_offset + get_type_size ( & ty ) ,
5111
+ & Value :: some ( result ) ? ,
5111
5112
true ,
5112
5113
) ?;
5113
5114
@@ -5143,7 +5144,7 @@ fn link_get_block_info_vrf_seed_property_fn(
5143
5144
. ok_or ( Error :: Wasm ( WasmError :: MemoryNotFound ) ) ?;
5144
5145
5145
5146
let height_value =
5146
- check_height_valid ( & mut caller, & memory, height_lo, height_hi, return_offset) ?;
5147
+ check_height_valid ( & mut caller, memory, height_lo, height_hi, return_offset) ?;
5147
5148
5148
5149
let vrf_seed = caller
5149
5150
. data_mut ( )
@@ -5200,7 +5201,7 @@ fn link_get_block_info_header_hash_property_fn(
5200
5201
. ok_or ( Error :: Wasm ( WasmError :: MemoryNotFound ) ) ?;
5201
5202
5202
5203
let height_value =
5203
- check_height_valid ( & mut caller, & memory, height_lo, height_hi, return_offset) ?;
5204
+ check_height_valid ( & mut caller, memory, height_lo, height_hi, return_offset) ?;
5204
5205
5205
5206
let header_hash = caller
5206
5207
. data_mut ( )
@@ -5257,7 +5258,7 @@ fn link_get_block_info_burnchain_header_hash_property_fn(
5257
5258
. ok_or ( Error :: Wasm ( WasmError :: MemoryNotFound ) ) ?;
5258
5259
5259
5260
let height_value =
5260
- check_height_valid ( & mut caller, & memory, height_lo, height_hi, return_offset) ?;
5261
+ check_height_valid ( & mut caller, memory, height_lo, height_hi, return_offset) ?;
5261
5262
5262
5263
let burnchain_header_hash = caller
5263
5264
. data_mut ( )
@@ -5314,7 +5315,7 @@ fn link_get_block_info_identity_header_hash_property_fn(
5314
5315
. ok_or ( Error :: Wasm ( WasmError :: MemoryNotFound ) ) ?;
5315
5316
5316
5317
let height_value =
5317
- check_height_valid ( & mut caller, & memory, height_lo, height_hi, return_offset) ?;
5318
+ check_height_valid ( & mut caller, memory, height_lo, height_hi, return_offset) ?;
5318
5319
5319
5320
let id_header_hash = caller
5320
5321
. data_mut ( )
@@ -5371,7 +5372,7 @@ fn link_get_block_info_miner_address_property_fn(
5371
5372
. ok_or ( Error :: Wasm ( WasmError :: MemoryNotFound ) ) ?;
5372
5373
5373
5374
let height_value =
5374
- check_height_valid ( & mut caller, & memory, height_lo, height_hi, return_offset) ?;
5375
+ check_height_valid ( & mut caller, memory, height_lo, height_hi, return_offset) ?;
5375
5376
5376
5377
let miner_address = caller
5377
5378
. data_mut ( )
@@ -5421,7 +5422,7 @@ fn link_get_block_info_miner_spend_winner_property_fn(
5421
5422
. ok_or ( Error :: Wasm ( WasmError :: MemoryNotFound ) ) ?;
5422
5423
5423
5424
let height_value =
5424
- check_height_valid ( & mut caller, & memory, height_lo, height_hi, return_offset) ?;
5425
+ check_height_valid ( & mut caller, memory, height_lo, height_hi, return_offset) ?;
5425
5426
5426
5427
let winner_spend = caller
5427
5428
. data_mut ( )
@@ -5471,7 +5472,7 @@ fn link_get_block_info_miner_spend_total_property_fn(
5471
5472
. ok_or ( Error :: Wasm ( WasmError :: MemoryNotFound ) ) ?;
5472
5473
5473
5474
let height_value =
5474
- check_height_valid ( & mut caller, & memory, height_lo, height_hi, return_offset) ?;
5475
+ check_height_valid ( & mut caller, memory, height_lo, height_hi, return_offset) ?;
5475
5476
5476
5477
let total_spend = caller
5477
5478
. data_mut ( )
@@ -5521,7 +5522,7 @@ fn link_get_block_info_block_reward_property_fn(
5521
5522
. ok_or ( Error :: Wasm ( WasmError :: MemoryNotFound ) ) ?;
5522
5523
5523
5524
let height_value =
5524
- check_height_valid ( & mut caller, & memory, height_lo, height_hi, return_offset) ?;
5525
+ check_height_valid ( & mut caller, memory, height_lo, height_hi, return_offset) ?;
5525
5526
5526
5527
let block_reward_opt = caller
5527
5528
. data_mut ( )
@@ -5589,7 +5590,7 @@ fn link_get_burn_block_info_header_hash_property_fn(
5589
5590
. ok_or ( Error :: Wasm ( WasmError :: MemoryNotFound ) ) ?;
5590
5591
5591
5592
let height_value =
5592
- check_height_valid ( & mut caller, & memory, height_lo, height_hi, return_offset) ?;
5593
+ check_height_valid ( & mut caller, memory, height_lo, height_hi, return_offset) ?;
5593
5594
5594
5595
let burnchain_header_hash_opt = caller
5595
5596
. data_mut ( )
@@ -5650,7 +5651,7 @@ fn link_get_burn_block_info_pox_addrs_property_fn(
5650
5651
. ok_or ( Error :: Wasm ( WasmError :: MemoryNotFound ) ) ?;
5651
5652
5652
5653
let height_value =
5653
- check_height_valid ( & mut caller, & memory, height_lo, height_hi, return_offset) ?;
5654
+ check_height_valid ( & mut caller, memory, height_lo, height_hi, return_offset) ?;
5654
5655
5655
5656
let pox_addrs_and_payout = caller
5656
5657
. data_mut ( )
0 commit comments