Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[jsonrpc] - Mark Transaction Builder RPC as unsafe #9226

Merged
merged 3 commits into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl TestCaseImpl for CallContractTest {
];

let data = ctx
.build_transaction_remotely("sui_moveCall", params)
.build_transaction_remotely("unsafe_moveCall", params)
.await?;
let response = ctx.sign_and_execute(data, "call contract").await;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ impl CoinMergeSplitTest {
let params = rpc_params![signer, primary_coin, coin_to_merge, Some(gas_obj_id), 2000];

let data = ctx
.build_transaction_remotely("sui_mergeCoins", params)
.build_transaction_remotely("unsafe_mergeCoins", params)
.await
.unwrap();

Expand All @@ -138,7 +138,7 @@ impl CoinMergeSplitTest {
let params = rpc_params![signer, primary_coin, amounts, Some(gas_obj_id), 2000];

let data = ctx
.build_transaction_remotely("sui_splitCoin", params)
.build_transaction_remotely("unsafe_splitCoin", params)
.await
.unwrap();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl TestCaseImpl for FullNodeBuildPublishTransactionTest {
];

let data = ctx
.build_transaction_remotely("sui_publish", params)
.build_transaction_remotely("unsafe_publish", params)
.await?;
let response = ctx.sign_and_execute(data, "publish basics package").await;
response
Expand Down
4 changes: 2 additions & 2 deletions crates/sui-cluster-test/src/test_case/native_transfer_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl TestCaseImpl for NativeTransferTest {
recipient_addr
];
let data = ctx
.build_transaction_remotely("sui_transferObject", params)
.build_transaction_remotely("unsafe_transferObject", params)
.await?;
let mut response = ctx.sign_and_execute(data, "coin transfer").await;

Expand All @@ -56,7 +56,7 @@ impl TestCaseImpl for NativeTransferTest {
let obj_to_transfer = *sui_objs.swap_remove(0).id();
let params = rpc_params![signer, obj_to_transfer, 5000, recipient_addr, None::<u64>];
let data = ctx
.build_transaction_remotely("sui_transferSui", params)
.build_transaction_remotely("unsafe_transferSui", params)
.await?;
let mut response = ctx.sign_and_execute(data, "coin transfer").await;

Expand Down
3 changes: 1 addition & 2 deletions crates/sui-indexer/src/apis/transaction_builder_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,12 @@ impl TransactionBuilderServer for TransactionBuilderApi {
async fn request_withdraw_stake(
&self,
signer: SuiAddress,
delegation: ObjectID,
staked_sui: ObjectID,
gas: Option<ObjectID>,
gas_budget: u64,
) -> RpcResult<TransactionBytes> {
self.fullnode
.request_withdraw_stake(signer, delegation, staked_sui, gas, gas_budget)
.request_withdraw_stake(signer, staked_sui, gas, gas_budget)
.await
}
}
Expand Down
7 changes: 2 additions & 5 deletions crates/sui-json-rpc/src/api/transaction_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use sui_json_rpc_types::{
use sui_open_rpc_macros::open_rpc;
use sui_types::base_types::{ObjectID, SuiAddress};

#[open_rpc(namespace = "sui", tag = "Transaction Builder API")]
#[rpc(server, client, namespace = "sui")]
#[open_rpc(namespace = "unsafe", tag = "Transaction Builder API")]
#[rpc(server, client, namespace = "unsafe")]
pub trait TransactionBuilder {
/// Create an unsigned transaction to transfer an object from one address to another. The object's type
/// must allow public transfers
Expand Down Expand Up @@ -240,9 +240,6 @@ pub trait TransactionBuilder {
&self,
/// the transaction signer's Sui address
signer: SuiAddress,
// TODO: remove this parameter
/// Delegation object ID
delegation: ObjectID,
/// StakedSui object ID
staked_sui: ObjectID,
/// gas object to be used in this transaction, node will pick one from the signer's possession if not provided
Expand Down
3 changes: 1 addition & 2 deletions crates/sui-json-rpc/src/transaction_builder_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,14 +320,13 @@ impl TransactionBuilderServer for TransactionBuilderApi {
async fn request_withdraw_stake(
&self,
signer: SuiAddress,
delegation: ObjectID,
staked_sui: ObjectID,
gas: Option<ObjectID>,
gas_budget: u64,
) -> RpcResult<TransactionBytes> {
Ok(TransactionBytes::from_data(
self.builder
.request_withdraw_stake(signer, delegation, staked_sui, gas, gas_budget)
.request_withdraw_stake(signer, staked_sui, gas, gas_budget)
.await?,
)?)
}
Expand Down
Loading