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: use "inline" auto-association fee payments #14291

Closed
wants to merge 15 commits into from

Conversation

tinker-michaelj
Copy link
Collaborator

@tinker-michaelj tinker-michaelj commented Jul 17, 2024

Description:

  • Switches from doing auto-associations via dispatch to doing them inline in the CryptoTransferHandler.
    • This implies the handler must charge fees whenever the context is not an internal dispatch from the ContractService (in that case the cost comes out of the gas budget for the EVM transaction).
    • Hence exposes chargeNetworkFee() in HandleContext.
  • Since there is no longer a synthetic TokenAssociate child, adds throttle check based on the number of automatic token associations in the children that are there.
  • Updates unit and @HapiTest expectations accordingly.

povolev15 and others added 10 commits July 3, 2024 12:14
…Commit, releaseDevelopCommit, releaseDevelopDailySnapshot, releaseDevelopSnapshot, releasePrereleaseChannel) (#14150)

Signed-off-by: Elijah Lynn <[email protected]>
…rizedRaw system contract method (#14193)

Signed-off-by: David S Bakin <[email protected]>
@tinker-michaelj tinker-michaelj requested a review from a team as a code owner July 17, 2024 19:41
@tinker-michaelj tinker-michaelj requested a review from a team July 17, 2024 19:41
@tinker-michaelj tinker-michaelj changed the base branch from develop to release/0.52 July 17, 2024 19:41
@tinker-michaelj tinker-michaelj requested a review from a team as a code owner July 17, 2024 19:41
david-bakin-sl
david-bakin-sl previously approved these changes Jul 17, 2024
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.

Some comments for your consideration.

(Also, is this a chore and not a fix or maybe feat? Also a reminder the PR description is TBS.)

@tinker-michaelj tinker-michaelj added this to the v0.52 milestone Jul 17, 2024
@tinker-michaelj tinker-michaelj self-assigned this Jul 17, 2024
@tinker-michaelj tinker-michaelj changed the title chore: use "inline" auto-association fee payments feat: use "inline" auto-association fee payments Jul 18, 2024
Signed-off-by: Michael Tinker <[email protected]>
Signed-off-by: Michael Tinker <[email protected]>
Signed-off-by: Michael Tinker <[email protected]>
Copy link

github-actions bot commented Jul 18, 2024

Node: Unit Test Results

  1 542 files    1 542 suites   3h 26m 32s ⏱️
115 770 tests 115 711 ✅ 59 💤 0 ❌
124 085 runs  124 026 ✅ 59 💤 0 ❌

Results for commit 66d8919.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jul 18, 2024

Node: HAPI Test (Node Death Reconnect) Results

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

Results for commit 66d8919.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jul 18, 2024

Node: HAPI Test (Restart) Results

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

Results for commit 66d8919.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jul 18, 2024

Node: HAPI Test (Token) Results

 22 files   22 suites   6m 34s ⏱️
272 tests 272 ✅ 0 💤 0 ❌
352 runs  352 ✅ 0 💤 0 ❌

Results for commit 66d8919.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jul 18, 2024

Node: HAPI Test (Crypto) Results

 24 files   24 suites   14m 39s ⏱️
362 tests 362 ✅ 0 💤 0 ❌
369 runs  369 ✅ 0 💤 0 ❌

Results for commit 66d8919.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jul 18, 2024

Node: HAPI Test (Misc) Results

 51 files   51 suites   20m 38s ⏱️
357 tests 357 ✅ 0 💤 0 ❌
375 runs  375 ✅ 0 💤 0 ❌

Results for commit 66d8919.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jul 18, 2024

Node: HAPI Test (Time Consuming) Results

19 tests   19 ✅  22m 49s ⏱️
 4 suites   0 💤
 4 files     0 ❌

Results for commit 66d8919.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jul 18, 2024

Node: HAPI Test (Smart Contract) Results

 73 files   73 suites   23m 56s ⏱️
681 tests 681 ✅ 0 💤 0 ❌
735 runs  735 ✅ 0 💤 0 ❌

Results for commit 66d8919.

♻️ This comment has been updated with latest results.

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.

LGTM but this is a comment not an approval because I want to come back to it.

// We only charge auto-association fees inline if this is a user disaptch; in that case the
// contract service will take the auto-association costs from the remaining EVM gas
if (context.recordBuilders()
.getOrCreate(SingleTransactionRecordBuilder.class)
Copy link
Member

Choose a reason for hiding this comment

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

(Gotta say, isn't obvious at this line how a method called getOrCreate works given an interface as the target class - had to trace this one down ...)

@@ -146,7 +152,7 @@ void doesTokenBalanceChangesWithAllowances() {
assertThat(receiverAccountBefore.numberPositiveBalances()).isEqualTo(2);
assertThat(senderRelBefore.balance()).isEqualTo(1000L);
// There is an association happening during the transfer for auto creation
assertThat(receiverRelBefore.balance()).isEqualTo(1);
assertThat(receiverRelBefore.balance()).isEqualTo(0);
Copy link
Member

Choose a reason for hiding this comment

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

Why wasn't this assert needed (or useful) also at L106 above? (Only instance in these tests modified in this PR where it wasn't.)

david-bakin-sl
david-bakin-sl previously approved these changes Jul 18, 2024
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.

DOne looking. LGTM

Copy link
Member

@Neeharika-Sompalli Neeharika-Sompalli left a comment

Choose a reason for hiding this comment

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

LGTM! We should probably target this to develop

@tinker-michaelj tinker-michaelj changed the base branch from release/0.52 to develop July 24, 2024 19:30
@tinker-michaelj tinker-michaelj dismissed stale reviews from Neeharika-Sompalli and david-bakin-sl July 24, 2024 19:30

The base branch was changed.

@tinker-michaelj
Copy link
Collaborator Author

Will retarget to develop.

@tinker-michaelj tinker-michaelj deleted the 14284-direct-auto-association branch August 27, 2024 13:28
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.

7 participants