Skip to content

Commit

Permalink
Remove relays script (#117)
Browse files Browse the repository at this point in the history
* Adds remove-relays script and operations templates.  Bumps version to v0.3.1

* Adds ops templates

* Bump to v0.3.2 & fix ops templates for remove relays & logging in remove relays script
  • Loading branch information
jim-toth authored Aug 21, 2024
1 parent bd94e74 commit 7ee8b36
Show file tree
Hide file tree
Showing 37 changed files with 49 additions and 44 deletions.
2 changes: 1 addition & 1 deletion operations/cancel-distribution-dev.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "cancel-distribution-dev" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npx"]
command = "ts-node"
args = ["scripts/distribution/cancel-distribution.ts"]
Expand Down
2 changes: 1 addition & 1 deletion operations/cancel-distribution-live.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "cancel-distribution-live" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npx"]
command = "ts-node"
args = ["scripts/distribution/cancel-distribution.ts"]
Expand Down
2 changes: 1 addition & 1 deletion operations/cancel-distribution-stage.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "cancel-distribution-stage" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npx"]
command = "ts-node"
args = ["scripts/distribution/cancel-distribution.ts"]
Expand Down
2 changes: 1 addition & 1 deletion operations/deploy-distribution-dev.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "deploy-distribution-dev" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npm"]
command = "run"
args = ["deploy"]
Expand Down
2 changes: 1 addition & 1 deletion operations/deploy-distribution-live.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "deploy-distribution-live" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npm"]
command = "run"
args = ["deploy"]
Expand Down
2 changes: 1 addition & 1 deletion operations/deploy-distribution-stage.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "deploy-distribution-stage" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npm"]
command = "run"
args = ["deploy"]
Expand Down
2 changes: 1 addition & 1 deletion operations/deploy-relay-registry-dev.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "deploy-relay-registry-dev" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npm"]
command = "run"
args = ["deploy"]
Expand Down
2 changes: 1 addition & 1 deletion operations/deploy-relay-registry-live.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "deploy-relay-registry-live" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npm"]
command = "run"
args = ["deploy"]
Expand Down
2 changes: 1 addition & 1 deletion operations/deploy-relay-registry-stage.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "deploy-relay-registry-stage" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npm"]
command = "run"
args = ["deploy"]
Expand Down
2 changes: 1 addition & 1 deletion operations/dev-tests/add-relays-dev.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "add-relays-dev" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npx"]
command = "ts-node"
args = ["scripts/relay-registry/add-relays.ts"]
Expand Down
2 changes: 1 addition & 1 deletion operations/dev-tests/add-relays-stage.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "add-relays-stage" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npx"]
command = "ts-node"
args = ["scripts/relay-registry/add-relays.ts"]
Expand Down
2 changes: 1 addition & 1 deletion operations/dev-tests/add-scores-dev.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ job "add-scores-dev" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npx"]
command = "ts-node"
args = ["scripts/distribution/add-scores.ts"]
Expand Down
2 changes: 1 addition & 1 deletion operations/dev-tests/add-scores-stage.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ job "add-scores-stage" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npx"]
command = "ts-node"
args = ["scripts/distribution/add-scores.ts"]
Expand Down
2 changes: 1 addition & 1 deletion operations/evolve-distribution-dev.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "deploy-distribution-dev" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npm"]
command = "run"
args = ["evolve"]
Expand Down
2 changes: 1 addition & 1 deletion operations/evolve-distribution-live.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "deploy-distribution-live" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npm"]
command = "run"
args = ["evolve"]
Expand Down
2 changes: 1 addition & 1 deletion operations/evolve-distribution-stage.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "deploy-distribution-stage" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npm"]
command = "run"
args = ["evolve"]
Expand Down
2 changes: 1 addition & 1 deletion operations/evolve-relay-registry-dev.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "evolve-relay-registry-dev" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npm"]
command = "run"
args = ["evolve"]
Expand Down
2 changes: 1 addition & 1 deletion operations/evolve-relay-registry-live.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "evolve-relay-registry-live" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npm"]
command = "run"
args = ["evolve"]
Expand Down
2 changes: 1 addition & 1 deletion operations/evolve-relay-registry-stage.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "evolve-relay-registry-stage" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npm"]
command = "run"
args = ["evolve"]
Expand Down
5 changes: 3 additions & 2 deletions operations/remove-relays-dev.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ job "remove-relays-dev" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npx"]
command = "ts-node"
args = ["scripts/relay-registry/remove-relays.ts"]
volumes = [ "data/data.json:/usr/src/app/smartweave/data/data.json" ]
}

vault {
Expand All @@ -24,7 +25,7 @@ job "remove-relays-dev" {
template {
data = <<EOH
{{with secret "kv/relay-registry/dev"}}
RELAY_REGISTRY_OWNER_KEY="{{.Data.data.RELAY_REGISTRY_OWNER_KEY}}"
RELAY_REGISTRY_OPERATOR_KEY="{{.Data.data.RELAY_REGISTRY_OWNER_KEY}}"
CONSUL_TOKEN="{{.Data.data.CONSUL_TOKEN}}"
{{end}}
EOH
Expand Down
5 changes: 3 additions & 2 deletions operations/remove-relays-live.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ job "remove-relays-live" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npx"]
command = "ts-node"
args = ["scripts/relay-registry/remove-relays.ts"]
volumes = [ "data/data.json:/usr/src/app/smartweave/data/data.json" ]
}

vault {
Expand All @@ -24,7 +25,7 @@ job "remove-relays-live" {
template {
data = <<EOH
{{with secret "kv/relay-registry/live"}}
RELAY_REGISTRY_OWNER_KEY="{{.Data.data.RELAY_REGISTRY_OWNER_KEY}}"
RELAY_REGISTRY_OPERATOR_KEY="{{.Data.data.RELAY_REGISTRY_OWNER_KEY}}"
CONSUL_TOKEN="{{.Data.data.CONSUL_TOKEN}}"
{{end}}
EOH
Expand Down
7 changes: 4 additions & 3 deletions operations/remove-relays-stage.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ job "remove-relays-stage" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npx"]
command = "ts-node"
args = ["scripts/relay-registry/remove-relays.ts"]
volumes = [ "data/data.json:/usr/src/app/smartweave/data/data.json" ]
}

vault {
Expand All @@ -24,7 +25,7 @@ job "remove-relays-stage" {
template {
data = <<EOH
{{with secret "kv/relay-registry/stage"}}
RELAY_REGISTRY_OWNER_KEY="{{.Data.data.RELAY_REGISTRY_OWNER_KEY}}"
RELAY_REGISTRY_OPERATOR_KEY="{{.Data.data.RELAY_REGISTRY_OWNER_KEY}}"
CONSUL_TOKEN="{{.Data.data.CONSUL_TOKEN}}"
{{end}}
EOH
Expand All @@ -36,7 +37,7 @@ job "remove-relays-stage" {
data = <<EOH
{
"fingerprints": [
]
}
EOH
Expand Down
2 changes: 1 addition & 1 deletion operations/set-distribution-bonus-dev.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "set-distribution-bonus-dev" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npx"]
command = "ts-node"
args = ["scripts/distribution/set-distribution-bonus.ts"]
Expand Down
2 changes: 1 addition & 1 deletion operations/set-distribution-bonus-live.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "set-distribution-bonus-live" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npx"]
command = "ts-node"
args = ["scripts/distribution/set-distribution-bonus.ts"]
Expand Down
2 changes: 1 addition & 1 deletion operations/set-distribution-bonus-stage.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "set-distribution-bonus-stage" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npx"]
command = "ts-node"
args = ["scripts/distribution/set-distribution-bonus.ts"]
Expand Down
2 changes: 1 addition & 1 deletion operations/set-distribution-multipliers-dev.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "set-distribution-multipliers-dev" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npx"]
command = "ts-node"
args = ["scripts/distribution/set-multipliers.ts"]
Expand Down
2 changes: 1 addition & 1 deletion operations/set-distribution-multipliers-live.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "set-distribution-multipliers-live" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npx"]
command = "ts-node"
args = ["scripts/distribution/set-multipliers.ts"]
Expand Down
2 changes: 1 addition & 1 deletion operations/set-distribution-multipliers-stage.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "set-distribution-multipliers-stage" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npx"]
command = "ts-node"
args = ["scripts/distribution/set-multipliers.ts"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "set-previous-distribution-tracking-limit-dev" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npx"]
command = "ts-node"
args = ["scripts/distribution/set-token-distribution-rate.ts"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "set-previous-distribution-tracking-limit-live" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npx"]
command = "ts-node"
args = ["scripts/distribution/set-token-distribution-rate.ts"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "set-previous-distribution-tracking-limit-stage" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npx"]
command = "ts-node"
args = ["scripts/distribution/set-token-distribution-rate.ts"]
Expand Down
2 changes: 1 addition & 1 deletion operations/set-token-distribution-rate-dev.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "set-token-distribution-rate-dev" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npx"]
command = "ts-node"
args = ["scripts/distribution/set-token-distribution-rate.ts"]
Expand Down
2 changes: 1 addition & 1 deletion operations/set-token-distribution-rate-live.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "set-token-distribution-rate-live" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npx"]
command = "ts-node"
args = ["scripts/distribution/set-token-distribution-rate.ts"]
Expand Down
2 changes: 1 addition & 1 deletion operations/set-token-distribution-rate-stage.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ job "set-token-distribution-rate-stage" {

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.3.1"
image = "ghcr.io/ator-development/smart-contracts:0.3.2"
entrypoint = ["npx"]
command = "ts-node"
args = ["scripts/distribution/set-token-distribution-rate.ts"]
Expand Down
6 changes: 3 additions & 3 deletions smartweave/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion smartweave/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ator/smart-contracts-smartweave",
"version": "0.3.1",
"version": "0.3.2",
"contributors": [
"ATOR Labs",
"Jim Toth <[email protected]>"
Expand Down
6 changes: 4 additions & 2 deletions smartweave/scripts/relay-registry/remove-relays.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ async function main() {

const input: RemoveClaimable = { function: 'removeClaimable', fingerprint }

console.log(`Runnning sanity check for ${input}`)
console.log(`Runnning sanity check for ${JSON.stringify(input)}`)
try {
// NB: Dry-run sanity check
const { cachedValue: { state } } = await contract.readState()
Expand All @@ -89,7 +89,9 @@ async function main() {
.connect(signer)
.writeInteraction<RemoveClaimable>(input)

console.log(`Remove relay ${input} result ${result?.originalTxId}`)
console.log(
`Remove relay ${JSON.stringify(input)} result ${result?.originalTxId}`
)
} catch (error) {
console.error(error)
console.log('Continuing execution')
Expand Down

0 comments on commit 7ee8b36

Please sign in to comment.