Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
2afd1957
Commit
2afd1957
authored
Oct 13, 2020
by
Karl Floersch
Committed by
GitHub
Oct 13, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10 from ethereum-optimism/fix/ctc_events
Fix ctc events
parents
9c4eb7f8
08bcdd21
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
29 deletions
+37
-29
OVM_CanonicalTransactionChain.sol
...stic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol
+16
-3
iOVM_CanonicalTransactionChain.sol
...ic-ethereum/iOVM/chain/iOVM_CanonicalTransactionChain.sol
+13
-4
OVM_CanonicalTransactionChain.spec.ts
...contracts/OVM/chain/OVM_CanonicalTransactionChain.spec.ts
+8
-22
No files found.
packages/contracts/contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol
View file @
2afd1957
...
...
@@ -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
Chain
BatchAppended(
emit
Queue
BatchAppended(
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
Chain
BatchAppended(
emit
Sequencer
BatchAppended(
nextQueueIndex - numQueuedTransactions,
numQueuedTransactions
);
...
...
packages/contracts/contracts/optimistic-ethereum/iOVM/chain/iOVM_CanonicalTransactionChain.sol
View file @
2afd1957
...
...
@@ -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
Chain
BatchAppended(
event
Sequencer
BatchAppended(
uint256 _startingQueueIndex,
uint256 _numQueueElements
);
...
...
packages/contracts/test/contracts/OVM/chain/OVM_CanonicalTransactionChain.spec.ts
View file @
2afd1957
...
...
@@ -168,28 +168,14 @@ describe('OVM_CanonicalTransactionChain', () => {
})
describe
(
'
with valid input parameters
'
,
()
=>
{
it
(
'
should emit a
QueueTransactionAppend
ed event
'
,
async
()
=>
{
it
(
'
should emit a
TransactionEnqueu
ed 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
,
'
Chain
BatchAppended
'
)
.
to
.
emit
(
OVM_CanonicalTransactionChain
,
'
Queue
BatchAppended
'
)
.
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
,
'
Chain
BatchAppended
'
)
.
to
.
emit
(
OVM_CanonicalTransactionChain
,
'
Queue
BatchAppended
'
)
.
withArgs
(
0
,
1
)
})
it
(
`should be able to append
${
size
}
elements`
,
async
()
=>
{
await
expect
(
OVM_CanonicalTransactionChain
.
appendQueueBatch
(
size
))
.
to
.
emit
(
OVM_CanonicalTransactionChain
,
'
Chain
BatchAppended
'
)
.
to
.
emit
(
OVM_CanonicalTransactionChain
,
'
Queue
BatchAppended
'
)
.
withArgs
(
0
,
size
)
})
...
...
@@ -611,7 +597,7 @@ describe('OVM_CanonicalTransactionChain', () => {
size
)
)
.
to
.
emit
(
OVM_CanonicalTransactionChain
,
'
Chain
BatchAppended
'
)
.
to
.
emit
(
OVM_CanonicalTransactionChain
,
'
Sequencer
BatchAppended
'
)
.
withArgs
(
0
,
0
)
})
})
...
...
@@ -659,7 +645,7 @@ describe('OVM_CanonicalTransactionChain', () => {
size
*
2
)
)
.
to
.
emit
(
OVM_CanonicalTransactionChain
,
'
Chain
BatchAppended
'
)
.
to
.
emit
(
OVM_CanonicalTransactionChain
,
'
Sequencer
BatchAppended
'
)
.
withArgs
(
0
,
size
)
})
})
...
...
@@ -699,7 +685,7 @@ describe('OVM_CanonicalTransactionChain', () => {
size
+
spacing
)
)
.
to
.
emit
(
OVM_CanonicalTransactionChain
,
'
Chain
BatchAppended
'
)
.
to
.
emit
(
OVM_CanonicalTransactionChain
,
'
Sequencer
BatchAppended
'
)
.
withArgs
(
0
,
spacing
)
})
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment