koinos / koinos/koinos-cli

[FEATURE]: Automatic contract re-registering

Open
#106 3 comments 0 reactions 0 assignees View on GitHub
enhancement task
Dominant language
Go
Stars
7
Forks
6
PR merge metrics
No merged PRs in 30d

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### New feature

Currently, if you're working with the CLI to `upload` and `register` a contract, it's not obvious what the behavior will be after re-uploading the contract.

```
> upload package.wasm package.abi
> address
XXX
> register package XXX
```

Running `package.do_something` at this point works as expected. But if I upload again to the same address...

```
> upload newpackage.wasm newpackage.abi
```

Will `package.do_something` automatically call the updated method? Autocomplete does not include `package.new_method`, so it seems like it's still referencing the old version. If I try to...

```
> register package XXX
```

...again, then I get an error because `package` is already registered. I have been working around this by registering `package1`, `package2`, etc. just so the behavior is obvious while developing. I propose the following...

```
> upload package.wasm package.abi
> address
XXX
> register package XXX
> package.do_something
done
> upload newpackage.wasm newpackage.abi
> package.do_something
Contract registered as `package` has been updated since you registered it, are you sure you want to continue?
[Y/n]
> Y
done
```

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by tracing the CLI paths for upload, register, contract calls, and autocomplete, then reproduce the command sequence in the issue after uploading a replacement contract. Done should make the existing alias recognize the updated contract, warn before continuing, and expose the new method without requiring a differently named registration.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.