Skip to content

Commit

Permalink
Add a test to cover the fix
Browse files Browse the repository at this point in the history
  • Loading branch information
brbrr committed Dec 9, 2024
1 parent 7a1108d commit 2a0042a
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,18 @@ public async Task Eth_get_storage_at_default_block()
Assert.That(serialized, Is.EqualTo("{\"jsonrpc\":\"2.0\",\"result\":\"0x0000000000000000000000000000000000000000000000000000000000abcdef\",\"id\":67}"));
}

[Test]
public async Task Eth_get_storage_at_trie_exception()
{
using Context ctx = await Context.Create();
ctx.Test.StateDb.Clear();
BlockParameter? blockParameter = null;
BlockHeader? header = ctx.Test.BlockFinder.FindHeader(blockParameter);
string serialized = await ctx.Test.TestEthRpc("eth_getStorageAt", TestItem.AddressA.Bytes.ToHexString(true), "0x1");
var expected = $"{{\"jsonrpc\":\"2.0\",\"error\":{{\"code\":-32002,\"message\":\"No state available for block {header?.Number} ({header?.Hash})\"}},\"id\":67}}";
Assert.That(serialized, Is.EqualTo(expected));
}

[Test]
public async Task Eth_get_block_number()
{
Expand Down

0 comments on commit 2a0042a

Please sign in to comment.