Stopping air leaks in attic
The reason eaves have this open space is so that moisture doesn't build up in the attic and cause rot. Completely sealing them off is generally not a great idea.

Attic insulation generally goes on top of the ceiling surface -- the space between there and the roof will generally be outside of the temperature-controlled part of the house anyway. It shouldn't really matter if the attic itself gets too hot or too cold. The main issues are vermin and moisture. There are vents you can install, and wire mesh will help with the vermin.

If you want to insulate a larger space than foam can handle, there are things called foam backing rods you can buy to fill large gaps -- once you've inserted it, there will be a much smaller gap between the foam backing rod and the surfaces, which can be filled with spray-in foam.