You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, tests can be done in a rudimentary way by writing a script with hard-coded values, which calls ABI methods on contract. Tests can also be done by manually crafting input data into a script, which then calls ABI methods on a contract.
Both of these options are onerous to use for anything over than trivial tests. We'd like to support
Crafting input data to a script with Rust, and
Crafting transactions to send to a node, and
Parsing return data, logs, and other receipts, and comparing them against golden values (e.g. assertions) with Rust.
This would allow arbitrary-complexity tests that can do things like make use of disk or network resources.
Proposal
Add a new commend to forc, forc test, which runs one or more tests. Parameters can be based off of cargo test.
The command should run the selected tests (written in Rust, in the project directory). fuel-tx can be used for crafting TransactionScript transactions simply.
A Rust SDK is needed that will:
Deploy one or more contracts.
Serialize/convert native Rust types into (binary) native Sway types, and use this serialized form as input data to a script.
Select a particular ABI method.
Craft and send a script transaction to a node. A standard script can be used that simply forwards input data to a script, and calls the given ABI method. More complex script crafting can be left for future work.
Problem
Currently, tests can be done in a rudimentary way by writing a script with hard-coded values, which calls ABI methods on contract. Tests can also be done by manually crafting input data into a script, which then calls ABI methods on a contract.
Both of these options are onerous to use for anything over than trivial tests. We'd like to support
This would allow arbitrary-complexity tests that can do things like make use of disk or network resources.
Proposal
Add a new commend to
forc
,forc test
, which runs one or more tests. Parameters can be based off ofcargo test
.The command should run the selected tests (written in Rust, in the project directory).
fuel-tx
can be used for craftingTransactionScript
transactions simply.A Rust SDK is needed that will:
Refer to https://github.com/FuelLabs/fuel-v2-contracts/blob/0cf8df2026a25ffef0719bf807586e736565aa2a/test/merkleTreeBinary.ts#L19 for a comprehensive example of the functionality tests should offer (except they should be written in Rust instead of TS/JS).
Additional repo that's a good reference for some features: https://github.com/gakonst/ethers-rs
The text was updated successfully, but these errors were encountered: