Skip to content

Commit 36601df

Browse files
Add a test that en EVM failing function results in an error (#3832)
## Motivation It was a little unclear whether an EVM smart contract failing would result in an error. ## Proposal It turns out that yes the error are being passed down and a test is added for this feature. ## Test Plan SI is the point. ## Release Plan Normal realease. ## Links None.
1 parent 49c09a9 commit 36601df

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

linera-service/tests/fixtures/evm_example_counter.sol

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,9 @@ contract ExampleCounter {
1717
function get_value() external view returns (uint64) {
1818
return value;
1919
}
20+
21+
function failing_function() external view returns (uint64) {
22+
require(false);
23+
return 0;
24+
}
2025
}

linera-service/tests/linera_net_tests.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ async fn test_evm_end_to_end_counter(config: impl LineraNetConfig) -> Result<()>
352352
}
353353
function increment(uint64 input);
354354
function get_value();
355+
function failing_function();
355356
}
356357

357358
let original_counter_value = 35;
@@ -386,6 +387,12 @@ async fn test_evm_end_to_end_counter(config: impl LineraNetConfig) -> Result<()>
386387
.make_application(&chain, &application_id)
387388
.await?;
388389

390+
let failing_function = failing_functionCall {};
391+
let failing_function = failing_function.abi_encode();
392+
let failing_function = EvmQuery::Query(failing_function);
393+
let result = application.run_json_query(failing_function).await;
394+
assert!(result.is_err());
395+
389396
let query = get_valueCall {};
390397
let query = query.abi_encode();
391398
let query = EvmQuery::Query(query);

0 commit comments

Comments
 (0)