Skip to content

Commit

Permalink
chore: cleanup test
Browse files Browse the repository at this point in the history
  • Loading branch information
Orlando committed Aug 14, 2023
1 parent 6561ac5 commit 9e09f6c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NETWORK_URL
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"author": "Snapshot Labs",
"license": "MIT",
"scripts": {
"format": "eslint . --ext .ts --fix"
"format:ts": "eslint . --ext .ts --fix",
"test:eth-sig-auth": "jest -c jest.config.ts"
},
"devDependencies": {
"@types/jest": "^29.5.3",
Expand Down
16 changes: 10 additions & 6 deletions starknet/tests/eth-sig-auth.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fs from 'fs';
import { ethers } from 'ethers';
import dotenv from 'dotenv';
import { Provider, Account, CallData, cairo, json } from 'starknet';
import {
Propose,
Expand All @@ -10,23 +11,26 @@ import {
UpdateProposal,
} from './types';

const pk = process.env.PRIVATE_KEY || '';
dotenv.config();

describe('Starknet Signature Authenticator', () => {
const signer = new ethers.Wallet(pk);
const provider = new Provider({ sequencer: { baseUrl: 'http://127.0.0.1:5050' } });
// devnet predeployed account
const network = process.env.NETWORK_URL || '';

describe('Ethereum Signature Authenticator', () => {
const provider = new Provider({ sequencer: { baseUrl: network } });
// starknet devnet predeployed account 0 with seed 0
const privateKey0 = '0xe3e70682c2094cac629f6fbed82c07cd';
const address0 = '0x7e00d496e324876bbc8531f2d9a82bf154d1a04a50218ee74cdd372f75a551a';
const account0 = new Account(provider, address0, privateKey0);

let signer: ethers.HDNodeWallet;
let spaceAddress: string;
let vanillaVotingStrategyAddress: string;
let vanillaProposalValidationStrategyAddress: string;
let ethSigAuthAddress: string;
let domain: any;

beforeAll(async () => {
signer = ethers.Wallet.createRandom();
// Deploy Ethereum Signature Authenticator
const ethSigAuthSierra = json.parse(
fs.readFileSync('starknet/target/dev/sx_EthSigAuthenticator.sierra.json').toString('ascii'),
Expand Down Expand Up @@ -110,7 +114,7 @@ describe('Starknet Signature Authenticator', () => {
domain = {
chainId: '0x534e5f474f45524c49', // devnet id
};
}, 100000);
}, 1000000);
test('can authenticate a proposal, a vote, and a proposal update', async () => {
// PROPOSE

Expand Down

0 comments on commit 9e09f6c

Please sign in to comment.