Skip to content

Commit

Permalink
Merge pull request #332 from input-output-hk/fix/remove-invalid-shell…
Browse files Browse the repository at this point in the history
…ey-genesis-field

fix: remove invalid Genesis.shelley.protocolMagicId
  • Loading branch information
rhyslbw committed Oct 6, 2020
2 parents 9476b4f + a73ba1e commit f7b2426
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 156 deletions.
2 changes: 1 addition & 1 deletion packages/api-genesis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"cleanup": "shx rm -rf dist node_modules src/graphql_types.ts",
"lint": "eslint --ignore-path ../../.eslintignore \"**/*.ts\"",
"prepack": "yarn build",
"test": "shx echo Temporarily disabled"
"test": "yarn build && NODE_ENV=test jest -c ./test/jest.config.js query"
},
"repository": {
"type": "git",
Expand Down
1 change: 0 additions & 1 deletion packages/api-genesis/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ type ShelleyGenesis {
maxLovelaceSupply: String!
networkId: String!
networkMagic: Int!
protocolMagicId: Int!
protocolParams: ShelleyProtocolParams!
securityParam: Int!
slotLength: Int!
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
query allInfo {
query keyNetworkInfo {
genesis {
byron {
blockVersionData {
scriptVersion
slotDuration
maxBlockSize
maxHeaderSize
maxProposalSize
maxTxSize
}
startTime
protocolConsts {
k
protocolMagic
}
}
shelley {
activeSlotsCoeff
epochLength
Expand All @@ -9,7 +24,6 @@ query allInfo {
maxLovelaceSupply
networkId
networkMagic
protocolMagicId
protocolParams {
a0
decentralisationParam
Expand Down

This file was deleted.

This file was deleted.

135 changes: 55 additions & 80 deletions packages/api-genesis/test/__snapshots__/genesis.query.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,116 +1,91 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`genesis Single-era Returns all information from genesis.json 1`] = `
exports[`genesis Returns key information about the network genesis 1`] = `
Object {
"genesis": Object {
"byron": Object {
"blockVersionData": Object {
"maxBlockSize": 2000000,
"maxHeaderSize": 2000000,
"maxProposalSize": 700,
"maxTxSize": 4096,
"scriptVersion": 0,
"slotDuration": 20000,
},
"protocolConsts": Object {
"k": 2160,
"protocolMagic": 764824073,
},
"startTime": 1506203091,
},
"shelley": Object {
"activeSlotsCoeff": 0.05,
"epochLength": 21600,
"epochLength": 432000,
"genDelegs": Object {
"46accc160a32598fd87b14d823fd25ec6ca3388316c404ce5aa06dca": Object {
"delegate": "e47b777efea3146b1aa18fde95ddbd3de38f068f529997ff4141e484",
"vrf": "56c2364bb4a90d0f674ae1b758d5c19b2f1622b3f763799f1f0793cfc4591daf",
"162f94554ac8c225383a2248c245659eda870eaa82d0ef25fc7dcd82": Object {
"delegate": "4485708022839a7b9b8b639a939c85ec0ed6999b5b6dc651b03c43f6",
"vrf": "aba81e764b71006c515986bf7b37a72fbb5554f78e6775f08e384dbd572a4b32",
},
"c800db9af0cfe4997163e730ff2eeadc984f4ed29bdfeed37fb87c05": Object {
"delegate": "252a3464a2e6d3e824e3dc63629276838227f92f2c6b6cc45fc16138",
"vrf": "ca23e0093e70086bf92788f0efcbe45c1727f19d4376a94118d5bfaebdcca257",
"2075a095b3c844a29c24317a94a643ab8e22d54a3a3a72a420260af6": Object {
"delegate": "6535db26347283990a252313a7903a45e3526ec25ddba381c071b25b",
"vrf": "fcaca997b8105bd860876348fc2c6e68b13607f9bbd23515cd2193b555d267af",
},
"cbdf7c87a498440cc16fb16b6d3a957de7979252de695e38344aee52": Object {
"delegate": "609114bdfa04f8fa2dc3450306427a6bb803a1cce84a2c3c760a7e4b",
"vrf": "48a39ab96ed61faa76b69a08f39282e6a4fb458020e024ee6b612c93f4439c99",
"268cfc0b89e910ead22e0ade91493d8212f53f3e2164b2e4bef0819b": Object {
"delegate": "1d4f2e1fda43070d71bb22a5522f86943c7c18aeb4fa47a362c27e23",
"vrf": "63ef48bc5355f3e7973100c371d6a095251c80ceb40559f4750aa7014a6fb6db",
},
"60baee25cbc90047e83fd01e1e57dc0b06d3d0cb150d0ab40bbfead1": Object {
"delegate": "7f72a1826ae3b279782ab2bc582d0d2958de65bd86b2c4f82d8ba956",
"vrf": "c0546d9aa5740afd569d3c2d9c412595cd60822bb6d9a4e8ce6c43d12bd0f674",
},
"ad5463153dc3d24b9ff133e46136028bdc1edbb897f5a7cf1b37950c": Object {
"delegate": "d9e5c76ad5ee778960804094a389f0b546b5c2b140a62f8ec43ea54d",
"vrf": "64fa87e8b29a5b7bfbd6795677e3e878c505bc4a3649485d366b50abadec92d7",
},
"b9547b8a57656539a8d9bc42c008e38d9c8bd9c8adbb1e73ad529497": Object {
"delegate": "855d6fc1e54274e331e34478eeac8d060b0b90c1f9e8a2b01167c048",
"vrf": "66d5167a1f426bd1adcc8bbf4b88c280d38c148d135cb41e3f5a39f948ad7fcc",
},
"f7b341c14cd58fca4195a9b278cce1ef402dc0e06deb77e543cd1757": Object {
"delegate": "69ae12f9e45c0c9122356c8e624b1fbbed6c22a2e3b4358cf0cb5011",
"vrf": "6394a632af51a32768a6f12dac3485d9c0712d0b54e3f389f355385762a478f2",
},
},
"initialFunds": Object {
"6034d2c8b6373a4a3326259c1fbccfc45405bd20552097d960868b40a9": 10000000000000000,
"6051d08fc78ca26cfc41b839f6c30b25ccf45f81594d4147a6f392a058": 1000000000000000,
},
"maxKESEvolutions": 120,
"initialFunds": Object {},
"maxKESEvolutions": 62,
"maxLovelaceSupply": "45000000000000000",
"networkId": "Testnet",
"networkMagic": 42,
"protocolMagicId": 42,
"networkId": "Mainnet",
"networkMagic": 764824073,
"protocolParams": Object {
"a0": 0.3,
"decentralisationParam": 1,
"eMax": 18,
"extraEntropy": Object {
"tag": "NeutralNonce",
},
"keyDeposit": 400000,
"keyDeposit": 2000000,
"maxBlockBodySize": 65536,
"maxBlockHeaderSize": 1100,
"maxTxSize": 16384,
"minFeeA": 44,
"minFeeB": 155381,
"minPoolCost": 0,
"minUTxOValue": 0,
"nOpt": 250,
"minPoolCost": 340000000,
"minUTxOValue": 1000000,
"nOpt": 150,
"poolDeposit": 500000000,
"protocolVersion": Object {
"major": 0,
"major": 2,
"minor": 0,
},
"rho": 0.0022,
"tau": 0.05,
},
"securityParam": 108,
"slotLength": 1,
"slotsPerKESPeriod": 3600,
"staking": Object {
"pools": Object {},
"stake": Object {},
},
"systemStart": "2020-07-13T11:00:00Z",
"updateQuorum": 3,
},
},
}
`;

exports[`genesis Single-era Returns key information about the network 1`] = `
Object {
"genesis": Object {
"shelley": Object {
"epochLength": 21600,
"maxLovelaceSupply": "45000000000000000",
"networkId": "Testnet",
"networkMagic": 42,
"securityParam": 108,
"slotLength": 1,
"slotsPerKESPeriod": 3600,
"systemStart": "2020-07-13T11:00:00Z",
},
},
}
`;

exports[`genesis Spanning-eras Returns key information about the network 1`] = `
Object {
"genesis": Object {
"byron": Object {
"blockVersionData": Object {
"maxBlockSize": 2000000,
"maxHeaderSize": 2000000,
"maxProposalSize": 700,
"maxTxSize": 4096,
"scriptVersion": 0,
"slotDuration": 20000,
},
"protocolConsts": Object {
"k": 2160,
"protocolMagic": 764824073,
"rho": 0.003,
"tau": 0.2,
},
"startTime": 1506203091,
},
"shelley": Object {
"epochLength": 432000,
"maxLovelaceSupply": "45000000000000000",
"networkId": "Mainnet",
"networkMagic": 764824073,
"securityParam": 2160,
"slotLength": 1,
"slotsPerKESPeriod": 129600,
"staking": null,
"systemStart": "2017-09-23T21:44:51Z",
"updateQuorum": 5,
},
},
}
Expand Down
35 changes: 6 additions & 29 deletions packages/api-genesis/test/genesis.query.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ const genesisFiles = {
mainnet: {
byron: require('../../../config/network/mainnet/genesis/byron.json'),
shelley: require('../../../config/network/mainnet/genesis/shelley.json')
},
shelley_testnet: {
shelley: require('../../../config/network/shelley_testnet/genesis_shelley.json')
}
}

Expand All @@ -21,33 +18,13 @@ function loadQueryNode (name: string): Promise<DocumentNode> {
describe('genesis', () => {
let client: TestClient

describe('Single-era', () => {
beforeAll(async () => {
client = await buildClient(genesisFiles.shelley_testnet)
})

it('Returns key information about the network', async () => {
const query = { query: await loadQueryNode('keyNetworkInfoShelley') }
const result = await client.query(query)
expect(result.data).toMatchSnapshot()
})

it('Returns all information from genesis.json', async () => {
const query = { query: await loadQueryNode('allInfoShelley') }
const result = await client.query(query)
expect(result.data).toMatchSnapshot()
})
beforeAll(async () => {
client = await buildClient(genesisFiles.mainnet)
})

describe('Spanning-eras', () => {
beforeAll(async () => {
client = await buildClient(genesisFiles.mainnet)
})

it('Returns key information about the network', async () => {
const query = { query: await loadQueryNode('keyNetworkInfoByronShelley') }
const result = await client.query(query)
expect(result.data).toMatchSnapshot()
})
it('Returns key information about the network genesis', async () => {
const query = { query: await loadQueryNode('keyNetworkInfo') }
const result = await client.query(query)
expect(result.data).toMatchSnapshot()
})
})

0 comments on commit f7b2426

Please sign in to comment.