croncats / contracts Goto Github PK
View Code? Open in Web Editor NEWon-chain contracts managing the cron service
License: MIT License
on-chain contracts managing the cron service
License: MIT License
Allow a task owner to refill (add NEAR) to their task, so it can continue operating without having the task run out.
UI: See attached screenshots, there are 3 pieces to this:
Based on current agent status changes, an agent could register, become pending, then go offline.
If there is a tiny function that can be called upon allowing agent to become active, it would confirm the agent was offline. This function would have a timeout, and allow active agents to kick from pending pool allowing the next pending agent an opportunity to become active.
Requirements:
NOTE:S
Goals for fair agent processing:
Floorkey issue - see: near view manager_v1.cron.testnet get_slot_ids
Happens when:
Setup PRs for all the accounts to move to croncat.testnet
See: https://learn.figment.io/network-documentation/near/tutorials/1-project_overview/5-account-storage
Requirements:
List of tests needed:
Talking through options about how to fix it, here's some notes:
Treasury contract:
Account for failed txn fee in proxy_call, so agent balance is not affected.
Appears 0.00059 NEAR - failed TXN cost
See:
Available Tasks: 1, Current Slot: 52226640
Receipt: EyBySwPJ19oM8sN5uvSW2RzHDZPxiUnkLmQ6PudVdcbh
Log [cron.in.testnet]: current slot 52226640
Failure [cron.in.testnet]: Error: {"index":0,"kind":{"ExecutionError":"Smart contract panicked: panicked at 'No tasks found in slot', manager/src/lib.rs:450:14"}}
Do not allow scheduling within current slot upon creation
When querying how many active tasks, the lookup has the logic:
This returns false counts of tasks, which actually should SUM these two.
See source: https://github.com/Cron-Near/contracts/blob/main/manager/src/lib.rs
Goals:
Task get stuck when (A: scheduled and then gets exited not removing hash correctly) (reproduce: Remove a task before its done, slot remains)
Idea:
Appears tick throws off the accuracy of BPS.
Change Tick to have 2 items in an array, so we can always have ~1000 blocks distance for better average.
See the following:
Receipts: 5tmLRf111bKzjVPpTgennn6Ne1f1uWsqxYNi3puzr6eF, 33EJkMmUQB7R774jYpPpkksS6YhZ9B53DkFbfCm78eY3, EdGnPe3nYnancgrgK23tGg9UAi3KTMyWYiLzYDpjAcHS
Log [cron.in.testnet]: current slot 53601660
Log [cron.in.testnet]: slot [[13, 52, 238, 24, 39, 136, 174, 243, 153, 231, 158, 97, 103, 236, 50, 194, 225, 5, 140, 158, 193, 35, 182, 146, 228, 101, 127, 53, 195, 84, 52, 213]]
Log [cron.in.testnet]: Found Task Task { owner_id: "cron.in.testnet", contract_id: "cron.in.testnet", function_id: "tick", cadence: "0 0 * * * * *", recurring: true, total_deposit: U128(5000000000000000000000000), deposit: U128(0), gas: 2400000000000, arguments: [] }
Receipt: HBeB7qKoMVEJTBW8pdXoZtLRUVEDgsuZzXRXRaqwBPR9
Log [cron.in.testnet]: Balances: Available 0, Staked 0
Receipt: GH9Uw8RR9aXgtKsrkE7Q1FZLmfX8AfSjBdYStMjVZbMF
Log [cron.in.testnet]: Task DTTuGCeIrvOZ555hZ+wywuEFjJ7BI7aS5GV/NcNUNNU= completed successfully
Log [cron.in.testnet]: Scheduling Next Task 53601720
2021-07-01T05:59:52.780Z Available Tasks: 1, Current Slot: 53601720
Receipts: 2gLYB6k32DaMUF1vmMXbbPf5KeXzC1jK4oDXpK7ox2QF, CqbytYoQmiMvoVztYx4Qk67WmRaeX3GwD2qEDyNVLtMD, yKsqySRTjiKF6VbX9sJoQsrGiRyhrrroYX94q3xYknk
Log [cron.in.testnet]: current slot 53601720
Log [cron.in.testnet]: slot [[13, 52, 238, 24, 39, 136, 174, 243, 153, 231, 158, 97, 103, 236, 50, 194, 225, 5, 140, 158, 193, 35, 182, 146, 228, 101, 127, 53, 195, 84, 52, 213]]
Log [cron.in.testnet]: Found Task Task { owner_id: "cron.in.testnet", contract_id: "cron.in.testnet", function_id: "tick", cadence: "0 0 * * * * *", recurring: true, total_deposit: U128(4999999999988507123382818), deposit: U128(0), gas: 2400000000000, arguments: [] }
Receipt: 39W5H5NrT6ojdBaD4P92xqkz9vUhDnWTEEKxoFUdhGZf
Log [cron.in.testnet]: Balances: Available 0, Staked 0
Receipt: 2CaWxpGbM891x9ZwQ2it2cDGpTvvLe3CQd8dr91sKx8J
Log [cron.in.testnet]: Task DTTuGCeIrvOZ555hZ+wywuEFjJ7BI7aS5GV/NcNUNNU= completed successfully
Log [cron.in.testnet]: Scheduling Next Task 53601780
2021-07-01T06:00:28.605Z Available Tasks: 1, Current Slot: 53601780
Receipts: 3ow6jf8q4xKz2ZUrj7twEZ2fvGuP8viUboDSrJ4JdqGS, 2LstCHc2FdDkZ7Tne2HNYxt2ykmmg96BizWMCsS12R66, BjLxdmptMjyV7FE1DoQ87sTDiLqC5ZKfobLNxzqYUdRe
Log [cron.in.testnet]: current slot 53601780
Log [cron.in.testnet]: slot [[13, 52, 238, 24, 39, 136, 174, 243, 153, 231, 158, 97, 103, 236, 50, 194, 225, 5, 140, 158, 193, 35, 182, 146, 228, 101, 127, 53, 195, 84, 52, 213]]
Log [cron.in.testnet]: Found Task Task { owner_id: "cron.in.testnet", contract_id: "cron.in.testnet", function_id: "tick", cadence: "0 0 * * * * *", recurring: true, total_deposit: U128(4999999999978096503029414), deposit: U128(0), gas: 2400000000000, arguments: [] }
Receipt: 7XNPvPG6qBimA5YhK4jXXxpNFTLpuXhGeD3QKXgcSKsR
Log [cron.in.testnet]: Balances: Available 0, Staked 0
Receipt: 7qNHWCYNG3zHNr4gt4EmGxML1jrhghgT9kWtJXXF7uwH
Log [cron.in.testnet]: Task DTTuGCeIrvOZ555hZ+wywuEFjJ7BI7aS5GV/NcNUNNU= completed successfully
Log [cron.in.testnet]: Scheduling Next Task 53607420
2021-07-01T06:01:02.907Z Available Tasks: 0, Current Slot: 53601840
2021-07-01T06:01:33.021Z Available Tasks: 0, Current Slot: 53601840
A couple of things to note regarding proxy_call
. Both have to do with making sure the next agent doesn't run into the same problem.
Ready
or Complete
otherwise it won't continue. We'll want to make sure we take action (probably remove the task) and then panic. Otherwise, the next agent will come across the same problem.Similar to above, there's a second assertion to see if there's enough balance to execute the job. The next agent will run into the same thing. It seems as though this needs to be caught before it happens. We can check a couple of cases:
owner_id
Create a new page, similar to create task, that allows a user to create a trigger for an associated trigger.
An agent can check to execute IF slot is +1 and their index is within range??? (also minus 1 if no tasks to clear old???)
Agent rewards are coming in much smaller than they should:
$ croncat status pa.testnet
payable account id: t.testnet
balance: 0.002090000036
total tasks executed: 12
The main tasks can run and fail continuously, need a param to allow tasks to stop upon first fail. (helps with pagination)
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.