Skip to content

Commit

Permalink
fix: Pass callvalue() to callcode
Browse files Browse the repository at this point in the history
  • Loading branch information
drklee3 committed Oct 15, 2024
1 parent d2df6b7 commit 99c2f6e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tests/e2e-evm/contracts/ABI_BasicTests.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ contract Caller {
let result := callcode(
gas(), // gas
to, // to address
0, // value
callvalue(), // value
0, // in - pointer to start of input, 0 since we copied the data to 0
data.length, // insize - size of the input
0, // out
0 // outsize - 0 since we don't know the size of the output
)

// Copy the returned data.
// Copy the returned data to memory.
// returndatacopy(t, f, s)
// - t: target location in memory
// - f: source location in return data
Expand Down
5 changes: 3 additions & 2 deletions tests/e2e-evm/test/callcode.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,16 @@ describe("CallCode", () => {
],
}),
}),
// msg.sender is the caller contract, and value is NOT passed
// msg.sender is the caller contract
wantSender: (ctx) => ctx.lowLevelCaller.address,
// msg.value is not preserved
wantValue: 0n,
},
{
name: "callcode with storage",
txParams: (ctx) => ({
to: ctx.lowLevelCaller.address,
value: 100n,
value: 0n,
gas: contractCallerGas + 20_000n,
data: encodeFunctionData({
abi: lowLevelCaller.abi,
Expand Down

0 comments on commit 99c2f6e

Please sign in to comment.