Skip to content

Commit a81fa68

Browse files
committed
Corrections after rebase.
1 parent 944179c commit a81fa68

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
@@ -443,6 +443,16 @@ fn get_zero_operation(operation: impl alloy_sol_types::SolCall) -> Result<EvmQue
443443
operation.to_evm_query()
444444
}
445445

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

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

785789
// Checking the balances on input
786790

@@ -867,8 +871,7 @@ async fn test_evm_end_to_end_balance_and_transfer(config: impl LineraNetConfig)
867871
#[cfg_attr(feature = "storage-service", test_case(LocalNetConfig::new_test(Database::Service, Network::Grpc) ; "storage_test_service_grpc"))]
868872
#[cfg_attr(feature = "scylladb", test_case(LocalNetConfig::new_test(Database::ScyllaDb, Network::Grpc) ; "scylladb_grpc"))]
869873
#[cfg_attr(feature = "dynamodb", test_case(LocalNetConfig::new_test(Database::DynamoDb, Network::Grpc) ; "aws_grpc"))]
870-
#[cfg_attr(feature = "kubernetes", test_case(SharedLocalKubernetesNetTestingConfig::new(Network::Grpc, BuildArg::Build) ; "kubernetes_grpc"))]
871-
#[cfg_attr(feature = "remote-net", test_case(RemoteNetTestingConfig::new(None) ; "remote_net_grpc"))]
874+
#[cfg_attr(feature = "remote-net", test_case(RemoteNetTestingConfig::new(CloseChains) ; "remote_net_grpc"))]
872875
#[test_log::test(tokio::test)]
873876
async fn test_evm_event(config: impl LineraNetConfig) -> Result<()> {
874877
use alloy_primitives::{Bytes, Log, U256};
@@ -1925,9 +1928,7 @@ async fn test_evm_erc20_shared(config: impl LineraNetConfig) -> Result<()> {
19251928
to: address2,
19261929
value: transfer1,
19271930
};
1928-
let operation = get_zero_operation(operation)?;
1929-
let operations = vec![operation; num_operations];
1930-
let query = EvmQuery::Operations(operations);
1931+
let query = get_zero_operations(operation, num_operations)?;
19311932
let time_start = Instant::now();
19321933
application1.run_json_query(query).await?;
19331934
let average_time = (time_start.elapsed().as_millis() as f64) / (num_operations as f64);

0 commit comments

Comments
 (0)