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
85423394
Commit
85423394
authored
Oct 28, 2020
by
Karl Floersch
Committed by
GitHub
Oct 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add getPendingQueueElements (#38)
parent
fa5a2598
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
4 deletions
+28
-4
OVM_CanonicalTransactionChain.sol
...stic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol
+17
-4
iOVM_CanonicalTransactionChain.sol
...ic-ethereum/iOVM/chain/iOVM_CanonicalTransactionChain.sol
+11
-0
No files found.
packages/contracts/contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol
View file @
85423394
...
@@ -167,6 +167,20 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
...
@@ -167,6 +167,20 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
});
});
}
}
/**
* @inheritdoc iOVM_CanonicalTransactionChain
*/
function getNumPendingQueueElements()
override
public
view
returns (
uint40
)
{
return _getQueueLength() - getNextQueueIndex();
}
/**
/**
* @inheritdoc iOVM_CanonicalTransactionChain
* @inheritdoc iOVM_CanonicalTransactionChain
*/
*/
...
@@ -248,15 +262,14 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
...
@@ -248,15 +262,14 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
override
override
public
public
{
{
uint40 nextQueueIndex = getNextQueueIndex();
_numQueuedTransactions = Math.min(_numQueuedTransactions, getNumPendingQueueElements());
uint40 queueLength = _getQueueLength();
_numQueuedTransactions = Math.min(_numQueuedTransactions, queueLength - nextQueueIndex);
require(
require(
_numQueuedTransactions > 0,
_numQueuedTransactions > 0,
"Must append more than zero transactions."
"Must append more than zero transactions."
);
);
bytes32[] memory leaves = new bytes32[](_numQueuedTransactions);
bytes32[] memory leaves = new bytes32[](_numQueuedTransactions);
uint40 nextQueueIndex = getNextQueueIndex();
for (uint256 i = 0; i < _numQueuedTransactions; i++) {
for (uint256 i = 0; i < _numQueuedTransactions; i++) {
if (msg.sender != sequencer) {
if (msg.sender != sequencer) {
...
@@ -683,7 +696,7 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
...
@@ -683,7 +696,7 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
internal
internal
view
view
{
{
if (
queue.getLength
() == 0) {
if (
getNumPendingQueueElements
() == 0) {
return;
return;
}
}
...
...
packages/contracts/contracts/optimistic-ethereum/iOVM/chain/iOVM_CanonicalTransactionChain.sol
View file @
85423394
...
@@ -85,6 +85,17 @@ interface iOVM_CanonicalTransactionChain {
...
@@ -85,6 +85,17 @@ interface iOVM_CanonicalTransactionChain {
uint40
uint40
);
);
/**
* Get the number of queue elements which have not yet been included.
* @return Length of the queue.
*/
function getNumPendingQueueElements()
external
view
returns (
uint40
);
/**
/**
* Gets the queue element at a particular index.
* Gets the queue element at a particular index.
* @param _index Index of the queue element to access.
* @param _index Index of the queue element to access.
...
...
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