diff --git a/cmd/flags/prover.go b/cmd/flags/prover.go index 2fba90db1..c25c94e3d 100644 --- a/cmd/flags/prover.go +++ b/cmd/flags/prover.go @@ -175,7 +175,7 @@ var ( } Allowance = &cli.StringFlag{ Name: "prover.allowance", - Usage: "Amount to approve TaikoL1 contract for TaikoToken usage", + Usage: "Amount to approve AssignmentHook contract for TaikoToken usage", Category: proverCategory, } GuardianProverHealthCheckServerEndpoint = &cli.StringFlag{ diff --git a/prover/prover.go b/prover/prover.go index d7212b0d8..c34b21ce4 100644 --- a/prover/prover.go +++ b/prover/prover.go @@ -322,13 +322,13 @@ func (p *Prover) setApprovalAmount(ctx context.Context) error { allowance, err := p.rpc.TaikoToken.Allowance( &bind.CallOpts{Context: ctx}, p.proverAddress, - p.cfg.TaikoL1Address, + p.cfg.AssignmentHookAddress, ) if err != nil { return err } - log.Info("Existing allowance for TaikoL1 contract", "allowance", allowance.String()) + log.Info("Existing allowance for AssignmentHook contract", "allowance", allowance.String()) if allowance.Cmp(p.cfg.Allowance) >= 0 { log.Info( @@ -348,11 +348,11 @@ func (p *Prover) setApprovalAmount(ctx context.Context) error { } opts.Context = ctx - log.Info("Approving TaikoL1 for taiko token", "allowance", p.cfg.Allowance.String()) + log.Info("Approving AssignmentHook for taiko token", "allowance", p.cfg.Allowance.String()) tx, err := p.rpc.TaikoToken.Approve( opts, - p.cfg.TaikoL1Address, + p.cfg.AssignmentHookAddress, p.cfg.Allowance, ) if err != nil { @@ -364,17 +364,17 @@ func (p *Prover) setApprovalAmount(ctx context.Context) error { return err } - log.Info("Approved TaikoL1 for taiko token", "txHash", receipt.TxHash.Hex()) + log.Info("Approved AssignmentHook for taiko token", "txHash", receipt.TxHash.Hex()) if allowance, err = p.rpc.TaikoToken.Allowance( &bind.CallOpts{Context: ctx}, p.proverAddress, - p.cfg.TaikoL1Address, + p.cfg.AssignmentHookAddress, ); err != nil { return err } - log.Info("New allowance for TaikoL1 contract", "allowance", allowance.String()) + log.Info("New allowance for AssignmentHook contract", "allowance", allowance.String()) return nil } diff --git a/prover/prover_test.go b/prover/prover_test.go index 14d26c4db..0a7cc5634 100644 --- a/prover/prover_test.go +++ b/prover/prover_test.go @@ -60,6 +60,7 @@ func (s *ProverTestSuite) SetupTest() { TaikoL1Address: common.HexToAddress(os.Getenv("TAIKO_L1_ADDRESS")), TaikoL2Address: common.HexToAddress(os.Getenv("TAIKO_L2_ADDRESS")), TaikoTokenAddress: common.HexToAddress(os.Getenv("TAIKO_TOKEN_ADDRESS")), + AssignmentHookAddress: common.HexToAddress(os.Getenv("ASSIGNMENT_HOOK_ADDRESS")), GuardianProverAddress: common.HexToAddress(os.Getenv("GUARDIAN_PROVER_CONTRACT_ADDRESS")), L1ProverPrivKey: l1ProverPrivKey, Dummy: true, @@ -157,6 +158,7 @@ func (s *ProverTestSuite) TestInitError() { TaikoL1Address: common.HexToAddress(os.Getenv("TAIKO_L1_ADDRESS")), TaikoL2Address: common.HexToAddress(os.Getenv("TAIKO_L2_ADDRESS")), TaikoTokenAddress: common.HexToAddress(os.Getenv("TAIKO_TOKEN_ADDRESS")), + AssignmentHookAddress: common.HexToAddress(os.Getenv("ASSIGNMENT_HOOK_CONTRACT_ADDRESS")), L1ProverPrivKey: l1ProverPrivKey, Dummy: true, ProveUnassignedBlocks: true, @@ -391,13 +393,13 @@ func (s *ProverTestSuite) TestSetApprovalAmount() { opts, err := bind.NewKeyedTransactorWithChainID(s.p.proverPrivateKey, s.p.rpc.L1ChainID) s.Nil(err) - tx, err := s.p.rpc.TaikoToken.Approve(opts, s.p.cfg.TaikoL1Address, common.Big0) + tx, err := s.p.rpc.TaikoToken.Approve(opts, s.p.cfg.AssignmentHookAddress, common.Big0) s.Nil(err) _, err = rpc.WaitReceipt(context.Background(), s.p.rpc.L1, tx) s.Nil(err) - allowance, err := s.p.rpc.TaikoToken.Allowance(&bind.CallOpts{}, s.p.proverAddress, s.p.cfg.TaikoL1Address) + allowance, err := s.p.rpc.TaikoToken.Allowance(nil, s.p.proverAddress, s.p.cfg.AssignmentHookAddress) s.Nil(err) s.Equal(0, allowance.Cmp(common.Big0)) @@ -410,7 +412,7 @@ func (s *ProverTestSuite) TestSetApprovalAmount() { s.Nil(s.p.setApprovalAmount(context.Background())) - allowance, err = s.p.rpc.TaikoToken.Allowance(&bind.CallOpts{}, s.p.proverAddress, s.p.cfg.TaikoL1Address) + allowance, err = s.p.rpc.TaikoToken.Allowance(nil, s.p.proverAddress, s.p.cfg.AssignmentHookAddress) s.Nil(err) s.Equal(0, amt.Cmp(allowance))