Claus Ibsen created CAMEL-27781:
-----------------------------------
Summary: camel-web3j: addresses and topics options are dropped,
ETH_HASHRATE and ETH_PROTOCOL_VERSION cannot be used as operation, and other
issues
Key: CAMEL-27781
URL: https://issues.apache.org/jira/browse/CAMEL-27781
Project: Camel
Issue Type: Bug
Components: camel-web3j
Reporter: Claus Ibsen
Fix For: 4.25.0
Found while improving the option descriptions of camel-web3j for CAMEL-23832
(pull request https://github.com/apache/camel/pull/31132).
These are separate problems of the component; the descriptions change only
documents the current behavior.
h4. 1. addresses and topics options (and String headers) are dropped
{{Web3jProducer}} ethNewFilter, ethGetLogs, shhPost and shhNewFilter call
{{message.getHeader(ADDRESSES/TOPICS, configuration::getAddresses/getTopics,
List.class)}}. The options are Strings and Camel has no String to List
converter, so the value becomes null: the filter has no address or topic,
without an error. Only a List header works.
Proposed change: use {{getAddressesAsList}} / {{getTopicsAsList}} and split a
String header on commas.
h4. 2. operation=ETH_HASHRATE is not found
{{Web3jConstants.ETH_HASHRATE}} = "CamelWeb3jEthHashrate" is both the operation
name and the hashrate header of ETH_SUBMIT_HASHRATE.
Proposed change: an ETH_HASHRATE operation constant and a separate header
constant, keeping the old name as an alias.
h4. 3. operation=ETH_PROTOCOL_VERSION is not found
{{Web3jConstants.ETH_PROTOCOL_VERSION}} = "ethProtocolVersion", unlike the
other operations.
Proposed change: "ETH_PROTOCOL_VERSION" plus the old value as an alias.
h4. 4. SHH_NEW_FILTER uses the data option as the identity
{{shhNewFilter}} passes {{data}} to {{new ShhFilter(data)}}, whose argument is
the {{to}} identity.
Proposed change: use toAddress.
h4. 5. Block numbers and nonce are decimal only; ETH_SUBMIT_WORK sends a
decimal nonce
{{Web3jHelper.toDefaultBlockParameter}} and the nonce conversion use {{new
BigInteger(value)}}, so 0x values fail. {{ethSubmitWork}} reads
{{CamelWeb3jNonce}} as a String, so a BigInteger header becomes a decimal
string while eth_submitWork needs hex.
h4. 6. ethAccounts sets the body before the error check
{{ethAccounts}} calls setBody before checkForError (duplicated call), so on a
JSON-RPC error the body is overwritten.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)