Commit 2afd1957 authored by Karl Floersch's avatar Karl Floersch Committed by GitHub

Merge pull request #10 from ethereum-optimism/fix/ctc_events

Fix ctc events
parents 9c4eb7f8 08bcdd21
......@@ -172,7 +172,16 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, OVM_Ba
queue.push2(transactionHash, timestampAndBlockNumber, bytes28(0));
emit QueueTransactionAppended(transaction, timestampAndBlockNumber);
(, uint32 nextQueueIndex) = _getLatestBatchContext();
// TODO: Evaluate if we need timestamp
emit TransactionEnqueued(
msg.sender,
_target,
_gasLimit,
_data,
nextQueueIndex - 1,
block.timestamp
);
}
/**
......@@ -203,7 +212,7 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, OVM_Ba
_numQueuedTransactions
);
emit ChainBatchAppended(
emit QueueBatchAppended(
nextQueueIndex - _numQueuedTransactions,
_numQueuedTransactions
);
......@@ -271,6 +280,10 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, OVM_Ba
}
}
require(
numSequencerTransactionsProcessed == _transactions.length,
"Not all sequencer transactions were processed."
);
require(
transactionIndex == _totalElementsToAppend,
"Actual transaction index does not match expected total elements to append."
......@@ -283,7 +296,7 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, OVM_Ba
numQueuedTransactions
);
emit ChainBatchAppended(
emit SequencerBatchAppended(
nextQueueIndex - numQueuedTransactions,
numQueuedTransactions
);
......
......@@ -17,12 +17,21 @@ interface iOVM_CanonicalTransactionChain is iOVM_BaseChain {
* Events *
**********/
event QueueTransactionAppended(
bytes _transaction,
bytes32 _timestampAndBlockNumber
event TransactionEnqueued(
address _l1TxOrigin,
address _target,
uint256 _gasLimit,
bytes _data,
uint256 _queueIndex,
uint256 _timestamp
);
event QueueBatchAppended(
uint256 _startingQueueIndex,
uint256 _numQueueElements
);
event ChainBatchAppended(
event SequencerBatchAppended(
uint256 _startingQueueIndex,
uint256 _numQueueElements
);
......
......@@ -168,28 +168,14 @@ describe('OVM_CanonicalTransactionChain', () => {
})
describe('with valid input parameters', () => {
it('should emit a QueueTransactionAppended event', async () => {
it('should emit a TransactionEnqueued event', async () => {
const timestamp = (await getEthTime(ethers.provider)) + 100
const blockNumber = await getNextBlockNumber(ethers.provider)
await setEthTime(ethers.provider, timestamp)
const encodedTimestampAndBlockNumber = encodeTimestampAndBlockNumber(
timestamp,
blockNumber
)
const encodedQueueTransaction = encodeQueueTransaction(
await signer.getAddress(),
target,
gasLimit,
data
)
await expect(
OVM_CanonicalTransactionChain.enqueue(target, gasLimit, data)
)
.to.emit(OVM_CanonicalTransactionChain, 'QueueTransactionAppended')
.withArgs(encodedQueueTransaction, encodedTimestampAndBlockNumber)
.to.emit(OVM_CanonicalTransactionChain, 'TransactionEnqueued')
})
describe('when enqueing multiple times', () => {
......@@ -399,7 +385,7 @@ describe('OVM_CanonicalTransactionChain', () => {
sequencer
).appendQueueBatch(1)
)
.to.emit(OVM_CanonicalTransactionChain, 'ChainBatchAppended')
.to.emit(OVM_CanonicalTransactionChain, 'QueueBatchAppended')
.withArgs(0, 1)
})
})
......@@ -414,13 +400,13 @@ describe('OVM_CanonicalTransactionChain', () => {
it('should be able to append a single element', async () => {
await expect(OVM_CanonicalTransactionChain.appendQueueBatch(1))
.to.emit(OVM_CanonicalTransactionChain, 'ChainBatchAppended')
.to.emit(OVM_CanonicalTransactionChain, 'QueueBatchAppended')
.withArgs(0, 1)
})
it(`should be able to append ${size} elements`, async () => {
await expect(OVM_CanonicalTransactionChain.appendQueueBatch(size))
.to.emit(OVM_CanonicalTransactionChain, 'ChainBatchAppended')
.to.emit(OVM_CanonicalTransactionChain, 'QueueBatchAppended')
.withArgs(0, size)
})
......@@ -611,7 +597,7 @@ describe('OVM_CanonicalTransactionChain', () => {
size
)
)
.to.emit(OVM_CanonicalTransactionChain, 'ChainBatchAppended')
.to.emit(OVM_CanonicalTransactionChain, 'SequencerBatchAppended')
.withArgs(0, 0)
})
})
......@@ -659,7 +645,7 @@ describe('OVM_CanonicalTransactionChain', () => {
size * 2
)
)
.to.emit(OVM_CanonicalTransactionChain, 'ChainBatchAppended')
.to.emit(OVM_CanonicalTransactionChain, 'SequencerBatchAppended')
.withArgs(0, size)
})
})
......@@ -699,7 +685,7 @@ describe('OVM_CanonicalTransactionChain', () => {
size + spacing
)
)
.to.emit(OVM_CanonicalTransactionChain, 'ChainBatchAppended')
.to.emit(OVM_CanonicalTransactionChain, 'SequencerBatchAppended')
.withArgs(0, spacing)
})
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment