Move all the FromProtocol stuff into codegen