Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -286,56 +286,13 @@ def test_bal_account_access_target(
blockchain_test(pre=pre, blocks=[block], post={})


def test_bal_call_with_value_transfer(
def test_bal_callcode_nested_value_transfer(
pre: Alloc,
blockchain_test: BlockchainTestFiller,
) -> None:
"""
Ensure BAL captures balance changes from CALL opcode with
value transfer.
"""
alice = pre.fund_eoa()
bob = pre.fund_eoa(amount=0)

# Oracle contract that uses CALL to transfer 100 wei to Bob
oracle_code = Op.CALL(0, bob, 100, 0, 0, 0, 0)
oracle_contract = pre.deploy_contract(code=oracle_code, balance=200)

tx = Transaction(
sender=alice, to=oracle_contract, gas_limit=1_000_000, gas_price=0xA
)

block = Block(
txs=[tx],
expected_block_access_list=BlockAccessListExpectation(
account_expectations={
alice: BalAccountExpectation(
nonce_changes=[BalNonceChange(tx_index=1, post_nonce=1)],
),
oracle_contract: BalAccountExpectation(
balance_changes=[
BalBalanceChange(tx_index=1, post_balance=100)
],
),
bob: BalAccountExpectation(
balance_changes=[
BalBalanceChange(tx_index=1, post_balance=100)
],
),
}
),
)

blockchain_test(pre=pre, blocks=[block], post={})


def test_bal_callcode_with_value_transfer(
pre: Alloc,
blockchain_test: BlockchainTestFiller,
) -> None:
"""
Ensure BAL captures balance changes from CALLCODE opcode with
value transfer.
Ensure BAL captures balance changes from nested value transfers
when CALLCODE executes target code that itself makes CALL with value.
"""
alice = pre.fund_eoa()
bob = pre.fund_eoa(amount=0)
Expand Down
Loading
Loading