OK, but then you're testifying under oath and lying, because it was you who did it, after all?

If you have an immunity deal and are asked to testify about a crime you committed under it, you admit to doing it and they can't prosecute you.

Gotcha.

That's what I'd be afraid of