Check zero contract root.

This commit is contained in:
Peilun Li 2024-10-11 19:14:32 +08:00
parent bc3a64ea80
commit bbba73efb8

View File

@ -519,21 +519,27 @@ impl LogSyncManager {
.call() .call()
.await .await
{ {
Ok(contract_root) => match self.store.get_context() { Ok(contract_root_bytes) => {
Ok((local_root, _)) => { let contract_root = H256::from_slice(&contract_root_bytes);
if H256::from_slice(&contract_root) != local_root { // contract_root is zero for tx submitted before upgrading.
error!( if !contract_root.is_zero() {
?contract_root, match self.store.get_context() {
?local_root, Ok((local_root, _)) => {
"local flow root and on-chain flow root mismatch" if contract_root != local_root {
); error!(
return false; ?contract_root,
?local_root,
"local flow root and on-chain flow root mismatch"
);
return false;
}
}
Err(e) => {
warn!(?e, "fail to read the local flow root");
}
} }
} }
Err(e) => { }
warn!(?e, "fail to read the local flow root");
}
},
Err(e) => { Err(e) => {
warn!(?e, "fail to read the on-chain flow root"); warn!(?e, "fail to read the on-chain flow root");
} }