Skip to content

Commit 12c3f65

Browse files
committed
fix: align allowed_docker_image_hashes consumers with new return shape
The view now returns [{ image_hash, expiry_timestamp_seconds }] instead of bare hashes. Update the launcher localnet test scripts to select by .image_hash (they compared array elements to a hash string, which never matches an object), and fix the return type in the contract README and the securing-mpc design doc.
1 parent 29aa05a commit 12c3f65

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

crates/contract/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ These functions require the caller to be a participant or candidate.
323323
| `config()` | Returns the contract configuration. | `&ConfigV1` | TBD | TBD |
324324
| `version()` | Returns the contract version. | `String` | TBD | TBD |
325325
| `update_config(config: ConfigV1)` | Updates the contract configuration for `V1`. | `()` | TBD | TBD |
326-
| `allowed_docker_image_hashes()` | Returns all currently allowed MPC Docker image hashes. | `Vec<NodeImageHash>` | TBD | TBD |
326+
| `allowed_docker_image_hashes()` | Returns all currently allowed MPC Docker image hashes with their eviction expiry, newest first. | `Vec<AllowedMpcDockerImageHash>` | TBD | TBD |
327327
| `allowed_launcher_image_hashes()` | Returns all currently allowed launcher image hashes. | `Vec<LauncherImageHash>` | TBD | TBD |
328328
| `allowed_launcher_compose_hashes()` | Returns all currently allowed launcher compose hashes (derived from launcher + MPC image pairs). | `Vec<LauncherDockerComposeHash>` | TBD | TBD |
329329
| `launcher_hash_votes()` | Returns current launcher hash votes, showing each participant's vote. | `LauncherHashVotes` | TBD | TBD |

docs/securing-mpc-with-tee-design-doc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ pub struct Contract {
375375

376376
///Returns all whitelisted Docker image hashes that have been approved
377377
/// by the DAO and verified by the TEE.
378-
pub fn allowed_docker_image_hashes(&self) -> Vec<NodeImageHash>
378+
pub fn allowed_docker_image_hashes(&self) -> Vec<AllowedMpcDockerImageHash>
379379

380380
/// Verifies if all current participants have an accepted TEE state.
381381
/// Automatically enters a resharing, in case one or more participants do not have an accepted

localnet/tee/scripts/rust-launcher/test-hash-override.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ test_override() {
6666
# Verify the hash is in the approved list
6767
local approved
6868
approved="$(near_call_ro allowed_docker_image_hashes '{}' | extract_json_ro)"
69-
if ! echo "$approved" | jq -e --arg h "$override_hash" '.[] | select(. == $h)' >/dev/null 2>&1; then
69+
if ! echo "$approved" | jq -e --arg h "$override_hash" '.[] | select(.image_hash == $h)' >/dev/null 2>&1; then
7070
err "Hash $override_hash is NOT in the approved list. Cannot test override."
7171
echo "$approved"
7272
return 1

localnet/tee/scripts/rust-launcher/test-verify-and-upgrade.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ upgrade_cluster() {
200200
# Check if already approved
201201
local current_hashes
202202
current_hashes="$(near_call_ro allowed_docker_image_hashes '{}' | extract_json_ro)"
203-
if echo "$current_hashes" | jq -e --arg h "$new_hash" '.[] | select(. == $h)' >/dev/null 2>&1; then
203+
if echo "$current_hashes" | jq -e --arg h "$new_hash" '.[] | select(.image_hash == $h)' >/dev/null 2>&1; then
204204
warn "Hash $new_hash is already approved — skipping vote"
205205
else
206206
# --- 2.1 Vote for new MPC hash ---
@@ -228,7 +228,7 @@ upgrade_cluster() {
228228
# Verify vote succeeded
229229
local updated_hashes
230230
updated_hashes="$(near_call_ro allowed_docker_image_hashes '{}' | extract_json_ro)"
231-
if echo "$updated_hashes" | jq -e --arg h "$new_hash" '.[] | select(. == $h)' >/dev/null 2>&1; then
231+
if echo "$updated_hashes" | jq -e --arg h "$new_hash" '.[] | select(.image_hash == $h)' >/dev/null 2>&1; then
232232
pass "New hash approved on-chain: $new_hash"
233233
else
234234
fail "Hash not found in approved list after voting"

0 commit comments

Comments
 (0)