Skip to content

Commit

Permalink
[VG-3407] Fix undelegate crash (#855)
Browse files Browse the repository at this point in the history
* fix: tezos account to compute operation uid when recipient is empty
* ci: bump patch version
* test: update tezos test http cache
  • Loading branch information
jcoatelen-ledger authored Feb 17, 2022
1 parent 6b441d3 commit 043597b
Show file tree
Hide file tree
Showing 19 changed files with 158 additions and 145 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ include_what_you_use() # add cmake conf option IWYU=ON to activate
# The project version number.
set(VERSION_MAJOR 4 CACHE STRING "Project major version number.")
set(VERSION_MINOR 1 CACHE STRING "Project minor version number.")
set(VERSION_PATCH 4 CACHE STRING "Project patch version number.")
set(VERSION_PATCH 5 CACHE STRING "Project patch version number.")
mark_as_advanced(VERSION_MAJOR VERSION_MINOR VERSION_PATCH)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY build)
Expand Down
29 changes: 21 additions & 8 deletions core/src/wallet/tezos/TezosLikeAccount2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,19 +560,32 @@ namespace ledger {
originatedAccountAddress = originatedAccount->getAddress();
}

const std::string& sender = parsedTx->getSender()->toBase58();
const std::string& receiver = parsedTx->getReceiver()->toBase58();
auto sender = parsedTx->getSender();
if(!sender) {
throw make_exception(api::ErrorCode::RUNTIME_ERROR, "computeOperationUid: Sender must be provided");
}
auto receiver = parsedTx->getReceiver();

const std::string& senderAddress = sender->toBase58();
const std::string& receiverAddress = receiver? receiver->toBase58() : std::string();
std::tie(opType, additional) = getOperationTypeAndUidAdditional(
sender,
receiver,
senderAddress,
receiverAddress,
originatedAccountId,
originatedAccountAddress
);
}
if(opType == api::OperationType::NONE) {
throw make_exception(api::ErrorCode::RUNTIME_ERROR, "Failed to determine the operation type for computing the operation id");
}

if(opType == api::OperationType::NONE) {
throw make_exception(
api::ErrorCode::RUNTIME_ERROR, "computeOperationUid: Failed to determine the operation type, sender=[%s] receiver=[%s] originatedAccId=[%s] originatedAccAddr=[%s]",
senderAddress,
receiverAddress,
originatedAccountId,
originatedAccountAddress
);
}
}

std::string txIdBase = fmt::format("{}+{}",
parsedTx->getCounter()->intValue(),
parsedTx->getOperationIndexInTransaction()
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
GET https://xtz-node.api.live.ledger.com/chains/main/blocks/head/context/contracts/tz1YnM9JMYof5yKXzs3XptoJ1RMf1Ri7RuGF/counter
0
2
"7522927"


GET https://xtz-node.api.live.ledger.com/chains/main/blocks/head/context/contracts/tz1YnM9JMYof5yKXzs3XptoJ1RMf1Ri7RuGF/manager_key
0
2
Expand All @@ -16,15 +10,21 @@ GET https://api.tzstats.com/explorer/account/tz1YnM9JMYof5yKXzs3XptoJ1RMf1Ri7RuG
{"address":"tz1YnM9JMYof5yKXzs3XptoJ1RMf1Ri7RuGF","address_type":"ed25519","pubkey":"edpkvZLkbFgjXLTqa193cDmrsWAo5Q7upHZMxacrobhQZUyTVU4ELs","first_in":1183493,"first_out":1183505,"last_in":1330307,"last_out":1287970,"first_seen":1183493,"last_seen":1330307,"first_in_time":"2020-10-23T08:28:12Z","first_out_time":"2020-10-23T08:40:12Z","last_in_time":"2021-02-04T09:04:23Z","last_out_time":"2021-01-04T17:21:39Z","first_seen_time":"2020-10-23T08:28:12Z","last_seen_time":"2021-02-04T09:04:23Z","total_received":0.2,"total_sent":0.095,"total_burned":0,"total_fees_paid":0.003312,"spendable_balance":0.101688,"total_balance":0.101688,"is_funded":true,"is_activated":false,"is_delegated":false,"is_revealed":true,"is_delegate":false,"is_active_delegate":false,"is_contract":false,"n_ops":6,"n_ops_failed":0,"n_tx":5,"n_delegation":0,"n_origination":0,"token_gen_min":5,"token_gen_max":46915}


GET https://xtz-node.api.live.ledger.com/chains/main/blocks/head/context/contracts/tz1YnM9JMYof5yKXzs3XptoJ1RMf1Ri7RuGF/counter
0
2
"7522927"


GET https://api.tzstats.com/explorer/block/head
0
2
{"hash":"BL1WQ1Tr7ZEtuhpEryJdHeAsBiS6efZbhVRmxqzj1st2bBQsmGN","predecessor":"BL6PfjDAeER2rPrVuLorgRWxxdS6Nko4DThN9VEkz3yCzX4cTo1","successor":"","baker":"tz1S8MNvuFEUsWgjHvi3AxibRBf388NhT1q2","height":2012306,"cycle":439,"is_cycle_snapshot":false,"time":"2022-01-08T00:29:10Z","solvetime":30,"version":11,"validation_pass":4,"fitness":1356946,"priority":0,"nonce":"0e7a0e9a43640100","voting_period_kind":"exploration","slot_mask":"","n_endorsed_slots":0,"n_ops":132,"n_ops_failed":0,"n_ops_contract":45,"n_contract_calls":44,"n_tx":59,"n_activation":0,"n_seed_nonce_revelations":0,"n_double_baking_evidences":0,"n_double_endorsement_evidences":0,"n_endorsement":69,"n_delegation":2,"n_reveal":2,"n_origination":0,"n_proposal":0,"n_ballot":0,"n_register_constant":0,"volume":8.04,"fee":0.040215,"reward":19.609375,"deposit":640,"unfrozen_fees":0,"unfrozen_rewards":0,"unfrozen_deposits":0,"activated_supply":0,"burned_supply":0.42725,"n_accounts":110,"n_new_accounts":0,"n_new_contracts":0,"n_cleared_accounts":0,"n_funded_accounts":0,"gas_limit":232801,"gas_used":210869,"gas_price":0.19071,"storage_size":1709,"days_destroyed":2.100792,"pct_account_reuse":100,"n_ops_implicit":2,"lb_esc_vote":false,"lb_esc_ema":160735,"protocol":"PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx"}
{"hash":"BKmy6tdtRTHCRx4ian66cKyknde4iqQnPXeLD598Mtt4ou2kLx9","predecessor":"BMFULyFRygAq4PoTqLVawbuYrkPqmmuuchXeUWFwCJnfALyHSDs","successor":"","baker":"tz1VQnqCCqX4K5sP3FNkVSNKTdCAMJDd3E1n","height":2125262,"cycle":453,"is_cycle_snapshot":false,"time":"2022-02-17T10:48:50Z","solvetime":30,"version":11,"fitness":1469902,"priority":0,"nonce":"6bc294388bce0300","voting_period_kind":"cooldown","slot_mask":"","n_endorsed_slots":0,"n_ops":94,"n_ops_failed":0,"n_ops_contract":19,"n_contract_calls":18,"n_tx":27,"n_activation":0,"n_seed_nonce_revelations":0,"n_double_baking_evidences":0,"n_double_endorsement_evidences":0,"n_endorsement":67,"n_delegation":0,"n_reveal":0,"n_origination":0,"n_proposal":0,"n_ballot":0,"n_register_constant":0,"volume":8.58491,"fee":0.017004,"reward":19.84375,"deposit":640,"activated_supply":0,"burned_supply":0.442,"n_accounts":97,"n_new_accounts":1,"n_new_contracts":0,"n_cleared_accounts":0,"n_funded_accounts":2,"gas_limit":120237,"gas_used":109491,"gas_price":0.1553,"storage_size":1254,"days_destroyed":29.054543,"pct_account_reuse":98.96907216494846,"n_ops_implicit":2,"lb_esc_vote":true,"lb_esc_ema":129871,"protocol":"PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx"}


GET https://api.tzstats.com/explorer/account/tz1YnM9JMYof5yKXzs3XptoJ1RMf1Ri7RuGF/op?limit=100
0
2
{"address":"tz1YnM9JMYof5yKXzs3XptoJ1RMf1Ri7RuGF","address_type":"ed25519","pubkey":"edpkvZLkbFgjXLTqa193cDmrsWAo5Q7upHZMxacrobhQZUyTVU4ELs","first_in":1183493,"first_out":1183505,"last_in":1330307,"last_out":1287970,"first_seen":1183493,"last_seen":1330307,"first_in_time":"2020-10-23T08:28:12Z","first_out_time":"2020-10-23T08:40:12Z","last_in_time":"2021-02-04T09:04:23Z","last_out_time":"2021-01-04T17:21:39Z","first_seen_time":"2020-10-23T08:28:12Z","last_seen_time":"2021-02-04T09:04:23Z","total_received":0.2,"total_sent":0.095,"total_burned":0,"total_fees_paid":0.003312,"spendable_balance":0.101688,"total_balance":0.101688,"is_funded":true,"is_activated":false,"is_delegated":false,"is_revealed":true,"is_delegate":false,"is_active_delegate":false,"is_contract":false,"n_ops":6,"n_ops_failed":0,"n_tx":5,"n_delegation":0,"n_origination":0,"token_gen_min":5,"token_gen_max":46915,"ops":[{"row_id":34477812,"hash":"ood2tS8MmAjAfsauGs6tDCc9BqsFx7qPHREBgXWi7XyidE3qi5Z","type":"transaction","block":"BL67XN1mU2wGGi8MPzvFNyrjLaDdtnxUdUbDpYs6Ws8cVfy1Tm6","time":"2020-10-23T08:28:12Z","height":1183493,"cycle":288,"counter":7314353,"op_l":3,"op_p":1,"op_c":0,"op_i":0,"status":"applied","is_success":true,"is_contract":false,"gas_limit":10407,"gas_used":10207,"gas_price":0.12687,"storage_limit":257,"storage_size":0,"storage_paid":0,"volume":0.1,"fee":0.001295,"burned":0.257,"days_destroyed":0.068681,"sender":"tz2B7ibGZBtVFLvRYBfe4Q9uw7SRE62MKZCD","receiver":"tz1YnM9JMYof5yKXzs3XptoJ1RMf1Ri7RuGF","confirmations":828813},{"row_id":34478135,"hash":"onyYeGLeSyy9JP1zmvfvAuUwhoEGwNUgXmaGLWLMacte1gpCb9M","type":"reveal","block":"BMDtRwahQYhtm8UYJxaF3fodXEWzajgGAB9asAXH9tY2e1qvnpK","time":"2020-10-23T08:40:12Z","height":1183505,"cycle":288,"counter":7522924,"op_l":3,"op_p":1,"op_c":0,"op_i":0,"status":"applied","is_success":true,"is_contract":false,"gas_limit":10200,"gas_used":10000,"gas_price":0.1233,"storage_limit":0,"storage_size":0,"storage_paid":0,"volume":0,"fee":0.001233,"has_data":true,"days_destroyed":0,"data":"edpkvZLkbFgjXLTqa193cDmrsWAo5Q7upHZMxacrobhQZUyTVU4ELs","sender":"tz1YnM9JMYof5yKXzs3XptoJ1RMf1Ri7RuGF","is_batch":true,"confirmations":828801},{"row_id":34478136,"hash":"onyYeGLeSyy9JP1zmvfvAuUwhoEGwNUgXmaGLWLMacte1gpCb9M","type":"transaction","block":"BMDtRwahQYhtm8UYJxaF3fodXEWzajgGAB9asAXH9tY2e1qvnpK","time":"2020-10-23T08:40:12Z","height":1183505,"cycle":288,"counter":7522925,"op_l":3,"op_p":1,"op_c":1,"op_i":0,"status":"applied","is_success":true,"is_contract":false,"gas_limit":10407,"gas_used":10207,"gas_price":0.12207,"storage_limit":0,"storage_size":0,"storage_paid":0,"volume":0.005,"fee":0.001246,"days_destroyed":0.000042,"sender":"tz1YnM9JMYof5yKXzs3XptoJ1RMf1Ri7RuGF","receiver":"tz2B7ibGZBtVFLvRYBfe4Q9uw7SRE62MKZCD","is_batch":true,"confirmations":828801},{"row_id":38645095,"hash":"ooatxJFR6pK6bAjhKNKf12fvAdtW4TRvH7dZYacAQYhyiL6QQvL","type":"transaction","block":"BKuzeoUVw6dR6SLkipz3xx6Q6Qk6aAy97Ndt9FCEX5mzmWCXzNK","time":"2021-01-04T17:20:39Z","height":1287969,"cycle":314,"counter":7522926,"op_l":3,"op_p":3,"op_c":0,"op_i":0,"status":"applied","is_success":true,"is_contract":false,"gas_limit":1627,"gas_used":1427,"gas_price":0.29222,"storage_limit":0,"storage_size":0,"storage_paid":0,"volume":0.08,"fee":0.000417,"days_destroyed":5.804222,"sender":"tz1YnM9JMYof5yKXzs3XptoJ1RMf1Ri7RuGF","receiver":"tz2MeLEMc2aBEQy71VKRpppBHbPmyFbkxK8m","confirmations":724337},{"row_id":38645135,"hash":"onpKtmX9nyrJzMRNrWb9UcUHu3p5Q1d3E5T8kGaSK4YizvcoViM","type":"transaction","block":"BMBkNAPb9yRJELH4f4Smr5JcuF5SD9Jc7JUWH9mEMHZn4BKEB2L","time":"2021-01-04T17:21:39Z","height":1287970,"cycle":314,"counter":7522927,"op_l":3,"op_p":4,"op_c":0,"op_i":0,"status":"applied","is_success":true,"is_contract":false,"gas_limit":1627,"gas_used":1427,"gas_price":0.29152,"storage_limit":0,"storage_size":0,"storage_paid":0,"volume":0.01,"fee":0.000416,"days_destroyed":0.725535,"sender":"tz1YnM9JMYof5yKXzs3XptoJ1RMf1Ri7RuGF","receiver":"tz2MeLEMc2aBEQy71VKRpppBHbPmyFbkxK8m","confirmations":724336},{"row_id":40482479,"hash":"opL9ynJ97b84eeuebMitDRowbc746boixTSgysVgezw9Hn7kyMB","type":"transaction","block":"BLkqeVdvakPyEVmJSwMtcFWbGfAr75iMdTZrM8avPaD7tkfcvqP","time":"2021-02-04T09:04:23Z","height":1330307,"cycle":324,"counter":9351481,"op_l":3,"op_p":3,"op_c":1,"op_i":0,"status":"applied","is_success":true,"is_contract":false,"gas_limit":1627,"gas_used":1427,"gas_price":0.25858,"storage_limit":0,"storage_size":0,"storage_paid":0,"volume":0.1,"fee":0.000369,"days_destroyed":2.939931,"sender":"tz2MeLEMc2aBEQy71VKRpppBHbPmyFbkxK8m","receiver":"tz1YnM9JMYof5yKXzs3XptoJ1RMf1Ri7RuGF","is_batch":true,"confirmations":681999}]}
{"address":"tz1YnM9JMYof5yKXzs3XptoJ1RMf1Ri7RuGF","address_type":"ed25519","pubkey":"edpkvZLkbFgjXLTqa193cDmrsWAo5Q7upHZMxacrobhQZUyTVU4ELs","first_in":1183493,"first_out":1183505,"last_in":1330307,"last_out":1287970,"first_seen":1183493,"last_seen":1330307,"first_in_time":"2020-10-23T08:28:12Z","first_out_time":"2020-10-23T08:40:12Z","last_in_time":"2021-02-04T09:04:23Z","last_out_time":"2021-01-04T17:21:39Z","first_seen_time":"2020-10-23T08:28:12Z","last_seen_time":"2021-02-04T09:04:23Z","total_received":0.2,"total_sent":0.095,"total_burned":0,"total_fees_paid":0.003312,"spendable_balance":0.101688,"total_balance":0.101688,"is_funded":true,"is_activated":false,"is_delegated":false,"is_revealed":true,"is_delegate":false,"is_active_delegate":false,"is_contract":false,"n_ops":6,"n_ops_failed":0,"n_tx":5,"n_delegation":0,"n_origination":0,"token_gen_min":5,"token_gen_max":46915,"ops":[{"row_id":34477812,"hash":"ood2tS8MmAjAfsauGs6tDCc9BqsFx7qPHREBgXWi7XyidE3qi5Z","type":"transaction","block":"BL67XN1mU2wGGi8MPzvFNyrjLaDdtnxUdUbDpYs6Ws8cVfy1Tm6","time":"2020-10-23T08:28:12Z","height":1183493,"cycle":288,"counter":7314353,"op_l":3,"op_p":1,"op_c":0,"op_i":0,"status":"applied","is_success":true,"is_contract":false,"gas_limit":10407,"gas_used":10207,"gas_price":0.12687,"storage_limit":257,"storage_size":0,"storage_paid":0,"volume":0.1,"fee":0.001295,"burned":0.257,"days_destroyed":0.068681,"sender":"tz2B7ibGZBtVFLvRYBfe4Q9uw7SRE62MKZCD","receiver":"tz1YnM9JMYof5yKXzs3XptoJ1RMf1Ri7RuGF","confirmations":941769},{"row_id":34478135,"hash":"onyYeGLeSyy9JP1zmvfvAuUwhoEGwNUgXmaGLWLMacte1gpCb9M","type":"reveal","block":"BMDtRwahQYhtm8UYJxaF3fodXEWzajgGAB9asAXH9tY2e1qvnpK","time":"2020-10-23T08:40:12Z","height":1183505,"cycle":288,"counter":7522924,"op_l":3,"op_p":1,"op_c":0,"op_i":0,"status":"applied","is_success":true,"is_contract":false,"gas_limit":10200,"gas_used":10000,"gas_price":0.1233,"storage_limit":0,"storage_size":0,"storage_paid":0,"volume":0,"fee":0.001233,"has_data":true,"days_destroyed":0,"data":"edpkvZLkbFgjXLTqa193cDmrsWAo5Q7upHZMxacrobhQZUyTVU4ELs","sender":"tz1YnM9JMYof5yKXzs3XptoJ1RMf1Ri7RuGF","is_batch":true,"confirmations":941757},{"row_id":34478136,"hash":"onyYeGLeSyy9JP1zmvfvAuUwhoEGwNUgXmaGLWLMacte1gpCb9M","type":"transaction","block":"BMDtRwahQYhtm8UYJxaF3fodXEWzajgGAB9asAXH9tY2e1qvnpK","time":"2020-10-23T08:40:12Z","height":1183505,"cycle":288,"counter":7522925,"op_l":3,"op_p":1,"op_c":1,"op_i":0,"status":"applied","is_success":true,"is_contract":false,"gas_limit":10407,"gas_used":10207,"gas_price":0.12207,"storage_limit":0,"storage_size":0,"storage_paid":0,"volume":0.005,"fee":0.001246,"days_destroyed":0.000042,"sender":"tz1YnM9JMYof5yKXzs3XptoJ1RMf1Ri7RuGF","receiver":"tz2B7ibGZBtVFLvRYBfe4Q9uw7SRE62MKZCD","is_batch":true,"confirmations":941757},{"row_id":38645095,"hash":"ooatxJFR6pK6bAjhKNKf12fvAdtW4TRvH7dZYacAQYhyiL6QQvL","type":"transaction","block":"BKuzeoUVw6dR6SLkipz3xx6Q6Qk6aAy97Ndt9FCEX5mzmWCXzNK","time":"2021-01-04T17:20:39Z","height":1287969,"cycle":314,"counter":7522926,"op_l":3,"op_p":3,"op_c":0,"op_i":0,"status":"applied","is_success":true,"is_contract":false,"gas_limit":1627,"gas_used":1427,"gas_price":0.29222,"storage_limit":0,"storage_size":0,"storage_paid":0,"volume":0.08,"fee":0.000417,"days_destroyed":5.804222,"sender":"tz1YnM9JMYof5yKXzs3XptoJ1RMf1Ri7RuGF","receiver":"tz2MeLEMc2aBEQy71VKRpppBHbPmyFbkxK8m","confirmations":837293},{"row_id":38645135,"hash":"onpKtmX9nyrJzMRNrWb9UcUHu3p5Q1d3E5T8kGaSK4YizvcoViM","type":"transaction","block":"BMBkNAPb9yRJELH4f4Smr5JcuF5SD9Jc7JUWH9mEMHZn4BKEB2L","time":"2021-01-04T17:21:39Z","height":1287970,"cycle":314,"counter":7522927,"op_l":3,"op_p":4,"op_c":0,"op_i":0,"status":"applied","is_success":true,"is_contract":false,"gas_limit":1627,"gas_used":1427,"gas_price":0.29152,"storage_limit":0,"storage_size":0,"storage_paid":0,"volume":0.01,"fee":0.000416,"days_destroyed":0.725535,"sender":"tz1YnM9JMYof5yKXzs3XptoJ1RMf1Ri7RuGF","receiver":"tz2MeLEMc2aBEQy71VKRpppBHbPmyFbkxK8m","confirmations":837292},{"row_id":40482479,"hash":"opL9ynJ97b84eeuebMitDRowbc746boixTSgysVgezw9Hn7kyMB","type":"transaction","block":"BLkqeVdvakPyEVmJSwMtcFWbGfAr75iMdTZrM8avPaD7tkfcvqP","time":"2021-02-04T09:04:23Z","height":1330307,"cycle":324,"counter":9351481,"op_l":3,"op_p":3,"op_c":1,"op_i":0,"status":"applied","is_success":true,"is_contract":false,"gas_limit":1627,"gas_used":1427,"gas_price":0.25858,"storage_limit":0,"storage_size":0,"storage_paid":0,"volume":0.1,"fee":0.000369,"days_destroyed":2.939931,"sender":"tz2MeLEMc2aBEQy71VKRpppBHbPmyFbkxK8m","receiver":"tz1YnM9JMYof5yKXzs3XptoJ1RMf1Ri7RuGF","is_batch":true,"confirmations":794955}]}


Loading

0 comments on commit 043597b

Please sign in to comment.