Enable Caller Context Preservation in Chain Extension for Staking Operations
Is your feature request related to a problem? Please describe.
At present, whenever a contract invokes the chain extension, the extension assigns the contract itself as the caller. This results in:
- Loss of the original transaction sender context
- Inability for users to move or manage their stake via contract calls
- Limited composability for DeFi and staking abstractions
Describe the solution you'd like
Expected Behavior
The chain extension should support preserving or forwarding the original caller context (msg.sender equivalent), allowing:
- Users to interact with staking logic through contracts
- Stake operations to be executed on behalf of the actual caller, not the contract
- More flexible and composable contract-based staking mechanisms
Proposed Solution
Introduce a modified or new chain extension that:
- Allows passing the original caller as the effective actor in staking operations
- Alternatively, provides a mechanism to explicitly specify the caller context when invoking the extension
- Ensures proper authorization and security checks to prevent misuse
Describe alternatives you've considered
No response
Additional context
No response
Alternatively, provides a mechanism to explicitly specify the caller context when invoking the extension
I prefer we use the different functions to specify the origin is contract or caller.
Hi @open-junius , are you working on this right now? If not, would you mind if I take it on? I’d love to contribute.
@statxc yes, I am on it. you can help to review the PR, it will be ready soon. thanks!
Does delegate_call solve this issue for you?