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
1378674b
Commit
1378674b
authored
Apr 06, 2021
by
Maurelian
Committed by
GitHub
Apr 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enforce MAX_ROLLUP_TX_SIZE on sequencer tx (#361)
parent
44bbc4e9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
1 deletion
+31
-1
OVM_CanonicalTransactionChain.sol
...stic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol
+5
-1
OVM_CanonicalTransactionChain.spec.ts
...contracts/OVM/chain/OVM_CanonicalTransactionChain.spec.ts
+26
-0
No files found.
packages/contracts/contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol
View file @
1378674b
...
...
@@ -480,6 +480,10 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
assembly {
txDataLength := shr(232, calldataload(nextTransactionPtr))
}
require(
txDataLength <= MAX_ROLLUP_TX_SIZE,
"Transaction data size exceeds maximum for rollup transaction."
);
leaves[leafIndex] = _getSequencerLeafHash(
curContext,
...
...
packages/contracts/test/contracts/OVM/chain/OVM_CanonicalTransactionChain.spec.ts
View file @
1378674b
...
...
@@ -754,6 +754,32 @@ describe('OVM_CanonicalTransactionChain', () => {
).
to
.
be
.
revertedWith
(
'
Must append at least one element.
'
)
})
it
(
'
should revert when trying to input more data than the max data size
'
,
async
()
=>
{
const
MAX_ROLLUP_TX_SIZE
=
await
OVM_CanonicalTransactionChain
.
MAX_ROLLUP_TX_SIZE
()
const
data
=
'
0x
'
+
'
12
'
.
repeat
(
MAX_ROLLUP_TX_SIZE
+
1
)
const
timestamp
=
await
getEthTime
(
ethers
.
provider
)
const
blockNumber
=
(
await
getNextBlockNumber
(
ethers
.
provider
))
-
1
await
expect
(
appendSequencerBatch
(
OVM_CanonicalTransactionChain
,
{
transactions
:
[
data
],
contexts
:
[
{
numSequencedTransactions
:
1
,
numSubsequentQueueTransactions
:
0
,
timestamp
,
blockNumber
,
},
],
shouldStartAtElement
:
0
,
totalElementsToAppend
:
1
,
})
).
to
.
be
.
revertedWith
(
'
Transaction data size exceeds maximum for rollup transaction.
'
)
})
describe
(
'
Sad path cases
'
,
()
=>
{
const
target
=
NON_ZERO_ADDRESS
const
gasLimit
=
500
_000
...
...
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