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
6749ab3d
Unverified
Commit
6749ab3d
authored
Jan 13, 2022
by
Mark Tyneway
Committed by
GitHub
Jan 13, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1999 from indeavr/develop
Makes sure that the Default sender is address(0)
parents
d27e841d
1bc6898a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
65 additions
and
5 deletions
+65
-5
kind-poems-happen.md
.changeset/kind-poems-happen.md
+5
-0
.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
api.go
l2geth/internal/ethapi/api.go
+5
-3
No files found.
.changeset/kind-poems-happen.md
0 → 100644
View file @
6749ab3d
---
'
@eth-optimism/l2geth'
:
patch
---
changed the default address to be address(0) in
`call`
integration-tests/.prettierrc.js
0 → 100644
View file @
6749ab3d
module
.
exports
=
{
...
require
(
'
../.prettierrc.js
'
),
}
integration-tests/.prettierrc.json
deleted
120000 → 0
View file @
d27e841d
../.prettierrc.json
\ No newline at end of file
integration-tests/contracts/ValueCalls.sol
View file @
6749ab3d
...
...
@@ -23,6 +23,10 @@ contract ValueContext {
function getCallValue() public payable returns(uint256) {
return msg.value;
}
function getCaller() external view returns (address){
return msg.sender;
}
}
contract ValueCalls is ValueContext {
...
...
integration-tests/test/rpc.spec.ts
View file @
6749ab3d
import
{
expect
}
from
'
./shared/setup
'
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
{
ethers
}
from
'
hardhat
'
import
{
...
...
@@ -233,6 +233,53 @@ describe('Basic RPC tests', () => {
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
'
,
()
=>
{
...
...
l2geth/internal/ethapi/api.go
View file @
6749ab3d
...
...
@@ -799,9 +799,11 @@ func DoCall(ctx context.Context, b Backend, args CallArgs, blockNrOrHash rpc.Blo
// Set sender address or use a default if none specified
var
addr
common
.
Address
if
args
.
From
==
nil
{
if
wallets
:=
b
.
AccountManager
()
.
Wallets
();
len
(
wallets
)
>
0
{
if
accounts
:=
wallets
[
0
]
.
Accounts
();
len
(
accounts
)
>
0
{
addr
=
accounts
[
0
]
.
Address
if
!
rcfg
.
UsingOVM
{
if
wallets
:=
b
.
AccountManager
()
.
Wallets
();
len
(
wallets
)
>
0
{
if
accounts
:=
wallets
[
0
]
.
Accounts
();
len
(
accounts
)
>
0
{
addr
=
accounts
[
0
]
.
Address
}
}
}
}
else
{
...
...
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