Skip to content

Commit bf98ded

Browse files
pxrlmrice32
andauthored
fix: [N-01] Constants not using UPPER_CASE format (#322)
* fix: [N-01] Constants not using UPPER_CASE format * remove refund address change Signed-off-by: Matt Rice <matthewcrice32@gmail.com> --------- Signed-off-by: Matt Rice <matthewcrice32@gmail.com> Co-authored-by: Matt Rice <matthewcrice32@gmail.com>
1 parent 071219f commit bf98ded

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

contracts/chain-adapters/ZkSync_Adapter.sol

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ contract ZkSync_Adapter is AdapterInterface {
7272
// goes live. For now, we'll hardcode these and use aggressive values to ensure inclusion.
7373

7474
// Limit on L2 gas to spend.
75-
uint256 public constant l2GasLimit = 300_000;
75+
uint256 public constant L2_GAS_LIMIT = 300_000;
7676

7777
// How much gas is required to publish a byte of data from L1 to L2. 800 is the required value
7878
// as set here https://github.com/matter-labs/era-contracts/blob/6391c0d7bf6184d7f6718060e3991ba6f0efe4a7/ethereum/contracts/zksync/facets/Mailbox.sol#L226
7979
// Note, this value can change and will require an updated adapter.
80-
uint256 public constant l1GasToL2GasPerPubDataLimit = 800;
80+
uint256 public constant L1_GAS_TO_L2_GAS_PER_PUB_DATA_LIMIT = 800;
8181

8282
// This address receives any remaining fee after an L1 to L2 transaction completes.
83-
// If refund recipient = address(0) then L2 msg.sender is used, unelss msg.sender is a contract then its address
83+
// If refund recipient = address(0) then L2 msg.sender is used, unless msg.sender is a contract then its address
8484
// gets aliased.
8585
address public constant l2RefundAddress = 0x428AB2BA90Eba0a4Be7aF34C9Ac451ab061AC010;
8686

@@ -122,8 +122,8 @@ contract ZkSync_Adapter is AdapterInterface {
122122
// We pass no ETH with the call, otherwise we'd need to add to the txBaseCost this value.
123123
0,
124124
message,
125-
l2GasLimit,
126-
l1GasToL2GasPerPubDataLimit,
125+
L2_GAS_LIMIT,
126+
L1_GAS_TO_L2_GAS_PER_PUB_DATA_LIMIT,
127127
new bytes[](0),
128128
l2RefundAddress
129129
);
@@ -168,8 +168,8 @@ contract ZkSync_Adapter is AdapterInterface {
168168
to,
169169
amount,
170170
"",
171-
l2GasLimit,
172-
l1GasToL2GasPerPubDataLimit,
171+
L2_GAS_LIMIT,
172+
L1_GAS_TO_L2_GAS_PER_PUB_DATA_LIMIT,
173173
new bytes[](0),
174174
l2RefundAddress
175175
);
@@ -179,8 +179,8 @@ contract ZkSync_Adapter is AdapterInterface {
179179
to,
180180
l1Token,
181181
amount,
182-
l2GasLimit,
183-
l1GasToL2GasPerPubDataLimit,
182+
L2_GAS_LIMIT,
183+
L1_GAS_TO_L2_GAS_PER_PUB_DATA_LIMIT,
184184
l2RefundAddress
185185
);
186186
}
@@ -199,7 +199,7 @@ contract ZkSync_Adapter is AdapterInterface {
199199
// https://github.com/matter-labs/era-contracts/blob/6391c0d7bf6184d7f6718060e3991ba6f0efe4a7/ethereum/contracts/zksync/facets/Mailbox.sol#L273
200200
// - priority_fee_per_gas = min(transaction.max_priority_fee_per_gas, transaction.max_fee_per_gas - block.base_fee_per_gas)
201201
// - effective_gas_price = priority_fee_per_gas + block.base_fee_per_gas
202-
return zkSync.l2TransactionBaseCost(tx.gasprice, l2GasLimit, l1GasToL2GasPerPubDataLimit);
202+
return zkSync.l2TransactionBaseCost(tx.gasprice, L2_GAS_LIMIT, L1_GAS_TO_L2_GAS_PER_PUB_DATA_LIMIT);
203203
}
204204

205205
function _contractHasSufficientEthBalance() internal view returns (uint256 requiredL1CallValue) {

test/chain-adapters/ZkSync_Adapter.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ describe("ZkSync Chain Adapter", function () {
113113
mockSpoke.address,
114114
0,
115115
functionCallData,
116-
await zkSyncAdapter.l2GasLimit(),
117-
await zkSyncAdapter.l1GasToL2GasPerPubDataLimit(),
116+
await zkSyncAdapter.L2_GAS_LIMIT(),
117+
await zkSyncAdapter.L1_GAS_TO_L2_GAS_PER_PUB_DATA_LIMIT(),
118118
[],
119119
await zkSyncAdapter.l2RefundAddress()
120120
);
@@ -133,8 +133,8 @@ describe("ZkSync Chain Adapter", function () {
133133
mockSpoke.address,
134134
dai.address,
135135
tokensSendToL2,
136-
await zkSyncAdapter.l2GasLimit(),
137-
await zkSyncAdapter.l1GasToL2GasPerPubDataLimit(),
136+
await zkSyncAdapter.L2_GAS_LIMIT(),
137+
await zkSyncAdapter.L1_GAS_TO_L2_GAS_PER_PUB_DATA_LIMIT(),
138138
await zkSyncAdapter.l2RefundAddress(),
139139
];
140140
expect(zkSyncErc20Bridge.deposit).to.have.been.calledWith(...expectedErc20L1ToL2BridgeParams);
@@ -156,8 +156,8 @@ describe("ZkSync Chain Adapter", function () {
156156
mockSpoke.address,
157157
leaves[0].netSendAmounts[0].toString(),
158158
"0x",
159-
await zkSyncAdapter.l2GasLimit(),
160-
await zkSyncAdapter.l1GasToL2GasPerPubDataLimit(),
159+
await zkSyncAdapter.L2_GAS_LIMIT(),
160+
await zkSyncAdapter.L1_GAS_TO_L2_GAS_PER_PUB_DATA_LIMIT(),
161161
[],
162162
await zkSyncAdapter.l2RefundAddress()
163163
);

0 commit comments

Comments
 (0)