diff --git a/.github/workflows/smart-contracts-integrations-tests-ghcr.yml b/.github/workflows/smart-contracts-integrations-tests-ghcr.yml new file mode 100644 index 000000000..ead779368 --- /dev/null +++ b/.github/workflows/smart-contracts-integrations-tests-ghcr.yml @@ -0,0 +1,37 @@ +name: Build and Push smart-contracts-tests-cardano-node-ogmios image to GHCR + +on: + workflow_dispatch: + inputs: + tag: + description: "Tag for GHCR image" + required: true + type: string + +jobs: + build-and-publish: + runs-on: ubuntu-latest + permissions: + contents: write + packages: write + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + logout: true + + - name: Build and Push Docker Image + uses: docker/build-push-action@v4 + with: + context: toolkit/offchain/tests/docker/ + file: toolkit/offchain/tests/docker/Dockerfile + push: true + tags: + ghcr.io/partner-chains/smart-contracts-tests-cardano-node-ogmios:${{ inputs.tag }} + ghcr.io/partner-chains/smart-contracts-tests-cardano-node-ogmios:latest diff --git a/Cargo.lock b/Cargo.lock index a7b1db394..60bcd27b2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6542,7 +6542,6 @@ dependencies = [ "anyhow", "cardano-serialization-lib", "cbor_event", - "db-sync-follower", "env_logger 0.11.3", "fraction", "hex", diff --git a/toolkit/mainchain-follower/db-sync-follower/Cargo.toml b/toolkit/mainchain-follower/db-sync-follower/Cargo.toml index 5739417e6..309647403 100644 --- a/toolkit/mainchain-follower/db-sync-follower/Cargo.toml +++ b/toolkit/mainchain-follower/db-sync-follower/Cargo.toml @@ -8,7 +8,6 @@ license = "Apache-2.0" [dependencies] sqlx = { version = "0.7.4", default-features = false, features = ["runtime-tokio-rustls", "postgres", "macros", "chrono", "migrate", "bigdecimal"]} tokio = { workspace = true, features = ["full"]} -testcontainers-modules = { version = "0.1.3", features = ["postgres"] } futures = { workspace = true } chrono = "0.4.31" hex = { workspace = true } @@ -39,6 +38,7 @@ partner-chains-plutus-data = { workspace = true } [dev-dependencies] tokio-test = "0.4.3" ctor = "0.2.5" +testcontainers-modules = { version = "0.1.3", features = ["postgres"] } [features] default = [] diff --git a/toolkit/offchain/Cargo.toml b/toolkit/offchain/Cargo.toml index a164db9fb..ced6f4fcc 100644 --- a/toolkit/offchain/Cargo.toml +++ b/toolkit/offchain/Cargo.toml @@ -14,7 +14,6 @@ targets = ["x86_64-unknown-linux-gnu"] anyhow = { workspace = true } cardano-serialization-lib = { workspace = true } cbor_event = { workspace = true } -db-sync-follower = { workspace = true, features = ["candidate-source"] } partner-chains-plutus-data = { workspace = true } fraction = { workspace = true } hex = { workspace = true } diff --git a/toolkit/offchain/tests/docker/Dockerfile b/toolkit/offchain/tests/docker/Dockerfile new file mode 100644 index 000000000..a82a26e09 --- /dev/null +++ b/toolkit/offchain/tests/docker/Dockerfile @@ -0,0 +1,7 @@ +FROM cardanosolutions/cardano-node-ogmios:v6.9.0_10.1.2 + +COPY ./config /config +COPY ./busybox /busybox +COPY ./entrypoint.sh /entrypoint.sh + +ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] diff --git a/toolkit/offchain/tests/docker/busybox b/toolkit/offchain/tests/docker/busybox new file mode 100755 index 000000000..7fa96a03f Binary files /dev/null and b/toolkit/offchain/tests/docker/busybox differ diff --git a/toolkit/offchain/tests/docker/config/config.base.json b/toolkit/offchain/tests/docker/config/config.base.json new file mode 100644 index 000000000..5350dbdb4 --- /dev/null +++ b/toolkit/offchain/tests/docker/config/config.base.json @@ -0,0 +1,117 @@ +{ + "AlonzoGenesisFile": "/config/genesis/alonzo.json", + "AlonzoGenesisHash": "1d53293bbcd7682fba139090bad147e87a373b70b1de757db36ca47c2a11905d", + "ByronGenesisFile": "/config/genesis/byron.json", + "ByronGenesisHash": "b75de8dd5d5b8f46aeddd1b1447bfbf7672c03340f1e0958b368e20ecf606c0d", + "ConwayGenesisFile": "/config/genesis/conway.json", + "ConwayGenesisHash": "4cc4d44e6894612a181d45c0eb7695cd92823a30db00aa4fd3b693a2847f9f3a", + "EnableP2P": true, + "ExperimentalHardForksEnabled": true, + "ExperimentalProtocolsEnabled": true, + "LastKnownBlockVersion-Alt": 0, + "LastKnownBlockVersion-Major": 3, + "LastKnownBlockVersion-Minor": 1, + "MinNodeVersion": "8.12.0", + "PeerSharing": true, + "Protocol": "Cardano", + "RequiresNetworkMagic": "RequiresMagic", + "NetworkMagic": 42, + "ShelleyGenesisFile": "/config/genesis/shelley.json", + "ShelleyGenesisHash": "aed63d7ec0474a71b1f06badcc08356bbe792ffc599b8fab11fc1d2ce31bb727", + "TargetNumberOfActivePeers": 20, + "TargetNumberOfEstablishedPeers": 50, + "TargetNumberOfKnownPeers": 150, + "TargetNumberOfRootPeers": 60, + "TestAllegraHardForkAtEpoch": 0, + "TestAlonzoHardForkAtEpoch": 0, + "TestMaryHardForkAtEpoch": 0, + "TestShelleyHardForkAtEpoch": 0, + "TestBabbageHardForkAtEpoch": 0, + "TestConwayHardForkAtEpoch": 0, + "TraceAcceptPolicy": true, + "TraceBlockFetchClient": false, + "TraceBlockFetchDecisions": false, + "TraceBlockFetchProtocol": false, + "TraceBlockFetchProtocolSerialised": false, + "TraceBlockFetchServer": false, + "TraceChainDb": true, + "TraceChainSyncBlockServer": false, + "TraceChainSyncClient": false, + "TraceChainSyncHeaderServer": false, + "TraceChainSyncProtocol": false, + "TraceConnectionManager": true, + "TraceDNSResolver": true, + "TraceDNSSubscription": true, + "TraceDiffusionInitialization": true, + "TraceErrorPolicy": true, + "TraceForge": true, + "TraceHandshake": true, + "TraceInboundGovernor": true, + "TraceIpSubscription": true, + "TraceLedgerPeers": true, + "TraceLocalChainSyncProtocol": false, + "TraceLocalConnectionManager": true, + "TraceLocalErrorPolicy": true, + "TraceLocalHandshake": true, + "TraceLocalRootPeers": true, + "TraceLocalTxSubmissionProtocol": false, + "TraceLocalTxSubmissionServer": false, + "TraceMempool": true, + "TraceMux": false, + "TracePeerSelection": true, + "TracePeerSelectionActions": true, + "TracePublicRootPeers": true, + "TraceServer": true, + "TraceTxInbound": false, + "TraceTxOutbound": false, + "TraceTxSubmissionProtocol": false, + "TracingVerbosity": "NormalVerbosity", + "TurnOnLogMetrics": true, + "TurnOnLogging": true, + "defaultBackends": [ + "KatipBK" + ], + "defaultScribes": [ + [ + "StdoutSK", + "stdout" + ] + ], + "hasEKG": 12788, + "hasPrometheus": [ + "127.0.0.1", + 12798 + ], + "minSeverity": "Info", + "options": { + "mapBackends": { + "cardano.node.metrics": [ + "EKGViewBK" + ], + "cardano.node.resources": [ + "EKGViewBK" + ] + }, + "mapSubtrace": { + "cardano.node.metrics": { + "subtrace": "Neutral" + } + } + }, + "rotation": { + "rpKeepFilesNum": 10, + "rpLogLimitBytes": 5000000, + "rpMaxAgeHours": 24 + }, + "setupBackends": [ + "KatipBK" + ], + "setupScribes": [ + { + "scFormat": "ScText", + "scKind": "StdoutSK", + "scName": "stdout", + "scRotation": null + } + ] +} diff --git a/toolkit/offchain/tests/docker/config/genesis/alonzo.json b/toolkit/offchain/tests/docker/config/genesis/alonzo.json new file mode 100644 index 000000000..c24e69722 --- /dev/null +++ b/toolkit/offchain/tests/docker/config/genesis/alonzo.json @@ -0,0 +1,365 @@ +{ + "collateralPercentage": 150, + "costModels": { + "PlutusV1": [ + 205665, + 812, + 1, + 1, + 1000, + 571, + 0, + 1, + 1000, + 24177, + 4, + 1, + 1000, + 32, + 117366, + 10475, + 4, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 100, + 100, + 23000, + 100, + 19537, + 32, + 175354, + 32, + 46417, + 4, + 221973, + 511, + 0, + 1, + 89141, + 32, + 497525, + 14068, + 4, + 2, + 196500, + 453240, + 220, + 0, + 1, + 1, + 1000, + 28662, + 4, + 2, + 245000, + 216773, + 62, + 1, + 1060367, + 12586, + 1, + 208512, + 421, + 1, + 187000, + 1000, + 52998, + 1, + 80436, + 32, + 43249, + 32, + 1000, + 32, + 80556, + 1, + 57667, + 4, + 1000, + 10, + 197145, + 156, + 1, + 197145, + 156, + 1, + 204924, + 473, + 1, + 208896, + 511, + 1, + 52467, + 32, + 64832, + 32, + 65493, + 32, + 22558, + 32, + 16563, + 32, + 76511, + 32, + 196500, + 453240, + 220, + 0, + 1, + 1, + 69522, + 11687, + 0, + 1, + 60091, + 32, + 196500, + 453240, + 220, + 0, + 1, + 1, + 196500, + 453240, + 220, + 0, + 1, + 1, + 806990, + 30482, + 4, + 1927926, + 82523, + 4, + 265318, + 0, + 4, + 0, + 85931, + 32, + 205665, + 812, + 1, + 1, + 41182, + 32, + 212342, + 32, + 31220, + 32, + 32696, + 32, + 43357, + 32, + 32247, + 32, + 38314, + 32, + 9462713, + 1021, + 10 + ], + "PlutusV2": [ + 205665, + 812, + 1, + 1, + 1000, + 571, + 0, + 1, + 1000, + 24177, + 4, + 1, + 1000, + 32, + 117366, + 10475, + 4, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 100, + 100, + 23000, + 100, + 19537, + 32, + 175354, + 32, + 46417, + 4, + 221973, + 511, + 0, + 1, + 89141, + 32, + 497525, + 14068, + 4, + 2, + 196500, + 453240, + 220, + 0, + 1, + 1, + 1000, + 28662, + 4, + 2, + 245000, + 216773, + 62, + 1, + 1060367, + 12586, + 1, + 208512, + 421, + 1, + 187000, + 1000, + 52998, + 1, + 80436, + 32, + 43249, + 32, + 1000, + 32, + 80556, + 1, + 57667, + 4, + 1000, + 10, + 197145, + 156, + 1, + 197145, + 156, + 1, + 204924, + 473, + 1, + 208896, + 511, + 1, + 52467, + 32, + 64832, + 32, + 65493, + 32, + 22558, + 32, + 16563, + 32, + 76511, + 32, + 196500, + 453240, + 220, + 0, + 1, + 1, + 69522, + 11687, + 0, + 1, + 60091, + 32, + 196500, + 453240, + 220, + 0, + 1, + 1, + 196500, + 453240, + 220, + 0, + 1, + 1, + 1159724, + 392670, + 0, + 2, + 806990, + 30482, + 4, + 1927926, + 82523, + 4, + 265318, + 0, + 4, + 0, + 85931, + 32, + 205665, + 812, + 1, + 1, + 41182, + 32, + 212342, + 32, + 31220, + 32, + 32696, + 32, + 43357, + 32, + 32247, + 32, + 38314, + 32, + 35892428, + 10, + 9462713, + 1021, + 10, + 38887044, + 32947, + 10 + ] + }, + "executionPrices": { + "prMem": 5.77e-2, + "prSteps": 7.21e-5 + }, + "lovelacePerUTxOWord": 34482, + "maxBlockExUnits": { + "exUnitsMem": 62000000, + "exUnitsSteps": 40000000000 + }, + "maxCollateralInputs": 3, + "maxTxExUnits": { + "exUnitsMem": 14000000, + "exUnitsSteps": 10000000000 + }, + "maxValueSize": 5000 +} diff --git a/toolkit/offchain/tests/docker/config/genesis/byron.base.json b/toolkit/offchain/tests/docker/config/genesis/byron.base.json new file mode 100644 index 000000000..e60ec9865 --- /dev/null +++ b/toolkit/offchain/tests/docker/config/genesis/byron.base.json @@ -0,0 +1,61 @@ +{ + "bootStakeholders": { + "2944b52e7773f56388382cd54f2c687e9769d988c5ff13e249b4da15": 1, + "38d155323b0c1c761fcd5429ddf4d028663594fcc474fe8c1b0f5ca4": 1, + "42090ce672754e4e8b6df76d79dfb3ada7040f1acce996715e69896f": 1 + }, + "heavyDelegation": { + "2944b52e7773f56388382cd54f2c687e9769d988c5ff13e249b4da15": { + "omega": 0, + "issuerPk": "o7x/dHu94JNaKoP02r7FwVCYqJlCkFoA6+jpbfS2FjP9sll9MxTOFzSYuPE0V7ysIYmMB/4vrp/qOnDGXDoqRQ==", + "delegatePk": "oRNWGprv349g7iuoOmMb2dLEZSXFIrSVZLuXLKWIVpWSGz1SYJofNxx3VwORZ1a3VbRSqUZ2F5ZUw+r0h3KlUA==", + "cert": "7377108dc4398bf02bad39c583e9a026c489b7d37f5e1b85bf1258bb536785640ecc52d691cafb510ccd12b954871502cbb6162ee6a7fff615e396972bef2009" + }, + "38d155323b0c1c761fcd5429ddf4d028663594fcc474fe8c1b0f5ca4": { + "omega": 0, + "issuerPk": "gdu2yPZT8DKdCP01icG37ZOcN0r0fzelUh/2+mnknfxE7zk7Q3cL2N7Q/2BosO2z9w0FOCOWXvHi0wNKHvYhMQ==", + "delegatePk": "YwSI8scESVUVlZSP1giUMu0yw1j2PY5ibSOfZszsPpNBc1MIk/hXjYHeH1D6R7kKQBV6PXHpWvY1sX2zoScMyw==", + "cert": "8d9a5ef9e01ee8d382605289f8807de84e77e5913c5303848a01b5d2120b61b9bd736093a7fdb5337d464242574f0fc61c9d000a1685882ded20c9745c0f7b0c" + }, + "42090ce672754e4e8b6df76d79dfb3ada7040f1acce996715e69896f": { + "omega": 0, + "issuerPk": "ZmeMK1IG0GXXqVhyE3OIo/NqIYzgFhwY1MW9YgdEZI0xd3Be3W+b1AYYfIuB2U4V7sZRXgqSmYgr/5Ogf9/YGQ==", + "delegatePk": "Lf/idM1q2GtVcrZfmAq/sr1qyKAVqSbrKnfzOtCA15BlsdACRgS3mC78I4hBUeNYeBKCIEeh9mxFuXQbRNuCPQ==", + "cert": "00f4931448473df3fa41d24557e9c79ef9a76ae01afb6b52507a837fa31446f2065860ffa080cfd2877bffd0121b86d6b52f3d7bf6a450b0bbcfe9c90726540c" + } + }, + "startTime": 1733736840, + "nonAvvmBalances": { + "2657WMsDfac5nEtUaWqyZSQL488boA9aTRZFMjX7WV2yHj4ka2gEyS7YA7khsaX6F": "3340000000", + "2657WMsDfac65eHoM4ssr14BttjnZ9fsJ6NfWSUgqsBhtyrsJgwdjZ1c2M8FPYWJE": "3340000000", + "2657WMsDfac7ANLktv8MWgmsjjsQgitu5zNXM6eQdRiUpYPkunchcBV6jvkXXT7rR": "3340000000" + }, + "blockVersionData": { + "scriptVersion": 0, + "slotDuration": "2000", + "maxBlockSize": "2000000", + "maxHeaderSize": "2000000", + "maxTxSize": "4096", + "maxProposalSize": "700", + "mpcThd": "20000000000000", + "heavyDelThd": "300000000000", + "updateVoteThd": "1000000000000", + "updateProposalThd": "100000000000000", + "updateImplicit": "10000", + "softforkRule": { + "initThd": "900000000000000", + "minThd": "600000000000000", + "thdDecrement": "50000000000000" + }, + "txFeePolicy": { + "summand": "155381000000000", + "multiplier": "43946000000" + }, + "unlockStakeEpoch": "18446744073709551615" + }, + "protocolConsts": { + "k": 10, + "protocolMagic": 42 + }, + "avvmDistr": {} +} diff --git a/toolkit/offchain/tests/docker/config/genesis/conway.json b/toolkit/offchain/tests/docker/config/genesis/conway.json new file mode 100644 index 000000000..18d875b5d --- /dev/null +++ b/toolkit/offchain/tests/docker/config/genesis/conway.json @@ -0,0 +1,297 @@ +{ + "poolVotingThresholds": { + "committeeNormal": 0.51, + "committeeNoConfidence": 0.51, + "hardForkInitiation": 0.51, + "motionNoConfidence": 0.51, + "ppSecurityGroup": 0.51 + }, + "dRepVotingThresholds": { + "motionNoConfidence": 0.67, + "committeeNormal": 0.67, + "committeeNoConfidence": 0.6, + "updateToConstitution": 0.75, + "hardForkInitiation": 0.6, + "ppNetworkGroup": 0.67, + "ppEconomicGroup": 0.67, + "ppTechnicalGroup": 0.67, + "ppGovGroup": 0.75, + "treasuryWithdrawal": 0.67 + }, + "committeeMinSize": 0, + "committeeMaxTermLength": 365, + "govActionLifetime": 30, + "govActionDeposit": 100000000000, + "dRepDeposit": 500000000, + "dRepActivity": 20, + "minFeeRefScriptCostPerByte": 15, + "plutusV3CostModel": [ + 100788, + 420, + 1, + 1, + 1000, + 173, + 0, + 1, + 1000, + 59957, + 4, + 1, + 11183, + 32, + 201305, + 8356, + 4, + 16000, + 100, + 16000, + 100, + 16000, + 100, + 16000, + 100, + 16000, + 100, + 16000, + 100, + 100, + 100, + 16000, + 100, + 94375, + 32, + 132994, + 32, + 61462, + 4, + 72010, + 178, + 0, + 1, + 22151, + 32, + 91189, + 769, + 4, + 2, + 85848, + 123203, + 7305, + -900, + 1716, + 549, + 57, + 85848, + 0, + 1, + 1, + 1000, + 42921, + 4, + 2, + 24548, + 29498, + 38, + 1, + 898148, + 27279, + 1, + 51775, + 558, + 1, + 39184, + 1000, + 60594, + 1, + 141895, + 32, + 83150, + 32, + 15299, + 32, + 76049, + 1, + 13169, + 4, + 22100, + 10, + 28999, + 74, + 1, + 28999, + 74, + 1, + 43285, + 552, + 1, + 44749, + 541, + 1, + 33852, + 32, + 68246, + 32, + 72362, + 32, + 7243, + 32, + 7391, + 32, + 11546, + 32, + 85848, + 123203, + 7305, + -900, + 1716, + 549, + 57, + 85848, + 0, + 1, + 90434, + 519, + 0, + 1, + 74433, + 32, + 85848, + 123203, + 7305, + -900, + 1716, + 549, + 57, + 85848, + 0, + 1, + 1, + 85848, + 123203, + 7305, + -900, + 1716, + 549, + 57, + 85848, + 0, + 1, + 955506, + 213312, + 0, + 2, + 270652, + 22588, + 4, + 1457325, + 64566, + 4, + 20467, + 1, + 4, + 0, + 141992, + 32, + 100788, + 420, + 1, + 1, + 81663, + 32, + 59498, + 32, + 20142, + 32, + 24588, + 32, + 20744, + 32, + 25933, + 32, + 24623, + 32, + 43053543, + 10, + 53384111, + 14333, + 10, + 43574283, + 26308, + 10, + 16000, + 100, + 16000, + 100, + 962335, + 18, + 2780678, + 6, + 442008, + 1, + 52538055, + 3756, + 18, + 267929, + 18, + 76433006, + 8868, + 18, + 52948122, + 18, + 1995836, + 36, + 3227919, + 12, + 901022, + 1, + 166917843, + 4307, + 36, + 284546, + 36, + 158221314, + 26549, + 36, + 74698472, + 36, + 333849714, + 1, + 254006273, + 72, + 2174038, + 72, + 2261318, + 64571, + 4, + 207616, + 8310, + 4, + 1293828, + 28716, + 63, + 0, + 1, + 1006041, + 43623, + 251, + 0, + 1 + ], + "constitution": { + "anchor": { + "dataHash": "ca41a91f399259bcefe57f9858e91f6d00e1a38d6d9c63d4052914ea7bd70cb2", + "url": "ipfs://bafkreifnwj6zpu3ixa4siz2lndqybyc5wnnt3jkwyutci4e2tmbnj3xrdm" + }, + "script": "fa24fb305126805cf2164c161d852a0e7330cf988f1fe558cf7d4a64" + }, + "committee": { + "members": { + "scriptHash-ff9babf23fef3f54ec29132c07a8e23807d7b395b143ecd8ff79f4c7": 1000 + }, + "threshold": { + "numerator": 2, + "denominator": 3 + } + } +} diff --git a/toolkit/offchain/tests/docker/config/genesis/shelley.base.json b/toolkit/offchain/tests/docker/config/genesis/shelley.base.json new file mode 100644 index 000000000..dc550a8cf --- /dev/null +++ b/toolkit/offchain/tests/docker/config/genesis/shelley.base.json @@ -0,0 +1,114 @@ +{ + "activeSlotsCoeff": 0.4, + "epochLength": 120, + "genDelegs": { + "4090c4d9554ab626a30a393ae3dd1fde40336e0515b1d4f430d6ae92": { + "delegate": "145375666292cb07f76d583a87e2ca670c0f0a6df9fac87b9c730e6b", + "vrf": "a98e88c05a5213d70a4562686afaefaaa9c1b25e5ab13502d7fb59a56c997365" + }, + "4d155b0043d217ba214ac5185830c4a3a2c12138d0ce75f6ca6fdd46": { + "delegate": "8ebe81d6fdaea9a69e34510479ea190ca38c28fe64e282d274910427", + "vrf": "cf900e7709bd19d05cc3a79391df97dc57d2303193682ea2b44a79e6af47f519" + }, + "bd025e4687723e07c8f011458ef72fd29a3d49ed5ebfd91913617854": { + "delegate": "63487d53beeb05ae2679654f0428555adf39f05745dd8bd5694b2682", + "vrf": "3700fc4b7df160c211fd172bde8975e9e8afb04dd10f9a1ada40c6ea0448baf4" + } + }, + "initialFunds": { + "008a75c2002312f380c7ceaf3b18d5ee5aa8a3d309ef40c80fca9006b2d9267776d1289412d8d3c09599393044730deba14feb31f52b0e6ef2": 3480000000000, + "00207e498c990230dd7db797eaa2de8b8c9fce9b522b5a0f7d658c2974d27cb9a1a408b81239b55ec03f6e004deffcc094e7252d5c45743784": 500000000, + "005281ccb1fceb0a3b038602500080dd771cccd6800dc753c9786ff5d3f441c3ef7ef4a8ade039f4f4224b9ae494125bbcff284df64e8e73d8": 500000000, + "6029390bd65da533dc5d03f5e1bf6fd8114c41d3cefdab7aae10e4d9ef": 29993040000000000 + }, + "maxKESEvolutions": 64, + "maxLovelaceSupply": 45000000000000000, + "networkId": "Testnet", + "networkMagic": 42, + "protocolParams": { + "a0": 0.3, + "decentralisationParam": 0.8, + "eMax": 18, + "extraEntropy": { + "tag": "NeutralNonce" + }, + "keyDeposit": 400000, + "maxBlockBodySize": 65536, + "maxBlockHeaderSize": 1100, + "maxTxSize": 16384, + "minFeeA": 44, + "minFeeB": 155381, + "minPoolCost": 0, + "minUTxOValue": 1, + "nOpt": 500, + "poolDeposit": 500000000, + "protocolVersion": { + "major": 10, + "minor": 0 + }, + "rho": 0.0022, + "tau": 0.05 + }, + "securityParam": 5, + "slotLength": 1, + "slotsPerKESPeriod": 129600, + "staking": { + "pools": { + "2d0de269b0996fdcd8f19f0b6d7d0bf14363984482f181a5a1ccd036": { + "cost": 0, + "margin": 0, + "metadata": null, + "owners": [], + "pledge": 0, + "publicKey": "2d0de269b0996fdcd8f19f0b6d7d0bf14363984482f181a5a1ccd036", + "relays": [], + "rewardAccount": { + "credential": { + "keyHash": "f0834f87e577f514cecdd41db9feabcc42671b4b15cd5a27924e571c" + }, + "network": "Testnet" + }, + "vrf": "72255c577e9fa3146e397ffeb45a187c48505a5f950216d7b1224d85dc4fbbac" + }, + "3ae3d52682660d1eaffe35747911481ccc9bc7eb4ea7c5b97f22a503": { + "cost": 0, + "margin": 0, + "metadata": null, + "owners": [], + "pledge": 0, + "publicKey": "3ae3d52682660d1eaffe35747911481ccc9bc7eb4ea7c5b97f22a503", + "relays": [], + "rewardAccount": { + "credential": { + "keyHash": "62513bb8ef979efcf5a4c9164ffd9b4355ad50584bc729bcbe09bdb0" + }, + "network": "Testnet" + }, + "vrf": "771d4c6125b9dabb6d9136f35b2e82f5404aa4d9a852bb9e5f4f0de8481e68c4" + }, + "bcf4107cca955239a101ef4a99795bd49ba4fde68ff82c913f547a7a": { + "cost": 0, + "margin": 0, + "metadata": null, + "owners": [], + "pledge": 0, + "publicKey": "bcf4107cca955239a101ef4a99795bd49ba4fde68ff82c913f547a7a", + "relays": [], + "rewardAccount": { + "credential": { + "keyHash": "65e49bf8ffe6111464a60f41b0df36d1861ed9666d17da360f38bf05" + }, + "network": "Testnet" + }, + "vrf": "77a49752e0586e0837093601810436500a8fff4819aef1e973582197a070475b" + } + }, + "stake": { + "d27cb9a1a408b81239b55ec03f6e004deffcc094e7252d5c45743784": "3ae3d52682660d1eaffe35747911481ccc9bc7eb4ea7c5b97f22a503", + "d9267776d1289412d8d3c09599393044730deba14feb31f52b0e6ef2": "bcf4107cca955239a101ef4a99795bd49ba4fde68ff82c913f547a7a", + "f441c3ef7ef4a8ade039f4f4224b9ae494125bbcff284df64e8e73d8": "2d0de269b0996fdcd8f19f0b6d7d0bf14363984482f181a5a1ccd036" + } + }, + "systemStart": "2024-12-09T09:34:00Z", + "updateQuorum": 1 +} diff --git a/toolkit/offchain/tests/docker/config/keys/kes.skey b/toolkit/offchain/tests/docker/config/keys/kes.skey new file mode 100644 index 000000000..b10794d5c --- /dev/null +++ b/toolkit/offchain/tests/docker/config/keys/kes.skey @@ -0,0 +1,5 @@ +{ + "type": "KesSigningKey_ed25519_kes_2^6", + "description": "KES Signing Key", + "cborHex": "590260e3fb9830192e8d1f1fd8f86a7bee3b5b820de3c6c034859a62efeb157db89ca49e7e0e31327f1ef6b100fd7fc2236394de1a56098810d24bc66ee6831f1ba8370ed0dd68898bb25e19226a705826b864d04de26d748ba1498bca4f5e9d9f9c80c0e26d5ad15b8dedc65c9bd7fc3c923c8b20e705b0b48ab371ec9806f3db84022a7024870f350e416f0516fb3cf1f7af37528bee348fd31e2553febc735df0514dc500743d694277e30af2779ddaa9919a1fe65f153b250a317de61480f75f1d208df68118fcb9427a6500935334bb07369ebe2a4bc2e24c8a96861c588f1196289984856dab4e445fbaca096c128be6bcee41b0a67efebbc532d7d67dc21d5392789b586a2752298f3dafcb995d683833e73ed94a037ad50f5fe8994c820746309b4554ea351d7d0ddbd89d61e513e22f9826f7dae821c8476084a553b42166be97cfaad1c404aeb818afb3d7179e50a8f4245b528e93eb61bae16d02cb4a5e0966a0f23f5a339a063e6f98b3845d2c8d96e5b3bed9559909da2e5893831b143005aff6d16d2137a5e22ef0dbd22cd52fb75e4e9a52a3cf5d9be88b168ca7a743fbf4f2eae5e3bc36378e05acebc12196b91a0a8d69a190e164f7ca65f9e0fbba7a0b0ee8434969c0aa8fde9706c25b86e4bc067a04f5f9c5855eb7b1badc0348f6bcff66dcfedec3aca06939a025a130d3f3fa0fe146df97c70973d6a139e320421b06dc00be9f081c844035a5df272eded4742aff626cc1a6befc91b74f93998607820d986c32e28d03b53adbf4a5aa7d9ad8cc08ea5b8c5cde0b0c98fdffad562441a6e8e06ebabbafed9cd78fc35a7a4512bbe7261c7fc24d583d419a2b" +} diff --git a/toolkit/offchain/tests/docker/config/keys/node.cert b/toolkit/offchain/tests/docker/config/keys/node.cert new file mode 100644 index 000000000..2a098964f --- /dev/null +++ b/toolkit/offchain/tests/docker/config/keys/node.cert @@ -0,0 +1,5 @@ +{ + "type": "NodeOperationalCertificate", + "description": "", + "cborHex": "82845820fe93302c954602caa3cde0a4c678283d5f04795857b6ed4290d2d97db05ff3f700005840187c0885b42bddd8fee88284713974207e0c3daa4e388efd73d3b187e220be25436db093c9327ae5a8b24e9354256351fb6f25576b39baf4c75e4bb596f64201582008accadc8b60a5f519ee74ab144ada6993709f5479152f9217688889d8a2db2e" +} diff --git a/toolkit/offchain/tests/docker/config/keys/vrf.skey b/toolkit/offchain/tests/docker/config/keys/vrf.skey new file mode 100644 index 000000000..50611a602 --- /dev/null +++ b/toolkit/offchain/tests/docker/config/keys/vrf.skey @@ -0,0 +1,5 @@ +{ + "type": "VrfSigningKey_PraosVRF", + "description": "VRF Signing Key", + "cborHex": "58402fd21843238aacbaf7c3a35d3250a0eb0c02b722c03aa0ad246ba7d098e85d181300549d7bdf2cf742febb876f2de88f718b16d29030d9d9f448915f551e9371" +} diff --git a/toolkit/offchain/tests/docker/config/topology.json b/toolkit/offchain/tests/docker/config/topology.json new file mode 100644 index 000000000..5bf5ecaab --- /dev/null +++ b/toolkit/offchain/tests/docker/config/topology.json @@ -0,0 +1,9 @@ +{ + "localRoots": [], + "publicRoots": [ + { + "accessPoints": [], + "advertise": false + } + ] +} diff --git a/toolkit/offchain/tests/docker/entrypoint.sh b/toolkit/offchain/tests/docker/entrypoint.sh new file mode 100755 index 000000000..44b993fee --- /dev/null +++ b/toolkit/offchain/tests/docker/entrypoint.sh @@ -0,0 +1,43 @@ +#! /bin/bash + +byron_startTime=$(( $(date +%s) + 1 )) +shelley_systemStart=$(date --utc +"%Y-%m-%dT%H:%M:%SZ" --date="@$byron_startTime") + +/busybox sed "s/\"startTime\": [0-9]*/\"startTime\": $byron_startTime/" /config/genesis/byron.base.json > /config/genesis/byron.json +/busybox sed "s/\"systemStart\": \"[^\"]*\"/\"systemStart\": \"$shelley_systemStart\"/" /config/genesis/shelley.base.json > /config/genesis/shelley.json + +byron_hash=$(/bin/cardano-cli byron genesis print-genesis-hash --genesis-json /config/genesis/byron.json) +shelley_hash=$(/bin/cardano-cli latest genesis hash --genesis /config/genesis/shelley.json) +alonzo_hash=$(/bin/cardano-cli latest genesis hash --genesis /config/genesis/alonzo.json) +conway_hash=$(/bin/cardano-cli latest genesis hash --genesis /config/genesis/conway.json) + +/busybox sed "s/\"ByronGenesisHash\": \"[^\"]*\"/\"ByronGenesisHash\": \"$byron_hash\"/" /config/config.base.json > /config/config.byron_hash.json +/busybox sed "s/\"ShelleyGenesisHash\": \"[^\"]*\"/\"ShelleyGenesisHash\": \"$shelley_hash\"/" /config/config.byron_hash.json > /config/config.shelley_hash.json +/busybox sed "s/\"AlonzoGenesisHash\": \"[^\"]*\"/\"AlonzoGenesisHash\": \"$alonzo_hash\"/" /config/config.shelley_hash.json > /config/config.alonzo_hash.json +/busybox sed "s/\"ConwayGenesisHash\": \"[^\"]*\"/\"ConwayGenesisHash\": \"$conway_hash\"/" /config/config.alonzo_hash.json > /config/config.json + +echo "Starting ogmios..." + +ogmios \ + --host 0.0.0.0 \ + --node-config /config/config.json \ + --node-socket /ipc/node.socket & +ogmios_status=$? + +if [ $ogmios_status -ne 0 ]; then + echo "Failed to start ogmios: $ogmios_status" + exit $ogmios_status +fi + +echo "Starting cardano-node..." + +cardano-node run \ + --topology /config/topology.json \ + --database-path /db \ + --port 3000 \ + --host-addr 0.0.0.0 \ + --config /config/config.json \ + --shelley-kes-key /config/keys/kes.skey \ + --shelley-vrf-key /config/keys/vrf.skey \ + --shelley-operational-certificate /config/keys/node.cert \ + --socket-path /ipc/node.socket diff --git a/toolkit/offchain/tests/integration_tests.rs b/toolkit/offchain/tests/integration_tests.rs new file mode 100644 index 000000000..12cc05381 --- /dev/null +++ b/toolkit/offchain/tests/integration_tests.rs @@ -0,0 +1,9 @@ +//! Integration tests for partner-chains smart contracts. +//! Public methods are tested with use of the cardano-node-ogmios test image, +//! that provides a fast single node Cardano chain. +//! +//! Dockerfile for the test image is present in the 'docker' directory. +//! In case of change to the supported cardano-node or ogmios, +//! it should be updated accordingly and pushed to the registry. + +pub const WHY_EMPTY: &str = "test will be implemented in the next pull request"; diff --git a/toolkit/partner-chains-cli/src/select_utxo.rs b/toolkit/partner-chains-cli/src/select_utxo.rs index 9f75e74a8..24ecf8c2a 100644 --- a/toolkit/partner-chains-cli/src/select_utxo.rs +++ b/toolkit/partner-chains-cli/src/select_utxo.rs @@ -154,26 +154,6 @@ pub(crate) mod tests { ] } - pub(crate) fn mock_result_0_valid() -> Vec { - vec![OgmiosUtxo { - transaction: OgmiosTx { - id: hex!("8a0d3e5644b3e84a775556b44e6407971d01b8bfa3f339294b7228ac18ddb29c"), - }, - index: 0, - value: OgmiosValue { - lovelace: 10000000, - native_tokens: HashMap::from([( - hex!("244d83c5418732113e891db15ede8f0d15df75b705a1542d86937875"), - vec![Asset { - name: hex!("4c757854657374546f6b656e54727932").to_vec(), - amount: 1, - }], - )]), - }, - ..Default::default() - }] - } - pub(crate) fn query_utxos_io( cardano_addr: &str, ogmios_addr: &'static str,