Get Neuron Id For Authenticated User

I also wondered: could you just let the “duplicate” proposals be submitted and filter them in the frontend? I.e., just take the oldest proposal with the same information into account in the frontend (so the newer ones never even influence what users see)?

Note thought that proposals still have a cost, so the “duplicate” ones will likely be rejected which measn that the submitter has to pay a fee. So not sure if this is nice for users.

Yeah that sounds terrible for users!

Ok, then let me suggest this:

// C-like Pseudocode
//        ^^^^^^^^^^

fn revalue(asset, up_or_down) {
  proposal = get_or_create_revalue_proposal(asset);
  vote(proposal, up_or_down);
}

fn get_or_create_revalue_proposal(asset) {
  if not asset.lock.acquire() {
    return err;
  }

  if is_there_revalue_proposal(asset) {
    asset.lock.release();
    return the existing proposal;
  }

  // No TOCTOU issue here, because asset.lock is being held.
  proposal = create_revalue_proposal(asset);

  asset.lock.release();
  return proposal;
}

This way of enforcing uniqueness does not involve the validator. As a result, the validator can remain nice and simple.

1 Like

Yes I did think about a lock, I will look at this as I think it might be the way to go.

As for the proposal fee for unsuccessful proposals, is it possible to have different fees for different types of proposals. I want to encourage player revaluations so ideally it would cost people nothing. Whereas the standard proposals should have the usual fee in place.

:+1:

Remember that a crash might occur while the lock is held. This is one of the issues that makes distributed systems “fraught with peril” :grimacing:

The issue being that my canister crashes, the asset is locked and doesn’t get released?

Could you explain the problem a little if possible?

Could I utilise the timer system to release locks at certain points?

@daniel-wong @Imuntaner

I think I get what to do. I’m fighting the governance design of the IC and I’m just going to redesign my app to fit the way you’ve set things up. I’m going to drop all the restrictions and I will just have those revaluation buttons raise a proposal. This will make neuron holders sure that a players value change is justified as it will cost them if people don’t vote for the revaluation. I’ll just add another view for the voting of the valuation proposals people have changed.

Thanks for all your help on this!

James