  Bosonic encoding of quantum information into harmonic oscillators is a
hardware efficient approach to battle noise. In this regard,
oscillator-to-oscillator codes not only provide an additional opportunity in
bosonic encoding, but also extend the applicability of error correction to
continuous-variable states ubiquitous in quantum sensing and communication. In
this work, we derive the optimal oscillator-to-oscillator codes among the
general family of Gottesman-Kitaev-Preskill (GKP)-stablizer codes for
homogeneous noise. We prove that an arbitrary GKP-stabilizer code can be
reduced to a generalized GKP two-mode-squeezing (TMS) code. The optimal
encoding to minimize the geometric mean error can be constructed from GKP-TMS
codes with an optimized GKP lattice and TMS gains. For single-mode data and
ancilla, this optimal code design problem can be efficiently solved, and we
further provide numerical evidence that a hexagonal GKP lattice is optimal and
strictly better than the previously adopted square lattice. For the multimode
case, general GKP lattice optimization is challenging. In the two-mode data and
ancilla case, we identify the D4 lattice -- a 4-dimensional dense-packing
lattice -- to be superior to a product of lower dimensional lattices. As a
by-product, the code reduction allows us to prove a universal
no-threshold-theorem for arbitrary oscillators-to-oscillators codes based on
Gaussian encoding, even when the ancilla are not GKP states.
