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
e8018b4b
Commit
e8018b4b
authored
Jun 30, 2021
by
rajivpoc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed unused functions from core utils
parent
e6151443
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
4 additions
and
103 deletions
+4
-103
sequencer-batch.ts
packages/core-utils/src/coders/sequencer-batch.ts
+0
-4
addresses.ts
packages/core-utils/src/common/addresses.ts
+0
-10
common.ts
packages/core-utils/src/common/common.ts
+0
-9
hex-strings.ts
packages/core-utils/src/common/hex-strings.ts
+0
-35
index.ts
packages/core-utils/src/common/index.ts
+0
-2
fees.ts
packages/core-utils/src/fees.ts
+1
-3
addresses.spec.ts
packages/core-utils/test/common/addresses.spec.ts
+0
-20
hex-utils.spec.ts
packages/core-utils/test/common/hex-utils.spec.ts
+1
-17
fees.spec.ts
packages/core-utils/test/fees/fees.spec.ts
+1
-2
service.ts
...data-transport-layer/src/services/l1-ingestion/service.ts
+1
-1
No files found.
packages/core-utils/src/coders/sequencer-batch.ts
View file @
e8018b4b
...
...
@@ -15,10 +15,6 @@ export interface AppendSequencerBatchParams {
transactions
:
string
[]
// total_size_bytes[],total_size_bytes[]
}
/**********************
* Internal Functions *
*********************/
const
APPEND_SEQUENCER_BATCH_METHOD_ID
=
'
appendSequencerBatch()
'
export
const
encodeAppendSequencerBatch
=
(
...
...
packages/core-utils/src/common/addresses.ts
deleted
100644 → 0
View file @
e6151443
/* Imports: External */
import
{
ethers
}
from
'
ethers
'
/* Imports: Internal */
import
{
getRandomHexString
}
from
'
./hex-strings
'
/* @returns a random Ethereum address as a string of 40 hex characters, normalized as a checksum address. */
export
const
getRandomAddress
=
():
string
=>
{
return
ethers
.
utils
.
getAddress
(
getRandomHexString
(
20
))
}
packages/core-utils/src/common/common.ts
deleted
100644 → 0
View file @
e6151443
export
const
assert
=
(
condition
:
()
=>
boolean
,
reason
?:
string
)
=>
{
try
{
if
(
condition
()
===
false
)
{
throw
new
Error
(
`Assertion failed:
${
reason
}
`
)
}
}
catch
(
err
)
{
throw
new
Error
(
`Assertion failed:
${
reason
}
\n
${
err
}
`
)
}
}
packages/core-utils/src/common/hex-strings.ts
View file @
e8018b4b
...
...
@@ -27,16 +27,6 @@ export const add0x = (str: string): string => {
return
str
.
startsWith
(
'
0x
'
)
?
str
:
'
0x
'
+
str
}
/**
* Returns whether or not the provided string is a hex string.
*
* @param str The string to test.
* @returns True if the provided string is a hex string, false otherwise.
*/
export
const
isHexString
=
(
inp
:
any
):
boolean
=>
{
return
typeof
inp
===
'
string
'
&&
inp
.
startsWith
(
'
0x
'
)
}
/**
* Casts a hex string to a buffer.
*
...
...
@@ -88,30 +78,5 @@ export const padHexString = (str: string, length: number): string => {
}
}
export
const
getLen
=
(
pos
:
{
start
;
end
})
=>
(
pos
.
end
-
pos
.
start
)
*
2
export
const
encodeHex
=
(
val
:
any
,
len
:
number
)
=>
remove0x
(
BigNumber
.
from
(
val
).
toHexString
()).
padStart
(
len
,
'
0
'
)
export
const
toVerifiedBytes
=
(
val
:
string
,
len
:
number
)
=>
{
val
=
remove0x
(
val
)
if
(
val
.
length
!==
len
)
{
throw
new
Error
(
'
Invalid length!
'
)
}
return
val
}
/**
* @param byteLength The length of the hex string in bytes
* @returns a random hex string of the specified byteLength (string length will be byteLength*2)
*/
export
const
getRandomHexString
=
(
byteLength
:
number
):
string
=>
{
return
(
'
0x
'
+
[...
Array
(
byteLength
*
2
)]
.
map
(()
=>
{
return
Math
.
floor
(
Math
.
random
()
*
16
).
toString
(
16
)
})
.
join
(
''
)
)
}
packages/core-utils/src/common/index.ts
View file @
e8018b4b
export
*
from
'
./addresses
'
export
*
from
'
./hex-strings
'
export
*
from
'
./misc
'
export
*
from
'
./common
'
packages/core-utils/src/fees.ts
View file @
e8018b4b
...
...
@@ -5,14 +5,12 @@
import
{
BigNumber
}
from
'
ethers
'
import
{
remove0x
}
from
'
./common
'
const
hundredMillion
=
BigNumber
.
from
(
100
_000_000
)
const
feeScalar
=
10
_000_000
export
const
TxGasPrice
=
BigNumber
.
from
(
feeScalar
+
feeScalar
/
2
)
const
txDataZeroGas
=
4
const
txDataNonZeroGasEIP2028
=
16
const
overhead
=
4200
+
200
*
txDataNonZeroGasEIP2028
const
tenThousand
=
BigNumber
.
from
(
10
_000
)
export
const
TxGasPrice
=
BigNumber
.
from
(
feeScalar
+
feeScalar
/
2
)
export
interface
EncodableL2GasLimit
{
data
:
Buffer
|
string
l1GasPrice
:
BigNumber
|
number
...
...
packages/core-utils/test/common/addresses.spec.ts
deleted
100644 → 0
View file @
e6151443
import
{
expect
}
from
'
../setup
'
/* Imports: Internal */
import
{
getRandomAddress
}
from
'
../../src
'
describe
(
'
getRandomAddress
'
,
()
=>
{
const
random
=
global
.
Math
.
random
before
(
async
()
=>
{
global
.
Math
.
random
=
()
=>
0.5
})
after
(
async
()
=>
{
global
.
Math
.
random
=
random
})
it
(
'
returns a random address string
'
,
()
=>
{
expect
(
getRandomAddress
()).
to
.
equal
(
'
0x
'
+
'
88
'
.
repeat
(
20
))
})
})
packages/core-utils/test/common/hex-utils.spec.ts
View file @
e8018b4b
...
...
@@ -2,23 +2,7 @@ import { expect } from '../setup'
import
{
BigNumber
}
from
'
ethers
'
/* Imports: Internal */
import
{
getRandomHexString
,
toRpcHexString
}
from
'
../../src
'
describe
(
'
getRandomHexString
'
,
()
=>
{
const
random
=
global
.
Math
.
random
before
(
async
()
=>
{
global
.
Math
.
random
=
()
=>
0.5
})
after
(
async
()
=>
{
global
.
Math
.
random
=
random
})
it
(
'
returns a random address string of the specified length
'
,
()
=>
{
expect
(
getRandomHexString
(
8
)).
to
.
equal
(
'
0x
'
+
'
88
'
.
repeat
(
8
))
})
})
import
{
toRpcHexString
}
from
'
../../src
'
describe
(
'
toRpcHexString
'
,
()
=>
{
it
(
'
should parse 0
'
,
()
=>
{
...
...
packages/core-utils/test/fees/fees.spec.ts
View file @
e8018b4b
import
{
expect
}
from
'
../setup
'
import
*
as
fees
from
'
../../src/fees
'
import
{
BigNumber
,
utils
}
from
'
ethers
'
import
{
utils
}
from
'
ethers
'
const
hundredBillion
=
10
**
11
const
million
=
10
**
6
describe
(
'
Fees
'
,
()
=>
{
it
(
'
should count zeros and ones
'
,
()
=>
{
...
...
packages/data-transport-layer/src/services/l1-ingestion/service.ts
View file @
e8018b4b
/* Imports: External */
import
{
fromHexString
,
EventArgsAddressSet
}
from
'
@eth-optimism/core-utils
'
import
{
fromHexString
}
from
'
@eth-optimism/core-utils
'
import
{
BaseService
,
Metrics
}
from
'
@eth-optimism/common-ts
'
import
{
JsonRpcProvider
}
from
'
@ethersproject/providers
'
import
{
LevelUp
}
from
'
levelup
'
...
...
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