Giter Site home page Giter Site logo

2023-01-blockswap-fv's People

Contributors

teryanarmen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

2023-01-blockswap-fv's Issues

[informational] incorrect error thrown

In _registerKnotsToSyndicate the following line seems to throw the wrong error:

            if (getSlotRegistry().currentSlashedAmountOfSLOTForKnot(blsKey.unwrap(blsPubKey)) != 0) revert InvalidNumberOfCollateralizedOwners();

I think it should be throwing KnotSlashed

[informational] strange duplicate check in _addPriorityStakers

There is a check for duplicates in _addPriorityStakers:

    function _addPriorityStakers(address[] memory _priorityStakers) internal {
        uint256 numOfStakers = _priorityStakers.length;
        if (numOfStakers == 0) revert EmptyArray();
        for (uint256 i; i < numOfStakers; ++i) {
            address staker = _priorityStakers[i];

            if (i > 0 && staker < _priorityStakers[i-1]) revert DuplicateArrayElements();

            isPriorityStaker[staker] = true;

            emit PriorityStakerRegistered(staker);
        }
    }

This seems strange because a) if there are duplicates there is no harm caused to the contract because the mapping is just changed twice to true in the same place, b) the check will not catch all duplicates since it uses strict less than as apposed to <=.

Example array with duplicates that will not end in a revert:

[0x1, 0x1]

This duplicate check also makes the life of the caller unnecessarily difficult because they have to sort their array of addresses, which could be an expensive operation if the caller is another contract.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.