1

I get a huge error message (~1MB) starting with

Error: invalid address (arg="_readAccess", coderType="address", value={"constructor":{"contractName":"SenderAccess","abi":[...

when executing a test written in TypeScript:

it("should be possible to create such an option", async () => {
    const accessControl = await SenderAccess.new(); // OK
    const validator = await NumberRangeValidation.new(1, 5); // OK
    // This will crash
    const option = await NumberConfigOptionDefinition.new('foo.bar.baz', accessControl, accessControl, validator);
});

The contract looks like this:

contract NumberConfigOptionDefinition is ConfigOptionDefinition {
    NumberValidation public validator;

    constructor(string memory _name, AccessControl _readAccess, AccessControl _writeAccess, NumberValidation _validator)
        ConfigOptionDefinition(_name, _readAccess, _writeAccess) public {
        validator = _validator;
    }
}

contract ConfigOptionDefinition {
    ... fields ...

    constructor(string memory _name, AccessControl _readAccess, AccessControl _writeAccess) internal {
        name = _name;
        readAccess = _readAccess;
        writeAccess = _writeAccess;
    }

What did I do wrong?

  • Can you console log the content of the accessControl variable? – wtk219 Nov 22 '19 at 18:36
0

Change this:

const option = await NumberConfigOptionDefinition.new(
    'foo.bar.baz',
    accessControl,
    accessControl,
    validator
);

To this:

const option = await NumberConfigOptionDefinition.new(
    'foo.bar.baz',
    accessControl.address,
    accessControl.address,
    validator.address
);
| improve this answer | |
  • Now it starts to make sense: The huge dump is actually the JavaScript representation of the contract object! Thanks. – Aaron Digulla Nov 27 '19 at 13:42
  • @AaronDigulla: You're welcome. – goodvibration Nov 27 '19 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.