tronprotocol/java-tron

More detailed results of the execution of the `CANCELALLUNFREEZEV2(0xdc)` opcode

yanghang8612 opened this issue · 1 comments

Rationale

When the system contract wallet/cancelallunfreezev2 is executed, we can distinguish the amount of bandwidth/energy/tronpower canceled in this cancellation operation respectively by the transaction execution result. However, for the CANCELALLUNFREEZEV2(0xdc) opcode in TVM, it only produces an internal transaction containing the overall canceled amount, and cannot distinguish the canceled amount of each of the three resources.

Implementation

Internal transaction is defined below:

message InternalTransaction {
  // internalTransaction identity, the root InternalTransaction hash
  // should equals to root transaction id.
  bytes hash = 1;
  // the one send trx (TBD: or token) via function
  bytes caller_address = 2;
  // the one recieve trx (TBD: or token) via function
  bytes transferTo_address = 3;
  message CallValueInfo {
    // trx (TBD: or token) value
    int64 callValue = 1;
    // TBD: tokenName, trx should be empty
    string tokenId = 2;
  }
  repeated CallValueInfo callValueInfo = 4;
  bytes note = 5;
  bool rejected = 6;
  string extra = 7;
}
  • Option A: Add three new types of internal transactions, like cancelAllUnfreezeV2ForBandwidth, cancelAllUnfreezeV2ForEnergy and cancelAllUnfreezeV2ForTronPower
  • Option B: Save the amount of three resource cancellations in the note field, the format should preferably be in json.

Discussions

Q: Does it need a hard fork?

Prefer Option B.
If it doesn't work well, it seems that changing to Option A can be very smooth based on Option B.