feat: Add previous_value field to ContractSlot
This change is required by the DCI to properly detect potential address changes (retriggers) on packed storage slots.
This commit is contained in:
@@ -123,6 +123,8 @@ message ContractSlot {
|
|||||||
bytes slot = 2;
|
bytes slot = 2;
|
||||||
// The new value for this storage slot.
|
// The new value for this storage slot.
|
||||||
bytes value = 3;
|
bytes value = 3;
|
||||||
|
// The old value of this storage slot
|
||||||
|
bytes previous_value = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// A struct for following the token balance changes for a contract.
|
// A struct for following the token balance changes for a contract.
|
||||||
|
|||||||
@@ -56,7 +56,11 @@ pub fn get_block_storage_changes(block: ð::v2::Block) -> Vec<TransactionStora
|
|||||||
for change in changes {
|
for change in changes {
|
||||||
latest_changes.insert(
|
latest_changes.insert(
|
||||||
change.key.clone(),
|
change.key.clone(),
|
||||||
ContractSlot { slot: change.key, value: change.new_value },
|
ContractSlot {
|
||||||
|
slot: change.key,
|
||||||
|
value: change.new_value,
|
||||||
|
previous_value: change.old_value,
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ impl TransactionChangesBuilder {
|
|||||||
.attributes
|
.attributes
|
||||||
.clone()
|
.clone()
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|&attr| (attr.change == i32::from(ChangeType::Creation)))
|
.filter(|&attr| attr.change == i32::from(ChangeType::Creation))
|
||||||
.map(|attr| attr.name.clone())
|
.map(|attr| attr.name.clone())
|
||||||
.collect(),
|
.collect(),
|
||||||
});
|
});
|
||||||
@@ -578,7 +578,11 @@ impl From<InterimContractChange> for Option<ContractChange> {
|
|||||||
.slots
|
.slots
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter(|(_, value)| value.has_changed())
|
.filter(|(_, value)| value.has_changed())
|
||||||
.map(|(slot, value)| ContractSlot { slot, value: value.new_value })
|
.map(|(slot, value)| ContractSlot {
|
||||||
|
slot,
|
||||||
|
value: value.new_value,
|
||||||
|
previous_value: value.start_value,
|
||||||
|
})
|
||||||
.collect(),
|
.collect(),
|
||||||
change: value.change.into(),
|
change: value.change.into(),
|
||||||
token_balances: value
|
token_balances: value
|
||||||
|
|||||||
@@ -138,6 +138,9 @@ pub struct ContractSlot {
|
|||||||
/// The new value for this storage slot.
|
/// The new value for this storage slot.
|
||||||
#[prost(bytes="vec", tag="3")]
|
#[prost(bytes="vec", tag="3")]
|
||||||
pub value: ::prost::alloc::vec::Vec<u8>,
|
pub value: ::prost::alloc::vec::Vec<u8>,
|
||||||
|
/// The old value of this storage slot
|
||||||
|
#[prost(bytes="vec", tag="4")]
|
||||||
|
pub previous_value: ::prost::alloc::vec::Vec<u8>,
|
||||||
}
|
}
|
||||||
/// A struct for following the token balance changes for a contract.
|
/// A struct for following the token balance changes for a contract.
|
||||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||||
|
|||||||
Reference in New Issue
Block a user