Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

[CAD-1838] Add whitelisting (listing) to return delisted. #87

Merged
merged 1 commit into from
Oct 1, 2020

Conversation

ksaric
Copy link
Contributor

@ksaric ksaric commented Oct 1, 2020

https://jira.iohk.io/browse/CAD-1838

Tested on shelley-qa node.

Testing instructions follow.

We have a valid offline metadata:

$> curl --verbose --header "Content-Type: application/json" http://localhost:3100/api/v1/metadata/fc80a2a814338475c737df5d1c50253046c8c04eb3663336af7beb38/93cf2f2fead6c419ccaae1a41f0786de4b9daefea7074d7bda3d288e76e20a97

*   Trying 127.0.0.1:3100...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 3100 (#0)
> GET /api/v1/metadata/fc80a2a814338475c737df5d1c50253046c8c04eb3663336af7beb38/93cf2f2fead6c419ccaae1a41f0786de4b9daefea7074d7bda3d288e76e20a97 HTTP/1.1
> Host: localhost:3100
> User-Agent: curl/7.68.0
> Accept: */*
> Content-Type: application/json
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Transfer-Encoding: chunked
< Date: Thu, 01 Oct 2020 12:10:42 GMT
< Server: Warp/3.3.5
< Content-Type: application/json;charset=utf-8
< Cache: always
< 
* Connection #0 to host localhost left intact
{"name": "IOG 3", "description": "IOG Testnet Pool (Private)", "ticker": "IOG3", "homepage": "https://iohk.io"}

We delist a specific pool:

$> curl --user ksaric:cirask --verbose --header "Content-Type: application/json" --request PATCH --data '{"poolId":"fc80a2a814338475c737df5d1c50253046c8c04eb3663336af7beb38"}' http://localhost:3100/api/v1/delist

*   Trying 127.0.0.1:3100...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 3100 (#0)
* Server auth using Basic with user 'ksaric'
> PATCH /api/v1/delist HTTP/1.1
> Host: localhost:3100
> Authorization: Basic a3NhcmljOmNpcmFzaw==
> User-Agent: curl/7.68.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 69
> 
* upload completely sent off: 69 out of 69 bytes
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Transfer-Encoding: chunked
< Date: Thu, 01 Oct 2020 12:10:42 GMT
< Server: Warp/3.3.5
< Content-Type: application/json;charset=utf-8
< 
* Connection #0 to host localhost left intact
{"poolId":"fc80a2a814338475c737df5d1c50253046c8c04eb3663336af7beb38"}

We try to fetch the metadata, but since the pool id was delisted, we can't get that info (403):

$> curl --verbose --header "Content-Type: application/json" http://localhost:3100/api/v1/metadata/fc80a2a814338475c737df5d1c50253046c8c04eb3663336af7beb38/93cf2f2fead6c419ccaae1a41f0786de4b9daefea7074d7bda3d288e76e20a97

*   Trying 127.0.0.1:3100...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 3100 (#0)
> GET /api/v1/metadata/fc80a2a814338475c737df5d1c50253046c8c04eb3663336af7beb38/93cf2f2fead6c419ccaae1a41f0786de4b9daefea7074d7bda3d288e76e20a97 HTTP/1.1
> Host: localhost:3100
> User-Agent: curl/7.68.0
> Accept: */*
> Content-Type: application/json
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 403 Forbidden
< Transfer-Encoding: chunked
< Date: Thu, 01 Oct 2020 12:10:42 GMT
< Server: Warp/3.3.5
< 
* Connection #0 to host localhost left intact

We then enlist the pool id:

$> curl --user ksaric:cirask --verbose --header "Content-Type: application/json" --request PATCH --data '{"poolId":"fc80a2a814338475c737df5d1c50253046c8c04eb3663336af7beb38"}' http://localhost:3100/api/v1/enlist

*   Trying 127.0.0.1:3100...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 3100 (#0)
* Server auth using Basic with user 'ksaric'
> PATCH /api/v1/enlist HTTP/1.1
> Host: localhost:3100
> Authorization: Basic a3NhcmljOmNpcmFzaw==
> User-Agent: curl/7.68.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 69
> 
* upload completely sent off: 69 out of 69 bytes
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Transfer-Encoding: chunked
< Date: Thu, 01 Oct 2020 12:10:42 GMT
< Server: Warp/3.3.5
< Content-Type: application/json;charset=utf-8
< 
* Connection #0 to host localhost left intact
{"poolId":"fc80a2a814338475c737df5d1c50253046c8c04eb3663336af7beb38"}

And then the metadata is available again:

$> curl --verbose --header "Content-Type: application/json" http://localhost:3100/api/v1/metadata/fc80a2a814338475c737df5d1c50253046c8c04eb3663336af7beb38/93cf2f2fead6c419ccaae1a41f0786de4b9daefea7074d7bda3d288e76e20a97

*   Trying 127.0.0.1:3100...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 3100 (#0)
> GET /api/v1/metadata/fc80a2a814338475c737df5d1c50253046c8c04eb3663336af7beb38/93cf2f2fead6c419ccaae1a41f0786de4b9daefea7074d7bda3d288e76e20a97 HTTP/1.1
> Host: localhost:3100
> User-Agent: curl/7.68.0
> Accept: */*
> Content-Type: application/json
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Transfer-Encoding: chunked
< Date: Thu, 01 Oct 2020 12:10:42 GMT
< Server: Warp/3.3.5
< Content-Type: application/json;charset=utf-8
< Cache: always
< 
* Connection #0 to host localhost left intact
{"name": "IOG 3", "description": "IOG Testnet Pool (Private)", "ticker": "IOG3", "homepage": "https://iohk.io"}%  

@ksaric ksaric merged commit 6cfba0b into master Oct 1, 2020
@iohk-bors iohk-bors bot deleted the ksaric/CAD-1838 branch October 1, 2020 12:31
@ksaric ksaric mentioned this pull request Oct 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant