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

Commit

Permalink
fix following comments
Browse files Browse the repository at this point in the history
  • Loading branch information
YoGhurt111 committed May 6, 2024
1 parent 4b7bab3 commit 0fd86b5
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions driver/txlist_decompressor/txlist_decompressor.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rlp"

"github.com/taikoxyz/taiko-client/internal/utils"
)

Expand Down
1 change: 1 addition & 0 deletions driver/txlist_decompressor/txlist_decompressor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
"github.com/stretchr/testify/require"

"github.com/taikoxyz/taiko-client/internal/utils"
)

Expand Down
5 changes: 2 additions & 3 deletions prover/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) {
}

// If we are running a guardian prover, we need to prove unassigned blocks and run in contester mode by default.
if c.IsSet(flags.GuardianProverMajority.Name) && c.IsSet(flags.GuardianProverMinority.Name) {
if c.IsSet(flags.GuardianProverMajority.Name) {
if err := c.Set(flags.ProveUnassignedBlocks.Name, "true"); err != nil {
return nil, err
}
Expand All @@ -120,8 +120,7 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) {
}

// If we are not running a guardian prover, a raiko host endpoint is required.
if (!c.IsSet(flags.GuardianProverMajority.Name) || !c.IsSet(flags.GuardianProverMinority.Name)) &&
!c.IsSet(flags.RaikoHostEndpoint.Name) {
if !c.IsSet(flags.GuardianProverMajority.Name) && !c.IsSet(flags.RaikoHostEndpoint.Name) {
return nil, errors.New("raiko host not provided")
}

Expand Down
6 changes: 5 additions & 1 deletion prover/proof_submitter/transaction/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package transaction

import (
"errors"
"fmt"
"math/big"

"github.com/ethereum-optimism/optimism/op-service/txmgr"
Expand All @@ -16,6 +17,7 @@ import (

var (
ErrUnretryableSubmission = errors.New("unretryable submission error")
ZeroAddress common.Address
)

// TxBuilder will build a transaction with the given nonce.
Expand Down Expand Up @@ -78,8 +80,10 @@ func (a *ProveBlockTxBuilder) Build(
} else {
if tier > encoding.TierGuardianMinorityID {
to = a.majorityGuardianProverAddress
} else {
} else if tier == encoding.TierGuardianMinorityID && a.minorityGuardianProverAddress != ZeroAddress {
to = a.minorityGuardianProverAddress
} else {
return nil, fmt.Errorf("tier %d need set minorityGuardianProverAddress", tier)
}
if data, err = encoding.GuardianProverABI.Pack("approve", *meta, *transition, *tierProof); err != nil {
if isSubmitProofTxErrorRetryable(err, blockID) {
Expand Down
9 changes: 5 additions & 4 deletions prover/prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,10 @@ func InitFromConfig(ctx context.Context, p *Prover, cfg *Config) (err error) {
return fmt.Errorf("failed to get MinGuardians from majority guardian prover contract: %w", err)
}

if _, err := p.rpc.MinorityGuardianProver.MinGuardians(&bind.CallOpts{Context: ctx}); err != nil {
return fmt.Errorf("failed to get MinGuardians from minority guardian prover contract: %w", err)
if p.rpc.MinorityGuardianProver != nil {
if _, err := p.rpc.MinorityGuardianProver.MinGuardians(&bind.CallOpts{Context: ctx}); err != nil {
return fmt.Errorf("failed to get MinGuardians from minority guardian prover contract: %w", err)
}
}

p.guardianProverHeartbeater = guardianProverHeartbeater.New(
Expand Down Expand Up @@ -469,8 +471,7 @@ func (p *Prover) getSubmitterByTier(tier uint16) proofSubmitter.Submitter {

// IsGuardianProver returns true if the current prover is a guardian prover.
func (p *Prover) IsGuardianProver() bool {
return p.cfg.GuardianProverMajorityAddress != common.Address{} &&
p.cfg.GuardianProverMinorityAddress != common.Address{}
return p.cfg.GuardianProverMajorityAddress != common.Address{}
}

// ProverAddress returns the current prover account address.
Expand Down

0 comments on commit 0fd86b5

Please sign in to comment.