Skip to content

Conversation

@iten-alg
Copy link
Contributor

@iten-alg iten-alg commented Jun 1, 2022

Summary

This PR will allow us to error on things of the sort:
"byte 0x01; store 0; int 1; load 0; +"
by keeping track of the scratch space as we assemble the program within each basic block.

Test Plan

Load/Store: Tested to make sure a load in the first block puts a uint64 on the stack and that load puts the type of whatever was last stored in that slot if a store was done in that block

Loads/Stores: Added test for loads when all the slots are the same type and put in a test for stores which makes sure it only sets slots to StackAny if the type is not the same as what's on the stack

@iten-alg iten-alg requested a review from jannotti June 1, 2022 19:56
@codecov
Copy link

codecov bot commented Jun 2, 2022

Codecov Report

Merging #4064 (962b55f) into master (8088e04) will increase coverage by 0.01%.
The diff coverage is 81.57%.

@@            Coverage Diff             @@
##           master    #4064      +/-   ##
==========================================
+ Coverage   54.39%   54.40%   +0.01%     
==========================================
  Files         391      391              
  Lines       48570    48594      +24     
==========================================
+ Hits        26418    26436      +18     
- Misses      19929    19936       +7     
+ Partials     2223     2222       -1     
Impacted Files Coverage Δ
data/transactions/logic/opcodes.go 84.86% <ø> (ø)
data/transactions/logic/assembler.go 83.31% <81.57%> (+0.16%) ⬆️
ledger/blockqueue.go 82.18% <0.00%> (-2.88%) ⬇️
ledger/tracker.go 74.45% <0.00%> (-2.17%) ⬇️
catchup/peerSelector.go 98.95% <0.00%> (-1.05%) ⬇️
cmd/tealdbg/debugger.go 72.69% <0.00%> (-0.81%) ⬇️
network/wsNetwork.go 62.79% <0.00%> (-0.20%) ⬇️
ledger/acctupdates.go 69.43% <0.00%> (+0.65%) ⬆️
data/transactions/verify/txn.go 45.02% <0.00%> (+0.86%) ⬆️
cmd/algoh/blockWatcher.go 80.95% <0.00%> (+3.17%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8088e04...962b55f. Read the comment docs.

jannotti
jannotti previously approved these changes Jun 3, 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.

Looks good to me. I'd like @michaeldiamant to have a look on Monday when he comes back as I think he's the only other person who has looked at ProgramKnowledge.

iten-alg and others added 2 commits June 9, 2022 11:19
Co-authored-by: Michael Diamant <michaeldiamant@users.noreply.github.com>
Refactor scratchSpace initialization into newOpStream
@jannotti jannotti merged commit cb3d5c6 into algorand:master Jun 9, 2022
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.

Assembler should track scratch slot types for better type checking

3 participants