vechain / thor

A general purpose blockchain highly compatible with Ethereum's ecosystem
GNU Lesser General Public License v3.0
795 stars 248 forks source link

feat: add support for 'finalized' revision in accounts #689

Closed darrenvechain closed 2 months ago

darrenvechain commented 3 months ago

Description

This PR allows clients to specify finalized as a revision on the accounts endpoints.

The solo instance is also modified to return the best block as the finalized block

Type of change

How Has This Been Tested?

curl --request GET \
  --url 'https://mainnet.blue.dev.node.vechain.org/accounts/0x3504c0089Ce44d5709BB97a957EC40C76F18dCdA?revision=best' \
  --header 'Accept: application/json, text/plain'

curl --request GET \
  --url 'https://mainnet.blue.dev.node.vechain.org/accounts/0x3504c0089Ce44d5709BB97a957EC40C76F18dCdA?revision=finalized' \
  --header 'Accept: application/json, text/plain'

Checklist:

codecov-commenter commented 3 months ago

Codecov Report

Attention: Patch coverage is 94.87179% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 61.64%. Comparing base (0489d6a) to head (7d7f067). Report is 3 commits behind head on master.

Files Patch % Lines
api/api.go 0.00% 2 Missing :warning:
api/utils/revisions.go 93.93% 1 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #689 +/- ## ========================================== + Coverage 61.37% 61.64% +0.26% ========================================== Files 194 195 +1 Lines 18223 18246 +23 ========================================== + Hits 11184 11247 +63 + Misses 5958 5904 -54 - Partials 1081 1095 +14 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

nwbrettski commented 2 months ago

Add finalized to:

Add documentation clarifying what finalized means:

libotony commented 2 months ago

Add finalized to:

  • transactions endpoint
  • debug trace call endpoint

Add documentation clarifying what finalized means:

  • 360 blocks
  • 2 rounds of BFT

Had a discussion with @darrenvechain, transaction's endpoint does not need finalized, it used to only accept blockID or null

libotony commented 2 months ago

Do not forget to sync the version thor.yaml with cmd/thor/VERSION @darrenvechain since we got changes in the API spec