forked from NSPG13/agent-bounties
-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (103 loc) · 6.4 KB
/
Copy pathsynthetic-paid-loop-canary.yml
File metadata and controls
113 lines (103 loc) · 6.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: Synthetic paid-loop canary
on:
workflow_dispatch:
schedule:
- cron: "7 0 29 7 *"
permissions:
contents: read
concurrency:
group: synthetic-paid-loop-canary-mainnet
cancel-in-progress: false
jobs:
create-claim-submit:
runs-on: ubuntu-latest
timeout-minutes: 15
env:
RPC_URL: ${{ vars.BASE_MAINNET_RPC_URL }}
KEEPER_KEY: ${{ secrets.BASE_KEEPER_PRIVATE_KEY }}
FACTORY: "0x082c52131aaf0c56e76b075f895eab6fcab6d2f9"
WALLET: "0x1eaa1c68772cf76bc5f4e4174766076e33ace662"
CREATOR: "0xc26a630e85134ed30968735c8e7de4576cfa5dbc"
BOUNTY: "0x5dfcb9e153fb215f5f2c62269ee4888484107763"
BOUNTY_ID: "0xa63145c8678882f0bd5ead03bfc52aa2b56ed3f0731103ff7dba192e3269a60f"
NONCE: "0xab14bf71a6f14f339c0ff06f94bb3bcecd162f93e06e4704a9d684425d70abf7"
ARTIFACT_REF: "https://github.com/NSPG13/agent-bounties/commit/7d28001b40e7227cc173e9824758413d069c080a"
ARTIFACT_HASH: "0xbec9450ffe5d0d73921c2cc829b1bab222cd74df3f71d58f071e56e459e2a4f5"
EVIDENCE_HASH: "0x9cddbd37c25bf3ba80a2e4b82839e4b0bf2e974333f42f62abc918df0f634848"
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5a
- uses: foundry-rs/foundry-toolchain@b00af27efadbc7b4ca8b82abbd903b17cc874d2a
- name: Validate fixed identities
run: |
set -euo pipefail
test "$(cast wallet address --private-key "$KEEPER_KEY" | tr '[:upper:]' '[:lower:]')" = "$CREATOR"
test "$(cast call "$WALLET" 'policy()(address,uint64,uint64,uint64,uint256,uint256,uint256,uint256,uint8,uint8,address,bytes32,bytes32)' --rpc-url "$RPC_URL" | head -1 | tr '[:upper:]' '[:lower:]')" = "$CREATOR"
- name: Create zero-funded canonical bounty
run: |
set -euo pipefail
if [ "$(cast code "$BOUNTY" --rpc-url "$RPC_URL")" = "0x" ]; then
params='(100000,10000,0x8a1e5ef80a8f99ae92f7e8fdc9495739d8e08a19c55dad985b76f5018210e34a,0x7b0960493231743c097b35c7def6d401fda9e96446f06d19318ecf6c1fe126b7,0x5f4adf4e1b5cbd8f1f2bf3ecaf8214ec3d0e7b3c4edcc8692604a8d1ea4ebe7f,0xdcf2d302c4a73b123fc3bb0b0ea40f7547e8febd20c5d4cc8c3998cfc684175e,0xc443416ed8eefd23018c58e526f7fcc0ab182b92e8c286bcc26b5f92ba093595,1800000000,86400,86400,1,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,2)'
verifiers='[0xbe6292b9e465f549e2363b918d6dd9187038431e,0xb7c2ce6430b66fb986e27b6140b29309550d487a]'
cast send "$FACTORY" \
'createBounty((uint256,uint256,bytes32,bytes32,bytes32,bytes32,bytes32,uint64,uint64,uint64,uint8,address,address,uint8),address[],uint256,bytes32)' \
"$params" "$verifiers" 0 "$NONCE" --private-key "$KEEPER_KEY" --rpc-url "$RPC_URL"
fi
test "$(cast call "$FACTORY" 'isCanonicalBounty(address)(bool)' "$BOUNTY" --rpc-url "$RPC_URL")" = "true"
- name: Fund and claim through bounded solver wallet
run: |
set -euo pipefail
if [ "$(cast call "$BOUNTY" 'fundedAmount()(uint256)' --rpc-url "$RPC_URL" | awk '{print $1}')" = "0" ]; then
cast send "$WALLET" 'fundBounty(address,uint256)' "$BOUNTY" 110000 \
--private-key "$KEEPER_KEY" --rpc-url "$RPC_URL"
fi
test "$(cast call "$BOUNTY" 'fundedAmount()(uint256)' --rpc-url "$RPC_URL" | awk '{print $1}')" = "110000"
if [ "$(cast call "$BOUNTY" 'solver()(address)' --rpc-url "$RPC_URL" | tr '[:upper:]' '[:lower:]')" = "0x0000000000000000000000000000000000000000" ]; then
cast send "$WALLET" 'claimBounty(address)' "$BOUNTY" \
--private-key "$KEEPER_KEY" --rpc-url "$RPC_URL"
fi
test "$(cast call "$BOUNTY" 'solver()(address)' --rpc-url "$RPC_URL" | tr '[:upper:]' '[:lower:]')" = "$WALLET"
- name: Submit exact public artifact
run: |
set -euo pipefail
if [ "$(cast call "$BOUNTY" 'submissionHash()(bytes32)' --rpc-url "$RPC_URL")" = "0x0000000000000000000000000000000000000000000000000000000000000000" ]; then
cast send "$WALLET" 'submitBounty(address,bytes32,bytes32)' \
"$BOUNTY" "$ARTIFACT_HASH" "$EVIDENCE_HASH" \
--private-key "$KEEPER_KEY" --rpc-url "$RPC_URL"
fi
test "$(cast call "$BOUNTY" 'submissionHash()(bytes32)' --rpc-url "$RPC_URL")" = "$ARTIFACT_HASH"
test "$(cast call "$BOUNTY" 'evidenceHash()(bytes32)' --rpc-url "$RPC_URL")" = "$EVIDENCE_HASH"
- name: Publish exact evidence after canonical indexing
run: |
set -euo pipefail
evidence='{"artifact_digest":"sha256:3a1fd04784fcc4831ea54b0ffe84585fc808ba6581300f1ced322a3af8d00a96","check_run_urls":[],"commit_sha":"7d28001b40e7227cc173e9824758413d069c080a","pull_request_url":"https://github.com/NSPG13/agent-bounties/pull/665","repository":"NSPG13/agent-bounties","source_snapshot_digest":"sha256:3a1fd04784fcc4831ea54b0ffe84585fc808ba6581300f1ced322a3af8d00a96","source_subdirectory":"."}'
payload="$(jq -cn \
--arg contract "$BOUNTY" --arg id "$BOUNTY_ID" --arg solver "$WALLET" \
--arg artifact "$ARTIFACT_REF" --argjson evidence "$evidence" \
'{network:"base-mainnet",bounty_contract:$contract,bounty_id:$id,round:1,solver_wallet:$solver,artifact_reference:$artifact,evidence:$evidence}')"
for attempt in $(seq 1 30); do
response="$(curl --fail-with-body --silent --show-error \
-H 'content-type: application/json' \
--data "$payload" \
https://mcp.agentbounties.app/tools/publish_autonomous_submission_evidence || true)"
if jq -e '.content[0].json.artifact_reference == "'"$ARTIFACT_REF"'"' >/dev/null 2>&1 <<<"$response"; then
exit 0
fi
sleep 10
done
echo "$response" >&2
echo "submission was not indexed and published within five minutes" >&2
exit 1
- name: Record evidence boundary
run: |
{
echo "## Synthetic canary submitted"
echo
echo "- bounty: \`$BOUNTY\`"
echo "- creator: \`$CREATOR\`"
echo "- solver: \`$WALLET\`"
echo "- funded: 0.11 USDC"
echo "- solver reward: 0.10 USDC"
echo "- verifier reserve / returned bond: 0.01 USDC"
echo
echo "This is not payment evidence. Only a confirmed canonical BountySettled event proves payout."
} >> "$GITHUB_STEP_SUMMARY"