Skip to content

Commit

Permalink
feat(info observer): advertise the contract ID in use PE-4894
Browse files Browse the repository at this point in the history
This allows gateways to indicate which contract they are using. Of
course, there is no way to verify that the gateway is indeed using that
contract for anything. But the contract state includes the hostname, so
if the contract state includes the gateway in question and the gateway
points to the contract, you can reasonably assume that the wallet holder
and the gateway operator desire to use that contract.

Note: this is not true on the observer side. The contract state does not
contain a hostname for the observer (it could be different from the
gateway host). Thus, the observer advertised contract ID should be
viewed as a convenience only. On-chain interactions are how observers
indicate which contract they are using.
  • Loading branch information
djwhitt committed Oct 26, 2023
1 parent c3856b3 commit 4dd26c8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ services:
- ARNS_ROOT_HOST=${ARNS_ROOT_HOST:-}
- SANDBOX_PROTOCOL=${SANDBOX_PROTOCOL:-}
- START_WRITERS=${START_WRITERS:-}
- CONTRACT_ID=${CONTRACT_ID:-bLAgYxAdX2Ry-nt6aH2ixgvJXbpsEYm28NgJgyqfs-U}

observer:
image: ghcr.io/ar-io/ar-io-observer:${OBSERVER_IMAGE_TAG:-6423f03c3ad6c3b2743f07a95d5d80ad48fffe9f}
image: ghcr.io/ar-io/ar-io-observer:${OBSERVER_IMAGE_TAG:-42c909257f9907f2aef9957b70474207f0cfc78d}
ports:
- 5000:5000
volumes:
Expand All @@ -63,4 +64,5 @@ services:
environment:
- PORT=5000
- OBSERVER_WALLET=${OBSERVER_WALLET:-<example>}
- CONTRACT_ID=${CONTRACT_ID:-bLAgYxAdX2Ry-nt6aH2ixgvJXbpsEYm28NgJgyqfs-U}
- RUN_OBSERVER=${RUN_OBSERVER:-true}
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,4 @@ export const ROOT_HOST_SUBDOMAIN_LENGTH =
export const SANDBOX_PROTOCOL = env.varOrUndefined('SANDBOX_PROTOCOL');
export const START_WRITERS =
env.varOrDefault('START_WRITERS', 'true') === 'true';
export const CONTRACT_ID = env.varOrUndefined('CONTRACT_ID');
1 change: 1 addition & 0 deletions src/routes/ar-io.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ arIoRouter.get('/ar-io/healthcheck', (_req, res) => {
arIoRouter.get('/ar-io/info', (_req, res) => {
res.status(200).send({
wallet: config.AR_IO_WALLET,
contractId: config.CONTRACT_ID,
});
});

Expand Down

0 comments on commit 4dd26c8

Please sign in to comment.