entity function targeting

Im making a shield enchantment that damages your enemy if you block their attack, and right now I just have it so it damages the furthest entity within 3 blocks: execute as @s if predicate medievalweapons:retribution_p run damage @e[distance=..3,sort=furthest,limit=1] 3 minecraft:generic but i want it to damage the attacker, which i tried just swapping @e for attacker but obviously it doesent know what im referencing. How can i reference the attacker in the function?

Continue to help post