Skip to content

Commit 7cee93b

Browse files
Keszey DánielKeszey Dániel
authored andcommitted
replace all strings
1 parent aa5d36f commit 7cee93b

28 files changed

+220
-130
lines changed

packages/protocol/contracts/L1/TaikoL1.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ contract TaikoL1 is EssentialContract, ITaikoL1, TaikoEvents, TaikoErrors {
228228
view
229229
virtual
230230
override
231-
onlyFromOwnerOrNamed("chain_pauser")
231+
onlyFromOwnerOrNamed(LibConstStrings.BYTES32_CHAIN_PAUSER)
232232
{ }
233233

234234
function _checkEOAForCalldataDA() internal pure virtual returns (bool) {

packages/protocol/contracts/L1/TaikoToken.sol

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
55
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20SnapshotUpgradeable.sol";
66
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20VotesUpgradeable.sol";
77
import "../common/EssentialContract.sol";
8+
import "../common/LibConstStrings.sol";
89

910
/// @title TaikoToken
1011
/// @notice The TaikoToken (TKO), in the protocol is used for prover collateral
@@ -52,7 +53,11 @@ contract TaikoToken is EssentialContract, ERC20SnapshotUpgradeable, ERC20VotesUp
5253
}
5354

5455
/// @notice Creates a new token snapshot.
55-
function snapshot() public onlyFromOwnerOrNamed("snapshooter") returns (uint256) {
56+
function snapshot()
57+
public
58+
onlyFromOwnerOrNamed(LibConstStrings.BYTES32_SNAPSHOOTER)
59+
returns (uint256)
60+
{
5661
return _snapshot();
5762
}
5863

packages/protocol/contracts/L1/hooks/AssignmentHook.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
55
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
66
import "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
77
import "../../common/EssentialContract.sol";
8+
import "../../common/LibConstStrings.sol";
89
import "../../libs/LibAddress.sol";
9-
import "../libs/LibConstStrings.sol";
1010
import "../ITaikoL1.sol";
1111
import "./IHook.sol";
1212

@@ -71,7 +71,7 @@ contract AssignmentHook is EssentialContract, IHook {
7171
)
7272
external
7373
payable
74-
onlyFromNamed("taiko")
74+
onlyFromNamed(LibConstStrings.BYTES32_TAIKO)
7575
nonReentrant
7676
{
7777
// Note that
@@ -106,7 +106,7 @@ contract AssignmentHook is EssentialContract, IHook {
106106
}
107107

108108
// Send the liveness bond to the Taiko contract
109-
IERC20 tko = IERC20(resolve(LibConstStrings.BYTES32_STR_TKO, false));
109+
IERC20 tko = IERC20(resolve(LibConstStrings.BYTES32_TAIKO_TOKEN, false));
110110

111111
// Note that we don't have to worry about
112112
// https://github.com/crytic/slither/wiki/Detector-Documentation#arbitrary-from-in-transferfrom
@@ -176,7 +176,7 @@ contract AssignmentHook is EssentialContract, IHook {
176176

177177
return keccak256(
178178
abi.encodePacked(
179-
LibConstStrings.BYTES32_STR_PROVER_ASSIGNMENT,
179+
LibConstStrings.BYTES32_PROVER_ASSIGNMENT,
180180
ITaikoL1(_taikoL1Address).getConfig().chainId,
181181
_taikoL1Address,
182182
_blockProposer,

packages/protocol/contracts/L1/libs/LibConstStrings.sol

Lines changed: 0 additions & 26 deletions
This file was deleted.

packages/protocol/contracts/L1/libs/LibProposing.sol

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,18 @@ pragma solidity 0.8.24;
44
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
55
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
66
import "../../common/IAddressResolver.sol";
7+
import "../../common/LibConstStrings.sol";
78
import "../../libs/LibAddress.sol";
89
import "../../libs/LibNetwork.sol";
910
import "../hooks/IHook.sol";
1011
import "../tiers/ITierProvider.sol";
11-
import "./LibConstStrings.sol";
1212

1313
/// @title LibProposing
1414
/// @notice A library for handling block proposals in the Taiko protocol.
1515
/// @custom:security-contact [email protected]
1616
library LibProposing {
1717
using LibAddress for address;
1818

19-
/// @notice Leaving this here to not forget about that this is a removed feature
2019
// = keccak256(abi.encode(new TaikoData.EthDeposit[](0)))
2120
bytes32 private constant _EMPTY_ETH_DEPOSIT_HASH =
2221
0x569e75fc77c1a856f6daaf9e69d8a9566ca34aa47f9133711ce065a571af0cfd;
@@ -157,7 +156,7 @@ library LibProposing {
157156

158157
// Use the difficulty as a random number
159158
meta_.minTier = ITierProvider(
160-
_resolver.resolve(LibConstStrings.BYTES32_STR_TIER_PROVIDER, false)
159+
_resolver.resolve(LibConstStrings.BYTES32_TIER_PROVIDER, false)
161160
).getMinTier(uint256(meta_.difficulty));
162161

163162
// Create the block that will be stored onchain
@@ -186,7 +185,7 @@ library LibProposing {
186185
}
187186

188187
{
189-
IERC20 tko = IERC20(_resolver.resolve(LibConstStrings.BYTES32_STR_TKO, false));
188+
IERC20 tko = IERC20(_resolver.resolve(LibConstStrings.BYTES32_TAIKO_TOKEN, false));
190189
uint256 tkoBalance = tko.balanceOf(address(this));
191190

192191
// Run all hooks.
@@ -242,13 +241,13 @@ library LibProposing {
242241
{
243242
if (_slotB.numBlocks == 1) {
244243
// Only proposer_one can propose the first block after genesis
245-
address proposerOne = _resolver.resolve("proposer_one", true);
244+
address proposerOne = _resolver.resolve(LibConstStrings.BYTES32_PROPOSER_ONE, true);
246245
if (proposerOne != address(0)) {
247246
return msg.sender == proposerOne;
248247
}
249248
}
250249

251-
address proposer = _resolver.resolve(LibConstStrings.BYTES32_STR_PROPOSER, true);
250+
address proposer = _resolver.resolve(LibConstStrings.BYTES32_PROPOSER, true);
252251
return proposer == address(0) || msg.sender == proposer;
253252
}
254253
}

packages/protocol/contracts/L1/libs/LibProving.sol

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ pragma solidity 0.8.24;
44
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
55
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
66
import "../../common/IAddressResolver.sol";
7+
import "../../common/LibConstStrings.sol";
78
import "../../verifiers/IVerifier.sol";
89
import "../tiers/ITierProvider.sol";
9-
import "./LibConstStrings.sol";
1010
import "./LibUtils.sol";
1111

1212
/// @title LibProving
@@ -154,9 +154,8 @@ library LibProving {
154154

155155
// Retrieve the tier configurations. If the tier is not supported, the
156156
// subsequent action will result in a revert.
157-
local.tier = ITierProvider(
158-
_resolver.resolve(LibConstStrings.BYTES32_STR_TIER_PROVIDER, false)
159-
).getTier(_proof.tier);
157+
local.tier = ITierProvider(_resolver.resolve(LibConstStrings.BYTES32_TIER_PROVIDER, false))
158+
.getTier(_proof.tier);
160159

161160
local.inProvingWindow =
162161
!LibUtils.isPostDeadline(ts.timestamp, local.b.lastUnpausedAt, local.tier.provingWindow);
@@ -202,7 +201,7 @@ library LibProving {
202201
});
203202

204203
IVerifier(verifier).verifyProof(ctx, _tran, _proof);
205-
} else if (local.tier.verifierName != LibConstStrings.BYTES32_STR_TIER_OP) {
204+
} else if (local.tier.verifierName != LibConstStrings.BYTES32_TIER_OP) {
206205
// The verifier can be address-zero, signifying that there are no
207206
// proof checks for the tier. In practice, this only applies to
208207
// optimistic proofs.
@@ -211,7 +210,7 @@ library LibProving {
211210
}
212211

213212
local.isTopTier = local.tier.contestBond == 0;
214-
IERC20 tko = IERC20(_resolver.resolve(LibConstStrings.BYTES32_STR_TKO, false));
213+
IERC20 tko = IERC20(_resolver.resolve(LibConstStrings.BYTES32_TAIKO_TOKEN, false));
215214

216215
local.livenessBond = blk.livenessBond;
217216
if (local.isTopTier) {
@@ -220,7 +219,7 @@ library LibProving {
220219
local.inProvingWindow
221220
|| (
222221
_proof.data.length == 32
223-
&& bytes32(_proof.data) == LibConstStrings.HASH_STR_RETURN_LIVENESS_BOND
222+
&& bytes32(_proof.data) == LibConstStrings.HASH_RETURN_LIVENESS_BOND
224223
)
225224
) {
226225
tko.safeTransfer(local.assignedProver, local.livenessBond);

packages/protocol/contracts/L1/libs/LibVerifying.sol

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ pragma solidity 0.8.24;
44
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
55
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
66
import "../../common/IAddressResolver.sol";
7+
import "../../common/LibConstStrings.sol";
78
import "../../signal/ISignalService.sol";
8-
import "../../signal/LibSignals.sol";
99
import "../tiers/ITierProvider.sol";
10-
import "./LibConstStrings.sol";
1110
import "./LibUtils.sol";
1211

1312
/// @title LibVerifying
@@ -120,7 +119,7 @@ library LibVerifying {
120119
uint64 numBlocksVerified;
121120
address tierProvider;
122121

123-
IERC20 tko = IERC20(_resolver.resolve(LibConstStrings.BYTES32_STR_TKO, false));
122+
IERC20 tko = IERC20(_resolver.resolve(LibConstStrings.BYTES32_TAIKO_TOKEN, false));
124123

125124
// Unchecked is safe:
126125
// - assignment is within ranges
@@ -152,7 +151,7 @@ library LibVerifying {
152151
} else {
153152
if (tierProvider == address(0)) {
154153
tierProvider =
155-
_resolver.resolve(LibConstStrings.BYTES32_STR_TIER_PROVIDER, false);
154+
_resolver.resolve(LibConstStrings.BYTES32_TIER_PROVIDER, false);
156155
}
157156

158157
if (
@@ -222,18 +221,19 @@ library LibVerifying {
222221
)
223222
private
224223
{
225-
ISignalService signalService = ISignalService(_resolver.resolve("signal_service", false));
224+
ISignalService signalService =
225+
ISignalService(_resolver.resolve(LibConstStrings.BYTES32_SIGNAL_SERVICE, false));
226226

227227
(uint64 lastSyncedBlock,) = signalService.getSyncedChainData(
228-
_config.chainId, LibSignals.HASH_STR_STATE_ROOT, 0 /* latest block Id*/
228+
_config.chainId, LibConstStrings.HASH_STATE_ROOT, 0 /* latest block Id*/
229229
);
230230

231231
if (_lastVerifiedBlockId > lastSyncedBlock + _config.blockSyncThreshold) {
232232
_state.slotA.lastSyncedBlockId = _lastVerifiedBlockId;
233233
_state.slotA.lastSynecdAt = uint64(block.timestamp);
234234

235235
signalService.syncChainData(
236-
_config.chainId, LibSignals.HASH_STR_STATE_ROOT, _lastVerifiedBlockId, _stateRoot
236+
_config.chainId, LibConstStrings.HASH_STATE_ROOT, _lastVerifiedBlockId, _stateRoot
237237
);
238238
}
239239
}

packages/protocol/contracts/L1/provers/GuardianProver.sol

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pragma solidity 0.8.24;
44
import "../tiers/ITierProvider.sol";
55
import "../ITaikoL1.sol";
66
import "./Guardians.sol";
7+
import "../../common/LibConstStrings.sol";
78

89
/// @title GuardianProver
910
/// @custom:security-contact [email protected]
@@ -57,7 +58,9 @@ contract GuardianProver is Guardians {
5758

5859
if (approved_) {
5960
deleteApproval(hash);
60-
ITaikoL1(resolve("taiko", false)).proveBlock(_meta.id, abi.encode(_meta, _tran, _proof));
61+
ITaikoL1(resolve(LibConstStrings.BYTES32_TAIKO, false)).proveBlock(
62+
_meta.id, abi.encode(_meta, _tran, _proof)
63+
);
6164
}
6265
}
6366
}

packages/protocol/contracts/L2/DelegateOwner.sol

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
pragma solidity 0.8.24;
33

44
import "../common/EssentialContract.sol";
5+
import "../common/LibConstStrings.sol";
56
import "../bridge/IBridge.sol";
67

78
/// @title DelegateOwner
@@ -64,7 +65,11 @@ contract DelegateOwner is EssentialContract, IMessageInvocable {
6465
/// @inheritdoc IMessageInvocable
6566
/// @dev Do not guard with nonReentrant as this function may re-enter the contract as _data
6667
/// represents calls to address(this).
67-
function onMessageInvocation(bytes calldata _data) external payable onlyFromNamed("bridge") {
68+
function onMessageInvocation(bytes calldata _data)
69+
external
70+
payable
71+
onlyFromNamed(LibConstStrings.BYTES32_BRIDGE)
72+
{
6873
(uint64 txId, address target, bytes memory txdata) =
6974
abi.decode(_data, (uint64, address, bytes));
7075

packages/protocol/contracts/L2/TaikoL2.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
55
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
66

77
import "../common/EssentialContract.sol";
8+
import "../common/LibConstStrings.sol";
89
import "../libs/LibAddress.sol";
910
import "../signal/ISignalService.sol";
10-
import "../signal/LibSignals.sol";
1111
import "./Lib1559Math.sol";
1212
import "./LibL2Config.sol";
1313

@@ -152,8 +152,8 @@ contract TaikoL2 is EssentialContract {
152152
if (_l1BlockId > lastSyncedBlock) {
153153
// Store the L1's state root as a signal to the local signal service to
154154
// allow for multi-hop bridging.
155-
ISignalService(resolve("signal_service", false)).syncChainData(
156-
l1ChainId, LibSignals.HASH_STR_STATE_ROOT, _l1BlockId, _l1StateRoot
155+
ISignalService(resolve(LibConstStrings.BYTES32_SIGNAL_SERVICE, false)).syncChainData(
156+
l1ChainId, LibConstStrings.HASH_STATE_ROOT, _l1BlockId, _l1StateRoot
157157
);
158158

159159
lastSyncedBlock = _l1BlockId;
@@ -180,7 +180,7 @@ contract TaikoL2 is EssentialContract {
180180
)
181181
external
182182
whenNotPaused
183-
onlyFromOwnerOrNamed("withdrawer")
183+
onlyFromOwnerOrNamed(LibConstStrings.BYTES32_WITHDRAWER)
184184
nonReentrant
185185
{
186186
if (_to == address(0)) revert L2_INVALID_PARAM();

0 commit comments

Comments
 (0)