-
Notifications
You must be signed in to change notification settings - Fork 70
Merge develop branch to boxes feature branch #354
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2754771
Ignore copied over txt test resource files (#342)
michaeldiamant c792c63
Github-Actions: Adding pr title and label checks (#339)
algojack 46577d5
Enhancement: Add UNKNOWN enum type to HTTP client enums. (#351)
winder 5e373bd
AVM: Consolidate TEAL and AVM versions (#348)
michaeldiamant 369b9a0
Testing: Modify cucumber steps to use dev mode network (#350)
michaeldiamant 5db404e
DevTools: adding source map decoder (#352)
barnjamin 0bc4b8a
Merge branch 'develop' into feature/box-storage
algochoi bae538d
Add back line in makefile
algochoi 9529ec1
Remove redundant mvn test
algochoi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| changelog: | ||
| exclude: | ||
| labels: | ||
| - Skip-Release-Notes | ||
| categories: | ||
| - title: Bugfixes | ||
| labels: | ||
| - Bug-Fix | ||
| - title: New Features | ||
| labels: | ||
| - New Feature | ||
| - title: Enhancements | ||
| labels: | ||
| - Enhancement | ||
| - title: Not Yet Enabled | ||
| labels: | ||
| - Not-Yet-Enabled | ||
| - title: Other | ||
| labels: | ||
| - "*" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| name: Check PR category and type | ||
| on: | ||
| pull_request: | ||
| branches: | ||
| - develop | ||
| types: [opened, synchronize, reopened, labeled, unlabeled, edited] | ||
| jobs: | ||
| check_label: | ||
| runs-on: ubuntu-latest | ||
| name: Check PR Category and Type | ||
| steps: | ||
| - name: Checking for correct number of required github pr labels | ||
| uses: mheap/github-action-required-labels@v2 | ||
| with: | ||
| mode: exactly | ||
| count: 1 | ||
| labels: "New Feature, Enhancement, Bug-Fix, Not-Yet-Enabled, Skip-Release-Notes" | ||
|
|
||
| - name: "Checking for PR Category in PR title. Should be like '<category>: <pr title>'." | ||
| run: | | ||
| if [[ ! "${{ github.event.pull_request.title }}" =~ ^.{2,}\:.{2,} ]]; then | ||
| echo "## PR Category is missing from PR title. Please add it like '<category>: <pr title>'." >> GITHUB_STEP_SUMMARY | ||
| exit 1 | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| unit: | ||
| mvn test -Dcucumber.filter.tags="@unit.offline or @unit.algod or @unit.indexer or @unit.rekey or @unit.indexer.rekey or @unit.transactions or @unit.transactions.keyreg or @unit.responses or @unit.applications or @unit.applications.boxes or @unit.dryrun or @unit.tealsign or @unit.responses.messagepack or @unit.responses.231 or @unit.responses.messagepack.231 or @unit.feetest or @unit.indexer.logs or @unit.abijson or @unit.abijson.byname or @unit.atomic_transaction_composer or @unit.transactions.payment or @unit.responses.unlimited_assets or @unit.algod.ledger_refactoring or @unit.indexer.ledger_refactoring or @unit.dryrun.trace.application" | ||
| mvn test -Dcucumber.filter.tags="@unit.offline or @unit.algod or @unit.indexer or @unit.rekey or @unit.indexer.rekey or @unit.transactions or @unit.transactions.keyreg or @unit.responses or @unit.applications or @unit.applications.boxes or @unit.dryrun or @unit.tealsign or @unit.responses.messagepack or @unit.responses.231 or @unit.responses.messagepack.231 or @unit.feetest or @unit.indexer.logs or @unit.abijson or @unit.abijson.byname or @unit.atomic_transaction_composer or @unit.transactions.payment or @unit.responses.unlimited_assets or @unit.algod.ledger_refactoring or @unit.indexer.ledger_refactoring or @unit.dryrun.trace.application or @unit.sourcemap" | ||
|
|
||
| integration: | ||
| mvn test -Dcucumber.filter.tags="@algod or @assets or @auction or @kmd or @send or @send.keyregtxn or @indexer or @rekey or @applications.verified or @applications or @applications.boxes or @compile or @dryrun or @indexer.applications or @indexer.231 or @abi or @c2c" | ||
| mvn test -Dcucumber.filter.tags="@algod or @assets or @auction or @kmd or @send or @send.keyregtxn or @indexer or @rekey_v1 or @applications.verified or @applications or @applications.boxes or @compile or @dryrun or @indexer.applications or @indexer.231 or @abi or @c2c or @compile.sourcemap" | ||
|
|
||
| docker-test: | ||
| ./run_integration_tests.sh | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 121 additions & 0 deletions
121
src/main/java/com/algorand/algosdk/logic/SourceMap.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| package com.algorand.algosdk.logic; | ||
|
|
||
| import java.lang.Integer; | ||
| import java.util.ArrayList; | ||
| import java.util.HashMap; | ||
|
|
||
| /** | ||
| * SourceMap class provides parser for source map from | ||
| * algod compile endpoint | ||
| */ | ||
| public class SourceMap { | ||
|
|
||
| public int version; | ||
| public String file; | ||
| public String[] sources; | ||
| public String[] names; | ||
| public String mappings; | ||
|
|
||
| public HashMap<Integer, Integer> pcToLine; | ||
| public HashMap<Integer, ArrayList<Integer>> lineToPc; | ||
|
|
||
| public SourceMap(HashMap<String,Object> sourceMap) { | ||
| int version = (int) sourceMap.get("version"); | ||
| if(version != 3){ | ||
| throw new IllegalArgumentException("Only source map version 3 is supported"); | ||
| } | ||
| this.version = version; | ||
|
|
||
| this.file = (String) sourceMap.get("file"); | ||
| this.mappings = (String) sourceMap.get("mappings"); | ||
|
|
||
| this.lineToPc = new HashMap<>(); | ||
| this.pcToLine = new HashMap<>(); | ||
|
|
||
| Integer lastLine = 0; | ||
| String[] vlqs = this.mappings.split(";"); | ||
| for(int i=0; i<vlqs.length; i++){ | ||
| ArrayList<Integer> vals = VLQDecoder.decodeSourceMapLine(vlqs[i]); | ||
|
|
||
| // If the vals length >= 3 the lineDelta | ||
| if(vals.size() >= 3){ | ||
| lastLine = lastLine + vals.get(2); | ||
| } | ||
|
|
||
| if(!this.lineToPc.containsKey(lastLine)){ | ||
| this.lineToPc.put(lastLine, new ArrayList<Integer>()); | ||
| } | ||
|
|
||
| ArrayList<Integer> currList = this.lineToPc.get(lastLine); | ||
| currList.add(i); | ||
| this.lineToPc.put(lastLine, currList); | ||
|
|
||
| this.pcToLine.put(i, lastLine); | ||
| } | ||
|
|
||
| } | ||
|
|
||
| /** | ||
| * Returns the Integer line number for the passed PC or null if not found | ||
| * @param pc the pc (program counter) of the assembled file | ||
| * @return the line number or null if not found | ||
| */ | ||
| public Integer getLineForPc(Integer pc) { | ||
| return this.pcToLine.get(pc); | ||
| } | ||
|
|
||
| /** | ||
| * Returns the List of PCs for the passed line number | ||
| * @param line the line number of the source file | ||
| * @return the list of PCs that line generated or empty array if not found | ||
| */ | ||
| public ArrayList<Integer> getPcsForLine(Integer line) { | ||
| if(!this.pcToLine.containsKey(line)){ | ||
| return new ArrayList<Integer>(); | ||
| } | ||
| return this.lineToPc.get(line); | ||
| } | ||
|
|
||
| private static class VLQDecoder { | ||
| // VLQDecoder for decoding the VLQ values returned for source map | ||
| // based on the decoder implementation here: https://github.com/algorand/go-algorand-sdk/blob/develop/logic/source_map.go | ||
|
|
||
| private static final String b64table = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | ||
| private static final int vlqShiftSize = 5; | ||
| private static final int vlqFlag = 1 << vlqShiftSize; | ||
| private static final int vlqMask = vlqFlag - 1; | ||
|
|
||
| public static ArrayList<Integer> decodeSourceMapLine(String vlq) { | ||
|
|
||
| ArrayList<Integer> results = new ArrayList<>(); | ||
| int value = 0; | ||
| int shift = 0; | ||
|
|
||
| for(int i=0; i<vlq.length(); i++){ | ||
| int digit = b64table.indexOf(vlq.charAt(i)); | ||
|
|
||
| value |= (digit & vlqMask) << shift; | ||
|
|
||
| if((digit & vlqFlag) > 0) { | ||
| shift += vlqShiftSize; | ||
| continue; | ||
| } | ||
|
|
||
| if((value&1)>0){ | ||
| value = (value >> 1) * -1; | ||
| }else{ | ||
| value = value >> 1; | ||
| } | ||
|
|
||
| results.add(value); | ||
|
|
||
| // Reset | ||
| value = 0; | ||
| shift = 0; | ||
| } | ||
|
|
||
| return results; | ||
| } | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.