-
Notifications
You must be signed in to change notification settings - Fork 680
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
Optimize reanchor #897
Comments
We will have a hiring candidate working on this one. |
Hey! Just started looking at this. I was messing with different inputs in the tests to make sure I understand the behavior of the current implementation of
I got
Do we want the |
It looks to me that the What the I would therefore expect the result after reanchoring to be Recall that the purpose of reanchoring is to rewrite the |
Oh hm this is helpful, thanks @KiChjang. I have another question though: the first test case shows that the let mut id: MultiLocation = (Parent, Parachain(1000), Parachain(4000), GeneralIndex(42)).into();
let ancestry = Parachain(2000).into();
let target = (Parent, Parachain(3000), Parachain(1000)).into();
let expected = (Parachain(4000), GeneralIndex(42)).into();
id.reanchor(&target, &ancestry).unwrap();
assert_eq!(id, expected); This gave:
I am confused that |
I think there was a miscommunication -- the Therefore the two examples you gave are already consistent. In both examples, |
Perhaps the part that you were stuck in is understanding that the |
Ok thanks! I now think I understand that
Isn't |
Look closer at your |
Oh I thought that all the |
That's correct. You can think of each junction as the next hop that you need to reach from the previous junction, so |
This might be silly question - how do I get
This isn't blocking since I can always |
@emmaling27 You can also try Finally, you can also try a special macro we have, which places code to only be compiled when compiling with
This will be compiled out when compiling However, most of the time I am doing print statements, I am just running local tests, which should support std anyway. If this is not enough info, provide a sample of where you want to |
@shawntabrizi thanks I will try that next time! I opened a PR here paritytech/polkadot#4697 let me know your thoughts! |
I think this can be closed. cc @KiChjang |
Probably not actually; the algorithm for reanchoring hasn't changed at all and so we'd still like to optimize it. |
* Small naming clean up. * Small naming clean up. * Add Rococo module to CLI Co-authored-by: Svyatoslav Nikolsky <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
* Small naming clean up. * Small naming clean up. * Add Rococo module to CLI Co-authored-by: Svyatoslav Nikolsky <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
* Small naming clean up. * Small naming clean up. * Add Rococo module to CLI Co-authored-by: Svyatoslav Nikolsky <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
* Small naming clean up. * Small naming clean up. * Add Rococo module to CLI Co-authored-by: Svyatoslav Nikolsky <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
* Small naming clean up. * Small naming clean up. * Add Rococo module to CLI Co-authored-by: Svyatoslav Nikolsky <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
* Small naming clean up. * Small naming clean up. * Add Rococo module to CLI Co-authored-by: Svyatoslav Nikolsky <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
* Small naming clean up. * Small naming clean up. * Add Rococo module to CLI Co-authored-by: Svyatoslav Nikolsky <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
* Small naming clean up. * Small naming clean up. * Add Rococo module to CLI Co-authored-by: Svyatoslav Nikolsky <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
* Small naming clean up. * Small naming clean up. * Add Rococo module to CLI Co-authored-by: Svyatoslav Nikolsky <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
* Small naming clean up. * Small naming clean up. * Add Rococo module to CLI Co-authored-by: Svyatoslav Nikolsky <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
* Small naming clean up. * Small naming clean up. * Add Rococo module to CLI Co-authored-by: Svyatoslav Nikolsky <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
* Small naming clean up. * Small naming clean up. * Add Rococo module to CLI Co-authored-by: Svyatoslav Nikolsky <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
* Small naming clean up. * Small naming clean up. * Add Rococo module to CLI Co-authored-by: Svyatoslav Nikolsky <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
* Small naming clean up. * Small naming clean up. * Add Rococo module to CLI Co-authored-by: Svyatoslav Nikolsky <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
* Small naming clean up. * Small naming clean up. * Add Rococo module to CLI Co-authored-by: Svyatoslav Nikolsky <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
* Small naming clean up. * Small naming clean up. * Add Rococo module to CLI Co-authored-by: Svyatoslav Nikolsky <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
Concerning
MultiLocation::reanchor
:So I realized that what we're essentially doing here is to first find the common ancestor between
self
andtarget
, then append the necessary junctions that will allow us to reachself
from the common ancestor, and then we'd simplify the result, giventarget
.I suspect what we can do here is to write the common ancestor from the perspective of
target
, that way we don't have to simplify at the end of the algorithm.Originally posted by @KiChjang in paritytech/polkadot#4470 (comment)
The text was updated successfully, but these errors were encountered: