chore: sync submodule state (parent ref update)
Made-with: Cursor
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {Test, console} from "forge-std/Test.sol";
|
||||
import {Test} from "forge-std/Test.sol";
|
||||
import {BridgeEscrowVault} from "../../../contracts/bridge/interop/BridgeEscrowVault.sol";
|
||||
import {BridgeRegistry} from "../../../contracts/bridge/interop/BridgeRegistry.sol";
|
||||
import {wXRP} from "../../../contracts/bridge/interop/wXRP.sol";
|
||||
@@ -19,11 +19,17 @@ contract BridgeIntegrationTest is Test {
|
||||
address public operator = address(0x2);
|
||||
address public user = address(0x5);
|
||||
address public hsmSigner = address(0x4);
|
||||
address public attestor1 = address(0x10);
|
||||
address public attestor2 = address(0x11);
|
||||
address public attestor3 = address(0x12);
|
||||
uint256 public attestor1Pk = 0x10;
|
||||
uint256 public attestor2Pk = 0x11;
|
||||
uint256 public attestor3Pk = 0x12;
|
||||
address public attestor1;
|
||||
address public attestor2;
|
||||
address public attestor3;
|
||||
|
||||
function setUp() public {
|
||||
attestor1 = vm.addr(attestor1Pk);
|
||||
attestor2 = vm.addr(attestor2Pk);
|
||||
attestor3 = vm.addr(attestor3Pk);
|
||||
vm.startPrank(admin);
|
||||
|
||||
// Deploy registry
|
||||
@@ -130,15 +136,17 @@ contract BridgeIntegrationTest is Test {
|
||||
bytes32 transferId = keccak256("test-attestation");
|
||||
bytes32 proofHash = keccak256("proof-data");
|
||||
|
||||
uint256 deadline = block.timestamp + 3600;
|
||||
|
||||
// Attestor 1 submits attestation
|
||||
vm.startPrank(attestor1);
|
||||
bytes memory sig1 = _signAttestation(attestor1, transferId, proofHash);
|
||||
bytes memory sig1 = _signAttestation(attestor1Pk, transferId, proofHash, 1, deadline);
|
||||
verifier.submitAttestation(
|
||||
BridgeVerifier.Attestation({
|
||||
transferId: transferId,
|
||||
proofHash: proofHash,
|
||||
nonce: 1,
|
||||
deadline: block.timestamp + 3600,
|
||||
deadline: deadline,
|
||||
signature: sig1
|
||||
})
|
||||
);
|
||||
@@ -146,13 +154,13 @@ contract BridgeIntegrationTest is Test {
|
||||
|
||||
// Attestor 2 submits attestation
|
||||
vm.startPrank(attestor2);
|
||||
bytes memory sig2 = _signAttestation(attestor2, transferId, proofHash);
|
||||
bytes memory sig2 = _signAttestation(attestor2Pk, transferId, proofHash, 2, deadline);
|
||||
verifier.submitAttestation(
|
||||
BridgeVerifier.Attestation({
|
||||
transferId: transferId,
|
||||
proofHash: proofHash,
|
||||
nonce: 2,
|
||||
deadline: block.timestamp + 3600,
|
||||
deadline: deadline,
|
||||
signature: sig2
|
||||
})
|
||||
);
|
||||
@@ -165,12 +173,23 @@ contract BridgeIntegrationTest is Test {
|
||||
}
|
||||
|
||||
function _signAttestation(
|
||||
address signer,
|
||||
uint256 signerPk,
|
||||
bytes32 transferId,
|
||||
bytes32 proofHash
|
||||
bytes32 proofHash,
|
||||
uint256 nonce,
|
||||
uint256 deadline
|
||||
) internal view returns (bytes memory) {
|
||||
bytes32 hash = keccak256(abi.encodePacked(transferId, proofHash, block.timestamp));
|
||||
(uint8 v, bytes32 r, bytes32 s) = vm.sign(uint256(uint160(signer)), hash);
|
||||
bytes32 typeHash = keccak256("Attestation(bytes32 transferId,bytes32 proofHash,uint256 nonce,uint256 deadline)");
|
||||
bytes32 structHash = keccak256(abi.encode(typeHash, transferId, proofHash, nonce, deadline));
|
||||
bytes32 domainSeparator = keccak256(abi.encode(
|
||||
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
|
||||
keccak256(bytes("BridgeVerifier")),
|
||||
keccak256(bytes("1")),
|
||||
block.chainid,
|
||||
address(verifier)
|
||||
));
|
||||
bytes32 hash = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
|
||||
(uint8 v, bytes32 r, bytes32 s) = vm.sign(signerPk, hash);
|
||||
return abi.encodePacked(r, s, v);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user