Skip to content
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

Risczero Fit #97

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea
target
*.iml
Cargo.lock
Cargo.lock
.vscode
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ edition = "2018"
default = ["std"]
std = []
external-secp = []
risczero-enable = []

[dependencies]

Expand Down
44 changes: 25 additions & 19 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,24 +70,30 @@ fn main() {
} else if tool.is_like_clang() || tool.is_like_gnu() {
consensus_config.flag("-std=c++17").flag("-Wno-unused-parameter");
}

consensus_config.cpp(true);
if cfg!(feature = "risczero-enable"){
consensus_config.no_default_flags(true)
.flag_if_supported("-march=rv32i")
.flag_if_supported("mabi=ilp32");
println!("compile after cpp=true: {:?}", consensus_config.get_compiler());
}

consensus_config
.cpp(true)
.include("depend/bitcoin/src")
.include("depend/bitcoin/src/secp256k1/include")
.file("depend/bitcoin/src/util/strencodings.cpp")
.file("depend/bitcoin/src/uint256.cpp")
.file("depend/bitcoin/src/pubkey.cpp")
.file("depend/bitcoin/src/hash.cpp")
.file("depend/bitcoin/src/primitives/transaction.cpp")
.file("depend/bitcoin/src/crypto/ripemd160.cpp")
.file("depend/bitcoin/src/crypto/sha1.cpp")
.file("depend/bitcoin/src/crypto/sha256.cpp")
.file("depend/bitcoin/src/crypto/sha512.cpp")
.file("depend/bitcoin/src/crypto/hmac_sha512.cpp")
.file("depend/bitcoin/src/script/bitcoinconsensus.cpp")
.file("depend/bitcoin/src/script/interpreter.cpp")
.file("depend/bitcoin/src/script/script.cpp")
.file("depend/bitcoin/src/script/script_error.cpp")
.compile("libbitcoinconsensus.a");
consensus_config.include("depend/bitcoin/src")
.include("depend/bitcoin/src/secp256k1/include")
.file("depend/bitcoin/src/util/strencodings.cpp")
.file("depend/bitcoin/src/uint256.cpp")
.file("depend/bitcoin/src/pubkey.cpp")
.file("depend/bitcoin/src/hash.cpp")
.file("depend/bitcoin/src/primitives/transaction.cpp")
.file("depend/bitcoin/src/crypto/ripemd160.cpp")
.file("depend/bitcoin/src/crypto/sha1.cpp")
.file("depend/bitcoin/src/crypto/sha256.cpp")
.file("depend/bitcoin/src/crypto/sha512.cpp")
.file("depend/bitcoin/src/crypto/hmac_sha512.cpp")
.file("depend/bitcoin/src/script/bitcoinconsensus.cpp")
.file("depend/bitcoin/src/script/interpreter.cpp")
.file("depend/bitcoin/src/script/script.cpp")
.file("depend/bitcoin/src/script/script_error.cpp")
.compile("libbitcoinconsensus.a");
}
9 changes: 9 additions & 0 deletions depend/bitcoin/src/serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,15 @@ const Out& AsBase(const In& x)
BASE_SERIALIZE_METHODS(cls) \
FORMATTER_METHODS_PARAMS(cls, obj, paramcls, paramobj)

// clang-format off
#ifdef RISCZERO
template <typename Stream> inline void Serialize(Stream& s, int a) { ser_writedata32(s, a); }
template <typename Stream> inline void Serialize(Stream& s, unsigned int a) { ser_writedata32(s, a); }
template <typename Stream> inline void Unserialize(Stream& s, int& a) { a = ser_readdata32(s); }
template <typename Stream> inline void Unserialize(Stream& s, unsigned int& a) { a = ser_readdata32(s); }
#endif
// clang-format on

// clang-format off
#ifndef CHAR_EQUALS_INT8
template <typename Stream> void Serialize(Stream&, char) = delete; // char serialization forbidden. Use uint8_t or int8_t
Expand Down
Loading