Skip to content

Commit

Permalink
Merge branch 'movement' into mikhail/upstream-sync
Browse files Browse the repository at this point in the history
  • Loading branch information
mzabaluev committed Sep 16, 2024
2 parents 7bc5e2f + 6d2ec93 commit b405734
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 26 deletions.
12 changes: 10 additions & 2 deletions crates/aptos/src/common/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl CliCommand<()> for InitTool {
network
} else {
eprintln!(
"Choose network from [devnet, testnet, local, custom | defaults to devnet]"
"Choose network from [devnet, testnet, local, custom | defaults to devnet]. For testnet, start over and run movement init --skip-faucet"
);
let input = read_line("network")?;
let input = input.trim();
Expand All @@ -126,6 +126,12 @@ impl CliCommand<()> for InitTool {
}
};

if network == Network::Testnet && !self.skip_faucet {
return Err(CliError::CommandArgumentError(format!(
"For testnet, start over and run movement init --skip-faucet"
)));
}

// Ensure the config contains the network used
profile_config.network = Some(network);

Expand Down Expand Up @@ -349,7 +355,9 @@ impl CliCommand<()> for InitTool {
.profile_name()
.unwrap_or(DEFAULT_PROFILE);
eprintln!(
"\n---\nMovement CLI is now set up for account {} as profile {}!\n See the account here: {}\n Run `movement --help` for more information about commands",
"\n---\nMovement CLI is now set up for account {} as profile {}!\n See the account here: {}\n
Run `movement --help` for more information about commands. \n
Visit https://faucet.movementlabs.xyz to use the testnet faucet.",
address,
profile_name,
explorer_account_link(address, Some(network))
Expand Down
52 changes: 28 additions & 24 deletions ecosystem/indexer-grpc/indexer-grpc-fullnode/src/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,29 +337,32 @@ pub fn convert_write_set_change(change: &WriteSetChange) -> transaction::WriteSe
)),
},
WriteSetChange::DeleteTableItem(delete_table_item) => {
let data = delete_table_item.data.as_ref().unwrap_or_else(|| {
panic!(
"Could not extract data from DeletedTableItem '{:?}' with handle '{:?}'",
delete_table_item,
delete_table_item.handle.to_string()
)
});
let data = delete_table_item.data.as_ref();
// .unwrap_or_else(|| {
// panic!(
// "Could not extract data from DeletedTableItem '{:?}' with handle '{:?}'",
// delete_table_item,
// delete_table_item.handle.to_string()
// )
// });

transaction::WriteSetChange {
r#type: transaction::write_set_change::Type::DeleteTableItem as i32,
change: Some(transaction::write_set_change::Change::DeleteTableItem(
transaction::DeleteTableItem {
state_key_hash: convert_hex_string_to_bytes(
&delete_table_item.state_key_hash,
),
handle: delete_table_item.handle.to_string(),
key: delete_table_item.key.to_string(),
data: Some(transaction::DeleteTableData {
key: data.key.to_string(),
key_type: data.key_type.clone(),
}),
},
)),
change: data.map(|data| {
transaction::write_set_change::Change::DeleteTableItem(
transaction::DeleteTableItem {
state_key_hash: convert_hex_string_to_bytes(
&delete_table_item.state_key_hash,
),
handle: delete_table_item.handle.to_string(),
key: delete_table_item.key.to_string(),
data: Some(transaction::DeleteTableData {
key: data.key.to_string(),
key_type: data.key_type.clone(),
}),
},
)
}),
}
},
WriteSetChange::WriteModule(write_module) => transaction::WriteSetChange {
Expand All @@ -381,10 +384,11 @@ pub fn convert_write_set_change(change: &WriteSetChange) -> transaction::WriteSe
r#type: Some(convert_move_struct_tag(&write_resource.data.typ)),
type_str: write_resource.data.typ.to_string(),
data: serde_json::to_string(&write_resource.data.data).unwrap_or_else(|_| {
panic!(
"Could not convert move_resource data to json '{:?}'",
write_resource.data
)
"{}".to_string()
// panic!(
// "Could not convert move_resource data to json '{:?}'",
// write_resource.data
// )
}),
},
)),
Expand Down

0 comments on commit b405734

Please sign in to comment.