@@ -43,6 +43,7 @@ func NewChunkProverTask(cfg *config.Config, chainCfg *params.ChainConfig, db *go
4343 blockOrm : orm .NewL2Block (db ),
4444 proverTaskOrm : orm .NewProverTask (db ),
4545 proverBlockListOrm : orm .NewProverBlockList (db ),
46+ taskCache : newCache (1024 ),
4647 },
4748 chunkTaskGetTaskTotal : promauto .With (reg ).NewCounterVec (prometheus.CounterOpts {
4849 Name : "coordinator_chunk_get_task_total" ,
@@ -169,6 +170,14 @@ func (cp *ChunkProverTask) Assign(ctx *gin.Context, getTaskParameter *coordinato
169170 log .Error ("format prover task failure" , "task_id" , chunkTask .Hash , "err" , err )
170171 return nil , ErrCoordinatorInternalFailure
171172 }
173+ if getTaskParameter .Universal {
174+ taskMsg , err = cp .applyUniversal (taskMsg )
175+ if err != nil {
176+ cp .recoverActiveAttempts (ctx , chunkTask )
177+ log .Error ("Generate universal prover task failure" , "task_id" , chunkTask .Hash , "type" , "chunk" )
178+ return nil , ErrCoordinatorInternalFailure
179+ }
180+ }
172181
173182 cp .chunkTaskGetTaskTotal .WithLabelValues (hardForkName ).Inc ()
174183 cp .chunkTaskGetTaskProver .With (prometheus.Labels {
@@ -180,6 +189,14 @@ func (cp *ChunkProverTask) Assign(ctx *gin.Context, getTaskParameter *coordinato
180189 return taskMsg , nil
181190}
182191
192+ func (cp * ChunkProverTask ) GetTaskMetaData (taskID string ) (string , error ) {
193+ if cached := cp .taskCache .Query (taskID ); cached != nil {
194+ return cached .MetaData , nil
195+ }
196+
197+ return "" , fmt .Errorf ("can not re-acquire the metadata for specified task, see coordinator log for the reason" )
198+ }
199+
183200func (cp * ChunkProverTask ) formatProverTask (ctx context.Context , task * orm.ProverTask , chunk * orm.Chunk , hardForkName string ) (* coordinatorType.GetTaskSchema , error ) {
184201 // Get block hashes.
185202 blockHashes , dbErr := cp .blockOrm .GetL2BlockHashesByChunkHash (ctx , task .TaskID )
0 commit comments