How can I un-jailbreak an iPhone 4?
As long as you backup your iPhone by syncing with iTunes, it'll restore every non-jailbreak thing just fine. The only exception being your login information for accounts and whatnot, unless iTunes is encrypting your backup.

You can verify your backup by going to iTunes' preferences and selecting the devices tab.

I'm not sure if it's still an issue, but if you happen to be using a tweak like "Five Icon Dock", you'll want to remove the extra icons from your dock, otherwise when you boot-up after restore, Springboard will constantly crash.