Skip to content

Commit c221510

Browse files
Simplify the prepare_for_call function. (#4189)
## Motivation The function `prepare_for_call` is returning an `OperationContext` that is never used. ## Proposal Remove it. ## Test Plan CI. ## Release Plan - Nothing to do / These changes follow the usual release cycle. ## Links None.
1 parent e37d22e commit c221510

File tree

1 file changed

+9
-19
lines changed

1 file changed

+9
-19
lines changed

linera-execution/src/runtime.rs

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@ use crate::{
3434
system::CreateApplicationResult,
3535
util::{ReceiverExt, UnboundedSenderExt},
3636
ApplicationDescription, ApplicationId, BaseRuntime, ContractRuntime, ExecutionError,
37-
FinalizeContext, Message, MessageContext, MessageKind, ModuleId, Operation, OperationContext,
38-
OutgoingMessage, QueryContext, QueryOutcome, ServiceRuntime, TransactionTracker,
39-
UserContractCode, UserContractInstance, UserServiceCode, UserServiceInstance,
40-
MAX_STREAM_NAME_LEN,
37+
FinalizeContext, Message, MessageContext, MessageKind, ModuleId, Operation, OutgoingMessage,
38+
QueryContext, QueryOutcome, ServiceRuntime, TransactionTracker, UserContractCode,
39+
UserContractInstance, UserServiceCode, UserServiceInstance, MAX_STREAM_NAME_LEN,
4140
};
4241

4342
#[cfg(test)]
@@ -442,7 +441,7 @@ impl SyncRuntimeInternal<UserContractInstance> {
442441
this: ContractSyncRuntimeHandle,
443442
authenticated: bool,
444443
callee_id: ApplicationId,
445-
) -> Result<(Arc<Mutex<UserContractInstance>>, OperationContext), ExecutionError> {
444+
) -> Result<Arc<Mutex<UserContractInstance>>, ExecutionError> {
446445
self.check_for_reentrancy(callee_id)?;
447446

448447
ensure!(
@@ -465,23 +464,14 @@ impl SyncRuntimeInternal<UserContractInstance> {
465464
_ => None,
466465
};
467466
let authenticated_caller_id = authenticated.then_some(caller_id);
468-
let timestamp = self.user_context;
469-
let callee_context = OperationContext {
470-
chain_id: self.chain_id,
471-
authenticated_signer,
472-
authenticated_caller_id,
473-
height: self.height,
474-
round: self.round,
475-
timestamp,
476-
};
477467
self.push_application(ApplicationStatus {
478468
caller_id: authenticated_caller_id,
479469
id: callee_id,
480470
description: application.description,
481471
// Allow further nested calls to be authenticated if this one is.
482472
signer: authenticated_signer,
483473
});
484-
Ok((application.instance, callee_context))
474+
Ok(application.instance)
485475
}
486476

487477
/// Cleans up the runtime after the execution of a call to a different contract.
@@ -1325,9 +1315,9 @@ impl ContractRuntime for ContractSyncRuntimeHandle {
13251315
callee_id: ApplicationId,
13261316
argument: Vec<u8>,
13271317
) -> Result<Vec<u8>, ExecutionError> {
1328-
let (contract, _context) =
1329-
self.inner()
1330-
.prepare_for_call(self.clone(), authenticated, callee_id)?;
1318+
let contract = self
1319+
.inner()
1320+
.prepare_for_call(self.clone(), authenticated, callee_id)?;
13311321

13321322
let value = contract
13331323
.try_lock()
@@ -1588,7 +1578,7 @@ impl ContractRuntime for ContractSyncRuntimeHandle {
15881578

15891579
self.inner().transaction_tracker = txn_tracker_moved;
15901580

1591-
let (contract, _context) = self.inner().prepare_for_call(self.clone(), true, app_id)?;
1581+
let contract = self.inner().prepare_for_call(self.clone(), true, app_id)?;
15921582

15931583
contract
15941584
.try_lock()

0 commit comments

Comments
 (0)