Skip to content

Conversation

@danielailie
Copy link
Contributor

No description provided.

transaction.signature = await alice.sign(transactionComputer.computeHashForSigning(transaction));

const userVerifier = new UserVerifier(new UserPublicKey(wallets.alice.address.getPublicKey()));
const userVerifier = new UserVerifier(alice.publicKey);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can use account.verify()?

Now I see, that we don't have separate verify_transaction and verify_message:

How about having so?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add this but in the next pr if that's ok. I don't want to add functionality on this pr as is enough big as it is

});
transaction.nonce = nonce + 1n;
transaction.signature = await bob.signer.sign(transactionComputer.computeBytesForSigning(transaction));
transaction.signature = bob.signTransaction(transaction);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

await?

assert.deepEqual(txOnNetwork.status, new TransactionStatus("success"));

transaction.signature = await bob.signer.sign(transactionComputer.computeBytesForSigning(transaction));
transaction.signature = bob.signTransaction(transaction);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

await - here and in other places, as needed?

Comment on lines 271 to 275
deployTransaction.nonce = alice.getNonceThenIncrement();

deployTransaction.signature = await alice.signer.sign(
Buffer.from(transactionComputer.computeBytesForSigning(deployTransaction)),
);
deployTransaction.signature = alice.signTransaction(deployTransaction);

const contractAddress = SmartContract.computeAddress(alice.address, alice.account.nonce);
alice.account.incrementNonce();
const contractAddress = SmartContract.computeAddress(alice.address, alice.nonce);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you use getNonceThenIncrement() and then try to compute the contract's address using alice.nonce you'll have a higher nonce than the one on the transaction, thus computing an invalid address.

Comment on lines 359 to 363
deployTransaction.nonce = alice.getNonceThenIncrement();

deployTransaction.signature = await alice.signer.sign(
Buffer.from(transactionComputer.computeBytesForSigning(deployTransaction)),
);
deployTransaction.signature = alice.signTransaction(deployTransaction);

const contractAddress = SmartContract.computeAddress(alice.address, alice.account.nonce);
alice.account.incrementNonce();
const contractAddress = SmartContract.computeAddress(alice.address, alice.nonce);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment as above


const contractAddress = SmartContract.computeAddress(alice.address, alice.account.nonce);
alice.account.incrementNonce();
const contractAddress = SmartContract.computeAddress(alice.address, alice.nonce);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment with the higher nonce and wrong contract address.


const contractAddress = SmartContract.computeAddress(alice.address, alice.account.nonce);
alice.account.incrementNonce();
const contractAddress = SmartContract.computeAddress(alice.address, alice.nonce);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same issue here


const contractAddress = SmartContract.computeAddress(alice.address, alice.account.nonce);
alice.account.incrementNonce();
const contractAddress = SmartContract.computeAddress(alice.address, alice.nonce);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same issue here, as well


const contractAddress = SmartContract.computeAddress(alice.address, alice.account.nonce);
alice.account.incrementNonce();
const contractAddress = SmartContract.computeAddress(alice.address, alice.nonce);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same issue here.

@danielailie danielailie merged commit aa0dce0 into feat/next Feb 3, 2025
4 checks passed
@danielailie danielailie deleted the TOOL-451-use-account-sign-transaction-in-tests branch February 3, 2025 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants