Skip to content

Commit

Permalink
Migrate reconciler
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-ogrady committed May 12, 2020
1 parent 5c1a539 commit e18745a
Show file tree
Hide file tree
Showing 5 changed files with 1,170 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ GOLINES_CMD=go run github.com/segmentio/golines
GOVERALLS_CMD=go run github.com/mattn/goveralls

GO_PACKAGES=./asserter/... ./fetcher/... ./types/... ./client/... ./server/... \
./parser/... ./syncer/...
./parser/... ./syncer/... ./reconciler/...
GO_FOLDERS=$(shell echo ${GO_PACKAGES} | sed -e "s/\.\///g" | sed -e "s/\/\.\.\.//g")
TEST_SCRIPT=go test -v ${GO_PACKAGES}
LINT_SETTINGS=golint,misspell,gocyclo,gocritic,whitespace,goconst,gocognit,bodyclose,unconvert,lll,unparam
Expand Down
1 change: 0 additions & 1 deletion fetcher/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,3 @@ fetcher := fetcher.New(ctx, serverURL, fetcher.WithBlockConcurrency(10))
## More Examples
Check out the [examples](/examples) to see how easy
it is to connect to a Rosetta server.

36 changes: 36 additions & 0 deletions reconciler/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Reconciler

[![GoDoc](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=shield)](https://pkg.go.dev/github.com/coinbase/rosetta-sdk-go/reconciler?tab=doc)

The Reconciler package is used to ensure that balance changes derived from
parsing Rosetta blocks are equivalent to the balance changes computed by the
node. If you want to see an example of how to use this package, take
a look at [rosetta-cli](https://github.com/coinbase/rosetta-cli).

## Features
* Customizable `Helper` and `Handler` to define your own logic for retrieving
calculated balance changes and handling successful/unsuccessful comparisons
* Perform balance lookup at either historical blocks or the current block (if
historical balance query is not supported)
* Provide a list of accounts to compare at each block (for quick and easy
debugging)

## Installation

```shell
go get github.com/coinbase/rosetta-sdk-go/reconciler
```

## Reconciliation Strategies
### Active Addresses
The reconciler checks that the balance of an account computed by
its operations is equal to the balance of the account according
to the node. If this balance is not identical, the reconciler will
error.

### Inactive Addresses
The reconciler randomly checks the balances of accounts that aren't
involved in any transactions. The balances of accounts could change
on the blockchain node without being included in an operation
returned by the Rosetta Node API. Recall that all balance-changing
operations must be returned by the Rosetta Node API.
Loading

0 comments on commit e18745a

Please sign in to comment.