@@ -38,7 +38,7 @@ impl AssetsLocationData {
3838 ProofType :: Chunk => format ! ( "chunk/{vk_as_path}/" ) ,
3939 ProofType :: Batch => format ! ( "batch/{vk_as_path}/" ) ,
4040 ProofType :: Bundle => format ! ( "bundle/{vk_as_path}/" ) ,
41- _ => unreachable ! ( "unreconginzed type" ) ,
41+ t => eyre :: bail !( "unrecognized proof type: {}" , t as u8 ) ,
4242 }
4343 . as_str ( ) ,
4444 ) ?)
@@ -226,38 +226,37 @@ impl ProvingService for LocalProver {
226226 }
227227}
228228
229- static GLOBAL_ASSET_URLS_FEYNMAN : LazyLock < HashMap < String , url:: Url > > = LazyLock :: new ( || {
230- HashMap :: from ( [
231- (
232- "b68fdc3f28a5ce006280980df70cd3447e56913e5bca6054603ba85f0794c23a6618ea25a7991845bbc5fd571670ee47379ba31ace92d345bca59702a0d4112d" . to_string ( ) ,
233- url:: Url :: parse ( "https://circuit-release.s3.us-west-2.amazonaws.com/scroll-zkvm/releases/0.5.2/chunk/" ) . unwrap ( ) ,
234- ) ,
235- (
236- "9a3f66370f11e3303f1a1248921025104e83253efea43a70d221cf4e15fc145bf2be2f4468d1ac4a70e7682babb1c60417e21c7633d4b55b58f44703ec82b05a" . to_string ( ) ,
237- url:: Url :: parse ( "https://circuit-release.s3.us-west-2.amazonaws.com/scroll-zkvm/releases/0.5.2/batch/" ) . unwrap ( ) ,
238- ) ,
239- (
240- "1f8627277e1c1f6e1cc70c03e6fde06929e5ea27ca5b1d56e23b235dfeda282e22c0e5294bcb1b3a9def836f8d0f18612a9860629b9497292976ca11844b7e73" . to_string ( ) ,
241- url:: Url :: parse ( "https://circuit-release.s3.us-west-2.amazonaws.com/scroll-zkvm/releases/0.5.2/bundle/" ) . unwrap ( ) ,
242- ) ,
243- ] )
244- } ) ;
229+ static GLOBAL_ASSET_URLS : LazyLock < HashMap < String , HashMap < String , url:: Url > > > =
230+ LazyLock :: new ( || {
231+ const ASSETS_JSON : & str = include_str ! ( "../assets_url_preset.json" ) ;
232+ serde_json:: from_str ( ASSETS_JSON ) . expect ( "Failed to parse assets_url_preset.json" )
233+ } ) ;
245234
246235impl LocalProver {
247236 pub fn new ( mut config : LocalProverConfig ) -> Self {
248237 for ( fork_name, circuit_config) in config. circuits . iter_mut ( ) {
249238 // validate each base url
250239 circuit_config. location_data . validate ( ) . unwrap ( ) ;
251- let mut template_url_mapping = match fork_name . to_lowercase ( ) . as_str ( ) {
252- "feynman" => GLOBAL_ASSET_URLS_FEYNMAN . clone ( ) ,
253- _ => HashMap :: new ( ) ,
254- } ;
240+ let mut template_url_mapping = GLOBAL_ASSET_URLS
241+ . get ( & fork_name . to_lowercase ( ) )
242+ . cloned ( )
243+ . unwrap_or_default ( ) ;
255244
256245 // apply default settings in template
257246 for ( key, url) in circuit_config. location_data . asset_detours . drain ( ) {
258247 template_url_mapping. insert ( key, url) ;
259248 }
249+
260250 circuit_config. location_data . asset_detours = template_url_mapping;
251+
252+ // validate each detours url
253+ for url in circuit_config. location_data . asset_detours . values ( ) {
254+ assert ! (
255+ url. path( ) . ends_with( '/' ) ,
256+ "url {} must be end with /" ,
257+ url. as_str( )
258+ ) ;
259+ }
261260 }
262261
263262 Self {
0 commit comments