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

Add the NoAccountAuthenticator variant #467

Merged
merged 1 commit into from
Nov 13, 2024

Conversation

junkil-park
Copy link
Contributor

@junkil-park junkil-park commented Jul 16, 2024

Description

This PR updates the TypeScript SDK to support the simulation enhancement AIP: https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-92.md.

Key Changes:

Simulation API Update: Allows users to simulate transactions without providing public keys by updating simulateTransaction to accept PublicKey | null instead of PublicKey. If null is provided, NoAccountAuthenticator is used as an authenticator. This new authenticator variant is supported by the Aptos VM as per this PR.

Multisig V2 Example Update: The multisig v2 example (multisig_v2.ts) is updated to reflect the change in the multisig transaction simulation behavior. To pre-check the multisig payload before creation, an entry function payload simulation with the multisig account as the sender and 0x0 as the fee payer is used.

Test Plan

This PR includes the following test scenarios:

  • Simulate a transaction without checking the authentication key when the public key is not provided (i.e., public key is null).
  • Simulate a fee payer transaction with fee payer as 0x0 and no public key of the fee payer provided.
  • Fail to execute a transaction when NoAccountAuthenticator is used.

Related Links

N.A.

Copy link
Collaborator

@0xmaayan 0xmaayan left a comment

Choose a reason for hiding this comment

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

left initial comments. can we gat a PR description on what we are changing/adding here and why?

examples/typescript-esm/multisig_v2.ts Outdated Show resolved Hide resolved
src/cli/localNode.ts Outdated Show resolved Hide resolved
tests/e2e/transaction/transactionSubmission.test.ts Outdated Show resolved Hide resolved
src/transactions/transactionBuilder/transactionBuilder.ts Outdated Show resolved Hide resolved
@junkil-park
Copy link
Contributor Author

left initial comments. can we gat a PR description on what we are changing/adding here and why?

Added!

@junkil-park junkil-park force-pushed the jpark/no-account-authenticator branch 2 times, most recently from b04e8e7 to 45d2d3d Compare July 18, 2024 16:50
Copy link
Collaborator

@0xmaayan 0xmaayan left a comment

Choose a reason for hiding this comment

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

Did a first round

  • Please fix the linting errors - can run pnpm lint on the sdk root folder
  • When we have a property publicKey?:PublicKey it means the publicKey is of type PublicKey or undefined - please use this syntax
  • Please update CHANGELOG
  • Also, tests are failing

src/api/transactionSubmission/simulate.ts Outdated Show resolved Hide resolved
src/api/transactionSubmission/simulate.ts Outdated Show resolved Hide resolved
src/api/transactionSubmission/simulate.ts Outdated Show resolved Hide resolved
src/api/transactionSubmission/simulate.ts Outdated Show resolved Hide resolved
src/api/transactionSubmission/simulate.ts Outdated Show resolved Hide resolved
tests/e2e/transaction/transactionSimulation.test.ts Outdated Show resolved Hide resolved
tests/e2e/transaction/transactionSimulation.test.ts Outdated Show resolved Hide resolved
tests/e2e/transaction/transactionSimulation.test.ts Outdated Show resolved Hide resolved
tests/e2e/transaction/transactionSimulation.test.ts Outdated Show resolved Hide resolved
tests/e2e/transaction/transactionSimulation.test.ts Outdated Show resolved Hide resolved
@junkil-park junkil-park force-pushed the jpark/no-account-authenticator branch from 45d2d3d to adf489b Compare July 22, 2024 15:53
Copy link
Collaborator

@0xmaayan 0xmaayan left a comment

Choose a reason for hiding this comment

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

Let's address the PR comments, clean up the PR (lint and format errors) - then can do another final round

@junkil-park
Copy link
Contributor Author

junkil-park commented Jul 30, 2024

Did a first round

  • Please fix the linting errors - can run pnpm lint on the sdk root folder

Some are unavoidable, so I added eslint-disable-next-line for those cases.

  • When we have a property publicKey?:PublicKey it means the publicKey is of type PublicKey or undefined - please use this syntax

Done accordingly.

  • Please update CHANGELOG

Updated.

  • Also, tests are failing

They passed locally. It requires a custom localnet. Probably, this PR should wait until the aptos-core is ready for the new simulation enhancement feature?

Copy link
Collaborator

@0xmaayan 0xmaayan left a comment

Choose a reason for hiding this comment

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

whats the migration process? looks like we first need to have the feature on mainnet? or are we good with only on devnet/testnet?
Can we make sure tests are passing with the localnet on main branch before merging it in?

examples/typescript/local_node.ts Outdated Show resolved Hide resolved
src/api/transactionSubmission/simulate.ts Outdated Show resolved Hide resolved
src/transactions/authenticator/account.ts Show resolved Hide resolved
src/transactions/types.ts Show resolved Hide resolved
@junkil-park junkil-park force-pushed the jpark/no-account-authenticator branch 2 times, most recently from 6381bf8 to e1f7ca3 Compare August 13, 2024 07:16
@junkil-park junkil-park force-pushed the jpark/no-account-authenticator branch 5 times, most recently from a404a42 to fcc63fe Compare September 14, 2024 01:02
@gregnazario
Copy link
Contributor

I rebased and fixed the conflicts.

@gregnazario gregnazario force-pushed the jpark/no-account-authenticator branch from 73ad632 to 5fc34d5 Compare October 9, 2024 17:21
@junkil-park
Copy link
Contributor Author

I rebased and fixed the conflicts.

Thank you! We’re now waiting on the security review and the testnet/mainnet release before merging this PR.

@junkil-park junkil-park force-pushed the jpark/no-account-authenticator branch 3 times, most recently from e495b5c to d645837 Compare November 8, 2024 06:00
Simulation API Update: Allows users to simulate transactions without providing public keys by updating simulateTransaction to accept PublicKey | null instead of PublicKey. If null is provided, NoAccountAuthenticator is used as an authenticator.

Multisig V2 Example Update: The multisig v2 example (multisig_v2.ts) is updated to reflect the change in the multisig transaction simulation behavior. To pre-check the multisig payload before creation, an entry function payload simulation with the multisig account as the sender and 0x0 as the fee payer is used.
@junkil-park junkil-park merged commit a013116 into main Nov 13, 2024
8 checks passed
@junkil-park junkil-park deleted the jpark/no-account-authenticator branch November 13, 2024 00:12
junkil-park added a commit that referenced this pull request Nov 13, 2024
Includes the transaction simulation enhancement support:
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-92.md
* #467
@junkil-park junkil-park mentioned this pull request Nov 13, 2024
2 tasks
junkil-park added a commit that referenced this pull request Nov 13, 2024
Includes the transaction simulation enhancement support:

https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-92.md
Add the NoAccountAuthenticator variant #467
junkil-park added a commit that referenced this pull request Nov 13, 2024
Includes the transaction simulation enhancement support:

https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-92.md
Add the NoAccountAuthenticator variant #467
junkil-park added a commit to aptos-labs/developer-docs that referenced this pull request Nov 15, 2024
* Add the documentation for the transaction simulation enhancement

This PR adds the documentation for the change in aptos-labs/aptos-ts-sdk#467 (AIP-92: https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-92.md).

* Update apps/nextra/pages/en/build/sdks/ts-sdk/building-transactions/multi-agent-transactions.mdx

Co-authored-by: Greg Nazario <[email protected]>

* Update apps/nextra/pages/en/build/sdks/ts-sdk/building-transactions/simulating-transactions.mdx

Co-authored-by: Greg Nazario <[email protected]>

* Update apps/nextra/pages/en/build/sdks/ts-sdk/building-transactions/simulating-transactions.mdx

Co-authored-by: Greg Nazario <[email protected]>

* Update apps/nextra/pages/en/build/sdks/ts-sdk/building-transactions/simulating-transactions.mdx

Co-authored-by: Greg Nazario <[email protected]>

* Update apps/nextra/pages/en/build/sdks/ts-sdk/building-transactions/simulating-transactions.mdx

Co-authored-by: Greg Nazario <[email protected]>

* Update apps/nextra/pages/en/build/sdks/ts-sdk/building-transactions/simulating-transactions.mdx

Co-authored-by: Greg Nazario <[email protected]>

* Update multi-agent-transactions.mdx

---------

Co-authored-by: Greg Nazario <[email protected]>
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