diff --git a/vm/starcoin-transactional-test-harness/src/context.rs b/vm/starcoin-transactional-test-harness/src/context.rs index 75ba858b4e..ca6813b153 100644 --- a/vm/starcoin-transactional-test-harness/src/context.rs +++ b/vm/starcoin-transactional-test-harness/src/context.rs @@ -139,6 +139,7 @@ impl ForkContext { self.storage.apply_write_set(write_set)?; let state_root = self.storage.commit()?; *self.state_root.lock().unwrap() = state_root; + self.storage.flush()?; Ok(()) } } diff --git a/vm/starcoin-transactional-test-harness/tests/cases/call_api_cmd.exp b/vm/starcoin-transactional-test-harness/tests/cases/call_api_cmd.exp index df402e5079..f6f0cfa2c5 100644 --- a/vm/starcoin-transactional-test-harness/tests/cases/call_api_cmd.exp +++ b/vm/starcoin-transactional-test-harness/tests/cases/call_api_cmd.exp @@ -1,7 +1,7 @@ -processed 5 tasks +processed 6 tasks -task 4 'run'. lines 9-16: +task 5 'run'. lines 11-19: { - "gas_used": 10457, + "gas_used": 15073, "status": "Executed" } diff --git a/vm/starcoin-transactional-test-harness/tests/cases/call_api_cmd.move b/vm/starcoin-transactional-test-harness/tests/cases/call_api_cmd.move index 6faab89605..a2cdf2edcd 100644 --- a/vm/starcoin-transactional-test-harness/tests/cases/call_api_cmd.move +++ b/vm/starcoin-transactional-test-harness/tests/cases/call_api_cmd.move @@ -6,11 +6,14 @@ //# call-api chain.get_block_by_number [1] -//# run --signers creator --args {{$.call-api[0].header.number}}u64 --args {{$.call-api[0].header.block_hash}} +//# call-api state.get_with_proof_by_root_raw ["0x1/1/0x1::Account::Account","{{$.call-api[0].header.state_root}}"] + +//# run --signers creator --args {{$.call-api[0].header.number}}u64 --args {{$.call-api[0].header.block_hash}} --args {{$.call-api[1]}} script{ use StarcoinFramework::Vector; - fun main(_sender: signer, block_number: u64, block_hash: vector){ + fun main(_sender: signer, block_number: u64, block_hash: vector, state_proof: vector){ assert!(block_number == 1, 1000); assert!(Vector::length(&block_hash) == 32, 1001); + assert!(Vector::length(&state_proof) > 32, 1002); } } \ No newline at end of file