Skip to content

Conversation

@michavie
Copy link
Contributor

@michavie michavie commented May 4, 2025

Test incorrectly assumes that contract results are returned in hex – it's base64 instead.

Quick debugging insight showcasing the invalid base64 <> hex comparison:

Screenshot 2025-05-04 at 11 44 05 PM


for (const result of transactionOnNetwork.smartContractResults) {
const matchesCriteriaOnData = result.data.toString().startsWith(ARGUMENTS_SEPARATOR);
const matchesCriteriaOnData = Buffer.from(result.data).toString("utf-8").startsWith(ARGUMENTS_SEPARATOR);
Copy link
Contributor

Choose a reason for hiding this comment

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

nonce: 7n,
function: "getUltimateAnswer",
smartContractResults: [new SmartContractResult({ data: Buffer.from("@6f6b@2a") })],
smartContractResults: [new SmartContractResult({ data: Buffer.from("QDZmNmJAMmE=", "base64") })],
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the inconsistencies between API and Proxy are not yet reconciled at the SDK level, thus a further fix is needed.

On proxy, it's an UTF-8 string (it's sub-components being hex-encoded):

On API, it's a base64-encoded string:

Good catch 🎉

We'll discuss this a bit internally, then come back.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, I think we can approve this PR, since there's no change in the implementation with respect to this issue - there's only the fix in smartContractTransactionsOutcomeParser.ts. And we can handle the Proxy - API inconsistency in a separate PR.

@danielailie danielailie merged commit d0a9791 into multiversx:main May 5, 2025
2 checks passed
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.

3 participants