-
Notifications
You must be signed in to change notification settings - Fork 12.2k
perf: optimize Pausable.sol by using uint256 instead of bool #5912
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'openzeppelin-solidity': patch | ||
--- | ||
|
||
Optimized Pausable.sol by using uint256 instead of bool for lower gas usage. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'openzeppelin-solidity': patch | ||
--- | ||
|
||
edited "peused" function |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/** | ||
* to.js - main file | ||
*/ | ||
module.exports = require('./lib/to'); | ||
Comment on lines
+1
to
+4
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainRemove vendored npm artifact (.deps/npm/to) — out of PR scope and repo standards. This PR targets Pausable gas optimizations; adding a vendored CommonJS entrypoint here is unrelated and risks supply-chain noise. Please drop this file from the PR. If needed, depend via package.json instead of committing built artifacts. To verify there are no references: 🏁 Script executed: #!/bin/bash
rg -n --hidden '\.deps/npm/to' -g '!**/node_modules/**' Length of output: 57 🏁 Script executed: #!/bin/bash
echo "Vendored files in .deps/npm/to:"
find .deps/npm/to -type f
echo ""
echo "Searching for any references to '.deps/npm/to' (excluding node_modules):"
rg -n '\.deps/npm/to' -g '!**/node_modules/**'
echo ""
echo "Searching for require(...) or import-from statements referencing module 'to' outside the vendored directory:"
rg -nP "require\s*\(\s*['\"].*to" -g '!**/node_modules/**' --glob '!.deps/npm/to/**'
rg -nP "import\s+.*from\s+['\"].*to" -g '!**/node_modules/**' --glob '!.deps/npm/to/**' Length of output: 26260 Drop the vendored 🤖 Prompt for AI Agents
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* Minified by jsDelivr using Terser v5.39.0. | ||
* Original file: /npm/tok@0.1.0/index.js | ||
* | ||
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files | ||
*/ | ||
var _=require("underscore"),crypto=require("crypto"),moment=require("moment");module.exports=function(e){if(_.defaults(e,{expiration:36e5,hashAlgorithm:"sha1",method:"hash"}),!e.secretKey)throw"must provide a secretKey";if("hash"!==e.method){if(!e.load)throw"must provide a load() function";if(!e.save)throw"must provide a save() function"}var t=function(t,a,n){a=a||[],_.isArray(t)||(t=_.isObject(t)?_.values(t):[t]),_.isArray(a)||(a=_.isObject(a)?_.values(a):[a]);var r=_.chain(t).concat(a).push(n).join("").value();return crypto.createHmac(e.hashAlgorithm,e.secretKey).update(r).digest("hex")};return{check:function(a,n,r){var o=function(t){return!!e.expiration&&moment().diff(parseInt(t.date,10))>e.expiration};if("hash"===e.method)return o(n)?r("token expired"):r(n.hash===t(a,n.value,n.date)?null:"token invalid");arguments.length<3&&(r=n,n=null),e.load(a,(function(e,i){return e?r(e):i?o(i)?r("token expired"):n.hash?r(i.hash===n.hash?null:"token invalid"):r(i.hash===t(a,n.value,n.date)?null:"token invalid"):r("token not found")}))},create:function(a,n,r){var o=+new Date,i=t(a,n,o),h={date:o,hash:i},u={date:o,hash:i};if(n&&(h.value=n),"hash"===e.method)return r(null,h);e.save(a,u,(function(e){n&&delete h.hash,r(e,h)}))}}}; | ||
//# sourceMappingURL=/sm/9b61580e56715ffcd364f1a70a4f7eb5885b8874b3f0b881759d385f3df968fe.map |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* Minified by jsDelivr using Terser v5.39.0. | ||
* Original file: /npm/toke@0.0.3/build/src/toke.js | ||
Check failure on line 3 in .deps/npm/toke
|
||
* | ||
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files | ||
*/ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,r){for(var t=0;t<r.length;t++){var i=r[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(r,t,i){return t&&e(r.prototype,t),i&&e(r,i),r}}();function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}var _utils=require("./utils"),utils=_interopRequireWildcard(_utils),_libLexicon=require("../lib/lexicon"),_libLexicon2=_interopRequireDefault(_libLexicon),_libGrammar=require("../lib/grammar"),_libGrammar2=_interopRequireDefault(_libGrammar),_default=function(){function e(r){_classCallCheck(this,e);r=r||{};this.grammar=r.grammar||_libGrammar2.default,this.lexicon=r.lexicon||_libLexicon2.default}return _createClass(e,[{key:"mk",value:function(e){return utils.mk(e,this.grammar,this.lexicon)}},{key:"compileToken",value:function(e,r){return utils.compileToken(e,r)}}]),e}();exports.default=_default,module.exports=exports.default; | ||
//# sourceMappingURL=/sm/669e91b95b4b628d5b7dbdcd73dae7cf887446c0d37562a7b23e1a1ead42e289.map | ||
Comment on lines
+1
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent ❓ Verification inconclusiveRemove minified third-party build (.deps/npm/toke) — licensing and provenance concerns. Minified distribution code does not belong in this repo and is unrelated to the Solidity change. If required, consume via a package manager and pin versions. Please delete this file from the PR. Quick check for usage: 🏁 Script executed: #!/bin/bash
rg -n --hidden '\.deps/npm/toke' -g '!**/node_modules/**' Length of output: 59 🏁 Script executed: #!/bin/bash
# Check for require statements referencing toke
rg -nP --hidden "require\(['\"]/.*toke.*['\"]\)" -g "!**/node_modules/**"
# Check for import statements referencing toke
rg -nP --hidden "import\s+(?:[^'\";]+)\s+from\s+['\"]/.*toke.*['\"]" -g "!**/node_modules/**"
# Check for dynamic import of toke
rg -nP --hidden "import\(['\"]/.*toke.*['\"]\)" -g "!**/node_modules/**" Length of output: 260 Remove the 🧰 Tools🪛 GitHub Check: codespell[failure] 3-3: [failure] 3-3: 🤖 Prompt for AI Agents
|
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.
Fix package name in changeset front matter.
The repo’s published package is "@openzeppelin/contracts", not "openzeppelin-solidity". Using the wrong package key will bypass release automation.
Apply this diff:
📝 Committable suggestion
🤖 Prompt for AI Agents