Skip to content

Commit

Permalink
fix testsuite building errors (#4277)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonjiao authored Nov 12, 2024
1 parent b743a6c commit de7b6d9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions testsuite/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ starcoin-txpool = { workspace = true }
starcoin-types = { workspace = true }
starcoin-vm-runtime = { workspace = true }
starcoin-vm-types = { workspace = true }
move-core-types = { workspace = true }

[dev-dependencies]
starcoin-transaction-builder = { workspace = true }
Expand Down
15 changes: 8 additions & 7 deletions testsuite/tests/steps/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@
// SPDX-License-Identifier: Apache-2.0
use crate::MyWorld;
use cucumber::{Steps, StepsBuilder};
use move_core_types::move_resource::MoveStructType;
use starcoin_types::access_path::AccessPath;
use starcoin_vm_types::{account_config::AccountResource, move_resource::MoveResource};
use starcoin_vm_types::{account_config::AccountResource, state_store::state_key::StateKey};

pub fn steps() -> Steps<MyWorld> {
let mut builder: StepsBuilder<MyWorld> = Default::default();
builder.then("state proof", |world: &mut MyWorld, _step| {
let client = world.default_rpc_client.as_ref().take().unwrap();
let account = world.default_account.as_ref().take().unwrap();
let access_path =
AccessPath::new(account.address.clone(), AccountResource::resource_path());
let proof = client
.clone()
.state_get_with_proof(access_path.clone())
.unwrap();
let access_path = AccessPath::resource_access_path(
account.address.clone(),
AccountResource::struct_tag(),
);
let key = StateKey::resource(account.address(), &AccountResource::struct_tag()).unwrap();
let proof = client.clone().state_get_with_proof(key).unwrap();
let state_root = client.clone().state_get_state_root().unwrap();
proof
.into_state_proof()
Expand Down
7 changes: 2 additions & 5 deletions testsuite/tests/steps/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,9 @@ fn transfer_txn(
amount: Option<u128>,
) -> Result<HashValue, Error> {
let chain_state_reader = client.state_reader(StateRootOption::Latest)?;
let account_resource = chain_state_reader
.get_account_resource(from)
.unwrap()
.unwrap();
let account_resource = chain_state_reader.get_account_resource(from)?;
let node_info = client.node_info()?;
let balance = chain_state_reader.get_balance(from).unwrap().unwrap();
let balance = chain_state_reader.get_balance(from)?;
let amount = amount.unwrap_or(balance * 20 / 100);
let raw_txn = build_transfer_txn(
from,
Expand Down

0 comments on commit de7b6d9

Please sign in to comment.