-
Notifications
You must be signed in to change notification settings - Fork 285
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
feat(cactus-plugin-ledger-connector-ethereum): add new connector plugin #2535
Conversation
const methodRef = contractInstance.methods[req.methodName]; | ||
Checks.truthy(methodRef, `${fnTag} YourContract.${req.methodName}`); | ||
|
||
const method: ContractSendMethod = methodRef(...req.params); |
Check failure
Code scanning / CodeQL
Unvalidated dynamic method call
} | ||
|
||
const web3MethodArgs = args.params || []; | ||
return looseWeb3Eth[args.methodName](...web3MethodArgs); |
Check failure
Code scanning / CodeQL
Unvalidated dynamic method call
); | ||
} | ||
|
||
return contract.methods[args.contractMethod](...contractMethodArgs)[ |
Check failure
Code scanning / CodeQL
Unvalidated dynamic method call
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.
@outSH Looks legit, I just have some notes regarding 2 other PRs in parallel:
- Is upgrading web3 project-wide to a newer version than what you are using here so please be on guard about that getting merged first (if it does - I don't know for sure it will)
- There's another PR in parallel also, the one with the yarn v3 upgrade and so far it is looking like we'll have to move away from hoisting completely because of the way it makes a lot of hard to debug bugs very easy to create the way you are also explaining it in your PR description.
@petermetz Thanks! ad1. You mean https://github.com/hyperledger/cacti/pull/2550? I'm updating to more recent one here (1.10 > 1.6.1). Either way, if I filled all missing web3 packages we should be good to go but I'll retest it when the PR you mentioned is merged :) |
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.
LGTM
@petermetz @izuru0 Just a quick note - I plan on changing the connector API during the web3js update (that I'm currently working on), so please don't merge it until release 2.0 (if that would make my future PR problematic). Ideally, I'd like to mark this connector as "API unstable" in README and make API breaking changes until futher notice but not sure if you'd agree on that :) |
@outSH Oh, my bad, I was looking at some other part of the diff and saw 1.5.2 [1] but I see now that you just did that because that was the version in those packages. Alright, we'll make it work one way or another, whoever merges second will need a little update on the versions to make sure it's all good. No action necessary, just raising awareness for now. |
The easiest way for me to handle that is to put this in draft state and then we can keep it open as long as you like. I'll put a 'change request' on this just to stop us from accidentally merging it because it's been already approved so I was about to merge it before you made that comment! If you want to avoid keeping this one open for long and then spend time rebasing then there are a couple more options that I can think of:
|
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.
Not an actual change request. I'm just blocking the merge for now. See the discussion above for details.
a29b8b9
to
1a475cb
Compare
- Update web3js packages from 1.10 to 4.0.3 in `cactus-plugin-ledger-connector-ethereum` and `cactus-test-plugin-ledger-connector-ethereum`. This allows interacting with most recent geth nodes. - Refactor all ethereum tests. Most of the test cases were duplicated multiple times (between different quorum ledger versions test and deployment methods). I've removed all this duplication while maintaining similar level of test coverage. New tests use Geth test ledger instead of Quorum one. - Add web3js type conversions methods to minimize impact of poor dynamic typing in this early release of 4.X. - Update API. In 4.X all numeric responses has been converted to BigNum. To keep up with this some fields has been changed to string instead of number when necessary. Add some missing fields as well. - Add `estimateMaxFeePerGas` method for estimating current transaction cost. - Fix invalid `runTransact` response type. - Add test script for checking integration with Alchemy that must be executed manually (it's excluded from CI at the moment) - `geth-alchemy-integration-manual-check.test`. Instructions on how to run it has been added to package README. Future improvements: - Support London fork gas fees (i.e. EIP-1559) - Refactor API to allow future extensions. - Fix several TODO items in this connector. Closes: hyperledger-cacti#2580 Depends on hyperledger-cacti#2535 Depends on hyperledger-cacti#2578 Signed-off-by: Michal Bajer <michal.bajer@fujitsu.com>
- Update web3js packages from 1.10 to 4.0.3 in `cactus-plugin-ledger-connector-ethereum` and `cactus-test-plugin-ledger-connector-ethereum`. This allows interacting with most recent geth nodes. - Refactor all ethereum tests. Most of the test cases were duplicated multiple times (between different quorum ledger versions test and deployment methods). I've removed all this duplication while maintaining similar level of test coverage. New tests use Geth test ledger instead of Quorum one. - Add web3js type conversions methods to minimize impact of poor dynamic typing in this early release of 4.X. - Update API. In 4.X all numeric responses has been converted to BigNum. To keep up with this some fields has been changed to string instead of number when necessary. Add some missing fields as well. - Add `estimateMaxFeePerGas` method for estimating current transaction cost. - Fix invalid `runTransact` response type. - Add test script for checking integration with Alchemy that must be executed manually (it's excluded from CI at the moment) - `geth-alchemy-integration-manual-check.test`. Instructions on how to run it has been added to package README. Future improvements: - Support London fork gas fees (i.e. EIP-1559) - Refactor API to allow future extensions. - Fix several TODO items in this connector. Closes: hyperledger-cacti#2580 Depends on hyperledger-cacti#2535 Depends on hyperledger-cacti#2578 Signed-off-by: Michal Bajer <michal.bajer@fujitsu.com>
- Update web3js packages from 1.10 to 4.0.3 in `cactus-plugin-ledger-connector-ethereum` and `cactus-test-plugin-ledger-connector-ethereum`. This allows interacting with most recent geth nodes. - Refactor all ethereum tests. Most of the test cases were duplicated multiple times (between different quorum ledger versions test and deployment methods). I've removed all this duplication while maintaining similar level of test coverage. New tests use Geth test ledger instead of Quorum one. - Add web3js type conversions methods to minimize impact of poor dynamic typing in this early release of 4.X. - Update API. In 4.X all numeric responses has been converted to BigNum. To keep up with this some fields has been changed to string instead of number when necessary. Add some missing fields as well. - Add `estimateMaxFeePerGas` method for estimating current transaction cost. - Fix invalid `runTransact` response type. - Add test script for checking integration with Alchemy that must be executed manually (it's excluded from CI at the moment) - `geth-alchemy-integration-manual-check.test`. Instructions on how to run it has been added to package README. Future improvements: - Support London fork gas fees (i.e. EIP-1559) - Refactor API to allow future extensions. - Fix several TODO items in this connector. Closes: hyperledger-cacti#2580 Depends on hyperledger-cacti#2535 Depends on hyperledger-cacti#2578 Signed-off-by: Michal Bajer <michal.bajer@fujitsu.com>
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.
LGTM, not approving for the same reasons as @petermetz mentioned
- Update web3js packages from 1.10 to 4.0.3 in `cactus-plugin-ledger-connector-ethereum` and `cactus-test-plugin-ledger-connector-ethereum`. This allows interacting with most recent geth nodes. - Refactor all ethereum tests. Most of the test cases were duplicated multiple times (between different quorum ledger versions test and deployment methods). I've removed all this duplication while maintaining similar level of test coverage. New tests use Geth test ledger instead of Quorum one. - Add web3js type conversions methods to minimize impact of poor dynamic typing in this early release of 4.X. - Update API. In 4.X all numeric responses has been converted to BigNum. To keep up with this some fields has been changed to string instead of number when necessary. Add some missing fields as well. - Add `estimateMaxFeePerGas` method for estimating current transaction cost. - Fix invalid `runTransact` response type. - Add test script for checking integration with Alchemy that must be executed manually (it's excluded from CI at the moment) - `geth-alchemy-integration-manual-check.test`. Instructions on how to run it has been added to package README. Future improvements: - Support London fork gas fees (i.e. EIP-1559) - Refactor API to allow future extensions. - Fix several TODO items in this connector. Closes: hyperledger-cacti#2580 Depends on hyperledger-cacti#2535 Depends on hyperledger-cacti#2578 Signed-off-by: Michal Bajer <michal.bajer@fujitsu.com>
- Update web3js packages from 1.10 to 4.0.3 in `cactus-plugin-ledger-connector-ethereum` and `cactus-test-plugin-ledger-connector-ethereum`. This allows interacting with most recent geth nodes. - Refactor all ethereum tests. Most of the test cases were duplicated multiple times (between different quorum ledger versions test and deployment methods). I've removed all this duplication while maintaining similar level of test coverage. New tests use Geth test ledger instead of Quorum one. - Add web3js type conversions methods to minimize impact of poor dynamic typing in this early release of 4.X. - Update API. In 4.X all numeric responses has been converted to BigNum. To keep up with this some fields has been changed to string instead of number when necessary. Add some missing fields as well. - Add `estimateMaxFeePerGas` method for estimating current transaction cost. - Fix invalid `runTransact` response type. - Add test script for checking integration with Alchemy that must be executed manually (it's excluded from CI at the moment) - `geth-alchemy-integration-manual-check.test`. Instructions on how to run it has been added to package README. Future improvements: - Support London fork gas fees (i.e. EIP-1559) - Refactor API to allow future extensions. - Fix several TODO items in this connector. Closes: hyperledger-cacti#2580 Depends on hyperledger-cacti#2535 Depends on hyperledger-cacti#2578 Signed-off-by: Michal Bajer <michal.bajer@fujitsu.com>
@petermetz |
@outSH
Yes! They all can and should in my opinion because we opened up the main branch for breaking changes as of last week => meaning that there will be no more 1.x releases (from the main branch) issued anymore so we can start making all the breaking changes that we've been holding off until now. |
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.
Approving now since we are ready to go! Thanks again @outSH !
1a475cb
to
cd3a9d8
Compare
FYI: I dismissed the false-positive CodeQL alerts because we do have our own runtime checks in place to make sure that there are no invalid method names provided when calling contract methods. |
cd3a9d8
to
bc7d96f
Compare
Add new plugin for connecting with Ethereum ledgers. New connector is based on already existing quorum connector. The main reason for introducing yet another plugin is a need for web3js upgrade (to 4.X) which is imposible in current quorum / besu connectors due to dependency to `web3js-quorum` which requires web3js 1.X. We have plans to make web3js library pluggable and reduce code duplication among other connectors in the future, but it will be delivered later on in a separate PR. Changes: - Add new plugin based on quorum connector. - Removed private transaction and other quorum related functionalities. - Update web3js to 1.10 - will be updated to 4.X in a separate commit. - Add missing `web3-eth-contract` dependencies to besu and xdai connectors. - Add new connector to cactus-verifier-client - Add integration tests in `cactus-test-plugin-ledger-connector-ethereum` (based on similar ones for quorum connector.) - Add new connector to CI. - Add `web3*` 4.1.1 dependencies to root `package.json` because they are already required in a root level (by `typings/web3js-quorum`). Ideally this could be put into another package (quorum connector?) and have the dependencies there, but for now I think it's important to be explicit about it since it's easy to mess up if wrong web3js library is hoisted up from any monorepo package. - Sort main `package.json` - Remove tap test scripts from the root `package.json` - they don't use `.taprc` and cause bunch of errors when they try to execute jest tests. This is confusing for the users because of all false negative errors printed. - Reorganize jest config and taprc to keep tests from quorum and ethereum conenctors grouped. Peter's tweaks: 1. Switched the root's web3 dependencies from 1.5.2 to 4.1.1 because in the meantime we've done a few upgrades (plus the old versions come with CVEs) 2. There is no more hoisting, it's been completely disabled, so we should not have any more issues regarding that. It is still true however, that the root folder has our handwritten type definitions which do import web3 packages and therefore the root should declare web3 as a dependency. 3. Once https://github.com/hyperledger/cacti/issues/2648 has been resolved we can remove both the root dependency declarations of web3 and the typings that necessitate them to begin with. Closes: hyperledger-cacti#2534 Co-authored-by: Peter Somogyvari <peter.somogyvari@accenture.com> Signed-off-by: Michal Bajer <michal.bajer@fujitsu.com> Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
bc7d96f
to
c011c36
Compare
- Update web3js packages from 1.10 to 4.0.3 in `cactus-plugin-ledger-connector-ethereum` and `cactus-test-plugin-ledger-connector-ethereum`. This allows interacting with most recent geth nodes. - Refactor all ethereum tests. Most of the test cases were duplicated multiple times (between different quorum ledger versions test and deployment methods). I've removed all this duplication while maintaining similar level of test coverage. New tests use Geth test ledger instead of Quorum one. - Add web3js type conversions methods to minimize impact of poor dynamic typing in this early release of 4.X. - Update API. In 4.X all numeric responses has been converted to BigNum. To keep up with this some fields has been changed to string instead of number when necessary. Add some missing fields as well. - Add `estimateMaxFeePerGas` method for estimating current transaction cost. - Fix invalid `runTransact` response type. - Add test script for checking integration with Alchemy that must be executed manually (it's excluded from CI at the moment) - `geth-alchemy-integration-manual-check.test`. Instructions on how to run it has been added to package README. Closes: hyperledger-cacti#2580 Depends on hyperledger-cacti#2535 Depends on hyperledger-cacti#2578 Signed-off-by: Michal Bajer <michal.bajer@fujitsu.com>
- Update web3js packages from 1.10 to 4.0.3 in `cactus-plugin-ledger-connector-ethereum` and `cactus-test-plugin-ledger-connector-ethereum`. This allows interacting with most recent geth nodes. - Refactor all ethereum tests. Most of the test cases were duplicated multiple times (between different quorum ledger versions test and deployment methods). I've removed all this duplication while maintaining similar level of test coverage. New tests use Geth test ledger instead of Quorum one. - Add web3js type conversions methods to minimize impact of poor dynamic typing in this early release of 4.X. - Update API. In 4.X all numeric responses has been converted to BigNum. To keep up with this some fields has been changed to string instead of number when necessary. Add some missing fields as well. - Add `estimateMaxFeePerGas` method for estimating current transaction cost. - Fix invalid `runTransact` response type. - Add test script for checking integration with Alchemy that must be executed manually (it's excluded from CI at the moment) - `geth-alchemy-integration-manual-check.test`. Instructions on how to run it has been added to package README. Closes: hyperledger-cacti#2580 Depends on hyperledger-cacti#2535 Depends on hyperledger-cacti#2578 Signed-off-by: Michal Bajer <michal.bajer@fujitsu.com>
- Update web3js packages from 1.10 to 4.0.3 in `cactus-plugin-ledger-connector-ethereum` and `cactus-test-plugin-ledger-connector-ethereum`. This allows interacting with most recent geth nodes. - Refactor all ethereum tests. Most of the test cases were duplicated multiple times (between different quorum ledger versions test and deployment methods). I've removed all this duplication while maintaining similar level of test coverage. New tests use Geth test ledger instead of Quorum one. - Add web3js type conversions methods to minimize impact of poor dynamic typing in this early release of 4.X. - Update API. In 4.X all numeric responses has been converted to BigNum. To keep up with this some fields has been changed to string instead of number when necessary. Add some missing fields as well. - Add `estimateMaxFeePerGas` method for estimating current transaction cost. - Fix invalid `runTransact` response type. - Add test script for checking integration with Alchemy that must be executed manually (it's excluded from CI at the moment) - `geth-alchemy-integration-manual-check.test`. Instructions on how to run it has been added to package README. Closes: hyperledger-cacti#2580 Depends on hyperledger-cacti#2535 Depends on hyperledger-cacti#2578 Signed-off-by: Michal Bajer <michal.bajer@fujitsu.com>
- Update web3js packages from 1.10 to 4.0.3 in `cactus-plugin-ledger-connector-ethereum` and `cactus-test-plugin-ledger-connector-ethereum`. This allows interacting with most recent geth nodes. - Refactor all ethereum tests. Most of the test cases were duplicated multiple times (between different quorum ledger versions test and deployment methods). I've removed all this duplication while maintaining similar level of test coverage. New tests use Geth test ledger instead of Quorum one. - Add web3js type conversions methods to minimize impact of poor dynamic typing in this early release of 4.X. - Update API. In 4.X all numeric responses has been converted to BigNum. To keep up with this some fields has been changed to string instead of number when necessary. Add some missing fields as well. - Add `estimateMaxFeePerGas` method for estimating current transaction cost. - Fix invalid `runTransact` response type. - Add test script for checking integration with Alchemy that must be executed manually (it's excluded from CI at the moment) - `geth-alchemy-integration-manual-check.test`. Instructions on how to run it has been added to package README. Closes: hyperledger-cacti#2580 Depends on hyperledger-cacti#2535 Depends on hyperledger-cacti#2578 Co-authored-by: Peter Somogyvari <peter.somogyvari@accenture.com> Signed-off-by: Michal Bajer <michal.bajer@fujitsu.com> Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
- Update web3js packages from 1.10 to 4.0.3 in `cactus-plugin-ledger-connector-ethereum` and `cactus-test-plugin-ledger-connector-ethereum`. This allows interacting with most recent geth nodes. - Refactor all ethereum tests. Most of the test cases were duplicated multiple times (between different quorum ledger versions test and deployment methods). I've removed all this duplication while maintaining similar level of test coverage. New tests use Geth test ledger instead of Quorum one. - Add web3js type conversions methods to minimize impact of poor dynamic typing in this early release of 4.X. - Update API. In 4.X all numeric responses has been converted to BigNum. To keep up with this some fields has been changed to string instead of number when necessary. Add some missing fields as well. - Add `estimateMaxFeePerGas` method for estimating current transaction cost. - Fix invalid `runTransact` response type. - Add test script for checking integration with Alchemy that must be executed manually (it's excluded from CI at the moment) - `geth-alchemy-integration-manual-check.test`. Instructions on how to run it has been added to package README. Closes: #2580 Depends on #2535 Depends on #2578 Co-authored-by: Peter Somogyvari <peter.somogyvari@accenture.com> Signed-off-by: Michal Bajer <michal.bajer@fujitsu.com> Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
- Update web3js packages from 1.10 to 4.0.3 in `cactus-plugin-ledger-connector-ethereum` and `cactus-test-plugin-ledger-connector-ethereum`. This allows interacting with most recent geth nodes. - Refactor all ethereum tests. Most of the test cases were duplicated multiple times (between different quorum ledger versions test and deployment methods). I've removed all this duplication while maintaining similar level of test coverage. New tests use Geth test ledger instead of Quorum one. - Add web3js type conversions methods to minimize impact of poor dynamic typing in this early release of 4.X. - Update API. In 4.X all numeric responses has been converted to BigNum. To keep up with this some fields has been changed to string instead of number when necessary. Add some missing fields as well. - Add `estimateMaxFeePerGas` method for estimating current transaction cost. - Fix invalid `runTransact` response type. - Add test script for checking integration with Alchemy that must be executed manually (it's excluded from CI at the moment) - `geth-alchemy-integration-manual-check.test`. Instructions on how to run it has been added to package README. Closes: hyperledger-cacti#2580 Depends on hyperledger-cacti#2535 Depends on hyperledger-cacti#2578 Co-authored-by: Peter Somogyvari <peter.somogyvari@accenture.com> Signed-off-by: Michal Bajer <michal.bajer@fujitsu.com> Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
Add new plugin for connecting with Ethereum ledgers. New connector is based on already existing quorum connector. The main reason for introducing yet another plugin is a need for web3js upgrade (to 4.X) which is imposible in current quorum / besu connectors due to dependency to
web3js-quorum
which requires web3js 1.X.We have plans to make web3js library pluggable and reduce code duplication among other connectors in the future, but it will be delivered later on in a separate PR.
Changes:
web3-eth-contract
dependencies to besu and xdai connectors.cactus-test-plugin-ledger-connector-ethereum
(based on similar ones for quorum connector.)web3*
1.5.2 dependencies to rootpackage.json
because they are already required in a root level (bytypings/web3js-quorum
). Ideally this could be put into another package (quorum connector?) and have the dependencies there, but for now I think it's important to be explicit about it since it's easy to mess up if wrong web3js library is hoisted up from any monorepo package.package.json
package.json
- they don't use.taprc
and cause bunch of errors when they try to execute jest tests. This is confusing for the users because of all false negative errors printed.Closes: #2534