Skip to content

Commit f27d364

Browse files
committed
/Certificate/{hash} route returns a beacon instead of a block
1 parent 6d594b5 commit f27d364

File tree

5 files changed

+13
-17
lines changed

5 files changed

+13
-17
lines changed

mithril-aggregator/src/http_server.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ mod handlers {
202202
let digest = message.clone();
203203
let certificate_hash = message;
204204
let previous_hash = "".to_string();
205-
let block = beacon.immutable_file_number;
206205
let timestamp: DateTime<Utc> = Utc::now();
207206
let started_at = format!("{:?}", timestamp);
208207
let completed_at = started_at.clone();
@@ -228,7 +227,7 @@ mod handlers {
228227
let certificate = entities::Certificate::new(
229228
certificate_hash,
230229
previous_hash,
231-
block,
230+
beacon,
232231
protocol_parameters,
233232
digest,
234233
started_at,

mithril-common/src/entities.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ pub struct Certificate {
8080
#[serde(rename = "previous_hash")]
8181
pub previous_hash: String,
8282

83-
/// Cardano chain block number
84-
#[serde(rename = "block")]
85-
pub block: u64,
83+
/// Cardano chain beacon
84+
#[serde(rename = "beacon")]
85+
pub beacon: Beacon,
8686

8787
/// Protocol parameters
8888
#[serde(rename = "protocol")]
@@ -115,7 +115,7 @@ impl Certificate {
115115
pub fn new(
116116
hash: String,
117117
previous_hash: String,
118-
block: u64,
118+
beacon: Beacon,
119119
protocol_parameters: ProtocolParameters,
120120
digest: String,
121121
started_at: String,
@@ -126,7 +126,7 @@ impl Certificate {
126126
Certificate {
127127
hash,
128128
previous_hash,
129-
block,
129+
beacon,
130130
protocol_parameters,
131131
digest,
132132
started_at,

mithril-common/src/fake_data.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,14 @@ pub fn certificate(certificate_hash: String) -> entities::Certificate {
6666

6767
// Certificate
6868
let previous_hash = format!("{}0", certificate_hash);
69-
let block = beacon.immutable_file_number;
70-
let digest = format!("1{}", block).repeat(20);
69+
let digest = format!("1{}", beacon.immutable_file_number).repeat(20);
7170
let started_at = "2006-01-02T15:04:05Z".to_string();
7271
let completed_at = "2006-01-02T15:04:05Z".to_string();
73-
let multisignature = format!("ABC{}", block).repeat(200);
72+
let multisignature = format!("ABC{}", beacon.immutable_file_number).repeat(200);
7473
entities::Certificate::new(
7574
certificate_hash,
7675
previous_hash,
77-
block,
76+
beacon,
7877
protocol_parameters,
7978
digest,
8079
started_at,

mithril-test-lab/mithril-end-to-end/src/Mithril/Aggregator.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ data SignerWithStake = SignerWithStake
3333
data Certificate = Certificate
3434
{ hash :: Text,
3535
previous_hash :: Text,
36-
block :: Word64,
36+
beacon :: Beacon,
3737
protocol :: ProtocolParameters,
3838
digest :: Text,
3939
started_at :: UTCTime,

openapi.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ components:
318318
required:
319319
- hash
320320
- previous_hash
321-
- block
321+
- beacon
322322
- protocol
323323
- digest
324324
- started_at
@@ -334,10 +334,8 @@ components:
334334
description: Hash of the previous certificate
335335
type: string
336336
format: bytes
337-
block:
338-
description: Cardano chain block number
339-
type: integer
340-
format: int64
337+
beacon:
338+
$ref: "#/components/schemas/Beacon"
341339
protocol:
342340
description: Protocol parameters
343341
$ref: "#/components/schemas/ProtocolParameters"

0 commit comments

Comments
 (0)