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
0af3d196
Unverified
Commit
0af3d196
authored
Nov 04, 2021
by
Kelvin Fichter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: lint files after fixing linting command issue
parent
45115399
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
23 additions
and
76 deletions
+23
-76
tx-batch-submitter.ts
...batch-submitter/src/batch-submitter/tx-batch-submitter.ts
+8
-8
tx-submission.ts
packages/batch-submitter/src/utils/tx-submission.ts
+1
-1
batch-submitter.spec.ts
...ch-submitter/test/batch-submitter/batch-submitter.spec.ts
+3
-40
mockchain-provider.ts
...atch-submitter/test/batch-submitter/mockchain-provider.ts
+0
-1
constants.ts
packages/batch-submitter/test/helpers/constants.ts
+0
-1
tx-submission.spec.ts
packages/batch-submitter/test/utils/tx-submission.spec.ts
+2
-6
simple-db.ts
packages/data-transport-layer/src/db/simple-db.ts
+2
-2
sequencer-batch-appended.ts
...ervices/l1-ingestion/handlers/sequencer-batch-appended.ts
+1
-5
service.ts
...data-transport-layer/src/services/l1-ingestion/service.ts
+1
-1
transaction.ts
...t-layer/src/services/l2-ingestion/handlers/transaction.ts
+1
-5
service.ts
...data-transport-layer/src/services/l2-ingestion/service.ts
+3
-3
service.ts
packages/data-transport-layer/src/services/main/service.ts
+1
-1
service.ts
packages/data-transport-layer/src/services/server/service.ts
+0
-1
utils.ts
packages/regenesis-surgery/scripts/utils.ts
+0
-1
No files found.
packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts
View file @
0af3d196
...
...
@@ -370,8 +370,9 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
}
let
isEqual
=
true
const
[
queueEleHash
,
timestamp
,
blockNumber
]
=
await
this
.
chainContract
.
getQueueElement
(
queueIndex
)
const
[,
timestamp
,
blockNumber
]
=
await
this
.
chainContract
.
getQueueElement
(
queueIndex
)
// TODO: Verify queue element hash equality. The queue element hash can be computed with:
// keccak256( abi.encode( msg.sender, _target, _gasLimit, _data))
...
...
@@ -445,7 +446,7 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
if
(
nextQueueIndex
>=
totalQueueElements
)
{
break
}
const
[
queueEleHash
,
timestamp
,
blockNumber
]
=
const
[,
timestamp
,
blockNumber
]
=
await
this
.
chainContract
.
getQueueElement
(
nextQueueIndex
)
if
(
timestamp
<
ele
.
timestamp
||
blockNumber
<
ele
.
blockNumber
)
{
...
...
@@ -506,7 +507,7 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
const
totalQueueElements
=
pendingQueueElements
+
nextRemoteQueueElements
if
(
nextQueueIndex
<
totalQueueElements
)
{
const
[
queueEleHash
,
queueTimestamp
,
queueBlockNumber
]
=
const
[,
queueTimestamp
,
queueBlockNumber
]
=
await
this
.
chainContract
.
getQueueElement
(
nextQueueIndex
)
latestTimestamp
=
queueTimestamp
latestBlockNumber
=
queueBlockNumber
...
...
@@ -611,8 +612,6 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
// convert to bytes27
meta
=
meta
.
slice
(
10
)
const
totalElements
=
meta
.
slice
(
-
10
)
const
nextQueueIndex
=
meta
.
slice
(
-
20
,
-
10
)
const
lastTimestamp
=
parseInt
(
meta
.
slice
(
-
30
,
-
20
),
16
)
const
lastBlockNumber
=
parseInt
(
meta
.
slice
(
-
40
,
-
30
),
16
)
this
.
logger
.
debug
(
'
Retrieved timestamp and block number from CTC
'
,
{
...
...
@@ -627,8 +626,9 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
queueIndex
:
number
,
queueElement
:
BatchElement
):
Promise
<
BatchElement
>
{
const
[
queueEleHash
,
timestamp
,
blockNumber
]
=
await
this
.
chainContract
.
getQueueElement
(
queueIndex
)
const
[,
timestamp
,
blockNumber
]
=
await
this
.
chainContract
.
getQueueElement
(
queueIndex
)
if
(
timestamp
>
queueElement
.
timestamp
&&
...
...
packages/batch-submitter/src/utils/tx-submission.ts
View file @
0af3d196
import
{
Signer
,
utils
,
ethers
,
PopulatedTransaction
}
from
'
ethers
'
import
{
Signer
,
ethers
,
PopulatedTransaction
}
from
'
ethers
'
import
{
TransactionReceipt
,
TransactionResponse
,
...
...
packages/batch-submitter/test/batch-submitter/batch-submitter.spec.ts
View file @
0af3d196
...
...
@@ -4,12 +4,10 @@ import { expect } from '../setup'
import
{
ethers
}
from
'
hardhat
'
import
'
@nomiclabs/hardhat-ethers
'
import
{
Signer
,
ContractFactory
,
Contract
,
BigNumber
}
from
'
ethers
'
import
ganache
from
'
ganache-core
'
import
sinon
from
'
sinon
'
import
{
Web3Provider
}
from
'
@ethersproject/providers
'
import
scc
from
'
@eth-optimism/contracts/artifacts/contracts/L1/rollup/StateCommitmentChain.sol/StateCommitmentChain.json
'
import
{
getContractInterface
,
predeploys
}
from
'
@eth-optimism/contracts
'
import
{
getContractInterface
}
from
'
@eth-optimism/contracts
'
import
{
smockit
,
MockContract
}
from
'
@eth-optimism/smock
'
import
{
getContractFactory
}
from
'
old-contracts
'
...
...
@@ -27,27 +25,19 @@ import {
StateBatchSubmitter
,
TX_BATCH_SUBMITTER_LOG_TAG
,
STATE_BATCH_SUBMITTER_LOG_TAG
,
BatchSubmitter
,
YnatmTransactionSubmitter
,
ResubmissionConfig
,
}
from
'
../../src
'
import
{
QueueOrigin
,
Batch
,
Signature
,
remove0x
,
}
from
'
@eth-optimism/core-utils
'
import
{
QueueOrigin
,
Batch
,
remove0x
}
from
'
@eth-optimism/core-utils
'
import
{
Logger
,
Metrics
}
from
'
@eth-optimism/common-ts
'
const
DUMMY_ADDRESS
=
'
0x
'
+
'
00
'
.
repeat
(
20
)
const
EXAMPLE_STATE_ROOT
=
'
0x16b7f83f409c7195b1f4fde5652f1b54a4477eacb6db7927691becafba5f8801
'
const
MAX_GAS_LIMIT
=
8
_000_000
const
MAX_TX_SIZE
=
100
_000
const
MIN_TX_SIZE
=
1
_000
const
MIN_GAS_PRICE_IN_GWEI
=
1
const
MAX_GAS_PRICE_IN_GWEI
=
70
const
GAS_RETRY_INCREMENT
=
5
const
GAS_THRESHOLD_IN_GWEI
=
120
...
...
@@ -67,13 +57,9 @@ const getQueueElement = async (
const
nextQueueElement
=
await
ctcContract
.
getQueueElement
(
nextQueueIndex
)
return
nextQueueElement
}
const
DUMMY_SIG
:
Signature
=
{
r
:
'
11
'
.
repeat
(
32
),
s
:
'
22
'
.
repeat
(
32
),
v
:
1
,
}
// A transaction batch submitter which skips the validate batch check
class
TransactionBatchSubmitter
extends
RealTransactionBatchSubmitter
{
// eslint-disable-next-line @typescript-eslint/no-unused-vars
protected
async
_validateBatch
(
batch
:
Batch
):
Promise
<
boolean
>
{
return
true
}
...
...
@@ -250,11 +236,6 @@ describe('BatchSubmitter', () => {
describe
(
'
TransactionBatchSubmitter
'
,
()
=>
{
describe
(
'
submitNextBatch
'
,
()
=>
{
const
enqueuedElements
:
Array
<
{
blockNumber
:
number
timestamp
:
number
}
>
=
[]
let
batchSubmitter
beforeEach
(
async
()
=>
{
for
(
let
i
=
1
;
i
<
15
;
i
++
)
{
...
...
@@ -490,21 +471,3 @@ describe('BatchSubmitter', () => {
})
})
})
describe
(
'
Batch Submitter with Ganache
'
,
()
=>
{
let
signer
const
server
=
ganache
.
server
({
default_balance_ether
:
420
,
blockTime
:
2
_000
,
})
const
provider
=
new
Web3Provider
(
ganache
.
provider
())
before
(
async
()
=>
{
await
server
.
listen
(
3001
)
signer
=
await
provider
.
getSigner
()
})
after
(
async
()
=>
{
await
server
.
close
()
})
})
packages/batch-submitter/test/batch-submitter/mockchain-provider.ts
View file @
0af3d196
...
...
@@ -120,7 +120,6 @@ export class MockchainProvider extends providers.JsonRpcProvider {
}
private
_toL2Block
(
block
:
UnformattedL2Block
):
L2Block
{
const
txType
:
number
=
parseInt
(
block
.
transactions
[
0
].
signatureHashType
,
10
)
const
l1BlockNumber
:
number
=
parseInt
(
block
.
transactions
[
0
].
l1BlockNumber
,
10
...
...
packages/batch-submitter/test/helpers/constants.ts
View file @
0af3d196
/* External Imports */
import
{
ethers
}
from
'
ethers
'
import
{
defaultAccounts
}
from
'
ethereum-waffle
'
export
const
FORCE_INCLUSION_PERIOD_SECONDS
=
600
...
...
packages/batch-submitter/test/utils/tx-submission.spec.ts
View file @
0af3d196
...
...
@@ -89,7 +89,6 @@ describe('submitTransactionWithYNATM', async () => {
// than our resubmission timeout
const
resubmissionTimeout
=
100
const
txReceiptDelay
=
resubmissionTimeout
*
3
const
numConfirmations
=
3
let
lastGasPrice
=
BigNumber
.
from
(
0
)
// Create a transaction which has a gas price that we will watch increment
const
tx
=
{
...
...
@@ -106,10 +105,7 @@ describe('submitTransactionWithYNATM', async () => {
hash
:
'
dummy hash
'
,
}
as
TransactionResponse
}
const
waitForTransaction
=
async
(
hash
:
string
,
_numConfirmations
:
number
):
Promise
<
TransactionReceipt
>
=>
{
const
waitForTransaction
=
async
():
Promise
<
TransactionReceipt
>
=>
{
await
new
Promise
((
r
)
=>
setTimeout
(
r
,
txReceiptDelay
))
return
{}
as
TransactionReceipt
}
...
...
@@ -117,7 +113,7 @@ describe('submitTransactionWithYNATM', async () => {
getGasPrice
:
async
()
=>
ethers
.
BigNumber
.
from
(
0
),
sendTransaction
,
provider
:
{
waitForTransaction
,
waitForTransaction
:
waitForTransaction
as
any
,
},
}
as
Signer
const
config
:
ResubmissionConfig
=
{
...
...
packages/data-transport-layer/src/db/simple-db.ts
View file @
0af3d196
...
...
@@ -20,7 +20,7 @@ export class SimpleDB {
endIndex
:
number
):
Promise
<
TEntry
[]
|
[]
>
{
try
{
return
new
Promise
<
any
[]
>
((
resolve
,
reject
)
=>
{
return
new
Promise
<
any
[]
>
((
resolve
)
=>
{
const
entries
:
any
[]
=
[]
this
.
db
.
createValueStream
({
...
...
@@ -30,7 +30,7 @@ export class SimpleDB {
.
on
(
'
data
'
,
(
transaction
:
string
)
=>
{
entries
.
push
(
JSON
.
parse
(
transaction
))
})
.
on
(
'
error
'
,
(
err
:
any
)
=>
{
.
on
(
'
error
'
,
()
=>
{
resolve
(
null
)
})
.
on
(
'
close
'
,
()
=>
{
...
...
packages/data-transport-layer/src/services/l1-ingestion/handlers/sequencer-batch-appended.ts
View file @
0af3d196
...
...
@@ -17,11 +17,7 @@ import {
TransactionEntry
,
EventHandlerSet
,
}
from
'
../../../types
'
import
{
SEQUENCER_ENTRYPOINT_ADDRESS
,
SEQUENCER_GAS_LIMIT
,
parseSignatureVParam
,
}
from
'
../../../utils
'
import
{
SEQUENCER_GAS_LIMIT
,
parseSignatureVParam
}
from
'
../../../utils
'
import
{
MissingElementError
}
from
'
./errors
'
export
const
handleEventsSequencerBatchAppended
:
EventHandlerSet
<
...
...
packages/data-transport-layer/src/services/l1-ingestion/service.ts
View file @
0af3d196
/* Imports: External */
import
{
fromHexString
,
FallbackProvider
}
from
'
@eth-optimism/core-utils
'
import
{
BaseService
,
Metrics
}
from
'
@eth-optimism/common-ts
'
import
{
BaseProvider
}
from
'
@ethersproject/providers
'
import
{
BaseProvider
}
from
'
@ethersproject/providers
'
import
{
LevelUp
}
from
'
levelup
'
import
{
constants
}
from
'
ethers
'
import
{
Gauge
,
Counter
}
from
'
prom-client
'
...
...
packages/data-transport-layer/src/services/l2-ingestion/handlers/transaction.ts
View file @
0af3d196
...
...
@@ -9,11 +9,7 @@ import {
StateRootEntry
,
TransactionEntry
,
}
from
'
../../../types
'
import
{
padHexString
,
SEQUENCER_GAS_LIMIT
,
parseSignatureVParam
,
}
from
'
../../../utils
'
import
{
padHexString
,
parseSignatureVParam
}
from
'
../../../utils
'
export
const
handleSequencerBlock
=
{
parseBlock
:
async
(
...
...
packages/data-transport-layer/src/services/l2-ingestion/service.ts
View file @
0af3d196
...
...
@@ -89,9 +89,9 @@ export class L2IngestionService extends BaseService<L2IngestionServiceOptions> {
this
.
state
.
l2RpcProvider
=
typeof
this
.
options
.
l2RpcProvider
===
'
string
'
?
new
StaticJsonRpcProvider
({
url
:
this
.
options
.
l2RpcProvider
,
headers
:
{
'
User-Agent
'
:
'
data-transport-layer
'
},
})
url
:
this
.
options
.
l2RpcProvider
,
headers
:
{
'
User-Agent
'
:
'
data-transport-layer
'
},
})
:
this
.
options
.
l2RpcProvider
}
...
...
packages/data-transport-layer/src/services/main/service.ts
View file @
0af3d196
/* Imports: External */
import
{
BaseService
,
Logger
,
Metrics
}
from
'
@eth-optimism/common-ts
'
import
{
BaseService
,
Metrics
}
from
'
@eth-optimism/common-ts
'
import
{
LevelUp
}
from
'
levelup
'
import
level
from
'
level
'
...
...
packages/data-transport-layer/src/services/server/service.ts
View file @
0af3d196
...
...
@@ -2,7 +2,6 @@
import
{
BaseService
,
Logger
,
Metrics
}
from
'
@eth-optimism/common-ts
'
import
express
,
{
Request
,
Response
}
from
'
express
'
import
promBundle
from
'
express-prom-bundle
'
import
{
Gauge
}
from
'
prom-client
'
import
cors
from
'
cors
'
import
{
BigNumber
}
from
'
ethers
'
import
{
JsonRpcProvider
}
from
'
@ethersproject/providers
'
...
...
packages/regenesis-surgery/scripts/utils.ts
View file @
0af3d196
...
...
@@ -14,7 +14,6 @@ import {
StateDump
,
SurgeryConfigs
,
GenesisFile
,
SupportedNetworks
,
}
from
'
./types
'
import
{
UNISWAP_V3_FACTORY_ADDRESS
}
from
'
./constants
'
...
...
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