Skip to content

Commit 1116cc1

Browse files
committed
Review feedback
1 parent 4a53cc2 commit 1116cc1

File tree

14 files changed

+179
-188
lines changed

14 files changed

+179
-188
lines changed

go.mod

+5-5
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ require (
3333
github.com/jackc/pgx/v5 v5.5.5
3434
github.com/libp2p/go-libp2p v0.32.0
3535
github.com/libp2p/go-libp2p-mplex v0.9.0
36-
github.com/libp2p/go-libp2p-pubsub v0.10.0
36+
github.com/libp2p/go-libp2p-pubsub v0.10.1
3737
github.com/libp2p/go-libp2p-testing v0.12.0
3838
github.com/mattn/go-isatty v0.0.20
3939
github.com/minio/minio-go/v7 v7.0.70
@@ -47,10 +47,10 @@ require (
4747
github.com/prometheus/client_golang v1.19.0
4848
github.com/stretchr/testify v1.9.0
4949
github.com/urfave/cli/v2 v2.27.1
50-
golang.org/x/crypto v0.21.0
50+
golang.org/x/crypto v0.23.0
5151
golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3
5252
golang.org/x/sync v0.6.0
53-
golang.org/x/term v0.18.0
53+
golang.org/x/term v0.20.0
5454
golang.org/x/time v0.5.0
5555
gorm.io/driver/postgres v1.5.7
5656
gorm.io/gorm v1.25.10
@@ -215,8 +215,8 @@ require (
215215
go.uber.org/zap v1.26.0 // indirect
216216
golang.org/x/mod v0.14.0 // indirect
217217
golang.org/x/net v0.23.0 // indirect
218-
golang.org/x/sys v0.18.0 // indirect
219-
golang.org/x/text v0.14.0 // indirect
218+
golang.org/x/sys v0.20.0 // indirect
219+
golang.org/x/text v0.15.0 // indirect
220220
golang.org/x/tools v0.17.0 // indirect
221221
google.golang.org/protobuf v1.32.0 // indirect
222222
gopkg.in/ini.v1 v1.67.0 // indirect

go.sum

+12-9
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,8 @@ github.com/libp2p/go-libp2p-asn-util v0.3.0 h1:gMDcMyYiZKkocGXDQ5nsUQyquC9+H+iLE
507507
github.com/libp2p/go-libp2p-asn-util v0.3.0/go.mod h1:B1mcOrKUE35Xq/ASTmQ4tN3LNzVVaMNmq2NACuqyB9w=
508508
github.com/libp2p/go-libp2p-mplex v0.9.0 h1:R58pDRAmuBXkYugbSSXR9wrTX3+1pFM1xP2bLuodIq8=
509509
github.com/libp2p/go-libp2p-mplex v0.9.0/go.mod h1:ro1i4kuwiFT+uMPbIDIFkcLs1KRbNp0QwnUXM+P64Og=
510-
github.com/libp2p/go-libp2p-pubsub v0.10.0 h1:wS0S5FlISavMaAbxyQn3dxMOe2eegMfswM471RuHJwA=
511-
github.com/libp2p/go-libp2p-pubsub v0.10.0/go.mod h1:1OxbaT/pFRO5h+Dpze8hdHQ63R0ke55XTs6b6NwLLkw=
510+
github.com/libp2p/go-libp2p-pubsub v0.10.1 h1:/RqOZpEtAolsr8/9CC8KqROJSOZeu7lK7fPftn4MwNg=
511+
github.com/libp2p/go-libp2p-pubsub v0.10.1/go.mod h1:1OxbaT/pFRO5h+Dpze8hdHQ63R0ke55XTs6b6NwLLkw=
512512
github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA=
513513
github.com/libp2p/go-libp2p-testing v0.12.0/go.mod h1:KcGDRXyN7sQCllucn1cOOS+Dmm7ujhfEyXQL5lvkcPg=
514514
github.com/libp2p/go-mplex v0.7.0 h1:BDhFZdlk5tbr0oyFq/xv/NPGfjbnrsDam1EvutpBDbY=
@@ -868,8 +868,8 @@ golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5y
868868
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
869869
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
870870
golang.org/x/crypto v0.20.0/go.mod h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ=
871-
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
872-
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
871+
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
872+
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
873873
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
874874
golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 h1:hNQpMuAJe5CtcUqCXaWga3FHu+kQvCqcsoVaQgSV60o=
875875
golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08=
@@ -991,16 +991,16 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
991991
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
992992
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
993993
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
994-
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
995-
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
994+
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
995+
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
996996
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
997997
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
998998
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
999999
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
10001000
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
10011001
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
1002-
golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
1003-
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
1002+
golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw=
1003+
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
10041004
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
10051005
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
10061006
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
@@ -1012,8 +1012,11 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
10121012
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
10131013
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
10141014
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
1015-
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
10161015
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
1016+
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
1017+
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
1018+
github.com/ethereum-optimism/op-geth v1.101315.1-rc.1 h1:/anTmTvsS4Ll9uJkhrldfQQcA+DF0b4aPz7E3b50cgw=
1019+
github.com/ethereum-optimism/op-geth v1.101315.1-rc.1/go.mod h1:VXVFzx1mr/JyJac5M4k5W/+0cqHZMkqKsIVDsOyj2rs=
10171020
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
10181021
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
10191022
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=

op-bindings/bindings/gaspriceoracle.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

op-e2e/actions/fjord_fork_test.go

+23-44
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"math/big"
77
"testing"
88

9+
"github.com/ethereum-optimism/optimism/op-service/predeploys"
910
"github.com/ethereum/go-ethereum/accounts/abi/bind"
1011
"github.com/ethereum/go-ethereum/common"
1112
"github.com/ethereum/go-ethereum/common/hexutil"
@@ -15,15 +16,14 @@ import (
1516
"github.com/stretchr/testify/require"
1617

1718
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
18-
"github.com/ethereum-optimism/optimism/op-bindings/predeploys"
1919
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
2020
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils"
2121
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
2222
"github.com/ethereum-optimism/optimism/op-service/testlog"
2323
)
2424

2525
var (
26-
fjordGasPriceOracleCodeHash = common.HexToHash("0x58e192326ee67ed52b7add91e4640024cbd1b21528a0ff1e1d21b7ca54e3ee62")
26+
fjordGasPriceOracleCodeHash = common.HexToHash("0xa88fa50a2745b15e6794247614b5298483070661adacb8d32d716434ed24c6b2")
2727
// https://basescan.org/tx/0x8debb2fe54200183fb8baa3c6dbd8e6ec2e4f7a4add87416cd60336b8326d16a
2828
txHex = "02f875822105819b8405709fb884057d460082e97f94273ca93a52b817294830ed7572aa591ccfa647fd80881249c58b0021fb3fc080a05bb08ccfd68f83392e446dac64d88a2d28e7072c06502dfabc4a77e77b5c7913a05878d53dd4ebba4f6367e572d524dffcabeec3abb1d8725ee3ac5dc32e1852e3"
2929
)
@@ -32,16 +32,15 @@ func TestFjordNetworkUpgradeTransactions(gt *testing.T) {
3232
t := NewDefaultTesting(gt)
3333
dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams)
3434
genesisBlock := hexutil.Uint64(0)
35-
ecotoneOffset := hexutil.Uint64(4)
36-
fjordOffset := hexutil.Uint64(8)
35+
fjordOffset := hexutil.Uint64(2)
3736

3837
dp.DeployConfig.L1CancunTimeOffset = &genesisBlock // can be removed once Cancun on L1 is the default
3938

4039
// Activate all forks at genesis, and schedule Fjord the block after
4140
dp.DeployConfig.L2GenesisRegolithTimeOffset = &genesisBlock
4241
dp.DeployConfig.L2GenesisCanyonTimeOffset = &genesisBlock
4342
dp.DeployConfig.L2GenesisDeltaTimeOffset = &genesisBlock
44-
dp.DeployConfig.L2GenesisEcotoneTimeOffset = &ecotoneOffset
43+
dp.DeployConfig.L2GenesisEcotoneTimeOffset = &genesisBlock
4544
dp.DeployConfig.L2GenesisFjordTimeOffset = &fjordOffset
4645
require.NoError(t, dp.DeployConfig.Check(), "must have valid config")
4746

@@ -50,10 +49,6 @@ func TestFjordNetworkUpgradeTransactions(gt *testing.T) {
5049
_, _, _, sequencer, engine, verifier, _, _ := setupReorgTestActors(t, dp, sd, log)
5150
ethCl := engine.EthClient()
5251

53-
// build a single block to move away from the genesis with 0-values in L1Block contract
54-
sequencer.ActL2StartBlock(t)
55-
sequencer.ActL2EndBlock(t)
56-
5752
// start op-nodes
5853
sequencer.ActL2PipelineFull(t)
5954
verifier.ActL2PipelineFull(t)
@@ -62,8 +57,6 @@ func TestFjordNetworkUpgradeTransactions(gt *testing.T) {
6257
gasPriceOracle, err := bindings.NewGasPriceOracleCaller(predeploys.GasPriceOracleAddr, ethCl)
6358
require.NoError(t, err)
6459

65-
sequencer.ActBuildL2ToEcotone(t)
66-
6760
// Get current implementations addresses (by slot) for L1Block + GasPriceOracle
6861
initialGasPriceOracleAddress, err := ethCl.StorageAt(context.Background(), predeploys.GasPriceOracleAddr, genesis.ImplementationSlot, nil)
6962
require.NoError(t, err)
@@ -107,41 +100,31 @@ func TestFjordNetworkUpgradeTransactions(gt *testing.T) {
107100
txData, err := hex.DecodeString(txHex)
108101
require.NoError(t, err)
109102

110-
l1GasUsed, err := gasPriceOracle.GetL1GasUsed(&bind.CallOpts{}, txData)
103+
gpoL1GasUsed, err := gasPriceOracle.GetL1GasUsed(&bind.CallOpts{}, txData)
111104
require.NoError(t, err)
112-
require.Equal(gt, uint64(1_888), l1GasUsed.Uint64())
113-
114-
fastLzSize := types.FlzCompressLen(txData)
105+
require.Equal(gt, uint64(1_888), gpoL1GasUsed.Uint64())
115106

116107
// Check that GetL1Fee takes into account fast LZ
117-
used, err := gasPriceOracle.GetL1Fee(&bind.CallOpts{}, txData)
108+
gpoFee, err := gasPriceOracle.GetL1Fee(&bind.CallOpts{}, txData)
118109
require.NoError(t, err)
119110

120-
cost := fjordL1Cost(t, gasPriceOracle, int64(fastLzSize))
121-
require.Equal(t, cost.Uint64(), used.Uint64())
111+
gethFee := fjordL1Cost(t, gasPriceOracle, types.RollupCostData{
112+
FastLzSize: uint64(types.FlzCompressLen(txData) + 68),
113+
})
114+
require.Equal(t, gethFee.Uint64(), gpoFee.Uint64())
122115

123-
// Check that L1FeeUppberBound works
116+
// Check that L1FeeUpperBound works
124117
upperBound, err := gasPriceOracle.GetL1FeeUpperBound(&bind.CallOpts{}, big.NewInt(int64(len(txData))))
125118
require.NoError(t, err)
126119

127-
flzUpperBound := len(txData) + len(txData)/255 + 16
120+
txLen := len(txData) + 68
121+
flzUpperBound := uint64(txLen + txLen/255 + 16)
128122

129-
upperBoundCost := fjordL1Cost(t, gasPriceOracle, int64(flzUpperBound))
123+
upperBoundCost := fjordL1Cost(t, gasPriceOracle, types.RollupCostData{FastLzSize: flzUpperBound})
130124
require.Equal(t, upperBoundCost.Uint64(), upperBound.Uint64())
131125
}
132126

133-
// The new cost function:
134-
// l1BaseFeeScaled = l1BaseFeeScalar * l1BaseFee * 16
135-
// l1BlobFeeScaled = l1BlobFeeScalar * l1BlobBaseFee
136-
// l1FeeScaled = l1BaseFeeScaled + l1BlobFeeScaled
137-
// ((intercept + fastlzCoef*max(fastlzLength, 100)) * l1FeeScaled) / 1e6
138-
func fjordL1Cost(
139-
t require.TestingT,
140-
gasPriceOracle *bindings.GasPriceOracleCaller,
141-
fastLzLength int64,
142-
) *big.Int {
143-
fastLzLength = max(fastLzLength, types.MinTransactionSize.Int64())
144-
127+
func fjordL1Cost(t require.TestingT, gasPriceOracle *bindings.GasPriceOracleCaller, rollupCostData types.RollupCostData) *big.Int {
145128
baseFeeScalar, err := gasPriceOracle.BaseFeeScalar(nil)
146129
require.NoError(t, err)
147130
l1BaseFee, err := gasPriceOracle.L1BaseFee(nil)
@@ -151,16 +134,12 @@ func fjordL1Cost(
151134
blobBaseFee, err := gasPriceOracle.BlobBaseFee(nil)
152135
require.NoError(t, err)
153136

154-
feeScaled := new(big.Int).Mul(new(big.Int).SetUint64(uint64(baseFeeScalar)), big.NewInt(16))
155-
feeScaled = new(big.Int).Mul(feeScaled, l1BaseFee)
156-
feeScaled = new(big.Int).Add(feeScaled, new(big.Int).Mul(new(big.Int).SetUint64(uint64(blobBaseFeeScalar)), blobBaseFee))
157-
158-
cost := new(big.Int).Mul(types.L1CostFastlzCoef, new(big.Int).SetInt64(fastLzLength+68))
159-
cost = new(big.Int).Add(cost, types.L1CostIntercept)
160-
require.True(t, cost.Sign() >= 0)
161-
162-
cost = new(big.Int).Mul(cost, feeScaled)
163-
cost = new(big.Int).Div(cost, new(big.Int).SetInt64(int64(1e12)))
137+
costFunc := types.NewL1CostFuncFjord(
138+
l1BaseFee,
139+
blobBaseFee,
140+
new(big.Int).SetUint64(uint64(baseFeeScalar)),
141+
new(big.Int).SetUint64(uint64(blobBaseFeeScalar)))
164142

165-
return cost
143+
fee, _ := costFunc(rollupCostData)
144+
return fee
166145
}

op-e2e/fastlz/fastlz.c

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
THE SOFTWARE.
22+
23+
This implementation is taken from the following repository/commit:
24+
https://github.com/ariya/FastLZ/tree/344eb4025f9ae866ebf7a2ec48850f7113a97a42
2225
*/
2326

2427
#include "fastlz.h"

op-e2e/fastlz/fastlz.h

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
THE SOFTWARE.
22+
23+
This implementation is taken from the following repository/commit:
24+
https://github.com/ariya/FastLZ/tree/344eb4025f9ae866ebf7a2ec48850f7113a97a42
2225
*/
2326

2427
#ifndef FASTLZ_H

0 commit comments

Comments
 (0)