Skip to content

Commit

Permalink
Updated cosmos bulletin subscription to gurantee delivery
Browse files Browse the repository at this point in the history
  • Loading branch information
jsimnz committed Apr 22, 2024
1 parent fc8caac commit 098d0aa
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 13 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 3 additions & 9 deletions demo/acp/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -39,9 +39,6 @@ services:

orbisd2:
<<: *orbisd
depends_on:
sourcehubd:
condition: service_started
command: ["start", "--config", "/demo/orbis.2.yaml"]
ports:
- "9002:9002"
Expand All @@ -50,9 +47,6 @@ services:

orbisd3:
<<: *orbisd
depends_on:
sourcehubd:
condition: service_started
command: ["start", "--config", "/demo/orbis.3.yaml"]
ports:
- "9003:9003"
Expand Down
4 changes: 4 additions & 0 deletions demo/acp/sourcehub-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ MONIKER=demo
VALIDATOR1=validator1
VALIDATOR2=validator2
VALIDATOR3=validator3
VALIDATOR4=validator4
ALICE=alice
BOB=bob

Expand All @@ -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
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion pkg/bulletin/sourcehub/bulletin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/dkg/rabin/rabin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit 098d0aa

Please sign in to comment.