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

feat(protocol): add various small fixes based on quill report #16031

Merged
merged 9 commits into from
Feb 24, 2024
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
2 changes: 1 addition & 1 deletion packages/protocol/contracts/L1/TaikoData.sol
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,6 @@ library TaikoData {
mapping(bytes32 blobHash => uint256 since) reusableBlobs;
SlotA slotA; // slot 6
SlotB slotB; // slot 7
uint256[143] __gap;
uint256[43] __gap;
}
}
2 changes: 1 addition & 1 deletion packages/protocol/contracts/L1/TaikoL1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import "./TaikoEvents.sol";
/// This contract doesn't hold any Ether. Ether deposited to L2 are held by the Bridge contract.
contract TaikoL1 is EssentialContract, ITaikoL1, ITierProvider, TaikoEvents, TaikoErrors {
TaikoData.State public state;
uint256[100] private __gap;
uint256[50] private __gap;

modifier whenProvingNotPaused() {
if (state.slotB.provingPaused) revert L1_PROVING_PAUSED();
Expand Down
2 changes: 2 additions & 0 deletions packages/protocol/contracts/L1/TaikoToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import "../common/EssentialContract.sol";
/// in the form of bonds. It is an ERC20 token with 18 decimal places of
/// precision.
contract TaikoToken is EssentialContract, ERC20SnapshotUpgradeable, ERC20VotesUpgradeable {
uint256[50] private __gap;

error TKO_INVALID_ADDR();

/// @notice Initializes the TaikoToken contract and mints initial tokens.
Expand Down
2 changes: 2 additions & 0 deletions packages/protocol/contracts/L1/hooks/AssignmentHook.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ contract AssignmentHook is EssentialContract, IHook {
// get paid within this limit.
uint256 public constant MAX_GAS_PAYING_PROVER = 50_000;

uint256[50] private __gap;

event BlockAssigned(
address indexed assignedProver, TaikoData.BlockMetadata meta, ProverAssignment assignment
);
Expand Down
2 changes: 2 additions & 0 deletions packages/protocol/contracts/L1/provers/GuardianProver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import "./Guardians.sol";

/// @title GuardianProver
contract GuardianProver is Guardians {
uint256[50] private __gap;

event GuardianApproval(
address indexed addr, uint256 indexed blockId, bytes32 blockHash, bool approved
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import "../../common/EssentialContract.sol";
import "./ITierProvider.sol";

contract OptimisticTierProvider is EssentialContract, ITierProvider {
uint256[50] private __gap;

error TIER_NOT_FOUND();

/// @notice Initializes the contract with the provided address manager.
Expand Down
2 changes: 2 additions & 0 deletions packages/protocol/contracts/L1/tiers/TestnetTierProvider.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import "./ITierProvider.sol";
// these many tokens: 1,000,000,000 * 10% / 86400=1157 TOK per block, which is
// about 722 USD.
contract TestnetTierProvider is EssentialContract, ITierProvider {
uint256[50] private __gap;

error TIER_NOT_FOUND();

/// @notice Initializes the contract with the provided address manager.
Expand Down
2 changes: 1 addition & 1 deletion packages/protocol/contracts/L2/TaikoL2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ contract TaikoL2 is CrossChainOwned {
uint64 public gasExcess; // slot 3
uint64 public lastSyncedBlock;

uint256[147] private __gap;
uint256[47] private __gap;

event Anchored(bytes32 parentHash, uint64 gasExcess);

Expand Down
2 changes: 2 additions & 0 deletions packages/protocol/contracts/bridge/Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ contract Bridge is EssentialContract, IBridge {
event MessageReceived(bytes32 indexed msgHash, Message message, bool isRecall);
event MessageRecalled(bytes32 indexed msgHash);
event MessageExecuted(bytes32 indexed msgHash);
event MessageRetried(bytes32 indexed msgHash);
event MessageStatusChanged(bytes32 indexed msgHash, Status status);
event MessageSuspended(bytes32 msgHash, bool suspended);
event AddressBanned(address indexed addr, bool banned);
Expand Down Expand Up @@ -377,6 +378,7 @@ contract Bridge is EssentialContract, IBridge {
} else if (isLastAttempt) {
_updateMessageStatus(msgHash, Status.FAILED);
}
emit MessageRetried(msgHash);
}

/// @notice Checks if the message was sent.
Expand Down
2 changes: 2 additions & 0 deletions packages/protocol/contracts/common/AddressManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ contract AddressManager is OwnerUUPSUpgradable, IAddressManager {
uint64 indexed chainId, bytes32 indexed name, address newAddress, address oldAddress
);

error AM_INVALID_PARAMS();
error AM_UNSUPPORTED();
/// @notice Initializes the owner for the upgradable contract.

Expand All @@ -60,6 +61,7 @@ contract AddressManager is OwnerUUPSUpgradable, IAddressManager {
onlyOwner
{
address oldAddress = addresses[chainId][name];
if (newAddress == oldAddress) revert AM_INVALID_PARAMS();
addresses[chainId][name] = newAddress;
emit AddressSet(chainId, name, newAddress, oldAddress);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/protocol/contracts/libs/LibAddress.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ library LibAddress {
/// @param amount The amount of Ether to send in wei.
/// @param gasLimit The max amount gas to pay for this transaction.
function sendEther(address to, uint256 amount, uint256 gasLimit) internal {
// Check for zero-value or zero-address transactions
// Check for zero-address transactions
if (to == address(0)) revert ETH_TRANSFER_FAILED();

// Attempt to send Ether to the recipient address
Expand Down
2 changes: 2 additions & 0 deletions packages/protocol/contracts/tokenvault/BaseVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ abstract contract BaseVault is
IMessageInvocable,
IERC165Upgradeable
{
uint256[50] private __gap;

error VAULT_PERMISSION_DENIED();

modifier onlyFromBridge() {
Expand Down
1 change: 0 additions & 1 deletion packages/protocol/test/L1/TaikoL1TestBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ abstract contract TaikoL1TestBase is TaikoTest {
registerAddress("tier_provider", address(cp));
registerAddress("signal_service", address(ss));
registerAddress("guardian_prover", address(gp));
registerAddress("bridge", address(bridge));
registerL2Address("taiko", address(L2));
registerL2Address("signal_service", address(L2SS));
registerL2Address("taiko_l2", address(L2));
Expand Down
2 changes: 0 additions & 2 deletions packages/protocol/test/tokenvault/ERC20Vault.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@ contract TestERC20Vault is TaikoTest {

addressManager.setAddress(destChainId, "signal_service", address(mockProofSignalService));

addressManager.setAddress(uint64(block.chainid), "bridge", address(bridge));

addressManager.setAddress(uint64(block.chainid), "erc20_vault", address(erc20Vault));

addressManager.setAddress(destChainId, "erc20_vault", address(destChainIdERC20Vault));
Expand Down
Loading