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

feat(trezor): add HF15 support, BP+ #8299

Merged
merged 1 commit into from
Aug 23, 2022
Merged
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
28 changes: 8 additions & 20 deletions src/device_trezor/device_trezor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@ namespace trezor {

std::vector<protocol::ki::MoneroTransferDetails> mtds;
std::vector<protocol::ki::MoneroExportedKeyImage> kis;
protocol::ki::key_image_data(wallet, transfers, mtds, client_version() <= 1);
protocol::ki::generate_commitment(mtds, transfers, req, client_version() <= 1);
protocol::ki::key_image_data(wallet, transfers, mtds);
protocol::ki::generate_commitment(mtds, transfers, req);

EVENT_PROGRESS(0.);
this->set_msg_addr<messages::monero::MoneroKeyImageExportInitRequest>(req.get());
Expand Down Expand Up @@ -635,11 +635,7 @@ namespace trezor {
}

// Step: sort
auto perm_req = signer->step_permutation();
if (perm_req){
auto perm_ack = this->client_exchange<messages::monero::MoneroTransactionInputsPermutationAck>(perm_req);
signer->step_permutation_ack(perm_ack);
}
signer->sort_ki();
EVENT_PROGRESS(3, 1, 1);

// Step: input_vini
Expand Down Expand Up @@ -697,13 +693,13 @@ namespace trezor {
unsigned device_trezor::client_version()
{
auto trezor_version = get_version();
if (trezor_version <= pack_version(2, 0, 10)){
throw exc::TrezorException("Trezor firmware 2.0.10 and lower are not supported. Please update.");
if (trezor_version < pack_version(2, 4, 3)){
throw exc::TrezorException("Minimal Trezor firmware version is 2.4.3. Please update.");
Copy link
Collaborator

Choose a reason for hiding this comment

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

From these comments:

Another thing, I hard-coded to the monero wallet that firmware version 2.5.1 supports HF15

We are releasing 2.5.1 which does not include this PR. Please bump to 2.5.2 in the monero PR.

I'm assuming only Trezor v2.5.2 will support bp+ and view tags. Wouldn't that mean the minimal Trezor version should be v2.5.2? Is the minimum set at v2.4.3 to support tx construction pre-fork?

Copy link
Collaborator

@j-berman j-berman Aug 5, 2022

Choose a reason for hiding this comment

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

Nevermind, I see. Once this ships, Trezors v2.4.3 and up will be able to use updated wallets until the fork height

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review @j-berman! That was the idea, so old Trezors could still use the wallet even if they did not update yet. We can later enforce minimal version 2.5.2.

}

unsigned client_version = 1;
if (trezor_version >= pack_version(2, 3, 1)){
client_version = 3;
unsigned client_version = 3;
if (trezor_version >= pack_version(2, 5, 2)){
client_version = 4;
}

#ifdef WITH_TREZOR_DEBUGGING
Expand Down Expand Up @@ -739,14 +735,6 @@ namespace trezor {
CHECK_AND_ASSERT_THROW_MES(init_msg, "TransactionInitRequest is empty");
CHECK_AND_ASSERT_THROW_MES(init_msg->has_tsx_data(), "TransactionInitRequest has no transaction data");
CHECK_AND_ASSERT_THROW_MES(m_features, "Device state not initialized"); // make sure the caller did not reset features
const bool nonce_required = init_msg->tsx_data().has_payment_id() && init_msg->tsx_data().payment_id().size() > 0;

if (nonce_required && init_msg->tsx_data().payment_id().size() == 8){
// Versions 2.0.9 and lower do not support payment ID
if (get_version() <= pack_version(2, 0, 9)) {
throw exc::TrezorException("Trezor firmware 2.0.9 and lower does not support transactions with short payment IDs or integrated addresses. Please update.");
}
}
}

void device_trezor::transaction_check(const protocol::tx::TData & tdata, const hw::tx_aux_data & aux_data)
Expand Down
Loading