diff --git a/prdoc/pr_10471.prdoc b/prdoc/pr_10471.prdoc new file mode 100644 index 0000000000000..9470a61027bc3 --- /dev/null +++ b/prdoc/pr_10471.prdoc @@ -0,0 +1,10 @@ +title: '[Revive] Change default value of eth_getStorageAt' +doc: +- audience: Runtime Dev + description: |- + Closes https://github.com/paritytech/contract-issues/issues/230 + + With this change `eth_getStorageAt` of the eth rpc always returns a 32 byte array. If the storage slot has never been written before, it returns the 32 byte zero value as the default value. Before that it was the empty array. +crates: +- name: pallet-revive-eth-rpc + bump: patch diff --git a/substrate/frame/revive/rpc/src/lib.rs b/substrate/frame/revive/rpc/src/lib.rs index c5cbbcbd7b2ac..b65cd76c6627e 100644 --- a/substrate/frame/revive/rpc/src/lib.rs +++ b/substrate/frame/revive/rpc/src/lib.rs @@ -352,7 +352,7 @@ impl EthRpcServer for EthRpcServerImpl { let hash = self.client.block_hash_for_tag(block).await?; let runtime_api = self.client.runtime_api(hash); let bytes = runtime_api.get_storage(address, storage_slot.to_big_endian()).await?; - Ok(bytes.unwrap_or_default().into()) + Ok(bytes.unwrap_or([0u8; 32].into()).into()) } async fn get_transaction_by_block_hash_and_index(