-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for running both a TESTNET and an alpha PUBLIC network Turret #1
Merged
Conversation
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
…the window global and object
update deploy documentation for alpha release
Note this PR breaks the current GitHub Actions for Serverless. The current flow alters the env variables depending on which Turret you're deploying. With GitHub secrets you would have to set once either for testnet or alpha but it wound't support deploying to both. Will need to address this before merging to |
* force exclude sodium-native * Update yarn.lock * Added btfdev to TURRETS_LIST * removed docs directory as that now exists in a separate repo * STRI 1,2,4,5,6,7, semi-automated deployments (#2) * Minimum fix for STRI 4. - requires exact upload fee * addresses stri 7 this validates that the xdr is valid. * this validates that the function fields are valid json or throws an err * Addresses STRI 1 + 2 Adds: SLS_TIMEOUT env var - Prevent multiple contracts from running at one time without having enough money - Adds const reserveFee = new BigNumber(SLS_TIMEOUT).dividedBy(RUN_DIVISOR).toFixed(7) - Hold a fee in reserver for the maximum amount of possible charges based on the SLS_TIMEOUT and RUN_DIVISOR env vars - subtracts the reserve fee from the current fee balance for the auth'ed hash. after execution unused fees are refunded, and cost returned. * update build system to use esbuild-loader and update lodash for lodash-es * remove residual docs github actions definition * refactor from alpha to public * update package.json and add license * update dotenv template file. * update wrangler.toml.dist template file for new bindings * remove run-script-os * Assisted automated deployment. This commit brings automated deployment of the wrangler CLI in one step. This is still slightly a WIP but it does work. To deploy a turret, go to the wrangler folder and run "node deploy.mjs" You might need to have turned on the node --experimental-vm-modules Please use node version 16.13.0 or higher. On branch template Changes to be committed: modified: ../README.md new file: deploy.mjs new file: deployrest.mjs modified: package.json modified: wrangler.toml.dist Changes not staged for commit: modified: package-lock.json Untracked files: curlrequests.ps deploy/ foralex.mjs tests.js ci.js sockets/ * remove docs folder * Rewrite Heal Function This commit rewrites the heal function and moves the endpoint to /trust/heal * Update package.json, add toml * add missing const * Update the TOML parser in heal for new format This commit updates the toml parser in the heal function to use the following format for future turret tomls. ```toml [[TURRETS]] NAME="script3-mainnet" HOME_DOMAIN="www.turret.script3.io" PUBLIC_KEY="GABMKJM6I25XI4K7U6XWMULOUQIQ27BCTMLS6BYYSOWKTBUXVRJSXHYQ" [[TURRETS]] NAME="script3-mainnet" HOME_DOMAIN="www.turret.script3.io" PUBLIC_KEY="GABMKJM6I25XI4K7U6XWMULOUQIQ27BCTMLS6BYYSOWKTBUXVRJSXHYQ" ``` * cache control account response in heal Co-authored-by: Alex Mootz <alexmootz@hotmail.com> * reordered and renamed some things for consistency * use underscores to denote legacy or wip files * Final changes for STRI (#11) * Clarify inputs and make heal return user sourced xdr * update to no use setTimeout * Code Cleanup * update toml format * update imports of lodash-es * update alpha to public * pass env to helper functions * readd cache for get calls * update heal helper functions Co-authored-by: Alex Mootz <alexmootz@hotmail.com> * Clarify inputs and make heal return user sourced xdr (#10) * Clarify inputs and make heal return user sourced xdr * update to no use setTimeout Co-authored-by: Tyler van der Hoeven <hi@tyvdh.com> Co-authored-by: lmorgan824 <usa51008@gmail.com> Co-authored-by: Silence <35656692+silence48@users.noreply.github.com> Co-authored-by: Alex Mootz <alexmootz@hotmail.com> Co-authored-by: mootz12 <38118608+mootz12@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We're finally ready to take our first (very safe) steps in the universe of public network Turrets! 🎉
This PR adds all the necessary config and script changes to make this functionality possible.
Note that when the
STELLAR_NETWORK = "PUBLIC"
a new check will come into play on the txFunction upload endpoint blocking all contract uploads except for those hashes which have been manually added to the newALLOWED
KV store.So here are the necessary steps to get everything up and running.
stellar-tss
ortss-stellar
in favor ofstellar-turrets
. (note I'll probably change the name of this repo as well). Because of this change you'll likely need to delete your AWS deployment and spin up a new one under this new name. AWS is weird with name changes. To do that just navigate into your AWS console under CloudFormation and delete thetss-stellar
stack.stellar-turrets-testnet
. You could also delete the existing Worker as it would get recreated the next time you deploy. For the KV navigate to the KV tab and re-prefix the existing KV stores with the newstellar-turrets-testnet
. For Cloudflare these changes are more cosmetic than necessary as CF works of ids not names of things, but it should help in the future if we start matching everything with their name.stellar-turrets-alpha
to our Cloudflare account. The best way to accomplish this is first to run thesetup.sh
script from within the./wrangler
directory again. You may need to comment out the commands for the existing testnet KV stores but I think it should just error out or skip those. Keep track of the alpha outputs and I strongly suggest using a new Stellar key for theTURRET_SIGNER
than you're using for the testnet.npm run preinit
and thennpm run init
. As the script walks you through the flow just paste in all the appropriate values. If you've forgotten what they were or are they should be in the old .env file or in the Cloudflare dashboard.wrangler publish
(for testnet) andwranger publish --env alpha
(for alpha, duh)6.1. On the first publish of a new
--env
you'll need to also create the Durable Object so you'll need to run the publish command with the--new-class TxFees
flag. So in the case of an alpha publish it would bewrangler --env alpha --new-class TxFees publish
./serverless
directory and runnpx envdist testnet
andnpx envdist alpha
and fill in the appropriate values. Note if you already have a .env file you can delete that as we'll now be creating and relying on.env.testnet
and.env.alpha
for the deploy process. Once those are built you should be able to just runsls deploy
(for testnet) andsls deploy --stage alpha
(for alpha, again, duh){TESTNET|ALPHA}_TURRET_FUNCTION_RUNNER_URL
values if you didn't have them earlier. Same goes for theSLS_TURRET_BASE_URL
variable in the Serverless env files. The deployments are only as good as your configuration so please ensure you've done it right.{TESTNET|ALPHA}_TURRET_ADDRESS
/SLS_TURRET_SIGNER_ACCOUNT
addresses between your testnet and alpha Turrets. Duplicating these is a bad idea as a leak to a Testnet key is no big deal but a leak on the public network could equal loss of funds. The time to be safe is now!If any of these instructions were wrong, incomplete or out of order please comment here so we can adjust. Good luck!