This repository was archived by the owner on Feb 12, 2025. It is now read-only.
[WIP] [COIN 584] [XTZ] Improve Fees and GasLimit using a RPC node#673
Merged
hlafet-ledger merged 3 commits intonrt_tezosfrom Dec 3, 2020
Merged
[WIP] [COIN 584] [XTZ] Improve Fees and GasLimit using a RPC node#673hlafet-ledger merged 3 commits intonrt_tezosfrom
hlafet-ledger merged 3 commits intonrt_tezosfrom
Conversation
…' into nrt_tezos # Conflicts: # core/src/tezos/TezosLikeExtendedPublicKey.cpp # core/src/wallet/tezos/TezosLikeAccount2.cpp # core/src/wallet/tezos/api_impl/TezosLikeTransactionApi.cpp # core/src/wallet/tezos/explorers/ExternalTezosLikeBlockchainExplorer.cpp
hlafet-ledger
suggested changes
Nov 30, 2020
| || (request.type != api::TezosOperationTag::OPERATION_TAG_DELEGATION && !request.value && !request.wipe)) { | ||
| throw make_exception(api::ErrorCode::INVALID_ARGUMENT, | ||
| "Missing mandatory informations (e.g. gasLimit, gasPrice or value)."); | ||
| } |
| return self->estimateGasLimit(filledTx).flatMapPtr<api::TezosLikeTransaction>(self->getMainExecutionContext(), [filledTx, gasPrice] (const std::shared_ptr<BigInt> &gas) -> FuturePtr<api::TezosLikeTransaction> { | ||
| // 0.000001 comes from the gasPrice->toInt64 being in picoTez | ||
| const auto fees = std::make_shared<BigInt>(static_cast<int64_t>(1 + static_cast<double>(gas->toInt64()) * static_cast<double>(gasPrice->toInt64()) * 0.000001)); | ||
| filledTx->setTransactionGasLimit(gas); |
Contributor
There was a problem hiding this comment.
we are missing here setRevealGasLimit and setRevealFees
| ExternalTezosLikeBlockchainExplorer::getFees() { | ||
| const bool parseNumbersAsString = true; | ||
| const auto feesField = | ||
| getConfiguration()->getString(api::Configuration::BLOCKCHAIN_EXPLORER_API_ENDPOINT) |
Contributor
There was a problem hiding this comment.
you are roll-backing here the new dev about the "fee"/"fees" fix
| { | ||
| // FIXME: await the correct chain id instead of hardcoded value | ||
| // ChainID is obtained by doing GET RPCNode /chains/main/chain_id | ||
| const auto strChainID = "NetXdQprcVkpaWU"; |
Contributor
There was a problem hiding this comment.
a missed hardcoded value ?
| vString.SetString(hash.c_str(), static_cast<SizeType>(hash.length()), allocator); | ||
| opObject.AddMember("branch", vString, allocator); | ||
|
|
||
| // Fake sign |
Contributor
There was a problem hiding this comment.
Fake sign is hardcoded because the signature must be in a format that tezos node can parse, even if it’s never verified
hlafet-ledger
approved these changes
Dec 3, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR provides a way to get much better XTZ gas and fees estimations. It's merely a merge of the work done by @gagbo:
#643
Conflicts: