-
Notifications
You must be signed in to change notification settings - Fork 141
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
pass extra bytes directly to precompiles #675
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,9 +71,7 @@ type ConfigurationBlockContext interface { | |
|
||
type BlockContext interface { | ||
ConfigurationBlockContext | ||
// GetPredicateResults returns an byte array result of verifying the predicates | ||
// of the given block. | ||
GetPredicateResultsBytes() []byte | ||
Extra() []byte // Exta returns the Extra field of the block header | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about |
||
} | ||
|
||
type Configurator interface { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,7 +61,8 @@ func handleWarpMessage(accessibleState contract.AccessibleState, input []byte, s | |
warpIndex := int(warpIndexInput) // This conversion is safe even if int is 32 bits because we checked above. | ||
state := accessibleState.GetStateDB() | ||
predicateBytes, exists := state.GetPredicateStorageSlots(ContractAddress, warpIndex) | ||
predicateResultsBytes := accessibleState.GetBlockContext().GetPredicateResultsBytes() | ||
extra := accessibleState.GetBlockContext().Extra() | ||
predicateResultsBytes := predicate.GetPredicateResultBytes(extra) | ||
Comment on lines
+64
to
+65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO, the logic in this file from line 63-72, should be moved somewhere else. ie, this contract is called in the context of some block and some tx, so it should not have to specify the hash of the tx currently being executed to the statedb to query it for the predicates, then query the results from the block header. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed. I'm happy to review that as part of this PR, or as a later one if you'd like. I'm approving in case you choose the latter so please ping me if you want a re-review. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMHO:
These are my observations after looking at just diffs, block context and warp handler. I haven't considered libevm or any other cyclic dependency. LMK if there is another concern that outweighs these considerations (especially parsing). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This approach #679 tries to follow the comment above, let me know your thoughts. |
||
predicateResults, err := predicate.ParseResults(predicateResultsBytes) | ||
if err != nil { | ||
// Note this should never occur as the results are parsed in the block header. | ||
|
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.
I think this PR conflicts with my comment here
If we can extend the BlockContext here, why we avoid using full and parsed types here?