-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: remove
sway-libs
dep from testing fixtures (#2189)
* test: mock the compute_bytecode functions in the sway contracts * doc: add changeset * build: forc format * wip * test: update vector test * test: updated tests * test: increase test timeout * update Forc and tests * test: remove unnecessary array conversion * docs: update docs example * test: update forc formatting issue
- Loading branch information
Showing
8 changed files
with
42 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 4 additions & 11 deletions
15
apps/docs-snippets/test/fixtures/forc-projects/bytecode-input/src/main.sw
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,14 @@ | ||
contract; | ||
|
||
// TODO: Uncomment bytecode-related stuff | ||
// This requires sway-libs to be compatible with latest forc (0.52+) | ||
// use bytecode::*; | ||
|
||
|
||
abi MyContract { | ||
// fn compute_bytecode_root(bytecode_input: Vec<u8>) -> b256; | ||
fn compute_bytecode_root(bytecode_input: Vec<u8>) -> bool; | ||
fn compute_bytecode_root(bytecode_input: Vec<u8>) -> b256; | ||
} | ||
|
||
impl MyContract for Contract { | ||
// #region vector-bytecode-input-sway | ||
fn compute_bytecode_root(bytecode_input: Vec<u8>) -> bool { | ||
// let root = compute_bytecode_root(bytecode_input); | ||
// return root; | ||
return true; | ||
fn compute_bytecode_root(bytecode_input: Vec<u8>) -> b256 { | ||
//simply return a fixed b256 value created from a hexadecimal string from testing purposes | ||
return 0x0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20; | ||
} | ||
// #endregion vector-bytecode-input-sway | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 5 additions & 14 deletions
19
packages/fuel-gauge/test/fixtures/forc-projects/bytecode-sway-lib/src/main.sw
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,24 @@ | ||
contract; | ||
|
||
// TODO: Uncomment bytecode-related stuff | ||
// This requires sway-libs to be compatible with latest forc (0.52+) | ||
// use bytecode::*; | ||
|
||
|
||
abi MyContract { | ||
fn compute_bytecode_root(bytecode_input: Vec<u8>); | ||
|
||
fn verify_contract_bytecode(contract_id: ContractId, bytecode: Vec<u8>) -> bool; | ||
|
||
// fn compute_predicate_address(bytecode: Vec<u8>) -> Address; | ||
fn compute_predicate_address(bytecode: Vec<u8>) -> bool; | ||
fn compute_predicate_address(bytecode: Vec<u8>) -> Address; | ||
} | ||
|
||
impl MyContract for Contract { | ||
fn compute_bytecode_root(bytecode_input: Vec<u8>) { | ||
// let mut bytecode = bytecode_input; | ||
// let root = compute_bytecode_root(bytecode); | ||
// log(root); | ||
// simply logs the hexidecimal b256 string of the bytecode input for testing purposes | ||
log(0x0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20); | ||
} | ||
|
||
fn verify_contract_bytecode(contract_id: ContractId, bytecode: Vec<u8>) -> bool { | ||
// verify_contract_bytecode(contract_id, bytecode); | ||
return true; | ||
} | ||
|
||
fn compute_predicate_address(bytecode: Vec<u8>) -> bool { | ||
// return compute_predicate_address(bytecode); | ||
return true; | ||
fn compute_predicate_address(bytecode: Vec<u8>) -> Address { | ||
return Address::from(0x6b6ef590390f0a7de75f8275ab5d7877c17236caba2514039c6565ec15f79111); | ||
} | ||
} |