Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CreateTransactionResponse struct never includes contract_address in response #1621

Closed
PurrProof opened this issue Oct 11, 2024 · 3 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@PurrProof
Copy link

PurrProof commented Oct 11, 2024

CreateTransactionResponse Missing Contract Address in Response

The CreateTransactionResponse struct seems to have a field for contract_address:

#[derive(Clone, Serialize, Debug)]
#[serde(rename_all = "PascalCase")]
pub struct CreateTransactionResponse {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub contract_address: Option<Address>,
    pub info: String,
    #[serde(rename = "TranID")]
    pub tran_id: B256,
}

However, in the function create_transaction:

fn create_transaction(
    params: Params,
    node: &Arc<Mutex<Node>>,
) -> Result<CreateTransactionResponse> {
    let response = CreateTransactionResponse {
        contract_address: None,
        info: "Txn processed".to_string(),
        tran_id: transaction_hash.0.into(),
    };
    Ok(response)
}

The response never contains a contract_address, as it's always set to None.

Is this intentional by design, or is it an oversight? I'm aware of the GetContractAddressFromTransactionID API, but this struct suggests the contract address should be included in the response.

Relevant Code:

@PurrProof
Copy link
Author

Linked issue: Zilliqa/gozilliqa-sdk#122

@chetan-zilliqa chetan-zilliqa self-assigned this Oct 29, 2024
@chetan-zilliqa
Copy link
Contributor

Thank you, @PurrProof, for reporting this. We’ve resolved the issue on both the SDK and ZQ2 sides.

@PurrProof
Copy link
Author

PurrProof commented Nov 14, 2024

Thank you, @chetan-zilliqa !

I've found another related issue here:

{
    "id": 0,
    "jsonrpc": "2.0",
    "result": {
        "ContractAddress": "0x7ACb6a641Ad9b3BB9dC947aa019d9B44b4aD572c",
        "Info": "Txn processed",
        "TranID": "0x42d0ddae6ce111353638c12ae2359c84d19e9e59cca751cf5d6d74e0e6bd18d5"
    }
}

There should not be those 0x in the RPC response.
They are not compatible with the go-zilliqa sdk (at least):

TxID: 0x0367a73945cbf76f98a1968fd7d15109008a3a74b03b88f165b8f6f7b2bfe7d3
track 0x0367a73945cbf76f98a1968fd7d15109008a3a74b03b88f165b8f6f7b2bfe7d3
Track error: -20:Txn Hash not Present

It happens because gozilliqa-sdk makes such requests:

{
    "id": 0,
    "jsonrpc": "2.0",
    "method": "GetTransaction",
    "params": [
        "0x42d0ddae6ce111353638c12ae2359c84d19e9e59cca751cf5d6d74e0e6bd18d5"
    ]
}

and receives responses:

{
    "error": {
        "code": -20,
        "message": "Txn Hash not Present"
    },
    "id": 0,
    "jsonrpc": "2.0"
}

Moreover, in all examples of the CreateTransaction there are no those 0x in the response:

zq1
zq2

Should I make new issue from this, or do you prefer just reopen this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants