Skip to content

Commit 8fc858b

Browse files
authored
[Protocol3] Replace uint256 with uint for consistency (no logic change) (#307)
1 parent 5c36b12 commit 8fc858b

29 files changed

+297
-283
lines changed

packages/loopring_v1/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"devDependencies": {
2727
"@types/bignumber.js": "^4.0.3",
2828
"@types/bluebird": "^3.5.20",
29-
"@types/lodash": "^4.17.14",
29+
"@types/lodash": "^4.14.136",
3030
"@types/node": "9.3.0",
3131
"@types/request-promise-native": "^1.0.14",
3232
"ajv": "^6.0.0",

packages/loopring_v2/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"devDependencies": {
3030
"@types/bignumber.js": "^4.0.3",
3131
"@types/bluebird": "3.5.24",
32-
"@types/lodash": "^4.17.14",
32+
"@types/lodash": "^4.14.136",
3333
"@types/node": "9.3.0",
3434
"@types/request-promise-native": "^1.0.14",
3535
"ajv": "^6.0.0",

packages/loopring_v3/contracts/iface/IBlockVerifier.sol

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ contract IBlockVerifier
5050
/// @param blockVersion The block version (i.e. which circuit version needs to be used)
5151
/// @param vk The verification key
5252
function registerCircuit(
53-
uint8 blockType,
54-
bool onchainDataAvailability,
55-
uint16 blockSize,
56-
uint8 blockVersion,
57-
uint256[18] calldata vk
53+
uint8 blockType,
54+
bool onchainDataAvailability,
55+
uint16 blockSize,
56+
uint8 blockVersion,
57+
uint[18] calldata vk
5858
)
5959
external;
6060

@@ -86,12 +86,12 @@ contract IBlockVerifier
8686
/// @param proofs The ZK proofs proving that the blocks are correct
8787
/// @return True if the block is valid, false otherwise
8888
function verifyProofs(
89-
uint8 blockType,
90-
bool onchainDataAvailability,
91-
uint16 blockSize,
92-
uint8 blockVersion,
93-
uint256[] calldata publicInputs,
94-
uint256[] calldata proofs
89+
uint8 blockType,
90+
bool onchainDataAvailability,
91+
uint16 blockSize,
92+
uint8 blockVersion,
93+
uint[] calldata publicInputs,
94+
uint[] calldata proofs
9595
)
9696
external
9797
view

packages/loopring_v3/contracts/iface/IExchange.sol

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -233,16 +233,16 @@ contract IExchange
233233
/// 1st element of the array.
234234
/// @return True if the given information is stored in the merkle tree, false otherwise
235235
function isAccountBalanceCorrect(
236-
uint256 merkleRoot,
237-
uint24 accountID,
238-
uint16 tokenID,
239-
uint256 pubKeyX,
240-
uint256 pubKeyY,
241-
uint32 nonce,
242-
uint96 balance,
243-
uint256 tradeHistoryRoot,
244-
uint256[30] calldata accountMerkleProof,
245-
uint256[12] calldata balanceMerkleProof
236+
uint merkleRoot,
237+
uint24 accountID,
238+
uint16 tokenID,
239+
uint pubKeyX,
240+
uint pubKeyY,
241+
uint32 nonce,
242+
uint96 balance,
243+
uint tradeHistoryRoot,
244+
uint[30] calldata accountMerkleProof,
245+
uint[12] calldata balanceMerkleProof
246246
)
247247
external
248248
pure
@@ -526,8 +526,8 @@ contract IExchange
526526
/// @param blockIndices The 0-based index of the blocks to be verified with the given proofs
527527
/// @param proofs The ZK proof for all blockIndices (proofs.length % 8 == 0).
528528
function verifyBlocks(
529-
uint[] calldata blockIndices,
530-
uint256[] calldata proofs
529+
uint[] calldata blockIndices,
530+
uint[] calldata proofs
531531
)
532532
external;
533533

@@ -580,7 +580,7 @@ contract IExchange
580580
view
581581
returns (
582582
bytes32 accumulatedHash,
583-
uint256 accumulatedFee,
583+
uint accumulatedFee,
584584
uint32 timestamp
585585
);
586586

@@ -699,7 +699,7 @@ contract IExchange
699699
view
700700
returns (
701701
bytes32 accumulatedHash,
702-
uint256 accumulatedFee,
702+
uint accumulatedFee,
703703
uint32 timestamp
704704
);
705705

@@ -768,14 +768,14 @@ contract IExchange
768768
/// token for the account. The deepest hash in the tree is the
769769
/// 1st element of the array.
770770
function withdrawFromMerkleTree(
771-
address token,
772-
uint pubKeyX,
773-
uint pubKeyY,
774-
uint32 nonce,
775-
uint96 balance,
776-
uint256 tradeHistoryRoot,
777-
uint256[30] calldata accountMerkleProof,
778-
uint256[12] calldata balanceMerkleProof
771+
address token,
772+
uint pubKeyX,
773+
uint pubKeyY,
774+
uint32 nonce,
775+
uint96 balance,
776+
uint tradeHistoryRoot,
777+
uint[30] calldata accountMerkleProof,
778+
uint[12] calldata balanceMerkleProof
779779
)
780780
external;
781781

@@ -802,15 +802,15 @@ contract IExchange
802802
/// token for the account. The deepest hash in the tree is the
803803
/// 1st element of the array.
804804
function withdrawFromMerkleTreeFor(
805-
address owner,
806-
address token,
807-
uint pubKeyX,
808-
uint pubKeyY,
809-
uint32 nonce,
810-
uint96 balance,
811-
uint256 tradeHistoryRoot,
812-
uint256[30] calldata accountMerkleProof,
813-
uint256[12] calldata balanceMerkleProof
805+
address owner,
806+
address token,
807+
uint pubKeyX,
808+
uint pubKeyY,
809+
uint32 nonce,
810+
uint96 balance,
811+
uint tradeHistoryRoot,
812+
uint[30] calldata accountMerkleProof,
813+
uint[12] calldata balanceMerkleProof
814814
)
815815
external;
816816

@@ -868,7 +868,7 @@ contract IExchange
868868
/// @param feeRecipient The address that receives the block fee
869869
/// @return feeAmount The amount of ETH earned in the block and sent to the operator
870870
function withdrawBlockFee(
871-
uint blockIdx,
871+
uint blockIdx,
872872
address payable feeRecipient
873873
)
874874
external

packages/loopring_v3/contracts/iface/ILoopringV3.sol

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,9 @@ contract ILoopringV3
216216
/// @param requestedAmount The amount of LRC to withdraw
217217
/// @return stakedLRC The amount of LRC withdrawn
218218
function withdrawExchangeStake(
219-
uint exchangeId,
219+
uint exchangeId,
220220
address recipient,
221-
uint requestedAmount
221+
uint requestedAmount
222222
)
223223
public
224224
returns (uint amount);
@@ -240,9 +240,9 @@ contract ILoopringV3
240240
/// @param recipient The address to receive LRC
241241
/// @param amount The amount of LRC to withdraw
242242
function withdrawProtocolFeeStake(
243-
uint exchangeId,
243+
uint exchangeId,
244244
address recipient,
245-
uint amount
245+
uint amount
246246
)
247247
external;
248248

@@ -258,7 +258,10 @@ contract ILoopringV3
258258
)
259259
external
260260
view
261-
returns (uint8 takerFeeBips, uint8 makerFeeBips);
261+
returns (
262+
uint8 takerFeeBips,
263+
uint8 makerFeeBips
264+
);
262265

263266
/// @dev Allow ETH to be sent directly to this contract (to collect the protocol fees)
264267
function()

packages/loopring_v3/contracts/impl/BlockVerifier.sol

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@ contract BlockVerifier is IBlockVerifier, Claimable
3434
{
3535
bool registered;
3636
bool enabled;
37-
uint256[18] verificationKey;
37+
uint[18] verificationKey;
3838
}
3939

4040
mapping (bool => mapping (uint8 => mapping (uint16 => mapping (uint8 => Circuit)))) public circuits;
4141

4242
function registerCircuit(
43-
uint8 blockType,
44-
bool onchainDataAvailability,
45-
uint16 blockSize,
46-
uint8 blockVersion,
47-
uint256[18] calldata vk
43+
uint8 blockType,
44+
bool onchainDataAvailability,
45+
uint16 blockSize,
46+
uint8 blockVersion,
47+
uint[18] calldata vk
4848
)
4949
external
5050
onlyOwner
@@ -62,7 +62,7 @@ contract BlockVerifier is IBlockVerifier, Claimable
6262

6363
emit CircuitRegistered(
6464
blockType,
65-
onchainDataAvailability,
65+
onchainDataAvailability,
6666
blockSize,
6767
blockVersion
6868
);
@@ -92,12 +92,12 @@ contract BlockVerifier is IBlockVerifier, Claimable
9292
}
9393

9494
function verifyProofs(
95-
uint8 blockType,
96-
bool onchainDataAvailability,
97-
uint16 blockSize,
98-
uint8 blockVersion,
99-
uint256[] calldata publicInputs,
100-
uint256[] calldata proofs
95+
uint8 blockType,
96+
bool onchainDataAvailability,
97+
uint16 blockSize,
98+
uint8 blockVersion,
99+
uint[] calldata publicInputs,
100+
uint[] calldata proofs
101101
)
102102
external
103103
view
@@ -107,12 +107,12 @@ contract BlockVerifier is IBlockVerifier, Claimable
107107
Circuit storage circuit = circuits[dataAvailability][blockType][blockSize][blockVersion];
108108
require(circuit.registered == true, "NOT_REGISTERED");
109109

110-
uint256[18] storage vk = circuit.verificationKey;
111-
uint256[14] memory _vk = [
110+
uint[18] storage vk = circuit.verificationKey;
111+
uint[14] memory _vk = [
112112
vk[0], vk[1], vk[2], vk[3], vk[4], vk[5], vk[6],
113113
vk[7], vk[8], vk[9], vk[10], vk[11], vk[12], vk[13]
114114
];
115-
uint256[4] memory _vk_gammaABC = [vk[14], vk[15], vk[16], vk[17]];
115+
uint[4] memory _vk_gammaABC = [vk[14], vk[15], vk[16], vk[17]];
116116

117117
if (publicInputs.length == 1) {
118118
return Verifier.Verify(_vk, _vk_gammaABC, proofs, publicInputs);
@@ -157,7 +157,7 @@ contract BlockVerifier is IBlockVerifier, Claimable
157157

158158
function needsDataAvailability(
159159
uint8 blockType,
160-
bool onchainDataAvailability
160+
bool onchainDataAvailability
161161
)
162162
internal
163163
pure

0 commit comments

Comments
 (0)