Skip to content

Commit 0c78838

Browse files
committed
Corrections after rebase.
1 parent 87b7f6f commit 0c78838

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed

linera-base/src/vm.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,20 @@ pub struct EvmOperation {
8080
}
8181

8282
impl EvmOperation {
83+
/// An EVM transaction with a specified amount and function input.
8384
pub fn new(amount: Amount, argument: Vec<u8>) -> Self {
8485
Self {
8586
value: amount.into(),
8687
argument,
8788
}
8889
}
8990

91+
/// Convert the input to a `Vec<u8>` if possible.
9092
pub fn to_bytes(&self) -> Result<Vec<u8>, bcs::Error> {
9193
bcs::to_bytes(&self)
9294
}
9395

96+
/// Creates an `EvmQuery` from the input.
9497
pub fn to_evm_query(&self) -> Result<EvmQuery, bcs::Error> {
9598
Ok(EvmQuery::Operation(self.to_bytes()?))
9699
}

linera-execution/src/evm/revm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1532,7 +1532,7 @@ where
15321532
runtime.schedule_operation(operation)?;
15331533
return Ok(Vec::new());
15341534
}
1535-
EvmQuery::Mutations(operations) => {
1535+
EvmQuery::Operations(operations) => {
15361536
let mut runtime = self.db.runtime.lock().unwrap();
15371537
for operation in operations {
15381538
runtime.schedule_operation(operation)?;

linera-service/tests/linera_net_tests.rs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,16 @@ fn get_zero_operation(operation: impl alloy_sol_types::SolCall) -> Result<EvmQue
444444
operation.to_evm_query()
445445
}
446446

447+
#[cfg(with_revm)]
448+
fn get_zero_operations(
449+
operation: impl alloy_sol_types::SolCall,
450+
num_operations: usize,
451+
) -> Result<EvmQuery, bcs::Error> {
452+
let operation = EvmOperation::new(Amount::ZERO, operation.abi_encode());
453+
let operations = vec![operation.to_bytes()?; num_operations];
454+
Ok(EvmQuery::Operations(operations))
455+
}
456+
447457
#[cfg(with_revm)]
448458
#[cfg_attr(feature = "storage-service", test_case(LocalNetConfig::new_test(Database::Service, Network::Grpc) ; "storage_test_service_grpc"))]
449459
#[cfg_attr(feature = "scylladb", test_case(LocalNetConfig::new_test(Database::ScyllaDb, Network::Grpc) ; "scylladb_grpc"))]
@@ -773,15 +783,9 @@ async fn test_evm_end_to_end_balance_and_transfer(config: impl LineraNetConfig)
773783
assert_eq!(balance_a_2, Amount::from_tokens(50));
774784
assert_eq!(balance_a_app, Amount::from_tokens(4));
775785

776-
let app_a = node_service_a
777-
.make_application(&chain_a, &application_id)
778-
.await?;
779-
let app_b = node_service_b
780-
.make_application(&chain_b, &application_id)
781-
.await?;
782-
let app_c = node_service_c
783-
.make_application(&chain_c, &application_id)
784-
.await?;
786+
let app_a = node_service_a.make_application(&chain_a, &application_id)?;
787+
let app_b = node_service_b.make_application(&chain_b, &application_id)?;
788+
let app_c = node_service_c.make_application(&chain_c, &application_id)?;
785789

786790
// Checking the balances on input
787791

@@ -868,8 +872,7 @@ async fn test_evm_end_to_end_balance_and_transfer(config: impl LineraNetConfig)
868872
#[cfg_attr(feature = "storage-service", test_case(LocalNetConfig::new_test(Database::Service, Network::Grpc) ; "storage_test_service_grpc"))]
869873
#[cfg_attr(feature = "scylladb", test_case(LocalNetConfig::new_test(Database::ScyllaDb, Network::Grpc) ; "scylladb_grpc"))]
870874
#[cfg_attr(feature = "dynamodb", test_case(LocalNetConfig::new_test(Database::DynamoDb, Network::Grpc) ; "aws_grpc"))]
871-
#[cfg_attr(feature = "kubernetes", test_case(SharedLocalKubernetesNetTestingConfig::new(Network::Grpc, BuildArg::Build) ; "kubernetes_grpc"))]
872-
#[cfg_attr(feature = "remote-net", test_case(RemoteNetTestingConfig::new(None) ; "remote_net_grpc"))]
875+
#[cfg_attr(feature = "remote-net", test_case(RemoteNetTestingConfig::new(CloseChains) ; "remote_net_grpc"))]
873876
#[test_log::test(tokio::test)]
874877
async fn test_evm_event(config: impl LineraNetConfig) -> Result<()> {
875878
use alloy_primitives::{Bytes, Log, U256};
@@ -1939,9 +1942,7 @@ async fn test_evm_erc20_shared(config: impl LineraNetConfig) -> Result<()> {
19391942
to: address2,
19401943
value: transfer1,
19411944
};
1942-
let operation = get_zero_operation(operation)?;
1943-
let operations = vec![operation; num_operations];
1944-
let query = EvmQuery::Operations(operations);
1945+
let query = get_zero_operations(operation, num_operations)?;
19451946
let time_start = Instant::now();
19461947
application1.run_json_query(query).await?;
19471948
let average_time = (time_start.elapsed().as_millis() as f64) / (num_operations as f64);

0 commit comments

Comments
 (0)