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
5a33924c
Commit
5a33924c
authored
Oct 15, 2020
by
Karl Floersch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Require all sequencer txs are processed
parent
2758b354
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
41 deletions
+24
-41
OVM_CanonicalTransactionChain.sol
...stic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol
+4
-0
OVM_CanonicalTransactionChain.spec.ts
...contracts/OVM/chain/OVM_CanonicalTransactionChain.spec.ts
+20
-41
No files found.
packages/contracts/contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol
View file @
5a33924c
...
...
@@ -322,6 +322,10 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, OVM_Ba
}
}
require(
theCalldataSize == nextSequencerTransactionPosition,
"Not all sequencer transactions were processed."
);
require(
transactionIndex == _totalElementsToAppend,
"Actual transaction index does not match expected total elements to append."
...
...
packages/contracts/test/contracts/OVM/chain/OVM_CanonicalTransactionChain.spec.ts
View file @
5a33924c
...
...
@@ -4,7 +4,6 @@ import { expect } from '../../../setup'
import
{
ethers
}
from
'
@nomiclabs/buidler
'
import
{
Signer
,
ContractFactory
,
Contract
,
BigNumber
}
from
'
ethers
'
import
{
TransactionResponse
}
from
"
@ethersproject/abstract-provider
"
;
import
{
FunctionFragment
}
from
"
@ethersproject/abi
"
;
import
{
smockit
,
MockContract
}
from
'
@eth-optimism/smock
'
import
_
from
'
lodash
'
...
...
@@ -19,8 +18,6 @@ import {
getEthTime
,
getNextBlockNumber
,
increaseEthTime
,
// NON_NULL_BYTES32,
// ZERO_ADDRESS,
}
from
'
../../../helpers
'
import
{
defaultAbiCoder
,
keccak256
}
from
'
ethers/lib/utils
'
...
...
@@ -33,33 +30,6 @@ interface sequencerBatchContext {
const
ELEMENT_TEST_SIZES
=
[
1
,
2
,
4
,
8
,
16
]
const
getQueueElementHash
=
(
queueIndex
:
number
):
string
=>
{
return
getChainElementHash
(
false
,
queueIndex
,
0
,
0
,
'
0x
'
)
}
const
getSequencerElementHash
=
(
timestamp
:
number
,
blockNumber
:
number
,
txData
:
string
):
string
=>
{
return
getChainElementHash
(
true
,
0
,
timestamp
,
blockNumber
,
txData
)
}
const
getChainElementHash
=
(
isSequenced
:
boolean
,
queueIndex
:
number
,
timestamp
:
number
,
blockNumber
:
number
,
txData
:
string
):
string
=>
{
return
keccak256
(
defaultAbiCoder
.
encode
(
[
'
bool
'
,
'
uint256
'
,
'
uint256
'
,
'
uint256
'
,
'
bytes
'
],
[
isSequenced
,
queueIndex
,
timestamp
,
blockNumber
,
txData
]
)
)
}
const
getTransactionHash
=
(
sender
:
string
,
target
:
string
,
...
...
@@ -81,17 +51,6 @@ const encodeQueueTransaction = (
)
}
const
encodeTimestampAndBlockNumber
=
(
timestamp
:
number
,
blockNumber
:
number
):
string
=>
{
return
(
'
0x
'
+
remove0x
(
BigNumber
.
from
(
blockNumber
).
toHexString
()).
padStart
(
54
,
'
0
'
)
+
remove0x
(
BigNumber
.
from
(
timestamp
).
toHexString
()).
padStart
(
10
,
'
0
'
)
)
}
interface
BatchContext
{
numSequencedTransactions
:
number
numSubsequentQueueTransactions
:
number
...
...
@@ -563,6 +522,26 @@ describe('OVM_CanonicalTransactionChain', () => {
)
})
it
(
'
should revert if not all sequencer transactions are processed
'
,
async
()
=>
{
await
expect
(
appendSequencerBatch
(
OVM_CanonicalTransactionChain
,
{
transactions
:
[
'
0x1234
'
,
'
0x1234
'
],
contexts
:
[
{
numSequencedTransactions
:
0
,
numSubsequentQueueTransactions
:
0
,
timestamp
:
0
,
blockNumber
:
0
,
},
],
shouldStartAtBatch
:
0
,
totalElementsToAppend
:
1
}
)).
to
.
be
.
revertedWith
(
'
Not all sequencer transactions were processed.
'
)
})
it
(
'
should revert if not called by the sequencer
'
,
async
()
=>
{
await
expect
(
appendSequencerBatch
(
OVM_CanonicalTransactionChain
.
connect
(
signer
),
{
...
...
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