From 098d0aa8594d2b5044348b9359ee395d7a85c456 Mon Sep 17 00:00:00 2001 From: John-Alan Simmons Date: Mon, 22 Apr 2024 02:58:50 -0400 Subject: [PATCH] Updated cosmos bulletin subscription to gurantee delivery --- Makefile | 4 ++++ demo/acp/compose.yaml | 12 +++--------- demo/acp/sourcehub-init.sh | 4 ++++ docker-compose.yaml | 4 ++-- pkg/bulletin/sourcehub/bulletin.go | 3 ++- pkg/dkg/rabin/rabin.go | 2 +- 6 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index ffcae87..3b4d79c 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,10 @@ run: docker-compose -f demo/acp/compose.yaml down -v docker-compose -f demo/acp/compose.yaml up +run-large: + docker-compose -f demo/acp-large/compose.yaml down -v + docker-compose -f demo/acp-large/compose.yaml up + rund: docker-compose -f demo/compose.yaml down -v diff --git a/demo/acp/compose.yaml b/demo/acp/compose.yaml index 8ed08e9..2fec872 100644 --- a/demo/acp/compose.yaml +++ b/demo/acp/compose.yaml @@ -15,6 +15,9 @@ volumes: o: bind x-orbisd: &orbisd + depends_on: + sourcehubd: + condition: service_started tty: true stdin_open: true image: ko.local/orbisd @@ -28,9 +31,6 @@ x-orbisd: &orbisd services: orbisd1: <<: *orbisd - depends_on: - sourcehubd: - condition: service_started command: ["start", "--config", "/demo/orbis.1.yaml"] ports: - "9001:9001" @@ -39,9 +39,6 @@ services: orbisd2: <<: *orbisd - depends_on: - sourcehubd: - condition: service_started command: ["start", "--config", "/demo/orbis.2.yaml"] ports: - "9002:9002" @@ -50,9 +47,6 @@ services: orbisd3: <<: *orbisd - depends_on: - sourcehubd: - condition: service_started command: ["start", "--config", "/demo/orbis.3.yaml"] ports: - "9003:9003" diff --git a/demo/acp/sourcehub-init.sh b/demo/acp/sourcehub-init.sh index ab7b0e8..e4f239c 100755 --- a/demo/acp/sourcehub-init.sh +++ b/demo/acp/sourcehub-init.sh @@ -4,6 +4,7 @@ MONIKER=demo VALIDATOR1=validator1 VALIDATOR2=validator2 VALIDATOR3=validator3 +VALIDATOR4=validator4 ALICE=alice BOB=bob @@ -12,6 +13,7 @@ sourcehubd init $MONIKER --chain-id sourcehub sourcehubd keys add ${VALIDATOR1} --keyring-backend test sourcehubd keys add ${VALIDATOR2} --keyring-backend test sourcehubd keys add ${VALIDATOR3} --keyring-backend test +sourcehubd keys add ${VALIDATOR4} --keyring-backend test # Static keys for testing # Alice Address source16dgy2uw5p74a0pzuwmq0hpl44xzn2yfauxfc70 @@ -27,12 +29,14 @@ cat /demo/bob.seed | sourcehubd keys add ${BOB} --recover --keyring-backend test VALIDATOR1_ADDRESS=$(sourcehubd keys show ${VALIDATOR1} --address --keyring-backend test) VALIDATOR2_ADDRESS=$(sourcehubd keys show ${VALIDATOR2} --address --keyring-backend test) VALIDATOR3_ADDRESS=$(sourcehubd keys show ${VALIDATOR3} --address --keyring-backend test) +VALIDATOR4_ADDRESS=$(sourcehubd keys show ${VALIDATOR4} --address --keyring-backend test) ALICE_ADDRESS=$(sourcehubd keys show ${ALICE} --address --keyring-backend test) BOB_ADDRESS=$(sourcehubd keys show ${BOB} --address --keyring-backend test) sourcehubd genesis add-genesis-account $VALIDATOR1_ADDRESS 100000000stake sourcehubd genesis add-genesis-account $VALIDATOR2_ADDRESS 100000000stake sourcehubd genesis add-genesis-account $VALIDATOR3_ADDRESS 100000000stake +sourcehubd genesis add-genesis-account $VALIDATOR4_ADDRESS 100000stake sourcehubd genesis add-genesis-account $ALICE_ADDRESS 100000stake sourcehubd genesis add-genesis-account $BOB_ADDRESS 100000stake diff --git a/docker-compose.yaml b/docker-compose.yaml index 76368b8..255886f 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -26,13 +26,13 @@ services: depends_on: sourcehubd: condition: service_started - + # default image runs as user 'node' image: ghcr.io/sourcenetwork/orbis:0.2.2 volumes: - orbis-data:/home/node/.orbis - sourcehub-data:/home/node/.sourcehub # Needed to access sourcehub cli keyring - command: ["start", "--config", "/home/node/.orbis/orbis.yml"] + command: ["start", "--config", "/home/node/.orbis/orbis.yaml"] ports: - "9000:9000" # P2P - "8080:8080" # GRPC API diff --git a/pkg/bulletin/sourcehub/bulletin.go b/pkg/bulletin/sourcehub/bulletin.go index 104a348..6ea485f 100644 --- a/pkg/bulletin/sourcehub/bulletin.go +++ b/pkg/bulletin/sourcehub/bulletin.go @@ -54,7 +54,7 @@ func (bb *Bulletin) Name() string { } func (bb *Bulletin) Init(ctx context.Context) error { - resultsCh, err := bb.client.RPC.Subscribe(ctx, "", "tm.event='Tx' AND NewPost.payload EXISTS") + resultsCh, err := bb.client.RPC.Subscribe(ctx, "", "tm.event='Tx' AND NewPost.payload EXISTS", 0) if err != nil { return fmt.Errorf("subscribe to namespace: %w", err) } @@ -236,6 +236,7 @@ func (bb *Bulletin) HandleEvents() { ID: namespace, } + log.Debugf("bulletin recieved event: %s", namespace) err = eventbus.Publish(bb.bus, evt) if err != nil { log.Warnf("failed to publish event to channel: %w", err) diff --git a/pkg/dkg/rabin/rabin.go b/pkg/dkg/rabin/rabin.go index 96186ae..c06128f 100644 --- a/pkg/dkg/rabin/rabin.go +++ b/pkg/dkg/rabin/rabin.go @@ -350,7 +350,7 @@ func (d *dkg) Start(ctx context.Context) error { log.Debug("Starting rabin DKG") - d.connectToPeers(ctx) + // d.connectToPeers(ctx) log.Debug("Generating and persisting deals")