I've spent a career litigating prisoner rights. The contours of Constitutional rights are very different in prison than in the outside.
COs can punch someone as long as they are trying to restore order. That's not how it's supposed to work outside, but it's the standard under which COs are trained.
/fin