Skip to content

Commit

Permalink
Merge pull request #327 from trilitech/staging
Browse files Browse the repository at this point in the history
Update main from staging, Feb 16
  • Loading branch information
timothymcmackin authored Feb 16, 2024
2 parents 7850abd + 135c901 commit b8d539e
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 67 deletions.
17 changes: 12 additions & 5 deletions docs/architecture/governance/amendment-history.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
title: History of amendments
authors: 'Thomas Zoughebi, Aymeric Bethencourt, and Maxime Fernandez'
last_update:
date: 30 June 2023
date: 14 February 2024
---

As presented in [Governance](../governance), the Tezos blockchain is constantly evolving, through new amendments. In this chapter, we will present an overview of past proposals and the reasons for their approval or disapproval.
As presented in [Governance](../governance), the Tezos blockchain is constantly evolving, through new amendments.
These are the past proposals to amend the Tezos protocol.

## [Athens](https://tezos.gitlab.io/protocols/004_Pt24m4xi.html) (Pt24m4xiP)

Expand Down Expand Up @@ -196,8 +197,14 @@ Mumbai's main changes are:

For more information, see the blog post from [Nomadic Labs](https://research-development.nomadic-labs.com/mumbai-announcement.html) and the [reference documentation](https://tezos.gitlab.io/protocols/016_mumbai.html).

## What have we learned so far?
## [Nairobi](https://tezos.gitlab.io/protocols/017_nairobi.html) (PtNairob)

In this chapter, we went through the past proposals' history and how and why they were approved or rejected.
*Nairobi* was autonomously [activated](https://tzstats.com/3760129) in June 2023.

In the next chapter, we will see the details of operations costs and various rewards calculations.
Nairobi's main changes are:

* Increased TPS thanks to a new gas model for signature verification.
* Renaming endorsements to attestations to specify the behavior of these consensus operations.
* Smart Rollups can now be aware of protocol updates happening on the L1.

For more information, see the blog post from [Nomadic Labs](https://research-development.nomadic-labs.com/nairobi-announcement.html) and the [reference documentation](https://tezos.gitlab.io/protocols/017_nairobi.html).
72 changes: 35 additions & 37 deletions docs/smart-contracts/languages/ligo.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: LIGO
last_update:
date: 29 June 2023
date: 8 February 2024
---

LIGO is a functional programming language that is intended to be both user-friendly and to avoid patterns that make formal verification difficult.
Expand All @@ -18,57 +18,55 @@ To learn LIGO, see these tutorials:
- [Deploy a smart contract with CameLIGO](../../tutorials/smart-contract/cameligo)
- [Deploy a smart contract with JsLIGO](../../tutorials/smart-contract/jsligo)

Let's define a LIGO contract in the two flavours above.
Here are examples of straightforward LIGO contracts.
Each contract stores an integer and provides entrypoints that increase or decrease the integer or reset it to zero.

## CameLIGO

```
```ocaml
type storage = int
type parameter =
Increment of int
| Decrement of int
| Reset
type returnValue = operation list * storage
// Increment entrypoint
[@entry] let increment (delta : int) (store : storage) : returnValue =
[], store + delta
type return = operation list * storage
// Decrement entrypoint
[@entry] let decrement (delta : int) (store : storage) : returnValue =
[], store - delta
let main (action, store : parameter * storage) : return =
[],
(match action with
Increment n -> store + n
| Decrement n -> store - n
| Reset -> 0)
// Reset entrypoint
[@entry] let reset (() : unit) (_ : storage) : returnValue =
[], 0
```

## JsLIGO

```
type storage = int;
type parameter =
["Increment", int]
| ["Decrement", int]
| ["Reset"];
type return_ = [list<operation>, storage];
let main = (action: parameter, store: storage) : return_ => {
return [
list([]),
match(action, {
Increment: n => store + n,
Decrement: n => store - n,
Reset: () => 0
})
];
};
```ts
namespace Counter {
type storage = int;
type returnValue = [list<operation>, storage];

// Increment entrypoint
@entry
const increment = (delta : int, store : storage) : returnValue =>
[list([]), store + delta];

// Decrement entrypoint
@entry
const decrement = (delta : int, store : storage) : returnValue =>
[list([]), store - delta];

// Reset entrypoint
@entry
const reset = (_p : unit, _s : storage) : returnValue =>
[list([]), 0];
}
```

This LIGO contract accepts the following LIGO expressions: `Increment(n)`, `Decrement(n)` and `Reset`. Those serve as `entrypoint` identification.

## Further reading

- [LIGO documentation](https://ligolang.org/docs/intro/introduction?lang=jsligo)
- [LIGO tutorials](https://ligolang.org/docs/tutorials/getting-started?lang=jsligo)
- [OpenTezos](https://opentezos.com/ligo)

8 changes: 4 additions & 4 deletions docs/tutorials/smart-contract/archetype.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ For more information about Archetype, see https://archetype-lang.org/.
The contract that you deploy in this tutorial stores a single integer.
It provides entrypoints that clients can call to change the value of that integer:

- The `increment` endpoint accepts an integer as a parameter and adds that integer to the value in storage
- The `decrement` endpoint accepts an integer as a parameter and subtracts that integer from the value in storage
- The `reset` endpoint takes no parameters and resets the value in storage to 0
- The `increment` entrypoint accepts an integer as a parameter and adds that integer to the value in storage
- The `decrement` entrypoint accepts an integer as a parameter and subtracts that integer from the value in storage
- The `reset` entrypoint takes no parameters and resets the value in storage to 0

After you deploy the contract, you or any other user can call it through the command line or a distributed application (dApp).

Expand Down Expand Up @@ -320,4 +320,4 @@ Now the contract is running on the Tezos blockchain.
You or any other user can call it from any source that can send transactions to Tezos, including command-line clients, dApps, and other contracts.

If you want to continue working with this contract, try creating a dApp to call it from a web application, similar to the dApp that you create in the tutorial [Build a simple web application](../build-your-first-app/).
You can also try adding your own endpoints and originating a new contract, but you cannot update the existing contract after it is deployed.
You can also try adding your own entrypoints and originating a new contract, but you cannot update the existing contract after it is deployed.
20 changes: 12 additions & 8 deletions docs/tutorials/smart-contract/cameligo.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,16 @@ A smart contract has these parts:
The contract that you deploy in this tutorial stores a single integer.
It provides entrypoints that clients can call to change the value of that integer:

- The `increment` endpoint accepts an integer as a parameter and adds that integer to the value in storage
- The `decrement` endpoint accepts an integer as a parameter and subtracts that integer to the value in storage
- The `reset` endpoint takes no parameters and resets the value in storage to 0
- The `increment` entrypoint accepts an integer as a parameter and adds that integer to the value in storage
- The `decrement` entrypoint accepts an integer as a parameter and subtracts that integer from the value in storage
- The `reset` entrypoint takes no parameters and resets the value in storage to 0

After you deploy the contract, you or any other user can call it from a variety of Tezos clients and decentralized applications (dApps).

## Creating and funding a wallet

To deploy and work with the contract, you need a wallet and some tez tokens.
You can get test tokens for free on the Ghostnet test network:

1. Install a Tezos-compatible wallet.
Which wallet you install is up to you and whether you want to install a wallet on your computer, in a browser extension, or as a mobile app.
Expand Down Expand Up @@ -128,7 +129,7 @@ You can work with LIGO code in any IDE, but this online IDE keeps you from havin
type storage = int
```

1. Add this code to define the return type for the endpoints.
1. Add this code to define the return type for the entrypoints.
Tezos entrypoints return two values: a list of other operations to call and the new value of the contract's storage.

```ocaml
Expand Down Expand Up @@ -202,7 +203,7 @@ Before you can deploy the contract to Tezos, you must compile it to Michelson, t
At the bottom of the window, the Result field shows the response `(LIST_EMPTY(), 42)`.
This response means that the contract did not call any other contracts, so the list of operations is empty.
Then it shows the new value of the storage.
You can test the decrement and reset functions in the same way.
You can test the decrement function in the same way.
If you see any errors, make sure that the code of your contract matches the code in the previous section.

1. Test the `Reset` entrypoint in the same way, but pass `unit` as the input parameter and any integer in the storage field.
Expand Down Expand Up @@ -243,7 +244,10 @@ You can ignore this warning because you can set the initial storage now.
When the contract is deployed, the Deploy contract window shows the address at the bottom of the window.

1. Copy the address of the deployed contract, which starts with `KT1`.
It will not be shown again.

:::warning
Copy the contract address now, because it will not be shown again.
:::

Now you can call the contract from any Tezos client, including web applications and command-line applications like [The Octez client](../../developing/octez-client).

Expand All @@ -260,7 +264,7 @@ It also allows you to call the contract.

<img src="/img/tutorials/bcd-originated-contract.png" alt="The block explorer, showing information about the contract" style={{width: 500}} />

1. Try calling one of the endpoints:
1. Try calling one of the entrypoints:

1. Go to the **Storage** tab and check the current state of the storage, which should be the integer that you put in the Deploy window.

Expand Down Expand Up @@ -289,4 +293,4 @@ Now the contract is running on the Tezos blockchain.
You or any other user can call it from any source that can send transactions to Tezos, including Octez, dApps, and other contracts.

If you want to continue working with this contract, try creating a dApp to call it from a web application, similar to the dApp that you create in the tutorial [Build a simple web application](../build-your-first-app/).
You can also try adding your own endpoints and originating a new contract, but you cannot update the existing contract after it is deployed.
You can also try adding your own entrypoints and originating a new contract, but you cannot update the existing contract after it is deployed.
20 changes: 12 additions & 8 deletions docs/tutorials/smart-contract/jsligo.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,16 @@ A smart contract has these parts:
The contract that you deploy in this tutorial stores a single integer.
It provides entrypoints that clients can call to change the value of that integer:

- The `increment` endpoint accepts an integer as a parameter and adds that integer to the value in storage
- The `decrement` endpoint accepts an integer as a parameter and subtracts that integer to the value in storage
- The `reset` endpoint takes no parameters and resets the value in storage to 0
- The `increment` entrypoint accepts an integer as a parameter and adds that integer to the value in storage
- The `decrement` entrypoint accepts an integer as a parameter and subtracts that integer from the value in storage
- The `reset` entrypoint takes no parameters and resets the value in storage to 0

After you deploy the contract, you or any other user can call it from a variety of Tezos clients and decentralized applications (dApps).

## Creating and funding a wallet

To deploy and work with the contract, you need a wallet and some tez tokens.
You can get test tokens for free on the Ghostnet test network:

1. Install a Tezos-compatible wallet.
Which wallet you install is up to you and whether you want to install a wallet on your computer, in a browser extension, or as a mobile app.
Expand Down Expand Up @@ -136,7 +137,7 @@ You can work with LIGO code in any IDE, but this online IDE keeps you from havin
type storage = int;
```

1. Add this code to define the return type for the endpoints.
1. Add this code to define the return type for the entrypoints.
Tezos entrypoints return two values: a list of other operations to call and the new value of the contract's storage.

```ts
Expand Down Expand Up @@ -217,7 +218,7 @@ Before you can deploy the contract to Tezos, you must compile it to Michelson, t
At the bottom of the window, the Result field shows the response `(LIST_EMPTY(), 42)`.
This response means that the contract did not call any other contracts, so the list of operations is empty.
Then it shows the new value of the storage.
You can test the decrement and reset functions in the same way.
You can test the decrement function in the same way.
If you see any errors, make sure that the code of your contract matches the code in the previous section.

1. Test the `Reset` entrypoint in the same way, but pass `unit` as the input parameter and any integer in the storage field.
Expand Down Expand Up @@ -258,7 +259,10 @@ You can ignore this warning because you can set the initial storage now.
When the contract is deployed, the Deploy contract window shows the address at the bottom of the window.

1. Copy the address of the deployed contract, which starts with `KT1`.
It will not be shown again.

:::warning
Copy the contract address now, because it will not be shown again.
:::

Now you can call the contract from any Tezos client, including web applications and command-line applications like [The Octez client](../../developing/octez-client).

Expand All @@ -275,7 +279,7 @@ It also allows you to call the contract.

<img src="/img/tutorials/bcd-originated-contract.png" alt="The block explorer, showing information about the contract" style={{width: 500}} />

1. Try calling one of the endpoints:
1. Try calling one of the entrypoints:

1. Go to the **Storage** tab and check the current state of the storage, which should be the integer that you put in the Deploy window.

Expand Down Expand Up @@ -304,4 +308,4 @@ Now the contract is running on the Tezos blockchain.
You or any other user can call it from any source that can send transactions to Tezos, including Octez, dApps, and other contracts.

If you want to continue working with this contract, try creating a dApp to call it from a web application, similar to the dApp that you create in the tutorial [Build a simple web application](../build-your-first-app/).
You can also try adding your own endpoints and originating a new contract, but you cannot update the existing contract after it is deployed.
You can also try adding your own entrypoints and originating a new contract, but you cannot update the existing contract after it is deployed.
10 changes: 5 additions & 5 deletions docs/tutorials/smart-contract/smartpy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ A smart contract has these parts:
The contract that you deploy in this tutorial stores a string value.
It provides entrypoints that clients can call to change the value of that string:

- The `replace` endpoint accepts a new string as a parameter and stores that string, replacing the existing string.
- The `append` endpoint accepts a new string as a parameter and appends it to the existing string.
- The `replace` entrypoint accepts a new string as a parameter and stores that string, replacing the existing string.
- The `append` entrypoint accepts a new string as a parameter and appends it to the existing string.

After you deploy the contract, you or any other user can call it from various sources, including web applications, other contracts, and the Octez command-line client.

Expand Down Expand Up @@ -154,7 +154,7 @@ You can work with SmartPy code in any IDE, but this online IDE keeps you from ha
scenario.verify(contract.data.greeting == "Hi, there!")
```

These tests run automatically on compilation to verify that the replace and append endpoints work.
These tests run automatically on compilation to verify that the replace and append entrypoints work.
For more information about SmartPy and tests, see the [SmartPy documentation](https://smartpy.io/).

The SmartPy online IDE looks like this:
Expand Down Expand Up @@ -261,7 +261,7 @@ It will not be shown again.

<img src="/img/tutorials/bcd-originated-contract.png" alt="The block explorer, showing information about the contract" style={{width: 500}} />

1. Try calling one of the endpoints:
1. Try calling one of the entrypoints:

1. Go to the **Storage** tab and check the current state of the storage.
If you just originated the contract, the storage is "Hello" because that's the value set in the smart contract code.
Expand Down Expand Up @@ -291,4 +291,4 @@ Now the contract is running on the Tezos blockchain.
You or any other user can call it from any source that can send transactions to Tezos, including Octez, dApps, and other contracts.

If you want to continue working with this contract, try creating a dApp to call it from a web application, similar to the dApp that you create in the tutorial [Build a simple web application](../build-your-first-app/).
You can also try adding your own endpoints and originating a new contract, but you cannot update the existing contract after it is deployed.
You can also try adding your own entrypoints and originating a new contract, but you cannot update the existing contract after it is deployed.

0 comments on commit b8d539e

Please sign in to comment.