Skip to content

Commit 81bb80c

Browse files
committed
Merge branch 'main' into ray-docs-releasenotes
Signed-off-by: Nicko Guyer <[email protected]>
2 parents 5e637db + 1b7dc9b commit 81bb80c

17 files changed

+260
-31
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-- No down migration for this one
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
BEGIN;
2+
3+
ALTER TABLE contractlisteners ALTER COLUMN location DROP NOT NULL;
4+
5+
COMMIT;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-- No down migration for this one
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ALTER TABLE contractlisteners RENAME COLUMN location TO location_old;
2+
ALTER TABLE contractlisteners ADD COLUMN location TEXT;
3+
UPDATE contractlisteners SET location = location_old;
4+
ALTER TABLE contractlisteners DROP COLUMN location_old;

docker_build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ docker buildx build \
4646
--build-arg BASE_TAG=$BASE_TAG \
4747
--build-arg UI_TAG=$UI_TAG \
4848
--build-arg UI_RELEASE=$UI_RELEASE \
49+
--load \
4950
$@ \
5051
.
5152
docker buildx rm firefly

docs/tutorials/create_custom_identity.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@ nav_order: 8
66
---
77

88
# Create a Custom Identity
9-
109
{: .no_toc }
1110

1211
## Table of contents
13-
1412
{: .no_toc .text-delta }
1513

1614
1. TOC
17-
{:toc}
15+
{:toc}
1816

1917
---
2018

internal/blockchain/ethereum/ethereum.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -742,10 +742,13 @@ func encodeContractLocation(ctx context.Context, location *Location) (result *ff
742742
return result, err
743743
}
744744

745-
func (e *Ethereum) AddContractListener(ctx context.Context, listener *core.ContractListenerInput) error {
746-
location, err := parseContractLocation(ctx, listener.Location)
747-
if err != nil {
748-
return err
745+
func (e *Ethereum) AddContractListener(ctx context.Context, listener *core.ContractListenerInput) (err error) {
746+
var location *Location
747+
if listener.Location != nil {
748+
location, err = parseContractLocation(ctx, listener.Location)
749+
if err != nil {
750+
return err
751+
}
749752
}
750753
abi, err := ffi2abi.ConvertFFIEventDefinitionToABI(ctx, &listener.Event.FFIEventDefinition)
751754
if err != nil {

internal/blockchain/ethereum/ethereum_test.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,6 +1689,43 @@ func TestAddSubscription(t *testing.T) {
16891689
assert.NoError(t, err)
16901690
}
16911691

1692+
func TestAddSubscriptionWithoutLocation(t *testing.T) {
1693+
e, cancel := newTestEthereum()
1694+
defer cancel()
1695+
httpmock.ActivateNonDefault(e.client.GetClient())
1696+
defer httpmock.DeactivateAndReset()
1697+
e.streamID = "es-1"
1698+
e.streams = &streamManager{
1699+
client: e.client,
1700+
}
1701+
1702+
sub := &core.ContractListenerInput{
1703+
ContractListener: core.ContractListener{
1704+
Event: &core.FFISerializedEvent{
1705+
FFIEventDefinition: fftypes.FFIEventDefinition{
1706+
Name: "Changed",
1707+
Params: fftypes.FFIParams{
1708+
{
1709+
Name: "value",
1710+
Schema: fftypes.JSONAnyPtr(`{"type": "string", "details": {"type": "string"}}`),
1711+
},
1712+
},
1713+
},
1714+
},
1715+
Options: &core.ContractListenerOptions{
1716+
FirstEvent: string(core.SubOptsFirstEventOldest),
1717+
},
1718+
},
1719+
}
1720+
1721+
httpmock.RegisterResponder("POST", `http://localhost:12345/subscriptions`,
1722+
httpmock.NewJsonResponderOrPanic(200, &subscription{}))
1723+
1724+
err := e.AddContractListener(context.Background(), sub)
1725+
1726+
assert.NoError(t, err)
1727+
}
1728+
16921729
func TestAddSubscriptionBadParamDetails(t *testing.T) {
16931730
e, cancel := newTestEthereum()
16941731
defer cancel()

internal/blockchain/ethereum/eventstream.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,16 @@ func (s *streamManager) createSubscription(ctx context.Context, location *Locati
184184
fromBlock = "latest"
185185
}
186186
sub := subscription{
187-
Name: subName,
188-
Stream: stream,
189-
FromBlock: fromBlock,
190-
EthCompatAddress: location.Address,
191-
EthCompatEvent: abi,
187+
Name: subName,
188+
Stream: stream,
189+
FromBlock: fromBlock,
190+
EthCompatEvent: abi,
192191
}
192+
193+
if location != nil {
194+
sub.EthCompatAddress = location.Address
195+
}
196+
193197
res, err := s.client.R().
194198
SetContext(ctx).
195199
SetBody(&sub).

internal/blockchain/fabric/eventstream.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,15 @@ func (s *streamManager) createSubscription(ctx context.Context, location *Locati
165165
Signer: s.signer,
166166
Stream: stream,
167167
Filter: eventFilter{
168-
ChaincodeID: location.Chaincode,
169168
EventFilter: event,
170169
},
171170
FromBlock: fromBlock,
172171
}
172+
173+
if location.Chaincode != "" {
174+
sub.Filter.ChaincodeID = location.Chaincode
175+
}
176+
173177
res, err := s.client.R().
174178
SetContext(ctx).
175179
SetBody(&sub).

0 commit comments

Comments
 (0)