Open mohitxskull opened 1 year ago
Thank you for the detailed description and examples @servedbyskull !
The transaction data appears to be serialized properly in near-api-js
since I can deserialize the transaction before it's sent to get the original input. I think the next step would be to try this in the JS and Rust CLIs to see if the behavior is any different there - I'd expect the JS CLI to throw the same error but the Rust CLI uses a different serialization wrapper AFAIK.
Thank you for the detailed description and examples @servedbyskull !
The transaction data appears to be serialized properly in
near-api-js
since I can deserialize the transaction before it's sent to get the original input. I think the next step would be to try this in the JS and Rust CLIs to see if the behavior is any different there - I'd expect the JS CLI to throw the same error but the Rust CLI uses a different serialization wrapper AFAIK.
Tried with JS Cli, same error
Tried with Rust Cli, same error
Looking up that Invalid last symbol
text I see various Rust libraries with the same code around this error message (disclaimer: I don't speak Rust or know whether transaction serialization relies on this same logic):
/// The last non-padding input symbol's encoded 6 bits have nonzero bits that will be discarded.
/// This is indicative of corrupted or truncated Base64.
/// Unlike InvalidByte, which reports symbols that aren't in the alphabet, this error is for
/// symbols that are in the alphabet but represent nonsensical encodings.
InvalidLastSymbol(usize, u8),
...
DecodeError::InvalidLastSymbol(index, byte) => {
write!(f, "Invalid last symbol {}, offset {}.", byte, index)
}
It's interesting that the "last symbol" byte mentioned in the error in your example code is 51
but in the CLI examples it's 117
. I can't seem to get a value other than 51
by changing the parameters in the example repo so I'm not sure what could account for the disparity there.
This isn't an issue specific to near-api-js
but I'm not sure where it would be best transferred. I can keep the issue open until I have a better place to put it but in the meantime I would try DevRel Office Hours or Discord - they should know who to escalate your issue to.
Any update?
Did you follow up with DevRel or on Discord?
Prerequisites
near-api-js
.Description
i have an function on a smart contract which accepts an argument
Vec<TokenMetadata>
from mynode.js
backend i am sending an array, and i am getting an errorsayingExecutionError: Smart contract panicked: panicked at 'Failed to deserialize input from JSON.: Error("Invalid last symbol 51, offset 29.", line: 1, column: 185)', nft/src/lib.rs:91:1
Reproducible demo
https://github.com/servedbyskull/near-api-js-error
Steps to reproduce
Expected behavior
Should run perfectly
Actual behavior
Throwed an error
Your environment
Self-service