Skip to content

Commit 5357c58

Browse files
authored
Merge branch 'main' into feat/vote-proof
2 parents 2a52a0c + 54d5275 commit 5357c58

File tree

57 files changed

+1546
-1479
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1546
-1479
lines changed

Earthfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
VERSION 0.8
22

3-
IMPORT github.com/input-output-hk/catalyst-ci/earthly/mdlint:v3.2.13 AS mdlint-ci
4-
IMPORT github.com/input-output-hk/catalyst-ci/earthly/cspell:v3.2.13 AS cspell-ci
3+
IMPORT github.com/input-output-hk/catalyst-ci/earthly/mdlint:v3.2.15 AS mdlint-ci
4+
IMPORT github.com/input-output-hk/catalyst-ci/earthly/cspell:v3.2.15 AS cspell-ci
55

66
FROM debian:stable-slim
77

docs/Earthfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
VERSION 0.8
22

3-
IMPORT github.com/input-output-hk/catalyst-ci/earthly/docs:v3.2.13 AS docs-ci
3+
IMPORT github.com/input-output-hk/catalyst-ci/earthly/docs:v3.2.15 AS docs-ci
44

55
IMPORT .. AS repo
66

Lines changed: 39 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,64 @@
11
; This c509 Certificate format is based upon:
2-
; https://datatracker.ietf.org/doc/draft-ietf-cose-cbor-encoded-cert/09/
2+
; https://datatracker.ietf.org/doc/draft-ietf-cose-cbor-encoded-cert/11/
33
; And is restricted/customized to better enable compatibility with Plutus scripts
4-
; that would consume them, without loosing necessary features of x509
4+
; that would consume them, without losing necessary features of x509
55
; Not all x509 features are supported and some fields have different semantics to improve
66
; certificate size and ability to be processed by Plutus Scripts.
77

8-
; cspell: words reencoded, biguint
8+
; cspell: words reencoded, biguint, stake1uyehkck0lajq8gr28t9uxnuvgcqrc6070x3k9r8048z8y5gh6ffgw
99

10-
C509CertificatePlutusRestrictedSubset = [ TBSCertificate, issuerSignatureValue: ed25519Signature, ]
10+
C509CertificatePlutusRestrictedSubset = [
11+
TBSCertificate,
12+
issuerSignatureValue: ed25519Signature
13+
]
1114

1215
; The elements of the following group are used in a CBOR Sequence:
1316
TBSCertificate = (
14-
c509CertificateType: &c509CertificateTypeValues, ; Always 0
15-
certificateSerialNumber: CertificateSerialNumber, ; Can be ignored/set to 0 or used as intended.
16-
issuer: Name, ; This could be an on-chain reference to the issuer cert, what would be the best way? Transaction hash/cert hash?
17-
validityNotBefore: Time, ; c509 uses UTC
18-
validityNotAfter: Time, ; c509 uses UTC
19-
subject: Name, ; Reference to on-chain keys related to this certificate
20-
subjectPublicKeyAlgorithm: AlgorithmIdentifier, ; Must be int(12) = Ed25519
21-
subjectPublicKey: subjectPublicKey, ; Ed25519 public key
22-
extensions: Extensions, ; No extensions are currently supported must be set to []
23-
issuerSignatureAlgorithm: AlgorithmIdentifier, ; Must be int(12) = Ed25519
17+
c509CertificateType: int, ; Always 2 as a natively signed
18+
certificateSerialNumber: CertificateSerialNumber, ; Can be ignored/set to 0 or used as intended.
19+
issuerSignatureAlgorithm: AlgorithmIdentifier, ; Must be int(12) = Ed25519
20+
issuer: Name / null, ; If the 'issuer' field is identical to the 'subject' field (in case of self-signed), then it must be encoded as CBOR null
21+
; This could be an on-chain reference to the issuer cert. What would be the best way? Transaction hash/cert hash?
22+
validityNotBefore: ~time, ; c509 uses UTC
23+
validityNotAfter: ~time / null, ; c509 uses UTC, no expiration date must be set to null
24+
subject: Name, ; Reference to on-chain keys related to this certificate
25+
subjectPublicKeyAlgorithm: AlgorithmIdentifier, ; Must be int(12) = Ed25519
26+
subjectPublicKey: subjectPublicKey, ; Ed25519 public key
27+
extensions: Extensions ; Set to [] if no Extensions provided
2428
)
2529

26-
; 0 = Native CBOR Certificate type
27-
; 1 = reencoded-der-cert - Not supported in this restricted version of the format.
28-
c509CertificateTypeValues = ( native-cbor: 0,
29-
; reencoded-der: 1 ; Not supported in this restricted encoding format
30-
)
31-
32-
CertificateSerialNumber = biguint
33-
34-
Name = [ * RelativeDistinguishedName ]
35-
/ text
36-
/ bytes
37-
38-
RelativeDistinguishedName = Attribute / [ 2* Attribute ]
30+
CertificateSerialNumber = ~biguint
3931

40-
Attribute = (
41-
( attributeType: int, attributeValue: text )
42-
// ( attributeType: oid, attributeValue: bytes )
43-
// ( attributeType: pen, attributeValue: bytes )
44-
// CardanoPublicKey
45-
)
46-
47-
subjectPublicKey = bytes .size (32..32); Ed25519 public key stored in bytes, adjust size of this if other key types are supported.
32+
; Currently ONLY AlgorithmIdentifier int(12) - Ed25519 is supported.
33+
; oid and [ algorithm: oid, parameters: bytes ] are not supported by Plutus.
34+
AlgorithmIdentifier = int / ~oid / [ algorithm: ~oid, parameters: bytes ]
4835

49-
; This is a completely custom Attribute for the RelativeDistinguishedName which is only for use with Plutus scripts.
50-
; attributeType = The type of Cardano key we associate with this certificate.
51-
; proof = Does the transaction require proof that the key is owned by the transaction signer?
52-
; attributeValue = The Cardano public key hash of the attribute type
36+
Name = [ * Attribute ] / text / bytes
5337

54-
CardanoPublicKey = ( attributeType: &cardanoKeyTypes proof: bool, attributeValue: bytes .size (28..28) )
38+
Attribute = ( attributeType: int, attributeValue: text )
39+
// ( attributeType: ~oid, attributeValue: bytes )
5540

56-
cardanoKeyTypes = (
57-
paymentKeyHash: 0,
58-
stakeKeyHash: 1,
59-
drepVerificationKeyHash: 2,
60-
ccColdVerificationKeyHash: 3,
61-
ccHotVerificationKeyHash: 4,
62-
)
41+
subjectPublicKey = bytes .size (32..32) ; Ed25519 public key stored in bytes, adjust size if other key types are supported.
6342

64-
; Plutus will need to convert the Unix epoch timestamp to the nearest slot number
43+
; For ~time, Plutus will need to convert the Unix epoch timestamp to the nearest slot number
6544
; validityNotBefore rounds up to the next Slot after that time.
6645
; validityNotAfter rounds down to the next Slot before that time.
67-
Time = ( ~time / null )
68-
69-
ed25519Signature = bstr .size 64; Ed25519 signature must be tagged to identify their type.
7046

47+
ed25519Signature = bstr .size 64 ; Ed25519 signature must be tagged to identify their type.
7148

72-
; Currently ONLY AlgorithmIdentifier int(12) - Ed25519 is supported.
73-
; oid and [ algorithm: oid, parameters: bytes ] are not supported by Plutus.
74-
AlgorithmIdentifier = (int
75-
/ ~oid
76-
/ [ algorithm: ~oid, parameters: bytes ])
49+
; The only Extension supported is int(3) = SubjectAltName where GeneralNames need to be
50+
; int(6) = uniformResourceIdentifier.
51+
; This uniformResourceIdentifier must conform to the URI based line in CIP-0134:
52+
; https://github.com/input-output-hk/catalyst-CIPs/tree/cip13-simple-cardano-address-extension/CIP-0134
53+
; for example, web+cardano://addr/stake1uyehkck0lajq8gr28t9uxnuvgcqrc6070x3k9r8048z8y5gh6ffgw
7754

78-
; Extensions are not currently supported by plutus and should be set to []
79-
; Any extensions present in the certificate will be ignored by plutus scripts.
8055
Extensions = [ * Extension ] / int
8156

8257
Extension = (
83-
( extensionID: int, extensionValue: any )
84-
// ( extensionID: ~oid, ? critical: true, extensionValue: bytes )
85-
// ( extensionID: pen, ? critical: true, extensionValue: bytes )
58+
( extensionID: int, extensionValue: any )
59+
// ( extensionID: ~oid, ? critical: true, extensionValue: bytes )
8660
)
61+
62+
SubjectAltName = GeneralNames / text
63+
GeneralNames = [ + GeneralName ]
64+
GeneralName = ( GeneralNameType: int, GeneralNameValue: any )
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "overhead_benchmark"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
edition.workspace = true
55

66
[lints]
@@ -9,8 +9,8 @@ workspace = true
99
[dependencies]
1010
cardano-chain-follower = { path = "../.." }
1111

12-
anyhow = "1.0.82"
13-
clap = { version = "4.5.4", features = ["derive", "help", "usage", "std"], default-features = false }
14-
pallas-traverse = "0.30.1"
15-
pallas-hardano = "0.30.1"
16-
tokio = { version = "1.37.0", features = ["macros", "sync", "rt-multi-thread", "rt", "net"] }
12+
anyhow = "1.0.89"
13+
clap = { version = "4.5.19", features = ["derive", "help", "usage", "std"], default-features = false }
14+
pallas-traverse = "0.30.2"
15+
pallas-hardano = "0.30.2"
16+
tokio = { version = "1.40.0", features = ["macros", "sync", "rt-multi-thread", "rt", "net"] }

rust/Earthfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
VERSION 0.8
22

3-
IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:v3.2.13 AS rust-ci
3+
IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:v3.2.15 AS rust-ci
44

55
COPY_SRC:
66
FUNCTION
@@ -15,15 +15,16 @@ COPY_SRC:
1515
hermes-ipfs \
1616
.
1717

18+
# builder : Set up our target toolchains, and copy our files.
19+
builder:
20+
DO rust-ci+SETUP
21+
1822
# sync-cfg: Synchronize local config with CI version.
1923
# Must be run by the developer manually.
2024
sync-cfg:
25+
FROM +builder
2126
DO rust-ci+SYNC_STD_CFG
2227

23-
# builder : Set up our target toolchains, and copy our files.
24-
builder:
25-
DO rust-ci+SETUP
26-
2728
builder-src:
2829
FROM +builder
2930

rust/Justfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ code-format:
2626

2727
# Lint the rust code
2828
code-lint:
29-
cargo lintfix
30-
cargo lint
29+
cargo lintfix -r
30+
cargo lint -r
3131

3232
# Pre Push Checks
3333
pre-push: sync-cfg code-format code-lint license-check

rust/c509-certificate/Cargo.toml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "c509-certificate"
33
description = "C509 certificate implementation"
44
keywords = ["cardano", "catalyst", "c509 certificate", "certificate", "x509"]
5-
version = "0.0.2"
5+
version = "0.0.3"
66
authors = [
77
"Arissara Chotivichit <[email protected]>"
88
]
@@ -21,26 +21,26 @@ workspace = true
2121
minicbor = { version = "0.25.1", features = ["std"] }
2222
hex = "0.4.3"
2323
oid = "0.2.1"
24-
oid-registry = "0.7.0"
25-
asn1-rs = "0.6.0"
26-
anyhow = "1.0.86"
24+
oid-registry = "0.7.1"
25+
asn1-rs = "0.6.2"
26+
anyhow = "1.0.89"
2727
bimap = "0.6.3"
28-
once_cell = "1.19.0"
28+
once_cell = "1.20.2"
2929
strum = "0.26.3"
30-
strum_macros = "0.26.3"
31-
regex = "1.10.5"
30+
strum_macros = "0.26.4"
31+
regex = "1.11.0"
3232
ed25519-dalek = { version = "2.1.1", features = ["pem"] }
33-
thiserror = "1.0.56"
34-
serde = { version = "1.0.204", features = ["derive"] }
35-
wasm-bindgen = "0.2.92"
33+
thiserror = "1.0.64"
34+
serde = { version = "1.0.210", features = ["derive"] }
35+
wasm-bindgen = "0.2.93"
3636
serde-wasm-bindgen = "0.6.5"
3737

3838
[package.metadata.cargo-machete]
3939
ignored = ["strum"]
4040

4141
[dev-dependencies]
42-
clap = { version = "4.5.9", features = ["derive"] }
43-
serde_json = "1.0.120"
42+
clap = { version = "4.5.19", features = ["derive"] }
43+
serde_json = "1.0.128"
4444
rand = "0.8.5"
4545
chrono = "0.4.38"
4646

rust/c509-certificate/Earthfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
VERSION 0.8
22

3-
IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust::v3.2.13 AS rust-ci
3+
IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust::v3.2.15 AS rust-ci
44

55
IMPORT .. AS rust-local
66
IMPORT ../.. AS repo

rust/c509-certificate/examples/cli/data/cert_sample_1.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"self_signed": true,
3-
"c509_certificate_type": 0,
3+
"c509_certificate_type": 2,
44
"certificate_serial_number": 128269,
5+
"issuer_signature_algorithm": null,
56
"issuer": [
67
{
78
"oid": "2.5.4.3",
@@ -24,6 +25,5 @@
2425
"value": { "int": 1 },
2526
"critical": false
2627
}
27-
],
28-
"issuer_signature_algorithm": null
28+
]
2929
}

0 commit comments

Comments
 (0)