Skip to content

Commit

Permalink
feat: update contracts with revert txns
Browse files Browse the repository at this point in the history
  • Loading branch information
ckartik committed Jun 27, 2024
1 parent a0f9440 commit fafa219
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 47 deletions.
11 changes: 6 additions & 5 deletions contracts/contracts/PreConfCommitmentStore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ contract PreConfCommitmentStore is OwnableUpgradeable, UUPSUpgradeable {
uint64 _decayEndTimeStamp,
bytes32 _bidHash,
string memory _bidSignature,
string memory _sharedSecretKey,
string memory _revertingTxHashes
) public view returns (bytes32) {
return
Expand All @@ -279,7 +278,6 @@ contract PreConfCommitmentStore is OwnableUpgradeable, UUPSUpgradeable {
abi.encodePacked(_bytes32ToHexString(_bidHash))
),
keccak256(abi.encodePacked(_bidSignature)),
keccak256(abi.encodePacked(_sharedSecretKey)),
keccak256(abi.encodePacked(_revertingTxHashes))
)
)
Expand Down Expand Up @@ -433,7 +431,8 @@ contract PreConfCommitmentStore is OwnableUpgradeable, UUPSUpgradeable {
decayEndTimeStamp,
bHash,
_bytesToHexString(bidSignature),
_bytesToHexString(sharedSecretKey)
_bytesToHexString(sharedSecretKey),
revertingTxHashes
);
EncrPreConfCommitment
memory encryptedCommitment = encryptedCommitments[
Expand Down Expand Up @@ -476,7 +475,8 @@ contract PreConfCommitmentStore is OwnableUpgradeable, UUPSUpgradeable {
bidSignature,
commitmentSignature,
encryptedCommitment.dispatchTimestamp,
sharedSecretKey
sharedSecretKey,
revertingTxHashes
);

commitmentIndex = getCommitmentIndex(newCommitment);
Expand Down Expand Up @@ -510,7 +510,8 @@ contract PreConfCommitmentStore is OwnableUpgradeable, UUPSUpgradeable {
bidSignature,
commitmentSignature,
encryptedCommitment.dispatchTimestamp,
sharedSecretKey
sharedSecretKey,
revertingTxHashes
);
}

Expand Down
11 changes: 8 additions & 3 deletions contracts/test/OracleTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ contract OracleTest is Test {
string txnHash;
uint64 decayStartTimestamp;
uint64 decayEndTimestamp;
bytes sharedSecretKey;
string revertingTxHashes;
bytes32 bidDigest;
bytes32 commitmentDigest;
bytes bidSignature;
Expand Down Expand Up @@ -432,6 +434,7 @@ contract OracleTest is Test {

function test_process_commitment_reward_multiple() public {
string[] memory txnHashes = new string[](4);
string memory revertingTxHashes = "0x6d9c53ad81249775f8c082b11ac293b2e19194ff791bd1c4fd37683310e90d08";
txnHashes[
0
] = "0x6d9c53ad81249775f8c082b11ac293b2e19194ff791bd1c4fd37683310e90d08";
Expand Down Expand Up @@ -497,7 +500,8 @@ contract OracleTest is Test {
20,
bidSignatures[i],
commitmentSignatures[i],
sharedSecretKey
sharedSecretKey,
revertingTxHashes
);
vm.stopPrank();
}
Expand Down Expand Up @@ -671,7 +675,8 @@ contract OracleTest is Test {
uint64 decayEndTimestamp,
uint256 bidderPk,
uint256 signerPk,
uint64 dispatchTimestamp
uint64 dispatchTimestamp,
string memory revertingTxHashes
)
public
returns (
Expand Down Expand Up @@ -699,7 +704,7 @@ contract OracleTest is Test {
decayEndTimestamp,
bidHash,
_bytesToHexString(bidSignature),
_bytesToHexString(sharedSecretKey)
revertingTxHashes
);

(v, r, s) = vm.sign(signerPk, commitmentHash);
Expand Down
Loading

0 comments on commit fafa219

Please sign in to comment.