-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
40 changed files
with
229 additions
and
43 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"version": "1", | ||
"name": "api", | ||
"type": "collection", | ||
"presets": { | ||
"requestType": "http", | ||
"requestUrl": "{{succinctBaseUrl}}" | ||
}, | ||
"ignore": [ | ||
"bin", | ||
"target", | ||
".git", | ||
"crates", | ||
"build", | ||
"nearx", | ||
"vendor", | ||
"wrapped" | ||
] | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
set export | ||
set dotenv-filename := ".env" | ||
set dotenv-load | ||
|
||
brunoc := "npx -y @usebruno/cli run" | ||
|
||
# Deploy a succinct circuit | ||
succinct-deploy $ENTRYPOINT $VERSION: | ||
$(brunoc) "Succinct/Deploy/new-deployment.bru" --env testnet -o /tmp/{{ENTRYPOINT}}-deployment-v${{VERSION}}.json | ||
|
||
succinct-check $ENTRYPOINT $VERSION: | ||
$(brunoc) "Succinct/Deploy/check-deployment.bru" --env testnet -o /tmp/{{ENTRYPOINT}}-deployment-v${{VERSION}}.json | ||
|
||
GIT_REF := env_var_or_default('GIT_REF', 'master') | ||
VERSION := env_var_or_default('VERSION', 'dev') | ||
|
||
BROADCAST := if env("BROADCAST", "") != "n" {"--broadcast "} else {""} | ||
LEGACY := if env('LEGACY', "") != "" {"--legacy "} else {""} | ||
VERIFIER := env('VERIFIER', 'etherscan') | ||
VERIFY := if env('VERIFY', "") != "n" {"--verify " + VERIFIER} else {""} | ||
|
||
ETH_RPC_URL := env('ETH_RPC_URL', 'https://rpc.sepolia.eth.gateway.fm') | ||
CHAIN_ID := env('CHAIN_ID', '11155111') | ||
ETH_PRIVATE_KEY := env_var('ETH_PRIVATE_KEY') | ||
ETH_PUBLIC_KEY := env_var('ETH_PUBLIC_KEY') | ||
|
||
forge-script SCRIPT TAIL *ARGS: | ||
#!/usr/bin/env bash | ||
echo {{SCRIPT}} | ||
echo {{TAIL}} | ||
cd ./nearx/contract && \ | ||
forge script {{SCRIPT}} \ | ||
--ffi \ | ||
--sender {{ETH_PUBLIC_KEY}} \ | ||
--rpc-url {{ETH_RPC_URL}} \ | ||
--private-key {{ETH_PRIVATE_KEY}} \ | ||
{{TAIL}} {{ARGS}} -vvvv | ||
get-deployments OUTPUT: | ||
echo "Getting deployments" | ||
{{brunoc}} "api/succinct/Get Deployments.bru" --env testnet -o {{OUTPUT}} | ||
|
||
filter-deployments INPUT NAME: | ||
cat {{INPUT}} \ | ||
| jq '.results[0].response.data' | jq -r "[.[] | select(.chain_id == {{CHAIN_ID}})]" \ | ||
| jq -r ".[] | select((.edges.release.name | contains(\"{{VERSION}}\")) and (.edges.release.entrypoint | contains(\"{{NAME}}\")))" | ||
|
||
init: (get-deployments "/tmp/deployments.json") | ||
#!/usr/bin/env bash | ||
set -euxo pipefail | ||
S_INFO=$(just filter-deployments /tmp/deployments.json Sync) | ||
echo $S_INFO | jq -r .gateway | ||
echo $S_INFO | jq -r .function_id | ||
|
||
just filter-deployments /tmp/deployments.json Verify | jq -r .function_id | ||
|
||
deploy: (forge-script "Deploy" BROADCAST + VERIFY + LEGACY) | ||
|
||
initialise: init | ||
forge-script Initialise | ||
|
||
update-params: (forge-script "UpdateParams" BROADCAST + LEGACY) | ||
|
||
upgrade: (forge-script "Upgrade" BROADCAST + VERIFY + LEGACY) | ||
|
||
request-sync: (forge-script "RequestSync" BROADCAST + LEGACY) | ||
|
||
request-verify: (forge-script "RequestVerify" BROADCAST + LEGACY) | ||
|
||
call-brunoc REQUEST: | ||
{{brunoc}} "api/succinct/deploy/{{REQUEST}}.bru" --env testnet -o /tmp/{{REQUEST}}-v{{VERSION}}.json | ||
|
||
check $CHECK_RELEASE_NUM: | ||
{{brunoc}} "api/succinct/deploy/check.bru" --env testnet -o /tmp/check-v{{VERSION}}.json | ||
|
||
wait-for-success ENTRYPOINT: | ||
#!/usr/bin/env bash | ||
|
||
CHECK_RELEASE_NUM=$(cat /tmp/new-deployment-v{{VERSION}}.json | jq -r ".results[0].response.data.release_number") | ||
CHECK_RELEASE_ID=$(cat /tmp/new-deployment-v{{VERSION}}.json | jq -r ".results[0].response.data.release_id") | ||
|
||
for ((count=0; count<20; count++)); do | ||
just check $CHECK_RELEASE_NUM | ||
if [ $? -ne 0 ]; then | ||
echo "non zero exit code: $?, trying in 30s" | ||
sleep 30s | ||
else | ||
echo "success" | ||
break | ||
fi | ||
done | ||
|
||
# TODO: update name | ||
update-release-name $ENTRYPOINT: | ||
#!/usr/bin/env bash | ||
export CHECK_RELEASE_ID=$(echo `just filter-deployments /tmp/deployments.json {{ENTRYPOINT}}` | jq -r .edges.release.id) | ||
{{brunoc}} "api/succinct/deploy/update-name.bru" --env testnet -o /tmp/update-release-name-v{{VERSION}}.json | ||
update-current-name $ENTRYPOINT: | ||
#!/usr/bin/env bash | ||
export CHECK_RELEASE_ID=$(echo `just filter-deployments /tmp/deployments.json {{ENTRYPOINT}}` | jq -r .edges.release.id) | ||
export VERSION=old | ||
echo $VERSION | ||
{{brunoc}} "api/succinct/deploy/update-name.bru" --env-var VERSION=$VERSION --env testnet -o /tmp/update-current-name-vold.json || exit 0 | ||
get-verifier OUTPUT: | ||
cat {{OUTPUT}} | jq -r '.results[].response.data.bytecode' | ||
|
||
release-dev $ENTRYPOINT $GIT_REF: | ||
#!/usr/bin/env bash | ||
set -euxo pipefail | ||
just call-brunoc "new-deployment" | ||
just update-current-name {{ENTRYPOINT}} | ||
just wait-for-success {{ENTRYPOINT}} | ||
just update-release-name {{ENTRYPOINT}} | ||
export FUNCTION_VERIFIER=`just get-verifier /tmp/check-v{{VERSION}}.json` | ||
FUNCTION_VERIFIER=$FUNCTION_VERIFIER just forge-script "DeployAndRegisterFunction" "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.