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

fix: vm.WithUNSAFECallerAddressProxying under DELEGATECALL #50

Merged
merged 7 commits into from
Oct 7, 2024

Conversation

ARR4N
Copy link
Collaborator

@ARR4N ARR4N commented Oct 4, 2024

Why this should be merged

Correct backwards compatibility for ava-labs/coreth NativeAssetCall (NAC).

How this works

NAC always acted as if it were its actual caller, not its effective caller under EVM rules. As DelegateCall modifies both the effective self and caller addresses, the WithUNSAFECallerAddressProxying() option now properly selects the actual caller to use when making outgoing calls.

In addition to proxying its actual-caller address on outbound calls, NAC charged the actual caller of the precompile. To discern this, the CallType is made available via PrecompileEnvironment. See the example code for how to determine the actual caller.

How this was tested

Additional test cases for TestPrecompileMakeCall as this asserts the addresses as seen by the contract called by the precompile.

@ARR4N ARR4N marked this pull request as ready for review October 7, 2024 11:32
@ARR4N ARR4N merged commit 51cd795 into libevm Oct 7, 2024
3 checks passed
@ARR4N ARR4N deleted the arr4n/precompile-call-unsafe-addr-proxy-fix branch October 7, 2024 11:46
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.

2 participants