diff --git a/parachain/config-dup.json b/parachain/config-dup.json new file mode 100644 index 0000000000..cb428441dd --- /dev/null +++ b/parachain/config-dup.json @@ -0,0 +1,699 @@ +{ + "relaychain": { + "bin": "/tmp/polkadot/target/release/polkadot", + "chain": "rococo-local", + "nodes": [ + { + "name": "alice", + "wsPort": 9944, + "port": 30444, + "flags": [ + "--enable-offchain-indexing=true", + "--offchain-worker=Always" + ] + }, + { + "name": "bob", + "wsPort": 9955, + "port": 30555, + "flags": [ + "--enable-offchain-indexing=true", + "--offchain-worker=Always" + ] + }, + { + "name": "eve", + "wsPort": 9956, + "port": 30556, + "flags": [ + "--enable-offchain-indexing=true", + "--offchain-worker=Always" + ] + } + ] + }, + "parachains": [ + { + "bin": "target/release/artemis", + "id": "200", + "wsPort": 9966, + "port": 30666, + "flags": [ + "-lbasic_authorship=trace,commitments=debug,import_header=trace,runtime=debug,submit_messages=trace", + "--rpc-port=9980", + "--offchain-worker=Always", + "--enable-offchain-indexing=true", + "--", + "--execution=wasm" + ] + }, + { + "bin": "target/release/artemis", + "id": "201", + "wsPort": 9967, + "port": 30667, + "flags": [ + "-lbasic_authorship=trace,commitments=debug,import_header=trace,runtime=debug,submit_messages=trace", + "--rpc-port=9981", + "--offchain-worker=Always", + "--enable-offchain-indexing=true", + "--", + "--execution=wasm" + ] + } + ], + "simpleParachains": [], + "hrmpChannels": [], + "types": { + "HrmpChannel": { + "maxCapacity": "u32", + "maxTotalSize": "u32", + "maxMessageSize": "u32", + "msgCount": "u32", + "totalSize": "u32", + "mqcHead": "Option", + "senderDeposit": "Balance", + "recipientDeposit": "Balance" + }, + "HrmpChannelId": { + "sender": "u32", + "receiver": "u32" + }, + "HrmpOpenChannelRequest": { + "confirmed": "bool", + "age": "SessionIndex", + "senderDeposit": "Balance", + "maxMessageSize": "u32", + "maxCapacity": "u32", + "maxTotalSize": "u32" + }, + "ParachainProposal": { + "proposer": "AccountId", + "genesisHead": "HeadData", + "validators": "Vec", + "name": "Bytes", + "balance": "Balance" + }, + "RegisteredParachainInfo": { + "validators": "Vec", + "proposer": "AccountId" + }, + "ServiceQuality": { + "_enum": [ + "Ordered", + "Fast" + ] + }, + "AbridgedCandidateReceipt": { + "parachainIndex": "ParaId", + "relayParent": "Hash", + "headData": "HeadData", + "collator": "CollatorId", + "signature": "CollatorSignature", + "povBlockHash": "Hash", + "commitments": "CandidateCommitments" + }, + "AbridgedHostConfiguration": { + "maxCodeSize": "u32", + "maxHeadDataSize": "u32", + "maxUpwardQueueCount": "u32", + "maxUpwardQueueSize": "u32", + "maxUpwardMessageSize": "u32", + "maxUpwardMessageNumPerCandidate": "u32", + "hrmpMaxMessageNumPerCandidate": "u32", + "validationUpgradeFrequency": "BlockNumber", + "validationUpgradeDelay": "BlockNumber" + }, + "AbridgedHrmpChannel": { + "maxCapacity": "u32", + "maxTotalSize": "u32", + "maxMessageSize": "u32", + "msgCount": "u32", + "totalSize": "u32", + "mqcHead": "Option" + }, + "AssignmentId": "AccountId", + "AssignmentKind": { + "_enum": { + "Parachain": "Null", + "Parathread": "(CollatorId, u32)" + } + }, + "AttestedCandidate": { + "candidate": "AbridgedCandidateReceipt", + "validityVotes": "Vec", + "validatorIndices": "BitVec" + }, + "AuthorityDiscoveryId": "AccountId", + "AvailabilityBitfield": "BitVec", + "AvailabilityBitfieldRecord": { + "bitfield": "AvailabilityBitfield", + "submittedTt": "BlockNumber" + }, + "BackedCandidate": { + "candidate": "CommittedCandidateReceipt", + "validityVotes": "Vec", + "validatorIndices": "BitVec" + }, + "BufferedSessionChange": { + "applyAt": "BlockNumber", + "validators": "Vec", + "queued": "Vec", + "sessionIndex": "SessionIndex" + }, + "CandidateCommitments": { + "upwardMessages": "Vec", + "horizontalMessages": "Vec", + "newValidationCode": "Option", + "headData": "HeadData", + "processedDownwardMessages": "u32", + "hrmpWatermark": "BlockNumber" + }, + "CandidateDescriptor": { + "paraId": "ParaId", + "relayParent": "RelayChainHash", + "collatorId": "CollatorId", + "persistedValidationDataHash": "Hash", + "povHash": "Hash", + "erasureRoot": "Hash", + "signature": "CollatorSignature", + "paraHead": "Hash", + "validationCodeHash": "Hash" + }, + "CandidateHash": "Hash", + "CandidatePendingAvailability": { + "core": "CoreIndex", + "hash": "CandidateHash", + "descriptor": "CandidateDescriptor", + "availabilityVotes": "BitVec", + "backers": "BitVec", + "relayParentNumber": "BlockNumber", + "backedInNumber": "BlockNumber" + }, + "CandidateReceipt": { + "descriptor": "CandidateDescriptor", + "commitmentsHash": "Hash" + }, + "GlobalValidationData": { + "maxCodeSize": "u32", + "maxHeadDataSize": "u32", + "blockNumber": "BlockNumber" + }, + "CollatorId": "H256", + "CollatorSignature": "Signature", + "CommittedCandidateReceipt": { + "descriptor": "CandidateDescriptor", + "commitments": "CandidateCommitments" + }, + "CoreAssignment": { + "core": "CoreIndex", + "paraId": "ParaId", + "kind": "AssignmentKind", + "groupIdx": "GroupIndex" + }, + "CoreIndex": "u32", + "CoreOccupied": { + "_enum": { + "Parathread": "ParathreadEntry", + "Parachain": "Null" + } + }, + "DisputeStatementSet": { + "candidateHash": "CandidateHash", + "session": "SessionIndex", + "statements": "Vec<(DisputeStatement, ValidatorIndex, ValidatorSignature)>" + }, + "MultiDisputeStatementSet": "Vec", + "DisputeStatement": { + "_enum": { + "Valid": "ValidDisputeStatementKind", + "Invalid": "InvalidDisputeStatementKind" + } + }, + "ValidDisputeStatementKind": { + "_enum": [ + "Explicit", + "BackingSeconded", + "BackingValid", + "ApprovalChecking" + ] + }, + "InvalidDisputeStatementKind": { + "_enum": [ + "Explicit" + ] + }, + "ExplicitDisputeStatement": { + "valid": "bool", + "candidateHash": "CandidateHash", + "session": "SessionIndex" + }, + "DoubleVoteReport": { + "identity": "ValidatorId", + "first": "(Statement, ValidatorSignature)", + "second": "(Statement, ValidatorSignature)", + "proof": "MembershipProof", + "signingContext": "SigningContext" + }, + "DownwardMessage": "Bytes", + "GroupIndex": "u32", + "GlobalValidationSchedule": { + "maxCodeSize": "u32", + "maxHeadDataSize": "u32", + "blockNumber": "BlockNumber" + }, + "HeadData": "Bytes", + "HostConfiguration": { + "maxCodeSize": "u32", + "maxHeadDataSize": "u32", + "maxUpwardQueueCount": "u32", + "maxUpwardQueueSize": "u32", + "maxUpwardMessageSize": "u32", + "maxUpwardMessageNumPerCandidate": "u32", + "hrmpMaxMessageNumPerCandidate": "u32", + "validationUpgradeFrequency": "BlockNumber", + "validationUpgradeDelay": "BlockNumber", + "maxPovSize": "u32", + "maxDownwardMessageSize": "u32", + "preferredDispatchableUpwardMessagesStepWeight": "Weight", + "hrmpMaxParachainOutboundChannels": "u32", + "hrmpMaxParathreadOutboundChannels": "u32", + "hrmpOpenRequestTtl": "u32", + "hrmpSenderDeposit": "Balance", + "hrmpRecipientDeposit": "Balance", + "hrmpChannelMaxCapacity": "u32", + "hrmpChannelMaxTotalSize": "u32", + "hrmpMaxParachainInboundChannels": "u32", + "hrmpMaxParathreadInboundChannels": "u32", + "hrmpChannelMaxMessageSize": "u32", + "acceptancePeriod": "BlockNumber", + "parathreadCores": "u32", + "parathreadRetries": "u32", + "groupRotationFrequency": "BlockNumber", + "chainAvailabilityPeriod": "BlockNumber", + "threadAvailabilityPeriod": "BlockNumber", + "schedulingLookahead": "u32", + "maxValidatorsPerCore": "Option", + "maxValidators": "Option", + "disputePeriod": "SessionIndex", + "noShowSlots": "u32", + "nDelayTranches": "u32", + "zerothDelayTrancheWidth": "u32", + "neededApprovals": "u32", + "relayVrfModuloSamples": "u32" + }, + "InboundDownwardMessage": { + "pubSentAt": "BlockNumber", + "pubMsg": "DownwardMessage" + }, + "InboundHrmpMessage": { + "sentAt": "BlockNumber", + "data": "Bytes" + }, + "InboundHrmpMessages": "Vec", + "LocalValidationData": { + "parentHead": "HeadData", + "balance": "Balance", + "codeUpgradeAllowed": "Option" + }, + "MessageIngestionType": { + "downwardMessages": "Vec", + "horizontalMessages": "BTreeMap" + }, + "MessageQueueChain": "RelayChainHash", + "OutboundHrmpMessage": { + "recipient": "u32", + "data": "Bytes" + }, + "ParachainDispatchOrigin": { + "_enum": [ + "Signed", + "Parachain", + "Root" + ] + }, + "ParachainInherentData": { + "validationData": "PersistedValidationData", + "relayChainState": "StorageProof", + "downwardMessages": "Vec", + "horizontalMessages": "BTreeMap" + }, + "ParachainsInherentData": { + "bitfields": "SignedAvailabilityBitfields", + "backedCandidates": "Vec", + "disputes": "MultiDisputeStatementSet", + "parentHeader": "Header" + }, + "ParaGenesisArgs": { + "genesisHead": "Bytes", + "validationCode": "Bytes", + "parachain": "bool" + }, + "ParaId": "u32", + "ParaInfo": { + "manager": "AccountId", + "deposit": "Balance", + "locked": "bool" + }, + "ParaLifecycle": { + "_enum": [ + "Onboarding", + "Parathread", + "Parachain", + "UpgradingToParachain", + "DowngradingToParathread", + "OutgoingParathread", + "OutgoingParachain" + ] + }, + "ParaPastCodeMeta": { + "upgradeTimes": "Vec", + "lastPruned": "Option" + }, + "ParaScheduling": { + "_enum": [ + "Always", + "Dynamic" + ] + }, + "ParathreadClaim": "(ParaId, CollatorId)", + "ParathreadClaimQueue": { + "queue": "Vec", + "nextCoreOffset": "u32" + }, + "ParathreadEntry": { + "claim": "ParathreadClaim", + "retries": "u32" + }, + "ParaValidatorIndex": "u32", + "PersistedValidationData": { + "parentHead": "HeadData", + "relayParentNumber": "RelayChainBlockNumber", + "relayParentStorageRoot": "Hash", + "maxPovSize": "u32" + }, + "RelayChainBlockNumber": "u32", + "RelayChainHash": "Hash", + "QueuedParathread": { + "claim": "ParathreadEntry", + "coreOffset": "u32" + }, + "Remark": "[u8; 32]", + "Retriable": { + "_enum": { + "Never": "Null", + "WithRetries": "u32" + } + }, + "Scheduling": { + "_enum": [ + "Always", + "Dynamic" + ] + }, + "SessionInfo": { + "validators": "Vec", + "discoveryKeys": "Vec", + "assignmentKeys": "Vec", + "validatorGroups": "Vec", + "nCores": "u32", + "zerothDelayTrancheWidth": "u32", + "relayVrfModuloSamples": "u32", + "nDelayTranches": "u32", + "noShowSlots": "u32", + "neededApprovals": "u32" + }, + "SessionInfoValidatorGroup": "Vec", + "SignedAvailabilityBitfield": { + "payload": "BitVec", + "validatorIndex": "ParaValidatorIndex", + "signature": "ValidatorSignature" + }, + "SignedAvailabilityBitfields": "Vec", + "SigningContext": { + "sessionIndex": "SessionIndex", + "parentHash": "Hash" + }, + "Statement": { + "_enum": { + "Never": "Null", + "Candidate": "Hash", + "Valid": "Hash", + "Invalid": "Hash" + } + }, + "TransientValidationData": { + "maxCodeSize": "u32", + "maxHeadDataSize": "u32", + "balance": "Balance", + "codeUpgradeAllowed": "Option", + "dmqLength": "u32" + }, + "UpwardMessage": "Bytes", + "ValidationFunctionParams": { + "maxCodeSize": "u32", + "relayChainHeight": "RelayChainBlockNumber", + "codeUpgradeAllowed": "Option" + }, + "ValidationCode": "Bytes", + "ValidationData": { + "persisted": "PersistedValidationData", + "transient": "TransientValidationData" + }, + "ValidationDataType": { + "validationData": "ValidationData", + "relayChainState": "Vec" + }, + "ValidatorSignature": "Signature", + "ValidityAttestation": { + "_enum": { + "Never": "Null", + "Implicit": "ValidatorSignature", + "Explicit": "ValidatorSignature" + } + }, + "VersionedXcm": { + "_enum": { + "V0": "Xcm" + } + }, + "WithdrawAsset": { + "assets": "Vec", + "effects": "Vec" + }, + "ReserveAssetDeposit": { + "assets": "Vec", + "effects": "Vec" + }, + "TeleportAsset": { + "assets": "Vec", + "effects": "Vec" + }, + "Balances": { + "queryId": "Compact", + "assets": "Vec" + }, + "Transact": { + "originType": "OriginKind", + "call": "Vec" + }, + "RelayTo": { + "dest": "MultiLocation", + "inner": "VersionedXcm" + }, + "RelayedFrom": { + "superorigin": "MultiLocation", + "inner": "VersionedXcm" + }, + "Xcm": { + "_enum": { + "WithdrawAsset": "WithdrawAsset", + "ReserveAssetDeposit": "ReserveAssetDeposit", + "TeleportAsset": "TeleportAsset", + "Balances": "Balances", + "Transact": "Transact", + "RelayTo": "RelayTo", + "RelayedFrom": "RelayedFrom" + } + }, + "XcmError": { + "_enum": [ + "Undefined", + "Unimplemented", + "UnhandledXcmVersion", + "UnhandledXcmMessage", + "UnhandledEffect", + "EscalationOfPrivilege", + "UntrustedReserveLocation", + "UntrustedTeleportLocation", + "DestinationBufferOverflow", + "CannotReachDestination", + "MultiLocationFull", + "FailedToDecode", + "BadOrigin" + ] + }, + "XcmResult": { + "_enum": { + "Ok": "()", + "Err": "XcmError" + } + }, + "OriginKind": { + "_enum": [ + "Native", + "SovereignAccount", + "Superuser" + ] + }, + "NetworkId": { + "_enum": { + "Any": "Null", + "Named": "Vec", + "Polkadot": "Null", + "Kusama": "Null" + } + }, + "MultiLocation": { + "_enum": { + "Null": "Null", + "X1": "Junction", + "X2": "(Junction, Junction)", + "X3": "(Junction, Junction, Junction)", + "X4": "(Junction, Junction, Junction, Junction)", + "X5": "(Junction, Junction, Junction, Junction, Junction)", + "X6": "(Junction, Junction, Junction, Junction, Junction, Junction)", + "X7": "(Junction, Junction, Junction, Junction, Junction, Junction, Junction)", + "X8": "(Junction, Junction, Junction, Junction, Junction, Junction, Junction, Junction)" + } + }, + "AccountId32Junction": { + "network": "NetworkId", + "id": "AccountId" + }, + "AccountIndex64Junction": { + "network": "NetworkId", + "index": "Compact" + }, + "AccountKey20Junction": { + "network": "NetworkId", + "index": "[u8; 20]" + }, + "Junction": { + "_enum": { + "Parent": "Null", + "Parachain": "Compact", + "AccountId32": "AccountId32Junction", + "AccountIndex64": "AccountIndex64Junction", + "AccountKey20": "AccountKey20Junction", + "PalletInstance": "u8", + "GeneralIndex": "Compact", + "GeneralKey": "Vec", + "OnlyChild": "Null" + } + }, + "VersionedMultiLocation": { + "_enum": { + "V0": "MultiLocation" + } + }, + "AssetInstance": { + "_enum": { + "Undefined": "Null", + "Index8": "u8", + "Index16": "Compact", + "Index32": "Compact", + "Index64": "Compact", + "Index128": "Compact", + "Array4": "[u8; 4]", + "Array8": "[u8; 8]", + "Array16": "[u8; 16]", + "Array32": "[u8; 32]", + "Blob": "Vec" + } + }, + "AbstractFungible": { + "id": "Vec", + "instance": "Compact" + }, + "AbstractNonFungible": { + "class": "Vec", + "instance": "AssetInstance" + }, + "ConcreteFungible": { + "id": "MultiLocation", + "amount": "Compact" + }, + "ConcreteNonFungible": { + "class": "MultiLocation", + "instance": "AssetInstance" + }, + "MultiAsset": { + "_enum": { + "None": "Null", + "All": "Null", + "AllFungible": "Null", + "AllNonFungible": "Null", + "AllAbstractFungible": "Vec", + "AllAbstractNonFungible": "Vec", + "AllConcreteFungible": "MultiLocation", + "AllConcreteNonFungible": "MultiLocation", + "AbstractFungible": "AbstractFungible", + "AbstractNonFungible": "AbstractNonFungible", + "ConcreteFungible": "ConcreteFungible", + "ConcreteNonFungible": "ConcreteNonFungible" + } + }, + "VersionedMultiAsset": { + "_enum": { + "V0": "MultiAsset" + } + }, + "DepositAsset": { + "assets": "Vec", + "dest": "MultiLocation" + }, + "DepositReserveAsset": { + "assets": "Vec", + "dest": "MultiLocation", + "effects": "Vec" + }, + "ExchangeAsset": { + "give": "Vec", + "receive": "Vec" + }, + "InitiateReserveWithdraw": { + "assets": "Vec", + "reserve": "MultiLocation", + "effects": "Vec" + }, + "InitiateTeleport": { + "assets": "Vec", + "dest": "MultiLocation", + "effects": "Vec" + }, + "QueryHolding": { + "queryId": "Compact", + "dest": "MultiLocation", + "assets": "Vec" + }, + "Order": { + "_enum": { + "Null": "Null", + "DepositAsset": "DepositAsset", + "DepositReserveAsset": "DepositReserveAsset", + "ExchangeAsset": "ExchangeAsset", + "InitiateReserveWithdraw": "InitiateReserveWithdraw", + "InitiateTeleport": "InitiateTeleport", + "QueryHolding": "QueryHolding" + } + }, + "MessagingStateSnapshot": { + "relayDispatchQueueSize": "(u32, u32)", + "egressChannels": "Vec" + }, + "MessagingStateSnapshotEgressEntry": "(ParaId, AbridgedHrmpChannel)", + "SystemInherentData": "ParachainInherentData", + "VecInboundHrmpMessage": "Vec" + } +} diff --git a/test/README.md b/test/README.md index 8e4620a096..e8ed04c421 100644 --- a/test/README.md +++ b/test/README.md @@ -63,10 +63,10 @@ Optional: If you cloned the polkadot repo in another location, Create an `.env` cp ./.env-example .env ``` -Start all services (parachain, relayer, ganache, etc): +Start all services (parachain, relayer, ganache, etc). We recommend adding the `duplicate` flag to create a duplicate parachain so that we have 2 different running and registered parachains for testing XCM and for testing the polkadot light client with multiple parachain headers being tracked. ```bash -scripts/start-services.sh +scripts/start-services.sh duplicate ``` Wait until the "System has been initialized" message diff --git a/test/config/launchConfigOverridesDup.json b/test/config/launchConfigOverridesDup.json new file mode 100644 index 0000000000..beee43ccd4 --- /dev/null +++ b/test/config/launchConfigOverridesDup.json @@ -0,0 +1,32 @@ +{ + "parachains": [ + { + "id": "200", + "wsPort": 11144, + "port": 31200, + "flags": [ + "--execution=native", + "-lruntime=debug,import_header=trace,bridge=trace", + "--rpc-cors=all", + "--offchain-worker=Always", + "--enable-offchain-indexing=true", + "--", + "--execution=wasm" + ] + }, + { + "id": "201", + "wsPort": 11145, + "port": 31201, + "flags": [ + "--execution=native", + "-lruntime=debug,import_header=trace,bridge=trace", + "--rpc-cors=all", + "--offchain-worker=Always", + "--enable-offchain-indexing=true", + "--", + "--execution=wasm" + ] + } + ] +} diff --git a/test/scripts/start-services.sh b/test/scripts/start-services.sh index 682f2b4fa5..4825da8d38 100755 --- a/test/scripts/start-services.sh +++ b/test/scripts/start-services.sh @@ -59,9 +59,9 @@ deploy_contracts() } -start_parachain() +start_polkadot_launch() { - echo "Starting Parachain" + echo "Building parachain and starting polkadot launch" pushd ../parachain bin=$(pwd)/target/release/artemis @@ -87,11 +87,31 @@ start_parachain() if [[ -f ../test/.env ]]; then source ../test/.env fi - jq -s '.[0] * .[1]' config.json ../test/config/launchConfigOverrides.json \ - | jq ".parachains[0].bin = \"$bin\"" \ - | jq ".parachains[0].chain = \"$configdir/spec.json\"" \ - | jq ".relaychain.bin = \"$polkadotbinary\"" \ - > $configdir/polkadotLaunchConfig.json + + if [ $# -eq 1 ] && [ $1 = "duplicate" ]; + then + echo "Generating second parachain spec" + target/release/artemis build-spec --disable-default-bootnode > $configdir/spec2.json + + node ../test/scripts/helpers/overrideParachainSpec.js $configdir/spec2.json \ + genesis.runtime.verifierLightclient.initialDifficulty 0x0 \ + genesis.runtime.verifierLightclient.initialHeader "$ethereum_initial_header" \ + genesis.runtime.parachainInfo.parachainId 201 \ + para_id 201 + jq -s '.[0] * .[1]' config-dup.json ../test/config/launchConfigOverridesDup.json \ + | jq ".parachains[0].bin = \"$bin\"" \ + | jq ".parachains[0].chain = \"$configdir/spec.json\"" \ + | jq ".parachains[1].bin = \"$bin\"" \ + | jq ".parachains[1].chain = \"$configdir/spec2.json\"" \ + | jq ".relaychain.bin = \"$polkadotbinary\"" \ + > $configdir/polkadotLaunchConfig.json + else + jq -s '.[0] * .[1]' config.json ../test/config/launchConfigOverrides.json \ + | jq ".parachains[0].bin = \"$bin\"" \ + | jq ".parachains[0].chain = \"$configdir/spec.json\"" \ + | jq ".relaychain.bin = \"$polkadotbinary\"" \ + > $configdir/polkadotLaunchConfig.json + fi polkadot-launch $configdir/polkadotLaunchConfig.json & @@ -129,7 +149,12 @@ trap cleanup SIGINT SIGTERM EXIT start_ganache deploy_contracts -start_parachain +if [ $# -eq 1 ] && [ $1 = "duplicate" ]; +then + start_polkadot_launch "duplicate" +else + start_polkadot_launch +fi restart_ganache echo "Waiting for consensus between polkadot and parachain" sleep 60