Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c597101ea | ||
|
|
90943bf1e6 | ||
|
|
512136400d | ||
|
|
c0662cb5f1 | ||
|
|
c73dc0d92a | ||
|
|
8f20f25e43 | ||
|
|
08e369aa64 | ||
|
|
40a78c66bf | ||
|
|
6945792aea | ||
|
|
5af22471a8 | ||
|
|
5e7a890adb |
@@ -1,4 +1,4 @@
|
||||
name: Publish onn release
|
||||
name: Publish on release
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
@@ -81,6 +81,29 @@ jobs:
|
||||
make test-rpc
|
||||
if: env.GIT_DIFF
|
||||
|
||||
sdk_tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Checkout laconic-sdk
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: "./laconic-sdk/"
|
||||
repository: cerc-io/laconic-sdk
|
||||
fetch-depth: 0
|
||||
- name: Environment
|
||||
run: ls -tlh && env
|
||||
- name: build containers scripts
|
||||
working-directory: tests/sdk_tests
|
||||
run: ./build-laconicd-container.sh && ./build-sdk-test-container.sh
|
||||
- name: start containers
|
||||
working-directory: tests/sdk_tests
|
||||
run: docker compose up -d
|
||||
- name: run-tests.sh
|
||||
working-directory: tests/sdk_tests
|
||||
run: ./run-tests.sh
|
||||
|
||||
|
||||
# integration_tests:
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
# Validator Upgrade Guide for laconic_81337-5 Testnet v0.6.0 -> v0.7.0
|
||||
|
||||
This guide assumes you have followed the instructions to crete a systemd service or docker container validator node v0.6.0 and you perform the upgrade on a machine running v0.6.0
|
||||
|
||||
It is highly recommended to make the backup of your datadir after you stop v0.6.0 and before you start v0.7.0. Unless you changed your datadir, it should be located in `~/.laconicd`
|
||||
|
||||
## Systemd service
|
||||
Skip this section if you use docker
|
||||
|
||||
This is very similar to building v0.6.0. We keep v 0.6.0 running until v0.7.0 is built and only after the successful build we should replace 0.6.0 binary with v0.7.0. This is to avoid jailing your validator for long downtime.
|
||||
The general upgrade plan is the following:
|
||||
1. Install Go v1.19.5 (we used 1.18 for v0.6.0)
|
||||
2. Remove old copy of the github repository and build directory
|
||||
3. Download the latest laconicd repository and checkout v0.7.0
|
||||
4. Build laconicd binary (but not install in this moment)
|
||||
5. Stop laconicd systemd service
|
||||
6. Install recently built new version of laconicd
|
||||
7. Start laconicd service
|
||||
|
||||
>***You have ~10 minutes after step 5 to complete steps 6 and 7 before your validator is jailed for downtime. Getting jailed for downtime is not a disaster, however would require manual unjailing.***
|
||||
|
||||
|
||||
|
||||
### Install Go 1.19
|
||||
|
||||
```sh
|
||||
# Update Ubuntu
|
||||
sudo apt update
|
||||
sudo apt upgrade -y
|
||||
|
||||
# Install required software packages
|
||||
sudo apt install git curl build-essential make jq -y
|
||||
|
||||
# Remove any existing installation of `go`
|
||||
sudo rm -rf /usr/local/go
|
||||
|
||||
# Install Go version 1.19.5
|
||||
curl https://dl.google.com/go/go1.19.5.linux-amd64.tar.gz | sudo tar -C/usr/local -zxvf -
|
||||
|
||||
```
|
||||
|
||||
Check the version of go installed
|
||||
|
||||
```sh
|
||||
go version
|
||||
|
||||
# Should return something like: go version go1.19.5 linux/amd64
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Remove old copy of `laconicd` build
|
||||
|
||||
>Attention should be paid that the directory mentioned below is `~/laconicd` and NOT `~/.laconicd`. The latter is the data directory containing all your node data and configuration and it must be kept during the upgrade.
|
||||
|
||||
```sh
|
||||
# Remove the previous build directory
|
||||
cd ~
|
||||
rm -rf laconicd
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Download `laconicd` repository
|
||||
```sh
|
||||
git clone https://github.com/cerc-io/laconicd.git
|
||||
cd laconicd
|
||||
|
||||
# Checkout 0.7.0 branch
|
||||
git fetch --all
|
||||
git checkout v0.7.0
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Build the new version of `laconicd`
|
||||
|
||||
```sh
|
||||
# Build laconic (but not install at this moment)
|
||||
make VERSION=v0.7.0 build
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Stop `laconicd` systemd service
|
||||
|
||||
```sh
|
||||
sudo systemctl stop laconicd
|
||||
```
|
||||
|
||||
>***Make sure the service is stopped***
|
||||
|
||||
```sh
|
||||
sudo systemctl status laconicd
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Install new `laconicd` version
|
||||
|
||||
```sh
|
||||
make VERSION=v0.7.0 install
|
||||
```
|
||||
|
||||
Verify your installation
|
||||
|
||||
```sh
|
||||
laconicd version
|
||||
```
|
||||
This should return `0.7.0`
|
||||
|
||||
---
|
||||
|
||||
### Start `laconicd` systemd service
|
||||
|
||||
```sh
|
||||
sudo systemctl start laconicd
|
||||
```
|
||||
|
||||
Verify that the node joined the network and produces new blocks
|
||||
|
||||
```sh
|
||||
journalctl -f -u laconicd
|
||||
```
|
||||
|
||||
|
||||
---
|
||||
|
||||
## Docker container
|
||||
|
||||
Upgrade plan:
|
||||
1. Stop running v0.6.0 container
|
||||
2. Delete v0.6.0 container
|
||||
3. Create v0.7.0 container
|
||||
4. Start v0.7.0 container
|
||||
|
||||
>***You have ~10 minutes to complete the upgrade procedure before your validator is jailed for downtime. Getting jailed for downtime is not a disaster, however would require manual unjailing.***
|
||||
|
||||
### Stop running v0.6.0 container
|
||||
```sh
|
||||
docker stop laconic-testnet-5
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Delete v0.6.0 container
|
||||
```sh
|
||||
docker rm laconic-testnet-5
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Create v0.7.0 container
|
||||
```sh
|
||||
docker create --name laconic-testnet-5 \
|
||||
--restart always \
|
||||
-v ~/.laconicd:/root/.laconicd \
|
||||
-p 26656:26656 \
|
||||
-p 127.0.0.1:26657:26657 \
|
||||
-p 127.0.0.1:26660:26660 \
|
||||
git.vdb.to/cerc-io/laconicd/laconicd:v0.7.0 \
|
||||
laconicd start --gql-playground --gql-server --log_level=warn
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Start v0.7.0 container
|
||||
```sh
|
||||
docker start laconic-testnet-5
|
||||
```
|
||||
|
||||
Verify that the node joined the network and produces new blocks
|
||||
|
||||
```sh
|
||||
docker logs -f laconic-testnet-5
|
||||
```
|
||||
|
||||
---
|
||||
+14
-15
@@ -8,16 +8,17 @@ import (
|
||||
"bytes"
|
||||
"errors"
|
||||
|
||||
canonicalJson "github.com/gibson042/canonicaljson-go"
|
||||
"github.com/ipfs/go-cid"
|
||||
cbor "github.com/ipfs/go-ipld-cbor"
|
||||
"github.com/ipld/go-ipld-prime/codec/dagcbor"
|
||||
"github.com/ipld/go-ipld-prime/codec/dagjson"
|
||||
"github.com/ipld/go-ipld-prime/fluent"
|
||||
"github.com/ipld/go-ipld-prime/linking"
|
||||
cidlink "github.com/ipld/go-ipld-prime/linking/cid"
|
||||
"github.com/ipld/go-ipld-prime/multicodec"
|
||||
basicnode "github.com/ipld/go-ipld-prime/node/basic"
|
||||
"github.com/ipld/go-ipld-prime/storage/memstore"
|
||||
|
||||
canonicalJson "github.com/gibson042/canonicaljson-go"
|
||||
"github.com/ipfs/go-cid"
|
||||
cbor "github.com/ipfs/go-ipld-cbor"
|
||||
basicnode "github.com/ipld/go-ipld-prime/node/basic"
|
||||
mh "github.com/multiformats/go-multihash"
|
||||
)
|
||||
|
||||
@@ -67,17 +68,7 @@ func GetAttributeAsString(obj map[string]interface{}, attr string) (string, erro
|
||||
}
|
||||
|
||||
// CIDFromJSONBytesUsingIpldPrime returns CID (dagcbor) for json (as bytes).
|
||||
// This is combination of samples for unmarshalling and linking
|
||||
// see: https://pkg.go.dev/github.com/ipld/go-ipld-prime
|
||||
func CIDFromJSONBytesUsingIpldPrime(content []byte) (string, error) {
|
||||
np := basicnode.Prototype.Any // Pick a stle for the in-memory data.
|
||||
nb := np.NewBuilder() // Create a builder.
|
||||
err := dagjson.Decode(nb, bytes.NewReader(content)) // Hand the builder to decoding -- decoding will fill it in!
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
n := nb.Build() // Call 'Build' to get the resulting Node. (It's immutable!)
|
||||
|
||||
lsys := cidlink.DefaultLinkSystem()
|
||||
|
||||
// We want to store the serialized data somewhere.
|
||||
@@ -96,6 +87,14 @@ func CIDFromJSONBytesUsingIpldPrime(content []byte) (string, error) {
|
||||
MhLength: 32, // sha2-256 hash has a 32-byte sum.
|
||||
}}
|
||||
|
||||
// And we need some data to link to! Here's a quick piece of example data:
|
||||
n, err := fluent.Build(basicnode.Prototype.Any, func(na fluent.NodeAssembler) {
|
||||
na.AssignBytes(content)
|
||||
})
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// Now: time to apply the LinkSystem, and do the actual store operation!
|
||||
lnk, err := lsys.Store(
|
||||
linking.LinkContext{}, // The zero value is fine. Configure it it you want cancellability or other features.
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestAndValidateCIDGeneration(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
content string
|
||||
}{
|
||||
{
|
||||
"empty string", "",
|
||||
},
|
||||
{
|
||||
"empty json", "{}",
|
||||
},
|
||||
|
||||
{
|
||||
"test record", "\\xa6curlohttps://cerc.iodtypex\\x19WebsiteRegistrationRecordgversione0.0.1ltls_cert_cidx.QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnRrbuild_artifact_cidx.QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9x\\x1crepo_registration_record_cidx.QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
deprecatedAndCorrect, _ := CIDFromJSONBytes([]byte(tc.content))
|
||||
newImpl, _ := CIDFromJSONBytesUsingIpldPrime([]byte(tc.content))
|
||||
require.Equal(t, deprecatedAndCorrect, newImpl, tc.name)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user