Skip to content

Commit

Permalink
remove unused method (#669)
Browse files Browse the repository at this point in the history
* remove unused method

* lint
  • Loading branch information
ermalkaleci authored Feb 7, 2024
1 parent 0d440a2 commit e0c17cf
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 18 deletions.
4 changes: 0 additions & 4 deletions executor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const _: &'static str = r#"
type HexString = `0x${string}`;
export interface JsCallback {
getStorage: (key: HexString) => Promise<string | undefined>
getStateRoot: () => Promise<string>
getNextKey: (prefix: HexString, key: HexString) => Promise<string | undefined>
offchainGetStorage: (key: HexString) => Promise<string | undefined>
offchainTimestamp: () => Promise<number>
Expand All @@ -38,9 +37,6 @@ extern "C" {
#[wasm_bindgen(catch, structural, method, js_name = "getStorage")]
pub async fn get_storage(this: &JsCallback, key: JsValue) -> Result<JsValue, JsValue>;

#[wasm_bindgen(catch, structural, method, js_name = "getStateRoot")]
pub async fn get_state_root(this: &JsCallback) -> Result<JsValue, JsValue>;

#[wasm_bindgen(catch, structural, method, js_name = "getNextKey")]
pub async fn get_next_key(
this: &JsCallback,
Expand Down
6 changes: 2 additions & 4 deletions executor/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,8 @@ pub async fn run_task(task: TaskCall, js: crate::JsCallback) -> Result<TaskRespo
}
}

RuntimeCall::ClosestDescendantMerkleValue(req) => {
let value = js.get_state_root().await?;
let value = from_value::<HexString>(value).map(|x| x.0)?;
req.inject_merkle_value(Some(value.as_ref()))
RuntimeCall::ClosestDescendantMerkleValue(_req) => {
unreachable!()
}

RuntimeCall::NextKey(req) => {
Expand Down
3 changes: 0 additions & 3 deletions packages/core/src/genesis-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@ export class GenesisProvider implements ProviderInterface {
getStorage: async function (key: HexString) {
return storage[key]
},
getStateRoot: async function () {
return '0x49416764844ff0d8bad851e8abe686dff9dd2de78621180ef8e9f99bb7a480f1'
},
getNextKey: async function (_prefix: HexString, _key: HexString) {
return undefined
},
Expand Down
7 changes: 0 additions & 7 deletions packages/core/src/wasm-executor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,6 @@ export const taskHandler = (block: Block): JsCallback => {
getStorage: async function (key: HexString) {
return block.get(key)
},
getStateRoot: async function () {
const header = await block.header
return header.stateRoot.toHex()
},
getNextKey: async function (prefix: HexString, key: HexString) {
const [nextKey] = await block.getKeysPaged({
prefix: prefix.length === 2 /** 0x */ ? key.slice(0, PREFIX_LENGTH) : prefix,
Expand Down Expand Up @@ -179,9 +175,6 @@ export const emptyTaskHandler = {
getStorage: async function (_key: HexString) {
throw new Error('Method not implemented')
},
getStateRoot: async function () {
throw new Error('Method not implemented')
},
getNextKey: async function (_prefix: HexString, _key: HexString) {
throw new Error('Method not implemented')
},
Expand Down

0 comments on commit e0c17cf

Please sign in to comment.