AztecProtocol / aztec-packages

Apache License 2.0
204 stars 235 forks source link

getInitialTestAccountsWallets() & sandbox account address mismatch #9384

Open twt-- opened 4 weeks ago

twt-- commented 4 weeks ago

In 0.59.0, the account addresses from getInitialTestAccountsWallets() does not match the addresses in the sandbox. The secret keys match, though.

I ran into this from an error when registering/deploying contracts using the wallet from getInitialTestAccountsWallets():

2024-10-23T23:45:25.318Z aztec:js:contract_interaction [INFO] Creating request for registering contract class 0x10dd205b8969dbc5bf3c4d29826883c71f4854c110c7e32fced86a513dad4d25 as part of deployment for 0x0be36262f837edbe44dbdbef4286b249d10598bc89dae80c505372656482130d 
NoRetryError: (JSON-RPC PROPAGATED) (host http://localhost:8080) (method pxe_simulateTx) (code 400) DB has no contract with address 0x225c2f74ec7d968dd551c4e7715d20fd582df2c8550c931a997a7ae8c2962b1b

The address 0x225c2f74ec7d968dd551c4e7715d20fd582df2c8550c931a997a7ae8c2962b1b that's not in the DB is what the getInitialTestAccountsWallets() thinks the account address should be, but the sandbox PXE has a different address for it:

Using @aztec/accounts@0.59.0:

> const wallets = await getInitialTestAccountsWallets(pxe)
> wallets.forEach(w => console.log(`Address: ${w.getAddress()}\nSecret Key: ${w.getSecretKey()}`))
Address: 0x225c2f74ec7d968dd551c4e7715d20fd582df2c8550c931a997a7ae8c2962b1b
Secret Key: 0x2153536ff6628eee01cf4024889ff977a18d9fa61d0e414422f7681cf085c281
Address: 0x2df5d128474b021912473d38d3c026b41c909bf9c162633bda569fc4fd3d8334
Secret Key: 0x0aebd1b4be76efa44f5ee655c20bf9ea60f7ae44b9a7fd1fd9f189c7a0b0cdae
Address: 0x0c7e9730557f78183d3d3dbdabc070c9edcac90ded69c57f53e270f99f099c8d
Secret Key: 0x0f6addf0da06c33293df974a565b03d1ab096090d907d98055a8b7f4954e120c

And from my sandbox setup (set to 0.59.0 with: VERSION=0.59.0 aztec-up)

$ docker-compose logs aztec | egrep '  (Address|Secret Key):'
aztec-1  |  Address: 0x1051d4e8c2993670ef25aaf78180064c8c577ba22fd6251c495667c47ad3dec2
aztec-1  |  Secret Key: 0x2153536ff6628eee01cf4024889ff977a18d9fa61d0e414422f7681cf085c281
aztec-1  |  Address: 0x0b93ec95ae428a1869150b869045e389f84921c684d3a6bf6c34c743661b2e42
aztec-1  |  Secret Key: 0x0aebd1b4be76efa44f5ee655c20bf9ea60f7ae44b9a7fd1fd9f189c7a0b0cdae
aztec-1  |  Address: 0x1a0f09933a572370357e30f6395ba640ffb35c56e17df2b44cd0b9e1dc8f16ed
aztec-1  |  Secret Key: 0x0f6addf0da06c33293df974a565b03d1ab096090d907d98055a8b7f4954e120c
twt-- commented 4 weeks ago

Manually running deployInitialTestAccounts() after the sandbox loads fixes this for me, which is weird because it looks like that is being called already as part of the sandbox startup process.

critesjosh commented 4 weeks ago

Thanks for reporting @twt-- . This seems to be a flaky bug. I just tried with version 0.60 and its working as expected. We are looking into this.

twt-- commented 4 weeks ago

I just tried with version 0.60 and its working as expected.

I just tried on 0.60.0 as well and still having the same issue -- still need to manually run deployInitialTestAccounts() to have usable accounts

critesjosh commented 4 weeks ago

The tests in aztec-starter are working as expected and they use this function. Does anything stand out to you as being done differently?

twt-- commented 4 weeks ago

It's not obvious to me what I'm doing different, but here's a repo with a small example program showing the issue - https://github.com/ClarifiedLabs/aztec-issue-9384

twt-- commented 1 week ago

Figured out that this seems to be an arm issue. Not seeing this in x86_64, but I do run into this on aarch64