Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add bot filter by feature #8914

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .changeset/wet-swans-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
"@ledgerhq/live-common": minor
"@ledgerhq/coin-framework": minor
"@ledgerhq/actions-root": minor
"@ledgerhq/coin-internet_computer": patch
"@ledgerhq/coin-algorand": patch
"@ledgerhq/coin-filecoin": patch
"@ledgerhq/coin-polkadot": patch
"@ledgerhq/coin-bitcoin": patch
"@ledgerhq/coin-cardano": patch
"@ledgerhq/coin-stellar": patch
"@ledgerhq/coin-vechain": patch
"@ledgerhq/coin-cosmos": patch
"@ledgerhq/coin-elrond": patch
"@ledgerhq/coin-hedera": patch
"@ledgerhq/coin-solana": patch
"@ledgerhq/coin-stacks": patch
"@ledgerhq/coin-tezos": patch
"@ledgerhq/coin-icon": patch
"@ledgerhq/coin-near": patch
"@ledgerhq/coin-tron": patch
"@ledgerhq/coin-evm": patch
"@ledgerhq/coin-ton": patch
"@ledgerhq/coin-xrp": patch
---

Bot feature : Add filter for features
1 change: 1 addition & 0 deletions .github/workflows/bot-nonreg-nitrogen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ jobs:
BOT_ENVIRONMENT: production
# We don't run these currencies daily because fees are expensive
BOT_DISABLED_CURRENCIES: bitcoin,ethereum,qtum,decred,cardano,axelar,cosmos,secret_network,avalanche_c_chain,bsc,filecoin,tron,cronos,fantom,boba,telos_evm,polygon_zk_evm,polkadot
BOT_FILTER_FEATURES: send
1 change: 1 addition & 0 deletions .github/workflows/bot-nonreg-oxygen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ jobs:
BOT_ENVIRONMENT: production
# We only run these currencies on a weekly basis because fees are expensive
BOT_FILTER_CURRENCIES: qtum,decred,cardano,axelar,cosmos,secret_network,avalanche_c_chain,bsc,filecoin,tron,cronos,fantom,boba,telos_evm,polygon_zk_evm,polkadot
BOT_FILTER_FEATURES: send
4 changes: 4 additions & 0 deletions .github/workflows/bot-testing-nitrogen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
currencies:
description: currency ids to test, separated with commas (,)
required: false
features:
description: features to test(send,sendMax,tokens,staking)
required: false
speculos_websocket:
description: check to use speculos with Websocket
type: boolean
Expand Down Expand Up @@ -48,4 +51,5 @@ jobs:
BOT_ENVIRONMENT: testing
BOT_FILTER_FAMILIES: ${{github.event.inputs.families}}
BOT_FILTER_CURRENCIES: ${{github.event.inputs.currencies}}
BOT_FILTER_FEATURES: ${{github.event.inputs.features}}
SPECULOS_USE_WEBSOCKET: ${{inputs.speculos_websocket}}
6 changes: 5 additions & 1 deletion libs/coin-framework/src/bot/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ export type TransactionRes<T extends TransactionCommon> = {
export type MutationSpec<T extends TransactionCommon> = {
// Name what this mutation is doing
name: string;
// related feature to test
feature?: MutationFeatureType;
// The maximum number of times to execute this mutation for a given test run
maxRun: number;
// Express the transaction to be done
Expand Down Expand Up @@ -118,7 +120,7 @@ export type AppSpec<T extends TransactionCommon> = {
testTimeout?: number;
// how much should we retry scan accounts if an error occurs
scanAccountsRetries?: number;
// if define, will run the mutations {multipleRuns} times in order to cover 2 txs in the same run and detect possible issues at the "second tx time"
// if defined, will run the mutations {multipleRuns} times in order to cover 2 txs in the same run and detect possible issues at the "second tx time"
multipleRuns?: number;
// if the nano app depends on an app, name of this app
dependency?: string | undefined;
Expand Down Expand Up @@ -266,3 +268,5 @@ export type FlowDesc<T extends TransactionCommon> = {
steps: Array<Step<T>>;
fallback?: (arg0: DeviceActionArg<T, State<T>>) => Step<T> | null | undefined;
};

export type MutationFeatureType = "send" | "sendMax" | "tokens" | "staking";
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
5 changes: 5 additions & 0 deletions libs/coin-modules/coin-bitcoin/src/specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ const bitcoinLikeMutations = ({
}: Arg = {}): MutationSpec<Transaction>[] => [
{
name: "move ~50%",
feature: "send",
maxRun: 1,
transaction: ({ account, siblings, bridge, maxSpendable }) => {
invariant(maxSpendable.gt(minimalAmount), "balance is too low");
Expand Down Expand Up @@ -144,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 @@ -176,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 @@ -249,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 Expand Up @@ -282,6 +286,7 @@ const bitcoinLikeMutations = ({
},
{
name: "send max",
feature: "sendMax",
maxRun: 1,
transaction: ({ account, siblings, bridge, 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
10 changes: 8 additions & 2 deletions libs/coin-modules/coin-cosmos/src/specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ function cosmosLikeMutations(minimalTransactionAmount: BigNumber): MutationSpec<
return [
{
name: "send some",
maxRun: 2,
feature: "send",
maxRun: 1,
testDestination: genericTestDestination,
test: ({ account, accountBeforeTransaction, operation }) => {
expect(account.balance.toString()).toBe(
Expand Down Expand Up @@ -148,6 +149,7 @@ function cosmosLikeMutations(minimalTransactionAmount: BigNumber): MutationSpec<
},
{
name: "send max",
feature: "sendMax",
maxRun: 1,
testDestination: genericTestDestination,
transaction: ({ account, siblings, bridge, maxSpendable }) => {
Expand All @@ -172,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 @@ -240,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 @@ -305,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 Expand Up @@ -381,6 +386,7 @@ function cosmosLikeMutations(minimalTransactionAmount: BigNumber): MutationSpec<
},
{
name: "claim rewards",
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
Loading
Loading