Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Feature/istanbul #3351

Merged
merged 109 commits into from
Aug 20, 2020
Merged

Feature/istanbul #3351

merged 109 commits into from
Aug 20, 2020

Conversation

dpneko
Copy link
Contributor

@dpneko dpneko commented Aug 19, 2020

What does this PR do?

Why are these changes required?

This PR has been tested by:

  • Unit Tests
  • Manual Testing

Follow up

Extra details

}
break;
}
case ALLOW_TVM_ASSET_ISSUE: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is another proposal called ALLOW_TVM_TRANSFER_TRC10.
Should this be called ALLOW_TVM_TRC10_ISSUE in proposal scope.


REWARDBALANCE(0xd8, 1, 1, OpCode.Tier.ExtTier),

ISSRCANDIDATE(0xd9, 1, 1, OpCode.Tier.ExtTier),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better call it ISWITNESS.
The code base has no sr candidate but witness candidate.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ISWITNESS will be used in future plan. We define it as a different meaning compare to this scenario.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It already introduces inconsistency.

accountCapsule.setInstance(accountCapsule.getInstance().toBuilder().build());
// spend 1024trx for assetissue, send to blackhole address
AccountCapsule bhAccountCapsule = repository.getAccount(repository.getBlackHoleAddress());
bhAccountCapsule.setBalance(Math.addExact(bhAccountCapsule.getBalance(), TOKEN_ISSUE_FEE));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TOKEN_ISSUE_FEE is not a constant. It's a chain parameter in dynamicProperty and is modified through proposals.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Will refine this code in next release due to code freezing :)

public DataWord isContract(DataWord address) {
ContractCapsule contract = getContractState()
.getContract(TransactionTrace.convertToTronAddress(address.getLast20Bytes()));
return contract != null ? new DataWord(1) : new DataWord(0);
}

public DataWord isSRCandidate(DataWord address) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be consistent with isContract(ISCONTRACT) opcode, you should use the name/OpCode/Solidity function name isWitness(ISWITNESS)`

  • Contract/Witness/Normal is the type code of AccountType
  • consistency across the whole TVM design really matters


ISSRCANDIDATE(0xd9, 1, 1, OpCode.Tier.ExtTier),

TOKENISSUE(0xda, 1, 1, Tier.HighTier),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since all other OpCodes are all verb-phrase, should this be ISSUETOKEN?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will consider to rename the opcode in next release due to code freezing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that if it is released, then It will never be changed.
So sad that your release plan is more important that code and consistency.

Copy link
Contributor

@taihaofu taihaofu Aug 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be changed. Not a hard fork case. As long as we keep the opcode hex value the same in the interpreter, it will not influence the transaction behavior and the solidity code. Just a naming issue.

Copy link
Contributor

@KI5FPL KI5FPL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor naming change required.
And corresponding changes should be made to tronprotocol/solidity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants