Skip to content

Commit

Permalink
deploy: 93cfa35
Browse files Browse the repository at this point in the history
  • Loading branch information
bitzoic committed Aug 30, 2024
1 parent 3d65c18 commit ded734e
Show file tree
Hide file tree
Showing 13 changed files with 139 additions and 47 deletions.
2 changes: 1 addition & 1 deletion master/search.js

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions master/sway_libs/all.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,18 @@
</div></div><div class="item-row"><div class="item-left Function-item"><a class="fn" href="asset/metadata/fn._set_metadata.html">asset::metadata::_set_metadata</a></div><div class="item-right docblock-short"><p>Unconditionally stores metadata for a specific asset and key pair.</p>
</div></div><div class="item-row"><div class="item-left Function-item"><a class="fn" href="asset/supply/fn._burn.html">asset::supply::_burn</a></div><div class="item-right docblock-short"><p>Burns assets with the given <code>sub_id</code>.</p>
</div></div><div class="item-row"><div class="item-left Function-item"><a class="fn" href="asset/supply/fn._mint.html">asset::supply::_mint</a></div><div class="item-right docblock-short"><p>Unconditionally mints new assets using the <code>sub_id</code> sub-identifier.</p>
</div></div><div class="item-row"><div class="item-left Function-item"><a class="fn" href="bytecode/fn.compute_bytecode_root.html">bytecode::compute_bytecode_root</a></div><div class="item-right docblock-short"><p>Takes the bytecode of a contract or predicate and configurables and computes the bytecode root.</p></div></div><div class="item-row"><div class="item-left Function-item"><a class="fn" href="bytecode/fn.compute_predicate_address.html">bytecode::compute_predicate_address</a></div><div class="item-right docblock-short"><p>Takes the bytecode of a predicate and configurables and computes the address of a predicate.</p>
</div></div><div class="item-row"><div class="item-left Function-item"><a class="fn" href="bytecode/fn.compute_bytecode_root.html">bytecode::compute_bytecode_root</a></div><div class="item-right docblock-short"><p>Takes the bytecode of a contract or predicate and computes the bytecode root.</p>
</div></div><div class="item-row"><div class="item-left Function-item"><a class="fn" href="bytecode/fn.compute_bytecode_root_with_configurables.html">bytecode::compute_bytecode_root_with_configurables</a></div><div class="item-right docblock-short"><p>Takes the bytecode of a contract or predicate and configurables and computes the bytecode root.</p></div></div><div class="item-row"><div class="item-left Function-item"><a class="fn" href="bytecode/fn.compute_predicate_address.html">bytecode::compute_predicate_address</a></div><div class="item-right docblock-short"><p>Takes the bytecode of a predicate and computes the address of a predicate.</p>
</div></div><div class="item-row"><div class="item-left Function-item"><a class="fn" href="bytecode/fn.compute_predicate_address_with_configurables.html">bytecode::compute_predicate_address_with_configurables</a></div><div class="item-right docblock-short"><p>Takes the bytecode of a predicate and configurables and computes the address of a predicate.</p>
</div></div><div class="item-row"><div class="item-left Function-item"><a class="fn" href="bytecode/fn.predicate_address_from_root.html">bytecode::predicate_address_from_root</a></div><div class="item-right docblock-short"><p>Takes the bytecode root of a predicate and generates the address of the predicate.</p>
</div></div><div class="item-row"><div class="item-left Function-item"><a class="fn" href="bytecode/fn.swap_configurables.html">bytecode::swap_configurables</a></div><div class="item-right docblock-short"><p>Swaps out configurable values in a contract or predicate’s bytecode.</p>
</div></div><div class="item-row"><div class="item-left Function-item"><a class="fn" href="bytecode/utils/fn._compute_bytecode_root.html">bytecode::utils::_compute_bytecode_root</a></div><div class="item-right docblock-short"><p>Takes some bytecode and computes the bytecode root.</p>
</div></div><div class="item-row"><div class="item-left Function-item"><a class="fn" href="bytecode/utils/fn._predicate_address_from_root.html">bytecode::utils::_predicate_address_from_root</a></div><div class="item-right docblock-short"><p>Takes the bytecode root of predicate generates the address of a predicate.</p>
</div></div><div class="item-row"><div class="item-left Function-item"><a class="fn" href="bytecode/utils/fn._swap_configurables.html">bytecode::utils::_swap_configurables</a></div><div class="item-right docblock-short"><p>Swaps out configurable values in a contract’s or predicate’s bytecode.</p>
</div></div><div class="item-row"><div class="item-left Function-item"><a class="fn" href="bytecode/fn.verify_contract_bytecode.html">bytecode::verify_contract_bytecode</a></div><div class="item-right docblock-short"><p>Asserts that a contract’s bytecode and the given bytecode and configurable values match.</p>
</div></div><div class="item-row"><div class="item-left Function-item"><a class="fn" href="bytecode/fn.verify_predicate_address.html">bytecode::verify_predicate_address</a></div><div class="item-right docblock-short"><p>Asserts that a predicates’s address from some bytecode and configurables and the given address match.</p></div></div><div class="item-row"><div class="item-left Function-item"><a class="fn" href="merkle/binary_proof/fn.leaf_digest.html">merkle::binary_proof::leaf_digest</a></div><div class="item-right docblock-short"><p>Returns the computed leaf hash of “MTH({d(0)}) = SHA-256(0x00 || d(0))”.</p>
</div></div><div class="item-row"><div class="item-left Function-item"><a class="fn" href="bytecode/fn.verify_contract_bytecode.html">bytecode::verify_contract_bytecode</a></div><div class="item-right docblock-short"><p>Asserts that a contract’s bytecode and the given bytecode match.</p>
</div></div><div class="item-row"><div class="item-left Function-item"><a class="fn" href="bytecode/fn.verify_contract_bytecode_with_configurables.html">bytecode::verify_contract_bytecode_with_configurables</a></div><div class="item-right docblock-short"><p>Asserts that a contract’s bytecode and the given bytecode and configurable values match.</p>
</div></div><div class="item-row"><div class="item-left Function-item"><a class="fn" href="bytecode/fn.verify_predicate_address.html">bytecode::verify_predicate_address</a></div><div class="item-right docblock-short"><p>Asserts that a predicates’s address from some bytecode and the given address match.</p>
</div></div><div class="item-row"><div class="item-left Function-item"><a class="fn" href="bytecode/fn.verify_predicate_address_with_configurables.html">bytecode::verify_predicate_address_with_configurables</a></div><div class="item-right docblock-short"><p>Asserts that a predicates’s address from some bytecode and configurables and the given address match.</p></div></div><div class="item-row"><div class="item-left Function-item"><a class="fn" href="merkle/binary_proof/fn.leaf_digest.html">merkle::binary_proof::leaf_digest</a></div><div class="item-right docblock-short"><p>Returns the computed leaf hash of “MTH({d(0)}) = SHA-256(0x00 || d(0))”.</p>
</div></div><div class="item-row"><div class="item-left Function-item"><a class="fn" href="merkle/binary_proof/fn.node_digest.html">merkle::binary_proof::node_digest</a></div><div class="item-right docblock-short"><p>Returns the computed node hash of “MTH(D[n]) = SHA-256(0x01 || MTH(D[0:k]) || MTH(D[k:n]))”.</p>
</div></div><div class="item-row"><div class="item-left Function-item"><a class="fn" href="merkle/binary_proof/fn.process_proof.html">merkle::binary_proof::process_proof</a></div><div class="item-right docblock-short"><p>This function will compute and return a Merkle root given a leaf and corresponding proof.</p>
</div></div><div class="item-row"><div class="item-left Function-item"><a class="fn" href="merkle/binary_proof/fn.verify_proof.html">merkle::binary_proof::verify_proof</a></div><div class="item-right docblock-short"><p>This function will take a Merkle leaf and proof and return whether the corresponding root<br /></div></div><div class="item-row"><div class="item-left Function-item"><a class="fn" href="merkle/utils/fn.path_length_from_key.html">merkle::utils::path_length_from_key</a></div><div class="item-right docblock-short"><p>Calculates the length of the path to a leaf</p>
Expand Down
13 changes: 4 additions & 9 deletions master/sway_libs/bytecode/fn.compute_bytecode_root.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="swaydoc"><meta name="description" content="API documentation for the Sway `compute_bytecode_root` function in `bytecode`."><meta name="keywords" content="sway, swaylang, sway-lang, compute_bytecode_root"><link rel="icon" href="../../static.files/sway-logo.svg"><title>compute_bytecode_root in bytecode - Sway</title><link rel="stylesheet" type="text/css" href="../../static.files/normalize.css"><link rel="stylesheet" type="text/css" href="../../static.files/swaydoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../static.files/ayu.css"><link rel="stylesheet" href="../../static.files/ayu.min.css"></head><body class="swaydoc fn"><nav class="sidebar"><a class="sidebar-logo" href="../../sway_libs/index.html"><div class="logo-container"><img class="sway-logo" src="../../static.files/sway-logo.svg" alt="logo"></div></a><h2 class="location">Function compute_bytecode_root</h2><div class="sidebar-elems"></div></nav><main><div class="width-limiter"><script src="../../search.js" type="text/javascript"></script><script>function onSearchFormSubmit(event){event.preventDefault();const searchQuery=document.getElementById("search-input").value;const url=new URL(window.location.href);if(searchQuery){url.searchParams.set('search',searchQuery)}else{url.searchParams.delete('search')}history.pushState({search:searchQuery},"",url);window.dispatchEvent(new HashChangeEvent("hashchange"))}document.addEventListener('DOMContentLoaded',()=>{const searchbar=document.getElementById("search-input");const searchForm=document.getElementById("search-form");searchbar.addEventListener("keyup",function(event){onSearchFormSubmit(event)});searchbar.addEventListener("search",function(event){onSearchFormSubmit(event)});function onQueryParamsChange(){const searchParams=new URLSearchParams(window.location.search);const query=searchParams.get("search");const searchSection=document.getElementById('search');const mainSection=document.getElementById('main-content');const searchInput=document.getElementById('search-input');if(query){searchInput.value=query;const results=Object.values(SEARCH_INDEX).flat().filter(item=>{const lowerQuery=query.toLowerCase();return item.name.toLowerCase().includes(lowerQuery)});const header=`<h1>Results for ${query}</h1>`;if(results.length>0){const resultList=results.map(item=>{const formattedName=`<span class="type ${item.type_name}">${item.name}</span>`;const name=[...item.module_info,formattedName].join("::");const path=["../..",...item.module_info,item.html_filename].join("/");const left=`<td><span>${name}</span></td>`;const right=`<td><p>${item.preview}</p></td>`;return`<tr onclick="window.location='${path}';">${left}${right}</tr>`}).join('');searchSection.innerHTML=`${header}<table>${resultList}</table>`}else{searchSection.innerHTML=`${header}<p>No results found.</p>`}searchSection.setAttribute("class","search-results");mainSection.setAttribute("class","content hidden")}else{searchSection.setAttribute("class","search-results hidden");mainSection.setAttribute("class","content")}}window.addEventListener('hashchange',onQueryParamsChange);onQueryParamsChange()})</script><nav class="sub"><form id="search-form" class="search-form" onsubmit="onSearchFormSubmit(event)"><div class="search-container"><input id="search-input" class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Search the docs..." type="search"></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn"><span class="in-band">Function <a class="mod" href="../index.html">sway_libs</a><span>::</span><a class="mod" href="index.html">bytecode</a><span>::</span><a class="fn" href="#">compute_bytecode_root</a></span></h1></div><div class="docblock item-decl"><pre class="sway fn"><code>pub fn compute_bytecode_root(
ref mut bytecode: Vec&lt;u8&gt;,
configurables: Option&lt;ContractConfigurables&gt;,
) -&gt; BytecodeRoot </code></pre></div><details class="swaydoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Takes the bytecode of a contract or predicate and configurables and computes the bytecode root.</p>
<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="swaydoc"><meta name="description" content="API documentation for the Sway `compute_bytecode_root` function in `bytecode`."><meta name="keywords" content="sway, swaylang, sway-lang, compute_bytecode_root"><link rel="icon" href="../../static.files/sway-logo.svg"><title>compute_bytecode_root in bytecode - Sway</title><link rel="stylesheet" type="text/css" href="../../static.files/normalize.css"><link rel="stylesheet" type="text/css" href="../../static.files/swaydoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../static.files/ayu.css"><link rel="stylesheet" href="../../static.files/ayu.min.css"></head><body class="swaydoc fn"><nav class="sidebar"><a class="sidebar-logo" href="../../sway_libs/index.html"><div class="logo-container"><img class="sway-logo" src="../../static.files/sway-logo.svg" alt="logo"></div></a><h2 class="location">Function compute_bytecode_root</h2><div class="sidebar-elems"></div></nav><main><div class="width-limiter"><script src="../../search.js" type="text/javascript"></script><script>function onSearchFormSubmit(event){event.preventDefault();const searchQuery=document.getElementById("search-input").value;const url=new URL(window.location.href);if(searchQuery){url.searchParams.set('search',searchQuery)}else{url.searchParams.delete('search')}history.pushState({search:searchQuery},"",url);window.dispatchEvent(new HashChangeEvent("hashchange"))}document.addEventListener('DOMContentLoaded',()=>{const searchbar=document.getElementById("search-input");const searchForm=document.getElementById("search-form");searchbar.addEventListener("keyup",function(event){onSearchFormSubmit(event)});searchbar.addEventListener("search",function(event){onSearchFormSubmit(event)});function onQueryParamsChange(){const searchParams=new URLSearchParams(window.location.search);const query=searchParams.get("search");const searchSection=document.getElementById('search');const mainSection=document.getElementById('main-content');const searchInput=document.getElementById('search-input');if(query){searchInput.value=query;const results=Object.values(SEARCH_INDEX).flat().filter(item=>{const lowerQuery=query.toLowerCase();return item.name.toLowerCase().includes(lowerQuery)});const header=`<h1>Results for ${query}</h1>`;if(results.length>0){const resultList=results.map(item=>{const formattedName=`<span class="type ${item.type_name}">${item.name}</span>`;const name=[...item.module_info,formattedName].join("::");const path=["../..",...item.module_info,item.html_filename].join("/");const left=`<td><span>${name}</span></td>`;const right=`<td><p>${item.preview}</p></td>`;return`<tr onclick="window.location='${path}';">${left}${right}</tr>`}).join('');searchSection.innerHTML=`${header}<table>${resultList}</table>`}else{searchSection.innerHTML=`${header}<p>No results found.</p>`}searchSection.setAttribute("class","search-results");mainSection.setAttribute("class","content hidden")}else{searchSection.setAttribute("class","search-results hidden");mainSection.setAttribute("class","content")}}window.addEventListener('hashchange',onQueryParamsChange);onQueryParamsChange()})</script><nav class="sub"><form id="search-form" class="search-form" onsubmit="onSearchFormSubmit(event)"><div class="search-container"><input id="search-input" class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Search the docs..." type="search"></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn"><span class="in-band">Function <a class="mod" href="../index.html">sway_libs</a><span>::</span><a class="mod" href="index.html">bytecode</a><span>::</span><a class="fn" href="#">compute_bytecode_root</a></span></h1></div><div class="docblock item-decl"><pre class="sway fn"><code>pub fn compute_bytecode_root(bytecode: Vec&lt;u8&gt;) -&gt; BytecodeRoot </code></pre></div><details class="swaydoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Takes the bytecode of a contract or predicate and computes the bytecode root.</p>
<h1>Arguments</h1>
<ul>
<li><code>bytecode</code>: [Vec<!-- raw HTML omitted -->] - The bytecode of a contract or predicate.</li>
<li><code>configurables</code>: [Option<!-- raw HTML omitted -->] - The configurable values to swap.</li>
</ul>
<h1>Returns</h1>
<ul>
Expand All @@ -16,11 +12,10 @@ <h1>Reverts</h1>
<li>When the bytecode is empty.</li>
</ul>
<h1>Examples</h1>
<pre><code class="language-sway">use sway_libs::bytecode::{compute_bytecode_root, ContractConfigurables, BytecodeRoot};
<pre><code class="language-sway">use sway_libs::bytecode::{compute_bytecode_root, BytecodeRoot};

fn foo(my_bytecode: Vec&lt;u8&gt;, my_configurables: Option&lt;ContractConfigurables&gt;) {
let mut my_bytecode = my_bytecode;
let bytecode_root: BytecodeRoot = compute_bytecode_root(my_bytecode, my_configurables);
fn foo(my_bytecode: Vec&lt;u8&gt;) {
let bytecode_root: BytecodeRoot = compute_bytecode_root(my_bytecode);
assert(bytecode_root != b256::zero());
}
</code></pre>
Expand Down
Loading

0 comments on commit ded734e

Please sign in to comment.