-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new PublishTemplate instruction (#1208)
Description --- As part of #1207 , this PR contains the basic instruction and skeleton for instruction processing. There is a validation implemented for the new PublishTemplate instruction (where also we validate size of wasm binary). Please note that in this PR there is no new substates or anything generated yet. Motivation and Context --- #1207 How Has This Been Tested? --- Send a new transaction to VN: ```rust let AccountGetResponse { account, public_key, } = client .accounts_get(ComponentAddressOrName::Name("acc")) .await?; let account_component_address = account.address .as_component_address() .expect("Failed to get component address"); // publish wasm template let wasm_binary = fs::read("./templates/counter/target/wasm32-unknown-unknown/release/counter.wasm")?; let tx = Transaction::builder() .fee_transaction_pay_from_component(account_component_address, Amount(1000)) .publish_template(wasm_binary) .build_unsigned_transaction(); let transaction_submit_req = TransactionSubmitRequest { transaction: tx, signing_key_index: Some(account.key_index), detect_inputs: true, detect_inputs_use_unversioned: true, proof_ids: vec![], autofill_inputs: vec![], }; let resp = client.submit_transaction(transaction_submit_req).await?; println!("Submit RESP: {resp:?}"); let wait_req = TransactionWaitResultRequest { transaction_id: resp.transaction_id, timeout_secs: Some(120), }; let wait_resp = client.wait_transaction_result(wait_req).await?; println!("TX RESP: {wait_resp:?}"); ``` Check printed out result and transaction result on UIs. Examples: - Invalid wasm template binary ![image](https://github.com/user-attachments/assets/de090251-5dae-4b21-a72b-f3c4f4939db6) - Size exceeding wasm template (manually set a lower limit to check error) ![image](https://github.com/user-attachments/assets/49b588c2-5008-4d70-b831-ab2f0400f647) - Success ![image](https://github.com/user-attachments/assets/ca86cd58-0ae9-4719-a3c8-132ca7fe8a51) What process can a PR reviewer use to test or verify this change? --- Breaking Changes --- - [x] None - [ ] Requires data directory to be deleted - [ ] Other - Please specify
- Loading branch information
Showing
35 changed files
with
653 additions
and
516 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Oops, something went wrong.