Skip to content

Commit

Permalink
Repair tests for change back to wasmi 0.31
Browse files Browse the repository at this point in the history
  • Loading branch information
graydon committed Sep 14, 2024
1 parent fa034f9 commit ebc64e8
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,22 @@
" 11 ret get_ledger_network_id -> Ok(Bytes(obj#11))": "cpu:2642712, mem:1627130, objs:-/6@657db8e6",
" 12 ret create_contract -> Ok(Address(obj#13))": "cpu:3300799, mem:2884581, objs:-/7@77ebce5a, store:-/2@4b95aafd, foot:2@9ddf4d04, auth:-/1@c59af36",
" 13 call vec_new_from_slice(1)": " auth:-/-",
" 14 ret vec_new_from_slice -> Ok(Vec(obj#15))": "cpu:3301762, mem:2884669, objs:-/8@630931ad",
" 14 ret vec_new_from_slice -> Ok(Vec(obj#15))": "cpu:3301762, mem:2884669, objs:-/8@883ed989",
" 15 call call(Address(obj#13), Symbol(deepstack), Vec(obj#15))": "",
" 16 push VM:cd475327:deepstack(U32(1022))": "cpu:3946311, mem:4139902, objs:-/9@c0957890, vm:1114112@415819ab/16@b860c029, stk:1@4c326cc9, auth:1@e5a014cb/-",
" 17 pop VM:cd475327:deepstack -> Ok(U32(522753))": "cpu:4288772, mem:4139948",
" 18 ret call -> Ok(U32(522753))": "cpu:4289394, mem:4139964, vm:-/-, stk:-, auth:-/-",
" 16 push VM:cd475327:deepstack(U32(1023))": "cpu:3946311, mem:4139902, objs:-/9@fc130356, vm:1114112@415819ab/16@b860c029, stk:1@7f88937c, auth:1@e5a014cb/-",
" 17 pop VM:cd475327:deepstack -> Ok(U32(523776))": "cpu:4289104, mem:4139948",
" 18 ret call -> Ok(U32(523776))": "cpu:4289726, mem:4139964, vm:-/-, stk:-, auth:-/-",
" 19 call vec_new_from_slice(1)": "",
" 20 ret vec_new_from_slice -> Ok(Vec(obj#19))": "cpu:4290357, mem:4140052, objs:-/10@f967c7d8",
" 20 ret vec_new_from_slice -> Ok(Vec(obj#19))": "cpu:4290689, mem:4140052, objs:-/10@2f3321d7",
" 21 call call(Address(obj#13), Symbol(deepstack), Vec(obj#19))": "",
" 22 push VM:cd475327:deepstack(U32(1023))": "cpu:4935874, mem:5395421, objs:-/11@257ac211, vm:1114112@415819ab/16@b860c029, stk:1@7f88937c, auth:1@315f96c7/-",
" 23 pop VM:cd475327:deepstack -> Ok(U32(523776))": "cpu:5278667, mem:5395467",
" 24 ret call -> Ok(U32(523776))": "cpu:5279289, mem:5395483, vm:-/-, stk:-, auth:-/-",
" 25 end": "cpu:5279289, mem:5395483, prngs:-/9b4a753, objs:-/11@257ac211, vm:-/-, evt:-, store:-/2@4b95aafd, foot:2@9ddf4d04, stk:-, auth:-/-"
" 22 push VM:cd475327:deepstack(U32(1024))": "cpu:4936206, mem:5395421, objs:-/11@21e203d3, vm:1114112@415819ab/16@b860c029, stk:1@ae79d93a, auth:1@315f96c7/-",
" 23 pop VM:cd475327:deepstack -> Err(Error(Budget, ExceededLimit))": "cpu:5278983, mem:5395467",
" 24 ret call -> Err(Error(Budget, ExceededLimit))": "cpu:5279605, mem:5395483, vm:-/-, stk:-, auth:-/-",
" 25 call vec_new_from_slice(1)": "",
" 26 ret vec_new_from_slice -> Ok(Vec(obj#23))": "cpu:5280568, mem:5395571, objs:-/12@e1647987",
" 27 call call(Address(obj#13), Symbol(deepstack), Vec(obj#23))": "",
" 28 push VM:cd475327:deepstack(U32(10240))": "cpu:5926085, mem:6650940, objs:-/13@26f17205, vm:1114112@415819ab/16@b860c029, stk:1@6cbdf7e, auth:1@8081480/-",
" 29 pop VM:cd475327:deepstack -> Err(Error(Budget, ExceededLimit))": "cpu:6268862, mem:6650986",
" 30 ret call -> Err(Error(Budget, ExceededLimit))": "cpu:6269484, mem:6651002, vm:-/-, stk:-, auth:-/-",
" 31 end": "cpu:6269484, mem:6651002, prngs:-/9b4a753, objs:-/13@26f17205, vm:-/-, evt:-, store:-/2@4b95aafd, foot:2@9ddf4d04, stk:-, auth:-/-"
}
52 changes: 26 additions & 26 deletions soroban-env-host/src/test/budget_metering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ fn test_vm_fuel_metering() -> Result<(), HostError> {
})?;
assert_eq!(
(cpu_count, cpu_consumed, wasm_mem_alloc, mem_consumed),
(1999, 11994, 65536, 73838)
(4005, 24030, 65536, 73838)
);

// giving it the exact required amount will succeed
Expand Down Expand Up @@ -410,8 +410,8 @@ fn total_amount_charged_from_random_inputs() -> Result<(), HostError> {
let actual = format!("{:?}", host.as_budget());
let expected = expect![[r#"
===============================================================================================================================================================================
Cpu limit: 100000000; used: 15313119
Mem limit: 41943040; used: 298417
Cpu limit: 100000000; used: 15754241
Mem limit: 41943040; used: 302115
===============================================================================================================================================================================
CostType iterations input cpu_insns mem_bytes const_term_cpu lin_term_cpu const_term_mem lin_term_mem
WasmInsnExec 246 None 984 0 4 0 0 0
Expand All @@ -425,9 +425,9 @@ fn total_amount_charged_from_random_inputs() -> Result<(), HostError> {
ComputeSha256Hash 1 Some(193) 14310 0 3738 7012 0 0
ComputeEd25519PubKey 226 None 9097178 0 40253 0 0 0
VerifyEd25519Sig 1 Some(227) 384738 0 377524 4068 0 0
VmInstantiation 1 Some(147) 97310 135880 31271 57504 130065 5064
VmCachedInstantiation 1 Some(147) 41608 71169 40828 680 69472 1478
InvokeVmFunction 47 None 101003 705 2149 0 15 0
VmInstantiation 1 Some(147) 503770 135880 451626 45405 130065 5064
VmCachedInstantiation 1 Some(147) 41870 70869 41142 634 69472 1217
InvokeVmFunction 47 None 91556 658 1948 0 14 0
ComputeKeccak256Hash 1 Some(1) 3812 0 3766 5969 0 0
DecodeEcdsaCurve256Sig 1 None 710 0 710 0 0 0
RecoverEcdsaSecp256k1Key 1 None 2315295 181 2315295 0 181 0
Expand All @@ -437,33 +437,33 @@ fn total_amount_charged_from_random_inputs() -> Result<(), HostError> {
Int256Pow 1 None 4286 99 4286 0 99 0
Int256Shift 1 None 913 99 913 0 99 0
ChaCha20DrawBytes 1 Some(1) 1061 0 1058 501 0 0
ParseWasmInstructions 1 Some(1) 37421 13981 37421 32 13980 215
ParseWasmFunctions 1 Some(1) 657 180 0 84156 0 23056
ParseWasmGlobals 1 Some(1) 1276 93 0 163415 0 11924
ParseWasmTableEntries 1 Some(1) 231 47 0 29644 0 6121
ParseWasmTypes 1 Some(1) 6977 387 0 893113 0 49554
ParseWasmDataSegments 1 Some(1) 1444 43 0 184921 0 5525
ParseWasmElemSegments 1 Some(1) 2440 367 0 312369 0 47034
ParseWasmImports 1 Some(1) 4134 795 0 529255 0 101762
ParseWasmExports 1 Some(1) 2825 277 0 361665 0 35491
ParseWasmDataSegmentBytes 1 Some(1) 0 1 0 14 0 129
InstantiateWasmInstructions 1 None 43208 70792 43208 0 70792 0
InstantiateWasmFunctions 1 Some(1) 62 138 0 8050 0 17749
InstantiateWasmGlobals 1 Some(1) 83 53 0 10647 0 6833
InstantiateWasmTableEntries 1 Some(1) 15 8 0 1933 0 1025
ParseWasmInstructions 1 Some(1) 73275 17614 73077 25410 17564 6457
ParseWasmFunctions 1 Some(1) 4224 370 0 540752 0 47464
ParseWasmGlobals 1 Some(1) 1377 104 0 176363 0 13420
ParseWasmTableEntries 1 Some(1) 234 49 0 29989 0 6285
ParseWasmTypes 1 Some(1) 8292 505 0 1061449 0 64670
ParseWasmDataSegments 1 Some(1) 1854 227 0 237336 0 29074
ParseWasmElemSegments 1 Some(1) 2566 375 0 328476 0 48095
ParseWasmImports 1 Some(1) 5483 806 0 701845 0 103229
ParseWasmExports 1 Some(1) 3354 284 0 429383 0 36394
ParseWasmDataSegmentBytes 1 Some(1) 0 2 0 28 0 257
InstantiateWasmInstructions 1 None 43030 70704 43030 0 70704 0
InstantiateWasmFunctions 1 Some(1) 59 114 0 7556 0 14613
InstantiateWasmGlobals 1 Some(1) 83 53 0 10711 0 6833
InstantiateWasmTableEntries 1 Some(1) 25 8 0 3300 0 1025
InstantiateWasmTypes 1 None 0 0 0 0 0 0
InstantiateWasmDataSegments 1 Some(1) 134 1012 0 17164 0 129632
InstantiateWasmElemSegments 1 Some(1) 267 106 0 34261 0 13665
InstantiateWasmImports 1 Some(1) 5829 770 0 746142 0 98578
InstantiateWasmExports 1 Some(1) 2313 71 0 296177 0 9176
InstantiateWasmDataSegments 1 Some(1) 179 1012 0 23038 0 129632
InstantiateWasmElemSegments 1 Some(1) 331 106 0 42488 0 13665
InstantiateWasmImports 1 Some(1) 6476 762 0 828974 0 97637
InstantiateWasmExports 1 Some(1) 2321 71 0 297100 0 9176
InstantiateWasmDataSegmentBytes 1 Some(1) 0 0 0 14 0 126
Sec1DecodePointUncompressed 1 None 1882 0 1882 0 0 0
VerifyEcdsaSecp256r1Sig 1 None 3000906 0 3000906 0 0 0
===============================================================================================================================================================================
Internal details (diagnostics info, does not affect fees)
Total # times meter was called: 45
Shadow cpu limit: 100000000; used: 15313119
Shadow mem limit: 41943040; used: 298417
Shadow cpu limit: 100000000; used: 15754241
Shadow mem limit: 41943040; used: 302115
===============================================================================================================================================================================
"#]];
Expand Down
12 changes: 6 additions & 6 deletions soroban-env-host/src/test/e2e_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ fn test_wasm_upload_success_in_recording_mode() {
}]
);
assert!(res.auth.is_empty());
let (expected_insns, expected_write_bytes) = (1036726, 684);
let (expected_insns, expected_write_bytes) = (1767136, 684);
assert_eq!(
res.resources,
SorobanResources {
Expand Down Expand Up @@ -687,7 +687,7 @@ fn test_wasm_upload_failure_in_recording_mode() {
));
assert!(res.ledger_changes.is_empty());
assert!(res.auth.is_empty());
let expected_instructions = 767816;
let expected_instructions = 1093647;
assert_eq!(
res.resources,
SorobanResources {
Expand Down Expand Up @@ -1145,7 +1145,7 @@ fn test_create_contract_success_in_recording_mode() {
read_only: vec![cd.wasm_key].try_into().unwrap(),
read_write: vec![cd.contract_key].try_into().unwrap()
},
instructions: 751027,
instructions: 831711,
read_bytes: 684,
write_bytes: 104,
}
Expand Down Expand Up @@ -1206,7 +1206,7 @@ fn test_create_contract_success_in_recording_mode_with_enforced_auth() {
read_only: vec![cd.wasm_key].try_into().unwrap(),
read_write: vec![cd.contract_key].try_into().unwrap()
},
instructions: 752472,
instructions: 833156,
read_bytes: 684,
write_bytes: 104,
}
Expand Down Expand Up @@ -1636,7 +1636,7 @@ fn test_invoke_contract_with_storage_ops_success_in_recording_mode() {
.unwrap(),
read_write: vec![data_key.clone()].try_into().unwrap(),
},
instructions: 1131993,
instructions: 1431216,
read_bytes: 3132,
write_bytes: 80,
}
Expand Down Expand Up @@ -1702,7 +1702,7 @@ fn test_invoke_contract_with_storage_ops_success_in_recording_mode() {
.unwrap(),
read_write: Default::default(),
},
instructions: 1245383,
instructions: 1543254,
read_bytes: 3212,
write_bytes: 0,
}
Expand Down
Loading

0 comments on commit ebc64e8

Please sign in to comment.