Skip to content

Commit 1928a0a

Browse files
authored
Add warmup iterations and time-to-message-notification. (#2526)
* Add warmup iterations and time-to-message-notification. * Add more checks to test_end_to_end_repeated_transfers. * Update the linera-service GraphQL schema.
1 parent b986e7d commit 1928a0a

File tree

7 files changed

+313
-54
lines changed

7 files changed

+313
-54
lines changed

linera-chain/src/data_types.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ pub struct Target {
210210
}
211211

212212
/// A set of messages from a single block, for a single destination.
213-
#[derive(Debug, Eq, PartialEq, Clone, Hash, Serialize, Deserialize)]
213+
#[derive(Debug, Eq, PartialEq, Clone, Hash, Serialize, Deserialize, SimpleObject)]
214214
pub struct MessageBundle {
215215
/// The block height.
216216
pub height: BlockHeight,
@@ -1305,15 +1305,11 @@ impl BcsHashable for CertificateValue {}
13051305

13061306
doc_scalar!(
13071307
MessageAction,
1308-
"Whether an incoming message is accepted or rejected"
1308+
"Whether an incoming message is accepted or rejected."
13091309
);
13101310
doc_scalar!(
13111311
ChannelFullName,
1312-
"A channel name together with its application ID"
1313-
);
1314-
doc_scalar!(
1315-
MessageBundle,
1316-
"A set of messages from a single block, for a single destination."
1312+
"A channel name together with its application ID."
13171313
);
13181314
doc_scalar!(
13191315
Medium,

linera-explorer/src/components/Block.test.ts

+9-5
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,16 @@ test('Block mounting', () => {
2323
sender: "e476187f6ddfeb9d588c7b45d3df334d5501d6499b3f9ad5595cae86cce16a65"
2424
},
2525
bundle: {
26-
certificate_hash: "f1c748c5e39591125250e85d57fdeac0b7ba44a32c12c616eb4537f93b6e5d0a",
26+
certificateHash: "f1c748c5e39591125250e85d57fdeac0b7ba44a32c12c616eb4537f93b6e5d0a",
2727
height: 5,
2828
messages: [{
29-
authenticated_signer: null,
30-
message: { System: { BytecodePublished: { operation_index: 0 } } }
29+
authenticatedSigner: null,
30+
message: { System: { BytecodePublished: { operation_index: 0 } } },
31+
grant: "0.01",
32+
index: 4,
33+
kind: "Tracked"
3134
}],
35+
transactionIndex: 0,
3236
timestamp: 1694097510206912
3337
},
3438
action: "Accept",
@@ -47,10 +51,10 @@ test('Block mounting', () => {
4751
locations: [
4852
[
4953
"e476187f6ddfeb9d588c7b45d3df334d5501d6499b3f9ad5595cae86cce16a65020000000000000000000000",
50-
{ certificate_hash: "a4167c67ce9c94c301fd5cbbefeccf6c8e56d568a4c75ed85e93bfacee66bac5", operation_index: 0 }],
54+
{ certificateHash: "a4167c67ce9c94c301fd5cbbefeccf6c8e56d568a4c75ed85e93bfacee66bac5", operation_index: 0 }],
5155
[
5256
"e476187f6ddfeb9d588c7b45d3df334d5501d6499b3f9ad5595cae86cce16a65050000000000000000000000",
53-
{ certificate_hash: "f1c748c5e39591125250e85d57fdeac0b7ba44a32c12c616eb4537f93b6e5d0a", operation_index: 0 }]]
57+
{ certificateHash: "f1c748c5e39591125250e85d57fdeac0b7ba44a32c12c616eb4537f93b6e5d0a", operation_index: 0 }]]
5458
}
5559
}
5660
}

linera-explorer/src/components/Blocks.test.ts

+9-5
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,16 @@ test('Blocks mounting', () => {
2525
sender: "e476187f6ddfeb9d588c7b45d3df334d5501d6499b3f9ad5595cae86cce16a65"
2626
},
2727
bundle: {
28-
certificate_hash: "f1c748c5e39591125250e85d57fdeac0b7ba44a32c12c616eb4537f93b6e5d0a",
28+
certificateHash: "f1c748c5e39591125250e85d57fdeac0b7ba44a32c12c616eb4537f93b6e5d0a",
2929
height: 5,
3030
messages: [{
31-
authenticated_signer: null,
32-
message: { System: { BytecodePublished: { operation_index: 0 } } }
31+
authenticatedSigner: null,
32+
message: { System: { BytecodePublished: { operation_index: 0 } } },
33+
grant: "0.01",
34+
index: 4,
35+
kind: "Tracked"
3336
}],
37+
transactionIndex: 0,
3438
timestamp: 1694097510206912
3539
},
3640
action: "Accept",
@@ -49,10 +53,10 @@ test('Blocks mounting', () => {
4953
locations: [
5054
[
5155
"e476187f6ddfeb9d588c7b45d3df334d5501d6499b3f9ad5595cae86cce16a65020000000000000000000000",
52-
{ certificate_hash: "a4167c67ce9c94c301fd5cbbefeccf6c8e56d568a4c75ed85e93bfacee66bac5", operation_index: 0 }],
56+
{ certificateHash: "a4167c67ce9c94c301fd5cbbefeccf6c8e56d568a4c75ed85e93bfacee66bac5", operation_index: 0 }],
5357
[
5458
"e476187f6ddfeb9d588c7b45d3df334d5501d6499b3f9ad5595cae86cce16a65050000000000000000000000",
55-
{ certificate_hash: "f1c748c5e39591125250e85d57fdeac0b7ba44a32c12c616eb4537f93b6e5d0a", operation_index: 0 }]]
59+
{ certificateHash: "f1c748c5e39591125250e85d57fdeac0b7ba44a32c12c616eb4537f93b6e5d0a", operation_index: 0 }]]
5660
}
5761
}
5862
}

linera-service-graphql-client/gql/service_requests.graphql

+88-6
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,36 @@ query ChainInbox($chainId: ChainId!, $origin: Origin!) {
5252
index
5353
}
5454
addedBundles {
55-
entries
55+
entries {
56+
height
57+
timestamp
58+
certificateHash
59+
transactionIndex
60+
messages {
61+
authenticatedSigner
62+
grant
63+
refundGrantTo
64+
kind
65+
index
66+
message
67+
}
68+
}
5669
}
5770
removedBundles {
58-
entries
71+
entries {
72+
height
73+
timestamp
74+
certificateHash
75+
transactionIndex
76+
messages {
77+
authenticatedSigner
78+
grant
79+
refundGrantTo
80+
kind
81+
index
82+
message
83+
}
84+
}
5985
}
6086
}
6187
}
@@ -113,8 +139,38 @@ query Chain(
113139
height
114140
index
115141
}
116-
addedBundles { entries }
117-
removedBundles { entries }
142+
addedBundles {
143+
entries {
144+
height
145+
timestamp
146+
certificateHash
147+
transactionIndex
148+
messages {
149+
authenticatedSigner
150+
grant
151+
refundGrantTo
152+
kind
153+
index
154+
message
155+
}
156+
}
157+
}
158+
removedBundles {
159+
entries {
160+
height
161+
timestamp
162+
certificateHash
163+
transactionIndex
164+
messages {
165+
authenticatedSigner
166+
grant
167+
refundGrantTo
168+
kind
169+
index
170+
message
171+
}
172+
}
173+
}
118174
}
119175
}
120176
}
@@ -170,7 +226,20 @@ query Block($hash: CryptoHash, $chainId: ChainId!) {
170226
previousBlockHash
171227
incomingBundles {
172228
origin
173-
bundle
229+
bundle {
230+
height
231+
timestamp
232+
certificateHash
233+
transactionIndex
234+
messages {
235+
authenticatedSigner
236+
grant
237+
refundGrantTo
238+
kind
239+
index
240+
message
241+
}
242+
}
174243
action
175244
}
176245
operations
@@ -215,7 +284,20 @@ query Blocks($from: CryptoHash, $chainId: ChainId!, $limit: Int) {
215284
previousBlockHash
216285
incomingBundles {
217286
origin
218-
bundle
287+
bundle {
288+
height
289+
timestamp
290+
certificateHash
291+
transactionIndex
292+
messages {
293+
authenticatedSigner
294+
grant
295+
refundGrantTo
296+
kind
297+
index
298+
message
299+
}
300+
}
219301
action
220302
}
221303
operations

linera-service-graphql-client/gql/service_schema.graphql

+54-3
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ type Chains {
266266
}
267267

268268
"""
269-
A channel name together with its application ID
269+
A channel name together with its application ID.
270270
"""
271271
scalar ChannelFullName
272272

@@ -542,14 +542,35 @@ An message to be sent and possibly executed in the receiver's block.
542542
scalar Message
543543

544544
"""
545-
Whether an incoming message is accepted or rejected
545+
Whether an incoming message is accepted or rejected.
546546
"""
547547
scalar MessageAction
548548

549549
"""
550550
A set of messages from a single block, for a single destination.
551551
"""
552-
scalar MessageBundle
552+
type MessageBundle {
553+
"""
554+
The block height.
555+
"""
556+
height: BlockHeight!
557+
"""
558+
The block's timestamp.
559+
"""
560+
timestamp: Timestamp!
561+
"""
562+
The confirmed block certificate hash.
563+
"""
564+
certificateHash: CryptoHash!
565+
"""
566+
The index of the transaction in the block that is sending this bundle.
567+
"""
568+
transactionIndex: Int!
569+
"""
570+
The relevant messages.
571+
"""
572+
messages: [PostedMessage!]!
573+
}
553574

554575
"""
555576
The kind of outgoing message being sent
@@ -755,6 +776,36 @@ The owner of a chain. This is currently the hash of the owner's public key used
755776
"""
756777
scalar Owner
757778

779+
"""
780+
A message together with kind, authentication and grant information.
781+
"""
782+
type PostedMessage {
783+
"""
784+
The user authentication carried by the message, if any.
785+
"""
786+
authenticatedSigner: Owner
787+
"""
788+
A grant to pay for the message execution.
789+
"""
790+
grant: Amount!
791+
"""
792+
Where to send a refund for the unused part of the grant after execution, if any.
793+
"""
794+
refundGrantTo: Account
795+
"""
796+
The kind of message being sent.
797+
"""
798+
kind: MessageKind!
799+
"""
800+
The index of the message in the sending block.
801+
"""
802+
index: Int!
803+
"""
804+
The message itself.
805+
"""
806+
message: Message!
807+
}
808+
758809
"""
759810
A signature public key
760811
"""

linera-service-graphql-client/src/service.rs

+45-2
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ mod from {
133133
use linera_base::identifiers::StreamId;
134134
use linera_chain::data_types::{
135135
BlockExecutionOutcome, EventRecord, ExecutedBlock, HashedCertificateValue, IncomingBundle,
136-
OutgoingMessage,
136+
MessageBundle, OutgoingMessage, PostedMessage,
137137
};
138138

139139
use super::*;
@@ -147,12 +147,55 @@ mod from {
147147
} = val;
148148
IncomingBundle {
149149
origin,
150-
bundle,
150+
bundle: bundle.into(),
151151
action,
152152
}
153153
}
154154
}
155155

156+
impl From<block::BlockBlockValueExecutedBlockBlockIncomingBundlesBundle> for MessageBundle {
157+
fn from(val: block::BlockBlockValueExecutedBlockBlockIncomingBundlesBundle) -> Self {
158+
let block::BlockBlockValueExecutedBlockBlockIncomingBundlesBundle {
159+
height,
160+
timestamp,
161+
certificate_hash,
162+
transaction_index,
163+
messages,
164+
} = val;
165+
let messages = messages.into_iter().map(PostedMessage::from).collect();
166+
MessageBundle {
167+
height,
168+
timestamp,
169+
certificate_hash,
170+
transaction_index: transaction_index as u32,
171+
messages,
172+
}
173+
}
174+
}
175+
176+
impl From<block::BlockBlockValueExecutedBlockBlockIncomingBundlesBundleMessages> for PostedMessage {
177+
fn from(
178+
val: block::BlockBlockValueExecutedBlockBlockIncomingBundlesBundleMessages,
179+
) -> Self {
180+
let block::BlockBlockValueExecutedBlockBlockIncomingBundlesBundleMessages {
181+
authenticated_signer,
182+
grant,
183+
refund_grant_to,
184+
kind,
185+
index,
186+
message,
187+
} = val;
188+
PostedMessage {
189+
authenticated_signer,
190+
grant,
191+
refund_grant_to,
192+
kind,
193+
index: index as u32,
194+
message,
195+
}
196+
}
197+
}
198+
156199
impl From<block::BlockBlockValueExecutedBlockBlock> for linera_chain::data_types::Block {
157200
fn from(val: block::BlockBlockValueExecutedBlockBlock) -> Self {
158201
let block::BlockBlockValueExecutedBlockBlock {

0 commit comments

Comments
 (0)