fix: add hosting contract to devnet provision script (closes #44) #45

Open
mik-tf wants to merge 1 commit from development_mik02_add_hosting_to_deploy into development
Owner

Summary

Adds the hosting contract to the devnet/testnet/mainnet provisioning script scripts/rhai/provision/deploy_services.rhai. The contract exists in contracts/hosting/ with tests, but was never part of standard provisioning — only an examples/rhai/contracts/deploy/11_deploy_hosting.rhai existed, which is not run as part of normal deploys.

Why

On devnet today: hosting.dev.hero does not exist. This blocks anything that calls hosting.farm_create / hosting.node_register from a downstream service. Context: #44 (verified via authenticated account.exists queries against the devnet gateway).

Also motivates the marketplace scaling architecture initiative Phase 3 (mycelium_code/home#72) — hero_compute_server first-boot hook calls the hosting contract directly via near-jsonrpc-client.

Diff

13 lines, mirrors the existing dns and marketplace deploy blocks exactly:

print("Deploying Hosting...");
let hosting = root.subaccount("hosting").create().skip_tokens().get();
admin_register_storage()
    .token("spore." + root_id)
    .accounts([hosting.id])
    .funder(root)
    .execute();
hosting.contract_hosting()
    .build()
    .init("new", #{ spore_token: "spore." + root_id })
    .deploy();
print(`  Deployed: ${hosting.id}`);

Placed between the DNS and Marketplace deploy blocks.

The init arg spore_token matches the existing examples/rhai/contracts/deploy/11_deploy_hosting.rhai and the Contract::new signature in contracts/hosting/src/lib.rs. The SPORE storage deposit registration is needed so the hosting account can receive SPORE via ft_transfer_call for slice payments — again matching the example script.

Verification

  • Hosting contract compiles cleanly on wasm32-unknown-unknown: verified with isolated cargo check --target wasm32-unknown-unknown from contracts/hosting/. No new deps.
  • No changes to the hosting contract source itself.
  • contract_hosting() Rhai builder already exists at src/rhai/account/contract_helpers.rs:399 and is registered at src/rhai/account/mod.rs:451 — no registration changes needed.
  • The existing examples/rhai/contracts/deploy/11_deploy_hosting.rhai proves this deploy flow works.

Deploy impact

Next devnet provision run will create hosting.dev.hero fresh. No migration concerns since nothing depends on prior state (there is no prior state). Same for testnet/mainnet when those are provisioned next.

If you prefer a minimal one-shot instead of modifying the provision script, you can alternatively run examples/rhai/contracts/deploy/11_deploy_hosting.rhai directly against devnet and close this PR — the end result for downstream consumers is the same. I went with the script change because it keeps future provision runs consistent.

@scott — whenever convenient. Non-urgent; we will implement Phase 3 using near-workspaces-rs sandbox tests in the meantime, so the only thing that waits on this merge is the final on-devnet E2E validation step.

## Summary Adds the `hosting` contract to the devnet/testnet/mainnet provisioning script `scripts/rhai/provision/deploy_services.rhai`. The contract exists in `contracts/hosting/` with tests, but was never part of standard provisioning — only an `examples/rhai/contracts/deploy/11_deploy_hosting.rhai` existed, which is not run as part of normal deploys. ## Why On devnet today: `hosting.dev.hero` does not exist. This blocks anything that calls `hosting.farm_create` / `hosting.node_register` from a downstream service. Context: https://forge.ourworld.tf/lhumina_code/hero_ledger/issues/44 (verified via authenticated `account.exists` queries against the devnet gateway). Also motivates the marketplace scaling architecture initiative Phase 3 ([mycelium_code/home#72](https://forge.ourworld.tf/mycelium_code/home/issues/72)) — `hero_compute_server` first-boot hook calls the hosting contract directly via `near-jsonrpc-client`. ## Diff 13 lines, mirrors the existing `dns` and `marketplace` deploy blocks exactly: ```rhai print("Deploying Hosting..."); let hosting = root.subaccount("hosting").create().skip_tokens().get(); admin_register_storage() .token("spore." + root_id) .accounts([hosting.id]) .funder(root) .execute(); hosting.contract_hosting() .build() .init("new", #{ spore_token: "spore." + root_id }) .deploy(); print(` Deployed: ${hosting.id}`); ``` Placed between the DNS and Marketplace deploy blocks. The init arg `spore_token` matches the existing `examples/rhai/contracts/deploy/11_deploy_hosting.rhai` and the `Contract::new` signature in `contracts/hosting/src/lib.rs`. The SPORE storage deposit registration is needed so the hosting account can receive SPORE via `ft_transfer_call` for slice payments — again matching the example script. ## Verification - Hosting contract compiles cleanly on `wasm32-unknown-unknown`: verified with isolated `cargo check --target wasm32-unknown-unknown` from `contracts/hosting/`. No new deps. - No changes to the hosting contract source itself. - `contract_hosting()` Rhai builder already exists at `src/rhai/account/contract_helpers.rs:399` and is registered at `src/rhai/account/mod.rs:451` — no registration changes needed. - The existing `examples/rhai/contracts/deploy/11_deploy_hosting.rhai` proves this deploy flow works. ## Deploy impact Next devnet provision run will create `hosting.dev.hero` fresh. No migration concerns since nothing depends on prior state (there is no prior state). Same for testnet/mainnet when those are provisioned next. If you prefer a minimal one-shot instead of modifying the provision script, you can alternatively run `examples/rhai/contracts/deploy/11_deploy_hosting.rhai` directly against devnet and close this PR — the end result for downstream consumers is the same. I went with the script change because it keeps future provision runs consistent. ## Related - Closes https://forge.ourworld.tf/lhumina_code/hero_ledger/issues/44 - Unblocks https://forge.ourworld.tf/mycelium_code/home/issues/72 Phase 3 (scaling architecture) @scott — whenever convenient. Non-urgent; we will implement Phase 3 using `near-workspaces-rs` sandbox tests in the meantime, so the only thing that waits on this merge is the final on-devnet E2E validation step.
fix: add hosting contract to devnet provision script
Some checks failed
Bootstrap Test / bootstrap (push) Failing after 30s
Test / build-and-test (push) Failing after 34s
Bootstrap Test / bootstrap (pull_request) Failing after 25s
Test / build-and-test (pull_request) Failing after 35s
d83b7c9908
The `hosting` contract (contracts/hosting/) has source and tests but was
never part of scripts/rhai/provision/deploy_services.rhai. Only an
example deploy script existed at
examples/rhai/contracts/deploy/11_deploy_hosting.rhai, which is not run
as part of standard provisioning.

Result: on devnet, `hosting.dev.hero` does not exist, so anything that
calls hosting.farm_create / hosting.node_register from a downstream
service (marketplace scaling initiative Phase 3) fails with
AccountDoesNotExist.

This adds a hosting deploy block to deploy_services.rhai modeled on the
existing dns and marketplace blocks:

- Creates subaccount `hosting.<root_id>`
- Registers SPORE storage deposit (hosting contract receives SPORE via
  ft_transfer_call for slice payments)
- Deploys the contract with `new({ spore_token: "spore.<root_id>" })`

The hosting contract compiles cleanly on wasm32-unknown-unknown from
current source (verified with isolated `cargo check
--target wasm32-unknown-unknown`). No new dependencies.

Closes #44
Author
Owner

CI status note

All four CI jobs on this PR are failing with the same error in the Checkout step:

fatal: could not read Username for 'https://forge.ourworld.tf': terminal prompts disabled
The process '/usr/bin/git' failed with exit code 128

Full log excerpt from run #468:

[command]/usr/bin/git config --local http.https://forge.ourworld.tf/.extraheader AUTHORIZATION: basic ***
...
[command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --no-recurse-submodules --depth=1 origin +d83b7c99088cfe804fd48c012531d3d1530d9b35:refs/remotes/origin/development_mik02_add_hosting_to_deploy
fatal: could not read Username for 'https://forge.ourworld.tf': terminal prompts disabled

This is not caused by this PR. The same Test / build-and-test and Bootstrap Test / bootstrap workflows failed on recent development runs (#189, #190) with identical symptoms on commit bb54ee00 — while a third workflow (#191) on the same commit passed. It looks like the runner's git-over-https auth is broken for these two workflows, and the fix is probably runner-side / extraheader related, not in this repo's code.

The actual diff in this PR is 13 lines in a Rhai provision script — it literally cannot affect a git checkout step that runs before any Rhai interpreter or Rust compile touches it.

Suggested next step: re-run manually from the Actions UI after the runner is fixed, or if the runner config needs a token refresh, please handle that separately. Happy to help investigate the runner infra if useful, but I don't have access to the runner config. Non-blocking for us — Phase 3 code work continues in parallel.

@scott — FYI, this is the CI failure I wanted you to look at when convenient.

## CI status note All four CI jobs on this PR are failing with the same error in the **Checkout** step: ``` fatal: could not read Username for 'https://forge.ourworld.tf': terminal prompts disabled The process '/usr/bin/git' failed with exit code 128 ``` Full log excerpt from run [#468](https://forge.ourworld.tf/lhumina_code/hero_ledger/actions/runs/468): ``` [command]/usr/bin/git config --local http.https://forge.ourworld.tf/.extraheader AUTHORIZATION: basic *** ... [command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --no-recurse-submodules --depth=1 origin +d83b7c99088cfe804fd48c012531d3d1530d9b35:refs/remotes/origin/development_mik02_add_hosting_to_deploy fatal: could not read Username for 'https://forge.ourworld.tf': terminal prompts disabled ``` **This is not caused by this PR.** The same `Test / build-and-test` and `Bootstrap Test / bootstrap` workflows failed on recent `development` runs (#189, #190) with identical symptoms on commit `bb54ee00` — while a third workflow (#191) on the same commit passed. It looks like the runner's git-over-https auth is broken for these two workflows, and the fix is probably runner-side / extraheader related, not in this repo's code. The actual diff in this PR is 13 lines in a Rhai provision script — it literally cannot affect a git checkout step that runs before any Rhai interpreter or Rust compile touches it. **Suggested next step**: re-run manually from the Actions UI after the runner is fixed, or if the runner config needs a token refresh, please handle that separately. Happy to help investigate the runner infra if useful, but I don't have access to the runner config. Non-blocking for us — Phase 3 code work continues in parallel. @scott — FYI, this is the CI failure I wanted you to look at when convenient.
Some checks failed
Bootstrap Test / bootstrap (push) Failing after 30s
Test / build-and-test (push) Failing after 34s
Bootstrap Test / bootstrap (pull_request) Failing after 25s
Test / build-and-test (pull_request) Failing after 35s
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin development_mik02_add_hosting_to_deploy:development_mik02_add_hosting_to_deploy
git switch development_mik02_add_hosting_to_deploy

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch development
git merge --no-ff development_mik02_add_hosting_to_deploy
git switch development_mik02_add_hosting_to_deploy
git rebase development
git switch development
git merge --ff-only development_mik02_add_hosting_to_deploy
git switch development_mik02_add_hosting_to_deploy
git rebase development
git switch development
git merge --no-ff development_mik02_add_hosting_to_deploy
git switch development
git merge --squash development_mik02_add_hosting_to_deploy
git switch development
git merge --ff-only development_mik02_add_hosting_to_deploy
git switch development
git merge development_mik02_add_hosting_to_deploy
git push origin development
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_ledger!45
No description provided.