From c436654be1b7544e099e67fc27990e03f0211645 Mon Sep 17 00:00:00 2001 From: Silas Davis <silas@erisindustries.com> Date: Fri, 5 May 2017 17:36:15 +0100 Subject: [PATCH] rename suicide to selfdestruct to match upstream --- manager/burrow-mint/evm/opcodes/opcodes.go | 4 ++-- manager/burrow-mint/evm/vm.go | 2 +- manager/burrow-mint/state/block_cache.go | 2 +- manager/burrow-mint/state/state_test.go | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manager/burrow-mint/evm/opcodes/opcodes.go b/manager/burrow-mint/evm/opcodes/opcodes.go index d633b5e5..0debc94e 100644 --- a/manager/burrow-mint/evm/opcodes/opcodes.go +++ b/manager/burrow-mint/evm/opcodes/opcodes.go @@ -185,7 +185,7 @@ const ( DELEGATECALL // 0x70 range - other - SUICIDE = 0xff + SELFDESTRUCT = 0xff ) // Since the opcodes aren't all in order we can't use a regular slice @@ -340,7 +340,7 @@ var opCodeToString = map[OpCode]string{ DELEGATECALL: "DELEGATECALL", // 0x70 range - other - SUICIDE: "SUICIDE", + SELFDESTRUCT: "SELFDESTRUCT", } func (o OpCode) String() string { diff --git a/manager/burrow-mint/evm/vm.go b/manager/burrow-mint/evm/vm.go index b5696651..26d4d196 100644 --- a/manager/burrow-mint/evm/vm.go +++ b/manager/burrow-mint/evm/vm.go @@ -907,7 +907,7 @@ func (vm *VM) call(caller, callee *Account, code, input []byte, value int64, gas output = copyslice(ret) return output, nil - case SUICIDE: // 0xFF + case SELFDESTRUCT: // 0xFF addr := stack.Pop() if useGasNegative(gas, GasGetAccount, &err) { return nil, err diff --git a/manager/burrow-mint/state/block_cache.go b/manager/burrow-mint/state/block_cache.go index 3ba8a456..0ec90b73 100644 --- a/manager/burrow-mint/state/block_cache.go +++ b/manager/burrow-mint/state/block_cache.go @@ -224,7 +224,7 @@ func (cache *BlockCache) Sync() { if removed { removed := cache.backend.RemoveAccount([]byte(addrStr)) if !removed { - sanity.PanicCrisis(fmt.Sprintf("Could not remove account to be removed: %X", acc.Address)) + sanity.PanicCrisis(fmt.Sprintf("Could not remove account to be removed: %X", addrStr)) } } else { if acc == nil { diff --git a/manager/burrow-mint/state/state_test.go b/manager/burrow-mint/state/state_test.go index c56966b6..2ecd60ff 100644 --- a/manager/burrow-mint/state/state_test.go +++ b/manager/burrow-mint/state/state_test.go @@ -744,7 +744,7 @@ proof-of-work chain as proof of what happened while they were gone ` } -func TestSuicide(t *testing.T) { +func TestSelfDestruct(t *testing.T) { state, privAccounts, _ := RandGenesisState(3, true, 1000, 1, true, 1000) @@ -756,14 +756,14 @@ func TestSuicide(t *testing.T) { newAcc1 := state.GetAccount(acc1.Address) - // store 0x1 at 0x1, push an address, then suicide :) + // store 0x1 at 0x1, push an address, then self-destruct:) contractCode := []byte{0x60, 0x01, 0x60, 0x01, 0x55, 0x73} contractCode = append(contractCode, acc2.Address...) contractCode = append(contractCode, 0xff) newAcc1.Code = contractCode state.UpdateAccount(newAcc1) - // send call tx with no data, cause suicide + // send call tx with no data, cause self-destruct tx := txs.NewCallTxWithNonce(acc0PubKey, acc1.Address, nil, sendingAmount, 1000, 0, acc0.Sequence+1) tx.Input.Signature = privAccounts[0].Sign(state.ChainID, tx) @@ -773,7 +773,7 @@ func TestSuicide(t *testing.T) { t.Errorf("Got error in executing call transaction, %v", err) } - // if we do it again, we won't get an error, but the suicide + // if we do it again, we won't get an error, but the self-destruct // shouldn't happen twice and the caller should lose fee tx.Input.Sequence += 1 tx.Input.Signature = privAccounts[0].Sign(state.ChainID, tx) -- GitLab