sunshine-protocol / sunshine

Governance + Bounty Platform
Other
42 stars 16 forks source link

Listing Bounties Shows Wrong BountyID. #153

Closed shekohex closed 4 years ago

shekohex commented 4 years ago

What is wrong?

When I try to list open bounties using Sunshine CLI shows big ids that seem to be not correct.

For example, a BountyId that is 12116433537164092995!

Steps to Reproduce

  1. Using Sunshine CLI (the master branch)

  2. Run a Clean node.

    $ cargo run --bin sunshine-node -- purge-chain --dev
  3. Run the Node in dev mode locally with RPC open.

    $ cargo run --bin sunshine-node -- --dev --ws-external --rpc-cors all
  4. Run the CLI and Create your own Key.

    $ cargo run --bin sunshine-cli -- key set
  5. Once you have an account created (and minted), List Open Bounties.

    $ cargo run -q --bin sunshine-cli -- bounty get-open-bounties 0

    you should see

    No open bounties above the passed input minimum balance

    since there is none, let's create one:

  6. Create a new Bounty

    $ cargo run -q --bin sunshine-cli -- bounty post-bounty sunshine-protocol sunshine-bounty 108 1000

    This will create a bounty for #108

    Depositer with AccountId 5H8Wjs3WAiB1BYd1jwRHwkL7i8VPCpeRcwFM8kyaBe1Gvo6T posted new BountyId 1, Balance 1000

Notice the BountyID.

  1. List Open bounties again
    $ cargo run -q --bin sunshine-cli -- bounty get-open-bounties 0

    and you get a wrong IDs

    Live BountyID 12116433537164092995 has total available balance 1000

    BTW, if you created a new Bounty it will get a new ID of 2 but when you list bounties it will get the same long ID 12116433537164092995

4meta5 commented 4 years ago

Ok, I reproduced in client tests

➜  client git:(fix-node-test-client) cart --release
   Compiling sunshine-bounty-client v0.2.0 (/Users/4meta5/sunshine-protocol/sunshine-node/client/client)
   Compiling test-client v0.1.0 (/Users/4meta5/sunshine-protocol/sunshine-node/bin/client)
    Finished release [optimized] target(s) in 45.74s
     Running /Users/4meta5/sunshine-protocol/sunshine-node/target/release/deps/sunshine_bounty_client-c6982707b32b4a11

running 5 tests
test org::tests::simple_test ... ok
test bounty::tests::simple_test ... ok
test bounty::tests::post_bounty_test ... ok
test org::tests::register_flat_org_test ... ok
test bounty::tests::get_bounties_test ... FAILED

failures:

---- bounty::tests::get_bounties_test stdout ----
thread 'bounty::tests::get_bounties_test' panicked at 'assertion failed: `(left == right)`
  left: `12116433537164092995`,
 right: `1`', client/client/src/bounty/mod.rs:268:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace