Skip to content

Commit

Permalink
Merge pull request #9 from immutable/features/DATA-1681
Browse files Browse the repository at this point in the history
DATA-1681 Add sighash to blockchain tables
  • Loading branch information
jasadams-imtbl authored Aug 19, 2024
2 parents 5c679d5 + 6986922 commit e05d9fd
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 4 deletions.
15 changes: 14 additions & 1 deletion src/main/java/io/blockchainetl/ethereum/domain/Log.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public class Log {
@Nullable
private String address;

@Nullable
private String sighash;

@Nullable
private String data;

Expand Down Expand Up @@ -96,6 +99,14 @@ public void setAddress(String address) {
this.address = address;
}

public String getSighash() {
return sighash;
}

public void setSighash(String sighash) {
this.sighash = sighash;
}

public String getData() {
return data;
}
Expand Down Expand Up @@ -158,6 +169,7 @@ public boolean equals(Object o) {
Objects.equal(transactionHash, log.transactionHash) &&
Objects.equal(transactionIndex, log.transactionIndex) &&
Objects.equal(address, log.address) &&
Objects.equal(sighash, log.sighash) &&
Objects.equal(data, log.data) &&
Objects.equal(topics, log.topics) &&
Objects.equal(blockTimestamp, log.blockTimestamp) &&
Expand All @@ -168,7 +180,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return Objects.hashCode(type, logIndex, transactionHash, transactionIndex, address, data, topics,
return Objects.hashCode(type, logIndex, transactionHash, transactionIndex, address, sighash, data, topics,
blockTimestamp,
blockNumber, blockHash, chainId);
}
Expand All @@ -181,6 +193,7 @@ public String toString() {
.add("transactionHash", transactionHash)
.add("transactionIndex", transactionIndex)
.add("address", address)
.add("sighash", sighash)
.add("data", data)
.add("topics", topics)
.add("blockTimestamp", blockTimestamp)
Expand Down
17 changes: 15 additions & 2 deletions src/main/java/io/blockchainetl/ethereum/domain/Trace.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public class Trace {
@Nullable
private BigInteger value;

@Nullable
private String sighash;

@Nullable
private String input;

Expand Down Expand Up @@ -142,6 +145,14 @@ public void setValue(BigInteger value) {
this.value = value;
}

public String getSighash() {
return sighash;
}

public void setSighash(String sighash) {
this.sighash = sighash;
}

public String getInput() {
return input;
}
Expand Down Expand Up @@ -277,6 +288,7 @@ public boolean equals(Object o) {
Objects.equal(chainId, trace.chainId) &&
Objects.equal(toAddress, trace.toAddress) &&
Objects.equal(value, trace.value) &&
Objects.equal(sighash,trace.sighash) &&
Objects.equal(input, trace.input) &&
Objects.equal(output, trace.output) &&
Objects.equal(traceType, trace.traceType) &&
Expand All @@ -297,8 +309,8 @@ public boolean equals(Object o) {
@Override
public int hashCode() {
return Objects.hashCode(transactionHash, transactionIndex, fromAddress, toAddress, value,
input, output, traceType, callType, rewardType, gas, gasUsed, subtraces, traceAddress, error, status,
traceId,blockTimestamp, blockNumber, blockHash, chainId);
sighash, input, output, traceType, callType, rewardType, gas, gasUsed, subtraces, traceAddress, error,
status, traceId,blockTimestamp, blockNumber, blockHash, chainId);
}

@Override
Expand All @@ -310,6 +322,7 @@ public String toString() {
.add("fromAddress", fromAddress)
.add("toAddress", toAddress)
.add("value", value)
.add("sighash", sighash)
.add("input", input)
.add("output", output)
.add("traceType", traceType)
Expand Down
15 changes: 14 additions & 1 deletion src/main/java/io/blockchainetl/ethereum/domain/Transaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ public class Transaction {
@JsonProperty("gas_price")
private Long gasPrice;

@Nullable
private String sighash;

@Nullable
private String input;

Expand Down Expand Up @@ -174,6 +177,14 @@ public void setGasPrice(Long gasPrice) {
this.gasPrice = gasPrice;
}

public String getSighash() {
return sighash;
}

public void setSighash(String sighash) {
this.sighash = sighash;
}

public String getInput() {
return input;
}
Expand Down Expand Up @@ -288,6 +299,7 @@ public boolean equals(Object o) {
Objects.equal(value, that.value) &&
Objects.equal(gas, that.gas) &&
Objects.equal(gasPrice, that.gasPrice) &&
Objects.equal(sighash, that.sighash) &&
Objects.equal(input, that.input) &&
Objects.equal(receiptCumulativeGasUsed, that.receiptCumulativeGasUsed) &&
Objects.equal(receiptGasUsed, that.receiptGasUsed) &&
Expand All @@ -307,7 +319,7 @@ public boolean equals(Object o) {
@Override
public int hashCode() {
return Objects.hashCode(type, hash, nonce, transactionIndex, fromAddress, toAddress, value, gas, gasPrice,
input,
sighash, input,
receiptCumulativeGasUsed, receiptGasUsed, receiptContractAddress, receiptRoot, receiptStatus, blockNumber,
blockHash, blockTimestamp, maxFeePerGas, maxPriorityFeePerGas, transactionType, chainId, receiptEffectiveGasPrice);
}
Expand All @@ -324,6 +336,7 @@ public String toString() {
.add("value", value)
.add("gas", gas)
.add("gasPrice", gasPrice)
.add("sighash", sighash)
.add("input", input)
.add("receiptCumulativeGasUsed", receiptCumulativeGasUsed)
.add("receiptGasUsed", receiptGasUsed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ protected void populateTableRowFields(TableRow row, String element) {
row.set("transaction_hash", log.getTransactionHash());
row.set("transaction_index", log.getTransactionIndex());
row.set("address", log.getAddress());
row.set("sighash", log.getSighash());
row.set("data", log.getData());
row.set("topics", log.getTopics());
row.set("block_number", log.getBlockNumber());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ protected void populateTableRowFields(TableRow row, String element) {
row.set("from_address", trace.getFromAddress());
row.set("to_address", trace.getToAddress());
row.set("value", trace.getValue() != null ? trace.getValue().toString() : null);
row.set("sighash", trace.getSighash());
row.set("input", trace.getInput());
row.set("output", trace.getOutput());
row.set("trace_type", trace.getTraceType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ protected void populateTableRowFields(TableRow row, String element) {
row.set("value", transaction.getValue() != null ? transaction.getValue().toString() : null);
row.set("gas", transaction.getGas());
row.set("gas_price", transaction.getGasPrice());
row.set("sighash", transaction.getSighash());
row.set("input", transaction.getInput());
row.set("receipt_cumulative_gas_used", transaction.getReceiptCumulativeGasUsed());
row.set("receipt_gas_used", transaction.getReceiptGasUsed());
Expand Down

0 comments on commit e05d9fd

Please sign in to comment.