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

[Bug] Failing to simulate publish_package_txn, but sending tx works. #14871

Open
KodamaXYZ opened this issue Oct 4, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@KodamaXYZ
Copy link

KodamaXYZ commented Oct 4, 2024

🐛 Bug

Hi team, I am trying to build a platform for contract deployment allowing users to easily deploy contracts.
while developing I noticed that when publishing a contract without simulation it works, but when I prompt my user's wallets they automatically simulate the tx offered resulting in failed a simulation preventing them to deploy the package from my frontend.

To reproduce

I kinda followed the steps suggested in your repo:
https://github.com/aptos-labs/aptos-ts-sdk/blob/1ceef3449781d56cbefa8d4350808cfc385d233b/examples/typescript/utils.ts#L42

const { metadataBytes, byteCode } = getPackageBytesToPublish(
        package_json_name,
      );
      
// building a publish package tx.
 const transaction = await aptos.publishPackageTransaction({
        account: acc.accountAddress,
        metadataBytes,
        moduleBytecode: byteCode,
      });

let simm = await aptos.transaction.simulate.simple({signerPublicKey: acc.publicKey, transaction: transaction})

https://api.mainnet.aptoslabs.com/v1/transactions/simulate (trace_id:d86821f11ad105c53d01fb9554404edb) failed with:

{"message":"Failed to convert transaction data from storage: Module ModuleId { address: b5e06093d4af611328f9db6c00df4724a44d123404e1595118fe64e564c55054, name: Identifier(\"Test\") } can't be found","error_code":"internal_error","vm_error_code":null}

Expected Behavior

Should pass, as sending this tx works. (even if simualtion fails)

System information

all latest, aptos cli - latest, working with mainnet. etc..

Please complete the following information:

  • Aptos Core Version - aptos-node-v1.19.1
  • Rust Version - not relevant.
  • Computer OS - ubuntu 20.

Additional Context:
It seems to me like the Simulation is not going through the same flow as actually performing the tx.
There must be a way to publish transactions with simulation.
let me know if you need additional information.

@KodamaXYZ KodamaXYZ added the bug Something isn't working label Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant