-
Notifications
You must be signed in to change notification settings - Fork 34
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
Fix payment_queryInfo #2188
Merged
Merged
Fix payment_queryInfo #2188
Changes from 3 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
9ba8cf4
Add rpc log
kamilsa 1a7d2b0
Add rpc response log
kamilsa 259e3a1
Fix payment query info, obsolete old api
kamilsa 725429a
Self-review issues
kamilsa 3267153
Clang-format
kamilsa 3340f38
Add missing == operator
kamilsa 9b542c8
Remove redundant 0 in stream operator
kamilsa 9ab2cbb
Revert "Add missing == operator"
kamilsa fc8b127
Fix clang-tidy
kamilsa 6456580
Update core/runtime/runtime_api/impl/transaction_payment_api.cpp
kamilsa 42ca1a0
Fix tests
kamilsa 8045bff
Merge remote-tracking branch 'origin/test/print-rpc' into test/print-rpc
kamilsa f9909d6
Review issues
kamilsa 01cf0a0
Fix offchain extension test
kamilsa 6012ad9
Merge branch 'master' into test/print-rpc
kamilsa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -16,6 +16,8 @@ OUTCOME_CPP_DEFINE_CATEGORY(kagome::runtime, | |||||
switch (err) { | ||||||
case E::TRANSACTION_PAYMENT_API_NOT_FOUND: | ||||||
return "Transaction payment runtime API is not found in the runtime"; | ||||||
case TransactionPaymentApiImpl::Error::API_BELOW_VERSION_2_NOT_SUPPORTED: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
return "API below version 2 is not supported"; | ||||||
} | ||||||
return "Unknown TransactionPaymentApiImpl error"; | ||||||
} | ||||||
|
@@ -32,7 +34,7 @@ namespace kagome::runtime { | |||||
BOOST_ASSERT(hasher_); | ||||||
} | ||||||
|
||||||
outcome::result<primitives::RuntimeDispatchInfo<primitives::OldWeight>> | ||||||
outcome::result<primitives::RuntimeDispatchInfo<primitives::Weight>> | ||||||
TransactionPaymentApiImpl::query_info(const primitives::BlockHash &block, | ||||||
const primitives::Extrinsic &ext, | ||||||
uint32_t len) { | ||||||
|
@@ -56,19 +58,18 @@ namespace kagome::runtime { | |||||
auto api_version = res->second; | ||||||
OUTCOME_TRY(ctx, executor_->ctx().ephemeralAt(block)); | ||||||
if (api_version < 2) { | ||||||
return executor_ | ||||||
->call<primitives::RuntimeDispatchInfo<primitives::OldWeight>>( | ||||||
ctx, "TransactionPaymentApi_query_info", ext.data, len); | ||||||
return Error::API_BELOW_VERSION_2_NOT_SUPPORTED; | ||||||
} | ||||||
OUTCOME_TRY( | ||||||
result, | ||||||
executor_->call<primitives::RuntimeDispatchInfo<primitives::Weight>>( | ||||||
ctx, "TransactionPaymentApi_query_info", ext.data, len)); | ||||||
primitives::RuntimeDispatchInfo<primitives::OldWeight> old_format_result; | ||||||
old_format_result.dispatch_class = result.dispatch_class; | ||||||
old_format_result.partial_fee = result.partial_fee; | ||||||
old_format_result.weight = result.weight.ref_time; | ||||||
return old_format_result; | ||||||
primitives::RuntimeDispatchInfo<primitives::Weight> weight_result; | ||||||
weight_result.dispatch_class = result.dispatch_class; | ||||||
weight_result.partial_fee = result.partial_fee; | ||||||
weight_result.weight.ref_time = result.weight.ref_time; | ||||||
weight_result.weight.proof_size = result.weight.proof_size; | ||||||
kamilsa marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
return result; | ||||||
} | ||||||
|
||||||
} // namespace kagome::runtime |
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Под шумок