diff --git a/enclave-modules/ecall-handler/src/light_client/aggregate_messages.rs b/enclave-modules/ecall-handler/src/light_client/aggregate_messages.rs index 3bd3f5a2..05d431a5 100644 --- a/enclave-modules/ecall-handler/src/light_client/aggregate_messages.rs +++ b/enclave-modules/ecall-handler/src/light_client/aggregate_messages.rs @@ -13,8 +13,6 @@ pub fn aggregate_messages( ctx: &mut Context, input: AggregateMessagesInput, ) -> Result { - ctx.set_timestamp(input.current_timestamp); - if input.messages.len() < 2 { return Err(Error::invalid_argument( "messages and signatures must have at least 2 elements".into(), diff --git a/enclave-modules/ecall-handler/src/light_client/init_client.rs b/enclave-modules/ecall-handler/src/light_client/init_client.rs index a599397c..6877c002 100644 --- a/enclave-modules/ecall-handler/src/light_client/init_client.rs +++ b/enclave-modules/ecall-handler/src/light_client/init_client.rs @@ -13,8 +13,6 @@ pub fn init_client( ctx: &mut Context, input: InitClientInput, ) -> Result { - ctx.set_timestamp(input.current_timestamp); - let lc = match ctx.get_light_client(&input.any_client_state.type_url) { Some(lc) => lc, None => { diff --git a/enclave-modules/ecall-handler/src/light_client/router.rs b/enclave-modules/ecall-handler/src/light_client/router.rs index 7f8e0300..7ccb0c1b 100644 --- a/enclave-modules/ecall-handler/src/light_client/router.rs +++ b/enclave-modules/ecall-handler/src/light_client/router.rs @@ -21,8 +21,12 @@ pub fn dispatch( let sealed_ek = cctx .sealed_ek .ok_or(Error::sealed_enclave_key_not_found())?; - let mut ctx = - Context::new(env.get_lc_registry(), env.new_store(cctx.tx_id), &sealed_ek); + let mut ctx = Context::new( + env.get_lc_registry(), + env.new_store(cctx.tx_id), + &sealed_ek, + cctx.current_timestamp, + ); match cmd { InitClient(input) => init_client(&mut ctx, input)?, UpdateClient(input) => update_client(&mut ctx, input)?, @@ -33,8 +37,12 @@ pub fn dispatch( } LightClientCommand::Query(cmd) => { use LightClientQueryCommand::*; - let mut ctx = - Context::new(env.get_lc_registry(), env.new_store(cctx.tx_id), &NopSigner); + let mut ctx = Context::new( + env.get_lc_registry(), + env.new_store(cctx.tx_id), + &NopSigner, + cctx.current_timestamp, + ); match cmd { QueryClient(input) => query_client(&mut ctx, input)?, } diff --git a/enclave-modules/ecall-handler/src/light_client/update_client.rs b/enclave-modules/ecall-handler/src/light_client/update_client.rs index b0023d7c..12905ea2 100644 --- a/enclave-modules/ecall-handler/src/light_client/update_client.rs +++ b/enclave-modules/ecall-handler/src/light_client/update_client.rs @@ -12,8 +12,6 @@ pub fn update_client( ctx: &mut Context, input: UpdateClientInput, ) -> Result { - ctx.set_timestamp(input.current_timestamp); - let lc = get_light_client_by_client_id(ctx, &input.client_id)?; let ek = ctx.get_enclave_key(); match lc.update_client(ctx, input.client_id.clone(), input.any_header)? { diff --git a/modules/context/src/context.rs b/modules/context/src/context.rs index 05a1042c..7d6289e9 100644 --- a/modules/context/src/context.rs +++ b/modules/context/src/context.rs @@ -11,23 +11,19 @@ pub struct Context<'k, R: LightClientResolver, S: KVStore, K: Signer> { lc_registry: R, store: S, ek: &'k K, - current_timestamp: Option