diff --git a/tools/proving-v1/pc2-chain.ps1 b/tools/proving-v1/pc2-chain.ps1 index a56be84e2..cbb8992e6 100644 --- a/tools/proving-v1/pc2-chain.ps1 +++ b/tools/proving-v1/pc2-chain.ps1 @@ -26,10 +26,12 @@ $first = $tip - 30; $last = $first + 7 $t = Get-Date $body = (@{jsonrpc='2.0'; id=1; method='igneum_exportSegments'; params=@('0x0', ('0x{0:x}' -f $last))} | ConvertTo-Json -Compress) $seqFile = Join-Path $job 'seq.json' -try { - $resp = Invoke-WebRequest -Method Post -Uri "http://127.0.0.1:$evmPort" -ContentType 'application/json' -Body $body -TimeoutSec 600 -UseBasicParsing - [IO.File]::WriteAllBytes($seqFile, $resp.Content) -} catch { "RESULT export FAILED: $_"; exit 1 } +$bodyFile = Join-Path $job 'export-request.json' +[IO.File]::WriteAllText($bodyFile, $body, (New-Object System.Text.UTF8Encoding $false)) +# curl.exe (Windows 10+ ships it) streams the 70 MB reply to a file; Invoke-WebRequest's Content is a string there +# and WriteAllBytes refused it (the first run, 19:52Z) +& curl.exe -s -S -m 600 -X POST "http://127.0.0.1:$evmPort" -H 'Content-Type: application/json' --data-binary "@$bodyFile" -o $seqFile 2>&1 | ForEach-Object { "curl: $_" } +if (-not (Test-Path $seqFile) -or (Get-Item $seqFile).Length -lt 1000) { "RESULT export FAILED: no reply file"; exit 1 } $len = (Get-Item $seqFile).Length "RESULT export $(Stamp) $len bytes in $([math]::Round(((Get-Date) - $t).TotalSeconds,1)) s to $seqFile" # the JSON-RPC envelope: the exporter wants the result object; unwrap with python inside WSL (below)