-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecates Celo legacy transaction type (0) #20
Deprecates Celo legacy transaction type (0) #20
Conversation
This is the current long-term support (LTS) version. Source: https://endoflife.date/nodejs
This file is copied by first-time users and they paste their secret mnemonic phrase here.
Because the environment variable is located at `tests/.env.test.local` dotenv has to be configured to look for the correct file. By default it looks for `.env` in the root of the directory.
Celoscan's current Alfajores endpoint URL can be found here: https://docs.celoscan.io/getting-started/endpoint-urls
Before this, tests had to be run manually with an environment variable `NETWORK`, and the test was run against the user submitted address. Removes the need for `NETWORK` by adding 3 distinct test cases for each network. Removes dependency on user submitted address, by hardcoding 3 address that definitely have a transaction history on the respective network. This ensures the test asserts the desired behaviour and doesn't depend on user submitted values.
For ease of reference for future readers.
This test case is a duplicate of a test available in `transfer.test.ts`.
|
Note-to-self: Ethers doesn't seem to parse the
|
Specifically any mention of `gatewayFee` or `gatewayFeeRecipient`. Deletes Celo Legacy Transaction interface
The first if statement seems redundant, because if `isCIP64(tx)` is true, then 1. there cannot be a tx.gatewayFee, 2. there cannot be a tx.gatewayFeeRecipient 3. there cannot be a tx.gasPrice It might have made sense to keep the code that deletes the fields in case `isCIP64(tx)` doesn't work as expected. But that adds more complexity than necessary in my opinion. Un-nesting if, else if, else statement (personal preference).
From cUSD to USDC transfer. The test was and is still incomplete, because it was and still is only testing that an ERC-20 transfer can be made. It doesn't assert that a USDC transfer with USDC as fee currency can be made. Moved this test into the CIP-64 block for ease of reference.
Commenting this out for the time being, because the tests are not relevant with Celo Legacy transactions deprecated.
Adds tests to assert code changes in the library will generate actively supported transaction types. The tests are not perfect, and need to be polished.
celo-ethers-wrapper/src/lib/transactions.ts Lines 227 to 242 in cb488c6
this default case is for celo type 0. it must go. what options do we have as an alternative default.
|
Note-to-self: When a transaction only specifies
For example: const txResponse = await signer.sendTransaction({
to: signer.address,
value: 1n,
feeCurrency: USDC_ADAPTER_ALFAJORES_ADDRESS,
}); At the moment, it's (1.), it drops |
That's done in c888262, I hadn't pushed my changes yet. |
Replaces it with Ethereum legacy tx type (0) at the moment. I left a note about my current thinking in the code. I'm not sure this is the best/appropriate fall-back option.
Current 2 tests are failing for reasons that are acceptable (type is `0` and not `2`), but Ethereum-compatible. So making sure the transactions are type `2` instead of `0` is a "nice to have". There is a nonce related bug that only occurs when I run the entire test suite. Otherwise, the test doesn't fail. It's a flakey test.
- moves tests from `deploy.test.ts` to `transfer.test.ts` - renames file from `transfer.test.ts` to `transactions.test.ts` I moved the tests into a single file, because running them concurrently made the tests flakey. Specifically either the contract deployment or the first transfer test would fail because of a nonce issue. I expect it's because both tests query `eth_getTransactionCount` and get the same result milliseconds apart. So they submit transactions with the same nonce.
At this point, the main code changes are made:
There are a couple outstanding (potential) issues:
|
asserts it's EIP1559, but fails at `ethCompatible`
ethCompatible flag is only every true for legacy txs (where we need it to tell Celo and Ethereum legacy txs apart). Type 2 txs are Ethereum compatible by definition. So testing the `type` is sufficient to infer Ethereum-compatibility.
Based on the response from the Blockchain team, it's expected that For that reason, I removed the |
This is done ✅ As of ed7dfbe and c48bd5e, Ethereum-compatible transactions are EIP-1559 (type |
Thanks @arthurgousset @aaronmgdr for your great work on this! |
Sounds good, I'll let you know when it's ready @jmrossy 👍 |
except for the conversation about gas price. all other files look good to me |
Let's wait for some more guidance and context from the Blockchain team in that case. |
…Price` Also renames gas variables in fee currency case for better readability.
@jmrossy I resolved the fee estimation conversation and committed subsequent changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! These changes look good to me.
The CI is failing but I think it's because PRs from forks can't access the repo secrets (the mnemonic).
If you confirm you're done with your changes, I'll merge this into a feature branch and confirm the CI is still happy.
I'm done with the changes 👍 Let's see what CI says :) |
Description
Goal is to deprecate the Celo legacy transaction type (0).
Context: [Action Required] Celo Legacy TX type deprecation
Changes
gatewayFee
andgatewayFeeRecipient
Other changes
CONTRIBUTING.md
file with instructions for first-time contributors to run tests.env
file and example to run test suite for first-time contributorshistory.test.ts
) related toCeloscanProvider
that were first added here Add CeloscanProvider #8deploy.test.ts
andtransfers.test.ts
in a single filetransactions.test.ts
to prevent flakey tests due to simultaneous nonce fetching and setting.Related