diff --git a/cmd/puppeth/wizard_genesis.go b/cmd/puppeth/wizard_genesis.go index 18941ec5cb61..40957122bd57 100644 --- a/cmd/puppeth/wizard_genesis.go +++ b/cmd/puppeth/wizard_genesis.go @@ -35,6 +35,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" blockSignerContract "github.com/ethereum/go-ethereum/contracts/blocksigner" + multiSignWalletContract "github.com/ethereum/go-ethereum/contracts/multisigwallet" randomizeContract "github.com/ethereum/go-ethereum/contracts/randomize" validatorContract "github.com/ethereum/go-ethereum/contracts/validator" "github.com/ethereum/go-ethereum/crypto" @@ -171,7 +172,7 @@ func (w *wizard) makeGenesis() { fmt.Println() fmt.Println("What is foundation wallet address? (default = 0x0000000000000000000000000000000000000068)") - genesis.Config.Posv.FoudationWalletAddr = w.readDefaultAddress(common.HexToAddress("0x0000000000000000000000000000000000000068")) + genesis.Config.Posv.FoudationWalletAddr = w.readDefaultAddress(common.HexToAddress(common.FoudationAddr)) // Validator Smart Contract Code pKey, _ := crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291") @@ -205,6 +206,37 @@ func (w *wizard) makeGenesis() { Storage: storage, } + fmt.Println() + fmt.Println("Which accounts are allowed to confirm in MultiSignWallet?") + var owners []common.Address + for { + if address := w.readAddress(); address != nil { + owners = append(owners, *address) + continue + } + if len(owners) > 0 { + break + } + } + fmt.Println() + fmt.Println("How many require for confirm tx in MultiSignWallet? (default = 2)") + required := int64(w.readDefaultInt(2)) + + // MultiSigWallet. + multiSignWalletAddr, _, err := multiSignWalletContract.DeployMultiSigWallet(transactOpts, contractBackend, owners, big.NewInt(required)) + if err != nil { + fmt.Println("Can't deploy MultiSignWallet SMC") + } + contractBackend.Commit() + code, _ = contractBackend.CodeAt(ctx, multiSignWalletAddr, nil) + storage = make(map[common.Hash]common.Hash) + contractBackend.ForEachStorageAt(ctx, multiSignWalletAddr, nil, f) + genesis.Alloc[common.HexToAddress(common.FoudationAddr)] = core.GenesisAccount{ + Balance: big.NewInt(0), + Code: code, + Storage: storage, + } + // Block Signers Smart Contract blockSignerAddress, _, err := blockSignerContract.DeployBlockSigner(transactOpts, contractBackend, big.NewInt(int64(epochNumber))) if err != nil { @@ -237,6 +269,20 @@ func (w *wizard) makeGenesis() { Storage: storage, } + fmt.Println() + fmt.Println("What is swap wallet address for fund 55m tomo?") + swapAddr := w.readDefaultAddress(common.HexToAddress(common.FoudationAddr)) + baseBalance := big.NewInt(0) // 55m + baseBalance.Add(baseBalance, big.NewInt(55*1000*1000)) + baseBalance.Mul(baseBalance, big.NewInt(1000000000000000000)) + subBalance := big.NewInt(0) // 150k + subBalance.Add(subBalance, big.NewInt(150*1000)) + subBalance.Mul(subBalance, big.NewInt(1000000000000000000)) + baseBalance.Sub(baseBalance, subBalance) // 55m - 150k + genesis.Alloc[swapAddr] = core.GenesisAccount{ + Balance: baseBalance, + } + default: log.Crit("Invalid consensus engine choice", "choice", choice) } diff --git a/common/types.go b/common/types.go index 8877b5bd1ac6..02c574e96624 100644 --- a/common/types.go +++ b/common/types.go @@ -33,6 +33,7 @@ const ( BlockSigners = "0x0000000000000000000000000000000000000089" MasternodeVotingSMC = "0x0000000000000000000000000000000000000088" RandomizeSMC = "0x0000000000000000000000000000000000000090" + FoudationAddr = "0x0000000000000000000000000000000000000068" ) var ( diff --git a/contracts/multisigwallet/contract/MultiSigWallet.sol b/contracts/multisigwallet/contract/MultiSigWallet.sol new file mode 100644 index 000000000000..01f5e82479ef --- /dev/null +++ b/contracts/multisigwallet/contract/MultiSigWallet.sol @@ -0,0 +1,370 @@ +pragma solidity ^0.4.21; + + +/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution. +/// @author Stefan George - +contract MultiSigWallet { + + /* + * Events + */ + event Confirmation(address indexed sender, uint indexed transactionId); + event Revocation(address indexed sender, uint indexed transactionId); + event Submission(uint indexed transactionId); + event Execution(uint indexed transactionId); + event ExecutionFailure(uint indexed transactionId); + event Deposit(address indexed sender, uint value); + event OwnerAddition(address indexed owner); + event OwnerRemoval(address indexed owner); + event RequirementChange(uint required); + + /* + * Constants + */ + uint constant public MAX_OWNER_COUNT = 50; + + /* + * Storage + */ + mapping (uint => Transaction) public transactions; + mapping (uint => mapping (address => bool)) public confirmations; + mapping (address => bool) public isOwner; + address[] public owners; + uint public required; + uint public transactionCount; + + struct Transaction { + address destination; + uint value; + bytes data; + bool executed; + } + + /* + * Modifiers + */ + modifier onlyWallet() { + require(msg.sender == address(this)); + _; + } + + modifier ownerDoesNotExist(address owner) { + require(!isOwner[owner]); + _; + } + + modifier ownerExists(address owner) { + require(isOwner[owner]); + _; + } + + modifier transactionExists(uint transactionId) { + require(transactions[transactionId].destination != 0); + _; + } + + modifier confirmed(uint transactionId, address owner) { + require(confirmations[transactionId][owner]); + _; + } + + modifier notConfirmed(uint transactionId, address owner) { + require(!confirmations[transactionId][owner]); + _; + } + + modifier notExecuted(uint transactionId) { + require(!transactions[transactionId].executed); + _; + } + + modifier notNull(address _address) { + require(_address != 0); + _; + } + + modifier validRequirement(uint ownerCount, uint _required) { + require(ownerCount <= MAX_OWNER_COUNT + && _required <= ownerCount + && _required != 0 + && ownerCount != 0); + _; + } + + /// @dev Fallback function allows to deposit ether. + function() + payable + { + if (msg.value > 0) + Deposit(msg.sender, msg.value); + } + + /* + * Public functions + */ + /// @dev Contract constructor sets initial owners and required number of confirmations. + /// @param _owners List of initial owners. + /// @param _required Number of required confirmations. + function MultiSigWallet(address[] _owners, uint _required) + public + validRequirement(_owners.length, _required) + { + for (uint i=0; i<_owners.length; i++) { + require(!isOwner[_owners[i]] && _owners[i] != 0); + isOwner[_owners[i]] = true; + } + owners = _owners; + required = _required; + } + + /// @dev Allows to add a new owner. Transaction has to be sent by wallet. + /// @param owner Address of new owner. + function addOwner(address owner) + public + onlyWallet + ownerDoesNotExist(owner) + notNull(owner) + validRequirement(owners.length + 1, required) + { + isOwner[owner] = true; + owners.push(owner); + OwnerAddition(owner); + } + + /// @dev Allows to remove an owner. Transaction has to be sent by wallet. + /// @param owner Address of owner. + function removeOwner(address owner) + public + onlyWallet + ownerExists(owner) + { + isOwner[owner] = false; + for (uint i=0; i owners.length) + changeRequirement(owners.length); + OwnerRemoval(owner); + } + + /// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet. + /// @param owner Address of owner to be replaced. + /// @param newOwner Address of new owner. + function replaceOwner(address owner, address newOwner) + public + onlyWallet + ownerExists(owner) + ownerDoesNotExist(newOwner) + { + for (uint i=0; i. + +package multisigwallet + +import ( + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/contracts/multisigwallet/contract" + "math/big" +) + +type MultiSigWallet struct { + *contract.MultiSigWalletSession + contractBackend bind.ContractBackend +} + +func NewMultiSigWallet(transactOpts *bind.TransactOpts, contractAddr common.Address, contractBackend bind.ContractBackend) (*MultiSigWallet, error) { + blockSigner, err := contract.NewMultiSigWallet(contractAddr, contractBackend) + if err != nil { + return nil, err + } + + return &MultiSigWallet{ + &contract.MultiSigWalletSession{ + Contract: blockSigner, + TransactOpts: *transactOpts, + }, + contractBackend, + }, nil +} + +func DeployMultiSigWallet(transactOpts *bind.TransactOpts, contractBackend bind.ContractBackend, _owners []common.Address, _required *big.Int) (common.Address, *MultiSigWallet, error) { + blockSignerAddr, _, _, err := contract.DeployMultiSigWallet(transactOpts, contractBackend, _owners, _required) + if err != nil { + return blockSignerAddr, nil, err + } + + blockSigner, err := NewMultiSigWallet(transactOpts, blockSignerAddr, contractBackend) + if err != nil { + return blockSignerAddr, nil, err + } + + return blockSignerAddr, blockSigner, nil +} diff --git a/contracts/utils_test.go b/contracts/utils_test.go index 7ba0e25f2df3..401d17411119 100644 --- a/contracts/utils_test.go +++ b/contracts/utils_test.go @@ -22,11 +22,11 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/consensus/posv" "github.com/ethereum/go-ethereum/contracts/blocksigner" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/consensus/posv" "math/big" "math/rand" "testing" diff --git a/contracts/validator/validator_test.go b/contracts/validator/validator_test.go index 2060057bd6de..f3896db4b8fa 100644 --- a/contracts/validator/validator_test.go +++ b/contracts/validator/validator_test.go @@ -142,7 +142,7 @@ func TestRewardBalance(t *testing.T) { logCaps[i] = &logCap{accounts[randIndex].From.String(), randCap} } - foundationAddr := common.HexToAddress("0x0000000000000000000000000000000000000068") + foundationAddr := common.HexToAddress(common.FoudationAddr) totalReward := new(big.Int).SetInt64(15 * 1000) rewards, err := contracts.GetRewardBalancesRate(foundationAddr, acc3Addr, totalReward, baseValidator) if err != nil { diff --git a/core/genesis.go b/core/genesis.go index 9d8eb279532c..c87460b90834 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -366,7 +366,7 @@ func DeveloperGenesisBlock(period uint64, faucet common.Address) *Genesis { common.BytesToAddress([]byte{6}): {Balance: big.NewInt(1)}, // ECAdd common.BytesToAddress([]byte{7}): {Balance: big.NewInt(1)}, // ECScalarMul common.BytesToAddress([]byte{8}): {Balance: big.NewInt(1)}, // ECPairing - faucet: {Balance: new(big.Int).Sub(new(big.Int).Lsh(big.NewInt(1), 256), big.NewInt(9))}, + faucet: {Balance: new(big.Int).Sub(new(big.Int).Lsh(big.NewInt(1), 256), big.NewInt(9))}, }, } } diff --git a/eth/downloader/api.go b/eth/downloader/api.go index d496fa6a4d4f..581e9aed2498 100644 --- a/eth/downloader/api.go +++ b/eth/downloader/api.go @@ -40,8 +40,8 @@ type PublicDownloaderAPI struct { // installSyncSubscription channel. func NewPublicDownloaderAPI(d *Downloader, m *event.TypeMux) *PublicDownloaderAPI { api := &PublicDownloaderAPI{ - d: d, - mux: m, + d: d, + mux: m, installSyncSubscription: make(chan chan interface{}), uninstallSyncSubscription: make(chan *uninstallSyncSubscriptionRequest), } diff --git a/eth/fetcher/fetcher.go b/eth/fetcher/fetcher.go index fb29a37ec302..65e69d72758d 100644 --- a/eth/fetcher/fetcher.go +++ b/eth/fetcher/fetcher.go @@ -669,7 +669,7 @@ func (f *Fetcher) insert(peer string, block *types.Block) { go f.broadcastBlock(block, true) return } - f.enqueue(peer,newBlock) + f.enqueue(peer, newBlock) return default: // Something went very wrong, drop the peer diff --git a/eth/handler_test.go b/eth/handler_test.go index e336dfa2857a..923df129a026 100644 --- a/eth/handler_test.go +++ b/eth/handler_test.go @@ -242,10 +242,10 @@ func testGetBlockBodies(t *testing.T, protocol int) { available []bool // Availability of explicitly requested blocks expected int // Total number of existing blocks to expect }{ - {1, nil, nil, 1}, // A single random block should be retrievable - {10, nil, nil, 10}, // Multiple random blocks should be retrievable - {limit, nil, nil, limit}, // The maximum possible blocks should be retrievable - {limit + 1, nil, nil, limit}, // No more than the possible block count should be returned + {1, nil, nil, 1}, // A single random block should be retrievable + {10, nil, nil, 10}, // Multiple random blocks should be retrievable + {limit, nil, nil, limit}, // The maximum possible blocks should be retrievable + {limit + 1, nil, nil, limit}, // No more than the possible block count should be returned {0, []common.Hash{pm.blockchain.Genesis().Hash()}, []bool{true}, 1}, // The genesis block should be retrievable {0, []common.Hash{pm.blockchain.CurrentBlock().Hash()}, []bool{true}, 1}, // The chains head block should be retrievable {0, []common.Hash{{}}, []bool{false}, 0}, // A non existent block should not be returned diff --git a/genesis/devnet.json b/genesis/devnet.json index b68c2286d4d7..9662718fdb7d 100644 --- a/genesis/devnet.json +++ b/genesis/devnet.json @@ -25,7 +25,21 @@ "coinbase": "0x0000000000000000000000000000000000000000", "alloc": { "0x487d62d33467c4842c5e54eb370837e4e88bba0f": { - "balance": "0x0000000000000000000000000000000000000000052B7D2DCC80CD2E4000000" + "balance": "0x0000000000000000000000000000000000000000052B7D2DCC80CD2E4000000" + }, + "0000000000000000000000000000000000000068": { + "code": "0x60806040526004361061011c5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c27811461015e578063173825d91461019257806320ea8d86146101b35780632f54bf6e146101cb5780633411c81c1461020057806354741525146102245780637065cb4814610255578063784547a7146102765780638b51d13f1461028e5780639ace38c2146102a6578063a0e67e2b14610361578063a8abe69a146103c6578063b5dc40c3146103eb578063b77bf60014610403578063ba51a6df14610418578063c01a8c8414610430578063c642747414610448578063d74f8edd146104b1578063dc8452cd146104c6578063e20056e6146104db578063ee22610b14610502575b600034111561015c5760408051348152905133917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a25b005b34801561016a57600080fd5b5061017660043561051a565b60408051600160a060020a039092168252519081900360200190f35b34801561019e57600080fd5b5061015c600160a060020a0360043516610542565b3480156101bf57600080fd5b5061015c6004356106b9565b3480156101d757600080fd5b506101ec600160a060020a0360043516610773565b604080519115158252519081900360200190f35b34801561020c57600080fd5b506101ec600435600160a060020a0360243516610788565b34801561023057600080fd5b50610243600435151560243515156107a8565b60408051918252519081900360200190f35b34801561026157600080fd5b5061015c600160a060020a0360043516610814565b34801561028257600080fd5b506101ec600435610939565b34801561029a57600080fd5b506102436004356109bd565b3480156102b257600080fd5b506102be600435610a2c565b6040518085600160a060020a0316600160a060020a031681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b8381101561032357818101518382015260200161030b565b50505050905090810190601f1680156103505780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561036d57600080fd5b50610376610aea565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156103b257818101518382015260200161039a565b505050509050019250505060405180910390f35b3480156103d257600080fd5b5061037660043560243560443515156064351515610b4d565b3480156103f757600080fd5b50610376600435610c86565b34801561040f57600080fd5b50610243610dff565b34801561042457600080fd5b5061015c600435610e05565b34801561043c57600080fd5b5061015c600435610e84565b34801561045457600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610243948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750610f4f9650505050505050565b3480156104bd57600080fd5b50610243610f6e565b3480156104d257600080fd5b50610243610f73565b3480156104e757600080fd5b5061015c600160a060020a0360043581169060243516610f79565b34801561050e57600080fd5b5061015c600435611103565b600380548290811061052857fe5b600091825260209091200154600160a060020a0316905081565b600033301461055057600080fd5b600160a060020a038216600090815260026020526040902054829060ff16151561057957600080fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b600354600019018210156106545782600160a060020a03166003838154811015156105c357fe5b600091825260209091200154600160a060020a03161415610649576003805460001981019081106105f057fe5b60009182526020909120015460038054600160a060020a03909216918490811061061657fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550610654565b60019091019061059c565b60038054600019019061066790826113a3565b5060035460045411156106805760035461068090610e05565b604051600160a060020a038416907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a2505050565b3360008181526002602052604090205460ff1615156106d757600080fd5b60008281526001602090815260408083203380855292529091205483919060ff16151561070357600080fd5b600084815260208190526040902060030154849060ff161561072457600080fd5b6000858152600160209081526040808320338085529252808320805460ff191690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b6000805b60055481101561080d578380156107d5575060008181526020819052604090206003015460ff16155b806107f957508280156107f9575060008181526020819052604090206003015460ff165b15610805576001820191505b6001016107ac565b5092915050565b33301461082057600080fd5b600160a060020a038116600090815260026020526040902054819060ff161561084857600080fd5b81600160a060020a038116151561085e57600080fd5b6003805490506001016004546032821115801561087b5750818111155b801561088657508015155b801561089157508115155b151561089c57600080fd5b600160a060020a038516600081815260026020526040808220805460ff1916600190811790915560038054918201815583527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b01805473ffffffffffffffffffffffffffffffffffffffff191684179055517ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d9190a25050505050565b600080805b6003548110156109b6576000848152600160205260408120600380549192918490811061096757fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff161561099b576001820191505b6004548214156109ae57600192506109b6565b60010161093e565b5050919050565b6000805b600354811015610a2657600083815260016020526040812060038054919291849081106109ea57fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610a1e576001820191505b6001016109c1565b50919050565b6000602081815291815260409081902080546001808301546002808501805487516101009582161595909502600019011691909104601f8101889004880284018801909652858352600160a060020a0390931695909491929190830182828015610ad75780601f10610aac57610100808354040283529160200191610ad7565b820191906000526020600020905b815481529060010190602001808311610aba57829003601f168201915b5050506003909301549192505060ff1684565b60606003805480602002602001604051908101604052809291908181526020018280548015610b4257602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610b24575b505050505090505b90565b606080600080600554604051908082528060200260200182016040528015610b7f578160200160208202803883390190505b50925060009150600090505b600554811015610c0657858015610bb4575060008181526020819052604090206003015460ff16155b80610bd85750848015610bd8575060008181526020819052604090206003015460ff165b15610bfe57808383815181101515610bec57fe5b60209081029091010152600191909101905b600101610b8b565b878703604051908082528060200260200182016040528015610c32578160200160208202803883390190505b5093508790505b86811015610c7b578281815181101515610c4f57fe5b9060200190602002015184898303815181101515610c6957fe5b60209081029091010152600101610c39565b505050949350505050565b606080600080600380549050604051908082528060200260200182016040528015610cbb578160200160208202803883390190505b50925060009150600090505b600354811015610d785760008581526001602052604081206003805491929184908110610cf057fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610d70576003805482908110610d2b57fe5b6000918252602090912001548351600160a060020a0390911690849084908110610d5157fe5b600160a060020a03909216602092830290910190910152600191909101905b600101610cc7565b81604051908082528060200260200182016040528015610da2578160200160208202803883390190505b509350600090505b81811015610df7578281815181101515610dc057fe5b906020019060200201518482815181101515610dd857fe5b600160a060020a03909216602092830290910190910152600101610daa565b505050919050565b60055481565b333014610e1157600080fd5b6003548160328211801590610e265750818111155b8015610e3157508015155b8015610e3c57508115155b1515610e4757600080fd5b60048390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a1505050565b3360008181526002602052604090205460ff161515610ea257600080fd5b6000828152602081905260409020548290600160a060020a03161515610ec757600080fd5b60008381526001602090815260408083203380855292529091205484919060ff1615610ef257600080fd5b6000858152600160208181526040808420338086529252808420805460ff1916909317909255905187927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a3610f4885611103565b5050505050565b6000610f5c8484846112b3565b9050610f6781610e84565b9392505050565b603281565b60045481565b6000333014610f8757600080fd5b600160a060020a038316600090815260026020526040902054839060ff161515610fb057600080fd5b600160a060020a038316600090815260026020526040902054839060ff1615610fd857600080fd5b600092505b6003548310156110695784600160a060020a031660038481548110151561100057fe5b600091825260209091200154600160a060020a0316141561105e578360038481548110151561102b57fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550611069565b600190920191610fdd565b600160a060020a03808616600081815260026020526040808220805460ff1990811690915593881682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a2604051600160a060020a038516907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25050505050565b3360008181526002602052604081205490919060ff16151561112457600080fd5b60008381526001602090815260408083203380855292529091205484919060ff16151561115057600080fd5b600085815260208190526040902060030154859060ff161561117157600080fd5b61117a86610939565b156112ab576000868152602081905260409081902060038101805460ff19166001908117909155815481830154935160028085018054959b50600160a060020a03909316959492939192839285926000199183161561010002919091019091160480156112285780601f106111fd57610100808354040283529160200191611228565b820191906000526020600020905b81548152906001019060200180831161120b57829003601f168201915b505091505060006040518083038185875af192505050156112735760405186907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a26112ab565b60405186907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a260038501805460ff191690555b505050505050565b600083600160a060020a03811615156112cb57600080fd5b60055460408051608081018252600160a060020a0388811682526020808301898152838501898152600060608601819052878152808452959095208451815473ffffffffffffffffffffffffffffffffffffffff19169416939093178355516001830155925180519496509193909261134b9260028501929101906113cc565b50606091909101516003909101805460ff191691151591909117905560058054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a2509392505050565b8154818355818111156113c7576000838152602090206113c791810190830161144a565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061140d57805160ff191683800117855561143a565b8280016001018555821561143a579182015b8281111561143a57825182559160200191906001019061141f565b5061144692915061144a565b5090565b610b4a91905b8082111561144657600081556001016114505600a165627a7a723058205abf7d18955ab47351d41bfbeff39ba447c3c2d681f3180795235e9f260da4ba002", + "storage": { + "0x6bf8ca7f6b60aada520b1de3253eaaf3710d544b731d920ef17a56b4cbdc3f63": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x789778ff79238bb5f54b14a383511c9ddb978f78ba374a6279a4f2922c9e00bf": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x0000000000000000000000000000000000000000000000000000000000000003": "0x0000000000000000000000000000000000000000000000000000000000000003", + "0x15c672e8be449ea3545382416b7b66165e04fbe2448704ac967d8d0b95242c10": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0xc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85c": "0x000000000000000000000000acd713c39726d0e554e476b0845f7f5bec9736d5", + "0xc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b": "0x0000000000000000000000004649befc11b1127bd7e3096f82ba33ae1699bf8b", + "0xc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85d": "0x000000000000000000000000d2e7b36d2d3ff9a627dda7069fa4337825f82f43", + "0x0000000000000000000000000000000000000000000000000000000000000004": "0x0000000000000000000000000000000000000000000000000000000000000002" + }, + "balance": "0x1fc3842bd1f071c00000" }, "0000000000000000000000000000000000000088": { "code": "0x6060604052600436106101115763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166301267951811461011657806302aa9be21461012c57806306a49fce1461014e57806315febd68146101b45780632d15cc04146101dc5780632f9c4bba146101fb578063302b68721461020e5780633477ee2e14610233578063441a3e701461026557806358e7525f1461027e5780636dd7d8ea1461029d578063a9a981a3146102b1578063a9ff959e146102c4578063ae6e43f5146102d7578063b642facd146102f6578063d09f1ab414610315578063d161c76714610328578063d51b9e931461033b578063d55b7dff1461036e578063f8ac9dd514610381575b600080fd5b61012a600160a060020a0360043516610394565b005b341561013757600080fd5b61012a600160a060020a03600435166024356105d7565b341561015957600080fd5b61016161080a565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156101a0578082015183820152602001610188565b505050509050019250505060405180910390f35b34156101bf57600080fd5b6101ca600435610873565b60405190815260200160405180910390f35b34156101e757600080fd5b610161600160a060020a0360043516610897565b341561020657600080fd5b610161610924565b341561021957600080fd5b6101ca600160a060020a03600435811690602435166109a6565b341561023e57600080fd5b6102496004356109d5565b604051600160a060020a03909116815260200160405180910390f35b341561027057600080fd5b61012a6004356024356109fd565b341561028957600080fd5b6101ca600160a060020a0360043516610b64565b61012a600160a060020a0360043516610b83565b34156102bc57600080fd5b6101ca610d40565b34156102cf57600080fd5b6101ca610d46565b34156102e257600080fd5b61012a600160a060020a0360043516610d4c565b341561030157600080fd5b610249600160a060020a0360043516610fe3565b341561032057600080fd5b6101ca611001565b341561033357600080fd5b6101ca611007565b341561034657600080fd5b61035a600160a060020a036004351661100d565b604051901515815260200160405180910390f35b341561037957600080fd5b6101ca611032565b341561038c57600080fd5b6101ca611038565b6005546000903410156103a657600080fd5b600160a060020a038216600090815260016020526040902054829060a060020a900460ff16156103d557600080fd5b600160a060020a03831660009081526001602081905260409091200154610402903463ffffffff61103e16565b9150600380548060010182816104189190611066565b506000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03851617905560606040519081016040908152600160a060020a0333811683526001602080850182905283850187905291871660009081529152208151815473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03919091161781556020820151815490151560a060020a0274ff0000000000000000000000000000000000000000199091161781556040820151600191820155600160a060020a03808616600090815260208381526040808320339094168352600290930190522034905560045461052092509063ffffffff61103e16565b600455600160a060020a038316600090815260026020526040902080546001810161054b8382611066565b506000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff191633600160a060020a038116919091179091557f7635f1d87b47fba9f2b09e56eb4be75cca030e0cb179c1602ac9261d39a8f5c1908434604051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a1505050565b600160a060020a0380831660009081526001602090815260408083203390941683526002909301905290812054839083908190101561061557600080fd5b600160a060020a038281166000908152600160205260409020543382169116141561068357600554600160a060020a038084166000908152600160209081526040808320339094168352600290930190522054610678908363ffffffff61105416565b101561068357600080fd5b600160a060020a038516600090815260016020819052604090912001546106b0908563ffffffff61105416565b600160a060020a0380871660009081526001602081815260408084209283019590955533909316825260020190915220546106f1908563ffffffff61105416565b600160a060020a03808716600090815260016020908152604080832033909416835260029093019052205560095461072f904363ffffffff61103e16565b600160a060020a033316600090815260208181526040808320848452909152902054909350610764908563ffffffff61103e16565b600160a060020a03331660008181526020818152604080832088845280835290832094909455918152905260019081018054909181016107a48382611066565b5060009182526020909120018390557faa0e554f781c3c3b2be110a0557f260f11af9a8aa2c64bc1e7a31dbb21e32fa2338686604051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a15050505050565b61081261108f565b600380548060200260200160405190810160405280929190818152602001828054801561086857602002820191906000526020600020905b8154600160a060020a0316815260019091019060200180831161084a575b505050505090505b90565b33600160a060020a0316600090815260208181526040808320938352929052205490565b61089f61108f565b6002600083600160a060020a0316600160a060020a0316815260200190815260200160002080548060200260200160405190810160405280929190818152602001828054801561091857602002820191906000526020600020905b8154600160a060020a031681526001909101906020018083116108fa575b50505050509050919050565b61092c61108f565b60008033600160a060020a0316600160a060020a0316815260200190815260200160002060010180548060200260200160405190810160405280929190818152602001828054801561086857602002820191906000526020600020905b815481526020019060010190808311610989575050505050905090565b600160a060020a0391821660009081526001602090815260408083209390941682526002909201909152205490565b60038054829081106109e357fe5b600091825260209091200154600160a060020a0316905081565b60008282828211610a0d57600080fd5b4382901015610a1b57600080fd5b600160a060020a03331660009081526020818152604080832085845290915281205411610a4757600080fd5b600160a060020a0333166000908152602081905260409020600101805483919083908110610a7157fe5b60009182526020909120015414610a8757600080fd5b600160a060020a03331660008181526020818152604080832089845280835290832080549084905593835291905260010180549194509085908110610ac857fe5b6000918252602082200155600160a060020a03331683156108fc0284604051600060405180830381858888f193505050501515610b0457600080fd5b7ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5683386856040518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390a15050505050565b600160a060020a03166000908152600160208190526040909120015490565b600654341015610b9257600080fd5b600160a060020a038116600090815260016020526040902054819060a060020a900460ff161515610bc257600080fd5b600160a060020a03821660009081526001602081905260409091200154610bef903463ffffffff61103e16565b600160a060020a0380841660009081526001602081815260408084209283019590955533909316825260020190915220541515610c8157600160a060020a0382166000908152600260205260409020805460018101610c4e8382611066565b506000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff191633600160a060020a03161790555b600160a060020a038083166000908152600160209081526040808320339094168352600290930190522054610cbc903463ffffffff61103e16565b600160a060020a03808416600090815260016020908152604080832033948516845260020190915290819020929092557f66a9138482c99e9baf08860110ef332cc0c23b4a199a53593d8db0fc8f96fbfc918490349051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a15050565b60045481565b60095481565b600160a060020a038181166000908152600160205260408120549091829182918591338216911614610d7d57600080fd5b600160a060020a038516600090815260016020526040902054859060a060020a900460ff161515610dad57600080fd5b600160a060020a0386166000908152600160208190526040909120805474ff000000000000000000000000000000000000000019169055600454610df69163ffffffff61105416565b600455600094505b600354851015610e805785600160a060020a0316600386815481101515610e2157fe5b600091825260209091200154600160a060020a03161415610e75576003805486908110610e4a57fe5b6000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff19169055610e80565b600190940193610dfe565b600160a060020a03808716600081815260016020818152604080842033909616845260028601825283205493909252908190529190910154909450610ecb908563ffffffff61105416565b600160a060020a0380881660009081526001602081815260408084209283019590955533909316825260020190915290812055600854610f11904363ffffffff61103e16565b600160a060020a033316600090815260208181526040808320848452909152902054909350610f46908563ffffffff61103e16565b600160a060020a0333166000818152602081815260408083208884528083529083209490945591815290526001908101805490918101610f868382611066565b5060009182526020909120018390557f4edf3e325d0063213a39f9085522994a1c44bea5f39e7d63ef61260a1e58c6d33387604051600160a060020a039283168152911660208201526040908101905180910390a1505050505050565b600160a060020a039081166000908152600160205260409020541690565b60075481565b60085481565b600160a060020a031660009081526001602052604090205460a060020a900460ff1690565b60055481565b60065481565b60008282018381101561104d57fe5b9392505050565b60008282111561106057fe5b50900390565b81548183558181151161108a5760008381526020902061108a9181019083016110a1565b505050565b60206040519081016040526000815290565b61087091905b808211156110bb57600081556001016110a7565b50905600a165627a7a7230582006ba34ba8a7d4cae8607d3da715fc79d484fd7cb6dd98b06d820244296874eba0029", diff --git a/p2p/discover/table.go b/p2p/discover/table.go index 704b3b612a6a..55fcf96534d9 100644 --- a/p2p/discover/table.go +++ b/p2p/discover/table.go @@ -40,9 +40,9 @@ import ( ) const ( - alpha = 3 // Kademlia concurrency factor + alpha = 3 // Kademlia concurrency factor bucketSize = 200 // Kademlia bucket size - maxReplacements = 10 // Size of per-bucket replacement list + maxReplacements = 10 // Size of per-bucket replacement list // We keep buckets for the upper 1/15 of distances because // it's very unlikely we'll ever encounter a node that's closer. diff --git a/swarm/api/http/error.go b/swarm/api/http/error.go index 9a65412cf997..2f77f2784a31 100644 --- a/swarm/api/http/error.go +++ b/swarm/api/http/error.go @@ -71,7 +71,7 @@ func initErrHandling() { multipleChoicesPage := GetMultipleChoicesErrorPage() //map the codes to the available pages tnames := map[int]string{ - 0: genErrPage, //default + 0: genErrPage, //default http.StatusBadRequest: genErrPage, http.StatusNotFound: notFoundPage, http.StatusMultipleChoices: multipleChoicesPage,