Skip to content

Commit

Permalink
Rename Transfer to TransferCoin (MystenLabs#1875)
Browse files Browse the repository at this point in the history
  • Loading branch information
lxfind authored May 10, 2022
1 parent ed21bd4 commit 4370c79
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
10 changes: 5 additions & 5 deletions sui/open_rpc/spec/openrpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -1487,14 +1487,14 @@
"SingleTransactionKind": {
"oneOf": [
{
"description": "Initiate an object transfer between addresses",
"description": "Initiate a coin transfer between addresses",
"type": "object",
"required": [
"Transfer"
"TransferCoin"
],
"properties": {
"Transfer": {
"$ref": "#/components/schemas/Transfer"
"TransferCoin": {
"$ref": "#/components/schemas/TransferCoin"
}
},
"additionalProperties": false
Expand Down Expand Up @@ -1995,7 +1995,7 @@
}
]
},
"Transfer": {
"TransferCoin": {
"type": "object",
"required": [
"object_ref",
Expand Down
2 changes: 1 addition & 1 deletion sui/src/benchmark/transaction_creator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fn make_transfer_transaction(
],
})
} else {
SingleTransactionKind::Transfer(Transfer {
SingleTransactionKind::TransferCoin(TransferCoin {
recipient,
object_ref,
})
Expand Down
4 changes: 2 additions & 2 deletions sui_core/src/execution_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use sui_types::{
gas::{self, SuiGasStatus},
messages::{
ExecutionStatus, MoveCall, MoveModulePublish, SingleTransactionKind, TransactionData,
TransactionEffects, Transfer,
TransactionEffects, TransferCoin,
},
object::Object,
storage::{BackingPackageStore, Storage},
Expand Down Expand Up @@ -86,7 +86,7 @@ fn execute_transaction<S: BackingPackageStore>(
// once across single tx, we should be able to run them in parallel.
for single_tx in transaction_data.kind.into_single_transactions() {
result = match single_tx {
SingleTransactionKind::Transfer(Transfer {
SingleTransactionKind::TransferCoin(TransferCoin {
recipient,
object_ref,
}) => {
Expand Down
2 changes: 1 addition & 1 deletion sui_core/src/transaction_input_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ where
.kind
.single_transactions()
.filter_map(|s| {
if let SingleTransactionKind::Transfer(t) = s {
if let SingleTransactionKind::TransferCoin(t) = s {
Some(t.object_ref.0)
} else {
None
Expand Down
4 changes: 2 additions & 2 deletions sui_core/src/unit_tests/batch_transaction_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async fn test_batch_transaction_ok() -> anyhow::Result<()> {
init_state_with_ids([sender; TOTAL].into_iter().zip(all_ids.clone().into_iter())).await;
let mut transactions = vec![];
for obj_id in all_ids.iter().take(N) {
transactions.push(SingleTransactionKind::Transfer(Transfer {
transactions.push(SingleTransactionKind::TransferCoin(TransferCoin {
recipient,
object_ref: authority_state
.get_object(obj_id)
Expand Down Expand Up @@ -99,7 +99,7 @@ async fn test_batch_transaction_last_one_fail() -> anyhow::Result<()> {
init_state_with_ids([sender; TOTAL].into_iter().zip(all_ids.clone().into_iter())).await;
let mut transactions = vec![];
for obj_id in all_ids.iter().take(N) {
transactions.push(SingleTransactionKind::Transfer(Transfer {
transactions.push(SingleTransactionKind::TransferCoin(TransferCoin {
recipient,
object_ref: authority_state
.get_object(obj_id)
Expand Down
6 changes: 3 additions & 3 deletions sui_core/tests/staged/sui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ SignedBatch:
SingleTransactionKind:
ENUM:
0:
Transfer:
TransferCoin:
NEWTYPE:
TYPENAME: Transfer
TYPENAME: TransferCoin
1:
Publish:
NEWTYPE:
Expand Down Expand Up @@ -606,7 +606,7 @@ TransactionKind:
NEWTYPE:
SEQ:
TYPENAME: SingleTransactionKind
Transfer:
TransferCoin:
STRUCT:
- recipient:
TYPENAME: SuiAddress
Expand Down
12 changes: 6 additions & 6 deletions sui_types/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub enum CallArg {
}

#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize, Deserialize, JsonSchema)]
pub struct Transfer {
pub struct TransferCoin {
pub recipient: SuiAddress,
pub object_ref: ObjectRef,
}
Expand Down Expand Up @@ -82,8 +82,8 @@ pub struct MoveModulePublish {

#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize, Deserialize, JsonSchema)]
pub enum SingleTransactionKind {
/// Initiate an object transfer between addresses
Transfer(Transfer),
/// Initiate a coin transfer between addresses
TransferCoin(TransferCoin),
/// Publish a new Move module
Publish(MoveModulePublish),
/// Call a function in a published Move module
Expand Down Expand Up @@ -114,7 +114,7 @@ impl SingleTransactionKind {
/// TODO: use an iterator over references here instead of a Vec to avoid allocations.
pub fn input_objects(&self) -> SuiResult<Vec<InputObjectKind>> {
let input_objects = match &self {
Self::Transfer(Transfer { object_ref, .. }) => {
Self::TransferCoin(TransferCoin { object_ref, .. }) => {
vec![InputObjectKind::ImmOrOwnedMoveObject(*object_ref)]
}
Self::Call(MoveCall {
Expand Down Expand Up @@ -168,7 +168,7 @@ impl Display for SingleTransactionKind {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let mut writer = String::new();
match &self {
Self::Transfer(t) => {
Self::TransferCoin(t) => {
writeln!(writer, "Transaction Kind : Transfer")?;
writeln!(writer, "Recipient : {}", t.recipient)?;
let (object_id, seq, digest) = t.object_ref;
Expand Down Expand Up @@ -291,7 +291,7 @@ where
gas_payment: ObjectRef,
gas_budget: u64,
) -> Self {
let kind = TransactionKind::Single(SingleTransactionKind::Transfer(Transfer {
let kind = TransactionKind::Single(SingleTransactionKind::TransferCoin(TransferCoin {
recipient,
object_ref,
}));
Expand Down

0 comments on commit 4370c79

Please sign in to comment.