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

feat: Airdrops with treasury and custom fee receivers #14455

Conversation

vtronkov
Copy link
Contributor

@vtronkov vtronkov commented Jul 29, 2024

Description:

  • When the receiver is a treasury account or custom fee collector we want to skip the custom fee validation because these users are exempt from paying them.
  • We also exempt users from paying if the allCollectorsExempt flag is true and the receiver is a fee collector to a token from the same type

Related issue(s):

Fixes #14423
Fixes #14443
Fixes #14479
Fixes #14485

vtronkov added 2 commits July 29, 2024 17:35
… the custom fee collector

Signed-off-by: Valentin Tronkov <99957253+vtronkov@users.noreply.github.com>
Signed-off-by: Valentin Tronkov <99957253+vtronkov@users.noreply.github.com>
Copy link
Contributor

@povolev15 povolev15 left a comment

Choose a reason for hiding this comment

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

LGTM TY @vtronkov

@povolev15
Copy link
Contributor

please rerun spotless

Signed-off-by: Valentin Tronkov <99957253+vtronkov@users.noreply.github.com>
@vtronkov
Copy link
Contributor Author

please rerun spotless

Oops. Done :)

Copy link
Member

@david-bakin-sl david-bakin-sl left a comment

Choose a reason for hiding this comment

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

Should have been a unit test that covered this aspect of handle that, now, would fail unless fixed. Sorry I missed that earlier. Not too late to add unit tests to TokenAirdropHandlerTest. (Especially if refactored according to comments below.)

boolean shouldExecuteCryptoTransfer = false;
final var transferListBuilder = TokenTransferList.newBuilder().token(tokenId);

// process fungible token transfers if any
if (!xfers.transfers().isEmpty()) {
for (var transfer : xfers.transfers()) {
Copy link
Member

Choose a reason for hiding this comment

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

Consider moving this entire loop into a method - or the body of the loop (or both). Would make it possible to unit test.

Same at L222-227 for nfts.

This method handle is incredibly complex - far too complex for reasonable testing. THis code here is a loop in a conditional in a loop. 140 lines in one method ... not a good idea.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, but since this method is implemented in #14279 - we will refactor it there 👍

Copy link
Member

Choose a reason for hiding this comment

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

ah, ok! thank you!

Copy link

github-actions bot commented Jul 29, 2024

Node: Unit Test Results

  1 546 files    1 546 suites   3h 25m 56s ⏱️
117 464 tests 117 403 ✅ 59 💤 2 ❌
125 678 runs  125 617 ✅ 59 💤 2 ❌

For more details on these failures, see this check.

Results for commit 64a01b6.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jul 29, 2024

Node: HAPI Test (Node Death Reconnect) Results

3 tests   3 ✅  5m 1s ⏱️
3 suites  0 💤
3 files    0 ❌

Results for commit 64a01b6.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jul 29, 2024

Node: HAPI Test (Token) Results

 22 files   22 suites   7m 0s ⏱️
281 tests 281 ✅ 0 💤 0 ❌
364 runs  364 ✅ 0 💤 0 ❌

Results for commit 64a01b6.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jul 29, 2024

Node: HAPI Test (Restart) Results

7 files  7 suites   8m 50s ⏱️
6 tests 6 ✅ 0 💤 0 ❌
7 runs  7 ✅ 0 💤 0 ❌

Results for commit 64a01b6.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jul 29, 2024

Node: HAPI Test (Crypto) Results

 32 files   32 suites   15m 44s ⏱️
364 tests 357 ✅ 0 💤 7 ❌
396 runs  389 ✅ 0 💤 7 ❌

For more details on these failures, see this check.

Results for commit 64a01b6.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jul 29, 2024

Node: HAPI Test (Misc) Results

 61 files   61 suites   16m 1s ⏱️
319 tests 318 ✅ 0 💤 1 ❌
409 runs  408 ✅ 0 💤 1 ❌

For more details on these failures, see this check.

Results for commit 64a01b6.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jul 29, 2024

Node: HAPI Test (Time Consuming) Results

19 tests   19 ✅  23m 1s ⏱️
 4 suites   0 💤
 4 files     0 ❌

Results for commit 64a01b6.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jul 29, 2024

Node: HAPI Test (Smart Contract) Results

 91 files   91 suites   25m 5s ⏱️
658 tests 658 ✅ 0 💤 0 ❌
835 runs  835 ✅ 0 💤 0 ❌

Results for commit 64a01b6.

♻️ This comment has been updated with latest results.

vtronkov added 2 commits July 29, 2024 19:52
Signed-off-by: Valentin Tronkov <99957253+vtronkov@users.noreply.github.com>
Signed-off-by: Valentin Tronkov <99957253+vtronkov@users.noreply.github.com>
Signed-off-by: Valentin Tronkov <99957253+vtronkov@users.noreply.github.com>
vtronkov added 2 commits July 30, 2024 14:26
Signed-off-by: Valentin Tronkov <99957253+vtronkov@users.noreply.github.com>
…ts' into 14423-14443-airdrops-with-treasury-and-custom-fee-recivers
Copy link
Member

@david-bakin-sl david-bakin-sl left a comment

Choose a reason for hiding this comment

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

I'd still like to see unit tests for handle() - but I'll assume you'll do that when you refactor that method in the base feature branch.

Copy link
Contributor

@MrValioBg MrValioBg left a comment

Choose a reason for hiding this comment

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

LGTM!

…ts' into 14423-14443-airdrops-with-treasury-and-custom-fee-recivers
Signed-off-by: Valentin Tronkov <99957253+vtronkov@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment