From d0a7b9bb2f3ca54f1001551dc4bc3e362615c7ad Mon Sep 17 00:00:00 2001 From: Mike Reinhart Date: Wed, 4 Dec 2019 15:33:01 -0500 Subject: [PATCH 1/2] Added tick to fix formatting --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3f89b230..4d537a52 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,7 +8,7 @@ The `nix/` folder contains helper scripts for working with the ledger via Nix. Use `./nix/install.sh` to install the apps onto the ledger using Nix. ### Developing -Use `nix/env.sh to enter a shell where you can run `make` and it will just work. You can also pass a command instead, e.g. `nix/env.sh s --run "make clean SHELL=bash"`. +Use `nix/env.sh ` to enter a shell where you can run `make` and it will just work. You can also pass a command instead, e.g. `nix/env.sh s --run "make clean SHELL=bash"`. For development, use `nix/watch.sh s make APP=` to incrementally build on every change. Be sure to `nix/env.sh s --run "make clean SHELL=bash"` if you start watching a different `APP`. From edcf4da0d989ee5a3fbf34b3d41b931808212b65 Mon Sep 17 00:00:00 2001 From: "Jonathan D.K. Gibbons" Date: Mon, 9 Dec 2019 10:34:20 -0500 Subject: [PATCH 2/2] Fix bug in manager.tz parsing. --- src/operations.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/operations.c b/src/operations.c index 2e1ff860..6a8e1cdb 100644 --- a/src/operations.c +++ b/src/operations.c @@ -314,9 +314,9 @@ static inline bool parse_byte( #define OP_JMPIF(step, cond) if(cond) { state->op_step=step; return true; } // Shortcuts for defining literal-matching states; mostly used for contract-call boilerplate. -#define OP_STEP_REQUIRE_SHORT(constant) { uint16_t val = MICHELSON_READ_SHORT; if(val != constant) PARSE_ERROR(); } OP_STEP -#define OP_STEP_REQUIRE_BYTE(constant) { if(byte != constant) PARSE_ERROR(); } OP_STEP -#define OP_STEP_REQUIRE_LENGTH(constant) { uint32_t val = MICHELSON_READ_LENGTH; if(val != constant) PARSE_ERROR(); } OP_STEP +#define OP_STEP_REQUIRE_SHORT(constant) { uint16_t val = MICHELSON_READ_SHORT; if(val != constant) { PRINTF("Expected: %d, got: %d\n", constant, val); PARSE_ERROR(); } } OP_STEP +#define OP_STEP_REQUIRE_BYTE(constant) { if(byte != constant) { PRINTF("Expected: %d, got: %d\n", constant, byte); PARSE_ERROR(); } } OP_STEP +#define OP_STEP_REQUIRE_LENGTH(constant) { uint32_t val = MICHELSON_READ_LENGTH; if(val != constant) { PARSE_ERROR(); } } OP_STEP switch(state->op_step) { @@ -560,10 +560,12 @@ static inline bool parse_byte( state->argument_length = MICHELSON_READ_LENGTH; } + OP_STEP + // Error on anything but a michelson sequence. OP_STEP_REQUIRE_BYTE(MICHELSON_TYPE_SEQUENCE); - OP_STEP { + { const uint32_t sequence_length = MICHELSON_READ_LENGTH; // Only allow single sequence (5 is needed