From 9e7176f6338d1ea1aaa57cf9982a7fd028a72932 Mon Sep 17 00:00:00 2001 From: vub Date: Sun, 15 Nov 2015 22:12:13 -0500 Subject: [PATCH] callcode to delegate call --- EIPS/eip-2.mediawiki | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EIPS/eip-2.mediawiki b/EIPS/eip-2.mediawiki index 6d6a8c3f..752834b4 100644 --- a/EIPS/eip-2.mediawiki +++ b/EIPS/eip-2.mediawiki @@ -15,7 +15,7 @@ If block.number >= HOMESTEAD_FORK_BLKNUM (suggestion: 666000 on liv # Transactions with s-value greater than secp256k1n/2 are now considered invalid. # If contract creation does not have enough gas to pay for the final gas fee for adding the contract code to the state, the contract creation fails (ie. goes out-of-gas) rather than leaving an empty contract. # Change the difficulty adjustment algorithm from the current formula: block_diff = parent_diff + parent_diff // 2048 * (1 if block_timestamp - parent_timestamp < 13 else -1) to block_diff = parent_diff + parent_diff // 2048 * max(1 - 2 * (block_timestamp - parent_timestamp) // 16, -99), where // is the integer division operator, eg. 6 // 2 = 3, 7 // 2 = 3, 8 // 2 = 4 -# In a CALLCODE operation, propagate the sender and value from the parent scope to the child scope. +# Add a new opcode, DELEGATE_CALL at 0xf4, which is te same as CALLCODE except it propagates the sender and value from the parent scope to the child scope. ==Rationale== @@ -39,7 +39,7 @@ The difficulty adjustment change conclusively solves a problem that the Ethereum The use of (block_timestamp - parent_timestamp) // 16 as the main input variable rather than the time difference directly serves to maintain the coarse-grained nature of the algorithm, preventing an excessive incentive to set the timestamp difference to exactly 1 in order to create a block that has slightly higher difficulty and that will thus be guaranteed to beat out any possible forks. The cap of -99 simply serves to ensure that the difficulty does not fall extremely far if two blocks happen to be very far apart in time due to a client security bug or other black-swan issue. -Propagating the sender and value from the parent scope to the child scope makes it much easier to use CALLCODE for a contract to store another address as a mutable source of code and ''pass through'' calls to it, as the child code would execute in essentially the same environment (except for reduced gas and increased callstack depth) as the parent. +Propagating the sender and value from the parent scope to the child scope makes it much easier for a contract to store another address as a mutable source of code and ''pass through'' calls to it, as the child code would execute in essentially the same environment (except for reduced gas and increased callstack depth) as the parent. ==Implementation==