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
fba4de0d
Commit
fba4de0d
authored
Oct 13, 2020
by
Karl Floersch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add events
parent
78186e29
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
OVM_CanonicalTransactionChain.sol
...stic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol
+16
-3
OVM_CanonicalTransactionChain.spec.ts
...contracts/OVM/chain/OVM_CanonicalTransactionChain.spec.ts
+1
-1
No files found.
packages/contracts/contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol
View file @
fba4de0d
...
@@ -21,6 +21,13 @@ import { OVM_BaseChain } from "./OVM_BaseChain.sol";
...
@@ -21,6 +21,13 @@ import { OVM_BaseChain } from "./OVM_BaseChain.sol";
*/
*/
contract OVM_CanonicalTransactionChain is OVM_BaseChain, Lib_AddressResolver { // TODO: re-add iOVM_CanonicalTransactionChain
contract OVM_CanonicalTransactionChain is OVM_BaseChain, Lib_AddressResolver { // TODO: re-add iOVM_CanonicalTransactionChain
/**********
* Events *
*********/
event queueTransactionAppended(bytes _queueTransaction, bytes32 timestampAndBlockNumber);
event chainBatchAppended(uint _startingQueueIndex, uint _numQueueElements);
/*************************************************
/*************************************************
* Contract Variables: Transaction Restrinctions *
* Contract Variables: Transaction Restrinctions *
*************************************************/
*************************************************/
...
@@ -113,16 +120,19 @@ contract OVM_CanonicalTransactionChain is OVM_BaseChain, Lib_AddressResolver { /
...
@@ -113,16 +120,19 @@ contract OVM_CanonicalTransactionChain is OVM_BaseChain, Lib_AddressResolver { /
i++; // TODO: Replace this dumb work with minting gas token. (not today)
i++; // TODO: Replace this dumb work with minting gas token. (not today)
}
}
bytes
32 queueRoot = keccak256(
abi.encode(
bytes
memory queueTx =
abi.encode(
msg.sender,
msg.sender,
_target,
_target,
_gasLimit,
_gasLimit,
_data
_data
));
);
bytes32 queueRoot = keccak256(queueTx);
// bytes is left aligned, uint is right aligned - use this to encode them together
// bytes is left aligned, uint is right aligned - use this to encode them together
bytes32 timestampAndBlockNumber = bytes32(bytes4(uint32(block.number))) | bytes32(uint256(uint40(block.timestamp)));
bytes32 timestampAndBlockNumber = bytes32(bytes4(uint32(block.number))) | bytes32(uint256(uint40(block.timestamp)));
// bytes32 timestampAndBlockNumber = bytes32(bytes4(uint32(999))) | bytes32(uint256(uint40(777)));
// bytes32 timestampAndBlockNumber = bytes32(bytes4(uint32(999))) | bytes32(uint256(uint40(777)));
queue.push2(queueRoot, timestampAndBlockNumber, bytes28(0));
queue.push2(queueRoot, timestampAndBlockNumber, bytes28(0));
emit queueTransactionAppended(queueTx, timestampAndBlockNumber);
}
}
function getQueueElement(uint queueIndex) public view returns(Lib_OVMCodec.QueueElement memory) {
function getQueueElement(uint queueIndex) public view returns(Lib_OVMCodec.QueueElement memory) {
...
@@ -282,11 +292,14 @@ contract OVM_CanonicalTransactionChain is OVM_BaseChain, Lib_AddressResolver { /
...
@@ -282,11 +292,14 @@ contract OVM_CanonicalTransactionChain is OVM_BaseChain, Lib_AddressResolver { /
require(transactionIndex == _totalElementsToAppend, "Not enough transactions supplied!");
require(transactionIndex == _totalElementsToAppend, "Not enough transactions supplied!");
bytes32 root = _getRoot(leaves);
bytes32 root = _getRoot(leaves);
uint numQueuedTransactions = _totalElementsToAppend - numSequencerTransactionsProcessed;
_appendBatch(
_appendBatch(
root,
root,
_totalElementsToAppend,
_totalElementsToAppend,
_totalElementsToAppend - numSequencerTransactionsProcessed
numQueuedTransactions
);
);
emit chainBatchAppended(nextQueueIndex-numQueuedTransactions, numQueuedTransactions);
}
}
function _validateBatchContext(BatchContext memory context, uint32 nextQueueIndex) internal {
function _validateBatchContext(BatchContext memory context, uint32 nextQueueIndex) internal {
...
...
packages/contracts/test/contracts/OVM/chain/OVM_CanonicalTransactionChain.spec.ts
View file @
fba4de0d
...
@@ -22,7 +22,7 @@ interface sequencerBatchContext {
...
@@ -22,7 +22,7 @@ interface sequencerBatchContext {
blockNumber
:
Number
blockNumber
:
Number
}
}
describe
.
only
(
'
OVM_CanonicalTransactionChain
'
,
()
=>
{
describe
(
'
OVM_CanonicalTransactionChain
'
,
()
=>
{
let
signer
:
Signer
let
signer
:
Signer
before
(
async
()
=>
{
before
(
async
()
=>
{
;[
signer
]
=
await
ethers
.
getSigners
()
;[
signer
]
=
await
ethers
.
getSigners
()
...
...
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