Commit ab8223d1 authored by Javed Khan's avatar Javed Khan

feat: add flag for sequencer client http url

parent 66481ca9
......@@ -163,6 +163,7 @@ var (
utils.RollupEnforceFeesFlag,
utils.RollupFeeThresholdDownFlag,
utils.RollupFeeThresholdUpFlag,
utils.SequencerClientHttpFlag,
}
rpcFlags = []cli.Flag{
......
......@@ -77,6 +77,7 @@ var AppHelpFlagGroups = []flagGroup{
utils.RollupEnforceFeesFlag,
utils.RollupFeeThresholdDownFlag,
utils.RollupFeeThresholdUpFlag,
utils.SequencerClientHttpFlag,
},
},
{
......
......@@ -861,6 +861,12 @@ var (
Usage: "Allow txs with fees above the current fee up to this amount, must be > 1",
EnvVar: "ROLLUP_FEE_THRESHOLD_UP",
}
SequencerClientHttpFlag = cli.StringFlag{
Name: "sequencer.clienthttp",
Usage: "HTTP endpoint for the sequencer client",
Value: "http://l2geth:8545",
EnvVar: "SEQUENCER_CLIENT_HTTP",
}
)
// MakeDataDir retrieves the currently requested data directory, terminating
......@@ -1137,6 +1143,9 @@ func setRollup(ctx *cli.Context, cfg *rollup.Config) {
val := ctx.GlobalFloat64(RollupFeeThresholdUpFlag.Name)
cfg.FeeThresholdUp = new(big.Float).SetFloat64(val)
}
if ctx.GlobalIsSet(SequencerClientHttpFlag.Name) {
cfg.SequencerClientHttp = ctx.GlobalString(SequencerClientHttpFlag.Name)
}
}
// setLes configures the les server and ultra light client settings from the command line flags.
......
......@@ -136,6 +136,10 @@ func (b *EthAPIBackend) IngestTransactions(txs []*types.Transaction) error {
return nil
}
func (b *EthAPIBackend) SequencerClientHttp() string {
return b.eth.config.Rollup.SequencerClientHttp
}
func (b *EthAPIBackend) HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error) {
// Pending block is only known by the miner
if number == rpc.PendingBlockNumber {
......
......@@ -1659,11 +1659,8 @@ func (s *PublicTransactionPoolAPI) SendRawTransaction(ctx context.Context, encod
return common.Hash{}, errors.New("Cannot send raw transaction while syncing")
}
// Forward tx to sequencer if config is set
// TODO: add forwarding config
if s.b.IsVerifier() {
// TODO: replace with env var L2_URL
client, err := ethclient.Dial("http://l2geth:8545")
client, err := ethclient.Dial(s.b.SequencerClientHttp())
if err != nil {
return common.Hash{}, err
}
......
......@@ -96,6 +96,7 @@ type Backend interface {
SuggestL2GasPrice(context.Context) (*big.Int, error)
SetL2GasPrice(context.Context, *big.Int) error
IngestTransactions([]*types.Transaction) error
SequencerClientHttp() string
}
func GetAPIs(apiBackend Backend) []rpc.API {
......
......@@ -86,6 +86,10 @@ func (b *LesApiBackend) IngestTransactions([]*types.Transaction) error {
panic("not implemented")
}
func (b *LesApiBackend) SequencerClientHttp() string {
return b.eth.config.Rollup.SequencerClientHttp
}
func (b *LesApiBackend) HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error) {
if number == rpc.LatestBlockNumber || number == rpc.PendingBlockNumber {
return b.eth.blockchain.CurrentHeader(), nil
......
......@@ -37,4 +37,6 @@ type Config struct {
// quoted and the transaction being executed
FeeThresholdDown *big.Float
FeeThresholdUp *big.Float
// HTTP endpoint of the sequencer
SequencerClientHttp string
}
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