Modify fn validate_proposal from state.rs to call proposal.ns_table.validate()?; at the end.
New unit tests in new source file sequencer/src/block/full_payload/ns_table/test.rs
Simplify NsIter to be like TxIter (ie. just a Range wrapper) now that we can assume there are no duplicate namespace IDs.
Fix test in persistence.rs
This PR does not:
Test submit_test_with_query_module is hard to debug. If something bad happens then the test just runs forever with log messages like
2024-06-14T23:51:50.4143933Z 2024-06-14T23:51:50.414097Z WARN hotshot_task_impls::transactions: Couldn't get a block: no available blocks
2024-06-14T23:51:50.4145539Z at /home/runner/.cargo/git/checkouts/hotshot-0ac703037ea89b98/828f718/crates/task-impls/src/transactions.rs:290
2024-06-14T23:51:50.4146966Z in hotshot_task_impls::transactions::wait_for_block with id: 1, view: 1408
2024-06-14T23:51:50.4148270Z in hotshot_task_impls::transactions::Transaction task with id: 1, view: 1407
2024-06-14T23:51:50.4148937Z
2024-06-14T23:51:50.4402287Z ##[error]The action 'Test' has timed out after 40 minutes.
Key places to review:
NsTable::validate
Serde for NsTable needed a workaround to call validate during deserialization. Search 382589140 for relevant code.
All changes to sequencer/src/state.rs
Reduce the traits supported by NamespaceId: no more Copy, Default, Namespace. Also remove Namespaced from Transaction.
test_append_and_collect_garbage is persistence.rs was malformed. This PR caused it to fail. Fixed the test in https://github.com/EspressoSystems/espresso-sequencer/pull/1607/commits/5ffd2e2241ec6b3a1167ccf3e90a2ab4ec3efb62. Fixed test persists only an empty (genesis) block--is this ok or do you want it to test a nontrivial block? (Previously the block it tested was malformed, which triggered the new namespace table validation code of the present PR.)
Closes #1605
This PR:
NsTable::validate
to check whether the bytes of a namespace table meet the desired conditions.validate_proposal
fromstate.rs
to callproposal.ns_table.validate()?;
at the end.sequencer/src/block/full_payload/ns_table/test.rs
NsIter
to be likeTxIter
(ie. just aRange
wrapper) now that we can assume there are no duplicate namespace IDs.persistence.rs
This PR does not:
Test
submit_test_with_query_module
is hard to debug. If something bad happens then the test just runs forever with log messages likeKey places to review:
NsTable::validate
NsTable
needed a workaround to callvalidate
during deserialization. Search382589140
for relevant code.sequencer/src/state.rs
NamespaceId
: no moreCopy
,Default
,Namespace
. Also removeNamespaced
fromTransaction
.test_append_and_collect_garbage
ispersistence.rs
was malformed. This PR caused it to fail. Fixed the test in https://github.com/EspressoSystems/espresso-sequencer/pull/1607/commits/5ffd2e2241ec6b3a1167ccf3e90a2ab4ec3efb62. Fixed test persists only an empty (genesis) block--is this ok or do you want it to test a nontrivial block? (Previously the block it tested was malformed, which triggered the new namespace table validation code of the present PR.)