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

chore(protocol)!: enforce naming convention #16168

Merged
merged 91 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
a0c7f1a
more
dantaik Feb 28, 2024
5f73c32
fmt
dantaik Feb 28, 2024
8e734ff
Update ERC20Vault.sol
dantaik Feb 28, 2024
81b030c
Update SignalService.sol
dantaik Feb 28, 2024
8c10e10
more
dantaik Feb 28, 2024
a8f1d13
Create SOLIDITY_STYLE_GUIDE.md
dantaik Feb 28, 2024
ef4361f
Update SOLIDITY_STYLE_GUIDE.md
dantaik Feb 28, 2024
c07e338
Update taikoL2.ts
dantaik Feb 28, 2024
1a4cd37
Update taikoL2.ts
dantaik Feb 28, 2024
bc02fe8
Update SOLIDITY_STYLE_GUIDE.md
dantaik Feb 28, 2024
af5f390
Merge branch 'main' into naming_conv
dantaik Feb 28, 2024
81819b9
fix(protocol): fix test error
dantaik Feb 28, 2024
6220eec
Merge branch 'fix_foundry' into naming_conv
dantaik Feb 28, 2024
042deda
Merge branch 'main' into naming_conv
dantaik Feb 28, 2024
19eb1a2
Merge branch 'main' into naming_conv
dantaik Feb 29, 2024
2f5e95a
Update ITaikoL1.sol
dantaik Feb 29, 2024
26cb30d
Merge branch 'naming_conv' of https://github.com/taikoxyz/taiko-mono …
dantaik Feb 29, 2024
9cbf397
more
dantaik Feb 29, 2024
b6ecd82
more
dantaik Feb 29, 2024
50df9f8
Update LibProving.sol
dantaik Feb 29, 2024
1130835
Update Bridge.sol
dantaik Feb 29, 2024
7041472
Update Bridge.sol
dantaik Feb 29, 2024
87f65bb
more
dantaik Feb 29, 2024
d588f01
more
dantaik Feb 29, 2024
3822456
Merge branch 'main' into naming_conv
dantaik Feb 29, 2024
83c498d
Update TaikoL1.sol
dantaik Feb 29, 2024
765e580
fix
dantaik Feb 29, 2024
39b1682
Merge branch 'naming_conv' of https://github.com/taikoxyz/taiko-mono …
dantaik Feb 29, 2024
9a194ce
more
dantaik Feb 29, 2024
b44d7a8
Update ISignalService.sol
dantaik Feb 29, 2024
5e5f1cb
Merge branch 'main' into naming_conv
dantaik Feb 29, 2024
367c9a8
solidity version
dantaik Feb 29, 2024
f075208
Update BridgedERC20.sol
dantaik Feb 29, 2024
110ab75
rename
dantaik Feb 29, 2024
00f9325
update license
dionysuzx Feb 28, 2024
a1570b6
rest of contracts
dionysuzx Feb 28, 2024
4e9b7ec
update
dionysuzx Feb 28, 2024
b2e8bf0
update
dionysuzx Feb 28, 2024
4ebeeca
update
dionysuzx Feb 28, 2024
3c0142c
revert license changes
dionysuzx Feb 29, 2024
e041216
contributing.md
dionysuzx Feb 29, 2024
aa085a9
addressmanager.sol
dionysuzx Feb 29, 2024
be3dc0a
addressresolver.sol
dionysuzx Feb 29, 2024
5516a7c
assignmenthook.sol
dionysuzx Feb 29, 2024
d34b73e
basenftvault
dionysuzx Feb 29, 2024
a5ed55a
basevault
dionysuzx Feb 29, 2024
e6f2abb
contributing.md
dionysuzx Feb 29, 2024
ee97d44
bridge.sol
dionysuzx Feb 29, 2024
17b473f
fmt bridge.sol
dionysuzx Feb 29, 2024
4a9880f
change a few functions to be internal to lower gas cost
dantaik Feb 29, 2024
326a25b
Merge branch 'internal' into naming_conv
dantaik Feb 29, 2024
a8dd7d9
fix
dantaik Feb 29, 2024
c1ae191
lint
dantaik Feb 29, 2024
f7e73b5
fix
dantaik Feb 29, 2024
c302733
more
dantaik Feb 29, 2024
f349b05
Merge branch 'internal' into naming_conv
dantaik Feb 29, 2024
09cec9c
Update LibVerifying.sol
dantaik Feb 29, 2024
c8b226f
bridgederc1155
dionysuzx Feb 29, 2024
c8cf712
bridgederc20
dionysuzx Feb 29, 2024
32c63bf
bridgederc20base
dionysuzx Feb 29, 2024
5ee0853
more
dionysuzx Feb 29, 2024
4fa5440
more
dionysuzx Feb 29, 2024
96768fd
more
dionysuzx Feb 29, 2024
df9ace8
more
dionysuzx Feb 29, 2024
b4be7d2
more and fmt
dionysuzx Feb 29, 2024
ed846e3
more
dionysuzx Feb 29, 2024
f65f5d6
more
dionysuzx Feb 29, 2024
eefa661
more
dionysuzx Feb 29, 2024
2a3c634
more
dionysuzx Feb 29, 2024
1a98777
more
dionysuzx Feb 29, 2024
77b9414
more
dionysuzx Feb 29, 2024
fedc4a0
more
dionysuzx Feb 29, 2024
e603199
more
dionysuzx Feb 29, 2024
d33f52a
more
dionysuzx Feb 29, 2024
1bb0891
finish
dionysuzx Feb 29, 2024
b647db4
fixup
dionysuzx Feb 29, 2024
7adee00
more
dionysuzx Feb 29, 2024
1f906b5
Merge branch 'internal' into oz/missing-docstrings
dantaik Feb 29, 2024
b1ff0e5
Merge branch 'oz/missing-docstrings' into naming_conv
dantaik Feb 29, 2024
d9dddee
Merge branch 'main' into oz/missing-docstrings
dantaik Feb 29, 2024
90f2917
Merge branch 'oz/missing-docstrings' into naming_conv
dantaik Feb 29, 2024
84eff92
fix
dantaik Feb 29, 2024
8a98450
Merge branch 'naming_conv' of https://github.com/taikoxyz/taiko-mono …
dantaik Feb 29, 2024
a7181d8
Merge branch 'main' into naming_conv
dantaik Feb 29, 2024
fe6ad79
fix
dantaik Feb 29, 2024
657843c
Update LibProposing.sol
dantaik Feb 29, 2024
19ca7ea
Update TaikoL1.sol
dantaik Feb 29, 2024
fbb0e73
x
dantaik Feb 29, 2024
770bde4
x
dantaik Feb 29, 2024
db5930b
Update Guardians.sol
dantaik Feb 29, 2024
55b4434
x
dantaik Feb 29, 2024
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
29 changes: 13 additions & 16 deletions packages/protocol/contracts/L1/ITaikoL1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,28 @@ import "./TaikoData.sol";
/// @custom:security-contact security@taiko.xyz
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
83 changes: 40 additions & 43 deletions packages/protocol/contracts/L1/TaikoL1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,18 @@ contract TaikoL1 is EssentialContract, ITaikoL1, TaikoEvents, TaikoErrors {

/// @inheritdoc ITaikoL1
function proposeBlock(
bytes calldata params,
bytes calldata txList
bytes calldata _params,
bytes calldata _txList
)
external
payable
nonReentrant
whenNotPaused
returns (
TaikoData.BlockMetadata memory meta,
TaikoData.EthDeposit[] memory depositsProcessed
)
returns (TaikoData.BlockMetadata memory meta_, TaikoData.EthDeposit[] memory deposits_)
{
TaikoData.Config memory config = getConfig();

(meta, depositsProcessed) = LibProposing.proposeBlock(state, config, this, params, txList);
(meta_, deposits_) = LibProposing.proposeBlock(state, config, this, _params, _txList);

if (!state.slotB.provingPaused) {
LibVerifying.verifyBlocks(state, config, this, config.maxBlocksToVerifyPerProposal);
Expand All @@ -76,8 +73,8 @@ contract TaikoL1 is EssentialContract, ITaikoL1, TaikoEvents, TaikoErrors {

/// @inheritdoc ITaikoL1
function proveBlock(
uint64 blockId,
bytes calldata input
uint64 _blockId,
bytes calldata _input
)
external
nonReentrant
Expand All @@ -88,9 +85,9 @@ contract TaikoL1 is EssentialContract, ITaikoL1, TaikoEvents, TaikoErrors {
TaikoData.BlockMetadata memory meta,
TaikoData.Transition memory tran,
TaikoData.TierProof memory proof
) = abi.decode(input, (TaikoData.BlockMetadata, TaikoData.Transition, TaikoData.TierProof));
) = abi.decode(_input, (TaikoData.BlockMetadata, TaikoData.Transition, TaikoData.TierProof));

if (blockId != meta.id) revert L1_INVALID_BLOCK_ID();
if (_blockId != meta.id) revert L1_INVALID_BLOCK_ID();

TaikoData.Config memory config = getConfig();

Expand All @@ -100,27 +97,27 @@ contract TaikoL1 is EssentialContract, ITaikoL1, TaikoEvents, TaikoErrors {
}

/// @inheritdoc ITaikoL1
function verifyBlocks(uint64 maxBlocksToVerify)
function verifyBlocks(uint64 _maxBlocksToVerify)
external
nonReentrant
whenNotPaused
whenProvingNotPaused
{
LibVerifying.verifyBlocks(state, getConfig(), this, maxBlocksToVerify);
LibVerifying.verifyBlocks(state, getConfig(), this, _maxBlocksToVerify);
}

/// @notice Pause block proving.
/// @param pause True if paused.
function pauseProving(bool pause) external {
/// @param _pause True if paused.
function pauseProving(bool _pause) external {
_authorizePause(msg.sender);
LibProving.pauseProving(state, pause);
LibProving.pauseProving(state, _pause);
}

/// @notice Deposits Ether to Layer 2.
/// @param recipient Address of the recipient for the deposited Ether on
/// @param _recipient Address of the recipient for the deposited Ether on
/// Layer 2.
function depositEtherToL2(address recipient) external payable nonReentrant whenNotPaused {
LibDepositing.depositEtherToL2(state, getConfig(), this, recipient);
function depositEtherToL2(address _recipient) external payable nonReentrant whenNotPaused {
LibDepositing.depositEtherToL2(state, getConfig(), this, _recipient);
}

/// @inheritdoc EssentialContract
Expand All @@ -130,59 +127,59 @@ contract TaikoL1 is EssentialContract, ITaikoL1, TaikoEvents, TaikoErrors {
}

/// @notice Checks if Ether deposit is allowed for Layer 2.
/// @param amount Amount of Ether to be deposited.
/// @param _amount Amount of Ether to be deposited.
/// @return true if Ether deposit is allowed, false otherwise.
function canDepositEthToL2(uint256 amount) public view returns (bool) {
return LibDepositing.canDepositEthToL2(state, getConfig(), amount);
function canDepositEthToL2(uint256 _amount) public view returns (bool) {
return LibDepositing.canDepositEthToL2(state, getConfig(), _amount);
}

/// @notice See {LibProposing-isBlobReusable}.
function isBlobReusable(bytes32 blobHash) public view returns (bool) {
return LibProposing.isBlobReusable(state, getConfig(), blobHash);
function isBlobReusable(bytes32 _blobHash) public view returns (bool) {
return LibProposing.isBlobReusable(state, getConfig(), _blobHash);
}

/// @notice Gets the details of a block.
/// @param blockId Index of the block.
/// @return blk The block.
/// @return ts The transition used to verify this block.
function getBlock(uint64 blockId)
/// @param _blockId Index of the block.
/// @return blk_ The block.
/// @return ts_ The transition used to verify this block.
function getBlock(uint64 _blockId)
public
view
returns (TaikoData.Block memory blk, TaikoData.TransitionState memory ts)
returns (TaikoData.Block memory blk_, TaikoData.TransitionState memory ts_)
{
uint64 slot;
(blk, slot) = LibUtils.getBlock(state, getConfig(), blockId);
(blk_, slot) = LibUtils.getBlock(state, getConfig(), _blockId);

if (blk.verifiedTransitionId != 0) {
ts = state.transitions[slot][blk.verifiedTransitionId];
if (blk_.verifiedTransitionId != 0) {
ts_ = state.transitions[slot][blk_.verifiedTransitionId];
}
}

/// @notice Gets the state transition for a specific block.
/// @param blockId Index of the block.
/// @param parentHash Parent hash of the block.
/// @return TransitionState The state transition data of the block.
/// @param _blockId Index of the block.
/// @param _parentHash Parent hash of the block.
/// @return The state transition data of the block.
function getTransition(
uint64 blockId,
bytes32 parentHash
uint64 _blockId,
bytes32 _parentHash
)
public
view
returns (TaikoData.TransitionState memory)
{
return LibUtils.getTransition(state, getConfig(), blockId, parentHash);
return LibUtils.getTransition(state, getConfig(), _blockId, _parentHash);
}

/// @notice Gets the state variables of the TaikoL1 contract.
/// @return a State variables stored at SlotA.
/// @return b State variables stored at SlotB.
/// @return a_ State variables stored at SlotA.
/// @return b_ State variables stored at SlotB.
function getStateVariables()
public
view
returns (TaikoData.SlotA memory a, TaikoData.SlotB memory b)
returns (TaikoData.SlotA memory a_, TaikoData.SlotB memory b_)
{
a = state.slotA;
b = state.slotB;
a_ = state.slotA;
b_ = state.slotB;
}

/// @inheritdoc ITaikoL1
Expand Down
62 changes: 31 additions & 31 deletions packages/protocol/contracts/L1/TaikoToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ contract TaikoToken is EssentialContract, ERC20SnapshotUpgradeable, ERC20VotesUp
}

/// @notice Burns tokens from the specified address.
/// @param from The address to burn tokens from.
/// @param amount The amount of tokens to burn.
function burn(address from, uint256 amount) public onlyOwner {
_burn(from, amount);
/// @param _from The address to burn tokens from.
/// @param _amount The amount of tokens to burn.
function burn(address _from, uint256 _amount) public onlyOwner {
_burn(_from, _amount);
}

/// @notice Creates a new token snapshot.
Expand All @@ -54,71 +54,71 @@ contract TaikoToken is EssentialContract, ERC20SnapshotUpgradeable, ERC20VotesUp
}

/// @notice Transfers tokens to a specified address.
/// @param to The address to transfer tokens to.
/// @param amount The amount of tokens to transfer.
/// @param _to The address to transfer tokens to.
/// @param _amount The amount of tokens to transfer.
/// @return A boolean indicating whether the transfer was successful or not.
function transfer(address to, uint256 amount) public override returns (bool) {
if (to == address(this)) revert TKO_INVALID_ADDR();
return super.transfer(to, amount);
function transfer(address _to, uint256 _amount) public override returns (bool) {
if (_to == address(this)) revert TKO_INVALID_ADDR();
return super.transfer(_to, _amount);
}

/// @notice Transfers tokens from one address to another.
/// @param from The address to transfer tokens from.
/// @param to The address to transfer tokens to.
/// @param amount The amount of tokens to transfer.
/// @param _from The address to transfer tokens from.
/// @param _to The address to transfer tokens to.
/// @param _amount The amount of tokens to transfer.
/// @return A boolean indicating whether the transfer was successful or not.
function transferFrom(
address from,
address to,
uint256 amount
address _from,
address _to,
uint256 _amount
)
public
override
returns (bool)
{
if (to == address(this)) revert TKO_INVALID_ADDR();
return super.transferFrom(from, to, amount);
if (_to == address(this)) revert TKO_INVALID_ADDR();
return super.transferFrom(_from, _to, _amount);
}

function _beforeTokenTransfer(
address from,
address to,
uint256 amount
address _from,
address _to,
uint256 _amount
)
internal
override(ERC20Upgradeable, ERC20SnapshotUpgradeable)
{
super._beforeTokenTransfer(from, to, amount);
super._beforeTokenTransfer(_from, _to, _amount);
}

function _afterTokenTransfer(
address from,
address to,
uint256 amount
address _from,
address _to,
uint256 _amount
)
internal
override(ERC20Upgradeable, ERC20VotesUpgradeable)
{
super._afterTokenTransfer(from, to, amount);
super._afterTokenTransfer(_from, _to, _amount);
}

function _mint(
address to,
uint256 amount
address _to,
uint256 _amount
)
internal
override(ERC20Upgradeable, ERC20VotesUpgradeable)
{
super._mint(to, amount);
super._mint(_to, _amount);
}

function _burn(
address from,
uint256 amount
address _from,
uint256 _amount
)
internal
override(ERC20Upgradeable, ERC20VotesUpgradeable)
{
super._burn(from, amount);
super._burn(_from, _amount);
}
}
Loading
Loading