How can the effects of pain on cognitive functions be tested in an ethically accepted way?
Pain is a form of stress. I would replace pain with another, ethically less problematic stressor. If you would want to do it elegantly, test a group of subjects with chronic pain (anything; e.g., back pain) and use a control group where you submit a group of healthy subjects to a stress test (e.g. Stroop test - huge body of literature on this) and a third group without a stressor. See if the pain group matches the stressed group and whether they are both significantly different from the controls. If yes, you've found a way to prevent ethically kind of unacceptable tests, where the search for volunteers will likely be very difficult too.