Skip to content

Commit

Permalink
Merge branch 'master' into chains/mainnet-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
olegfomenko committed Jun 25, 2024
2 parents 2d2c962 + 4a989cf commit 6dde640
Show file tree
Hide file tree
Showing 27 changed files with 1,214 additions and 209 deletions.
87 changes: 45 additions & 42 deletions docs/common/core/003-csca-list-proposal-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ When obtained the passport signer's root certificate, you can check its presence
stored on Rarimo chain in a decentralized manner.
This is how you ensure that the passport is signed by an eligible entity.

Technical details can be found in [CSCA List Rarimo Core module](https://github.com/rarimo/rarimo-core/x/cscalist/README.md).
Technical details can be found in [CSCA List Rarimo Core module](../../../x/cscalist/README.md).

The keys of CSCA signers can be compromised or updated, ergo list updates must be handled.
This is done via proposals. The guide will help you in creating and verifying proposals on list changes.
Expand All @@ -38,10 +38,11 @@ You can call the CLI from that dir, or add it to your `$PATH`:
export PATH=$PATH:$(go env GOPATH)/bin
```

<!-- TODO: where the user can get RPC? -->
Some commands require network RPC in order to fetch state.
You can put it into environment variable for convenient command calls:
All commands require Rarimo home directory set.
Also, some of them require network RPC in order to fetch state.
You can put these into environment variable for convenient command calls:
```bash
export RARIMO_HOME=/path/to/your/rarimo/home
export RPC=https://your-rpc
```

Expand All @@ -59,79 +60,81 @@ This is why you have to monitor the list manually if you are interested in up-to
### Compare with state

```bash
rarimo-cored --node $RPC query cscalist ldif-tree-diff your-file.ldif
rarimo-cored --home $RARIMO_HOME --node $RPC query cscalist ldif-tree-diff your-file.ldif
```
If roots are different, the list was changed and the proposal must be created to update the tree.

## Create proposal

Most likely, you have already filled basic proposal data in the block scan (title, description, etc.). You should have the file with CSCA list, see **Download the list** subsection. Assuming the file name is `your-file.ldif`.

Obtain primary data for your proposal:
Next, obtain primary data for your proposal, which depends on the proposal type.

### ReplaceCSCAListProposal

```bash
cd ~/Downloads # or wherever you have the file
rarimo-cored query cscalist parse-ldif --output-format hash your-file.ldif your-output-file.txt
rarimo-cored --home $RARIMO_HOME query cscalist parse-ldif your-file.ldif your-output-file.txt
```

`your-output-file.txt` will contain the big list of hashes of public keys from the LDIF file. Example:
```
0x1d4dd579478a38c00f58a4d94263ff2bb0459992c073ebb7a6991194e44157f2
0x0dcc4019fccc7ad4fbb535a40633cc32f99a18096a736b21e695e35e964209ae
0x01a3d79b678d79a8f912b693c4d57b38cf0e44ef413b7684e92a664e98c911ed
"0x1d4dd579478a38c00f58a4d94263ff2bb0459992c073ebb7a6991194e44157f2",
"0x0dcc4019fccc7ad4fbb535a40633cc32f99a18096a736b21e695e35e964209ae",
"0x01a3d79b678d79a8f912b693c4d57b38cf0e44ef413b7684e92a664e98c911ed"
```
If this is `ReplaceCSCAListProposal`, just copy the hashes to the proposal `leaves` field.

For `EditCSCAListProposal` the process is more complicated:
These are the hashes of compatible public keys from the provided LDIF file.
Just copy them to the `leaves` field of your draft proposal.

### Method 1
### EditCSCAListProposal

1. Obtain the old Master List LDIF file, which tree is stored on-chain at the moment.
If you don't have it, use **Method 2** instead.
2. Optional: ensure that the list from file is the same as on-chain:
```bash
rarimo-cored --node $RPC query cscalist ldif-tree-diff your-old-file.ldif
cd ~/Downloads # or wherever you have the file
rarimo-cored --home $RARIMO_HOME query cscalist prepare-proposal your-file.ldif your-output-file.txt
```
You expect to see message that the trees' roots are the same.
Otherwise, seek for an actual `your-old-file.ldif`.
3. Extract the hashes from your old file:
```bash
rarimo-cored query cscalist parse-ldif --output-format hash your-old-file.ldif old-output-file.txt

`your-output-file.txt` will contain two lists of hashes to add and remove. Example:
```
=== To add ===
"0x1d4dd579478a38c00f58a4d94263ff2bb0459992c073ebb7a6991194e44157f2",
"0x0dcc4019fccc7ad4fbb535a40633cc32f99a18096a736b21e695e35e964209ae"
=== To remove ===
"0x01a3d79b678d79a8f912b693c4d57b38cf0e44ef413b7684e92a664e98c911ed"
```
4. Compare `your-output-file.txt` and `old-output-file.txt` to find the differences.
You can use `diff`, `vimdiff` or any preferable tool.
- hashes present only in `your-output-file.txt` are to be added
- hashes present only in `old-output-file.txt` are to be removed
5. Put acquired hashes into respective fields: `toAdd`, `toRemove`
The command has fetched the current state, compared it to the tree from file and provided the differences to consume.
Copy the respective hashes to the `toAdd` and `toRemove` fields of your draft proposal.

### Method 2
### Submit proposal

1. Fetch the current hashes from the Merkle tree:
Basically, you need a command:
```bash
rarimo-cored --node $RPC query cscalist tree > current-tree.txt
rarimo-cored --home $RARIMO_HOME --node $RPC tx gov submit-proposal draft_proposal.json --from <your-rarimo-account>
```
2. Iterate over the `current-tree.txt` manually and collect `key` values.
You may put them into `old-output-file.txt`.
<!-- TODO: manual iteration is very bad -->
3. Perform steps 4 and 5 from **Method 1**.

Congratulations! You should now have your proposal ready for submission.
Refer to Cosmos SDK documentation and other guides to get more details about:
- Account creation
- Generating and managing your keys
- Obtaining `draft_proposal.json`

## Verify proposal

In order to vote for the proposal, you need to ensure that its content corresponds to the actual state of CSCA List.

Firstly, download the list from [ICAO website](https://pkddownloadsg.icao.int/)
and prepare the list of hashes, like described in **Create proposal** section.

Secondly, check whether the proposal makes any difference to the current state:
```bash
rarimo-cored --node $RPC query cscalist ldif-tree-diff your-file.ldif
rarimo-cored --home $RARIMO_HOME --node $RPC query cscalist ldif-tree-diff your-file.ldif
```
If there is no difference, the proposal does not make sense, and you should vote 'No' or 'NoWithVeto'.
If there is no difference, the proposal either does not make sense, or is fraudulent, and you should vote 'No' or 'NoWithVeto'.
Again, the deeper validation depends on proposal type.

If this is `ReplaceCSCAListProposal`, just compare the `leaves` field with `your-output-file.txt`. It is possible that you could have the different order of hashes due to ICAO change of order. Therefore, you may wish to sort both lists, e.g. with `sort` command.

For `EditCSCAListProposal`, you need to perform the same steps as in **Create proposal** section.
Then compare the `toAdd` and `toRemove` fields with the differences between `your-output-file.txt` and `old-output-file.txt`.
For `EditCSCAListProposal`, you should additionally perform:
```bash
rarimo-cored --home $RARIMO_HOME --node $RPC query cscalist prepare-proposal your-file.ldif your-output-file.txt
```
Then compare the `toAdd` and `toRemove` fields with the differences between `your-output-file.txt` and someone's proposal.

If you get the same results as in the proposal, it is correct, and you can vote for it.
If you get the same results as in the proposal (of any type), it is correct, and you should support it.
32 changes: 31 additions & 1 deletion docs/common/mainnet/002-upgrades.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,36 @@ title: Mainnet upgrades

# Mainnet upgrades

## V1.1.2

Core binary: (
alpine-linux/amd64): "<https://github.com/rarimo/rarimo-core/releases/download/v1.1.2/rarimo-core-alpine-linux-amd64>".

Also, you can build core from sources by yourself: use "<https://github.com/rarimo/rarimo-core/releases/tag/v1.1.2>"
release information.

Also, if you are using Ubuntu linux, please install `musl-dev` using `sudo apt install musl-dev` command to be able to
use Alpine binary on your machine.

If you are using `cosmovisor` the upgrade will be done automatically.

Upgrade v1.1.2 changes the parameters of [feemarket](../../../x/feemarket) module, in particular `BaseFee`
and `NoBaseFee` that should be `0` and `true` while we are using zero commissions on production.

## V1.1.1

Core binary: (
alpine-linux/amd64): "<https://github.com/rarimo/rarimo-core/releases/download/v1.1.1/rarimo-core-alpine-linux-amd64>".

Also, you can build core from sources by yourself: use "<https://github.com/rarimo/rarimo-core/releases/tag/v1.1.1>"
release information.

Also, if you are using Ubuntu linux, please install `musl-dev` using `sudo apt install musl-dev` command to be able to
use Alpine binary on your machine.

Upgrade v1.1.1 introduces a new module to store and manage [CSCA Master List](https://pkddownloadsg.icao.int/). More
information can be found in [module docs](../../../x/cscalist/README.md).

## V1.1.0

Core binary: (
Expand All @@ -22,7 +52,7 @@ Upgrade v1.1.0 introduces a couple of features for identity transfers:

- New WorldCoin identity transfer
- Fix for the Iden3 identity transfers: GIST and state transfers are split into two different operations.
- Double-sending of confirmation messages will not cause TX error.
- Double-sending of confirmation messages will not cause TX error.

## V1.0.7

Expand Down
19 changes: 9 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,18 @@ require (
github.com/tidwall/sjson v1.2.5
github.com/tyler-smith/go-bip39 v1.1.0
golang.org/x/net v0.24.0
golang.org/x/text v0.14.0
google.golang.org/genproto/googleapis/api v0.0.0-20240415180920-8c6c420018be
google.golang.org/grpc v1.63.2
google.golang.org/protobuf v1.33.0
golang.org/x/text v0.15.0
google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8
google.golang.org/grpc v1.64.0
google.golang.org/protobuf v1.34.1
sigs.k8s.io/yaml v1.4.0
)

require github.com/rs/zerolog v1.29.1 // indirect

require (
cloud.google.com/go v0.112.2 // indirect
cloud.google.com/go/compute v1.25.1 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/compute/metadata v0.3.0 // indirect
cloud.google.com/go/iam v1.1.7 // indirect
cloud.google.com/go/storage v1.39.1 // indirect
filippo.io/edwards25519 v1.0.0-rc.1 // indirect
Expand Down Expand Up @@ -93,6 +92,7 @@ require (
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/gin-gonic/gin v1.8.1 // indirect
github.com/github/smimesign v0.2.0 // indirect
github.com/go-kit/kit v0.12.0 // indirect
Expand All @@ -117,7 +117,7 @@ require (
github.com/googleapis/gax-go/v2 v2.12.3 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
github.com/gtank/merlin v0.1.1 // indirect
github.com/gtank/ristretto255 v0.1.2 // indirect
Expand Down Expand Up @@ -197,15 +197,14 @@ require (
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f // indirect
golang.org/x/oauth2 v0.18.0 // indirect
golang.org/x/oauth2 v0.20.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/term v0.19.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/api v0.170.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20240415180920-8c6c420018be // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
Expand Down
Loading

0 comments on commit 6dde640

Please sign in to comment.