Skip to content
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

Clvm serde #15

Merged
merged 41 commits into from
Jan 6, 2024
Merged
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
3ba52a2
Modernize `SConstruct`.
richardkiss Aug 11, 2023
dc73078
Use `chialisp_puzzles` and `chia_base`.
richardkiss Aug 11, 2023
7a4742c
Use `chia_base` to greatly simplify hsms.
richardkiss Aug 11, 2023
0747b60
Bump `chia_base` to 0.1.3. `chmod -x`
richardkiss Aug 11, 2023
ec2f745
Get `full_life_cycle.sh` working
richardkiss Aug 11, 2023
2e35186
`black`
richardkiss Aug 11, 2023
cd25dc4
Refactor clvm_serialization
richardkiss Aug 12, 2023
38cec27
Forgot a command
richardkiss Aug 12, 2023
5cf78b0
setuptools
richardkiss Aug 12, 2023
1d5ada9
Some minor improvements
richardkiss Aug 14, 2023
ccc86e4
Get `hsm_dump_us` working
richardkiss Aug 16, 2023
f6205f8
Remove `UnsignedSpend.from_chunks`
richardkiss Aug 16, 2023
c5a4fec
Handle hex or qrint encoding, zlib okay too
richardkiss Aug 18, 2023
5317d6f
standard dataclasses
richardkiss Oct 2, 2023
4485410
First crack at interop tests
richardkiss Oct 5, 2023
c72dda6
Pay attention to `Field.default_factory`
richardkiss Oct 5, 2023
396d751
Allow hybrid expandable `dataclass` objects
richardkiss Oct 7, 2023
10ad856
refactor
richardkiss Oct 10, 2023
071a6b1
`Nonexandable`. May rename
richardkiss Oct 10, 2023
e0ad75a
Simplify `SumHint` and `PathHint`.
richardkiss Oct 10, 2023
fd00658
Move `SumHint` and `PathHint`
richardkiss Oct 10, 2023
be777c3
nonexpandable tuple
richardkiss Oct 12, 2023
0ff21c8
Rewrite `Nonexpandable` in terms of `tuple_nonexpandable`
richardkiss Oct 12, 2023
1df94bb
Serde of dataclasses now leverages tuple
richardkiss Oct 12, 2023
d0ec460
Ditch `PairTuple` and use `Frugal`
richardkiss Oct 12, 2023
e071e6d
Eliminate special case for `Frugal`
richardkiss Oct 12, 2023
2ae2753
Make `UnsignedSpend` more like original version
richardkiss Oct 12, 2023
7cbb995
Delete obsolete, rename
richardkiss Oct 12, 2023
16e5c0c
Add `hsms.core`
richardkiss Oct 16, 2023
39ec242
Use new serialization rather than legacy.
richardkiss Oct 17, 2023
9497eec
Revamp `TypeTree`
richardkiss Oct 25, 2023
f2ae042
move `clvm_serde`
richardkiss Oct 25, 2023
b7df4c6
Fix tests, mypy
richardkiss Nov 6, 2023
393cc6b
pin to `chia_base`
richardkiss Nov 7, 2023
fb19c06
Support `from __future__ import annotations`
richardkiss Nov 7, 2023
82d9d12
Interop with subtypes of `int`, `bytes`, `str`
richardkiss Nov 9, 2023
fa28fc4
coverage
richardkiss Nov 9, 2023
2a92fa5
py38
richardkiss Nov 10, 2023
c251d7e
`from_bytes`
richardkiss Nov 10, 2023
6c67aba
Use pypi chia_base
richardkiss Dec 7, 2023
a0e6ef2
coverage
richardkiss Dec 12, 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
Prev Previous commit
Next Next commit
Bump chia_base to 0.1.3. chmod -x
  • Loading branch information
richardkiss committed Jan 5, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 0747b608257f910043d18c999e3d0fe6d6224891
Empty file modified hsms/cmds/hsm_dump_sb.py
100755 → 100644
Empty file.
Empty file modified hsms/cmds/hsmmerge.py
100755 → 100644
Empty file.
Empty file modified hsms/cmds/hsms.py
100755 → 100644
Empty file.
Empty file modified hsms/cmds/hsmwizard.py
100755 → 100644
Empty file.
Empty file modified hsms/cmds/qrint.py
100755 → 100644
Empty file.
10 changes: 2 additions & 8 deletions hsms/consensus/conditions.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
from typing import Dict, Iterable, List
from typing import Dict, List

from clvm_rs import Program


def iter_program(program: Program) -> Iterable[Program]:
while program.pair:
yield Program.to(program.pair[0])
program = program.pair[1]


def conditions_by_opcode(conditions: Program) -> Dict[int, List[Program]]:
d: Dict[int, List[Program]] = {}
for _ in iter_program(conditions):
for _ in conditions.as_iter():
if _.pair:
d.setdefault(Program.to(_.pair[0]).as_int(), []).append(_)
return d
8 changes: 5 additions & 3 deletions hsms/process/sign.py
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@
from .signing_hints import SumHint, SumHints, PathHint, PathHints
from .unsigned_spend import SignatureInfo, UnsignedSpend

MAX_COST = 1 << 34

@dataclass
class SignatureMetadata:
@@ -27,9 +28,10 @@ class SignatureMetadata:

def conditions_for_coin_spend(coin_spend: CoinSpend) -> Program:
if coin_spend not in CONDITIONS_FOR_COIN_SPEND:
CONDITIONS_FOR_COIN_SPEND[coin_spend] = coin_spend.puzzle_reveal.run_with_cost(
coin_spend.solution, max_cost=1<<32
)[1]
_cost, r = coin_spend.puzzle_reveal.run_with_cost(
coin_spend.solution, max_cost=MAX_COST
)
CONDITIONS_FOR_COIN_SPEND[coin_spend] = r
return CONDITIONS_FOR_COIN_SPEND[coin_spend]


4 changes: 2 additions & 2 deletions hsms/process/unsigned_spend.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import zlib

from dataclasses import dataclass
from typing import List

import zlib

from clvm_rs import Program

from chia_base.atoms import bytes32
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ license = "Apache-2.0"
repository = "https://github.com/chia-network/hsms.git"
readme = "README.md"
src_root = "."
dependencies = ["segno==1.4.1", "chia_base==0.1.2", "chialisp_puzzles==0.1.0"]
dependencies = ["segno==1.4.1", "chia_base==0.1.3", "chialisp_puzzles==0.1.0"]
packages = ["hsms"]
# version is defined with `setuptools_scm`. See `SConstruct` file.