Skip to content

Commit 5ebc1f2

Browse files
committed
Test stability
1 parent e796abc commit 5ebc1f2

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ export class MigrationEncoder_v1v3
6666

6767
const space = options?.space ?? BigInt(MIGRATION_V1_V3_NONCE_SPACE)
6868
const nonce = 0n // Nonce must be unused
69-
// const v2Nonce = v2commons.transaction.encodeNonce(space, nonce)
7069

7170
// Update implementation to v3
7271
const updateImplementationAbi = AbiFunction.from('function updateImplementation(address implementation)')

packages/utils/migration/test/encoder_v1_v3.test.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const convertContextToV3Context = (context: v2commons.context.WalletContext): V3
2828
}
2929
}
3030

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

@@ -57,7 +57,7 @@ describe('MigrationEncoder_v1v3', () => {
5757
testSigner = createMultiSigner(testSignerPk, providers.v2)
5858
})
5959

60-
describe('convertConfig', () => {
60+
describe('convertConfig', async () => {
6161
it('should convert v1 config to v3 config with single signer', async () => {
6262
const v1Config: v1.config.WalletConfig = {
6363
version: 1,
@@ -251,7 +251,7 @@ describe('MigrationEncoder_v1v3', () => {
251251
})
252252
})
253253

254-
describe('prepareMigration', () => {
254+
describe('prepareMigration', async () => {
255255
it('should prepare migration transactions correctly', async () => {
256256
const walletAddress = testAddress
257257
const contexts: VersionedContext = {
@@ -396,7 +396,7 @@ describe('MigrationEncoder_v1v3', () => {
396396
})
397397
})
398398

399-
describe('decodeTransactions', () => {
399+
describe('decodeTransactions', async () => {
400400
it('should decode transactions correctly', async () => {
401401
const walletAddress = testAddress
402402
const imageHash = '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'
@@ -524,7 +524,7 @@ describe('MigrationEncoder_v1v3', () => {
524524
})
525525
})
526526

527-
describe('constants', () => {
527+
describe('constants', async () => {
528528
it('should have correct nonce space', () => {
529529
expect(MIGRATION_V1_V3_NONCE_SPACE).toBe('0x9e4d5bdafd978baf1290aff23057245a2a62bef5')
530530
})
@@ -535,7 +535,7 @@ describe('MigrationEncoder_v1v3', () => {
535535
})
536536
})
537537

538-
describe('integration test', () => {
538+
describe('integration test', async () => {
539539
it('should use migration ', async () => {
540540
// Create v1 config
541541
const v1Config: v1.config.WalletConfig = {
@@ -620,6 +620,9 @@ describe('MigrationEncoder_v1v3', () => {
620620
expect(receipt?.status).toBe(1)
621621
// This should now be a v3 wallet on chain
622622

623+
// Wait for any pending transactions to fully settle
624+
await new Promise((resolve) => setTimeout(resolve, 100))
625+
623626
// Save the wallet information to the state provider
624627
const stateProvider = new State.Local.Provider()
625628
await stateProvider.saveDeploy(v1ImageHash, convertContextToV3Context(v1.DeployedWalletContext))
@@ -653,6 +656,8 @@ describe('MigrationEncoder_v1v3', () => {
653656
method: 'eth_sendTransaction',
654657
params: [signedTx],
655658
})
659+
// Wait a bit for the transaction to be mined
660+
await new Promise((resolve) => setTimeout(resolve, 3000))
656661
const testReceipt = await providers.v3.request({
657662
method: 'eth_getTransactionReceipt',
658663
params: [testTx],

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { assert, beforeEach, describe, expect, it } from 'vitest'
1111
import { Migrator_v1v3, MigratorV1V3Options } from '../src/migrations/v1/migrator_v1_v3.js'
1212
import { createMultiSigner, type MultiSigner, type V1WalletType } from './testUtils.js'
1313

14-
describe('Migrator_v1v3', () => {
14+
describe('Migrator_v1v3', async () => {
1515
let anvilSigner: MultiSigner
1616
let testSigner: MultiSigner
1717

@@ -42,7 +42,7 @@ describe('Migrator_v1v3', () => {
4242
testSigner = createMultiSigner(Secp256k1.randomPrivateKey(), providers.v2)
4343
})
4444

45-
describe('convertWallet', () => {
45+
describe('convertWallet', async () => {
4646
it('should convert a v1 wallet to a v3 wallet', async () => {
4747
const v1Config = {
4848
version: 1,
@@ -84,6 +84,9 @@ describe('Migrator_v1v3', () => {
8484
}
8585
const v3Wallet = await migrator.convertWallet(v1Wallet, options)
8686

87+
// Wait for any pending transactions from v1 wallet operations to settle
88+
await new Promise((resolve) => setTimeout(resolve, 100))
89+
8790
// Test the wallet works as a v3 wallet now with a test transaction
8891
const call: Payload.Call = {
8992
to: Address.from('0x0000000000000000000000000000000000000000'),
@@ -111,6 +114,8 @@ describe('Migrator_v1v3', () => {
111114
method: 'eth_sendTransaction',
112115
params: [signedTx],
113116
})
117+
// Wait a bit for the transaction to be mined
118+
await new Promise((resolve) => setTimeout(resolve, 3000))
114119
const receipt = await providers.v3.request({
115120
method: 'eth_getTransactionReceipt',
116121
params: [testTx],

0 commit comments

Comments
 (0)