Skip to content
This repository has been archived by the owner. It is now read-only.

Transaction receipt contractAddress injection #3265

Merged
merged 2 commits into from Nov 16, 2017

Conversation

@evertonfraga
Copy link
Member

@evertonfraga evertonfraga commented Nov 9, 2017

What does it do?

Overrides eth_getTransactionReceipt to properly add contractAddress.

It comes in handy as the light client currently doesn't return that for now.

@evertonfraga
Copy link
Member Author

@evertonfraga evertonfraga commented Nov 10, 2017

TODO: add support to batch requests

@ghost
Copy link

@ghost ghost commented Nov 10, 2017

Thank you for this, can you explain how to use it?

@evertonfraga
Copy link
Member Author

@evertonfraga evertonfraga commented Nov 13, 2017

@ni2k10 you can try to build Mist from source, or wait for a release, that will happen ~2 days after this has been merged.

@bliekp
Copy link

@bliekp bliekp commented Nov 13, 2017

Please merge this ASAP. This is a real showstopper and it would be great if this is fixed...

@evertonfraga
Copy link
Member Author

@evertonfraga evertonfraga commented Nov 13, 2017

Copy link
Member

@marcgarreau marcgarreau left a comment

:shipit: successfully resolves hanging contracts in tandem with ethereum/meteor-dapp-wallet#427

@evertonfraga evertonfraga merged commit c58353f into develop Nov 16, 2017
1 check passed
@evertonfraga evertonfraga deleted the transactionReceipt-injection branch Nov 16, 2017
@pokjs
Copy link

@pokjs pokjs commented Dec 29, 2017

@@ -0,0 +1,60 @@
+const _ = global._;
+const BaseProcessor = require('./base');
+const eth = require('ethereumjs-util');
+
+/**

    • Process method: eth_getTransactionReceipt
  • */

+module.exports = class extends BaseProcessor {
+

  • sanitizeRequestPayload(conn, payload, isPartOfABatch) {
  •    return super.sanitizeRequestPayload(conn, payload, isPartOfABatch);
    
  • }
  • async exec(conn, payload) {
  •    const txHash = payload.params[0];
    
  •    // Sends regular eth_getTransactionReceipt request
    
  •    const ret = await conn.socket.send(payload, {
    
  •        fullResult: true
    
  •    });
    
  •    // If that contains a contractAddress already, fine.
    
  •    if (ret.result.result.contractAddress != null) {
    
  •        return ret.result;
    
  •    }
    
  •    // Due to a geth's light client v1 bug, it does not return
    
  •    // contractAddress value on the receipts. Let's fix that.
    
  •    // 1. GET TRANSACTION from AND nonce VALUES
    
  •    const transactionInfo = await conn.socket.send({
    
  •        jsonrpc: '2.0',
    
  •        id: _.uuid(),
    
  •        method: 'eth_getTransactionByHash',
    
  •        params: [txHash]
    
  •    }, { fullResult: true });
    
  •    const fromAddress = transactionInfo.result.result.from;
    
  •    const nonce = parseInt(transactionInfo.result.result.nonce, 16);
    
  •    const possibleContractAddress = `0x${eth.generateAddress(fromAddress, nonce).toString('hex')}`;
    
  •    // 2. GET CODE FROM ADDRESS
    
  •    const contractCode = await conn.socket.send({
    
  •        jsonrpc: '2.0',
    
  •        id: _.uuid(),
    
  •        method: 'eth_getCode',
    
  •        params: [possibleContractAddress, 'latest']
    
  •    }, { fullResult: true });
    
  •    const contractCodeResult = contractCode.result.result;
    
  •    // 3. IF IT EXISTS, ASSIGN TO RETURN VALUE
    
  •    if (contractCodeResult && contractCodeResult.length > 2) {
    
  •        ret.result.result.contractAddress = possibleContractAddress;
    
  •    }
    
  •    return ret.result;
    
  • }
    +};

jnd510
Copy link

jnd510 commented on c44891e Dec 31, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Contract Name:ControllerCompiler Version:v0.4.11+commit.68ef5810

jackpot1136
Copy link

ghost commented on c44891e Dec 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

etherscan the right place. I have been trying to get gas money . I have been trying to get gas money.

1toya999
Copy link

ghost commented on c44891e Feb 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E

Graal46
Copy link

ghost commented on c44891e May 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uuff

@lock
Copy link

@lock lock bot commented Mar 29, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked and limited conversation to collaborators Mar 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants