How to prevent selfdestruct from another contractHow to prevent an attack on a contract creation serviceContract calling another contractWill contract selfdestruct also return tokens?how to call one contract function into another contractThis contract does not implement all functions and thus cannot be createdWhat is a standard implementation of upgradable ethereum Token contractIf a contract's function calls a function of another contract within it, is the address of the contract the msg.sender?Is it possible to run out of gas in a method before reaching the self-destruct call?msg.sender problem for calling ERC20 token contract from another contractremix ERC223: This contract does not implement all functions and thus cannot be created

What environment would goblins be best adapted for?

Is this story about US tax office reasonable?

Break equation in parts

What is a subpixel in Super Mario Bros, and how does it relate to wall clipping?

Crossword gone overboard

Inverter Power draw from 12V battery

What's the connection between "kicking a pigeon" and "how a bill becomes a law"?

Ticket sales for Queen at the Live Aid

Why does the 6502 have the BIT instruction?

Is it possible to change original filename of an exe?

Black-and-white film where monster/alien gets fried

Do firearms count as ranged weapons?

How do I subvert the tropes of a train heist?

Can a non-EU citizen travel within schengen zone freely without passport?

If a massive object like Jupiter flew past the Earth how close would it need to come to pull people off of the surface?

Tic-Tac-Toe for the terminal

Canon 70D often overexposing or underexposing shots

Where do I put diamond mines on my map?

A Mathematical Discussion: Fill in the Blank

What caused the tendency for conservatives to not support climate change reform?

Is it ok to put a subplot to a story that is never meant to contribute to the development of the main plot?

Modern approach to radio buttons

Future enhancements for the finite element method

Smart people send dumb people to a new planet on a space craft that crashes into a body of water



How to prevent selfdestruct from another contract


How to prevent an attack on a contract creation serviceContract calling another contractWill contract selfdestruct also return tokens?how to call one contract function into another contractThis contract does not implement all functions and thus cannot be createdWhat is a standard implementation of upgradable ethereum Token contractIf a contract's function calls a function of another contract within it, is the address of the contract the msg.sender?Is it possible to run out of gas in a method before reaching the self-destruct call?msg.sender problem for calling ERC20 token contract from another contractremix ERC223: This contract does not implement all functions and thus cannot be created













1















I have a contract A calling another contract B



Contract A



contract A 

function sendValue(B _externalContract, uint _value)
_externalContract.acceptValue(_value);



contract B
function acceptValue(unit value);



Contract B (contract A expect contract B acceptValue to be safe)



 contract B 
function acceptValue(unit _value)
dosomethingWith(_value)




If a malicious user now design contract B function acceptValue to self destruct like so



Contract B



 contract B 
function acceptValue(unit _value)
selfdestruct(msg.sender);




  • Will that function destroy my contract A or malicious user Contract B?

  • Is there a check I can perform in contract A sendValue to prevent that?









share|improve this question


























    1















    I have a contract A calling another contract B



    Contract A



    contract A 

    function sendValue(B _externalContract, uint _value)
    _externalContract.acceptValue(_value);



    contract B
    function acceptValue(unit value);



    Contract B (contract A expect contract B acceptValue to be safe)



     contract B 
    function acceptValue(unit _value)
    dosomethingWith(_value)




    If a malicious user now design contract B function acceptValue to self destruct like so



    Contract B



     contract B 
    function acceptValue(unit _value)
    selfdestruct(msg.sender);




    • Will that function destroy my contract A or malicious user Contract B?

    • Is there a check I can perform in contract A sendValue to prevent that?









    share|improve this question
























      1












      1








      1








      I have a contract A calling another contract B



      Contract A



      contract A 

      function sendValue(B _externalContract, uint _value)
      _externalContract.acceptValue(_value);



      contract B
      function acceptValue(unit value);



      Contract B (contract A expect contract B acceptValue to be safe)



       contract B 
      function acceptValue(unit _value)
      dosomethingWith(_value)




      If a malicious user now design contract B function acceptValue to self destruct like so



      Contract B



       contract B 
      function acceptValue(unit _value)
      selfdestruct(msg.sender);




      • Will that function destroy my contract A or malicious user Contract B?

      • Is there a check I can perform in contract A sendValue to prevent that?









      share|improve this question














      I have a contract A calling another contract B



      Contract A



      contract A 

      function sendValue(B _externalContract, uint _value)
      _externalContract.acceptValue(_value);



      contract B
      function acceptValue(unit value);



      Contract B (contract A expect contract B acceptValue to be safe)



       contract B 
      function acceptValue(unit _value)
      dosomethingWith(_value)




      If a malicious user now design contract B function acceptValue to self destruct like so



      Contract B



       contract B 
      function acceptValue(unit _value)
      selfdestruct(msg.sender);




      • Will that function destroy my contract A or malicious user Contract B?

      • Is there a check I can perform in contract A sendValue to prevent that?






      solidity contract-development contract-design






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 13 at 14:14









      AbkAbk

      1083




      1083




















          1 Answer
          1






          active

          oldest

          votes


















          3














          It destroys Contract B and sends B's Eth balance to contract A, if called from A.



          There is no way B can destroy A. Otherwise, there would be chaos.



          Hope it helps.






          share|improve this answer























          • Thanks for the answer. It helps a lot.

            – Abk
            Apr 13 at 17:53











          • My pleasure. Thanks for accepting my answer.

            – Rob Hitchens
            Apr 14 at 2:46











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "642"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fethereum.stackexchange.com%2fquestions%2f69620%2fhow-to-prevent-selfdestruct-from-another-contract%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          It destroys Contract B and sends B's Eth balance to contract A, if called from A.



          There is no way B can destroy A. Otherwise, there would be chaos.



          Hope it helps.






          share|improve this answer























          • Thanks for the answer. It helps a lot.

            – Abk
            Apr 13 at 17:53











          • My pleasure. Thanks for accepting my answer.

            – Rob Hitchens
            Apr 14 at 2:46















          3














          It destroys Contract B and sends B's Eth balance to contract A, if called from A.



          There is no way B can destroy A. Otherwise, there would be chaos.



          Hope it helps.






          share|improve this answer























          • Thanks for the answer. It helps a lot.

            – Abk
            Apr 13 at 17:53











          • My pleasure. Thanks for accepting my answer.

            – Rob Hitchens
            Apr 14 at 2:46













          3












          3








          3







          It destroys Contract B and sends B's Eth balance to contract A, if called from A.



          There is no way B can destroy A. Otherwise, there would be chaos.



          Hope it helps.






          share|improve this answer













          It destroys Contract B and sends B's Eth balance to contract A, if called from A.



          There is no way B can destroy A. Otherwise, there would be chaos.



          Hope it helps.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 13 at 14:50









          Rob HitchensRob Hitchens

          30.2k74585




          30.2k74585












          • Thanks for the answer. It helps a lot.

            – Abk
            Apr 13 at 17:53











          • My pleasure. Thanks for accepting my answer.

            – Rob Hitchens
            Apr 14 at 2:46

















          • Thanks for the answer. It helps a lot.

            – Abk
            Apr 13 at 17:53











          • My pleasure. Thanks for accepting my answer.

            – Rob Hitchens
            Apr 14 at 2:46
















          Thanks for the answer. It helps a lot.

          – Abk
          Apr 13 at 17:53





          Thanks for the answer. It helps a lot.

          – Abk
          Apr 13 at 17:53













          My pleasure. Thanks for accepting my answer.

          – Rob Hitchens
          Apr 14 at 2:46





          My pleasure. Thanks for accepting my answer.

          – Rob Hitchens
          Apr 14 at 2:46

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Ethereum Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fethereum.stackexchange.com%2fquestions%2f69620%2fhow-to-prevent-selfdestruct-from-another-contract%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Tamil (spriik) Luke uk diar | Nawigatjuun

          Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

          Training a classifier when some of the features are unknownWhy does Gradient Boosting regression predict negative values when there are no negative y-values in my training set?How to improve an existing (trained) classifier?What is effect when I set up some self defined predisctor variables?Why Matlab neural network classification returns decimal values on prediction dataset?Fitting and transforming text data in training, testing, and validation setsHow to quantify the performance of the classifier (multi-class SVM) using the test data?How do I control for some patients providing multiple samples in my training data?Training and Test setTraining a convolutional neural network for image denoising in MatlabShouldn't an autoencoder with #(neurons in hidden layer) = #(neurons in input layer) be “perfect”?