Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik committed Jan 15, 2025
1 parent 598ff9c commit 67775f2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
5 changes: 3 additions & 2 deletions packages/protocol/contracts/layer1/based/ITaikoInbox.sol
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,12 @@ interface ITaikoInbox {
/// @param transitions The transitions data.
event BatchesProved(address verifier, uint64[] batchIds, Transition[] transitions);

/// @notice Emitted when a transition is overwritten by another one.
/// @notice Emitted when a transition is overwritten by a conflicting one with the same parent
/// hash but different block hash or state root.
/// @param batchId The batch ID.
/// @param oldTran The old transition overwritten.
/// @param newTran The new transition.
event TransitionOverwritten(uint64 batchId, Transition oldTran, Transition newTran);
event ConflictingProof(uint64 batchId, Transition oldTran, Transition newTran);

/// @notice Emitted when a batch is verified.
/// @param batchId The ID of the verified batch.
Expand Down
15 changes: 8 additions & 7 deletions packages/protocol/contracts/layer1/based/TaikoInbox.sol
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ abstract contract TaikoInbox is EssentialContract, ITaikoInbox, ITaiko, IFork {
Config memory config = getConfig();
IVerifier.Context[] memory ctxs = new IVerifier.Context[](metas.length);

bool hasConflictingOverwrite;
bool hasConflictingProof;
for (uint256 i; i < metas.length; ++i) {
BatchMetadata memory meta = metas[i];

Expand Down Expand Up @@ -244,7 +244,7 @@ abstract contract TaikoInbox is EssentialContract, ITaikoInbox, ITaiko, IFork {
}
}

bool isConflictingOverwrite;
bool isConflictingProof;
if (tid == 0) {
// This transition is new, we need to use the next available ID.
tid = batch.nextTransitionId++;
Expand All @@ -255,8 +255,8 @@ abstract contract TaikoInbox is EssentialContract, ITaikoInbox, ITaiko, IFork {
&& (oldTran.stateRoot == 0 || oldTran.stateRoot == tran.stateRoot);
require(!isSameTransition, SameTransition());

isConflictingOverwrite = true;
emit TransitionOverwritten(meta.batchId, oldTran, tran);
isConflictingProof = true;
emit ConflictingProof(meta.batchId, oldTran, tran);
}

Transition storage ts = state.transitions[slot][tid];
Expand All @@ -266,7 +266,8 @@ abstract contract TaikoInbox is EssentialContract, ITaikoInbox, ITaiko, IFork {
unchecked {
uint256 deadline =
uint256(meta.proposedAt).max(stats2.lastUnpausedAt) + config.provingWindow;
if (block.timestamp <= deadline && !isConflictingOverwrite) {

if (block.timestamp <= deadline && !isConflictingProof) {
_creditBond(meta.proposer, meta.livenessBond);
}

Expand All @@ -289,7 +290,7 @@ abstract contract TaikoInbox is EssentialContract, ITaikoInbox, ITaiko, IFork {

ts.blockHash = tran.blockHash;

hasConflictingOverwrite = hasConflictingOverwrite || isConflictingOverwrite;
hasConflictingProof = hasConflictingProof || isConflictingProof;
}

address verifier = resolve(LibStrings.B_PROOF_VERIFIER, false);
Expand All @@ -305,7 +306,7 @@ abstract contract TaikoInbox is EssentialContract, ITaikoInbox, ITaiko, IFork {
emit BatchesProved(verifier, batchIds, trans);
}

if (hasConflictingOverwrite) {
if (hasConflictingProof) {
_pause();
emit Paused(verifier);
} else {
Expand Down

0 comments on commit 67775f2

Please sign in to comment.