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
b7e9d10c
Unverified
Commit
b7e9d10c
authored
Dec 06, 2021
by
Mark Tyneway
Committed by
GitHub
Dec 06, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1736 from ethereum-optimism/fix/ops-config
integration-tests: fee too low/too high
parents
2ba78932
b1fa3f33
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
72 additions
and
12 deletions
+72
-12
pretty-dogs-hope.md
.changeset/pretty-dogs-hope.md
+5
-0
fee-payment.spec.ts
integration-tests/test/fee-payment.spec.ts
+2
-5
rpc.spec.ts
integration-tests/test/rpc.spec.ts
+39
-0
env.ts
integration-tests/test/shared/env.ts
+2
-1
utils.ts
integration-tests/test/shared/utils.ts
+15
-2
docker-compose.yml
ops/docker-compose.yml
+5
-3
geth.env
ops/envs/geth.env
+4
-1
No files found.
.changeset/pretty-dogs-hope.md
0 → 100644
View file @
b7e9d10c
---
'
@eth-optimism/integration-tests'
:
patch
---
Enforce fees in docker-compose setup and test cases for fee too low and fee too high
integration-tests/test/fee-payment.spec.ts
View file @
b7e9d10c
...
@@ -8,7 +8,7 @@ import { serialize } from '@ethersproject/transactions'
...
@@ -8,7 +8,7 @@ import { serialize } from '@ethersproject/transactions'
import
{
predeploys
,
getContractFactory
}
from
'
@eth-optimism/contracts
'
import
{
predeploys
,
getContractFactory
}
from
'
@eth-optimism/contracts
'
/* Imports: Internal */
/* Imports: Internal */
import
{
gasPriceForL2
,
isLiveNetwork
}
from
'
./shared/utils
'
import
{
isLiveNetwork
}
from
'
./shared/utils
'
import
{
OptimismEnv
}
from
'
./shared/env
'
import
{
OptimismEnv
}
from
'
./shared/env
'
import
{
Direction
}
from
'
./shared/watcher-utils
'
import
{
Direction
}
from
'
./shared/watcher-utils
'
...
@@ -173,10 +173,7 @@ describe('Fee Payment Integration Tests', async () => {
...
@@ -173,10 +173,7 @@ describe('Fee Payment Integration Tests', async () => {
env
.
sequencerFeeVault
.
address
env
.
sequencerFeeVault
.
address
)
)
// Submit the withdrawal.
const
withdrawTx
=
await
env
.
sequencerFeeVault
.
withdraw
()
const
withdrawTx
=
await
env
.
sequencerFeeVault
.
withdraw
({
gasPrice
:
await
gasPriceForL2
(
env
),
// Will be zero on HH
})
// Wait for the withdrawal to be relayed to L1.
// Wait for the withdrawal to be relayed to L1.
await
withdrawTx
.
wait
()
await
withdrawTx
.
wait
()
...
...
integration-tests/test/rpc.spec.ts
View file @
b7e9d10c
...
@@ -140,6 +140,45 @@ describe('Basic RPC tests', () => {
...
@@ -140,6 +140,45 @@ describe('Basic RPC tests', () => {
'
gas required exceeds allowance
'
'
gas required exceeds allowance
'
)
)
})
})
it
(
'
should reject a transaction with too low of a fee
'
,
async
()
=>
{
if
(
isLiveNetwork
())
{
console
.
log
(
'
Skipping too low of a fee test on live network
'
)
return
}
const
gasPrice
=
await
env
.
gasPriceOracle
.
gasPrice
()
await
env
.
gasPriceOracle
.
setGasPrice
(
1000
)
const
tx
=
{
...
defaultTransactionFactory
(),
gasPrice
:
1
,
}
await
expect
(
env
.
l2Wallet
.
sendTransaction
(
tx
)).
to
.
be
.
rejectedWith
(
`gas price too low: 1 wei, use at least tx.gasPrice = 1000 wei`
)
// Reset the gas price to its original price
await
env
.
gasPriceOracle
.
setGasPrice
(
gasPrice
)
})
it
(
'
should reject a transaction with too high of a fee
'
,
async
()
=>
{
if
(
isLiveNetwork
())
{
console
.
log
(
'
Skpping too high of a fee test on live network
'
)
return
}
const
gasPrice
=
await
env
.
gasPriceOracle
.
gasPrice
()
const
largeGasPrice
=
gasPrice
.
mul
(
10
)
const
tx
=
{
...
defaultTransactionFactory
(),
gasPrice
:
largeGasPrice
,
}
await
expect
(
env
.
l2Wallet
.
sendTransaction
(
tx
)).
to
.
be
.
rejectedWith
(
`gas price too high:
${
largeGasPrice
.
toString
()}
wei, use at most `
+
`tx.gasPrice =
${
gasPrice
.
toString
()}
wei`
)
})
})
})
describe
(
'
eth_call
'
,
()
=>
{
describe
(
'
eth_call
'
,
()
=>
{
...
...
integration-tests/test/shared/env.ts
View file @
b7e9d10c
...
@@ -13,6 +13,7 @@ import {
...
@@ -13,6 +13,7 @@ import {
replicaProvider
,
replicaProvider
,
l1Wallet
,
l1Wallet
,
l2Wallet
,
l2Wallet
,
gasPriceOracleWallet
,
fundUser
,
fundUser
,
getOvmEth
,
getOvmEth
,
getL1Bridge
,
getL1Bridge
,
...
@@ -100,7 +101,7 @@ export class OptimismEnv {
...
@@ -100,7 +101,7 @@ export class OptimismEnv {
.
attach
(
ctcAddress
)
.
attach
(
ctcAddress
)
const
gasPriceOracle
=
getContractFactory
(
'
OVM_GasPriceOracle
'
)
const
gasPriceOracle
=
getContractFactory
(
'
OVM_GasPriceOracle
'
)
.
connect
(
l2
Wallet
)
.
connect
(
gasPriceOracle
Wallet
)
.
attach
(
predeploys
.
OVM_GasPriceOracle
)
.
attach
(
predeploys
.
OVM_GasPriceOracle
)
const
sccAddress
=
await
addressManager
.
getAddress
(
'
StateCommitmentChain
'
)
const
sccAddress
=
await
addressManager
.
getAddress
(
'
StateCommitmentChain
'
)
...
...
integration-tests/test/shared/utils.ts
View file @
b7e9d10c
...
@@ -47,6 +47,10 @@ const env = cleanEnv(process.env, {
...
@@ -47,6 +47,10 @@ const env = cleanEnv(process.env, {
ADDRESS_MANAGER
:
str
({
ADDRESS_MANAGER
:
str
({
default
:
'
0x5FbDB2315678afecb367f032d93F642f64180aa3
'
,
default
:
'
0x5FbDB2315678afecb367f032d93F642f64180aa3
'
,
}),
}),
GAS_PRICE_ORACLE_PRIVATE_KEY
:
str
({
default
:
'
0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba
'
,
}),
L2_CHAINID
:
num
({
default
:
420
}),
L2_CHAINID
:
num
({
default
:
420
}),
IS_LIVE_NETWORK
:
bool
({
default
:
false
}),
IS_LIVE_NETWORK
:
bool
({
default
:
false
}),
})
})
...
@@ -77,6 +81,12 @@ export const l1Wallet = new Wallet(env.PRIVATE_KEY, l1Provider)
...
@@ -77,6 +81,12 @@ export const l1Wallet = new Wallet(env.PRIVATE_KEY, l1Provider)
// if it's using non-0 gas price
// if it's using non-0 gas price
export
const
l2Wallet
=
l1Wallet
.
connect
(
l2Provider
)
export
const
l2Wallet
=
l1Wallet
.
connect
(
l2Provider
)
// The owner of the GasPriceOracle on L2
export
const
gasPriceOracleWallet
=
new
Wallet
(
env
.
GAS_PRICE_ORACLE_PRIVATE_KEY
,
l2Provider
)
// Predeploys
// Predeploys
export
const
PROXY_SEQUENCER_ENTRYPOINT_ADDRESS
=
export
const
PROXY_SEQUENCER_ENTRYPOINT_ADDRESS
=
'
0x4200000000000000000000000000000000000004
'
'
0x4200000000000000000000000000000000000004
'
...
@@ -182,14 +192,17 @@ export const waitForL2Geth = async (
...
@@ -182,14 +192,17 @@ export const waitForL2Geth = async (
// eslint-disable-next-line @typescript-eslint/no-shadow
// eslint-disable-next-line @typescript-eslint/no-shadow
export
const
gasPriceForL2
=
async
(
env
:
OptimismEnv
)
=>
{
export
const
gasPriceForL2
=
async
(
env
:
OptimismEnv
)
=>
{
if
(
await
isMainnet
(
env
))
{
// The integration tests enforce fees on L2
// which run against hardhat on L1. Update if
// geth --dev is adopted for L1
const
chainId
=
await
env
.
l1Wallet
.
getChainId
()
if
((
await
isMainnet
(
env
))
||
chainId
===
31337
)
{
return
env
.
l2Wallet
.
getGasPrice
()
return
env
.
l2Wallet
.
getGasPrice
()
}
}
if
(
isLiveNetwork
())
{
if
(
isLiveNetwork
())
{
return
Promise
.
resolve
(
BigNumber
.
from
(
10000
))
return
Promise
.
resolve
(
BigNumber
.
from
(
10000
))
}
}
return
Promise
.
resolve
(
BigNumber
.
from
(
0
))
return
Promise
.
resolve
(
BigNumber
.
from
(
0
))
}
}
...
...
ops/docker-compose.yml
View file @
b7e9d10c
...
@@ -28,12 +28,13 @@ services:
...
@@ -28,12 +28,13 @@ services:
DEPLOYER_PRIVATE_KEY
:
"
0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
DEPLOYER_PRIVATE_KEY
:
"
0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
SEQUENCER_PRIVATE_KEY
:
"
0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
SEQUENCER_PRIVATE_KEY
:
"
0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
PROPOSER_PRIVATE_KEY
:
"
0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a"
PROPOSER_PRIVATE_KEY
:
"
0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a"
GAS_PRICE_ORACLE_OWNER
:
"
0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
# Default hardhat account 5
GAS_PRICE_ORACLE_OWNER
:
"
0x9965507d1a55bcc2695c58ba16fb37d819b0a4dc"
# setting the whitelist owner to address(0) disables the whitelist
# setting the whitelist owner to address(0) disables the whitelist
WHITELIST_OWNER
:
"
0x0000000000000000000000000000000000000000"
WHITELIST_OWNER
:
"
0x0000000000000000000000000000000000000000"
L1_FEE_WALLET_ADDRESS
:
"
0x391716d440c151c42cdf1c95c1d83a5427bca52c"
L1_FEE_WALLET_ADDRESS
:
"
0x391716d440c151c42cdf1c95c1d83a5427bca52c"
L2_CHAIN_ID
:
420
L2_CHAIN_ID
:
420
L2_BLOCK_GAS_LIMIT
:
1
1
000000
L2_BLOCK_GAS_LIMIT
:
1
5
000000
BLOCK_SIGNER_ADDRESS
:
"
0x00000398232E2064F896018496b4b44b3D62751F"
BLOCK_SIGNER_ADDRESS
:
"
0x00000398232E2064F896018496b4b44b3D62751F"
GAS_PRICE_ORACLE_OVERHEAD
:
"
2750"
GAS_PRICE_ORACLE_OVERHEAD
:
"
2750"
GAS_PRICE_ORACLE_SCALAR
:
"
1500000"
GAS_PRICE_ORACLE_SCALAR
:
"
1500000"
...
@@ -214,4 +215,5 @@ services:
...
@@ -214,4 +215,5 @@ services:
entrypoint
:
./gas-oracle.sh
entrypoint
:
./gas-oracle.sh
environment
:
environment
:
GAS_PRICE_ORACLE_ETHEREUM_HTTP_URL
:
http://l2geth:8545
GAS_PRICE_ORACLE_ETHEREUM_HTTP_URL
:
http://l2geth:8545
GAS_PRICE_ORACLE_PRIVATE_KEY
:
"
0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
# Default hardhat account 5
GAS_PRICE_ORACLE_PRIVATE_KEY
:
"
0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba"
ops/envs/geth.env
View file @
b7e9d10c
...
@@ -6,7 +6,7 @@ ETH1_CONFIRMATION_DEPTH=0
...
@@ -6,7 +6,7 @@ ETH1_CONFIRMATION_DEPTH=0
ROLLUP_CLIENT_HTTP=
ROLLUP_CLIENT_HTTP=
ROLLUP_POLL_INTERVAL_FLAG=500ms
ROLLUP_POLL_INTERVAL_FLAG=500ms
ROLLUP_ENABLE_L2_GAS_POLLING=true
ROLLUP_ENABLE_L2_GAS_POLLING=true
# ROLLUP_ENFORCE_FEES=
ROLLUP_ENFORCE_FEES=true
RPC_ENABLE=true
RPC_ENABLE=true
RPC_ADDR=0.0.0.0
RPC_ADDR=0.0.0.0
...
@@ -36,3 +36,6 @@ BLOCK_SIGNER_KEY=6587ae678cf4fc9a33000cdbf9f35226b71dcc6a4684a31203241f9bcfd55d2
...
@@ -36,3 +36,6 @@ BLOCK_SIGNER_KEY=6587ae678cf4fc9a33000cdbf9f35226b71dcc6a4684a31203241f9bcfd55d2
BLOCK_SIGNER_ADDRESS=0x00000398232E2064F896018496b4b44b3D62751F
BLOCK_SIGNER_ADDRESS=0x00000398232E2064F896018496b4b44b3D62751F
L2_BLOCK_GAS_LIMIT=15000000
L2_BLOCK_GAS_LIMIT=15000000
ROLLUP_FEE_THRESHOLD_DOWN=0.9
ROLLUP_FEE_THRESHOLD_UP=1.1
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