ubiquity / ubiquity-dollar

Ubiquity Dollar (UUSD) smart contracts and user interface.
https://uad.ubq.fi
Apache License 2.0
34 stars 91 forks source link

Enforce linting check on contracts naming convention #849

Closed molecula451 closed 1 month ago

molecula451 commented 11 months ago

https://github.com/ubiquity/ubiquity-dollar/pull/848#issuecomment-1852582043

ubiquibot[bot] commented 11 months ago
! action returned an unexpected value
gitcoindev commented 11 months ago

Perhaps solhint or https://github.com/solhint-community/solhint-community fork could be integrated after all rules are agreed:

Example settings:

https://github.com/PaulRBerg/foundry-template/blob/main/.solhint.json

There are differences in so called 'best practices' rules, it would be good to fully review and decide on which subset or superset of rules to use.

https://github.com/protofire/solhint/blob/develop/docs/rules.md#best-practise-rules

vs

https://github.com/solhint-community/solhint-community/blob/master/docs/rules.md#best-practise-rules

molecula451 commented 11 months ago

Perhaps solhint or https://github.com/solhint-community/solhint-community fork could be integrated after all rules are agreed:

Example settings:

https://github.com/PaulRBerg/foundry-template/blob/main/.solhint.json

There are differences in so called 'best practices' rules, it would be good to fully review and decide on which subset or superset of rules to use.

https://github.com/protofire/solhint/blob/develop/docs/rules.md#best-practise-rules

vs

https://github.com/solhint-community/solhint-community/blob/master/docs/rules.md#best-practise-rules

851

ubiquibot[bot] commented 11 months ago
! action returned an unexpected value
0x4007 commented 11 months ago

There are differences in so called 'best practices' rules, it would be good to fully review and decide on which subset or superset of rules to use.

lol thats unfortunate.

I just asked ChatGPT and it says that the following rules are

Not under debate (we should probably enable):

avoid-call-value
avoid-low-level-calls
avoid-sha3
avoid-suicide
avoid-throw
avoid-tx-origin
check-send-result
compiler-version
func-visibility
multiple-sends
no-complex-fallback
no-inline-assembly
not-rely-on-block-hash
reentrancy
state-visibility

Recommended in community only:

max-states-count
no-console
no-empty-blocks
no-global-import
no-unused-import
no-unused-vars
payable-fallback
reason-string
quotes
const-name-snakecase
contract-name-camelcase
event-name-camelcase
func-name-mixedcase
use-forbidden-name
var-name-mixedcase
imports-on-top
visibility-modifier-order

Recommended in original only:

mark-callable-contracts (recommended in "community.md" as deprecated)
not-rely-on-time (not recommended in "community.md")

My Recommendation

I will need to research the rules at a later time but upon first pass:

Community
Enabled Rule Comment
max-states-count not sure what this is
no-console
no-empty-blocks
no-global-import not sure what this is but globals are bad in javascript so I assume it's bad here too
no-unused-import
no-unused-vars
payable-fallback i think this means something about the contract being able to handle eth?
reason-string
quotes
const-name-snakecase
contract-name-camelcase shouldn't these normally be pascal case?
event-name-camelcase
func-name-mixedcase
use-forbidden-name
var-name-mixedcase
imports-on-top
visibility-modifier-order
Original
Enabled Rule Comment
mark-callable-contracts (recommended in "community.md" as deprecated) no idea what this is
not-rely-on-time (not recommended in "community.md") no idea what this is
molecula451 commented 11 months ago

It's nice the recopilation, but we should follow the convention by 50% or own judment, the reason?

an e.g

no-inline-assembly

We have inline assembly in diamond, and there is no issue with that, as much as it shows as recommended, it can be turned off.. This is one of many others

The idea (my idea) it's to stylize the code more and enforce the rules, but still many of these can be turned off

sha3? no body uses sha3 (in solidity) anymore, i don't see any good judment on solidity code writing sha3.. for e.g

ubiquibot[bot] commented 11 months ago
! action returned an unexpected value
ubiquibot[bot] commented 11 months ago
! action returned an unexpected value
0x4007 commented 11 months ago
! action returned an unexpected value

Currently trying to debug this but I'm only seeing it in this repo so I'm debugging in production now. Sorry for the incoming notifications.

{
        log: 'action has an uncaught error',
        level: 'error',
        metadata: {
          logReturn: TypeError: Cannot read properties of undefined (reading 'created_at')
              at checkTaskToUnassign (/var/task/.netlify/functions/webhooks/webhooks.js:192291:60)
              at processTicksAndRejections (node:internal/process/task_queues:95:5)
              at async Promise.all (index 0)
              at checkTasksToUnassign (/var/task/.netlify/functions/webhooks/webhooks.js:192241:27)
              at logAnyReturnFromHandlers (/var/task/.netlify/functions/webhooks/webhooks.js:192652:24)
              at bindEvents (/var/task/.netlify/functions/webhooks/webhooks.js:192645:5)
              at async Promise.all (index 0)
              at Runtime.handler (/var/task/.netlify/functions/webhooks/webhooks.js:192748:5) {
            [stack]: "TypeError: Cannot read properties of undefined (reading 'created_at')\n    at checkTaskToUnassign (/var/task/.netlify/functions/webhooks/webhooks.js:192291:60)\n    at processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async Promise.all (index 0)\n    at checkTasksToUnassign (/var/task/.netlify/functions/webhooks/webhooks.js:192241:27)\n    at logAnyReturnFromHandlers (/var/task/.netlify/functions/webhooks/webhooks.js:192652:24)\n    at bindEvents (/var/task/.netlify/functions/webhooks/webhooks.js:192645:5)\n    at async Promise.all (index 0)\n    at Runtime.handler (/var/task/.netlify/functions/webhooks/webhooks.js:192748:5)",
            [message]: "Cannot read properties of undefined (reading 'created_at')"
          },
          handlerType: { type: 'wildcard', actions: [ [AsyncFunction: checkTasksToUnassign] { [length]: 1, [name]: 'checkTasksToUnassign', [Symbol(Symbol.toStringTag)]: 'AsyncFunction' }, [length]: 1 ] },
          activeHandler: 'checkTasksToUnassign',
          error: { name: 'TypeError', message: "Cannot read properties of undefined (reading 'created_at')", stack: "TypeError: Cannot read properties of undefined (reading 'created_at')\n    at checkTaskToUnassign (/var/task/.netlify/functions/webhooks/webhooks.js:192291:60)\n    at processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async Promise.all (index 0)\n    at checkTasksToUnassign (/var/task/.netlify/functions/webhooks/webhooks.js:192241:27)\n    at logAnyReturnFromHandlers (/var/task/.netlify/functions/webhooks/webhooks.js:192652:24)\n    at bindEvents (/var/task/.netlify/functions/webhooks/webhooks.js:192645:5)\n    at async Promise.all (index 0)\n    at Runtime.handler (/var/task/.netlify/functions/webhooks/webhooks.js:192748:5)" },
          caller: 'renderCatchAll',
          revision: '05a143c'
        }
      }
ubiquibot[bot] commented 11 months ago
# Comment event received without a recognized user command.
ubiquibot[bot] commented 11 months ago
! action has an uncaught error
ubiquibot[bot] commented 11 months ago
# Comment event received without a recognized user command.
0x4007 commented 11 months ago

test

ubiquibot[bot] commented 11 months ago
# Comment event received without a recognized user command.
0x4007 commented 11 months ago

test

0x4007 commented 11 months ago

/help

ubiquibot[bot] commented 11 months ago
! action has an uncaught error
ubiquibot[bot] commented 11 months ago

Available Commands

Command Description Example
/start Assign yourself to the issue. /start
/stop Unassign yourself from the issue. /stop
/help List all available commands. /help
/autopay Toggle automatic payment for the completion of the current issue. /autopay true
/query Returns the user's wallet, access, and multiplier information. /query @user
/ask Ask a context aware question. /ask is x or y the best approach?
/multiplier Set the task payout multiplier for a specific contributor, and provide a reason for why. /multiplier @user 0.5 "multiplier
reason"
/labels Set access control, for admins only. /labels @user priority time
price
/authorize Approve a label change, for admins only. /authorize
/wallet Register your wallet address for payments. /wallet ubq.eth
0x4007 commented 11 months ago

test

ubiquibot[bot] commented 11 months ago
! action has an uncaught error
0x4007 commented 11 months ago

test

ubiquibot[bot] commented 11 months ago
! action has an uncaught error
0x4007 commented 11 months ago

test

0x4007 commented 11 months ago

test

0x4007 commented 11 months ago

/help

ubiquibot[bot] commented 11 months ago

Available Commands

Command Description Example
/start Assign yourself to the issue. /start
/stop Unassign yourself from the issue. /stop
/help List all available commands. /help
/autopay Toggle automatic payment for the completion of the current issue. /autopay true
/query Returns the user's wallet, access, and multiplier information. /query @user
/ask Ask a context aware question. /ask is x or y the best approach?
/multiplier Set the task payout multiplier for a specific contributor, and provide a reason for why. /multiplier @user 0.5 "multiplier
reason"
/labels Set access control, for admins only. /labels @user priority time
price
/authorize Approve a label change, for admins only. /authorize
/wallet Register your wallet address for payments. /wallet ubq.eth
0x4007 commented 11 months ago

test

0x4007 commented 11 months ago

test

0x4007 commented 11 months ago

/help

ubiquibot[bot] commented 11 months ago

Available Commands

Command Description Example
/start Assign yourself to the issue. /start
/stop Unassign yourself from the issue. /stop
/help List all available commands. /help
/autopay Toggle automatic payment for the completion of the current issue. /autopay true
/query Returns the user's wallet, access, and multiplier information. /query @user
/ask Ask a context aware question. /ask is x or y the best approach?
/multiplier Set the task payout multiplier for a specific contributor, and provide a reason for why. /multiplier @user 0.5 "multiplier
reason"
/labels Set access control, for admins only. /labels @user priority time
price
/authorize Approve a label change, for admins only. /authorize
/wallet Register your wallet address for payments. /wallet ubq.eth
0x4007 commented 11 months ago

test

0x4007 commented 11 months ago

Netlify logs just stopped outputting any of my logs suddenly...

0x4007 commented 11 months ago

test

ubiquibot[bot] commented 11 months ago
# Comment event received without a recognized user command.
0x4007 commented 11 months ago

/help

ubiquibot[bot] commented 11 months ago

Available Commands

Command Description Example
/start Assign yourself to the issue. /start
/stop Unassign yourself from the issue. /stop
/help List all available commands. /help
/autopay Toggle automatic payment for the completion of the current issue. /autopay true
/query Returns the user's wallet, access, and multiplier information. /query @user
/ask Ask a context aware question. /ask is x or y the best approach?
/multiplier Set the task payout multiplier for a specific contributor, and provide a reason for why. /multiplier @user 0.5 "multiplier
reason"
/labels Set access control, for admins only. /labels @user priority time
price
/authorize Approve a label change, for admins only. /authorize
/wallet Register your wallet address for payments. /wallet ubq.eth
ubiquibot[bot] commented 11 months ago
@@ No latest assign event found. @@
0x4007 commented 11 months ago

test

ubiquibot[bot] commented 11 months ago
# Comment event received without a recognized user command.
ubiquibot[bot] commented 11 months ago
@@ No latest assign event found. @@
gitcoindev commented 11 months ago
@@ No latest assign event found. @@

that might be it - > nobody was assigned yet in this case reduce returns nothing and it may fail at (just guessing by looking at code)

const latestAssignEventTime = new Date(latestAssignEvent.created_at).getTime();

ubiquibot[bot] commented 11 months ago
# Comment event received without a recognized user command.
ubiquibot[bot] commented 11 months ago
@@ No latest assign event found. @@
0x4007 commented 11 months ago

test

ubiquibot[bot] commented 11 months ago
# Comment event received without a recognized user command.
ubiquibot[bot] commented 11 months ago
@@ No latest assign event found. @@
0x4007 commented 11 months ago

test

ubiquibot[bot] commented 11 months ago
# Comment event received without a recognized user command.
ubiquibot[bot] commented 11 months ago
@@ No latest assign event found. @@
0x4007 commented 11 months ago

/help