Skip to content
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

Cannot use Secp256k1_noconflict: code is outdated #11

Open
kCox96 opened this issue Apr 22, 2020 · 0 comments
Open

Cannot use Secp256k1_noconflict: code is outdated #11

kCox96 opened this issue Apr 22, 2020 · 0 comments

Comments

@kCox96
Copy link

kCox96 commented Apr 22, 2020

Hello,

I'm currently working on a project of which the aim is to update some smart contracts to prevent clouds from colluding to save computational power in a replication-based approach. The project uses the ECCMath_noconflict.sol and Secp256k1_noconflict.sol contracts to provide cryptography to make sure all transactions are secure and private. I have managed to update the ECCMath_noconflict.sol file so that the code alligns with the updates in Solidity 0.5.0, however, I am having issues updating Secp256k1_noconflict.sol. I have two main issues; the first being the use of empty return statements which is now disallowed in more recent versions of solidity:
function _mul(uint d, uint[2] memory P) internal view returns (uint[3] memory Q) { uint p = pp; if (d == 0) {} // TODO return; uint dwPtr; // points to array of NAF coefficients. uint i;
this function returns if d == 0, however, this is now disallowed and I'm not sure how to reformat.
The second issue is the use of loops and labels in the following inline assembly code:

loop: jumpi(loop_end, iszero(d)) jumpi(even, iszero(and(d, 1))) dm := mod(d, 32) mstore8(add(dwPtr, i), dm) // Don"t store as signed - convert when reading. d := add(sub(d, dm), mul(gt(dm, 16), 32)) even: d := div(d, 2) i := add(i, 1) jump(loop) loop_end:

labels are now disallowed in the more recent solidity versions and I'm struggling to get around this. I rewrote the code like this:

`for { } gt(d, 0) {

              if iszero(and(d,1)) {
                d:= div(d,2)
                i:= add(i,1)
              }

                mstore8(add(dwPtr, i), dm) // Don"t store as signed - convert when reading.
                d := add(sub(d, dm), mul(gt(dm, 16), 32))`

but it was just met with errors.

Would anyone be able to point me in the right direction for updating this code so that it complies with the Solidity 0.5.0 updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant