From c04225e952d562245b68468d3da55a9cc0513604 Mon Sep 17 00:00:00 2001 From: F Bojarski Date: Thu, 13 Feb 2025 11:17:42 +0100 Subject: [PATCH] address OB's comments Signed-off-by: F Bojarski --- .../SelfdestructCoinbaseTests.java | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/selfdestructTests/SelfdestructCoinbaseTests.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/selfdestructTests/SelfdestructCoinbaseTests.java index 46a32c84e..ef70a96b6 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/selfdestructTests/SelfdestructCoinbaseTests.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/selfdestructTests/SelfdestructCoinbaseTests.java @@ -43,6 +43,29 @@ public class SelfdestructCoinbaseTests { + /** + * This test aims to test the SELFDESTRUCT of the COINBASE address in various scenarii: - root + * context is deployment - coinbase / recipient address collision - coinbase is deployed prior to + * the transaction - the transaction is reverted + */ + static final ToyAccount CHECKING_COINBASE = + ToyAccount.builder() + .code( + BytecodeCompiler.newProgram() + .op(OpCode.COINBASE) + .op(OpCode.BALANCE) + .op(OpCode.POP) + .op(OpCode.COINBASE) + .op(OpCode.EXTCODESIZE) + .push(0) + .push(0) + .op(OpCode.COINBASE) + .op(OpCode.EXTCODECOPY) + .op(OpCode.COINBASE) + .op(OpCode.EXTCODEHASH) + .compile()) + .build(); + @ParameterizedTest @MethodSource("selfDestructCoinbaseInputs") void selfdestructCoinbaseTests( @@ -106,9 +129,7 @@ void selfdestructCoinbaseTests( ToyTransaction.builder() .sender(senderAccount) .keyPair(senderKeyPair) - .value(Wei.of(123)) - .gasLimit(100000L) - .payload(BytecodeCompiler.newProgram().op(OpCode.COINBASE).op(OpCode.BALANCE).compile()) + .to(CHECKING_COINBASE) .nonce(senderAccount.getNonce() + 1) .build();