Skip to content
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

refactor: rename addMissingVariables to estimateTxDependencies, and add docs for tx dep estimation #924

Closed
wants to merge 99 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
15297bc
create package for code snippets
Torres-ssf Apr 11, 2023
fb10948
create contract echo-values for snippets package
Torres-ssf Apr 11, 2023
4f394be
properly setup snippets contracts dir
Torres-ssf Apr 11, 2023
bd5fc4f
add utility to load ABI and BIN files for snippet contracts
Torres-ssf Apr 11, 2023
07dda7b
add function to create test wallet for snippets package
Torres-ssf Apr 11, 2023
b2c8bbe
implement snippet test file for contracts index page
Torres-ssf Apr 11, 2023
8f861d0
implement snippet test file for contracts interacting-with-contracts …
Torres-ssf Apr 11, 2023
0745ea3
update content of doc page interacting-with-contracts
Torres-ssf Apr 11, 2023
a19db5c
implement snippet test file for contracts read-only-calls page
Torres-ssf Apr 11, 2023
b335135
update content of doc page read-only-calls
Torres-ssf Apr 11, 2023
920b646
implement snippet test file for contracts deploying-contracts page
Torres-ssf Apr 11, 2023
2a7740d
update content of doc page deploying-contracts
Torres-ssf Apr 11, 2023
631187e
change deploying-contracts page order
Torres-ssf Apr 11, 2023
4382f5c
refact test suite
Torres-ssf Apr 11, 2023
84eff32
create contract counter on snippets package
Torres-ssf Apr 11, 2023
a5a55f3
define code snippet region
Torres-ssf Apr 11, 2023
0b89d6f
implement snippet test file for contracts transaction-parameters page
Torres-ssf Apr 11, 2023
077a365
update content of doc page transaction-parameters
Torres-ssf Apr 11, 2023
0e7656f
change transaction-parameters page order
Torres-ssf Apr 11, 2023
b8f0303
make regex cleaner
Torres-ssf Apr 12, 2023
16d4d48
create contract return context on snippets package
Torres-ssf Apr 12, 2023
30ce753
implement snippet test file for contracts call-parameters page
Torres-ssf Apr 12, 2023
d9ca919
update content of doc page call-parameters
Torres-ssf Apr 12, 2023
de7fc79
change doc call-parameters page order
Torres-ssf Apr 12, 2023
e5030c2
implement snippet test file for contracts multicalls page
Torres-ssf Apr 12, 2023
6dcf28c
update content of doc page multicalls
Torres-ssf Apr 12, 2023
c523274
Merge branch 'master' into torres/docs/add-dedicated-package-code-sni…
Torres-ssf Apr 12, 2023
dc75e2a
renaming package snippets to doc-snippets
Torres-ssf Apr 12, 2023
c436496
implement snippet test file for contracts cost-estimation page
Torres-ssf Apr 12, 2023
b0e7113
update content of doc page cost-estimation
Torres-ssf Apr 12, 2023
973b172
implement snippet test file for contracts calls-with-different-wallet…
Torres-ssf Apr 12, 2023
f911ae7
update content of doc page calls-with-different-wallets
Torres-ssf Apr 12, 2023
60cbd9a
add code snippet
Torres-ssf Apr 12, 2023
55e0aaf
update content of doc page contract index
Torres-ssf Apr 12, 2023
2e5c60e
update content of doc page deploying-contracts
Torres-ssf Apr 12, 2023
7e88a52
update content of doc page transaction-parameters
Torres-ssf Apr 12, 2023
74e074a
create code snippet
Torres-ssf Apr 13, 2023
2fad58d
update doc page the fuelvm-binary-file
Torres-ssf Apr 13, 2023
4587f29
Merge branch 'master' into torres/docs/add-dedicated-package-code-sni…
Torres-ssf Apr 13, 2023
aaf2e97
fix pnpm dep name after renaming package
Torres-ssf Apr 13, 2023
dae1b48
create contract log-values on docs-snippets package
Torres-ssf Apr 13, 2023
5a8abe4
add snippet test for doc logs page
Torres-ssf Apr 13, 2023
871c975
update content on docs logs page
Torres-ssf Apr 13, 2023
fe0daad
ensure docs-snippets is not deployed to NPM
Torres-ssf Apr 13, 2023
55d9fdb
remove TODO and add NOTE
Torres-ssf Apr 13, 2023
44f35ac
shame
Torres-ssf Apr 14, 2023
673cdc9
create contract simple-token in doc-snippets package
Torres-ssf Apr 14, 2023
2073b2d
create contract token-depositor in doc-snippets package
Torres-ssf Apr 14, 2023
3036364
add snippet test for doc calling-external-contracts page
Torres-ssf Apr 14, 2023
c23754c
update content in doc page calling-external-contracts
Torres-ssf Apr 14, 2023
0380c60
Merge branch 'master' into torres/docs/add-dedicated-package-code-sni…
Torres-ssf Apr 14, 2023
04a16fa
refacting code
Torres-ssf Apr 14, 2023
f7fcbfa
adding code snippet
Torres-ssf Apr 14, 2023
3d6c110
update content on page variable-outputs
Torres-ssf Apr 14, 2023
5f68adb
refactoring
Torres-ssf Apr 14, 2023
319ba06
standardizing code snippets names
Torres-ssf Apr 14, 2023
6336de5
standardizing docs pages headings
Torres-ssf Apr 14, 2023
2017995
add empty changeset
Torres-ssf Apr 14, 2023
aa0d213
rename contract doc page
Torres-ssf Apr 14, 2023
bd5c1dc
ajusting some headings
Torres-ssf Apr 14, 2023
d95372c
Merge branch 'master' into torres/docs/add-dedicated-package-code-sni…
Torres-ssf Apr 15, 2023
6fc119a
Merge branch 'master' into torres/docs/add-dedicated-package-code-sni…
Torres-ssf Apr 18, 2023
c3a761d
removing extra .gitignore files
Torres-ssf Apr 18, 2023
d79e0de
fix authors on forc files
Torres-ssf Apr 18, 2023
0b3b362
Merge branch 'master' into torres/docs/add-dedicated-package-code-sni…
Torres-ssf Apr 19, 2023
f279122
Merge branch 'master' into torres/docs/add-dedicated-package-code-sni…
Torres-ssf Apr 20, 2023
1e46213
improving some text
Torres-ssf Apr 21, 2023
988b317
improve text readability
Torres-ssf Apr 21, 2023
7ecdaf2
improve text readability
Torres-ssf Apr 21, 2023
60aacf3
improve text readability
Torres-ssf Apr 21, 2023
45b69b2
ooops
Torres-ssf Apr 21, 2023
5587d7f
refact some code snippets
Torres-ssf Apr 21, 2023
7d25a91
improve sentence
Torres-ssf Apr 21, 2023
57cffff
improve doc page interacting with contracs
Torres-ssf Apr 21, 2023
7827e82
rename interact-with-contract doc page
Torres-ssf Apr 21, 2023
495968a
improve sentence
Torres-ssf Apr 21, 2023
5ee9b66
fix link
Torres-ssf Apr 21, 2023
4626b3f
improve text readability
Torres-ssf Apr 23, 2023
a9bce28
improve text readability
Torres-ssf Apr 23, 2023
ad304c1
use better heading
Torres-ssf Apr 23, 2023
5959f00
use better var name
Torres-ssf Apr 23, 2023
8d2c434
refact code
Torres-ssf Apr 23, 2023
d463263
improve text readability
Torres-ssf Apr 23, 2023
b2487fd
improve text readability
Torres-ssf Apr 23, 2023
afc8310
improve heading
Torres-ssf Apr 23, 2023
8c16ddf
improve heading
Torres-ssf Apr 23, 2023
90526e2
improve some sentences
Torres-ssf Apr 23, 2023
9f3f570
add nodemon to the party
Torres-ssf Apr 23, 2023
2b7e555
add @vue/devtools-api dep
Torres-ssf Apr 23, 2023
a59c652
remove typedoc setting on contributing README file
Torres-ssf Apr 23, 2023
ecda215
Merge branch 'master' into torres/docs/add-dedicated-package-code-sni…
arboleya Apr 23, 2023
6dfb5a6
update nodemon config file
Torres-ssf Apr 23, 2023
0048c22
rename `addMissingVariables` to `estimateTxDependencies`
Dhaiwat10 Apr 24, 2023
6bceb3b
update docstring
Dhaiwat10 Apr 24, 2023
d1de438
add docs
Dhaiwat10 Apr 24, 2023
f8afddd
add changeset
Dhaiwat10 Apr 24, 2023
50f0837
add a link for better context
Dhaiwat10 Apr 24, 2023
ee46b7c
Merge branch 'master' into torres/docs/add-dedicated-package-code-sni…
arboleya Apr 25, 2023
67653fe
Merge branch 'torres/docs/add-dedicated-package-code-snippets-contrac…
arboleya Apr 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update doc page the fuelvm-binary-file
Torres-ssf committed Apr 13, 2023
commit 2fad58d575ed1985bb730a628a3cb814b72e69b1
33 changes: 10 additions & 23 deletions apps/docs/src/guide/contracts/the-fuelvm-binary-file.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,22 @@
# The FuelVM binary file
# Understanding the FuelVM Binary File

The command `forc build` compiles your Sway code and generates the bytecode: the binary code that the Fuel Virtual Machine will interpret. For instance, the smart contract below:
When you compile your Sway code using the `forc build` command, it generates a bytecode file. This binary file contains the compiled code that the Fuel Virtual Machine (FuelVM) will interpret and execute.

<!-- TODO: stop using hardcoded snippets -->
For example, consider the following smart contract:

```rust:line-numbers
contract;
<<< @/../../docs-snippets/contracts/echo-values/src/main.sw#understanding-fuel-binary-file{ts:line-numbers}

abi MyContract {
fn test_function() -> bool;
}

impl MyContract for Contract {
fn test_function() -> bool {
true
}
}
```

After `forc build`, will have a binary file that contains:
After running `forc build`, a binary file will be generated with the following content:

```sh
$ cat out/debug/my-test.bin
G4]�]D`I]C�As@
6]C�$@!QK%
$ cat out/debug/echo-values.bin
�GT]����]@`I]G�I@sH]G�I@sHr�{6�]D`J]C�%E]@`J$@Ͼ{RD�^�%
```

This seems very unreadable! But, `forc` has a nice interpreter for this bytecode: `forc `parse-bytecode`, which will interpret that binary data and output the equivalent FuelVM assembly:
At first glance, the content appears unreadable. However, `forc` provides a helpful interpreter for this bytecode: the `forc parse-bytecode` command. This command takes the binary data and outputs the equivalent FuelVM assembly:

```sh
$ forc parse-bytecode out/debug/my-test.bin
$ forc parse-bytecode out/debug/echo-values.bin
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
@@ -50,4 +37,4 @@ half-word byte op raw notes
16 64 XOR(20, 27, 53) 21 51 bd 4b
```

If you want to deploy your smart contract using the SDK, this binary file is important; it's what we'll be sending to the FuelVM in a transaction.
When deploying your smart contract using the SDK, the binary file plays a crucial role. It is sent to the FuelVM in a transaction, allowing the FuelVM to interpret and execute your smart contract.