From 6635a0b337558087743a4de0e3dd1d717120955e Mon Sep 17 00:00:00 2001 From: Cyrill Leutwiler Date: Tue, 10 Sep 2024 09:09:52 +0200 Subject: [PATCH] fixed size event topics Signed-off-by: Cyrill Leutwiler --- crates/integration/contracts/Events.sol | 10 +++------- crates/llvm-context/src/polkavm/evm/event.rs | 4 +++- crates/runner/src/specs.rs | 1 - 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/crates/integration/contracts/Events.sol b/crates/integration/contracts/Events.sol index c3f7dd7..8d88f1d 100644 --- a/crates/integration/contracts/Events.sol +++ b/crates/integration/contracts/Events.sol @@ -22,12 +22,7 @@ pragma solidity ^0.8; }, "data": "4d43bec90000000000000000000000000000000000000000000000000000000000000000" } - } - ] -} -*/ - -/* TODO when pallet_revive accepts Solidity event topics + }, { "Call": { "dest": { @@ -36,7 +31,8 @@ pragma solidity ^0.8; "data": "4d43bec9000000000000000000000000000000000000000000000000000000000000007b" } } - + ] +} */ contract Events { diff --git a/crates/llvm-context/src/polkavm/evm/event.rs b/crates/llvm-context/src/polkavm/evm/event.rs index 37ef12f..ecf4935 100644 --- a/crates/llvm-context/src/polkavm/evm/event.rs +++ b/crates/llvm-context/src/polkavm/evm/event.rs @@ -43,6 +43,7 @@ where context.byte_type().array_type(topics_buffer_size as u32), "topics_buffer", ); + for (n, topic) in topics.iter().enumerate() { let topic_buffer_offset = context .xlen_type() @@ -57,6 +58,7 @@ where context.build_byte_swap(topic.as_basic_value_enum())?, )?; } + [ context .builder() @@ -68,7 +70,7 @@ where .as_basic_value_enum(), context .xlen_type() - .const_int(topics_buffer_size as u64, false) + .const_int(topics.len() as u64, false) .as_basic_value_enum(), input_pointer.as_basic_value_enum(), input_length.as_basic_value_enum(), diff --git a/crates/runner/src/specs.rs b/crates/runner/src/specs.rs index 6099a7a..76e635f 100644 --- a/crates/runner/src/specs.rs +++ b/crates/runner/src/specs.rs @@ -58,7 +58,6 @@ pub enum SpecsAction { }, /// Verify the result of the last call, omitting this will simply ensure the last call was successful VerifyCall(VerifyCallExpectation), - /// Verify the balance of an account VerifyBalance { origin: TestAddress,