Skip to content

Commit 1680b17

Browse files
committed
Fix test
1 parent c2c7ca6 commit 1680b17

5 files changed

Lines changed: 18 additions & 7 deletions

File tree

packages/utils/migration/src/migrations/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { State } from '@0xsequence/wallet-core'
22
import { Payload } from '@0xsequence/wallet-primitives'
33
import { Address, Hex } from 'ox'
44
import { UnsignedMigration, VersionedContext } from '../types.js'
5-
import { MigrationEncoder_v1v3 } from './v1/migration_v1_v3.js'
5+
import { MigrationEncoder_v1v3 } from './v1/encoder_v1_v3.js'
66

77
export interface MigrationEncoder<FromConfigType, ToConfigType, ConvertOptionsType, PrepareOptionsType> {
88
fromVersion: number

packages/utils/migration/src/migrations/v1/migration_v1_v3.ts renamed to packages/utils/migration/src/migrations/v1/encoder_v1_v3.ts

File renamed without changes.

packages/utils/migration/src/migrations/v1/migrator_v1_v3.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { State, Wallet as WalletV3 } from '@0xsequence/wallet-core'
44
import { Payload, Context as V3Context } from '@0xsequence/wallet-primitives'
55
import { Address, Hex } from 'ox'
66
import { Migrator } from '../index.js'
7-
import { ConvertOptions, MigrationEncoder_v1v3, PrepareOptions } from './migration_v1_v3.js'
7+
import { ConvertOptions, MigrationEncoder_v1v3, PrepareOptions } from './encoder_v1_v3.js'
88

99
export type MigratorV1V3Options = ConvertOptions &
1010
PrepareOptions & {

packages/utils/migration/test/migration_v1_v3.test.ts renamed to packages/utils/migration/test/encoder_v1_v3.test.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { ethers } from 'ethers'
1313
import { AbiFunction, Address, Hex, Provider, RpcTransport, Secp256k1 } from 'ox'
1414
import { fromRpcStatus } from 'ox/TransactionReceipt'
1515
import { assert, beforeEach, describe, expect, it } from 'vitest'
16-
import { MIGRATION_V1_V3_NONCE_SPACE, Migration_v1v3 } from '../src/migrations/v1/migration_v1_v3.js'
16+
import { MIGRATION_V1_V3_NONCE_SPACE, MigrationEncoder_v1v3 } from '../src/migrations/v1/encoder_v1_v3.js'
1717
import { VersionedContext } from '../src/types.js'
1818
import { createMultiSigner, MultiSigner } from './testUtils.js'
1919

@@ -28,7 +28,7 @@ const convertContextToV3Context = (context: v2commons.context.WalletContext): V3
2828
}
2929
}
3030

31-
describe('Migration_v1v3', () => {
31+
describe('MigrationEncoder_v1v3', () => {
3232
let anvilSigner: MultiSigner
3333
let testSigner: MultiSigner
3434

@@ -38,12 +38,12 @@ describe('Migration_v1v3', () => {
3838
}
3939
let chainId: number
4040

41-
let migration: Migration_v1v3
41+
let migration: MigrationEncoder_v1v3
4242

4343
let testAddress: Address.Address
4444

4545
beforeEach(async () => {
46-
migration = new Migration_v1v3()
46+
migration = new MigrationEncoder_v1v3()
4747
const url = 'http://127.0.0.1:8545'
4848
providers = {
4949
v2: ethers.getDefaultProvider(url),
@@ -546,6 +546,11 @@ describe('Migration_v1v3', () => {
546546
weight: 1,
547547
address: testSigner.address,
548548
},
549+
// Include a random signer to avoid image hash collisions
550+
{
551+
weight: 1,
552+
address: Address.fromPublicKey(Secp256k1.getPublicKey({ privateKey: Secp256k1.randomPrivateKey() })),
553+
},
549554
],
550555
}
551556
const v1ImageHash = v1.config.ConfigCoder.imageHashOf(v1Config)

packages/utils/migration/test/migrator_v1_v3.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ describe('Migrator_v1v3', () => {
3333
}
3434
chainId = Number(await providers.v3.request({ method: 'eth_chainId' }))
3535

36-
stateProvider = new State.Sequence.Provider('http://127.0.0.1:36261')
36+
stateProvider = new State.Local.Provider()
37+
// stateProvider = new State.Sequence.Provider('http://127.0.0.1:36261')
3738
migrator = new Migrator_v1v3(stateProvider)
3839

3940
const anvilPk = '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80'
@@ -51,6 +52,11 @@ describe('Migrator_v1v3', () => {
5152
weight: 1,
5253
address: testSigner.address,
5354
},
55+
// Include a random signer to avoid image hash collisions
56+
{
57+
weight: 1,
58+
address: Address.fromPublicKey(Secp256k1.getPublicKey({ privateKey: Secp256k1.randomPrivateKey() })),
59+
},
5460
],
5561
}
5662
const orchestrator = new Orchestrator([testSigner.v2])

0 commit comments

Comments
 (0)