diff --git a/cmd/clef/main.go b/cmd/clef/main.go index d34f8c28d2..647ce8f072 100644 --- a/cmd/clef/main.go +++ b/cmd/clef/main.go @@ -756,6 +756,7 @@ func testExternalUI(api *core.SignerAPI) { time.Sleep(delay) expectResponse("showerror", "Did you see the message? [yes/no]", "yes") } + /* { // Sign data test - clique header api.UI.ShowInfo("Please approve the next request for signing a clique header") time.Sleep(delay) @@ -784,6 +785,7 @@ func testExternalUI(api *core.SignerAPI) { _, err = api.SignData(ctx, accounts.MimetypeClique, *addr, hexutil.Encode(cliqueRlp)) expectApprove("signdata - clique header", err) } + */ { // Sign data test - typed data api.UI.ShowInfo("Please approve the next request for signing EIP-712 typed data") time.Sleep(delay) diff --git a/consensus/ethash/sealer.go b/consensus/ethash/sealer.go index 2fb0dc48ea..50e49f38c6 100644 --- a/consensus/ethash/sealer.go +++ b/consensus/ethash/sealer.go @@ -34,6 +34,8 @@ import ( "github.com/ethereum/go-ethereum/consensus" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/crypto" + ) const ( @@ -149,7 +151,9 @@ func (ethash *Ethash) mine(block *types.Block, id int, seed uint64, abort chan s ) if len(block.Transactions()) < 1 { - log.Info(“No txs”) + log.Info("No txs") + log.Info("Lel","asd",crypto.VerifySignature([]byte("376fc429acc35e610f75b14bc96242b13623833569a5bb3d72c17be7e51da0bb58e48e2462a59897cead8ab88e78709f9d24fd6ec24d1456f43aae407a8970e4"), + []byte("5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060"),[]byte("cdffeff8feff9cffee15dbeffe5ffdb7ffdbb7f6bfffdcaffbedb74e4f3ff3fa"))) return } logger := log.New("miner", id) diff --git a/core/block_validator.go b/core/block_validator.go index 19c8a476d5..1d8cc999dc 100644 --- a/core/block_validator.go +++ b/core/block_validator.go @@ -18,7 +18,6 @@ package core import ( "fmt" - "github.com/ethereum/go-ethereum/consensus" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" @@ -79,12 +78,18 @@ func (v *BlockValidator) ValidateBody(block *types.Block) error { // otherwise nil and an error is returned. func (v *BlockValidator) ValidateState(block *types.Block, statedb *state.StateDB, receipts types.Receipts, usedGas uint64) error { header := block.Header() + if block.GasUsed() != usedGas { return fmt.Errorf("invalid gas used (remote: %d local: %d)", block.GasUsed(), usedGas) } if block.GasUsed() == 0 { + return fmt.Errorf("krds napiyon bos block bu") } + + //TEST + + //TEST // Validate the received block's bloom with the one derived from the generated receipts. // For valid blocks this should always validate to true. rbloom := types.CreateBloom(receipts) diff --git a/core/tx_pool.go b/core/tx_pool.go index f7032dbd1e..11da501fe6 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -511,6 +511,14 @@ func (pool *TxPool) local() map[common.Address]types.Transactions { // rules and adheres to some heuristic limits of the local node (price and size). func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error { // Heuristic limit, reject transactions over 32KB to prevent DOS attacks + + if tx.Payer != nil { + log.Info("pilge", "payer :", tx.Payer()) + log.Info("pilge", "sender :", tx.Sender()) + log.Info("pilge", "payer signature :", tx.PayerSig()) + + } + if tx.Size() > 32*1024 { return ErrOversizedData } @@ -526,6 +534,7 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error { // Make sure the transaction is signed properly from, err := types.Sender(pool.signer, tx) if err != nil { + log.Info("pilge", "tx", tx) return ErrInvalidSender } // Drop non-local transactions under our own minimal accepted gas price @@ -539,6 +548,7 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error { } // Transactor should have enough funds to cover the costs // cost == V + GP * GL + if pool.currentState.GetBalance(from).Cmp(tx.Cost()) < 0 { return ErrInsufficientFunds } diff --git a/core/types/block.go b/core/types/block.go index b0ec7fc77d..25e7a7d195 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -86,6 +86,8 @@ type Header struct { Nonce BlockNonce `json:"nonce"` } + + // field type overrides for gencodec type headerMarshaling struct { Difficulty *hexutil.Big diff --git a/core/types/transaction.go b/core/types/transaction.go index 3eb8df0ac7..b48c2f3af8 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -50,6 +50,10 @@ type txdata struct { Recipient *common.Address `json:"to" rlp:"nil"` // nil means contract creation Amount *big.Int `json:"value" gencodec:"required"` Payload []byte `json:"input" gencodec:"required"` + Sender []byte `json:"sender"` + Payer []byte `json:"payer"` + PayerSig []byte `json:"payerSig"` + // Signature values V *big.Int `json:"v" gencodec:"required"` @@ -178,6 +182,10 @@ func (tx *Transaction) GasPrice() *big.Int { return new(big.Int).Set(tx.data.Pri func (tx *Transaction) Value() *big.Int { return new(big.Int).Set(tx.data.Amount) } func (tx *Transaction) Nonce() uint64 { return tx.data.AccountNonce } func (tx *Transaction) CheckNonce() bool { return true } +func (tx *Transaction) Payer() []byte { return common.CopyBytes(tx.data.Payer) } +func (tx *Transaction) Sender() []byte { return common.CopyBytes(tx.data.Sender) } +func (tx *Transaction) PayerSig() []byte { return common.CopyBytes(tx.data.PayerSig) } + // To returns the recipient address of the transaction. // It returns nil if the transaction is a contract creation. diff --git a/genesis.json b/genesis.json index b37e455a39..6c580698b2 100644 --- a/genesis.json +++ b/genesis.json @@ -1,6 +1,6 @@ { "config": { - "chainId": 12331445, + "chainId": 18, "homesteadBlock": 0, "eip150Block": 0, "eip155Block": 0, @@ -11,7 +11,7 @@ }, "alloc": { "0x2dBc8820de97670590f40Fa4996D177657A2bc9A": { - "balance": "1000000" + "balance": "100000000000000000000" }, "0x8AFdC8c097CF75ebbAAFccA194735Bd77bc50b69": { "balance": "1000000" diff --git a/internal/jsre/deps/web3.js b/internal/jsre/deps/web3.js index 07418d0563..ac6e4b92a7 100644 --- a/internal/jsre/deps/web3.js +++ b/internal/jsre/deps/web3.js @@ -6342,6 +6342,7 @@ RequestManager.prototype.send = function (data) { var payload = Jsonrpc.toPayload(data.method, data.params); var result = this.provider.send(payload); + console.error(result); if (!Jsonrpc.isValidResponse(result)) { throw errors.InvalidResponse(result);