Skip to content

Commit 4a8936c

Browse files
psiemensjleni
andauthored
Update transaction test cases (#42)
* Add JS code to generate transaction test vectors * Update tests to use new testvectors * Update CONTRACT_HASH_ADD_NEW_KEY * Update test cases to use public keys * Fix JSON test cases * Remove test cases with multiple authorizers * Improve test cases to include wider range of account key values * Fix test names * Compute account key buffer size as constant * Update parser.c * Update transaction example blobs for zemu tests * Fix multi-line macro * Fix transaction test cases * Adjust FLOW_ACCOUNT_KEY_SIZE * Update parser.c * Update parser.c * Update parser.c * Update parser.c * Update parser.c * Update test.js * Revert "Update test.js" This reverts commit 0f5aaa2c71e714808d5885194b2d82d191e5d95d. * update zemu screenshots Co-authored-by: Juan Leni <[email protected]>
1 parent 179794f commit 4a8936c

File tree

147 files changed

+4101
-5664
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+4101
-5664
lines changed

app/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ COIN=FLOW
4747
endif
4848

4949
APPVERSION_M=0
50-
APPVERSION_N=7
51-
APPVERSION_P=3
50+
APPVERSION_N=8
51+
APPVERSION_P=0
5252

5353
$(info COIN = [$(COIN)])
5454
ifeq ($(COIN),FLOW)

app/src/coin_script_hashes.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ extern "C" {
2121

2222
#define CONTRACT_HASH_TOKEN_TRANSFER "ca80b628d985b358ae1cb136bcd976997c942fa10dbabfeafb4e20fa66a5a5e2"
2323
#define CONTRACT_HASH_CREATE_ACCOUNT "eef2d0494448554177612e63026256258339230cbc6931ded78d6149443c6173"
24-
#define CONTRACT_HASH_ADD_NEW_KEY "9f2e43f75e6f001879c66b16137e3cddbe3adeb56c1915831022babe84d6b0ee"
24+
#define CONTRACT_HASH_ADD_NEW_KEY "595c86561441b32b2b91ee03f9e10ca6efa7b41bcc994f51317ec0aa9d8f8a42"
2525

2626
#ifdef __cplusplus
2727
}

app/src/parser.c

+15-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,19 @@ void __assert_fail(const char * assertion, const char * file, unsigned int line,
2929
}
3030
#endif
3131

32-
#define FLOW_PUBKEY_SIZE 150
32+
#define FLOW_PUBLIC_KEY_SIZE 64 // 64 bytes for public key
33+
#define FLOW_SIG_ALGO_SIZE 1 // 8 bits for signature algorithm (uint8)
34+
#define FLOW_HASH_ALGO_SIZE 1 // 8 bits for hash algorithm (uint8)
35+
#define FLOW_WEIGHT_SIZE 2 // 16 bits for weight (uint16)
36+
#define RLP_PREFIX 1
37+
38+
#define FLOW_ACCOUNT_KEY_SIZE (2 * ( \
39+
(RLP_PREFIX * 2) + \
40+
((RLP_PREFIX * 2) + FLOW_PUBLIC_KEY_SIZE) + \
41+
(RLP_PREFIX + FLOW_SIG_ALGO_SIZE) + \
42+
(RLP_PREFIX + FLOW_HASH_ALGO_SIZE) + \
43+
(RLP_PREFIX + FLOW_WEIGHT_SIZE) \
44+
) + 2)
3345

3446
parser_error_t parser_parse(parser_context_t *ctx, const uint8_t *data, size_t dataLen) {
3547
CHECK_PARSER_ERR(parser_init(ctx, data, dataLen))
@@ -88,7 +100,7 @@ parser_error_t parser_printArgumentPublicKey(const parser_context_t *argumentCtx
88100
parsed_json_t parsedJson = {false};
89101
CHECK_PARSER_ERR(json_parse(&parsedJson, (char *) argumentCtx->buffer, argumentCtx->bufferLen));
90102

91-
char bufferUI[FLOW_PUBKEY_SIZE];
103+
char bufferUI[FLOW_ACCOUNT_KEY_SIZE];
92104
CHECK_PARSER_ERR(json_extractPubKey(bufferUI, sizeof(bufferUI), &parsedJson, 0))
93105
pageString(outVal, outValLen, bufferUI, pageIdx, pageCount);
94106

@@ -120,7 +132,7 @@ parser_error_t parser_printArgumentPublicKeys(const parser_context_t *argumentCt
120132
zemu_log_stack("PublicKeys");
121133

122134
uint16_t arrayElementToken;
123-
char bufferUI[FLOW_PUBKEY_SIZE];
135+
char bufferUI[FLOW_ACCOUNT_KEY_SIZE];
124136
CHECK_PARSER_ERR(array_get_nth_element(&parsedJson, internalTokenElementIdx, argumentIndex, &arrayElementToken))
125137
CHECK_PARSER_ERR(json_extractPubKey(bufferUI, sizeof(bufferUI), &parsedJson, arrayElementToken))
126138
pageString(outVal, outValLen, bufferUI, pageIdx, pageCount);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
8+
# Runtime data
9+
pids
10+
*.pid
11+
*.seed
12+
*.pid.lock
13+
14+
# Directory for instrumented libs generated by jscoverage/JSCover
15+
lib-cov
16+
17+
# Coverage directory used by tools like istanbul
18+
coverage
19+
20+
# nyc test coverage
21+
.nyc_output
22+
23+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24+
.grunt
25+
26+
# Bower dependency directory (https://bower.io/)
27+
bower_components
28+
29+
# node-waf configuration
30+
.lock-wscript
31+
32+
# Compiled binary addons (https://nodejs.org/api/addons.html)
33+
build/Release
34+
35+
# Dependency directories
36+
node_modules/
37+
jspm_packages/
38+
39+
# TypeScript v1 declaration files
40+
typings/
41+
42+
# Optional npm cache directory
43+
.npm
44+
45+
# Optional eslint cache
46+
.eslintcache
47+
48+
# Optional REPL history
49+
.node_repl_history
50+
51+
# Output of 'npm pack'
52+
*.tgz
53+
54+
# Yarn Integrity file
55+
.yarn-integrity
56+
57+
# dotenv environment variables file
58+
.env
59+
60+
# next.js build output
61+
.next
62+
63+
\.idea/
64+
65+
.vscode
66+
67+
TODO\.md
68+
69+
\dist
70+
/certs/cert.pem
71+
/certs/server.cert
72+
/certs/server.key

0 commit comments

Comments
 (0)