We construct toric codes on various high-dimensional manifolds. Assuming a conjecture in geometry we find families of

quantum CSS stabilizer codes on N qubits with logarithmic weight stabilizers and distance N^{1-\epsilon} for any \epsilon>0.

The conjecture is that there is a constant C>0 such that for any n-dimensional torus {\mathbb T}^n={\mathbb R}^n/\Lambda, where \Lambda is a lattice, the least volume unoriented n/2-dimensional cycle (using the Euclidean metric) representing nontrivial homology has volume at least C^n times the volume of the least volume n/2-dimensional hyperplane representing nontrivial homology; in fact, it would suffice to have this result for \Lambda an integral lattice with the cycle restricted to faces of a cubulation by unit hypercubes.

The main technical result is an estimate of Rankin invariants for certain random lattices, showing that in a certain sense they are optimal.

Additionally, we construct codes with square-root distance, logarithmic weight stabilizers, and inverse polylogarithmic soundness factor (considered as quantum locally testable codes.

We also provide an short, alternative proof that the shortest vector in the exterior power of a lattice may be non-split.