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
6693d3a8
Commit
6693d3a8
authored
Mar 12, 2021
by
Kevin Ho
Committed by
GitHub
Mar 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove pushTwo and getTwo (#324)
parent
6ac40bad
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
177 deletions
+8
-177
OVM_CanonicalTransactionChain.sol
...stic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol
+8
-11
OVM_ChainStorageContainer.sol
...timistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol
+0
-46
iOVM_ChainStorageContainer.sol
...mistic-ethereum/iOVM/chain/iOVM_ChainStorageContainer.sol
+0
-41
Lib_RingBuffer.sol
...ts/optimistic-ethereum/libraries/utils/Lib_RingBuffer.sol
+0
-65
TestLib_RingBuffer.sol
...cts/contracts/test-libraries/utils/TestLib_RingBuffer.sol
+0
-14
No files found.
packages/contracts/contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol
View file @
6693d3a8
...
@@ -313,14 +313,12 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
...
@@ -313,14 +313,12 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
iOVM_ChainStorageContainer queueRef = queue();
iOVM_ChainStorageContainer queueRef = queue();
queueRef.pushTwo(
queueRef.push(transactionHash);
transactionHash,
queueRef.push(timestampAndBlockNumber);
timestampAndBlockNumber
);
// The underlying queue data structure stores 2 elements
// The underlying queue data structure stores 2 elements
// per insertion, so to get the real queue length we need
// per insertion, so to get the real queue length we need
// to divide by 2 and subtract 1.
See the usage of `pushTwo(..)`.
// to divide by 2 and subtract 1.
uint256 queueIndex = queueRef.length() / 2 - 1;
uint256 queueIndex = queueRef.length() / 2 - 1;
emit TransactionEnqueued(
emit TransactionEnqueued(
msg.sender,
msg.sender,
...
@@ -751,11 +749,10 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
...
@@ -751,11 +749,10 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
{
{
// The underlying queue data structure stores 2 elements
// The underlying queue data structure stores 2 elements
// per insertion, so to get the actual desired queue index
// per insertion, so to get the actual desired queue index
// we need to multiply by 2. See the usage of `pushTwo(..)`.
// we need to multiply by 2.
(
uint40 trueIndex = uint40(_index * 2);
bytes32 transactionHash,
bytes32 transactionHash = _queueRef.get(trueIndex);
bytes32 timestampAndBlockNumber
bytes32 timestampAndBlockNumber = _queueRef.get(trueIndex + 1);
) = _queueRef.getTwo(uint40(_index * 2));
uint40 elementTimestamp;
uint40 elementTimestamp;
uint40 elementBlockNumber;
uint40 elementBlockNumber;
...
@@ -786,7 +783,7 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
...
@@ -786,7 +783,7 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
{
{
// The underlying queue data structure stores 2 elements
// The underlying queue data structure stores 2 elements
// per insertion, so to get the real queue length we need
// per insertion, so to get the real queue length we need
// to divide by 2.
See the usage of `pushTwo(..)`.
// to divide by 2.
return uint40(_queueRef.length() / 2);
return uint40(_queueRef.length() / 2);
}
}
...
...
packages/contracts/contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol
View file @
6693d3a8
...
@@ -142,35 +142,6 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes
...
@@ -142,35 +142,6 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes
buffer.push(_object, _globalMetadata);
buffer.push(_object, _globalMetadata);
}
}
/**
* @inheritdoc iOVM_ChainStorageContainer
*/
function pushTwo(
bytes32 _objectA,
bytes32 _objectB
)
override
public
onlyOwner
{
buffer.pushTwo(_objectA, _objectB);
}
/**
* @inheritdoc iOVM_ChainStorageContainer
*/
function pushTwo(
bytes32 _objectA,
bytes32 _objectB,
bytes27 _globalMetadata
)
override
public
onlyOwner
{
buffer.pushTwo(_objectA, _objectB, _globalMetadata);
}
/**
/**
* @inheritdoc iOVM_ChainStorageContainer
* @inheritdoc iOVM_ChainStorageContainer
*/
*/
...
@@ -186,23 +157,6 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes
...
@@ -186,23 +157,6 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes
{
{
return buffer.get(uint40(_index));
return buffer.get(uint40(_index));
}
}
/**
* @inheritdoc iOVM_ChainStorageContainer
*/
function getTwo(
uint256 _index
)
override
public
view
returns (
bytes32,
bytes32
)
{
return buffer.getTwo(uint40(_index));
}
/**
/**
* @inheritdoc iOVM_ChainStorageContainer
* @inheritdoc iOVM_ChainStorageContainer
...
...
packages/contracts/contracts/optimistic-ethereum/iOVM/chain/iOVM_ChainStorageContainer.sol
View file @
6693d3a8
...
@@ -65,31 +65,6 @@ interface iOVM_ChainStorageContainer {
...
@@ -65,31 +65,6 @@ interface iOVM_ChainStorageContainer {
)
)
external;
external;
/**
* Pushes two objects into the container at the same time. A useful optimization.
* @param _objectA First 32 byte value to insert into the container.
* @param _objectB Second 32 byte value to insert into the container.
*/
function pushTwo(
bytes32 _objectA,
bytes32 _objectB
)
external;
/**
* Pushes two objects into the container at the same time. Also allows setting the global
* metadata field.
* @param _objectA First 32 byte value to insert into the container.
* @param _objectB Second 32 byte value to insert into the container.
* @param _globalMetadata New global metadata for the container.
*/
function pushTwo(
bytes32 _objectA,
bytes32 _objectB,
bytes27 _globalMetadata
)
external;
/**
/**
* Retrieves an object from the container.
* Retrieves an object from the container.
* @param _index Index of the particular object to access.
* @param _index Index of the particular object to access.
...
@@ -104,22 +79,6 @@ interface iOVM_ChainStorageContainer {
...
@@ -104,22 +79,6 @@ interface iOVM_ChainStorageContainer {
bytes32
bytes32
);
);
/**
* Retrieves two consecutive objects from the container.
* @param _index Index of the particular objects to access.
* @return 32 byte object value at index `_index`.
* @return 32 byte object value at index `_index + 1`.
*/
function getTwo(
uint256 _index
)
external
view
returns (
bytes32,
bytes32
);
/**
/**
* Removes all objects after and including a given index.
* Removes all objects after and including a given index.
* @param _index Object index to delete from.
* @param _index Object index to delete from.
...
...
packages/contracts/contracts/optimistic-ethereum/libraries/utils/Lib_RingBuffer.sol
View file @
6693d3a8
...
@@ -111,47 +111,6 @@ library Lib_RingBuffer {
...
@@ -111,47 +111,6 @@ library Lib_RingBuffer {
);
);
}
}
/**
* Pushes a two elements to the buffer.
* @param _self Buffer to access.
* @param _valueA First value to push to the buffer.
* @param _valueA Second value to push to the buffer.
* @param _extraData Optional global extra data.
*/
function pushTwo(
RingBuffer storage _self,
bytes32 _valueA,
bytes32 _valueB,
bytes27 _extraData
)
internal
{
_self.push(_valueA, _extraData);
_self.push(_valueB, _extraData);
}
/**
* Pushes a two elements to the buffer.
* @param _self Buffer to access.
* @param _valueA First value to push to the buffer.
* @param _valueA Second value to push to the buffer.
*/
function pushTwo(
RingBuffer storage _self,
bytes32 _valueA,
bytes32 _valueB
)
internal
{
RingBufferContext memory ctx = _self.getContext();
_self.pushTwo(
_valueA,
_valueB,
ctx.extraData
);
}
/**
/**
* Retrieves an element from the buffer.
* Retrieves an element from the buffer.
* @param _self Buffer to access.
* @param _self Buffer to access.
...
@@ -211,30 +170,6 @@ library Lib_RingBuffer {
...
@@ -211,30 +170,6 @@ library Lib_RingBuffer {
}
}
}
}
/**
* Retrieves two consecutive elements from the buffer.
* @param _self Buffer to access.
* @param _index Element index to retrieve.
* @return Value of the element at index `_index`.
* @return Value of the element at index `_index + 1`.
*/
function getTwo(
RingBuffer storage _self,
uint256 _index
)
internal
view
returns (
bytes32,
bytes32
)
{
return (
_self.get(_index),
_self.get(_index + 1)
);
}
/**
/**
* Deletes all elements after (and including) a given index.
* Deletes all elements after (and including) a given index.
* @param _self Buffer to access.
* @param _self Buffer to access.
...
...
packages/contracts/contracts/test-libraries/utils/TestLib_RingBuffer.sol
View file @
6693d3a8
...
@@ -25,20 +25,6 @@ contract TestLib_RingBuffer {
...
@@ -25,20 +25,6 @@ contract TestLib_RingBuffer {
);
);
}
}
function pushTwo(
bytes32 _valueA,
bytes32 _valueB,
bytes27 _extraData
)
public
{
buf.pushTwo(
_valueA,
_valueB,
_extraData
);
}
function get(
function get(
uint256 _index
uint256 _index
)
)
...
...
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