-
Notifications
You must be signed in to change notification settings - Fork 11.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #136 from lxfind/fix-adpater-tests
Fix CreateTransferUse.move
- Loading branch information
Showing
1 changed file
with
11 additions
and
16 deletions.
There are no files selected for viewing
27 changes: 11 additions & 16 deletions
27
...rogrammability/adapter/tests/testsuite/create_transfer_use/sources/CreateTransferUse.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,27 @@ | ||
module 0x2::CreateTransferUse { | ||
use FastX::Authenticator::{Self, Authenticator}; | ||
use FastX::Address::{Self, Address}; | ||
use FastX::ID::ID; | ||
use FastX::Transfer; | ||
use FastX::TxContext; | ||
use FastX::TxContext::{Self, TxContext}; | ||
|
||
struct S has key { | ||
id: ID, | ||
f: u64 | ||
} | ||
|
||
/// Create an object and transfer it to `signer` | ||
public fun create(signer: signer, f: u64, inputs_hash: vector<u8>) { | ||
let ctx = TxContext::make_unsafe(signer, inputs_hash); | ||
let s = S { id: TxContext::new_id(&mut ctx), f }; | ||
Transfer::transfer(s, TxContext::get_authenticator(&ctx)); | ||
/// Create an object and transfer it to `recipient` | ||
public fun create(f: u64, recipient: vector<u8>, ctx: TxContext) { | ||
Transfer::transfer( | ||
S { id: TxContext::new_id(&mut ctx), f }, | ||
Address::new(recipient) | ||
) | ||
} | ||
|
||
fun transfer_(s: S, recipient: Authenticator) { | ||
public fun transfer(s: S, recipient: Address, _ctx: TxContext) { | ||
Transfer::transfer(s, recipient) | ||
} | ||
|
||
public fun transfer( | ||
_signer: signer, | ||
id: address, | ||
recipient: address, | ||
_inputs_hash: vector<u8> | ||
) acquires S { | ||
let s = move_from<S>(id); | ||
transfer_(s, Authenticator::new_from_address(recipient)) | ||
public fun use_it(s: &S, _ctx: TxContext) { | ||
s.f; | ||
} | ||
} |
8a18ead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bench results
�[0m�[0m�[1m�[32m Finished�[0m release [optimized + debuginfo] target(s) in 4.17s
�[0m�[0m�[1m�[32m Running�[0m
target/release/bench
[2022-01-07T05:03:31Z INFO bench] Starting benchmark: OrdersAndCerts
[2022-01-07T05:03:31Z INFO bench] Preparing accounts.
[2022-01-07T05:03:35Z INFO bench] Preparing transactions.
[2022-01-07T05:03:43Z INFO fastpay::network] Listening to Tcp traffic on 127.0.0.1:9555
[2022-01-07T05:03:44Z INFO bench] Set max_in_flight to 500
[2022-01-07T05:03:44Z INFO bench] Sending requests.
[2022-01-07T05:03:44Z INFO fastpay::network] Sending Tcp requests to 127.0.0.1:9555
[2022-01-07T05:03:44Z WARN fastpay::network] User query failed: The given sequence (SequenceNumber(0)) number must match the next expected sequence (SequenceNumber(1)) number of the account
[2022-01-07T05:03:45Z WARN fastpay::network] User query failed: The given sequence (SequenceNumber(0)) number must match the next expected sequence (SequenceNumber(1)) number of the account
[2022-01-07T05:03:45Z INFO fastpay::network] 127.0.0.1:9555 has processed 5000 packets
[2022-01-07T05:03:46Z WARN fastpay::network] User query failed: The given sequence (SequenceNumber(0)) number must match the next expected sequence (SequenceNumber(1)) number of the account
[2022-01-07T05:03:46Z INFO fastpay::network] In flight 500 Remaining 35000
[2022-01-07T05:03:46Z INFO fastpay::network] 127.0.0.1:9555 has processed 10000 packets
[2022-01-07T05:03:47Z WARN fastpay::network] User query failed: The given sequence (SequenceNumber(0)) number must match the next expected sequence (SequenceNumber(1)) number of the account
[2022-01-07T05:03:47Z INFO fastpay::network] 127.0.0.1:9555 has processed 15000 packets
[2022-01-07T05:03:48Z WARN fastpay::network] User query failed: The given sequence (SequenceNumber(0)) number must match the next expected sequence (SequenceNumber(1)) number of the account
[2022-01-07T05:03:48Z INFO fastpay::network] In flight 500 Remaining 30000
[2022-01-07T05:03:48Z INFO fastpay::network] 127.0.0.1:9555 has processed 20000 packets
[2022-01-07T05:03:49Z WARN fastpay::network] User query failed: The given sequence (SequenceNumber(0)) number must match the next expected sequence (SequenceNumber(1)) number of the account
[2022-01-07T05:03:49Z INFO fastpay::network] 127.0.0.1:9555 has processed 25000 packets
[2022-01-07T05:03:50Z WARN fastpay::network] User query failed: The given sequence (SequenceNumber(0)) number must match the next expected sequence (SequenceNumber(1)) number of the account
[2022-01-07T05:03:50Z INFO fastpay::network] In flight 500 Remaining 25000
[2022-01-07T05:03:50Z INFO fastpay::network] 127.0.0.1:9555 has processed 30000 packets
[2022-01-07T05:03:51Z WARN fastpay::network] User query failed: The given sequence (SequenceNumber(0)) number must match the next expected sequence (SequenceNumber(1)) number of the account
[2022-01-07T05:03:52Z WARN fastpay::network] User query failed: The given sequence (SequenceNumber(0)) number must match the next expected sequence (SequenceNumber(1)) number of the account
[2022-01-07T05:03:52Z INFO fastpay::network] 127.0.0.1:9555 has processed 35000 packets
[2022-01-07T05:03:52Z INFO fastpay::network] In flight 500 Remaining 20000
[2022-01-07T05:03:52Z INFO fastpay::network] 127.0.0.1:9555 has processed 40000 packets
[2022-01-07T05:03:53Z WARN fastpay::network] User query failed: The given sequence (SequenceNumber(0)) number must match the next expected sequence (SequenceNumber(1)) number of the account
[2022-01-07T05:03:53Z INFO fastpay::network] 127.0.0.1:9555 has processed 45000 packets
[2022-01-07T05:03:53Z INFO fastpay::network] In flight 500 Remaining 15000
[2022-01-07T05:03:53Z INFO fastpay::network] 127.0.0.1:9555 has processed 50000 packets
[2022-01-07T05:03:54Z WARN fastpay::network] User query failed: The given sequence (SequenceNumber(0)) number must match the next expected sequence (SequenceNumber(1)) number of the account
[2022-01-07T05:03:54Z INFO fastpay::network] 127.0.0.1:9555 has processed 55000 packets
[2022-01-07T05:03:54Z INFO fastpay::network] In flight 500 Remaining 10000
[2022-01-07T05:03:54Z INFO fastpay::network] 127.0.0.1:9555 has processed 60000 packets
[2022-01-07T05:03:55Z WARN fastpay::network] User query failed: The given sequence (SequenceNumber(0)) number must match the next expected sequence (SequenceNumber(1)) number of the account
[2022-01-07T05:03:55Z INFO fastpay::network] 127.0.0.1:9555 has processed 65000 packets
[2022-01-07T05:03:55Z INFO fastpay::network] In flight 500 Remaining 5000
[2022-01-07T05:03:55Z INFO fastpay::network] 127.0.0.1:9555 has processed 70000 packets
[2022-01-07T05:03:56Z WARN fastpay::network] User query failed: The given sequence (SequenceNumber(0)) number must match the next expected sequence (SequenceNumber(1)) number of the account
[2022-01-07T05:03:56Z INFO fastpay::network] 127.0.0.1:9555 has processed 75000 packets
[2022-01-07T05:03:57Z WARN fastpay::network] User query failed: The given sequence (SequenceNumber(0)) number must match the next expected sequence (SequenceNumber(1)) number of the account
[2022-01-07T05:03:57Z INFO fastpay::network] 127.0.0.1:9555 has processed 80000 packets
[2022-01-07T05:03:57Z INFO fastpay::network] Done sending Tcp requests to 127.0.0.1:9555
[2022-01-07T05:03:57Z INFO bench] Received 80000 responses.
[2022-01-07T05:03:57Z WARN bench] Completed benchmark for OrdersAndCerts
Total time: 12286617us, items: 40000, tx/sec: 3255.574744455695