diff --git a/driver/txlist_decompressor/txlist_decompressor.go b/driver/txlist_decompressor/txlist_decompressor.go index 9018af0ac..a26edc1d9 100644 --- a/driver/txlist_decompressor/txlist_decompressor.go +++ b/driver/txlist_decompressor/txlist_decompressor.go @@ -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" ) diff --git a/driver/txlist_decompressor/txlist_decompressor_test.go b/driver/txlist_decompressor/txlist_decompressor_test.go index a816b9e5f..a2d676f10 100644 --- a/driver/txlist_decompressor/txlist_decompressor_test.go +++ b/driver/txlist_decompressor/txlist_decompressor_test.go @@ -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" ) diff --git a/prover/config.go b/prover/config.go index 7d24e5615..ddc1cc096 100644 --- a/prover/config.go +++ b/prover/config.go @@ -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 } @@ -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") } diff --git a/prover/proof_submitter/transaction/builder.go b/prover/proof_submitter/transaction/builder.go index 4a79e7b52..0a069f97c 100644 --- a/prover/proof_submitter/transaction/builder.go +++ b/prover/proof_submitter/transaction/builder.go @@ -2,6 +2,7 @@ package transaction import ( "errors" + "fmt" "math/big" "github.com/ethereum-optimism/optimism/op-service/txmgr" @@ -16,6 +17,7 @@ import ( var ( ErrUnretryableSubmission = errors.New("unretryable submission error") + ZeroAddress common.Address ) // TxBuilder will build a transaction with the given nonce. @@ -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) { diff --git a/prover/prover.go b/prover/prover.go index aabe3f00e..e9797713c 100644 --- a/prover/prover.go +++ b/prover/prover.go @@ -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( @@ -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.