diff --git a/packages/protocol/script/SetDcapParams.s.sol b/packages/protocol/script/SetDcapParams.s.sol index 9f65aa2eaa1..990a80f0bf0 100644 --- a/packages/protocol/script/SetDcapParams.s.sol +++ b/packages/protocol/script/SetDcapParams.s.sol @@ -67,7 +67,7 @@ contract SetDcapParams is Script, AttestationBase { } function _configureTcbInfoJson() internal { - tcbInfoPath = vm.envString("TCB_INFO_PATH"); + string memory tcbInfoPath = vm.envString("TCB_INFO_PATH"); string memory tcbInfoJson = vm.readFile(string.concat(vm.projectRoot(), tcbInfoPath)); configureTcbInfoJson(dcapAttestationAddress, tcbInfoJson); console2.logString("TCB_INFO_JSON set: "); diff --git a/packages/protocol/test/automata-attestation/AutomataDcapV3AttestationTest.t.sol b/packages/protocol/test/automata-attestation/AutomataDcapV3AttestationTest.t.sol index 0983fbe0071..bc6c9b3c5e0 100644 --- a/packages/protocol/test/automata-attestation/AutomataDcapV3AttestationTest.t.sol +++ b/packages/protocol/test/automata-attestation/AutomataDcapV3AttestationTest.t.sol @@ -117,7 +117,7 @@ contract AutomataDcapV3AttestationTest is Test, AttestationBase { assertTrue(parsedInstanceAddr == address(0xC2D4564358139C90C17B744FE837F4DDc503EEdF)); } - function testParsedQuoteBinAttestation() public { + function testParsedSampleQuoteBinAttestation() public { vm.prank(user); bytes memory v3QuoteBytes = sampleQuote; V3Struct.ParsedV3QuoteStruct memory v3quote = @@ -128,6 +128,20 @@ contract AutomataDcapV3AttestationTest is Test, AttestationBase { assertTrue(parsedInstanceAddr == 0xC2D4564358139C90C17B744FE837F4DDc503EEdF); } + function testParsedCustomQuoteBinAttestation() public { + // fast forward to a time where the quote is valid + skip(1_820_000_000 - block.timestamp); + vm.prank(user); + bytes memory v3QuoteBytes = + hex"03000200000000000a000f00939a7233f79c4ca9940a0db3957f060724b261d141674cafc44426b74ed02fdf000000000b0d100fffff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000000000e7000000000000009b2784bccc0779fa34e75d74881bf5850bb4a6410f4edfa935ef77115db3a86d0000000000000000000000000000000000000000000000000000000000000000ca0583a715534a8c981b914589a7f0dc5d60959d9ae79fb5353299a4231673d500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000309734c02d2145cabb034f3c0505d28f7e5bfc2d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ca10000010eec632f3dbb9a3b1280ca5e837750e12ce5adbea2cc64d53672b0b0213404d3b27c84dc886ce361716b5d51e85136750ca05827ced6d7c2afd025bc6ee44bd874269e41c5fcd064b417d110f40b745b5c7d0eb8208be57c3c48bd7bdabbf2e47c46ddd935f4589134f89c9e0995dfdaaef29aa61807366818f2eebf915134d0b0d100fffff0000000000000000000000000000000000000000000000000000000000000000000000000000000000001500000000000000e70000000000000096b347a64e5a045e27369c26e6dcda51fd7c850e9b3a3a79e718f43261dee1e400000000000000000000000000000000000000000000000000000000000000008c4f5775d796503e96137f77c68a829a0056ac8ded70140b081b094490c57bff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000bf7138a8539a3d44afb1d9ab145134cd27aa8c6ee6c3053bdab6b19b46800d570000000000000000000000000000000000000000000000000000000000000000e04cceabc75e8485601a01fdf514b68c31f4498f3e2273930c03a1f7efbe0eaee34f08f9c3a0eba0e24f677ce5692389f4c016e5caf8451b544d312df74264752000000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f0500620e00002d2d2d2d2d424547494e2043455254494649434154452d2d2d2d2d0a4d494945386a4343424a696741774942416749556565364e4e4f502f6b526c6f734d77336b435a70644a70424f414977436759494b6f5a497a6a3045417749770a634445694d434147413155454177775a535735305a577767553064594946424453794251624746305a6d397962534244515445614d42674741315545436777520a535735305a577767513239796347397959585270623234784644415342674e564241634d43314e68626e526849454e7359584a684d51737743515944565151490a44414a445154454c4d416b474131554542684d4356564d774868634e4d6a51774e5449794d6a4d7a4f544d345768634e4d7a45774e5449794d6a4d7a4f544d340a576a42774d534977494159445651514444426c4a626e526c624342545231676755454e4c49454e6c636e52705a6d6c6a5958526c4d526f77474159445651514b0a4442464a626e526c6243424462334a7762334a6864476c76626a45554d424947413155454277774c553246756447456751327868636d4578437a414a42674e560a4241674d416b4e424d517377435159445651514745774a56557a425a4d424d4742797147534d34394167454743437147534d34394177454841304941424673770a4f5267652f704a4834514d3163456c44626f463451384549313864386a42665a63536b4c615179656b35614f6b4767454756672f476655356255453450544c2b0a37794c6b626b394471557950467836592b434b6a67674d4f4d494944436a416642674e5648534d4547444157674253566231334e765276683655424a796454300a4d383442567776655644427242674e56485238455a4442694d47436758714263686c706f64485277637a6f764c32467761533530636e567a6447566b633256790a646d6c6a5a584d75615735305a577775593239744c334e6e6543396a5a584a3061575a7059324630615739754c3359304c33426a61324e796244396a595431770a624746305a6d397962535a6c626d4e765a476c755a7a316b5a584977485159445652304f42425945464c686b766f31584a6f2b6958464c6c6c454f2b472f56580a695239534d41344741315564447745422f775145417749477744414d42674e5648524d4241663845416a41414d4949434f77594a4b6f5a496876684e415130420a424949434c444343416967774867594b4b6f5a496876684e41513042415151516668326b6a583748503937435265674c6256594f726a434341575547436971470a534962345451454e41514977676746564d42414743797147534962345451454e415149424167454c4d42414743797147534962345451454e415149434167454c0a4d42414743797147534962345451454e41514944416745444d42414743797147534962345451454e41514945416745444d42454743797147534962345451454e0a41514946416749412f7a415242677371686b69472b4530424451454342674943415038774541594c4b6f5a496876684e4151304241676343415141774541594c0a4b6f5a496876684e4151304241676743415141774541594c4b6f5a496876684e4151304241676b43415141774541594c4b6f5a496876684e4151304241676f430a415141774541594c4b6f5a496876684e4151304241677343415141774541594c4b6f5a496876684e4151304241677743415141774541594c4b6f5a496876684e0a4151304241673043415141774541594c4b6f5a496876684e4151304241673443415141774541594c4b6f5a496876684e4151304241673843415141774541594c0a4b6f5a496876684e4151304241684143415141774541594c4b6f5a496876684e4151304241684543415130774877594c4b6f5a496876684e41513042416849450a4541734c4177502f2f7741414141414141414141414141774541594b4b6f5a496876684e4151304241775143414141774641594b4b6f5a496876684e415130420a424151474d474271414141414d41384743697147534962345451454e4151554b415145774867594b4b6f5a496876684e41513042426751516c4b6254394547580a78334843365163754c712b374d7a424542676f71686b69472b453042445145484d4459774541594c4b6f5a496876684e4151304242774542416638774541594c0a4b6f5a496876684e4151304242774942416638774541594c4b6f5a496876684e4151304242774d4241663877436759494b6f5a497a6a304541774944534141770a5251496763325556534f386d4b384c314f5675534943514264315671534e50326e716d5656394c4678504e326c6f774349514362662b69785065367a335966420a664b51344f4b6c546f694d55386a66333849672f765275586976525257773d3d0a2d2d2d2d2d454e442043455254494649434154452d2d2d2d2d0a2d2d2d2d2d424547494e2043455254494649434154452d2d2d2d2d0a4d4949436c6a4343416a32674177494241674956414a567658633239472b487051456e4a3150517a7a674658433935554d416f4743437147534d343942414d430a4d476778476a415942674e5642414d4d45556c756447567349464e48574342536232393049454e424d526f77474159445651514b4442464a626e526c624342440a62334a7762334a6864476c76626a45554d424947413155454277774c553246756447456751327868636d4578437a414a42674e564241674d416b4e424d5173770a435159445651514745774a56557a4165467730784f4441314d6a45784d4455774d5442614677307a4d7a41314d6a45784d4455774d5442614d484178496a41670a42674e5642414d4d47556c756447567349464e4857434251513073675547786864475a76636d306751304578476a415942674e5642416f4d45556c75644756730a49454e76636e4276636d4630615739754d5251774567594456515148444174545957353059534244624746795954454c4d416b474131554543417743513045780a437a414a42674e5642415954416c56544d466b77457759484b6f5a497a6a3043415159494b6f5a497a6a304441516344516741454e53422f377432316c58534f0a3243757a7078773734654a423732457944476757357258437478327456544c7136684b6b367a2b5569525a436e71523770734f766771466553786c6d546c4a6c0a65546d693257597a33714f42757a43427544416642674e5648534d4547444157674251695a517a575770303069664f44744a5653763141624f536347724442530a42674e5648523845537a424a4d45656752614244686b466f64485277637a6f764c324e6c636e52705a6d6c6a5958526c63793530636e567a6447566b633256790a646d6c6a5a584d75615735305a577775593239744c306c756447567355306459556d397664454e424c6d526c636a416442674e5648513445466751556c5739640a7a62306234656c4153636e553944504f4156634c336c517744675944565230504151482f42415144416745474d42494741315564457745422f7751494d4159420a4166384341514177436759494b6f5a497a6a30454177494452774177524149675873566b6930772b6936565947573355462f32327561586530594a446a3155650a6e412b546a44316169356343494359623153416d4435786b66545670766f34556f79695359787244574c6d5552344349394e4b7966504e2b0a2d2d2d2d2d454e442043455254494649434154452d2d2d2d2d0a2d2d2d2d2d424547494e2043455254494649434154452d2d2d2d2d0a4d4949436a7a4343416a53674177494241674955496d554d316c71644e496e7a6737535655723951477a6b6e42717777436759494b6f5a497a6a3045417749770a614445614d4267474131554541777752535735305a5777675530645949464a766233516751304578476a415942674e5642416f4d45556c756447567349454e760a636e4276636d4630615739754d5251774567594456515148444174545957353059534244624746795954454c4d416b47413155454341774351304578437a414a0a42674e5642415954416c56544d423458445445344d4455794d5445774e4455784d466f58445451354d54497a4d54497a4e546b314f566f77614445614d4267470a4131554541777752535735305a5777675530645949464a766233516751304578476a415942674e5642416f4d45556c756447567349454e76636e4276636d46300a615739754d5251774567594456515148444174545957353059534244624746795954454c4d416b47413155454341774351304578437a414a42674e56424159540a416c56544d466b77457759484b6f5a497a6a3043415159494b6f5a497a6a3044415163445167414543366e45774d4449595a4f6a2f69505773437a61454b69370a314f694f534c52466857476a626e42564a66566e6b59347533496a6b4459594c304d784f346d717379596a6c42616c54565978465032734a424b357a6c4b4f420a757a43427544416642674e5648534d4547444157674251695a517a575770303069664f44744a5653763141624f5363477244425342674e5648523845537a424a0a4d45656752614244686b466f64485277637a6f764c324e6c636e52705a6d6c6a5958526c63793530636e567a6447566b63325679646d6c6a5a584d75615735300a5a577775593239744c306c756447567355306459556d397664454e424c6d526c636a416442674e564851344546675155496d554d316c71644e496e7a673753560a55723951477a6b6e4271777744675944565230504151482f42415144416745474d42494741315564457745422f7751494d4159424166384341514577436759490a4b6f5a497a6a3045417749445351417752674968414f572f35516b522b533943695344634e6f6f774c7550524c735747662f59693747535839344267775477670a41694541344a306c72486f4d732b586f356f2f7358364f39515778485241765a55474f6452513763767152586171493d0a2d2d2d2d2d454e442043455254494649434154452d2d2d2d2d0a00"; + V3Struct.ParsedV3QuoteStruct memory v3quote = + verifyParsedQuoteAttestation(v3QuoteBytes, true); + address parsedInstanceAddr = + address(bytes20(Bytes.slice(v3quote.localEnclaveReport.reportData, 0, 20))); + // console.log("[log] parsed instance addr = %s", parsedInstanceAddr); + assertTrue(parsedInstanceAddr == 0x309734C02d2145cABB034F3c0505D28F7E5bFc2d); + } + function testParsedQuoteBase64Attestation() public { string memory v3QuoteB64Str = "AwACAAAAAAAKAA8Ak5pyM/ecTKmUCg2zlX8GBxLOavHkqB4OzaxCe5m7ApUAAAAACwsQD///AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAADnAAAAAAAAADAx1Y7sROJljY0p6/ptbdwC841C1n7aq7S/qjSGeOa6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAdPSuOeKkIHE14ZQJvmEsmUZdpbf5KBZii0O8HZPcA9QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAdC5oqY9mLGLKIiJy2EWABZTTIFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAyhAAAEDWo4+gcMfB8oCHFOW95E3dDzSJmZxRjEPY6SLfsAxxmdL1E9tpPreSh37ItjqcFJQ6gYaaITdFjh1JUAI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Roa0ZvZEhSd2N6b3ZMMk5sY25ScFptbGpZWFJsY3k1MGNuVnpkR1ZrYzJWeWRtbGpaWE11YVc1MApaV3d1WTI5dEwwbHVkR1ZzVTBkWVVtOXZkRU5CTG1SbGNqQWRCZ05WSFE0RUZnUVVJbVVNMWxxZE5JbnpnN1NWClVyOVFHemtuQnF3d0RnWURWUjBQQVFIL0JBUURBZ0VHTUJJR0ExVWRFd0VCL3dRSU1BWUJBZjhDQVFFd0NnWUkKS29aSXpqMEVBd0lEU1FBd1JnSWhBT1cvNVFrUitTOUNpU0RjTm9vd0x1UFJMc1dHZi9ZaTdHU1g5NEJnd1R3ZwpBaUVBNEowbHJIb01zK1hvNW8vc1g2TzlRV3hIUkF2WlVHT2RSUTdjdnFSWGFxST0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQoA"; diff --git a/packages/protocol/test/automata-attestation/assets/0424/tcb_30606a000000.json b/packages/protocol/test/automata-attestation/assets/0424/tcb_30606a000000.json new file mode 100644 index 00000000000..c97c2b2971d --- /dev/null +++ b/packages/protocol/test/automata-attestation/assets/0424/tcb_30606a000000.json @@ -0,0 +1,221 @@ +{ + "tcbInfo": { + "version": 2, + "issueDate": "2024-06-05T21:19:36Z", + "nextUpdate": "2024-07-05T21:19:36Z", + "fmspc": "30606a000000", + "pceId": "0000", + "tcbType": 0, + "tcbEvaluationDataNumber": 16, + "tcbLevels": [ + { + "tcb": { + "sgxtcbcomp01svn": 12, + "sgxtcbcomp02svn": 12, + "sgxtcbcomp03svn": 3, + "sgxtcbcomp04svn": 3, + "sgxtcbcomp05svn": 255, + "sgxtcbcomp06svn": 255, + "sgxtcbcomp07svn": 1, + "sgxtcbcomp08svn": 0, + "sgxtcbcomp09svn": 0, + "sgxtcbcomp10svn": 0, + "sgxtcbcomp11svn": 0, + "sgxtcbcomp12svn": 0, + "sgxtcbcomp13svn": 0, + "sgxtcbcomp14svn": 0, + "sgxtcbcomp15svn": 0, + "sgxtcbcomp16svn": 0, + "pcesvn": 13 + }, + "tcbDate": "2023-08-09T00:00:00Z", + "tcbStatus": "SWHardeningNeeded" + }, + { + "tcb": { + "sgxtcbcomp01svn": 12, + "sgxtcbcomp02svn": 12, + "sgxtcbcomp03svn": 3, + "sgxtcbcomp04svn": 3, + "sgxtcbcomp05svn": 255, + "sgxtcbcomp06svn": 255, + "sgxtcbcomp07svn": 0, + "sgxtcbcomp08svn": 0, + "sgxtcbcomp09svn": 0, + "sgxtcbcomp10svn": 0, + "sgxtcbcomp11svn": 0, + "sgxtcbcomp12svn": 0, + "sgxtcbcomp13svn": 0, + "sgxtcbcomp14svn": 0, + "sgxtcbcomp15svn": 0, + "sgxtcbcomp16svn": 0, + "pcesvn": 13 + }, + "tcbDate": "2023-08-09T00:00:00Z", + "tcbStatus": "ConfigurationAndSWHardeningNeeded" + }, + { + "tcb": { + "sgxtcbcomp01svn": 11, + "sgxtcbcomp02svn": 11, + "sgxtcbcomp03svn": 3, + "sgxtcbcomp04svn": 3, + "sgxtcbcomp05svn": 255, + "sgxtcbcomp06svn": 255, + "sgxtcbcomp07svn": 1, + "sgxtcbcomp08svn": 0, + "sgxtcbcomp09svn": 0, + "sgxtcbcomp10svn": 0, + "sgxtcbcomp11svn": 0, + "sgxtcbcomp12svn": 0, + "sgxtcbcomp13svn": 0, + "sgxtcbcomp14svn": 0, + "sgxtcbcomp15svn": 0, + "sgxtcbcomp16svn": 0, + "pcesvn": 13 + }, + "tcbDate": "2023-02-15T00:00:00Z", + "tcbStatus": "OutOfDate" + }, + { + "tcb": { + "sgxtcbcomp01svn": 11, + "sgxtcbcomp02svn": 11, + "sgxtcbcomp03svn": 3, + "sgxtcbcomp04svn": 3, + "sgxtcbcomp05svn": 255, + "sgxtcbcomp06svn": 255, + "sgxtcbcomp07svn": 0, + "sgxtcbcomp08svn": 0, + "sgxtcbcomp09svn": 0, + "sgxtcbcomp10svn": 0, + "sgxtcbcomp11svn": 0, + "sgxtcbcomp12svn": 0, + "sgxtcbcomp13svn": 0, + "sgxtcbcomp14svn": 0, + "sgxtcbcomp15svn": 0, + "sgxtcbcomp16svn": 0, + "pcesvn": 13 + }, + "tcbDate": "2023-02-15T00:00:00Z", + "tcbStatus": "OutOfDateConfigurationNeeded" + }, + { + "tcb": { + "sgxtcbcomp01svn": 7, + "sgxtcbcomp02svn": 9, + "sgxtcbcomp03svn": 3, + "sgxtcbcomp04svn": 3, + "sgxtcbcomp05svn": 255, + "sgxtcbcomp06svn": 255, + "sgxtcbcomp07svn": 1, + "sgxtcbcomp08svn": 0, + "sgxtcbcomp09svn": 0, + "sgxtcbcomp10svn": 0, + "sgxtcbcomp11svn": 0, + "sgxtcbcomp12svn": 0, + "sgxtcbcomp13svn": 0, + "sgxtcbcomp14svn": 0, + "sgxtcbcomp15svn": 0, + "sgxtcbcomp16svn": 0, + "pcesvn": 13 + }, + "tcbDate": "2022-08-10T00:00:00Z", + "tcbStatus": "OutOfDate" + }, + { + "tcb": { + "sgxtcbcomp01svn": 7, + "sgxtcbcomp02svn": 9, + "sgxtcbcomp03svn": 3, + "sgxtcbcomp04svn": 3, + "sgxtcbcomp05svn": 255, + "sgxtcbcomp06svn": 255, + "sgxtcbcomp07svn": 0, + "sgxtcbcomp08svn": 0, + "sgxtcbcomp09svn": 0, + "sgxtcbcomp10svn": 0, + "sgxtcbcomp11svn": 0, + "sgxtcbcomp12svn": 0, + "sgxtcbcomp13svn": 0, + "sgxtcbcomp14svn": 0, + "sgxtcbcomp15svn": 0, + "sgxtcbcomp16svn": 0, + "pcesvn": 13 + }, + "tcbDate": "2022-08-10T00:00:00Z", + "tcbStatus": "OutOfDateConfigurationNeeded" + }, + { + "tcb": { + "sgxtcbcomp01svn": 4, + "sgxtcbcomp02svn": 4, + "sgxtcbcomp03svn": 3, + "sgxtcbcomp04svn": 3, + "sgxtcbcomp05svn": 255, + "sgxtcbcomp06svn": 255, + "sgxtcbcomp07svn": 0, + "sgxtcbcomp08svn": 0, + "sgxtcbcomp09svn": 0, + "sgxtcbcomp10svn": 0, + "sgxtcbcomp11svn": 0, + "sgxtcbcomp12svn": 0, + "sgxtcbcomp13svn": 0, + "sgxtcbcomp14svn": 0, + "sgxtcbcomp15svn": 0, + "sgxtcbcomp16svn": 0, + "pcesvn": 11 + }, + "tcbDate": "2021-11-10T00:00:00Z", + "tcbStatus": "OutOfDate" + }, + { + "tcb": { + "sgxtcbcomp01svn": 4, + "sgxtcbcomp02svn": 4, + "sgxtcbcomp03svn": 3, + "sgxtcbcomp04svn": 3, + "sgxtcbcomp05svn": 255, + "sgxtcbcomp06svn": 255, + "sgxtcbcomp07svn": 0, + "sgxtcbcomp08svn": 0, + "sgxtcbcomp09svn": 0, + "sgxtcbcomp10svn": 0, + "sgxtcbcomp11svn": 0, + "sgxtcbcomp12svn": 0, + "sgxtcbcomp13svn": 0, + "sgxtcbcomp14svn": 0, + "sgxtcbcomp15svn": 0, + "sgxtcbcomp16svn": 0, + "pcesvn": 10 + }, + "tcbDate": "2020-11-11T00:00:00Z", + "tcbStatus": "OutOfDate" + }, + { + "tcb": { + "sgxtcbcomp01svn": 4, + "sgxtcbcomp02svn": 4, + "sgxtcbcomp03svn": 3, + "sgxtcbcomp04svn": 3, + "sgxtcbcomp05svn": 255, + "sgxtcbcomp06svn": 255, + "sgxtcbcomp07svn": 0, + "sgxtcbcomp08svn": 0, + "sgxtcbcomp09svn": 0, + "sgxtcbcomp10svn": 0, + "sgxtcbcomp11svn": 0, + "sgxtcbcomp12svn": 0, + "sgxtcbcomp13svn": 0, + "sgxtcbcomp14svn": 0, + "sgxtcbcomp15svn": 0, + "sgxtcbcomp16svn": 0, + "pcesvn": 5 + }, + "tcbDate": "2018-01-04T00:00:00Z", + "tcbStatus": "OutOfDate" + } + ] + }, + "signature": "cd542e85f79fdf7fadb6218bb8640df5fd988f6287b5da46c7f96c63f93c39e540fe260a2f5fe640430705339fad9372a4301f071a9838a737dff6ff6c63e042" +} diff --git a/packages/protocol/test/automata-attestation/common/AttestationBase.t.sol b/packages/protocol/test/automata-attestation/common/AttestationBase.t.sol index 62016721950..33345398ca9 100644 --- a/packages/protocol/test/automata-attestation/common/AttestationBase.t.sol +++ b/packages/protocol/test/automata-attestation/common/AttestationBase.t.sol @@ -30,7 +30,12 @@ contract AttestationBase is Test, DcapTestUtils, V3QuoteParseUtils { // use a network that where the P256Verifier contract exists // ref: https://github.com/daimo-eth/p256-verifier //string internal rpcUrl = vm.envString("RPC_URL"); - string internal tcbInfoPath = "/test/automata-attestation/assets/0923/tcb_00606A000000.json"; + string[] internal tcbInfoPaths = [ + "/test/automata-attestation/assets/0923/tcb_00606A000000.json", + "/test/automata-attestation/assets/0424/tcb_00A067110000.json", + "/test/automata-attestation/assets/0424/tcb_00906ED50000.json", + "/test/automata-attestation/assets/0424/tcb_30606a000000.json" + ]; string internal idPath = "/test/automata-attestation/assets/0923/identity.json"; address constant admin = address(1); address constant user = 0x0926b716f6aEF52F9F3C3474A2846e1Bf1ACedf6; @@ -68,15 +73,18 @@ contract AttestationBase is Test, DcapTestUtils, V3QuoteParseUtils { setMrEnclave(address(attestation), mrEnclave, true); setMrSigner(address(attestation), mrSigner, true); - string memory tcbInfoJson = vm.readFile(string.concat(vm.projectRoot(), tcbInfoPath)); - string memory enclaveIdJson = vm.readFile(string.concat(vm.projectRoot(), idPath)); + for (uint256 i = 0; i < tcbInfoPaths.length; i++) { + string memory tcbInfoJson = + vm.readFile(string.concat(vm.projectRoot(), tcbInfoPaths[i])); - (bool tcbParsedSuccess, TCBInfoStruct.TCBInfo memory parsedTcbInfo) = - parseTcbInfoJson(tcbInfoJson); - require(tcbParsedSuccess, "tcb parsed failed"); - string memory fmspc = LibString.lower(parsedTcbInfo.fmspc); - attestation.configureTcbInfoJson(fmspc, parsedTcbInfo); + (bool tcbParsedSuccess, TCBInfoStruct.TCBInfo memory parsedTcbInfo) = + parseTcbInfoJson(tcbInfoJson); + require(tcbParsedSuccess, "tcb parsed failed"); + string memory fmspc = LibString.lower(parsedTcbInfo.fmspc); + attestation.configureTcbInfoJson(fmspc, parsedTcbInfo); + } + string memory enclaveIdJson = vm.readFile(string.concat(vm.projectRoot(), idPath)); configureQeIdentityJson(address(attestation), enclaveIdJson); vm.stopPrank(); }