Skip to content

Commit

Permalink
feat: add features flags on every test and set maxRun to 1
Browse files Browse the repository at this point in the history
  • Loading branch information
qperrot committed Jan 16, 2025
1 parent ce9b984 commit a7cbb03
Show file tree
Hide file tree
Showing 30 changed files with 113 additions and 20 deletions.
9 changes: 7 additions & 2 deletions libs/coin-modules/coin-algorand/src/specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ const algorand: AppSpec<AlgorandTransaction> = {
mutations: [
{
name: "move ~50%",
maxRun: 2,
feature: "send",
maxRun: 1,
testDestination: genericTestDestination,
transaction: ({ account, siblings, bridge, maxSpendable }) => {
invariant(maxSpendable.gt(0), "Spendable balance is too low");
Expand Down Expand Up @@ -104,6 +105,7 @@ const algorand: AppSpec<AlgorandTransaction> = {
},
{
name: "send max",
feature: "sendMax",
maxRun: 1,
testDestination: genericTestDestination,
transaction: ({ account, siblings, bridge, maxSpendable }) => {
Expand Down Expand Up @@ -135,7 +137,8 @@ const algorand: AppSpec<AlgorandTransaction> = {
},
{
name: "send ASA ~50%",
maxRun: 2,
feature: "tokens",
maxRun: 1,
transaction: ({ account, siblings, bridge, maxSpendable }) => {
invariant(maxSpendable.gt(0), "Spendable balance is too low");
const subAccount = sample(getAssetsWithBalance(account));
Expand Down Expand Up @@ -178,6 +181,7 @@ const algorand: AppSpec<AlgorandTransaction> = {
},
{
name: "opt-In ASA available",
feature: "tokens",
maxRun: 1,
transaction: ({ account, bridge, maxSpendable }) => {
// maxSpendable is expected to be greater than 100,000 micro-Algos
Expand Down Expand Up @@ -217,6 +221,7 @@ const algorand: AppSpec<AlgorandTransaction> = {
},
{
name: "claim rewards",
feature: "staking",
maxRun: 1,
transaction: ({ account, bridge, maxSpendable }) => {
const rewards = (account as AlgorandAccount).algorandResources?.rewards;
Expand Down
3 changes: 3 additions & 0 deletions libs/coin-modules/coin-bitcoin/src/specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ const bitcoinLikeMutations = ({
},
{
name: "optimize-size",
feature: "send",
maxRun: 1,
transaction: ({ account, siblings, bridge, maxSpendable }) => {
invariant(maxSpendable.gt(minimalAmount), "balance is too low");
Expand Down Expand Up @@ -177,6 +178,7 @@ const bitcoinLikeMutations = ({
},
{
name: "send 1 utxo",
feature: "send",
maxRun: 1,
transaction: ({ account, bridge, siblings, maxSpendable }) => {
invariant(maxSpendable.gt(minimalAmount), "balance is too low");
Expand Down Expand Up @@ -250,6 +252,7 @@ const bitcoinLikeMutations = ({
},
{
name: "send OP_RETURN transaction",
feature: "send",
maxRun: 1,
transaction: ({ account, bridge, siblings, maxSpendable }) => {
invariant(maxSpendable.gt(minimalAmount), "balance is too low");
Expand Down
6 changes: 6 additions & 0 deletions libs/coin-modules/coin-cardano/src/specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const cardano: AppSpec<Transaction> = {
mutations: [
{
name: "move ~10% token",
feature: "tokens",
maxRun: 1,
transaction: ({ account, siblings, bridge, maxSpendable }) => {
invariant(maxSpendable.gte(minSpendableRequiredForTokenTx), "balance is too low");
Expand Down Expand Up @@ -77,6 +78,7 @@ const cardano: AppSpec<Transaction> = {
{
testDestination: genericTestDestination,
name: "move ~50%",
feature: "send",
maxRun: 1,
transaction: ({ account, siblings, bridge, maxSpendable }) => {
invariant(maxSpendable.gt(minBalanceRequired), "balance is too low");
Expand Down Expand Up @@ -125,6 +127,7 @@ const cardano: AppSpec<Transaction> = {
},
{
name: "send max",
feature: "sendMax",
maxRun: 1,
testDestination: genericTestDestination,
transaction: ({ account, siblings, bridge, maxSpendable }) => {
Expand Down Expand Up @@ -163,6 +166,7 @@ const cardano: AppSpec<Transaction> = {
},
{
name: "delegate to pool",
feature: "staking",
maxRun: 1,
transaction: ({ account, bridge, maxSpendable }) => {
invariant(maxSpendable.gte(minBalanceRequiredForDelegate), "balance is too low");
Expand Down Expand Up @@ -195,6 +199,7 @@ const cardano: AppSpec<Transaction> = {
},
{
name: "redelegate to pool",
feature: "staking",
maxRun: 1,
transaction: ({ account, bridge, maxSpendable }) => {
invariant(maxSpendable.gte(minBalanceRequiredForDelegate), "balance is too low");
Expand Down Expand Up @@ -225,6 +230,7 @@ const cardano: AppSpec<Transaction> = {
},
{
name: "undelegate",
feature: "staking",
maxRun: 1,
transaction: ({ account, bridge, maxSpendable }) => {
invariant(maxSpendable.gte(minBalanceRequiredForDelegate), "balance is too low");
Expand Down
5 changes: 4 additions & 1 deletion libs/coin-modules/coin-cosmos/src/specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ function cosmosLikeMutations(minimalTransactionAmount: BigNumber): MutationSpec<
},
{
name: "delegate new validators",
feature: "staking",
maxRun: 1,
transaction: ({ account, bridge, siblings }) => {
expectSiblingsHaveSpendablePartGreaterThan(siblings, 0.5);
Expand Down Expand Up @@ -242,7 +243,8 @@ function cosmosLikeMutations(minimalTransactionAmount: BigNumber): MutationSpec<
},
{
name: "undelegate",
maxRun: 5,
feature: "staking",
maxRun: 1,
transaction: ({ account, bridge, maxSpendable }) => {
invariant(canUndelegate(account as CosmosAccount), "can undelegate");
const { cosmosResources } = account as CosmosAccount;
Expand Down Expand Up @@ -307,6 +309,7 @@ function cosmosLikeMutations(minimalTransactionAmount: BigNumber): MutationSpec<
},
{
name: "redelegate",
feature: "staking",
maxRun: 1,
transaction: ({ account, bridge, maxSpendable }) => {
const { cosmosResources } = account as CosmosAccount;
Expand Down
6 changes: 6 additions & 0 deletions libs/coin-modules/coin-elrond/src/specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ const elrond: AppSpec<Transaction> = {
mutations: [
{
name: "send 50%~",
feature: "send",
maxRun: 1,
deviceAction: acceptMoveBalanceTransaction,
transaction: ({ account, siblings, bridge }) => {
Expand Down Expand Up @@ -204,6 +205,7 @@ const elrond: AppSpec<Transaction> = {
},
{
name: "send max",
feature: "sendMax",
maxRun: 1,
deviceAction: acceptMoveBalanceTransaction,
transaction: ({ account, siblings, bridge }) => {
Expand Down Expand Up @@ -236,6 +238,7 @@ const elrond: AppSpec<Transaction> = {
},
{
name: "move some ESDT",
feature: "tokens",
maxRun: 1,
deviceAction: acceptEsdtTransferTransaction,
transaction: ({ account, siblings, bridge }) => {
Expand Down Expand Up @@ -273,6 +276,7 @@ const elrond: AppSpec<Transaction> = {
},
{
name: "delegate 1 EGLD",
feature: "staking",
maxRun: 1,
deviceAction: acceptDelegateTransaction,
transaction: ({ account, bridge }) => {
Expand Down Expand Up @@ -301,6 +305,7 @@ const elrond: AppSpec<Transaction> = {
},
{
name: "unDelegate 1 EGLD",
feature: "staking",
maxRun: 1,
deviceAction: acceptUndelegateTransaction,
transaction: ({ account, bridge }) => {
Expand Down Expand Up @@ -331,6 +336,7 @@ const elrond: AppSpec<Transaction> = {
},
{
name: "withdraw all EGLD",
feature: "staking",
maxRun: 1,
deviceAction: acceptWithdrawTransaction,
transaction: ({ account, bridge }) => {
Expand Down
5 changes: 4 additions & 1 deletion libs/coin-modules/coin-evm/src/specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ const evmBasicMutations: ({
}) => MutationSpec<EvmTransaction>[] = ({ maxAccount }) => [
{
name: "move 50%",
maxRun: 2,
feature: "send",
maxRun: 1,
testDestination: testCoinDestination,
transaction: ({ account, siblings, bridge, maxSpendable }): TransactionRes<EvmTransaction> => {
const sibling = pickSiblings(siblings, maxAccount);
Expand Down Expand Up @@ -266,6 +267,7 @@ const evmBasicMutations: ({
},
{
name: "send max",
feature: "sendMax",
maxRun: 1,
testDestination: testCoinDestination,
transaction: ({ account, siblings, bridge }): TransactionRes<EvmTransaction> => {
Expand Down Expand Up @@ -311,6 +313,7 @@ const evmBasicMutations: ({

const moveErc20Mutation: MutationSpec<EvmTransaction> = {
name: "move some ERC20 like (ERC20, BEP20, etc...)",
feature: "tokens",
maxRun: 1,
testDestination: testTokenDestination,
transaction: ({ account, siblings, bridge }): TransactionRes<EvmTransaction> => {
Expand Down
5 changes: 5 additions & 0 deletions libs/coin-modules/coin-filecoin/src/test/bot-specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const filecoinSpecs: AppSpec<Transaction> = {
mutations: [
{
name: "Send small to f4 address",
feature: "send",
maxRun: 1,
deviceAction: generateDeviceActionFlow(BotScenario.F4_RECIPIENT),
testDestination: genericTestDestination,
Expand All @@ -51,6 +52,7 @@ const filecoinSpecs: AppSpec<Transaction> = {
},
{
name: "Send small to eth address",
feature: "send",
maxRun: 1,
deviceAction: generateDeviceActionFlow(BotScenario.ETH_RECIPIENT),
testDestination: genericTestDestination,
Expand All @@ -72,6 +74,7 @@ const filecoinSpecs: AppSpec<Transaction> = {
},
{
name: "Send 50%~",
feature: "send",
maxRun: 1,
testDestination: genericTestDestination,
transaction: ({ account, siblings, bridge }) => {
Expand All @@ -98,6 +101,7 @@ const filecoinSpecs: AppSpec<Transaction> = {
},
{
name: "Transfer Max",
feature: "sendMax",
maxRun: 1,
transaction: ({ account, siblings, bridge }) => {
return {
Expand All @@ -115,6 +119,7 @@ const filecoinSpecs: AppSpec<Transaction> = {
},
{
name: "Send ~50% WFIL",
feature: "tokens",
maxRun: 1,
deviceAction: generateDeviceActionFlow(BotScenario.TOKEN_TRANSFER),
transaction: ({ account, bridge, maxSpendable }) => {
Expand Down
9 changes: 6 additions & 3 deletions libs/coin-modules/coin-hedera/src/test/bot-specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ const hedera: AppSpec<Transaction> = {
mutations: [
{
name: "Send ~50%",
maxRun: 2,
feature: "send",
maxRun: 1,
testDestination: genericTestDestination,
transaction: ({
account,
Expand Down Expand Up @@ -83,7 +84,8 @@ const hedera: AppSpec<Transaction> = {
},
{
name: "Send max",
maxRun: 2,
feature: "sendMax",
maxRun: 1,
testDestination: genericTestDestination,
transaction: ({
account,
Expand All @@ -109,7 +111,8 @@ const hedera: AppSpec<Transaction> = {
},
{
name: "Memo",
maxRun: 2,
feature: "send",
maxRun: 1,
transaction: ({
account,
siblings,
Expand Down
2 changes: 2 additions & 0 deletions libs/coin-modules/coin-icon/src/specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const icon: AppSpec<Transaction> = {
mutations: [
{
name: "send 50%~",
feature: "send",
maxRun: 1,
transaction: ({ account, siblings, bridge }) => {
invariant(account.spendableBalance.gt(0), "balance is 0");
Expand Down Expand Up @@ -94,6 +95,7 @@ const icon: AppSpec<Transaction> = {
},
{
name: "send max",
feature: "sendMax",
maxRun: 1,
transaction: ({ account, siblings, bridge }) => {
invariant(account.spendableBalance.gt(0), "balance is 0");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const internetComputerSpecs: AppSpec<Transaction> = {
mutations: [
{
name: "Send ~50%",
feature: "send",
maxRun: 1,
testDestination: genericTestDestination,
transaction: ({ account, siblings, bridge, maxSpendable }) => {
Expand Down Expand Up @@ -74,6 +75,7 @@ const internetComputerSpecs: AppSpec<Transaction> = {
},
{
name: "Transfer Max",
feature: "sendMax",
maxRun: 1,
testDestination: genericTestDestination,
transaction: ({ account, siblings, bridge }) => {
Expand Down
5 changes: 5 additions & 0 deletions libs/coin-modules/coin-near/src/specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const near: AppSpec<Transaction> = {
mutations: [
{
name: "Move 50% to another account",
feature: "send",
maxRun: 1,
transaction: ({ account, siblings, bridge, maxSpendable }) => {
invariant(maxSpendable.gt(minimalAmount), "balance is too low");
Expand All @@ -48,6 +49,7 @@ const near: AppSpec<Transaction> = {
},
{
name: "Send max to another account",
feature: "sendMax",
maxRun: 1,
transaction: ({ account, siblings, bridge, maxSpendable }) => {
invariant(maxSpendable.gt(minimalAmount), "balance is too low");
Expand All @@ -66,6 +68,7 @@ const near: AppSpec<Transaction> = {
},
{
name: "Stake",
feature: "staking",
maxRun: 1,
transaction: ({ account, bridge, maxSpendable }) => {
invariant(maxSpendable.gt(minimalAmount.plus(stakingFee)), "balance is too low");
Expand Down Expand Up @@ -99,6 +102,7 @@ const near: AppSpec<Transaction> = {
},
{
name: "Unstake",
feature: "staking",
maxRun: 1,
transaction: ({ account, bridge, maxSpendable }) => {
invariant(maxSpendable.gt(stakingFee), "balance is too low for fees");
Expand Down Expand Up @@ -134,6 +138,7 @@ const near: AppSpec<Transaction> = {
},
{
name: "Withdraw",
feature: "staking",
maxRun: 1,
transaction: ({ account, bridge, maxSpendable }) => {
invariant(maxSpendable.gt(stakingFee), "balance is too low for fees");
Expand Down
Loading

0 comments on commit a7cbb03

Please sign in to comment.