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
9caba306
Unverified
Commit
9caba306
authored
Jul 12, 2021
by
Mark Tyneway
Committed by
GitHub
Jul 12, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1262 from ethereum-optimism/develop
Develop -> Master PR
parents
16141680
c4498b5a
Changes
12
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
134 additions
and
49 deletions
+134
-49
kind-hotels-turn.md
.changeset/kind-hotels-turn.md
+5
-0
six-cobras-fold.md
.changeset/six-cobras-fold.md
+5
-0
tidy-swans-mate.md
.changeset/tidy-swans-mate.md
+5
-0
wise-mails-laugh.md
.changeset/wise-mails-laugh.md
+5
-0
l2_gas_pricer.go
go/gas-oracle/gasprices/l2_gas_pricer.go
+6
-2
flags.go
l2geth/cmd/utils/flags.go
+2
-2
tx_pool.go
l2geth/core/tx_pool.go
+8
-2
README.md
packages/contracts/deployments/README.md
+46
-31
generate-markdown.js
packages/contracts/scripts/generate-markdown.js
+6
-12
README.md
packages/smock/README.md
+19
-0
TestHelpers_BasicReturnContract.sol
.../smock/test/contracts/TestHelpers_BasicReturnContract.sol
+8
-0
function-manipulation.spec.ts
packages/smock/test/smockit/function-manipulation.spec.ts
+19
-0
No files found.
.changeset/kind-hotels-turn.md
0 → 100644
View file @
9caba306
---
'
@eth-optimism/gas-oracle'
:
patch
---
Add additional logging in the
`gas-oracle`
.changeset/six-cobras-fold.md
0 → 100644
View file @
9caba306
---
'
@eth-optimism/l2geth'
:
patch
---
Fixes the flags to use float64 instead of bools for the
`--rollup.feethresholddown`
and
`-rollup.feethresholdup`
config options
.changeset/tidy-swans-mate.md
0 → 100644
View file @
9caba306
---
'
@eth-optimism/l2geth'
:
patch
---
Prevents the sequencer from accepting transactions with a too high nonce
.changeset/wise-mails-laugh.md
0 → 100644
View file @
9caba306
---
'
@eth-optimism/smock'
:
patch
---
Add a test and a doc section for returning multiple uint256 arrays
go/gas-oracle/gasprices/l2_gas_pricer.go
View file @
9caba306
...
@@ -52,6 +52,8 @@ func (p *GasPricer) CalcNextEpochGasPrice(avgGasPerSecondLastEpoch float64) (uin
...
@@ -52,6 +52,8 @@ func (p *GasPricer) CalcNextEpochGasPrice(avgGasPerSecondLastEpoch float64) (uin
}
}
// The percent difference between our current average gas & our target gas
// The percent difference between our current average gas & our target gas
proportionOfTarget
:=
avgGasPerSecondLastEpoch
/
targetGasPerSecond
proportionOfTarget
:=
avgGasPerSecondLastEpoch
/
targetGasPerSecond
log
.
Trace
(
"Calculating next epoch gas price"
,
"proportionOfTarget"
,
proportionOfTarget
,
"avgGasPerSecondLastEpoch"
,
avgGasPerSecondLastEpoch
,
"targetGasPerSecond"
,
targetGasPerSecond
)
// The percent that we should adjust the gas price to reach our target gas
// The percent that we should adjust the gas price to reach our target gas
proportionToChangeBy
:=
0.0
proportionToChangeBy
:=
0.0
if
proportionOfTarget
>=
1
{
// If average avgGasPerSecondLastEpoch is GREATER than our target
if
proportionOfTarget
>=
1
{
// If average avgGasPerSecondLastEpoch is GREATER than our target
...
@@ -59,9 +61,11 @@ func (p *GasPricer) CalcNextEpochGasPrice(avgGasPerSecondLastEpoch float64) (uin
...
@@ -59,9 +61,11 @@ func (p *GasPricer) CalcNextEpochGasPrice(avgGasPerSecondLastEpoch float64) (uin
}
else
{
}
else
{
proportionToChangeBy
=
math
.
Max
(
proportionOfTarget
,
1
-
p
.
maxChangePerEpoch
)
proportionToChangeBy
=
math
.
Max
(
proportionOfTarget
,
1
-
p
.
maxChangePerEpoch
)
}
}
log
.
Debug
(
"CalcNextEpochGasPrice"
,
"proportionToChangeBy"
,
proportionToChangeBy
,
"proportionOfTarget"
,
proportionOfTarget
)
updated
:=
float64
(
max
(
1
,
p
.
curPrice
))
*
proportionToChangeBy
updated
:=
float64
(
max
(
1
,
p
.
curPrice
))
*
proportionToChangeBy
return
max
(
p
.
floorPrice
,
uint64
(
math
.
Ceil
(
updated
))),
nil
result
:=
max
(
p
.
floorPrice
,
uint64
(
math
.
Ceil
(
updated
)))
log
.
Debug
(
"Calculated next epoch gas price"
,
"proportionToChangeBy"
,
proportionToChangeBy
,
"proportionOfTarget"
,
proportionOfTarget
,
"result"
,
result
)
return
result
,
nil
}
}
// CompleteEpoch ends the current epoch and updates the current gas price for the next epoch
// CompleteEpoch ends the current epoch and updates the current gas price for the next epoch
...
...
l2geth/cmd/utils/flags.go
View file @
9caba306
...
@@ -898,12 +898,12 @@ var (
...
@@ -898,12 +898,12 @@ var (
Usage
:
"Disable transactions with 0 gas price"
,
Usage
:
"Disable transactions with 0 gas price"
,
EnvVar
:
"ROLLUP_ENFORCE_FEES"
,
EnvVar
:
"ROLLUP_ENFORCE_FEES"
,
}
}
RollupFeeThresholdDownFlag
=
cli
.
Bool
Flag
{
RollupFeeThresholdDownFlag
=
cli
.
Float64
Flag
{
Name
:
"rollup.feethresholddown"
,
Name
:
"rollup.feethresholddown"
,
Usage
:
"Allow txs with fees below the current fee up to this amount, must be < 1"
,
Usage
:
"Allow txs with fees below the current fee up to this amount, must be < 1"
,
EnvVar
:
"ROLLUP_FEE_THRESHOLD_DOWN"
,
EnvVar
:
"ROLLUP_FEE_THRESHOLD_DOWN"
,
}
}
RollupFeeThresholdUpFlag
=
cli
.
Bool
Flag
{
RollupFeeThresholdUpFlag
=
cli
.
Float64
Flag
{
Name
:
"rollup.feethresholdup"
,
Name
:
"rollup.feethresholdup"
,
Usage
:
"Allow txs with fees above the current fee up to this amount, must be > 1"
,
Usage
:
"Allow txs with fees above the current fee up to this amount, must be > 1"
,
EnvVar
:
"ROLLUP_FEE_THRESHOLD_UP"
,
EnvVar
:
"ROLLUP_FEE_THRESHOLD_UP"
,
...
...
l2geth/core/tx_pool.go
View file @
9caba306
...
@@ -560,9 +560,15 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
...
@@ -560,9 +560,15 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
return
ErrUnderpriced
return
ErrUnderpriced
}
}
// Ensure the transaction adheres to nonce ordering
// Ensure the transaction adheres to nonce ordering
if
vm
.
UsingOVM
{
if
pool
.
currentState
.
GetNonce
(
from
)
!=
tx
.
Nonce
()
{
return
ErrNonceTooLow
}
}
else
{
if
pool
.
currentState
.
GetNonce
(
from
)
>
tx
.
Nonce
()
{
if
pool
.
currentState
.
GetNonce
(
from
)
>
tx
.
Nonce
()
{
return
ErrNonceTooLow
return
ErrNonceTooLow
}
}
}
// Transactor should have enough funds to cover the costs
// Transactor should have enough funds to cover the costs
// cost == V + GP * GL
// cost == V + GP * GL
if
vm
.
UsingOVM
{
if
vm
.
UsingOVM
{
...
...
packages/contracts/deployments/README.md
View file @
9caba306
This diff is collapsed.
Click to expand it.
packages/contracts/scripts/generate-markdown.js
View file @
9caba306
#!/usr/bin/env node
#!/usr/bin/env node
const
dirtree
=
require
(
'
directory-tree
'
)
const
dirtree
=
require
(
'
directory-tree
'
)
const
fs
=
require
(
'
fs
'
)
const
fs
=
require
(
'
fs
'
)
const
{
predeploys
}
=
require
(
'
../dist/predeploys
'
)
/**
/**
*
*
...
@@ -37,19 +38,12 @@ const networks = {
...
@@ -37,19 +38,12 @@ const networks = {
### Predeploy contracts:
### Predeploy contracts:
|Contract|Address|
|Contract|Address|
|--|--|
|--|--|\n`
|OVM_ETH: | \`0x4200000000000000000000000000000000000006\`
for
(
const
[
name
,
addr
]
of
Object
.
entries
(
predeploys
))
{
|OVM_L2StandardBridge: | \`0x4200000000000000000000000000000000000010\`
md
+=
`|
${
name
}
|
${
addr
}
|\n`
|OVM_L2CrossDomainMessenger: | \`0x4200000000000000000000000000000000000007\`
}
|OVM_L2ToL1MessagePasser: | \`0x4200000000000000000000000000000000000000\`
|OVM_L1MessageSender: | \`0x4200000000000000000000000000000000000001\`
|OVM_DeployerWhitelist: | \`0x4200000000000000000000000000000000000002\`
|OVM_ECDSAContractAccount: | \`0x4200000000000000000000000000000000000003\`
|OVM_SequencerEntrypoint: | \`0x4200000000000000000000000000000000000005\`
|Lib_AddressManager: | \`0x4200000000000000000000000000000000000008\`
|ERC1820Registry: | \`0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24\`
---
md
+=
`\n
---
---
---
## LAYER 1\n\n`
## LAYER 1\n\n`
...
...
packages/smock/README.md
View file @
9caba306
...
@@ -240,6 +240,25 @@ MyMockContract.smocked.myFunction.will.return.with({
...
@@ -240,6 +240,25 @@ MyMockContract.smocked.myFunction.will.return.with({
console
.
log
(
await
MyMockContract
.
myFunction
())
// ['Some value', 1234, true]
console
.
log
(
await
MyMockContract
.
myFunction
())
// ['Some value', 1234, true]
```
```
### Returning a Multiple Arrays
```
typescript
import
{
ethers
}
from
'
hardhat
'
import
{
smockit
}
from
'
@eth-optimism/smock
'
const
MyContractFactory
=
await
ethers
.
getContractFactory
(
'
MyContract
'
)
const
MyContract
=
await
MyContractFactory
.
deploy
(...)
// Smockit!
const
MyMockContract
=
await
smockit
(
MyContract
)
MyMockContract
.
smocked
.
myFunction
.
will
.
return
.
with
([
[
1234
,
5678
],
[
4321
,
8765
]
])
console
.
log
(
await
MyMockContract
.
myFunction
())
// [ [1234, 5678], [4321, 8765] ]
```
### Returning a Function
### Returning a Function
```
typescript
```
typescript
import
{
ethers
}
from
'
hardhat
'
import
{
ethers
}
from
'
hardhat
'
...
...
packages/smock/test/contracts/TestHelpers_BasicReturnContract.sol
View file @
9caba306
...
@@ -132,6 +132,14 @@ contract TestHelpers_BasicReturnContract {
...
@@ -132,6 +132,14 @@ contract TestHelpers_BasicReturnContract {
)
)
{}
{}
function getMultipleUint256Arrays()
public
returns (
uint256[] memory,
uint256[] memory
)
{}
function overloadedFunction(
function overloadedFunction(
uint256 _paramA,
uint256 _paramA,
uint256 _paramB
uint256 _paramB
...
...
packages/smock/test/smockit/function-manipulation.spec.ts
View file @
9caba306
...
@@ -533,6 +533,25 @@ describe('[smock]: function manipulation tests', () => {
...
@@ -533,6 +533,25 @@ describe('[smock]: function manipulation tests', () => {
expect
(
result
[
i
]).
to
.
deep
.
equal
(
expected
[
i
])
expect
(
result
[
i
]).
to
.
deep
.
equal
(
expected
[
i
])
}
}
})
})
it
(
'
should be able to return multiple arrays of uint256 values
'
,
async
()
=>
{
const
expected
=
[
[
1234
,
2345
,
3456
,
4567
,
5678
,
6789
].
map
((
n
)
=>
{
return
BigNumber
.
from
(
n
)
}),
[
1234
,
2345
,
3456
,
4567
,
5678
,
6789
].
map
((
n
)
=>
{
return
BigNumber
.
from
(
n
)
}),
]
mock
.
smocked
.
getMultipleUint256Arrays
.
will
.
return
.
with
(
expected
)
const
result
=
await
mock
.
callStatic
.
getMultipleUint256Arrays
()
for
(
let
i
=
0
;
i
<
result
.
length
;
i
++
)
{
for
(
let
j
=
0
;
j
<
result
[
i
].
length
;
j
++
)
{
expect
(
result
[
i
][
j
]).
to
.
deep
.
equal
(
expected
[
i
][
j
])
}
}
})
})
})
})
})
})
})
...
...
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