remote devnet config - GCP VM

This commit is contained in:
Justin Schuldt 2022-03-18 13:20:16 +00:00
parent 90489cc299
commit 42284a25e3
4 changed files with 20 additions and 8 deletions

View File

@ -211,9 +211,9 @@ k8s_resource(
if num_guardians >= 2:
local_resource(
name = "guardian-set-update",
resource_deps = guardian_resource_deps,
resource_deps = guardian_resource_deps + ["guardian"],
deps = ["scripts/send-vaa.sh", "clients/eth"],
cmd = './scripts/update-guardian-set.sh %s' % (num_guardians),
cmd = './scripts/update-guardian-set.sh %s %s' % (num_guardians, webHost),
labels = ["guardian"],
trigger_mode = trigger_mode,
)
@ -409,7 +409,7 @@ if explorer:
k8s_resource(
"bigtable-emulator",
port_forwards = [port_forward(8086, name = "BigTable clients [:8086]", host = webHost)],
port_forwards = [port_forward(8086, name = "BigTable clients [:8086]")],
labels = ["explorer"],
trigger_mode = trigger_mode,
)
@ -431,7 +431,7 @@ if explorer:
k8s_resource(
"cloud-functions",
resource_deps = ["proto-gen", "bigtable-emulator", "pubsub-emulator"],
port_forwards = [port_forward(8090, name = "Cloud Functions [:8090]")],
port_forwards = [port_forward(8090, name = "Cloud Functions [:8090]", host = webHost)],
labels = ["explorer"],
trigger_mode = trigger_mode,
)

View File

@ -8,6 +8,7 @@ import (
"fmt"
"log"
"strings"
"sync"
"cloud.google.com/go/bigtable"
"cloud.google.com/go/pubsub"
@ -42,6 +43,7 @@ var nftEmitters = map[string]string{
"0000000000000000000000002b048Da40f69c8dc386a56705915f8E966fe1eba": "0x2b048Da40f69c8dc386a56705915f8E966fe1eba", // ethereum ropesten
// TODO "": "", // fantom
}
var muNFTEmitters sync.RWMutex
// NFTEmitters will be populated with lowercase addresses
var NFTEmitters = map[string]string{}
@ -69,6 +71,8 @@ var tokenTransferEmitters = map[string]string{
// TODO "": "", // fantom
}
var muTokenTransferEmitters sync.RWMutex
// TokenTransferEmitters will be populated with lowercase addresses
var TokenTransferEmitters = map[string]string{}
@ -258,16 +262,20 @@ func addReceiverAddressToMutation(mut *bigtable.Mutation, ts bigtable.Timestamp,
// ProcessVAA is triggered by a PubSub message, emitted after row is saved to BigTable by guardiand
func ProcessVAA(ctx context.Context, m PubSubMessage) error {
muNFTEmitters.Lock()
if len(NFTEmitters) == 0 {
for k, v := range nftEmitters {
NFTEmitters[strings.ToLower(k)] = strings.ToLower(v)
}
}
muNFTEmitters.Unlock()
muTokenTransferEmitters.Lock()
if len(TokenTransferEmitters) == 0 {
for k, v := range tokenTransferEmitters {
TokenTransferEmitters[strings.ToLower(k)] = strings.ToLower(v)
}
}
muTokenTransferEmitters.Unlock()
data := string(m.Data)
if data == "" {

View File

@ -2,8 +2,9 @@
# This script submits a VAA to devnet
set -e
vaaHex=${1}
devnetRPC=http://localhost:8545
webHost=$1
vaaHex=${2}
devnetRPC="http://${webHost}:8545"
devnetCoreAddress=0xC89Ce4735882C9F0f0FE26686c53074E09B0D550
key=4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d # one of the Ganche defaults

View File

@ -9,6 +9,9 @@ sleep 30
newNumGuardians=$1
echo "new number of guardians: ${newNumGuardians}"
webHost=$2
echo "webHost ${webHost}"
# file & path to save governance VAA
fileName=new-guardianset.prototxt
localPath=./scripts/$fileName
@ -18,7 +21,7 @@ echo "containerPath: ${containerPath}"
sock=/tmp/admin.sock
guardianPublicWebBaseUrl=http://localhost:70713
guardianPublicWebBaseUrl="${webHost}:7071"
currentGuardianSetUrl="${guardianPublicWebBaseUrl}/v1/guardianset/current"
@ -84,7 +87,7 @@ hexVaa=$(base64_to_hex ${b64Vaa})
echo "got hex VAA: ${hexVaa}"
# fire off the Golang script in clients/eth:
./scripts/send-vaa.sh $hexVaa
./scripts/send-vaa.sh $webHost $hexVaa
# give some time for guardians to observe the tx and update their state
sleep 30