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
5b943ecf
Commit
5b943ecf
authored
Jun 09, 2023
by
Mark Tyneway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: delete
Will speed up the test suite for this package by quite a bit
parent
8d7dcc70
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
126 deletions
+0
-126
calldata.json
packages/core-utils/test/fixtures/calldata.json
+0
-1
batch-encoding.spec.ts
packages/core-utils/test/optimism/batch-encoding.spec.ts
+0
-125
No files found.
packages/core-utils/test/fixtures/calldata.json
deleted
100644 → 0
View file @
8d7dcc70
This diff is collapsed.
Click to expand it.
packages/core-utils/test/optimism/batch-encoding.spec.ts
deleted
100644 → 0
View file @
8d7dcc70
import
'
../setup
'
/* Internal Imports */
import
{
expect
}
from
'
chai
'
import
{
encodeAppendSequencerBatch
,
decodeAppendSequencerBatch
,
sequencerBatch
,
BatchType
,
SequencerBatch
,
}
from
'
../../src
'
describe
(
'
BatchEncoder
'
,
function
()
{
this
.
timeout
(
10
_000
)
// eslint-disable-next-line @typescript-eslint/no-var-requires
const
data
=
require
(
'
../fixtures/calldata.json
'
)
describe
(
'
appendSequencerBatch
'
,
()
=>
{
it
(
'
legacy: should work with the simple case
'
,
()
=>
{
const
batch
=
{
shouldStartAtElement
:
0
,
totalElementsToAppend
:
0
,
contexts
:
[],
transactions
:
[],
type
:
BatchType
.
LEGACY
,
}
const
encoded
=
encodeAppendSequencerBatch
(
batch
)
const
decoded
=
decodeAppendSequencerBatch
(
encoded
)
expect
(
decoded
).
to
.
deep
.
equal
(
batch
)
})
it
(
'
legacy: should work with more complex case
'
,
()
=>
{
const
batch
=
{
shouldStartAtElement
:
10
,
totalElementsToAppend
:
1
,
contexts
:
[
{
numSequencedTransactions
:
2
,
numSubsequentQueueTransactions
:
1
,
timestamp
:
100
,
blockNumber
:
200
,
},
],
transactions
:
[
'
0x45423400000011
'
,
'
0x45423400000012
'
],
type
:
BatchType
.
LEGACY
,
}
const
encoded
=
encodeAppendSequencerBatch
(
batch
)
const
decoded
=
decodeAppendSequencerBatch
(
encoded
)
expect
(
decoded
).
to
.
deep
.
equal
(
batch
)
})
describe
(
'
mainnet data
'
,
()
=>
{
for
(
const
[
hash
,
calldata
]
of
Object
.
entries
(
data
))
{
// Deserialize the raw calldata
const
decoded
=
SequencerBatch
.
fromHex
<
SequencerBatch
>
(
calldata
as
string
)
it
(
`
${
hash
}
`
,
()
=>
{
const
encoded
=
decoded
.
toHex
()
expect
(
encoded
).
to
.
deep
.
equal
(
calldata
)
const
batch
=
SequencerBatch
.
decode
(
decoded
.
encode
())
expect
(
decoded
).
to
.
deep
.
eq
(
batch
)
})
it
(
`
${
hash
}
(compressed)`
,
()
=>
{
// Set the batch type to be zlib so that the batch
// is compressed
decoded
.
type
=
BatchType
.
ZLIB
// Encode a compressed batch
const
encodedCompressed
=
decoded
.
encode
()
// Decode a compressed batch
const
decodedPostCompressed
=
SequencerBatch
.
decode
<
SequencerBatch
>
(
encodedCompressed
)
// Expect that the batch type is detected
expect
(
decodedPostCompressed
.
type
).
to
.
eq
(
BatchType
.
ZLIB
)
// Expect that the contexts match
expect
(
decoded
.
contexts
).
to
.
deep
.
equal
(
decodedPostCompressed
.
contexts
)
for
(
const
[
i
,
tx
]
of
decoded
.
transactions
.
entries
())
{
const
got
=
decodedPostCompressed
.
transactions
[
i
]
expect
(
got
).
to
.
deep
.
eq
(
tx
)
}
// Reserialize the batch as legacy
decodedPostCompressed
.
type
=
BatchType
.
LEGACY
// Ensure that the original data can be recovered
const
encoded
=
decodedPostCompressed
.
toHex
()
expect
(
encoded
).
to
.
deep
.
equal
(
calldata
)
})
it
(
`
${
hash
}
: serialize txs`
,
()
=>
{
for
(
const
tx
of
decoded
.
transactions
)
{
tx
.
toTransaction
()
}
})
}
})
it
(
'
should throw an error
'
,
()
=>
{
const
batch
=
{
shouldStartAtElement
:
10
,
totalElementsToAppend
:
1
,
contexts
:
[
{
numSequencedTransactions
:
2
,
numSubsequentQueueTransactions
:
1
,
timestamp
:
100
,
blockNumber
:
200
,
},
],
transactions
:
[
'
0x454234000000112
'
,
'
0x45423400000012
'
],
}
expect
(()
=>
encodeAppendSequencerBatch
(
batch
)).
to
.
throw
(
'
Unexpected uneven hex string value!
'
)
expect
(()
=>
sequencerBatch
.
decode
(
'
0x
'
)).
to
.
throw
(
'
Incorrect function signature
'
)
})
})
})
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