Skip to content

Commit

Permalink
Merge pull request #734 from pfeairheller/feat-the-real-smids
Browse files Browse the repository at this point in the history
New database tables for tracking Habs and multisig participants.
  • Loading branch information
SmithSamuelM committed Apr 3, 2024
2 parents 7fd7f30 + bfc3ca7 commit 0b55922
Show file tree
Hide file tree
Showing 26 changed files with 766 additions and 298 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/python-app-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.12.1
- name: Set up Python 3.12.2
uses: actions/setup-python@v2
with:
python-version: 3.12.1
python-version: 3.12.2
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -47,10 +47,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.12.1
- name: Set up Python 3.12.2
uses: actions/setup-python@v2
with:
python-version: 3.12.1
python-version: 3.12.2
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -68,10 +68,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.12.1
- name: Set up Python 3.12.2
uses: actions/setup-python@v2
with:
python-version: 3.12.1
python-version: 3.12.2
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
46 changes: 46 additions & 0 deletions scripts/demo/basic/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

echo "Testing clean"

function isSuccess() {
ret=$?
if [ $ret -ne 0 ]; then
echo "Error $ret"
exit $ret
fi
}

# CREATE DATABASE AND KEYSTORE
kli init --name nat --base "${KERI_TEMP_DIR}" --nopasscode
isSuccess

# RESOLVE WITNESS OOBIs
kli oobi resolve --name nat --base "${KERI_TEMP_DIR}" --oobi-alias wan --oobi http://127.0.0.1:5643/oobi/BLskRTInXnMxWaGqcpSyMgo0nYbalW99cGZESrz3zapM/controller
isSuccess
kli oobi resolve --name nat --base "${KERI_TEMP_DIR}" --oobi-alias wil --oobi http://127.0.0.1:5642/oobi/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha/controller
isSuccess
kli oobi resolve --name nat --base "${KERI_TEMP_DIR}" --oobi-alias wes --oobi http://127.0.0.1:5644/oobi/BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX/controller
isSuccess

## INCEPT AND PROPOGATE EVENTS AND RECEIPTS TO WITNESSES
kli incept --name nat --base "${KERI_TEMP_DIR}" --receipt-endpoint --alias nat --file "${KERI_DEMO_SCRIPT_DIR}/data/trans-wits-sample.json"
isSuccess
kli interact --name nat --base "${KERI_TEMP_DIR}" --alias nat
isSuccess
kli rotate --name nat --base "${KERI_TEMP_DIR}" --receipt-endpoint --alias nat --witness-cut BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX
isSuccess
kli rotate --name nat --base "${KERI_TEMP_DIR}" --receipt-endpoint --alias nat --witness-add BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX
isSuccess
kli interact --name nat --base "${KERI_TEMP_DIR}" --alias nat
isSuccess
kli interact --name nat --base "${KERI_TEMP_DIR}" --alias nat
isSuccess
kli interact --name nat --base "${KERI_TEMP_DIR}" --alias nat
isSuccess
kli interact --name nat --base "${KERI_TEMP_DIR}" --alias nat
isSuccess

kli clean --name nat --base "${KERI_TEMP_DIR}"
isSuccess

kli status --name nat --alias nat
22 changes: 11 additions & 11 deletions scripts/demo/basic/demo-witness-async-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,34 @@ function isSuccess() {
}

# CREATE DATABASE AND KEYSTORE
kli init --name witness-test --base "${KERI_TEMP_DIR}" --nopasscode
kli init --name async-witness-test --base "${KERI_TEMP_DIR}" --nopasscode
isSuccess

# RESOLVE WITNESS OOBIs
kli oobi resolve --name witness-test --base "${KERI_TEMP_DIR}" --oobi-alias wan --oobi http://127.0.0.1:5643/oobi/BLskRTInXnMxWaGqcpSyMgo0nYbalW99cGZESrz3zapM/controller
kli oobi resolve --name async-witness-test --base "${KERI_TEMP_DIR}" --oobi-alias wan --oobi http://127.0.0.1:5643/oobi/BLskRTInXnMxWaGqcpSyMgo0nYbalW99cGZESrz3zapM/controller
isSuccess
kli oobi resolve --name witness-test --base "${KERI_TEMP_DIR}" --oobi-alias wil --oobi http://127.0.0.1:5642/oobi/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha/controller
kli oobi resolve --name async-witness-test --base "${KERI_TEMP_DIR}" --oobi-alias wil --oobi http://127.0.0.1:5642/oobi/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha/controller
isSuccess
kli oobi resolve --name witness-test --base "${KERI_TEMP_DIR}" --oobi-alias wes --oobi http://127.0.0.1:5644/oobi/BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX/controller
kli oobi resolve --name async-witness-test --base "${KERI_TEMP_DIR}" --oobi-alias wes --oobi http://127.0.0.1:5644/oobi/BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX/controller
isSuccess

## INCEPT AND PROPOGATE EVENTS AND RECEIPTS TO WITNESSES
kli incept --name witness-test --base "${KERI_TEMP_DIR}" --alias trans-wits --file "${KERI_DEMO_SCRIPT_DIR}/data/trans-wits-sample.json"
kli incept --name async-witness-test --base "${KERI_TEMP_DIR}" --alias trans-wits --file "${KERI_DEMO_SCRIPT_DIR}/data/trans-wits-sample.json"
isSuccess

kli incept --name witness-test --base "${KERI_TEMP_DIR}" --alias inquisitor --file "${KERI_DEMO_SCRIPT_DIR}/data/inquisitor-sample.json"
kli incept --name async-witness-test --base "${KERI_TEMP_DIR}" --alias inquisitor --file "${KERI_DEMO_SCRIPT_DIR}/data/inquisitor-sample.json"
isSuccess

kli status --name witness-test --base "${KERI_TEMP_DIR}" --alias trans-wits
kli status --name async-witness-test --base "${KERI_TEMP_DIR}" --alias trans-wits

kli rotate --name witness-test --base "${KERI_TEMP_DIR}" --alias trans-wits --witness-cut BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX
kli rotate --name async-witness-test --base "${KERI_TEMP_DIR}" --alias trans-wits --witness-cut BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX
isSuccess

kli status --name witness-test --base "${KERI_TEMP_DIR}" --alias trans-wits
kli status --name async-witness-test --base "${KERI_TEMP_DIR}" --alias trans-wits

kli rotate --name witness-test --base "${KERI_TEMP_DIR}" --alias trans-wits --witness-add BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX
kli rotate --name async-witness-test --base "${KERI_TEMP_DIR}" --alias trans-wits --witness-add BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX
isSuccess

kli status --name witness-test --base "${KERI_TEMP_DIR}" --alias trans-wits
kli status --name async-witness-test --base "${KERI_TEMP_DIR}" --alias trans-wits

echo 'Test Complete'
4 changes: 2 additions & 2 deletions scripts/demo/basic/multisig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

kli init --name multisig1 --base "${KERI_TEMP_DIR}" --salt 0ACDEyMzQ1Njc4OWxtbm9aBc --nopasscode --config-dir ${KERI_SCRIPT_DIR} --config-file demo-witness-oobis
kli incept --name multisig1 --base "${KERI_TEMP_DIR}" --alias multisig1 --file ${KERI_DEMO_SCRIPT_DIR}/data/multisig-1-sample.json
kli ends add --name multisig1 --base "${KERI_TEMP_DIR}" --alias multisig1 --eid BLskRTInXnMxWaGqcpSyMgo0nYbalW99cGZESrz3zapM --role mailbox
#kli ends add --name multisig1 --base "${KERI_TEMP_DIR}" --alias multisig1 --eid BLskRTInXnMxWaGqcpSyMgo0nYbalW99cGZESrz3zapM --role mailbox

kli init --name multisig2 --base "${KERI_TEMP_DIR}" --salt 0ACDEyMzQ1Njc4OWdoaWpsaw --nopasscode --config-dir ${KERI_SCRIPT_DIR} --config-file demo-witness-oobis
kli incept --name multisig2 --base "${KERI_TEMP_DIR}" --alias multisig2 --file ${KERI_DEMO_SCRIPT_DIR}/data/multisig-2-sample.json
kli ends add --name multisig2 --base "${KERI_TEMP_DIR}" --alias multisig2 --eid BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX --role mailbox
#kli ends add --name multisig2 --base "${KERI_TEMP_DIR}" --alias multisig2 --eid BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX --role mailbox

kli oobi resolve --name multisig1 --base "${KERI_TEMP_DIR}" --oobi-alias multisig2 --oobi http://127.0.0.1:5642/oobi/EJccSRTfXYF6wrUVuenAIHzwcx3hJugeiJsEKmndi5q1
kli oobi resolve --name multisig2 --base "${KERI_TEMP_DIR}" --oobi-alias multisig1 --oobi http://127.0.0.1:5642/oobi/EKYLUMmNPZeEs77Zvclf0bSN5IN-mLfLpx2ySb-HDlk4
Expand Down
9 changes: 5 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@
keywords=[
# eg: 'keyword1', 'keyword2', 'keyword3',
],
python_requires='>=3.12.1',
python_requires='>=3.12.2',
install_requires=[
'lmdb>=1.3.0',
'pysodium>=0.7.12',
'blake3>=0.3.1',
'msgpack>=1.0.4',
'cbor2>=5.4.3',
'cbor2>=5.6.2',
'multidict>=6.0.2',
'ordered-set>=4.1.0',
'hio>=0.6.9',
'hio>=0.6.11',
'multicommand>=1.0.0',
'jsonschema>=4.17.0',
'falcon>=3.1.0',
Expand All @@ -87,7 +87,8 @@
'mnemonic>=0.20',
'PrettyTable>=3.5.0',
'http_sfv>=0.9.8',
'cryptography>=39.0.2'
'cryptography>=42.0.5',
'semver>=3.0.2'
],
extras_require={
},
Expand Down
64 changes: 64 additions & 0 deletions src/keri/app/cli/commands/clean.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# -*- encoding: utf-8 -*-
"""
keri.kli.commands module
"""
import argparse

from hio import help
from hio.base import doing

from keri.app.cli.common import existing

logger = help.ogler.getLogger()


def handler(args):
"""
Launch KERI database initialization
Args:
args(Namespace): arguments object from command line
"""
clean = CleanDoer(args)
return [clean]


parser = argparse.ArgumentParser(description='Cleans and migrates a database and keystore')
parser.set_defaults(handler=handler,
transferable=True)

# Parameters for basic structure of database
parser.add_argument('--name', '-n', help='keystore name and file location of KERI keystore', required=True)
parser.add_argument('--base', '-b', help='additional optional prefix to file location of KERI keystore',
required=False, default="")
parser.add_argument('--temp', '-t', help='create a temporary keystore, used for testing', default=False)

# Parameters for Manager creation
# passcode => bran
parser.add_argument('--passcode', '-p', help='22 character encryption passcode for keystore (is not saved)',
dest="bran", default=None)


class CleanDoer(doing.Doer):

def __init__(self, args):
self.args = args
super(CleanDoer, self).__init__()

def recur(self, tyme):

hby = existing.setupHby(name=self.args.name, base=self.args.base,
bran=self.args.bran, temp=self.args.temp)
print("Migrating...")
hby.db.migrate()
print("Finished")

hby = existing.setupHby(name=self.args.name, base=self.args.base,
bran=self.args.bran, temp=self.args.temp)

print("Database open, performing clean...")
hby.db.clean()
print("Finished.")

return True
6 changes: 5 additions & 1 deletion src/keri/app/cli/commands/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@
"""
import argparse
import getpass
import os
import sys

from hio import help
from hio.base import doing

import keri.app.oobiing
from keri.app import habbing, configing, oobiing, connecting
from keri import kering
from keri.app import habbing, configing, oobiing
from keri.app.keeping import Algos
from keri.db import basing
from keri.kering import ConfigurationError
from keri.vdr import credentialing

Expand Down
Empty file.
64 changes: 64 additions & 0 deletions src/keri/app/cli/commands/migrate/list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# -*- encoding: utf-8 -*-
"""
keri.kli.commands module
"""
import argparse

from hio import help
from hio.base import doing
from prettytable import PrettyTable

from keri.app.cli.common import existing

logger = help.ogler.getLogger()


def handler(args):
"""
Launch KERI database initialization
Args:
args(Namespace): arguments object from command line
"""
lister = ListDoer(args)
return [lister]


parser = argparse.ArgumentParser(description='Cleans and migrates a database and keystore')
parser.set_defaults(handler=handler,
transferable=True)

# Parameters for basic structure of database
parser.add_argument('--name', '-n', help='keystore name and file location of KERI keystore', required=True)
parser.add_argument('--base', '-b', help='additional optional prefix to file location of KERI keystore',
required=False, default="")
parser.add_argument('--temp', '-t', help='create a temporary keystore, used for testing', default=False)

# Parameters for Manager creation
# passcode => bran
parser.add_argument('--passcode', '-p', help='22 character encryption passcode for keystore (is not saved)',
dest="bran", default=None)


class ListDoer(doing.Doer):

def __init__(self, args):
self.args = args
super(ListDoer, self).__init__()

def recur(self, tyme):
tab = PrettyTable()
tab.field_names = ["Num", "Name", "Date Completed"]
tab.align["Name"] = "l"

hby = existing.setupHby(name=self.args.name, base=self.args.base,
bran=self.args.bran, temp=self.args.temp)

for idx, (name, dater) in enumerate(hby.db.complete()):
print(name, dater)
date = dater.datetime.strftime("%Y-%m-%d %H:%M") if dater is not None else "Not Run"
tab.add_row((f"{idx + 1}", f"{name}", date))

print(tab)
return True
67 changes: 67 additions & 0 deletions src/keri/app/cli/commands/migrate/run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# -*- encoding: utf-8 -*-
"""
keri.kli.commands module
"""
import argparse

import keri
from hio import help
from hio.base import doing
from keri import kering

from keri.app.cli.common import existing
from keri.db import basing

logger = help.ogler.getLogger()


def handler(args):
"""
Launch KERI database initialization
Args:
args(Namespace): arguments object from command line
"""
clean = MigrateDoer(args)
return [clean]


parser = argparse.ArgumentParser(description='Cleans and migrates a database and keystore')
parser.set_defaults(handler=handler,
transferable=True)

# Parameters for basic structure of database
parser.add_argument('--name', '-n', help='keystore name and file location of KERI keystore', required=True)
parser.add_argument('--base', '-b', help='additional optional prefix to file location of KERI keystore',
required=False, default="")
parser.add_argument('--temp', '-t', help='create a temporary keystore, used for testing', default=False)

# Parameters for Manager creation
# passcode => bran
parser.add_argument('--passcode', '-p', help='22 character encryption passcode for keystore (is not saved)',
dest="bran", default=None)


class MigrateDoer(doing.Doer):

def __init__(self, args):
self.args = args
super(MigrateDoer, self).__init__()

def recur(self, tyme):
db = basing.Baser(name=self.args.name,
base=self.args.base,
temp=self.args.temp,
reopen=False)

try:
db.reopen()
except kering.DatabaseError:
pass

print("Migrating...")
db.migrate()
print("Finished")

return True

0 comments on commit 0b55922

Please sign in to comment.