Skip to content

Dev post migration #307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 89 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
6de1faf
lmdb
StuartFarmer May 12, 2021
5bb69cb
new cache
StuartFarmer Jun 10, 2021
e950bbd
lamdb instead of lmdb
StuartFarmer Jun 14, 2021
b5ba23b
driver get
StuartFarmer Jun 23, 2021
97ea541
add tests
StuartFarmer Jun 23, 2021
e8054f4
new cache
StuartFarmer Jun 23, 2021
2329351
new cache integrated
StuartFarmer Jun 23, 2021
5986110
no cache hard apply
StuartFarmer Aug 4, 2021
a550df9
handle OSError in the FS_DRIVER flush method for testing. SHould pro…
JeffWScott Aug 9, 2021
3953fe0
Encode balance in executor
JeffWScott Aug 12, 2021
23a6cbd
log out values
JeffWScott Aug 12, 2021
6f11b18
convert balance to ContractingDecimal
JeffWScott Aug 12, 2021
7eadbcd
troubleshooting statements
JeffWScott Aug 12, 2021
55d8c07
if balance is dict then make ContractingDecimal
JeffWScott Aug 12, 2021
2233e08
remove troubleshooting
JeffWScott Aug 12, 2021
be4711e
new rollback
StuartFarmer Sep 5, 2021
81b5630
Merge remote-tracking branch 'origin/lmdb' into lmdb
StuartFarmer Sep 5, 2021
6183a5b
reads
StuartFarmer Sep 5, 2021
627d266
reads get passed
StuartFarmer Sep 5, 2021
1b8b5f6
Merge remote-tracking branch 'origin/lmdb' into lmdb-jeff
JeffWScott Sep 7, 2021
8e00d51
fixed rollback method to rollback to a point in HCL time.
JeffWScott Sep 7, 2021
53616bc
hdf5 poc base
nsmkhn Feb 23, 2022
2f598dd
fix some test cases
nsmkhn Feb 23, 2022
997012d
revert raise KeyError
nsmkhn Feb 23, 2022
443ac0d
fix file size constantly increases
nsmkhn Feb 25, 2022
e293a7b
fetch keys api
nsmkhn Feb 28, 2022
873ceae
get rid of iter method
nsmkhn Feb 28, 2022
e02e089
remove redundant code
nsmkhn Feb 28, 2022
47a4208
default
StuartFarmer Feb 28, 2022
965dcf1
fix flush adhering integration tests
nsmkhn Feb 28, 2022
441bf6d
fix integration tests failures
nsmkhn Feb 28, 2022
eafd78e
adhere old api
nsmkhn Feb 28, 2022
e35e4a4
refactoring
nsmkhn Mar 1, 2022
fe9dd58
refactoring
nsmkhn Mar 1, 2022
60d2246
refactoring
nsmkhn Mar 4, 2022
a8d0e5c
merge
StuartFarmer Mar 11, 2022
00a53ee
Updated CacheDriver and tests from lmdb-jeff
JeffWScott Mar 11, 2022
9d94baa
remove mark argument being passed to CacheDriver get method
JeffWScott Mar 11, 2022
8819494
executor to use pending_reads instead of reads
JeffWScott Mar 11, 2022
7d305a4
ref
StuartFarmer Mar 11, 2022
675177d
add h5py to dependencies
nsmkhn Mar 14, 2022
c749cf1
change hdf5 driver home
nsmkhn Mar 16, 2022
9f8b994
filename fix
StuartFarmer Mar 17, 2022
ad09e3e
Merge pull request #301 from Lamden/dev-hlc-ref
JeffWScott Mar 22, 2022
0a2b579
Merge branch 'dev-merge-lmdb-jeff' into lmdb-jeff
JeffWScott Mar 22, 2022
5c28ed3
Merge pull request #302 from Lamden/lmdb-jeff
JeffWScott Mar 22, 2022
42e9afd
remove redundant checks
nsmkhn Mar 29, 2022
d86a378
c extension for hdf5
nsmkhn Mar 30, 2022
313176a
utilize pkgconfig for extension dependencies
nsmkhn Mar 30, 2022
9316ca4
Merge branch 'dev-hdf5-poc' into dev-migration
nsmkhn May 2, 2022
1439137
Rollback default driver to MongoDB driver
nsmkhn May 2, 2022
0c2d934
Use HDF5 driver
nsmkhn May 4, 2022
0022de2
change default to FSDRIVER
JeffWScott May 17, 2022
e843063
driver tweaks
JeffWScott Jun 15, 2022
f5b36e7
Merge branch 'dev-merge-lmdb-jeff' into dev-post-migration
JeffWScott Jun 22, 2022
8af8d5b
merge lmdb-jeff cache driver changes
JeffWScott Jun 23, 2022
7bfa0ee
generic pkgconfig for darwin
nsmkhn Jun 24, 2022
e12d228
fix default argument constructor isn't called
nsmkhn Jun 24, 2022
d468900
fix flush
nsmkhn Jun 24, 2022
f4e80e2
fix convert_dict
nsmkhn Jul 13, 2022
7bd7241
h5 driver: enable debug in set_value
nsmkhn Jul 21, 2022
282bf34
h5 driver: enable logging everywhere
nsmkhn Jul 21, 2022
21d1839
h5 driver: raise error if we try to create a file which already exist…
nsmkhn Jul 21, 2022
a191500
h5 driver: if file already exists but H5Fopen fails for some reason
nsmkhn Jul 21, 2022
9cb0de1
h5 driver: add lock
nsmkhn Jul 21, 2022
646de05
h5 driver: simplify lock
nsmkhn Jul 21, 2022
8da72b1
h5 driver: fix lock
nsmkhn Jul 21, 2022
6ffc948
h5 driver: fix lock
nsmkhn Jul 21, 2022
dc74f1e
h5 driver: disable debug logs
nsmkhn Jul 21, 2022
df5a9c5
h5 driver: fetch keys from contract with C HDF5 api; remove h5py comp…
nsmkhn Jul 23, 2022
d577841
fix for h5 driver: use H5OVisit as per documentation
nsmkhn Jul 23, 2022
67f6e7a
h5 driver: fixed too few arguments to H5Ovisit function call by calli…
nsmkhn Jul 25, 2022
ab99d7b
h5 driver: store group only if has value
nsmkhn Jul 28, 2022
f695804
create genesis block: add flag in order to not commit state changes m…
nsmkhn Aug 3, 2022
d01a00f
h5 driver: modify version conditional macro statement to use h5ovisit…
nsmkhn Aug 3, 2022
8649d8d
remove lmdb driver and requirements
JeffWScott Aug 3, 2022
6d8e39d
Merge pull request #309 from Lamden/dev-post-migration-remove-lmdb
JeffWScott Aug 3, 2022
1cd5807
Add motor package to setup.py
JeffWScott Aug 4, 2022
243662e
version to 1.1.6
JeffWScott Aug 4, 2022
451c732
downgrade pymongo driver version
JeffWScott Aug 4, 2022
3a6005d
h5 driver: store block numbers alongside values so we know at which b…
nsmkhn Aug 4, 2022
42ad0be
Merge pull request #310 from Lamden/dev-h5driver-block-number
nsmkhn Aug 4, 2022
0412b32
allow client.py to accept no submission file and instead get the cont…
JeffWScott Aug 9, 2022
49dfbfe
Merge remote-tracking branch 'origin/dev-post-migration' into dev-pos…
JeffWScott Aug 9, 2022
24a7a14
allow client.py to accept no submission file and instead get the cont…
JeffWScott Aug 9, 2022
212d6ae
rt
StuartFarmer Sep 22, 2022
1db6b61
Add AUXILIARY_SALT to random seed from environment.
JeffWScott Jan 25, 2023
cddadb1
add new context items
JeffWScott Jan 25, 2023
94c6e8d
Merge pull request #311 from Lamden/dev-post-migration-context
JeffWScott Jan 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ contracting.egg-info
build
.github
.idea
logs
logs
*.so
.ccls
42 changes: 28 additions & 14 deletions contracting/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,37 +175,49 @@ def __init__(self, signer='sys',
self.submission_filename = submission_filename
self.environment = environment

# Seed the genesis contracts into the instance
with open(self.submission_filename) as f:
contract = f.read()
# Get submission contract from file
if submission_filename is not None:
# Seed the genesis contracts into the instance
with open(self.submission_filename) as f:
contract = f.read()

self.raw_driver.set_contract(name='submission',
code=contract)
self.raw_driver.set_contract(name='submission',
code=contract)

self.raw_driver.commit()
self.raw_driver.commit()

# Get submission contract from state
self.submission_contract = self.get_contract('submission')

def set_submission_contract(self, filename=None):
def set_submission_contract(self, filename=None, commit=True):
state_contract = self.get_contract('submission')

if filename is None:
filename = self.submission_filename

with open(filename) as f:
contract = f.read()
if filename is None and state_contract is None:
raise AssertionError("No submission contract provided or found in state.")

self.raw_driver.delete_contract(name='submission')
self.raw_driver.set_contract(name='submission',
code=contract)
if filename is not None:
with open(filename) as f:
contract = f.read()

self.raw_driver.commit()
self.raw_driver.delete_contract(name='submission')
self.raw_driver.set_contract(name='submission',
code=contract)
if commit:
self.raw_driver.commit()

self.submission_contract = self.get_contract('submission')


def flush(self):
# flushes db and resubmits genesis contracts
self.raw_driver.flush()
self.raw_driver.clear_pending_state()
self.set_submission_contract()

if self.submission_filename is not None:
self.set_submission_contract()

# Returns abstract contract which has partial methods mapped to each exported function.
def get_contract(self, name):
Expand Down Expand Up @@ -273,6 +285,8 @@ def compile(self, f):

def submit(self, f, name=None, metering=None, owner=None, constructor_args={}, signer=None):

assert self.submission_contract is not None, "No submission contract set. Try set_submission_contract first."

if isinstance(f, FunctionType):
f, n = self.closure_to_code_string(f)
if name is None:
Expand Down
5 changes: 5 additions & 0 deletions contracting/compilation/linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ def no_nested_imports(self, node):
def visit_Name(self, node):
self.not_system_variable(node.id, node.lineno)

if node.id == 'rt':
self._is_success = False
str = "Line {}: ".format(node.lineno) + VIOLATION_TRIGGERS[13]
self._violations.append(str)

if node.id in ILLEGAL_BUILTINS and node.id != 'float':
self._is_success = False
str = "Line {}: ".format(node.lineno) + VIOLATION_TRIGGERS[13]
Expand Down
4 changes: 4 additions & 0 deletions contracting/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@

DELIMITER = ':'
INDEX_SEPARATOR = '.'
HDF5_GROUP_SEPARATOR = '/'

DECIMAL_PRECISION = 64

SUBMISSION_CONTRACT_NAME = 'submission'
PRIVATE_METHOD_PREFIX = '__'
EXPORT_DECORATOR_STRING = 'export'
INIT_DECORATOR_STRING = 'construct'
Expand All @@ -24,3 +26,5 @@
WRITE_COST_PER_BYTE = 25

STAMPS_PER_TAU = 20

BLOCK_NUM_DEFAULT = -1
Loading