Code Monkey home page Code Monkey logo

bat-ledger's People

Contributors

ayumi avatar dependabot[bot] avatar diracdeltas avatar evq avatar genysys avatar husobee avatar jlbyrne avatar maikelmclauflin avatar mihaiplesa avatar mrose17 avatar nejczdovc avatar nvonpentz avatar oauthbringer avatar orspetol avatar renovate[bot] avatar tarikdem avatar thypon avatar tsmartt avatar yachtcaptain23 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bat-ledger's Issues

move source-of-truth for publisher rules to eyeshade

  1. Deprecate these calls in the ledger:

    GET /v2/publisher/identity
    GET /v2/publisher/identity/verified

  2. Move these calls from the ledger to the eyeshade server:

    POST /v2/publisher/ruleset
    PATCH /v2/publisher/rulesets
    PUT /v2/publisher/ruleset/{publisher}
    DELETE /v2/publisher/ruleset/{publisher}
    GET /v2/reports/publisher/rulesets

  3. Add messages from eyeshade to ledger that provide the functionality in the five calls above.

upgrade old surveyors to un-stick contributions

currently we have a number of ledger clients stuck using old surveyors instead of the current one. it seems most likely that this is caused by brave-intl/bat-client#35 in combination with the fact that some clients reconcile date was not pushed back on grant claim and grants were made unredeemable before their maturity date.

we will fix the client side - to go out in a browser-laptop release but as a quick fix we should unstick clients by upgrading old surveyors servers side on demand.

GET /v1/owners/{owner}/wallet returns only settlement info for one channel

To implement https://github.com/brave-intl/creators-private-issues/issues/960 publishers needs to know the total amount an owner earned during the last settlement.

It appears as though a settlement document only has the information for a single channel, and we are only returning one settlement per owner in this request.

entries = await settlements.find({ owner: owner }, { sort: { timestamp: -1 }, limit: 1 })

cc @evq

Owner accounts can't be easily deleted

Many publishers have requested that their accounts be deleted. We do not have an easy way to do this. Right now we must manually delete the records from both eyeshade and publishers. This is error prone and not scalable.

We should create some endpoint on eyeshade that publishers can hit that deletes all records associated with an owner (owner, their channels, token, etc). Something like this would work:

DELETE /v2/owners/{owner}

Related to https://github.com/brave-intl/creators-private-issues/issues/969

Proxy ledger publisher verification related endpoints to Publishers app

In the Brave browser, the payments tab has publisher verified green checkmarks. This green checkmark is queried from Ledger.

Instead of Ledger fetching this information from Eyeshade, we're going to fetch the verified_status for an owner from the publishers api.

We'll be disabling the data propagation in a separate task.

create full lifecycle for grant server during tests

during the test for settling a grant, the tester should not have to manage the db before running the tests. manual management can cause the db to be in poor state and for tests to fail. instead, automate by making sure that during a test, a single grant is added to the db, it is used, and subsequently flushed from the redis db by the end of the test.

retire github authentication in eyeshade

we should retire github auth in eyeshade and other services where possible, we're moving toward a publishers based admin panel and our github auth has known issues, e.g. it does not work across dynos:

if the first hit to v1/login (redirects the user to github) and the second (user is redirected back from github) happen on different dynos, the login does not succeed

apps we could remove it for currently:

  • balance
  • helper
  • extractor

implement swaggerstats equivalent in runtime-prometheus.js

cf., http://swaggerstats.io/apidoc.html#operation/%2Fswagger-stats%2Fmetrics

Name Type Labels Description
api_all_request_total counter - The total number of all API requests received
api_all_success_total counter - The total number of all API requests with success response
api_all_errors_total counter - The total number of all API requests with error response
api_all_client_error_total counter - The total number of all API requests with client error response
api_all_server_error_total counter - The total number of all API requests with server error response
api_all_request_in_processing_total gauge - The total number of all API requests currently in processing (no response yet)
nodejs_process_memory_rss_bytes gauge - Node.js process resident memory (RSS) bytes
nodejs_process_memory_heap_total_bytes gauge - Node.js process memory heapTotal bytes
nodejs_process_memory_heap_used_bytes gauge - Node.js process memory heapUsed bytes
nodejs_process_memory_external_bytes gauge - Node.js process memory external bytes
nodejs_process_cpu_usage_percentage gauge - Node.js process CPU usage percentage
api_request_total counter methodpathcode The total number of all API requests
api_request_duration_milliseconds histogram methodpathle API requests duration
api_request_size_bytes histogram methodpathle API requests size
api_response_size_bytes histogram methodpathle API response size

Add Promotion creation to Tests

while it is implicit currently, the promotion creation under the npm script create-promotion should be a test that can be isolated and integrated with the rest of the testing flow

Support additional uphold conversions to purchase BAT

e.g., DASH, BCH, BTG.

this requires adding the appropriate network address. we probably want to rework the algorithm so that an address generation request is sent to uphold only if the user selects a particular alt-currency (at present, a wallet creation gets addresses for BTC, ETH, and LTC).

verify all channels sent to POST /v2/owners by publishers

currently only non-website channels are verified (all are sent by publishers), but with brave-intl/creators-private-issues#940 we will need this change to keep things in sync until we can remove eyeshade's copy of the channel/owner relationships

Make code more legible and testable

there are a variety of improvements that could be made to make the code more legible and testable

legible

  • using imports instead of requires and filename patterns
  • breaking apart monolithic files
  • destructuring
  • using default values

testable

  • breaking apart monolithic files
  • more (and exporting existing) pure functions (where available)

these items can be addressed in any order, as well as broken up by server / worker

blacklist fraudulant publishers and do sanity check when creating report

blacklisting publishers currently happens manually on voting document basis
mark publisher's excluded boolean if they are registered in our blacklist
if excluded is true, do not include in payout information
take the publisher, check the blacklist, flip the bool if

create mongodb indeces for blacklist and query them
  eyeshade/workers/wallet.js:voting-report
    mark excluded
  eyeshade/workers/reports.js:report-publishers-contributions
    sanity check to make sure no publishers in report have

remove setup scripts

setup scripts have been abstracted to tests. remove setup folder, update readme

Relation download does not exist

when starting up the extractor worker, the relation download errs in

npm run start-extractor-worker

saying that it does not exist.

First request to helper's /v1/rates results in a subset of values

when hitting /v1/rates immediately after the server starts up, a subset of rate conversions are sent back, instead of the full 20, which is denoted in the helper tests.

To reproduce, shut everything down, start up the servers, and run the helper integration test and see it fail the first time because only 8 values are sent back. Sometimes 9 are sent back, depending on if other tests are running in parallel.

Add bat-helper server

and have bat-ledger and bat-eyeshade talk to it instead of the exchange rate services directly

Reduce Rate Limit for ledger-web:3001/v1/grants/{grantId}

isolate why this is happening and allow tests to turn off / reduce time during testing

during the script

npm run test-integration

or, if using the docker container

docker-compose run --rm -v $(pwd)/test:/usr/src/app/test ledger-web npm run test-integration

the following error is received. if the endpoint is hit too often

status: 429
http://ledger-web:3001/v1/grants/d6a9c116-5779-4442-a0dc-6237e295ae29
{ statusCode: 429,
  error: 'Too Many Requests',
  message: 'try again in 86400 seconds' }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.