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

Docs revamp #5866

Draft
wants to merge 40 commits into
base: master
Choose a base branch
from
Draft

Docs revamp #5866

wants to merge 40 commits into from

Conversation

joseph-fajen
Copy link
Contributor

@joseph-fajen joseph-fajen commented Mar 28, 2024

This Draft PR is for the Plutus Core Plutus Tx documentation revamp project. I'll use nested PRs within this Draft PR until the docs revamp project reaches a to-be-defined level of maturity to merge with master.

  • Establish new top-level organizational structure
  • Port over all of the existing content from the read-the-docs site to this new top-level structure.
  • Create a Developer onboarding and quick setup guide
    • Draft has been reviewed a few times, getting pretty close to a complete doc
    • Need to align on the most appropriate first contract example to use
    • Need to align a bit more on scope
  • Write an updated Introduction section for review and discussion
  • Work with web dev team to work out new docs platform requirements
  • Do a deep dive on all the content to improve organization and ease of readability. This is a larger and ongoing aspect of the documentation work that I plan to prioritize in coordination with the team after we are up and live with the new docs platform.
  • Write up a list of FAQs for review
    • Some feedback needs to be incorporated
    • The questions are written, but the answers to the questions will be written at a later stage
  • Import all the docs into the new docs platform as soon as the new platform is available
  • Test the docs in the new platform to make sure links work, navigation is clear

@zliu41 zliu41 requested a review from a team March 29, 2024 03:04
@zliu41
Copy link
Member

zliu41 commented Mar 29, 2024

Is there a particular reason to use md instead of rst? I'm not sure whether md allows importing code from Haskell modules like rst does.

Copy link
Member

@zliu41 zliu41 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a partial review. Note that when we write docs the style we adopt is to write each sentence on a separate line.

#### Hardware and OS requirements

**Processing power**
- Minimum: Intel Core i5 or AMD equivalent
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How were these requirements determined? I doubt you can't develop Plutus on an intel core i3, for example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just did a little Googling to get a sense of some common recommended specs.

#### GHC (Glasgow Haskell Compiler)

- GHC is the main compiler for Haskell with many extensions and optimizations.
- To install GHC, run `stack setup`. Stack will automatically install the appropriate version of GHC for your project.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to teach people how to install Stack, GHC and Cabal, since they are standard Haskell tooling. Also, if you are using Nix or Docker, they will already be installed for you.

I also don't think "stack setup" is the standard way of installing GHC.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know. Taking a step back to look at the bigger picture, we may need to revisit the question of how much detail is appropriate to include given our intended audience. I think I'll make a revised outline for review and discussion to simplify getting agreement about scope and detail.


To verify your Cabal installation, run `cabal –version`.

### Git
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We definitely don't need to teach people how to install Git. It is so basic and not specific to Plutus.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

- macOS: macOS Catalina (10.15) or later
- Windows: While Windows can be used for Haskell development, it is less common and might require additional setup such as using Windows Subsystem for Linux (WSL2) to provide a Linux-compatible environment.

### Tools
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest stripping out this whole subsection. This alone is enough: https://github.com/IntersectMBO/plutus/blob/master/doc/read-the-docs-site/quick-start.rst

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like some great resources in that quick-start.rst file!


An IDE provides a comprehensive environment for writing, testing, and debugging your Haskell code. Visual Studio Code (VS Code) is a widely used code editor that supports the Haskell extension. See [https://code.visualstudio.com/](https://code.visualstudio.com/).

## Testing your environment setup
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this. We are basically teaching people how to write hello world in Haskell. That's not our responsibility - we should assume users already know Haskell, and if they are new to Haskell, they can find this information (and much more materials for Haskell beginners) elsewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, good point.

Before we start building our vesting smart contract, let's go over the following core concepts that underpin Plutus smart contracts.

### Datum
In a vesting contract, the datum represents the state and conditions of the vesting agreement. It includes information such as the beneficiary's public key hash and the deadline for the vesting period. The datum is attached to the UTxO that holds the vested funds and is used by the contract's validator script to enforce the vesting conditions. It ensures that the funds can only be released to the beneficiary after the specified deadline has passed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to have a subsection explaining what Datum is, it's better to explain what it is in general, and then proceed to explain what it does in the specific context of a vesting contract.

Besides, if there's a section explaining core concepts, I think it should start with the EUTxO model.


1. Create a new directory for your project and navigate to it in your terminal.

2. If you are using Nix, enter a Nix shell that provides the necessary development environment by running `nix develop` in your project directory. If you are not using Nix, make sure that all required C libraries are installed since PlutusTx depends on `cardano-base`, which in turn depends on cryptographic C libraries like `libblst`, `libsecp256k1`, and `libsodium`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part is no longer needed following #5864

In a vesting contract, the datum represents the state and conditions of the vesting agreement. It includes information such as the beneficiary's public key hash and the deadline for the vesting period. The datum is attached to the UTxO that holds the vested funds and is used by the contract's validator script to enforce the vesting conditions. It ensures that the funds can only be released to the beneficiary after the specified deadline has passed.

### Redeemer
A redeemer is a piece of data that is provided by the spending transaction. It is used by the validator script to make decisions during the validation process. The redeemer is used to pass dynamic information to the validator script that may not be known at the time the UTXO is created but is only known at the time the UTXO is being spent. In the context of a vesting contract, the redeemer is typically not used, since the contract's logic does not need any additional input from the transaction. Instead, the validation of the transaction is based solely on the datum (vesting conditions) and the script context, such as checking if the deadline has passed and if the transaction is signed by the beneficiary. However, if required, a redeemer could be used to provide additional arguments to the validator script.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the context of a vesting contract, the redeemer is typically not used

The fact that this example does not need a redeemer suggests that it is not a very interesting example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to use a simple and straightforward example that is easy to understand from the perspective of someone who has never used Plutus. This is an example from the Plutus Pioneer Program. We can consider other examples if they would more effectively serve the purpose of this onboarding guide.


### Section 1: Importing the required modules and functions

```haskell
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't have code inlined in the md files. The code needs to be put in a Haskell module and checked by CI.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, good to know. Once we agree on the example we want to use here, would we use code block inclusions instead of inlining code to show each section we want to describe? I'm not sure how we would follow that practice while reviewing drafts. But once we have a documentation platform established for the revamp, then I imagine we could generate draft pages that include code blocks.

@joseph-fajen
Copy link
Contributor Author

joseph-fajen commented Mar 29, 2024

@zliu41
Is there a particular reason to use md instead of rst? I'm not sure whether md allows importing code from Haskell modules like rst does.

I'm working with the web dev team to determine whether we will stay with Read the docs using .rst files or Docusaurus where I would use .md files. So for now I'm using .md until we know what platform we'll be using for the revamp. The code block inclusion question is top of mind in our discussion with the web dev team.

@joseph-fajen
Copy link
Contributor Author

@zliu41
I did a partial review. Note that when we write docs the style we adopt is to write each sentence on a separate line.

Thanks for reminding me about writing each sentence on a separate line. I will follow that practice.

@zeme-wana zeme-wana force-pushed the master branch 2 times, most recently from a161078 to db5cabb Compare July 9, 2024 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants