-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #734 from pfeairheller/feat-the-real-smids
New database tables for tracking Habs and multisig participants.
- Loading branch information
Showing
26 changed files
with
766 additions
and
298 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.