-
Notifications
You must be signed in to change notification settings - Fork 696
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
Prevents EthereumBlobExporter from consuming dest when returning NotApplicable #5789
Changes from 5 commits
e6837de
b96caa5
1f4c919
bfc90ba
668fd3b
4fe4085
caa4ea5
fb04b1d
eeb8754
2fca3c4
777bfe3
700a875
d34be33
d8b666e
92a1847
754f524
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,9 +71,13 @@ impl<UniversalLocation, EthereumNetwork, OutboundQueue, AgentHashedDescription, | |
let dest = destination.take().ok_or(SendError::MissingArgument)?; | ||
if dest != Here { | ||
log::trace!(target: "xcm::ethereum_blob_exporter", "skipped due to unmatched remote destination {dest:?}."); | ||
// We need to make sure that mutable variables are not consumed in case of | ||
// `NotApplicable`, since they may be used by a subsequent exporter. | ||
*destination = Some(dest); | ||
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. @claravanstaden
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. I wondered about that one, because the comment only mentions dest and msg. But basically no mutable parameters should be altered when the error is 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. Fixed in bfc90ba. This case is easy to miss... Perhaps the parameters should not be mutable in the first place? 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. |
||
return Err(SendError::NotApplicable) | ||
} | ||
|
||
let universal_source_value = universal_source.clone(); | ||
let (local_net, local_sub) = universal_source | ||
.take() | ||
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. Same as #5789 (comment) 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. |
||
.ok_or_else(|| { | ||
|
@@ -88,6 +92,10 @@ impl<UniversalLocation, EthereumNetwork, OutboundQueue, AgentHashedDescription, | |
|
||
if Ok(local_net) != universal_location.global_consensus() { | ||
log::trace!(target: "xcm::ethereum_blob_exporter", "skipped due to unmatched relay network {local_net:?}."); | ||
// We need to make sure that mutable variables are not consumed in case of | ||
// `NotApplicable`, since they may be used by a subsequent exporter. | ||
*universal_source = universal_source_value.clone(); | ||
*destination = Some(dest); | ||
return Err(SendError::NotApplicable) | ||
} | ||
|
||
|
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.
How about just replace
take
here withclone
without other reset operations?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.
Good point, that is much better. :) 4fe4085