Please describe the feature you’d like to see added.
Support the risczero platfrom by riscv32-unknown-elf-g++. which will bring more prove system for bitcoin.
Is your feature related to a problem, if so please describe it.
when i compile by riscv32-unknown-elf-g++ compiler, get the below error:
0blockbody-guest: cargo:warning=In file included from depend/bitcoin/src/hash.h:14,
1blockbody-guest: cargo:warning= from depend/bitcoin/src/script/interpreter.h:9,
2blockbody-guest: cargo:warning= from depend/bitcoin/src/script/interpreter.cpp:6:
3blockbody-guest: cargo:warning=depend/bitcoin/src/serialize.h: In instantiation of 'void Serialize(Stream&, const T&) [with Stream = HashWriter; T = int]':
4blockbody-guest: cargo:warning=depend/bitcoin/src/hash.h:144:20: required from 'HashWriter& HashWriter::operator<<(const T&) [with T = int]'
5blockbody-guest: cargo:warning=depend/bitcoin/src/script/interpreter.cpp:1613:12: required from 'uint256 SignatureHash(const CScript&, const T&, unsigned int, int, const CAmount&, SigVersion, const PrecomputedTransactionData*) [with T = CTransaction; CAmount = long long int]'
6blockbody-guest: cargo:warning=depend/bitcoin/src/script/interpreter.cpp:1664:36: required from 'bool GenericTransactionSignatureChecker<T>::CheckECDSASignature(const std::vector<unsigned char>&, const std::vector<unsigned char>&, const CScript&, SigVersion) const [with T = CTransaction]'
7blockbody-guest: cargo:warning=depend/bitcoin/src/script/interpreter.cpp:1785:16: required from here
8blockbody-guest: cargo:warning=depend/bitcoin/src/serialize.h:776:7: error: request for member 'Serialize' in 'a', which is of non-class type 'const int'
9blockbody-guest: cargo:warning= 776 | a.Serialize(os);
This error is caused by the logic in the SignatureHash function within src/script/interpreter.cpp. The function serializes the data to obtain a hash value, but it fails to find a serialization method for the int type.
0// Sighash type
1ss << nHashType;
This behavior is particularly strict in environments like RISC-V, where the ABI (Application Binary Interface) might enforce more rigid type distinctions, leading to errors during compilation.
The -march=rv32i -mabi=ilp32
for the compiler(riscv32-unknown-elf-g++).
Describe the solution you’d like
This issue was temporarily bypassed by adding serialization/deserialization code for the int type. Supporting R0 will allow the BTC L2 prover to extend to more proof systems.
- Add methods temporarily in the PR
- https://github.com/rust-bitcoin/rust-bitcoinconsensus/pull/97/files; Maybe best solution from the commiunity.
Describe any alternatives you’ve considered
No response
Please leave any additional context
No response