“Invalid pre-image data” triggered on non-connected node, Use JSON-Schema for verification of JSON data, etc.

Dev. Team Sprint Update 22

BOSagora
BOSagora
4 min readAug 12, 2020

--

Functionality Implementations

“Invalid pre-image data” triggered on non-connected node #1062

This was a bug fix. The following message shouldn’t show up for an empty, non-connected validator. Having it means there’s a bug in pre-image propagation / the Genesis block.

$ dub build
$ cd test/system/node/2/
$ ../../../../build/agora
[…]
[main(ZbnT) INF] Listening for requests on http://0.0.0.0:2826/
Task terminated with uncaught exception: Request failure to http://node-6:6826 after 5 attempts
Task terminated with uncaught exception: Request failure to http://node-7:7826 after 5 attempts
Task terminated with uncaught exception: Request failure to http://node-4:4826 after 5 attempts
Task terminated with uncaught exception: Request failure to http://node-5:5826 after 5 attempts
Task terminated with uncaught exception: Request failure to http://node-3:3826 after 5 attempts
2020–07–27 09:15:36,758 Info [agora.consensus.ValidatorSet] — Invalid pre-image data: The pre-image has a invalid hash value. Pre-image: { enroll_key: 0xb20da9cfbda971f3f573f55eabcd677feaf12f7948e8994a97cdf9e570799b71631e87bb9ebce0d6a402275adfb6e365fdb72139c18559a10df0e5fe4bae08eb, hash: 0x148006017980424589fc1a7f360f815ef1bcce71a3bd0b581f7a126a57449cb058bba5eca3642cac3e93c15ebd2f2d54d206e6ee3c7fc06b8a59e597d5e02840, distance: 11 }

Use JSON-Schema for verification of JSON data #55

Originally, only JSON data properties are verified. There was a need to use more standardized methods. When Verifying JSON data, verification must happen in a standard way

The following is the definition of done:

  • Automatically generate the interface using JSON-Schema.
  • Create a function to verify JSON data using the interface.
  • Apply a new verification method to all sources.

Add a web page with SDK documentation that will be automatically generated when the recent PR is merged #22

This feature is self-explanatory. We needed to create documentation that was easy to access and maintain.

You can view the documentation here:
https://bpfkorea.github.io/boa-sdk-ts/classes/boaclient.html

Apply DB transactions to the Block storage processing #51

This enhancement was to correct if an error occurred while storing blocks and transactions or enrollments, that do not match the ledger actual data may exist. For example, if there is only block data exists. In this case, rollback must be done and must be restored in the tables.

If you would like more info on our Typescript SDK development please check out our Github repository.
https://github.com/bpfkorea/boa-sdk-ts

Ongoing Development

  • Transition away from creating a block based on the number of transactions in the pool #1004
  • Design and implement quorum balancing #240
  • Node configuration and block storage consistency is not checked #1006
  • Validator can get stuck trying to connect to expired / discontinued Validators (test-case) #854

Functionality Implementations

#1062 “무효한 프리이미지 데이터” 메시지가 연결되지 않은 노드에서 발생하는 이슈

일종의 버그 수정 작업이었습니다. 연결되지 않은 검증자들에게서 아래와 같은 메시지들이 보여서는 안됩니다. 만약 아래 메시지가 뜬다면 프리이미지 전파와 제네시스 블록에 버그가 있다는 의미입니다.

$ dub build
$ cd test/system/node/2/
$ ../../../../build/agora
[…]
[main(ZbnT) INF] Listening for requests on http://0.0.0.0:2826/
Task terminated with uncaught exception: Request failure to http://node-6:6826 after 5 attempts
Task terminated with uncaught exception: Request failure to http://node-7:7826 after 5 attempts
Task terminated with uncaught exception: Request failure to http://node-4:4826 after 5 attempts
Task terminated with uncaught exception: Request failure to http://node-5:5826 after 5 attempts
Task terminated with uncaught exception: Request failure to http://node-3:3826 after 5 attempts
2020–07–27 09:15:36,758 Info [agora.consensus.ValidatorSet] — Invalid pre-image data: The pre-image has a invalid hash value. Pre-image: { enroll_key: 0xb20da9cfbda971f3f573f55eabcd677feaf12f7948e8994a97cdf9e570799b71631e87bb9ebce0d6a402275adfb6e365fdb72139c18559a10df0e5fe4bae08eb, hash: 0x148006017980424589fc1a7f360f815ef1bcce71a3bd0b581f7a126a57449cb058bba5eca3642cac3e93c15ebd2f2d54d206e6ee3c7fc06b8a59e597d5e02840, distance: 11 }

#55 JSON 데이터 검증을 위해 JSON-Schema 사용

기존 검증시에는 JSON 데이터 속성만 검증되었습니다. 따라서, 검증 관련으로 보다 통일된 방식을 사용할 필요가 있었고, 이후, JSON 데이터를 검증할 때는 무조건 표준 방식으로 검증합니다.

아래는 완료 정의된 내용입니다:

  • JSON-Schema를 사용하여 자동적으로 인터페이스를 생성합니다.
  • 인터페이스를 사용하여 JSON 데이터를 검증할 기능을 생성합니다.
  • 모든 소스에 새로운 검증 방식을 적용합니다.

#22 최신 PR(코드병합요청)이 통합될 때 자동적으로 생성되는 SDK 문서를 가진 웹페이지 추가하기

이 기능은 개발팀이 접근성이 좋고 관리하기 쉬운 문서를 생성할 수 있도록 해줍니다.

아래 링크에서 문서를 확인하실 수 있습니다.
https://bpfkorea.github.io/boa-sdk-ts/classes/boaclient.html

#51 블록 저장 처리에 DB 트랜잭션 적용

이 기능은 블록/트랜잭션이나 검증자등록 저장 시 오류가 발생할 때 복원하는 역할을 합니다. 예를 들어 블록 정보 저장 시, 블록 헤더 데이터만 있는 등 실제 원장 데이터와 일치하지 않을 때 이를 수정합니다. 이 경우 롤백을 수행해서 테이블에서 이를 복원합니다.

타입 스크립트 SDK 개발관련 더 자세한 정보를 원하시면, BOSAGORA의 깃허브에서 확인하시기 바랍니다.
https://github.com/bpfkorea/boa-sdk-ts

Ongoing Development

  • 풀에 있는 거래 수에 기반해 블록을 생성하는 것으로부터 변경 진행#1004
  • 쿼럼 밸런싱 디자인 및 구현 #240
  • 노드 환경설정과 블록 스토리지에 대한 일관성이 확인되지 않음 #1006
  • 연결이 끊긴 검증자들에 연결을 시도하며 검증자가 정체될 수 있음 (테스트 케이스) #854

--

--