Skip to content

Commit

Permalink
Merge pull request #5912 from oasisprotocol/kostko/stable/24.3.x/back…
Browse files Browse the repository at this point in the history
…port-5909

[BACKPORT/24.3.x] runtime: Do not persist updated trusted state for TDX
  • Loading branch information
kostko authored Oct 18, 2024
2 parents 3b1fc77 + 850fa71 commit d4fa419
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions .changelog/5909.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
runtime: Do not persist updated trusted state for TDX
17 changes: 16 additions & 1 deletion runtime/src/consensus/tendermint/verifier/store/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::{
consensus::verifier::{Error, TrustRoot},
protocol::ProtocolUntrustedLocalStorage,
storage::KeyValue,
Protocol,
Protocol, TeeType, BUILD_INFO,
};

/// Storage key prefix under which the sealed trusted state is stored in
Expand Down Expand Up @@ -95,6 +95,12 @@ impl TrustedStateStore {
/// Panics in case the light store does not have any blocks or if insertion to the underlying
/// runtime's untrusted local store fails.
pub fn save(&self, runtime_version: Version, store: &Box<dyn LightStore>) {
if BUILD_INFO.tee_type == TeeType::Tdx {
// TODO: Currently TDX does not have sealing capabilities, so we just do not persist
// anything as we can't seal secrets until we have CPU-bound key derivation.
return;
}

let lowest_block = store.lowest(Status::Trusted).unwrap();
let highest_block = store.highest(Status::Trusted).unwrap();

Expand Down Expand Up @@ -129,6 +135,15 @@ impl TrustedStateStore {
runtime_version: Version,
trust_root: &TrustRoot,
) -> Result<TrustedState, Error> {
if BUILD_INFO.tee_type == TeeType::Tdx {
// TODO: Currently TDX does not have sealing capabilities, so we just do not persist
// anything as we can't seal secrets until we have CPU-bound key derivation.
return Ok(TrustedState {
trust_root: trust_root.clone(),
trusted_blocks: vec![],
});
}

// Attempt to load the previously sealed trusted state.
let untrusted_value = self
.untrusted_local_store
Expand Down

0 comments on commit d4fa419

Please sign in to comment.