Skip to content

trust_level=0 on current mainnet: sync key block (#33), Simplex signature sets - #65

Open
miinimal wants to merge 2 commits into
yungwine:masterfrom
miinimal:trust-level-0-mainnet
Open

miinimal wants to merge 2 commits into
yungwine:masterfrom
miinimal:trust-level-0-mainnet

Conversation

@miinimal

Copy link
Copy Markdown

Fixes #33 and makes trust_level=0 work on current mainnet together with the pytoniq-core change linked below.

sync() left last_key_block unset (#33). When the stored masterchain block is already at or past the liteserver's last block (liteservers lag behind each other), the proof has no forward link, so client.last_key_block stayed None and the next proof failed with AttributeError on None. sync() now sets it to the trusted key block it chose. Test: tests/test_sync.py (offline; fails on master, passes here).

Simplex consensus signatures. Masterchain proofs now carry liteServer.signatureSet.simplex; raw_get_mc_block_proof passes the whole set to pytoniq-core's new check_block_signature_set, which builds the right signed message. With an older pytoniq-core it falls back to the previous catchain-only check, so this change is safe on its own.

Live: with both changes, LiteClient.from_mainnet_config(trust_level=0) connected on mainnet three times in a row, the second and third from the stored blocks. tests/test_sync.py and tests/test_wallet.py pass offline; flake8 (CI selection) clean.

Requires (for Simplex): yungwine/pytoniq-core#35

When the stored masterchain block is already at or past the liteserver's last block (liteservers lag behind each
other), the proof contains no forward link, so client.last_key_block stayed None and the next proof failed with
AttributeError on None (yungwine#33). Use the trusted key block chosen by sync.
…onsensus)

Mainnet masterchain proofs now carry liteServer.signatureSet.simplex. Pass the whole set to
pytoniq_core's check_block_signature_set, which builds the signed message for either kind; with an older
pytoniq-core the previous catchain-only check is used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AttributeError: 'NoneType' object has no attribute 'seqno' with trust_level 0

1 participant