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

Detect delegated sender authorization in CustomMessageCallProcessor #9814

Merged
merged 20 commits into from Nov 14, 2023

Conversation

tinker-michaelj
Copy link
Collaborator

@tinker-michaelj tinker-michaelj commented Nov 10, 2023

Description:

  • Closes Fix delegateContractIdRequiredForTransferInDelegateCall test from ContractCreateSuite #8717
  • Enables delegateContractIdRequiredForTransferInDelegateCall() as a @HapiTest.
  • On develop, the CustomMessageCallProcessor incorrectly checks whether the executing frame is a delegatecall to decide when to activate only delegatable_contract_id keys in a receiverSigRequired key structure.
    • But this just limits a contract's ability to use DELEGATECALL to transfer value to an account it controls, which does not make sense.
    • Instead we want to limit when a contract can use delegated code to transfer value to an account that it controls.
  • This PR fixes the mistake by adding a FrameUtils.acquiredSenderAuthorizationViaDelegateCall() method that instead tests if the executing frame acquired its sender authorization via delegatecall (i.e. whether its parent receiver address was running delegated code when it initiated the call represented by the executing frame).

Misc - delegates highly unwanted debug logging from TokenServiceApiImpl.

… fields

Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
…nd restrict to delegatable_contract_id keys

Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Copy link

github-actions bot commented Nov 10, 2023

Node: Unit Test Results

    2 278 files  ±0      2 278 suites  ±0   1h 29m 55s ⏱️ + 2m 48s
118 385 tests +4  118 351 ✔️ +4  34 💤 ±0  0 ±0 
126 646 runs  +4  126 612 ✔️ +4  34 💤 ±0  0 ±0 

Results for commit 42e8314. ± Comparison against base commit af2f38e.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Nov 10, 2023

Node: E2E Test Results

    1 files      1 suites   20m 32s ⏱️
312 tests 312 ✔️ 0 💤 0
334 runs  334 ✔️ 0 💤 0

Results for commit 42e8314.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Nov 10, 2023

Node: Integration Test Results

280 tests   280 ✔️  28m 50s ⏱️
    5 suites      0 💤
    5 files        0

Results for commit 42e8314.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Nov 10, 2023

Node: HAPI Test Results

1 246 tests   865 ✔️  1h 22m 43s ⏱️
   166 suites  381 💤
   166 files        0

Results for commit 42e8314.

♻️ This comment has been updated with latest results.

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 as per hedera-base changes ! Thanks @tinker-michaelj

Base automatically changed from 09775-fix-sc-create-children to develop November 10, 2023 16:49
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 !

Copy link
Member

@lukelee-sl lukelee-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

@tinker-michaelj tinker-michaelj merged commit c194954 into develop Nov 14, 2023
14 of 15 checks passed
@tinker-michaelj tinker-michaelj deleted the 08717-fix-recSigReq-delegate-detection branch November 14, 2023 18:08
nickpoorman pushed a commit that referenced this pull request Nov 22, 2023
…#9814)

Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Nick Poorman <nick@swirldslabs.com>
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.

Fix delegateContractIdRequiredForTransferInDelegateCall test from ContractCreateSuite
3 participants