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
87d1b3cc
Commit
87d1b3cc
authored
Dec 10, 2020
by
Alina
Committed by
GitHub
Dec 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
require relayer fee transfer success (#117)
parent
09936907
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
1 deletion
+31
-1
OVM_ECDSAContractAccount.sol
...mistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol
+5
-1
OVM_ECDSAContractAccount.spec.ts
...t/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts
+26
-0
No files found.
packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol
View file @
87d1b3cc
...
...
@@ -87,11 +87,15 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount {
// Transfer fee to relayer.
address relayer = Lib_SafeExecutionManagerWrapper.safeCALLER();
uint256 fee = decodedTx.gasLimit * decodedTx.gasPrice;
Lib_SafeExecutionManagerWrapper.safeCALL(
(bool success, ) =
Lib_SafeExecutionManagerWrapper.safeCALL(
gasleft(),
ETH_ERC20_ADDRESS,
abi.encodeWithSignature("transfer(address,uint256)", relayer, fee)
);
Lib_SafeExecutionManagerWrapper.safeREQUIRE(
success == true,
"Fee was not transferred to relayer."
);
// Contract creations are signalled by sending a transaction to the zero address.
if (decodedTx.to == address(0)) {
...
...
packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts
View file @
87d1b3cc
...
...
@@ -269,5 +269,31 @@ describe('OVM_ECDSAContractAccount', () => {
'
Gas is not sufficient to execute the transaction.
'
)
})
it
(
`should revert if fee is not transferred to the relayer`
,
async
()
=>
{
const
message
=
serializeNativeTransaction
(
DEFAULT_EIP155_TX
)
const
sig
=
await
signNativeTransaction
(
wallet
,
DEFAULT_EIP155_TX
)
Mock__OVM_ExecutionManager
.
smocked
.
ovmCALL
.
will
.
return
.
with
([
false
,
'
0x
'
])
await
callPrecompile
(
Helper_PrecompileCaller
,
OVM_ECDSAContractAccount
,
'
execute
'
,
[
message
,
0
,
//isEthSignedMessage
`0x
${
sig
.
v
}
`
,
//v
`0x
${
sig
.
r
}
`
,
//r
`0x
${
sig
.
s
}
`
,
//s
],
40000000
)
const
ovmREVERT
:
any
=
Mock__OVM_ExecutionManager
.
smocked
.
ovmREVERT
.
calls
[
0
]
expect
(
ethers
.
utils
.
toUtf8String
(
ovmREVERT
.
_data
)).
to
.
equal
(
'
Fee was not transferred to relayer.
'
)
})
})
})
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