Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 27 additions & 71 deletions .github/ISSUE_TEMPLATE/request-a-feature.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,85 +7,41 @@ assignees: ''

---

<!--
Thank you for contributing to java-tron!
Please provide as much detail as possible to help us evaluate your feature request.
-->

## Problem Statement

<!-- Describe the problem this feature solves, the context/motivation, and who would benefit -->
# Summary
<!-- Provide a concise description of the problem and the proposed solution.-->

## Proposed Solution
# Problem
### Motivation
<!-- Describe the context or motivation if necessary. -->

<!-- Describe your proposed solution in detail -->
### Current State
<!-- Describe the current behavior of the system. -->

### Specification
### Limitations or Risks
<!-- Explain the limitations, risks, or inefficiencies. -->

<!-- Provide technical specifications or requirements -->
# Proposed Solution

**API Changes** (if applicable)
<!-- Describe any new or modified APIs -->
### Proposed Design
<!-- Describe the proposed solution at a high level. Implementation details are optional but encouraged if relevant.-->

**Configuration Changes** (if applicable)
<!-- Describe any new configuration options -->
### Key Changes
<!-- List the main areas affected by this proposal, such as Module(s), Configuration and API. -->

**Protocol Changes** (if applicable)
<!-- Describe any changes to the TRON protocol -->
# Impact
<!-- Assess the expected impact of this change, such as Security, Stability, Performance, Developer Experience -->

## Scope of Impact

<!-- Select the system components that will be affected by this feature:
- Core protocol
- API/RPC
- Database
- Network layer
- Smart contracts
- Documentation
- Others, please specify
# Compatibility
<!--
* Breaking Change: Yes / No
* Default Behavior Change:
* Migration Required:
Provide details if any of the above is applicable.
-->

**Breaking Changes**
<!-- Will this feature introduce any breaking changes? -->

**Backward Compatibility**
<!-- How will this feature maintain backward compatibility? -->

## Implementation

**Do you have ideas regarding the implementation?**
<!-- Share any technical approaches or implementation details -->

**Are you willing to implement this feature?**
<!-- Let us know if you'd like to contribute the implementation -->

**Estimated Complexity**
<!-- Your assessment of implementation complexity, choose among
- Low (minor changes)
- Medium (moderate changes)
- High (significant changes)
- Unknown
-->

## Testing Strategy

<!-- How should this feature be tested? -->

**Test Scenarios**

**Performance Considerations**
<!-- Describe any performance implications -->

## Alternatives Considered (Optional)

<!-- Describe any alternative solutions or features you've considered -->

## Additional Context (Optional)

<!-- Add any other context, mockups, diagrams, or examples -->

**Related Issues/PRs**
<!-- Link to any related issues or pull requests -->
# References (Optional)
<!-- TIPs, papers, related issues, prior art -->

**References**
<!-- Link to any relevant documentation, specifications, or discussions -->
# Additional Notes
- Do you have ideas regarding implementation? Yes / No
- Are you willing to implement this feature? Yes / No
6 changes: 4 additions & 2 deletions .github/workflows/pr-reviewer.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
name: Auto Assign Reviewers

on:
pull_request:
pull_request_target:
branches: [ 'develop', 'release_**' ]
types: [ opened, edited, reopened ]

jobs:
assign-reviewers:
name: Assign Reviewers by Scope
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write

steps:
- name: Assign reviewers based on PR title scope
Expand Down
25 changes: 25 additions & 0 deletions actuator/src/main/java/org/tron/core/vm/EnergyCost.java
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,27 @@ public static long getVoteWitnessCost2(Program program) {
? amountArrayMemoryNeeded : witnessArrayMemoryNeeded), 0, Op.VOTEWITNESS);
}

public static long getVoteWitnessCost3(Program program) {
Stack stack = program.getStack();
long oldMemSize = program.getMemSize();
BigInteger amountArrayLength = stack.get(stack.size() - 1).value();
BigInteger amountArrayOffset = stack.get(stack.size() - 2).value();
BigInteger witnessArrayLength = stack.get(stack.size() - 3).value();
BigInteger witnessArrayOffset = stack.get(stack.size() - 4).value();

BigInteger wordSize = BigInteger.valueOf(DataWord.WORD_SIZE);

BigInteger amountArraySize = amountArrayLength.multiply(wordSize).add(wordSize);
BigInteger amountArrayMemoryNeeded = memNeeded(amountArrayOffset, amountArraySize);

BigInteger witnessArraySize = witnessArrayLength.multiply(wordSize).add(wordSize);
BigInteger witnessArrayMemoryNeeded = memNeeded(witnessArrayOffset, witnessArraySize);

return VOTE_WITNESS + calcMemEnergy(oldMemSize,
(amountArrayMemoryNeeded.compareTo(witnessArrayMemoryNeeded) > 0
? amountArrayMemoryNeeded : witnessArrayMemoryNeeded), 0, Op.VOTEWITNESS);
}

public static long getWithdrawRewardCost(Program ignored) {
return WITHDRAW_REWARD;
}
Expand Down Expand Up @@ -550,6 +571,10 @@ private static BigInteger memNeeded(DataWord offset, DataWord size) {
return size.isZero() ? BigInteger.ZERO : offset.value().add(size.value());
}

private static BigInteger memNeeded(BigInteger offset, BigInteger size) {
return size.equals(BigInteger.ZERO) ? BigInteger.ZERO : offset.add(size);
}

private static boolean isDeadAccount(Program program, DataWord address) {
return program.getContractState().getAccount(address.toTronAddress()) == null;
}
Expand Down
12 changes: 12 additions & 0 deletions actuator/src/main/java/org/tron/core/vm/OperationRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ public static JumpTable getTable() {
adjustSelfdestruct(table);
}

if (VMConfig.allowTvmOsaka()) {
adjustVoteWitnessCost(table);
}

return table;
}

Expand Down Expand Up @@ -706,4 +710,12 @@ public static void adjustSelfdestruct(JumpTable table) {
EnergyCost::getSuicideCost3,
OperationActions::suicideAction2));
}

public static void adjustVoteWitnessCost(JumpTable table) {
table.set(new Operation(
Op.VOTEWITNESS, 4, 1,
EnergyCost::getVoteWitnessCost3,
OperationActions::voteWitnessAction,
VMConfig::allowTvmVote));
}
}
Loading
Loading