Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup DoS protection on graphql node #418

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"author": "",
"license": "ISC",
"scripts": {
"api:start": "squid-graphql-server --subscriptions",
"api:start": "squid-graphql-server --subscriptions --max-root-fields 50 --max-response-size 5000",
"api:stop": "./scripts/deploy/api.sh stop",
"archive:start": "./scripts/deploy/archive.sh local up",
"archive:stop": "./scripts/deploy/archive.sh local down",
Expand Down
32 changes: 16 additions & 16 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
A type that has ss58 address format of the account. As soon as the chain
encounters any new address, they get registered here as user/pool/market account.
"""
type Account @entity {
type Account @entity @cardinality(value: 500) {
"Account address"
accountId: String!
"List of balances connected to the account"
balances: [AccountBalance]! @derivedFrom(field: "account")
balances: [AccountBalance]! @derivedFrom(field: "account") @cardinality(value: 100)
"Unique identifier of the object"
id: ID!
"Zeitgeist's identifier for market. Valid only for market account."
Expand All @@ -16,9 +16,9 @@ type Account @entity {
"""
Balance of a particular asset denoted by assetId present in the account
"""
type AccountBalance @entity {
type AccountBalance @entity @cardinality(value: 500) {
"Connected account"
account: Account!
account: Account! @cardinality(value: 1)
"Zeitgeist's identifier for asset"
assetId: String!
"Balance of the asset"
Expand All @@ -31,7 +31,7 @@ type AccountBalance @entity {
Balance history of a particular asset in an account. Records all transactions
associated with the account.
"""
type HistoricalAccountBalance @entity {
type HistoricalAccountBalance @entity @cardinality(value: 500) {
"Account address"
accountId: String! @index
"Zeitgeist's identifier for asset"
Expand All @@ -54,13 +54,13 @@ type HistoricalAccountBalance @entity {
A type that has detail of the outcome asset. It is initialised as soon as the
market is created and price is assigned when pool is deployed for the market.
"""
type Asset @entity {
type Asset @entity @cardinality(value: 500) {
"Unique identifier of the object"
id: ID!
"Zeitgeist's identifier for asset"
assetId: String!
"Connected pool"
pool: Pool!
pool: Pool! @cardinality(value: 1)
"Spot price of the asset in the pool"
price: Float!
"Balance of the asset present in the pool account"
Expand All @@ -70,7 +70,7 @@ type Asset @entity {
"""
A type that records the price history of an outcome asset.
"""
type HistoricalAsset @entity {
type HistoricalAsset @entity @cardinality(value: 500) {
"Unique identifier of the object"
id: ID!
"Account which executed the trade"
Expand Down Expand Up @@ -98,7 +98,7 @@ type HistoricalAsset @entity {
"""
A type that records the trade history of an account.
"""
type HistoricalSwap @entity {
type HistoricalSwap @entity @cardinality(value: 500) {
"Unique identifier of the object"
id: ID!
"Account which executed the trade"
Expand All @@ -122,7 +122,7 @@ type HistoricalSwap @entity {
"""
Prediction market details
"""
type Market @entity {
type Market @entity @cardinality(value: 500) {
"Address responsible for authorizing disputes. Null if Adv Comm is the authority"
authorizedAddress: String
"The base asset in the market swap pool (usually a currency)"
Expand Down Expand Up @@ -164,7 +164,7 @@ type Market @entity {
"Time period expressed in block numbers or timestamps"
period: MarketPeriod!
"Market's liquidity pool details"
pool: Pool
pool: Pool @cardinality(value: 1)
"Reasoning for market rejection"
rejectReason: String
"Reported outcome of the market. Null if the market is not reported yet"
Expand All @@ -189,7 +189,7 @@ type Market @entity {
Market history of a particular market. Records all transactions
associated with the market.
"""
type HistoricalMarket @entity {
type HistoricalMarket @entity @cardinality(value: 500) {
"Height of the block"
blockNumber: Int!
"The account that reported or disputed"
Expand All @@ -213,11 +213,11 @@ type HistoricalMarket @entity {
"""
Liquidity pool details
"""
type Pool @entity {
type Pool @entity @cardinality(value: 500) {
"Account for the pool"
account: Account!
account: Account! @cardinality(value: 1)
"List of assets connected to the pool"
assets: [Asset]! @derivedFrom(field: "pool")
assets: [Asset]! @derivedFrom(field: "pool") @cardinality(value: 20)
"The base asset in the market swap pool (usually a currency)"
baseAsset: String!
"Amount of market's base asset present in the pool"
Expand Down Expand Up @@ -248,7 +248,7 @@ type Pool @entity {
Liquidity history of a particular pool. Records all transactions
associated with the pool.
"""
type HistoricalPool @entity {
type HistoricalPool @entity @cardinality(value: 500) {
"New amount of market's base asset present in the pool"
baseAssetQty: BigInt
"Height of the block"
Expand Down