Skip to content

Commit 8b8ba57

Browse files
authored
RM UserData from Transfer command and node service. (#2559)
* RM UserData from Transfer command and node service. As a fallout, the burn & claim methods also loose the UserData. * RM unused import behind feature flag * Update docs and schemas after the removal.
1 parent f5fe8c0 commit 8b8ba57

File tree

17 files changed

+68
-260
lines changed

17 files changed

+68
-260
lines changed

CLI.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ A Byzantine-fault tolerant sidechain with low-latency finality and high throughp
140140

141141
Transfer funds
142142

143-
**Usage:** `linera transfer [OPTIONS] --from <SENDER> --to <RECIPIENT> <AMOUNT>`
143+
**Usage:** `linera transfer --from <SENDER> --to <RECIPIENT> <AMOUNT>`
144144

145145
###### **Arguments:**
146146

@@ -150,7 +150,6 @@ Transfer funds
150150

151151
* `--from <SENDER>` — Sending chain ID (must be one of our chains)
152152
* `--to <RECIPIENT>` — Recipient account
153-
* `--data <USER_DATA>` — User Data (should be a string whose bytes are at most 32 in length)
154153

155154

156155

linera-chain/src/test.rs

-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ impl BlockTestExt for Block {
8989
owner,
9090
recipient,
9191
amount,
92-
user_data: Default::default(),
9392
})
9493
}
9594

linera-chain/src/unit_tests/chain_tests.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use linera_base::{
1717
};
1818
use linera_execution::{
1919
committee::{Committee, Epoch, ValidatorName, ValidatorState},
20-
system::{OpenChainConfig, Recipient, UserData},
20+
system::{OpenChainConfig, Recipient},
2121
test_utils::{ExpectedCall, MockApplication},
2222
ExecutionError, ExecutionRuntimeConfig, ExecutionRuntimeContext, Message, MessageKind,
2323
Operation, ResourceControlPolicy, SystemMessage, SystemOperation, TestExecutionRuntimeContext,
@@ -153,7 +153,6 @@ async fn test_block_size_limit() {
153153
owner: None,
154154
recipient: Recipient::root(0),
155155
amount: Amount::ONE,
156-
user_data: UserData::default(),
157156
});
158157
let result = chain.execute_block(&invalid_block, time, None).await;
159158
assert_matches!(

linera-client/src/client_context.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use {
3535
linera_core::data_types::ChainInfoQuery,
3636
linera_execution::{
3737
committee::Epoch,
38-
system::{OpenChainConfig, Recipient, SystemOperation, UserData, OPEN_CHAIN_MESSAGE_INDEX},
38+
system::{OpenChainConfig, Recipient, SystemOperation, OPEN_CHAIN_MESSAGE_INDEX},
3939
Operation,
4040
},
4141
linera_rpc::{
@@ -694,7 +694,6 @@ where
694694
owner: None,
695695
recipient: Recipient::chain(next_recipient),
696696
amount,
697-
user_data: UserData::default(),
698697
}),
699698
};
700699
let operations = iter::repeat(operation)

linera-client/src/client_options.rs

-4
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,6 @@ pub enum ClientCommand {
301301

302302
/// Amount to transfer
303303
amount: Amount,
304-
305-
/// User Data (should be a string whose bytes are at most 32 in length)
306-
#[arg(long = "data")]
307-
user_data: Option<String>,
308304
},
309305

310306
/// Open (i.e. activate) a new chain deriving the UID from an existing one.

linera-client/src/unit_tests/chain_listener.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ use linera_core::{
1818
node::CrossChainMessageDelivery,
1919
test_utils::{MemoryStorageBuilder, NodeProvider, StorageBuilder as _, TestBuilder},
2020
};
21-
use linera_execution::{
22-
system::{Recipient, UserData},
23-
ResourceControlPolicy,
24-
};
21+
use linera_execution::{system::Recipient, ResourceControlPolicy};
2522
use linera_rpc::{
2623
config::{NetworkProtocol, ValidatorPublicNetworkPreConfig},
2724
simple::TransportProtocol,
@@ -189,9 +186,7 @@ async fn test_chain_listener() -> anyhow::Result<()> {
189186
// Transfer one token to chain 0. The listener should eventually become leader and receive
190187
// the message.
191188
let recipient0 = Recipient::chain(chain_id0);
192-
client1
193-
.transfer(None, Amount::ONE, recipient0, UserData::default())
194-
.await?;
189+
client1.transfer(None, Amount::ONE, recipient0).await?;
195190
for i in 0.. {
196191
client0.synchronize_from_validators().boxed().await?;
197192
let balance = client0.local_balance().await?;

linera-core/benches/client_benchmarks.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use linera_core::{
1111
client,
1212
test_utils::{MemoryStorageBuilder, NodeProvider, StorageBuilder, TestBuilder},
1313
};
14-
use linera_execution::system::{Recipient, UserData};
14+
use linera_execution::system::Recipient;
1515
use linera_storage::{
1616
READ_CERTIFICATE_COUNTER, READ_HASHED_CERTIFICATE_VALUE_COUNTER, WRITE_CERTIFICATE_COUNTER,
1717
WRITE_HASHED_CERTIFICATE_VALUE_COUNTER,
@@ -63,7 +63,7 @@ where
6363

6464
let account = Account::owner(chain2.chain_id(), owner1);
6565
let cert = chain1
66-
.transfer_to_account(None, amt, account, UserData(None))
66+
.transfer_to_account(None, amt, account)
6767
.await
6868
.unwrap()
6969
.unwrap();
@@ -80,7 +80,7 @@ where
8080

8181
let account = Recipient::chain(chain1.chain_id());
8282
let cert = chain1
83-
.claim(owner1, chain2.chain_id(), account, amt, UserData(None))
83+
.claim(owner1, chain2.chain_id(), account, amt)
8484
.await
8585
.unwrap()
8686
.unwrap();

linera-core/src/client/mod.rs

+8-17
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ use linera_chain::{
4848
use linera_execution::{
4949
committee::{Committee, Epoch, ValidatorName},
5050
system::{
51-
AdminOperation, OpenChainConfig, Recipient, SystemChannel, SystemOperation, UserData,
51+
AdminOperation, OpenChainConfig, Recipient, SystemChannel, SystemOperation,
5252
CREATE_APPLICATION_MESSAGE_INDEX, OPEN_CHAIN_MESSAGE_INDEX,
5353
},
5454
ExecutionError, Message, Operation, Query, Response, SystemExecutionError, SystemMessage,
@@ -1287,20 +1287,18 @@ where
12871287
}
12881288

12891289
/// Sends money.
1290-
#[tracing::instrument(level = "trace", skip(user_data))]
1290+
#[tracing::instrument(level = "trace")]
12911291
pub async fn transfer(
12921292
&self,
12931293
owner: Option<Owner>,
12941294
amount: Amount,
12951295
recipient: Recipient,
1296-
user_data: UserData,
12971296
) -> Result<ClientOutcome<Certificate>, ChainClientError> {
12981297
// TODO(#467): check the balance of `owner` before signing any block proposal.
12991298
self.execute_operation(Operation::System(SystemOperation::Transfer {
13001299
owner,
13011300
recipient,
13021301
amount,
1303-
user_data,
13041302
}))
13051303
.await
13061304
}
@@ -1321,21 +1319,19 @@ where
13211319
}
13221320

13231321
/// Claims money in a remote chain.
1324-
#[tracing::instrument(level = "trace", skip(user_data))]
1322+
#[tracing::instrument(level = "trace")]
13251323
pub async fn claim(
13261324
&self,
13271325
owner: Owner,
13281326
target_id: ChainId,
13291327
recipient: Recipient,
13301328
amount: Amount,
1331-
user_data: UserData,
13321329
) -> Result<ClientOutcome<Certificate>, ChainClientError> {
13331330
self.execute_operation(Operation::System(SystemOperation::Claim {
13341331
owner,
13351332
target_id,
13361333
recipient,
13371334
amount,
1338-
user_data,
13391335
}))
13401336
.await
13411337
}
@@ -2140,28 +2136,25 @@ where
21402136
}
21412137

21422138
/// Sends tokens to a chain.
2143-
#[tracing::instrument(level = "trace", skip(user_data))]
2139+
#[tracing::instrument(level = "trace")]
21442140
pub async fn transfer_to_account(
21452141
&self,
21462142
owner: Option<Owner>,
21472143
amount: Amount,
21482144
account: Account,
2149-
user_data: UserData,
21502145
) -> Result<ClientOutcome<Certificate>, ChainClientError> {
2151-
self.transfer(owner, amount, Recipient::Account(account), user_data)
2146+
self.transfer(owner, amount, Recipient::Account(account))
21522147
.await
21532148
}
21542149

21552150
/// Burns tokens.
2156-
#[tracing::instrument(level = "trace", skip(user_data))]
2151+
#[tracing::instrument(level = "trace")]
21572152
pub async fn burn(
21582153
&self,
21592154
owner: Option<Owner>,
21602155
amount: Amount,
2161-
user_data: UserData,
21622156
) -> Result<ClientOutcome<Certificate>, ChainClientError> {
2163-
self.transfer(owner, amount, Recipient::Burn, user_data)
2164-
.await
2157+
self.transfer(owner, amount, Recipient::Burn).await
21652158
}
21662159

21672160
/// Attempts to synchronize chains that have sent us messages and populate our local
@@ -2722,19 +2715,17 @@ where
27222715
/// Sends money to a chain.
27232716
/// Do not check balance. (This may block the client)
27242717
/// Do not confirm the transaction.
2725-
#[tracing::instrument(level = "trace", skip(user_data))]
2718+
#[tracing::instrument(level = "trace")]
27262719
pub async fn transfer_to_account_unsafe_unconfirmed(
27272720
&self,
27282721
owner: Option<Owner>,
27292722
amount: Amount,
27302723
account: Account,
2731-
user_data: UserData,
27322724
) -> Result<ClientOutcome<Certificate>, ChainClientError> {
27332725
self.execute_operation(Operation::System(SystemOperation::Transfer {
27342726
owner,
27352727
recipient: Recipient::Account(account),
27362728
amount,
2737-
user_data,
27382729
}))
27392730
.await
27402731
}

0 commit comments

Comments
 (0)