Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #9708 from EOSIO/develop-boxed-query-sha
Browse files Browse the repository at this point in the history
rodeos: allow queries to use sha functions
  • Loading branch information
tbfleming authored Nov 23, 2020
2 parents 7fb6e3f + e665259 commit 8dfe8b9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 47 deletions.
4 changes: 4 additions & 0 deletions libraries/rodeos/include/b1/rodeos/callbacks/crypto.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,22 @@ struct crypto_callbacks {
void assert_ripemd160(int, int, int) { return unimplemented<void>("assert_ripemd160"); }

void sha1(eosio::vm::span<const char> data, legacy_ptr<fc::sha1> hash_val) {
// TODO: needs checktime protection in queries. Filters don't need this protection.
*hash_val = fc::sha1::hash(data.data(), data.size());
}

void sha256(eosio::vm::span<const char> data, legacy_ptr<fc::sha256> hash_val) {
// TODO: needs checktime protection in queries. Filters don't need this protection.
*hash_val = fc::sha256::hash(data.data(), data.size());
}

void sha512(eosio::vm::span<const char> data, legacy_ptr<fc::sha512> hash_val) {
// TODO: needs checktime protection in queries. Filters don't need this protection.
*hash_val = fc::sha512::hash(data.data(), data.size());
}

void ripemd160(eosio::vm::span<const char> data, legacy_ptr<fc::ripemd160> hash_val) {
// TODO: needs checktime protection in queries. Filters don't need this protection.
*hash_val = fc::ripemd160::hash(data.data(), data.size());
}

Expand Down

This file was deleted.

6 changes: 3 additions & 3 deletions libraries/rodeos/wasm_ql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#include <b1/rodeos/callbacks/chaindb.hpp>
#include <b1/rodeos/callbacks/compiler_builtins.hpp>
#include <b1/rodeos/callbacks/console.hpp>
#include <b1/rodeos/callbacks/crypto.hpp>
#include <b1/rodeos/callbacks/memory.hpp>
#include <b1/rodeos/callbacks/unimplemented.hpp>
#include <b1/rodeos/callbacks/unimplemented_query.hpp>
#include <b1/rodeos/rodeos.hpp>
#include <boost/filesystem.hpp>
#include <boost/multi_index/member.hpp>
Expand Down Expand Up @@ -74,10 +74,10 @@ struct callbacks : action_callbacks<callbacks>,
compiler_builtins_callbacks<callbacks>,
console_callbacks<callbacks>,
context_free_system_callbacks<callbacks>,
crypto_callbacks<callbacks>,
db_callbacks<callbacks>,
memory_callbacks<callbacks>,
query_callbacks<callbacks>,
unimplemented_query_callbacks<callbacks>,
unimplemented_callbacks<callbacks> {
wasm_ql::thread_state& thread_state;
rodeos::chaindb_state& chaindb_state;
Expand All @@ -100,10 +100,10 @@ void register_callbacks() {
compiler_builtins_callbacks<callbacks>::register_callbacks<rhf_t>();
console_callbacks<callbacks>::register_callbacks<rhf_t>();
context_free_system_callbacks<callbacks>::register_callbacks<rhf_t>();
crypto_callbacks<callbacks>::register_callbacks<rhf_t>();
db_callbacks<callbacks>::register_callbacks<rhf_t>();
memory_callbacks<callbacks>::register_callbacks<rhf_t>();
query_callbacks<callbacks>::register_callbacks<rhf_t>();
unimplemented_query_callbacks<callbacks>::register_callbacks<rhf_t>();
unimplemented_callbacks<callbacks>::register_callbacks<rhf_t>();
}

Expand Down

0 comments on commit 8dfe8b9

Please sign in to comment.