-
Notifications
You must be signed in to change notification settings - Fork 867
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
Log Event Streaming for Plugin API #186
Conversation
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
@@ -176,6 +176,10 @@ public static Address privateContractAddress( | |||
}))); | |||
} | |||
|
|||
public static Address fromPlugin(final org.hyperledger.besu.plugin.data.Address logger) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we do a type check first? There's a strong chance it is a compatible object we just can't staticly prove it.
if (logger instanceof Address) {
return (Address) logger;
} else {
return wrap(BytesValue.fromPlugin(logger));
}
@@ -68,6 +68,10 @@ public static Hash fromHexStringLenient(final String str) { | |||
return new Hash(Bytes32.fromHexStringLenient(str)); | |||
} | |||
|
|||
public static Hash fromPlugin(final org.hyperledger.besu.plugin.data.Hash blockHash) { | |||
return wrap(Bytes32.fromPlugin(blockHash)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same type check here, and all the places we do a wrap.
ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/LogWithMetadata.java
Show resolved
Hide resolved
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
@@ -168,6 +169,10 @@ static Bytes32 fromHexStringStrict(final String str) { | |||
return wrap(BytesValues.fromRawHexString(str, -1, false)); | |||
} | |||
|
|||
static Bytes32 fromPlugin(final UnformattedData data) { | |||
return wrap(data.getByteArray()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shemnon Would we want to leave this one as is since wrap here does runtime verification of the structure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's a Bytes32 it should already have been validated when the instance was made. If we keep wrapping this will put pressure on the garbage collector and I'd like to avoid that as much as possible. Either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah right, sounds good
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
👍 |
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
PR description
Since the blockchain can now produce LogWithMetadata in its events. We create a new listener that the plugin implementation hooks into.
There is also code that converts from the plugin types to our domain types. It's a bit forceful so I'm open to suggestions on how to make that part more elegant within Java's type system.
Fixed Issue(s)
https://pegasys1.atlassian.net/secure/RapidBoard.jspa?rapidView=28&projectKey=PIE&modal=detail&selectedIssue=PIE-1802&assignee=5ce472e018de8f0dc3552e9c&assignee=UNASSIGNED_USER_ID