-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update scripts and add optional vBridgeInput value maxEdges for deplo…
…yment (#164) * Update scripts and add optional vBridgeInput value maxEdges for deployment * Remove only annotation on bridge tests
- Loading branch information
Showing
18 changed files
with
201 additions
and
322 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { ethers } from "ethers"; | ||
import { SignatureBridgeSide } from "@webb-tools/bridges" | ||
|
||
export async function changeGovernor( | ||
bridgeAddress: string, | ||
newGovernor: string, | ||
currentGovernor: ethers.Wallet | ||
) { | ||
const bridgeInstance = await SignatureBridgeSide.connect(bridgeAddress, currentGovernor, currentGovernor); | ||
const refreshNonce = await bridgeInstance.contract.refreshNonce(); | ||
const tx = await bridgeInstance.transferOwnership(newGovernor, refreshNonce+1); | ||
const receipt = await tx.wait(); | ||
console.log(receipt); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
require('dotenv').config(); | ||
import { ethers } from 'ethers'; | ||
import { VAnchor } from '@webb-tools/anchors'; | ||
import path from 'path'; | ||
import { fetchComponentsFromFilePaths, getChainIdType } from '@webb-tools/utils'; | ||
import { CircomUtxo, Keypair, randomBN, Utxo } from '@webb-tools/sdk-core'; | ||
import { hexToU8a } from '@polkadot/util'; | ||
|
||
export async function transactWrapNative(anchorAddress: string, sender: ethers.Signer) { | ||
const zkComponentsSmall = await fetchComponentsFromFilePaths( | ||
path.resolve( | ||
__dirname, | ||
`../../../protocol-solidity-fixtures/fixtures/vanchor_2/8/poseidon_vanchor_2_8.wasm` | ||
), | ||
path.resolve( | ||
__dirname, | ||
`../../../protocol-solidity-fixtures/fixtures/vanchor_2/8/witness_calculator.js` | ||
), | ||
path.resolve( | ||
__dirname, | ||
`../../../protocol-solidity-fixtures/fixtures/vanchor_2/8/circuit_final.zkey` | ||
) | ||
); | ||
const zkComponentsLarge = await fetchComponentsFromFilePaths( | ||
path.resolve( | ||
__dirname, | ||
`../../../protocol-solidity-fixtures/fixtures/vanchor_16/8/poseidon_vanchor_16_8.wasm` | ||
), | ||
path.resolve( | ||
__dirname, | ||
`../../../protocol-solidity-fixtures/fixtures/vanchor_16/8/witness_calculator.js` | ||
), | ||
path.resolve( | ||
__dirname, | ||
`../../../protocol-solidity-fixtures/fixtures/vanchor_16/8/circuit_final.zkey` | ||
) | ||
); | ||
const anchor = await VAnchor.connect(anchorAddress, zkComponentsSmall, zkComponentsLarge, sender); | ||
const sourceChainId = getChainIdType(5001); | ||
const randomKeypair = new Keypair(); | ||
|
||
const utxo = await CircomUtxo.generateUtxo({ | ||
curve: 'Bn254', | ||
backend: 'Circom', | ||
chainId: sourceChainId.toString(), | ||
originChainId: sourceChainId.toString(), | ||
amount: '1000000000000000', | ||
keypair: randomKeypair, | ||
}) | ||
|
||
// Build up the inputs for proving manager | ||
const dummyOutputUtxo = await CircomUtxo.generateUtxo({ | ||
curve: 'Bn254', | ||
backend: 'Circom', | ||
chainId: sourceChainId.toString(), | ||
originChainId: sourceChainId.toString(), | ||
amount: '0', | ||
keypair: randomKeypair, | ||
}); | ||
const inputs: Utxo[] = []; | ||
const outputs: [Utxo, Utxo] = [utxo, dummyOutputUtxo]; | ||
|
||
while (inputs.length !== 2 && inputs.length < 16) { | ||
inputs.push( | ||
await CircomUtxo.generateUtxo({ | ||
curve: 'Bn254', | ||
backend: 'Circom', | ||
chainId: sourceChainId.toString(), | ||
originChainId: sourceChainId.toString(), | ||
amount: '0', | ||
blinding: hexToU8a(randomBN(31).toHexString()), | ||
keypair: randomKeypair, | ||
}) | ||
); | ||
} | ||
|
||
const tx = await anchor.transactWrap( | ||
'0x0000000000000000000000000000000000000000', | ||
inputs, | ||
outputs, | ||
'0', | ||
'0x0000000000000000000000000000000000000000', | ||
'0x0000000000000000000000000000000000000000', | ||
{} | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
require('dotenv').config(); | ||
import { getChainIdType } from "@webb-tools/utils"; | ||
import { ethers } from "ethers"; | ||
|
||
export const providerRinkeby = new ethers.providers.JsonRpcProvider(`https://rinkeby.infura.io/v3/fff68ca474dd4764a8d54dd14fa5519e`); | ||
export const walletRinkeby = new ethers.Wallet(process.env.PRIVATE_KEY!, providerRinkeby); | ||
export const chainIdTypeRinkeby = getChainIdType(4); | ||
|
||
export const providerPolygon = new ethers.providers.JsonRpcProvider(process.env.POLYGON_KEY!); | ||
export const walletPolygon = new ethers.Wallet(process.env.PRIVATE_KEY!, providerPolygon); | ||
export const chainIdTypePolygon = getChainIdType(80001); | ||
|
||
export const providerKovan = new ethers.providers.JsonRpcProvider(`https://kovan.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161`); | ||
export const walletKovan = new ethers.Wallet(process.env.PRIVATE_KEY!, providerKovan); | ||
export const chainIdTypeKovan = getChainIdType(42); | ||
|
||
export const providerRopsten = new ethers.providers.JsonRpcProvider(`https://ropsten.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161`); | ||
export const walletRopsten = new ethers.Wallet(process.env.PRIVATE_KEY!, providerRopsten); | ||
export const chainIdTypeRopsten = getChainIdType(3); | ||
|
||
export const providerGoerli = new ethers.providers.JsonRpcProvider(`https://goerli.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161`); | ||
export const walletGoerli = new ethers.Wallet(process.env.PRIVATE_KEY!, providerGoerli); | ||
export const chainIdTypeGoerli = getChainIdType(5); | ||
|
||
export const providerOptimism = new ethers.providers.JsonRpcProvider(process.env.OPTIMISM_KEY!); | ||
export const walletOptimism = new ethers.Wallet(process.env.PRIVATE_KEY!, providerOptimism); | ||
export const chainIdTypeOptimism = getChainIdType(69); | ||
|
||
export const providerArbitrum = new ethers.providers.JsonRpcProvider(process.env.ARBITRUM_KEY!); | ||
export const walletArbitrum = new ethers.Wallet(process.env.PRIVATE_KEY!, providerArbitrum); | ||
export const chainIdTypeArbitrum = getChainIdType(421611); | ||
|
||
export const providerMoonbase = new ethers.providers.JsonRpcProvider('https://moonbeam-alpha.api.onfinality.io/public'); | ||
export const walletMoonbase = new ethers.Wallet(process.env.PRIVATE_KEY!, providerMoonbase); | ||
export const chainIdTypeMoonbase = getChainIdType(1287); | ||
|
||
export const providerAvalanche = new ethers.providers.JsonRpcProvider(process.env.AVALANCHE_KEY!); | ||
export const walletAvalanche = new ethers.Wallet(process.env.PRIVATE_KEY!, providerAvalanche); | ||
export const chainIdTypeAvalanche = getChainIdType(43113); | ||
|
||
export const providerAurora = new ethers.providers.JsonRpcProvider(process.env.AURORA_KEY!); | ||
export const walletAurora = new ethers.Wallet(process.env.PRIVATE_KEY!, providerAurora); | ||
export const chainIdTypeAurora = getChainIdType(1313161555); | ||
|
||
export const providerHarmony = new ethers.providers.JsonRpcProvider(process.env.HARMONY_KEY!); | ||
export const walletHarmony = new ethers.Wallet(process.env.PRIVATE_KEY!, providerHarmony); | ||
export const chainIdTypeHarmony = getChainIdType(1666700000); | ||
|
||
export const providerAthena = new ethers.providers.JsonRpcProvider(`http://127.0.0.1:5002`); | ||
export const walletAthena = new ethers.Wallet("0x0000000000000000000000000000000000000000000000000000000000000001", providerAthena); | ||
export const chainIdTypeAthena = getChainIdType(5002); | ||
|
||
export const providerHermes = new ethers.providers.JsonRpcProvider(`http://127.0.0.1:5001`); | ||
export const walletHermes = new ethers.Wallet("0x0000000000000000000000000000000000000000000000000000000000000001", providerHermes); | ||
export const chainIdTypeHermes = getChainIdType(5001); | ||
|
||
export const providerDemeter = new ethers.providers.JsonRpcProvider(`http://127.0.0.1:5003`); | ||
export const walletDemeter = new ethers.Wallet("0x0000000000000000000000000000000000000000000000000000000000000001", providerDemeter); | ||
export const chainIdTypeDemeter = getChainIdType(5003); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require('dotenv').config(); | ||
const path = require('path'); | ||
import { ethers } from 'ethers'; | ||
import { toFixedHex } from '@webb-tools/sdk-core'; | ||
import { walletRinkeby, walletGoerli, walletArbitrum, walletMoonbase } from '../ethersGovernorWallets'; | ||
import { viewRootAcrossBridge } from './viewRootAcrossBridge'; | ||
import { VAnchor } from '@webb-tools/anchors'; | ||
import { VAnchor__factory } from '@webb-tools/contracts'; | ||
|
||
export const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms)); | ||
|
||
async function run() { | ||
const anchorGoerli = VAnchor__factory.connect('0xE24A63Ebb690d0d6C241FDd4aA8ad90421f91D8a', walletGoerli); | ||
} | ||
|
||
run(); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require('dotenv').config(); | ||
import { ethers } from 'ethers'; | ||
import { VAnchor } from '@webb-tools/contracts'; | ||
|
||
export async function viewRootAcrossBridge(merkleRootAnchor: VAnchor, edgeListAnchor: VAnchor) { | ||
const lastMerkleRoot = await merkleRootAnchor.getLastRoot(); | ||
const merkleChainId = await merkleRootAnchor.signer.getChainId(); | ||
|
||
console.log('Latest merkle root on chain: ', lastMerkleRoot); | ||
const merkleRootIndex = await edgeListAnchor.edgeIndex(merkleChainId); | ||
const edgeListEntry = await edgeListAnchor.edgeList(merkleRootIndex); | ||
console.log('edge list entry: ', edgeListEntry); | ||
} | ||
|
Oops, something went wrong.