-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into a7_relayer_watchdog_updates
- Loading branch information
Showing
117 changed files
with
2,677 additions
and
3,111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,26 +29,53 @@ Because we squash all of the changes into a single commit, please try to keep th | |
|
||
For example, `feat(scope): description of feature` should only impact the `scope` package. If your change is a global one, you can use `feat: description of feature`, for example. | ||
|
||
### Source code comments | ||
### Source code comments (NatSpec) | ||
|
||
Follow the [NatSpec format](https://docs.soliditylang.org/en/latest/natspec-format.html) for documenting smart contract source code. Please adhere to a few additional standards: | ||
|
||
#### Contract header | ||
|
||
All contracts should have at the top, and nothing else (minimum viable documentation): | ||
|
||
``` | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.24; | ||
``` | ||
|
||
All contracts should have, preceding their declaration, at minimum: | ||
|
||
``` | ||
/// @title A title | ||
/// @custom:security-contact [email protected] | ||
``` | ||
|
||
#### Single tag | ||
|
||
Always use a single tag, for example do not do this: | ||
|
||
``` | ||
/// @dev Here is a dev comment. | ||
/// @dev Here is another dev comment. | ||
``` | ||
|
||
Instead, combine them into a single comment. | ||
|
||
#### Comment style | ||
|
||
Choose `///` over `/** */` for multi-line NatSpec comments for consistency. All NatSpec comments should use `///` instead of `/** */`. Additional explanatory comments should use `//`, even for multi-line comments. | ||
|
||
#### Notice tag | ||
|
||
Omit the usage of `@notice` and let the compiler automatically pick it up to save column space. For example, this: | ||
Explicitly use `@notice`, don't let the compiler pick it up automatically: | ||
|
||
``` | ||
/// @notice This is a notice. | ||
/// This is a notice. | ||
``` | ||
|
||
becomes this: | ||
|
||
``` | ||
/// This is a notice. | ||
/// @notice This is a notice. | ||
``` | ||
|
||
#### Annotation indentation | ||
|
@@ -166,9 +193,50 @@ If you are referring to some struct or function within the file you can use the | |
/// @notice See the struct in {TaikoData.Config} | ||
``` | ||
|
||
#### What to document | ||
|
||
All public interfaces (those that would be in the ABI) should be documented. This includes public state variables, functions, events, errors, etc. If it's in the ABI, it needs NatSpec. | ||
|
||
#### Ordering | ||
|
||
> Taken from the official Solidity Style Guide | ||
Contract elements should be laid out in the following order: | ||
|
||
1. Pragma statements | ||
2. Import statements | ||
3. Events | ||
4. Errors | ||
5. Interfaces | ||
6. Libraries | ||
7. Contracts | ||
|
||
Inside each contract, library or interface, use the following order: | ||
|
||
1. Type declarations | ||
2. State variables | ||
3. Events | ||
4. Errors | ||
5. Modifiers | ||
6. Functions | ||
|
||
Functions should be grouped according to their visibility and ordered: | ||
|
||
1. constructor | ||
2. receive function (if exists) | ||
3. fallback function (if exists) | ||
4. external | ||
5. public | ||
6. internal | ||
7. private | ||
|
||
It is preferred for state variables to follow the same ordering according to visibility as functions, shown above, but it is not required as this could affect the storage layout. | ||
|
||
Lexicographical order is preferred but also optional. | ||
|
||
#### Documenting interfaces | ||
|
||
To document the implementing contract of an interface, you cannot use `@inheritdoc`, it is not supported for contracts. Thus, you should mention a statement like so: | ||
To document the implementing contract of an interface, you cannot use `@inheritdoc`, it is not supported for contracts at the top-level. Thus, you should mention a statement like so: | ||
|
||
```solidity | ||
/// @notice See the documentation in {IProverPool} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+3.37 MB
packages/protocol/audit/quill_audits_taiko_smart_contract_audit_report.pdf
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,4 @@ | ||
// SPDX-License-Identifier: MIT | ||
// _____ _ _ _ _ | ||
// |_ _|_ _(_) |_____ | | __ _| |__ ___ | ||
// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< | ||
// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ | ||
// | ||
// Email: [email protected] | ||
// Website: https://taiko.xyz | ||
// GitHub: https://github.com/taikoxyz | ||
// Discord: https://discord.gg/taikoxyz | ||
// Twitter: https://twitter.com/taikoxyz | ||
// Blog: https://mirror.xyz/labs.taiko.eth | ||
// Youtube: https://www.youtube.com/@taikoxyz | ||
|
||
pragma solidity 0.8.24; | ||
|
||
import "./TaikoData.sol"; | ||
|
@@ -20,31 +7,28 @@ import "./TaikoData.sol"; | |
/// @custom:security-contact [email protected] | ||
interface ITaikoL1 { | ||
/// @notice Proposes a Taiko L2 block. | ||
/// @param params Block parameters, currently an encoded BlockParams object. | ||
/// @param txList txList data if calldata is used for DA. | ||
/// @return meta The metadata of the proposed L2 block. | ||
/// @return depositsProcessed The Ether deposits processed. | ||
/// @param _params Block parameters, currently an encoded BlockParams object. | ||
/// @param _txList txList data if calldata is used for DA. | ||
/// @return meta_ The metadata of the proposed L2 block. | ||
/// @return deposits_ The Ether deposits processed. | ||
function proposeBlock( | ||
bytes calldata params, | ||
bytes calldata txList | ||
bytes calldata _params, | ||
bytes calldata _txList | ||
) | ||
external | ||
payable | ||
returns ( | ||
TaikoData.BlockMetadata memory meta, | ||
TaikoData.EthDeposit[] memory depositsProcessed | ||
); | ||
returns (TaikoData.BlockMetadata memory meta_, TaikoData.EthDeposit[] memory deposits_); | ||
|
||
/// @notice Proves or contests a block transition. | ||
/// @param blockId The index of the block to prove. This is also used to | ||
/// @param _blockId The index of the block to prove. This is also used to | ||
/// select the right implementation version. | ||
/// @param input An abi-encoded (BlockMetadata, Transition, TierProof) | ||
/// tuple. | ||
function proveBlock(uint64 blockId, bytes calldata input) external; | ||
/// @param _input An abi-encoded (TaikoData.BlockMetadata, TaikoData.Transition, | ||
/// TaikoData.TierProof) tuple. | ||
function proveBlock(uint64 _blockId, bytes calldata _input) external; | ||
|
||
/// @notice Verifies up to a certain number of blocks. | ||
/// @param maxBlocksToVerify Max number of blocks to verify. | ||
function verifyBlocks(uint64 maxBlocksToVerify) external; | ||
/// @param _maxBlocksToVerify Max number of blocks to verify. | ||
function verifyBlocks(uint64 _maxBlocksToVerify) external; | ||
|
||
/// @notice Gets the configuration of the TaikoL1 contract. | ||
/// @return Config struct containing configuration parameters. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,10 @@ | ||
// SPDX-License-Identifier: MIT | ||
// _____ _ _ _ _ | ||
// |_ _|_ _(_) |_____ | | __ _| |__ ___ | ||
// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< | ||
// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ | ||
// | ||
// Email: [email protected] | ||
// Website: https://taiko.xyz | ||
// GitHub: https://github.com/taikoxyz | ||
// Discord: https://discord.gg/taikoxyz | ||
// Twitter: https://twitter.com/taikoxyz | ||
// Blog: https://mirror.xyz/labs.taiko.eth | ||
// Youtube: https://www.youtube.com/@taikoxyz | ||
|
||
pragma solidity 0.8.24; | ||
|
||
/// @title TaikoData | ||
/// @custom:security-contact [email protected] | ||
/// @notice This library defines various data structures used in the Taiko | ||
/// protocol. | ||
/// @custom:security-contact [email protected] | ||
library TaikoData { | ||
/// @dev Struct holding Taiko configuration parameters. See {TaikoConfig}. | ||
struct Config { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,21 @@ | ||
// SPDX-License-Identifier: MIT | ||
// _____ _ _ _ _ | ||
// |_ _|_ _(_) |_____ | | __ _| |__ ___ | ||
// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< | ||
// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ | ||
// | ||
// Email: [email protected] | ||
// Website: https://taiko.xyz | ||
// GitHub: https://github.com/taikoxyz | ||
// Discord: https://discord.gg/taikoxyz | ||
// Twitter: https://twitter.com/taikoxyz | ||
// Blog: https://mirror.xyz/labs.taiko.eth | ||
// Youtube: https://www.youtube.com/@taikoxyz | ||
|
||
pragma solidity 0.8.24; | ||
|
||
/// @title TaikoErrors | ||
/// @custom:security-contact [email protected] | ||
/// @notice This abstract contract provides custom error declartions used in | ||
/// @notice This abstract contract provides custom error declarations used in | ||
/// the Taiko protocol. Each error corresponds to specific situations where | ||
/// exceptions might be thrown. | ||
/// @dev The errors defined here must match the definitions in the corresponding | ||
/// L1 libraries. | ||
/// @custom:security-contact [email protected] | ||
abstract contract TaikoErrors { | ||
// NOTE: The following custom errors must match the definitions in | ||
// `L1/libs/*.sol`. | ||
error L1_ALREADY_CONTESTED(); | ||
error L1_ALREADY_PROVED(); | ||
error L1_ASSIGNED_PROVER_NOT_ALLOWED(); | ||
error L1_BLOB_FOR_DA_DISABLED(); | ||
error L1_BLOB_NOT_FOUND(); | ||
error L1_BLOB_NOT_REUSEABLE(); | ||
error L1_BLOB_REUSE_DISALBED(); | ||
error L1_BLOB_NOT_REUSABLE(); | ||
error L1_BLOB_REUSE_DISABLED(); | ||
error L1_BLOCK_MISMATCH(); | ||
error L1_INVALID_BLOCK_ID(); | ||
error L1_INVALID_CONFIG(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,15 @@ | ||
// SPDX-License-Identifier: MIT | ||
// _____ _ _ _ _ | ||
// |_ _|_ _(_) |_____ | | __ _| |__ ___ | ||
// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< | ||
// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ | ||
// | ||
// Email: [email protected] | ||
// Website: https://taiko.xyz | ||
// GitHub: https://github.com/taikoxyz | ||
// Discord: https://discord.gg/taikoxyz | ||
// Twitter: https://twitter.com/taikoxyz | ||
// Blog: https://mirror.xyz/labs.taiko.eth | ||
// Youtube: https://www.youtube.com/@taikoxyz | ||
|
||
pragma solidity 0.8.24; | ||
|
||
import "./TaikoData.sol"; | ||
|
||
/// @title TaikoEvents | ||
/// @custom:security-contact [email protected] | ||
/// @notice This abstract contract provides event declarations for the Taiko | ||
/// protocol, which are emitted during block proposal, proof, verification, and | ||
/// Ethereum deposit processes. | ||
/// @dev The events defined here must match the definitions in the corresponding | ||
/// L1 libraries. | ||
/// @custom:security-contact [email protected] | ||
abstract contract TaikoEvents { | ||
/// @dev Emitted when a block is proposed. | ||
/// @param blockId The ID of the proposed block. | ||
|
@@ -41,7 +28,7 @@ abstract contract TaikoEvents { | |
/// @dev Emitted when a block is verified. | ||
/// @param blockId The ID of the verified block. | ||
/// @param assignedProver The block's assigned prover. | ||
/// @param prover The prover whose transition is used for verifing the | ||
/// @param prover The prover whose transition is used for verifying the | ||
/// block. | ||
/// @param blockHash The hash of the verified block. | ||
/// @param stateRoot The block's state root. | ||
|
Oops, something went wrong.