Skip to content
This repository has been archived by the owner on Feb 9, 2022. It is now read-only.

lambda-prevout-provider fallback-prevout-provider #128

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

monstrobishi
Copy link
Contributor

What kind of PR is this?:

/kind feature

What this PR does / why we need it:

As whale cannot technically "index" unconfirmed prevouts, it must rely on listunspent => include_unsafe, which would be detrimental to whale infrastructure. The only other solution being that the client must keep track of prevouts. As Lambda does not persist state, nor do we want to maintain a database, an alternative implementation is required.

This failsafe provider uses the cloudwatch logs to fetch the prevout used in the last transaction, in the case where this causes any kind of issue, the whale client provider is used as a fallback.

Which issue(s) does this PR fixes?:

Fixes #

Additional comments?:

@codeclimate
Copy link

codeclimate bot commented Aug 5, 2021

Code Climate has analyzed commit 127fd9e and detected 0 issues on this pull request.

View more on Code Climate.

@codecov
Copy link

codecov bot commented Aug 5, 2021

Codecov Report

Merging #128 (127fd9e) into main (96aad7e) will decrease coverage by 0.18%.
The diff coverage is 96.55%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #128      +/-   ##
==========================================
- Coverage   97.93%   97.75%   -0.19%     
==========================================
  Files          18       19       +1     
  Lines         242      267      +25     
  Branches       16       18       +2     
==========================================
+ Hits          237      261      +24     
- Misses          5        6       +1     
Impacted Files Coverage Δ
...almon-oracles-functions/src/salmonWalletAccount.ts 95.45% <95.45%> (ø)
packages/salmon-oracles-functions/src/index.ts 100.00% <100.00%> (ø)
...ges/salmon-oracles-functions/src/oraclesManager.ts 93.10% <100.00%> (+0.51%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 96aad7e...127fd9e. Read the comment docs.

console.log(`Sent with txid: ${txid}`)
const prevout = await broadcastPrices(oraclesManager, env, prices)
if (prevout !== undefined) {
process.stdout.write(`${JSON.stringify(prevout)}`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
process.stdout.write(`${JSON.stringify(prevout)}`)
process.stdout.write(`${FALLBACK_PREVOUT_PREFIX} ${JSON.stringify(prevout)}`)

With specific log group, literally we have partitioned, filterable time series DB :D

@monstrobishi monstrobishi marked this pull request as draft August 16, 2021 05:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants