From dc6fbe3e0b89dff3bb3a38ef969f52d51fb6200e Mon Sep 17 00:00:00 2001 From: Teddy Ding Date: Fri, 15 Nov 2024 01:24:31 -0500 Subject: [PATCH 1/2] generate with address, not subaccount id --- .../roundtable/__tests__/helpers/usernames-helper.test.ts | 8 ++++++++ .../__tests__/tasks/subaccount-username-generator.test.ts | 8 ++++++++ .../roundtable/src/tasks/subaccount-username-generator.ts | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/indexer/services/roundtable/__tests__/helpers/usernames-helper.test.ts b/indexer/services/roundtable/__tests__/helpers/usernames-helper.test.ts index 5ba926245af..d5392c2771e 100644 --- a/indexer/services/roundtable/__tests__/helpers/usernames-helper.test.ts +++ b/indexer/services/roundtable/__tests__/helpers/usernames-helper.test.ts @@ -13,6 +13,10 @@ describe('usernames-helper', () => { 'dydx1df84hz7y0dd3mrqcv3vrhw9wdttelul8edqmvp', 'dydx16h7p7f4dysrgtzptxx2gtpt5d8t834g9dj830z', 'dydx15u9tppy5e2pdndvlrvafxqhuurj9mnpdstzj6z', + 'dydx1q54yvrslnu0xp4drpde6f4e0k2ap9efss5hpsd', + 'dydx199tqg4wdlnu4qjlxchpd7seg454937hjrknju4', + 'dydx1n88uc38xhjgxzw9nwre4ep2c8ga4fjxc565lnf', + 'dydx1n88uc38xhjgxzw9nwre4ep2c8ga4fjxc575lnf', ]; const expectedUsernames = [ @@ -24,6 +28,10 @@ describe('usernames-helper', () => { 'BoldGapOGY', 'ZoomEraQE0', 'WiryFernLEC', + 'RudeFuel59E', + 'MacroMealFK5', + 'HappySnapWTT', + 'BumpyEdgeH5Y', ]; for (let i = 0; i < addresses.length; i++) { diff --git a/indexer/services/roundtable/__tests__/tasks/subaccount-username-generator.test.ts b/indexer/services/roundtable/__tests__/tasks/subaccount-username-generator.test.ts index 1a7ce0dfa14..cceb9fe631f 100644 --- a/indexer/services/roundtable/__tests__/tasks/subaccount-username-generator.test.ts +++ b/indexer/services/roundtable/__tests__/tasks/subaccount-username-generator.test.ts @@ -48,6 +48,14 @@ describe('subaccount-username-generator', () => { SubaccountUsernamesTable.findAll( {}, [], {}); + const expectedUsernames = [ + 'BumpyEdgeH5Y', // dydx1n88uc38xhjgxzw9nwre4ep2c8ga4fjxc575lnf + 'HappySnapWTT', // dydx1n88uc38xhjgxzw9nwre4ep2c8ga4fjxc565lnf + 'MacroMealFK5', // dydx199tqg4wdlnu4qjlxchpd7seg454937hjrknju4 + ]; expect(subaccountsWithUsernamesAfter.length).toEqual(subaccountsLength); + for (let i = 0; i < expectedUsernames.length; i++) { + expect(subaccountsWithUsernamesAfter[i].username).toEqual(expectedUsernames[i]); + } }); }); diff --git a/indexer/services/roundtable/src/tasks/subaccount-username-generator.ts b/indexer/services/roundtable/src/tasks/subaccount-username-generator.ts index d1a435cb64b..03fd93f5224 100644 --- a/indexer/services/roundtable/src/tasks/subaccount-username-generator.ts +++ b/indexer/services/roundtable/src/tasks/subaccount-username-generator.ts @@ -20,7 +20,7 @@ export default async function runTask(): Promise { for (const subaccount of subaccountZerosWithoutUsername) { for (let i = 0; i < config.ATTEMPT_PER_SUBACCOUNT; i++) { const username: string = generateUsernameForSubaccount( - subaccount.subaccountId, + subaccount.address, // Always use subaccountNum 0 for generation. Effectively we are // generating one username per address. The fact that we are storing // in the `subaccount_usernames` table is a tech debt. From 2c799a51c0e9d0a9f984ff639dc3386f6eae4c9f Mon Sep 17 00:00:00 2001 From: Teddy Ding Date: Fri, 15 Nov 2024 09:41:25 -0500 Subject: [PATCH 2/2] ENable push --- .github/workflows/indexer-build-and-push-mainnet.yml | 1 + .github/workflows/indexer-build-and-push-testnet.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/indexer-build-and-push-mainnet.yml b/.github/workflows/indexer-build-and-push-mainnet.yml index 78d54d2f68d..9a85f25767b 100644 --- a/.github/workflows/indexer-build-and-push-mainnet.yml +++ b/.github/workflows/indexer-build-and-push-mainnet.yml @@ -4,6 +4,7 @@ on: # yamllint disable-line rule:truthy push: branches: - main + - 'td/*' - 'release/indexer/v[0-9]+.[0-9]+.x' # e.g. release/indexer/v0.1.x - 'release/indexer/v[0-9]+.x' # e.g. release/indexer/v1.x # TODO(DEC-837): Customize github build and push to ECR by service with paths diff --git a/.github/workflows/indexer-build-and-push-testnet.yml b/.github/workflows/indexer-build-and-push-testnet.yml index 3cee1bf285e..7a72f5355b2 100644 --- a/.github/workflows/indexer-build-and-push-testnet.yml +++ b/.github/workflows/indexer-build-and-push-testnet.yml @@ -4,6 +4,7 @@ on: # yamllint disable-line rule:truthy push: branches: - main + - 'td/*' - 'release/indexer/v[0-9]+.[0-9]+.x' # e.g. release/indexer/v0.1.x - 'release/indexer/v[0-9]+.x' # e.g. release/indexer/v1.x # TODO(DEC-837): Customize github build and push to ECR by service with paths