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

FatePrefixError when trying to decode callData for Tokaen.org transactions #277

Closed
martinkaintas opened this issue Jun 20, 2024 · 5 comments · Fixed by #279
Closed

FatePrefixError when trying to decode callData for Tokaen.org transactions #277

martinkaintas opened this issue Jun 20, 2024 · 5 comments · Fixed by #279

Comments

@martinkaintas
Copy link

When trying to decode callData for Tokaen.org transaction I'm getting a FatePrefixError: Invalid FATE prefix: 0b10001111 error.

The error happens at this line in the Superhero Wallet when trying to execute buy here

Screenshot 2024-06-20 144602

@dincho
Copy link
Member

dincho commented Jun 21, 2024

@davidyuk can you help here getting more lib specific reproduction steps?

@davidyuk
Copy link
Member

davidyuk commented Jun 24, 2024

Sure!

import { BytecodeContractCallEncoder } from './src/main.js';

const response = await fetch(`https://testnet.aeternity.io/v3/contracts/ct_7NTLakadL7cQ4X3EcXYmec5p3QYgAEA6DDqYBMwH5ZZ2U2k5L/code`);
const { bytecode } = await response.json();

const bytecodeContractCallEncoder = new BytecodeContractCallEncoder(bytecode);
const value = bytecodeContractCallEncoder.decodeCall('cb_KxEV1igBG2+IDeC2s6dj/8DKjvSn'); // copied from SW confirmation window
console.log(value);

0b10001111 introduced in aeternity/aebytecode#94

@davidyuk
Copy link
Member

davidyuk commented Jul 9, 2024

More concrete reproduction

import { BytecodeContractCallEncoder } from './src/main.js';

const bytecodeContractCallEncoder = new BytecodeContractCallEncoder(
    'cb_+NBGA6D+x/gUE1YYLmvMJDIzJK2ZFJyOM5sXubwJy+9TVt/ib8C4n7iE/kTWRB8ANwA3ABoOgj8BAz/+m66dXgA3AQdHAgwBAAwDAAwDNwEHDAOPbxX4U0YDoJg7mklGIIWH49uiZBksC7yUEVO88y4D7lTd8+T4TMK2wKOS/kTWRB8ANwEHNwAaBoIAAQM/jC8BEUTWRB8RaW5pdIIvAIk4LjAuMC1yYzEAowAAlS8CEUTWRB8RaW5pdBGbrp1eDW5ld4IvAIk4LjAuMC1yYzEAaSb5ng==',
);

console.log(bytecodeContractCallEncoder._internalEncoder._typeResolver._bytecode)
contract IntHolder =
  type state = int
  entrypoint init(x) = x
  
main contract IntHolderFactory =
  stateful entrypoint new(x : int) : IntHolder =
    Chain.create(x)

@dincho
Copy link
Member

dincho commented Jul 9, 2024

Thanks @davidyuk

@davidyuk
Copy link
Member

I will draft a PR today/tomorrow

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 a pull request may close this issue.

3 participants