-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[master] Make scilla tests parallel-friendly. (#3762)
* Separate eth signers and zil signers * Add more scilla tests * Remove useless packages * Fix init-signers to batch fund zil addresses * Fix packages * Bump s-h-p version * new tests * bump hardhat-scilla-plugin version * Fix HelloWorld test * Fix FungibleToken tests * Fix GetBalance test * Refactor, add new script to fund from eth accounts * Update CI script * fix ci * Update readme
- Loading branch information
Showing
36 changed files
with
691 additions
and
440 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
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
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
42 changes: 32 additions & 10 deletions
42
tests/EvmAcceptanceTests/helpers/parallel-tests/SignerPool.ts
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 |
---|---|---|
@@ -1,27 +1,49 @@ | ||
import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; | ||
import {Account} from "@zilliqa-js/account"; | ||
|
||
export default class SignerPool { | ||
public takeSigner(): SignerWithAddress { | ||
if (this.signers.length == 0) { | ||
public takeEthSigner(): SignerWithAddress { | ||
if (this.eth_signers.length == 0) { | ||
throw new Error( | ||
"No more signers to return. Either you haven't initialized this pool, or you just ran out of signers." | ||
); | ||
} | ||
|
||
return this.signers.pop()!; | ||
return this.eth_signers.pop()!; | ||
} | ||
|
||
public initSigners(...signer: SignerWithAddress[]) { | ||
this.releaseSigner(...signer); | ||
public takeZilSigner(): Account { | ||
if (this.zil_signers.length == 0) { | ||
throw new Error( | ||
"No more signers to return. Either you haven't initialized this pool, or you just ran out of signers." | ||
); | ||
} | ||
|
||
return this.zil_signers.pop()!; | ||
} | ||
|
||
public initSigners(signer: SignerWithAddress[], privateKeys: string[]) { | ||
this.releaseEthSigner(...signer); | ||
|
||
this.zil_signers.push(...privateKeys.map((key) => new Account(key))); | ||
} | ||
|
||
public releaseEthSigner(...signer: SignerWithAddress[]) { | ||
this.eth_signers.push(...signer); | ||
} | ||
|
||
public releaseZilSigner(...signer: Account[]) { | ||
this.zil_signers.push(...signer); | ||
} | ||
|
||
public releaseSigner(...signer: SignerWithAddress[]) { | ||
this.signers.push(...signer); | ||
public getZilSigner(index: number): Account { | ||
return this.zil_signers[index]; | ||
} | ||
|
||
public count(): number { | ||
return this.signers.length; | ||
public count(): [eth_count: number, zil_count: number] { | ||
return [this.eth_signers.length, this.zil_signers.length]; | ||
} | ||
|
||
private signers: SignerWithAddress[] = []; | ||
private eth_signers: SignerWithAddress[] = []; | ||
private zil_signers: Account[] = []; | ||
} |
Oops, something went wrong.