Skip to content

Commit 3b4353f

Browse files
committed
Ignore (instead of panic) on TypeInfo update.
1 parent 6036627 commit 3b4353f

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

core-rust/state-manager/src/store/rocks_db.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2064,21 +2064,27 @@ impl<R: WriteableRocks> StateManagerDatabase<R> {
20642064
substate_changes: &BySubstate<SubstateChangeAction>,
20652065
) {
20662066
for (index_within_txn, node_id) in substate_changes.iter_node_ids().enumerate() {
2067-
let type_info_creation = substate_changes.get(
2067+
let type_info_change = substate_changes.get(
20682068
node_id,
20692069
&TYPE_INFO_FIELD_PARTITION,
20702070
&TypeInfoField::TypeInfo.into(),
20712071
);
2072-
let Some(type_info_creation) = type_info_creation else {
2072+
let Some(type_info_change) = type_info_change else {
20732073
continue;
20742074
};
2075-
let SubstateChangeAction::Create { new } = type_info_creation else {
2076-
panic!(
2077-
"type info substate should be immutable: {:?}",
2078-
type_info_creation
2079-
);
2075+
let created_type_info_value = match type_info_change {
2076+
SubstateChangeAction::Create { new } => new,
2077+
SubstateChangeAction::Update { .. } => {
2078+
// Even if TypeInfo is updated (e.g. its blueprint version bumped), the fields
2079+
// that we care about (package address and blueprint name) are effectively
2080+
// immutable - we can thus safely ignore all updates to this substate.
2081+
continue;
2082+
},
2083+
SubstateChangeAction::Delete { .. } => {
2084+
panic!("type info substate should not be deleted: {:?}", type_info_change)
2085+
},
20802086
};
2081-
let type_info = scrypto_decode::<TypeInfoSubstate>(new).expect("decode type info");
2087+
let type_info = scrypto_decode::<TypeInfoSubstate>(created_type_info_value).expect("decode type info");
20822088

20832089
let entity_type = node_id.entity_type().expect("type of upserted Entity");
20842090
let creation_id = CreationId::new(state_version, index_within_txn);

0 commit comments

Comments
 (0)