The Abstract Factory
Forging STARK prover artifacts through polymorphic factories.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Abstract Factory
ARCANUM SCHOOL: Conjuration // Provermancy
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CAIRO PATTERN //
trait ArtifactFactory<T> {
fn create_trace(self: @T) -> felt252;
fn create_proof(self: @T) -> felt252;
}
#[derive(Copy, Drop)]
struct StarkFactory {}
impl StarkFactoryImpl of ArtifactFactory<StarkFactory> {
fn create_trace(self: @StarkFactory) -> felt252 { 'stark_trace' }
fn create_proof(self: @StarkFactory) -> felt252 { 'stark_proof' }
}
In the STARK prover realms, the Abstract Factory conjures corresponding traces and proofs without binding the alchemist to their concrete forms.
Runic Tags:
#cairo
#design-pattern
#factory