Skip to content

Commit

Permalink
pretty struct packing comments (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
RensR authored Sep 27, 2023
1 parent 2da4acc commit cfdeeda
Show file tree
Hide file tree
Showing 9 changed files with 93 additions and 92 deletions.
3 changes: 2 additions & 1 deletion contracts/src/v0.8/ccip/AggregateRateLimiter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ contract AggregateRateLimiter is OwnerIsCreator {
using USDPriceWith18Decimals for uint224;

error PriceNotFoundForToken(address token);

event AdminSet(address newAdmin);

// The address of the token limit admin that has the same permissions as the owner.
Expand Down Expand Up @@ -67,7 +68,7 @@ contract AggregateRateLimiter is OwnerIsCreator {
}

// ================================================================
// | Access |
// Access
// ================================================================

/// @notice Gets the token limit admin address.
Expand Down
14 changes: 7 additions & 7 deletions contracts/src/v0.8/ccip/CommitStore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ contract CommitStore is ICommitStore, TypeAndVersionInterface, OCR2Base {

/// @notice Static commit store config
struct StaticConfig {
uint64 chainSelector; // -------┐ Destination chainSelector
uint64 sourceChainSelector; // -┘ Source chainSelector
uint64 chainSelector; // ───────╮ Destination chainSelector
uint64 sourceChainSelector; // ─╯ Source chainSelector
address onRamp; // OnRamp address on the source chain
address armProxy; // ARM proxy address
}
Expand All @@ -40,8 +40,8 @@ contract CommitStore is ICommitStore, TypeAndVersionInterface, OCR2Base {

/// @notice a sequenceNumber interval
struct Interval {
uint64 min; // ---┐ Minimum sequence number, inclusive
uint64 max; // ---┘ Maximum sequence number, inclusive
uint64 min; // ───╮ Minimum sequence number, inclusive
uint64 max; // ───╯ Maximum sequence number, inclusive
}

/// @notice Report that is committed by the observing DON at the committing phase
Expand Down Expand Up @@ -98,7 +98,7 @@ contract CommitStore is ICommitStore, TypeAndVersionInterface, OCR2Base {
}

// ================================================================
// | Verification |
// Verification
// ================================================================

/// @notice Returns the next expected sequence number.
Expand Down Expand Up @@ -218,7 +218,7 @@ contract CommitStore is ICommitStore, TypeAndVersionInterface, OCR2Base {
}

// ================================================================
// | Config |
// Config
// ================================================================

/// @notice Returns the static commit store config.
Expand Down Expand Up @@ -264,7 +264,7 @@ contract CommitStore is ICommitStore, TypeAndVersionInterface, OCR2Base {
}

// ================================================================
// | Access and ARM |
// Access and ARM
// ================================================================

/// @notice Single function to check the status of the commitStore.
Expand Down
8 changes: 4 additions & 4 deletions contracts/src/v0.8/ccip/PriceRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ contract PriceRegistry is IPriceRegistry, OwnerIsCreator, TypeAndVersionInterfac
}

// ================================================================
// | Price calculations |
// Price calculations
// ================================================================

// @inheritdoc IPriceRegistry
Expand Down Expand Up @@ -147,7 +147,7 @@ contract PriceRegistry is IPriceRegistry, OwnerIsCreator, TypeAndVersionInterfac
}

// ================================================================
// | Fee tokens |
// Fee tokens
// ================================================================

/// @notice Get the list of fee tokens.
Expand Down Expand Up @@ -185,7 +185,7 @@ contract PriceRegistry is IPriceRegistry, OwnerIsCreator, TypeAndVersionInterfac
}

// ================================================================
// | Price updates |
// Price updates
// ================================================================

// @inheritdoc IPriceRegistry
Expand All @@ -211,7 +211,7 @@ contract PriceRegistry is IPriceRegistry, OwnerIsCreator, TypeAndVersionInterfac
}

// ================================================================
// | Access |
// Access
// ================================================================

/// @notice Get the list of price updaters.
Expand Down
8 changes: 4 additions & 4 deletions contracts/src/v0.8/ccip/Router.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ contract Router is IRouter, IRouterClient, TypeAndVersionInterface, OwnerIsCreat
}

// ================================================================
// | Message sending |
// Message sending
// ================================================================

/// @inheritdoc IRouterClient
Expand Down Expand Up @@ -145,7 +145,7 @@ contract Router is IRouter, IRouterClient, TypeAndVersionInterface, OwnerIsCreat
}

// ================================================================
// | Message execution |
// Message execution
// ================================================================

/// @inheritdoc IRouter
Expand Down Expand Up @@ -218,7 +218,7 @@ contract Router is IRouter, IRouterClient, TypeAndVersionInterface, OwnerIsCreat
}

// ================================================================
// | Config |
// Config
// ================================================================

/// @notice Gets the wrapped representation of the native fee coin.
Expand Down Expand Up @@ -316,7 +316,7 @@ contract Router is IRouter, IRouterClient, TypeAndVersionInterface, OwnerIsCreat
}

// ================================================================
// | Access |
// Access
// ================================================================

/// @notice only lets permissioned offRamps execute
Expand Down
14 changes: 7 additions & 7 deletions contracts/src/v0.8/ccip/libraries/RateLimiter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ library RateLimiter {
event ConfigChanged(Config config);

struct TokenBucket {
uint128 tokens; // ------┐ Current number of tokens that are in the bucket.
uint32 lastUpdated; // | Timestamp in seconds of the last token refill, good for 100+ years.
bool isEnabled; // ------┘ Indication whether the rate limiting is enabled or not
uint128 capacity; // ----┐ Maximum number of tokens that can be in the bucket.
uint128 rate; // --------┘ Number of tokens per second that the bucket is refilled.
uint128 tokens; // ──────╮ Current number of tokens that are in the bucket.
uint32 lastUpdated; // Timestamp in seconds of the last token refill, good for 100+ years.
bool isEnabled; // ──────╯ Indication whether the rate limiting is enabled or not
uint128 capacity; // ────╮ Maximum number of tokens that can be in the bucket.
uint128 rate; // ────────╯ Number of tokens per second that the bucket is refilled.
}

struct Config {
bool isEnabled; // Indication whether the rate limiting should be enabled
uint128 capacity; // ----┐ Specifies the capacity of the rate limiter
uint128 rate; // -------┘ Specifies the rate of the rate limiter
uint128 capacity; // ────╮ Specifies the capacity of the rate limiter
uint128 rate; // ───────╯ Specifies the rate of the rate limiter
}

/// @notice _consume removes the given tokens from the pool, lowering the
Expand Down
26 changes: 13 additions & 13 deletions contracts/src/v0.8/ccip/offRamp/EVM2EVMOffRamp.sol
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,22 @@ contract EVM2EVMOffRamp is IAny2EVMOffRamp, AggregateRateLimiter, TypeAndVersion

/// @notice Static offRamp config
struct StaticConfig {
address commitStore; // --------┐ CommitStore address on the destination chain
uint64 chainSelector; // -------┘ Destination chainSelector
uint64 sourceChainSelector; // -┐ Source chainSelector
address onRamp; // -------------┘ OnRamp address on the source chain
address commitStore; // ────────╮ CommitStore address on the destination chain
uint64 chainSelector; // ───────╯ Destination chainSelector
uint64 sourceChainSelector; // ─╮ Source chainSelector
address onRamp; // ─────────────╯ OnRamp address on the source chain
address prevOffRamp; // Address of previous-version OffRamp
address armProxy; // ARM proxy address
}

/// @notice Dynamic offRamp config
/// @dev since OffRampConfig is part of OffRampConfigChanged event, if changing it, we should update the ABI on Atlas
struct DynamicConfig {
uint32 permissionLessExecutionThresholdSeconds; // -┐ Waiting time before manual execution is enabled
address router; // ---------------------------------┘ Router address
address priceRegistry; // -----┐ Price registry address
uint16 maxTokensLength; // | Maximum number of ERC20 token transfers that can be included per message
uint32 maxDataSize; // --------┘ Maximum payload data size
uint32 permissionLessExecutionThresholdSeconds; // ─╮ Waiting time before manual execution is enabled
address router; // ─────────────────────────────────╯ Router address
address priceRegistry; // ─────╮ Price registry address
uint16 maxTokensLength; // Maximum number of ERC20 token transfers that can be included per message
uint32 maxDataSize; // ────────╯ Maximum payload data size
}

// STATIC CONFIG
Expand Down Expand Up @@ -168,7 +168,7 @@ contract EVM2EVMOffRamp is IAny2EVMOffRamp, AggregateRateLimiter, TypeAndVersion
}

// ================================================================
// | Messaging |
// Messaging
// ================================================================

// The size of the execution state in bits
Expand Down Expand Up @@ -431,7 +431,7 @@ contract EVM2EVMOffRamp is IAny2EVMOffRamp, AggregateRateLimiter, TypeAndVersion
}

// ================================================================
// | Config |
// Config
// ================================================================

/// @notice Returns the static config.
Expand Down Expand Up @@ -476,7 +476,7 @@ contract EVM2EVMOffRamp is IAny2EVMOffRamp, AggregateRateLimiter, TypeAndVersion
}

// ================================================================
// | Tokens and pools |
// Tokens and pools
// ================================================================

/// @notice Get all supported source tokens
Expand Down Expand Up @@ -616,7 +616,7 @@ contract EVM2EVMOffRamp is IAny2EVMOffRamp, AggregateRateLimiter, TypeAndVersion
}

// ================================================================
// | Access and ARM |
// Access and ARM
// ================================================================

/// @notice Reverts as this contract should not access CCIP messages
Expand Down
Loading

0 comments on commit cfdeeda

Please sign in to comment.