Skip to content

Commit

Permalink
remove duplicate smart contract deployment logic
Browse files Browse the repository at this point in the history
  • Loading branch information
najienka committed Jan 22, 2025
1 parent 8c920ce commit 4f6088a
Showing 1 changed file with 1 addition and 38 deletions.
39 changes: 1 addition & 38 deletions test/hardhat/Blocklock.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,51 +213,14 @@ describe("BlocklockSender", function () {
}

it("can request blocklock decryption", async function () {
const blocklock_default_pk = {
x: {
c0: BigInt("0x2691d39ecc380bfa873911a0b848c77556ee948fb8ab649137d3d3e78153f6ca"),
c1: BigInt("0x2863e20a5125b098108a5061b31f405e16a069e9ebff60022f57f4c4fd0237bf"),
},
y: {
c0: BigInt("0x193513dbe180d700b189c529754f650b7b7882122c8a1e242a938d23ea9f765c"),
c1: BigInt("0x11c939ea560caf31f552c9c4879b15865d38ba1dfb0f7a7d2ac46a4f0cae25ba"),
},
};

schemeProvider = await ethers.deployContract("SignatureSchemeAddressProvider", [await owner.getAddress()]);
await schemeProvider.waitForDeployment();

blocklockScheme = await ethers.deployContract("BlocklockSignatureScheme");
await blocklockScheme.waitForDeployment();
await schemeProvider.updateSignatureScheme(SCHEME_ID, await blocklockScheme.getAddress());

sigSender = await ethers.deployContract("SignatureSender", [
[blocklock_default_pk.x.c0, blocklock_default_pk.x.c1],
[blocklock_default_pk.y.c0, blocklock_default_pk.y.c1],
await owner.getAddress(),
await schemeProvider.getAddress(),
]);
await sigSender.waitForDeployment();

decryptionSender = await ethers.deployContract("DecryptionSender", [
[blocklock_default_pk.x.c0, blocklock_default_pk.x.c1],
[blocklock_default_pk.y.c0, blocklock_default_pk.y.c1],
await owner.getAddress(),
await schemeProvider.getAddress(),
]);
await decryptionSender.waitForDeployment();

blocklock = await ethers.deployContract("BlocklockSender", [await decryptionSender.getAddress()]);
await blocklock.waitForDeployment();

let blockHeight = await ethers.provider.getBlockNumber();

const msg = ethers.parseEther("4");
const msgBytes = AbiCoder.defaultAbiCoder().encode(["uint256"], [msg]);
const encodedMessage = getBytes(msgBytes);
// encodedMessage = 0x00000000000000000000000000000000000000000000000029a2241af62c0000

const { id, receipt } = await encryptAndRegister(encodedMessage, BigInt(blockHeight + 2), blocklock_default_pk);
const { id, receipt } = await encryptAndRegister(encodedMessage, BigInt(blockHeight + 2), BLOCKLOCK_DEFAULT_PUBLIC_KEY);

expect(BigInt(id) > BigInt(0)).to.be.equal(true);

Expand Down

0 comments on commit 4f6088a

Please sign in to comment.