Skip to content

feat: bubble up error in stylus init #338

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

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/stylus/StylusDeployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,16 @@ contract StylusDeployer {
// initialize - this will fail if the program wasn't activated by this point
// we check if initData exists to avoid calling contracts unnecessarily
if (initData.length != 0) {
(bool success,) = address(newContractAddress).call{value: initValue}(initData);
(bool success, bytes memory data) =
address(newContractAddress).call{value: initValue}(initData);
if (!success) {
revert ContractInitializationError(newContractAddress);
if (data.length > 0) {
assembly {
revert(add(data, 32), mload(data))
}
} else {
revert ContractInitializationError(newContractAddress);
}
}
Comment on lines 80 to 88
Copy link
Contributor

Choose a reason for hiding this comment

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

not a strong preference, but I think this is slightly better

revert ContractInitializationError(newContractAddress, data)

} else if (initValue != 0) {
// if initValue exists init data should too
Expand Down
Loading