From 32349d71ea29dbcd91fe580d8fc27f7dda834254 Mon Sep 17 00:00:00 2001 From: Andreas Fackler Date: Mon, 8 Sep 2025 13:53:14 +0200 Subject: [PATCH 1/3] Restore old behavior: Don't record oracle if blob known from same block. --- linera-execution/src/execution_state_actor.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/linera-execution/src/execution_state_actor.rs b/linera-execution/src/execution_state_actor.rs index 193ba4f1c012..49ab8bdac8ff 100644 --- a/linera-execution/src/execution_state_actor.rs +++ b/linera-execution/src/execution_state_actor.rs @@ -452,17 +452,12 @@ where .await? .track_blob_read(content.bytes().len() as u64)?; } + self.state + .system + .blob_used(self.txn_tracker, blob_id) + .await?; content }; - let is_new = self - .state - .system - .blob_used(self.txn_tracker, blob_id) - .await?; - if is_new { - self.txn_tracker - .replay_oracle_response(OracleResponse::Blob(blob_id))?; - } callback.respond(content) } From 3407f6d58da82fc0c25dcf99f7b53eb9c8d72150 Mon Sep 17 00:00:00 2001 From: Andreas Fackler Date: Mon, 8 Sep 2025 15:07:41 +0200 Subject: [PATCH 2/3] Add a regression test; fix README after #4397. --- examples/publish-read-data-blob/README.md | 4 ++-- linera-core/src/unit_tests/wasm_client_tests.rs | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/examples/publish-read-data-blob/README.md b/examples/publish-read-data-blob/README.md index e26f43158c28..3fce22e089b6 100644 --- a/examples/publish-read-data-blob/README.md +++ b/examples/publish-read-data-blob/README.md @@ -1,8 +1,8 @@ # Publish and read a data blob This example shows how to create a blob and how to read it. -This example should be read in conjunction with the end-to-end -test `test_wasm_end_to_end_publish_read_data_blob`. +This example should be read in conjunction with the client +test `run_test_publish_read_data_blob`. It shows 3 scenarios: * Publishing and reading blobs with the publishing and reading in different diff --git a/linera-core/src/unit_tests/wasm_client_tests.rs b/linera-core/src/unit_tests/wasm_client_tests.rs index b9757c1c53a6..22f1e34d5a4a 100644 --- a/linera-core/src/unit_tests/wasm_client_tests.rs +++ b/linera-core/src/unit_tests/wasm_client_tests.rs @@ -1066,7 +1066,7 @@ where // publishing the data. let publish_op = publish_read_data_blob::Operation::CreateDataBlob(test_data.clone()); - client + let certificate = client .execute_operation(Operation::user(application_id, &publish_op)?) .await .unwrap_ok_committed(); @@ -1081,14 +1081,16 @@ where .execute_operation(Operation::user(application_id, &read_op)?) .await .unwrap_ok_committed(); + assert_eq!(certificate.block().body.oracle_responses[0].len(), 0); // Method 2: Publishing and reading in the same transaction let test_data = b"This is test data for method 2.".to_vec(); let combined_op = publish_read_data_blob::Operation::CreateAndReadDataBlob(test_data); - client + let certificate = client .execute_operation(Operation::user(application_id, &combined_op)?) .await .unwrap_ok_committed(); + assert_eq!(certificate.block().body.oracle_responses[0].len(), 0); // Method 3: Publishing and reading in the same block but different transactions let test_data = b"This is test data for method 3.".to_vec(); @@ -1098,10 +1100,12 @@ where let read_op = publish_read_data_blob::Operation::ReadDataBlob(hash, test_data); let op1 = Operation::user(application_id, &publish_op)?; let op2 = Operation::user(application_id, &read_op)?; - client + let certificate = client .execute_operations(vec![op1, op2], vec![]) .await .unwrap_ok_committed(); + assert_eq!(certificate.block().body.oracle_responses[0].len(), 0); + assert_eq!(certificate.block().body.oracle_responses[1].len(), 0); Ok(()) } From 34a11de53d56f33efb6e26d54799adcdb9934bf9 Mon Sep 17 00:00:00 2001 From: Andreas Fackler Date: Mon, 8 Sep 2025 15:41:18 +0200 Subject: [PATCH 3/3] Add comment justifying 0 oracle responses. --- linera-core/src/unit_tests/wasm_client_tests.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/linera-core/src/unit_tests/wasm_client_tests.rs b/linera-core/src/unit_tests/wasm_client_tests.rs index 22f1e34d5a4a..13cd8d453bf0 100644 --- a/linera-core/src/unit_tests/wasm_client_tests.rs +++ b/linera-core/src/unit_tests/wasm_client_tests.rs @@ -1081,6 +1081,8 @@ where .execute_operation(Operation::user(application_id, &read_op)?) .await .unwrap_ok_committed(); + // None of the following blocks should have oracle responses: all read blobs were created + // on the same chain, so no oracle is needed. assert_eq!(certificate.block().body.oracle_responses[0].len(), 0); // Method 2: Publishing and reading in the same transaction