Skip to content

Commit

Permalink
Fix flaky test caused by address normalization (MystenLabs#16231)
Browse files Browse the repository at this point in the history
## Description 

Describe the changes or additions included in this PR.

## Test Plan 

How did you test the new or updated feature?

---
If your changes are not user-facing and do not break anything, you can
skip the following section. Otherwise, please briefly describe what has
changed under the Release Notes section.

### Type of Change (Check all that apply)

- [ ] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
  • Loading branch information
hayes-mysten authored Feb 13, 2024
1 parent c9aa1ea commit 2f5a385
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sdk/graphql-transport/src/mappers/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

export function toShortTypeString<T extends string | null | undefined>(type?: T): T {
return type?.replace(/0x0+(\d)/g, '0x$1').replace(/,\b/g, ', ') as T;
return type?.replace(/0x0{31,}(\d)/g, '0x$1').replace(/,\b/g, ', ') as T;
}

export function isNumericString(value: string) {
Expand Down
4 changes: 2 additions & 2 deletions sdk/graphql-transport/src/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type {
SuiMoveNormalizedModule,
} from '@mysten/sui.js/client';
import { TransactionBlock } from '@mysten/sui.js/transactions';
import { normalizeStructTag, parseStructTag } from '@mysten/sui.js/utils';
import { normalizeStructTag, normalizeSuiAddress, parseStructTag } from '@mysten/sui.js/utils';

import type {
ObjectFilter,
Expand Down Expand Up @@ -412,7 +412,7 @@ export const RPC_METHODS: {
afterStructs = page.structs?.pageInfo.endCursor;
}

return mapNormalizedMoveModule(moveModule, pkg);
return mapNormalizedMoveModule(moveModule, normalizeSuiAddress(pkg));
},
async getNormalizedMoveStruct(transport, [pkg, module, struct]) {
const moveStruct = await transport.graphqlQuery(
Expand Down

0 comments on commit 2f5a385

Please sign in to comment.