Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that all symbols in the simplicity library begin with simplicity_ #248

Merged
merged 5 commits into from
Jul 31, 2024

Commits on Jul 24, 2024

  1. Add simplicity_ prefix to all jet names

    This the first step into prefixing all symbol names in the simplicity static
    library.
    
    C has no name spaces, and we want to ensure there are no symbol collisions with
    other libraries.
    roconnor-blockstream committed Jul 24, 2024
    Configuration menu
    Copy the full SHA
    56961a9 View commit details
    Browse the repository at this point in the history

Commits on Jul 30, 2024

  1. Mass rename of symbols

    This prefixes most symbol names in the simplicity static library.
    
    C has no name spaces, and we want to ensure there are no symbol collisions with
    other libraries.
    
    clang-rename is very finicky, so the following bash script was used:
    
    shopt -s globstar
    for SYMBOL in closeBitstream readNBits decodeUptoMaxInt readBitstring computeWordCMR computeCommitmentMerkleRoot computeAnnotatedMerkleRoot verifyCanonicalOrder fillWitnessData verifyNoDuplicateIdentityRoots decodeMallocDag analyseBounds evalTCOExpression read_buffer8 write_buffer8 read_sha256_context write_sha256_context copyBits mallocBoundVars decodeJet rsort hasDuplicates sha256_compression_is_optimized sha256_bitstring computeTypeAnalyses mallocTypeInference sha256_confidential sha256_confAsset sha256_confNonce sha256_confAmt generateIssuanceEntropy calculateAsset calculateToken make_tapleaf make_tapbranch build_txEnv
    do
        clang-rename -i -qualified-name=${SYMBOL} -new-name=simplicity_${SYMBOL} $(grep "${SYMBOL}(" *.c *.h include/**/*.h primitive/**/*.c primitive/**/*.h -l) -- -I include
    done
    roconnor-blockstream committed Jul 30, 2024
    Configuration menu
    Copy the full SHA
    4c96dbe View commit details
    Browse the repository at this point in the history
  2. Rename sha256_compression pointer

    C has no name spaces, and we want to ensure there are no symbol collisions with
    other libraries.
    roconnor-blockstream committed Jul 30, 2024
    Configuration menu
    Copy the full SHA
    0cd012a View commit details
    Browse the repository at this point in the history
  3. Rename read/write functions

    clang-rename cannot rename macro generated functions, so this must be done by hand.
    
    This prefixes the rest of the symbol names in the simplicity static library.
    
    C has no name spaces, and we want to ensure there are no symbol collisions with
    other libraries.
    roconnor-blockstream committed Jul 30, 2024
    Configuration menu
    Copy the full SHA
    8b33ed5 View commit details
    Browse the repository at this point in the history
  4. Rename API functions

    All of the other exported symbols begin with the "simplicity_" prefix.
    We are renameing the "elements_simplicty_" API functions to be
    "simplicity_elements_" instead so that everything consistently has the same prefix.
    roconnor-blockstream committed Jul 30, 2024
    Configuration menu
    Copy the full SHA
    bd89d2a View commit details
    Browse the repository at this point in the history