From 68b3a3c3a06b1ccdba6b92a1127930b61da2c8b3 Mon Sep 17 00:00:00 2001 From: Hannes Karppila Date: Mon, 27 Nov 2023 21:36:24 +0200 Subject: [PATCH] Update to latest Fuel versions (#16) * Update to latest Fuel versions * Update tests * fmt * Use latest fuel-core in ci * Newer rust install * Clippy * Install fuel-core binary correctly * Fix some minor errors --- .github/workflows/ci.yml | 6 +- Cargo.toml | 6 +- docs/walkthrough.md | 219 +++++++++++++++++---------------------- examples/example_tx.json | 187 +++++++++++++++++++++++++++++++-- src/lib.rs | 2 +- src/main.rs | 13 ++- tests/cli_integration.rs | 4 +- 7 files changed, 292 insertions(+), 145 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 955722313c2..24d1f7c8b7e 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,10 +58,10 @@ jobs: args: --verbose --all-targets - name: Install fuel-core for tests - uses: baptiste0928/cargo-install@v1 + uses: baptiste0928/cargo-install@v2 with: - crate: fuel-core - version: "0.8" + crate: fuel-core-bin + version: "0.21" - name: Run tests uses: actions-rs/cargo@v1 diff --git a/Cargo.toml b/Cargo.toml index 3636500e814..45e6f9ad722 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,9 +5,9 @@ edition = "2021" [dependencies] clap = { version = "3.1", features = ["env", "derive"] } -fuel-gql-client = { version = "0.9" } -fuel-types = { version = "0.3", features = ["serde-types"] } -fuel-vm = { version = "0.12", features = ["serde"] } +fuel-core-client = { version = "0.21" } +fuel-types = { version = "0.43", features = ["serde"] } +fuel-vm = { version = "0.43", features = ["serde"] } serde_json = "1.0" shellfish = { version = "0.6.0", features = ["rustyline", "async", "tokio"] } surf = "2.3" diff --git a/docs/walkthrough.md b/docs/walkthrough.md index d14a855810b..88a0b1609c3 100755 --- a/docs/walkthrough.md +++ b/docs/walkthrough.md @@ -46,75 +46,34 @@ forc parse-bytecode out/debug/dbg_example.bin Which should give us something like ```text - half-word byte op raw notes - 0 0 JI(4) 90 00 00 04 jump to byte 16 - 1 4 NOOP 47 00 00 00 - 2 8 Undefined 00 00 00 00 data section offset lo (0) - 3 12 Undefined 00 00 00 cc data section offset hi (204) - 4 16 LW(63, 12, 1) 5d fc c0 01 - 5 20 ADD(63, 63, 12) 10 ff f3 00 - 6 24 MOVE(20, 5) 1a 50 50 00 - 7 28 CFEI(24) 91 00 00 18 - 8 32 ADDI(16, 20, 8) 50 41 40 08 - 9 36 LW(16, 63, 0) 5d 43 f0 00 - 10 40 SW(20, 16, 1) 5f 51 00 01 - 11 44 ADDI(16, 20, 0) 50 41 40 00 - 12 48 LW(16, 63, 1) 5d 43 f0 01 - 13 52 SW(20, 16, 0) 5f 51 00 00 - 14 56 ADDI(16, 20, 0) 50 41 40 00 - 15 60 LW(17, 20, 0) 5d 45 40 00 - 16 64 LW(16, 63, 2) 5d 43 f0 02 - 17 68 LT(16, 17, 16) 16 41 14 00 - 18 72 JNZI(16, 20) 73 40 00 14 conditionally jump to byte 80 - 19 76 JI(34) 90 00 00 22 jump to byte 136 - 20 80 ADDI(16, 20, 0) 50 41 40 00 - 21 84 ADDI(16, 20, 0) 50 41 40 00 - 22 88 LW(17, 20, 0) 5d 45 40 00 - 23 92 LW(16, 63, 0) 5d 43 f0 00 - 24 96 ADD(16, 16, 17) 10 41 04 40 - 25 100 SW(20, 16, 0) 5f 51 00 00 - 26 104 ADDI(16, 20, 8) 50 41 40 08 - 27 108 ADDI(16, 20, 8) 50 41 40 08 - 28 112 LW(17, 20, 1) 5d 45 40 01 - 29 116 ADDI(16, 20, 0) 50 41 40 00 - 30 120 LW(16, 20, 0) 5d 41 40 00 - 31 124 MUL(16, 17, 16) 1b 41 14 00 - 32 128 SW(20, 16, 1) 5f 51 00 01 - 33 132 JI(14) 90 00 00 0e jump to byte 56 - 34 136 ADDI(16, 20, 8) 50 41 40 08 - 35 140 LW(16, 20, 1) 5d 41 40 01 - 36 144 JI(37) 90 00 00 25 jump to byte 148 - 37 148 LW(17, 63, 3) 5d 47 f0 03 - 38 152 EQ(17, 17, 0) 13 45 10 00 - 39 156 JNZI(17, 41) 73 44 00 29 conditionally jump to byte 164 - 40 160 JI(43) 90 00 00 2b jump to byte 172 - 41 164 LOG(16, 0, 0, 0) 33 40 00 00 - 42 168 JI(49) 90 00 00 31 jump to byte 196 - 43 172 LW(19, 63, 4) 5d 4f f0 04 - 44 176 ADDI(17, 20, 16) 50 45 40 10 - 45 180 SW(20, 19, 2) 5f 51 30 02 - 46 184 ADDI(17, 20, 16) 50 45 40 10 - 47 188 LW(17, 20, 2) 5d 45 40 02 - 48 192 LOGD(0, 0, 16, 17) 34 00 04 11 - 49 196 LW(16, 63, 1) 5d 43 f0 01 - 50 200 RET(0) 24 00 00 00 - 51 204 Undefined 00 00 00 00 - 52 208 Undefined 00 00 00 01 - 53 212 Undefined 00 00 00 00 - 54 216 Undefined 00 00 00 00 - 55 220 Undefined 00 00 00 00 - 56 224 Undefined 00 00 00 05 - 57 228 Undefined 00 00 00 00 - 58 232 Undefined 00 00 00 00 - 59 236 Undefined 00 00 00 00 - 60 240 Undefined 00 00 00 08 + + half-word byte op raw notes + 0 0 JI { imm: 4 } 90 00 00 04 jump to byte 16 + 1 4 NOOP 47 00 00 00 + 2 8 InvalidOpcode 00 00 00 00 data section offset lo (0) + 3 12 InvalidOpcode 00 00 00 44 data section offset hi (68) + 4 16 LW { ra: 63, rb: 12, imm: 1 } 5d fc c0 01 + 5 20 ADD { ra: 63, rb: 63, rc: 12 } 10 ff f3 00 + 6 24 MOVE { ra: 18, rb: 1 } 1a 48 10 00 + 7 28 MOVE { ra: 17, rb: 0 } 1a 44 00 00 + 8 32 LW { ra: 16, rb: 63, imm: 0 } 5d 43 f0 00 + 9 36 LT { ra: 16, rb: 17, rc: 16 } 16 41 14 00 + 10 40 JNZI { ra: 16, imm: 13 } 73 40 00 0d conditionally jump to byte 52 + 11 44 LOG { ra: 18, rb: 0, rc: 0, rd: 0 } 33 48 00 00 + 12 48 RET { ra: 0 } 24 00 00 00 + 13 52 ADD { ra: 17, rb: 17, rc: 1 } 10 45 10 40 + 14 56 MUL { ra: 18, rb: 18, rc: 17 } 1b 49 24 40 + 15 60 JI { imm: 8 } 90 00 00 08 jump to byte 32 + 16 64 NOOP 47 00 00 00 + 17 68 InvalidOpcode 00 00 00 00 + 18 72 InvalidOpcode 00 00 00 05 ``` -We can recognize the `while` loop by the conditional jumps `JNZI(..)`. The condition just before the first jump can be identified by `LT(..)` instruction (for `<`). Some notable instructions that are generated only once in our code include `MUL(..)` for multiplication and `LOG(.., 0, 0, 0)` from the `log` function. +We can recognize the `while` loop by the conditional jumps `JNZI`. The condition just before the first jump can be identified by `LT` instruction (for `<`). Some notable instructions that are generated only once in our code include `MUL` for multiplication and `LOG {.., 0, 0, 0}` from the `log` function. ## Setting up the debugging -We can start up the debug infrastructure. On a new terminal session run `fuel-core --db-type in-memory`; we need to have that running because it actually executes the program. Now we can fire up the debugger itself: `fuel-debugger`. Now +We can start up the debug infrastructure. On a new terminal session run `fuel-core run --db-type in-memory --debug`; we need to have that running because it actually executes the program. Now we can fire up the debugger itself: `fuel-debugger`. Now if everything is set up correctly, you shoould see the debugger prompt (`>> `). You can use `help` command to list available commands. Now we would like to inspect the program while it's running. To do this, we first need to send the script to the executor, i.e. `fuel-core`. To do so, we need a *transaction specification*, `tx.json`. It looks something like this: @@ -122,44 +81,55 @@ Now we would like to inspect the program while it's running. To do this, we firs ```json { "Script": { - "byte_price": 0, - "gas_price": 0, - "gas_limit": 1000000, - "maturity": 0, + "script_gas_limit": 1000000, "script": [], "script_data": [], - "inputs": [], + "policies": { + "bits": "GasPrice", + "values": [0,0,0,0] + }, + "inputs": [ + { + "CoinSigned": { + "utxo_id": { + "tx_id": "c49d65de61cf04588a764b557d25cc6c6b4bc0d7429227e2a21e61c213b3a3e2", + "output_index": 18 + }, + "owner": "f1e92c42b90934aa6372e30bc568a326f6e66a1a0288595e6e3fbd392a4f3e6e", + "amount": 10599410012256088338, + "asset_id": "2cafad611543e0265d89f1c2b60d9ebf5d56ad7e23d9827d6b522fd4d6e44bc3", + "tx_pointer": { + "block_height": 0, + "tx_index": 0 + }, + "witness_index": 0, + "maturity": 0, + "predicate_gas_used": null, + "predicate": null, + "predicate_data": null + } + } + ], "outputs": [], - "witnesses": [], + "witnesses": [ + { + "data": [ + 156,254,34,102,65,96,133,170,254,105,147,35,196,199,179,133,132,240,208,149,11,46,30,96,44,91,121,195,145,184,159,235,117,82,135,41,84,154,102,61,61,16,99,123,58,173,75,226,219,139,62,33,41,176,16,18,132,178,8,125,130,169,32,108 + ] + } + ], "receipts_root": "0000000000000000000000000000000000000000000000000000000000000000" } } ``` -However, the key `script` in should contain the actual bytecode to execute, i.e. the contents of `out/debug/dbg_example.bin` as a JSON array. The following command can be used to generate it: +However, the key `script` should contain the actual bytecode to execute, i.e. the contents of `out/debug/dbg_example.bin` as a JSON array. The following command can be used to generate it: ```bash python3 -c 'print(list(open("out/debug/dbg_example.bin", "rb").read()))' ``` -So now we replace the script array with the result, and save it as `tx.json`. It looks something like this: - -```json -{ - "Script": { - "byte_price": 0, - "gas_price": 0, - "gas_limit": 1000000, - "maturity": 0, - "script": [144, 0, 0, 4, 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 204, 93, 252, 192, 1, 16, 255, 243, 0, 26, 80, 80, 0, 145, 0, 0, 24, 80, 65, 64, 8, 93, 67, 240, 0, 95, 81, 0, 1, 80, 65, 64, 0, 93, 67, 240, 1, 95, 81, 0, 0, 80, 65, 64, 0, 93, 69, 64, 0, 93, 67, 240, 2, 22, 65, 20, 0, 115, 64, 0, 20, 144, 0, 0, 34, 80, 65, 64, 0, 80, 65, 64, 0, 93, 69, 64, 0, 93, 67, 240, 0, 16, 65, 4, 64, 95, 81, 0, 0, 80, 65, 64, 8, 80, 65, 64, 8, 93, 69, 64, 1, 80, 65, 64, 0, 93, 65, 64, 0, 27, 65, 20, 0, 95, 81, 0, 1, 144, 0, 0, 14, 80, 65, 64, 8, 93, 65, 64, 1, 144, 0, 0, 37, 93, 71, 240, 3, 19, 69, 16, 0, 115, 68, 0, 41, 144, 0, 0, 43, 51, 64, 0, 0, 144, 0, 0, 49, 93, 79, 240, 4, 80, 69, 64, 16, 95, 81, 48, 2, 80, 69, 64, 16, 93, 69, 64, 2, 52, 0, 4, 17, 93, 67, 240, 1, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8], - "script_data": [], - "inputs": [], - "outputs": [], - "witnesses": [], - "receipts_root": "0000000000000000000000000000000000000000000000000000000000000000" - } -} -``` +So now we replace the script array with the result, and save it as `tx.json`. ## Using the debugger @@ -168,9 +138,9 @@ Now we can actually execute the script: ```text >> start_tx tx.json -Receipt: Log { id: 0000000000000000000000000000000000000000000000000000000000000000, ra: 120, rb: 0, rc: 0, rd: 0, pc: 10516, is: 10352 } -Receipt: Return { id: 0000000000000000000000000000000000000000000000000000000000000000, val: 0, pc: 10552, is: 10352 } -Receipt: ScriptResult { result: Success, gas_used: 1302 } +Receipt: Log { id: 0000000000000000000000000000000000000000000000000000000000000000, ra: 120, rb: 0, rc: 0, rd: 0, pc: 10380, is: 10336 } +Receipt: Return { id: 0000000000000000000000000000000000000000000000000000000000000000, val: 0, pc: 10384, is: 10336 } +Receipt: ScriptResult { result: Success, gas_used: 60 } Terminated ``` @@ -195,7 +165,7 @@ reg[0x9] = 1000000 # ggas >> memory 0x10 0x8 - 000010: dc dd a0 56 c2 20 1c 6b + 000010: e9 5c 58 86 c8 87 26 dd ``` However, that's not too interesting either, so let's just execute until the end, and then reset the vm to remove the breakpoints. @@ -203,8 +173,8 @@ However, that's not too interesting either, so let's just execute until the end, ``` >> continue -Receipt: Log { id: 0000000000000000000000000000000000000000000000000000000000000000, ra: 120, rb: 0, rc: 0, rd: 0, pc: 10516, is: 10352 } -Receipt: Return { id: 0000000000000000000000000000000000000000000000000000000000000000, val: 0, pc: 10552, is: 10352 } +Receipt: Log { id: 0000000000000000000000000000000000000000000000000000000000000000, ra: 120, rb: 0, rc: 0, rd: 0, pc: 10380, is: 10336 } +Receipt: Return { id: 0000000000000000000000000000000000000000000000000000000000000000, val: 0, pc: 10384, is: 10336 } Terminated >> reset @@ -214,28 +184,28 @@ Terminated Next, we will setup a breakpoint to check the state on each iteration of the `while` loop. For instance, if we'd like to see what numbers get multiplied together, we could set up a breakpoint before the operation. The bytecode has only a single `MUL` instruction: ``` - half-word byte op raw notes - 31 124 MUL(16, 17, 16) 1b 41 14 00 + half-word byte op raw notes + 14 56 MUL { ra: 18, rb: 18, rc: 17 } 1b 49 24 40 ``` -We can set a breakpoint on its address, at halfword-offset `31`. +We can set a breakpoint on its address, at halfword-offset `14`. ``` ->>> breakpoint 31 +>>> breakpoint 14 >> start_tx tx.json -Receipt: ScriptResult { result: Success, gas_used: 287 } -Stopped on breakpoint at address 124 of contract 0x0000000000000000000000000000000000000000000000000000000000000000 +Receipt: ScriptResult { result: Success, gas_used: 9 } +Stopped on breakpoint at address 56 of contract 0x0000000000000000000000000000000000000000000000000000000000000000 ``` -Now we can inspect the inputs tu multiply. Looking at [the specification](https://github.com/FuelLabs/fuel-specs/blob/master/specs/vm/instruction_set.md#mul-multiply) tells us that the instruction `MUL(16, 17, 16)` means `reg[16] = reg[17] * reg[16]`. So inpecting the inputs tells us that +Now we can inspect the inputs tu multiply. Looking at [the specification](https://github.com/FuelLabs/fuel-specs/blob/master/src/fuel-vm/instruction-set.md#mul-multiply) tells us that the instruction `MUL { ra: 18, rb: 18, rc: 17 }` means `reg[18] = reg[18] * reg[17]`. So inpecting the inputs tells us that ``` ->> r 16 17 +>> r 18 17 -reg[0x10] = 1 # reg16 +reg[0x12] = 1 # reg18 reg[0x11] = 1 # reg17 ``` @@ -244,12 +214,12 @@ So on the first round the numbers are `1` and `1`, so we can continue to the nex ``` >> c -Stopped on breakpoint at address 124 of contract 0x0000000000000000000000000000000000000000000000000000000000000000 +Stopped on breakpoint at address 56 of contract 0x0000000000000000000000000000000000000000000000000000000000000000 ->> r 16 17 +>> r 18 17 -reg[0x10] = 2 # reg16 -reg[0x11] = 1 # reg17 +reg[0x12] = 1 # reg18 +reg[0x11] = 2 # reg17 ``` @@ -258,13 +228,12 @@ And the next one: ``` >> c -Stopped on breakpoint at address 124 of contract 0x0000000000000000000000000000000000000000000000000000000000000000 - ->> r 16 17 +Stopped on breakpoint at address 56 of contract 0x0000000000000000000000000000000000000000000000000000000000000000 -reg[0x10] = 3 # reg16 -reg[0x11] = 2 # reg17 +>> r 18 17 +reg[0x12] = 2 # reg18 +reg[0x11] = 3 # reg17 ``` And fourth one: @@ -272,12 +241,12 @@ And fourth one: ``` >> c -Stopped on breakpoint at address 124 of contract 0x0000000000000000000000000000000000000000000000000000000000000000 +Stopped on breakpoint at address 56 of contract 0x0000000000000000000000000000000000000000000000000000000000000000 ->> r 16 17 +>> r 18 17 -reg[0x10] = 4 # reg16 -reg[0x11] = 6 # reg17 +reg[0x12] = 6 # reg18 +reg[0x11] = 4 # reg17 ``` @@ -286,18 +255,18 @@ And round 5: ``` >> c -Stopped on breakpoint at address 124 of contract 0x0000000000000000000000000000000000000000000000000000000000000000 +Stopped on breakpoint at address 56 of contract 0x0000000000000000000000000000000000000000000000000000000000000000 ->> r 16 17 +>> r 18 17 -reg[0x10] = 5 # reg16 -reg[0x11] = 24 # reg17 +reg[0x12] = 24 # reg18 +reg[0x11] = 5 # reg17 ``` At this point we can look at the values -16 | 17 +17 | 18 ---|---- 1 | 1 2 | 1 @@ -305,12 +274,12 @@ At this point we can look at the values 4 | 6 5 | 24 -From this we can clearly see that the left side, register `16` is the `counter` variable, and register `17` is `result`. Now the counter equals the given factorial function argument `5`, and the loop terminates. So when we continue, the program finishes without encountering any more breakpoints: +From this we can clearly see that the left side, register `17` is the `counter` variable, and register `18` is `result`. Now the counter equals the given factorial function argument `5`, and the loop terminates. So when we continue, the program finishes without encountering any more breakpoints: ``` >> c -Receipt: Log { id: 0000000000000000000000000000000000000000000000000000000000000000, ra: 120, rb: 0, rc: 0, rd: 0, pc: 10516, is: 10352 } -Receipt: Return { id: 0000000000000000000000000000000000000000000000000000000000000000, val: 0, pc: 10552, is: 10352 } +Receipt: Log { id: 0000000000000000000000000000000000000000000000000000000000000000, ra: 120, rb: 0, rc: 0, rd: 0, pc: 10380, is: 10336 } +Receipt: Return { id: 0000000000000000000000000000000000000000000000000000000000000000, val: 0, pc: 10384, is: 10336 } Terminated ``` diff --git a/examples/example_tx.json b/examples/example_tx.json index 6ef39a0a8d5..607c5b059f5 100755 --- a/examples/example_tx.json +++ b/examples/example_tx.json @@ -1,14 +1,187 @@ { "Script": { - "byte_price": 0, - "gas_price": 0, - "gas_limit": 1000000, - "maturity": 0, - "script": [80,64,0,202,80,68,0,186,51,65,16,0,36,4,0,0], + "script_gas_limit": 1000000, + "script": [ + 144, + 0, + 0, + 4, + 71, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 68, + 93, + 252, + 192, + 1, + 16, + 255, + 243, + 0, + 26, + 72, + 16, + 0, + 26, + 68, + 0, + 0, + 93, + 67, + 240, + 0, + 22, + 65, + 20, + 0, + 115, + 64, + 0, + 13, + 51, + 72, + 0, + 0, + 36, + 0, + 0, + 0, + 16, + 69, + 16, + 64, + 27, + 73, + 36, + 64, + 144, + 0, + 0, + 8, + 71, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 5 + ], "script_data": [], - "inputs": [], + "policies": { + "bits": "GasPrice", + "values": [ + 0, + 0, + 0, + 0 + ] + }, + "inputs": [ + { + "CoinSigned": { + "utxo_id": { + "tx_id": "c49d65de61cf04588a764b557d25cc6c6b4bc0d7429227e2a21e61c213b3a3e2", + "output_index": 18 + }, + "owner": "f1e92c42b90934aa6372e30bc568a326f6e66a1a0288595e6e3fbd392a4f3e6e", + "amount": 10599410012256088338, + "asset_id": "2cafad611543e0265d89f1c2b60d9ebf5d56ad7e23d9827d6b522fd4d6e44bc3", + "tx_pointer": { + "block_height": 0, + "tx_index": 0 + }, + "witness_index": 0, + "maturity": 0, + "predicate_gas_used": null, + "predicate": null, + "predicate_data": null + } + } + ], "outputs": [], - "witnesses": [], + "witnesses": [ + { + "data": [ + 156, + 254, + 34, + 102, + 65, + 96, + 133, + 170, + 254, + 105, + 147, + 35, + 196, + 199, + 179, + 133, + 132, + 240, + 208, + 149, + 11, + 46, + 30, + 96, + 44, + 91, + 121, + 195, + 145, + 184, + 159, + 235, + 117, + 82, + 135, + 41, + 84, + 154, + 102, + 61, + 61, + 16, + 99, + 123, + 58, + 173, + 75, + 226, + 219, + 139, + 62, + 33, + 41, + 176, + 16, + 18, + 132, + 178, + 8, + 125, + 130, + 169, + 32, + 108 + ] + } + ], "receipts_root": "0000000000000000000000000000000000000000000000000000000000000000" } } \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index dd944d740c7..7ff2becbf13 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,5 @@ pub mod names; // Re-exports -pub use fuel_gql_client::client::{schema::RunResult, FuelClient}; +pub use fuel_core_client::client::{schema::RunResult, FuelClient}; pub use fuel_vm::prelude::{ContractId, Transaction}; diff --git a/src/main.rs b/src/main.rs index 799b1b7762d..ac88485745e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -152,7 +152,7 @@ async fn cmd_step(state: &mut State, mut args: Vec) -> Result<(), Box) -> Result<(), B if args.is_empty() { for r in 0..VM_REGISTER_COUNT { - let value = state.client.register(&state.session_id, r).await?; + let value = state.client.register(&state.session_id, r as u32).await?; println!("reg[{:#x}] = {:<8} # {}", r, value, register_name(r)); } } else { for arg in &args { if let Some(v) = parse_int(arg) { if v < VM_REGISTER_COUNT { - let value = state.client.register(&state.session_id, v).await?; + let value = state.client.register(&state.session_id, v as u32).await?; println!("reg[{:#02x}] = {:<8} # {}", v, value, register_name(v)); } else { println!("Register index too large {}", v); return Ok(()); } } else if let Some(index) = names::register_index(arg) { - let value = state.client.register(&state.session_id, index).await?; + let value = state + .client + .register(&state.session_id, index as u32) + .await?; println!("reg[{:#02x}] = {:<8} # {}", index, value, arg); } else { println!("Unknown register name {}", arg); @@ -245,7 +248,7 @@ async fn cmd_memory(state: &mut State, mut args: Vec) -> Result<(), Box< let mem = state .client - .memory(&state.session_id, offset, limit) + .memory(&state.session_id, offset as u32, limit as u32) .await?; for (i, chunk) in mem.chunks(WORD_SIZE).enumerate() { diff --git a/tests/cli_integration.rs b/tests/cli_integration.rs index 62ed740ce40..952968b5165 100755 --- a/tests/cli_integration.rs +++ b/tests/cli_integration.rs @@ -9,6 +9,8 @@ fn test_cli() { let port = portpicker::pick_unused_port().expect("No ports free"); let mut fuel_core = Command::new("fuel-core") + .arg("run") + .arg("--debug") .arg("--db-type") .arg("in-memory") .arg("--port") @@ -43,7 +45,7 @@ fn test_cli() { cmd.send_line("step on").unwrap(); cmd.exp_regex(r">> ").unwrap(); cmd.send_line("continue").unwrap(); - cmd.exp_regex(r"Stopped on breakpoint at address 4 of contract 0x0{64}") + cmd.exp_regex(r"Stopped on breakpoint at address 16 of contract 0x0{64}") .unwrap(); cmd.send_line("step off").unwrap(); cmd.exp_regex(r">> ").unwrap();