slimcoin-project / pacli

Simple CLI PeerAssets client (extended version).
GNU General Public License v3.0
0 stars 0 forks source link

donation list DECK -m testing #113

Open buhtignew opened 1 month ago

buhtignew commented 1 month ago

In agreement to the Usage mode mentioned in the donation list -h I've run donation list a2459e054ce0f600c90be458915af6bad36a6863a0ce0e33ab76086b514f765a -m, donation list 3369f3eb703656c0b46b613dcfb4df78fc05657a0b75f44551634de6321d9d9c -m and donation list 0b3816628374d24078c741251f712b7f6af1c6f82ff7ddce083c20a58fcc2bc1 -m for all the PoD tokens from my token list -p output but each time I've got the following error:

  File "~/.local/bin/pacli", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "~/.local/lib/python3.12/site-packages/pacli/__main__.py", line 479, in main
    fire.Fire({
  File "~/.local/lib/python3.12/site-packages/fire/core.py", line 143, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/lib/python3.12/site-packages/fire/core.py", line 477, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
                                ^^^^^^^^^^^^^^^^^^^^
  File "~/.local/lib/python3.12/site-packages/fire/core.py", line 693, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/lib/python3.12/site-packages/pacli/dt_classes.py", line 1010, in list
    return ei.run_command(dc.show_donations_by_address, deckid, examine_address, mode=mode)
                                                                                      ^^^^
UnboundLocalError: cannot access local variable 'mode' where it is not associated with a value
d5000 commented 3 weeks ago

Fixed in commit 5a37a0b.

buhtignew commented 3 weeks ago

Everything seems to work as expected, the only strange thing I'm seeing is the output of donation list 0b3816628374d24078c741251f712b7f6af1c6f82ff7ddce083c20a58fcc2bc1 -m command:

'Donations realized from address: mixcqdAy4aFtuBV7uRebqBTjiFWCcS4UEp'

        General error raised by PeerAssets. Check if your input is correct.

        If you gave a deck as an argument, a possible reason for this error is that you need to initialize the deck.

        To initialize the default decks, use:

        pacli deck init

        To initialize a single deck, use:

        pacli deck init DECKID

I've tried with donation list 0b3816628374d24078c741251f712b7f6af1c6f82ff7ddce083c20a58fcc2bc1 -m -d, but the output hasn't changed.

d5000 commented 3 weeks ago

I can't reproduce the error.

I saw that I had forgot the debug mode for one of the branches of this command. I have now added a debug mode. Can you repeat the command which led to the error (with -d of course) with the updated code?

I also added the --wallet or -w option for the -m branch without -p. This was an easy addition and already in my TODO list. So now it's possible to see all donations from the wallet with one command, regardless of the proposal, so I consider it an important improvement.

Commit: 63f387e

buhtignew commented 3 weeks ago

I consider it an important improvement.

It is indeed!

I saw that I had forgot the debug mode for one of the branches of this command. I have now added a debug mode. Can you repeat the command which led to the error (with -d of course) with the updated code?

The error hasn't gone away on my side. However, I think I've got the meaning of this message. The deck wasn't initialized. Maybe we should decide whether to provide the same output for the decks that are not initialized as for those initialized or to not provide any output and to throw the error.

I also added the --wallet or -w option for the -m branch without -p

This works as expected.

d5000 commented 2 weeks ago

Well, if the error isn't gone, could you repeat the command with -d please? As I wrote, I can't reproduce it myself.

buhtignew commented 4 days ago

Here is the output of the donation list 0b3816628374d24078c741251f712b7f6af1c6f82ff7ddce083c20a58fcc2bc1 -m command:

'Donations realized from address: msAzW8dLyCNhnashwThAo2rUNKBycqt7yv'

        General error raised by PeerAssets. Check if your input is correct.

        If you gave a deck as an argument, a possible reason for this error is that you need to initialize the deck.

        To initialize the default decks, use:

        pacli deck init

        To initialize a single deck, use:

        pacli deck init DECKID

And here is the output of the donation list 0b3816628374d24078c741251f712b7f6af1c6f82ff7ddce083c20a58fcc2bc1 -m -d command:

'Donations realized from address: msAzW8dLyCNhnashwThAo2rUNKBycqt7yv'

        General error raised by PeerAssets. Check if your input is correct.

        If you gave a deck as an argument, a possible reason for this error is that you need to initialize the deck.

        To initialize the default decks, use:

        pacli deck init

        To initialize a single deck, use:

        pacli deck init DECKID

Traceback (most recent call last):
  File "~/.local/bin/pacli", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "~/.local/lib/python3.12/site-packages/pacli/__main__.py", line 479, in main
    fire.Fire({
  File "~/.local/lib/python3.12/site-packages/fire/core.py", line 143, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/lib/python3.12/site-packages/fire/core.py", line 477, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
                                ^^^^^^^^^^^^^^^^^^^^
  File "~/.local/lib/python3.12/site-packages/fire/core.py", line 693, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/lib/python3.12/site-packages/pacli/dt_classes.py", line 1019, in list
    return ei.run_command(dc.show_donations_by_address, deckid, examine_address, wallet=wallet, mode=mode, debug=debug)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/lib/python3.12/site-packages/pacli/extended_interface.py", line 33, in run_command
    result = c(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^
  File "~/.local/lib/python3.12/site-packages/pacli/dt_commands.py", line 74, in show_donations_by_address
    pst = dmu.get_parser_state(provider, deck, force_continue=True, force_dstates=True)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/lib/python3.12/site-packages/pypeerassets/at/dt_misc_utils.py", line 221, in get_parser_state
    unfiltered_cards = list((card for batch in pa.get_card_bundles(provider, deck) for card in batch))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/lib/python3.12/site-packages/pypeerassets/at/dt_misc_utils.py", line 221, in <genexpr>
    unfiltered_cards = list((card for batch in pa.get_card_bundles(provider, deck) for card in batch))
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/lib/python3.12/site-packages/pypeerassets/__main__.py", line 202, in get_card_bundles
    for result in th.map(card_bundle_parser, bundles):
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/concurrent/futures/_base.py", line 608, in map
    fs = [self.submit(fn, *args) for args in zip(*iterables)]
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/lib/python3.12/site-packages/pypeerassets/__main__.py", line 193, in <genexpr>
    return (card_bundler(provider, deck, i) for i in raw_txns)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/lib/python3.12/site-packages/pypeerassets/__main__.py", line 158, in card_bundler
    sender=find_tx_sender(provider, tx),
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/lib/python3.12/site-packages/pypeerassets/pautils.py", line 55, in find_tx_sender
    txid = vin["txid"]
           ~~~^^^^^^^^
KeyError: 'txid'

(my main address right now is msAzW8dLyCNhnashwThAo2rUNKBycqt7yv).

However as I wrote above, I wouldn't call the message I'm getting as wrong - it's rather correct since the deck 0b3816628374d24078c741251f712b7f6af1c6f82ff7ddce083c20a58fcc2bc1 isn't initialized on my side. The only thing to decide here (IMO) is whether we should allow people listing donations of the not initialized decks or not, since the command seems to make the work of searching for the donations released for the deck and then outputs the message that the deck is not initialized. Maybe we should check whether the deck is initialized or not before any work is done. Or as alternative we can let people searching for donations released for the not initialized decks (which is a bit more astonishing) avoiding in such cases making any check whether the deck is initialized or not.