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

AVM: Add Semicolon Parsing #4363

Merged
merged 18 commits into from
Aug 11, 2022
Merged

AVM: Add Semicolon Parsing #4363

merged 18 commits into from
Aug 11, 2022

Conversation

iten-alg
Copy link
Contributor

@iten-alg iten-alg commented Aug 5, 2022

Summary

Test Plan

@iten-alg iten-alg requested a review from jannotti August 5, 2022 19:50
@iten-alg iten-alg changed the title Semicolons AVM: Add Semicolon Parsing Aug 5, 2022
Copy link
Contributor

@jannotti jannotti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks almost ready. Thanks for all those test changes, I'm sure it was a pain.

data/transactions/logic/assembler.go Outdated Show resolved Hide resolved
data/transactions/logic/assembler.go Outdated Show resolved Hide resolved
data/transactions/logic/assembler.go Outdated Show resolved Hide resolved
data/transactions/logic/assembler.go Outdated Show resolved Hide resolved
data/transactions/logic/assembler.go Outdated Show resolved Hide resolved
data/transactions/logic/assembler_test.go Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Aug 9, 2022

Codecov Report

Merging #4363 (8b9b516) into master (60fb4f6) will increase coverage by 0.00%.
The diff coverage is 88.75%.

@@           Coverage Diff           @@
##           master    #4363   +/-   ##
=======================================
  Coverage   55.60%   55.61%           
=======================================
  Files         403      403           
  Lines       50801    50811   +10     
=======================================
+ Hits        28250    28260   +10     
  Misses      20157    20157           
  Partials     2394     2394           
Impacted Files Coverage Δ
data/transactions/logic/assembler.go 85.12% <88.75%> (-0.04%) ⬇️
agreement/cryptoVerifier.go 67.60% <0.00%> (-2.12%) ⬇️
agreement/proposalManager.go 96.07% <0.00%> (-1.97%) ⬇️
cmd/tealdbg/debugger.go 72.69% <0.00%> (-0.81%) ⬇️
network/wsNetwork.go 64.70% <0.00%> (-0.20%) ⬇️
ledger/tracker.go 78.63% <0.00%> (ø)
catchup/service.go 70.12% <0.00%> (+0.74%) ⬆️
network/wsPeer.go 67.67% <0.00%> (+2.19%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@iten-alg iten-alg requested a review from jannotti August 9, 2022 20:02
data/transactions/logic/assembler.go Outdated Show resolved Hide resolved
data/transactions/logic/assembler_test.go Outdated Show resolved Hide resolved
data/transactions/logic/evalAppTxn_test.go Outdated Show resolved Hide resolved
@iten-alg iten-alg requested a review from jannotti August 9, 2022 21:08
@iten-alg iten-alg requested a review from jannotti August 10, 2022 20:02
Copy link
Contributor

@jannotti jannotti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

}
}
return tokens, nil
}
Copy link
Contributor

@tzaffi tzaffi Aug 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the fact that splitTokens() behaves differently for the following 2 examples problematic? (the 2nd output isn't consistently nil):

	tokens := []string{"hello", "there"}
	splitTokens(tokens)

	tokens = []string{"hello", "there", ";"}
	splitTokens(tokens)

See the playground

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the difference will turn out to be important in the next step of the plan. Once tokens can expand into other tokens, it will matter whether something expands to included the semi or not. So I think the distinction is useful. (But in the meantime, the distinction won't matter because the next tokens are tested with len.

Copy link
Contributor

@tzaffi tzaffi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a reasonable change. I made a suggestion regarding adding more test cases to TestFieldsFromLine. You might also consider adding a unit test for the new helpersplitTokens(). Though it is implicitly tested in TestFieldsFromLine adding more unit tests to such an important part of the codebase seems beneficial to me.

@iten-alg
Copy link
Contributor Author

Thanks for the feedback Zeph! I've gone through and addressed all the comments I believe

@iten-alg iten-alg requested a review from jannotti August 11, 2022 17:01
check(`"" // test`, `""`)
check("int 1; int 2", "int", "1", ";", "int", "2")
check("int 1;;;int 2", "int", "1", ";", ";", ";", "int", "2")
check("int 1; ;int 2;; ; ;; ", "int", "1", ";", ";", "int", "2", ";", ";", ";", ";", ";")
Copy link
Contributor

@tzaffi tzaffi Aug 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about:

  • "int 1; ;int 2;; ; ;;"
    *"int 1; ;int 2;"
  • ";"
  • "; ; ;;;;"
  • " ;"
  • " ; "

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(or slight variants that are sensible given how the test works)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, I added most of them (the first I think was pretty covered already so I left that out)

Copy link
Contributor

@tzaffi tzaffi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants