revert flag change

This commit is contained in:
colinlyguo
2023-08-03 17:56:26 +08:00
parent 1b542830af
commit bbb4ca6d76
3 changed files with 29 additions and 44 deletions

View File

@@ -15,6 +15,5 @@
"l2geth_config": {
"endpoint": "/var/lib/jenkins/workspace/SequencerPipeline/MyPrivateNetwork/geth.ipc",
"confirmations": "0x1"
},
"mock_proof_submission": true
}
}

View File

@@ -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.

View File

@@ -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() {