The SGX Step codebase gets straight to the gap between what I think people people have in mind from SGX and what is actually visible from SGX https://github.com/jovanbulck/sgx-step
Other excellent sgx articles include:
Understanding TCB Recovery, how Intel responds to vulnerability reports and carries out disclosure and update process, but many companies do it wrong https://sgx.fail
TEE and blockchains:
I will plug my Sirrah codebase and project, i am using this as a base for most of my research prototypes, some contributions but mostly its just me on this. But it illustrates the design pattern, happy to answer in detail anything related to this codebase and would probably extend it in order to prove a point https://writings.flashbots.net/suave-tee-coprocessor
SGXonerated is all about how Secret Network went wrong in design by skipping defenses against replay attacks and access patterns. It includes a reproducibility artifact built out of the Secret Network integration tests. https://eprint.iacr.org/2023/378