Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
fix(prover): fix tx.gasLimit flag for prover (#692)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha authored Apr 7, 2024
1 parent 2586c72 commit 6683d54
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
10 changes: 2 additions & 8 deletions prover/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type Config struct {
ContesterMode bool
EnableLivenessBondProof bool
RPCTimeout time.Duration
ProveBlockGasLimit *uint64
ProveBlockGasLimit uint64
HTTPServerPort uint64
Capacity uint64
MinOptimisticTierFee *big.Int
Expand Down Expand Up @@ -76,12 +76,6 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) {
startingBlockID = new(big.Int).SetUint64(c.Uint64(flags.StartingBlockID.Name))
}

var proveBlockTxGasLimit *uint64
if c.IsSet(flags.TxGasLimit.Name) {
gasLimit := c.Uint64(flags.TxGasLimit.Name)
proveBlockTxGasLimit = &gasLimit
}

var allowance = common.Big0
if c.IsSet(flags.Allowance.Name) {
amt, ok := new(big.Int).SetString(c.String(flags.Allowance.Name), 10)
Expand Down Expand Up @@ -149,7 +143,7 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) {
ContesterMode: c.Bool(flags.ContesterMode.Name),
EnableLivenessBondProof: c.Bool(flags.EnableLivenessBondProof.Name),
RPCTimeout: c.Duration(flags.RPCTimeout.Name),
ProveBlockGasLimit: proveBlockTxGasLimit,
ProveBlockGasLimit: c.Uint64(flags.TxGasLimit.Name),
Capacity: c.Uint64(flags.ProverCapacity.Name),
HTTPServerPort: c.Uint64(flags.ProverHTTPServerPort.Name),
MinOptimisticTierFee: new(big.Int).SetUint64(c.Uint64(flags.MinOptimisticTierFee.Name)),
Expand Down
1 change: 1 addition & 0 deletions prover/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ func (p *Prover) initProofSubmitters(
p.proofGenerationCh,
p.cfg.TaikoL2Address,
p.cfg.Graffiti,
p.cfg.ProveBlockGasLimit,
txmgr,
txBuilder,
); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion prover/proof_submitter/proof_contester.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ type ProofContester struct {
// NewProofContester creates a new ProofContester instance.
func NewProofContester(
rpcClient *rpc.Client,
gasLimit uint64,
txmgr *txmgr.SimpleTxManager,
graffiti string,
builder *transaction.ProveBlockTxBuilder,
) *ProofContester {
return &ProofContester{
rpc: rpcClient,
txBuilder: builder,
sender: transaction.NewSender(rpcClient, txmgr, 0), // TODO
sender: transaction.NewSender(rpcClient, txmgr, gasLimit),
graffiti: rpc.StringToBytes32(graffiti),
}
}
Expand Down
5 changes: 3 additions & 2 deletions prover/proof_submitter/proof_submitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func NewProofSubmitter(
resultCh chan *proofProducer.ProofWithHeader,
taikoL2Address common.Address,
graffiti string,
gasLimit uint64,
txmgr *txmgr.SimpleTxManager,
builder *transaction.ProveBlockTxBuilder,
) (*ProofSubmitter, error) {
Expand All @@ -55,7 +56,7 @@ func NewProofSubmitter(
resultCh: resultCh,
anchorValidator: anchorValidator,
txBuilder: builder,
sender: transaction.NewSender(rpcClient, txmgr, 0),
sender: transaction.NewSender(rpcClient, txmgr, gasLimit),
proverAddress: txmgr.From(),
taikoL2Address: taikoL2Address,
graffiti: rpc.StringToBytes32(graffiti),
Expand Down Expand Up @@ -131,7 +132,7 @@ func (s *ProofSubmitter) SubmitProof(
log.Info(
"NewProofSubmitter block proof",
"blockID", proofWithHeader.BlockID,
"proposer", proofWithHeader.Meta.Coinbase,
"coinbase", proofWithHeader.Meta.Coinbase,
"parentHash", proofWithHeader.Header.ParentHash,
"hash", proofWithHeader.Opts.BlockHash,
"stateRoot", proofWithHeader.Opts.StateRoot,
Expand Down
2 changes: 2 additions & 0 deletions prover/proof_submitter/proof_submitter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,14 @@ func (s *ProofSubmitterTestSuite) SetupTest() {
s.proofCh,
common.HexToAddress(os.Getenv("TAIKO_L2_ADDRESS")),
"test",
0,
txMgr,
builder,
)
s.Nil(err)
s.contester = NewProofContester(
s.RPCClient,
0,
txMgr,
"test",
builder,
Expand Down
1 change: 1 addition & 0 deletions prover/prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ func InitFromConfig(ctx context.Context, p *Prover, cfg *Config) (err error) {
// Proof contester
p.proofContester = proofSubmitter.NewProofContester(
p.rpc,
p.cfg.ProveBlockGasLimit,
p.txmgr,
p.cfg.Graffiti,
txBuilder,
Expand Down

0 comments on commit 6683d54

Please sign in to comment.