/
githubmirror
/
sway
Обзор
Документация
Войти
/
githubmirror
/
sway
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/src/sdk-harness/test_projects/contract_bytecode/mod.rs
47 строк
1 KB
Igor Rončević
Improve execution time and coverage of SDK harness and in-language tests (#7555)
16 фев 2026, 22:57
Не верифицирован
16 фев 2026, 22:57
0d8fbc8
Код
Авторство
О чём код?
use fuel_vm::fuel_tx::Contract as FuelsTxContract; use fuels::{prelude::*, types::Bits256}; abigen!(Contract( name = "ContractBytecodeTest", abi = "out/contract_bytecode-abi.json" )); #[tokio::test] async fn can_get_bytecode_root() { let wallet = launch_provider_and_get_wallet().await.unwrap(); let (contract_instance, id) = get_test_contract_instance(wallet).await; let bytecode_root = contract_instance .methods() .get_contract_bytecode_root(ContractId::from(id.clone())) .with_contracts(&[&contract_instance]) .call() .await .unwrap() .value; let contract_bytecode = std::fs::read("out/contract_bytecode.bin").unwrap(); let expected_bytecode_root = Bits256(*FuelsTxContract::root_from_code(contract_bytecode)); assert_eq!(expected_bytecode_root, bytecode_root); } async fn get_test_contract_instance( wallet: Wallet, ) -> (ContractBytecodeTest<Wallet>, ContractId) { let id = Contract::load_from( "out/contract_bytecode.bin", LoadConfiguration::default(), ) .unwrap() .deploy(&wallet, TxPolicies::default()) .await .unwrap() .contract_id; let instance = ContractBytecodeTest::new(id.clone(), wallet); (instance, id) }