有時需要更新 CCF JavaScript 解譯器的執行時期選項,以延長要求執行持續時間,或更新堆積或堆疊配置大小。 在本操作指南中,您將學習更新運行時設置。 本教學課程建置在 快速入門:使用 Azure 入口網站 建立 Azure 受控 CCF 資源 中建立的 Azure 受控 CCF (受控 CCF) 資源為基礎。
先決條件
- Python 3+。
- CCF Python 套件的最新版本。
下載服務身分識別
Azure 受控 CCF 資源具有稱為服務身分識別的唯一身分識別,由憑證表示,並在資源建立期間建立。 屬於 Azure 受控 CCF 資源的每個個別節點都有其自我簽署憑證,由服務身分識別背書,以建立信任。
建議客戶下載服務身分憑證,並在與服務互動時使用它來建立 TLS 連線。 下列命令會下載憑證,並將其儲存至 service_cert.pem 中。
curl https://identity.confidential-ledger.core.azure.com/ledgerIdentity/confidentialbillingapp --silent | jq ' .ledgerTlsCertificate' | xargs echo -e > service_cert.pem
更新執行階段選項
備註
在 Mac 上執行命令時,請將 替換 date -Is 為 date +%FT%T%z。
- 準備 set_js_runtime_options.json 檔案,並使用下列命令提交:
$ cat set_js_runtime_options.json { "actions": [ { "name": "set_js_runtime_options", "args": { "max_heap_bytes": 1024, "max_stack_bytes": 1024, "max_execution_time_ms": 5000, // increase the request execution time "log_exception_details": false, "return_exception_details": false } } ] } $ proposal_id=$( (ccf_cose_sign1 --content set_js_runtime_options.json --signing-cert member0_cert.pem --signing-key member0_privk.pem --ccf-gov-msg-type proposal --ccf-gov-msg-created_at `date -Is` | curl https://confidentialbillingapp.confidential-ledger.azure.com/gov/proposals -H 'Content-Type: application/cose' --data-binary @- --cacert service_cert.pem | jq -r ‘.proposal_id’) ) - 下一步是通過提交投票來接受該提案。
cat vote_accept.json { "ballot": "export function vote (proposal, proposerId) { return true }" } ccf_cose_sign1 --content vote_accept.json --signing-cert member0_cert.pem --signing-key member0_privk.pem --ccf-gov-msg-type ballot --ccf-gov-msg-created_at `date -Is` --ccf-gov-msg-proposal_id $proposal_id | curl https://confidentialbillingapp.confidential-ledger.azure.com/gov/proposals/$proposal_id/ballots -H 'Content-Type: application/cose' --data-binary @- --cacert service_cert.pem - 針對受管理 CCF 資源中的每個成員重複上述步驟。
- 接受提案後,執行階段選項將應用於後續請求。