Cannot use Bytes type properly

Open
#436 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust
Domain
cli

Research direction

Reproduce the soroban contract invoke call against the initialize entry point shown in token/src/contract.rs, comparing the --name and --symbol Bytes arguments. Trace the CLI's argument parsing for these values; done when both hexadecimal values are accepted and the contract initialization transaction succeeds.

Written by the indexing model from the issue text.

Description

bug
What version are you using?

0.6.0

What did you do?

I have deployed an instance of the token interface on futurenet, and I'm trying to call initialize with this fn sig. The last two args are Bytes that I believe are supposed to be the hex string representation of the value. I am trying the following and am wondering why it wouldn't be able to parse the --symbol arg but had no problem with the --name arg, both are hex strings of the value that I want to pass for name and symbol.

$ soroban contract invoke \
    --id 6885ed6b904a6cead909c99cdc482ffa4a74c181803f678cacbfbe831e9efac6 \
    --secret-key S... \
    --rpc-url http://localhost:8000/soroban/rpc \
    --network-passphrase 'Test SDF Future Network ; October 2022' \
    --fn initialize \
    -- \
    --admin GCGORBD5DB4JDIKVIA536CJE3EWMWZ6KBUBWZWRQM7Y3NHFRCLOKYVAL \
    --decimal 7 \
    --name 467265696768746572205465737420546f6b656e \
    --symbol 465454
error: parsing argument symbol: invalid type: integer `465454`, expected string or map
What did you expect to see?

A successful transaction for initializing this contract

What did you see instead?

cli cannot parse the hex string provided for the bytes arg called symbol, it seems to be fine with the hex string for bytes for the arg called name.

Dominant language
Rust
Stars
123
Forks
141
Avg merge
2d 21h
Merged PRs (30d)
17

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from stellar/stellar-cli

All issues in stellar/stellar-cli

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.