Skip to content

Eth stream#1739

Merged
benma merged 7 commits intoBitBoxSwiss:masterfrom
Tomasvrba:eth-stream
Feb 14, 2026
Merged

Eth stream#1739
benma merged 7 commits intoBitBoxSwiss:masterfrom
Tomasvrba:eth-stream

Conversation

@Tomasvrba
Copy link
Copy Markdown
Collaborator

No description provided.

@Tomasvrba Tomasvrba force-pushed the eth-stream branch 5 times, most recently from 8976b36 to 9671437 Compare January 14, 2026 15:08
@Tomasvrba Tomasvrba marked this pull request as ready for review January 14, 2026 15:29
Comment thread src/rust/bitbox02-rust/src/hww/api/ethereum/sighash.rs Outdated
Comment thread src/rust/bitbox02-rust/src/hww/api/ethereum/sign.rs Outdated
Comment thread src/rust/bitbox02-rust/src/hww/api/ethereum/sign.rs Outdated
Comment thread src/rust/bitbox02-rust/src/hww/api/ethereum/sighash.rs Outdated
Comment thread src/rust/bitbox02-rust/src/hww/api/ethereum/sighash.rs Outdated
Comment thread src/rust/bitbox02-rust/src/hww/api/ethereum/sighash.rs
Comment thread src/rust/bitbox02-rust/src/hww/api/ethereum/sighash.rs Outdated
Comment thread src/rust/bitbox02-rust/src/hww/api.rs Outdated
Comment thread src/rust/bitbox02-rust/src/hww/api/ethereum.rs Outdated
Comment thread src/rust/bitbox02-rust/Cargo.toml Outdated
Comment thread src/rust/bitbox02-rust/src/hww/api.rs Outdated
Comment thread src/rust/bitbox02-rust/tests/sighash_tests.rs Outdated
@Tomasvrba Tomasvrba force-pushed the eth-stream branch 3 times, most recently from b5a3f42 to e89eafa Compare February 3, 2026 16:39
@Tomasvrba Tomasvrba requested a review from benma February 7, 2026 09:39
Comment thread src/rust/bitbox02-rust/src/hww/api/ethereum/sign.rs Outdated
Comment thread messages/eth.proto Outdated
Comment thread messages/eth.proto Outdated
Comment thread src/rust/bitbox02-rust/src/hww/api/ethereum.rs Outdated
Comment thread src/rust/bitbox02-rust/src/hww/api/ethereum/sighash.rs Outdated
Comment thread src/rust/bitbox02-rust/src/hww/api/ethereum/sign.rs
Comment thread src/rust/bitbox02-rust/src/hww/api/ethereum/sign.rs Outdated
Comment thread src/rust/bitbox02-rust/src/hww/api/ethereum/sign.rs Outdated
Comment thread src/rust/bitbox02-rust/src/hww/api/ethereum/sighash.rs
Comment thread py/bitbox02/bitbox02/bitbox02/bitbox02.py
@Tomasvrba Tomasvrba force-pushed the eth-stream branch 2 times, most recently from 97aad1e to 56eee94 Compare February 11, 2026 16:32
@Tomasvrba Tomasvrba requested a review from benma February 11, 2026 17:22
Comment thread src/rust/bitbox02-rust/src/hww/api/ethereum/sign.rs Outdated
Comment thread src/rust/bitbox02-rust/src/hww/api/ethereum/sign.rs
benma and others added 2 commits February 13, 2026 13:12
So it can handle ETH transactions with very large data fields that
can't be sent by the host in one USB packet.

The Go code to produce the tests has been adjusted to work with the
updated go-ethereum package, and to output the data using the
`SimpleProducer`.
update existing tests to include the new data length field

Adds new protobuf fields to support streaming large transaction data:
- data_length: Indicates total data size (triggers streaming mode if > 6144)
- EthSignDataRequestChunkResponse: Request for a data chunk at offset/length
- EthSignDataResponseChunkRequest: Response containing the requested chunk

Regenerates all protobuf files (Python, Rust, C) from the updated .proto.

Updates existing tests to populate the new data_length field (set to 0
for traditional mode where all data is sent inline).
Implements the DataProducer trait with two implementations:
- SimpleProducer: Returns all data in one call (for small data)
- ChunkingProducer: Fetches data in 4096-byte chunks via IPC (for large data)

Updates DataProducer::next() to return Result<Option<Vec<u8>>, Error>
instead of Option<Vec<u8>> for proper error handling.

Updates sighash computation functions (compute_legacy, compute_eip1559) to:
- Accept DataProducer via RefCell for async access
- Propagate errors through the call chain
- Use the Write trait to stream data into the hasher

Updates sign.rs hash functions to use ChunkingProducer when
data_length > 0, otherwise use SimpleProducer with inline data.
Adds _handle_eth_chunking() method to BitBox02 class to handle the
chunk request/response loop for ETH transactions with large data fields.

Updates eth_sign() and eth_sign_eip1559() to:
- Set data_length field when data exceeds 6144 bytes
- Call _handle_eth_chunking() to process chunk requests
- Use empty data field when streaming (data is sent incrementally)

Updates send_message.py with a streaming test case for validation.
extracts the go scripts that generate eth sighash test data into a
standalone go script and commits generate json data
Adds transactions with large data (about 20% of total txs) to the
sighash go script to unit test the chunking producer

- test sign.rs to test that new streaming mode produces same
signatures as non-streaming
- test that streaming large data produces signatures of expected size

eth: prepare tests for eth sighash streaming

prepares initial unit tests for simple and chunking producer for data
streaming

tests generated by Claude Code
Copy link
Copy Markdown
Collaborator

@benma benma left a comment

Choose a reason for hiding this comment

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

Nice work!

@benma benma merged commit e217ae3 into BitBoxSwiss:master Feb 14, 2026
42 checks passed
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.

2 participants