circlesubi / circles-core Goto Github PK
View Code? Open in Web Editor NEWCommon methods to interact with the Circles ecosystem
Home Page: https://circlesubi.github.io/circles-core
License: GNU Affero General Public License v3.0
Common methods to interact with the Circles ecosystem
Home Page: https://circlesubi.github.io/circles-core
License: GNU Affero General Public License v3.0
That calls the new endpoints in the api
API: CirclesUBI/circles-api#124 and CirclesUBI/circles-myxogastria#396
In the query you specify language
Provide util that returns a json object with notifications
[{
message: <String>,
date: <Date>,
icon_id: <Icon-ID>,
}]
Possibly only for example 10 at a time and not the whole history
We could improve test speed when removing the --runInBand
flag of jest as it will make them run concurrently.
This can only be done when we fixed this issue in the relayer though: CirclesUBI/safe-relay-service#44 since running them at the same time leads to a "mass deployment" of Safe contracts which apparently breaks something in the relayer code 😭
If we use the docker images in Docker Hub, we could reduce further the build time by using the build cache in the GH Actions, not having to re-download all of the images every time we run the tests workflow.
Some references about best practices for using Docker Hub for CI/CD:
Revisit tests and make them run again / clean up API changes which occurred during launch phase.
Myxogastria doesn't work with this new version v2.10.11 (error: Uncaught CoreError: "databaseSource" is missing in options
). The constructor of the core requires the param databaseSource
.
Solution: make the parameter optional and with a default value: graph
.
This might be due to circular connections?
Default suggestion: 30
Until we do more research
Related: CirclesUBI/circles-myxogastria#589
This can greatly improve the loading times and UX experience as we can wrap multiple transactions into one. This is especially interesting for the organization onboarding flow where many transactions are required.
Token Tests started to fail only in GitHub Actions with this PR: #119
See the logs from https://github.com/CirclesUBI/circles-core/runs/6858140027?check_suite_focus=true:
> @circles/[email protected] test /home/runner/work/circles-core/circles-core/circles-core
> jest --runInBand
cat: edges-data/edges.json: No such file or directory
FAIL test/token.test.js (358.495 s)
● Token › Find transitive transfer steps › should return max flow and possible path
TransferError: Request failed @ http://api.circles.local/api/transfers/ with error 503
54 | return response.data;
55 | } catch (error) {
> 56 | throw new TransferError(error.message, ErrorCodes.UNKNOWN_ERROR);
| ^
57 | }
58 | }
59 |
at _callee13$ (src/token.js:56:11)
at tryCatch (node_modules/regenerator-runtime/runtime.js:63:40)
at Generator.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:294:22)
at Generator.throw (node_modules/regenerator-runtime/runtime.js:119:21)
at asyncGeneratorStep (node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
at _throw (node_modules/@babel/runtime/helpers/asyncToGenerator.js:29:9)
at runMicrotasks (<anonymous>)
● Token › Transitive Transactions › should send Circles to someone transitively
TransferError: Request failed @ http://api.circles.local/api/transfers/ with error 503
54 | return response.data;
55 | } catch (error) {
> 56 | throw new TransferError(error.message, ErrorCodes.UNKNOWN_ERROR);
| ^
57 | }
58 | }
59 |
at _callee13$ (src/token.js:56:11)
at tryCatch (node_modules/regenerator-runtime/runtime.js:63:40)
at Generator.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:294:22)
at Generator.throw (node_modules/regenerator-runtime/runtime.js:119:21)
at asyncGeneratorStep (node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
at _throw (node_modules/@babel/runtime/helpers/asyncToGenerator.js:29:9)
at runMicrotasks (<anonymous>)
● Token › Transitive Transactions › should fail sending Circles when data error
Command failed: docker exec circles-api cat edges-data/edges.json
cat: edges-data/edges.json: No such file or directory
315 | await Promise.resolve().then(() => {
316 | const edgesData = JSON.parse(
> 317 | execSync(
| ^
318 | `docker exec circles-api cat edges-data/edges.json`,
319 | ).toString(),
320 | );
at test/token.test.js:317:11
at runMicrotasks (<anonymous>)
PASS test/common.test.js
PASS test/safe.test.js (134.65 s)
PASS test/activity.test.js (89.094 s)
PASS test/trust.test.js (89.627 s)
PASS test/organization.test.js (155.172 s)
PASS test/utils.test.js (32.205 s)
PASS test/user.test.js
PASS test/lib.test.js
Test Suites: 1 failed, 8 passed, 9 total
Tests: 3 failed, 54 passed, 57 total
Snapshots: 0 total
Time: 865.09 s
Ran all test suites.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @circles/[email protected] test: `jest --runInBand`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @circles/[email protected] test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2022-06-13T09_38_59_875Z-debug.log
Error: Process completed with exit code 1.
Modify the findTransitiveTransfer
method to make request to the pathfinder service API instead of the circles-api
.
We could parallelize the deployment of multiple Contracts (Tokens, Safes) to make our tests faster. Currently we wait for each deployment.
The ideal would be to use the file in src in tests too
When the relayer throws an server error (500 e.g.) the core still returns an TransferError
even though it should be an RequestError
.
The token tests are failing with invalid nonce errors in the relayer service.
It seems that the same safe is used for multiple transactions at the same time which might cause the invalid transactions due to race conditions.
One solution could be to decouple the test state by creating a larger test network before all tests, with independent sub networks for each test.
The current graph being used to calculate the max flow is incorrect as it is not considering different tokens. There is already a fix underway but it needs to be integrated.
We have to wait for the relayer to fund Token deployment before we can actually do it. Right now we hardcoded the check in the client (https://github.com/CirclesUBI/circles-baby-phoenix/blob/development/src/store/onboarding/actions.js#L69) but it might make sense to move it to the core as we can automatically check the actual gas costs here.
If my username was "miko" and I wanted to edit to "Miko", I should be able to do it as long as the username with other case variations is not taken by other account. Right now it says that the username is taken, but actually it's not used by other account, so it should be allowed (unless ther's other user with username "MIKO" or similar)
Currently
await core.utils.requestAPI({ path: ['users'], method: 'POST', data: { username, }, });
returns 409
The delegate call cannot be estimated through the relayer (see https://github.com/safe-global/safe-eth-py/blob/master/gnosis/safe/safe.py#L800).
In local environment with docker it works, but not in production.
We need to enable the feature in the relayer.
As an example of how to do it, let's see the case of using Multisend to update safe version and change fallback handler.
Check tx data in the gnosis ap ui, both estimations are attempted: first from the Safe and then directly from the owner account.
Make available the endpoint to update edges per user, so the client can use it on its implementation
Improve documentation by giving examples of the response of the different methods (like in the circles-api
repo)
Describe the bug
When I run the tests (only the Token > Transitive Transactions > should send Circles to someone transitively test) several times with the docker deployment, the 3rd or 4th time the test fails with this error:
RequestError: Request failed @ http://relay.circles.local/api/v2/safes/0x514c97a4fa711D4f2B55354FEf4454F05C07D6b1/transactions/estimate/ with error 422
Therefore, I restart the docker containers and tests run well again:
make ENV=backend down
docker volume prune -f
make ENV=backend up
make ENV=backend contracts
make ENV=backend subgraph
make ENV=backend up # sometimes circles-api-worker is down
Try to understand and define the pains and gains we are going to solve
Pains:
Gains:
Try to generate the full spectrum of ideas and possibilities - the more the better
Try to find all the weak and strong spots of the prototypes, the more details you find the better
Try to figure out the most suited collaborators to get the job done efficiently, with the goal to get the proposal accepted by the community
Try to judge the proposal based on its ability to incrementally improve the original intended experiences and incentivized behaviors. Accept or reject the proposal and adjust the prioritization of your next weeks challenges and roadmap accordingly, consider to pivot radically on your current strategy
The current max-flow implementation in the core uses plain Integers, which works for now but we might run into trouble when numbers get larger. We should change the algorithm to work with BN objects instead.
In getTrustNetworkStatus extract trusting user address from id
In trust.js change trustConnections in isTrusted
from being a count to returning information about the trust connections e.g.
[{address: 0x....., }, {address: 0x....}]
Line 59 in 7e0980b
Line 345 in 7e0980b
This is needed for this feature in the app: Related CirclesUBI/circles-myxogastria#325
https://circlesubi.github.io/circles-core/#coretokenfindtransitivetransfer
It would be helpful for projects using @circles/core package to know what error can be thrown by different functions such as
findTransitiveTransfer and updateTransitiveTransfer and transfer to better handle them. It should be clear when they occur and what they indicate.
See API changes here: CirclesUBI/circles-api#20
Right now our Travis CI tests fail as Token deployment is not funded yet. This can be fixed with this ticket: #16
Currently when clicking the "back" button we move to a hard-coded parent root but this seems to be unintuitive for some users as they might have come from somewhere else.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.