-
Notifications
You must be signed in to change notification settings - Fork 46
Order ABI correctly in multi-contract files #45
Conversation
|
||
it("orders the complex ABI", function(){ | ||
var expectedOrder = ['LogB', 'LogA', 'LogD', 'LogC', 'theFirst', 'second', 'andThird']; | ||
var sources = {}; |
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.
This is a little confusing. . . i.e not sure events are contributing to clarity of this test.
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.
Love the additional comments (also the tests!)
// AST can have multiple contract definitions, make sure we have the | ||
// one that matches our contract | ||
if (definition.name !== "ContractDefinition" || | ||
definition.attributes.name !== contract.contract_name){ |
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.
Maybe contract.contractName
cause snake case is deprecated in truffle-contract-schema
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 catch and agree but will revisit in a separate PR because contract_name
all over the place in this file and need to investigate the full implications of upgrading here.
Addresses truffle 812
While processing the AST to identify
ContractDefinitions
, we have to make sure a given definition node matches the contract name. Solc produces an AST that lays out all the contracts in a file adjacently but only one of these belongs to the contract in question.Re-factored the tests so that we have examples of single contract files, multi-contract files and inheritance from an imported file.