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
952b5267
Commit
952b5267
authored
Jan 27, 2022
by
Matthew Slipper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix itests
parent
3a726175
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
124 additions
and
9 deletions
+124
-9
check-block-hashes.ts
integration-tests/tasks/check-block-hashes.ts
+1
-0
nightly.spec.ts
integration-tests/test/env-specific/nightly.spec.ts
+109
-0
hardfork.spec.ts
integration-tests/test/hardfork.spec.ts
+11
-9
utils.ts
integration-tests/test/shared/utils.ts
+3
-0
No files found.
integration-tests/tasks/check-block-hashes.ts
View file @
952b5267
import
{
task
}
from
'
hardhat/config
'
import
{
task
}
from
'
hardhat/config
'
import
{
providers
}
from
'
ethers
'
import
{
providers
}
from
'
ethers
'
import
{
die
,
logStderr
}
from
'
../test/shared/utils
'
import
{
die
,
logStderr
}
from
'
../test/shared/utils
'
task
(
task
(
...
...
integration-tests/test/env-specific/nightly.spec.ts
0 → 100644
View file @
952b5267
import
{
Contract
}
from
'
ethers
'
import
{
ethers
}
from
'
hardhat
'
import
{
OptimismEnv
}
from
'
../shared/env
'
import
{
expect
}
from
'
../shared/setup
'
import
{
traceToGasByOpcode
}
from
'
../hardfork.spec
'
import
{
envConfig
}
from
'
../shared/utils
'
describe
(
'
Nightly
'
,
()
=>
{
before
(
async
function
()
{
if
(
!
envConfig
.
RUN_NIGHTLY_TESTS
)
{
this
.
skip
()
}
})
describe
(
'
Berlin Hardfork
'
,
()
=>
{
let
env
:
OptimismEnv
let
SimpleStorage
:
Contract
let
Precompiles
:
Contract
before
(
async
()
=>
{
env
=
await
OptimismEnv
.
new
()
SimpleStorage
=
await
ethers
.
getContractAt
(
'
SimpleStorage
'
,
'
0xE08fFE40748367ddc29B5A154331C73B7FCC13bD
'
,
env
.
l2Wallet
)
Precompiles
=
await
ethers
.
getContractAt
(
'
Precompiles
'
,
'
0x32E8Fbfd0C0bd1117112b249e997C27b0EC7cba2
'
,
env
.
l2Wallet
)
})
describe
(
'
EIP-2929
'
,
()
=>
{
it
(
'
should update the gas schedule
'
,
async
()
=>
{
const
tx
=
await
SimpleStorage
.
setValueNotXDomain
(
`0x
${
'
77
'
.
repeat
(
32
)}
`
)
await
tx
.
wait
()
const
berlinTrace
=
await
env
.
l2Provider
.
send
(
'
debug_traceTransaction
'
,
[
tx
.
hash
]
)
const
preBerlinTrace
=
await
env
.
l2Provider
.
send
(
'
debug_traceTransaction
'
,
[
'
0x2bb346f53544c5711502fbcbd1d78dc4fb61ca5f9390b9d6d67f1a3a77de7c39
'
]
)
const
berlinSstoreCosts
=
traceToGasByOpcode
(
berlinTrace
.
structLogs
,
'
SSTORE
'
)
const
preBerlinSstoreCosts
=
traceToGasByOpcode
(
preBerlinTrace
.
structLogs
,
'
SSTORE
'
)
expect
(
preBerlinSstoreCosts
).
to
.
eq
(
80000
)
expect
(
berlinSstoreCosts
).
to
.
eq
(
5300
)
})
})
describe
(
'
EIP-2565
'
,
()
=>
{
it
(
'
should become cheaper
'
,
async
()
=>
{
const
tx
=
await
Precompiles
.
expmod
(
64
,
1
,
64
,
{
gasLimit
:
5
_000_000
})
await
tx
.
wait
()
const
berlinTrace
=
await
env
.
l2Provider
.
send
(
'
debug_traceTransaction
'
,
[
tx
.
hash
]
)
const
preBerlinTrace
=
await
env
.
l2Provider
.
send
(
'
debug_traceTransaction
'
,
[
'
0x7ba7d273449b0062448fe5e7426bb169a032ce189d0e3781eb21079e85c2d7d5
'
]
)
expect
(
berlinTrace
.
gas
).
to
.
be
.
lt
(
preBerlinTrace
.
gas
)
})
})
describe
(
'
Berlin Additional (L1 London)
'
,
()
=>
{
describe
(
'
EIP-3529
'
,
()
=>
{
it
(
'
should remove the refund for selfdestruct
'
,
async
()
=>
{
const
Factory__SelfDestruction
=
await
ethers
.
getContractFactory
(
'
SelfDestruction
'
,
env
.
l2Wallet
)
const
SelfDestruction
=
await
Factory__SelfDestruction
.
deploy
()
const
tx
=
await
SelfDestruction
.
destruct
({
gasLimit
:
5
_000_000
})
await
tx
.
wait
()
const
berlinTrace
=
await
env
.
l2Provider
.
send
(
'
debug_traceTransaction
'
,
[
tx
.
hash
]
)
const
preBerlinTrace
=
await
env
.
l2Provider
.
send
(
'
debug_traceTransaction
'
,
[
'
0x948667349f00e996d9267e5c30d72fe7202a0ecdb88bab191e9a022bba6e4cb3
'
,
]
)
expect
(
berlinTrace
.
gas
).
to
.
be
.
gt
(
preBerlinTrace
.
gas
)
})
})
})
})
})
integration-tests/test/hardfork.spec.ts
View file @
952b5267
import
{
expect
}
from
'
./shared/setup
'
import
{
Contract
,
BigNumber
}
from
'
ethers
'
import
{
Contract
,
BigNumber
}
from
'
ethers
'
import
{
ethers
}
from
'
hardhat
'
import
{
ethers
}
from
'
hardhat
'
import
{
expect
}
from
'
./shared/setup
'
import
{
OptimismEnv
}
from
'
./shared/env
'
import
{
OptimismEnv
}
from
'
./shared/env
'
const
traceToGasByOpcode
=
(
structLogs
,
opcode
)
=>
{
export
const
traceToGasByOpcode
=
(
structLogs
,
opcode
)
=>
{
let
gas
=
0
let
gas
=
0
const
opcodes
=
[]
const
opcodes
=
[]
for
(
const
log
of
structLogs
)
{
for
(
const
log
of
structLogs
)
{
...
@@ -63,7 +63,7 @@ describe('Hard forks', () => {
...
@@ -63,7 +63,7 @@ describe('Hard forks', () => {
)
)
const
preBerlinTrace
=
await
env
.
l2Provider
.
send
(
const
preBerlinTrace
=
await
env
.
l2Provider
.
send
(
'
debug_traceTransaction
'
,
'
debug_traceTransaction
'
,
[
tx
.
hash
,
{
overrides
:
{
berlinBlock
:
tip
.
number
+
10
}
}]
[
tx
.
hash
,
{
overrides
:
{
berlinBlock
:
tip
.
number
*
2
}
}]
)
)
expect
(
berlinTrace
.
gas
).
to
.
not
.
eq
(
preBerlinTrace
.
gas
)
expect
(
berlinTrace
.
gas
).
to
.
not
.
eq
(
preBerlinTrace
.
gas
)
...
@@ -93,7 +93,7 @@ describe('Hard forks', () => {
...
@@ -93,7 +93,7 @@ describe('Hard forks', () => {
)
)
const
preBerlinTrace
=
await
env
.
l2Provider
.
send
(
const
preBerlinTrace
=
await
env
.
l2Provider
.
send
(
'
debug_traceTransaction
'
,
'
debug_traceTransaction
'
,
[
tx
.
hash
,
{
overrides
:
{
berlinBlock
:
tip
.
number
+
10
}
}]
[
tx
.
hash
,
{
overrides
:
{
berlinBlock
:
tip
.
number
*
2
}
}]
)
)
expect
(
berlinTrace
.
gas
).
to
.
be
.
lt
(
preBerlinTrace
.
gas
)
expect
(
berlinTrace
.
gas
).
to
.
be
.
lt
(
preBerlinTrace
.
gas
)
})
})
...
@@ -132,7 +132,7 @@ describe('Hard forks', () => {
...
@@ -132,7 +132,7 @@ describe('Hard forks', () => {
)
)
const
preBerlinTrace
=
await
env
.
l2Provider
.
send
(
const
preBerlinTrace
=
await
env
.
l2Provider
.
send
(
'
debug_traceTransaction
'
,
'
debug_traceTransaction
'
,
[
tx
.
hash
,
{
overrides
:
{
berlinBlock
:
tip
.
number
+
10
}
}]
[
tx
.
hash
,
{
overrides
:
{
berlinBlock
:
tip
.
number
*
2
}
}]
)
)
// Updating a non zero value to another non zero value should not change
// Updating a non zero value to another non zero value should not change
expect
(
berlinTrace
.
gas
).
to
.
deep
.
eq
(
preBerlinTrace
.
gas
)
expect
(
berlinTrace
.
gas
).
to
.
deep
.
eq
(
preBerlinTrace
.
gas
)
...
@@ -152,8 +152,9 @@ describe('Hard forks', () => {
...
@@ -152,8 +152,9 @@ describe('Hard forks', () => {
)
)
const
preBerlinTrace
=
await
env
.
l2Provider
.
send
(
const
preBerlinTrace
=
await
env
.
l2Provider
.
send
(
'
debug_traceTransaction
'
,
'
debug_traceTransaction
'
,
[
tx
.
hash
,
{
overrides
:
{
berlinBlock
:
tip
.
number
+
10
}
}]
[
tx
.
hash
,
{
overrides
:
{
berlinBlock
:
tip
.
number
*
2
}
}]
)
)
// Updating to a zero value from a non zero value should becomes
// Updating to a zero value from a non zero value should becomes
// more expensive due to this change being coupled with EIP-2929
// more expensive due to this change being coupled with EIP-2929
expect
(
berlinTrace
.
gas
).
to
.
be
.
gt
(
preBerlinTrace
.
gas
)
expect
(
berlinTrace
.
gas
).
to
.
be
.
gt
(
preBerlinTrace
.
gas
)
...
@@ -173,8 +174,9 @@ describe('Hard forks', () => {
...
@@ -173,8 +174,9 @@ describe('Hard forks', () => {
)
)
const
preBerlinTrace
=
await
env
.
l2Provider
.
send
(
const
preBerlinTrace
=
await
env
.
l2Provider
.
send
(
'
debug_traceTransaction
'
,
'
debug_traceTransaction
'
,
[
tx
.
hash
,
{
overrides
:
{
berlinBlock
:
tip
.
number
+
10
}
}]
[
tx
.
hash
,
{
overrides
:
{
berlinBlock
:
tip
.
number
*
2
}
}]
)
)
// Updating to a zero value from a non zero value should becomes
// Updating to a zero value from a non zero value should becomes
// more expensive due to this change being coupled with EIP-2929
// more expensive due to this change being coupled with EIP-2929
expect
(
berlinTrace
.
gas
).
to
.
be
.
gt
(
preBerlinTrace
.
gas
)
expect
(
berlinTrace
.
gas
).
to
.
be
.
gt
(
preBerlinTrace
.
gas
)
...
@@ -194,7 +196,7 @@ describe('Hard forks', () => {
...
@@ -194,7 +196,7 @@ describe('Hard forks', () => {
)
)
const
preBerlinTrace
=
await
env
.
l2Provider
.
send
(
const
preBerlinTrace
=
await
env
.
l2Provider
.
send
(
'
debug_traceTransaction
'
,
'
debug_traceTransaction
'
,
[
tx
.
hash
,
{
overrides
:
{
berlinBlock
:
tip
.
number
+
10
}
}]
[
tx
.
hash
,
{
overrides
:
{
berlinBlock
:
tip
.
number
*
2
}
}]
)
)
// The berlin execution should use more gas than the pre Berlin
// The berlin execution should use more gas than the pre Berlin
...
...
integration-tests/test/shared/utils.ts
View file @
952b5267
...
@@ -93,6 +93,9 @@ const procEnv = cleanEnv(process.env, {
...
@@ -93,6 +93,9 @@ const procEnv = cleanEnv(process.env, {
RUN_STRESS_TESTS
:
bool
({
RUN_STRESS_TESTS
:
bool
({
default
:
true
,
default
:
true
,
}),
}),
RUN_NIGHTLY_TESTS
:
bool
({
default
:
false
,
}),
MOCHA_TIMEOUT
:
num
({
MOCHA_TIMEOUT
:
num
({
default
:
120
_000
,
default
:
120
_000
,
...
...
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