const the_supported_gates = [ "UnknownGate" , "ArithmeticGate" , "ArithmeticExtensionGate" , "BaseSumGate" , "ConstantGate" , "CosetInterpolationGate" , "ExponentiationGate" , "LookupGate" , "LookupTableGate" , "MultiplicationExtensionGate" , "NoopGate" , "PoseidonGate" , "PoseidonMdsGate" , "PublicInputGate" , "RandomAccessGate" , "ReducingGate" , "ReducingExtensionGate" ]; const the_gate_colors = [ "#800000" // UnknownGate -> dark red , "#c0c0c0" // ArithmeticGate -> light grey , "#808080" // ArithmeticExtensionGate -> medium grey , "#60c0c0" // BaseSumGate -> medium cyan , "#f0f080" // ConstantGate -> yellow , "#b0b0f0" // CosetInterpolationGate -> light blue , "#80f080" // ExponentiationGate -> cyan , "#80f080" // LookupGate -> light green , "#60c060" // LookupTableGate -> medium green , "#8080c0" // MultiplicationExtensionGate -> dark blue , "#ffffff" // NoopGate -> white , "#f07070" // PoseidonGate -> light red , "#c06060" // PoseidonMdsGate -> medium red , "#a0ffa0" // PublicInputGate -> ligth green , "#8080f0" // RandomAccessGate -> blue , "#f080f0" // ReducingGate -> light purple , "#c060c0" // ReducingExtensionGate -> medium purple ]; const the_gate_equations = [ "???" // UnknownGate , "w = c0*x*y + c1*z" // ArithmeticGate , "w = c0*x*y + c1*z" // ArithmeticExtensionGate , "y = sum_i 2^i*b_i" // BaseSumGate , "x=c0, y=c1" // ConstantGate , "..." // CosetInterpolationGate , "y = x^k" // ExponentiationGate , "(x,y) in T" // LookupGate , "N/A" // LookupTableGate , "z = c0*x*y" // MultiplicationExtensionGate , "true" // NoopGate , "..." // PoseidonGate , "..." // PoseidonMdsGate , "x[0..3] = hash(PI)" // PublicInputGate , "y = x[i]" // RandomAccessGate , "y = sum_ a^i*c_i" // ReducingGate , "y = sum_ a^i*c_i" // ReducingExtensionGate ]; function findGateIndex(gate) { let k = the_supported_gates.indexOf(gate); return ((k<0) ? 0 : k); } function add_table_row(table, idx, text, color) { let tr = document.createElement("tr"); tr.style.background = (color)?color:"#fffff"; let td1 = document.createElement("td"); td1.innerHTML = idx.toString(); let td2 = document.createElement("td"); td2.innerHTML = text; tr.appendChild(td1); tr.appendChild(td2); table.appendChild(tr); } /* function test_fill_gates() { let el = document.getElementById("gates"); for(let i=0; i let cell = document.createElementNS("http://www.w3.org/2000/svg", "rect"); cell.setAttribute('width' ,10); cell.setAttribute('height',10); cell.setAttribute('x',10*j); cell.setAttribute('y',10*i); cell.setAttribute('style',"stroke-width:1;stroke:black;"); cell.setAttribute('fill',col); let hover_call = "cell_hover(" + i.toString() + "," + j.toString() + ")"; cell.setAttribute('onmouseover', hover_call ); el_svg.appendChild(cell); } } let el_ratio = document.getElementById("nonempty-ratio"); let ratio = Math.round( 100 * (ncells - empty_counter) / ncells); el_ratio.innerHTML = ratio.toString() + "%"; } function handle_error(res) { if (!res.ok) { throw new Error(`HTTP error! Status: ${res.status}`); } return res.json(); } function load_witness(fname) { fetch(fname).then( err => handle_error(err) ).then( data => initialize_from_witness(fname,data) ).catch(); }