diff --git a/apps/src/lib/node/ledger/shell/finalize_block.rs b/apps/src/lib/node/ledger/shell/finalize_block.rs index 15d1aea2c7..729c6c990b 100644 --- a/apps/src/lib/node/ledger/shell/finalize_block.rs +++ b/apps/src/lib/node/ledger/shell/finalize_block.rs @@ -267,9 +267,6 @@ where msg ) } - self.wl_storage - .write_tx_hash(tx.header_hash()) - .expect("Error while writing tx hash to storage"); } } diff --git a/shared/src/ledger/protocol/mod.rs b/shared/src/ledger/protocol/mod.rs index 837bdabd86..343b2fb47e 100644 --- a/shared/src/ledger/protocol/mod.rs +++ b/shared/src/ledger/protocol/mod.rs @@ -253,12 +253,9 @@ where )?; // Account for gas - shell_params.tx_gas_meter.add_wrapper_gas(tx_bytes)?; - - // If wrapper was succesful, write inner tx hash to storage shell_params .tx_gas_meter - .add_tx_size_gas(tx_bytes) + .add_wrapper_gas(tx_bytes) .map_err(|err| Error::GasError(err.to_string()))?; Ok(changed_keys) diff --git a/shared/src/ledger/vp_host_fns.rs b/shared/src/ledger/vp_host_fns.rs index 1aa8419cb0..5bf9d487e4 100644 --- a/shared/src/ledger/vp_host_fns.rs +++ b/shared/src/ledger/vp_host_fns.rs @@ -303,7 +303,11 @@ pub fn get_tx_code_hash( tx: &Tx, sentinel: &mut VpSentinel, ) -> EnvResult> { - add_gas(gas_meter, HASH_LENGTH as u64 * MEMORY_ACCESS_GAS_PER_BYTE)?; + add_gas( + gas_meter, + HASH_LENGTH as u64 * MEMORY_ACCESS_GAS_PER_BYTE, + sentinel, + )?; let hash = tx .get_section(tx.code_sechash()) .and_then(|x| Section::code_sec(x.as_ref())) @@ -337,6 +341,7 @@ pub fn get_tx_index( add_gas( gas_meter, TX_INDEX_LENGTH as u64 * MEMORY_ACCESS_GAS_PER_BYTE, + sentinel, )?; Ok(*tx_index) } @@ -354,6 +359,7 @@ where add_gas( gas_meter, ESTABLISHED_ADDRESS_BYTES_LEN as u64 * MEMORY_ACCESS_GAS_PER_BYTE, + sentinel, )?; Ok(storage.native_token.clone()) } diff --git a/shared/src/vm/wasm/run.rs b/shared/src/vm/wasm/run.rs index acfaf9b70a..2865e22503 100644 --- a/shared/src/vm/wasm/run.rs +++ b/shared/src/vm/wasm/run.rs @@ -568,7 +568,9 @@ where .map_err(|e| Error::GasError(e.to_string()))?; validate_untrusted_wasm(code).map_err(Error::ValidationError)?; - gas_meter.add_compiling_gas(tx_len)?; + gas_meter + .add_compiling_gas(tx_len) + .map_err(|e| Error::GasError(e.to_string()))?; match wasm_cache.compile_or_fetch(code)? { Some((module, store)) => Ok((module, store)), None => Err(Error::NoCompiledWasmCode),