Skip to content

contract extend doesnt work with --wasm or --wasm-hash #1557

Closed

Description

@BlaineHeffron

What version are you using?

stellar 21.4.0 (v20.0.0-267-gb92725bdc3543c8796f5ebd4444ec277a175de05)
soroban-env 21.2.0 (8809852dcf8489f99407a5ceac12625ee3d14693)
soroban-env interface version 90194313216
stellar-xdr 21.2.0 (9bea881f2057e412fdbb98875841626bf77b4b88)
xdr curr (70180d5e8d9caee9e8645ed8a38c36a8cf403cd9)

What did you do?

I ran the command in the guide on extending contracts via their wasm or wasm hash:

stellar contract extend \
    --source S... \
    --network testnet \
    --wasm ../relative/path/to/soroban_contract.wasm \
    --ledgers-to-extend 535679 \
    --durability persistent

What did you expect to see?

success

What did you see instead?

stderr=```
thread \'main\' panicked at cmd/soroban-cli/src/commands/contract/extend.rs:134:43:
called `Option::unwrap()` on a `None` value

It panics when it doesn't find the --id argument. The issue is that extend seems to be written only to use a contract ID to find the contract. But it accepts the flattened key arguments which allows a wasm, wasm-hash or contract-id. So to fix the issue it needs to check for the presence of any and perform the proper ledger fetching logic depending on the one given. Or its argument list should only include a contract-id and not the wasm, wasm-hash option (and we will need to remove those guide entries). I'm not sure which is the intended behavior is but I'm assuming its the former given that there are guide entries indicating you can extend via wasm or wasm-hash: https://developers.stellar.org/docs/build/guides/cli/extend-contract-wasm

Activity

  1. added
    bug
    on Aug 21, 2024
  2. moved this to Backlog (Not Ready) in DevXon Aug 21, 2024
  3. janewang commented on Aug 21, 2024

    @janewang
    Contributor

    @BlaineHeffron To my knowledge, we can extend the contract's wasm code, the contract instance itself, and the ledger entries on the contract. So it probably shouldn't require a contract id always.

    https://developers.stellar.org/docs/build/guides/cli/extend-contract-instance

  4. moved this from Backlog (Not Ready) to Backlog (Ready for Design) in DevXon Aug 21, 2024
  5. moved this from Backlog (Ready for Design) to Todo (Ready for Dev) in DevXon Aug 27, 2024
  6. moved this from Todo (Ready for Dev) to Done in DevXon Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions