Skip to content
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(compiler): Fix topology for adjacent ons [LNG-257] #929

Merged
merged 10 commits into from
Oct 17, 2023

Conversation

InversionSpaces
Copy link
Contributor

@InversionSpaces InversionSpaces commented Oct 12, 2023

  • Update topology: while computing pathAfter, find next ForceExecModel and generate exit to relay if its pathOn does not match our afterOn (it means that more hops will be done to reach it.
  • Add unit and integration tests

@linear
Copy link

linear bot commented Oct 12, 2023

LNG-257 Incorrect topology with adjacent `on`s

aqua:

func rem(x: i32) -> i32:
    <- x % 2

func test(a: i32) -> []i32:
    result: *i32

    on HOST_PEER_ID:
        result <- rem(a + 1)
        on "worker" via "host":
            result <- rem(a + 2)
        on INIT_PEER_ID via HOST_PEER_ID:
            result <- rem(a + 3)
        
    <- result

bair:

try:
    -relay- <- call %init_peer_id% ("getDataSrv", "-relay-") []
    -a-arg- <- call %init_peer_id% ("getDataSrv", "a") []
    new $result:
        try:
            add <- call -relay- ("math", "add") [-a-arg-, 1]
            rem-0 <- call -relay- ("math", "rem") [add, 2]
            ap rem-0 $result
            try:
                new $-ephemeral-stream-:
                    new #-ephemeral-canon-:
                        canon "host" $-ephemeral-stream- #-ephemeral-canon-
                add-0 <- call "worker" ("math", "add") [-a-arg-, 2]
                rem-1 <- call "worker" ("math", "rem") [add-0, 2]
                ap rem-1 $result
                new $-ephemeral-stream-:
                    new #-ephemeral-canon-:
                        canon "host" $-ephemeral-stream- #-ephemeral-canon-
            catch:
                new $-ephemeral-stream-:
                    new #-ephemeral-canon-:
                        canon "host" $-ephemeral-stream- #-ephemeral-canon-
                new $-ephemeral-stream-:
                    new #-ephemeral-canon-:
                        canon -relay- $-ephemeral-stream- #-ephemeral-canon-
                fail :error:
            try:
                ;; No hop to -relay- here
                add-1 <- call %init_peer_id% ("math", "add") [-a-arg-, 3]
                rem-2 <- call %init_peer_id% ("math", "rem") [add-1, 2]
                ap rem-2 $result
            catch:
                fail :error:
        catch:
            fail :error:
        canon %init_peer_id% $result #-result-fix-0
        ap #-result-fix-0 -result-flat-0
    call %init_peer_id% ("callbackSrv", "response") [-result-flat-0]
catch:
    call %init_peer_id% ("errorHandlingSrv", "error") [:error:, 0]

No hop to -relay- is generated

@InversionSpaces InversionSpaces added the e2e Run e2e workflow label Oct 12, 2023
@InversionSpaces InversionSpaces force-pushed the fix/adj-on-topology-LNG-257 branch from c8343a9 to da57f04 Compare October 16, 2023 16:02
@InversionSpaces InversionSpaces marked this pull request as ready for review October 17, 2023 11:41
@InversionSpaces InversionSpaces enabled auto-merge (squash) October 17, 2023 11:47
@InversionSpaces InversionSpaces merged commit ba15d9e into main Oct 17, 2023
9 checks passed
@InversionSpaces InversionSpaces deleted the fix/adj-on-topology-LNG-257 branch October 17, 2023 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e2e Run e2e workflow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants