Skip to content

Commit

Permalink
[Move] Change transfer_and_freeze to freeze_object (MystenLabs#672)
Browse files Browse the repository at this point in the history
  • Loading branch information
lxfind authored Mar 7, 2022
1 parent 48dbe19 commit 4f16649
Show file tree
Hide file tree
Showing 14 changed files with 176 additions and 197 deletions.
2 changes: 1 addition & 1 deletion sui_core/src/authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl AuthorityState {
if object_kind.object_id() == t.object_ref.0 {
fp_ensure!(
matches!(object.owner, Owner::SingleOwner(..)),
SuiError::TransferImmutableError
SuiError::TransferSharedError
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion sui_core/src/unit_tests/authority_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ async fn test_transfer_immutable() {
assert_eq!(
result.unwrap_err(),
SuiError::LockErrors {
errors: vec![SuiError::TransferImmutableError]
errors: vec![SuiError::TransferSharedError]
}
);
}
Expand Down
8 changes: 3 additions & 5 deletions sui_core/src/unit_tests/client_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -980,10 +980,9 @@ async fn test_move_calls_object_transfer() {
}

#[tokio::test]
async fn test_move_calls_object_transfer_and_freeze() {
async fn test_move_calls_freeze_object() {
let (mut client, authority_clients) = make_address_manager(4).await;
let (addr1, key1) = make_account(&mut client);
let (addr2, _) = make_account(&mut client);

let object_value: u64 = 100;
let gas_object_id = ObjectID::random();
Expand Down Expand Up @@ -1027,18 +1026,17 @@ async fn test_move_calls_object_transfer_and_freeze() {
let new_obj_ref = client_object(&mut client, new_obj_ref.0).await.0;
gas_object_ref = client_object(&mut client, gas_object_ref.0).await.0;

let pure_args = vec![bcs::to_bytes(&AccountAddress::from(addr2)).unwrap()];
let call_response = client
.move_call(
addr1,
framework_obj_ref,
ident_str!("ObjectBasics").to_owned(),
ident_str!("transfer_and_freeze").to_owned(),
ident_str!("freeze_object").to_owned(),
Vec::new(),
gas_object_ref,
vec![new_obj_ref],
vec![],
pure_args,
vec![],
GAS_VALUE_FOR_TESTING / 2,
signature_callback(&key1),
)
Expand Down
158 changes: 78 additions & 80 deletions sui_core/tests/staged/sui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -306,232 +306,230 @@ SuiError:
SEQ:
TYPENAME: SuiError
1:
TransferImmutableError: UNIT
2:
TransferSharedError: UNIT
3:
2:
TransferNonCoinError: UNIT
4:
3:
MoveObjectAsPackage:
STRUCT:
- object_id:
TYPENAME: ObjectID
5:
4:
UnexpectedOwnerType: UNIT
6:
5:
UnsupportedSharedObjectError: UNIT
7:
6:
InvalidSignature:
STRUCT:
- error: STR
8:
7:
IncorrectSigner: UNIT
9:
8:
UnknownSigner: UNIT
10:
9:
CertificateRequiresQuorum: UNIT
11:
10:
UnexpectedSequenceNumber:
STRUCT:
- object_id:
TYPENAME: ObjectID
- expected_sequence:
TYPENAME: SequenceNumber
12:
11:
ConflictingTransaction:
STRUCT:
- pending_transaction:
TYPENAME: Transaction
13:
12:
ErrorWhileProcessingTransaction: UNIT
14:
13:
ErrorWhileProcessingTransactionTransaction:
STRUCT:
- err: STR
15:
14:
ErrorWhileProcessingConfirmationTransaction:
STRUCT:
- err: STR
16:
15:
ErrorWhileRequestingCertificate: UNIT
17:
16:
ErrorWhileProcessingPublish:
STRUCT:
- err: STR
18:
17:
ErrorWhileProcessingMoveCall:
STRUCT:
- err: STR
19:
18:
ErrorWhileRequestingInformation: UNIT
20:
19:
ObjectFetchFailed:
STRUCT:
- object_id:
TYPENAME: ObjectID
- err: STR
21:
20:
MissingEalierConfirmations:
STRUCT:
- object_id:
TYPENAME: ObjectID
- current_sequence_number:
TYPENAME: SequenceNumber
22:
21:
UnexpectedTransactionIndex: UNIT
23:
22:
CertificateNotfound:
STRUCT:
- certificate_digest:
TYPENAME: TransactionDigest
24:
23:
ParentNotfound:
STRUCT:
- object_id:
TYPENAME: ObjectID
- sequence:
TYPENAME: SequenceNumber
25:
24:
UnknownSenderAccount: UNIT
26:
25:
CertificateAuthorityReuse: UNIT
27:
26:
InvalidSequenceNumber: UNIT
28:
27:
SequenceOverflow: UNIT
29:
28:
SequenceUnderflow: UNIT
30:
29:
WrongShard: UNIT
31:
30:
InvalidCrossShardUpdate: UNIT
32:
31:
InvalidAuthenticator: UNIT
33:
32:
InvalidAddress: UNIT
34:
33:
InvalidTransactionDigest: UNIT
35:
34:
InvalidObjectDigest:
STRUCT:
- object_id:
TYPENAME: ObjectID
- expected_digest:
TYPENAME: ObjectDigest
36:
35:
InvalidDecoding: UNIT
37:
36:
UnexpectedMessage: UNIT
38:
37:
DuplicateObjectRefInput: UNIT
39:
38:
ClientIoError:
STRUCT:
- error: STR
40:
39:
ModuleLoadFailure:
STRUCT:
- error: STR
41:
40:
ModuleVerificationFailure:
STRUCT:
- error: STR
42:
41:
ModuleDeserializationFailure:
STRUCT:
- error: STR
43:
42:
ModulePublishFailure:
STRUCT:
- error: STR
44:
43:
ModuleBuildFailure:
STRUCT:
- error: STR
45:
44:
DependentPackageNotFound:
STRUCT:
- package_id:
TYPENAME: ObjectID
46:
45:
MoveUnitTestFailure:
STRUCT:
- error: STR
47:
46:
FunctionNotFound:
STRUCT:
- error: STR
48:
47:
ModuleNotFound:
STRUCT:
- module_name: STR
49:
48:
InvalidFunctionSignature:
STRUCT:
- error: STR
50:
49:
TypeError:
STRUCT:
- error: STR
51:
50:
AbortedExecution:
STRUCT:
- error: STR
52:
51:
InvalidMoveEvent:
STRUCT:
- error: STR
53:
52:
CircularObjectOwnership: UNIT
54:
53:
GasBudgetTooHigh:
STRUCT:
- error: STR
55:
54:
InsufficientGas:
STRUCT:
- error: STR
56:
55:
InvalidTxUpdate: UNIT
57:
56:
TransactionLockExists: UNIT
58:
57:
TransactionLockDoesNotExist: UNIT
59:
58:
TransactionLockReset: UNIT
60:
59:
ObjectNotFound:
STRUCT:
- object_id:
TYPENAME: ObjectID
61:
60:
ObjectDeleted:
STRUCT:
- object_ref:
TUPLE:
- TYPENAME: ObjectID
- TYPENAME: SequenceNumber
- TYPENAME: ObjectDigest
62:
61:
BadObjectType:
STRUCT:
- error: STR
63:
62:
MoveExecutionFailure: UNIT
64:
63:
ObjectInputArityViolation: UNIT
65:
64:
ExecutionInvariantViolation: UNIT
66:
65:
AuthorityInformationUnavailable: UNIT
67:
66:
AuthorityUpdateFailure: UNIT
68:
67:
ByzantineAuthoritySuspicion:
STRUCT:
- authority:
TYPENAME: PublicKeyBytes
69:
68:
PairwiseSyncFailed:
STRUCT:
- xsource:
Expand All @@ -542,33 +540,33 @@ SuiError:
TYPENAME: TransactionDigest
- error:
TYPENAME: SuiError
70:
69:
StorageError:
NEWTYPE:
TYPENAME: TypedStoreError
71:
70:
BatchErrorSender: UNIT
72:
71:
QuorumNotReached:
STRUCT:
- errors:
SEQ:
TYPENAME: SuiError
73:
72:
ObjectSerializationError: UNIT
74:
73:
ConcurrentTransactionError: UNIT
75:
74:
IncorrectRecipientError: UNIT
76:
75:
TooManyIncorrectAuthorities: UNIT
77:
76:
IncorrectGasSplit: UNIT
78:
77:
IncorrectGasMerge: UNIT
79:
78:
AccountNotFound: UNIT
80:
79:
AccountExists: UNIT
Transaction:
STRUCT:
Expand Down
Loading

0 comments on commit 4f16649

Please sign in to comment.