Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Open
yanghang8612 opened this issue Oct 11, 2023 · 3 comments

Comments

@yanghang8612
Copy link
Contributor

yanghang8612 commented Oct 11, 2023

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 extra field, the format should preferably be in json.

Discussions

Q: Does it need a hard fork?

@tomatoishealthy
Copy link
Contributor

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

@yanghang8612
Copy link
Contributor Author

yanghang8612 commented Feb 28, 2024

We will go with option B.
The change is expected to be included in the v4.7.5.

@yanghang8612
Copy link
Contributor Author

We have decided to include this improvement in the next upgrade. Feel free to discuss it.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants