diff --git a/prover/config.json b/prover/config.json index d9d1e6c74..b96a1c91d 100644 --- a/prover/config.json +++ b/prover/config.json @@ -15,6 +15,5 @@ "l2geth_config": { "endpoint": "/var/lib/jenkins/workspace/SequencerPipeline/MyPrivateNetwork/geth.ipc", "confirmations": "0x1" - }, - "mock_proof_submission": true + } } diff --git a/prover/config/config.go b/prover/config/config.go index 7aaf48663..78acd3cbe 100644 --- a/prover/config/config.go +++ b/prover/config/config.go @@ -13,14 +13,13 @@ import ( // Config loads prover configuration items. type Config struct { - ProverName string `json:"prover_name"` - KeystorePath string `json:"keystore_path"` - KeystorePassword string `json:"keystore_password"` - Core *ProverCoreConfig `json:"core"` - DBPath string `json:"db_path"` - CoordinatorConfig *CoordinatorConfig `json:"coordinator_config"` - L2GethConfig *L2GethConfig `json:"l2geth_config"` - MockProofSubmission bool `json:"mock_proof_submission"` + ProverName string `json:"prover_name"` + KeystorePath string `json:"keystore_path"` + KeystorePassword string `json:"keystore_password"` + Core *ProverCoreConfig `json:"core"` + DBPath string `json:"db_path"` + CoordinatorConfig *CoordinatorConfig `json:"coordinator_config"` + L2GethConfig *L2GethConfig `json:"l2geth_config"` } // ProverCoreConfig load zk prover config. diff --git a/prover/prover.go b/prover/prover.go index 5a0c04d94..fcb8a5bdc 100644 --- a/prover/prover.go +++ b/prover/prover.go @@ -46,8 +46,6 @@ type Prover struct { stopChan chan struct{} priv *ecdsa.PrivateKey - - mockProofSubmission bool } // NewProver new a Prover object. @@ -84,15 +82,14 @@ func NewProver(ctx context.Context, cfg *config.Config) (*Prover, error) { } return &Prover{ - ctx: ctx, - cfg: cfg, - coordinatorClient: coordinatorClient, - l2GethClient: l2GethClient, - stack: stackDb, - proverCore: newProverCore, - stopChan: make(chan struct{}), - priv: priv, - mockProofSubmission: cfg.MockProofSubmission, + ctx: ctx, + cfg: cfg, + coordinatorClient: coordinatorClient, + l2GethClient: l2GethClient, + stack: stackDb, + proverCore: newProverCore, + stopChan: make(chan struct{}), + priv: priv, }, nil } @@ -146,33 +143,23 @@ func (r *Prover) proveAndSubmit() error { } var proofMsg *message.ProofDetail - if r.mockProofSubmission { - // If the mockProofSubmission flag is true, generate a mock proof + if task.Times <= 2 { + // If panic times <= 2, try to proof the task. + if err = r.stack.UpdateTimes(task, task.Times+1); err != nil { + return err + } + + log.Info("start to prove task", "task-type", task.Task.Type, "task-id", task.Task.ID) + proofMsg = r.prove(task) + } else { + // when the prover has more than 3 times panic, + // it will omit to prove the task, submit StatusProofError and then Delete the task. proofMsg = &message.ProofDetail{ - Status: message.StatusOk, - Error: "", + Status: message.StatusProofError, + Error: "zk proving panic", ID: task.Task.ID, Type: task.Task.Type, } - } else { - if task.Times <= 2 { - // If panic times <= 2, try to proof the task. - if err = r.stack.UpdateTimes(task, task.Times+1); err != nil { - return err - } - - log.Info("start to prove task", "task-type", task.Task.Type, "task-id", task.Task.ID) - proofMsg = r.prove(task) - } else { - // when the prover has more than 3 times panic, - // it will omit to prove the task, submit StatusProofError and then Delete the task. - proofMsg = &message.ProofDetail{ - Status: message.StatusProofError, - Error: "zk proving panic", - ID: task.Task.ID, - Type: task.Task.Type, - } - } } defer func() {