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
453e8c53
Unverified
Commit
453e8c53
authored
Feb 07, 2022
by
smartcontracts
Committed by
GitHub
Feb 07, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2153 from ethereum-optimism/sc/sdk-integration-3
feat(itests): remove Watcher from fundUser
parents
c826fddb
3535fb2f
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
46 deletions
+33
-46
native-eth-ovm-calls.spec.ts
integration-tests/test/native-eth-ovm-calls.spec.ts
+3
-13
rpc.spec.ts
integration-tests/test/rpc.spec.ts
+1
-1
env.ts
integration-tests/test/shared/env.ts
+8
-8
utils.ts
integration-tests/test/shared/utils.ts
+20
-18
stress-tests.spec.ts
integration-tests/test/stress-tests.spec.ts
+1
-6
No files found.
integration-tests/test/native-eth-ovm-calls.spec.ts
View file @
453e8c53
...
@@ -38,7 +38,7 @@ describe('Native ETH value integration tests', () => {
...
@@ -38,7 +38,7 @@ describe('Native ETH value integration tests', () => {
}
}
const
value
=
ethers
.
utils
.
parseEther
(
'
0.01
'
)
const
value
=
ethers
.
utils
.
parseEther
(
'
0.01
'
)
await
fundUser
(
env
.
watcher
,
env
.
l1Bridge
,
value
,
wallet
.
address
)
await
fundUser
(
env
.
messenger
,
value
,
wallet
.
address
)
const
initialBalances
=
await
getBalances
()
const
initialBalances
=
await
getBalances
()
...
@@ -156,12 +156,7 @@ describe('Native ETH value integration tests', () => {
...
@@ -156,12 +156,7 @@ describe('Native ETH value integration tests', () => {
beforeEach
(
async
()
=>
{
beforeEach
(
async
()
=>
{
ValueCalls0
=
await
Factory__ValueCalls
.
deploy
()
ValueCalls0
=
await
Factory__ValueCalls
.
deploy
()
ValueCalls1
=
await
Factory__ValueCalls
.
deploy
()
ValueCalls1
=
await
Factory__ValueCalls
.
deploy
()
await
fundUser
(
await
fundUser
(
env
.
messenger
,
initialBalance0
,
ValueCalls0
.
address
)
env
.
watcher
,
env
.
l1Bridge
,
initialBalance0
,
ValueCalls0
.
address
)
// These tests ass assume ValueCalls0 starts with a balance, but ValueCalls1 does not.
// These tests ass assume ValueCalls0 starts with a balance, but ValueCalls1 does not.
await
checkBalances
([
initialBalance0
,
0
])
await
checkBalances
([
initialBalance0
,
0
])
})
})
...
@@ -203,12 +198,7 @@ describe('Native ETH value integration tests', () => {
...
@@ -203,12 +198,7 @@ describe('Native ETH value integration tests', () => {
it
(
'
should have the correct ovmSELFBALANCE which includes the msg.value
'
,
async
()
=>
{
it
(
'
should have the correct ovmSELFBALANCE which includes the msg.value
'
,
async
()
=>
{
// give an initial balance which the ovmCALLVALUE should be added to when calculating ovmSELFBALANCE
// give an initial balance which the ovmCALLVALUE should be added to when calculating ovmSELFBALANCE
const
initialBalance
=
10
const
initialBalance
=
10
await
fundUser
(
await
fundUser
(
env
.
messenger
,
initialBalance
,
ValueCalls1
.
address
)
env
.
watcher
,
env
.
l1Bridge
,
initialBalance
,
ValueCalls1
.
address
)
const
sendAmount
=
15
const
sendAmount
=
15
const
[
success
,
returndata
]
=
await
ValueCalls0
.
callStatic
.
sendWithData
(
const
[
success
,
returndata
]
=
await
ValueCalls0
.
callStatic
.
sendWithData
(
...
...
integration-tests/test/rpc.spec.ts
View file @
453e8c53
...
@@ -219,7 +219,7 @@ describe('Basic RPC tests', () => {
...
@@ -219,7 +219,7 @@ describe('Basic RPC tests', () => {
// Fund account to call from
// Fund account to call from
const
from
=
wallet
.
address
const
from
=
wallet
.
address
const
value
=
15
const
value
=
15
await
fundUser
(
env
.
watcher
,
env
.
l1Bridge
,
value
,
from
)
await
fundUser
(
env
.
messenger
,
value
,
from
)
// Do the call and check msg.value
// Do the call and check msg.value
const
data
=
ValueContext
.
interface
.
encodeFunctionData
(
'
getCallValue
'
)
const
data
=
ValueContext
.
interface
.
encodeFunctionData
(
'
getCallValue
'
)
...
...
integration-tests/test/shared/env.ts
View file @
453e8c53
...
@@ -85,6 +85,13 @@ export class OptimismEnv {
...
@@ -85,6 +85,13 @@ export class OptimismEnv {
}
}
static
async
new
():
Promise
<
OptimismEnv
>
{
static
async
new
():
Promise
<
OptimismEnv
>
{
const
network
=
await
l1Provider
.
getNetwork
()
const
messenger
=
new
CrossChainMessenger
({
l1SignerOrProvider
:
l1Wallet
,
l2SignerOrProvider
:
l2Wallet
,
l1ChainId
:
network
.
chainId
,
})
const
addressManager
=
getAddressManager
(
l1Wallet
)
const
addressManager
=
getAddressManager
(
l1Wallet
)
const
watcher
=
await
initWatcher
(
l1Provider
,
l2Provider
,
addressManager
)
const
watcher
=
await
initWatcher
(
l1Provider
,
l2Provider
,
addressManager
)
const
l1Bridge
=
await
getL1Bridge
(
l1Wallet
,
addressManager
)
const
l1Bridge
=
await
getL1Bridge
(
l1Wallet
,
addressManager
)
...
@@ -94,7 +101,7 @@ export class OptimismEnv {
...
@@ -94,7 +101,7 @@ export class OptimismEnv {
const
min
=
envConfig
.
L2_WALLET_MIN_BALANCE_ETH
.
toString
()
const
min
=
envConfig
.
L2_WALLET_MIN_BALANCE_ETH
.
toString
()
const
topUp
=
envConfig
.
L2_WALLET_TOP_UP_AMOUNT_ETH
.
toString
()
const
topUp
=
envConfig
.
L2_WALLET_TOP_UP_AMOUNT_ETH
.
toString
()
if
(
balance
.
lt
(
utils
.
parseEther
(
min
)))
{
if
(
balance
.
lt
(
utils
.
parseEther
(
min
)))
{
await
fundUser
(
watcher
,
l1Bridge
,
utils
.
parseEther
(
topUp
))
await
fundUser
(
messenger
,
utils
.
parseEther
(
topUp
))
}
}
const
l1Messenger
=
getContractFactory
(
'
L1CrossDomainMessenger
'
)
const
l1Messenger
=
getContractFactory
(
'
L1CrossDomainMessenger
'
)
.
connect
(
l1Wallet
)
.
connect
(
l1Wallet
)
...
@@ -129,13 +136,6 @@ export class OptimismEnv {
...
@@ -129,13 +136,6 @@ export class OptimismEnv {
.
connect
(
l2Wallet
)
.
connect
(
l2Wallet
)
.
attach
(
predeploys
.
OVM_L1BlockNumber
)
.
attach
(
predeploys
.
OVM_L1BlockNumber
)
const
network
=
await
l1Provider
.
getNetwork
()
const
messenger
=
new
CrossChainMessenger
({
l1SignerOrProvider
:
l1Wallet
,
l2SignerOrProvider
:
l2Wallet
,
l1ChainId
:
network
.
chainId
,
})
return
new
OptimismEnv
({
return
new
OptimismEnv
({
addressManager
,
addressManager
,
l1Bridge
,
l1Bridge
,
...
...
integration-tests/test/shared/utils.ts
View file @
453e8c53
...
@@ -4,7 +4,6 @@ import {
...
@@ -4,7 +4,6 @@ import {
Wallet
,
Wallet
,
constants
,
constants
,
providers
,
providers
,
BigNumberish
,
BigNumber
,
BigNumber
,
utils
,
utils
,
}
from
'
ethers
'
}
from
'
ethers
'
...
@@ -13,13 +12,13 @@ import {
...
@@ -13,13 +12,13 @@ import {
getContractInterface
,
getContractInterface
,
predeploys
,
predeploys
,
}
from
'
@eth-optimism/contracts
'
}
from
'
@eth-optimism/contracts
'
import
{
injectL2Context
,
remove0x
,
Watcher
}
from
'
@eth-optimism/core-utils
'
import
{
injectL2Context
,
remove0x
}
from
'
@eth-optimism/core-utils
'
import
{
CrossChainMessenger
,
NumberLike
}
from
'
@eth-optimism/sdk
'
import
{
cleanEnv
,
str
,
num
,
bool
,
makeValidator
}
from
'
envalid
'
import
{
cleanEnv
,
str
,
num
,
bool
,
makeValidator
}
from
'
envalid
'
import
dotenv
from
'
dotenv
'
import
dotenv
from
'
dotenv
'
dotenv
.
config
()
dotenv
.
config
()
/* Imports: Internal */
/* Imports: Internal */
import
{
Direction
,
waitForXDomainTransaction
}
from
'
./watcher-utils
'
import
{
OptimismEnv
}
from
'
./env
'
import
{
OptimismEnv
}
from
'
./env
'
export
const
isLiveNetwork
=
()
=>
{
export
const
isLiveNetwork
=
()
=>
{
...
@@ -180,23 +179,26 @@ export const getOvmEth = (wallet: Wallet) => {
...
@@ -180,23 +179,26 @@ export const getOvmEth = (wallet: Wallet) => {
}
}
export
const
fundUser
=
async
(
export
const
fundUser
=
async
(
watcher
:
Watcher
,
messenger
:
CrossChainMessenger
,
bridge
:
Contract
,
amount
:
NumberLike
,
amount
:
BigNumberish
,
recipient
?:
string
recipient
?:
string
)
=>
{
)
=>
{
const
value
=
BigNumber
.
from
(
amount
)
await
messenger
.
waitForMessageReceipt
(
const
tx
=
recipient
await
messenger
.
depositETH
(
amount
,
{
?
bridge
.
depositETHTo
(
recipient
,
DEFAULT_TEST_GAS_L2
,
'
0x
'
,
{
l2GasLimit
:
DEFAULT_TEST_GAS_L2
,
value
,
overrides
:
{
gasLimit
:
DEFAULT_TEST_GAS_L1
,
gasPrice
:
DEFAULT_TEST_GAS_L1
,
})
},
:
bridge
.
depositETH
(
DEFAULT_TEST_GAS_L2
,
'
0x
'
,
{
value
,
gasLimit
:
DEFAULT_TEST_GAS_L1
,
})
})
)
await
waitForXDomainTransaction
(
watcher
,
tx
,
Direction
.
L1ToL2
)
if
(
recipient
!==
undefined
)
{
const
tx
=
await
messenger
.
l2Signer
.
sendTransaction
({
to
:
recipient
,
value
:
amount
,
})
await
tx
.
wait
()
}
}
}
export
const
conditionalTest
=
(
export
const
conditionalTest
=
(
...
...
integration-tests/test/stress-tests.spec.ts
View file @
453e8c53
...
@@ -47,12 +47,7 @@ describe('stress tests', () => {
...
@@ -47,12 +47,7 @@ describe('stress tests', () => {
}
}
for
(
const
wallet
of
wallets
)
{
for
(
const
wallet
of
wallets
)
{
await
fundUser
(
await
fundUser
(
env
.
messenger
,
utils
.
parseEther
(
'
0.1
'
),
wallet
.
address
)
env
.
watcher
,
env
.
l1Bridge
,
utils
.
parseEther
(
'
0.1
'
),
wallet
.
address
)
}
}
})
})
...
...
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