Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[experimental] Decoding and then re-compiling a transaction invalidates existing signatures #2362

Open
mcintyre94 opened this issue Mar 22, 2024 · 2 comments · Fixed by #2387
Assignees
Labels
bug Something isn't working released

Comments

@mcintyre94
Copy link
Collaborator

Overview

If we have a transaction that has been partially signed, and we decode it using the new web3js and then call compileMessage, the existing signature may not be compatible with the newly compiled message. This is because of the new more deterministic account ordering used in the experimental web3js

Steps to reproduce

Codesandbox: https://codesandbox.io/p/devbox/web3js-account-ordering-xmxrxm (node index.mjs)

This repro creates and signs a transaction with the legacy web3js. It then decodes + recompiles the transaction message using the new web3js, and verifies the signature before and after

Description of bug

  • If we decode a transaction with an existing accounts array then I think we need to keep it the same, to ensure the compiled message.

Suggested fix:

  • Add a field to the Transaction model eg orderedAccounts
  • There should be no way exposed to set that field, it should only be used when we decode an existing transaction. Also probably only set it if there are existing signatures
  • If we do anything that already invalidates signatures (like adding an instruction), we should also strip this field
  • When we compile the message, if this field is set then we should use it instead of our deterministic account ordering
Copy link
Contributor

github-actions bot commented Apr 3, 2024

🎉 This issue has been resolved in version 1.91.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@mcintyre94 mcintyre94 reopened this Apr 3, 2024
@mcintyre94
Copy link
Collaborator Author

^ Nope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment