Commit 9caba306 authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

Merge pull request #1262 from ethereum-optimism/develop

Develop -> Master PR
parents 16141680 c4498b5a
---
'@eth-optimism/gas-oracle': patch
---
Add additional logging in the `gas-oracle`
---
'@eth-optimism/l2geth': patch
---
Fixes the flags to use float64 instead of bools for the `--rollup.feethresholddown` and `-rollup.feethresholdup` config options
---
'@eth-optimism/l2geth': patch
---
Prevents the sequencer from accepting transactions with a too high nonce
---
'@eth-optimism/smock': patch
---
Add a test and a doc section for returning multiple uint256 arrays
...@@ -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
......
...@@ -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.BoolFlag{ RollupFeeThresholdDownFlag = cli.Float64Flag{
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.BoolFlag{ RollupFeeThresholdUpFlag = cli.Float64Flag{
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",
......
...@@ -560,8 +560,14 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error { ...@@ -560,8 +560,14 @@ 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 pool.currentState.GetNonce(from) > tx.Nonce() { if vm.UsingOVM {
return ErrNonceTooLow if pool.currentState.GetNonce(from) != tx.Nonce() {
return ErrNonceTooLow
}
} else {
if pool.currentState.GetNonce(from) > tx.Nonce() {
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
......
This diff is collapsed.
#!/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`
......
...@@ -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'
......
...@@ -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
......
...@@ -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])
}
}
})
}) })
}) })
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment