Skip to content

Commit f0332f8

Browse files
Mikellemrekucci
authored andcommitted
chore: moved from uint64 to uint256 (#157)
* chore: moved from uint64 to uint256 * chore: fixed tests for the oracle
1 parent 64bc907 commit f0332f8

18 files changed

Lines changed: 199 additions & 185 deletions

File tree

contracts-abi/abi/BidderRegistry.abi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
},
3131
{
3232
"name": "bidAmt",
33-
"type": "uint64",
34-
"internalType": "uint64"
33+
"type": "uint256",
34+
"internalType": "uint256"
3535
},
3636
{
3737
"name": "state",
@@ -52,8 +52,8 @@
5252
},
5353
{
5454
"name": "bid",
55-
"type": "uint64",
56-
"internalType": "uint64"
55+
"type": "uint256",
56+
"internalType": "uint256"
5757
},
5858
{
5959
"name": "bidder",

contracts-abi/abi/PreConfCommitmentStore.abi

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@
163163
},
164164
{
165165
"name": "bid",
166-
"type": "uint64",
167-
"internalType": "uint64"
166+
"type": "uint256",
167+
"internalType": "uint256"
168168
},
169169
{
170170
"name": "blockNumber",
@@ -288,8 +288,8 @@
288288
},
289289
{
290290
"name": "_bid",
291-
"type": "uint64",
292-
"internalType": "uint64"
291+
"type": "uint256",
292+
"internalType": "uint256"
293293
},
294294
{
295295
"name": "_blockNumber",
@@ -349,8 +349,8 @@
349349
},
350350
{
351351
"name": "bid",
352-
"type": "uint64",
353-
"internalType": "uint64"
352+
"type": "uint256",
353+
"internalType": "uint256"
354354
},
355355
{
356356
"name": "blockNumber",
@@ -433,8 +433,8 @@
433433
},
434434
{
435435
"name": "bid",
436-
"type": "uint64",
437-
"internalType": "uint64"
436+
"type": "uint256",
437+
"internalType": "uint256"
438438
},
439439
{
440440
"name": "blockNumber",
@@ -601,8 +601,8 @@
601601
},
602602
{
603603
"name": "_bid",
604-
"type": "uint64",
605-
"internalType": "uint64"
604+
"type": "uint256",
605+
"internalType": "uint256"
606606
},
607607
{
608608
"name": "_blockNumber",
@@ -766,8 +766,8 @@
766766
},
767767
{
768768
"name": "bid",
769-
"type": "uint64",
770-
"internalType": "uint64"
769+
"type": "uint256",
770+
"internalType": "uint256"
771771
},
772772
{
773773
"name": "blockNumber",
@@ -960,8 +960,8 @@
960960
"inputs": [
961961
{
962962
"name": "bid",
963-
"type": "uint64",
964-
"internalType": "uint64"
963+
"type": "uint256",
964+
"internalType": "uint256"
965965
},
966966
{
967967
"name": "blockNumber",
@@ -1014,8 +1014,8 @@
10141014
},
10151015
{
10161016
"name": "bid",
1017-
"type": "uint64",
1018-
"internalType": "uint64"
1017+
"type": "uint256",
1018+
"internalType": "uint256"
10191019
},
10201020
{
10211021
"name": "blockNumber",
@@ -1091,9 +1091,9 @@
10911091
},
10921092
{
10931093
"name": "bid",
1094-
"type": "uint64",
1094+
"type": "uint256",
10951095
"indexed": false,
1096-
"internalType": "uint64"
1096+
"internalType": "uint256"
10971097
},
10981098
{
10991099
"name": "blockNumber",
@@ -1245,9 +1245,9 @@
12451245
},
12461246
{
12471247
"name": "bid",
1248-
"type": "uint64",
1248+
"type": "uint256",
12491249
"indexed": true,
1250-
"internalType": "uint64"
1250+
"internalType": "uint256"
12511251
},
12521252
{
12531253
"name": "blockNumber",

contracts-abi/clients/BidderRegistry/BidderRegistry.go

Lines changed: 18 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts-abi/clients/PreConfCommitmentStore/PreConfCommitmentStore.go

Lines changed: 80 additions & 80 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/contracts/BidderRegistry.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ contract BidderRegistry is
292292
*/
293293
function OpenBid(
294294
bytes32 commitmentDigest,
295-
uint64 bid,
295+
uint256 bid,
296296
address bidder,
297297
uint64 blockNumber
298298
) external onlyPreConfirmationEngine {

contracts/contracts/PreConfCommitmentStore.sol

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ contract PreConfCommitmentStore is OwnableUpgradeable {
1919
/// @dev EIP-712 Type Hash for preconfirmation commitment
2020
bytes32 public constant EIP712_COMMITMENT_TYPEHASH =
2121
keccak256(
22-
"PreConfCommitment(string txnHash,uint64 bid,uint64 blockNumber,uint64 decayStartTimeStamp,uint64 decayEndTimeStamp,bytes32 bidHash,string signature,string sharedSecretKey)"
22+
"PreConfCommitment(string txnHash,uint256 bid,uint64 blockNumber,uint64 decayStartTimeStamp,uint64 decayEndTimeStamp,bytes32 bidHash,string signature,string sharedSecretKey)"
2323
);
2424

2525
/// @dev EIP-712 Type Hash for preconfirmation bid
2626
bytes32 public constant EIP712_BID_TYPEHASH =
2727
keccak256(
28-
"PreConfBid(string txnHash,uint64 bid,uint64 blockNumber,uint64 decayStartTimeStamp,uint64 decayEndTimeStamp)"
28+
"PreConfBid(string txnHash,uint256 bid,uint64 blockNumber,uint64 decayStartTimeStamp,uint64 decayEndTimeStamp)"
2929
);
3030

3131
// Represents the dispatch window in milliseconds
@@ -69,7 +69,7 @@ contract PreConfCommitmentStore is OwnableUpgradeable {
6969
bool isUsed;
7070
address bidder;
7171
address commiter;
72-
uint64 bid;
72+
uint256 bid;
7373
uint64 blockNumber;
7474
bytes32 bidHash;
7575
uint64 decayStartTimeStamp;
@@ -87,7 +87,7 @@ contract PreConfCommitmentStore is OwnableUpgradeable {
8787
bytes32 indexed commitmentIndex,
8888
address bidder,
8989
address commiter,
90-
uint64 bid,
90+
uint256 bid,
9191
uint64 blockNumber,
9292
bytes32 bidHash,
9393
uint64 decayStartTimeStamp,
@@ -122,7 +122,7 @@ contract PreConfCommitmentStore is OwnableUpgradeable {
122122
event SignatureVerified(
123123
address indexed signer,
124124
string txnHash,
125-
uint64 indexed bid,
125+
uint256 indexed bid,
126126
uint64 blockNumber
127127
);
128128

@@ -216,7 +216,7 @@ contract PreConfCommitmentStore is OwnableUpgradeable {
216216
*/
217217
function getBidHash(
218218
string memory _txnHash,
219-
uint64 _bid,
219+
uint256 _bid,
220220
uint64 _blockNumber,
221221
uint64 _decayStartTimeStamp,
222222
uint64 _decayEndTimeStamp
@@ -247,7 +247,7 @@ contract PreConfCommitmentStore is OwnableUpgradeable {
247247
*/
248248
function getPreConfHash(
249249
string memory _txnHash,
250-
uint64 _bid,
250+
uint256 _bid,
251251
uint64 _blockNumber,
252252
uint64 _decayStartTimeStamp,
253253
uint64 _decayEndTimeStamp,
@@ -286,7 +286,7 @@ contract PreConfCommitmentStore is OwnableUpgradeable {
286286
* @return recoveredAddress the address from the bid hash.
287287
*/
288288
function verifyBid(
289-
uint64 bid,
289+
uint256 bid,
290290
uint64 blockNumber,
291291
uint64 decayStartTimeStamp,
292292
uint64 decayEndTimeStamp,
@@ -316,7 +316,7 @@ contract PreConfCommitmentStore is OwnableUpgradeable {
316316
*/
317317
function verifyPreConfCommitment(
318318
string memory txnHash,
319-
uint64 bid,
319+
uint256 bid,
320320
uint64 blockNumber,
321321
uint64 decayStartTimeStamp,
322322
uint64 decayEndTimeStamp,
@@ -388,7 +388,7 @@ contract PreConfCommitmentStore is OwnableUpgradeable {
388388
*/
389389
function openCommitment(
390390
bytes32 encryptedCommitmentIndex,
391-
uint64 bid,
391+
uint256 bid,
392392
uint64 blockNumber,
393393
string memory txnHash,
394394
uint64 decayStartTimeStamp,

contracts/contracts/interfaces/IBidderRegistry.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pragma solidity ^0.8.20;
44
interface IBidderRegistry {
55
struct PreConfCommitment {
66
string txnHash;
7-
uint64 bid;
7+
uint256 bid;
88
uint64 blockNumber;
99
string bidHash;
1010
string bidSignature;
@@ -14,7 +14,7 @@ interface IBidderRegistry {
1414

1515
struct BidState {
1616
address bidder;
17-
uint64 bidAmt;
17+
uint256 bidAmt;
1818
State state;
1919
}
2020

@@ -24,7 +24,7 @@ interface IBidderRegistry {
2424
Withdrawn
2525
}
2626

27-
function OpenBid(bytes32 commitmentDigest, uint64 bid, address bidder, uint64 blockNumber) external;
27+
function OpenBid(bytes32 commitmentDigest, uint256 bid, address bidder, uint64 blockNumber) external;
2828

2929
function getDeposit(address bidder, uint256 window) external view returns (uint256);
3030

contracts/contracts/interfaces/IPreConfCommitmentStore.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ interface IPreConfCommitmentStore {
1313
bool isUsed;
1414
address bidder;
1515
address commiter;
16-
uint64 bid;
16+
uint256 bid;
1717
uint64 blockNumber;
1818
bytes32 bidHash;
1919
uint64 decayStartTimeStamp;
@@ -28,15 +28,15 @@ interface IPreConfCommitmentStore {
2828
event SignatureVerified(
2929
address indexed signer,
3030
string txnHash,
31-
uint64 indexed bid,
31+
uint256 indexed bid,
3232
uint64 blockNumber
3333
);
3434

3535
// External functions that need to be implemented
3636

3737
function getBidHash(
3838
string memory _txnHash,
39-
uint64 _bid,
39+
uint256 _bid,
4040
uint64 _blockNumber
4141
) external view returns (bytes32);
4242

contracts/test/PreConfirmationConfTest.sol

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {WindowFromBlockNumber} from "../contracts/utils/WindowFromBlockNumber.so
1414

1515
contract TestPreConfCommitmentStore is Test {
1616
struct TestCommitment {
17-
uint64 bid;
17+
uint256 bid;
1818
uint64 blockNumber;
1919
string txnHash;
2020
uint64 decayStartTimestamp;
@@ -45,10 +45,10 @@ contract TestPreConfCommitmentStore is Test {
4545
"0xkartik",
4646
10,
4747
20,
48-
0xa0327970258c49b922969af74d60299a648c50f69a2d98d6ab43f32f64ac2100,
49-
0x65618f8f9e46b8f0790c621ca2989cfe4c949594a4a3a81261baa682e8883840,
50-
hex"876c1216c232828be9fabb14981c8788cebdf6ed66e563c4a2ccc82a577d052543207aeeb158a32d8977736797ae250c63ef69a82cd85b727da21e20d030fb311b",
51-
hex"bfea9167927707ae7586ed3bba8565999f8b7ad874b2dd4f175caf81084c0d0a17f9599daf5b3f2773757408aa4b44875c95df0f4150cfb295f95273e1fefdd01b",
48+
0x56c06a13be335eba981b780ea45dff258a7c429d0e9d993235ef2d3a7e435df8,
49+
0x9d954942ad3f6cb41ccd029869be7b28036270b4754665a3783c2d6bf0ef7d08,
50+
hex"2e7df27808c72d7d5b2543bb63b06c0ae2144e021593b8d2a7cca6a3fb2d9c4b1a82dd2a07266de9364d255bdb709476ad96b826ec855efb528eaff66682997e1c",
51+
hex"682a1bc8659a0d2616f579ca0e0944d4e21911e65561b7d9ae7dba36c5a5b699248f1c93e8e6f52492ee6c3cb0f34f20f5a97fb2653c5a67200e1de9254389e11c",
5252
15,
5353
bytes("0xsecret")
5454
);
@@ -264,8 +264,8 @@ contract TestPreConfCommitmentStore is Test {
264264

265265
(uint8 v, bytes32 r, bytes32 s) = vm.sign(bidderPk, bidHash);
266266
bytes memory signature = abi.encodePacked(r, s, v);
267+
console.logBytes(signature);
267268
bytes memory sharedSecretKey = bytes("0xsecret");
268-
269269
bytes32 preConfHash = preConfCommitmentStore.getPreConfHash(
270270
_testCommitmentAliceBob.txnHash,
271271
_testCommitmentAliceBob.bid,
@@ -367,7 +367,7 @@ contract TestPreConfCommitmentStore is Test {
367367

368368
function verifyCommitmentNotUsed(
369369
string memory txnHash,
370-
uint64 bid,
370+
uint256 bid,
371371
uint64 blockNumber,
372372
uint64 decayStartTimestamp,
373373
uint64 decayEndTimestamp,
@@ -401,7 +401,7 @@ contract TestPreConfCommitmentStore is Test {
401401

402402
function storeCommitment(
403403
address commiter,
404-
uint64 bid,
404+
uint256 bid,
405405
uint64 blockNumber,
406406
string memory txnHash,
407407
uint64 decayStartTimestamp,
@@ -443,7 +443,7 @@ contract TestPreConfCommitmentStore is Test {
443443
function openCommitment(
444444
address msgSender,
445445
bytes32 encryptedCommitmentIndex,
446-
uint64 bid,
446+
uint256 bid,
447447
uint64 blockNumber,
448448
string memory txnHash,
449449
uint64 decayStartTimestamp,
@@ -470,7 +470,7 @@ contract TestPreConfCommitmentStore is Test {
470470

471471
function verifyStoredCommitment(
472472
bytes32 index,
473-
uint64 bid,
473+
uint256 bid,
474474
uint64 blockNumber,
475475
uint64 decayStartTimestamp,
476476
uint64 decayEndTimestamp,

oracle/pkg/apiserver/dashboard.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func (s *Service) configureDashboard() error {
113113
if !ok {
114114
currentAmount = big.NewInt(0)
115115
}
116-
currentAmount = big.NewInt(0).Add(currentAmount, big.NewInt(0).SetUint64(cmt.Amount))
116+
currentAmount = big.NewInt(0).Add(currentAmount, cmt.Amount)
117117
existing.TotalAmount = currentAmount.String()
118118
_ = s.blockStats.Add(uint64(cmt.BlockNum), existing)
119119
},

0 commit comments

Comments
 (0)