-
Notifications
You must be signed in to change notification settings - Fork 0
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
Milestone 1 Support #1
Conversation
* update dictionary validation to validate chainID * bug fixes * get evmChainId only one * Bug fix Co-authored-by: Scott Twiname <[email protected]> * Fix unwrapping dictionary response Co-authored-by: Scott Twiname <[email protected]>
* add header to manifest network * Improve validation of runner name * add all search params to connection headers Co-authored-by: Scott Twiname <[email protected]>
* add unfinalizedBlock service * add unit tests for unfinalized blocks * modify log levels of best and finalised blocks
* fix: incomplete ds data in same block (#1370) Co-authored-by: Orion <[email protected]> * [SKIP CI] Prerelease * Best Block (#1308) * Draft * update changes * rebase changes * fix * fix (#1329) * disable best blocks for workers until we support it * Rename bestBlock to unfinalizedBlocks, other clean up * Clean up * Further clean up * Dedupe reindex function * Fix tests * Clean up * Update checking finalization to use parent hash * Rename logger * Refactor unfinalized blocks * Use header rather than full block, improve detecting forks * Verify unfinalized blocks when disabled. Use sorted array for storing unfinalized blocks * Clean up logs * Fix not indexing unfinalized blocks right away, exit if historical not enabled Co-authored-by: Scott Twiname <[email protected]> * [SKIP CI] Prerelease * Fix bugs with unfinalized blocks (#1374) * Fix bugs with unfinalized blocks - Fix using wrong hash for unfinalized blocks - Fix not removing unfinalized blocks when the latest unfinalized block < finalized * Fix tests getting stuck * Fix issue finding where fork occurred * [SKIP CI] Prerelease * [release] 20221028 (#1372) * hot fix tests (#1360) * update tests: api.service.spec, init-controller.test, publish-controller.spec * update tests following comments * [SKIP CI] Prerelease * add ethereum to CLI and Validator (#1378) * Imporve dictionary query (#1371) * wip * wip * wip * broken wip * wip refactoring * seperate dictionaryQueryEntries * fix logic for setDicitonaryQueryEntries * cleaning up * move dictionaryEntry.ts to node-core * remove comments * create class for dictionaryqueryentries * update tests * move dictionaryQueryService into dicitonaryService * refactor * update logic for useDicitonary * relocated dictionaryQuery funcs * add test for dictquerymap * tests failing on windows? * test getDictionaryQueryEntries * test fixed for getDictioanryQueryEntries * added test for sorting * conflict fixed ? * fix conflict_2 * fix conflict_3 * add delete temp ds records back * clean up with new logic * clean up, add comments for test * fix * update logic * add generic type * [SKIP CI] Prerelease * Enable for better inheritance of generated entity modeld (#1377) * refactor: enable for entity inheritance * refactor: include also filed getters * [SKIP CI] Prerelease * fix comments issue with new package (#1380) * fix comments issue with new package * moved yaml package * [SKIP CI] Prerelease * fix logic with reindex and unfinalized height and dynamic ds (#1382) * fix logic with reindex and unfinalized height * fix * include fix for #1379 * update polkadot to 9.7.1 (#1384) * [release] 20221107 * Fix remove alter table (#1387) * remove migrate alter table * remove * [SKIP CI] Prerelease * [release] 20221108 (#1388) * fix missing sequelize sync (#1389) * [SKIP CI] Prerelease * [release] 20221108 patch (#1390) * reindex bind (#1391) * [SKIP CI] Prerelease * [release] 20221109 (#1393) * Handle fetch errors, then retry (#1386) * add retryOnFail function * add retryOnFail * add test, fix logic * [SKIP CI] Prerelease * fix (#1395) * [SKIP CI] Prerelease * [release] 20221109 node-core (#1394) * Fix tests hanging (#1396) * Fix tests hanging * Update base docker image with newer git version * [SKIP CI] Prerelease * Add distinct query plugin (#1274) * Add distinct query plugin * Clean up log * Fix distinct not being provided to query * Uppercase enum to be consistent with other enums * Update dictionary queries to try distinct argument * [SKIP CI] Prerelease * Add query distinct dependencies (#1398) * fix missing update forked graphile dependencies * tidy up * tidy up * [SKIP CI] Prerelease * Break block dispatcher file up and move common code to base class (#1397) * [SKIP CI] Prerelease * Hot schema trigger (#1401) * implement trigger with notification * working prior clean up * refactor and clean up on async and await * clean up * clear comments * add filter * fix * fix err * [SKIP CI] Prerelease * [release] 20221115 (#1402) * [release] 20221115 * [release] 20221115 * [release] 20221115 * fix hot schema (#1404) * fix and refactor * refactor getTriggers * [SKIP CI] Prerelease * [release] 20221115 (#1408) * [release] 20221115 * [release] 20221115 * fix fetchblock for works (#1410) * [SKIP CI] Prerelease * fix row estimate (#1417) * fix row estimate * tidy up * [SKIP CI] Prerelease * Add support to cli/validator for flare (#1416) * [SKIP CI] Prerelease * missing validator missing ipfs chainTypes (#1419) * [SKIP CI] Prerelease * query explain include graphql query (#1426) * [SKIP CI] Prerelease * dictionary auth link integration (#1411) * add required dependancies and add flag for feature * update modules and add logic to dictionary * update dictionary parameters, update tests, remove hardcoded values * simplify auth dictionary handling * add apollo link type, remove un-needed from wrapper * remove dictionary from indexer module * update flag name, add error check * update yargs flag description * Update appolo-links * update @subql/apollo-links version, remove apollo/client version change * fix yarn.lock * add await init to dictionary tests * fix fetch test dictionary provider, update yarn.lock Co-authored-by: Lachlan McCrae <[email protected]> Co-authored-by: HZ <[email protected]> * Fix missing speChanged logic with getRuntime (#1421) * init * need fix worker * fix test * tidy up * fix test, fix missing dictionary * inject service to runtime * remove unused code * [SKIP CI] Prerelease * Feat/multi chain indexing (#1375) * [SKIP CI] Prerelease * remove enums (#1427) * [SKIP CI] Prerelease * change to print graphql sql on request (#1428) * [SKIP CI] Prerelease * fix missing util-crptyo in util package (#1429) * fix missing util-crptyo in util package * need prerelease in query service * [SKIP CI] Prerelease * fix import issue in query service (#1430) * [SKIP CI] Prerelease * fix missing query (#1432) * [SKIP CI] Prerelease * change fetch module SubqueryProject => ISubqueryProject (#1433) Co-authored-by: Lachlan McCrae <[email protected]> * [SKIP CI] Prerelease * Update polkadot 9.9.1 (#1434) * update polkadot api, also fix force-clean dependencies issue * tidy up * [SKIP CI] Prerelease * [release] 20221123 (#1431) * [release] 20221123 * Update packages/query/CHANGELOG.md Co-authored-by: Scott Twiname <[email protected]> * Update packages/node-core/CHANGELOG.md Co-authored-by: Scott Twiname <[email protected]> * Update packages/node/CHANGELOG.md Co-authored-by: Scott Twiname <[email protected]> * Update packages/node-core/CHANGELOG.md Co-authored-by: Scott Twiname <[email protected]> * Update packages/validator/CHANGELOG.md Co-authored-by: Scott Twiname <[email protected]> Co-authored-by: Scott Twiname <[email protected]> * Add a way to pass settings to the graphql playground (#1436) * Add a way to pass settings to the graphql playground * Add a changelog entry * [SKIP CI] Prerelease * Fix the changelog entry for the last PR (#1437) * [SKIP CI] Prerelease * fix enum name missing issue (#1441) * fix enum name missing issue * tidy up * [SKIP CI] Prerelease * hash sql queries (#1438) * hashed sql * add comments * add comment for hashName function * update function * update hashName function * [SKIP CI] Prerelease * [release] 20221130 (#1442) * [release] 20221130 * [release] 20221130 * Add --file flag for codegen (#1446) * init * change flag behaviour so -f can overwrite -l * update getManifestPath method, fix typo * update argument description * update variable names * update arg description * add error message on bad --file path Co-authored-by: Lachlan McCrae <[email protected]> * [SKIP CI] Prerelease * add try and catch for hsr (#1449) * [SKIP CI] Prerelease * Bypass blocks (#1435) * wip * manifest error * manfiest passed * added logging for bypassing blocks * sync main, moved bypassBlocks under networks * pass all tests * mock dictioanry case * fix metadata * clean up * allow range * bypass working, needs more testing * wip on bypass with setting new bufferHeight * working * added runtime test * add test for latestBufferHeight (blocked) * removed unneeded test, improve logic * clean up * add comments * add comments for latestBufferHeight reasoning * update logic * refactor * update logic * refactor * [SKIP CI] Prerelease * [release] 20221205 (#1448) * [release] 20221205 * [release] 20221205 * [release] 20221206 * details for bypassBlocks * Remove unused RuntimeService from indexer module, it had missing dependencies (#1453) * [SKIP CI] Prerelease * Fix/subcommands (#1451) * updated forceClean * update reindex * [SKIP CI] Prerelease * Enable env vars parsing at node and query commands (#1452) * [SKIP CI] Prerelease * Workers: Fix SequelizeDatabaseError - tuple concurrently updated (#1458) * add flag for hot-schema reload on node, ensure query is on main thread * remove flags * [SKIP CI] Prerelease * Add start height to project (#1456) * [SKIP CI] Prerelease * Fix poi offset is 0 (#1459) * [SKIP CI] Prerelease * Handle when fields got undefined with historical (#1463) * [SKIP CI] Prerelease * update deploy cli (#1460) * [SKIP CI] Prerelease * exit on fail (#1464) * [SKIP CI] Prerelease * fix parentSpecVersion could be undefined (#1467) * [SKIP CI] Prerelease * [release] 20221219 (#1466) * [release] 20221219 * update * Update packages/node-core/CHANGELOG.md Co-authored-by: Scott Twiname <[email protected]> * Update packages/node/CHANGELOG.md Co-authored-by: Scott Twiname <[email protected]> * Update packages/node-core/CHANGELOG.md Co-authored-by: Scott Twiname <[email protected]> * Update packages/cli/CHANGELOG.md Co-authored-by: Scott Twiname <[email protected]> * update Co-authored-by: Scott Twiname <[email protected]> * Fix templates with other sdks, make -f flag work like other commands (#1470) * Fix templates with other sdks, make -f flag work like other commands * Fix for sdks with first class smart contracts * [SKIP CI] Prerelease * Tweak error message for genesis hash (#1471) * [SKIP CI] Prerelease * Fix trigger function (#1469) * fix trigger and function for subscription and hot schema reload * update * [SKIP CI] Prerelease * [release] 20221222 (#1474) * validate dictionary with start height (#1473) * validate dictionary with start height * Update packages/node/src/indexer/fetch.service.ts Co-authored-by: Scott Twiname <[email protected]> Co-authored-by: Scott Twiname <[email protected]> * [SKIP CI] Prerelease * add count for entity (#1480) * add count for entity * Update packages/node-core/src/indexer/store.service.ts Co-authored-by: Scott Twiname <[email protected]> Co-authored-by: Scott Twiname <[email protected]> * [SKIP CI] Prerelease * Fixing readme doc for @subql/query (#1485) * doc: correcting grammer * fix: typo * [SKIP CI] Prerelease * update polkadot api to 9.11.1 (#1483) * update polkadot api to 9.11.1 * update * [SKIP CI] Prerelease * add connection filters (#1484) * [SKIP CI] Prerelease * update fetch.module dictionary service * add bypassBlocks Co-authored-by: hariu-starfish <[email protected]> Co-authored-by: Orion <[email protected]> Co-authored-by: Jay Ji <[email protected]> Co-authored-by: Scott Twiname <[email protected]> Co-authored-by: Naveen V <[email protected]> Co-authored-by: Filippo <[email protected]> Co-authored-by: Lachlan McCrae <[email protected]> Co-authored-by: Lachlan McCrae <[email protected]> Co-authored-by: HZ <[email protected]> Co-authored-by: MOZGIII <[email protected]> Co-authored-by: James Bayly <[email protected]> Co-authored-by: Mingyang Li <[email protected]>
* Ensure addresses are checksum addresses * Add a test for api * Fixes --------- Co-authored-by: JQQQ <[email protected]>
|
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've read through the code. I still have some testing to do though
//decode gives control chars around the string, remove them | ||
/* eslint-disable no-control-regex */ | ||
const decodedTopic = Buffer.from(event.topic[i], 'base64') | ||
.toString() | ||
.replace(/[\u0000-\u001F\u007F-\u009F]/g, ''); |
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.
Do we know why these exist? I can get you in contact with someone from Soroban if you need to understand why
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.
it's because events contain XDR representation of data
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 added a new commit that uses their xdr library to decode the topics and values
|
||
const logger = getLogger('safe.api.soroban'); | ||
|
||
export default class SafeSorobanProvider extends SorobanServer { |
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.
We shouldn't inject the safe api into the sandbox then as it's no use.
We can leave this code here in case at a later stage this becomes possible
const apiService = testContext.get(ApiService); | ||
|
||
// Initialise async services, we do this here rather than in factories, so we can capture one off events | ||
await (apiService as SorobanApiService).init(); |
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.
Why is there a cast here? Does BaseTestingService
not type this properly?
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.
we provide the base ApiService
with a factory that returns SorobanApiService
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.
It already seems to be init here https://github.com/subquery/subql-soroban/pull/1/files#diff-bcab2c6418e84f215507df5daf3213a159fc422d9cf05b1cbe1fb91d4308ef54R57
From testing:
|
I update starter to index transfer events |
package.json
Outdated
}, | ||
"resolutions": { | ||
"node-fetch": "2.6.7", | ||
"@subql/common": "2.3.1-1" |
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 think this needs to be removed
const logger = getLogger('soroban-server'); | ||
const DEFAULT_PAGE_SIZE = 100; | ||
|
||
export class SorobanServer extends Server { |
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.
This is going to lead to a huge request and being very inefficient. We should fetch more pages until we move on to a following block.
); | ||
} | ||
|
||
delete this.eventsCache[maxEventHeight]; |
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.
If maxEventHeight
equals request.startLedger
were going to get no results
import { ApiWrapper } from '@subql/types-soroban'; | ||
|
||
export function calcInterval(api: ApiWrapper): number { | ||
// TODO find a way to get this from the blockchain |
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.
Lets remove the comment then
const apiService = testContext.get(ApiService); | ||
|
||
// Initialise async services, we do this here rather than in factories, so we can capture one off events | ||
await (apiService as SorobanApiService).init(); |
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.
It already seems to be init here https://github.com/subquery/subql-soroban/pull/1/files#diff-bcab2c6418e84f215507df5daf3213a159fc422d9cf05b1cbe1fb91d4308ef54R57
return testContext.get(TestRunner); | ||
} | ||
|
||
async indexBlock( |
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.
Other than substrate these all have the same implementation. We should move this to the base service and only substrate sdk can override this method
case xdr.ScValType.scvSymbol(): { | ||
return value.sym().toString(); | ||
} | ||
static decodeScVals(scVal: xdr.ScVal): any { |
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.
Does soroban not provide this functionality?
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.
their scValToNative
had issues for some datatypes, such as ScvString.
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.
Is it worth contributing back to soroban sdk?
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.
The issue with ScvString was we get a Uint8Array. From the docs, it looks it was intended to be that way:
string -> string IF the underlying buffer can be decoded as ascii/utf8, Uint8Array of the raw contents in any error case
so, we just extract the Uint8Array and decode it from base64 to utf8
const startLedgerEvents = events.filter( | ||
(event) => parseInt(event.ledger) === sequence, | ||
); | ||
const otherEvents = events.filter( | ||
(event) => parseInt(event.ledger) !== sequence, | ||
); |
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.
} | ||
|
||
//fetch events of a ledger from subsequent pages | ||
private async fetchAdditionalEvents( |
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.
This and getEvents
seem way over complicated.
I suggest having a recursive function to get all the events for a block.
Then another that adds a caching layer over the top of it
Tests are failing now. I think there might need to be some changes ported over from the testing framework and the connection pool state |
starter project for testing: https://github.com/DeveloperInProgress/soroban-subql-starter