-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add carp funnel with stake delegation pool tracking #246
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
e62b7ab
add carp funnel with stake delegation pool tracking
ecioppettini ba77b28
handle presync in carp funnel
ecioppettini e12f963
expose cde utils get cardano delegation function
ecioppettini 40d5e8e
use local (tmp) carp client lib in the funnel
ecioppettini 4265a95
add delegation check in batcher's address validator
ecioppettini f1cbd29
add stopSlot setting to stop fetching
ecioppettini 3413015
improve logging and make presync concurrent
ecioppettini d7f4540
address review comments
ecioppettini 77f7ac2
fix markCardanoCdeSlotProcessed query
ecioppettini 444771d
presync checkpointing for cardano cde
ecioppettini 879218d
drop cde_tracking_cardano in down.sql
ecioppettini 709ead0
address new review comments
ecioppettini 06a4493
replace carp local client with 2.3.0 from npm
ecioppettini 72d896d
cache the startingSlot and the previous range upper end
ecioppettini 6f70baf
remove old TODO
ecioppettini 17b265f
replace map-filter with reduce for getEarlistSlot/Blockheight
ecioppettini a2c3b33
add CARDANO_CONFIRMATION_DEPTH config
ecioppettini d63f1f1
refactor getEarliestStart* functions
ecioppettini 91c3247
default case of min should be Infinity
ecioppettini e334a4d
document timestampToAbsoluteSlot and fix missing slot offset
ecioppettini b6de71c
reinitialize the cache entry in case of error
ecioppettini File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import type { | ||
CdeCardanoPoolDatum, | ||
ChainDataExtensionCardanoDelegation, | ||
ChainDataExtensionDatum, | ||
} from '@paima/sm'; | ||
import { ChainDataExtensionDatumType, DEFAULT_FUNNEL_TIMEOUT, timeout } from '@paima/utils'; | ||
import { Routes, query } from '@dcspark/carp-client/client/src'; | ||
import type { DelegationForPoolResponse } from '@dcspark/carp-client/shared/models/DelegationForPool'; | ||
|
||
export default async function getCdeData( | ||
url: string, | ||
extension: ChainDataExtensionCardanoDelegation, | ||
fromAbsoluteSlot: number, | ||
toAbsoluteSlot: number, | ||
getBlockNumber: (slot: number) => number | ||
): Promise<ChainDataExtensionDatum[]> { | ||
const events = await timeout( | ||
query(url, Routes.delegationForPool, { | ||
pools: extension.pools, | ||
range: { minSlot: fromAbsoluteSlot, maxSlot: toAbsoluteSlot }, | ||
}), | ||
DEFAULT_FUNNEL_TIMEOUT | ||
); | ||
|
||
return events.map(e => eventToCdeDatum(e, extension, getBlockNumber(e.slot))); | ||
} | ||
|
||
function eventToCdeDatum( | ||
event: DelegationForPoolResponse[0], | ||
extension: ChainDataExtensionCardanoDelegation, | ||
blockNumber: number | ||
): CdeCardanoPoolDatum { | ||
return { | ||
cdeId: extension.cdeId, | ||
cdeDatumType: ChainDataExtensionDatumType.CardanoPool, | ||
blockNumber, | ||
payload: { | ||
address: event.credential, | ||
pool: event.pool || undefined, | ||
}, | ||
scheduledPrefix: extension.scheduledPrefix, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was the need to add this? It's not used anywhere in the function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this question, it's used in the first line of the function actually