Skip to content

Commit

Permalink
address OB's comments
Browse files Browse the repository at this point in the history
Signed-off-by: F Bojarski <ceciestunepoubelle@protonmail.ch>
  • Loading branch information
letypequividelespoubelles committed Feb 13, 2025
1 parent 1834525 commit c04225e
Showing 1 changed file with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit c04225e

Please sign in to comment.