contributing.rst 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. Contributing
  2. ============
  3. Solang is in active development, so there are many ways in which you can
  4. contribute.
  5. * Consider that users who will read the docs are from different background and cultures and that they have different preferences.
  6. * Avoid potential offensive terms and, for instance, prefer "allow list and deny list" to "white list and black list".
  7. * We believe that we all have a role to play to improve our world, and even if writing inclusive doc might not look like a huge improvement, it's a first step in the right direction.
  8. * We suggest to refer to `Microsoft bias free writing guidelines <https://docs.microsoft.com/en-us/style-guide/bias-free-communication>`_
  9. and `Google inclusive doc writing guide <https://developers.google.com/style/inclusive-documentation>`_ as starting points.
  10. Target Specific
  11. ---------------
  12. Solang supports Substrate and Solana. These targets need testing
  13. via integration tests. New targets like
  14. `Fabric <https://github.com/hyperledger/fabric-chaincode-wasm>`_ need to be
  15. added, and tests added.
  16. How to report issues
  17. --------------------
  18. Please report issues to
  19. `github issues <https://github.com/hyperledger/solang/issues>`_.
  20. Debugging issues with LLVM
  21. --------------------------
  22. The Solang compiler builds `LLVM IR <http://releases.llvm.org/8.0.1/docs/LangRef.html>`_.
  23. This is done via the `inkwell <https://github.com/TheDan64/inkwell>`_ crate, which is
  24. a "safe" rust wrapper. However, it is easy to construct IR which is invalid. When this
  25. happens you might get segfaults deep in llvm. There are two ways to help when this
  26. happens.
  27. Build LLVM with Assertions Enabled
  28. __________________________________
  29. If you are using llvm provided by your distribution, llvm will not be build with
  30. ``LLVM_ENABLE_ASSERTIONS=On``. See :ref:`llvm-from-source` how to build
  31. your own.
  32. Verify the IR with llc
  33. ______________________
  34. Some issues with the IR will not be detected even with LLVM Assertions on. These includes
  35. issues like instructions in a basic block after a branch instruction (i.e. unreachable
  36. instructions).
  37. Run ``solang --emit llvm -v foo.sol`` and you will get a foo.ll file, assuming that the
  38. contract in foo.sol is called foo. Try to compile this with ``llc foo.ll``. If IR is
  39. not valid, llc will tell you.
  40. Style guide
  41. -----------
  42. Solang follows default rustfmt, and clippy. Any clippy warnings need to be fixed.
  43. Outside of the tests, code should ideally be written in a such a way that no
  44. ``#[allow(clippy::foo)]`` are needed.
  45. For test code, this is much less strict. It is much more important that tests are
  46. written, and that they have good coverage rather than worrying about clippy warnings.
  47. Feel free to sprinkle some ``#[allow(clippy::foo)]`` around your test code to make
  48. your merge request pass.