Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
8c722a0a
Commit
8c722a0a
authored
Jan 12, 2022
by
Indeavr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(integration-tests): Added tests checking msg.sender value of eth_call
parent
3e3c07a3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
2 deletions
+55
-2
.prettierrc.js
integration-tests/.prettierrc.js
+3
-0
.prettierrc.json
integration-tests/.prettierrc.json
+0
-1
ValueCalls.sol
integration-tests/contracts/ValueCalls.sol
+4
-0
rpc.spec.ts
integration-tests/test/rpc.spec.ts
+48
-1
No files found.
integration-tests/.prettierrc.js
0 → 100644
View file @
8c722a0a
module
.
exports
=
{
...
require
(
'
../.prettierrc.js
'
),
}
integration-tests/.prettierrc.json
deleted
120000 → 0
View file @
3e3c07a3
../.prettierrc.json
\ No newline at end of file
integration-tests/contracts/ValueCalls.sol
View file @
8c722a0a
...
@@ -23,6 +23,10 @@ contract ValueContext {
...
@@ -23,6 +23,10 @@ contract ValueContext {
function getCallValue() public payable returns(uint256) {
function getCallValue() public payable returns(uint256) {
return msg.value;
return msg.value;
}
}
function getCaller() external view returns (address){
return msg.sender;
}
}
}
contract ValueCalls is ValueContext {
contract ValueCalls is ValueContext {
...
...
integration-tests/test/rpc.spec.ts
View file @
8c722a0a
import
{
expect
}
from
'
./shared/setup
'
import
{
expect
}
from
'
./shared/setup
'
import
{
expectApprox
,
injectL2Context
}
from
'
@eth-optimism/core-utils
'
import
{
expectApprox
,
injectL2Context
}
from
'
@eth-optimism/core-utils
'
import
{
Wallet
,
BigNumber
,
Contract
,
ContractFactory
}
from
'
ethers
'
import
{
Wallet
,
BigNumber
,
Contract
,
ContractFactory
,
constants
}
from
'
ethers
'
import
{
serialize
}
from
'
@ethersproject/transactions
'
import
{
serialize
}
from
'
@ethersproject/transactions
'
import
{
ethers
}
from
'
hardhat
'
import
{
ethers
}
from
'
hardhat
'
import
{
import
{
...
@@ -233,6 +233,53 @@ describe('Basic RPC tests', () => {
...
@@ -233,6 +233,53 @@ describe('Basic RPC tests', () => {
expect
(
res
).
to
.
eq
(
BigNumber
.
from
(
value
))
expect
(
res
).
to
.
eq
(
BigNumber
.
from
(
value
))
})
})
// https://github.com/ethereum-optimism/optimism/issues/1998
it
(
'
should use address(0) as the default "from" value
'
,
async
()
=>
{
// Deploy a contract to check msg.caller
const
Factory__ValueContext
:
ContractFactory
=
await
ethers
.
getContractFactory
(
'
ValueContext
'
,
wallet
)
const
ValueContext
:
Contract
=
await
Factory__ValueContext
.
deploy
()
await
ValueContext
.
deployTransaction
.
wait
()
// Do the call and check msg.sender
const
data
=
ValueContext
.
interface
.
encodeFunctionData
(
'
getCaller
'
)
const
res
=
await
provider
.
call
({
to
:
ValueContext
.
address
,
data
,
})
const
[
paddedRes
]
=
ValueContext
.
interface
.
decodeFunctionResult
(
'
getCaller
'
,
res
)
expect
(
paddedRes
).
to
.
eq
(
constants
.
AddressZero
)
})
it
(
'
should correctly use the "from" value
'
,
async
()
=>
{
// Deploy a contract to check msg.caller
const
Factory__ValueContext
:
ContractFactory
=
await
ethers
.
getContractFactory
(
'
ValueContext
'
,
wallet
)
const
ValueContext
:
Contract
=
await
Factory__ValueContext
.
deploy
()
await
ValueContext
.
deployTransaction
.
wait
()
const
from
=
wallet
.
address
// Do the call and check msg.sender
const
data
=
ValueContext
.
interface
.
encodeFunctionData
(
'
getCaller
'
)
const
res
=
await
provider
.
call
({
to
:
ValueContext
.
address
,
from
,
data
,
})
const
[
paddedRes
]
=
ValueContext
.
interface
.
decodeFunctionResult
(
'
getCaller
'
,
res
)
expect
(
paddedRes
).
to
.
eq
(
from
)
})
})
})
describe
(
'
eth_getTransactionReceipt
'
,
()
=>
{
describe
(
'
eth_getTransactionReceipt
'
,
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment