Commit 95c0463c authored by Mark Tyneway's avatar Mark Tyneway Committed by Kelvin Fichter

l2geth: fix various tests

The tests were not running in CI on the experimental
branch which was an oversight and allowed for various
tests to fail. Now that experimental has been renamed
to regenesis/0.5.0, the tests are running in CI again.
This commit fixes all tests that were broken while
development happened on experimental.

It removes a config option `--rollup.minl2gaslimit`
that is no longer required post regenesis.

It also adds the ability to populate a genesis account
with value in the sync service tests.
parent 4f805355
---
'@eth-optimism/l2geth': patch
---
Fix various geth tests
......@@ -161,7 +161,6 @@ var (
utils.RollupMaxCalldataSizeFlag,
utils.RollupBackendFlag,
utils.RollupEnforceFeesFlag,
utils.RollupMinL2GasLimitFlag,
utils.RollupFeeThresholdDownFlag,
utils.RollupFeeThresholdUpFlag,
}
......
......@@ -75,7 +75,6 @@ var AppHelpFlagGroups = []flagGroup{
utils.RollupMaxCalldataSizeFlag,
utils.RollupBackendFlag,
utils.RollupEnforceFeesFlag,
utils.RollupMinL2GasLimitFlag,
utils.RollupFeeThresholdDownFlag,
utils.RollupFeeThresholdUpFlag,
},
......
......@@ -851,11 +851,6 @@ var (
Usage: "Disable transactions with 0 gas price",
EnvVar: "ROLLUP_ENFORCE_FEES",
}
RollupMinL2GasLimitFlag = cli.Uint64Flag{
Name: "rollup.minl2gaslimit",
Usage: "Minimum accepted L2 gas limit",
EnvVar: "ROLLUP_MIN_L2_GAS_LIMIT",
}
RollupFeeThresholdDownFlag = cli.Float64Flag{
Name: "rollup.feethresholddown",
Usage: "Allow txs with fees below the current fee up to this amount, must be < 1",
......@@ -1134,10 +1129,6 @@ func setRollup(ctx *cli.Context, cfg *rollup.Config) {
if ctx.GlobalIsSet(RollupEnforceFeesFlag.Name) {
cfg.EnforceFees = true
}
if ctx.GlobalIsSet(RollupMinL2GasLimitFlag.Name) {
val := ctx.GlobalUint64(RollupMinL2GasLimitFlag.Name)
cfg.MinL2GasLimit = new(big.Int).SetUint64(val)
}
if ctx.GlobalIsSet(RollupFeeThresholdDownFlag.Name) {
val := ctx.GlobalFloat64(RollupFeeThresholdDownFlag.Name)
cfg.FeeThresholdDown = new(big.Float).SetFloat64(val)
......
......@@ -40,6 +40,7 @@ func skipWithoutSolc(t *testing.T) {
}
func TestSolidityCompiler(t *testing.T) {
t.Skip("Not required for optimism")
skipWithoutSolc(t)
contracts, err := CompileSolidityString("", testSource)
......
......@@ -98,7 +98,7 @@ func newTester(t *testing.T, confOverride func(*eth.Config)) *tester {
t.Fatalf("failed to create node: %v", err)
}
ethConf := &eth.Config{
Genesis: core.DeveloperGenesisBlock(15, common.Address{}, common.Address{}, common.Address{}, common.Address{}, common.Address{}, common.Address{}, "", nil, 12000000),
Genesis: core.DeveloperGenesisBlock(15, common.Address{}),
Miner: miner.Config{
Etherbase: common.HexToAddress(testAddress),
},
......
......@@ -198,6 +198,11 @@ type ReceiptForStorage Receipt
// EncodeRLP implements rlp.Encoder, and flattens all content fields of a receipt
// into an RLP stream.
func (r *ReceiptForStorage) EncodeRLP(w io.Writer) error {
feeScalar := ""
if r.FeeScalar != nil {
feeScalar = r.FeeScalar.String()
}
enc := &storedReceiptRLP{
PostStateOrStatus: (*Receipt)(r).statusEncoding(),
CumulativeGasUsed: r.CumulativeGasUsed,
......@@ -205,7 +210,7 @@ func (r *ReceiptForStorage) EncodeRLP(w io.Writer) error {
L1GasUsed: r.L1GasUsed,
L1GasPrice: r.L1GasPrice,
L1Fee: r.L1Fee,
FeeScalar: r.FeeScalar.String(),
FeeScalar: feeScalar,
}
for i, log := range r.Logs {
enc.Logs[i] = (*LogForStorage)(log)
......@@ -227,6 +232,7 @@ func (r *ReceiptForStorage) DecodeRLP(s *rlp.Stream) error {
if err := decodeStoredReceiptRLP(r, blob); err == nil {
return nil
}
if err := decodeV3StoredReceiptRLP(r, blob); err == nil {
return nil
}
......@@ -249,9 +255,13 @@ func decodeStoredReceiptRLP(r *ReceiptForStorage, blob []byte) error {
r.Bloom = CreateBloom(Receipts{(*Receipt)(r)})
// UsingOVM
scalar, ok := new(big.Float).SetString(stored.FeeScalar)
if !ok {
return errors.New("cannot parse fee scalar")
scalar := new(big.Float)
if stored.FeeScalar != "" {
var ok bool
scalar, ok = scalar.SetString(stored.FeeScalar)
if !ok {
return errors.New("cannot parse fee scalar")
}
}
r.L1GasUsed = stored.L1GasUsed
r.L1GasPrice = stored.L1GasPrice
......
......@@ -128,7 +128,7 @@ func odrContractCall(ctx context.Context, db ethdb.Database, config *params.Chai
from := statedb.GetOrNewStateObject(bankAddr)
from.SetBalance(math.MaxBig256)
msg := callmsg{types.NewMessage(from.Address(), &testContractAddr, 0, new(big.Int), 100000, new(big.Int), data, false, nil, nil, 0, types.QueueOriginSequencer)}
msg := callmsg{types.NewMessage(from.Address(), &testContractAddr, 0, new(big.Int), 100000, new(big.Int), data, false, nil, 0, types.QueueOriginSequencer)}
context := core.NewEVMContext(msg, header, bc, nil)
vmenv := vm.NewEVM(context, statedb, config, vm.Config{})
......@@ -142,7 +142,7 @@ func odrContractCall(ctx context.Context, db ethdb.Database, config *params.Chai
header := lc.GetHeaderByHash(bhash)
state := light.NewState(ctx, header, lc.Odr())
state.SetBalance(bankAddr, math.MaxBig256)
msg := callmsg{types.NewMessage(bankAddr, &testContractAddr, 0, new(big.Int), 100000, new(big.Int), data, false, nil, nil, 0, types.QueueOriginSequencer)}
msg := callmsg{types.NewMessage(bankAddr, &testContractAddr, 0, new(big.Int), 100000, new(big.Int), data, false, nil, 0, types.QueueOriginSequencer)}
context := core.NewEVMContext(msg, header, lc, nil)
vmenv := vm.NewEVM(context, state, config, vm.Config{})
gp := new(core.GasPool).AddGas(math.MaxUint64)
......
......@@ -194,7 +194,7 @@ func odrContractCall(ctx context.Context, db ethdb.Database, bc *core.BlockChain
// Perform read-only call.
st.SetBalance(testBankAddress, math.MaxBig256)
msg := callmsg{types.NewMessage(testBankAddress, &testContractAddr, 0, new(big.Int), 1000000, new(big.Int), data, false, nil, nil, 0, types.QueueOriginSequencer)}
msg := callmsg{types.NewMessage(testBankAddress, &testContractAddr, 0, new(big.Int), 1000000, new(big.Int), data, false, nil, 0, types.QueueOriginSequencer)}
context := core.NewEVMContext(msg, header, chain, nil)
vmenv := vm.NewEVM(context, st, config, vm.Config{})
gp := new(core.GasPool).AddGas(math.MaxUint64)
......
......@@ -32,10 +32,6 @@ type Config struct {
Backend Backend
// Only accept transactions with fees
EnforceFees bool
// Prevent transactions with a L2 gas limit lower than this value
// The L2 gas limit is parsed from the `tx.gasPrice`, see the
// `rollup/fees` package for more information
MinL2GasLimit *big.Int
// Allow fees within a buffer upwards or downwards
// to take fee volatility into account between being
// quoted and the transaction being executed
......
......@@ -28,10 +28,10 @@ var (
)
// GasPriceOracleABI is the input ABI used to generate the binding from.
const GasPriceOracleABI = "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"GasPriceUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"L1BaseFeeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"OverheadUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"ScalarUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gasPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"getL1Fee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"getL1GasUsed\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1BaseFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"overhead\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"scalar\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_gasPrice\",\"type\":\"uint256\"}],\"name\":\"setGasPrice\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_baseFee\",\"type\":\"uint256\"}],\"name\":\"setL1BaseFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_overhead\",\"type\":\"uint256\"}],\"name\":\"setOverhead\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_scalar\",\"type\":\"uint256\"}],\"name\":\"setScalar\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"
const GasPriceOracleABI = "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"DecimalsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"GasPriceUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"L1BaseFeeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"OverheadUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"ScalarUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gasPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"getL1Fee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"getL1GasUsed\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1BaseFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"overhead\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"scalar\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_decimals\",\"type\":\"uint256\"}],\"name\":\"setDecimals\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_gasPrice\",\"type\":\"uint256\"}],\"name\":\"setGasPrice\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_baseFee\",\"type\":\"uint256\"}],\"name\":\"setL1BaseFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_overhead\",\"type\":\"uint256\"}],\"name\":\"setOverhead\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_scalar\",\"type\":\"uint256\"}],\"name\":\"setScalar\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"
// GasPriceOracleBin is the compiled bytecode used for deploying new contracts.
var GasPriceOracleBin = "0x6080604052610abe6003556216e360600455600660055534801561002257600080fd5b50604051610be4380380610be48339818101604052602081101561004557600080fd5b50516000610051610098565b600080546001600160a01b0319166001600160a01b038316908117825560405192935091600080516020610bc4833981519152908290a3506100928161009c565b506101ad565b3390565b6100a4610098565b6001600160a01b03166100b561019e565b6001600160a01b031614610110576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166101555760405162461bcd60e51b8152600401808060200182810382526026815260200180610b9e6026913960400191505060405180910390fd5b600080546040516001600160a01b0380851693921691600080516020610bc483398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031690565b6109e2806101bc6000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638da5cb5b1161008c578063de26c4a111610066578063de26c4a114610261578063f2fde38b14610307578063f45e65d81461032d578063fe173b9714610335576100ea565b80638da5cb5b14610203578063bede39b514610227578063bf1fe42014610244576100ea565b806349948e0e116100c857806349948e0e14610130578063519b4bd3146101d657806370465597146101de578063715018a6146101fb576100ea565b80630c18c162146100ef578063313ce567146101095780633577afc514610111575b600080fd5b6100f761033d565b60408051918252519081900360200190f35b6100f7610343565b61012e6004803603602081101561012757600080fd5b5035610349565b005b6100f76004803603602081101561014657600080fd5b81019060208101813564010000000081111561016157600080fd5b82018360208201111561017357600080fd5b8035906020019184600183028401116401000000008311171561019557600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506103e6945050505050565b6100f7610435565b61012e600480360360208110156101f457600080fd5b503561043b565b61012e6104d8565b61020b610584565b604080516001600160a01b039092168252519081900360200190f35b61012e6004803603602081101561023d57600080fd5b5035610593565b61012e6004803603602081101561025a57600080fd5b5035610630565b6100f76004803603602081101561027757600080fd5b81019060208101813564010000000081111561029257600080fd5b8201836020820111156102a457600080fd5b803590602001918460018302840111640100000000831117156102c657600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506106cd945050505050565b61012e6004803603602081101561031d57600080fd5b50356001600160a01b0316610739565b6100f761083b565b6100f7610841565b60035481565b60055481565b610351610847565b6001600160a01b0316610362610584565b6001600160a01b0316146103ab576040805162461bcd60e51b815260206004820181905260248201526000805160206109b6833981519152604482015290519081900360640190fd5b60038190556040805182815290517f32740b35c0ea213650f60d44366b4fb211c9033b50714e4a1d34e65d5beb9bb49181900360200190a150565b6000806103f2836106cd565b905060006104028260025461084b565b90506000600554600a0a9050600061041c8360045461084b565b9050600061042a82846108ad565b979650505050505050565b60025481565b610443610847565b6001600160a01b0316610454610584565b6001600160a01b03161461049d576040805162461bcd60e51b815260206004820181905260248201526000805160206109b6833981519152604482015290519081900360640190fd5b60048190556040805182815290517f3336cd9708eaf2769a0f0dc0679f30e80f15dcd88d1921b5a16858e8b85c591a9181900360200190a150565b6104e0610847565b6001600160a01b03166104f1610584565b6001600160a01b03161461053a576040805162461bcd60e51b815260206004820181905260248201526000805160206109b6833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b61059b610847565b6001600160a01b03166105ac610584565b6001600160a01b0316146105f5576040805162461bcd60e51b815260206004820181905260248201526000805160206109b6833981519152604482015290519081900360640190fd5b60028190556040805182815290517f351fb23757bb5ea0546c85b7996ddd7155f96b939ebaa5ff7bc49c75f27f2c449181900360200190a150565b610638610847565b6001600160a01b0316610649610584565b6001600160a01b031614610692576040805162461bcd60e51b815260206004820181905260248201526000805160206109b6833981519152604482015290519081900360640190fd5b60018190556040805182815290517ffcdccc6074c6c42e4bd578aa9870c697dc976a270968452d2b8c8dc369fae3969181900360200190a150565b600080805b8351811015610714578381815181106106e757fe5b01602001516001600160f81b0319166107055760048201915061070c565b6010820191505b6001016106d2565b50600061072382600354610914565b905061073181610440610914565b949350505050565b610741610847565b6001600160a01b0316610752610584565b6001600160a01b03161461079b576040805162461bcd60e51b815260206004820181905260248201526000805160206109b6833981519152604482015290519081900360640190fd5b6001600160a01b0381166107e05760405162461bcd60e51b815260040180806020018281038252602681526020018061096f6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60045481565b60015481565b3390565b60008261085a575060006108a7565b8282028284828161086757fe5b04146108a45760405162461bcd60e51b81526004018080602001828103825260218152602001806109956021913960400191505060405180910390fd5b90505b92915050565b6000808211610903576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161090c57fe5b049392505050565b6000828201838110156108a4576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fdfe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a164736f6c6343000706000a4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573738be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0"
var GasPriceOracleBin = "0x608060405234801561001057600080fd5b50604051610e55380380610e5583398101604081905261002f91610167565b61003833610047565b61004181610097565b50610197565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000546001600160a01b031633146100f65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6001600160a01b03811661015b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016100ed565b61016481610047565b50565b60006020828403121561017957600080fd5b81516001600160a01b038116811461019057600080fd5b9392505050565b610caf806101a66000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c80638c8885c811610097578063de26c4a111610066578063de26c4a1146101cc578063f2fde38b146101df578063f45e65d8146101f2578063fe173b97146101fb57600080fd5b80638c8885c81461016b5780638da5cb5b1461017e578063bede39b5146101a6578063bf1fe420146101b957600080fd5b806349948e0e116100d357806349948e0e14610134578063519b4bd3146101475780637046559714610150578063715018a61461016357600080fd5b80630c18c162146100fa578063313ce567146101165780633577afc51461011f575b600080fd5b61010360035481565b6040519081526020015b60405180910390f35b61010360055481565b61013261012d3660046108d0565b610204565b005b610103610142366004610918565b6102c6565b61010360025481565b61013261015e3660046108d0565b610322565b6101326103d8565b6101326101793660046108d0565b610465565b60005460405173ffffffffffffffffffffffffffffffffffffffff909116815260200161010d565b6101326101b43660046108d0565b61051b565b6101326101c73660046108d0565b6105d1565b6101036101da366004610918565b610687565b6101326101ed3660046109e7565b61072b565b61010360045481565b61010360015481565b60005473ffffffffffffffffffffffffffffffffffffffff16331461028a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b60038190556040518181527f32740b35c0ea213650f60d44366b4fb211c9033b50714e4a1d34e65d5beb9bb4906020015b60405180910390a150565b6000806102d283610687565b90506000600254826102e49190610a53565b90506000600554600a6102f79190610bb2565b90506000600454836103099190610a53565b905060006103178383610bbe565b979650505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146103a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610281565b60048190556040518181527f3336cd9708eaf2769a0f0dc0679f30e80f15dcd88d1921b5a16858e8b85c591a906020016102bb565b60005473ffffffffffffffffffffffffffffffffffffffff163314610459576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610281565b610463600061085b565b565b60005473ffffffffffffffffffffffffffffffffffffffff1633146104e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610281565b60058190556040518181527fd68112a8707e326d08be3656b528c1bcc5bbbfc47f4177e2179b14d8640838c1906020016102bb565b60005473ffffffffffffffffffffffffffffffffffffffff16331461059c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610281565b60028190556040518181527f351fb23757bb5ea0546c85b7996ddd7155f96b939ebaa5ff7bc49c75f27f2c44906020016102bb565b60005473ffffffffffffffffffffffffffffffffffffffff163314610652576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610281565b60018190556040518181527ffcdccc6074c6c42e4bd578aa9870c697dc976a270968452d2b8c8dc369fae396906020016102bb565b600080805b8351811015610704578381815181106106a7576106a7610bf9565b01602001517fff00000000000000000000000000000000000000000000000000000000000000166106e4576106dd600483610c28565b91506106f2565b6106ef601083610c28565b91505b806106fc81610c40565b91505061068c565b506000600354826107159190610c28565b905061072381610440610c28565b949350505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146107ac576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610281565b73ffffffffffffffffffffffffffffffffffffffff811661084f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610281565b6108588161085b565b50565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156108e257600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60006020828403121561092a57600080fd5b813567ffffffffffffffff8082111561094257600080fd5b818401915084601f83011261095657600080fd5b813581811115610968576109686108e9565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019083821181831017156109ae576109ae6108e9565b816040528281528760208487010111156109c757600080fd5b826020860160208301376000928101602001929092525095945050505050565b6000602082840312156109f957600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114610a1d57600080fd5b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615610a8b57610a8b610a24565b500290565b600181815b80851115610ae957817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115610acf57610acf610a24565b80851615610adc57918102915b93841c9390800290610a95565b509250929050565b600082610b0057506001610bac565b81610b0d57506000610bac565b8160018114610b235760028114610b2d57610b49565b6001915050610bac565b60ff841115610b3e57610b3e610a24565b50506001821b610bac565b5060208310610133831016604e8410600b8410161715610b6c575081810a610bac565b610b768383610a90565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115610ba857610ba8610a24565b0290505b92915050565b6000610a1d8383610af1565b600082610bf4577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008219821115610c3b57610c3b610a24565b500190565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415610c7257610c72610a24565b506001019056fea2646970667358221220f621ba3a2be0d1a6013dd55747de8ced461c9dc210b1ed78e1fadadb047e304064736f6c63430008090033"
// DeployGasPriceOracle deploys a new Ethereum contract, binding an instance of GasPriceOracle to it.
func DeployGasPriceOracle(auth *bind.TransactOpts, backend bind.ContractBackend, _owner common.Address) (common.Address, *types.Transaction, *GasPriceOracle, error) {
......@@ -418,6 +418,27 @@ func (_GasPriceOracle *GasPriceOracleTransactorSession) RenounceOwnership() (*ty
return _GasPriceOracle.Contract.RenounceOwnership(&_GasPriceOracle.TransactOpts)
}
// SetDecimals is a paid mutator transaction binding the contract method 0x8c8885c8.
//
// Solidity: function setDecimals(uint256 _decimals) returns()
func (_GasPriceOracle *GasPriceOracleTransactor) SetDecimals(opts *bind.TransactOpts, _decimals *big.Int) (*types.Transaction, error) {
return _GasPriceOracle.contract.Transact(opts, "setDecimals", _decimals)
}
// SetDecimals is a paid mutator transaction binding the contract method 0x8c8885c8.
//
// Solidity: function setDecimals(uint256 _decimals) returns()
func (_GasPriceOracle *GasPriceOracleSession) SetDecimals(_decimals *big.Int) (*types.Transaction, error) {
return _GasPriceOracle.Contract.SetDecimals(&_GasPriceOracle.TransactOpts, _decimals)
}
// SetDecimals is a paid mutator transaction binding the contract method 0x8c8885c8.
//
// Solidity: function setDecimals(uint256 _decimals) returns()
func (_GasPriceOracle *GasPriceOracleTransactorSession) SetDecimals(_decimals *big.Int) (*types.Transaction, error) {
return _GasPriceOracle.Contract.SetDecimals(&_GasPriceOracle.TransactOpts, _decimals)
}
// SetGasPrice is a paid mutator transaction binding the contract method 0xbf1fe420.
//
// Solidity: function setGasPrice(uint256 _gasPrice) returns()
......@@ -523,6 +544,139 @@ func (_GasPriceOracle *GasPriceOracleTransactorSession) TransferOwnership(newOwn
return _GasPriceOracle.Contract.TransferOwnership(&_GasPriceOracle.TransactOpts, newOwner)
}
// GasPriceOracleDecimalsUpdatedIterator is returned from FilterDecimalsUpdated and is used to iterate over the raw logs and unpacked data for DecimalsUpdated events raised by the GasPriceOracle contract.
type GasPriceOracleDecimalsUpdatedIterator struct {
Event *GasPriceOracleDecimalsUpdated // Event containing the contract specifics and raw log
contract *bind.BoundContract // Generic contract to use for unpacking event data
event string // Event name to use for unpacking event data
logs chan types.Log // Log channel receiving the found contract events
sub ethereum.Subscription // Subscription for errors, completion and termination
done bool // Whether the subscription completed delivering logs
fail error // Occurred error to stop iteration
}
// Next advances the iterator to the subsequent event, returning whether there
// are any more events found. In case of a retrieval or parsing error, false is
// returned and Error() can be queried for the exact failure.
func (it *GasPriceOracleDecimalsUpdatedIterator) Next() bool {
// If the iterator failed, stop iterating
if it.fail != nil {
return false
}
// If the iterator completed, deliver directly whatever's available
if it.done {
select {
case log := <-it.logs:
it.Event = new(GasPriceOracleDecimalsUpdated)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
default:
return false
}
}
// Iterator still in progress, wait for either a data or an error event
select {
case log := <-it.logs:
it.Event = new(GasPriceOracleDecimalsUpdated)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
case err := <-it.sub.Err():
it.done = true
it.fail = err
return it.Next()
}
}
// Error returns any retrieval or parsing error occurred during filtering.
func (it *GasPriceOracleDecimalsUpdatedIterator) Error() error {
return it.fail
}
// Close terminates the iteration process, releasing any pending underlying
// resources.
func (it *GasPriceOracleDecimalsUpdatedIterator) Close() error {
it.sub.Unsubscribe()
return nil
}
// GasPriceOracleDecimalsUpdated represents a DecimalsUpdated event raised by the GasPriceOracle contract.
type GasPriceOracleDecimalsUpdated struct {
Arg0 *big.Int
Raw types.Log // Blockchain specific contextual infos
}
// FilterDecimalsUpdated is a free log retrieval operation binding the contract event 0xd68112a8707e326d08be3656b528c1bcc5bbbfc47f4177e2179b14d8640838c1.
//
// Solidity: event DecimalsUpdated(uint256 )
func (_GasPriceOracle *GasPriceOracleFilterer) FilterDecimalsUpdated(opts *bind.FilterOpts) (*GasPriceOracleDecimalsUpdatedIterator, error) {
logs, sub, err := _GasPriceOracle.contract.FilterLogs(opts, "DecimalsUpdated")
if err != nil {
return nil, err
}
return &GasPriceOracleDecimalsUpdatedIterator{contract: _GasPriceOracle.contract, event: "DecimalsUpdated", logs: logs, sub: sub}, nil
}
// WatchDecimalsUpdated is a free log subscription operation binding the contract event 0xd68112a8707e326d08be3656b528c1bcc5bbbfc47f4177e2179b14d8640838c1.
//
// Solidity: event DecimalsUpdated(uint256 )
func (_GasPriceOracle *GasPriceOracleFilterer) WatchDecimalsUpdated(opts *bind.WatchOpts, sink chan<- *GasPriceOracleDecimalsUpdated) (event.Subscription, error) {
logs, sub, err := _GasPriceOracle.contract.WatchLogs(opts, "DecimalsUpdated")
if err != nil {
return nil, err
}
return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe()
for {
select {
case log := <-logs:
// New log arrived, parse the event and forward to the user
event := new(GasPriceOracleDecimalsUpdated)
if err := _GasPriceOracle.contract.UnpackLog(event, "DecimalsUpdated", log); err != nil {
return err
}
event.Raw = log
select {
case sink <- event:
case err := <-sub.Err():
return err
case <-quit:
return nil
}
case err := <-sub.Err():
return err
case <-quit:
return nil
}
}
}), nil
}
// ParseDecimalsUpdated is a log parse operation binding the contract event 0xd68112a8707e326d08be3656b528c1bcc5bbbfc47f4177e2179b14d8640838c1.
//
// Solidity: event DecimalsUpdated(uint256 )
func (_GasPriceOracle *GasPriceOracleFilterer) ParseDecimalsUpdated(log types.Log) (*GasPriceOracleDecimalsUpdated, error) {
event := new(GasPriceOracleDecimalsUpdated)
if err := _GasPriceOracle.contract.UnpackLog(event, "DecimalsUpdated", log); err != nil {
return nil, err
}
return event, nil
}
// GasPriceOracleGasPriceUpdatedIterator is returned from FilterGasPriceUpdated and is used to iterate over the raw logs and unpacked data for GasPriceUpdated events raised by the GasPriceOracle contract.
type GasPriceOracleGasPriceUpdatedIterator struct {
Event *GasPriceOracleGasPriceUpdated // Event containing the contract specifics and raw log
......
......@@ -111,6 +111,9 @@ func TestCalculateFee(t *testing.T) {
msg, _ := tx.AsMessage(signer)
l1MsgFee, err := fees.CalculateL1MsgFee(msg, state, &addr)
if err != nil {
t.Fatal(err)
}
if l1MsgFee.Cmp(expectL1Fee) != 0 {
t.Fatal("l1 msg fee not computed correctly")
}
......
......@@ -66,7 +66,6 @@ type SyncService struct {
gasPriceOracleOwnerAddressLock *sync.RWMutex
enforceFees bool
signer types.Signer
minL2GasLimit *big.Int
feeThresholdUp *big.Float
feeThresholdDown *big.Float
}
......@@ -123,11 +122,6 @@ func NewSyncService(ctx context.Context, cfg Config, txpool *core.TxPool, bc *co
cfg.FeeThresholdUp)
}
}
if cfg.MinL2GasLimit == nil {
value := new(big.Int)
log.Info("Sanitizing minimum L2 gas limit", "value", value)
cfg.MinL2GasLimit = value
}
service := SyncService{
ctx: ctx,
......@@ -147,7 +141,6 @@ func NewSyncService(ctx context.Context, cfg Config, txpool *core.TxPool, bc *co
gasPriceOracleOwnerAddressLock: new(sync.RWMutex),
enforceFees: cfg.EnforceFees,
signer: types.NewEIP155Signer(chainID),
minL2GasLimit: cfg.MinL2GasLimit,
feeThresholdDown: cfg.FeeThresholdDown,
feeThresholdUp: cfg.FeeThresholdUp,
}
......
......@@ -22,12 +22,11 @@ import (
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rollup/fees"
"github.com/ethereum/go-ethereum/rollup/rcfg"
)
func setupLatestEthContextTest() (*SyncService, *EthContext) {
service, _, _, _ := newTestSyncService(false)
service, _, _, _ := newTestSyncService(false, nil)
resp := &EthContext{
BlockNumber: uint64(10),
BlockHash: common.Hash{},
......@@ -98,7 +97,7 @@ func TestSyncServiceContextUpdated(t *testing.T) {
// after the transaction enqueued event is emitted. Set `false` as
// the argument to start as a sequencer
func TestSyncServiceTransactionEnqueued(t *testing.T) {
service, txCh, _, err := newTestSyncService(false)
service, txCh, _, err := newTestSyncService(false, nil)
if err != nil {
t.Fatal(err)
}
......@@ -160,7 +159,7 @@ func TestSyncServiceTransactionEnqueued(t *testing.T) {
}
func TestTransactionToTipNoIndex(t *testing.T) {
service, txCh, _, err := newTestSyncService(false)
service, txCh, _, err := newTestSyncService(false, nil)
if err != nil {
t.Fatal(err)
}
......@@ -211,7 +210,7 @@ func TestTransactionToTipNoIndex(t *testing.T) {
}
func TestTransactionToTipTimestamps(t *testing.T) {
service, txCh, _, err := newTestSyncService(false)
service, txCh, _, err := newTestSyncService(false, nil)
if err != nil {
t.Fatal(err)
}
......@@ -275,7 +274,7 @@ func TestTransactionToTipTimestamps(t *testing.T) {
}
func TestApplyIndexedTransaction(t *testing.T) {
service, txCh, _, err := newTestSyncService(true)
service, txCh, _, err := newTestSyncService(true, nil)
if err != nil {
t.Fatal(err)
}
......@@ -318,7 +317,7 @@ func TestApplyIndexedTransaction(t *testing.T) {
}
func TestApplyBatchedTransaction(t *testing.T) {
service, txCh, _, err := newTestSyncService(true)
service, txCh, _, err := newTestSyncService(true, nil)
if err != nil {
t.Fatal(err)
}
......@@ -355,7 +354,7 @@ func TestApplyBatchedTransaction(t *testing.T) {
}
func TestIsAtTip(t *testing.T) {
service, _, _, err := newTestSyncService(true)
service, _, _, err := newTestSyncService(true, nil)
if err != nil {
t.Fatal(err)
}
......@@ -428,7 +427,7 @@ func TestIsAtTip(t *testing.T) {
}
func TestSyncQueue(t *testing.T) {
service, txCh, _, err := newTestSyncService(true)
service, txCh, _, err := newTestSyncService(true, nil)
if err != nil {
t.Fatal(err)
}
......@@ -485,7 +484,7 @@ func TestSyncQueue(t *testing.T) {
}
func TestSyncServiceL1GasPrice(t *testing.T) {
service, _, _, err := newTestSyncService(true)
service, _, _, err := newTestSyncService(true, nil)
setupMockClient(service, map[string]interface{}{})
if err != nil {
......@@ -523,7 +522,7 @@ func TestSyncServiceL1GasPrice(t *testing.T) {
}
func TestSyncServiceL2GasPrice(t *testing.T) {
service, _, _, err := newTestSyncService(true)
service, _, _, err := newTestSyncService(true, nil)
if err != nil {
t.Fatal(err)
}
......@@ -557,40 +556,8 @@ func TestSyncServiceL2GasPrice(t *testing.T) {
}
}
func TestSyncServiceMinL2GasPrice(t *testing.T) {
service, _, _, err := newTestSyncService(true)
if err != nil {
t.Fatal(err)
}
service.minL2GasLimit = new(big.Int).SetUint64(10_000_000)
signer := types.NewEIP155Signer(big.NewInt(420))
// Generate a key
key, _ := crypto.GenerateKey()
// Create a transaction
gasLimit := uint64(100)
tx := types.NewTransaction(0, common.Address{}, big.NewInt(0), gasLimit, big.NewInt(15000000), []byte{})
// Make sure the gas limit is set correctly
if tx.Gas() != gasLimit {
t.Fatal("gas limit not set correctly")
}
// Sign the dummy tx with the owner key
signedTx, err := types.SignTx(tx, signer, key)
if err != nil {
t.Fatal(err)
}
// Sanity check the L2 gas limit
if tx.L2Gas() > service.minL2GasLimit.Uint64() {
t.Fatal("L2 gas limit expected to be smaller than min accepted by sequencer")
}
// Verify the fee of the signed tx, ensure it does not error
err = service.verifyFee(signedTx)
if !errors.Is(err, fees.ErrL2GasLimitTooLow) {
t.Fatal(err)
}
}
func TestSyncServiceGasPriceOracleOwnerAddress(t *testing.T) {
service, _, _, err := newTestSyncService(true)
service, _, _, err := newTestSyncService(true, nil)
if err != nil {
t.Fatal(err)
}
......@@ -624,7 +591,7 @@ func TestSyncServiceGasPriceOracleOwnerAddress(t *testing.T) {
// Only the gas price oracle owner can send 0 gas price txs
// when fees are enforced
func TestFeeGasPriceOracleOwnerTransactions(t *testing.T) {
service, _, _, err := newTestSyncService(true)
service, _, _, err := newTestSyncService(true, nil)
if err != nil {
t.Fatal(err)
}
......@@ -680,7 +647,7 @@ func TestFeeGasPriceOracleOwnerTransactions(t *testing.T) {
// Pass true to set as a verifier
func TestSyncServiceSync(t *testing.T) {
service, txCh, sub, err := newTestSyncService(true)
service, txCh, sub, err := newTestSyncService(true, nil)
defer sub.Unsubscribe()
if err != nil {
t.Fatal(err)
......@@ -732,7 +699,7 @@ func TestSyncServiceSync(t *testing.T) {
}
func TestInitializeL1ContextPostGenesis(t *testing.T) {
service, _, _, err := newTestSyncService(true)
service, _, _, err := newTestSyncService(true, nil)
if err != nil {
t.Fatal(err)
}
......@@ -798,7 +765,7 @@ func TestInitializeL1ContextPostGenesis(t *testing.T) {
func TestBadFeeThresholds(t *testing.T) {
// Create the deps for the sync service
cfg, txPool, chain, db, err := newTestSyncServiceDeps(false)
cfg, txPool, chain, db, err := newTestSyncServiceDeps(false, nil)
if err != nil {
t.Fatal(err)
}
......@@ -843,14 +810,21 @@ func TestBadFeeThresholds(t *testing.T) {
}
}
func newTestSyncServiceDeps(isVerifier bool) (Config, *core.TxPool, *core.BlockChain, ethdb.Database, error) {
func newTestSyncServiceDeps(isVerifier bool, alloc *common.Address) (Config, *core.TxPool, *core.BlockChain, ethdb.Database, error) {
chainCfg := params.AllEthashProtocolChanges
chainID := big.NewInt(420)
chainCfg.ChainID = chainID
engine := ethash.NewFaker()
db := rawdb.NewMemoryDatabase()
_ = new(core.Genesis).MustCommit(db)
genesis := new(core.Genesis)
if alloc != nil {
genesis.Alloc = make(core.GenesisAlloc)
genesis.Alloc[*alloc] = core.GenesisAccount{
Balance: new(big.Int).SetUint64(100000000000000),
}
}
_ = genesis.MustCommit(db)
chain, err := core.NewBlockChain(db, nil, chainCfg, engine, vm.Config{}, nil)
if err != nil {
return Config{}, nil, nil, nil, fmt.Errorf("Cannot initialize blockchain: %w", err)
......@@ -869,8 +843,8 @@ func newTestSyncServiceDeps(isVerifier bool) (Config, *core.TxPool, *core.BlockC
return cfg, txPool, chain, db, nil
}
func newTestSyncService(isVerifier bool) (*SyncService, chan core.NewTxsEvent, event.Subscription, error) {
cfg, txPool, chain, db, err := newTestSyncServiceDeps(isVerifier)
func newTestSyncService(isVerifier bool, alloc *common.Address) (*SyncService, chan core.NewTxsEvent, event.Subscription, error) {
cfg, txPool, chain, db, err := newTestSyncServiceDeps(isVerifier, alloc)
if err != nil {
return nil, nil, nil, fmt.Errorf("Cannot initialize syncservice: %w", err)
}
......
......@@ -279,7 +279,7 @@ func (tx *stTransaction) toMessage(ps stPostState) (core.Message, error) {
return nil, fmt.Errorf("invalid tx data %q", dataHex)
}
msg := types.NewMessage(from, to, tx.Nonce, value, gasLimit, tx.GasPrice, data, true, nil, nil, 0, types.QueueOriginSequencer)
msg := types.NewMessage(from, to, tx.Nonce, value, gasLimit, tx.GasPrice, data, true, nil, 0, types.QueueOriginSequencer)
return msg, nil
}
......
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