Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove
_with_configurables
functions from Bytecode Library and use …
…`Option` instead (#285) ## Type of change <!--Delete points that do not apply--> - Improvement (refactoring, restructuring repository, cleaning tech debt, ...) - Breaking ## Breaking The following demonstrates the breaking change: Before: ```sway fn foo(my_bytecode: Vec<u8>, my_configurables: ContractConfigurables, my_contract_id: ContractId, my_predicate_address: Address) { // Compute bytecode root let root_no_configurables: BytecodeRoot = compute_bytecode_root(my_bytecode); let root_with_configurables: BytecodeRoot = compute_bytecode_root_with_configurables(my_bytecode, my_configurables); // Compute predicate address let address_no_configurables: Address = compute_predicate_address(my_bytecode); let address_with_configurables: Address = compute_predicate_address_with_configurables(my_bytecode, my_configurables); // Verify contract bytecode verify_contract_bytecode(my_contract_id, my_bytecode); // No configurables verify_contract_bytecode_with_configurables(my_contract_id, my_bytecode, my_configurables); // With configurables // Verify predicate address verify_predicate_address(my_predicate_address, my_bytecode); // No configurables verify_predicate_address_with_configurables(my_predicate_address, my_bytecode, my_configurables); // With configurables } ``` After: ```sway fn foo(my_bytecode: Vec<u8>, my_configurables: ContractConfigurables, my_contract_id: ContractId, my_predicate_address: Address) { // Compute bytecode root let root_no_configurables: BytecodeRoot = compute_bytecode_root(my_bytecode, None); let root_with_configurables: BytecodeRoot = compute_bytecode_root(my_bytecode, Some(my_configurables)); // Compute predicate address let address_no_configurables: Address = compute_predicate_address(my_bytecode, None); let address_with_configurables: Address = compute_predicate_address(my_bytecode, Some(my_configurables)); // Verify contract bytecode verify_contract_bytecode(my_contract_id, my_bytecode, None); // No configurables verify_contract_bytecode(my_contract_id, my_bytecode, Some(my_configurables)); // With configurables // Verify predicate address verify_predicate_address(my_predicate_address, my_bytecode, None); // No configurables verify_predicate_address(my_predicate_address, my_bytecode, Some(my_configurables)); // With configurables } ``` ## Changes The following changes have been made: - `compute_bytecode_root_with_configurables()` has been removed in place of `compute_bytecode_root()` with an `Option` argument for configurables - `compute_predicate_address_with_configurables()` has been removed in place of `compute_predicate_address()` with an `Option` argument for configurables - `verify_contract_bytecode_with_configurables()` has been removed in place of `verify_contract_bytecode()` with an `Option` argument for configurables - `verify_predicate_address_with_configurables()` has been removed in place of `verify_predicate_address()` with an `Option` argument for configurables - The `BytecodeRoot` type has been added - The `ContractConfigurables` type has been added ## Related Issues <!--Delete everything after the "#" symbol and replace it with a number. No spaces between hash and number--> Closes #219 ## Checklist - [x] I have linked to any relevant issues. - [x] I have commented my code, particularly in hard-to-understand areas. - [x] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [ ] If my change requires substantial documentation changes, I have [requested support from the DevRel team](https://github.com/FuelLabs/devrel-requests/issues/new/choose) - [x] I have added tests that prove my fix is effective or that my feature works. - [x] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [x] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [x] I have requested a review from the relevant team or maintainers. - [x] I have updated the changelog to reflect the changes on this PR.
- Loading branch information