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

txns of type NORMAL should not call contracts #241

Merged
merged 16 commits into from May 17, 2024

Conversation

kroggen
Copy link
Member

@kroggen kroggen commented Aug 11, 2023

These changes are intended to be implemented on hardfork V4:

  • Transactions with type NORMAL should not call smart contracts
  • Transactions with type TRANSFER can only interface with smart contracts on these conditions:
    • The amount must be greater than 0
    • The payload must be empty

To transfer native Aergo tokens to a smart contract for a function that is not named "default" or that requires arguments, we must use a transaction with type CALL

@kroggen kroggen added check hardfork Run sync test with the PR V4 To be released on hardfork V4 labels Aug 11, 2023
@kroggen
Copy link
Member Author

kroggen commented Aug 11, 2023

Tests to be added:

On hardfork_version >= 4

Should work:

  • Transfer Aergo to contract using TRANSFER type

Should fail:

  • Transfer Aergo to contract using TRANSFER type, contract without function "default"
  • Transfer Aergo to contract using TRANSFER type, contract function "default" not payable
  • Transfer Aergo to contract using TRANSFER type, payload not empty (hash)
  • Transfer Aergo to contract using TRANSFER type, payload not empty (JSON for call)
  • Transfer Aergo to contract using TRANSFER type, amount = 0

Then repeat the above using NORMAL type

On hardfork_version < 4

Should fail:

  • Transfer Aergo to contract using TRANSFER type, contract without function "default"
  • Transfer Aergo to contract using TRANSFER type, contract function "default" not payable
  • Transfer Aergo to contract using TRANSFER type, payload not empty (hash)

The same for NORMAL type

Should work:

  • Transfer Aergo to contract using TRANSFER type
  • Transfer Aergo to contract using TRANSFER type, payload not empty (JSON for call)
  • Transfer Aergo to contract using TRANSFER type, amount = 0

The same for NORMAL type

@kroggen kroggen changed the base branch from develop to topic/hardfork-v4 October 6, 2023 04:10
@kroggen kroggen force-pushed the topic/normal-txn-do-not-call-contract branch from e1e424d to 0bc2cc8 Compare October 6, 2023 04:28
@kroggen kroggen force-pushed the topic/normal-txn-do-not-call-contract branch from bd568d1 to 0bc2cc8 Compare October 17, 2023 09:10
@kroggen kroggen force-pushed the topic/normal-txn-do-not-call-contract branch from 09a876d to ccfc0c6 Compare October 17, 2023 13:54
@kroggen kroggen removed the check hardfork Run sync test with the PR label Nov 9, 2023
@hayarobi
Copy link
Member

@ultrafellen Do you agree with this policy?

Copy link
Member

@ultrafellen ultrafellen left a comment

Choose a reason for hiding this comment

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

I'm not sure about the code, but I agree with the policy.

Copy link
Member

@hayarobi hayarobi left a comment

Choose a reason for hiding this comment

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

lgtm

@kroggen kroggen merged commit 9b24dcb into topic/hardfork-v4 May 17, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
V4 To be released on hardfork V4
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants