elective-stereophonic
elective-stereophonic
Infinite Loops in smart contracts! singapore
Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest Nxt Client: Nxt 1.11.15

Author Topic: Infinite Loops in smart contracts!  (Read 2460 times)

colin012

  • Hero Member
  • *****
  • Karma: +65/-18
  • Offline Offline
  • Posts: 851
  • NXTOrganization Marketing
    • View Profile
Infinite Loops in smart contracts!
« on: December 01, 2014, 05:06:26 pm »

The biggest potential problem I see with Smart Contracts is that someone could break the NXT blockchain by making an SC containing an infinite loop, either on purpose or by mistake. Is there any current plan to prevent this? Perhaps an infinite loop detector (which would need a lot of testing to make sure nothing slips past it)? Or maybe simply a loop limiter? Only allowing a loop to execute a certain number of times. Of course, this could be a problem if someone maliciously puts a bunch of loops inside of loops to slow down the execution of new blocks and cause problems for people who run nodes... So I suppose there will also need to be a limit to loop depth or something counter that gets added to every time any loop goes through so that the total number of all loop executions is limited somehow.

Or you could just not allow loops at all but that would be inconvienet for SC coders.
Logged
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬  ▄▀▀▀▀▀▀▀▀▄  ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬●  nimirum  ●▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
▬▬▬ ◖ENDING CENSORSHIP ONLINE◗  ◖ ICO OPEN NOW◗ ▬▬▬

Come-from-Beyond

  • Hero Member
  • *****
  • Karma: +794/-671
  • Offline Offline
  • Posts: 4013
    • View Profile
Re: Infinite Loops in smart contracts!
« Reply #1 on: December 01, 2014, 05:14:19 pm »

The biggest potential problem I see with Smart Contracts is that someone could break the NXT blockchain by making an SC containing an infinite loop, either on purpose or by mistake. Is there any current plan to prevent this? Perhaps an infinite loop detector (which would need a lot of testing to make sure nothing slips past it)? Or maybe simply a loop limiter? Only allowing a loop to execute a certain number of times. Of course, this could be a problem if someone maliciously puts a bunch of loops inside of loops to slow down the execution of new blocks and cause problems for people who run nodes... So I suppose there will also need to be a limit to loop depth or something counter that gets added to every time any loop goes through so that the total number of all loop executions is limited somehow.

Or you could just not allow loops at all but that would be inconvienet for SC coders.

Nxt SC language doesn't have loops.
Logged

Fatih87SK

  • Hero Member
  • *****
  • Karma: +127/-36
  • Offline Offline
  • Posts: 2206
    • View Profile
Re: Infinite Loops in smart contracts!
« Reply #2 on: December 01, 2014, 05:37:42 pm »

We will release Super Smart Contracts.
Logged

Come-from-Beyond

  • Hero Member
  • *****
  • Karma: +794/-671
  • Offline Offline
  • Posts: 4013
    • View Profile
Re: Infinite Loops in smart contracts!
« Reply #3 on: December 01, 2014, 05:44:13 pm »

We will release Super Smart Contracts.

With superloops, I hope...
Logged

colin012

  • Hero Member
  • *****
  • Karma: +65/-18
  • Offline Offline
  • Posts: 851
  • NXTOrganization Marketing
    • View Profile
Re: Infinite Loops in smart contracts!
« Reply #4 on: December 01, 2014, 06:46:30 pm »

Nxt SC language doesn't have loops.

I suppose it is possible to do things without loops so long as you can anticipate everything people would want loops for (e.g. iterating through accounts, assets, blocks, or transactions and performing a function for each).

Actually, come to think about it, I don't know any other reason someone would want a loop for Smart Contracts. Maybe you can limit SC language to performing iteration loops (sometime called enhanced-for loops or for-each loops). That should prevent infinate looping but still allow devs the freedom to loop.
Logged
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬  ▄▀▀▀▀▀▀▀▀▄  ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬●  nimirum  ●▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
▬▬▬ ◖ENDING CENSORSHIP ONLINE◗  ◖ ICO OPEN NOW◗ ▬▬▬

Come-from-Beyond

  • Hero Member
  • *****
  • Karma: +794/-671
  • Offline Offline
  • Posts: 4013
    • View Profile
Re: Infinite Loops in smart contracts!
« Reply #5 on: December 01, 2014, 08:33:04 pm »

I suppose it is possible to do things without loops so long as you can anticipate everything people would want loops for (e.g. iterating through accounts, assets, blocks, or transactions and performing a function for each).

Actually, come to think about it, I don't know any other reason someone would want a loop for Smart Contracts. Maybe you can limit SC language to performing iteration loops (sometime called enhanced-for loops or for-each loops). That should prevent infinate looping but still allow devs the freedom to loop.

Nxt SC work with sets. Loops hardly needed in parallel processing.
Logged

Daedelus

  • Hero Member
  • *****
  • Karma: +230/-12
  • Offline Offline
  • Posts: 3280
    • View Profile
Re: Infinite Loops in smart contracts!
« Reply #6 on: December 10, 2014, 01:55:47 pm »

I suppose it is possible to do things without loops so long as you can anticipate everything people would want loops for (e.g. iterating through accounts, assets, blocks, or transactions and performing a function for each).

Actually, come to think about it, I don't know any other reason someone would want a loop for Smart Contracts. Maybe you can limit SC language to performing iteration loops (sometime called enhanced-for loops or for-each loops). That should prevent infinate looping but still allow devs the freedom to loop.

Nxt SC work with sets. Loops hardly needed in parallel processing.

You are talking about ternary processing/Jinn/IoT here?

So Nxt Smart Contracts are designed to be executed across Jinn?
Logged
NXT: NXT-4CS7-S4N5-PTH5-A8R2Q

Come-from-Beyond

  • Hero Member
  • *****
  • Karma: +794/-671
  • Offline Offline
  • Posts: 4013
    • View Profile
Re: Infinite Loops in smart contracts!
« Reply #7 on: December 10, 2014, 02:22:38 pm »

You are talking about ternary processing/Jinn/IoT here?

So Nxt Smart Contracts are designed to be executed across Jinn?

Jinn can do it but is not required.
Logged

youyou

  • Sr. Member
  • ****
  • Karma: +44/-46
  • Offline Offline
  • Posts: 472
    • View Profile
Re: Infinite Loops in smart contracts!
« Reply #8 on: December 10, 2014, 02:28:56 pm »

You are talking about ternary processing/Jinn/IoT here?

So Nxt Smart Contracts are designed to be executed across Jinn?

Jinn can do it but is not required.

can jinn improve this?
Logged

Come-from-Beyond

  • Hero Member
  • *****
  • Karma: +794/-671
  • Offline Offline
  • Posts: 4013
    • View Profile
Re: Infinite Loops in smart contracts!
« Reply #9 on: December 10, 2014, 02:38:38 pm »

can jinn improve this?

Yes, everything that can be parallelized can be improved by Jinn.
Logged

Brangdon

  • Hero Member
  • *****
  • Karma: +229/-25
  • Offline Offline
  • Posts: 1389
  • Quality is addictive.
    • View Profile
Re: Infinite Loops in smart contracts!
« Reply #10 on: December 22, 2014, 02:53:05 pm »

We will release Super Smart Contracts.
There is already a project for Automated Transactions, which includes a Turing Complete language that can do loops. As I understand it, there are limits on how many instructions a script can execute, both in total and in a given block, so attempted infinite loops are cut short before they take infinite resources.

(AT doesn't seem to be going into Nxt core for at least several months, if ever.)
Logged
 

elective-stereophonic
elective-stereophonic
assembly
assembly