Skip to content

Use LatestSigner and don't set GasPrice in ContractBackend#322

Merged
matthiasgeihs merged 4 commits intohyperledger-labs:mainfrom
perun-network:eth-latest-signer
Feb 14, 2022
Merged

Use LatestSigner and don't set GasPrice in ContractBackend#322
matthiasgeihs merged 4 commits intohyperledger-labs:mainfrom
perun-network:eth-latest-signer

Conversation

@sebastianst
Copy link
Copy Markdown
Contributor

  • eth/channel: Use types.LatestSigner for all sim backend tests
    • Before, types.EIP155Signers were created in many different places.
      It is recommended by the geth folks to use types.LatestSigner instead.
      This was streamlined an there's now a common channel/test.SimSigner that
      can always be used together with the simulated backend.
    • FundAddress and Test_ConfirmTransaction were adapted to use the
      new types.DynamicFeeTx.
    • The unused test.GasLimit variable was deleted.
    • The test.GasPrice variable was renamed to InitialGasBaseFee and its
      description updated.
  • eth/channel: Don't set GasPrice in ContractBackend.NewTransactor
    • Setting TransactOpts.GasPrice forces the transactions to be sent as a
      legacy transaction, instead of a type 2 EIP1559, which results in much
      higher gas costs.
    • Also remove the SuggestedGasPrice method from the SimulatedBackend, as
      it is not used anymore, because EIP1559 TXs are now sent everywhere.

Opened as a draft to let @ndzik try it out first if we truly now send EIP1559 txs.
Original issue in Erdstall is at https://github.com/perun-network/erdstall-ext/issues/121

Comment thread backend/ethereum/channel/test/simulated.go
@ndzik
Copy link
Copy Markdown
Contributor

ndzik commented Feb 10, 2022

I can confirm that this change has the expected result 👍

I wrote a small application and this tx uses the updated logic from go-perun to make a contract call and it is of type 2 💪

- Before, types.EIP155Signer's were created in many different places.
It is recommended by the geth folks to use types.LatestSigner instead.
This was streamlined an there's now a common channel/test.SimSigner that
can always be used together with the simulated backend.

- FundAddress and Test_ConfirmTransaction were adapted to use the
new types.DynamicFeeTx.

- The unused test.GasLimit variable was deleted.

- The test.GasPrice variable was renamed to InitialGasBaseFee and its
description updated.

Signed-off-by: Sebastian Stammler <seb@perun.network>
Setting TransactOpts.GasPrice forces the transactions to be sent as a
legacy transaction, instead of a type 2 EIP1559, which results in much
higher gas costs.

Also remove the SuggestedGasPrice method from the SimulatedBackend, as
it is not used anymore, because EIP1559 TXs are now sent everywhere.

Signed-off-by: Sebastian Stammler <seb@perun.network>
Signed-off-by: Sebastian Stammler <seb@perun.network>
Signed-off-by: Sebastian Stammler <seb@perun.network>
@sebastianst sebastianst marked this pull request as ready for review February 10, 2022 17:02
Copy link
Copy Markdown
Contributor

@matthiasgeihs matthiasgeihs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@matthiasgeihs matthiasgeihs merged commit 80d6c73 into hyperledger-labs:main Feb 14, 2022
@matthiasgeihs matthiasgeihs deleted the eth-latest-signer branch February 14, 2022 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants