Skip to content

Plugin architecture: Entrypoint #292

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

Merged
merged 2 commits into from
Dec 10, 2022
Merged

Conversation

nkrishang
Copy link
Contributor

Introduces the Entrypoint smart contract for the plugin architecture.

@nkrishang nkrishang self-assigned this Dec 10, 2022
Comment on lines +33 to +56
function _delegate(address implementation) internal virtual {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())

// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)

// Copy the returned data.
returndatacopy(0, 0, returndatasize())

switch result
// delegatecall returns 0 on error.
case 0 {
revert(0, returndatasize())
}
default {
return(0, returndatasize())
}
}
}

Check warning

Code scanning / Slither

Assembly usage

Entrypoint._delegate(address) (contracts/extension/plugin/Entrypoint.sol#33-56) uses assembly - INLINE ASM (contracts/extension/plugin/Entrypoint.sol#34-55)
@nkrishang nkrishang merged commit 169ae05 into main Dec 10, 2022
@nkrishang nkrishang deleted the plugin-architecture-entrypoint branch December 26, 2022 19:04
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.

1 participant