FuelLabs / fuels-ts

Fuel Network Typescript SDK
https://docs.fuel.network/docs/fuels-ts/
Apache License 2.0
44.1k stars 1.34k forks source link

Scripts are not working, getting error "The transaction reverted with an unknown reason: 123" #2284

Closed nadiia-balaian closed 5 months ago

nadiia-balaian commented 5 months ago

What version of fuels-ts are you using?

82

Steps to Reproduce

Create instance of the script and try to call its methods.

We created a script in rust sdk. Then I try to use them


const scriptProxy = new Script(
    ScriptProxyAbiBytes,
    ScriptProxyAbi__factory.abi,
    options.wallet,
  );

const tx = await scriptProxy.functions
      .main(
        { WithdrawCollateral: withdrawCollateralInput },
        {
          value: new Address(BETA_CONTRACT_ADDRESSES.proxy.fuel).toB256(),
        },
        updateFee,
        priceFeedIds,
        updateData,
      )
      .callParams({ forward })
      .txParams({ gasPrice: 1 })

const { gasUsed: gasValue } = await tx.getTransactionCost();
const res = await tx.txParams({ gasLimit: gasValue }).call();

We tested script methods in rust sdk and there is no problems with that.

When I try to call script methods inside ts sdk I got an error

Screenshot 2024-05-10 at 12 49 19

Expected Behavior

Transaction is successfully sent

Actual Behavior

Error "The transaction reverted with an unknown reason: 123"

Torres-ssf commented 5 months ago

@nadiia-balaian the revert reason 123 is defined within Sway here

And it seems it is only being used here

This error happens when a contract was called with a method unknown for that contract

nadiia-balaian commented 5 months ago

We found the root cause of the issue – it was an outdated Pyth contract and ABI on our side. Thanks for your assistance with this