diff --git a/abe/abe.go b/abe/abe.go deleted file mode 100644 index dfaa52fe9d..0000000000 --- a/abe/abe.go +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright 2017 The Celo Authors -// This file is part of the celo library. -// -// The celo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The celo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the celo library. If not, see . - -package abe - -import ( - "bytes" - "encoding/base64" - "encoding/json" - // "errors" - "fmt" - "net/http" - "regexp" - "time" - - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - // "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/log" -) - -func decryptPhoneNumber(request types.AttestationRequest, account accounts.Account, wallet accounts.Wallet) (string, error) { - phoneNumber, err := wallet.Decrypt(account, request.EncryptedPhone, nil, nil) - if err != nil { - return "", err - } - // TODO(asa): Better validation of phone numbers - r, _ := regexp.Compile(`^\+[0-9]{8,15}$`) - // if !bytes.Equal(crypto.Keccak256(phoneNumber), request.PhoneHash.Bytes()) { - // return string(phoneNumber), errors.New("Phone hash doesn't match decrypted phone number") - //} else - if !r.MatchString(string(phoneNumber)) { - return string(phoneNumber), fmt.Errorf("Decrypted phone number invalid: %s", string(phoneNumber)) - } - return string(phoneNumber), nil -} - -func createAttestationMessage(request types.AttestationRequest, account accounts.Account, wallet accounts.Wallet) (string, error) { - signature, err := wallet.SignHash(account, request.CodeHash.Bytes()) - if err != nil { - return "", err - } - return base64.URLEncoding.EncodeToString(signature), nil -} - -func sendSms(phoneNumber string, message string, account common.Address, issuer common.Address, verificationServiceURL string) error { - values := map[string]string{"phoneNumber": phoneNumber, "message": message, "account": base64.URLEncoding.EncodeToString(account.Bytes()), "issuer": base64.URLEncoding.EncodeToString(issuer.Bytes())} - jsonValue, _ := json.Marshal(values) - var err error - - // Retry 5 times if we fail. - for i := 0; i < 5; i++ { - _, err := http.Post(verificationServiceURL, "application/json", bytes.NewBuffer(jsonValue)) - if err == nil { - break - } - time.Sleep(100 * time.Millisecond) - } - return err -} - -func SendAttestationMessages(receipts []*types.Receipt, block *types.Block, coinbase common.Address, accountManager *accounts.Manager, verificationServiceURL string) { - account := accounts.Account{Address: coinbase} - var wallet accounts.Wallet - var err error - for _, receipt := range receipts { - for _, request := range receipt.AttestationRequests { - if wallet == nil { - wallet, err = accountManager.Find(account) - if err != nil { - log.Error("[Celo] Failed to get account for sms attestation", "err", err) - return - } - } - - if !bytes.Equal(coinbase.Bytes(), request.Verifier.Bytes()) { - continue - } - phoneNumber, err := decryptPhoneNumber(request, account, wallet) - if err != nil { - log.Error("[Celo] Failed to decrypt phone number", "err", err) - continue - } - - message, err := createAttestationMessage(request, account, wallet) - if err != nil { - log.Error("[Celo] Failed to create attestation message", "err", err) - continue - } - - log.Debug(fmt.Sprintf("[Celo] Sending attestation message: \"%s\"", message), nil, nil) - err = sendSms(phoneNumber, message, request.Account, account.Address, verificationServiceURL) - if err != nil { - log.Error("[Celo] Failed to send SMS", "err", err) - } - } - } -} diff --git a/cmd/geth/main.go b/cmd/geth/main.go index c6ad39cec5..0a9a5a905b 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -112,7 +112,6 @@ var ( utils.MinerLegacyExtraDataFlag, utils.MinerRecommitIntervalFlag, utils.MinerNoVerfiyFlag, - utils.MinerVerificationServiceUrlFlag, utils.NATFlag, utils.NoDiscoverFlag, utils.DiscoveryV5Flag, diff --git a/cmd/geth/usage.go b/cmd/geth/usage.go index af9ac07b35..ca1f8d5d78 100644 --- a/cmd/geth/usage.go +++ b/cmd/geth/usage.go @@ -199,7 +199,6 @@ var AppHelpFlagGroups = []flagGroup{ utils.MinerExtraDataFlag, utils.MinerRecommitIntervalFlag, utils.MinerNoVerfiyFlag, - utils.MinerVerificationServiceUrlFlag, }, }, { diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 0a1d2af5c2..1ff0d4b9f2 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -399,11 +399,6 @@ var ( Name: "miner.noverify", Usage: "Disable remote sealing verification", } - MinerVerificationServiceUrlFlag = cli.StringFlag{ - Name: "miner.verificationpool", - Usage: "URL to the verification service to be used by the miner to attest users' phone numbers", - Value: eth.DefaultConfig.MinerVerificationServiceUrl, - } // Account settings UnlockedAccountFlag = cli.StringFlag{ Name: "unlock", @@ -1306,9 +1301,6 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) { if ctx.GlobalIsSet(MinerNoVerfiyFlag.Name) { cfg.MinerNoverify = ctx.Bool(MinerNoVerfiyFlag.Name) } - if ctx.GlobalIsSet(MinerVerificationServiceUrlFlag.Name) { - cfg.MinerVerificationServiceUrl = ctx.GlobalString(MinerVerificationServiceUrlFlag.Name) - } if ctx.GlobalIsSet(VMEnableDebugFlag.Name) { // TODO(fjl): force-enable this in --dev mode cfg.EnablePreimageRecording = ctx.GlobalBool(VMEnableDebugFlag.Name) diff --git a/core/state_processor.go b/core/state_processor.go index 1cee44ed6b..c3456cb57b 100644 --- a/core/state_processor.go +++ b/core/state_processor.go @@ -128,7 +128,6 @@ func ApplyTransaction(config *params.ChainConfig, bc ChainContext, author *commo if msg.To() == nil { receipt.ContractAddress = crypto.CreateAddress(vmenv.Context.Origin, tx.Nonce()) } - receipt.AttestationRequests = vmenv.AttestationRequests // Set the receipt logs and create a bloom for filtering receipt.Logs = statedb.GetLogs(tx.Hash()) receipt.Bloom = types.CreateBloom(types.Receipts{receipt}) diff --git a/core/types/receipt.go b/core/types/receipt.go index b5c154ce1b..1b75132c4c 100644 --- a/core/types/receipt.go +++ b/core/types/receipt.go @@ -20,7 +20,6 @@ import ( "bytes" "fmt" "io" - "math/big" "unsafe" "github.com/ethereum/go-ethereum/common" @@ -43,15 +42,6 @@ const ( ReceiptStatusSuccessful = uint64(1) ) -// AttestationRequest represents a request for verification in the Celo ABE protocol. -type AttestationRequest struct { - PhoneHash common.Hash - CodeHash common.Hash - Account common.Address - Verifier common.Address - EncryptedPhone hexutil.Bytes -} - // Receipt represents the results of a transaction. type Receipt struct { // Consensus fields @@ -61,9 +51,6 @@ type Receipt struct { Bloom Bloom `json:"logsBloom" gencodec:"required"` Logs []*Log `json:"logs" gencodec:"required"` - // Celo fields - AttestationRequests []AttestationRequest - // Implementation fields (don't reorder!) TxHash common.Hash `json:"transactionHash" gencodec:"required"` ContractAddress common.Address `json:"contractAddress"` @@ -93,9 +80,6 @@ type receiptStorageRLP struct { ContractAddress common.Address Logs []*LogForStorage GasUsed uint64 - - // Celo fields - AttestationRequests []AttestationRequest } // NewReceipt creates a barebone transaction receipt, copying the init fields. @@ -109,36 +93,6 @@ func NewReceipt(root []byte, failed bool, cumulativeGasUsed uint64) *Receipt { return r } -// Decode an AttestationRequest from raw input bytes. -// Input is expected to be encoded in the following manner: -// input[0:32]: bytes32 phoneHash -// input[32:64]: bytes32 codeHash -// input[64:96]: address account -// input[96:128]: address verifier -// input[128:160]: s - uint256 start of encryptedPhone data -// input[s:s+32]: l - length of encryptedPhoneData -// input[s+32:s+32+l]: bytes encryptedPhone -func DecodeAttestationRequest(input []byte) (AttestationRequest, error) { - var v AttestationRequest - v.PhoneHash = common.BytesToHash(input[0:32]) - v.Account = common.BytesToAddress(input[64:96]) - v.CodeHash = common.BytesToHash(input[32:64]) - v.Verifier = common.BytesToAddress(input[96:128]) - - encodedEncryptedPhoneStart := big.NewInt(0) - encodedEncryptedPhoneLen := big.NewInt(0) - - encodedEncryptedPhoneStart.SetBytes(input[128:160]) - encryptedPhoneStart := encodedEncryptedPhoneStart.Uint64() - - encodedEncryptedPhoneLen.SetBytes(input[encryptedPhoneStart:(encryptedPhoneStart + 32)]) - encryptedPhoneLen := encodedEncryptedPhoneLen.Uint64() - - // TODO(asa): Consider validating the length of EncryptedPhone - v.EncryptedPhone = input[(encryptedPhoneStart + 32):(encryptedPhoneStart + 32 + encryptedPhoneLen)] - return v, nil -} - // EncodeRLP implements rlp.Encoder, and flattens the consensus fields of a receipt // into an RLP stream. If no post state is present, byzantium fork is assumed. func (r *Receipt) EncodeRLP(w io.Writer) error { @@ -203,14 +157,13 @@ type ReceiptForStorage Receipt // into an RLP stream. func (r *ReceiptForStorage) EncodeRLP(w io.Writer) error { enc := &receiptStorageRLP{ - PostStateOrStatus: (*Receipt)(r).statusEncoding(), - CumulativeGasUsed: r.CumulativeGasUsed, - Bloom: r.Bloom, - TxHash: r.TxHash, - ContractAddress: r.ContractAddress, - Logs: make([]*LogForStorage, len(r.Logs)), - GasUsed: r.GasUsed, - AttestationRequests: r.AttestationRequests, + PostStateOrStatus: (*Receipt)(r).statusEncoding(), + CumulativeGasUsed: r.CumulativeGasUsed, + Bloom: r.Bloom, + TxHash: r.TxHash, + ContractAddress: r.ContractAddress, + Logs: make([]*LogForStorage, len(r.Logs)), + GasUsed: r.GasUsed, } for i, log := range r.Logs { enc.Logs[i] = (*LogForStorage)(log) @@ -238,8 +191,6 @@ func (r *ReceiptForStorage) DecodeRLP(s *rlp.Stream) error { // Assign the implementation fields r.TxHash, r.ContractAddress, r.GasUsed = dec.TxHash, dec.ContractAddress, dec.GasUsed - // Assign the celo fields - r.AttestationRequests = dec.AttestationRequests return nil } diff --git a/core/vm/contracts.go b/core/vm/contracts.go index f6447a921f..1802ff7576 100644 --- a/core/vm/contracts.go +++ b/core/vm/contracts.go @@ -26,7 +26,6 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto/bls" "github.com/ethereum/go-ethereum/crypto/bn256" @@ -53,7 +52,6 @@ var PrecompiledContractsHomestead = map[common.Address]PrecompiledContract{ } var CeloPrecompiledContractsAddressOffset = byte(0xff) -var requestAttestationAddress = common.BytesToAddress(append([]byte{0}, CeloPrecompiledContractsAddressOffset)) var transferAddress = common.BytesToAddress(append([]byte{0}, (CeloPrecompiledContractsAddressOffset - 2))) var fractionMulExpAddress = common.BytesToAddress(append([]byte{0}, (CeloPrecompiledContractsAddressOffset - 3))) var proofOfPossessionAddress = common.BytesToAddress(append([]byte{0}, (CeloPrecompiledContractsAddressOffset - 4))) @@ -74,13 +72,12 @@ var PrecompiledContractsByzantium = map[common.Address]PrecompiledContract{ common.BytesToAddress([]byte{8}): &bn256Pairing{}, // Celo Precompiled Contracts - requestAttestationAddress: &requestAttestation{}, - transferAddress: &transfer{}, - fractionMulExpAddress: &fractionMulExp{}, - proofOfPossessionAddress: &proofOfPossession{}, - getValidatorAddress: &getValidator{}, - numberValidatorsAddress: &numberValidators{}, - epochSizeAddress: &epochSize{}, + transferAddress: &transfer{}, + fractionMulExpAddress: &fractionMulExp{}, + proofOfPossessionAddress: &proofOfPossession{}, + getValidatorAddress: &getValidator{}, + numberValidatorsAddress: &numberValidators{}, + epochSizeAddress: &epochSize{}, } // RunPrecompiledContract runs and evaluates the output of a precompiled contract. @@ -431,40 +428,6 @@ func (c *bn256Pairing) Run(input []byte, caller common.Address, evm *EVM, gas ui return false32Byte, gas, nil } -// Requesting attestation in the Celo address based encryption protocol is implemented as a -// native contract. -type requestAttestation struct{} - -func (c *requestAttestation) RequiredGas(input []byte) uint64 { - // TODO(asa): Charge less gas when the phone number is invalid. - return params.AttestationRequestGas -} - -// Ensures that the input is parsable as a AttestationRequest. -func (c *requestAttestation) Run(input []byte, caller common.Address, evm *EVM, gas uint64) ([]byte, uint64, error) { - gas, err := debitRequiredGas(c, input, gas) - if err != nil { - return nil, gas, err - } - - abeAddress, err := GetRegisteredAddressWithEvm(params.AttestationsRegistryId, evm) - - if err != nil { - return nil, gas, err - } - - if caller != *abeAddress { - return nil, gas, fmt.Errorf("Unable to call requestAttestation from unpermissioned address") - } - _, err = types.DecodeAttestationRequest(input) - if err != nil { - log.Error("[Celo] Unable to decode verification request", "err", err) - return nil, gas, err - } else { - return input, gas, nil - } -} - // Native transfer contract to make Celo Gold ERC20 compatible. type transfer struct{} diff --git a/core/vm/evm.go b/core/vm/evm.go index 00ef099ab8..ffd3ad783a 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -140,9 +140,6 @@ type EVM struct { // available gas is calculated in gasCall* according to the 63/64 rule and later // applied in opCall*. callGasTemp uint64 - // Maintains a queue of Celo attestation requests - // TODO(asa): Save this in StateDB - AttestationRequests []types.AttestationRequest DontMeterGas bool } diff --git a/core/vm/instructions.go b/core/vm/instructions.go index 6e3807c084..788e8bd779 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -765,12 +765,7 @@ func opCall(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memory gas += params.CallStipend } ret, returnGas, err := interpreter.evm.Call(contract, toAddr, args, gas, value) - // TODO(asa): Consider passing the EVM to RunPrecompiledContract instead. - if toAddr == requestAttestationAddress && err == nil { - // This should never return an error as we would have returned an error in Call. - request, _ := types.DecodeAttestationRequest(ret) - interpreter.evm.AttestationRequests = append(interpreter.evm.AttestationRequests, request) - } + if err != nil { stack.push(interpreter.intPool.getZero()) } else { diff --git a/eth/backend.go b/eth/backend.go index a62d2efa95..a52e9b60c3 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -197,7 +197,7 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) { istanbul.SetChain(eth.blockchain, eth.blockchain.CurrentBlock) } - eth.miner = miner.New(eth, eth.chainConfig, eth.EventMux(), eth.engine, config.MinerRecommit, config.MinerGasFloor, config.MinerGasCeil, eth.isLocalBlock, config.MinerVerificationServiceUrl, &chainDb) + eth.miner = miner.New(eth, eth.chainConfig, eth.EventMux(), eth.engine, config.MinerRecommit, config.MinerGasFloor, config.MinerGasCeil, eth.isLocalBlock, &chainDb) eth.miner.SetExtra(makeExtraData(config.MinerExtraData)) eth.APIBackend = &EthAPIBackend{eth} diff --git a/eth/config.go b/eth/config.go index 3a7c83cdfd..f4d6c9584d 100644 --- a/eth/config.go +++ b/eth/config.go @@ -42,16 +42,15 @@ var DefaultConfig = Config{ DatasetsInMem: 1, DatasetsOnDisk: 2, }, - NetworkId: 1, - LightPeers: 99, - LightServ: 50, - DatabaseCache: 768, - TrieTimeout: 60 * time.Minute, - MinerGasFloor: 8000000, - MinerGasCeil: 8000000, - MinerGasPrice: big.NewInt(1), - MinerRecommit: 3 * time.Second, - MinerVerificationServiceUrl: "https://mining-pool.celo.org/v0.1/sms", + NetworkId: 1, + LightPeers: 99, + LightServ: 50, + DatabaseCache: 768, + TrieTimeout: 60 * time.Minute, + MinerGasFloor: 8000000, + MinerGasCeil: 8000000, + MinerGasPrice: big.NewInt(1), + MinerRecommit: 3 * time.Second, TxPool: core.DefaultTxPoolConfig, @@ -104,14 +103,13 @@ type Config struct { TrieTimeout time.Duration // Mining-related options - MinerNotify []string `toml:",omitempty"` - MinerExtraData []byte `toml:",omitempty"` - MinerGasFloor uint64 - MinerGasCeil uint64 - MinerGasPrice *big.Int - MinerRecommit time.Duration - MinerNoverify bool - MinerVerificationServiceUrl string + MinerNotify []string `toml:",omitempty"` + MinerExtraData []byte `toml:",omitempty"` + MinerGasFloor uint64 + MinerGasCeil uint64 + MinerGasPrice *big.Int + MinerRecommit time.Duration + MinerNoverify bool // Ethash options Ethash ethash.Config diff --git a/miner/miner.go b/miner/miner.go index e0786386e5..7bdc4ac959 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -55,13 +55,13 @@ type Miner struct { shouldStart int32 // should start indicates whether we should start after sync } -func New(eth Backend, config *params.ChainConfig, mux *event.TypeMux, engine consensus.Engine, recommit time.Duration, gasFloor, gasCeil uint64, isLocalBlock func(block *types.Block) bool, verificationService string, db *ethdb.Database) *Miner { +func New(eth Backend, config *params.ChainConfig, mux *event.TypeMux, engine consensus.Engine, recommit time.Duration, gasFloor, gasCeil uint64, isLocalBlock func(block *types.Block) bool, db *ethdb.Database) *Miner { miner := &Miner{ eth: eth, mux: mux, engine: engine, exitCh: make(chan struct{}), - worker: newWorker(config, engine, eth, mux, recommit, gasFloor, gasCeil, isLocalBlock, verificationService, db), + worker: newWorker(config, engine, eth, mux, recommit, gasFloor, gasCeil, isLocalBlock, db), canStart: 1, } go miner.update() diff --git a/miner/worker.go b/miner/worker.go index c9e335bc11..c895cdc4f4 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -25,7 +25,6 @@ import ( "time" mapset "github.com/deckarep/golang-set" - "github.com/ethereum/go-ethereum/abe" "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/consensus" @@ -189,41 +188,35 @@ type worker struct { fullTaskHook func() // Method to call before pushing the full sealing task. resubmitHook func(time.Duration, time.Duration) // Method to call upon updating resubmitting interval. - // Verification Service - verificationService string - verificationMu sync.RWMutex - lastBlockVerified uint64 - // Needed for randomness db *ethdb.Database } -func newWorker(config *params.ChainConfig, engine consensus.Engine, eth Backend, mux *event.TypeMux, recommit time.Duration, gasFloor, gasCeil uint64, isLocalBlock func(*types.Block) bool, verificationService string, db *ethdb.Database) *worker { +func newWorker(config *params.ChainConfig, engine consensus.Engine, eth Backend, mux *event.TypeMux, recommit time.Duration, gasFloor, gasCeil uint64, isLocalBlock func(*types.Block) bool, db *ethdb.Database) *worker { worker := &worker{ - config: config, - engine: engine, - eth: eth, - mux: mux, - chain: eth.BlockChain(), - gasFloor: gasFloor, - gasCeil: gasCeil, - isLocalBlock: isLocalBlock, - verificationService: verificationService, - localUncles: make(map[common.Hash]*types.Block), - remoteUncles: make(map[common.Hash]*types.Block), - unconfirmed: newUnconfirmedBlocks(eth.BlockChain(), miningLogAtDepth), - pendingTasks: make(map[common.Hash]*task), - txsCh: make(chan core.NewTxsEvent, txChanSize), - chainHeadCh: make(chan core.ChainHeadEvent, chainHeadChanSize), - chainSideCh: make(chan core.ChainSideEvent, chainSideChanSize), - newWorkCh: make(chan *newWorkReq), - taskCh: make(chan *task), - resultCh: make(chan *types.Block, resultQueueSize), - exitCh: make(chan struct{}), - startCh: make(chan struct{}, 1), - resubmitIntervalCh: make(chan time.Duration), - resubmitAdjustCh: make(chan *intervalAdjust, resubmitAdjustChanSize), - db: db, + config: config, + engine: engine, + eth: eth, + mux: mux, + chain: eth.BlockChain(), + gasFloor: gasFloor, + gasCeil: gasCeil, + isLocalBlock: isLocalBlock, + localUncles: make(map[common.Hash]*types.Block), + remoteUncles: make(map[common.Hash]*types.Block), + unconfirmed: newUnconfirmedBlocks(eth.BlockChain(), miningLogAtDepth), + pendingTasks: make(map[common.Hash]*task), + txsCh: make(chan core.NewTxsEvent, txChanSize), + chainHeadCh: make(chan core.ChainHeadEvent, chainHeadChanSize), + chainSideCh: make(chan core.ChainSideEvent, chainSideChanSize), + newWorkCh: make(chan *newWorkReq), + taskCh: make(chan *task), + resultCh: make(chan *types.Block, resultQueueSize), + exitCh: make(chan struct{}), + startCh: make(chan struct{}, 1), + resubmitIntervalCh: make(chan time.Duration), + resubmitAdjustCh: make(chan *intervalAdjust, resubmitAdjustChanSize), + db: db, } // Subscribe NewTxsEvent for tx pool worker.txsSub = eth.TxPool().SubscribeNewTxsEvent(worker.txsCh) @@ -396,22 +389,6 @@ func (w *worker) newWorkLoop(recommit time.Duration) { timestamp = time.Now().Unix() commit(false, commitInterruptNewHead) - processAttestationRequestsUpTo := func(number uint64) { - w.verificationMu.Lock() - defer w.verificationMu.Unlock() - for blockNum := number; blockNum > w.lastBlockVerified; blockNum-- { - block := w.chain.GetBlockByNumber(number) - if now := time.Now().Unix(); block.Time().Uint64()+params.AttestationExpirySeconds >= uint64(now) { - receipts := w.chain.GetReceiptsByHash(block.Hash()) - abe.SendAttestationMessages(receipts, block, w.coinbase, w.eth.AccountManager(), w.verificationService) - } else { - break - } - } - w.lastBlockVerified = number - } - go processAttestationRequestsUpTo(headNumber) - case <-timer.C: // If mining is running resubmit a new work cycle periodically to pull in // higher priced transactions. Disable this overhead for pending blocks. diff --git a/miner/worker_test.go b/miner/worker_test.go index 971565f532..61237809c3 100644 --- a/miner/worker_test.go +++ b/miner/worker_test.go @@ -58,8 +58,6 @@ var ( testUserKey, _ = crypto.GenerateKey() testUserAddress = crypto.PubkeyToAddress(testUserKey.PublicKey) - testVerificationService = "" - // Test transactions pendingTxs []*types.Transaction newTxs []*types.Transaction @@ -178,7 +176,7 @@ func newTestWorker(t *testing.T, chainConfig *params.ChainConfig, engine consens if shouldAddPendingTxs { backend.txPool.AddLocals(pendingTxs) } - w := newWorker(chainConfig, engine, backend, new(event.TypeMux), time.Second, params.DefaultGasLimit, params.DefaultGasLimit, nil, testVerificationService, &backend.db) + w := newWorker(chainConfig, engine, backend, new(event.TypeMux), time.Second, params.DefaultGasLimit, params.DefaultGasLimit, nil, &backend.db) w.setEtherbase(testBankAddress) return w, backend } diff --git a/params/protocol_params.go b/params/protocol_params.go index 72d80b57ae..81363bc174 100644 --- a/params/protocol_params.go +++ b/params/protocol_params.go @@ -90,8 +90,6 @@ const ( Bn256PairingPerPointGas uint64 = 80000 // Per-point price for an elliptic curve pairing check // Celo precompiled contracts - // TODO(asa): Figure out what the actual gas cost of this contract should be. - AttestationRequestGas uint64 = 3000 // Per-message price for sending an SMS. Not an accurate representation of the real cost of sending an SMS. // TODO: make this cost variable- https://github.com/celo-org/geth/issues/250 FractionMulExpGas uint64 = 1050 // Cost of performing multiplication and exponentiation of fractions to an exponent of up to 10^3. // TODO(kobigurk): Figure out what the actual gas cost of this contract should be. @@ -132,10 +130,6 @@ func makeRegistryId(contractName string) [32]byte { return id } -const ( - AttestationExpirySeconds uint64 = 86400 // One day. The Attestations contract will expire verifications well before this, but this prevents us from processing very old requests whenever we go offline and resync. -) - const ( // Default intrinsic gas cost of transactions paying for gas in alternative currencies. IntrinsicGasForAlternativeGasCurrency uint64 = 134000