Commit ac5482d0 authored by smartcontracts's avatar smartcontracts Committed by GitHub

Have ECDSAContractAccount use max available gas (#359)

* have eoa pass hardcoded max gas limit

* tweak for tests to pass

* use gasleft instead of hardcoded gas limit
parent 46d30311
...@@ -114,7 +114,7 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount { ...@@ -114,7 +114,7 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount {
// Contract creations are signalled by sending a transaction to the zero address. // Contract creations are signalled by sending a transaction to the zero address.
if (decodedTx.to == address(0)) { if (decodedTx.to == address(0)) {
(address created, bytes memory revertData) = Lib_SafeExecutionManagerWrapper.safeCREATE( (address created, bytes memory revertData) = Lib_SafeExecutionManagerWrapper.safeCREATE(
decodedTx.gasLimit, gasleft(),
decodedTx.data decodedTx.data
); );
...@@ -131,7 +131,7 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount { ...@@ -131,7 +131,7 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount {
Lib_SafeExecutionManagerWrapper.safeINCREMENTNONCE(); Lib_SafeExecutionManagerWrapper.safeINCREMENTNONCE();
return Lib_SafeExecutionManagerWrapper.safeCALL( return Lib_SafeExecutionManagerWrapper.safeCALL(
decodedTx.gasLimit, gasleft(),
decodedTx.to, decodedTx.to,
decodedTx.data decodedTx.data
); );
......
...@@ -106,7 +106,6 @@ describe('OVM_ECDSAContractAccount', () => { ...@@ -106,7 +106,6 @@ describe('OVM_ECDSAContractAccount', () => {
// The ovmCALL is the 2nd call because the first call transfers the fee. // The ovmCALL is the 2nd call because the first call transfers the fee.
const ovmCALL: any = Mock__OVM_ExecutionManager.smocked.ovmCALL.calls[1] const ovmCALL: any = Mock__OVM_ExecutionManager.smocked.ovmCALL.calls[1]
expect(ovmCALL._gasLimit).to.equal(DEFAULT_EIP155_TX.gasLimit)
expect(ovmCALL._address).to.equal(DEFAULT_EIP155_TX.to) expect(ovmCALL._address).to.equal(DEFAULT_EIP155_TX.to)
expect(ovmCALL._calldata).to.equal(DEFAULT_EIP155_TX.data) expect(ovmCALL._calldata).to.equal(DEFAULT_EIP155_TX.data)
}) })
...@@ -130,7 +129,6 @@ describe('OVM_ECDSAContractAccount', () => { ...@@ -130,7 +129,6 @@ describe('OVM_ECDSAContractAccount', () => {
// The ovmCALL is the 2nd call because the first call transfers the fee. // The ovmCALL is the 2nd call because the first call transfers the fee.
const ovmCALL: any = Mock__OVM_ExecutionManager.smocked.ovmCALL.calls[1] const ovmCALL: any = Mock__OVM_ExecutionManager.smocked.ovmCALL.calls[1]
expect(ovmCALL._gasLimit).to.equal(DEFAULT_EIP155_TX.gasLimit)
expect(ovmCALL._address).to.equal(DEFAULT_EIP155_TX.to) expect(ovmCALL._address).to.equal(DEFAULT_EIP155_TX.to)
expect(ovmCALL._calldata).to.equal(DEFAULT_EIP155_TX.data) expect(ovmCALL._calldata).to.equal(DEFAULT_EIP155_TX.data)
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment