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
fbd7f7dd
Unverified
Commit
fbd7f7dd
authored
Sep 15, 2021
by
elenadimitrova
Committed by
Kelvin Fichter
Nov 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reset the batch submitter to use old contracts
parent
3f590e33
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
58 deletions
+58
-58
batch-submitter.ts
...es/batch-submitter/src/batch-submitter/batch-submitter.ts
+2
-2
state-batch-submitter.ts
...ch-submitter/src/batch-submitter/state-batch-submitter.ts
+2
-2
tx-batch-submitter.ts
...batch-submitter/src/batch-submitter/tx-batch-submitter.ts
+6
-6
transaction-chain-contract.ts
packages/batch-submitter/src/transaction-chain-contract.ts
+4
-4
batch-submitter.spec.ts
...ch-submitter/test/batch-submitter/batch-submitter.spec.ts
+44
-44
No files found.
packages/batch-submitter/src/batch-submitter/batch-submitter.ts
View file @
fbd7f7dd
...
@@ -138,10 +138,10 @@ export abstract class BatchSubmitter {
...
@@ -138,10 +138,10 @@ export abstract class BatchSubmitter {
await
getContractFactory
(
'
Lib_AddressManager
'
,
this
.
signer
)
await
getContractFactory
(
'
Lib_AddressManager
'
,
this
.
signer
)
).
attach
(
this
.
addressManagerAddress
)
).
attach
(
this
.
addressManagerAddress
)
const
sccAddress
=
await
addressManager
.
getAddress
(
const
sccAddress
=
await
addressManager
.
getAddress
(
'
StateCommitmentChain
'
'
OVM_
StateCommitmentChain
'
)
)
const
ctcAddress
=
await
addressManager
.
getAddress
(
const
ctcAddress
=
await
addressManager
.
getAddress
(
'
CanonicalTransactionChain
'
'
OVM_
CanonicalTransactionChain
'
)
)
return
{
return
{
ctcAddress
,
ctcAddress
,
...
...
packages/batch-submitter/src/batch-submitter/state-batch-submitter.ts
View file @
fbd7f7dd
...
@@ -94,10 +94,10 @@ export class StateBatchSubmitter extends BatchSubmitter {
...
@@ -94,10 +94,10 @@ export class StateBatchSubmitter extends BatchSubmitter {
}
}
this
.
chainContract
=
(
this
.
chainContract
=
(
await
getContractFactory
(
'
StateCommitmentChain
'
,
this
.
signer
)
await
getContractFactory
(
'
OVM_
StateCommitmentChain
'
,
this
.
signer
)
).
attach
(
sccAddress
)
).
attach
(
sccAddress
)
this
.
ctcContract
=
(
this
.
ctcContract
=
(
await
getContractFactory
(
'
CanonicalTransactionChain
'
,
this
.
signer
)
await
getContractFactory
(
'
OVM_
CanonicalTransactionChain
'
,
this
.
signer
)
).
attach
(
ctcAddress
)
).
attach
(
ctcAddress
)
this
.
logger
.
info
(
'
Connected Optimism contracts
'
,
{
this
.
logger
.
info
(
'
Connected Optimism contracts
'
,
{
...
...
packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts
View file @
fbd7f7dd
...
@@ -107,13 +107,13 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
...
@@ -107,13 +107,13 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
return
return
}
}
const
unwrapped_CanonicalTransactionChain
=
(
const
unwrapped_
OVM_
CanonicalTransactionChain
=
(
await
getContractFactory
(
'
CanonicalTransactionChain
'
,
this
.
signer
)
await
getContractFactory
(
'
OVM_
CanonicalTransactionChain
'
,
this
.
signer
)
).
attach
(
ctcAddress
)
).
attach
(
ctcAddress
)
this
.
chainContract
=
new
CanonicalTransactionChainContract
(
this
.
chainContract
=
new
CanonicalTransactionChainContract
(
unwrapped_CanonicalTransactionChain
.
address
,
unwrapped_
OVM_
CanonicalTransactionChain
.
address
,
getContractInterface
(
'
CanonicalTransactionChain
'
),
getContractInterface
(
'
OVM_
CanonicalTransactionChain
'
),
this
.
signer
this
.
signer
)
)
this
.
logger
.
info
(
'
Initialized new CTC
'
,
{
this
.
logger
.
info
(
'
Initialized new CTC
'
,
{
...
@@ -573,12 +573,12 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
...
@@ -573,12 +573,12 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
)
)
const
addr
=
await
manager
.
getAddress
(
const
addr
=
await
manager
.
getAddress
(
'
ChainStorageContainer-CTC-batches
'
'
OVM_
ChainStorageContainer-CTC-batches
'
)
)
const
container
=
new
Contract
(
const
container
=
new
Contract
(
addr
,
addr
,
getNewContractInterface
(
'
I
ChainStorageContainer
'
),
getNewContractInterface
(
'
iOVM_
ChainStorageContainer
'
),
this
.
signer
.
provider
this
.
signer
.
provider
)
)
...
...
packages/batch-submitter/src/transaction-chain-contract.ts
View file @
fbd7f7dd
...
@@ -15,7 +15,7 @@ import {
...
@@ -15,7 +15,7 @@ import {
export
{
encodeAppendSequencerBatch
,
BatchContext
,
AppendSequencerBatchParams
}
export
{
encodeAppendSequencerBatch
,
BatchContext
,
AppendSequencerBatchParams
}
/*
/*
* CanonicalTransactionChainContract is a wrapper around a normal Ethers contract
*
OVM_
CanonicalTransactionChainContract is a wrapper around a normal Ethers contract
* where the `appendSequencerBatch(...)` function uses a specialized encoding for improved efficiency.
* where the `appendSequencerBatch(...)` function uses a specialized encoding for improved efficiency.
*/
*/
export
class
CanonicalTransactionChainContract
extends
Contract
{
export
class
CanonicalTransactionChainContract
extends
Contract
{
...
@@ -57,12 +57,12 @@ const APPEND_SEQUENCER_BATCH_METHOD_ID = keccak256(
...
@@ -57,12 +57,12 @@ const APPEND_SEQUENCER_BATCH_METHOD_ID = keccak256(
).
slice
(
2
,
10
)
).
slice
(
2
,
10
)
const
appendSequencerBatch
=
async
(
const
appendSequencerBatch
=
async
(
CanonicalTransactionChain
:
Contract
,
OVM_
CanonicalTransactionChain
:
Contract
,
batch
:
AppendSequencerBatchParams
,
batch
:
AppendSequencerBatchParams
,
options
?:
TransactionRequest
options
?:
TransactionRequest
):
Promise
<
TransactionResponse
>
=>
{
):
Promise
<
TransactionResponse
>
=>
{
return
CanonicalTransactionChain
.
signer
.
sendTransaction
({
return
OVM_
CanonicalTransactionChain
.
signer
.
sendTransaction
({
to
:
CanonicalTransactionChain
.
address
,
to
:
OVM_
CanonicalTransactionChain
.
address
,
data
:
getEncodedCalldata
(
batch
),
data
:
getEncodedCalldata
(
batch
),
...
options
,
...
options
,
})
})
...
...
packages/batch-submitter/test/batch-submitter/batch-submitter.spec.ts
View file @
fbd7f7dd
...
@@ -8,7 +8,7 @@ import ganache from 'ganache-core'
...
@@ -8,7 +8,7 @@ import ganache from 'ganache-core'
import
sinon
from
'
sinon
'
import
sinon
from
'
sinon
'
import
{
Web3Provider
}
from
'
@ethersproject/providers
'
import
{
Web3Provider
}
from
'
@ethersproject/providers
'
import
scc
from
'
@eth-optimism/contracts/artifacts/contracts/L1/rollup/
StateCommitmentChain.sol/
StateCommitmentChain.json
'
import
scc
from
'
@eth-optimism/contracts/artifacts/contracts/L1/rollup/
OVM_StateCommitmentChain.sol/OVM_
StateCommitmentChain.json
'
import
{
getContractInterface
,
predeploys
}
from
'
@eth-optimism/contracts
'
import
{
getContractInterface
,
predeploys
}
from
'
@eth-optimism/contracts
'
import
{
smockit
,
MockContract
}
from
'
@eth-optimism/smock
'
import
{
smockit
,
MockContract
}
from
'
@eth-optimism/smock
'
...
@@ -88,8 +88,8 @@ describe('BatchSubmitter', () => {
...
@@ -88,8 +88,8 @@ describe('BatchSubmitter', () => {
let
AddressManager
:
Contract
let
AddressManager
:
Contract
let
Mock__OVM_ExecutionManager
:
MockContract
let
Mock__OVM_ExecutionManager
:
MockContract
let
Mock__BondManager
:
MockContract
let
Mock__
OVM_
BondManager
:
MockContract
let
Mock__StateCommitmentChain
:
MockContract
let
Mock__
OVM_
StateCommitmentChain
:
MockContract
before
(
async
()
=>
{
before
(
async
()
=>
{
AddressManager
=
await
makeAddressManager
()
AddressManager
=
await
makeAddressManager
()
await
AddressManager
.
setAddress
(
await
AddressManager
.
setAddress
(
...
@@ -101,12 +101,12 @@ describe('BatchSubmitter', () => {
...
@@ -101,12 +101,12 @@ describe('BatchSubmitter', () => {
await
getContractFactory
(
'
OVM_ExecutionManager
'
)
await
getContractFactory
(
'
OVM_ExecutionManager
'
)
)
)
Mock__BondManager
=
await
smockit
(
Mock__
OVM_
BondManager
=
await
smockit
(
await
getContractFactory
(
'
BondManager
'
)
await
getContractFactory
(
'
OVM_
BondManager
'
)
)
)
Mock__StateCommitmentChain
=
await
smockit
(
Mock__
OVM_
StateCommitmentChain
=
await
smockit
(
await
getContractFactory
(
'
StateCommitmentChain
'
)
await
getContractFactory
(
'
OVM_
StateCommitmentChain
'
)
)
)
await
setProxyTarget
(
await
setProxyTarget
(
...
@@ -117,82 +117,82 @@ describe('BatchSubmitter', () => {
...
@@ -117,82 +117,82 @@ describe('BatchSubmitter', () => {
await
setProxyTarget
(
await
setProxyTarget
(
AddressManager
,
AddressManager
,
'
BondManager
'
,
'
OVM_
BondManager
'
,
Mock__BondManager
Mock__
OVM_
BondManager
)
)
await
setProxyTarget
(
await
setProxyTarget
(
AddressManager
,
AddressManager
,
'
StateCommitmentChain
'
,
'
OVM_
StateCommitmentChain
'
,
Mock__StateCommitmentChain
Mock__
OVM_
StateCommitmentChain
)
)
Mock__StateCommitmentChain
.
smocked
.
canOverwrite
.
will
.
return
.
with
(
false
)
Mock__
OVM_
StateCommitmentChain
.
smocked
.
canOverwrite
.
will
.
return
.
with
(
false
)
Mock__OVM_ExecutionManager
.
smocked
.
getMaxTransactionGasLimit
.
will
.
return
.
with
(
Mock__OVM_ExecutionManager
.
smocked
.
getMaxTransactionGasLimit
.
will
.
return
.
with
(
MAX_GAS_LIMIT
MAX_GAS_LIMIT
)
)
Mock__BondManager
.
smocked
.
isCollateralized
.
will
.
return
.
with
(
true
)
Mock__
OVM_
BondManager
.
smocked
.
isCollateralized
.
will
.
return
.
with
(
true
)
})
})
let
Factory__CanonicalTransactionChain
:
ContractFactory
let
Factory__
OVM_
CanonicalTransactionChain
:
ContractFactory
let
Factory__StateCommitmentChain
:
ContractFactory
let
Factory__
OVM_
StateCommitmentChain
:
ContractFactory
before
(
async
()
=>
{
before
(
async
()
=>
{
Factory__CanonicalTransactionChain
=
await
getContractFactory
(
Factory__
OVM_
CanonicalTransactionChain
=
await
getContractFactory
(
'
CanonicalTransactionChain
'
'
OVM_
CanonicalTransactionChain
'
)
)
Factory__StateCommitmentChain
=
await
getContractFactory
(
Factory__
OVM_
StateCommitmentChain
=
await
getContractFactory
(
'
StateCommitmentChain
'
'
OVM_
StateCommitmentChain
'
)
)
Factory__StateCommitmentChain
=
Factory__StateCommitmentChain
.
connect
(
signer
)
Factory__StateCommitmentChain
=
Factory__StateCommitmentChain
.
connect
(
signer
)
})
})
let
CanonicalTransactionChain
:
CanonicalTransactionChainContract
let
OVM_
CanonicalTransactionChain
:
CanonicalTransactionChainContract
let
StateCommitmentChain
:
Contract
let
OVM_
StateCommitmentChain
:
Contract
let
l2Provider
:
MockchainProvider
let
l2Provider
:
MockchainProvider
beforeEach
(
async
()
=>
{
beforeEach
(
async
()
=>
{
const
unwrapped_CanonicalTransactionChain
=
const
unwrapped_
OVM_
CanonicalTransactionChain
=
await
Factory__CanonicalTransactionChain
.
deploy
(
await
Factory__
OVM_
CanonicalTransactionChain
.
deploy
(
AddressManager
.
address
,
AddressManager
.
address
,
FORCE_INCLUSION_PERIOD_SECONDS
FORCE_INCLUSION_PERIOD_SECONDS
)
)
await
unwrapped_CanonicalTransactionChain
.
init
()
await
unwrapped_
OVM_
CanonicalTransactionChain
.
init
()
await
AddressManager
.
setAddress
(
await
AddressManager
.
setAddress
(
'
CanonicalTransactionChain
'
,
'
OVM_
CanonicalTransactionChain
'
,
unwrapped_CanonicalTransactionChain
.
address
unwrapped_
OVM_
CanonicalTransactionChain
.
address
)
)
CanonicalTransactionChain
=
new
CanonicalTransactionChainContract
(
OVM_
CanonicalTransactionChain
=
new
CanonicalTransactionChainContract
(
unwrapped_CanonicalTransactionChain
.
address
,
unwrapped_
OVM_
CanonicalTransactionChain
.
address
,
getContractInterface
(
'
CanonicalTransactionChain
'
),
getContractInterface
(
'
OVM_
CanonicalTransactionChain
'
),
sequencer
sequencer
)
)
const
unwrapped_StateCommitmentChain
=
const
unwrapped_
OVM_
StateCommitmentChain
=
await
Factory__StateCommitmentChain
.
deploy
(
await
Factory__
OVM_
StateCommitmentChain
.
deploy
(
AddressManager
.
address
,
AddressManager
.
address
,
0
,
// fraudProofWindowSeconds
0
,
// fraudProofWindowSeconds
0
// sequencerPublishWindowSeconds
0
// sequencerPublishWindowSeconds
)
)
await
unwrapped_StateCommitmentChain
.
init
()
await
unwrapped_
OVM_
StateCommitmentChain
.
init
()
await
AddressManager
.
setAddress
(
await
AddressManager
.
setAddress
(
'
StateCommitmentChain
'
,
'
OVM_
StateCommitmentChain
'
,
unwrapped_StateCommitmentChain
.
address
unwrapped_
OVM_
StateCommitmentChain
.
address
)
)
StateCommitmentChain
=
new
Contract
(
OVM_
StateCommitmentChain
=
new
Contract
(
unwrapped_StateCommitmentChain
.
address
,
unwrapped_
OVM_
StateCommitmentChain
.
address
,
getContractInterface
(
'
StateCommitmentChain
'
),
getContractInterface
(
'
OVM_
StateCommitmentChain
'
),
sequencer
sequencer
)
)
l2Provider
=
new
MockchainProvider
(
l2Provider
=
new
MockchainProvider
(
CanonicalTransactionChain
.
address
,
OVM_
CanonicalTransactionChain
.
address
,
StateCommitmentChain
.
address
OVM_
StateCommitmentChain
.
address
)
)
})
})
...
@@ -241,7 +241,7 @@ describe('BatchSubmitter', () => {
...
@@ -241,7 +241,7 @@ describe('BatchSubmitter', () => {
let
batchSubmitter
let
batchSubmitter
beforeEach
(
async
()
=>
{
beforeEach
(
async
()
=>
{
for
(
let
i
=
1
;
i
<
15
;
i
++
)
{
for
(
let
i
=
1
;
i
<
15
;
i
++
)
{
await
CanonicalTransactionChain
.
enqueue
(
await
OVM_
CanonicalTransactionChain
.
enqueue
(
'
0x
'
+
'
01
'
.
repeat
(
20
),
'
0x
'
+
'
01
'
.
repeat
(
20
),
50
_000
,
50
_000
,
'
0x
'
+
i
.
toString
().
repeat
(
64
),
'
0x
'
+
i
.
toString
().
repeat
(
64
),
...
@@ -256,7 +256,7 @@ describe('BatchSubmitter', () => {
...
@@ -256,7 +256,7 @@ describe('BatchSubmitter', () => {
it
(
'
should submit a sequencer batch correctly
'
,
async
()
=>
{
it
(
'
should submit a sequencer batch correctly
'
,
async
()
=>
{
l2Provider
.
setNumBlocksToReturn
(
5
)
l2Provider
.
setNumBlocksToReturn
(
5
)
const
nextQueueElement
=
await
getQueueElement
(
const
nextQueueElement
=
await
getQueueElement
(
CanonicalTransactionChain
OVM_
CanonicalTransactionChain
)
)
l2Provider
.
setL2BlockData
(
l2Provider
.
setL2BlockData
(
{
{
...
@@ -304,7 +304,7 @@ describe('BatchSubmitter', () => {
...
@@ -304,7 +304,7 @@ describe('BatchSubmitter', () => {
}
as
any
)
}
as
any
)
// Turn blocks 3-5 into sequencer txs
// Turn blocks 3-5 into sequencer txs
const
nextQueueElement
=
await
getQueueElement
(
const
nextQueueElement
=
await
getQueueElement
(
CanonicalTransactionChain
,
OVM_
CanonicalTransactionChain
,
2
2
)
)
l2Provider
.
setL2BlockData
(
l2Provider
.
setL2BlockData
(
...
@@ -395,7 +395,7 @@ describe('BatchSubmitter', () => {
...
@@ -395,7 +395,7 @@ describe('BatchSubmitter', () => {
let
stateBatchSubmitter
let
stateBatchSubmitter
beforeEach
(
async
()
=>
{
beforeEach
(
async
()
=>
{
for
(
let
i
=
1
;
i
<
15
;
i
++
)
{
for
(
let
i
=
1
;
i
<
15
;
i
++
)
{
await
CanonicalTransactionChain
.
enqueue
(
await
OVM_
CanonicalTransactionChain
.
enqueue
(
'
0x
'
+
'
01
'
.
repeat
(
20
),
'
0x
'
+
'
01
'
.
repeat
(
20
),
50
_000
,
50
_000
,
'
0x
'
+
i
.
toString
().
repeat
(
64
),
'
0x
'
+
i
.
toString
().
repeat
(
64
),
...
@@ -409,7 +409,7 @@ describe('BatchSubmitter', () => {
...
@@ -409,7 +409,7 @@ describe('BatchSubmitter', () => {
l2Provider
.
setNumBlocksToReturn
(
5
)
l2Provider
.
setNumBlocksToReturn
(
5
)
const
nextQueueElement
=
await
getQueueElement
(
const
nextQueueElement
=
await
getQueueElement
(
CanonicalTransactionChain
OVM_
CanonicalTransactionChain
)
)
l2Provider
.
setL2BlockData
(
l2Provider
.
setL2BlockData
(
{
{
...
...
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