Error decoding contract log using fuels-ts 0.94.6

Hi fuel team! i deployed contract using

forc="0.63.6"
fuel-core = "0.36.0"

I got this error tryin decode event log

 _FuelError: Log type with logId '12590297951544648000' doesn't exist in the ABI.
      at Interface.decodeLog (/Users/master/abi-checker/node_modules/@fuel-ts/abi-coder/src/Interface.ts:66:13)

logId ‘12590297951544648000’ is indeed not in contract abi, but there is a logid 12590297951544646752 and we can see it in explorer

Please help me solve this problem!

Hi @PaulZhemanov, sorry for the inconvenience. We’re currently investigating the issue.

Is the contract deployed on the testnet? If so, could you confirm that its ID is 0xc24ecaddd54cb04b88fb657da41da54e805aa2789654101dac7ede7716923e54?

Additionally, which function from the spark-market contract is triggering the log decode error?

@Torres-ssf hi!

we log deposit event

I think we need more memory store for this event on fuels-ts side

you can check this

thanks!

@PaulZhemanov, it seems the issue is due to using the latest contract ABI with an older deployed contract.

I encountered the same error you’re experiencing when executing the deposit function:

FuelError: Invalid u64 byte data size.

After analyzing the logged data, which is the DepositEvent struct, I noticed that the last modifications to this struct were made in this commit: ba9f781.

I built an earlier version of the Spark Market contract, prior to these changes, and used its ABI to connect to the deployed contract you’re working with. This allowed me to successfully execute the deposit call and decode its logs. Here’s the decoded data:

{
  amount: <BN: 0x2710>,
  asset: {
    bits: '0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07'
  },
  user: { Address: [Object] },
  liquid_base: <BN: 0x7596>, // from the old `DepositEvent` version
  liquid_quote: <BN: 0x0>    // from the old `DepositEvent` version
}

The fields liquid_base and liquid_quote indicate that this struct belongs to the previous DepositEvent version. Which was modified to this

To resolve the issue, you need to redeploy the latest version of the Spark Market contract.

@Torres-ssf
i use new deployed contract with struct balance and new generated abi of this contract

@PaulZhemanov Can you confirm for me what is the ID of the current contract that you are using?

It is 0xc24ecaddd54cb04b88fb657da41da54e805aa2789654101dac7ede7716923e54 ?

@Torres-ssf yes, i use this contract

abi for this contract

and you can see i use the same abi here

@PaulZhemanov I’ve created a repository that demonstrates the issue. It’s straightforward to set up and run the tests to verify that calling deposit with the old JSON ABI functions correctly.

The repository includes three tests:

  1. Old JSON ABI Test: Connects to the contract using the old JSON ABI and validates that the call works as expected, with the log being properly decoded.
  2. New JSON ABI Test: Connects to the contract using the new JSON ABI and verifies that the call fails with the error: FuelError: Invalid u64 byte data size.
  3. ABI Comparison Test: Fetches the most recent JSON ABI from the Spark Mark contract, compares it with the new JSON ABI used in Test 2, and confirms they are identical.

I am using the same contract ID as the one shown in the receipt you provided here, which is informed at the field id.

@Torres-ssf you are not using the new json abi

link to new json abi at the link above(1777 lines of code)

1 Like

@PaulZhemanov Has this been resolved now?

Could you mark the solution if so - thanks.

1 Like