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
7dc728ba
Commit
7dc728ba
authored
Mar 17, 2022
by
Mark Tyneway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
contracts: batch compression ratios in fetch-batches task
parent
2165fada
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
2 deletions
+26
-2
fetch-batches.ts
packages/contracts/tasks/fetch-batches.ts
+26
-2
No files found.
packages/contracts/tasks/fetch-batches.ts
View file @
7dc728ba
import
{
ethers
}
from
'
ethers
'
import
{
task
}
from
'
hardhat/config
'
import
*
as
types
from
'
hardhat/internal/core/params/argumentTypes
'
import
{
SequencerBatch
}
from
'
@eth-optimism/core-utils
'
import
{
BatchType
,
SequencerBatch
}
from
'
@eth-optimism/core-utils
'
import
{
names
}
from
'
../src/address-names
'
import
{
getContractFromArtifact
}
from
'
../src/deploy-utils
'
...
...
@@ -51,7 +51,31 @@ task('fetch-batches')
for
(
const
event
of
events
)
{
const
tx
=
await
provider
.
getTransaction
(
event
.
transactionHash
)
const
batch
=
(
SequencerBatch
as
any
).
fromHex
(
tx
.
data
)
batches
.
push
(
batch
.
toJSON
())
// Add an extra field to the resulting json
// so that the serialization sizes can be observed
const
json
=
batch
.
toJSON
()
json
.
sizes
=
{
legacy
:
0
,
zlib
:
0
,
}
// Create a copy of the batch to serialize in
// the alternative format
const
copy
=
(
SequencerBatch
as
any
).
fromHex
(
tx
.
data
)
if
(
batch
.
type
===
BatchType
.
ZLIB
)
{
copy
.
type
=
BatchType
.
LEGACY
json
.
sizes
.
legacy
=
copy
.
encode
().
length
json
.
sizes
.
zlib
=
batch
.
encode
().
length
}
else
{
copy
.
type
=
BatchType
.
ZLIB
json
.
sizes
.
zlib
=
copy
.
encode
().
length
json
.
sizes
.
legacy
=
batch
.
encode
().
length
}
json
.
compressionRatio
=
json
.
sizes
.
zlib
/
json
.
sizes
.
legacy
batches
.
push
(
json
)
}
}
...
...
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