Skip to content

Commit b9fa576

Browse files
committed
Merge branch 'release/1.17.0'
2 parents 5bc4069 + ef5a1ea commit b9fa576

File tree

16 files changed

+534
-37
lines changed

16 files changed

+534
-37
lines changed

.github/release.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
changelog:
2+
exclude:
3+
labels:
4+
- Skip-Release-Notes
5+
categories:
6+
- title: Bugfixes
7+
labels:
8+
- Bug-Fix
9+
- title: New Features
10+
labels:
11+
- New Feature
12+
- title: Enhancements
13+
labels:
14+
- Enhancement
15+
- title: Not Yet Enabled
16+
labels:
17+
- Not-Yet-Enabled
18+
- title: Other
19+
labels:
20+
- "*"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Check PR category and type
2+
on:
3+
pull_request:
4+
branches:
5+
- develop
6+
types: [opened, synchronize, reopened, labeled, unlabeled, edited]
7+
jobs:
8+
check_label:
9+
runs-on: ubuntu-latest
10+
name: Check PR Category and Type
11+
steps:
12+
- name: Checking for correct number of required github pr labels
13+
uses: mheap/github-action-required-labels@v2
14+
with:
15+
mode: exactly
16+
count: 1
17+
labels: "New Feature, Enhancement, Bug-Fix, Not-Yet-Enabled, Skip-Release-Notes"
18+
19+
- name: "Checking for PR Category in PR title. Should be like '<category>: <pr title>'."
20+
run: |
21+
if [[ ! "${{ github.event.pull_request.title }}" =~ ^.{2,}\:.{2,} ]]; then
22+
echo "## PR Category is missing from PR title. Please add it like '<category>: <pr title>'." >> GITHUB_STEP_SUMMARY
23+
exit 1
24+
fi

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ src/test/resources/**/*.json
66
src/test/resources/**/*.base64
77
src/test/resources/**/*.teal
88
src/test/resources/**/*.tok
9+
src/test/resources/**/*.txt
910

1011
# OS X
1112
.DS_Store

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
# 1.17.0
2+
### New Features
3+
* DevTools: adding source map decoder by @barnjamin in https://github.com/algorand/java-algorand-sdk/pull/352
4+
### Enhancements
5+
* Github-Actions: Adding pr title and label checks by @algojack in https://github.com/algorand/java-algorand-sdk/pull/339
6+
* Enhancement: Add UNKNOWN enum type to HTTP client enums. by @winder in https://github.com/algorand/java-algorand-sdk/pull/351
7+
* AVM: Consolidate TEAL and AVM versions by @michaeldiamant in https://github.com/algorand/java-algorand-sdk/pull/348
8+
* Testing: Modify cucumber steps to use dev mode network by @michaeldiamant in https://github.com/algorand/java-algorand-sdk/pull/350
9+
### Other
10+
* Ignore copied over txt test resource files by @michaeldiamant in https://github.com/algorand/java-algorand-sdk/pull/342
11+
112
# 1.16.0
213

314
## What's Changed

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
unit:
2-
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.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"
2+
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.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"
33

44
integration:
5-
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 @compile or @dryrun or @indexer.applications or @indexer.231 or @abi or @c2c"
5+
mvn test \
6+
-Dtest=com.algorand.algosdk.integration.RunCucumberIntegrationTest \
7+
-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 @compile or @dryrun or @indexer.applications or @indexer.231 or @abi or @c2c or @compile.sourcemap"
68

79
docker-test:
810
./run_integration_tests.sh

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Maven:
1919
<dependency>
2020
<groupId>com.algorand</groupId>
2121
<artifactId>algosdk</artifactId>
22-
<version>1.16.0</version>
22+
<version>1.17.0</version>
2323
</dependency>
2424
```
2525

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.algorand</groupId>
66
<artifactId>algosdk</artifactId>
7-
<version>1.16.0</version>
7+
<version>1.17.0</version>
88
<packaging>jar</packaging>
99

1010
<name>${project.groupId}:${project.artifactId}</name>

src/main/java/com/algorand/algosdk/logic/Logic.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,14 +250,14 @@ public static ProgramData readProgram(byte[] program, List<byte[]> args) throws
250250
}
251251
// costs calculated dynamically starting in v4
252252
if (version < 4 && cost > MAX_COST) {
253-
throw new IllegalArgumentException("program too costly for Teal version < 4. consider using v4.");
253+
throw new IllegalArgumentException("program too costly for version < 4. consider using v4.");
254254
}
255255

256256
return new ProgramData(true, ints, bytes);
257257
}
258258

259259
/**
260-
* Retrieves TEAL supported version
260+
* Retrieves supported program version
261261
* @return int
262262
* @throws IOException
263263
*/
@@ -269,7 +269,7 @@ public static int getLogicSigVersion() throws IOException {
269269
}
270270

271271
/**
272-
* Retrieves max supported version of TEAL evaluator
272+
* Retrieves max supported program version of evaluator
273273
* @return int
274274
* @throws IOException
275275
*/
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
package com.algorand.algosdk.logic;
2+
3+
import java.lang.Integer;
4+
import java.util.ArrayList;
5+
import java.util.HashMap;
6+
7+
/**
8+
* SourceMap class provides parser for source map from
9+
* algod compile endpoint
10+
*/
11+
public class SourceMap {
12+
13+
public int version;
14+
public String file;
15+
public String[] sources;
16+
public String[] names;
17+
public String mappings;
18+
19+
public HashMap<Integer, Integer> pcToLine;
20+
public HashMap<Integer, ArrayList<Integer>> lineToPc;
21+
22+
public SourceMap(HashMap<String,Object> sourceMap) {
23+
int version = (int) sourceMap.get("version");
24+
if(version != 3){
25+
throw new IllegalArgumentException("Only source map version 3 is supported");
26+
}
27+
this.version = version;
28+
29+
this.file = (String) sourceMap.get("file");
30+
this.mappings = (String) sourceMap.get("mappings");
31+
32+
this.lineToPc = new HashMap<>();
33+
this.pcToLine = new HashMap<>();
34+
35+
Integer lastLine = 0;
36+
String[] vlqs = this.mappings.split(";");
37+
for(int i=0; i<vlqs.length; i++){
38+
ArrayList<Integer> vals = VLQDecoder.decodeSourceMapLine(vlqs[i]);
39+
40+
// If the vals length >= 3 the lineDelta
41+
if(vals.size() >= 3){
42+
lastLine = lastLine + vals.get(2);
43+
}
44+
45+
if(!this.lineToPc.containsKey(lastLine)){
46+
this.lineToPc.put(lastLine, new ArrayList<Integer>());
47+
}
48+
49+
ArrayList<Integer> currList = this.lineToPc.get(lastLine);
50+
currList.add(i);
51+
this.lineToPc.put(lastLine, currList);
52+
53+
this.pcToLine.put(i, lastLine);
54+
}
55+
56+
}
57+
58+
/**
59+
* Returns the Integer line number for the passed PC or null if not found
60+
* @param pc the pc (program counter) of the assembled file
61+
* @return the line number or null if not found
62+
*/
63+
public Integer getLineForPc(Integer pc) {
64+
return this.pcToLine.get(pc);
65+
}
66+
67+
/**
68+
* Returns the List of PCs for the passed line number
69+
* @param line the line number of the source file
70+
* @return the list of PCs that line generated or empty array if not found
71+
*/
72+
public ArrayList<Integer> getPcsForLine(Integer line) {
73+
if(!this.pcToLine.containsKey(line)){
74+
return new ArrayList<Integer>();
75+
}
76+
return this.lineToPc.get(line);
77+
}
78+
79+
private static class VLQDecoder {
80+
// VLQDecoder for decoding the VLQ values returned for source map
81+
// based on the decoder implementation here: https://github.com/algorand/go-algorand-sdk/blob/develop/logic/source_map.go
82+
83+
private static final String b64table = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
84+
private static final int vlqShiftSize = 5;
85+
private static final int vlqFlag = 1 << vlqShiftSize;
86+
private static final int vlqMask = vlqFlag - 1;
87+
88+
public static ArrayList<Integer> decodeSourceMapLine(String vlq) {
89+
90+
ArrayList<Integer> results = new ArrayList<>();
91+
int value = 0;
92+
int shift = 0;
93+
94+
for(int i=0; i<vlq.length(); i++){
95+
int digit = b64table.indexOf(vlq.charAt(i));
96+
97+
value |= (digit & vlqMask) << shift;
98+
99+
if((digit & vlqFlag) > 0) {
100+
shift += vlqShiftSize;
101+
continue;
102+
}
103+
104+
if((value&1)>0){
105+
value = (value >> 1) * -1;
106+
}else{
107+
value = value >> 1;
108+
}
109+
110+
results.add(value);
111+
112+
// Reset
113+
value = 0;
114+
shift = 0;
115+
}
116+
117+
return results;
118+
}
119+
}
120+
121+
}

0 commit comments

Comments
 (0)