[BUG] calling authwit in the deployment of a contract causes the contract address to change.
What are you trying to do?
We have a token transfer that we would like to happen in the contructor of a contract.
Recently a feature was added so you can add authwits to the deployment of an contract
const deployTx = await deployMethod.with({ authWitnesses: [senderAuthwit] }).send({ fee: { paymentMethod } }).deployed()
This is a code snippet
const deployMethod = await AccountEscrowContract.deployWithPublicKeys(
escrowPublicKeys,
sender,
send_amount,
preEmailHash1,
token.address
)
console.log("deployMethod created")
escrowinstance = await deployMethod.getInstance()
await pxe.registerAccount(escrowSecret, await computePartialAddress(escrowinstance))
const senderAuthwit = await sender.createAuthWit({
caller: escrowinstance.address,
action: token.methods.transfer_in_private(sender.getAddress(), escrowinstance.address, send_amount, 0)
})
const deployTx = await deployMethod.with({ authWitnesses: [senderAuthwit] }).send({ fee: { paymentMethod } }).deployed()
However, if i include this "with({authwitnesses: [senderAuthwit] }) the contract address that is registered is different to the one that is deployed. ie,
[15:30:03.639] INFO: pxe:service Registered account 0x2efe17d7d1a371ec2904b52d20ddc6eac0691a08b70c453129c7f968d2692084
[15:30:04.129] INFO: pxe:service Added contract Escrow at 0x1f469802fc6d2ac606a49ca180a6a24791cac69784c95ade8a020c6b0315ff1f with class 0x16bc512a15de6f2cc0e727830979b81b903e68bd49c73bcd5250f08b64333bd4
If i remove the authwit from the deployment. These are the logs, the contract address is the same as the one registered, but this transaction does not go through because we need the authwit
[15:34:18.184] INFO: pxe:service Registered account 0x0a6fb8456b859cf02837e2a9e7a96d092573bd275d16449164da95d56d8253a8
[15:34:18.597] INFO: pxe:service Added contract Escrow at 0x0a6fb8456b859cf02837e2a9e7a96d092573bd275d16449164da95d56d8253a8 with class 0x16bc512a15de6f2cc0e727830979b81b903e68bd49c73bcd5250f08b64333bd4
for the same classId
Code Reference
^
Aztec Version
0.87.2
OS
MacOS
Browser (if relevant)
No response
Node Version
v20.12.0
Additional Context
No response