Skip to content

Conversation

cmickeyb
Copy link
Contributor

@cmickeyb cmickeyb commented Aug 4, 2025

Several small fixes to problems found while debugging the WAMR upgrade (coming).

The multi-user test failed "ungracefully" when errors occurred. This
improves error handling and reporting (and makes it easier to follow
the progression of the test).

Signed-off-by: Mic Bowman <[email protected]>
Block store debug was not set for the block store library because of
an incorrect reference. Fixed the reference.

Signed-off-by: Mic Bowman <[email protected]>
Correct a couple of the error messages generated in the send and
initialize operations of the enclave wrapper code.

Signed-off-by: Mic Bowman <[email protected]>
Replace the flag for c++ v11 with c++ v17 for contract compiles. This
required changes to some of the replacement definitions for memory
allocation in the the contract common library.

Signed-off-by: Mic Bowman <[email protected]>
Several small changes to the lmdb blockstore:

* Add a flag to ensure that thread local storage is not used. This is
  really the critical modification in this PR as prep for WAMR upgrade.

* Add thread locks to all of the low level operations; while not
  (theoretically) necessary, the additional locks may help with some
  of the reentrancy issues.

* Clean up a bad variable reference in one of the debug statements

Signed-off-by: Mic Bowman <[email protected]>
@cmickeyb cmickeyb requested a review from Copilot August 4, 2025 16:10
@cmickeyb cmickeyb self-assigned this Aug 4, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR contains small fixes discovered during debugging the WAMR 2.4 upgrade, focusing on error message corrections, thread safety improvements, and C++ standards updates.

  • Updated error messages to correctly reflect the failing function names
  • Added thread safety locks to block store operations and improved debugging
  • Upgraded C++ standard from C++11 to C++17 and updated operator declarations

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
eservice/pdo/eservice/pdo_helper.py Fixed error message function names to match actual methods
contracts/wawaka/contract-build.cmake Upgraded C++ standard and reorganized link options with debugging comments
contracts/wawaka/common/Util.cpp Updated operator new declarations and added stderr definition
common/packages/block_store/lmdb_block_store.cpp Added thread safety locks and improved initialization/debugging
common/CMakeLists.txt Fixed library name reference for debug compilation
build/tests/multi-user.sh Enhanced error handling and debugging output

@@ -65,6 +67,7 @@ void operator delete(void *ptr, std::align_val_t) _NOEXCEPT
}

#include <stdio.h>
FILE *const stderr = NULL;
Copy link
Preview

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

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

Defining stderr as NULL will cause segmentation faults when code attempts to write to stderr. Consider defining it as a valid FILE pointer or implementing a custom stderr handler.

Suggested change
FILE *const stderr = NULL;
static FILE dummy_stderr;
FILE *const stderr = &dummy_stderr;

Copilot uses AI. Check for mistakes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in a way, we want access to stderr to fail. this is only necessary because one of the builtin libraries (wasi or wamr) references stderr in a way that requires the symbol definition.

cmickeyb and others added 2 commits August 4, 2025 11:23
Co-authored-by: Copilot <[email protected]>
Signed-off-by: Mic Bowman <[email protected]>
Co-authored-by: Copilot <[email protected]>
Signed-off-by: Mic Bowman <[email protected]>
@cmickeyb cmickeyb merged commit 01a1973 into hyperledger-labs:main Aug 4, 2025
5 checks passed
@cmickeyb cmickeyb deleted the mic.aug04.small_fixes branch August 4, 2025 17:41
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