Skip to content

Commit

Permalink
Merge pull request #14 from bcnmy/dev
Browse files Browse the repository at this point in the history
Documentation and Refactoring
  • Loading branch information
ankurdubey521 committed Jul 3, 2023
2 parents ce43269 + 10c8997 commit 0e8bca6
Show file tree
Hide file tree
Showing 80 changed files with 5,443 additions and 2,201 deletions.
13 changes: 6 additions & 7 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
PRIVATE_KEY=
DEPLOYER_PRIVATE_KEY=

# Local Simulation Config
SIMULATION_CHAIN_ID=0xB1C0B1C0
ANVIL_DEFAULT_PRIVATE_KEY=
FOUNDATION_RELAYER_PRIVATE_KEY=
TESTNET_FOUNDATION_RELAYER_PRIVATE_KEY=
RELAYER_GENERATION_SEED_PHRASE=

TRANSACTION_ALLOCATOR_DEPLOYMENT_CONFIG_JSON=script/TA.Deployment.Testnet.Config.json
DEPLOYMENT_MODE=TESTNET_DEBUG
RPC_URL=http://127.0.0.1:8545/
WS_URL=ws://127.0.0.1:8545/
SIMULATION_RPC_URL=http://127.0.0.1:8545/
SIMULATION_WS_URL=ws://127.0.0.1:8545/

# RPC
FUJI_RPC_URL=
Expand Down
62 changes: 0 additions & 62 deletions .github/workflows/foundry-gas-diff.yml

This file was deleted.

300 changes: 300 additions & 0 deletions broadcast/TA.Deployment.s.sol/2982195648/run-1688047552.json

Large diffs are not rendered by default.

490 changes: 490 additions & 0 deletions broadcast/TA.Deployment.s.sol/2982195648/run-1688054968.json

Large diffs are not rendered by default.

490 changes: 490 additions & 0 deletions broadcast/TA.Deployment.s.sol/2982195648/run-1688055832.json

Large diffs are not rendered by default.

490 changes: 490 additions & 0 deletions broadcast/TA.Deployment.s.sol/2982195648/run-1688056305.json

Large diffs are not rendered by default.

490 changes: 490 additions & 0 deletions broadcast/TA.Deployment.s.sol/2982195648/run-latest.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions hardhat/simulation/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ dotenv.config();
const BOND_TOKEN_ADDRESS = '0x5FbDB2315678afecb367f032d93F642f64180aa3';
const TA_ADDRESS = '0x0165878A594ca255338adfa4d48449f69242Eb8F';

const httpProvider = new ethers.providers.JsonRpcBatchProvider(process.env.RPC_URL!);
const wsProvider = new ethers.providers.WebSocketProvider(process.env.WS_URL!);
const httpWallet = new ethers.Wallet(process.env.PRIVATE_KEY!, httpProvider);
const wsWallet = new ethers.Wallet(process.env.PRIVATE_KEY!, wsProvider);
const httpProvider = new ethers.providers.JsonRpcBatchProvider(process.env.SIMULATION_RPC_URL!);
const wsProvider = new ethers.providers.WebSocketProvider(process.env.SIMULATION_WS_URL!);
const httpWallet = new ethers.Wallet(process.env.DEPLOYER_PRIVATE_KEY!, httpProvider);
const wsWallet = new ethers.Wallet(process.env.DEPLOYER_PRIVATE_KEY!, wsProvider);

const config = {
httpProvider,
Expand Down
9 changes: 0 additions & 9 deletions hardhat/simulation/mempool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import { metrics } from './metrics';
import { config } from './config';

export class Mempool {
// lock = new AsyncLock();
// lockName = 'MEMPOOL';

pool: Set<string> = new Set();

public init() {
Expand All @@ -23,28 +20,22 @@ export class Mempool {
);
});

// this.lock.acquire(this.lockName, async () => {
txs.forEach((t) => {
this.pool.add(t);
});
metrics.setTransactionsInMempool(this.pool.size);
// });
}, config.generationIntervalSec * 1000);
}

public async getTransactions(): Promise<Set<string>> {
// return this.lock.acquire(this.lockName, () => {
const transactions = new Set(this.pool);
return transactions;
// });
}

public async removeTransactions(tx: string[]) {
// return this.lock.acquire(this.lockName, async () => {
tx.forEach((t) => {
this.pool.delete(t);
});
metrics.setTransactionsInMempool(this.pool.size);
// });
}
}
4 changes: 2 additions & 2 deletions hardhat/simulation/relayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class Relayer {
);
}

private getActiveStateToPendingStateMap(
private getActiveStateToLatestStateMap(
activeState: RelayerStateStruct,
latestState: RelayerStateStruct
): number[] {
Expand Down Expand Up @@ -187,7 +187,7 @@ export class Relayer {
relayerGenerationIterationBitmap: relayerGenerationIterations,
activeState: currentState,
latestState: latestState,
activeStateToPendingStateMap: this.getActiveStateToPendingStateMap(
activeStateToLatestStateMap: this.getActiveStateToLatestStateMap(
currentState,
latestState
),
Expand Down
8 changes: 0 additions & 8 deletions hardhat/simulation/run.sh

This file was deleted.

2 changes: 1 addition & 1 deletion hardhat/testnet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const initializeWormholeApplication = async () => {
// Initialize the foundation relayer
relayers.push(
new Relayer(
process.env.FOUNDATION_RELAYER_PRIVATE_KEY!,
process.env.TESTNET_FOUNDATION_RELAYER_PRIVATE_KEY!,
(
await targetChain.transactionAllocator.relayerInfo(
new Wallet(process.env.ANVIL_DEFAULT_PRIVATE_KEY!, targetChain.httpProvider).address
Expand Down
4 changes: 2 additions & 2 deletions hardhat/testnet/relayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export class Relayer {
);
}

private getActiveStateToPendingStateMap(
private getActiveStateToLatestStateMap(
activeState: RelayerStateStruct,
latestState: RelayerStateStruct
): number[] {
Expand Down Expand Up @@ -205,7 +205,7 @@ export class Relayer {
relayerGenerationIterationBitmap: relayerGenerationIterations,
activeState: currentState,
latestState: latestState,
activeStateToPendingStateMap: this.getActiveStateToPendingStateMap(
activeStateToLatestStateMap: this.getActiveStateToLatestStateMap(
currentState,
latestState
),
Expand Down
2 changes: 1 addition & 1 deletion hardhat/testnet/state-tracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ transactionAllocatorWs.on(

// Default Case
const foundationRelayerAddress = new Wallet(
process.env.FOUNDATION_RELAYER_PRIVATE_KEY!,
process.env.TESTNET_FOUNDATION_RELAYER_PRIVATE_KEY!,
httpProvider
).address;
const relayers = [foundationRelayerAddress];
Expand Down
Loading

0 comments on commit 0e8bca6

Please sign in to comment.