From 649971792c0517885242597923ed22e2e3a90fcf Mon Sep 17 00:00:00 2001 From: Orlando Date: Sat, 2 Sep 2023 23:39:51 +0100 Subject: [PATCH] chore: fully migrated to hardhat --- starknet/test/l1-execution.test.ts | 47 ++++++++++++------------------ 1 file changed, 18 insertions(+), 29 deletions(-) diff --git a/starknet/test/l1-execution.test.ts b/starknet/test/l1-execution.test.ts index 8f679ddd..5ebbe5fd 100644 --- a/starknet/test/l1-execution.test.ts +++ b/starknet/test/l1-execution.test.ts @@ -26,7 +26,6 @@ describe('L1 Avatar Execution', function () { // Using both a starknet hardhat and sn.js account wrapper as hardhat has cleaner deployment flow // but sn.js has cleaner contract interactions. Syntax is being integrated soon. - let account: Account; let accountSH: starknet.starknetAccount; let starkTxAuthenticator: starknet.StarknetContract; let vanillaVotingStrategy: starknet.StarknetContract; @@ -48,14 +47,6 @@ describe('L1 Avatar Execution', function () { account_pk, ); - account = new Account( - new Provider({ sequencer: { baseUrl: stark_network } }), - account_address, - account_pk, - ); - - - const starkTxAuthenticatorFactory = await starknet.getContractFactory( 'sx_StarkTxAuthenticator', ); @@ -127,9 +118,7 @@ describe('L1 Avatar Execution', function () { ethRelayer.address, quorum, )); - console.log('loading l1 messaging contract') - await starknet.devnet.loadL1MessagingContract(eth_network, mockStarknetMessaging.address); - console.log('loaded l1 messaging contract') + // Dumping the Starknet state so it can be loaded at the same point for each test await starknet.devnet.dump('dump.pkl'); console.log('setup done'); @@ -169,12 +158,12 @@ describe('L1 Avatar Execution', function () { console.log('proposing'); // Propose - await account.execute({ - contractAddress: starkTxAuthenticator.address, - entrypoint: 'authenticate_propose', - calldata: CallData.compile({ + await accountSH.invoke( + starkTxAuthenticator, + 'authenticate_propose', + CallData.compile({ space: space.address, - author: account.address, + author: accountSH.address, executionStrategy: { address: ethRelayer.address, params: executionPayload, @@ -182,35 +171,35 @@ describe('L1 Avatar Execution', function () { userProposalValidationParams: [], metadataURI: [], }), - }); + { rawInput: true }); // Vote - await account.execute({ - contractAddress: starkTxAuthenticator.address, - entrypoint: 'authenticate_vote', - calldata: CallData.compile({ + await accountSH.invoke( + starkTxAuthenticator, + 'authenticate_vote', + CallData.compile({ space: space.address, - voter: account.address, + voter: accountSH.address, proposalId: { low: '0x1', high: '0x0' }, choice: '0x1', userVotingStrategies: [{ index: '0x0', params: [] }], metadataURI: [], }), - }); + { rawInput: true }); // TODO: Advance time so that the maxVotingTimestamp is exceeded await starknet.devnet.increaseTime(10); await sleep(10000); // Execute - await account.execute({ - contractAddress: space.address, - entrypoint: 'execute', - calldata: CallData.compile({ + await accountSH.invoke( + space, + 'execute', + CallData.compile({ proposalId: { low: '0x1', high: '0x0' }, executionPayload: executionPayload, }), - }); + { rawInput: true }); // Propogating message to L1 const flushL2Response = await starknet.devnet.flush();