From c827d6a324a69e73d6f3cdc0ed8760467a876e37 Mon Sep 17 00:00:00 2001 From: Chris Cushman <104409744+vreff@users.noreply.github.com> Date: Tue, 19 Sep 2023 16:31:14 -0400 Subject: [PATCH] Fix VRF foundry tests for nightly build version (#10717) * Fix VRF foundry tests for nightly build version * prettier * Add foundry test trigger for CI --------- Co-authored-by: Austin Born --- .github/workflows/solidity-foundry.yml | 1 + .../test/v0.8/foundry/vrf/VRFV2Plus.t.sol | 56 +++++++++---------- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/.github/workflows/solidity-foundry.yml b/.github/workflows/solidity-foundry.yml index 29022197bd3..8f0181640ea 100644 --- a/.github/workflows/solidity-foundry.yml +++ b/.github/workflows/solidity-foundry.yml @@ -21,6 +21,7 @@ jobs: filters: | src: - 'contracts/src/v0.8/**/*' + - 'contracts/test/v0.8/foundry/**/*' - '.github/workflows/solidity-foundry.yml' - 'contracts/foundry.toml' - 'contracts/gas-snapshots/*.gas-snapshot' diff --git a/contracts/test/v0.8/foundry/vrf/VRFV2Plus.t.sol b/contracts/test/v0.8/foundry/vrf/VRFV2Plus.t.sol index 80a94730ffe..9eb3550a8f7 100644 --- a/contracts/test/v0.8/foundry/vrf/VRFV2Plus.t.sol +++ b/contracts/test/v0.8/foundry/vrf/VRFV2Plus.t.sol @@ -282,15 +282,15 @@ contract VRFV2Plus is BaseTest { // Store the previous block's blockhash, and assert that it is as expected. vm.roll(requestBlock + 1); s_bhs.store(requestBlock); - assertEq(bytes32(uint256(requestBlock)), s_bhs.getBlockhash(requestBlock)); + assertEq(hex"c65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8", s_bhs.getBlockhash(requestBlock)); // Fulfill the request. // Proof generated via the generate-proof-v2-plus script command. Example usage: /* go run . generate-proof-v2-plus \ -key-hash 0x9f2353bde94264dbc3d554a94cceba2d7d2b4fdce4304d3e09a1fea9fbeb1528 \ - -pre-seed 93724884573574303181157854277074121673523280784530506403108144933983063023487 \ - -block-hash 0x000000000000000000000000000000000000000000000000000000000000000a \ + -pre-seed 53391429126065232382402681707515137895470547057819816488254124798726362946635 \ + -block-hash 0xc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8 \ -block-num 10 \ -sender 0x90A8820424CC8a819d14cBdE54D12fD3fbFa9bb2 \ -native-payment true @@ -301,22 +301,22 @@ contract VRFV2Plus is BaseTest { 62070622898698443831883535403436258712770888294397026493185421712108624767191 ], gamma: [ - 51111463251706978184511913295560024261167135799300172382907308330135472647507, - 41885656274025752055847945432737871864088659248922821023734315208027501951872 + 2973102176083872659982988645522968133664529102555885971868619302367987919116, + 43610558806647181042154132372309425100765955827430056035281841579494767100593 ], - c: 16524568342669389118511849307228542933779732546262509461687493305210182275018, - s: 41994650358817457338836417117109954917585544148583960677058620868924739846555, - seed: 93724884573574303181157854277074121673523280784530506403108144933983063023487, - uWitness: 0x239F36bb6F40B875feDB78A35668ED503714229D, + c: 44558436621153210954487996771157467729629491520915192177070584116261579650304, + s: 18447217702001910909971999949841419857536434117467121546901211519652998560328, + seed: 53391429126065232382402681707515137895470547057819816488254124798726362946635, + uWitness: 0x61e70839187C12Fe136bdcC78D1D3765BecA245d, cGammaWitness: [ - 39509254444382483930263995092200486700241035538419529811079167788988152938775, - 45386456067856204990374891906500133027941582609057652148999284389995660222714 + 57868024672571504735938309170346165090467827794150592801232968679608710558443, + 19249635816589941728350586356475545703589085434839461964712223344491075318152 ], sHashWitness: [ - 111625720767470372476405191521859549066251564741183518661578940869038469627728, - 102482035245447833089088394562631090129269030797203395897444301192092668485625 + 61151023867440095994162103308586528914977848168432699421313437043942463394142, + 107161674609768447269383119603000260750848712436031813376573304048979100187696 ], - zInv: 46854489406365983023053639507653417780777725139199393583659574012051139260916 + zInv: 92231836131549905872346812799402691650433126386650679876913933650318463342041 }); VRFCoordinatorV2Plus.RequestCommitment memory rc = VRFCoordinatorV2Plus.RequestCommitment({ blockNum: requestBlock, @@ -399,15 +399,15 @@ contract VRFV2Plus is BaseTest { // Store the previous block's blockhash, and assert that it is as expected. vm.roll(requestBlock + 1); s_bhs.store(requestBlock); - assertEq(bytes32(uint256(requestBlock)), s_bhs.getBlockhash(requestBlock)); + assertEq(hex"ce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec", s_bhs.getBlockhash(requestBlock)); // Fulfill the request. // Proof generated via the generate-proof-v2-plus script command. Example usage: /* go run . generate-proof-v2-plus \ -key-hash 0x9f2353bde94264dbc3d554a94cceba2d7d2b4fdce4304d3e09a1fea9fbeb1528 \ - -pre-seed 108233140904510496268355288815996296196427471042093167619305836589216327096601 \ - -block-hash 0x0000000000000000000000000000000000000000000000000000000000000014 \ + -pre-seed 14817911724325909152780695848148728017190840227899344848185245004944693487904 \ + -block-hash 0xce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec \ -block-num 20 \ -sender 0x90A8820424CC8a819d14cBdE54D12fD3fbFa9bb2 */ @@ -417,22 +417,22 @@ contract VRFV2Plus is BaseTest { 62070622898698443831883535403436258712770888294397026493185421712108624767191 ], gamma: [ - 49785247270467418393187938018746488660500261614113251546613288843777654841004, - 8320717868018488740308781441198484312662094766876176838868269181386589318272 + 33866404953216897461413961842321788789902210776565180957857448351149268461878, + 115311460432520855364215812517921508651759645277579047898967111537639679255245 ], - c: 76453805415479914665188560136648688491255275134351022531196270897692316685243, - s: 22475315809542512110111038532919582593833813393763591614796010376988981373422, - seed: 108233140904510496268355288815996296196427471042093167619305836589216327096601, - uWitness: 0x5FEaCA3fb4754440E6a2A9954FC9239C598575D6, + c: 32561838617228634441320154326890637858849550728945663611942735469609183032389, + s: 55806041637816588920133401262818662941786708593795051215322306020699218819370, + seed: 14817911724325909152780695848148728017190840227899344848185245004944693487904, + uWitness: 0x917554f18dB75eac206Ae5366B80c0b6A87b5996, cGammaWitness: [ - 55445396003779478156538753672495726993840482493921680192868130506843942678541, - 106319974075683500018668841039963899149060186085112051787355016812064025102025 + 84076069514674055711740813040098459867759972960517070154541804330775196519927, + 23456142794899412334950030002327578074149212885334118042147040122102091306080 ], sHashWitness: [ - 34533061775486739812426491689767238316751877347882380297143821485918957938090, - 2922713080913931101723342979079557154957284247074698150345640807351459691338 + 67919054534004130885903575144858988177160334233773664996450084407340736891592, + 82934864721844704662104532515068228502043057799129930869203380251475000254135 ], - zInv: 5351690486803355464662962731889988792533544566214255216629618109252893229562 + zInv: 37397948970756055003892765560695914630264479979131589134478580629419519112029 }); VRFCoordinatorV2Plus.RequestCommitment memory rc = VRFCoordinatorV2Plus.RequestCommitment({ blockNum: requestBlock,