Skip to content

Commit

Permalink
fix(builder): router various issues (#1570)
Browse files Browse the repository at this point in the history
Co-authored-by: Matías <mjlescano@protonmail.com>
  • Loading branch information
dbeal-eth and mjlescano authored Dec 2, 2024
1 parent 7a8cb03 commit 07a2526
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 38 deletions.
4 changes: 3 additions & 1 deletion packages/builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@rollup/plugin-terser": "^0.4.4",
"@types/debug": "^4.1.12",
"@types/jest": "^29.5.12",
"@types/json-stable-stringify": "^1.1.0",
"@types/lodash": "^4.17.7",
"@types/pako": "^2.0.3",
"jest": "^29.7.0",
Expand All @@ -43,7 +44,7 @@
"typedoc-plugin-zod": "^1.2.0"
},
"dependencies": {
"@usecannon/router": "^4.1.0",
"@usecannon/router": "^4.1.2",
"@usecannon/web-solc": "0.5.1",
"axios": "^1.7.2",
"axios-retry": "^4.4.2",
Expand All @@ -52,6 +53,7 @@
"debug": "^4.3.6",
"form-data": "^4.0.0",
"fuse.js": "^7.0.0",
"json-stable-stringify": "^1.1.1",
"lodash": "^4.17.21",
"pako": "^2.1.0",
"promise-events": "^0.2.4",
Expand Down
13 changes: 11 additions & 2 deletions packages/builder/src/definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ChainBuilderRuntime } from './runtime';
import { chainDefinitionSchema } from './schemas';
import { CannonHelperContext, ChainBuilderContext } from './types';
import { template } from './utils/template';
import stableStringify from 'json-stable-stringify';

import { PackageReference } from './package-reference';

Expand Down Expand Up @@ -276,8 +277,16 @@ export class ChainDefinition {
if (!objs) {
return null;
} else {
debugVerbose('creating hash of', objs.map(JSON.stringify as any));
return objs.map((o) => crypto.createHash('md5').update(JSON.stringify(o)).digest('hex'));
debugVerbose(
'creating hash of',
objs.map(JSON.stringify as any),
'and',
objs.map((o) => stableStringify(o))
);
return [
...objs.map((o) => crypto.createHash('md5').update(JSON.stringify(o)).digest('hex')),
...objs.map((o) => crypto.createHash('md5').update(stableStringify(o)).digest('hex')),
];
}
}

Expand Down
10 changes: 10 additions & 0 deletions packages/builder/src/steps/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ const routerStep = {
contractAddresses,
config: newConfig,
},
{
contractAbis,
contractAddresses,
config: _.omit(newConfig, 'includeDiamondCompatibility'),
},
{
contractAbis,
contractAddresses,
config: _.omit(newConfig, 'includeReceive', 'includeDiamondCompatibility'),
},
];
},

Expand Down
Loading

0 comments on commit 07a2526

Please sign in to comment.