New Feature: Hyperledger Integration (chaincode-fabric-evm) #2149
Conversation
…ffle-deployer/index.js)
…ffle-migrate/index.js)
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.
It's great that the override here is rather tiny! Thanks for all the tests to get things started with good practice.
Mostly my suggestions here are on code organization, since this brings us to three network types.
packages/truffle/test/sources/migrations/fabric-evm/migrations/2_migrations_sync.js
Show resolved
Hide resolved
packages/truffle/test/sources/migrations/fabric-evm/migrations/3_migrations_async.js
Show resolved
Hide resolved
packages/truffle-interface-adapter/test/fabric-evm-getId.test.ts
Outdated
Show resolved
Hide resolved
e2a363c
to
d1e9faa
Compare
c5dc0b4
to
e937b25
Compare
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.
Looks good apart from the one comment!
990c8ce
to
2af8a26
Compare
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.
hooray!
async initNetworkType (web3: Web3Shim) { | ||
// truffle has started expecting gas used/limit to be | ||
// hex strings to support bignumbers for other ledgers | ||
getBlock(web3); |
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.
Naming note here, not to change for this PR, but we might want to fix at some point:
For explicitness purposes, these methods should probably include the word override
or something similar, to convey that it's not that we're getting the block, but we're overriding how we get the block.
An alternative solution would be to abstract this, so that getBlock
, getTransaction
, would be in a mapping, something like:
const overrides = {
"getBlock": (original) => {
const _oldFormatter = original.method.outputFormatter;
original.method.outputFormatter = (block) => {
_oldFormatter.call(original, block);
/* ... */
};
},
/* ... */
}
Just if you want to keep this in the back of your mind for whenever.
@@ -1 +1,5 @@ | |||
export function getSupportedNetworks() { | |||
return ["quorum", "fabric-evm"]; | |||
}; |
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 blocking approval, but I think we should fix the name here to reflect that this specifically relates to which network types use the legacy system. Maybe getLegacyNetworkTypes
.
Ooh, we could take this a step further! We can add requiresLegacySystem
as a boolean field on the Definition objects, and that way it becomes a lot more cohesive when adding a new network. Basically, just these steps:
- Create an overrides file + definition
- Import the definition and link it up in the web3-shim module
This PR builds on top of prior work in #1806 to implement
chaincode-fabric-evm
integration.⛓
Example
truffle-config.js
for using Truffle withchaincode-fabric-evm
: