Some may call these wood members blocking and deem them as optional.
Blocking between roof trusses.
For instance if your roof has a steep pitch you may be able to use 2 inch by 4 inch rafters but if your roof has a low pitch building code may require that you used 2 inch by 6 inch or 2 inch by 8.
In my experience traveling across the country observing wood framed construction it was apparent that east of the rocky mountains structural wood members in line with supporting walls between roof framing cease to be installed.
Blocking or boundary member.
A continuous band rim or header joist or roof truss parallel to the braced wall panels shall be permitted to replace the blocking required by this.
Preventing rotation is typically accomplished by installing full depth solid blocking along wall top plates between rafters and ceiling joists.
Rotation loads on rafters occur when the roof sheathing is resisting lateral loads perpendicular to the rafter because these loads are actually trying to move the top edge of the rafter sideways.
Rafter blocking is an essential part of the roof framing process in that the blocks provide a stop for ceiling insulation and a continuous surface for the roof sheathing to be edge nailed to.
For low pitch roofs building codes may require larger dimension rafters.
Truss heel blocking can function as perimeter blocking of the roof diaphragm however the adequacy of this connection depends on multiple factors the building designer may not assume that prescriptive heel blocking will perform adequately as perimeter blocking for the roof diaphragm.
Roof trusses shall be supported laterally at points of bearing by solid blocking to prevent rotation and lateral displacement.
And often in a humid environment.
Each block is 2x4 or 2x6 depending on the size of the rafters and is secured to the top plate.
Roof rafters and ceiling joists shall be supported laterally to prevent rotations and lateral displacement when required by section 2306 7.