Skip to content

Commit

Permalink
Fix path and update smoldot (#509)
Browse files Browse the repository at this point in the history
* update smoldot

* fix template path
  • Loading branch information
ermalkaleci authored Nov 2, 2023
1 parent aea6f8b commit 2019212
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "vendor/smoldot"]
path = vendor/smoldot
url = https://github.com/AcalaNetwork/smoldot.git
url = https://github.com/smol-dot/smoldot.git
2 changes: 1 addition & 1 deletion executor/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 8 additions & 11 deletions executor/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,17 +341,14 @@ pub async fn run_task(task: TaskCall, js: crate::JsCallback) -> Result<TaskRespo

success
.storage_changes
.trie_diffs()
.iter()
.for_each(|(child, diff)| {
diff.diff_iter_unordered().for_each(|(key, value, _)| {
let prefixed_key = if let Some(child) = child {
prefixed_child_key(child.iter().copied(), key.iter().copied())
} else {
key.to_vec()
};
storage_changes.insert(prefixed_key, value.map(|x| x.to_vec()));
});
.storage_changes_iter_unordered()
.for_each(|(child, key, value)| {
let prefixed_key = if let Some(child) = child {
prefixed_child_key(child.iter().copied(), key.iter().copied())
} else {
key.to_vec()
};
storage_changes.insert(prefixed_key, value.map(|x| x.to_vec()));
});

storage_main_trie_changes = success.storage_changes.into_main_trie_diff();
Expand Down
4 changes: 2 additions & 2 deletions packages/chopsticks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"bin": "./chopsticks.js",
"scripts": {
"clean": "rm -rf dist",
"build": "yarn clean && tsc -p ./tsconfig.json && tsc -p ./tsconfig.esm.json",
"build": "yarn clean && tsc -p ./tsconfig.json && tsc -p ./tsconfig.esm.json && yarn copyfiles",
"copyfiles": "cp -r src/utils/template dist/cjs/utils/ && cp -r src/utils/template dist/esm/utils/",
"script:start": "cd ../..; ts-node --transpile-only -r tsconfig-paths/register packages/chopsticks/src/cli.ts",
"script:run": "cd ../..; LOG_LEVEL=trace ts-node-dev --transpile-only -r tsconfig-paths/register --inspect --notify=false packages/chopsticks/src/cli.ts -- --config=configs/dev.yml",
"dev:karura": "cd ../..; ts-node-dev --transpile-only --inspect -r tsconfig-paths/register --notify=false packages/chopsticks/src/cli.ts -- --config=configs/karura.yml",
Expand Down Expand Up @@ -45,7 +46,6 @@
"dist/esm/**",
"dist/cjs/**",
"dist/types/**",
"template",
"chopsticks.js"
],
"main": "./dist/cjs/index.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/chopsticks/src/utils/generate-html-diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { HexString } from '@polkadot/util/types'
import { decodeStorageDiff } from './decoder'
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs'
import { template } from 'lodash'
import path from 'node:path'
import url from 'node:url'

export const generateHtmlDiff = async (block: Block, diff: [HexString, HexString | null][]) => {
const { oldState, delta } = await decodeStorageDiff(block, diff)
const htmlTemplate = readFileSync(path.join(__dirname, '../../template/diff.html'), 'utf-8')
const htmlTemplate = readFileSync(url.resolve(__filename, './template/diff.html'), 'utf-8')
return template(htmlTemplate)({ left: JSON.stringify(oldState), delta: JSON.stringify(delta) })
}

Expand Down
File renamed without changes.

0 comments on commit 2019212

Please sign in to comment.