Skip to content

Commit

Permalink
Merge cardano-cli golden tests
Browse files Browse the repository at this point in the history
This folder is required for the cardano-testnet
  • Loading branch information
kayvank committed Mar 16, 2023
2 parents f75881e + 6ec1f41 commit 42b7094
Show file tree
Hide file tree
Showing 32 changed files with 226 additions and 1,164 deletions.
47 changes: 3 additions & 44 deletions CONTRIBUTING.adoc
Expand Up @@ -307,51 +307,10 @@ allows us to remove the ``source-repository-package`` stanza.

=== How to work with a local copy of source dependencies

Sometimes you may want to make a change that spans both `marconi` *and* some of its dependencies (most commonly, the packages in `plutus`).
The obvious workflow is to make changes in the `plutus` repository, update the pin in `plutus-apps` to point to the new commit, test, repeat.
Sometimes you may want to make a change that spans both `marconi` *and* some of its dependencies (most commonly, the packages in `plutus-apps`).
The obvious workflow is to make changes in the `plutus-apps` repository, update the pin in `marconi` to point to the new commit, test, repeat.
But this is very tedious and it's much nicer to work with a local checkout where cabal can incrementally rebuild the whole thing.

Here's an example of doing this for some packages in `plutus`.
You may need to adapt this example depending on what exactly you're trying to do.

First of all, we add some lines to `cabal.project.local` (we do this to avoid modifying `cabal.project`, which is tracked by git, as much as possible).
```
-- Add the packages that we want to pull in locally as "local" packages
-- (assuming a `plutus-core` checkout in `../plutus`)
packages:
../plutus/plutus-core
../plutus/plutus-tx
../plutus/plutus-tx-plugin
../plutus/plutus-ledger-api

-- Sometimes cabal may get upset about dependencies, you can make its life easier
-- by turning off unnecessary features for the altered packages.
package plutus-core
benchmarks: false
tests: false
package plutus-tx
benchmarks: false
tests: false
package plutus-tx-plugin
benchmarks: false
tests: false
```

Then we unfortunately do need to modify the main `cabal.project`, to comment out the packages that we are replacing with local ones.
```
source-repository-package
...
subdir:
--plutus-core
--plutus-ledger-api
--plutus-tx
--plutus-tx-plugin
word-array
prettyprinter-configurable
stubs/plutus-ghc-stub
```

After this, a `cabal build` should build with the local checkouts of `plutus` for the packages you specified.
https://github.com/input-output-hk/plutus-apps/blob/main/CONTRIBUTING.adoc#how-to-work-with-a-local-copy-of-source-dependencies[Plutus-apps repository] has a nice example of such workflow.

== Working conventions

Expand Down
39 changes: 9 additions & 30 deletions README.adoc
Expand Up @@ -10,18 +10,15 @@ image:https://img.shields.io/badge/policy-Cardano%20Engineering%20Handbook-infor

Marconi is A lightweight customizable solution for indexing and querying the Cardano blockchain.

This repository contains:
[[Architecture]]
== Architecture

Marconi consists of a set of compomentes:

- link:./marconi-core[marconi-core]
- link:./marconi-chain-index[marconi-chain-indexer]
- link:./marconi-sidechain[marconi-sidechain]

[IMPORTANT]
====
The rest of this README is focussed on people who want to develop or contribute to the Framework.
====

== Development

[[how-to-develop]]
Expand All @@ -38,18 +35,12 @@ Run `nix develop` to enter the development shell and you will be presented with
User documentations are work in progress. You may generate Haskell API documenations (haddocks) directly from the `nix shell` for each of marconi compoments:

```
cabal new-haddock marconi-core
cabal new-haddock marconi-chain-index
cabal new-haddock marconi-sidechain
cabal haddock marconi-core
cabal haddock marconi-chain-index
cabal haddock marconi-sidechain

```

== Branching, Versioning and Releases

At this time our protected branch is `main`.
We adopt the PVP versioning scheme.
Check out link:doc/BRANCHING-AND-RELEASE.adoc[Branching Policy and Release Process] to learn more.

=== Dependency update

The dependency update policy is dependent on the protected branch.
Expand Down Expand Up @@ -81,22 +72,10 @@ However, note that this is pre-release software, so we will not usually be provi
[[how-to-develop]]
=== How to develop and contribute to the project

See link:CONTRIBUTING{outfilesuffix}[CONTRIBUTING], which describes our processes in more detail including development environments; and link:ARCHITECTURE{outfilesuffix}[ARCHITECTURE], which describes the structure of the repository.

=== How to depend on the project from another Haskell project

None of our libraries are on Hackage, unfortunately (many of our dependencies aren't either).
So for the time being, you need to:

. Add `plutus-apps` as a `source-repository-package` to your `cabal.project`.
. Copy the `source-repository-package` stanzas from our `cabal.project` to yours.
. Copy additional stanzas from our `cabal.project` as you need, e.g. you may need some of the `allow-newer` stanzas.

The https://github.com/input-output-hk/plutus-starter[plutus-starter] project
(deprecated) provides an example.
See link:CONTRIBUTING{outfilesuffix}[CONTRIBUTING], which describes our processes in more detail including development environments; and <<Architecture>>, which describes the structure of the repository.

== Licensing

You are free to copy, modify, and distribute the Plutus Platform with
You are free to copy, modify, and distribute the Marconi Platform with
under the terms of the Apache 2.0 license. See the link:./LICENSE[LICENSE]
and link:./NOTICE[NOTICE] files for details.
10 changes: 10 additions & 0 deletions __std__/cells/marconi/devshells/marconi-shell.nix
Expand Up @@ -134,5 +134,15 @@ inputs.std.lib.dev.mkShell {
value = pkgs.lib.optionalString
(pkgs.stdenv.hostPlatform.libc == "glibc") "${pkgs.glibcLocales}/lib/locale/locale-archive";
}
# These environemnt variables are rquired by marconi-chain-index tets
{
name = "CARDANO_CLI";
value = "${cell.library.cardano-node.cardano-cli}/bin/cardano-cli";
}
{
name = "CARDANO_NODE";
value = "${cell.library.cardano-node.cardano-node}/bin/cardano-node";
}

];
}
63 changes: 10 additions & 53 deletions __std__/cells/marconi/library/make-marconi-project.nix
Expand Up @@ -19,8 +19,15 @@ let

shell.withHoogle = false;

# TODO(std) fix this when nix-shell goes away
sha256map = import (inputs.self + /nix/pkgs/haskell/sha256map.nix);
# source-repository-packages
sha256map = {
"https://github.com/input-output-hk/cardano-addresses"."b7273a5d3c21f1a003595ebf1e1f79c28cd72513" = "129r5kyiw10n2021bkdvnr270aiiwyq58h472d151ph0r7wpslgp";
"https://github.com/input-output-hk/cardano-config"."1646e9167fab36c0bff82317743b96efa2d3adaa" = "sha256-TNbpnR7llUgBN2WY7CryMxNVupBIUH01h1hRNHoxboY=";
"https://github.com/input-output-hk/cardano-ledger"."da3e9ae10cf9ef0b805a046c84745f06643583c2" = "sha256-3VUZKkLu1R43GUk9IwgsGQ55O0rnu8NrCkFX9gqA4ck=";
"https://github.com/input-output-hk/cardano-wallet"."18a931648550246695c790578d4a55ee2f10463e" = "0i40hp1mdbljjcj4pn3n6zahblkb2jmpm8l4wnb36bya1pzf66fx";
"https://github.com/sevanspowell/hw-aeson"."b5ef03a7d7443fcd6217ed88c335f0c411a05408" = "1dwx90wqavdl4d0npbzbxyh2pzi9zs1qz7nvsrb3n1cm2xbv4i5z";
"https://github.com/input-output-hk/plutus-apps"."9d90900d049f2333960fbc349cc816d2b163cda5" = "0cqm86z73k54rcnnplcwxl8v0l96pnmwlq4hgn9fjmlj01j2v3bv";
};

inputMap = {
"https://input-output-hk.github.io/cardano-haskell-packages" = inputs.CHaP;
Expand Down Expand Up @@ -71,24 +78,7 @@ let
ln -s ${pkgs.windows.mcfgthreads}/bin/mcfgthread-12.dll $out/bin/mcfgthread-12.dll
'';
in
lib.mkIf (pkgs.stdenv.hostPlatform.isWindows) {
packages = {
# Add dll symlinks to the compoents we want to run.
# plutus-core.components.tests.plutus-core-test.postInstall = symlinkDlls;
# plutus-core.components.tests.plutus-ir-test.postInstall = symlinkDlls;
# plutus-core.components.tests.untyped-plutus-core-test.postInstall = symlinkDlls;
# plutus-ledger-api.components.tests.plutus-ledger-api-test.postInstall = symlinkDlls;

# These three tests try to use `diff` and the following could be used to make the
# linux version of diff available. Unfortunately the paths passed to it are windows style.
# plutus-core.components.tests.plutus-core-test.build-tools = [ pkgs.buildPackages.diffutils ];
# plutus-core.components.tests.plutus-ir-test.build-tools = [ pkgs.buildPackages.diffutils ];
# plutus-core.components.tests.untyped-plutus-core-test.build-tools = [ pkgs.buildPackages.diffutils ];
# plutus-core.components.tests.plutus-core-test.buildable = lib.mkForce false;
# plutus-core.components.tests.plutus-ir-test.buildable = lib.mkForce false;
# plutus-core.components.tests.untyped-plutus-core-test.buildable = lib.mkForce false;
};
}
lib.mkIf (pkgs.stdenv.hostPlatform.isWindows) { }
)
(lib.mkIf pkgs.stdenv.hostPlatform.isDarwin {
packages = {
Expand Down Expand Up @@ -122,39 +112,6 @@ let

marconi-sidechain.doHaddock = deferPluginErrors;
marconi-sidechain.flags.defer-plugin-errors = deferPluginErrors;

# plutus-contract.doHaddock = deferPluginErrors;
# plutus-contract.flags.defer-plugin-errors = deferPluginErrors;

# plutus-e2e-tests.doHaddock = deferPluginErrors;
# plutus-e2e-tests.flags.defer-plugin-errors = deferPluginErrors;
# plutus-e2e-tests.preCheck = "
# export CARDANO_CLI=${config.hsPkgs.cardano-cli.components.exes.cardano-cli}/bin/cardano-cli${pkgs.stdenv.hostPlatform.extensions.executable}
# export CARDANO_NODE=${config.hsPkgs.cardano-node.components.exes.cardano-node}/bin/cardano-node${pkgs.stdenv.hostPlatform.extensions.executable}
# export CARDANO_NODE_SRC=${src}
# ";
# plutus-e2e-tests.components.tests.plutus-e2e-tests-test.build-tools =
# lib.mkForce (with pkgs.buildPackages; [ jq coreutils shellcheck lsof ]);

# plutus-use-cases.doHaddock = deferPluginErrors;
# plutus-use-cases.flags.defer-plugin-errors = deferPluginErrors;

# plutus-ledger.doHaddock = deferPluginErrors;
# plutus-ledger.flags.defer-plugin-errors = deferPluginErrors;

# plutus-script-utils.doHaddock = deferPluginErrors;
# plutus-script-utils.flags.defer-plugin-errors = deferPluginErrors;

# plutus-example.doHaddock = deferPluginErrors;
# plutus-example.flags.defer-plugin-errors = deferPluginErrors;
# plutus-example.preCheck = "
# export CARDANO_CLI=${config.hsPkgs.cardano-cli.components.exes.cardano-cli}/bin/cardano-cli${pkgs.stdenv.hostPlatform.extensions.executable}
# export CARDANO_NODE=${config.hsPkgs.cardano-node.components.exes.cardano-node}/bin/cardano-node${pkgs.stdenv.hostPlatform.extensions.executable}
# export CARDANO_SUBMIT_API=${config.hsPkgs.cardano-submit-api.components.exes.cardano-submit-api}/bin/cardano-submit-api${pkgs.stdenv.hostPlatform.extensions.executable}
# export CREATE_SCRIPT_CONTEXT=${config.hsPkgs.plutus-example.components.exes.create-script-context}/bin/create-script-context${pkgs.stdenv.hostPlatform.extensions.executable}
# export CARDANO_NODE_SRC=${src}
# ";

# FIXME: Haddock mysteriously gives a spurious missing-home-modules warning
plutus-tx-plugin.doHaddock = false;

Expand Down

0 comments on commit 42b7094

Please sign in to comment.