Skip to content

Commit

Permalink
Merge branch 'main' into a7_relayer_watchdog_updates
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey committed Feb 29, 2024
2 parents 72f5da1 + c021d40 commit fdb763c
Show file tree
Hide file tree
Showing 117 changed files with 2,677 additions and 3,111 deletions.
78 changes: 73 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ require (
github.com/pkg/errors v0.9.1
github.com/pressly/goose/v3 v3.18.0
github.com/prometheus/client_golang v1.19.0
github.com/rabbitmq/amqp091-go v1.8.1
github.com/rabbitmq/amqp091-go v1.9.0
github.com/shopspring/decimal v1.3.1
github.com/stretchr/testify v1.8.4
github.com/swaggo/swag v1.16.2
github.com/swaggo/swag v1.16.3
github.com/testcontainers/testcontainers-go v0.28.0
github.com/urfave/cli/v2 v2.27.1
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,8 @@ github.com/prometheus/common v0.48.0 h1:QO8U2CdOzSn1BBsmXJXduaaW+dY/5QLjfB8svtSz
github.com/prometheus/common v0.48.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc=
github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo=
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
github.com/rabbitmq/amqp091-go v1.8.1 h1:RejT1SBUim5doqcL6s7iN6SBmsQqyTgXb1xMlH0h1hA=
github.com/rabbitmq/amqp091-go v1.8.1/go.mod h1:+jPrT9iY2eLjRaMSRHUhc3z14E/l85kv/f+6luSD3pc=
github.com/rabbitmq/amqp091-go v1.9.0 h1:qrQtyzB4H8BQgEuJwhmVQqVHB9O4+MNDJCCAcpc3Aoo=
github.com/rabbitmq/amqp091-go v1.9.0/go.mod h1:+jPrT9iY2eLjRaMSRHUhc3z14E/l85kv/f+6luSD3pc=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
Expand Down Expand Up @@ -615,8 +615,8 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4=
github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw=
github.com/swaggo/swag v1.16.2 h1:28Pp+8DkQoV+HLzLx8RGJZXNGKbFqnuvSbAAtoxiY04=
github.com/swaggo/swag v1.16.2/go.mod h1:6YzXnDcpr0767iOejs318CwYkCQqyGer6BizOg03f+E=
github.com/swaggo/swag v1.16.3 h1:PnCYjPCah8FK4I26l2F/KQ4yz3sILcVUN3cTlBFA9Pg=
github.com/swaggo/swag v1.16.3/go.mod h1:DImHIuOFXKpMFAQjcC7FG4m3Dg4+QuUgUzJmKjI/gRk=
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY=
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc=
github.com/taikoxyz/taiko-geth v0.0.0-20240208145922-98152a0c9fc8 h1:PE5B0McCy7+So4zQFO6b9E2qhCRhKEu+QF7EbRaLiog=
Expand Down
4 changes: 2 additions & 2 deletions packages/bridge-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
"@types/object-hash": "^3.0.6",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"@vitest/coverage-v8": "^0.33.0",
"@vitest/coverage-v8": "^1.3.1",
"@wagmi/cli": "^2.1.1",
"abitype": "^0.8.11",
"abitype": "^1.0.0",
"ajv": "^8.12.0",
"autoprefixer": "^10.4.17",
"daisyui": "^4.7.2",
Expand Down
Binary file not shown.
42 changes: 13 additions & 29 deletions packages/protocol/contracts/L1/ITaikoL1.sol
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";
Expand All @@ -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.
Expand Down
15 changes: 1 addition & 14 deletions packages/protocol/contracts/L1/TaikoData.sol
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 {
Expand Down
25 changes: 6 additions & 19 deletions packages/protocol/contracts/L1/TaikoErrors.sol
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();
Expand Down
17 changes: 2 additions & 15 deletions packages/protocol/contracts/L1/TaikoEvents.sol
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.
Expand All @@ -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.
Expand Down
Loading

0 comments on commit fdb763c

Please sign in to comment.