@@ -858,8 +858,7 @@ parser_error_t compute_chain_hash(parser_tx_t *txObj) {
858858 return parser_ok ;
859859}
860860
861- // | borsh(leaves_data) | borsh(indices_leaves) | borsh(lemmas) | borsh(tree_size) | borsh(root_hash) | borsh(root_indexes) |
862- // borsh(chain_data) | borsh(extra_metadata_hash) | borsh(chain_hash)
861+ // | borsh(leaves_data) | borsh(indices_leaves) | borsh(lemmas) | borsh(tree_size) | borsh(root_hash) | borsh(chain_hash)
863862parser_error_t merkle_proofs_read (parser_context_t * ctx , parser_tx_t * txObj ) {
864863 CHECK_INPUT (ctx );
865864 CHECK_INPUT (txObj );
@@ -913,10 +912,20 @@ parser_error_t merkle_proofs_read(parser_context_t *ctx, parser_tx_t *txObj) {
913912
914913 // read root_hash
915914 txObj -> merkle_proofs .root_hash .ptr = ctx -> buffer .ptr + ctx -> offset ;
916- txObj -> merkle_proofs .root_hash .len = 32 ;
915+ txObj -> merkle_proofs .root_hash .len = CX_SHA256_SIZE ;
917916 CTX_CHECK_AND_ADVANCE (ctx , txObj -> merkle_proofs .root_hash .len );
918917 print_buffer (& txObj -> merkle_proofs .root_hash , "root_hash" );
919918
919+ CHECK_ERROR (verify_merkle_proofs (& txObj -> merkle_proofs ));
920+
921+ return parser_ok ;
922+ }
923+
924+ // borsh(root_indexes) | borsh(chain_data) | borsh(extra_metadata_hash)
925+ parser_error_t schema_extra_data_read (parser_context_t * ctx , parser_tx_t * txObj ) {
926+ CHECK_INPUT (ctx );
927+ CHECK_INPUT (txObj );
928+
920929 // read root_type_indices
921930 CHECK_ERROR (read_root_type_indices (ctx , & txObj -> schema .root_type_indices ));
922931
@@ -929,13 +938,15 @@ parser_error_t merkle_proofs_read(parser_context_t *ctx, parser_tx_t *txObj) {
929938 CTX_CHECK_AND_ADVANCE (ctx , CX_SHA256_SIZE );
930939 print_buffer (& txObj -> schema .extra_metadata_hash , "extra_metadata_hash" );
931940
941+ return parser_ok ;
942+ }
943+
944+ parser_error_t schema_chain_hash_read (parser_context_t * ctx , parser_tx_t * txObj ) {
932945 // read chain hash
933946 txObj -> schema .chain_hash .ptr = ctx -> buffer .ptr + ctx -> offset ;
934947 txObj -> schema .chain_hash .len = CX_SHA256_SIZE ;
935948 CTX_CHECK_AND_ADVANCE (ctx , CX_SHA256_SIZE );
936949
937- CHECK_ERROR (verify_merkle_proofs (& txObj -> merkle_proofs ));
938-
939950 // compute chain hash
940951 CHECK_ERROR (compute_chain_hash (txObj ));
941952
0 commit comments