Skip to content

Commit

Permalink
Updated version
Browse files Browse the repository at this point in the history
  • Loading branch information
Rubilmax committed Feb 21, 2023
1 parent 739a384 commit f1d0ac9
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/foundry-storage-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ jobs:
version: nightly

- name: Check storage layout
uses: Rubilmax/[email protected]
uses: Rubilmax/[email protected].1
with:
contract: contracts/Example.sol:Example
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
version: nightly

- name: Check storage layout
uses: Rubilmax/[email protected]
uses: Rubilmax/[email protected].1
with:
contract: src/Contract.sol:Contract
# settings below are optional, but allows to check whether the added storage slots are empty on the deployed contract
Expand Down
176 changes: 135 additions & 41 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4381,7 +4381,7 @@ exports.withCustomRequest = withCustomRequest;

Object.defineProperty(exports, "__esModule", ({ value: true }));

const VERSION = "2.21.2";
const VERSION = "2.21.3";

function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
Expand Down Expand Up @@ -60672,63 +60672,67 @@ module.exports = {
/***/ 3682:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {

var register = __nccwpck_require__(4670)
var addHook = __nccwpck_require__(5549)
var removeHook = __nccwpck_require__(6819)
var register = __nccwpck_require__(4670);
var addHook = __nccwpck_require__(5549);
var removeHook = __nccwpck_require__(6819);

// bind with array of arguments: https://stackoverflow.com/a/21792913
var bind = Function.bind
var bindable = bind.bind(bind)
var bind = Function.bind;
var bindable = bind.bind(bind);

function bindApi (hook, state, name) {
var removeHookRef = bindable(removeHook, null).apply(null, name ? [state, name] : [state])
hook.api = { remove: removeHookRef }
hook.remove = removeHookRef

;['before', 'error', 'after', 'wrap'].forEach(function (kind) {
var args = name ? [state, kind, name] : [state, kind]
hook[kind] = hook.api[kind] = bindable(addHook, null).apply(null, args)
})
function bindApi(hook, state, name) {
var removeHookRef = bindable(removeHook, null).apply(
null,
name ? [state, name] : [state]
);
hook.api = { remove: removeHookRef };
hook.remove = removeHookRef;
["before", "error", "after", "wrap"].forEach(function (kind) {
var args = name ? [state, kind, name] : [state, kind];
hook[kind] = hook.api[kind] = bindable(addHook, null).apply(null, args);
});
}

function HookSingular () {
var singularHookName = 'h'
function HookSingular() {
var singularHookName = "h";
var singularHookState = {
registry: {}
}
var singularHook = register.bind(null, singularHookState, singularHookName)
bindApi(singularHook, singularHookState, singularHookName)
return singularHook
registry: {},
};
var singularHook = register.bind(null, singularHookState, singularHookName);
bindApi(singularHook, singularHookState, singularHookName);
return singularHook;
}

function HookCollection () {
function HookCollection() {
var state = {
registry: {}
}
registry: {},
};

var hook = register.bind(null, state)
bindApi(hook, state)
var hook = register.bind(null, state);
bindApi(hook, state);

return hook
return hook;
}

var collectionHookDeprecationMessageDisplayed = false
function Hook () {
var collectionHookDeprecationMessageDisplayed = false;
function Hook() {
if (!collectionHookDeprecationMessageDisplayed) {
console.warn('[before-after-hook]: "Hook()" repurposing warning, use "Hook.Collection()". Read more: https://git.io/upgrade-before-after-hook-to-1.4')
collectionHookDeprecationMessageDisplayed = true
console.warn(
'[before-after-hook]: "Hook()" repurposing warning, use "Hook.Collection()". Read more: https://git.io/upgrade-before-after-hook-to-1.4'
);
collectionHookDeprecationMessageDisplayed = true;
}
return HookCollection()
return HookCollection();
}

Hook.Singular = HookSingular.bind()
Hook.Collection = HookCollection.bind()
Hook.Singular = HookSingular.bind();
Hook.Collection = HookCollection.bind();

module.exports = Hook
module.exports = Hook;
// expose constructors as a named property for TypeScript
module.exports.Hook = Hook
module.exports.Singular = Hook.Singular
module.exports.Collection = Hook.Collection
module.exports.Hook = Hook;
module.exports.Singular = Hook.Singular;
module.exports.Collection = Hook.Collection;


/***/ }),
Expand Down Expand Up @@ -84016,6 +84020,20 @@ const isDomainOrSubdomain = function isDomainOrSubdomain(destination, original)
return orig === dest || orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest);
};

/**
* isSameProtocol reports whether the two provided URLs use the same protocol.
*
* Both domains must already be in canonical form.
* @param {string|URL} original
* @param {string|URL} destination
*/
const isSameProtocol = function isSameProtocol(destination, original) {
const orig = new URL$1(original).protocol;
const dest = new URL$1(destination).protocol;

return orig === dest;
};

/**
* Fetch function
*
Expand Down Expand Up @@ -84047,7 +84065,7 @@ function fetch(url, opts) {
let error = new AbortError('The user aborted a request.');
reject(error);
if (request.body && request.body instanceof Stream.Readable) {
request.body.destroy(error);
destroyStream(request.body, error);
}
if (!response || !response.body) return;
response.body.emit('error', error);
Expand Down Expand Up @@ -84088,9 +84106,43 @@ function fetch(url, opts) {

req.on('error', function (err) {
reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));

if (response && response.body) {
destroyStream(response.body, err);
}

finalize();
});

fixResponseChunkedTransferBadEnding(req, function (err) {
if (signal && signal.aborted) {
return;
}

if (response && response.body) {
destroyStream(response.body, err);
}
});

/* c8 ignore next 18 */
if (parseInt(process.version.substring(1)) < 14) {
// Before Node.js 14, pipeline() does not fully support async iterators and does not always
// properly handle when the socket close/end events are out of order.
req.on('socket', function (s) {
s.addListener('close', function (hadError) {
// if a data listener is still present we didn't end cleanly
const hasDataListener = s.listenerCount('data') > 0;

// if end happened before close but the socket didn't emit an error, do it now
if (response && hasDataListener && !hadError && !(signal && signal.aborted)) {
const err = new Error('Premature close');
err.code = 'ERR_STREAM_PREMATURE_CLOSE';
response.body.emit('error', err);
}
});
});
}

req.on('response', function (res) {
clearTimeout(reqTimeout);

Expand Down Expand Up @@ -84162,7 +84214,7 @@ function fetch(url, opts) {
size: request.size
};

if (!isDomainOrSubdomain(request.url, locationURL)) {
if (!isDomainOrSubdomain(request.url, locationURL) || !isSameProtocol(request.url, locationURL)) {
for (const name of ['authorization', 'www-authenticate', 'cookie', 'cookie2']) {
requestOpts.headers.delete(name);
}
Expand Down Expand Up @@ -84255,6 +84307,13 @@ function fetch(url, opts) {
response = new Response(body, response_options);
resolve(response);
});
raw.on('end', function () {
// some old IIS servers return zero-length OK deflate responses, so 'data' is never emitted.
if (!response) {
response = new Response(body, response_options);
resolve(response);
}
});
return;
}

Expand All @@ -84274,6 +84333,41 @@ function fetch(url, opts) {
writeToStream(req, request);
});
}
function fixResponseChunkedTransferBadEnding(request, errorCallback) {
let socket;

request.on('socket', function (s) {
socket = s;
});

request.on('response', function (response) {
const headers = response.headers;

if (headers['transfer-encoding'] === 'chunked' && !headers['content-length']) {
response.once('close', function (hadError) {
// if a data listener is still present we didn't end cleanly
const hasDataListener = socket.listenerCount('data') > 0;

if (hasDataListener && !hadError) {
const err = new Error('Premature close');
err.code = 'ERR_STREAM_PREMATURE_CLOSE';
errorCallback(err);
}
});
}
});
}

function destroyStream(stream, err) {
if (stream.destroy) {
stream.destroy(err);
} else {
// node < 8
stream.emit('error', err);
stream.end();
}
}

/**
* Redirect code matching
*
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "foundry-storage-check",
"version": "3.2.0",
"version": "3.2.1",
"description": "Github Action checking the storage layout diff from Foundry storage layout reports",
"author": {
"name": "Romain (Rubilmax) Milon",
Expand Down

0 comments on commit f1d0ac9

Please sign in to comment.