-
Notifications
You must be signed in to change notification settings - Fork 64
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
Error in ensureDomainExistence function: "Decode data for discriminant 85 is undefined" #126
Comments
Youssef also reported a decoded error: It was displayed by modifying a file: Modified code: async request(query, params) {
const scope = createScope();
const { createHash } = useCryptoAssertive();
const url = this.forceGetApiURL();
const accountId = this.forceGetAccountId();
const keyPair = this.forceGetKeyPair();
const payload = QueryPayload({
query,
account_id: accountId,
timestamp_ms: BigInt(Date.now()),
filter: params?.filter ?? PredicateBox('Raw', Predicate('Pass')),
});
try {
let queryBytes,queryString;
scope.run(() => {
const payloadHash = collect(createHash(QueryPayload.toBuffer(payload)));
const signature = makeSignature(keyPair, payloadHash.bytes());
queryString = VersionedSignedQueryRequest('V1', SignedQueryRequest({ payload, signature }))
console.log(SignedQueryRequest({ payload, signature }))
queryBytes = VersionedSignedQueryRequest.toBuffer(VersionedSignedQueryRequest('V1', SignedQueryRequest({ payload, signature })));
});
const response = await this.forceGetFetch()(url + ENDPOINT_QUERY, {
method: 'POST',
body: queryBytes,
}).then();
/* ADDED BY YOUSSEF MOHAMMAD TO DECODE RUST ERROR MESSAGE */
console.log(await response.text())
/* */
const buffer = await response.arrayBuffer();
const decoder = new TextDecoder("utf-8");
console.log("QS",queryBytes, queryBytes.length, decoder.decode(queryBytes))
const bytes = new Uint8Array(buffer);
fs.writeFileSync('./iroha-query.bin',queryBytes)
if (response.status === 200) {
// OK
const value = VersionedPaginatedQueryResult.fromBuffer(bytes).as('V1');
return Enum.variant('Ok', value);
}
else {
// ERROR
try {
const error = QueryError.fromBuffer(bytes);
return Enum.variant('Err', error);
} catch(e) {
const decoder = new TextDecoder("utf-8");
//throw new Error(decoder.decode(bytes));
return decoder.decode(bytes);
}
}
}
finally {
scope.free();
}
} |
@6r1d, please mention me directly and add In general, I think it is a versioning issue. I am not sure that |
@6r1d, I am likely to close the issue due to its irrelevance. |
Sure, but hopefully it will not repeat. I am not sure personally, so it would help if you explain a bit. |
I think it is simply a compatibility issue. However, I think it might be useful to implement this: |
Today, Youssef Mohammad reported an error occuring with Iroha-JS in Iroha Telegram.
Log
Details reported:
iroha2-stable
brancheec85ce9
@iroha2/client
ver. 2.0.2uname -a
output: Linux Hyper 5.4.0-125-generic Refactor crypto wasm #141-Ubuntu SMP Wed Aug 10 13:42:03 UTC 2022 x86_64 x86_64 x86_64 GNU/LinuxThe text was updated successfully, but these errors were encountered: