Skip to content

Commit

Permalink
fix linux
Browse files Browse the repository at this point in the history
Signed-off-by: turuslan <turuslan.devbox@gmail.com>
  • Loading branch information
turuslan committed May 20, 2024
1 parent 739f478 commit 3cbf4fd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 4 additions & 5 deletions core/parachain/pvf/kagome_pvf_worker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ namespace kagome::parachain {
std::error_code err{};
std::filesystem::current_path("..", err);
if (err) {
return SecureModeError{
fmt::format("Failed to chdir to ..: {}", err.message())};
return SecureModeError{fmt::format("Failed to chdir to ..: {}", err)};
}
if (std::filesystem::current_path() != "/") {
return SecureModeError{
Expand Down Expand Up @@ -277,21 +276,21 @@ namespace kagome::parachain {
if (auto res = changeRoot(input.cache_dir); !res) {
SL_ERROR(logger,
"Failed to enable secure validator mode (change root): {}",
res.error().message());
res.error());
return std::errc::not_supported;
}
input.cache_dir = "/";

if (auto res = enableLandlock(input.cache_dir); !res) {
SL_ERROR(logger,
"Failed to enable secure validator mode (landlock): {}",
res.error().message());
res.error());
return std::errc::not_supported;
}
if (auto res = enableSeccomp(); !res) {
SL_ERROR(logger,
"Failed to enable secure validator mode (seccomp): {}",
res.error().message());
res.error());
return std::errc::not_supported;
}
SL_VERBOSE(logger, "Successfully enabled secure validator mode");
Expand Down
4 changes: 4 additions & 0 deletions core/parachain/pvf/kagome_pvf_worker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ namespace kagome::parachain {
std::string message_;
};

inline auto format_as(const SecureModeError &e) {
return e.message();
}

/// Changes the filessystem root directory for the current process to
/// worker_dir
outcome::result<void, SecureModeError> changeRoot(
Expand Down

0 comments on commit 3cbf4fd

Please sign in to comment.