Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,70 @@
# Contributing to Building-secure-contracts
# Contributing to Building-Secure-Contracts

First, thanks for your interest in contributing to Building-secure-contracts! We welcome and appreciate all contributions, including bug reports, feature suggestions, tutorials/blog posts, and code improvements.
First, thank you for your interest in contributing to Building-Secure-Contracts! We appreciate and warmly welcome all contributions, which include bug reports, feature suggestions, tutorials/blog posts, and code improvements.

If you're unsure where to start, we recommend our [`good first issue`](https://github.com/crytic/building-secure-contracts/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) and [`help wanted`](https://github.com/crytic/building-secure-contracts/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) issue labels.
If you're not sure where to begin, we recommend checking out our [`good first issue`](https://github.com/crytic/building-secure-contracts/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) and [`help wanted`](https://github.com/crytic/building-secure-contracts/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) issue labels.

## Bug reports and feature suggestions
## Bug Reports and Feature Suggestions

Bug reports and feature suggestions can be submitted to our issue tracker. For bug reports, attaching the contract that caused the bug will help us in debugging and resolving the issue quickly. If you find a security vulnerability, do not open an issue; email opensource@trailofbits.com instead.
Please submit bug reports and feature suggestions to our issue tracker. When reporting a bug, attaching the contract causing the issue is helpful for efficient debugging and resolution. If you discover a security vulnerability, do not open an issue; instead, email opensource@trailofbits.com.

## Questions

Questions can be submitted to the issue tracker, but you may get a faster response if you ask in our [chat room](https://slack.empirehacking.nyc/) (in the #ethereum channel).

## Code
## Code Contributions

building-secure-contracts uses the pull request contribution model. Please make an account on Github, fork this repo, and submit code contributions via pull request. For more documentation, look [here](https://guides.github.com/activities/forking/).
Building-Secure-Contracts follows the pull request contribution model. Create an account on Github, fork this repo, and submit code contributions through pull requests. For additional documentation, refer [here](https://guides.github.com/activities/forking/).

Some pull request guidelines:

- Minimize irrelevant changes (formatting, whitespace, etc) to code that would otherwise not be touched by this patch. Save formatting or style corrections for a separate pull request that does not make any semantic changes.
- When possible, large changes should be split up into smaller focused pull requests.
- Fill out the pull request description with a summary of what your patch does, key changes that have been made, and any further points of discussion, if applicable.
- Title your pull request with a brief description of what it's changing. "Fixes #123" is a good comment to add to the description, but makes for an unclear title on its own.
- Limit unnecessary changes (formatting, whitespace, etc.) to code unrelated to the patch. Save formatting or style corrections for a separate pull request, which doesn't include any semantic changes.
- When possible, break down large changes into smaller, focused pull requests.
- Complete the pull request description with an overview of your patch, including key modifications, and any further discussion points if relevant.
- Use a concise title to describe your pull request's changes. "Fixes #123" is suitable for adding to the description, but not as a standalone title.

## Directory Structure

Below is a rough outline of building-secure-contracts's structure:
Here's a basic overview of Building-Secure-Contracts' structure:

```text
.
├── development-guidelnes # High-level best-practices for all smart contracts
├── development-guidelines # High-level best practices for all smart contracts
├── learn_evm # EVM technical knowledge
├── not-so-smart-contracts # Examples of smart contract common issues. Each issue contains a description, an example and recommendations
├── program-analysis # How to use automated tools to secure contracts
├── ressources # Various online resources
├── not-so-smart-contracts # Examples of common smart contract issues, including descriptions, examples, and recommendations
├── program-analysis # How to utilize automated tools to secure contracts
├── resources # Various online resources
└── ...
```

## Linting and formatting
## Linting and Formatting

To install the formatters and linters, run:

```bash
npm install
```

To run the formatter, use:
To use the formatter, run:

```bash
npm run format
```

To run the linters, use:
To use the linters, run:

```bash
npm run lint
```

To run the individual linters, use:
To use individual linters, run:

- `npm run lint:format` to check the formatting
- `npm run lint:links` to check for invalid links in markdown files
- `npm run lint:links` to verify the validity of links in markdown files

## Create the book
## Creating the Book

We use `mdbook` to generate [secure-contracts.com](https://secure-contracts.com/).
We utilize `mdbook` to generate [secure-contracts.com](https://secure-contracts.com/).

To run it locally:

Expand All @@ -73,4 +73,4 @@ cargo install --git https://github.com/montyly/mdBook.git mdbook
mdbook build
```

Note: we use https://github.com/montyly/mdBook.git, which contains https://github.com/rust-lang/mdBook/pull/1584.
Note: We use https://github.com/montyly/mdBook.git, which contains https://github.com/rust-lang/mdBook/pull/1584.
50 changes: 24 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,39 @@

![](https://github.com/crytic/building-secure-contracts/workflows/CI/badge.svg) ![](https://github.com/crytic/building-secure-contracts/workflows/Echidna/badge.svg)

This repository, brought to you by [Trail of Bits](https://www.trailofbits.com/), outlines guidelines and best practices to write secure smart contracts.
Brought to you by [Trail of Bits](https://www.trailofbits.com/), this repository offers guidelines and best practices for developing secure smart contracts. Contributions are welcome, you can contribute by following our [contributing guidelines](https://github.com/crytic/building-secure-contracts/blob/master/CONTRIBUTING.md).

We welcome contributions, and you can contribute by following our [contributing guidelines](https://github.com/crytic/building-secure-contracts/blob/master/CONTRIBUTING.md).
**Table of Contents:**

**Table of contents:**

- [Development guidelines](./development-guidelines)
- [High-level best practices](./development-guidelines/guidelines.md): High-level best-practices for all smart contracts
- [Incident Response Recommendations](./development-guidelines/incident_response.md): Guidelines on how to formulate an incident response plan
- [Secure development workflow](./development-guidelines/workflow.md): A rough, high-level process to follow while you write code
- [Token integration checklist](./development-guidelines/token_integration.md): What to check when interacting with arbitrary token
- [Learn EVM](./learn_evm): EVM technical knowledge
- [EVM Opcodes](./learn_evm/evm_opcodes.md): Details on all EVM opcodes
- [Development Guidelines](./development-guidelines)
- [High-Level Best Practices](./development-guidelines/guidelines.md): Best practices for all smart contracts
- [Incident Response Recommendations](./development-guidelines/incident_response.md): Guidelines for creating an incident response plan
- [Secure Development Workflow](./development-guidelines/workflow.md): A high-level process to follow during code development
- [Token Integration Checklist](./development-guidelines/token_integration.md): What to check when interacting with arbitrary tokens
- [Learn EVM](./learn_evm): Technical knowledge about the EVM
- [EVM Opcodes](./learn_evm/evm_opcodes.md): Information on all EVM opcodes
- [Transaction Tracing](./learn_evm/tracing.md): Helper scripts and guidance for generating and navigating transaction traces
- [Arithmetic Checks](./learn_evm/arithmetic-checks.md): A guide to performing arithmetic checks in the EVM
- [Yellow Paper Guidance](./learn_evm/yellow-paper.md): Symbol reference for more easily reading the Ethereum yellow paper
- [Forks <> EIPs](./learn_evm/eips_forks.md): Summarize the EIPs included in each Ethereum fork
- [Forks <> CIPs](./learn_evm/cips_forks.md): Summarize the CIPs and EIPs included in each Celo fork _(EVM-compatible chain)_
- [Upgrades <> TIPs](./learn_evm/tips_upgrades.md): Summarize the TIPs included in each TRON upgrade _(EVM-compatible chain)_
- [Forks <> BEPs](./learn_evm/beps_forks.md): Summarize the BEPs included in each BSC fork _(EVM-compatible chain)_
- [Not so smart contracts](./not-so-smart-contracts): Examples of smart contract common issues. Each issue contains a description, an example and recommendations
- [Yellow Paper Guidance](./learn_evm/yellow-paper.md): Symbol reference for easier reading of the Ethereum yellow paper
- [Forks <> EIPs](./learn_evm/eips_forks.md): Summaries of the EIPs included in each Ethereum fork
- [Forks <> CIPs](./learn_evm/cips_forks.md): Summaries of the CIPs and EIPs included in each Celo fork _(EVM-compatible chain)_
- [Upgrades <> TIPs](./learn_evm/tips_upgrades.md): Summaries of the TIPs included in each TRON upgrade _(EVM-compatible chain)_
- [Forks <> BEPs](./learn_evm/beps_forks.md): Summaries of the BEPs included in each BSC fork _(EVM-compatible chain)_
- [Not So Smart Contracts](./not-so-smart-contracts): Examples of common smart contract issues, complete with descriptions, examples, and recommendations
- [Algorand](./not-so-smart-contracts/algorand)
- [Cairo](./not-so-smart-contracts/cairo)
- [Cosmos](./not-so-smart-contracts/cosmos)
- [Substrate](./not-so-smart-contracts/substrate)
- [Solana](./not-so-smart-contracts/solana)
- [Program analysis](./program-analysis): How to use automated tools to secure contracts
- [Echidna](./program-analysis/echidna): a fuzzer that will check your contract's properties.
- [Slither](./program-analysis/slither): a static analyzer available through a CLI and scriptable interface.
- [Manticore](./program-analysis/manticore): a symbolic execution engine that can prove the correctness properties.
- For each tool, this training material will provide:
- a theoretical introduction, a walkthrough of its API, and a set of exercises.
- exercises expected to require ~two hours to practically learn its operation.
- [Resources](./resources): Various online resources
- [Trail of Bits blogposts](./resources/tob_blogposts.md): List of blockchain related blogposts made by Trail of Bits
- [Program Analysis](./program-analysis): Using automated tools to secure contracts
- [Echidna](./program-analysis/echidna): A fuzzer that checks your contract's properties
- [Slither](./program-analysis/slither): A static analyzer with both CLI and scriptable interfaces
- [Manticore](./program-analysis/manticore): A symbolic execution engine that proves the correctness of properties
- For each tool, this training material provides:
- A theoretical introduction, an API walkthrough, and a set of exercises
- Exercises that take approximately two hours to gain practical understanding
- [Resources](./resources): Assorted online resources
- [Trail of Bits Blog Posts](./resources/tob_blogposts.md): A list of blockchain-related blog posts created by Trail of Bits

# License

Expand Down
58 changes: 29 additions & 29 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

[Introduction](./README.md)

- [Development-guidelines](./development-guidelines/README.md)
- [High-level best practices](./development-guidelines/guidelines.md)
- [Token integration checklist](./development-guidelines/token_integration.md)
- [Development Guidelines](./development-guidelines/README.md)
- [High-Level Best Practices](./development-guidelines/guidelines.md)
- [Token Integration Checklist](./development-guidelines/token_integration.md)
- [Incident Response Recommendations](./development-guidelines/incident_response.md)
- [Secure development workflow](./development-guidelines/workflow.md)
- [Secure Development Workflow](./development-guidelines/workflow.md)
- [Learn EVM](./learn_evm/README.md)
- [EVM Opcode Reference](./learn_evm/evm_opcodes.md)
- [Transaction Tracing](./learn_evm/tracing.md)
Expand All @@ -23,51 +23,51 @@
- [Closing Account](./not-so-smart-contracts/algorand/closing_account/README.md)
- [Closing Asset](./not-so-smart-contracts/algorand/closing_asset/README.md)
- [Group Size Check](./not-so-smart-contracts/algorand/group_size_check/README.md)
- [Time-based Replay Attack](./not-so-smart-contracts/algorand/time_based_replay_attack/README.md)
- [Time-Based Replay Attack](./not-so-smart-contracts/algorand/time_based_replay_attack/README.md)
- [Access Controls](./not-so-smart-contracts/algorand/access_controls/README.md)
- [Asset Id Check](./not-so-smart-contracts/algorand/asset_id_check/README.md)
- [Asset ID Check](./not-so-smart-contracts/algorand/asset_id_check/README.md)
- [Denial of Service](./not-so-smart-contracts/algorand/denial_of_service/README.md)
- [Inner Transaction Fee](./not-so-smart-contracts/algorand/inner_transaction_fee/README.md)
- [Clear State Transaction Check](./not-so-smart-contracts/algorand/clear_state_transaction_check/README.md)
- [Cairo](./not-so-smart-contracts/cairo/README.md)
- [Improper access controls](./not-so-smart-contracts/cairo/access_controls/README.md)
- [Integer division errors](./not-so-smart-contracts/cairo/integer_division/README.md)
- [View state modifications](./not-so-smart-contracts/cairo/view_state/README.md)
- [Arithmetic overflow](./not-so-smart-contracts/cairo/arithmetic_overflow/README.md)
- [Signature replays](./not-so-smart-contracts/cairo/replay_protection/README.md)
- [Improper Access Controls](./not-so-smart-contracts/cairo/access_controls/README.md)
- [Integer Division Errors](./not-so-smart-contracts/cairo/integer_division/README.md)
- [View State Modifications](./not-so-smart-contracts/cairo/view_state/README.md)
- [Arithmetic Overflow](./not-so-smart-contracts/cairo/arithmetic_overflow/README.md)
- [Signature Replays](./not-so-smart-contracts/cairo/replay_protection/README.md)
- [L1 to L2 Address Conversion](./not-so-smart-contracts/cairo/L1_to_L2_address_conversion/README.md)
- [Incorrect Felt Comparison](./not-so-smart-contracts/cairo/incorrect_felt_comparison/README.md)
- [Namespace Storage Var Collision](./not-so-smart-contracts/cairo/namespace_storage_var_collision/README.md)
- [Dangerous Public Imports in Libraries](./not-so-smart-contracts/cairo/dangerous_public_imports_in_libraries/README.md)
- [Cosmos](./not-so-smart-contracts/cosmos/README.md)
- [Incorrect signers](./not-so-smart-contracts/cosmos/incorrect_getsigners/README.md)
- [Non-determinism](./not-so-smart-contracts/cosmos/non_determinism/README.md)
- [Not prioritized messages](./not-so-smart-contracts/cosmos/messages_priority/README.md)
- [Slow ABCI methods](./not-so-smart-contracts/cosmos/abci_fast/README.md)
- [ABCI methods panic](./not-so-smart-contracts/cosmos/abci_panic/README.md)
- [Broken bookkeeping](./not-so-smart-contracts/cosmos/broken_bookkeeping/README.md)
- [Rounding errors](./not-so-smart-contracts/cosmos/rounding_errors/README.md)
- [Unregistered message handler](./not-so-smart-contracts/cosmos/unregistered_msg_handler/README.md)
- [Missing error handler](./not-so-smart-contracts/cosmos/missing_error_handler/README.md)
- [Incorrect Signers](./not-so-smart-contracts/cosmos/incorrect_getsigners/README.md)
- [Non-Determinism](./not-so-smart-contracts/cosmos/non_determinism/README.md)
- [Not Prioritized Messages](./not-so-smart-contracts/cosmos/messages_priority/README.md)
- [Slow ABCI Methods](./not-so-smart-contracts/cosmos/abci_fast/README.md)
- [ABCI Methods Panic](./not-so-smart-contracts/cosmos/abci_panic/README.md)
- [Broken Bookkeeping](./not-so-smart-contracts/cosmos/broken_bookkeeping/README.md)
- [Rounding Errors](./not-so-smart-contracts/cosmos/rounding_errors/README.md)
- [Unregistered Message Handler](./not-so-smart-contracts/cosmos/unregistered_msg_handler/README.md)
- [Missing Error Handler](./not-so-smart-contracts/cosmos/missing_error_handler/README.md)
- [Solana](./not-so-smart-contracts/solana/README.md)
- [Arbitrary CPI](./not-so-smart-contracts/solana/arbitrary_cpi/README.md)
- [Improper PDA Validation](./not-so-smart-contracts/solana/improper_pda_validation/README.md)
- [Ownership Check](./not-so-smart-contracts/solana/ownership_check/README.md)
- [Signer Check](./not-so-smart-contracts/solana/signer_check/README.md)
- [Sysvar Account Check](./not-so-smart-contracts/solana/sysvar_account_check/README.md)
- [Substrate](./not-so-smart-contracts/substrate/README.md)
- [Arithmetic overflow](./not-so-smart-contracts/substrate/arithmetic_overflow/README.md)
- [Don't panic!](./not-so-smart-contracts/substrate/dont_panic/README.md)
- [Weights and fees](./not-so-smart-contracts/substrate/weights_and_fees/README.md)
- [Verify first](./not-so-smart-contracts/substrate/verify_first/README.md)
- [Unsigned transaction validation](./not-so-smart-contracts/substrate/validate_unsigned/README.md)
- [Bad randomness](./not-so-smart-contracts/substrate/randomness/README.md)
- [Bad origin](./not-so-smart-contracts/substrate/origins/README.md)
- [Arithmetic Overflow](./not-so-smart-contracts/substrate/arithmetic_overflow/README.md)
- [Don't Panic!](./not-so-smart-contracts/substrate/dont_panic/README.md)
- [Weights and Fees](./not-so-smart-contracts/substrate/weights_and_fees/README.md)
- [Verify First](./not-so-smart-contracts/substrate/verify_first/README.md)
- [Unsigned Transaction Validation](./not-so-smart-contracts/substrate/validate_unsigned/README.md)
- [Bad Randomness](./not-so-smart-contracts/substrate/randomness/README.md)
- [Bad Origin](./not-so-smart-contracts/substrate/origins/README.md)
- [Program Analysis](./program-analysis/README.md)
- [Echidna](./program-analysis/echidna/README.md)
- [Introduction](./program-analysis/echidna/introduction/README.md)
- [Introduction to fuzzing](./program-analysis/echidna/introduction/fuzzing-introduction.md)
- [How to test a property](./program-analysis/echidna/introduction/how-to-test-a-property.md)
- [Introduction to Fuzzing](./program-analysis/echidna/introduction/fuzzing-introduction.md)
- [How to Test a Property](./program-analysis/echidna/introduction/how-to-test-a-property.md)
- [Basic](./program-analysis/echidna/basic/README.md)
- [How to select the most suitable testing mode](./program-analysis/echidna/basic/testing-modes.md)
- [How to select the best testing approach](./program-analysis/echidna/basic/common-testing-approaches.md)
Expand Down
Loading