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

Plutus v3 #83

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open

Conversation

logicalmechanism
Copy link
Contributor

Beginning of the v2 to v3 transition. This branch is pure Plutus V3. It contains breaking changes.

Each new type needs a review and double check but it at least lays down the groundwork for this transition.

New types are generated from: v1.22.1.0 Context

I tried to group types where they should be going so some movement might be needed.

@logicalmechanism
Copy link
Contributor Author

logicalmechanism commented Mar 1, 2024

test validator for sancho net:

validator {
  fn params(_datum: Void, _redeemer: Void, context: ScriptContext) -> Bool {
    when context.purpose is {
      Spend(_) -> {
       let d = #"97f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb"
        let g1 = builtin.bls12_381_g1_uncompress(d)
        let x = g1 |> builtin.bls12_381_g1_compress
        x == d
      }
      _ -> False
    }
  }
}

Should be able to compile the script, create a reference script utxo, and spend into and out of that contract.
aiken --version
aiken v1.0.24-alpha+d698f76

Copy link
Member

@KtorZ KtorZ left a comment

Choose a reason for hiding this comment

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

Awesome! Thanks for doing this. I have made a few naming suggestion essentially trying to explicit some of the guidelines / conventions that we've been following in the standard library.

I'd be nice to get also extend those acceptance tests here: https://github.com/aiken-lang/aiken/tree/main/examples/acceptance_tests/script_context with Conway transactions, though this requires having already updated Aiken's simulate command and internals with the ability to create full Plutus V3 script contexts. In the meantime, using Ogmios for evaluating transactions is a viable option.

.github/workflows/continuous-integration.yml Outdated Show resolved Hide resolved
lib/aiken/transaction.ak Outdated Show resolved Hide resolved
lib/aiken/transaction/certificate.ak Outdated Show resolved Hide resolved
lib/aiken/transaction/certificate.ak Outdated Show resolved Hide resolved
lib/aiken/transaction/credential.ak Outdated Show resolved Hide resolved
lib/aiken/transaction/governance.ak Outdated Show resolved Hide resolved
lib/aiken/transaction/governance.ak Outdated Show resolved Hide resolved
lib/aiken/transaction/governance.ak Outdated Show resolved Hide resolved
lib/aiken/transaction/governance.ak Outdated Show resolved Hide resolved
lib/aiken/transaction/governance.ak Outdated Show resolved Hide resolved
logicalmechanism and others added 14 commits March 11, 2024 11:57
ChangedParameters -> ChangedProtocolParameters

Co-authored-by: Matthias Benkort <5680256+KtorZ@users.noreply.github.com>
ParameterChange -> ProtocolParameterChange

Co-authored-by: Matthias Benkort <5680256+KtorZ@users.noreply.github.com>
return_addr -> return_address

Co-authored-by: Matthias Benkort <5680256+KtorZ@users.noreply.github.com>
constitution -> guardrails

Co-authored-by: Matthias Benkort <5680256+KtorZ@users.noreply.github.com>
Co-authored-by: Matthias Benkort <5680256+KtorZ@users.noreply.github.com>
Co-authored-by: Matthias Benkort <5680256+KtorZ@users.noreply.github.com>
Co-authored-by: Matthias Benkort <5680256+KtorZ@users.noreply.github.com>
Co-authored-by: Matthias Benkort <5680256+KtorZ@users.noreply.github.com>
Name changes and adding back in the yml workspace file
@logicalmechanism
Copy link
Contributor Author

With Aiken 1.0.26, the use of the Dict type was discouraged.

https://github.com/logicalmechanism/stdlib/blob/plutus-v3/lib/aiken/transaction.ak#L67-L87

Does this mean all of these Dicts should be turned into lists of tuples too? like List<(x,y)> @KtorZ

@KtorZ
Copy link
Member

KtorZ commented Apr 7, 2024

With Aiken 1.0.26, the use of the Dict type was discouraged.

Not really. It wasn't discourage, but simply made safer. We will still use Dict in the standard library in places that make sense. But We'll also use type Map<k, v> = List<Pair<k, v>> in other places as soon as the new Pair type lands in.

@logicalmechanism
Copy link
Contributor Author

With Aiken 1.0.26, the use of the Dict type was discouraged.

Not really. It wasn't discourage, but simply made safer. We will still use Dict in the standard library in places that make sense. But We'll also use type Map<k, v> = List<Pair<k, v>> in other places as soon as the new Pair type lands in.

Well when the Pair type comes out in 1.0.27 I think I will revisit this and see what to change or update. I am attempting to use this branch on SanchoNet with some interesting errors so I was assuming something may be went wrong because of the Dict type.

@logicalmechanism
Copy link
Contributor Author

New types are generated from: v1.30.0.0 Context.

Key changes:

ScriptContext using ScriptInfo now and has the redeemer field.

There are naming conflicts introduced here so to avoid any issues, the ScriptPurpose uses the verb form of the action and the ScriptInfo will use the present tense verb form.

The new types need an additional review due to the introduction of Pair/Pairs type. I want to make sure everything still agrees with the current branch of both the stdlib and plutus.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🫡 In Progress
Development

Successfully merging this pull request may close these issues.

None yet

2 participants