Skip to content

Commit

Permalink
Upgrade polkadot-sdk to release-polkadot-v1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jasl committed Oct 26, 2023
1 parent a8f098b commit a0f814a
Show file tree
Hide file tree
Showing 39 changed files with 1,444 additions and 2,251 deletions.
968 changes: 440 additions & 528 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion crates/phala-mq/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ hex = { version = "0.4.3", default-features = false, features = ['alloc'] }
derive_more = { version = "0.99", default-features = false, features = ["display"] }
parity-scale-codec = { version = "3.3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"] }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0", default-features = false }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", default-features = false }
serde = { version = "1.0", default-features = false, features = ["derive"] }

spin = { version = "0.9", default-features = false, features = ["mutex", "use_ticket_mutex"], optional = true }
Expand Down
12 changes: 6 additions & 6 deletions crates/phala-node-rpc-ext/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ codec = { package = "parity-scale-codec", version = "3.3" }
scale-info = { version = "2.3", default-features = false }

# primitives
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0" }
sp-blockchain = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0" }
sp-api = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0" }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sp-blockchain = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sp-api = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }

# client dependencies
sc-client-api = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0" }
sc-rpc = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0" }
sc-client-api = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sc-rpc = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }

phala-mq = { path = "../../crates/phala-mq" }
phala-pallets = { path = "../../pallets/phala" }
Expand Down
28 changes: 14 additions & 14 deletions crates/phala-pallet-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ codec = { package = "parity-scale-codec", version = "3.0", default-features = fa
scale-info = { version = "2.0", default-features = false, features = ["derive", "serde", "decode"] }

# Substrate
sp-io = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0", default-features = false }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0", default-features = false }
sp-std = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0", default-features = false }
frame-support = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0", default-features = false }
frame-system = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0", default-features = false }
sp-io = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", default-features = false }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", default-features = false }
sp-std = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", default-features = false }
frame-support = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", default-features = false }
frame-system = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", default-features = false }

# Polkadot
xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0", default-features = false }
xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", default-features = false }

[dev-dependencies]
sp-io = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0" }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0" }
sp-std = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0" }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0" }
frame-support = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0" }
frame-system = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0" }
sp-io = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sp-std = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
frame-support = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
frame-system = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
# Polkadot
xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0" }
xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }

[features]
default = ["std"]
Expand Down
2 changes: 1 addition & 1 deletion crates/phala-serde-more/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"

[dependencies]
serde = { version = "1.0.130", default-features = false, features = ["derive", "alloc"] }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0", default-features = false }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", default-features = false }
scale = { package = "parity-scale-codec", version = "3.3", default-features = false }
hex = { version = "0.4.3", default-features = false, features = ["alloc"] }

Expand Down
10 changes: 5 additions & 5 deletions crates/phala-trie-storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ repository = "https://github.com/Phala-Network/phala-blockchain"
[dependencies]
parity-scale-codec = { version = "3.3", default-features = false }
scale-info = { version = "2.3", default-features = false, features = ["derive"] }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0", features = ["full_crypto"] }
sp-trie = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0" }
sp-state-machine = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0", default-features = false }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", features = ["full_crypto"] }
sp-trie = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sp-state-machine = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", default-features = false }

serde = { version = "1.0", default-features = false, features = ["derive", "alloc"], optional = true }
hash-db = "0.16.0"
Expand All @@ -21,8 +21,8 @@ im = { version = "15", features = ["serde"] }
log = "0.4"

[dev-dependencies]
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0" }
sp-application-crypto = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0", features = ["full_crypto"] }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sp-application-crypto = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", features = ["full_crypto"] }
hash256-std-hasher = { version = "0.15", default-features = false }
hex = "0.4"
serde_json = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion crates/phala-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ hex = { version = "0.4", default-features = false, features = ["alloc"] }
serde = { version = "1.0.101", default-features = false, optional = true }
codec = { package = "parity-scale-codec", version = "3.3", default-features = false, features = ["full"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"] }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.1.0", default-features = false }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", default-features = false }

phala-mq = { path = "../../crates/phala-mq", default-features = false }
prpc = { path = "../../crates/prpc", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion crates/sgx-attestation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ base64 = { version = "0.21", default-features = false, features = ["alloc"] }
scale = { package = "parity-scale-codec", version = "3.6.5", default-features = false, features = ["derive"] }

# Release version no-std has bug
webpki = { git = "https://github.com/rustls/webpki", version = "0.102.0-alpha.3", package = "rustls-webpki", default-features = false, features = ["alloc", "ring"] }
webpki = { git = "https://github.com/rustls/webpki", version = "=0.102.0-alpha.3", rev = "2ed9a4324f48c2c46ffdd7dc9d3eb315af25fce2", package = "rustls-webpki", default-features = false, features = ["alloc", "ring"] }

[dev-dependencies]
insta = "1"
Expand Down
8 changes: 4 additions & 4 deletions crates/sgx-attestation/sample/ias_attestation.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"raReport": "{\"id\":\"82934912299674180590716290258197145307\",\"timestamp\":\"2021-09-12T18:06:20.402478\",\"version\":4,\"epidPseudonym\":\"4TUztFNlJtNfyhtdnN3L4ZfOUkUNcw2coVyAYcxi6Q893o6a+lHgfxVYrlsCAaz2IdpD0QZKFbpjBVbPbhGCszGTg/FwliaPlJ0HMa60Cyx1/pd83YHFgOf02/z36QCdiSvlCnRxxE41sZQE8/WrLqv5hzlsLegOEw6X+r0XS2E=\",\"advisoryURL\":\"https://security-center.intel.com\",\"advisoryIDs\":[\"INTEL-SA-00334\"],\"isvEnclaveQuoteStatus\":\"SW_HARDENING_NEEDED\",\"isvEnclaveQuoteBody\":\"AgABABMMAAAMAAsAAAAAACA1iY73e440nuw+J3NzpJAAAAAAAAAAAAAAAAAAAAAAERICB/+ABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAHAAAAAAAAAFGEIvp2nS1VmCAVoOBBfGqFIf38cwj17BiqobaSS9DzAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACBX0LxHPZEMMMLq3gWullqHaATDDsCi2cxM6Zs+aPg5gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAxeNE8tR8hFZM3y+hkwT6i3/F91dSdoF2ztTwfD/I+jAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"}",
"rawSigningCert": "308204a130820309a003020102020900d107765d32a3b096300d06092a864886f70d01010b0500307e310b3009060355040613025553310b300906035504080c0243413114301206035504070c0b53616e746120436c617261311a3018060355040a0c11496e74656c20436f72706f726174696f6e3130302e06035504030c27496e74656c20534758204174746573746174696f6e205265706f7274205369676e696e67204341301e170d3136313132323039333635385a170d3236313132303039333635385a307b310b3009060355040613025553310b300906035504080c0243413114301206035504070c0b53616e746120436c617261311a3018060355040a0c11496e74656c20436f72706f726174696f6e312d302b06035504030c24496e74656c20534758204174746573746174696f6e205265706f7274205369676e696e6730820122300d06092a864886f70d01010105000382010f003082010a0282010100a97a2de0e66ea6147c9ee745ac0162686c7192099afc4b3f040fad6de093511d74e802f510d716038157dcaf84f4104bd3fed7e6b8f99c8817fd1ff5b9b864296c3d81fa8f1b729e02d21d72ffee4ced725efe74bea68fbc4d4244286fcdd4bf64406a439a15bcb4cf67754489c423972b4a80df5c2e7c5bc2dbaf2d42bb7b244f7c95bf92c75d3b33fc5410678a89589d1083da3acc459f2704cd99598c275e7c1878e00757e5bdb4e840226c11c0a17ff79c80b15c1ddb5af21cc2417061fbd2a2da819ed3b72b7efaa3bfebe2805c9b8ac19aa346512d484cfc81941e15f55881cc127e8f7aa12300cd5afb5742fa1d20cb467a5beb1c666cf76a368978b50203010001a381a43081a1301f0603551d2304183016801478437b76a67ebcd0af7e4237eb357c3b8701513c300e0603551d0f0101ff0404030206c0300c0603551d130101ff0402300030600603551d1f045930573055a053a051864f687474703a2f2f7472757374656473657276696365732e696e74656c2e636f6d2f636f6e74656e742f43524c2f5347582f4174746573746174696f6e5265706f72745369676e696e6743412e63726c300d06092a864886f70d01010b050003820181006708b61b5c2bd215473e2b46af99284fbb939d3f3b152c996f1a6af3b329bd220b1d3b610f6bce2e6753bded304db21912f385256216cfcba456bd96940be892f5690c260d1ef84f1606040222e5fe08e5326808212a447cfdd64a46e94bf29f6b4b9a721d25b3c4e2f62f58baed5d77c505248f0f801f9fbfb7fd752080095cee80938b339f6dbb4e165600e20e4a718812d49d9901e310a9b51d66c79909c6996599fae6d76a79ef145d9943bf1d3e35d3b42d1fb9a45cbe8ee334c166eee7d32fcdc9935db8ec8bb1d8eb3779dd8ab92b6e387f0147450f1e381d08581fb83df33b15e000a59be57ea94a3a52dc64bdaec959b3464c91e725bbdaea3d99e857e380a23c9d9fb1ef58e9e42d71f12130f9261d7234d6c37e2b03dba40dfdfb13ac4ad8e13fd3756356b6b50015a3ec9580b815d87c2cef715cd28df00bbf2a3c403ebf6691b3f05edd9143803ca085cff57e053eec2f8fea46ea778a68c9be885bc28225bc5f309be4a2b74d3a03945319dd3c7122fed6ff53bb8b8cb3a03c",
"signature": "04120fa93e9974d873967028afb395ec06aef00dab2a49be42cccd2d59a9ec05ac7528e070790e4b66c12811a1fd8720ae476ab370ab996899e76905488383ce433a359373c463f6b2cf596ccbe2eeace123209f951ff3dfb57e07eddc6e1a66197f4d578144e51e85c2602b86efd3ced231040a6151e936d106b7f3199b37adde5c69215e11c345fd051ec70268c5da6c4ee724b22bfd8279546be38bc5d8b2e805ff6db0798f7fa9ef4e9c6742260e35c9cdbfa4a6e4ec100a7cfa4b30031808d1a52e151391ba10887a4c82c23dcda35224e90ba5ab06e8c487dec35bd6ae8c89623ea36dd4609f4a6ec6f4c1399ce67e053e5b50efa2d6e1c027215dcf0b"
}
"raReport": "{\"id\":\"272094254367129475820129751491483103595\",\"timestamp\":\"2023-10-18T09:01:15.022794\",\"version\":4,\"epidPseudonym\":\"TnbOji9riBrkhR429r3k19eolZQTpS8ZDKlZUEUieqci/sAdv871SfO4S4fcXMh6doegnYsPrZ87aOi4pEL1BtdRgo/OUU5eohWv2yExfVYwvJ0gOWQvZ+ZqvewbpXPds0OSs9kP9WUHyWXgNtRF4Fqqy1lnLMMInlJuGJt/CkA=\",\"advisoryURL\":\"https://security-center.intel.com\",\"advisoryIDs\":[\"INTEL-SA-00220\",\"INTEL-SA-00270\",\"INTEL-SA-00293\",\"INTEL-SA-00320\",\"INTEL-SA-00329\",\"INTEL-SA-00334\",\"INTEL-SA-00381\",\"INTEL-SA-00389\",\"INTEL-SA-00477\",\"INTEL-SA-00614\",\"INTEL-SA-00615\",\"INTEL-SA-00617\",\"INTEL-SA-00828\"],\"isvEnclaveQuoteStatus\":\"GROUP_OUT_OF_DATE\",\"platformInfoBlob\":\"1502006504000100001515020401800E0000000000000000000D00000C000000020000000000000B56FCF7763A87703529571B936A90ACB8773E3183802427094CFB472200439F39008491D6439EC3F8797CA205DAC7958314A44BFBDD51DE5B0656590F39F7629187\",\"isvEnclaveQuoteBody\":\"AgABAFYLAAANAA0AAAAAAEDTN+Go/mqYQBu9Z6iQUBUAAAAAAAAAAAAAAAAAAAAAAhUCBP+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAHAAAAAAAAABCCloGAHL79W3V3nQgg2G0KYNgerRTbeTWV7b4Oh7mGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACD1xnnferKFHD2uvYqTXdDA8iZ22kCD5xw7h38CMfOngAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIZWxsbyBXb3JsZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"}",
"signature": "Wg5G5d/Hw13nZhjxtdlq7WmSoHIYposzlp0+Oywag3NDQG2W2zTq17uaU/driT9PaPnVEaYz808/IJEoOipsZniNAFd6jYSQ5tnYMLB7ot+y2LcNsGS7Kw5xgeumt+KCccaZvPsjMVk/hqfKlCoYLL2AzOB+JSQe6JLNqVMeOjNu0SqY0SWV+rc6eQgCHdcnwsSpQqUfcbk1mS3y5iV87qFNgtwNFaqMwhKpFMRI3JpjTgrPAlZB1lzhTy7z+mA620aGBd6mK0GkePeW7g9X8hRpEDNaPfU9D9mlyfRTjzRBSwPQC3ENdrvGPQYGhDyk9ciMxSbcKaA0sq94MyqDOQ==",
"rawSigningCert": "MIIEoTCCAwmgAwIBAgIJANEHdl0yo7CWMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTEUMBIGA1UEBwwLU2FudGEgQ2xhcmExGjAYBgNVBAoMEUludGVsIENvcnBvcmF0aW9uMTAwLgYDVQQDDCdJbnRlbCBTR1ggQXR0ZXN0YXRpb24gUmVwb3J0IFNpZ25pbmcgQ0EwHhcNMTYxMTIyMDkzNjU4WhcNMjYxMTIwMDkzNjU4WjB7MQswCQYDVQQGEwJVUzELMAkGA1UECAwCQ0ExFDASBgNVBAcMC1NhbnRhIENsYXJhMRowGAYDVQQKDBFJbnRlbCBDb3Jwb3JhdGlvbjEtMCsGA1UEAwwkSW50ZWwgU0dYIEF0dGVzdGF0aW9uIFJlcG9ydCBTaWduaW5nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqXot4OZuphR8nudFrAFiaGxxkgma/Es/BA+tbeCTUR106AL1ENcWA4FX3K+E9BBL0/7X5rj5nIgX/R/1ubhkKWw9gfqPG3KeAtIdcv/uTO1yXv50vqaPvE1CRChvzdS/ZEBqQ5oVvLTPZ3VEicQjlytKgN9cLnxbwtuvLUK7eyRPfJW/ksddOzP8VBBniolYnRCD2jrMRZ8nBM2ZWYwnXnwYeOAHV+W9tOhAImwRwKF/95yAsVwd21ryHMJBcGH70qLagZ7Ttyt++qO/6+KAXJuKwZqjRlEtSEz8gZQeFfVYgcwSfo96oSMAzVr7V0L6HSDLRnpb6xxmbPdqNol4tQIDAQABo4GkMIGhMB8GA1UdIwQYMBaAFHhDe3amfrzQr35CN+s1fDuHAVE8MA4GA1UdDwEB/wQEAwIGwDAMBgNVHRMBAf8EAjAAMGAGA1UdHwRZMFcwVaBToFGGT2h0dHA6Ly90cnVzdGVkc2VydmljZXMuaW50ZWwuY29tL2NvbnRlbnQvQ1JML1NHWC9BdHRlc3RhdGlvblJlcG9ydFNpZ25pbmdDQS5jcmwwDQYJKoZIhvcNAQELBQADggGBAGcIthtcK9IVRz4rRq+ZKE+7k50/OxUsmW8aavOzKb0iCx07YQ9rzi5nU73tME2yGRLzhSViFs/LpFa9lpQL6JL1aQwmDR74TxYGBAIi5f4I5TJoCCEqRHz91kpG6Uvyn2tLmnIdJbPE4vYvWLrtXXfFBSSPD4Afn7+3/XUggAlc7oCTizOfbbtOFlYA4g5KcYgS1J2ZAeMQqbUdZseZCcaZZZn65tdqee8UXZlDvx0+NdO0LR+5pFy+juM0wWbu59MvzcmTXbjsi7HY6zd53Yq5K244fwFHRQ8eOB0IWB+4PfM7FeAApZvlfqlKOlLcZL2uyVmzRkyR5yW72uo9mehX44CiPJ2fse9Y6eQtcfEhMPkmHXI01sN+KwPbpA39+xOsStjhP9N1Y1a2tQAVo+yVgLgV2Hws73Fc0o3wC78qPEA+v2aRs/Be3ZFDgDyghc/1fgU+7C+P6kbqd4poyb6IW8KCJbxfMJvkordNOgOUUxndPHEi/tb/U7uLjLOgPA=="
}
18 changes: 11 additions & 7 deletions crates/sgx-attestation/src/ias.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use core::time::Duration;

use alloc::string::String;
use alloc::vec::Vec;
use base64::{engine::general_purpose, Engine as _};
use pink_json::de::Error as JsonError;
use scale::{Decode, Encode};
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -50,12 +51,15 @@ pub struct RaReport {
pub isv_enclave_quote_body: String,
}

fn b64_decode(s: &str) -> Result<Vec<u8>, Error> {
general_purpose::STANDARD
.decode(s)
.or(Err(Error::CodecError))
}

impl RaReport {
pub fn decode_quote(&self) -> Result<EnclaveQuoteBody, Error> {
use base64::{engine::general_purpose, Engine as _};
let quote_body = general_purpose::STANDARD
.decode(&self.isv_enclave_quote_body)
.or(Err(Error::CodecError))?;
let quote_body = b64_decode(&self.isv_enclave_quote_body)?;
EnclaveQuoteBody::decode(&mut &quote_body[..]).or(Err(Error::CodecError))
}
}
Expand All @@ -73,10 +77,10 @@ impl SignedIasReport {
pink_json::from_str(&self.ra_report)
}

pub fn verify(&self, now_since_unix_epoch: Duration) -> Result<(), crate::Error> {
pub fn verify(&self, now_since_unix_epoch: Duration) -> Result<(), Error> {
let report = self.ra_report.as_str().as_bytes();
let signature = hex::decode(&self.signature).unwrap();
let raw_signing_cert = hex::decode(&self.raw_signing_cert).unwrap();
let signature = b64_decode(&self.signature)?;
let raw_signing_cert = b64_decode(&self.raw_signing_cert)?;
verify_signature(report, &signature, &raw_signing_cert, now_since_unix_epoch)
}
}
Expand Down
Loading

0 comments on commit a0f814a

Please sign in to comment.