mirror of
https://github.com/Xahau/xahaud.git
synced 2026-06-07 18:56:36 +00:00
add namespaces to the grants cache
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <queue>
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
#include <wasmedge/wasmedge.h>
|
||||
|
||||
@@ -174,7 +175,7 @@ struct HookResult
|
||||
false; // hook_again allows strong pre-apply to nominate
|
||||
// additional weak post-apply execution
|
||||
std::shared_ptr<STObject const> provisionalMeta;
|
||||
std::set<AccountID>
|
||||
std::set<std::tuple<AccountID, uint256 /* namespace */>>
|
||||
foreignStateGrantCache; // add found grants here to avoid rechecking
|
||||
};
|
||||
|
||||
|
||||
@@ -1940,7 +1940,7 @@ HookAPI::state_foreign_set(
|
||||
// check if we've used a grant to modify this state entry before, if not
|
||||
// look up possible grants
|
||||
if (!hasFix ||
|
||||
hookCtx.result.foreignStateGrantCache.find(account) ==
|
||||
hookCtx.result.foreignStateGrantCache.find({account, ns}) ==
|
||||
hookCtx.result.foreignStateGrantCache.end())
|
||||
{
|
||||
auto const sle =
|
||||
@@ -2016,7 +2016,7 @@ HookAPI::state_foreign_set(
|
||||
}
|
||||
|
||||
// add the grant to the cache
|
||||
hookCtx.result.foreignStateGrantCache.emplace(account);
|
||||
hookCtx.result.foreignStateGrantCache.emplace(account, ns);
|
||||
}
|
||||
|
||||
if (auto ret = set_state_cache(account, ns, key, data, true);
|
||||
|
||||
Reference in New Issue
Block a user